migrated to git

This commit is contained in:
Francesco Mangiacrapa 2020-04-08 12:59:38 +02:00
parent 856afe6247
commit c64f7c3ce6
14 changed files with 545 additions and 1519 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target/

311
LICENSE.md Normal file
View File

@ -0,0 +1,311 @@
#European Union Public Licence V.1.1
##*EUPL © the European Community 2007*
This **European Union Public Licence** (the **“EUPL”**) applies to the Work or Software
(as defined below) which is provided under the terms of this Licence. Any use of
the Work, other than as authorised under this Licence is prohibited (to the
extent such use is covered by a right of the copyright holder of the Work).
The Original Work is provided under the terms of this Licence when the Licensor
(as defined below) has placed the following notice immediately following the
copyright notice for the Original Work:
**Licensed under the EUPL V.1.1**
or has expressed by any other mean his willingness to license under the EUPL.
##1. Definitions
In this Licence, the following terms have the following meaning:
- The Licence: this Licence.
- The Original Work or the Software: the software distributed and/or
communicated by the Licensor under this Licence, available as Source Code and
also as Executable Code as the case may be.
- Derivative Works: the works or software that could be created by the Licensee,
based upon the Original Work or modifications thereof. This Licence does not
define the extent of modification or dependence on the Original Work required
in order to classify a work as a Derivative Work; this extent is determined by
copyright law applicable in the country mentioned in Article 15.
- The Work: the Original Work and/or its Derivative Works.
- The Source Code: the human-readable form of the Work which is the most
convenient for people to study and modify.
- The Executable Code: any code which has generally been compiled and which is
meant to be interpreted by a computer as a program.
- The Licensor: the natural or legal person that distributes and/or communicates
the Work under the Licence.
- Contributor(s): any natural or legal person who modifies the Work under the
Licence, or otherwise contributes to the creation of a Derivative Work.
- The Licensee or “You”: any natural or legal person who makes any usage of the
Software under the terms of the Licence.
- Distribution and/or Communication: any act of selling, giving, lending,
renting, distributing, communicating, transmitting, or otherwise making
available, on-line or off-line, copies of the Work or providing access to its
essential functionalities at the disposal of any other natural or legal
person.
##2. Scope of the rights granted by the Licence
The Licensor hereby grants You a world-wide, royalty-free, non-exclusive,
sub-licensable licence to do the following, for the duration of copyright vested
in the Original Work:
- use the Work in any circumstance and for all usage, reproduce the Work, modify
- the Original Work, and make Derivative Works based upon the Work, communicate
- to the public, including the right to make available or display the Work or
- copies thereof to the public and perform publicly, as the case may be, the
- Work, distribute the Work or copies thereof, lend and rent the Work or copies
- thereof, sub-license rights in the Work or copies thereof.
Those rights can be exercised on any media, supports and formats, whether now
known or later invented, as far as the applicable law permits so.
In the countries where moral rights apply, the Licensor waives his right to
exercise his moral right to the extent allowed by law in order to make effective
the licence of the economic rights here above listed.
The Licensor grants to the Licensee royalty-free, non exclusive usage rights to
any patents held by the Licensor, to the extent necessary to make use of the
rights granted on the Work under this Licence.
##3. Communication of the Source Code
The Licensor may provide the Work either in its Source Code form, or as
Executable Code. If the Work is provided as Executable Code, the Licensor
provides in addition a machine-readable copy of the Source Code of the Work
along with each copy of the Work that the Licensor distributes or indicates, in
a notice following the copyright notice attached to the Work, a repository where
the Source Code is easily and freely accessible for as long as the Licensor
continues to distribute and/or communicate the Work.
##4. Limitations on copyright
Nothing in this Licence is intended to deprive the Licensee of the benefits from
any exception or limitation to the exclusive rights of the rights owners in the
Original Work or Software, of the exhaustion of those rights or of other
applicable limitations thereto.
##5. Obligations of the Licensee
The grant of the rights mentioned above is subject to some restrictions and
obligations imposed on the Licensee. Those obligations are the following:
Attribution right: the Licensee shall keep intact all copyright, patent or
trademarks notices and all notices that refer to the Licence and to the
disclaimer of warranties. The Licensee must include a copy of such notices and a
copy of the Licence with every copy of the Work he/she distributes and/or
communicates. The Licensee must cause any Derivative Work to carry prominent
notices stating that the Work has been modified and the date of modification.
Copyleft clause: If the Licensee distributes and/or communicates copies of the
Original Works or Derivative Works based upon the Original Work, this
Distribution and/or Communication will be done under the terms of this Licence
or of a later version of this Licence unless the Original Work is expressly
distributed only under this version of the Licence. The Licensee (becoming
Licensor) cannot offer or impose any additional terms or conditions on the Work
or Derivative Work that alter or restrict the terms of the Licence.
Compatibility clause: If the Licensee Distributes and/or Communicates Derivative
Works or copies thereof based upon both the Original Work and another work
licensed under a Compatible Licence, this Distribution and/or Communication can
be done under the terms of this Compatible Licence. For the sake of this clause,
“Compatible Licence” refers to the licences listed in the appendix attached to
this Licence. Should the Licensees obligations under the Compatible Licence
conflict with his/her obligations under this Licence, the obligations of the
Compatible Licence shall prevail.
Provision of Source Code: When distributing and/or communicating copies of the
Work, the Licensee will provide a machine-readable copy of the Source Code or
indicate a repository where this Source will be easily and freely available for
as long as the Licensee continues to distribute and/or communicate the Work.
Legal Protection: This Licence does not grant permission to use the trade names,
trademarks, service marks, or names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the copyright notice.
##6. Chain of Authorship
The original Licensor warrants that the copyright in the Original Work granted
hereunder is owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each Contributor warrants that the copyright in the modifications he/she brings
to the Work are owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each time You accept the Licence, the original Licensor and subsequent
Contributors grant You a licence to their contributions to the Work, under the
terms of this Licence.
##7. Disclaimer of Warranty
The Work is a work in progress, which is continuously improved by numerous
contributors. It is not a finished work and may therefore contain defects or
“bugs” inherent to this type of software development.
For the above reason, the Work is provided under the Licence on an “as is” basis
and without warranties of any kind concerning the Work, including without
limitation merchantability, fitness for a particular purpose, absence of defects
or errors, accuracy, non-infringement of intellectual property rights other than
copyright as stated in Article 6 of this Licence.
This disclaimer of warranty is an essential part of the Licence and a condition
for the grant of any rights to the Work.
##8. Disclaimer of Liability
Except in the cases of wilful misconduct or damages directly caused to natural
persons, the Licensor will in no event be liable for any direct or indirect,
material or moral, damages of any kind, arising out of the Licence or of the use
of the Work, including without limitation, damages for loss of goodwill, work
stoppage, computer failure or malfunction, loss of data or any commercial
damage, even if the Licensor has been advised of the possibility of such
damage. However, the Licensor will be liable under statutory product liability
laws as far such laws apply to the Work.
##9. Additional agreements
While distributing the Original Work or Derivative Works, You may choose to
conclude an additional agreement to offer, and charge a fee for, acceptance of
support, warranty, indemnity, or other liability obligations and/or services
consistent with this Licence. However, in accepting such obligations, You may
act only on your own behalf and on your sole responsibility, not on behalf of
the original Licensor or any other Contributor, and only if You agree to
indemnify, defend, and hold each Contributor harmless for any liability incurred
by, or claims asserted against such Contributor by the fact You have accepted
any such warranty or additional liability.
##10. Acceptance of the Licence
The provisions of this Licence can be accepted by clicking on an icon “I agree”
placed under the bottom of a window displaying the text of this Licence or by
affirming consent in any other similar way, in accordance with the rules of
applicable law. Clicking on that icon indicates your clear and irrevocable
acceptance of this Licence and all of its terms and conditions.
Similarly, you irrevocably accept this Licence and all of its terms and
conditions by exercising any rights granted to You by Article 2 of this Licence,
such as the use of the Work, the creation by You of a Derivative Work or the
Distribution and/or Communication by You of the Work or copies thereof.
##11. Information to the public
In case of any Distribution and/or Communication of the Work by means of
electronic communication by You (for example, by offering to download the Work
from a remote location) the distribution channel or media (for example, a
website) must at least provide to the public the information requested by the
applicable law regarding the Licensor, the Licence and the way it may be
accessible, concluded, stored and reproduced by the Licensee.
##12. Termination of the Licence
The Licence and the rights granted hereunder will terminate automatically upon
any breach by the Licensee of the terms of the Licence.
Such a termination will not terminate the licences of any person who has
received the Work from the Licensee under the Licence, provided such persons
remain in full compliance with the Licence.
##13. Miscellaneous
Without prejudice of Article 9 above, the Licence represents the complete
agreement between the Parties as to the Work licensed hereunder.
If any provision of the Licence is invalid or unenforceable under applicable
law, this will not affect the validity or enforceability of the Licence as a
whole. Such provision will be construed and/or reformed so as necessary to make
it valid and enforceable.
The European Commission may publish other linguistic versions and/or new
versions of this Licence, so far this is required and reasonable, without
reducing the scope of the rights granted by the Licence. New versions of the
Licence will be published with a unique version number.
All linguistic versions of this Licence, approved by the European Commission,
have identical value. Parties can take advantage of the linguistic version of
their choice.
##14. Jurisdiction
Any litigation resulting from the interpretation of this License, arising
between the European Commission, as a Licensor, and any Licensee, will be
subject to the jurisdiction of the Court of Justice of the European Communities,
as laid down in article 238 of the Treaty establishing the European Community.
Any litigation arising between Parties, other than the European Commission, and
resulting from the interpretation of this License, will be subject to the
exclusive jurisdiction of the competent court where the Licensor resides or
conducts its primary business.
##15. Applicable Law
This Licence shall be governed by the law of the European Union country where
the Licensor resides or has his registered office.
This licence shall be governed by the Belgian law if:
- a litigation arises between the European Commission, as a Licensor, and any
- Licensee; the Licensor, other than the European Commission, has no residence
- or registered office inside a European Union country.
---
##Appendix
**“Compatible Licences”** according to article 5 EUPL are:
- GNU General Public License (GNU GPL) v. 2
- Open Software License (OSL) v. 2.1, v. 3.0
- Common Public License v. 1.0
- Eclipse Public License v. 1.0
- Cecill v. 2.0

176
changelog.xml Normal file
View File

@ -0,0 +1,176 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-user.GISViewer.4-2-2"
date="2018-06-08">
<Change>[Task #11352] Another fix regarding print out of password in clear
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.4-2-1"
date="2018-03-07">
<Change>[Task #11352] Removed print out password as plaintext
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.4-2-0"
date="2017-12-19">
<Change>[Feature #10612] Extend GISViewer's zoom range
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.4-1-0"
date="2017-06-28">
<Change>Changed maven compiler at 1.8
</Change>
<Change>[Feature #5164] Upgraded to gwt 2.7.0
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.4-0-0"
date="2016-09-26">
<Change>[Feature #5148] Removed dependency 'geoserverinterface' and
changed interface
</Change>
<Change>[Feature #5164] Upgraded to gwt 2.7.0
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-10-2"
date="2016-09-16">
<Change>[Release #5037] Fixed Etics dependency
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-10-1"
date="2016-04-28">
<Change>Bug Fixing for method getValueOfParameter
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-10-0"
date="2016-02-15">
<Change>[Feature: #2034] Added method to get gcube token for WPS
service
</Change>
<Change>[Feature: #2087] Integrated with geo-utility
</Change>
<Change>[Feature #2143] WPS x,y resolutions as function of the zoom
level
</Change>
<Change>[Feature #2232] Added Z-Axis for ncWMS layers
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-9-0"
date="2016-01-04">
<Change>[Task: #1283] Added code to manage ncWMS layers
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-8-0"
date="2015-09-25">
<Change>Bug #427. Validation of the datestamp read from metadata
retrieved;
GisViewer upgrade to OpenLayers 2.11
</Change>
<Change>Feature #452. Added property file to read the base
configurations to work outside gcube infrastructure
</Change>
<Change>[Feature #784] Gcube Geoexplorer: workspace explorer
integration
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-7-0"
date="2015-03-13">
<Change>Feature #203. Updated transect invocation</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-6-2"
date="2015-03-13">
<Change>Changed css
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-6-1"
date="2015-02-10">
<Change>Fixed True Marble
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-5-1"
date="2014-09-01">
<Change>Fixed support #832: z-index too high
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-5-0"
date="2014-09-01">
<Change>Updated to support display of layers stored on Map Server
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-4-0"
date="2014-06-04">
<Change>Updated to support new portal bom configurations
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-3-0"
date="2013-10-21">
<Change>#Ticket 2223. This project was enhancements to gwt 2.5.1
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-2-0"
date="2013-09-16">
<Change>New methods are added to read "describe feature type" used for
trunsect functionality
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-1-0"
date="2013-05-29">
<Change>#497 Fixed issue</Change>
<Change>New method - add wms layers</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.3-0-0"
date="2013-03-05">
<Change># 1272 Gis Viewer was mavenized</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.2-1-3"
date="2012-11-30">
<Change>Update</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.2-1-2"
date="2012-10-25">
<Change>Update</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.2-1-1"
date="2012-09-03">
<Change>Update</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.2-1-0"
date="2012-07-24">
<Change>WFS performance improvement</Change>
<Change>Advanced click data interface</Change>
<Change>Enabling workspace image exporting</Change>
<Change>Interface enhancement</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.2-0-0"
date="2012-05-04">
<Change>Code optimizing</Change>
<Change>Interface Enhancement</Change>
<Change>Implementation of an additional panel interface version
besides a window interface
</Change>
<Change>Openlayers toolbar reimplementation</Change>
<Change>Added a set of external Base Layers using OpenLayers</Change>
<Change>CSV data export</Change>
<Change>Advanced data request: box rectangular area selection</Change>
<Change>Snapshot with external layers</Change>
<Change>Pluggable Layers from WMS links</Change>
<Change>Delete Search Button</Change>
<Change>Optimize map preview</Change>
<Change>Filter on Workspace</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.1-4-0"
date="2012-02-17">
<Change>Most of the code has been refactorized</Change>
<Change>Unused files and libraries have been removed</Change>
<Change>Added generic parameters retrieving system</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.1-2"
date="2011-07-09">
<Change>release with minor changes</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.1-1-1"
date="2011-12-07">
<Change>release with minor changes</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.GISViewer.1-1-0"
date="2011-02-02">
<Change>First Release</Change>
</Changeset>
</ReleaseNotes>

30
descriptor.xml Normal file
View File

@ -0,0 +1,30 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>servicearchive</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>/</baseDirectory>
<fileSets>
<fileSet>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>README.md</include>
<include>LICENSE.md</include>
<include>profile.xml</include>
<include>changelog.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
</fileSets>
<files>
<file>
<source>target/${build.finalName}.${project.packaging}</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
</files>
</assembly>

57
pom.xml
View File

@ -1,10 +1,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.0.0</version>
<version>1.1.0</version>
<relativePath />
</parent>
@ -15,11 +16,13 @@
<description>
GWT Widget application to access GIS Data
</description>
<scm>
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</connection>
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</developerConnection>
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</url>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
<url>https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</url>
</scm>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.7.0</gwtVersion>
@ -157,6 +160,25 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- SA Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>servicearchive</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
@ -183,31 +205,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<descriptors>
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>fully.qualified.MainClass</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>servicearchive</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>

View File

@ -1,253 +0,0 @@
package org.gcube.portlets.user.gisviewer.test.client;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.data.BaseModel;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.Element;
public class GridExample extends ContentPanel {
public GridExample() {
}
@Override
protected void onRender(Element parent, int pos) {
super.onRender(parent, pos);
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
ColumnConfig column = new ColumnConfig();
column.setId("name");
column.setHeader("Employee Name");
column.setWidth(200);
configs.add(column);
column = new ColumnConfig("department", "Department", 150);
column.setAlignment(HorizontalAlignment.LEFT);
configs.add(column);
column = new ColumnConfig("designation", "Designation", 150);
column.setAlignment(HorizontalAlignment.LEFT);
configs.add(column);
column = new ColumnConfig("salary", "Slary", 100);
column.setAlignment(HorizontalAlignment.RIGHT);
final NumberFormat number = NumberFormat.getFormat("0.00");
GridCellRenderer<Employee> checkSalary = new GridCellRenderer<Employee>() {
public String render(Employee model, String property,
ColumnData config, int rowIndex, int colIndex,
ListStore<Employee> employeeList, Grid<Employee> grid) {
double val = (Double) model.get(property);
String style = val < 70000 ? "red" : "green";
return "<span style='color:" + style + "'>"
+ number.format(val) + "</span>";
}
};
column.setRenderer(checkSalary);
configs.add(column);
column = new ColumnConfig("joiningdate", "Joining Date", 100);
column.setAlignment(HorizontalAlignment.RIGHT);
column.setDateTimeFormat(DateTimeFormat.getShortDateFormat());
configs.add(column);
ListStore<Employee> employeeList = new ListStore<Employee>();
employeeList.add(new TestData().getEmployees());
ColumnModel cm = new ColumnModel(configs);
Grid<Employee> grid = new Grid<Employee>(employeeList, cm);
grid.setStyleAttribute("borderTop", "none");
grid.setAutoExpandColumn("name");
grid.setBorders(true);
grid.setStripeRows(true);
grid.setColumnLines(true);
setBodyBorder(true);
setHeading("Employee List");
setButtonAlign(HorizontalAlignment.CENTER);
setLayout(new FitLayout());
setSize(700, 500);
add(grid);
}
public Grid<Employee> getGrid() {
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
ColumnConfig column = new ColumnConfig();
column.setId("name");
column.setHeader("Employee Name");
column.setWidth(200);
configs.add(column);
column = new ColumnConfig("department", "Department", 150);
column.setAlignment(HorizontalAlignment.LEFT);
configs.add(column);
column = new ColumnConfig("designation", "Designation", 150);
column.setAlignment(HorizontalAlignment.LEFT);
configs.add(column);
column = new ColumnConfig("salary", "Slary", 100);
column.setAlignment(HorizontalAlignment.RIGHT);
final NumberFormat number = NumberFormat.getFormat("0.00");
GridCellRenderer<Employee> checkSalary = new GridCellRenderer<Employee>() {
public String render(Employee model, String property,
ColumnData config, int rowIndex, int colIndex,
ListStore<Employee> employeeList, Grid<Employee> grid) {
double val = (Double) model.get(property);
String style = val < 70000 ? "red" : "green";
return "<span style='color:" + style + "'>"
+ number.format(val) + "</span>";
}
};
column.setRenderer(checkSalary);
configs.add(column);
column = new ColumnConfig("joiningdate", "Joining Date", 100);
column.setAlignment(HorizontalAlignment.RIGHT);
column.setDateTimeFormat(DateTimeFormat.getShortDateFormat());
configs.add(column);
ListStore<Employee> employeeList = new ListStore<Employee>();
employeeList.add(getEmployees());
ColumnModel cm = new ColumnModel(configs);
Grid<Employee> grid = new Grid<Employee>(employeeList, cm);
grid.setStyleAttribute("borderTop", "none");
grid.setAutoExpandColumn("name");
grid.setBorders(true);
grid.setStripeRows(true);
grid.setColumnLines(true);
return grid;
}
private List<Employee> getEmployees() {
List<Employee> employees = new ArrayList<Employee>();
DateTimeFormat f = DateTimeFormat.getFormat("yyyy-mm-dd");
employees.add(new Employee("Hollie Voss", "General Administration",
"Executive Director", 150000, f.parse("2006-05-01")));
employees.add(new Employee("Emerson Milton",
"Information Technology", "CTO", 120000, f
.parse("2007-03-01")));
employees.add(new Employee("Christina Blake",
"Information Technology", "Project Manager", 90000, f
.parse("2008-08-01")));
employees.add(new Employee("Heriberto Rush",
"Information Technology", "Senior S/WEngineer", 70000, f
.parse("2009-02-07")));
employees.add(new Employee("Candice Carson",
"Information Technology", "S/W Engineer", 60000, f
.parse("2007-11-01")));
employees.add(new Employee("Chad Andrews",
"Information Technology", "Senior S/W Engineer", 70000, f
.parse("2008-02-01")));
employees.add(new Employee("Dirk Newman", "Information Technology",
"S/W Engineer", 62000, f.parse("2009-03-01")));
employees.add(new Employee("Bell Snedden",
"Information Technology", "S/W Engineer", 73000, f
.parse("2007-07-07")));
employees.add(new Employee("Benito Meeks", "Marketing",
"General Manager", 105000, f.parse("2008-02-01")));
employees.add(new Employee("Gail Horton", "Marketing", "Executive",
55000, f.parse("2009-05-01")));
employees.add(new Employee("Claudio Engle", "Marketing",
"Executive", 58000, f.parse("2008-09-03")));
employees.add(new Employee("Buster misjenou", "Accounts",
"Executive", 52000, f.parse("2008-02-07")));
return employees;
}
// ////////////////////////////////
public class Employee extends BaseModel {
private static final long serialVersionUID = 1L;
public Employee() {
}
public Employee(String name, String department, String designation,
double salary, Date joiningdate) {
set("name", name);
set("department", department);
set("designation", designation);
set("salary", salary);
set("joiningdate", joiningdate);
}
public Date getJoiningdate() {
return (Date) get("joiningdate");
}
public String getName() {
return (String) get("name");
}
public String getDepartment() {
return (String) get("department");
}
public String getDesignation() {
return (String) get("designation");
}
public double getSalary() {
Double salary = (Double) get("salary");
return salary.doubleValue();
}
public String toString() {
return getName();
}
}
public class TestData {
public List<Employee> getEmployees() {
List<Employee> employees = new ArrayList<Employee>();
DateTimeFormat f = DateTimeFormat.getFormat("yyyy-mm-dd");
employees.add(new Employee("Hollie Voss", "General Administration",
"Executive Director", 150000, f.parse("2006-05-01")));
employees.add(new Employee("Emerson Milton",
"Information Technology", "CTO", 120000, f
.parse("2007-03-01")));
employees.add(new Employee("Christina Blake",
"Information Technology", "Project Manager", 90000, f
.parse("2008-08-01")));
employees.add(new Employee("Heriberto Rush",
"Information Technology", "Senior S/WEngineer", 70000, f
.parse("2009-02-07")));
employees.add(new Employee("Candice Carson",
"Information Technology", "S/W Engineer", 60000, f
.parse("2007-11-01")));
employees.add(new Employee("Chad Andrews",
"Information Technology", "Senior S/W Engineer", 70000, f
.parse("2008-02-01")));
employees.add(new Employee("Dirk Newman", "Information Technology",
"S/W Engineer", 62000, f.parse("2009-03-01")));
employees.add(new Employee("Bell Snedden",
"Information Technology", "S/W Engineer", 73000, f
.parse("2007-07-07")));
employees.add(new Employee("Benito Meeks", "Marketing",
"General Manager", 105000, f.parse("2008-02-01")));
employees.add(new Employee("Gail Horton", "Marketing", "Executive",
55000, f.parse("2009-05-01")));
employees.add(new Employee("Claudio Engle", "Marketing",
"Executive", 58000, f.parse("2008-09-03")));
employees.add(new Employee("Buster misjenou", "Accounts",
"Executive", 52000, f.parse("2008-02-07")));
return employees;
}
}
}

View File

@ -1,496 +0,0 @@
package org.gcube.portlets.user.gisviewer.test.client;
/*
* Ext GWT 2.2.5 - Ext for GWT
* Copyright(c) 2007-2010, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.SelectionMode;
import com.extjs.gxt.ui.client.core.XTemplate;
import com.extjs.gxt.ui.client.data.BaseModel;
import com.extjs.gxt.ui.client.dnd.DND.Feedback;
import com.extjs.gxt.ui.client.dnd.GridDragSource;
import com.extjs.gxt.ui.client.dnd.GridDropTarget;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.FieldEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.util.DateWrapper;
import com.extjs.gxt.ui.client.widget.Component;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.form.SimpleComboBox;
import com.extjs.gxt.ui.client.widget.grid.CheckBoxSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
import com.extjs.gxt.ui.client.widget.grid.RowExpander;
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.table.NumberCellRenderer;
import com.extjs.gxt.ui.client.widget.toolbar.LabelToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.Element;
public class GridPluginsExample extends LayoutContainer {
private VerticalPanel panel;
private GridCellRenderer<Stock> gridNumber;
private GridCellRenderer<Stock> change;
public GridPluginsExample() {
final NumberFormat currency = NumberFormat.getCurrencyFormat();
final NumberFormat number = NumberFormat.getFormat("0.00");
final NumberCellRenderer<Grid<Stock>> numberRenderer = new NumberCellRenderer<Grid<Stock>>(currency);
change = new GridCellRenderer<Stock>() {
public String render(Stock model, String property, ColumnData config, int rowIndex, int colIndex,
ListStore<Stock> store, Grid<Stock> grid) {
double val = (Double) model.get(property);
String style = val < 0 ? "red" : "green";
return "<span style='color:" + style + "'>" + number.format(val) + "</span>";
}
};
gridNumber = new GridCellRenderer<Stock>() {
public String render(Stock model, String property, ColumnData config, int rowIndex, int colIndex,
ListStore<Stock> store, Grid<Stock> grid) {
return numberRenderer.render(null, property, model.get(property));
}
};
panel = new VerticalPanel();
panel.setSpacing(20);
}
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
createExpander();
//createCheckBox();
//createNumberer();
//createFramed();
add(panel);
}
private void createCheckBox() {
List<Stock> stocks = getStocks();
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
final CheckBoxSelectionModel<Stock> sm = new CheckBoxSelectionModel<Stock>();
// selection model supports the SIMPLE selection mode
// sm.setSelectionMode(SelectionMode.SIMPLE);
configs.add(sm.getColumn());
ColumnConfig column = new ColumnConfig();
column.setId("name");
column.setHeader("Company");
column.setWidth(300);
configs.add(column);
column = new ColumnConfig();
column.setId("symbol");
column.setHeader("Symbol");
column.setWidth(100);
configs.add(column);
column = new ColumnConfig();
column.setId("last");
column.setHeader("Last");
column.setAlignment(HorizontalAlignment.RIGHT);
column.setWidth(75);
column.setRenderer(gridNumber);
configs.add(column);
column = new ColumnConfig("change", "Change", 100);
column.setAlignment(HorizontalAlignment.RIGHT);
column.setRenderer(change);
configs.add(column);
ListStore<Stock> store = new ListStore<Stock>();
store.add(stocks);
ColumnModel cm = new ColumnModel(configs);
ContentPanel cp = new ContentPanel();
cp.setHeading("Framed with Checkbox Selection and Horizontal Scrolling");
cp.setFrame(true);
//cp.setIcon(Resources.ICONS.table());
cp.setLayout(new FitLayout());
cp.setSize(600, 300);
Grid<Stock> grid = new Grid<Stock>(store, cm);
grid.setSelectionModel(sm);
grid.setBorders(true);
grid.setColumnReordering(true);
grid.getAriaSupport().setLabelledBy(cp.getHeader().getId() + "-label");
grid.addPlugin(sm);
ToolBar toolBar = new ToolBar();
toolBar.getAriaSupport().setLabel("Grid Options");
toolBar.add(new LabelToolItem("Selection Mode: "));
final SimpleComboBox<String> type = new SimpleComboBox<String>();
type.setTriggerAction(TriggerAction.ALL);
type.setEditable(false);
type.setFireChangeEventOnSetValue(true);
type.setWidth(100);
type.add("Multi");
type.add("Simple");
type.setSimpleValue("Multi");
type.addListener(Events.Change, new Listener<FieldEvent>() {
public void handleEvent(FieldEvent be) {
boolean simple = type.getSimpleValue().equals("Simple");
sm.deselectAll();
sm.setSelectionMode(simple ? SelectionMode.SIMPLE : SelectionMode.MULTI);
}
});
toolBar.add(type);
toolBar.add(new SeparatorToolItem());
cp.setTopComponent(toolBar);
cp.add(grid);
panel.add(cp);
}
private void createExpander() {
List<Stock> stocks = getStocks();
for (Stock s : stocks) {
s.set(
"desc",
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.<br/><br/>Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit.");
}
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
XTemplate tpl = XTemplate.create("<p><b>Company:</b> {name}</p><br><p><b>Summary:</b> {desc}</p>");
RowExpander expander = new RowExpander();
expander.setTemplate(tpl);
configs.add(expander);
ColumnConfig column = new ColumnConfig();
column.setId("name");
column.setHeader("Company");
column.setWidth(200);
configs.add(column);
column = new ColumnConfig();
column.setId("symbol");
column.setHeader("Symbol");
column.setWidth(100);
configs.add(column);
column = new ColumnConfig();
column.setId("last");
column.setHeader("Last");
column.setAlignment(HorizontalAlignment.RIGHT);
column.setWidth(75);
column.setRenderer(gridNumber);
configs.add(column);
column = new ColumnConfig("change", "Change", 100);
column.setAlignment(HorizontalAlignment.RIGHT);
column.setRenderer(change);
configs.add(column);
column = new ColumnConfig("date", "Last Updated", 100);
column.setAlignment(HorizontalAlignment.RIGHT);
column.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/yyyy"));
configs.add(column);
ListStore<Stock> store = new ListStore<Stock>();
store.add(stocks);
ColumnModel cm = new ColumnModel(configs);
ContentPanel cp = new ContentPanel();
cp.setHeading("Expander Rows, Collapse and Auto Fill");
//cp.setIcon(Resources.ICONS.table());
cp.setAnimCollapse(false);
cp.setCollapsible(true);
cp.setLayout(new FitLayout());
cp.setSize(600, 300);
Grid<Stock> grid = new Grid<Stock>(store, cm);
//grid.addPlugin(expander);
grid.setColumnReordering(true);
grid.getView().setAutoFill(true);
grid.getAriaSupport().setLabelledBy(cp.getHeader().getId() + "-label");
cp.add(grid);
new GridDragSource(grid);
GridDropTarget target = new GridDropTarget(grid);
target.setAllowSelfAsSource(true);
target.setFeedback(Feedback.INSERT);
panel.add(cp);
}
private void createFramed() {
List<Stock> stocks = getStocks();
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
CheckBoxSelectionModel<Stock> sm = new CheckBoxSelectionModel<Stock>();
configs.add(sm.getColumn());
ColumnConfig column = new ColumnConfig();
column.setId("name");
column.setHeader("Company");
column.setWidth(200);
configs.add(column);
column = new ColumnConfig();
column.setId("symbol");
column.setHeader("Symbol");
column.setWidth(100);
configs.add(column);
column = new ColumnConfig();
column.setId("last");
column.setHeader("Last");
column.setAlignment(HorizontalAlignment.RIGHT);
column.setWidth(75);
column.setRenderer(gridNumber);
configs.add(column);
column = new ColumnConfig("change", "Change", 100);
column.setAlignment(HorizontalAlignment.RIGHT);
column.setRenderer(change);
configs.add(column);
column = new ColumnConfig("date", "Last Updated", 100);
column.setAlignment(HorizontalAlignment.RIGHT);
column.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/yyyy"));
configs.add(column);
ListStore<Stock> store = new ListStore<Stock>();
store.add(stocks);
ColumnModel cm = new ColumnModel(configs);
ContentPanel cp = new ContentPanel();
cp.setHeading("Support for standard Panel features such as framing, buttons and toolbars");
cp.setFrame(true);
//cp.setIcon(Resources.ICONS.table());
cp.addButton(new Button("Save"));
cp.addButton(new Button("Cancel"));
cp.setButtonAlign(HorizontalAlignment.CENTER);
cp.setLayout(new FitLayout());
cp.setSize(600, 300);
ToolBar toolBar = new ToolBar();
toolBar.getAriaSupport().setLabel("Grid Options");
toolBar.add(new Button("Add"));//, Resources.ICONS.add()));
toolBar.add(new SeparatorToolItem());
toolBar.add(new Button("Remove"));//, Resources.ICONS.delete()));
toolBar.add(new SeparatorToolItem());
toolBar.add(new Button("Configure"));//, Resources.ICONS.plugin()));
cp.setTopComponent(toolBar);
Grid<Stock> grid = new Grid<Stock>(store, cm);
grid.setSelectionModel(sm);
grid.setAutoExpandColumn("name");
grid.setColumnReordering(true);
grid.setBorders(true);
grid.addPlugin(sm);
grid.getAriaSupport().setLabelledBy(cp.getHeader().getId() + "-label");
cp.add(grid);
panel.add(cp);
}
private void createNumberer() {
List<Stock> stocks = getStocks();
RowNumberer r = new RowNumberer();
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
configs.add(r);
ColumnConfig column = new ColumnConfig();
column.setId("name");
column.setHeader("Company");
column.setWidth(200);
configs.add(column);
column = new ColumnConfig();
column.setId("symbol");
column.setHeader("Symbol");
column.setWidth(100);
configs.add(column);
column = new ColumnConfig();
column.setId("last");
column.setHeader("Last");
column.setAlignment(HorizontalAlignment.RIGHT);
column.setWidth(75);
column.setRenderer(gridNumber);
configs.add(column);
column = new ColumnConfig("change", "Change", 100);
column.setAlignment(HorizontalAlignment.RIGHT);
column.setRenderer(change);
configs.add(column);
ListStore<Stock> store = new ListStore<Stock>();
store.add(stocks);
ColumnModel cm = new ColumnModel(configs);
final Grid<Stock> grid = new Grid<Stock>(store, cm);
grid.addPlugin(r);
grid.getView().setForceFit(true);
Button btn = new Button("Remove a Row", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
grid.getStore().remove(grid.getStore().getAt(0));
if (grid.getStore().getCount() == 0) {
ce.<Component> getComponent().disable();
}
}
});
//btn.setIcon(Resources.ICONS.delete());
ContentPanel cp = new ContentPanel();
cp.setHeading("Grid with Numbered Rows and Force Fit");
//cp.setIcon(Resources.ICONS.table());
cp.setLayout(new FitLayout());
cp.setSize(600, 300);
cp.add(grid);
cp.addButton(btn);
grid.getAriaSupport().setLabelledBy(cp.getHeader().getId() + "-label");
panel.add(cp);
}
private List<Stock> getStocks() {
List<Stock> stocks = new ArrayList<Stock>();
stocks.add(new Stock("Apple Inc.", "AAPL", 125.64, 123.43));
stocks.add(new Stock("Cisco Systems, Inc.", "CSCO", 25.84, 26.3));
stocks.add(new Stock("Google Inc.", "GOOG", 516.2, 512.6));
stocks.add(new Stock("Intel Corporation", "INTC", 21.36, 21.53));
stocks.add(new Stock("Level 3 Communications, Inc.", "LVLT", 5.55, 5.54));
stocks.add(new Stock("Microsoft Corporation", "MSFT", 29.56, 29.72));
stocks.add(new Stock("Nokia Corporation (ADR)", "NOK", 27.83, 27.93));
stocks.add(new Stock("Oracle Corporation", "ORCL", 18.73, 18.98));
stocks.add(new Stock("Starbucks Corporation", "SBUX", 27.33, 27.36));
stocks.add(new Stock("Yahoo! Inc.", "YHOO", 26.97, 27.29));
stocks.add(new Stock("Applied Materials, Inc.", "AMAT", 18.4, 18.66));
stocks.add(new Stock("Comcast Corporation", "CMCSA", 25.9, 26.4));
stocks.add(new Stock("Sirius Satellite", "SIRI", 2.77, 2.74));
stocks.add(new Stock("First Data Corporation", "FDC", 32.7, 32.65));
return stocks;
}
private class Stock extends BaseModel {
public Stock() {
}
public Stock(String name, double open, double change, double pctChange, Date date, String industry) {
set("name", name);
set("open", open);
set("change", change);
set("percentChange", pctChange);
set("date", date);
set("industry", industry);
set("split", new Boolean(Math.random() > .5));
set("type", getType());
}
public Stock(String name, String symbol, double open, double last) {
set("name", name);
set("symbol", symbol);
set("open", open);
set("last", last);
set("date", new DateWrapper().addDays(-(int)(Math.random() * 100)).asDate());
set("change", last - open);
set("split", new Boolean(Math.random() > .5));
set("type", getType());
}
public double getChange() {
return getLast() - getOpen();
}
public String getIndustry() {
return get("industry");
}
public double getLast() {
Double open = (Double) get("last");
return open.doubleValue();
}
public Date getLastTrans() {
return (Date) get("date");
}
public String getName() {
return (String) get("name");
}
public double getOpen() {
Double open = (Double) get("open");
return open.doubleValue();
}
public double getPercentChange() {
return getChange() / getOpen();
}
public String getSymbol() {
return (String) get("symbol");
}
public void setIndustry(String industry) {
set("industry", industry);
}
public String toString() {
return getName();
}
private String getType() {
double r = Math.random();
if (r <= .25) {
return "Auto";
} else if (r > .25 && r <= .50) {
return "Media";
} else if (r > .5 && r <= .75) {
return "Medical";
} else {
return "Tech";
}
}
}
}

View File

@ -1,155 +0,0 @@
package org.gcube.portlets.user.gisviewer.test.client;
import org.gcube.portlets.user.gisviewer.client.Constants;
import org.gcube.portlets.user.gisviewer.client.GisViewer;
import org.gcube.portlets.user.gisviewer.client.GisViewerParameters;
import org.gcube.portlets.user.gisviewer.client.GisViewerSaveHandler;
import org.gcube.portlets.user.gisviewer.client.GisViewerService;
import org.gcube.portlets.user.gisviewer.client.GisViewerServiceAsync;
import org.gcube.portlets.user.gisviewer.client.Constants.Mode;
import org.gcube.portlets.user.gisviewer.client.commons.beans.GroupInfo;
import org.gcube.portlets.user.gisviewer.client.commons.beans.SavedGroup;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class GxtGisViewer implements EntryPoint {
private GisViewerServiceAsync service;
private GisViewer gisViewer;
public void onModuleLoad() {
//disableDefaultContextMenu();
service = (GisViewerServiceAsync) GWT.create(GisViewerService.class);
Button openButton = new Button(".: click :.", new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
initGeoWindow();
}
});
//openButton.setIcon(IconHelper.createPath("images/engine_start.jpg", 330, 290));
//openButton.setSize(336, 300);
RootPanel.get("entryDiv").add(new HTML("<br/>"));
RootPanel.get("entryDiv").add(openButton);
if (Constants.MODE==Mode.TEST) {
RootPanel.get("entryDiv").add(new GridPluginsExample());
//initGeoWindow();
//RootPanel.get("entryDiv").add(new TreeExample());
}
RootPanel.get().add(new Button("Add layer \"salinity\"", new SelectionListener<ButtonEvent>(){
@Override
public void componentSelected(ButtonEvent ce) {
if (gisViewer!=null)
gisViewer.addLayerByName("salinity");
}
}));
}
protected void initGeoWindow() {
GisViewerParameters gisViewerParameters = new GisViewerParameters();
/*
* ADDING AN ARRAYLIST OF LAYER TITLES
*/
// List<String> layers = new ArrayList<String>();
// layers.add("TrueMarble.16km.2700x1350");
// layers.add("depthmean");
// layers.add("eezall");
// gisViewerParameters.setOpeningLayers(layers);
/*
* ADDING AN ARRAY OF LAYERS TITLES
*/
// String[] layers = {"TrueMarble.16km.2700x1350", "depthmean", "eezall", "v_point_geometries_example"};
// gisViewerParameters.setOpeningLayers(layers);
/*
* ADDING A GROUP NAME
*/
gisViewerParameters.setOpeningGroup(Constants.defaultGroup);
gisViewerParameters.setGisViewerSaveHandler(new GisViewerSaveHandler() {
@Override
public void saveLayerImage(String name, String contentType, String url) {
// TODO Auto-generated method stub
}
@Override
public void saveMapImage(String name, String outputFormat,
String bbox, String width, String height,
String[] geoservers, String[] layers, String[] styles,
String[] opacities, String[] cqlfilters, String[] gsrefs) {
// TODO Auto-generated method stub
}
});
gisViewer = new GisViewer(gisViewerParameters);
gisViewer.show();
}
private void showSaveDialogLayer(final String format, String content_type, String link) {
final Window dialogBox = new Window();
// dialogBox.addStyleName("z_index_1200");
VerticalPanel hcafLegend = new VerticalPanel();
// link = Constants.geoServerURL + link;
// hcafLegend.add(new Label("Link to save: " + link));
// Add a close button at the bottom of the dialog
Button closeButton = new Button("close",
new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
dialogBox.hide();
}
});
closeButton.addStyleName("border_left border_right border_top");
closeButton.setWidth("50px");
Button saveButton = new Button("save",
new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
}
});
saveButton.addStyleName("border_left border_right border_top");
saveButton.setWidth("100px");
HorizontalPanel hp = new HorizontalPanel();
hp.add(saveButton);
hp.add(closeButton);
hcafLegend.add(hp);
hcafLegend.setCellHorizontalAlignment(hp,
HasHorizontalAlignment.ALIGN_RIGHT);
// legendPanel.insert(hcafLegend, 1);
dialogBox.setTitle("Save Layer as " + format);
// dialogBox.setAnimationEnabled(true);
// dialogBox.setWidth("350px");
hcafLegend.setWidth("400px");
dialogBox.add(hcafLegend);
dialogBox.center();
// Show the popup
dialogBox.show();
}
}

View File

@ -1,86 +0,0 @@
/**
*
*/
package org.gcube.portlets.user.gisviewer.test.client;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Iterator;
import org.apache.commons.io.IOUtils;
import org.gcube.common.geoserverinterface.json.JSONArray;
import org.gcube.common.geoserverinterface.json.JSONException;
import org.gcube.common.geoserverinterface.json.JSONObject;
/**
* @author ceras
*
*/
public class JsonParser {
/**
* @param args
*/
public static void main(String[] args) {
//InputStream is = JsonParser.class.getResourceAsStream( "test.json");
// try {
// InputStream is = new URL(url).openStream();
// String jsonTxt = IOUtils.toString(is);
// String jsonText = readAll(rd);
// JSONObject json = new JSONObject(jsonText);
// return json;
// } catch (Exception e) {
// e.printStackTrace();
// }
try {
String url = "http://geoserver.d4science-ii.research-infrastructures.eu/geoserver/wfs?service=wfs&version=1.1.0&REQUEST=GetFeature&TYPENAME=aquamaps:lamarsipuscarlsbergi20120619071303812&BBOX=-14.765625,117.7734375,-2.4609375,132.890625&MAXFEATURES=200&OUTPUTFORMAT=json";
InputStream is = new URL(url).openStream();
String jsonTxt = IOUtils.toString(is);
JSONObject json = new JSONObject(jsonTxt);
String type = json.getString("type");
System.out.println("type="+type);
JSONArray features = json.getJSONArray("features");
System.out.println(features.length()+" features.");
for (int i=0; i<features.length(); i++) {
JSONObject properties = ((JSONObject)features.get(i)).getJSONObject("properties");
Iterator<String> ii = properties.keys();
while (ii.hasNext()) {
String key = ii.next();
String value = properties.getString(key);
System.out.println(key+" = "+value);
}
System.out.println();
//System.out.println("gid=" + properties.getString("gid") + "; csquarecode=" + properties.getString("csquarecode") + "; probability=" + properties.getString("probability") + ".");
}
//
// double coolness = json.getDouble( "coolness" );
// int altitude = json.getInt( "altitude" );
// JSONObject pilot = json.getJSONObject("pilot");
// String firstName = pilot.getString("firstName");
// String lastName = pilot.getString("lastName");
//
// System.out.println( "Coolness: " + coolness );
// System.out.println( "Altitude: " + altitude );
// System.out.println( "Pilot: " + lastName );
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

View File

@ -1,33 +0,0 @@
package org.gcube.portlets.user.gisviewer.test.client;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.google.gwt.user.client.ui.HTML;
public class TabExample extends LayoutContainer {
public TabExample() {
TabPanel advanced = new TabPanel();
advanced.setSize(600, 250);
advanced.setMinTabWidth(115);
advanced.setResizeTabs(true);
advanced.setAnimScroll(true);
advanced.setTabScroll(true);
advanced.setCloseContextMenu(true);
int index = 0;
while (index < 7) {
TabItem item = new TabItem();
item.setText("New Tab " + ++index);
item.setClosable(index != 1);
item.add(new HTML("<b>Tab Body " + index+"</b>"));
item.addStyleName("pad-text");
advanced.add(item);
}
advanced.setSelection(advanced.getItem(6));
add(advanced);
}
}

View File

@ -1,135 +0,0 @@
package org.gcube.portlets.user.gisviewer.test.client;
import java.util.ArrayList;
import java.util.List;
import com.extjs.gxt.ui.client.data.BaseModel;
public class TestData extends BaseModel {
/**
*
*/
private static final long serialVersionUID = 1L;
String nome, cognome, a, b, c, d, e, f, g, h, i;
int eta;
public TestData() {
}
public TestData(String nome, String cognome, int eta) {
set("nome", nome);
set("cognome", cognome);
set("eta", eta);
}
public TestData(String nome, String cognome, int eta, String a, String b,
String c, String d, String e, String f, String g, String h,
String i) {
super();
set("nome", nome);
set("cognome", cognome);
set("a", a);
set("b", b);
set("c", c);
set("d", d);
set("e", e);
set("f", f);
set("g", g);
set("h", h);
set("i", i);
set("eta", eta);
}
public String getCognome() {
return cognome;
}
public int getEta() {
return eta;
}
public String getNome() {
return nome;
}
public void setCognome(String cognome) {
this.cognome = cognome;
}
public void setEta(int eta) {
this.eta = eta;
}
public void setNome(String nome) {
this.nome = nome;
}
public static List<TestData> getTestData() {
List<TestData> persone = new ArrayList<TestData>();
persone.add(new TestData("ciccio", "ceras", 31, "asd", "asd", "asd", "asd", "asd", "asd", "asd", "asd", "asd"));
persone.add(new TestData("pinco", "pallino", 25, "dsa", "asd", "dsa", "asd", "dsa", "asd", "dsa", "asd", "dsa"));
persone.add(new TestData("moira", "orfei", 22, "dsa", "asd", "dsa", "asd", "dsa", "asd", "dsa", "asd", "dsa"));
persone.add(new TestData("silvio", "berlusconi", 89, "dsa", "asd", "dsa", "asd", "dsa", "asd", "dsa", "asd", "dsa"));
persone.add(new TestData("pippo", "pluto", 13, "dsa", "asd", "dsa", "asd", "dsa", "asd", "dsa", "asd", "dsa"));
persone.add(new TestData("pippo", "pippo", 37, "dsa", "asd", "dsa", "asd", "dsa", "asd", "dsa", "asd", "dsa"));
return persone;
}
public static void main(String[] args) {
String str = "ALGORITHM CITATION : Kaschner, K., J. S. Ready, E. Agbayani, J. Rius, K. Kesner-Reyes, P. D. Eastwood, A. B. South, S. O. Kullander, T. Rees, C. H. Close, R. Watson, D. Pauly, and R. Froese. 2008 AquaMaps: Predicted range maps for aquatic species. World wide web electronic publication, www.aquamaps.org, Version 10/2008. | HCAF GENERATION TIME : 1970_01_01_01_00_00_000_CET | HCAF TITLE : Default | HSPEC TITLE : Test Venus_SuitableRange | HSPEN GENERATION TIME : 1970_01_01_01_00_00_000_CET | ALGORITHM : SuitableRange | HSPEN TITLE : Default | HSPEC GENERATION TIME : 2012_03_13_11_25_55_188_CET |";
// try split by pipe
String[] splitPipe = str.split("\\|");
System.out.println("split lenght: "+splitPipe.length);
if (splitPipe.length==1)
// no map case
System.out.println("Description: "+str);
else {
// map case
System.out.println("Metadata list");
for (String metadata: splitPipe) {
// try split by ":"
String[] splitPoints = metadata.split(":");
if (splitPoints.length==0)
System.out.println(" - "+metadata);
else
System.out.println(" - "+getCapitalWords(splitPoints[0]) + "-"+metadata.substring(splitPoints[0].length()+1).trim());
}
}
}
public static String getCapitalWords(String string) {
String ris = "";
boolean precUnderscore = true;
for (int i=0; i<string.length(); i++) {
char c = string.charAt(i);
if (c == '_') {
precUnderscore = true;
ris += " ";
} else {
ris += (precUnderscore ? Character.toUpperCase(c) : Character.toLowerCase(c));
if (precUnderscore == true)
precUnderscore = false;
}
}
return ris.trim();
}
}

View File

@ -1,87 +0,0 @@
package org.gcube.portlets.user.gisviewer.test.client;
/*
* Ext GWT 2.2.5 - Ext for GWT
* Copyright(c) 2007-2010, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
import java.util.List;
import com.extjs.gxt.ui.client.data.BaseModelData;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.TreePanelEvent;
import com.extjs.gxt.ui.client.store.TreeStore;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel.CheckCascade;
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel.CheckNodes;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Window;
public class TreeExample extends LayoutContainer {
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
//setLayout(new FitLayout());
setSize("100%", "100%");
setBorders(true);
// creazione dello store
TreeStore<ModelData> store = new TreeStore<ModelData>();
// creazione tree panel
TreePanel<ModelData> tree = new TreePanel<ModelData>(store);
tree.setTrackMouseOver(false);
tree.setCheckable(true);
tree.setCheckNodes(CheckNodes.LEAF);
tree.setCheckStyle(CheckCascade.NONE);
tree.setDisplayProperty("nome");
ModelData m = new BaseModelData();
m.set("nome", "ciao");
ModelData mnew = new BaseModelData();
mnew.set("nome", "new!");
ModelData mnew2 = new BaseModelData();
mnew2.set("nome", "new!");
ModelData m2 = new BaseModelData();
m2.set("nome", "ciccio");
ModelData m3 = new BaseModelData();
m3.set("nome", "ceras");
store.add(m, false);
store.add(mnew, false);
store.add(m, m2, false);
store.add(m, m3, false);
store.add(mnew, mnew2, false);
tree.expandAll();
tree.setChecked(m2, true);
List<ModelData> a = tree.getCheckedSelection();
// change in node check state
tree.addListener(Events.CheckChange, new Listener<TreePanelEvent<ModelData>>() {
public void handleEvent(TreePanelEvent<ModelData> be) {
Window.alert("oh "+(be.isChecked()?"yes":"no")+"!");
}
});
add(tree);
//tree.getSelectionModel().select(store.getRootItems(), true);
}
}

View File

@ -1,171 +0,0 @@
package org.gcube.portlets.user.gisviewer.test.client;
/*
* Ext GWT 2.2.5 - Ext for GWT
* Copyright(c) 2007-2010, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
import java.util.Arrays;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.data.BaseTreeModel;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.store.TreeStore;
import com.extjs.gxt.ui.client.util.IconHelper;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.extjs.gxt.ui.client.widget.treegrid.TreeGrid;
import com.extjs.gxt.ui.client.widget.treegrid.WidgetTreeGridCellRenderer;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Widget;
public class WidgetTreeGridExample extends LayoutContainer {
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
setLayout(new FlowLayout(10));
LayerFolder model = getTreeModel();
TreeStore<ModelData> store = new TreeStore<ModelData>();
store.add(model.getChildren(), true);
ColumnConfig name = new ColumnConfig("name", "Name", 100);
name.setRenderer(new WidgetTreeGridCellRenderer<ModelData>(){
@Override
public Widget getWidget(ModelData model, String property, ColumnData config, int rowIndex, int colIndex,
ListStore<ModelData> store, Grid<ModelData> grid) {
if (model.get("type").equals("music")) {
VerticalPanel lc = new VerticalPanel();
lc.setSize(200, 100);
lc.setBorders(true);
lc.add(new Button("ciao"));
lc.add(new Button("ciao2"));
lc.add(new Button("ciao3"));
return lc;
} else {
Button b = new Button((String)model.get(property));
b.setToolTip("Click for more information");
return b;
}
}
});
ColumnConfig date = new ColumnConfig("author", "Author", 100);
ColumnConfig size = new ColumnConfig("genre", "Genre", 100);
ColumnModel cm = new ColumnModel(Arrays.asList(name, date, size));
ContentPanel cp = new ContentPanel();
cp.setBodyBorder(false);
cp.setHeading("Widget Renderer TreeGrid");
cp.setButtonAlign(HorizontalAlignment.CENTER);
cp.setLayout(new FitLayout());
cp.setFrame(true);
cp.setSize(600, 300);
final TreeGrid<ModelData> tree = new TreeGrid<ModelData>(store, cm);
tree.setBorders(true);
tree.setSize(400, 400);
tree.setAutoExpandColumn("name");
tree.getTreeView().setRowHeight(26);
tree.getStyle().setLeafIcon(IconHelper.createStyle("icon-music"));
cp.add(tree);
add(cp);
add(new Button("dfg", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
tree.getTreeView().getRow(1).getStyle().setHeight(200, Unit.PX);
}
}));
}
private LayerFolder getTreeModel() {
LayerFolder[] folders = new LayerFolder[] {
new LayerFolder("Beethoven", new Music[] {
new Music("Six String Quartets", "Beethoven", "Quartets"),
}),
new LayerFolder("Brahms", new Music[] {
new Music("Violin Concerto", "Brahms", "Concertos"),
}),
new LayerFolder("Mozart", new Music[] {
new Music("Piano Concerto No. 12", "Mozart", "Concertos"),
})
};
LayerFolder root = new LayerFolder("root");
for (int i = 0; i < folders.length; i++) {
root.add((LayerFolder) folders[i]);
}
return root;
}
private class LayerFolder extends BaseTreeModel {
private static final long serialVersionUID = 1L;
public LayerFolder(String name) {
set("name", name);
set("type", "layer");
}
public LayerFolder(String name, BaseTreeModel[] children) {
this(name);
for (BaseTreeModel baseTreeModel : children)
add(baseTreeModel);
}
public String getName() {
return get("name");
}
public String toString() {
return getName();
}
}
private class Music extends BaseTreeModel {
private static final long serialVersionUID = 1L;
public Music(String name, String author, String genre) {
set("name", name);
set("author", author);
set("genre", genre);
set("type", "music");
}
public String getName() {
return (String) get("name");
}
public String toString() {
return getName();
}
}
}

View File

@ -1,73 +0,0 @@
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"id": "lamarsipuscarlsbergi20120619071303812.fid-2a43039e_1386c07be0c_-3894",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[-13, 125.5],
[-13, 125.00000000000011],
[-12.5, 125.00000000000011],
[-12.5, 125.5],
[-13, 125.5]
]
]
]
},
"geometry_name": "the_geom",
"properties": {
"gid": 44883,
"csquarecode": "3112:225:3",
"probability": 1
}
}, {
"type": "Feature",
"id": "lamarsipuscarlsbergi20120619071303812.fid-2a43039e_1386c07be0c_-3893",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[-10.499999999999943, 129.5000000000001],
[-10.499999999999943, 129],
[-9.999999999999943, 129],
[-9.999999999999943, 129.5000000000001],
[-10.499999999999943, 129.5000000000001]
]
]
]
},
"geometry_name": "the_geom",
"properties": {
"gid": 44857,
"csquarecode": "3112:209:1",
"probability": 1
}
}, {
"type": "Feature",
"id": "lamarsipuscarlsbergi20120619071303812.fid-2a43039e_1386c07be0c_-3892",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[-11, 127.00000000000011],
[-11, 126.5],
[-10.499999999999943, 126.5],
[-10.499999999999943, 127.00000000000011],
[-11, 127.00000000000011]
]
]
]
},
"geometry_name": "the_geom",
"properties": {
"gid": 44848,
"csquarecode": "3112:206:4",
"probability": 1
}
}]
}