Revision 2098
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/test/java/org/gvsig/tools/AppTest.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 |
package org.gvsig.tools; |
|
25 |
|
|
26 |
import junit.framework.Test; |
|
27 |
import junit.framework.TestCase; |
|
28 |
import junit.framework.TestSuite; |
|
29 |
|
|
30 |
/** |
|
31 |
* Unit test for simple App. |
|
32 |
*/ |
|
33 |
public class AppTest extends TestCase { |
|
34 |
|
|
35 |
/** |
|
36 |
* @return the suite of tests being tested |
|
37 |
*/ |
|
38 |
public static Test suite() { |
|
39 |
return new TestSuite(AppTest.class); |
|
40 |
} |
|
41 |
|
|
42 |
/** |
|
43 |
* Create the test case |
|
44 |
* |
|
45 |
* @param testName |
|
46 |
* name of the test case |
|
47 |
*/ |
|
48 |
public AppTest(String testName) { |
|
49 |
super(testName); |
|
50 |
} |
|
51 |
|
|
52 |
/** |
|
53 |
* Rigourous Test :-) |
|
54 |
*/ |
|
55 |
public void testApp() { |
|
56 |
assertTrue(true); |
|
57 |
} |
|
58 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.tools.swing.api.ToolsSwingLibrary |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/icontheme/IconTheme.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 |
package org.gvsig.tools.swing.icontheme; |
|
25 |
|
|
26 |
import java.awt.Image; |
|
27 |
import java.io.File; |
|
28 |
import java.net.URL; |
|
29 |
import java.util.Iterator; |
|
30 |
|
|
31 |
import javax.swing.ImageIcon; |
|
32 |
|
|
33 |
public interface IconTheme { |
|
34 |
|
|
35 |
public static final String NO_ICON_NAME = "-no-icon-"; |
|
36 |
|
|
37 |
interface Icon extends Comparable<Icon> { |
|
38 |
public String getName(); |
|
39 |
public String getGroup() ; |
|
40 |
public ImageIcon getImageIcon(); |
|
41 |
public Image getImage(); |
|
42 |
public Object getResource() ; |
|
43 |
public URL getURL() ; |
|
44 |
public String getLabel(); |
|
45 |
public String getProviderName(); |
|
46 |
} |
|
47 |
|
|
48 |
/** |
|
49 |
* Load all icons from the IconTheme |
|
50 |
*/ |
|
51 |
public void load(Object resource) throws IllegalArgumentException; |
|
52 |
|
|
53 |
|
|
54 |
public void setDefault(IconTheme def); |
|
55 |
|
|
56 |
public IconTheme getDefault(); |
|
57 |
|
|
58 |
/** |
|
59 |
* Returns <code>true</code> if the icon theme contains a mapping for the |
|
60 |
* specified iconName. |
|
61 |
* |
|
62 |
* @param iconName The key to check if it has been registered in this |
|
63 |
* IconTheme |
|
64 |
* |
|
65 |
* @return <code>true</code> if this IconTheme contains |
|
66 |
* <code>iconName</code>, <code>false</code> otherwise. |
|
67 |
*/ |
|
68 |
public boolean exists(String name); |
|
69 |
|
|
70 |
/** |
|
71 |
* Gets the ImageIcon associated with the provided name, if the name |
|
72 |
* is present in the theme. If the icon not exists try to return |
|
73 |
* a icon with name "no-icon" or returns <code>null</code> if |
|
74 |
* this not exists. |
|
75 |
* |
|
76 |
* @param name |
|
77 |
* The name whose associated icon is to be retrieved |
|
78 |
* |
|
79 |
* @return |
|
80 |
* The icon associated with the provided name |
|
81 |
*/ |
|
82 |
public ImageIcon get(String iconName); |
|
83 |
|
|
84 |
/** |
|
85 |
* Return the ThemeIcon associated with the name. |
|
86 |
* |
|
87 |
* @param name of the icon |
|
88 |
* @return the IconTheme requiered |
|
89 |
*/ |
|
90 |
public Icon getThemeIcon(String name); |
|
91 |
|
|
92 |
/** |
|
93 |
* Gets the theme name of the theme |
|
94 |
* @return theme name |
|
95 |
*/ |
|
96 |
public String getName(); |
|
97 |
|
|
98 |
/** |
|
99 |
* Sets the theme name of the theme |
|
100 |
* |
|
101 |
* @param themeName |
|
102 |
*/ |
|
103 |
public void setName(String themeName); |
|
104 |
|
|
105 |
public String getID(); |
|
106 |
|
|
107 |
public void setID(String id); |
|
108 |
|
|
109 |
/** |
|
110 |
* Gets the theme description. |
|
111 |
* |
|
112 |
* @return The description of this theme. |
|
113 |
*/ |
|
114 |
public String getDescription(); |
|
115 |
|
|
116 |
/** |
|
117 |
* Sets the theme description. It should be a short description |
|
118 |
* (around 20-30 words), including the highlights of the theme, |
|
119 |
* the author and maybe its email address or a link the the theme's |
|
120 |
* homepage. |
|
121 |
* |
|
122 |
* @param description |
|
123 |
*/ |
|
124 |
public void setDescription(String description); |
|
125 |
|
|
126 |
/** |
|
127 |
* Return an iterator over the names of the icons in the theme. |
|
128 |
* |
|
129 |
* @return iterator of names of icons |
|
130 |
*/ |
|
131 |
public Iterator<String> iterator(); |
|
132 |
|
|
133 |
/** |
|
134 |
* Return an iterator over the ThemIcon in the theme. |
|
135 |
* |
|
136 |
* @return iterator of ThemeIcon |
|
137 |
*/ |
|
138 |
public Iterator<Icon> getThemeIcons(); |
|
139 |
|
|
140 |
|
|
141 |
/** |
|
142 |
* Return the icon used as icon by default when the requested icon |
|
143 |
* not exists. |
|
144 |
* |
|
145 |
* @return the default icon to use. |
|
146 |
*/ |
|
147 |
public ImageIcon getDefaultIcon(); |
|
148 |
|
|
149 |
/** |
|
150 |
* Set the default icon to use when the requestd icon not exists. |
|
151 |
* |
|
152 |
* @param icon |
|
153 |
*/ |
|
154 |
public void setDefaultIcon(ImageIcon icon); |
|
155 |
|
|
156 |
public void setDefaultIcon(URL resource); |
|
157 |
|
|
158 |
public void setDefaultIcon(String name); |
|
159 |
|
|
160 |
/** |
|
161 |
* Register a icon in the theme. |
|
162 |
* The parameter icon can be null if the resource is specified. |
|
163 |
* The parameter resource can be null if the icon is specified. |
|
164 |
* |
|
165 |
* Plugin and group can be null. |
|
166 |
* |
|
167 |
* @param provider name of the icon |
|
168 |
* @param group name for the icon. |
|
169 |
* @param name of icon |
|
170 |
* @param icon, can be nulll if the resource is specified. |
|
171 |
* @param resource, resource of the icon, usualy and url to the icon. |
|
172 |
* |
|
173 |
* @throws IllegalArgumentException if name is null/empty or icon/resource are null |
|
174 |
*/ |
|
175 |
public void registerDefault(String provider, String group, String name, ImageIcon icon, URL resource) throws IllegalArgumentException; |
|
176 |
|
|
177 |
/** |
|
178 |
* Register a icon in the theme. |
|
179 |
* The parameter icon can be null if the resource is specified. |
|
180 |
* The parameter resource can be null if the icon is specified. |
|
181 |
* |
|
182 |
* Plugin and group can be null. |
|
183 |
* |
|
184 |
* @param provider name of the icon |
|
185 |
* @param group name for the icon. |
|
186 |
* @param name of icon |
|
187 |
* @param icon, can be nulll if the resource is specified. |
|
188 |
* @param resource, resource of the icon, usualy and url to the icon. |
|
189 |
* |
|
190 |
* @throws IllegalArgumentException if name is null/empty or icon/resource are null |
|
191 |
*/ |
|
192 |
public void register(String provider, String group, String name, ImageIcon icon, URL resource) throws IllegalArgumentException; |
|
193 |
|
|
194 |
public void export(File folder); |
|
195 |
|
|
196 |
/** |
|
197 |
* @deprecated use {@link #getDefaultIcon()} |
|
198 |
* @return |
|
199 |
*/ |
|
200 |
public ImageIcon getNoIcon(); |
|
201 |
|
|
202 |
/** |
|
203 |
* @deprecated use {@link #get(String)} instead |
|
204 |
*/ |
|
205 |
public ImageIcon get(String iconName, ClassLoader loader); |
|
206 |
|
|
207 |
/** |
|
208 |
* @deprecated use {@link #registerDefault(PluginServices, String, String, ImageIcon, Object)} |
|
209 |
*/ |
|
210 |
public void registerDefault(String iconName, ImageIcon image); |
|
211 |
|
|
212 |
/** |
|
213 |
* @deprecated use {@link #registerDefault(PluginServices, String, String, ImageIcon, Object)} |
|
214 |
*/ |
|
215 |
public void registerDefault(String iconName, Object resource); |
|
216 |
|
|
217 |
/** |
|
218 |
* @deprecated use {@link #register(PluginServices, String, String, ImageIcon, Object)} |
|
219 |
*/ |
|
220 |
public void register(String iconName, ImageIcon image); |
|
221 |
|
|
222 |
/** |
|
223 |
* @deprecated use {@link #register(PluginServices, String, String, ImageIcon, Object)} |
|
224 |
*/ |
|
225 |
public void register(String iconName, Object resource); |
|
226 |
} |
|
0 | 227 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/icontheme/IconThemeManager.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 |
package org.gvsig.tools.swing.icontheme; |
|
25 |
|
|
26 |
import java.util.Iterator; |
|
27 |
|
|
28 |
import org.gvsig.tools.util.FolderSet; |
|
29 |
|
|
30 |
public interface IconThemeManager { |
|
31 |
/** |
|
32 |
* Gets the default theme |
|
33 |
* @return the default theme. |
|
34 |
*/ |
|
35 |
public IconTheme getDefault(); |
|
36 |
|
|
37 |
/** |
|
38 |
* Sets the iconTheme like current theme |
|
39 |
* @param iconTheme |
|
40 |
*/ |
|
41 |
public void setCurrent(IconTheme iconTheme); |
|
42 |
|
|
43 |
/** |
|
44 |
* Gets the current theme |
|
45 |
* @return current the current theme |
|
46 |
*/ |
|
47 |
public IconTheme getCurrent(); |
|
48 |
|
|
49 |
/** |
|
50 |
* Returns the theme that has been registered with the name that receives like |
|
51 |
* parameter |
|
52 |
* @param themeName |
|
53 |
* @return the theme that contains like name in its properties the parameter |
|
54 |
*/ |
|
55 |
public IconTheme get(String themeID); |
|
56 |
|
|
57 |
public int getCount(); |
|
58 |
|
|
59 |
public IconTheme get(int index); |
|
60 |
|
|
61 |
public boolean contains(IconTheme theme); |
|
62 |
|
|
63 |
public Iterator<IconTheme> iterator(); |
|
64 |
|
|
65 |
public boolean add(IconTheme theme); |
|
66 |
|
|
67 |
public boolean remove(IconTheme theme); |
|
68 |
|
|
69 |
public void clear(); |
|
70 |
|
|
71 |
public FolderSet getRepository(); |
|
72 |
|
|
73 |
public double getScaleFactor(); |
|
74 |
|
|
75 |
public void setScaleFactor(double scaleFactor); |
|
76 |
} |
|
0 | 77 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/pickercontroller/DatePickerController.java | ||
---|---|---|
1 |
package org.gvsig.tools.swing.api.pickercontroller; |
|
2 |
|
|
3 |
import java.util.Date; |
|
4 |
|
|
5 |
/** |
|
6 |
* |
|
7 |
* @author jjdelcerro |
|
8 |
*/ |
|
9 |
public interface DatePickerController extends PickerController<Date> { |
|
10 |
|
|
11 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/pickercontroller/ColorPickerController.java | ||
---|---|---|
1 |
package org.gvsig.tools.swing.api.pickercontroller; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
|
|
5 |
/** |
|
6 |
* |
|
7 |
* @author jjdelcerro |
|
8 |
*/ |
|
9 |
public interface ColorPickerController extends PickerController<Color> { |
|
10 |
|
|
11 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/pickercontroller/FilePickerController.java | ||
---|---|---|
1 |
package org.gvsig.tools.swing.api.pickercontroller; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import javax.swing.filechooser.FileFilter; |
|
5 |
|
|
6 |
/** |
|
7 |
* |
|
8 |
* @author jjdelcerro |
|
9 |
*/ |
|
10 |
public interface FilePickerController extends PickerController<File> { |
|
11 |
|
|
12 |
void setFileFilter(FileFilter filter); |
|
13 |
|
|
14 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/pickercontroller/PickerController.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.tools.swing.api.pickercontroller; |
|
3 |
|
|
4 |
import org.gvsig.tools.swing.api.ChangeListenerSupport; |
|
5 |
|
|
6 |
/** |
|
7 |
* |
|
8 |
* @author jjdelcerro |
|
9 |
*/ |
|
10 |
public interface PickerController<T> extends ChangeListenerSupport { |
|
11 |
|
|
12 |
public T get(); |
|
13 |
|
|
14 |
public void set(T value); |
|
15 |
|
|
16 |
public void coerceAndSet(Object value); |
|
17 |
|
|
18 |
public void setEnabled(boolean enabled); |
|
19 |
|
|
20 |
public boolean isEnabled(); |
|
21 |
|
|
22 |
public void setEditable(boolean enabled); |
|
23 |
|
|
24 |
public boolean isEditable(); |
|
25 |
|
|
26 |
public boolean isValid(); |
|
27 |
|
|
28 |
public boolean isEmpty(); |
|
29 |
|
|
30 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/pickercontroller/AbstractPickerController.java | ||
---|---|---|
1 |
package org.gvsig.tools.swing.api.pickercontroller; |
|
2 |
|
|
3 |
|
|
4 |
import javax.swing.ImageIcon; |
|
5 |
import javax.swing.event.ChangeEvent; |
|
6 |
import javax.swing.event.ChangeListener; |
|
7 |
import org.apache.commons.lang3.StringUtils; |
|
8 |
import org.gvsig.tools.ToolsLocator; |
|
9 |
import org.gvsig.tools.dataTypes.CoercionException; |
|
10 |
import org.gvsig.tools.dataTypes.DataType; |
|
11 |
import org.gvsig.tools.dataTypes.DataTypesManager; |
|
12 |
import org.gvsig.tools.swing.api.ChangeListenerHelper; |
|
13 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
14 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
|
15 |
import org.gvsig.tools.swing.icontheme.IconThemeManager; |
|
16 |
import org.slf4j.Logger; |
|
17 |
import org.slf4j.LoggerFactory; |
|
18 |
|
|
19 |
/** |
|
20 |
* |
|
21 |
* @author jjdelcerro |
|
22 |
*/ |
|
23 |
public abstract class AbstractPickerController<T> implements PickerController<T> { |
|
24 |
|
|
25 |
protected static final Logger LOG = LoggerFactory.getLogger(AbstractPickerController.class); |
|
26 |
|
|
27 |
protected ChangeListenerHelper changeListenerHelper; |
|
28 |
private boolean editable; |
|
29 |
|
|
30 |
public AbstractPickerController() { |
|
31 |
this.changeListenerHelper = ToolsSwingLocator.getToolsSwingManager() |
|
32 |
.createChangeListenerHelper(); |
|
33 |
this.editable = true; |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
public void addChangeListener(ChangeListener listener) { |
|
38 |
this.changeListenerHelper.addChangeListener(listener); |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
public ChangeListener[] getChangeListeners() { |
|
43 |
return this.changeListenerHelper.getChangeListeners(); |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
public void removeChangeListener(ChangeListener listener) { |
|
48 |
this.changeListenerHelper.removeChangeListener(listener); |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
public void removeAllChangeListener() { |
|
53 |
this.changeListenerHelper.removeAllChangeListener(); |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public boolean hasChangeListeners() { |
|
58 |
return this.changeListenerHelper.hasChangeListeners(); |
|
59 |
} |
|
60 |
|
|
61 |
protected void fireChangeEvent() { |
|
62 |
this.changeListenerHelper.fireEvent(); |
|
63 |
} |
|
64 |
|
|
65 |
protected void fireChangeEvent(ChangeEvent event) { |
|
66 |
this.changeListenerHelper.fireEvent(event); |
|
67 |
} |
|
68 |
|
|
69 |
protected Object coerce(int type, Object value, Object defaultValue) { |
|
70 |
DataTypesManager manager = ToolsLocator.getDataTypesManager(); |
|
71 |
DataType dataType = manager.get(type); |
|
72 |
try { |
|
73 |
Object v = dataType.coerce(value); |
|
74 |
return v; |
|
75 |
} catch (CoercionException ex) { |
|
76 |
String s = (value==null)? "null":StringUtils.abbreviate(value.toString(), 100); |
|
77 |
LOG.warn("Can't coerce value ("+s+") to "+dataType.getName()+".", ex); |
|
78 |
return defaultValue; |
|
79 |
} |
|
80 |
} |
|
81 |
|
|
82 |
@Override |
|
83 |
public void setEditable(boolean editable) { |
|
84 |
this.editable = editable; |
|
85 |
} |
|
86 |
|
|
87 |
@Override |
|
88 |
public boolean isEditable() { |
|
89 |
return this.editable; |
|
90 |
} |
|
91 |
|
|
92 |
@Override |
|
93 |
public boolean isValid() { |
|
94 |
return true; |
|
95 |
} |
|
96 |
|
|
97 |
@Override |
|
98 |
public boolean isEmpty() { |
|
99 |
return false; |
|
100 |
} |
|
101 |
|
|
102 |
protected boolean existsIcon(String name) { |
|
103 |
IconThemeManager iconThemeManager = ToolsSwingLocator.getIconThemeManager(); |
|
104 |
IconTheme theme = iconThemeManager.getCurrent(); |
|
105 |
return theme.exists(name); |
|
106 |
} |
|
107 |
|
|
108 |
protected ImageIcon getIcon(String name) { |
|
109 |
IconThemeManager iconThemeManager = ToolsSwingLocator.getIconThemeManager(); |
|
110 |
IconTheme theme = iconThemeManager.getCurrent(); |
|
111 |
ImageIcon icon = theme.get(name); |
|
112 |
return icon; |
|
113 |
} |
|
114 |
|
|
115 |
|
|
116 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/pickercontroller/FolderPickerController.java | ||
---|---|---|
1 |
package org.gvsig.tools.swing.api.pickercontroller; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import javax.swing.filechooser.FileFilter; |
|
5 |
|
|
6 |
/** |
|
7 |
* |
|
8 |
* @author jjdelcerro |
|
9 |
*/ |
|
10 |
public interface FolderPickerController extends PickerController<File> { |
|
11 |
|
|
12 |
void setFileFilter(FileFilter filter); |
|
13 |
|
|
14 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/Component.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 |
package org.gvsig.tools.swing.api; |
|
25 |
|
|
26 |
import javax.swing.JComponent; |
|
27 |
|
|
28 |
/** |
|
29 |
* Interface for components that allows to define interfaces for them, as |
|
30 |
* otherwise JComponent is a class and you cannot extend it with an interface. |
|
31 |
* |
|
32 |
* @author gvSIG team |
|
33 |
* @version $Id$ |
|
34 |
*/ |
|
35 |
public interface Component { |
|
36 |
|
|
37 |
/** |
|
38 |
* Returns this component as a swing {@link JComponent}. |
|
39 |
* |
|
40 |
* @return a {@link JComponent} |
|
41 |
*/ |
|
42 |
public JComponent asJComponent(); |
|
43 |
|
|
44 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ToolsSwingManager.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.tools.swing.api; |
|
3 |
|
|
4 |
import java.awt.Color; |
|
5 |
import java.awt.Dimension; |
|
6 |
import java.awt.Image; |
|
7 |
import java.awt.event.ActionListener; |
|
8 |
import java.awt.image.BufferedImage; |
|
9 |
import java.io.File; |
|
10 |
import javax.swing.AbstractButton; |
|
11 |
import javax.swing.ComboBoxModel; |
|
12 |
import javax.swing.Icon; |
|
13 |
import javax.swing.JButton; |
|
14 |
import javax.swing.JComboBox; |
|
15 |
import javax.swing.JComponent; |
|
16 |
import javax.swing.JLabel; |
|
17 |
import javax.swing.JList; |
|
18 |
import javax.swing.JSlider; |
|
19 |
import javax.swing.JTabbedPane; |
|
20 |
import javax.swing.JTextField; |
|
21 |
import javax.swing.table.TableModel; |
|
22 |
import javax.swing.text.JTextComponent; |
|
23 |
import javax.swing.tree.TreeModel; |
|
24 |
import org.gvsig.tools.bookmarksandhistory.Bookmarks; |
|
25 |
import org.gvsig.tools.bookmarksandhistory.History; |
|
26 |
import org.gvsig.tools.swing.api.bookmarkshistory.BookmarksController; |
|
27 |
import org.gvsig.tools.swing.api.bookmarkshistory.HistoryController; |
|
28 |
import org.gvsig.tools.swing.api.pickercontroller.ColorPickerController; |
|
29 |
import org.gvsig.tools.swing.api.pickercontroller.DatePickerController; |
|
30 |
import org.gvsig.tools.swing.api.pickercontroller.FilePickerController; |
|
31 |
import org.gvsig.tools.swing.api.pickercontroller.FolderPickerController; |
|
32 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
|
33 |
|
|
34 |
|
|
35 |
public interface ToolsSwingManager { |
|
36 |
|
|
37 |
public ActionListenerSupport createActionListenerSupport(); |
|
38 |
|
|
39 |
public JListWithCheckbox createJListWithCheckbox(JList wrappedList); |
|
40 |
|
|
41 |
public void setTreeModel(JComboBox comboBox, TreeModel aTreeModel); |
|
42 |
|
|
43 |
public ComboBoxModel createComboBoxModel(TreeModel treeModel); |
|
44 |
|
|
45 |
/** |
|
46 |
* @param txtLabel |
|
47 |
* @param btnShowDialog |
|
48 |
* @param sldAlpha |
|
49 |
* @param allowNull |
|
50 |
* @return |
|
51 |
* @deprecated use createColorPickerController |
|
52 |
*/ |
|
53 |
public ColorChooserController createColorChooserController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull); |
|
54 |
/** |
|
55 |
* @param txtLabel |
|
56 |
* @param btnShowDialog |
|
57 |
* @return |
|
58 |
* @deprecated use createColorPickerController |
|
59 |
*/ |
|
60 |
public ColorChooserController createColorChooserController(JTextField txtLabel, JButton btnShowDialog); |
|
61 |
/** |
|
62 |
* @param txtLabel |
|
63 |
* @param btnShowDialog |
|
64 |
* @param sldAlpha |
|
65 |
* @return |
|
66 |
* @deprecated use createColorPickerController |
|
67 |
*/ |
|
68 |
public ColorChooserController createColorChooserController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha); |
|
69 |
|
|
70 |
|
|
71 |
/** |
|
72 |
* Create a buffered Image of the given size and type. |
|
73 |
* In this context, buffered image means editable image (admits setRGB etc) |
|
74 |
* If the size is bigger of max physical size of buffered image, creates a file mapped buffered Image. |
|
75 |
* |
|
76 |
* @param w width in pixels of the requested image |
|
77 |
* @param h height in pixels of the requested image |
|
78 |
* @param type image type (refers to bands, etc. see {@link Image} |
|
79 |
* @return a buffered (editable) image of the desired size and type |
|
80 |
* @see setMaxPhysicalSizeOfBufferedImage |
|
81 |
* @see getMaxPhysicalSizeOfBufferedImage |
|
82 |
* |
|
83 |
*/ |
|
84 |
public BufferedImage createBufferedImage(int w, int h, int type); |
|
85 |
|
|
86 |
|
|
87 |
/** |
|
88 |
* Create a file mapped buffered Image of the given size and type. |
|
89 |
* In this context, buffered image means editable image (admits setRGB etc) |
|
90 |
* |
|
91 |
* @param w width in pixels of the requested image |
|
92 |
* @param h height in pixels of the requested image |
|
93 |
* @param type image type (refers to bands, etc. see {@link Image} |
|
94 |
* @return a buffered (editable) image of the desired size and type |
|
95 |
*/ |
|
96 |
public BufferedImage createVirtualBufferedImage(int w, int h, int type); |
|
97 |
|
|
98 |
public BufferedImage copyBufferedImage(BufferedImage img); |
|
99 |
|
|
100 |
/** |
|
101 |
* Sets the max physical size of buffered image creates by this manager. |
|
102 |
* |
|
103 |
* @param dimension |
|
104 |
* @see createBufferedImage |
|
105 |
* @see createVirtualBufferedImage |
|
106 |
*/ |
|
107 |
public void setMaxPhysicalSizeOfBufferedImage(Dimension dimension); |
|
108 |
|
|
109 |
/** |
|
110 |
* Return the max physical size of buffered image creates by this manager. |
|
111 |
* |
|
112 |
* @return |
|
113 |
* @see createBufferedImage |
|
114 |
* @see createVirtualBufferedImage |
|
115 |
*/ |
|
116 |
public Dimension getMaxPhysicalSizeOfBufferedImage(); |
|
117 |
|
|
118 |
/** |
|
119 |
* Alpha blending is the process of combining a translucent foreground color with a background |
|
120 |
* |
|
121 |
* https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending |
|
122 |
* |
|
123 |
* @param bgColor |
|
124 |
* @param fgColor |
|
125 |
* @return |
|
126 |
*/ |
|
127 |
public Color alphaBlendingWithOpaqueBackground(Color bgColor, Color fgColor); |
|
128 |
|
|
129 |
public Color opaqueColor(Color src); |
|
130 |
|
|
131 |
public void translate(JComponent component); |
|
132 |
|
|
133 |
public void translate(AbstractButton component); |
|
134 |
|
|
135 |
public void translate(JLabel component); |
|
136 |
|
|
137 |
public void translate(JTabbedPane component); |
|
138 |
|
|
139 |
public void setDefaultPopupMenu(final JTextComponent component); |
|
140 |
|
|
141 |
public void setDefaultPopupMenu(final JComboBox component); |
|
142 |
|
|
143 |
public void setDefaultPopupMenu(final JTextComponent component, String title); |
|
144 |
|
|
145 |
public void setDefaultPopupMenu(final JComboBox component, String title); |
|
146 |
|
|
147 |
public ChangeListenerHelper createChangeListenerHelper(); |
|
148 |
|
|
149 |
public ColorPickerController createColorPickerController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull); |
|
150 |
|
|
151 |
public ColorPickerController createColorPickerController(JTextField txtLabel, JButton btnShowDialog); |
|
152 |
|
|
153 |
public ColorPickerController createColorPickerController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha); |
|
154 |
|
|
155 |
public DatePickerController createDatePickerController(JTextField txtDate, JButton btnDate); |
|
156 |
|
|
157 |
public FilePickerController createFilePickerController(JTextField txtFile, JButton btnFile, String dialogTitle, String fileChooserID, File initialPath, boolean seticon); |
|
158 |
|
|
159 |
public FilePickerController createFilePickerController(JTextField txtFile, JButton btnFile); |
|
160 |
|
|
161 |
public FilePickerController createFilePickerController(JTextField txtFile, JButton btnFile, String dialogTitle); |
|
162 |
|
|
163 |
public FolderPickerController createFolderPickerController(JTextField txtFile, JButton btnFile, String dialogTitle, String fileChooserID, File initialPath, boolean seticon); |
|
164 |
|
|
165 |
public FolderPickerController createFolderPickerController(JTextField txtFile, JButton btnFile); |
|
166 |
|
|
167 |
public FolderPickerController createFolderPickerController(JTextField txtFile, JButton btnFile, String dialogTitle); |
|
168 |
|
|
169 |
public PickerController<byte[]> createByteArrayPickerController(JTextField txtText, JButton btnUpload, JButton btnDownload, String fileChooserID, File initialPath); |
|
170 |
|
|
171 |
public PickerController<byte[]> createByteArrayPickerController(JTextField txtText, JButton btnUpload, JButton btnDownload); |
|
172 |
|
|
173 |
public void removeBorder(JComponent component); |
|
174 |
|
|
175 |
public void addClearButton(final JTextComponent text, final ActionListener action); |
|
176 |
|
|
177 |
public void addClearButton(final JTextComponent text); |
|
178 |
|
|
179 |
public void addClearButton(JComboBox combo); |
|
180 |
|
|
181 |
public SimpleImage createSimpleImage(); |
|
182 |
|
|
183 |
public SimpleImage createSimpleImage(Object source); |
|
184 |
|
|
185 |
public DropDown createDropDown(JComboBox combo); |
|
186 |
|
|
187 |
public DropDown createDropDown(JLabel label); |
|
188 |
|
|
189 |
public DropDown createDropDown(AbstractButton button); |
|
190 |
|
|
191 |
public DropDown createDropDown(JComponent component); |
|
192 |
|
|
193 |
/** |
|
194 |
* Contructor for creating a CompoundIcon where the icons are |
|
195 |
* layed out HORIZONTAL, the gap is 0 and the X/Y alignments will |
|
196 |
* default to CENTER. |
|
197 |
* |
|
198 |
* @param icons the Icons to be painted as part of the CompoundIcon |
|
199 |
* |
|
200 |
* @return the CompoundIcon |
|
201 |
*/ |
|
202 |
public CompoundIcon createCompoundIcon(Icon... icons); |
|
203 |
|
|
204 |
/** |
|
205 |
* Contructor for creating a CompoundIcon where the gap is 0 and |
|
206 |
* the X/Y alignments will default to CENTER. |
|
207 |
* |
|
208 |
* @param orientation the orientation used to lay out the icons for painting. |
|
209 |
* Must be one of SwingConstants.HORIZONTAL, SwingConstants.VERTICAL or STACKED. |
|
210 |
* @param icons the Icons to be painted as part of the CompoundIcon |
|
211 |
* |
|
212 |
* @return the CompoundIcon |
|
213 |
*/ |
|
214 |
public CompoundIcon createCompoundIcon(int orientation, Icon... icons); |
|
215 |
|
|
216 |
/** |
|
217 |
* Convenience contructor for creating a CompoundIcon where the X/Y |
|
218 |
* alignments will default to CENTER. |
|
219 |
* |
|
220 |
* @param orientation the orientation used to lay out the icons for painting. |
|
221 |
* Must be one of SwingConstants.HORIZONTAL, SwingConstants.VERTICAL or STACKED. |
|
222 |
* @param gap the gap between the icons |
|
223 |
* @param icons the Icons to be painted as part of the CompoundIcon |
|
224 |
* |
|
225 |
* @return the CompoundIcon |
|
226 |
*/ |
|
227 |
public CompoundIcon createCompoundIcon(int orientation, int gap, Icon... icons); |
|
228 |
|
|
229 |
/** |
|
230 |
* Create a CompoundIcon specifying all the properties. |
|
231 |
* |
|
232 |
* @param orientation the orientation used to lay out the icons for painting. |
|
233 |
* Must be one of SwingConstants.HORIZONTAL, SwingConstants.VERTICAL or STACKED. |
|
234 |
* @param gap the gap between the icons |
|
235 |
* @param alignmentX the X alignment of the icons. Common values are SwingConstants.LEFT, |
|
236 |
* SwingConstants.CENTER, SwingConstants.RIGHT. |
|
237 |
* @param alignmentY the Y alignment of the icons. Common values are SwingConstants.TOP, |
|
238 |
* SwingConstants.CENTER, SwingConstants.BOTTOM. |
|
239 |
* @param icons the Icons to be painted as part of the CompoundIcon |
|
240 |
* |
|
241 |
* @return the CompoundIcon |
|
242 |
*/ |
|
243 |
public CompoundIcon createCompoundIcon(int orientation, int gap, int alignmentX, int alignmentY, Icon... icons); |
|
244 |
|
|
245 |
public BookmarksController createBookmarksController(Bookmarks bookmarks, JButton button); |
|
246 |
|
|
247 |
public HistoryController createHistoryController(History history, JButton button); |
|
248 |
|
|
249 |
public FilteredTableModel createFilteredTableModel(TableModel model, int filterColumn); |
|
250 |
|
|
251 |
public FilteredListModel createFilteredListModel(); |
|
252 |
|
|
253 |
public JLabel createTitledSeparator(String title, int height, int titlePosition, int titleJustification); |
|
254 |
|
|
255 |
public JLabel createTitledSeparator(String title); |
|
256 |
|
|
257 |
public JWebBrowser createJWebBrowser(); |
|
258 |
|
|
259 |
public void registerJWebBrowserFactory(JWebBrowserFactory factory); |
|
260 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ColorChooserController.java | ||
---|---|---|
1 |
package org.gvsig.tools.swing.api; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import javax.swing.event.ChangeListener; |
|
5 |
|
|
6 |
public interface ColorChooserController { |
|
7 |
|
|
8 |
void addChangeListener(ChangeListener changeListener); |
|
9 |
|
|
10 |
Color get(); |
|
11 |
|
|
12 |
void set(Color color); |
|
13 |
|
|
14 |
void setEnabled(boolean enabled); |
|
15 |
|
|
16 |
boolean isEnabled(); |
|
17 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/BasePropertiesPanelHelper.java | ||
---|---|---|
1 |
package org.gvsig.tools.swing.api; |
|
2 |
|
|
3 |
import java.awt.event.ActionEvent; |
|
4 |
import java.awt.event.ActionListener; |
|
5 |
import javax.swing.JComponent; |
|
6 |
import javax.swing.event.AncestorEvent; |
|
7 |
import javax.swing.event.AncestorListener; |
|
8 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
9 |
|
|
10 |
public class BasePropertiesPanelHelper implements BasePropertiesPanel { |
|
11 |
|
|
12 |
protected final JComponent component; |
|
13 |
protected final JComponent accept; |
|
14 |
protected boolean canceled; |
|
15 |
protected ActionListenerSupport listeners; |
|
16 |
|
|
17 |
public BasePropertiesPanelHelper(JComponent component, JComponent accept) { |
|
18 |
this.component = component; |
|
19 |
this.accept = accept; |
|
20 |
this.canceled = false; |
|
21 |
this.listeners = ToolsSwingLocator.getToolsSwingManager().createActionListenerSupport(); |
|
22 |
} |
|
23 |
|
|
24 |
public void closeWindow() { |
|
25 |
this.component.setVisible(false); |
|
26 |
} |
|
27 |
|
|
28 |
public void showWindow(String title, WindowManager.MODE mode) { |
|
29 |
WindowManager manager = ToolsSwingLocator.getWindowManager(); |
|
30 |
this.component.addAncestorListener(new AncestorListener() { |
|
31 |
public void ancestorRemoved(AncestorEvent arg0) { |
|
32 |
fireCloseEvent(); |
|
33 |
} |
|
34 |
|
|
35 |
public void ancestorMoved(AncestorEvent arg0) { |
|
36 |
} |
|
37 |
|
|
38 |
public void ancestorAdded(AncestorEvent arg0) { |
|
39 |
} |
|
40 |
}); |
|
41 |
manager.showWindow(this.component, title, mode); |
|
42 |
} |
|
43 |
|
|
44 |
public boolean isCanceled() { |
|
45 |
return this.canceled; |
|
46 |
} |
|
47 |
|
|
48 |
public void addActionListener(ActionListener listener) { |
|
49 |
this.listeners.addActionListener(listener); |
|
50 |
} |
|
51 |
|
|
52 |
public void removeActionListener(ActionListener listener) { |
|
53 |
this.listeners.removeActionListener(listener); |
|
54 |
} |
|
55 |
|
|
56 |
public void removeAllActionListener() { |
|
57 |
this.listeners.removeAllActionListener(); |
|
58 |
} |
|
59 |
|
|
60 |
public void fireActionEvent(ActionEvent actionEvent) { |
|
61 |
this.listeners.fireActionEvent(actionEvent); |
|
62 |
} |
|
63 |
|
|
64 |
public void fireAcceptEvent() { |
|
65 |
this.listeners.fireActionEvent( |
|
66 |
new ActionEvent(this.component, ACTION_ACCEPT, "accept") |
|
67 |
); |
|
68 |
} |
|
69 |
|
|
70 |
public void fireCancelEvent() { |
|
71 |
this.listeners.fireActionEvent( |
|
72 |
new ActionEvent(this.component, ACTION_CANCEL, "cancel") |
|
73 |
); |
|
74 |
} |
|
75 |
|
|
76 |
public void fireCloseEvent() { |
|
77 |
this.listeners.fireActionEvent( |
|
78 |
new ActionEvent(this.component, ACTION_CLOSE, "close") |
|
79 |
); |
|
80 |
} |
|
81 |
|
|
82 |
public void setVisibleAceptCancel(boolean visible) { |
|
83 |
this.accept.setVisible(visible); |
|
84 |
} |
|
85 |
|
|
86 |
public boolean getVisibleAceptCancel() { |
|
87 |
return accept.isVisible(); |
|
88 |
} |
|
89 |
|
|
90 |
public void clear() { |
|
91 |
// Do nothing |
|
92 |
} |
|
93 |
|
|
94 |
public JComponent asJComponent() { |
|
95 |
return this.component; |
|
96 |
} |
|
97 |
|
|
98 |
public void setCanceled(boolean canceled) { |
|
99 |
this.canceled = canceled; |
|
100 |
} |
|
101 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/BasePropertiesPanel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2015 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or modify it under |
|
7 |
* the terms of the GNU General Public License as published by the Free Software |
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later |
|
9 |
* version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
14 |
* details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License along with |
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us at info AT |
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
|
|
24 |
package org.gvsig.tools.swing.api; |
|
25 |
|
|
26 |
import java.awt.event.ActionListener; |
|
27 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
28 |
|
|
29 |
/** |
|
30 |
* Base interface to build panels. |
|
31 |
* |
|
32 |
* @author gvSIG Team |
|
33 |
* @version $Id$ |
|
34 |
*/ |
|
35 |
public interface BasePropertiesPanel extends Component { |
|
36 |
|
|
37 |
public static final int ACTION_CLOSE = 0; |
|
38 |
public static final int ACTION_ACCEPT = 1; |
|
39 |
public static final int ACTION_CANCEL = 2; |
|
40 |
|
|
41 |
|
|
42 |
public void clear(); |
|
43 |
|
|
44 |
public boolean isCanceled(); |
|
45 |
|
|
46 |
public void setVisibleAceptCancel(boolean visible); |
|
47 |
|
|
48 |
public boolean getVisibleAceptCancel(); |
|
49 |
|
|
50 |
public void closeWindow() ; |
|
51 |
|
|
52 |
public void showWindow(String title, WindowManager.MODE mode); |
|
53 |
|
|
54 |
public void addActionListener(ActionListener listener); |
|
55 |
|
|
56 |
public void removeActionListener(ActionListener listener); |
|
57 |
|
|
58 |
public void removeAllActionListener(); |
|
59 |
|
|
60 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/FilteredListModel.java | ||
---|---|---|
1 |
package org.gvsig.tools.swing.api; |
|
2 |
|
|
3 |
import javax.swing.ListModel; |
|
4 |
import org.gvsig.tools.util.LabeledValue; |
|
5 |
|
|
6 |
/** |
|
7 |
* |
|
8 |
* @author jjdelcerro |
|
9 |
*/ |
|
10 |
public interface FilteredListModel extends ListModel { |
|
11 |
|
|
12 |
public void addElement(LabeledValue element); |
|
13 |
|
|
14 |
public void addElement(Object element); |
|
15 |
|
|
16 |
public LabeledValue getElementAt(int index); |
|
17 |
|
|
18 |
public void setFilter(String filter); |
|
19 |
|
|
20 |
public void sort(final boolean ascending); |
|
21 |
|
|
22 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ActionListenerSupport.java | ||
---|---|---|
1 |
package org.gvsig.tools.swing.api; |
|
2 |
|
|
3 |
import java.awt.event.ActionEvent; |
|
4 |
import java.awt.event.ActionListener; |
|
5 |
|
|
6 |
public interface ActionListenerSupport { |
|
7 |
|
|
8 |
public void addActionListener(ActionListener listener); |
|
9 |
|
|
10 |
public ActionListener[] getActionListeners(); |
|
11 |
|
|
12 |
public void removeActionListener(ActionListener listener); |
|
13 |
|
|
14 |
public void removeAllActionListener(); |
|
15 |
|
|
16 |
public void fireActionEvent(ActionEvent event); |
|
17 |
|
|
18 |
public boolean hasActionListeners(); |
|
19 |
|
|
20 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/windowmanager/WindowManager_v2.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.tools.swing.api.windowmanager; |
|
3 |
|
|
4 |
import java.awt.Image; |
|
5 |
import javax.swing.JComponent; |
|
6 |
|
|
7 |
|
|
8 |
public interface WindowManager_v2 extends WindowManager { |
|
9 |
|
|
10 |
public final static int BUTTON_OK = 1; |
|
11 |
public final static int BUTTON_CANCEL = 2; |
|
12 |
public final static int BUTTON_APPLY = 4; |
|
13 |
|
|
14 |
public final static int BUTTONS_OK = BUTTON_OK; |
|
15 |
public final static int BUTTONS_OK_CANCEL = BUTTON_OK|BUTTON_CANCEL; |
|
16 |
public final static int BUTTONS_APPLY_OK_CANCEL = BUTTON_OK|BUTTON_CANCEL|BUTTON_APPLY; |
|
17 |
|
|
18 |
public Dialog createDialog(JComponent component, String title, String header, int buttons); |
|
19 |
|
|
20 |
public void showWindow(JComponent componet, String tittle, MODE mode, Image icon); |
|
21 |
|
|
22 |
public void showWindow(JComponent component, String title, MODE mode, Image icon, int flags); |
|
23 |
|
|
24 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/windowmanager/Dialog.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.tools.swing.api.windowmanager; |
|
3 |
|
|
4 |
import java.awt.Image; |
|
5 |
import java.awt.event.ActionListener; |
|
6 |
import javax.swing.JComponent; |
|
7 |
import org.gvsig.tools.swing.api.Component; |
|
8 |
|
|
9 |
|
|
10 |
public interface Dialog extends Component { |
|
11 |
|
|
12 |
int getAction(); |
|
13 |
|
|
14 |
void setContents(JComponent contents); |
|
15 |
|
|
16 |
void setHeaderTitle(String header); |
|
17 |
|
|
18 |
void setHeaderLabel(String header); |
|
19 |
|
|
20 |
void setHeaderImage(Image image); |
|
21 |
|
|
22 |
void setButtons(int buttons); |
|
23 |
|
|
24 |
void setButtonLabel(int button, String label); |
|
25 |
|
|
26 |
void setButtonEnabled(int button, boolean enabled); |
|
27 |
|
|
28 |
boolean isButtonEnabled(int button); |
|
29 |
|
|
30 |
void show(WindowManager.MODE mode); |
|
31 |
|
|
32 |
void setIcon(Image icon); |
|
33 |
|
|
34 |
public void addActionListener(ActionListener listener); |
|
35 |
|
|
36 |
public ActionListener[] getActionListeners(); |
|
37 |
|
|
38 |
public void removeActionListener(ActionListener listener); |
|
39 |
|
|
40 |
public void removeAllActionListener(); |
|
41 |
|
|
42 |
public JComponent getContents(); |
|
43 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/windowmanager/WindowManager.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 |
package org.gvsig.tools.swing.api.windowmanager; |
|
25 |
|
|
26 |
import javax.swing.JComponent; |
|
27 |
|
|
28 |
public interface WindowManager { |
|
29 |
|
|
30 |
public enum MODE { |
|
31 |
WINDOW, |
|
32 |
DIALOG, |
|
33 |
TOOL; |
|
34 |
|
|
35 |
public static MODE fromInteger(int x) { |
|
36 |
switch (x) { |
|
37 |
default: |
|
38 |
case 0: |
|
39 |
return WINDOW; |
|
40 |
case 1: |
|
41 |
return DIALOG; |
|
42 |
case 2: |
|
43 |
return TOOL; |
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
public static int toInteger(MODE x) { |
|
48 |
switch (x) { |
|
49 |
default: |
|
50 |
case WINDOW: |
|
51 |
return 0; |
|
52 |
case DIALOG: |
|
53 |
return 1; |
|
54 |
case TOOL: |
|
55 |
return 2; |
|
56 |
} |
|
57 |
} |
|
58 |
}; |
|
59 |
|
|
60 |
public void showWindow(JComponent componet, String tittle, MODE mode); |
|
61 |
|
|
62 |
} |
|
0 | 63 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/TaskStatusController.java | ||
---|---|---|
1 |
package org.gvsig.tools.swing.api.task; |
|
2 |
|
|
3 |
import org.gvsig.tools.task.TaskStatus; |
|
4 |
|
|
5 |
/** |
|
6 |
* |
|
7 |
* @author jjdelcerro |
|
8 |
*/ |
|
9 |
public interface TaskStatusController { |
|
10 |
|
|
11 |
public void bind(TaskStatus taskStatus); |
|
12 |
|
|
13 |
public boolean getShowCancelButton(); |
|
14 |
|
|
15 |
public void setShowCancelButton(boolean showCancelButton); |
|
16 |
|
|
17 |
public boolean getShowRemoveTaskButton(); |
|
18 |
|
|
19 |
public void setShowRemoveTaskButton(boolean showRemoveTaskButton); |
|
20 |
|
|
21 |
public void setTitle(String title); |
|
22 |
|
|
23 |
public TaskStatus getTaskStatus(); |
|
24 |
|
|
25 |
public void message(String message); |
|
26 |
|
|
27 |
public void setCurValue(long value); |
|
28 |
|
|
29 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTasksStatusList.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 |
package org.gvsig.tools.swing.api.task; |
|
25 |
|
|
26 |
import javax.swing.JPanel; |
|
27 |
|
|
28 |
import org.gvsig.tools.task.TaskStatusManager; |
|
29 |
|
|
30 |
public abstract class JTasksStatusList extends JPanel { |
|
31 |
|
|
32 |
/** |
|
33 |
* |
|
34 |
*/ |
|
35 |
private static final long serialVersionUID = -2712653249045541115L; |
|
36 |
|
|
37 |
public abstract TaskStatusManager getManager(); |
|
38 |
|
|
39 |
} |
|
40 |
|
|
0 | 41 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTaskStatus.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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 |
package org.gvsig.tools.swing.api.task; |
|
25 |
|
|
26 |
import javax.swing.JPanel; |
|
27 |
|
|
28 |
import org.gvsig.tools.swing.api.Component; |
|
29 |
import org.gvsig.tools.task.TaskStatus; |
|
30 |
|
|
31 |
public abstract class JTaskStatus extends JPanel implements Component { |
|
32 |
|
|
33 |
|
|
34 |
/** |
|
35 |
* |
|
36 |
*/ |
|
37 |
private static final long serialVersionUID = -6606077362610993539L; |
|
38 |
|
|
39 |
public abstract void bind(TaskStatus taskStatus); |
|
40 |
|
|
41 |
public abstract boolean getShowCancelButton() ; |
|
42 |
|
|
43 |
public abstract void setShowCancelButton(boolean showCancelButton); |
|
44 |
|
|
45 |
public abstract boolean getShowRemoveTaskButton(); |
|
46 |
|
|
47 |
public abstract void setShowRemoveTaskButton(boolean showRemoveTaskButton) ; |
|
48 |
|
|
49 |
/** |
|
50 |
* @deprecated @see {@link JTaskStatus#setTitle(String)}. |
|
51 |
*/ |
|
52 |
public abstract void setTittle(String tittle); |
|
53 |
|
|
54 |
public abstract void setTitle(String title); |
|
55 |
|
|
56 |
public abstract TaskStatus getTaskStatus(); |
|
57 |
|
|
58 |
public abstract void message(String message); |
|
59 |
|
|
60 |
public abstract void setCurValue(long value); |
|
61 |
} |
|
0 | 62 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.213/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTasksStatus.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 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. |
Also available in: Unified diff