Revision 1667

View differences:

org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/.directory
1
[Dolphin]
2
Timestamp=2017,8,10,17,17,50
3
Version=3
4
ViewMode=1
5

  
6
[Settings]
7
HiddenFilesShown=true
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.app/org.gvsig.legend.aggregate.app.mainplugin/buildNumber.properties
1
#Fri Sep 09 11:27:29 CEST 2016
2
buildNumber=1
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.app/org.gvsig.legend.aggregate.app.mainplugin/src/main/resources-plugin/plugin-persistence.def
1
<?xml version="1.0"?>
2
<!--
3
Definitions of plugin persistence org.gvsig.aggregatelegend.app.mainplugin
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    <class name="org.gvsig.legend.aggregate.app.mainplugin">
9
      <extends>
10
      </extends>
11
      <description>Persistence of the legend of aggregate texts</description>
12
      <fields>
13
      </fields>
14
    </class>
15
  </classes>
16
</definitions>  
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.app/org.gvsig.legend.aggregate.app.mainplugin/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 gvSIG
3
  Association. This program is free software; you can redistribute it and/or modify
4
  it under the terms of the GNU General Public License as published by the Free Software
5
  Foundation; either version 3 of the License, or (at your option) any later version.
6
  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
7
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8
  PURPOSE. See the GNU General Public License for more details. You should have received
9
  a copy of the GNU General Public License along with this program; if not, write to
10
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
11
  USA. For any additional information, do not hesitate to contact us at info AT gvsig.com,
12
  or visit our website www.gvsig.com. -->
13
<plugin-config>
14
  <depends plugin-name="org.gvsig.app.mainplugin" />
15
  <resourceBundle name="text" />
16
  <libraries library-dir="lib" />
17
  <extensions>
18
    <extension class-name="org.gvsig.legend.aggregate.app.AggregateLegendTextExtension"
19
      description="" active="true" priority="1">
20

  
21
      <action 
22
          name="aggregatelegend-set" 
23
          label="_Set_aggregated_legend" 
24
          tooltip="_Set_aggregated_legend"
25
          position="900700100" 
26
          action-command="aggregatelegend-set"
27
          accelerator=""
28
      />
29

  
30
    </extension>
31

  
32
  </extensions>
33
</plugin-config>
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.app/org.gvsig.legend.aggregate.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
1
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 gvSIG
2
  Association. This program is free software; you can redistribute it and/or modify
3
  it under the terms of the GNU General Public License as published by the Free Software
4
  Foundation; either version 3 of the License, or (at your option) any later version.
5
  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
6
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
7
  PURPOSE. See the GNU General Public License for more details. You should have received
8
  a copy of the GNU General Public License along with this program; if not, write to
9
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
10
  USA. For any additional information, do not hesitate to contact us at info AT gvsig.com,
11
  or visit our website www.gvsig.com. -->
12
<assembly>
13
  <id>gvsig-plugin-package</id>
14
  <formats>
15
    <format>zip</format>
16
  </formats>
17
  <baseDirectory>${project.artifactId}</baseDirectory>
18
  <includeBaseDirectory>true</includeBaseDirectory>
19
  <files>
20
    <file>
21
      <source>target/${project.artifactId}-${project.version}.jar</source>
22
      <outputDirectory>lib</outputDirectory>
23
    </file>
24
    <file>
25
      <source>target/package.info</source>
26
    </file>
27
  </files>
28

  
29
  <fileSets>
30
    <fileSet>
31
      <directory>src/main/resources-plugin</directory>
32
      <outputDirectory>.</outputDirectory>
33
    </fileSet>
34
  </fileSets>
35

  
36

  
37
  <dependencySets>
38
    <dependencySet>
39
      <useProjectArtifact>false</useProjectArtifact>
40
      <useTransitiveDependencies>false</useTransitiveDependencies>
41
      <outputDirectory>lib</outputDirectory>
42
      <includes>
43
        <include>org.gvsig:org.gvsig.legend.aggregate.lib.api</include>
44
        <include>org.gvsig:org.gvsig.legend.aggregate.lib.impl</include>
45
        <include>org.gvsig:org.gvsig.legend.aggregate.swing.api</include>
46
        <include>org.gvsig:org.gvsig.legend.aggregate.swing.impl</include>
47
      </includes>
48
    </dependencySet>
49
  </dependencySets>
50

  
51
</assembly>
52

  
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.app/org.gvsig.legend.aggregate.app.mainplugin/src/main/java/org/gvsig/legend/aggregate/app/AggregateLegendTextExtension.java
1

  
2
package org.gvsig.legend.aggregate.app;
3

  
4
import org.gvsig.andami.plugins.Extension;
5

  
6

  
7
public class AggregateLegendTextExtension extends Extension {
8

  
9
    @Override
10
    public void initialize() {
11
    }
12

  
13
    @Override
14
    public void execute(String string) {
15
    }
16

  
17
    @Override
18
    public boolean isEnabled() {
19
        return true;
20
    }
21

  
22
    @Override
23
    public boolean isVisible() {
24
        return true;
25
    }
26
    
27
}
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.app/org.gvsig.legend.aggregate.app.mainplugin/pom.xml
1
<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">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.legend.aggregate.app</artifactId>
6
    <version>1.0.0-SNAPSHOT</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.legend.aggregate.app.mainplugin</artifactId>
10
  <version>1.0.0-SNAPSHOT</version>
11
  <name>org.gvsig.legend.aggregate.app.mainplugin</name>
12

  
13
    <properties>
14
    <!-- Package info property values -->
15
    <gvsig.package.info.state>devel</gvsig.package.info.state>
16
    <gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.4.0-A</gvsig.package.info.dependencies>
17
    <gvsig.package.info.official>true</gvsig.package.info.official>
18
    <gvsig.package.info.name>Vector legend: Aggregate text symbols</gvsig.package.info.name>
19
    <gvsig.package.info.description>Legend for aggregate text symbols that are near.</gvsig.package.info.description>
20
    <gvsig.package.info.categories>View,Vector,Symbology</gvsig.package.info.categories>
21
    <gvsig.package.info.javaVM>j1_7</gvsig.package.info.javaVM>
22
    <gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-base-legends/pool</gvsig.package.info.poolURL>
23
  </properties>
24

  
25
  <dependencies>
26
    <dependency>
27
      <groupId>org.gvsig</groupId>
28
      <artifactId>org.gvsig.andami</artifactId>
29
      <scope>compile</scope>
30
    </dependency>
31
    <dependency>
32
      <groupId>org.gvsig</groupId>
33
      <artifactId>org.gvsig.legend.aggregate.swing.api</artifactId>
34
      <scope>compile</scope>
35
    </dependency>
36
    <dependency>
37
      <groupId>org.gvsig</groupId>
38
      <artifactId>org.gvsig.legend.aggregate.lib.api</artifactId>
39
      <scope>compile</scope>
40
    </dependency>
41
    <dependency>
42
      <groupId>org.gvsig</groupId>
43
      <artifactId>org.gvsig.legend.aggregate.lib.impl</artifactId>
44
      <scope>runtime</scope>
45
    </dependency>
46
    <dependency>
47
      <groupId>org.gvsig</groupId>
48
      <artifactId>org.gvsig.legend.aggregate.swing.impl</artifactId>
49
      <scope>runtime</scope>
50
    </dependency>
51
    <dependency>
52
      <groupId>org.gvsig</groupId>
53
      <artifactId>org.gvsig.app.mainplugin</artifactId>
54
      <scope>compile</scope>
55
    </dependency>
56
  </dependencies>
57
</project>
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.app/pom.xml
1
<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">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.legend.aggregate</artifactId>
6
    <version>1.0.0-SNAPSHOT</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.legend.aggregate.app</artifactId>
10
  <packaging>pom</packaging>
11
  <name>org.gvsig.legend.aggregate.app</name>
12

  
13
  <modules>
14
    <module>org.gvsig.legend.aggregate.app.mainplugin</module>
15
  </modules>
16

  
17
</project>
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/pom.xml
1
<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">
2
  <modelVersion>4.0.0</modelVersion>
3
  <groupId>org.gvsig</groupId>
4
  <artifactId>org.gvsig.legend.aggregate</artifactId>
5
  <version>1.0.0-SNAPSHOT</version>
6
  <packaging>pom</packaging>
7
  <name>${project.artifactId}</name>
8
  <description>Legend for aggregate text symbols that are near.</description>
9
  <parent>
10
    <groupId>org.gvsig</groupId>
11
    <artifactId>org.gvsig.desktop</artifactId>
12
    <version>2.0.195</version>
13
  </parent>
14

  
15
  <url>https://devel.gvsig.org/sites/org.gvsig.legend.aggregate/${project.version}</url>
16
  <scm>
17
    <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-base-legends/org.gvsig.legend.aggregate/trunk/${project.artifactId}</connection>
18
    <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-base-legends/org.gvsig.legend.aggregate/trunk/${project.artifactId}</developerConnection>
19
    <url>https://devel.gvsig.org/redmine/projects/gvsig-base-legends/repository/show/org.gvsig.legend.aggregate/trunk/${project.artifactId}</url>
20
  </scm>
21
  <repositories>
22
    <repository>
23
      <id>gvsig-public-http-repository</id>
24
      <name>gvSIG maven public HTTP repository</name>
25
      <url>http://devel.gvsig.org/m2repo/j2se</url>
26
      <releases>
27
        <enabled>true</enabled>
28
        <updatePolicy>daily</updatePolicy>
29
        <checksumPolicy>warn</checksumPolicy>
30
      </releases>
31
      <snapshots>
32
        <enabled>true</enabled>
33
        <updatePolicy>daily</updatePolicy>
34
        <checksumPolicy>warn</checksumPolicy>
35
      </snapshots>
36
    </repository>
37
  </repositories>
38

  
39
  <distributionManagement>
40
    <site>
41
      <id>gvsig-repository</id>
42
      <url>dav:https://devel.gvsig.org/download/projects/gvsig-base-legends/pool/${project.artifactId}/${project.version}</url>
43
    </site>
44
  </distributionManagement>
45

  
46
  <build>
47
    <plugins>
48
      <plugin>
49
        <groupId>org.apache.maven.plugins</groupId>
50
        <artifactId>maven-release-plugin</artifactId>
51
        <configuration>
52
          <tagBase>https://devel.gvsig.org/svn/gvsig-base-legends/org.gvsig.legend.aggregate/tags</tagBase>
53
        </configuration>
54
      </plugin>
55
    </plugins>
56
  </build>
57

  
58

  
59

  
60
  <dependencyManagement>
61
    <dependencies>
62
      <dependency>
63
        <groupId>org.gvsig</groupId>
64
        <artifactId>org.gvsig.legend.aggregate.lib.api</artifactId>
65
        <version>1.0.0-SNAPSHOT</version>
66
      </dependency>
67
      <dependency>
68
        <groupId>org.gvsig</groupId>
69
        <artifactId>org.gvsig.legend.aggregate.lib.impl</artifactId>
70
        <version>1.0.0-SNAPSHOT</version>
71
      </dependency>
72
      <dependency>
73
        <groupId>org.gvsig</groupId>
74
        <artifactId>org.gvsig.legend.aggregate.swing.api</artifactId>
75
        <version>1.0.0-SNAPSHOT</version>
76
      </dependency>
77
      <dependency>
78
        <groupId>org.gvsig</groupId>
79
        <artifactId>org.gvsig.legend.aggregate.swing.impl</artifactId>
80
        <version>1.0.0-SNAPSHOT</version>
81
      </dependency>
82
      <dependency>
83
        <groupId>org.gvsig</groupId>
84
        <artifactId>org.gvsig.legend.aggregate.app.mainplugin</artifactId>
85
        <version>1.0.0-SNAPSHOT</version>
86
      </dependency>
87
    </dependencies>
88
  </dependencyManagement>
89
  <modules>
90
    <module>org.gvsig.legend.aggregate.lib</module>
91
    <module>org.gvsig.legend.aggregate.swing</module>
92
    <module>org.gvsig.legend.aggregate.app</module>
93
  </modules>
94
</project>
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.api/src/main/java/org/gvsig/legend/aggregate/lib/api/AggregateLegendLocator.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.legend.aggregate.lib.api;
24

  
25
import org.gvsig.tools.locator.AbstractLocator;
26
import org.gvsig.tools.locator.Locator;
27
import org.gvsig.tools.locator.LocatorException;
28

  
29

  
30
public class AggregateLegendLocator extends AbstractLocator {
31

  
32
    /**
33
     * AggregateLegend locator name
34
     */
35
    private static final String LOCATOR_NAME = "AggregateLegendLocator";
36

  
37
    /**
38
     * AggregateLegend manager name
39
     */
40
    public static final String MANAGER_NAME = "AggregateLegendManager";
41

  
42
    /**
43
     * AggregateLegend manager description
44
     */
45
    private static final String MANAGER_DESCRIPTION =
46
        "AggregateLegend Manager of gvSIG";
47

  
48

  
49
    /**
50
     * Unique instance
51
     */
52
    private static final AggregateLegendLocator instance = new AggregateLegendLocator();
53

  
54
    @Override
55
    public String getLocatorName() {
56
        return LOCATOR_NAME;
57
    }
58

  
59
    /**
60
     * Registers the Class implementing the AggregateLegendManager interface.
61
     *
62
     * @param clazz
63
     *            implementing the AggregateLegendManager interface
64
     */
65
    public static void registerAggregateLegendManager(Class clazz){
66
        getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
67
    }
68

  
69
    /**
70
     * Registers the default Class implementing the AggregateLegendManager interface
71
     *
72
     * @param clazz
73
     *            implementing the AggregateLegendManager interface
74
     */
75
    public static void registerDefaultAggregateLegendManager(Class clazz){
76
        getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
77
    }
78

  
79
    /**
80
     * Return a reference to AggregateLegendManager.
81
     *
82
     * @return a reference to AggregateLegendManager
83
     * @throws LocatorException
84
     *             if there is no access to the class or the class
85
     *             cannot be instantiated
86
     * @see Locator#get(String)
87
     */
88
    public static AggregateLegendManager getAggregateLegendManager() throws LocatorException {
89
        return (AggregateLegendManager) getInstance().get(MANAGER_NAME);
90
    }
91

  
92
    /**
93
     * @return
94
     */
95
    public static Locator getInstance() {
96
        return instance;
97
    }
98

  
99
}
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.api/src/main/java/org/gvsig/legend/aggregate/lib/api/AggregateLegendLibrary.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.legend.aggregate.lib.api;
24

  
25
import org.gvsig.tools.library.AbstractLibrary;
26
import org.gvsig.tools.library.LibraryException;
27
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
28

  
29

  
30
/**
31
 * @author fdiaz
32
 *
33
 */
34
public class AggregateLegendLibrary extends AbstractLibrary {
35

  
36
    /* (non-Javadoc)
37
     * @see org.gvsig.tools.library.AbstractLibrary#doInitialize()
38
     */
39
    @Override
40
    protected void doInitialize() throws LibraryException {
41
        registerAsAPI(AggregateLegendLibrary.class);
42
    }
43

  
44
    /* (non-Javadoc)
45
     * @see org.gvsig.tools.library.AbstractLibrary#doPostInitialize()
46
     */
47
    @Override
48
    protected void doPostInitialize() throws LibraryException {
49
        // Validate there is any implementation registered.
50
        AggregateLegendManager manager = AggregateLegendLocator.getAggregateLegendManager();
51
        if (manager == null) {
52
            throw new ReferenceNotRegisteredException(
53
                AggregateLegendLocator.MANAGER_NAME, AggregateLegendLocator.getInstance());
54
        }
55
    }
56

  
57
}
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.api/src/main/java/org/gvsig/legend/aggregate/lib/api/AggregateLegendManager.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 3
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.legend.aggregate.lib.api;
24

  
25
import org.gvsig.tools.service.Manager;
26

  
27

  
28
public interface AggregateLegendManager {
29

  
30
    /**
31
     * Creates an aggregate legend
32
     *
33
     * @return the aggregate legend
34
     */
35
    public AggregateLegend create();
36

  
37
    public Class<? extends AggregateLegend> getLegendClass();
38
}
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.api/src/main/java/org/gvsig/legend/aggregate/lib/api/AggregateLegend.java
1
package org.gvsig.legend.aggregate.lib.api;
2

  
3
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
4

  
5
public interface AggregateLegend extends IVectorLegend {
6

  
7
    public int getDistance();
8
    public void setDistance(int distance);
9
}
10

  
11

  
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.legend.aggregate.lib.api.AggregateLegendLibrary
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.api/pom.xml
1
<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">
2
  <modelVersion>4.0.0</modelVersion>
3
  <groupId>org.gvsig</groupId>
4
  <artifactId>org.gvsig.legend.aggregate.lib.api</artifactId>
5
  <name>org.gvsig.legend.aggregate.lib.api</name>
6
  <parent>
7
    <groupId>org.gvsig</groupId>
8
    <artifactId>org.gvsig.legend.aggregate.lib</artifactId>
9
    <version>1.0.0-SNAPSHOT</version>
10
  </parent>
11

  
12
  <build>
13
    <plugins>
14
      <plugin>
15
        <groupId>org.apache.maven.plugins</groupId>
16
        <artifactId>maven-jar-plugin</artifactId>
17
        <configuration>
18
        </configuration>
19
        <executions>
20
          <!-- Generates a jar file only with the test classes -->
21
          <execution>
22
            <goals>
23
              <goal>test-jar</goal>
24
            </goals>
25
          </execution>
26
        </executions>
27
      </plugin>
28
    </plugins>
29
  </build>
30

  
31
  <dependencies>
32
    <dependency>
33
      <groupId>org.gvsig</groupId>
34
      <artifactId>org.gvsig.tools.lib</artifactId>
35
      <scope>compile</scope>
36
    </dependency>
37
    <dependency>
38
      <groupId>org.gvsig</groupId>
39
      <artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
40
      <scope>compile</scope>
41
    </dependency>
42
  </dependencies>
43
</project>
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.lib/pom.xml
1
<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">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.legend.aggregate</artifactId>
6
    <version>1.0.0-SNAPSHOT</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.legend.aggregate.lib</artifactId>
10
  <packaging>pom</packaging>
11
  <modules>
12
    <module>org.gvsig.legend.aggregate.lib.api</module>
13
    <module>org.gvsig.legend.aggregate.lib.impl</module>
14
  </modules>
15
</project>
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.legend.aggregate.lib.impl.AggregateLegendLibraryImpl
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.impl/src/main/java/org/gvsig/legend/aggregate/lib/impl/AggregateLegendLibraryImpl.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2015 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

  
25
package org.gvsig.legend.aggregate.lib.impl;
26

  
27
import org.gvsig.fmap.mapcontext.MapContextLibrary;
28
import org.gvsig.fmap.mapcontext.MapContextLocator;
29
import org.gvsig.fmap.mapcontext.MapContextManager;
30
import org.gvsig.legend.aggregate.lib.api.AggregateLegendLibrary;
31
import org.gvsig.legend.aggregate.lib.api.AggregateLegendLocator;
32
import org.gvsig.tools.library.AbstractLibrary;
33
import org.gvsig.tools.library.LibraryException;
34

  
35
public class AggregateLegendLibraryImpl extends AbstractLibrary {
36

  
37
    @Override
38
    public void doRegistration() {
39
        registerAsImplementationOf(AggregateLegendLibrary.class);
40
        this.require(MapContextLibrary.class);
41
    }
42

  
43
    @Override
44
    protected void doInitialize() throws LibraryException {
45
        AggregateLegendLocator.registerAggregateLegendManager(DefaultAggregateLegendManager.class);
46
        MapContextManager mcmanager = MapContextLocator.getMapContextManager();
47
        mcmanager.registerLegend("AggregateLegend", DefaultAggregateLegend.class);
48
    }
49

  
50
    @Override
51
    protected void doPostInitialize() throws LibraryException {
52
    }
53

  
54
}
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.impl/src/main/java/org/gvsig/legend/aggregate/lib/impl/DefaultAggregateLegendManager.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.legend.aggregate.lib.impl;
24

  
25
import org.gvsig.legend.aggregate.lib.api.AggregateLegend;
26
import org.gvsig.legend.aggregate.lib.api.AggregateLegendManager;
27

  
28

  
29
public class DefaultAggregateLegendManager implements AggregateLegendManager {
30

  
31
    @Override
32
    public AggregateLegend create() {
33
        return new DefaultAggregateLegend();
34
    }
35

  
36
    @Override
37
    public Class<? extends AggregateLegend> getLegendClass() {
38
        return DefaultAggregateLegend.class;
39
    }
40

  
41
}
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.impl/src/main/java/org/gvsig/legend/aggregate/lib/impl/DefaultAggregateLegend.java
1
package org.gvsig.legend.aggregate.lib.impl;
2

  
3
import java.awt.Graphics2D;
4
import java.awt.geom.AffineTransform;
5
import java.awt.geom.Rectangle2D;
6
import java.awt.image.BufferedImage;
7
import java.util.ArrayList;
8
import java.util.List;
9
import java.util.Map;
10
import org.cresques.cts.ICoordTrans;
11
import org.gvsig.fmap.dal.exception.DataException;
12
import org.gvsig.fmap.dal.feature.Feature;
13
import org.gvsig.fmap.dal.feature.FeatureQuery;
14
import org.gvsig.fmap.dal.feature.FeatureSelection;
15
import org.gvsig.fmap.dal.feature.FeatureSet;
16
import org.gvsig.fmap.dal.feature.FeatureStore;
17
import org.gvsig.fmap.geom.Geometry;
18
import org.gvsig.fmap.geom.primitive.Point;
19
import org.gvsig.fmap.mapcontext.MapContextException;
20
import org.gvsig.fmap.mapcontext.ViewPort;
21
import org.gvsig.fmap.mapcontext.rendering.legend.LegendException;
22
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
23
import org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol;
24
import org.gvsig.legend.aggregate.lib.api.AggregateLegend;
25
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractVectorialLegend;
26
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.DefaultFeatureDrawnNotification;
27
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.impl.SimpleTextSymbol;
28
import org.gvsig.tools.exception.BaseException;
29
import org.gvsig.tools.task.Cancellable;
30
import org.gvsig.tools.visitor.VisitCanceledException;
31
import org.gvsig.tools.visitor.Visitor;
32

  
33
public class DefaultAggregateLegend extends AbstractVectorialLegend implements AggregateLegend {
34

  
35
    private static class Marker {
36

  
37
        private final Point pointGeo;
38
        private final Point pointPixels;
39
        private int count;
40
        private final Rectangle2D rectangle;
41

  
42
        public Marker(Point pointGeo, Point pointPixels, double distance) {
43
            this.count = 1;
44
            this.pointGeo = pointGeo;
45
            this.pointPixels = pointPixels;
46
            double d2 = distance / 2;
47
            this.rectangle = new Rectangle2D.Double(pointPixels.getX() - d2, pointPixels.getY() - d2, distance, distance);
48
        }
49

  
50
        public boolean contains(Point pointPixels) {
51
            return this.rectangle.contains(pointPixels.getX(), pointPixels.getY());
52
        }
53

  
54
        public void add(Feature feature) {
55
            this.count++;
56
        }
57
    }
58

  
59
    private int distance; // Pixels
60
    private List<Marker> markers;
61
    private final ITextSymbol defaultSymbol;
62
    
63
    public DefaultAggregateLegend() {
64
        this.defaultSymbol = new SimpleTextSymbol();
65
        this.markers = null;
66
        this.distance = 30;
67
    }
68

  
69
    @Override
70
    protected String[] getRequiredFeatureAttributeNames(FeatureStore featureStore) throws DataException {
71
        return new String[] { featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName() };
72
    }
73

  
74
    @Override
75
    public ISymbol getDefaultSymbol() {
76
        return this.defaultSymbol;
77
    }
78

  
79
    @Override
80
    public void setDefaultSymbol(ISymbol is) {
81
    }
82

  
83
    @Override
84
    public ISymbol getSymbolByFeature(Feature ftr) throws MapContextException {
85
        return this.defaultSymbol;
86
    }
87

  
88
    @Override
89
    public int getShapeType() {
90
        return Geometry.TYPES.GEOMETRY;
91
    }
92

  
93
    @Override
94
    public void setShapeType(int i) {
95
    }
96

  
97
    @Override
98
    public boolean isUseDefaultSymbol() {
99
        return true;
100
    }
101

  
102
    @Override
103
    public void useDefaultSymbol(boolean bln) {
104
    }
105

  
106
    @Override
107
    public boolean isSuitableForShapeType(int shapeType) {
108
        return true;
109
    }
110

  
111
    @Override
112
    protected void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, Map queryParameters, ICoordTrans coordTrans, FeatureStore featureStore, FeatureQuery featureQuery, double dpi) throws LegendException {
113
        super.draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans, featureStore, featureQuery, dpi); 
114
        this.drawMarkers(image, g, cancel, viewPort.getAffineTransform());
115
    }
116

  
117
    @Override
118
    protected void drawFeatures(
119
        BufferedImage image, 
120
        Graphics2D g, 
121
        final ViewPort viewPort, 
122
        final Cancellable cancel, 
123
        final ICoordTrans coordTrans, 
124
        double dpi, 
125
        DefaultFeatureDrawnNotification drawnNotification, 
126
        FeatureSet featureSet, 
127
        FeatureSelection selection
128
        ) throws BaseException {
129
        this.markers = new ArrayList<>();
130
        featureSet.accept(new Visitor() {
131
            @Override
132
            public void visit(Object o) throws VisitCanceledException, BaseException {
133
                if( cancel.isCanceled() ) {
134
                    throw new VisitCanceledException();
135
                }
136
                Feature feature = (Feature) o;
137
                Geometry geom = feature.getDefaultGeometry();
138
                if( geom != null ) {
139
                    Point pointGeo = geom.centroid();
140
                    if( coordTrans!=null ) {
141
                        pointGeo.reProject(coordTrans);
142
                    }
143
                    Point pointPixels = (Point) pointGeo.cloneGeometry();
144
                    pointPixels.transform(viewPort.getAffineTransform());
145
                    boolean newMarker = true;
146
                    for( Marker marker : markers ) {
147
                        if( marker.contains(pointPixels) ) {
148
                            marker.add(feature);
149
                            newMarker = false;
150
                        }
151
                    }
152
                    if( newMarker ) {
153
                        markers.add(new Marker(pointGeo, pointPixels, getDistance()));
154
                    }
155
                }
156
            }
157
        });
158
    }
159

  
160
    private void drawMarkers(BufferedImage image, Graphics2D g, Cancellable cancel, AffineTransform affineTransform) {
161
        ITextSymbol symbol = this.defaultSymbol;
162
        for( Marker marker : markers ) {
163
            if( cancel.isCanceled() ) {
164
                return;
165
            }
166
            symbol.setDrawWithHalo(true);
167
            symbol.setText(String.valueOf(marker.count));
168
            symbol.draw(g, affineTransform, marker.pointGeo, null, cancel);
169
        }
170
    }
171

  
172

  
173
    /**
174
     * @return the distance
175
     */
176
    public int getDistance() {
177
        return distance;
178
    }
179

  
180
    /**
181
     * @param distance the distance to set
182
     */
183
    public void setDistance(int distance) {
184
        this.distance = distance;
185
    }
186

  
187
}
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.lib/org.gvsig.legend.aggregate.lib.impl/pom.xml
1
<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">
2
  <modelVersion>4.0.0</modelVersion>
3
  <artifactId>org.gvsig.legend.aggregate.lib.impl</artifactId>
4
  <name>org.gvsig.legend.aggregate.lib.impl</name>
5
  <parent>
6
    <groupId>org.gvsig</groupId>
7
    <artifactId>org.gvsig.legend.aggregate.lib</artifactId>
8
    <version>1.0.0-SNAPSHOT</version>
9
  </parent>
10
  <groupId>org.gvsig</groupId>
11
  <dependencies>
12
    <dependency>
13
      <groupId>org.gvsig</groupId>
14
      <artifactId>org.gvsig.legend.aggregate.lib.api</artifactId>
15
      <scope>compile</scope>
16
    </dependency>
17
    <dependency>
18
      <groupId>org.gvsig</groupId>
19
      <artifactId>org.gvsig.fmap.dal.api</artifactId>
20
      <scope>compile</scope>
21
    </dependency>
22
    <dependency>
23
      <groupId>org.gvsig</groupId>
24
      <artifactId>org.gvsig.symbology.lib.impl</artifactId>
25
      <version>2.0.197-SNAPSHOT</version>
26
      <type>jar</type>
27
    </dependency>
28
  </dependencies>
29
</project>
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.swing/pom.xml
1
<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">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.legend.aggregate</artifactId>
6
    <version>1.0.0-SNAPSHOT</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.legend.aggregate.swing</artifactId>
10
  <packaging>pom</packaging>
11
  <name>org.gvsig.legend.aggregate.swing</name>
12
  <modules>
13
    <module>org.gvsig.legend.aggregate.swing.api</module>
14
    <module>org.gvsig.legend.aggregate.swing.impl</module>
15
  </modules>
16
</project>
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.swing/org.gvsig.legend.aggregate.swing.impl/src/main/java/org/gvsig/legend/aggregate/swing/impl/DefaultAggregateLegendSwingLibrary.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2015 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

  
25
package org.gvsig.legend.aggregate.swing.impl;
26

  
27
import org.gvsig.legend.aggregate.lib.api.AggregateLegendLibrary;
28
import org.gvsig.legend.aggregate.swing.api.AggregateLegendSwingLibrary;
29
import org.gvsig.legend.aggregate.swing.api.AggregateLegendSwingLocator;
30
import org.gvsig.symbology.swing.SymbologySwingLibrary;
31
import org.gvsig.symbology.swing.SymbologySwingLocator;
32
import org.gvsig.symbology.swing.SymbologySwingManager;
33
import org.gvsig.tools.library.AbstractLibrary;
34
import org.gvsig.tools.library.LibraryException;
35

  
36

  
37
public class DefaultAggregateLegendSwingLibrary extends AbstractLibrary {
38

  
39

  
40

  
41
	@Override
42
    public void doRegistration() {
43
        registerAsImplementationOf(AggregateLegendSwingLibrary.class);
44
        require(SymbologySwingLibrary.class);
45
    }
46

  
47
    @Override
48
    protected void doInitialize() throws LibraryException {
49
        AggregateLegendSwingLocator.registerAggregateLegendSwingManager(DefaultAggregateLegendSwingManager.class);
50
        SymbologySwingManager symmnager = SymbologySwingLocator.getSwingManager();
51
        symmnager.registerLegendEditor(DefaultAggregateLegendEditor.class);
52
    }
53

  
54
    @Override
55
    protected void doPostInitialize() throws LibraryException {
56

  
57
	}
58

  
59
}
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.swing/org.gvsig.legend.aggregate.swing.impl/src/main/java/org/gvsig/legend/aggregate/swing/impl/DefaultAggregateLegendEditorView.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<object classname="com.jeta.forms.store.memento.FormPackage">
4
 <at name="fileversion">
5
  <object classname="com.jeta.forms.store.memento.FormsVersion2">
6
   <at name="major">2</at>
7
   <at name="minor">0</at>
8
   <at name="sub">0</at>
9
  </object>
10
 </at>
11
 <at name="form">
12
  <object classname="com.jeta.forms.store.memento.FormMemento">
13
   <super classname="com.jeta.forms.store.memento.ComponentMemento">
14
    <at name="cellconstraints">
15
     <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
16
      <at name="column">1</at>
17
      <at name="row">1</at>
18
      <at name="colspan">1</at>
19
      <at name="rowspan">1</at>
20
      <at name="halign">default</at>
21
      <at name="valign">default</at>
22
      <at name="insets" object="insets">0,0,0,0</at>
23
     </object>
24
    </at>
25
    <at name="componentclass">com.jeta.forms.gui.form.FormComponent</at>
26
   </super>
27
   <at name="id">/home/jjdelcerro/datos/devel/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.swing/org.gvsig.legend.aggregate.swing.impl/src/main/java/org/gvsig/legend/aggregate/swing/impl/DefaultAggregateLegendEditorView.xml</at>
28
   <at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE</at>
29
   <at name="colspecs">FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE</at>
30
   <at name="components">
31
    <object classname="java.util.LinkedList">
32
     <item >
33
      <at name="value">
34
       <object classname="com.jeta.forms.store.memento.BeanMemento">
35
        <super classname="com.jeta.forms.store.memento.ComponentMemento">
36
         <at name="cellconstraints">
37
          <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
38
           <at name="column">2</at>
39
           <at name="row">2</at>
40
           <at name="colspan">1</at>
41
           <at name="rowspan">1</at>
42
           <at name="halign">default</at>
43
           <at name="valign">default</at>
44
           <at name="insets" object="insets">0,0,0,0</at>
45
          </object>
46
         </at>
47
         <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
48
        </super>
49
        <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
50
        <at name="beanclass">com.jeta.forms.components.label.JETALabel</at>
51
        <at name="beanproperties">
52
         <object classname="com.jeta.forms.store.memento.PropertiesMemento">
53
          <at name="classname">com.jeta.forms.components.label.JETALabel</at>
54
          <at name="properties">
55
           <object classname="com.jeta.forms.store.support.PropertyMap">
56
            <at name="border">
57
             <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
58
              <super classname="com.jeta.forms.store.properties.BorderProperty">
59
               <at name="name">border</at>
60
              </super>
61
              <at name="borders">
62
               <object classname="java.util.LinkedList">
63
                <item >
64
                 <at name="value">
65
                  <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
66
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
67
                    <at name="name">border</at>
68
                   </super>
69
                  </object>
70
                 </at>
71
                </item>
72
               </object>
73
              </at>
74
             </object>
75
            </at>
76
            <at name="name">lblDistance</at>
77
            <at name="width">49</at>
78
            <at name="text">Distance</at>
79
            <at name="fill">
80
             <object classname="com.jeta.forms.store.properties.effects.PaintProperty">
81
              <at name="name">fill</at>
82
             </object>
83
            </at>
84
            <at name="height">14</at>
85
           </object>
86
          </at>
87
         </object>
88
        </at>
89
       </object>
90
      </at>
91
     </item>
92
     <item >
93
      <at name="value">
94
       <object classname="com.jeta.forms.store.memento.BeanMemento">
95
        <super classname="com.jeta.forms.store.memento.ComponentMemento">
96
         <at name="cellconstraints">
97
          <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
98
           <at name="column">4</at>
99
           <at name="row">2</at>
100
           <at name="colspan">1</at>
101
           <at name="rowspan">1</at>
102
           <at name="halign">default</at>
103
           <at name="valign">default</at>
104
           <at name="insets" object="insets">0,0,0,0</at>
105
          </object>
106
         </at>
107
         <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
108
        </super>
109
        <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
110
        <at name="beanclass">javax.swing.JTextField</at>
111
        <at name="beanproperties">
112
         <object classname="com.jeta.forms.store.memento.PropertiesMemento">
113
          <at name="classname">javax.swing.JTextField</at>
114
          <at name="properties">
115
           <object classname="com.jeta.forms.store.support.PropertyMap">
116
            <at name="border">
117
             <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
118
              <super classname="com.jeta.forms.store.properties.BorderProperty">
119
               <at name="name">border</at>
120
              </super>
121
              <at name="borders">
122
               <object classname="java.util.LinkedList">
123
                <item >
124
                 <at name="value">
125
                  <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
126
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
127
                    <at name="name">border</at>
128
                   </super>
129
                  </object>
130
                 </at>
131
                </item>
132
               </object>
133
              </at>
134
             </object>
135
            </at>
136
            <at name="name">txtDistance</at>
137
            <at name="width">446</at>
138
            <at name="height">20</at>
139
           </object>
140
          </at>
141
         </object>
142
        </at>
143
       </object>
144
      </at>
145
     </item>
146
    </object>
147
   </at>
148
   <at name="properties">
149
    <object classname="com.jeta.forms.store.memento.PropertiesMemento">
150
     <at name="classname">com.jeta.forms.gui.form.GridView</at>
151
     <at name="properties">
152
      <object classname="com.jeta.forms.store.support.PropertyMap">
153
       <at name="border">
154
        <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
155
         <super classname="com.jeta.forms.store.properties.BorderProperty">
156
          <at name="name">border</at>
157
         </super>
158
         <at name="borders">
159
          <object classname="java.util.LinkedList"/>
160
         </at>
161
        </object>
162
       </at>
163
       <at name="name"/>
164
       <at name="fill">
165
        <object classname="com.jeta.forms.store.properties.effects.PaintProperty">
166
         <at name="name">fill</at>
167
        </object>
168
       </at>
169
       <at name="scollBars">
170
        <object classname="com.jeta.forms.store.properties.ScrollBarsProperty">
171
         <at name="name">scollBars</at>
172
         <at name="verticalpolicy">21</at>
173
         <at name="horizontalpolicy">31</at>
174
         <at name="border">
175
          <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
176
           <super classname="com.jeta.forms.store.properties.BorderProperty">
177
            <at name="name">border</at>
178
           </super>
179
           <at name="borders">
180
            <object classname="java.util.LinkedList">
181
             <item >
182
              <at name="value">
183
               <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
184
                <super classname="com.jeta.forms.store.properties.BorderProperty">
185
                 <at name="name">border</at>
186
                </super>
187
               </object>
188
              </at>
189
             </item>
190
            </object>
191
           </at>
192
          </object>
193
         </at>
194
        </object>
195
       </at>
196
      </object>
197
     </at>
198
    </object>
199
   </at>
200
   <at name="cellpainters">
201
    <object classname="com.jeta.forms.store.support.Matrix">
202
     <at name="rows">
203
      <object classname="[Ljava.lang.Object;" size="3">
204
       <at name="item" index="0">
205
        <object classname="[Ljava.lang.Object;" size="5"/>
206
       </at>
207
       <at name="item" index="1">
208
        <object classname="[Ljava.lang.Object;" size="5"/>
209
       </at>
210
       <at name="item" index="2">
211
        <object classname="[Ljava.lang.Object;" size="5"/>
212
       </at>
213
      </object>
214
     </at>
215
    </object>
216
   </at>
217
   <at name="rowgroups">
218
    <object classname="com.jeta.forms.store.memento.FormGroupSet">
219
     <at name="groups">
220
      <object classname="java.util.HashMap"/>
221
     </at>
222
    </object>
223
   </at>
224
   <at name="colgroups">
225
    <object classname="com.jeta.forms.store.memento.FormGroupSet">
226
     <at name="groups">
227
      <object classname="java.util.HashMap"/>
228
     </at>
229
    </object>
230
   </at>
231
  </object>
232
 </at>
233
</object>
org.gvsig.legend.aggregate/trunk/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.swing/org.gvsig.legend.aggregate.swing.impl/src/main/java/org/gvsig/legend/aggregate/swing/impl/DefaultAggregateLegendEditorView.java
1
package org.gvsig.legend.aggregate.swing.impl;
2

  
3
import com.jeta.open.i18n.I18NUtils;
4
import com.jgoodies.forms.layout.CellConstraints;
5
import com.jgoodies.forms.layout.FormLayout;
6
import java.awt.BorderLayout;
7
import java.awt.ComponentOrientation;
8
import java.awt.Container;
9
import java.awt.Dimension;
10
import javax.swing.Box;
11
import javax.swing.ImageIcon;
12
import javax.swing.JFrame;
13
import javax.swing.JLabel;
14
import javax.swing.JPanel;
15
import javax.swing.JTextField;
16

  
17

  
18
public class DefaultAggregateLegendEditorView extends JPanel
19
{
20
   JLabel lblDistance = new JLabel();
21
   JTextField txtDistance = new JTextField();
22

  
23
   /**
24
    * Default constructor
25
    */
26
   public DefaultAggregateLegendEditorView()
27
   {
28
      initializePanel();
29
   }
30

  
31
   /**
32
    * Adds fill components to empty cells in the first row and first column of the grid.
33
    * This ensures that the grid spacing will be the same as shown in the designer.
34
    * @param cols an array of column indices in the first row where fill components should be added.
35
    * @param rows an array of row indices in the first column where fill components should be added.
36
    */
37
   void addFillComponents( Container panel, int[] cols, int[] rows )
38
   {
39
      Dimension filler = new Dimension(10,10);
40

  
41
      boolean filled_cell_11 = false;
42
      CellConstraints cc = new CellConstraints();
43
      if ( cols.length > 0 && rows.length > 0 )
44
      {
45
         if ( cols[0] == 1 && rows[0] == 1 )
46
         {
47
            /** add a rigid area  */
48
            panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
49
            filled_cell_11 = true;
50
         }
51
      }
52

  
53
      for( int index = 0; index < cols.length; index++ )
54
      {
55
         if ( cols[index] == 1 && filled_cell_11 )
56
         {
57
            continue;
58
         }
59
         panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
60
      }
61

  
62
      for( int index = 0; index < rows.length; index++ )
63
      {
64
         if ( rows[index] == 1 && filled_cell_11 )
65
         {
66
            continue;
67
         }
68
         panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
69
      }
70

  
71
   }
72

  
73
   /**
74
    * Helper method to load an image file from the CLASSPATH
75
    * @param imageName the package and name of the file to load relative to the CLASSPATH
76
    * @return an ImageIcon instance with the specified image file
77
    * @throws IllegalArgumentException if the image resource cannot be loaded.
78
    */
79
   public ImageIcon loadImage( String imageName )
80
   {
81
      try
82
      {
83
         ClassLoader classloader = getClass().getClassLoader();
84
         java.net.URL url = classloader.getResource( imageName );
85
         if ( url != null )
86
         {
87
            ImageIcon icon = new ImageIcon( url );
88
            return icon;
89
         }
90
      }
91
      catch( Exception e )
92
      {
93
         e.printStackTrace();
94
      }
95
      throw new IllegalArgumentException( "Unable to load image: " + imageName );
96
   }
97

  
98
   /**
99
    * Method for recalculating the component orientation for 
100
    * right-to-left Locales.
101
    * @param orientation the component orientation to be applied
102
    */
103
   public void applyComponentOrientation( ComponentOrientation orientation )
104
   {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff