Revision 2118
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.mainplugin/src/main/assembly/gvsig-plugin-package-fedora11.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
</fileSets> |
|
24 |
|
|
25 |
|
|
26 |
<dependencySets> |
|
27 |
<dependencySet> |
|
28 |
<useProjectArtifact>false</useProjectArtifact> |
|
29 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
30 |
<outputDirectory>lib</outputDirectory> |
|
31 |
<includes> |
|
32 |
<include>org.gvsig:org.gvsig.raster.swing.api:jar</include> |
|
33 |
<include>org.gvsig:org.gvsig.raster.swing.impl:jar</include> |
|
34 |
<include>org.gvsig:org.gvsig.raster.cache.lib.api:jar</include> |
|
35 |
<include>org.gvsig:org.gvsig.raster.cache.lib.impl:jar</include> |
|
36 |
<include>org.gvsig:org.gvsig.raster.lib.api:jar</include> |
|
37 |
<include>org.gvsig:org.gvsig.raster.lib.impl:jar</include> |
|
38 |
<include>org.gvsig:org.gvsig.raster.algorithm:jar</include> |
|
39 |
<include>org.gvsig:org.gvsig.raster.fmap:jar</include> |
|
40 |
<include>org.gvsig:org.gvsig.jpotrace:jar</include> |
|
41 |
<include>org.gvsig:org.gvsig.timesupport.lib.api:jar</include> |
|
42 |
<include>org.gvsig:org.gvsig.timesupport.lib.impl:jar</include> |
|
43 |
<include>org.joda:joda-time:jar</include> |
|
44 |
</includes> |
|
45 |
</dependencySet> |
|
46 |
</dependencySets> |
|
47 |
</assembly> |
|
0 | 48 |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.mainplugin/src/main/assembly/gvsig-plugin-package-lin.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
<file> |
|
17 |
<source>${user.home}/.depman/lib/libjpotrace2.0.0.so</source> |
|
18 |
<outputDirectory>install/files/native</outputDirectory> |
|
19 |
</file> |
|
20 |
</files> |
|
21 |
|
|
22 |
<fileSets> |
|
23 |
<fileSet> |
|
24 |
<directory>src/main/resources-plugin</directory> |
|
25 |
<outputDirectory>.</outputDirectory> |
|
26 |
</fileSet> |
|
27 |
</fileSets> |
|
28 |
|
|
29 |
|
|
30 |
<dependencySets> |
|
31 |
<dependencySet> |
|
32 |
<useProjectArtifact>false</useProjectArtifact> |
|
33 |
<useTransitiveDependencies>true</useTransitiveDependencies> |
|
34 |
<outputDirectory>lib</outputDirectory> |
|
35 |
<includes> |
|
36 |
<include>org.gvsig:org.gvsig.raster.swing.api:jar</include> |
|
37 |
<include>org.gvsig:org.gvsig.raster.swing.impl:jar</include> |
|
38 |
<include>org.gvsig:org.gvsig.raster.cache.lib.api:jar</include> |
|
39 |
<include>org.gvsig:org.gvsig.raster.cache.lib.impl:jar</include> |
|
40 |
<include>org.gvsig:org.gvsig.raster.lib.api:jar</include> |
|
41 |
<include>org.gvsig:org.gvsig.raster.lib.impl:jar</include> |
|
42 |
<include>org.gvsig:org.gvsig.raster.algorithm:jar</include> |
|
43 |
<include>org.gvsig:org.gvsig.raster.fmap:jar</include> |
|
44 |
<include>org.gvsig:org.gvsig.jpotrace:jar</include> |
|
45 |
<include>org.gvsig:org.gvsig.timesupport.lib.api:jar</include> |
|
46 |
<include>org.gvsig:org.gvsig.timesupport.lib.impl:jar</include> |
|
47 |
<include>org.joda:joda-time:jar</include> |
|
48 |
</includes> |
|
49 |
</dependencySet> |
|
50 |
</dependencySets> |
|
51 |
</assembly> |
|
0 | 52 |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.mainplugin/src/main/assembly/gvsig-plugin-package-win.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
|
|
17 |
<!-- Sin migrar la vectorización de momento --> |
|
18 |
|
|
19 |
<file> |
|
20 |
<source>${user.home}/.depman/bin/jpotrace001.dll</source> |
|
21 |
<outputDirectory>install/files</outputDirectory> |
|
22 |
</file> |
|
23 |
</files> |
|
24 |
|
|
25 |
<fileSets> |
|
26 |
<fileSet> |
|
27 |
<directory>src/main/resources-plugin</directory> |
|
28 |
<outputDirectory>.</outputDirectory> |
|
29 |
</fileSet> |
|
30 |
</fileSets> |
|
31 |
|
|
32 |
|
|
33 |
<dependencySets> |
|
34 |
<dependencySet> |
|
35 |
<useProjectArtifact>false</useProjectArtifact> |
|
36 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
37 |
<outputDirectory>lib</outputDirectory> |
|
38 |
<includes> |
|
39 |
<include>org.gvsig:org.gvsig.raster.swing.api:jar</include> |
|
40 |
<include>org.gvsig:org.gvsig.raster.swing.impl:jar</include> |
|
41 |
<include>org.gvsig:org.gvsig.raster.cache.lib.api:jar</include> |
|
42 |
<include>org.gvsig:org.gvsig.raster.cache.lib.impl:jar</include> |
|
43 |
<include>org.gvsig:org.gvsig.raster.lib.api:jar</include> |
|
44 |
<include>org.gvsig:org.gvsig.raster.lib.impl:jar</include> |
|
45 |
<include>org.gvsig:org.gvsig.raster.algorithm:jar</include> |
|
46 |
<include>org.gvsig:org.gvsig.raster.fmap:jar</include> |
|
47 |
<include>org.gvsig:org.gvsig.jpotrace:jar</include> |
|
48 |
<include>org.gvsig:org.gvsig.timesupport.lib.api:jar</include> |
|
49 |
<include>org.gvsig:org.gvsig.timesupport.lib.impl:jar</include> |
|
50 |
<include>org.joda:joda-time:jar</include> |
|
51 |
</includes> |
|
52 |
</dependencySet> |
|
53 |
</dependencySets> |
|
54 |
</assembly> |
|
0 | 55 |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.mainplugin/src/main/java/org/gvsig/raster/mainplugin/RasterMainPluginExtension.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 |
*/ |
|
22 |
package org.gvsig.raster.mainplugin; |
|
23 |
|
|
24 |
import org.gvsig.andami.plugins.Extension; |
|
25 |
import org.gvsig.i18n.Messages; |
|
26 |
|
|
27 |
|
|
28 |
/** |
|
29 |
* Main plugin for raster |
|
30 |
* |
|
31 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
32 |
*/ |
|
33 |
public class RasterMainPluginExtension extends Extension { |
|
34 |
|
|
35 |
public void initialize() { |
|
36 |
Messages.addResourceFamily("org.gvsig.raster.mainplugin.i18n.text", |
|
37 |
RasterMainPluginExtension.class.getClassLoader(), |
|
38 |
RasterMainPluginExtension.class.getClass().getName()); |
|
39 |
} |
|
40 |
|
|
41 |
public void execute(String actionCommand) { |
|
42 |
|
|
43 |
} |
|
44 |
|
|
45 |
public boolean isEnabled() { |
|
46 |
return false; |
|
47 |
} |
|
48 |
|
|
49 |
public boolean isVisible() { |
|
50 |
return false; |
|
51 |
} |
|
52 |
|
|
53 |
} |
|
0 | 54 |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.mainplugin/src/main/java/org/gvsig/raster/mainplugin/toolbar/BinarySearch.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 |
*/ |
|
22 |
package org.gvsig.raster.mainplugin.toolbar; |
|
23 |
|
|
24 |
import java.util.Arrays; |
|
25 |
import java.util.List; |
|
26 |
import java.util.Vector; |
|
27 |
|
|
28 |
import org.gvsig.gui.beans.comboboxconfigurablelookup.ILookUp; |
|
29 |
import org.gvsig.gui.beans.comboboxconfigurablelookup.JComboBoxConfigurableLookUp; |
|
30 |
import org.gvsig.gui.beans.comboboxconfigurablelookup.StringComparator; |
|
31 |
/** |
|
32 |
* Clase para reimplementar una nueva busqueda para el componente |
|
33 |
* {@link JComboBoxConfigurableLookUp} |
|
34 |
* |
|
35 |
* @version 13/02/2008 |
|
36 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
37 |
*/ |
|
38 |
public class BinarySearch implements ILookUp { |
|
39 |
/* |
|
40 |
* (non-Javadoc) |
|
41 |
* @see org.gvsig.gui.beans.comboboxconfigurablelookup.ILookUp#doLookUpConsideringCaseSensitive(java.lang.String, java.util.Vector, org.gvsig.gui.beans.comboboxconfigurablelookup.StringComparator) |
|
42 |
*/ |
|
43 |
public List doLookUpConsideringCaseSensitive(String text, Vector sortOrderedItems, StringComparator comp) { |
|
44 |
Vector list = new Vector(); |
|
45 |
for (int i = 0; i < sortOrderedItems.size(); i++) |
|
46 |
if (sortOrderedItems.get(i).toString().indexOf(text) != -1) |
|
47 |
list.add(sortOrderedItems.get(i)); |
|
48 |
return Arrays.asList(list.toArray()); |
|
49 |
} |
|
50 |
|
|
51 |
/* |
|
52 |
* (non-Javadoc) |
|
53 |
* @see org.gvsig.gui.beans.comboboxconfigurablelookup.ILookUp#doLookUpIgnoringCaseSensitive(java.lang.String, java.util.Vector, org.gvsig.gui.beans.comboboxconfigurablelookup.StringComparator) |
|
54 |
*/ |
|
55 |
public List doLookUpIgnoringCaseSensitive(String text, Vector sortOrderedItems, StringComparator comp) { |
|
56 |
Vector list = new Vector(); |
|
57 |
for (int i = 0; i < sortOrderedItems.size(); i++) |
|
58 |
if (sortOrderedItems.get(i).toString().toLowerCase().indexOf(text.toLowerCase()) != -1) |
|
59 |
list.add(sortOrderedItems.get(i)); |
|
60 |
return Arrays.asList(list.toArray()); |
|
61 |
} |
|
62 |
} |
|
0 | 63 |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.mainplugin/src/main/java/org/gvsig/raster/mainplugin/toolbar/IGenericToolBarMenuItem.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 |
*/ |
|
22 |
package org.gvsig.raster.mainplugin.toolbar; |
|
23 |
|
|
24 |
import javax.swing.Icon; |
|
25 |
|
|
26 |
import org.gvsig.app.project.documents.view.toc.ITocItem; |
|
27 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
28 |
|
|
29 |
/** |
|
30 |
* Interfaz que debe implementar quien quiera aparecer en la barra de |
|
31 |
* herramientas gen?rica. |
|
32 |
* |
|
33 |
* @version 06/02/2008 |
|
34 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
35 |
*/ |
|
36 |
public interface IGenericToolBarMenuItem { |
|
37 |
/** |
|
38 |
* Devuelve el nombre del grupo al que pertenece el item de menu |
|
39 |
* @return |
|
40 |
*/ |
|
41 |
public String getGroup(); |
|
42 |
|
|
43 |
/** |
|
44 |
* Devuelve el orden en el que aparecer? en el men? |
|
45 |
* @return |
|
46 |
*/ |
|
47 |
public int getOrder(); |
|
48 |
|
|
49 |
/** |
|
50 |
* Devuelve el orden en el que aparecer? en el men? |
|
51 |
* @return |
|
52 |
*/ |
|
53 |
public int getGroupOrder(); |
|
54 |
|
|
55 |
/** |
|
56 |
* Devuelve el texto que se ver? en el men? |
|
57 |
* @return |
|
58 |
*/ |
|
59 |
public String getText(); |
|
60 |
|
|
61 |
/** |
|
62 |
* Devuelve el icono del item del menu |
|
63 |
* @return |
|
64 |
*/ |
|
65 |
public Icon getIcon(); |
|
66 |
|
|
67 |
/** |
|
68 |
* Dice si es visible el item de menu para dicha entrada |
|
69 |
* @param item |
|
70 |
* @param selectedItems |
|
71 |
* @return |
|
72 |
*/ |
|
73 |
public boolean isVisible(ITocItem item, FLayer[] selectedItems); |
|
74 |
|
|
75 |
/** |
|
76 |
* Dice si el item actual esta habilitado |
|
77 |
* @param item |
|
78 |
* @param selectedItems |
|
79 |
* @return |
|
80 |
*/ |
|
81 |
public boolean isEnabled(ITocItem item, FLayer[] selectedItems); |
|
82 |
|
|
83 |
/** |
|
84 |
* Metodo que sera invocado cuando el item del menu sea presionado |
|
85 |
* @param item |
|
86 |
* @param selectedItems |
|
87 |
*/ |
|
88 |
public void execute(ITocItem item, FLayer[] selectedItems); |
|
89 |
} |
|
0 | 90 |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.mainplugin/src/main/java/org/gvsig/raster/mainplugin/toolbar/ButtonItems.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 |
*/ |
|
22 |
package org.gvsig.raster.mainplugin.toolbar; |
|
23 |
|
|
24 |
import java.util.ArrayList; |
|
25 |
|
|
26 |
import javax.swing.JButton; |
|
27 |
|
|
28 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
29 |
import org.gvsig.gui.beans.controls.combobutton.ComboButton; |
|
30 |
/** |
|
31 |
* Clase para gestionar y ordenar los items de un ComboButton |
|
32 |
* |
|
33 |
* @version 13/02/2008 |
|
34 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
35 |
*/ |
|
36 |
public class ButtonItems { |
|
37 |
private ComboButton comboButton = null; |
|
38 |
private FLayer[] layers = null; |
|
39 |
private ArrayList arrayList = new ArrayList(); |
|
40 |
private ArrayList arrayKeys = new ArrayList(); |
|
41 |
|
|
42 |
public ButtonItems(ComboButton comboButton, FLayer[] layers) { |
|
43 |
this.comboButton = comboButton; |
|
44 |
this.layers = layers; |
|
45 |
} |
|
46 |
|
|
47 |
/** |
|
48 |
* A?ade un item al ComboButton |
|
49 |
* @param menuItem |
|
50 |
* @param key |
|
51 |
*/ |
|
52 |
public void addButton(IGenericToolBarMenuItem menuItem, String key) { |
|
53 |
int pos = 0; |
|
54 |
boolean find = false; |
|
55 |
for (int i = 0; i < arrayList.size(); i++) { |
|
56 |
pos = i; |
|
57 |
IGenericToolBarMenuItem aux = (IGenericToolBarMenuItem) arrayList.get(i); |
|
58 |
if (aux.getGroupOrder() > menuItem.getGroupOrder()) { |
|
59 |
find = true; |
|
60 |
break; |
|
61 |
} |
|
62 |
if (aux.getGroupOrder() == menuItem.getGroupOrder()) { |
|
63 |
if (aux.getOrder() > menuItem.getOrder()) { |
|
64 |
find = true; |
|
65 |
break; |
|
66 |
} |
|
67 |
} |
|
68 |
} |
|
69 |
if (!find) |
|
70 |
pos = arrayList.size(); |
|
71 |
arrayList.add(pos, menuItem); |
|
72 |
arrayKeys.add(pos, key); |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* Refresca los items del ComboButton |
|
77 |
*/ |
|
78 |
public void refresh() { |
|
79 |
String actionCommand = comboButton.getActionCommand(); |
|
80 |
comboButton.clearButtons(); |
|
81 |
int group = -1; |
|
82 |
for (int i = 0; i < arrayList.size(); i++) { |
|
83 |
IGenericToolBarMenuItem aux = (IGenericToolBarMenuItem) arrayList.get(i); |
|
84 |
|
|
85 |
if ((group != -1) && (group != aux.getGroupOrder())) |
|
86 |
comboButton.addSeparator(); |
|
87 |
|
|
88 |
JButton button2 = new JButton(aux.getText(), aux.getIcon()); |
|
89 |
|
|
90 |
if (!aux.isVisible(null, layers)) |
|
91 |
button2.setEnabled(false); |
|
92 |
|
|
93 |
if (!aux.isEnabled(null, layers)) |
|
94 |
button2.setEnabled(false); |
|
95 |
|
|
96 |
button2.setActionCommand((String) arrayKeys.get(i)); |
|
97 |
comboButton.addButton(button2); |
|
98 |
group = aux.getGroupOrder(); |
|
99 |
} |
|
100 |
comboButton.setSelectedItem(actionCommand); |
|
101 |
} |
|
102 |
} |
|
0 | 103 |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.mainplugin/src/main/java/org/gvsig/raster/mainplugin/toolbar/GenericToolBarPanel.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 |
*/ |
|
22 |
package org.gvsig.raster.mainplugin.toolbar; |
|
23 |
|
|
24 |
import java.awt.Insets; |
|
25 |
import java.awt.event.ActionEvent; |
|
26 |
import java.awt.event.ActionListener; |
|
27 |
import java.awt.event.ItemEvent; |
|
28 |
import java.awt.event.ItemListener; |
|
29 |
import java.awt.event.MouseEvent; |
|
30 |
import java.awt.event.MouseListener; |
|
31 |
import java.util.ArrayList; |
|
32 |
import java.util.Iterator; |
|
33 |
import java.util.List; |
|
34 |
|
|
35 |
import javax.swing.JButton; |
|
36 |
import javax.swing.JToolBar; |
|
37 |
|
|
38 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
39 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
40 |
import org.gvsig.gui.beans.comboboxconfigurablelookup.DefaultComboBoxConfigurableLookUpModel; |
|
41 |
import org.gvsig.gui.beans.comboboxconfigurablelookup.JComboBoxConfigurableLookUp; |
|
42 |
import org.gvsig.gui.beans.controls.IControl; |
|
43 |
import org.gvsig.gui.beans.controls.combobutton.ComboButton; |
|
44 |
import org.gvsig.gui.beans.controls.combobutton.ComboButtonEvent; |
|
45 |
import org.gvsig.gui.beans.controls.combobutton.ComboButtonListener; |
|
46 |
import org.gvsig.tools.ToolsLocator; |
|
47 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
48 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
49 |
/** |
|
50 |
* Componente que contiene los objetos visuales de la barra de herramientas |
|
51 |
* generica |
|
52 |
* |
|
53 |
* @version 13/02/2008 |
|
54 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
55 |
*/ |
|
56 |
public class GenericToolBarPanel extends JToolBar implements ComboButtonListener, ActionListener, MouseListener, ItemListener, IControl { |
|
57 |
private static final long serialVersionUID = -4382962282970490523L; |
|
58 |
private JComboBoxConfigurableLookUp jCBCLU = null; |
|
59 |
private ComboButton buttonGroup = new ComboButton(); |
|
60 |
private ComboButton buttonMenu = new ComboButton(); |
|
61 |
private FLayers lastLayers = null; |
|
62 |
|
|
63 |
public GenericToolBarPanel() { |
|
64 |
super("GenericToolBarPanel"); |
|
65 |
initialize(); |
|
66 |
} |
|
67 |
|
|
68 |
/** |
|
69 |
* Especifica que las capas de la vista han cambiado. |
|
70 |
* @param layers |
|
71 |
*/ |
|
72 |
public void setLayers(FLayers layers) { |
|
73 |
lastLayers = layers; |
|
74 |
|
|
75 |
getComboBoxConfigurableLookUp().setBlockPopupHided(true); |
|
76 |
getComboBoxConfigurableLookUp().removeAllItems(); |
|
77 |
|
|
78 |
if(layers != null) { |
|
79 |
List<FLayer> lyrs = getLayerList(layers, null); |
|
80 |
for (int i = 0; i < lyrs.size(); i++) |
|
81 |
getComboBoxConfigurableLookUp().addItem(((FLayer)lyrs.get(i)).getName()); |
|
82 |
|
|
83 |
if (layers.getActives().length > 0) |
|
84 |
getComboBoxConfigurableLookUp().setSelectedItem(layers.getActives()[0].getName()); |
|
85 |
else if (layers.getLayersCount() > 0) |
|
86 |
getComboBoxConfigurableLookUp().setSelectedItem(layers.getLayer(0).getName()); |
|
87 |
} |
|
88 |
reloadSubMenu(); |
|
89 |
getComboBoxConfigurableLookUp().setBlockPopupHided(false); |
|
90 |
} |
|
91 |
|
|
92 |
/** |
|
93 |
* Devuelve un combo de busqueda de items. |
|
94 |
* @return |
|
95 |
*/ |
|
96 |
private JComboBoxConfigurableLookUp getComboBoxConfigurableLookUp() { |
|
97 |
if (jCBCLU == null) { |
|
98 |
jCBCLU = new JComboBoxConfigurableLookUp(); |
|
99 |
jCBCLU.setOnlyOneColorOnText(true); |
|
100 |
jCBCLU.setPrototypeDisplayValue(" "); |
|
101 |
if (jCBCLU.getModel() instanceof DefaultComboBoxConfigurableLookUpModel) { |
|
102 |
((DefaultComboBoxConfigurableLookUpModel) jCBCLU.getModel()).setShowAllItemsInListBox(false); |
|
103 |
((DefaultComboBoxConfigurableLookUpModel) jCBCLU.getModel()).setLookUpAgent(new BinarySearch()); |
|
104 |
((DefaultComboBoxConfigurableLookUpModel) jCBCLU.getModel()).setCaseSensitive(false); |
|
105 |
jCBCLU.setToForceSelectAnItem(true); |
|
106 |
jCBCLU.setDisplayAllItemsWithArrowButton(true); |
|
107 |
} |
|
108 |
jCBCLU.addActionListener(this); |
|
109 |
} |
|
110 |
return jCBCLU; |
|
111 |
} |
|
112 |
|
|
113 |
private void initialize() { |
|
114 |
buttonGroup.addComboButtonClickedListener(this); |
|
115 |
buttonGroup.setName("Menu principal"); |
|
116 |
buttonGroup.setMargin(new Insets(0, 0, 0, 0)); |
|
117 |
buttonGroup.setAlwaysMenuOnClick(true); |
|
118 |
reloadMenuGroup(); |
|
119 |
add(buttonGroup); |
|
120 |
|
|
121 |
buttonMenu.addComboButtonClickedListener(this); |
|
122 |
buttonMenu.setName("Submenus"); |
|
123 |
buttonMenu.addMouseListener(this); |
|
124 |
buttonMenu.setMargin(new Insets(0, 0, 0, 0)); |
|
125 |
reloadMenuGroup(); |
|
126 |
add(buttonMenu); |
|
127 |
|
|
128 |
add(getComboBoxConfigurableLookUp()); |
|
129 |
this.setRollover(true); |
|
130 |
} |
|
131 |
|
|
132 |
/** |
|
133 |
* Recarga los items del menu global dejando seleccionado el item que habia |
|
134 |
* previamente, en caso de que exista |
|
135 |
*/ |
|
136 |
public void reloadMenuGroup() { |
|
137 |
FLayer[] layers = new FLayer[] { getLayerSelected() }; |
|
138 |
ButtonItems buttonItems = new ButtonItems(buttonGroup, layers); |
|
139 |
|
|
140 |
ExtensionPointManager extensionPoints =ToolsLocator.getExtensionPointManager(); |
|
141 |
ExtensionPoint point=extensionPoints.get("GenericToolBarGroup"); |
|
142 |
Iterator<?> iterator = point.iterator(); |
|
143 |
while (iterator.hasNext()) { |
|
144 |
ExtensionPoint.Extension extension = (ExtensionPoint.Extension) iterator |
|
145 |
.next(); |
|
146 |
Object object; |
|
147 |
try { |
|
148 |
object = extension.create(); |
|
149 |
} catch (Exception e) { |
|
150 |
throw new RuntimeException(e); |
|
151 |
} |
|
152 |
if (object instanceof IGenericToolBarMenuItem) |
|
153 |
buttonItems.addButton((IGenericToolBarMenuItem) object, extension |
|
154 |
.getName()); |
|
155 |
} |
|
156 |
buttonItems.refresh(); |
|
157 |
reloadSubMenu(); |
|
158 |
} |
|
159 |
|
|
160 |
/** |
|
161 |
* Recarga los items del submenu dejando seleccionado el item que habia |
|
162 |
* previamente, en caso de que exista |
|
163 |
*/ |
|
164 |
public void reloadSubMenu() { |
|
165 |
FLayer[] layers = new FLayer[] { getLayerSelected() }; |
|
166 |
ButtonItems buttonItems = new ButtonItems(buttonMenu, layers); |
|
167 |
ExtensionPointManager extensionPoints =ToolsLocator.getExtensionPointManager(); |
|
168 |
ExtensionPoint point=extensionPoints.add("GenericToolBarMenu"); |
|
169 |
Iterator<?> iterator = point.iterator(); |
|
170 |
while (iterator.hasNext()) { |
|
171 |
ExtensionPoint.Extension entry = (ExtensionPoint.Extension) iterator |
|
172 |
.next(); |
|
173 |
Object object; |
|
174 |
try { |
|
175 |
object = entry.create(); |
|
176 |
} catch (Exception e) { |
|
177 |
throw new RuntimeException(e); |
|
178 |
} |
|
179 |
if (object instanceof IGenericToolBarMenuItem) { |
|
180 |
IGenericToolBarMenuItem item = (IGenericToolBarMenuItem) object; |
|
181 |
if (!buttonGroup.getActionCommand().equals(item.getGroup())) |
|
182 |
continue; |
|
183 |
buttonItems.addButton(item, entry.getName()); |
|
184 |
} |
|
185 |
} |
|
186 |
buttonItems.refresh(); |
|
187 |
} |
|
188 |
|
|
189 |
/** |
|
190 |
* Devuelve el layer seleccionado en el combobox |
|
191 |
* @return |
|
192 |
*/ |
|
193 |
public FLayer getLayerSelected() { |
|
194 |
if (lastLayers == null) |
|
195 |
return null; |
|
196 |
List<FLayer> lyrs = getLayerList(lastLayers, null); |
|
197 |
for (int i = 0; i < lyrs.size(); i++) |
|
198 |
if (((FLayer)lyrs.get(i)).getName().equals(getComboBoxConfigurableLookUp().getEditor().getItem())) |
|
199 |
return (FLayer)lyrs.get(i); |
|
200 |
return null; |
|
201 |
} |
|
202 |
|
|
203 |
public static List<FLayer> getLayerList(FLayers srcLyrs, List<FLayer> destLyrs) { |
|
204 |
if(srcLyrs == null) |
|
205 |
return null; |
|
206 |
if(destLyrs == null) |
|
207 |
destLyrs = new ArrayList<FLayer>(); |
|
208 |
for (int i = 0; i < srcLyrs.getLayersCount(); i++) { |
|
209 |
if(srcLyrs.getLayer(i) instanceof FLayers) |
|
210 |
destLyrs = getLayerList((FLayers)srcLyrs.getLayer(i), destLyrs); |
|
211 |
else |
|
212 |
destLyrs.add(srcLyrs.getLayer(i)); |
|
213 |
} |
|
214 |
return destLyrs; |
|
215 |
} |
|
216 |
|
|
217 |
/* |
|
218 |
* (non-Javadoc) |
|
219 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) |
|
220 |
*/ |
|
221 |
public void actionPerformed(ActionEvent e) { |
|
222 |
if (e.getSource() == getComboBoxConfigurableLookUp()) { |
|
223 |
// selectLayerInTOC(lastLayers, (String) getComboBoxConfigurableLookUp().getSelectedItem()); |
|
224 |
} |
|
225 |
} |
|
226 |
|
|
227 |
/* |
|
228 |
* (non-Javadoc) |
|
229 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) |
|
230 |
*/ |
|
231 |
public void actionComboButtonClicked(ComboButtonEvent e) { |
|
232 |
if (e.getSource() == buttonGroup) { |
|
233 |
reloadSubMenu(); |
|
234 |
return; |
|
235 |
} |
|
236 |
if (e.getSource() == buttonMenu) { |
|
237 |
ExtensionPointManager extensionPoints =ToolsLocator.getExtensionPointManager(); |
|
238 |
ExtensionPoint point=extensionPoints.add("GenericToolBarMenu"); |
|
239 |
Iterator<?> iterator = point.iterator(); |
|
240 |
while (iterator.hasNext()) { |
|
241 |
ExtensionPoint.Extension entry = (ExtensionPoint.Extension) iterator |
|
242 |
.next(); |
|
243 |
if (!entry.getName().equals( |
|
244 |
((JButton) e.getSource()).getActionCommand())) |
|
245 |
continue; |
|
246 |
Object object; |
|
247 |
try { |
|
248 |
object = entry.create(); |
|
249 |
} catch (Exception e1) { |
|
250 |
// TODO Auto-generated catch block |
|
251 |
throw new RuntimeException(e1); |
|
252 |
} |
|
253 |
if (object instanceof IGenericToolBarMenuItem) { |
|
254 |
IGenericToolBarMenuItem item = (IGenericToolBarMenuItem) object; |
|
255 |
|
|
256 |
FLayer[] layers = new FLayer[] { getLayerSelected() }; |
|
257 |
if (!item.isVisible(null, layers)) |
|
258 |
continue; |
|
259 |
if (!item.isEnabled(null, layers)) |
|
260 |
continue; |
|
261 |
|
|
262 |
if (getLayerSelected() != null) { |
|
263 |
item.execute(null, new FLayer[] { getLayerSelected() }); |
|
264 |
} else |
|
265 |
item.execute(null, null); |
|
266 |
reloadSubMenu(); |
|
267 |
return; |
|
268 |
} |
|
269 |
} |
|
270 |
return; |
|
271 |
} |
|
272 |
} |
|
273 |
|
|
274 |
/** |
|
275 |
* Selecciona una capa en el TOC |
|
276 |
* @param layers |
|
277 |
* @param nameLayer |
|
278 |
*/ |
|
279 |
// private void selectLayerInTOC(FLayers layers, String nameLayer) { |
|
280 |
// if (layers == null) |
|
281 |
// return; |
|
282 |
// for (int i = 0; i < layers.getLayersCount(); i++) { |
|
283 |
// if (layers.getLayer(i) instanceof FLayers) { |
|
284 |
// selectLayerInTOC((FLayers) layers.getLayer(i), nameLayer); |
|
285 |
// } else { |
|
286 |
// if (layers.getLayer(i) instanceof FLayer) { |
|
287 |
// FLayer layer = ((FLayer) layers.getLayer(i)); |
|
288 |
// if (layer.getName().equals(nameLayer) && !layer.isActive()) { |
|
289 |
// layer.setActive(true); |
|
290 |
// } |
|
291 |
// } |
|
292 |
// } |
|
293 |
// } |
|
294 |
// } |
|
295 |
|
|
296 |
/** |
|
297 |
* Recargo el menu cada vez que entra el raton en el boton, para ahorrar tiempo en |
|
298 |
* la visualizacion del mismo |
|
299 |
*/ |
|
300 |
public void mouseEntered(MouseEvent e) { |
|
301 |
this.reloadSubMenu(); |
|
302 |
} |
|
303 |
|
|
304 |
public void itemStateChanged(ItemEvent e) { |
|
305 |
// if (e.getStateChange() != ItemEvent.SELECTED) |
|
306 |
// return; |
|
307 |
// |
|
308 |
// FLayer layer = getLayerSelected(); |
|
309 |
// |
|
310 |
// if (layer == null) |
|
311 |
// return; |
|
312 |
// |
|
313 |
// FLayers layers = lastLayers; |
|
314 |
// for(int i = 0; i < layers.getLayersCount(); i++) |
|
315 |
// layers.getLayer(i).setActive(false); |
|
316 |
// |
|
317 |
// layer.setActive(true); |
|
318 |
// View view = (View) PluginServices.getMDIManager().getActiveWindow(); |
|
319 |
// JScrollBar verticalBar = view.getTOC().getJScrollPane().getVerticalScrollBar(); |
|
320 |
// double widthPerEntry = verticalBar.getMaximum() / layer.getMapContext().getLayers().getLayersCount(); |
|
321 |
// verticalBar.setValue((int)widthPerEntry * (layer.getMapContext().getLayers().getLayersCount() - pos - 1)); |
|
322 |
} |
|
323 |
|
|
324 |
public void mouseClicked(MouseEvent e) {} |
|
325 |
public void mouseExited(MouseEvent e) {} |
|
326 |
public void mousePressed(MouseEvent e) {} |
|
327 |
public void mouseReleased(MouseEvent e) {} |
|
328 |
|
|
329 |
public void addActionListener(ActionListener listener) { |
|
330 |
// TODO Auto-generated method stub |
|
331 |
|
|
332 |
} |
|
333 |
|
|
334 |
public Object getValue() { |
|
335 |
// TODO Auto-generated method stub |
|
336 |
return null; |
|
337 |
} |
|
338 |
|
|
339 |
public void removeActionListener(ActionListener listener) { |
|
340 |
// TODO Auto-generated method stub |
|
341 |
|
|
342 |
} |
|
343 |
|
|
344 |
public Object setValue(Object value) { |
|
345 |
// TODO Auto-generated method stub |
|
346 |
return null; |
|
347 |
} |
|
348 |
|
|
349 |
} |
|
0 | 350 |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.mainplugin/src/main/java/org/gvsig/raster/mainplugin/toolbar/GenericToolBarMenuItem.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 |
*/ |
|
22 |
package org.gvsig.raster.mainplugin.toolbar; |
|
23 |
|
|
24 |
import java.util.Map; |
|
25 |
|
|
26 |
import javax.swing.Icon; |
|
27 |
|
|
28 |
import org.gvsig.andami.IconThemeHelper; |
|
29 |
import org.gvsig.app.project.documents.view.toc.ITocItem; |
|
30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
31 |
import org.gvsig.tools.extensionpoint.ExtensionBuilder; |
|
32 |
|
|
33 |
/** |
|
34 |
* Clase que implementa un IGenericToolBarMenuItem para evitar tener que crear |
|
35 |
* clases para items de menu sencillas |
|
36 |
* |
|
37 |
* @version 06/02/2008 |
|
38 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
39 |
*/ |
|
40 |
public class GenericToolBarMenuItem implements IGenericToolBarMenuItem, ExtensionBuilder { |
|
41 |
private String text = ""; |
|
42 |
private int order = 0; |
|
43 |
private int groupOrder = 0; |
|
44 |
private Icon icon = null; |
|
45 |
private String group = ""; |
|
46 |
|
|
47 |
public GenericToolBarMenuItem(String text, Icon icon) { |
|
48 |
this(text, icon, "", 0); |
|
49 |
} |
|
50 |
|
|
51 |
public GenericToolBarMenuItem(String text) { |
|
52 |
this(text, IconThemeHelper.getImageIcon("blank-icon"), "", 0); |
|
53 |
} |
|
54 |
|
|
55 |
public GenericToolBarMenuItem(String text, Icon icon, String group, int order) { |
|
56 |
this.text = text; |
|
57 |
this.order = order; |
|
58 |
this.icon = icon; |
|
59 |
this.group = group; |
|
60 |
} |
|
61 |
|
|
62 |
public GenericToolBarMenuItem(String text, Icon icon, String group) { |
|
63 |
this(text, icon, group, 0); |
|
64 |
} |
|
65 |
|
|
66 |
public GenericToolBarMenuItem(String text, Icon icon, int order) { |
|
67 |
this(text, icon, "", 0); |
|
68 |
} |
|
69 |
|
|
70 |
/* |
|
71 |
* (non-Javadoc) |
|
72 |
* @see org.gvsig.raster.gui.IGenericToolBarMenuItem#getGroup() |
|
73 |
*/ |
|
74 |
public String getGroup() { |
|
75 |
return group; |
|
76 |
} |
|
77 |
|
|
78 |
/* |
|
79 |
* (non-Javadoc) |
|
80 |
* @see org.gvsig.rastertools.generictoolbar.IGenericToolBarMenuItem#getOrder() |
|
81 |
*/ |
|
82 |
public int getOrder() { |
|
83 |
return order; |
|
84 |
} |
|
85 |
|
|
86 |
/* |
|
87 |
* (non-Javadoc) |
|
88 |
* @see org.gvsig.rastertools.generictoolbar.IGenericToolBarMenuItem#getText() |
|
89 |
*/ |
|
90 |
public String getText() { |
|
91 |
return text; |
|
92 |
} |
|
93 |
|
|
94 |
/* |
|
95 |
* (non-Javadoc) |
|
96 |
* @see org.gvsig.rastertools.generictoolbar.IGenericToolBarMenuItem#getIcon() |
|
97 |
*/ |
|
98 |
public Icon getIcon() { |
|
99 |
return icon; |
|
100 |
} |
|
101 |
|
|
102 |
/* |
|
103 |
* (non-Javadoc) |
|
104 |
* @see org.gvsig.raster.gui.IGenericToolBarMenuItem#isEnabled(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[]) |
|
105 |
*/ |
|
106 |
public boolean isEnabled(ITocItem item, FLayer[] selectedItems) { |
|
107 |
return true; |
|
108 |
} |
|
109 |
|
|
110 |
/* |
|
111 |
* (non-Javadoc) |
|
112 |
* @see org.gvsig.raster.gui.IGenericToolBarMenuItem#isVisible(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[]) |
|
113 |
*/ |
|
114 |
public boolean isVisible(ITocItem item, FLayer[] selectedItems) { |
|
115 |
return true; |
|
116 |
} |
|
117 |
|
|
118 |
/* |
|
119 |
* (non-Javadoc) |
|
120 |
* @see org.gvsig.raster.gui.IGenericToolBarMenuItem#getGroupOrder() |
|
121 |
*/ |
|
122 |
public int getGroupOrder() { |
|
123 |
return groupOrder; |
|
124 |
} |
|
125 |
|
|
126 |
/* |
|
127 |
* (non-Javadoc) |
|
128 |
* @see org.gvsig.raster.gui.IGenericToolBarMenuItem#execute(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[]) |
|
129 |
*/ |
|
130 |
public void execute(ITocItem item, FLayer[] selectedItems) {} |
|
131 |
|
|
132 |
public Object create() { |
|
133 |
return this; |
|
134 |
} |
|
135 |
|
|
136 |
public Object create(Object[] args) { |
|
137 |
return this; |
|
138 |
} |
|
139 |
|
|
140 |
public Object create(Map args) { |
|
141 |
return this; |
|
142 |
} |
|
143 |
} |
|
0 | 144 |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.mainplugin/src/main/java/org/gvsig/raster/mainplugin/GenericToolBarModule.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 |
*/ |
|
22 |
package org.gvsig.raster.mainplugin; |
|
23 |
|
|
24 |
import java.awt.Dimension; |
|
25 |
|
|
26 |
import org.gvsig.andami.IconThemeHelper; |
|
27 |
import org.gvsig.andami.PluginServices; |
|
28 |
import org.gvsig.andami.plugins.Extension; |
|
29 |
import org.gvsig.andami.ui.mdiFrame.MDIFrame; |
|
30 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
31 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
32 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
33 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
34 |
import org.gvsig.i18n.Messages; |
|
35 |
import org.gvsig.raster.mainplugin.toolbar.GenericToolBarMenuItem; |
|
36 |
import org.gvsig.raster.mainplugin.toolbar.GenericToolBarPanel; |
|
37 |
import org.gvsig.tools.ToolsLocator; |
|
38 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
39 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
40 |
|
|
41 |
/** |
|
42 |
* Extension para la barra de herramientas generica |
|
43 |
* |
|
44 |
* @version 13/02/2008 |
|
45 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
46 |
*/ |
|
47 |
public class GenericToolBarModule extends Extension { |
|
48 |
private GenericToolBarPanel toolBar = null; |
|
49 |
|
|
50 |
/** |
|
51 |
* Crea y devuelve la barra de herramientas |
|
52 |
* @return |
|
53 |
*/ |
|
54 |
private GenericToolBarPanel getGenericToolBarPanel() { |
|
55 |
if (toolBar == null) { |
|
56 |
MDIFrame f = (MDIFrame) PluginServices.getMainFrame(); |
|
57 |
if (f == null) |
|
58 |
return null; |
|
59 |
toolBar = new GenericToolBarPanel(); |
|
60 |
toolBar.setVisible(false); |
|
61 |
f.addToolBarControl(getClass(), toolBar, "RasterToolBar"); |
|
62 |
} else { |
|
63 |
toolBar.setPreferredSize(new Dimension(300, getToolbarHeight())); |
|
64 |
} |
|
65 |
|
|
66 |
return toolBar; |
|
67 |
} |
|
68 |
|
|
69 |
/** |
|
70 |
* Obtenemos el alto de cualquier toolbar que este visible en gvSIG y no sea |
|
71 |
* nuestro para poder asignarselo al GenericToolBar como PreferredSize. En |
|
72 |
* caso de no encontrar ninguno que cumpla las condiciones, se devolver? 24 |
|
73 |
* @return |
|
74 |
*/ |
|
75 |
private int getToolbarHeight() { |
|
76 |
if ((PluginServices.getMainFrame() == null) || |
|
77 |
(PluginServices.getMainFrame().getToolbars() == null) || |
|
78 |
(PluginServices.getMainFrame().getToolbars().length <= 0)) |
|
79 |
return 24; |
|
80 |
|
|
81 |
for (int i = 0; i < PluginServices.getMainFrame().getToolbars().length; i++) { |
|
82 |
if ((PluginServices.getMainFrame().getToolbars()[i].getHeight() > 16) && |
|
83 |
((Object) PluginServices.getMainFrame().getToolbars()[i] != (Object) toolBar)) |
|
84 |
return PluginServices.getMainFrame().getToolbars()[i].getHeight(); |
|
85 |
} |
|
86 |
return 24; |
|
87 |
} |
|
88 |
|
|
89 |
/* |
|
90 |
* (non-Javadoc) |
|
91 |
* @see com.iver.andami.plugins.IExtension#initialize() |
|
92 |
*/ |
|
93 |
public void initialize() { |
|
94 |
registerIcons(); |
|
95 |
|
|
96 |
// Creaci?n del punto de extensi?n para registrar paneles en el cuadro de propiedades. |
|
97 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
|
98 |
ExtensionPoint point = extensionPoints.add("GenericToolBarGroup"); |
|
99 |
point.setDescription("Punto de extension para los grupos de menus del GenericToolBarPanel"); |
|
100 |
|
|
101 |
point.append("RasterLayer", "", new GenericToolBarMenuItem(Messages.getText("capa_raster"), IconThemeHelper.getImageIcon("menu-layer-icon"))); |
|
102 |
point.append("RasterProcess", "", new GenericToolBarMenuItem(Messages.getText("process_raster"), IconThemeHelper.getImageIcon("menu-process-icon"))); |
|
103 |
point.append("Multispectral", "", new GenericToolBarMenuItem(Messages.getText("multispectral"), IconThemeHelper.getImageIcon("menu-multispectral-icon"))); |
|
104 |
point.append("Enhanced", "", new GenericToolBarMenuItem(Messages.getText("enhanced"), IconThemeHelper.getImageIcon("menu-enhanced-icon"))); |
|
105 |
point.append("GeoRaster", "", new GenericToolBarMenuItem(Messages.getText("transformaciones_geograficas"), IconThemeHelper.getImageIcon("menu-transgeo-icon"))); |
|
106 |
point.append("RasterExport", "", new GenericToolBarMenuItem(Messages.getText("raster_export"), IconThemeHelper.getImageIcon("menu-raster-export"))); |
|
107 |
|
|
108 |
point = extensionPoints.add("GenericToolBarMenu"); |
|
109 |
point.setDescription("Punto de extension para los submenus del GenericToolBarPanel"); |
|
110 |
} |
|
111 |
|
|
112 |
private void registerIcons() { |
|
113 |
//Actions |
|
114 |
IconThemeHelper.registerIcon("action", "menu-layer-icon", this); |
|
115 |
IconThemeHelper.registerIcon("action", "menu-process-icon", this); |
|
116 |
IconThemeHelper.registerIcon("action", "menu-transgeo-icon", this); |
|
117 |
IconThemeHelper.registerIcon("action", "menu-raster-export", this); |
|
118 |
IconThemeHelper.registerIcon("action", "menu-multispectral-icon", this); |
|
119 |
IconThemeHelper.registerIcon("action", "menu-enhanced-icon", this); |
|
120 |
} |
|
121 |
|
|
122 |
@Override |
|
123 |
public void postInitialize() { |
|
124 |
super.postInitialize(); |
|
125 |
if (getGenericToolBarPanel() != null) |
|
126 |
getGenericToolBarPanel().reloadMenuGroup(); |
|
127 |
} |
|
128 |
|
|
129 |
/* |
|
130 |
* (non-Javadoc) |
|
131 |
* @see com.iver.andami.plugins.IExtension#isEnabled() |
|
132 |
*/ |
|
133 |
public boolean isEnabled() { |
|
134 |
return false; |
|
135 |
} |
|
136 |
|
|
137 |
/** |
|
138 |
* Establece si la barra de herramientas esta visible |
|
139 |
* @param enabled |
|
140 |
*/ |
|
141 |
private void setToolBarVisible(boolean enabled) { |
|
142 |
if (getGenericToolBarPanel() == null) |
|
143 |
return; |
|
144 |
|
|
145 |
toolBar.setVisible(enabled); |
|
146 |
} |
|
147 |
|
|
148 |
/* |
|
149 |
* (non-Javadoc) |
|
150 |
* @see com.iver.andami.plugins.IExtension#isVisible() |
|
151 |
*/ |
|
152 |
@SuppressWarnings("deprecation") |
|
153 |
public boolean isVisible() { |
|
154 |
org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
|
155 |
if (f == null || !(f instanceof AbstractViewPanel)) { |
|
156 |
setToolBarVisible(false); |
|
157 |
return false; |
|
158 |
} |
|
159 |
|
|
160 |
if (getGenericToolBarPanel() != null) |
|
161 |
getGenericToolBarPanel().setLayers(null); |
|
162 |
AbstractViewPanel vista = (AbstractViewPanel) f; |
|
163 |
ViewDocument model = vista.getModel(); |
|
164 |
MapContext mapa = model.getMapContext(); |
|
165 |
if (mapa.getLayers().getLayersCount() > 0) { |
|
166 |
if (getGenericToolBarPanel() != null) { |
|
167 |
getGenericToolBarPanel().setLayers(mapa.getLayers()); |
|
168 |
} |
|
169 |
} |
|
170 |
|
|
171 |
setToolBarVisible(true); |
|
172 |
return true; |
|
173 |
|
|
174 |
/*if (f instanceof AbstractViewPanel) { |
|
175 |
AbstractViewPanel vista = (AbstractViewPanel) f; |
|
176 |
ViewDocument model = vista.getModel(); |
|
177 |
MapContext mapa = model.getMapContext(); |
|
178 |
if (mapa.getLayers().getLayersCount() > 0) { |
|
179 |
setToolBarVisible(true); |
|
180 |
if (getGenericToolBarPanel() != null) { |
|
181 |
getGenericToolBarPanel().setLayers(mapa.getLayers()); |
|
182 |
} |
|
183 |
return true; |
|
184 |
} |
|
185 |
} |
|
186 |
|
|
187 |
setToolBarVisible(false); |
|
188 |
return false;*/ |
|
189 |
} |
|
190 |
|
|
191 |
public void execute(String actionCommand) {} |
|
192 |
} |
|
0 | 193 |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.mainplugin/src/main/resources-plugin/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<depends plugin-name="org.gvsig.app" /> |
|
4 |
<depends plugin-name="org.gvsig.app.document.table.app.mainplugin" /> |
|
5 |
<resourceBundle name="text"/> |
|
6 |
<libraries library-dir="lib"/> |
|
7 |
<extensions> |
|
8 |
<extension class-name="org.gvsig.raster.mainplugin.RasterMainPluginExtension" |
|
9 |
description="" |
|
10 |
active="true" |
|
11 |
priority="1"> |
|
12 |
</extension> |
|
13 |
</extensions> |
|
14 |
</plugin-config> |
|
0 | 15 |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.mainplugin/src/main/resources-plugin/org/gvsig/raster/mainplugin/text.properties | ||
---|---|---|
1 |
capa_raster=Capa Raster |
|
2 |
process_raster=Procesos Raster |
|
3 |
multispectral=Multiespectral |
|
4 |
enhanced=Realce |
|
5 |
transformaciones_geograficas=Transformaciones geograficas |
|
6 |
raster_export=Exportar Raster |
|
0 | 7 |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.mainplugin/src/main/resources-plugin/org/gvsig/raster/mainplugin/text_en.properties | ||
---|---|---|
1 |
capa_raster=Raster layer |
|
2 |
process_raster=Raster process |
|
3 |
multispectral=Multispectral |
|
4 |
enhanced=Enhanced |
|
5 |
transformaciones_geograficas=Geographic transformations |
|
6 |
raster_export=Export to raster |
|
0 | 7 |
Also available in: Unified diff