Revision 272
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ToolsSwingLocator.java | ||
---|---|---|
22 | 22 |
package org.gvsig.tools.swing.api; |
23 | 23 |
|
24 | 24 |
import org.gvsig.tools.locator.BaseLocator; |
25 |
import org.gvsig.tools.locator.Locator; |
|
25 | 26 |
import org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager; |
26 | 27 |
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
27 | 28 |
|
28 | 29 |
/** |
29 |
* Locator for the tools swing Library. Returns references to the library's main |
|
30 |
* {@link Locator} for the tools swing Library. It returns a reference to the |
|
31 |
* library's main |
|
30 | 32 |
* utilities. |
31 | 33 |
* |
32 | 34 |
* @author 2010- C?sar Ordi?ana - gvSIG team |
... | ... | |
63 | 65 |
} |
64 | 66 |
|
65 | 67 |
/** |
66 |
* Return the singleton instance.
|
|
68 |
* Return the {@link Singleton} instance.
|
|
67 | 69 |
* |
68 |
* @return the singleton instance
|
|
70 |
* @return the {@link Singleton} instance
|
|
69 | 71 |
*/ |
70 | 72 |
public static ToolsSwingLocator getInstance() { |
71 | 73 |
return instance; |
... | ... | |
82 | 84 |
} |
83 | 85 |
|
84 | 86 |
/** |
85 |
* Registers the Class implementing the DynObjectSwingManager interface. |
|
87 |
* Registers the Class implementing the {@link DynObjectSwingManager} |
|
88 |
* interface. |
|
86 | 89 |
* |
87 | 90 |
* @param clazz |
88 |
* implementing the DynObjectSwingManager interface
|
|
91 |
* implementing the {@link DynObjectSwingManager} interface
|
|
89 | 92 |
*/ |
90 | 93 |
public static void registerDynObjectSwingManager( |
91 | 94 |
Class<? extends DynObjectSwingManager> clazz) { |
... | ... | |
94 | 97 |
} |
95 | 98 |
|
96 | 99 |
/** |
97 |
* Registers the Class implementing the UsabilitySwingManager interface. |
|
100 |
* Registers the Class implementing the {@link UsabilitySwingManager} |
|
101 |
* interface. |
|
98 | 102 |
* |
99 | 103 |
* @param clazz |
100 |
* implementing the UsabilitySwingManager interface
|
|
104 |
* implementing the {@link UsabilitySwingManager} interface
|
|
101 | 105 |
*/ |
102 | 106 |
public static void registerUsabilitySwingManager( |
103 | 107 |
Class<? extends UsabilitySwingManager> clazz) { |
... | ... | |
106 | 110 |
} |
107 | 111 |
|
108 | 112 |
/** |
109 |
* Return the Locator's name
|
|
113 |
* Return the {@link Locator}'s name
|
|
110 | 114 |
* |
111 |
* @return a String with the Locator's name
|
|
115 |
* @return a String with the {@link Locator}'s name
|
|
112 | 116 |
*/ |
113 | 117 |
public String getLocatorName() { |
114 | 118 |
return LOCATOR_NAME; |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ToolsSwingLibrary.java | ||
---|---|---|
41 | 41 |
|
42 | 42 |
@Override |
43 | 43 |
protected void doPostInitialize() throws LibraryException { |
44 |
// Validate there is any DynObjectSwingManager implementation |
|
44 |
// Validates if there is any DynObjectSwingManager implementation
|
|
45 | 45 |
// registered. |
46 | 46 |
DynObjectSwingManager dynObjectSwingManager = |
47 | 47 |
ToolsSwingLocator.getDynObjectSwingManager(); |
... | ... | |
52 | 52 |
ToolsSwingLocator.getInstance()); |
53 | 53 |
} |
54 | 54 |
|
55 |
// Validate there is any UsabilitySwingManager implementation |
|
55 |
// Validates if there is any UsabilitySwingManager implementation
|
|
56 | 56 |
// registered. |
57 | 57 |
UsabilitySwingManager usabilitySwingManager = |
58 | 58 |
ToolsSwingLocator.getUsabilitySwingManager(); |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/dynobject/DynFieldComponentModel.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 |
/* |
|
23 |
* AUTHORS (In addition to CIT): |
|
24 |
* 2010 Institute of New Imaging Technologies (INIT): |
|
25 |
* http://www.init.uji.es |
|
26 |
* Geographic Information research group: |
|
27 |
* http://www.geoinfo.uji.es |
|
28 |
* Universitat Jaume I, Spain |
|
29 |
*/ |
|
30 |
|
|
31 |
/** |
|
32 |
* |
|
33 |
*/ |
|
34 |
package org.gvsig.tools.swing.api.dynobject; |
|
35 |
|
|
36 |
import org.gvsig.tools.dynobject.DynClass; |
|
37 |
import org.gvsig.tools.dynobject.DynField; |
|
38 |
|
|
39 |
/** |
|
40 |
* @author <a href="mailto:reinhold@uji.es">cmartin</a> |
|
41 |
* |
|
42 |
*/ |
|
43 |
public interface DynFieldComponentModel { |
|
44 |
|
|
45 |
/** |
|
46 |
* Returns the {@link DynClass} being rendered. |
|
47 |
* |
|
48 |
* @return the DynClass |
|
49 |
*/ |
|
50 |
public DynClass getDynClass(); |
|
51 |
|
|
52 |
/** |
|
53 |
* Returns the {@link DynField} being rendered. |
|
54 |
* |
|
55 |
* @return the DynField |
|
56 |
*/ |
|
57 |
public DynField getDynField(); |
|
58 |
|
|
59 |
public String getGroup(); |
|
60 |
|
|
61 |
public boolean isReadOnly(); |
|
62 |
|
|
63 |
public void setGroup(String group); |
|
64 |
|
|
65 |
public void setReadOnly(boolean isReadOnly); |
|
66 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/dynobject/DynFieldModel.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 |
/* |
|
23 |
* AUTHORS (In addition to CIT): |
|
24 |
* 2010 Institute of New Imaging Technologies (INIT): |
|
25 |
* http://www.init.uji.es |
|
26 |
* Geographic Information research group: |
|
27 |
* http://www.geoinfo.uji.es |
|
28 |
* Universitat Jaume I, Spain |
|
29 |
*/ |
|
30 |
|
|
31 |
/** |
|
32 |
* |
|
33 |
*/ |
|
34 |
package org.gvsig.tools.swing.api.dynobject; |
|
35 |
|
|
36 |
import org.gvsig.tools.dynobject.DynClass; |
|
37 |
import org.gvsig.tools.dynobject.DynField; |
|
38 |
|
|
39 |
/** |
|
40 |
* |
|
41 |
* The view model of a given {@link DynField}. It provides layout information |
|
42 |
* about its |
|
43 |
* group and its readonly properties. |
|
44 |
* |
|
45 |
* @author 2010 - <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG Team |
|
46 |
* @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart?n </a> - |
|
47 |
* gvSIG Team |
|
48 |
* @version $Id$ |
|
49 |
* |
|
50 |
*/ |
|
51 |
public interface DynFieldModel { |
|
52 |
|
|
53 |
/** |
|
54 |
* Returns the {@link DynClass} being rendered. |
|
55 |
* |
|
56 |
* @return the DynClass |
|
57 |
*/ |
|
58 |
public DynClass getDynClass(); |
|
59 |
|
|
60 |
/** |
|
61 |
* Returns the {@link DynField} being rendered. |
|
62 |
* |
|
63 |
* @return the DynField |
|
64 |
*/ |
|
65 |
public DynField getDynField(); |
|
66 |
|
|
67 |
/** |
|
68 |
* Returns the group in which the {@link DynField} belongs. |
|
69 |
* |
|
70 |
* @return |
|
71 |
*/ |
|
72 |
public String getGroup(); |
|
73 |
|
|
74 |
/** |
|
75 |
* Returns if the {@link DynField} is ReadOnly or not. |
|
76 |
* |
|
77 |
* @return |
|
78 |
*/ |
|
79 |
public boolean isReadOnly(); |
|
80 |
|
|
81 |
/** |
|
82 |
* Sets the group in which the {@link DynField} belongs. |
|
83 |
* |
|
84 |
* @param group |
|
85 |
* the group name. |
|
86 |
* |
|
87 |
*/ |
|
88 |
public void setGroup(String group); |
|
89 |
|
|
90 |
/** |
|
91 |
* Returns if the {@link DynField} is ReadOnly or not. |
|
92 |
* |
|
93 |
* @param isReadOnly |
|
94 |
* <br> |
|
95 |
* <b>true </b> the ValueField is read |
|
96 |
* only, so not writable.<br> |
|
97 |
* <b>false </b> the ValueField is not |
|
98 |
* read only, so also writable. |
|
99 |
*/ |
|
100 |
public void setReadOnly(boolean isReadOnly); |
|
101 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/dynobject/DynObjectModel.java | ||
---|---|---|
35 | 35 |
|
36 | 36 |
import java.util.List; |
37 | 37 |
|
38 |
import org.gvsig.tools.dynobject.DynField; |
|
39 |
import org.gvsig.tools.dynobject.DynObject; |
|
40 |
|
|
38 | 41 |
/** |
39 |
* @author <a href="mailto:reinhold@uji.es">cmartin</a> |
|
40 | 42 |
* |
43 |
* The view model of a given {@link DynObject}. It allows to add |
|
44 |
* {@link DynField}s into different |
|
45 |
* view groups, by defining different {@link DynFieldModel}s. |
|
46 |
* |
|
47 |
* @author 2010 - <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG Team |
|
48 |
* @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart?n </a> - |
|
49 |
* gvSIG Team |
|
50 |
* @version $Id$ |
|
51 |
* |
|
41 | 52 |
*/ |
42 | 53 |
public interface DynObjectModel { |
43 | 54 |
|
44 |
public DynFieldComponentModel add(String fieldName); |
|
55 |
/** |
|
56 |
* Creates a new {@link DynFieldModel} with the given <b>group</b> and |
|
57 |
* <b>fieldName</b>. |
|
58 |
* This {@link DynFieldModel} is then added to the list of |
|
59 |
* {@link DynFieldModel}s of this DynObjectModel |
|
60 |
* and then returned. |
|
61 |
* |
|
62 |
* @param group |
|
63 |
* the group name of the associated {@link DynField}. If null, |
|
64 |
* the group name will be set to <b>"General"</b>. |
|
65 |
* @param fieldName |
|
66 |
* the id name of the associated {@link DynField}. |
|
67 |
* @return |
|
68 |
* the newly created {@link DynFieldModel} added to the list. |
|
69 |
*/ |
|
70 |
public DynFieldModel add(String group, String fieldName); |
|
45 | 71 |
|
46 |
public DynFieldComponentModel add(String group, String fieldName); |
|
72 |
/** |
|
73 |
* Creates a new {@link DynFieldModel} within the default "General" |
|
74 |
* <b>group</b>, but with the given <b>fieldName</b>. |
|
75 |
* This {@link DynFieldModel} is then added to the list of |
|
76 |
* {@link DynFieldModel}s of this DynObjectModel |
|
77 |
* and then returned. |
|
78 |
* |
|
79 |
* @param fieldName |
|
80 |
* the id name of the associated {@link DynField}. |
|
81 |
* @return |
|
82 |
* the newly created {@link DynFieldModel} added to the list. |
|
83 |
*/ |
|
84 |
public DynFieldModel add(String fieldName); |
|
47 | 85 |
|
86 |
/** |
|
87 |
* Adds a group name to the {@link DynFieldModel}. |
|
88 |
* |
|
89 |
* @param group |
|
90 |
* the group name. |
|
91 |
*/ |
|
48 | 92 |
public void addGroup(String group); |
49 | 93 |
|
94 |
/** |
|
95 |
* Retrieves the list of {@link DynFieldModel}s based on the group name. |
|
96 |
* |
|
97 |
* @param group |
|
98 |
* the group name. |
|
99 |
* @return |
|
100 |
* the list of {@link DynFieldModel}s. |
|
101 |
*/ |
|
50 | 102 |
public List getGroupElements(String group); |
51 | 103 |
|
104 |
/** |
|
105 |
* Return an array of group names available for this {@link DynFieldModel}. |
|
106 |
* |
|
107 |
* @return |
|
108 |
* the array of group names. |
|
109 |
*/ |
|
52 | 110 |
public String[] getGroups(); |
53 | 111 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/dynobject/DynObjectSwingManager.java | ||
---|---|---|
33 | 33 |
import org.gvsig.tools.swing.api.dynobject.set.JDynObjectSetComponent; |
34 | 34 |
|
35 | 35 |
/** |
36 |
* Manager for DynObject related Swing components.
|
|
36 |
* Manager for {@link DynObject} related Swing components.
|
|
37 | 37 |
* |
38 |
* @author gvSIG team |
|
38 |
* @author 2010 - <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG Team |
|
39 |
* @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart?n </a> - |
|
40 |
* gvSIG Team |
|
41 |
* @version $Id$ |
|
42 |
* |
|
39 | 43 |
*/ |
40 | 44 |
public interface DynObjectSwingManager extends Manager { |
41 | 45 |
|
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/dynobject/JDynObjectComponentFactory.java | ||
---|---|---|
38 | 38 |
import org.gvsig.tools.service.spi.ServiceFactory; |
39 | 39 |
|
40 | 40 |
/** |
41 |
* @author <a href="mailto:reinhold@uji.es">cmartin</a> |
|
42 | 41 |
* |
42 |
* Factory that creates and returns a {@link JDynObjectComponent}. |
|
43 |
* |
|
44 |
* @see ServiceFactory |
|
45 |
* |
|
46 |
* @author 2010 - <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG Team |
|
47 |
* @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart?n </a> - |
|
48 |
* gvSIG Team |
|
49 |
* @version $Id$ |
|
50 |
* |
|
43 | 51 |
*/ |
44 | 52 |
public interface JDynObjectComponentFactory extends ServiceFactory { |
45 | 53 |
|
54 |
/** |
|
55 |
* |
|
56 |
* Creates a new JDynObjectComponent base on its {@link DynObject} and its |
|
57 |
* {@link DynObjectModel}. |
|
58 |
* |
|
59 |
* @param dynObject |
|
60 |
* the current {@link DynObject}. |
|
61 |
* @param model |
|
62 |
* the {@link DynObjectModel} that specifies which values are to |
|
63 |
* be displayed. |
|
64 |
* @return |
|
65 |
* the {@link JDynObjectComponent} object. |
|
66 |
* @throws ServiceException |
|
67 |
*/ |
|
46 | 68 |
public JDynObjectComponent createJDynObjectComponent(DynObject dynObject, |
47 | 69 |
DynObjectModel model) throws ServiceException; |
48 | 70 |
|
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/dynobject/ValueChangedListener.java | ||
---|---|---|
35 | 35 |
|
36 | 36 |
import java.util.EventListener; |
37 | 37 |
|
38 |
import org.gvsig.tools.swing.api.dynobject.dynfield.JDynComponent; |
|
38 | 39 |
import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent; |
39 | 40 |
|
40 | 41 |
/** |
41 |
* @author <a href="mailto:reinhold@uji.es">cmartin</a> |
|
42 | 42 |
* |
43 |
* {@link EventListener} to be fired to notify that a value of a |
|
44 |
* JDynFieldComponent has been changed. |
|
45 |
* |
|
46 |
* @author 2010 - <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG Team |
|
47 |
* @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart?n </a> - |
|
48 |
* gvSIG Team |
|
49 |
* @version $Id$ |
|
50 |
* |
|
43 | 51 |
*/ |
44 | 52 |
public interface ValueChangedListener extends EventListener { |
45 | 53 |
|
46 |
public void handleValueChanged(JDynFieldComponent field); |
|
54 |
/** |
|
55 |
* |
|
56 |
* This function is called to each {@link ValueChangedListener} contained in |
|
57 |
* a {@link JDynComponent} whenever a value has changed. |
|
58 |
* |
|
59 |
* @param jDynFieldComponent |
|
60 |
* the JDynFieldComponent that changed its value and caused this |
|
61 |
* event. |
|
62 |
*/ |
|
63 |
public void handleValueChanged(JDynFieldComponent jDynFieldComponent); |
|
47 | 64 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/dynobject/JDynObjectComponent.java | ||
---|---|---|
32 | 32 |
|
33 | 33 |
import org.gvsig.tools.dynobject.DynObject; |
34 | 34 |
import org.gvsig.tools.swing.api.ComponentService; |
35 |
import org.gvsig.tools.swing.api.dynobject.dynfield.JDynComponent; |
|
36 |
import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField; |
|
35 | 37 |
|
36 | 38 |
/** |
37 |
* Component which is able to render a {@link DynObject}
|
|
39 |
* Component able to render a {@link DynObject}.
|
|
38 | 40 |
* |
39 |
* @author 2010- C?sar Ordi?ana - gvSIG team |
|
41 |
* @author 2010 - <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG Team |
|
42 |
* @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart?n </a> - |
|
43 |
* gvSIG Team |
|
44 |
* @version $Id$ |
|
45 |
* |
|
40 | 46 |
*/ |
41 |
public interface JDynObjectComponent extends ValueChangedListener,
|
|
42 |
ComponentService { |
|
47 |
public interface JDynObjectComponent extends JDynComponent, ValueField,
|
|
48 |
ComponentService, ValueChangedListener {
|
|
43 | 49 |
|
44 | 50 |
public static class PARAMETERS { |
45 | 51 |
|
... | ... | |
49 | 55 |
} |
50 | 56 |
|
51 | 57 |
/** |
52 |
* Returns the {@link DynObject} being rendered.
|
|
58 |
* Returns the {@link DynObject} to be rendered.
|
|
53 | 59 |
* |
54 |
* @return the DynObject
|
|
60 |
* @return the {@link DynObject}
|
|
55 | 61 |
*/ |
56 |
public abstract DynObject getDynObject();
|
|
62 |
public DynObject getDynObject(); |
|
57 | 63 |
|
58 | 64 |
/** |
59 |
* Returns the {@link DynObject} being rendered.
|
|
65 |
* Returns the {@link DynObject} to be rendered.
|
|
60 | 66 |
* |
61 |
* @return the DynObject
|
|
67 |
* @return the {@link DynObject}
|
|
62 | 68 |
*/ |
63 |
public abstract DynObjectModel getModel();
|
|
69 |
public DynObjectModel getModel(); |
|
64 | 70 |
|
65 | 71 |
/** |
66 |
* @return |
|
67 |
*/ |
|
68 |
public abstract boolean isValid(); |
|
69 |
|
|
70 |
/** |
|
72 |
* Sets the current value into the {@link DynObject} value. This should be |
|
73 |
* used only |
|
74 |
* when we really want to alter the value of the {@link DynObject}. |
|
71 | 75 |
* |
76 |
* @param value |
|
77 |
* <br> |
|
78 |
* the Value to be set. |
|
72 | 79 |
*/ |
73 |
public abstract void requestFocus();
|
|
80 |
public void setValue(Object value);
|
|
74 | 81 |
|
75 |
/** |
|
76 |
* Stores the edited data into the DynObject. |
|
77 |
*/ |
|
78 |
public abstract void saveStatus(); |
|
79 |
|
|
80 |
/** |
|
81 |
* @param object |
|
82 |
*/ |
|
83 |
public abstract void setValue(Object dynObject); |
|
84 |
|
|
85 |
/** |
|
86 |
* @param listener |
|
87 |
*/ |
|
88 |
public abstract void addValueChangedListener(ValueChangedListener listener); |
|
89 |
|
|
90 | 82 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/dynobject/dynfield/ValueField.java | ||
---|---|---|
33 | 33 |
*/ |
34 | 34 |
package org.gvsig.tools.swing.api.dynobject.dynfield; |
35 | 35 |
|
36 |
import org.gvsig.tools.dynobject.DynField; |
|
37 |
|
|
36 | 38 |
/** |
37 |
* @author <a href="mailto:reinhold@uji.es">cmartin</a> |
|
38 | 39 |
* |
40 |
* Minimal interface to interact with the Value of a {@link DynField}. |
|
41 |
* |
|
42 |
* @author 2010 - <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG Team |
|
43 |
* @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart?n </a> - |
|
44 |
* gvSIG Team |
|
45 |
* @version $Id$ |
|
46 |
* |
|
39 | 47 |
*/ |
40 | 48 |
public interface ValueField { |
41 | 49 |
|
50 |
/** |
|
51 |
* Returns the value by default that this ValueField has. |
|
52 |
* |
|
53 |
* @return the default value. |
|
54 |
*/ |
|
42 | 55 |
public Object getDefaultValue(); |
43 | 56 |
|
57 |
/** |
|
58 |
* Returns the current value of this ValueField. |
|
59 |
* |
|
60 |
* @return the default value. |
|
61 |
*/ |
|
44 | 62 |
public Object getValue(); |
45 | 63 |
|
64 |
/** |
|
65 |
* Modifies the current value of the ValueField. |
|
66 |
* |
|
67 |
* @return the default value. |
|
68 |
*/ |
|
46 | 69 |
public void setValue(Object value); |
47 | 70 |
|
48 | 71 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/dynobject/dynfield/JDynComponent.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 |
/* |
|
23 |
* AUTHORS (In addition to CIT): |
|
24 |
* 2010 Institute of New Imaging Technologies (INIT): |
|
25 |
* http://www.init.uji.es |
|
26 |
* Geographic Information research group: |
|
27 |
* http://www.geoinfo.uji.es |
|
28 |
* Universitat Jaume I, Spain |
|
29 |
*/ |
|
30 |
package org.gvsig.tools.swing.api.dynobject.dynfield; |
|
31 |
|
|
32 |
import org.gvsig.tools.dynobject.DynField; |
|
33 |
import org.gvsig.tools.dynobject.DynObject; |
|
34 |
import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent; |
|
35 |
import org.gvsig.tools.swing.api.dynobject.ValueChangedListener; |
|
36 |
|
|
37 |
/** |
|
38 |
* Set of functions shared by both the {@link JDynFieldComponent} and |
|
39 |
* {@link JDynObjectComponent}. |
|
40 |
* |
|
41 |
* @author 2010 - <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG Team |
|
42 |
* @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart?n </a> - |
|
43 |
* gvSIG Team |
|
44 |
* @version $Id$ |
|
45 |
* |
|
46 |
*/ |
|
47 |
public interface JDynComponent { |
|
48 |
|
|
49 |
/** |
|
50 |
* Returns whether the {@link DynField} value passes the validation phase or |
|
51 |
* not. |
|
52 |
* |
|
53 |
* @return |
|
54 |
* <b>true </b> the field value is valid. <br> |
|
55 |
* <b>false </b> the field value is not valid. |
|
56 |
*/ |
|
57 |
public boolean isValid(); |
|
58 |
|
|
59 |
/** |
|
60 |
* Specifies which is the component of this class to gain the focus |
|
61 |
* when this function is called. |
|
62 |
*/ |
|
63 |
public void requestFocus(); |
|
64 |
|
|
65 |
/** |
|
66 |
* Stores the edited data into the {@link DynObject} field. |
|
67 |
*/ |
|
68 |
public void saveStatus(); |
|
69 |
|
|
70 |
/** |
|
71 |
* Allows adding a listener to the list of listeners of this JDynComponent. |
|
72 |
* |
|
73 |
* @param listener |
|
74 |
* the {@link ValueChangedListener} |
|
75 |
* |
|
76 |
* @see ValueChangedListener#handleValueChanged(JDynFieldComponent) |
|
77 |
*/ |
|
78 |
public void addValueChangedListener(ValueChangedListener listener); |
|
79 |
|
|
80 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/dynobject/dynfield/JDynFieldComponent.java | ||
---|---|---|
27 | 27 |
* http://www.geoinfo.uji.es |
28 | 28 |
* Universitat Jaume I, Spain |
29 | 29 |
*/ |
30 |
|
|
31 |
/** |
|
32 |
* |
|
33 |
*/ |
|
34 | 30 |
package org.gvsig.tools.swing.api.dynobject.dynfield; |
35 | 31 |
|
36 | 32 |
import org.gvsig.tools.dynobject.DynField; |
37 |
import org.gvsig.tools.dynobject.DynObject; |
|
38 | 33 |
import org.gvsig.tools.swing.api.ComponentService; |
39 | 34 |
import org.gvsig.tools.swing.api.dynobject.ValueChangedListener; |
40 | 35 |
|
41 | 36 |
/** |
42 |
* @author <a href="mailto:reinhold@uji.es">cmartin</a> |
|
37 |
* Object created by {@link JDynFieldComponentFactory} via its |
|
38 |
* createJDynFieldComponent() |
|
39 |
* function. |
|
43 | 40 |
* |
41 |
* JDynFieldComponent is the Java graphic representation of a DynField's value. |
|
42 |
* It has, apart from all the {@link ValueField} functionalities, a function |
|
43 |
* inherited |
|
44 |
* from the {@link ComponentService} interface to obtain the Java Component. |
|
45 |
* |
|
46 |
* @author 2010 - <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG Team |
|
47 |
* @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart?n </a> - |
|
48 |
* gvSIG Team |
|
49 |
* @version $Id$ |
|
50 |
* |
|
44 | 51 |
*/ |
45 |
public interface JDynFieldComponent extends ValueField, ComponentService { |
|
52 |
public interface JDynFieldComponent extends ValueField, JDynComponent, |
|
53 |
ComponentService { |
|
46 | 54 |
|
55 |
/** |
|
56 |
* DynObject parameters used for DynObjectServices for the exchange |
|
57 |
* of information. |
|
58 |
*/ |
|
47 | 59 |
public static class PARAMETERS { |
48 | 60 |
|
49 | 61 |
public static String MANAGER = "manager"; |
... | ... | |
51 | 63 |
public static String PARENT = "dynfield"; |
52 | 64 |
} |
53 | 65 |
|
54 |
public void addValueChangedListener(ValueChangedListener listener); |
|
55 |
|
|
56 | 66 |
/** |
67 |
* Returns the {@link DynField} to be rendered. |
|
57 | 68 |
* |
58 |
*/ |
|
59 |
public void fireValueChangedEvent(); |
|
60 |
|
|
61 |
/** |
|
62 |
* Returns the {@link DynField} being rendered. |
|
63 |
* |
|
64 | 69 |
* @return the DynField |
65 | 70 |
*/ |
66 | 71 |
public DynField getDynField(); |
67 | 72 |
|
68 |
public Object getFieldValue(); |
|
69 |
|
|
70 |
public boolean isMandatory(); |
|
71 |
|
|
72 | 73 |
/** |
73 |
* Returns the {@link DynObject} being rendered.
|
|
74 |
* Returns the {@link DynObject} to be rendered.
|
|
74 | 75 |
* |
75 | 76 |
* @return the DynObject |
76 | 77 |
*/ |
77 | 78 |
// public DynObject getDynObject(); |
78 | 79 |
|
79 |
public boolean isValid(); |
|
80 |
|
|
81 | 80 |
/** |
81 |
* Gets the {@link DynField}'s value at this particular moment, if any. |
|
82 | 82 |
* |
83 |
* |
|
84 |
* @return |
|
85 |
* the current {@link DynField}'s value, <b>null</b> otherwise. |
|
83 | 86 |
*/ |
84 |
public void requestFocus();
|
|
87 |
public Object getFieldValue();
|
|
85 | 88 |
|
86 | 89 |
/** |
87 |
* Stores the edited data into the DynObject field. |
|
90 |
* Returns if the {@link DynField} is set to be compulsory or not. |
|
91 |
* |
|
92 |
* @return |
|
93 |
* <b>true </b> the field is compulsory. <br> |
|
94 |
* <b>false </b> the field is optional. |
|
88 | 95 |
*/ |
89 |
public void saveStatus();
|
|
96 |
public boolean isMandatory();
|
|
90 | 97 |
|
91 | 98 |
/** |
99 |
* Specifies if this JDynFieldComponent is to be enabled or not. |
|
100 |
* |
|
92 | 101 |
* @param isEnabled |
102 |
* <br> |
|
103 |
* <b>true </b> the component is enabled.<br> |
|
104 |
* <b>false </b> the component is |
|
105 |
* disabled. |
|
93 | 106 |
*/ |
94 | 107 |
public void setEnabled(boolean isEnabled); |
95 | 108 |
|
109 |
/** |
|
110 |
* Sets the current value into the {@link DynField} value. This should be |
|
111 |
* used only |
|
112 |
* when we really want to alter the value of the {@link DynField}. |
|
113 |
* |
|
114 |
* @param value |
|
115 |
* <br> |
|
116 |
* the Value to be set. |
|
117 |
*/ |
|
96 | 118 |
public void setFieldValue(Object value); |
97 | 119 |
|
120 |
/** |
|
121 |
* Walks through the list of {@link ValueChangedListener} objects and |
|
122 |
* calls the <b>handleValueChanged</b> function by specifying this |
|
123 |
* JDynFieldComponent object |
|
124 |
* as the one that has been changed. |
|
125 |
* |
|
126 |
* @see ValueChangedListener#handleValueChanged(JDynFieldComponent) |
|
127 |
*/ |
|
128 |
public void fireValueChangedEvent(); |
|
129 |
|
|
98 | 130 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/usability/UsabilitySwingManager.java | ||
---|---|---|
41 | 41 |
/** |
42 | 42 |
* Creates a button with no set text or icon. |
43 | 43 |
* |
44 |
* @return a button |
|
44 |
* @return a button.
|
|
45 | 45 |
*/ |
46 | 46 |
JButton createJButton(); |
47 | 47 |
|
... | ... | |
50 | 50 |
* supplied. |
51 | 51 |
* |
52 | 52 |
* @param action |
53 |
* the {@link Action} used to specify the new button |
|
53 |
* the {@link Action} used to specify the new button.
|
|
54 | 54 |
* |
55 | 55 |
*/ |
56 | 56 |
JButton createJButton(Action action); |
57 | 57 |
|
58 |
// |
|
59 |
// /** |
|
60 |
// * @param component1 |
|
61 |
// * @param component2 |
|
62 |
// * @param marginLeft |
|
63 |
// * @param marginRight |
|
64 |
// * @param button |
|
65 |
// * @return |
|
66 |
// */ |
|
67 |
// public JPanel createGridBagRowPanel(JPanel gridBagPanel, Component |
|
68 |
// labelComponent, |
|
69 |
// Component fieldLabel, |
|
70 |
// Integer marginLeft, Integer marginRight); |
|
71 |
// |
|
72 |
// /** |
|
73 |
// * @param panel |
|
74 |
// * @param component1 |
|
75 |
// * @param component2 |
|
76 |
// * @param marginLeft |
|
77 |
// * @param marginRight |
|
78 |
// * @return |
|
79 |
// */ |
|
80 |
// JPanel createBoxRowPanel(JPanel panel, Component component1, |
|
81 |
// Component component2, Integer marginLeft, Integer marginRight); |
|
82 |
|
|
83 | 58 |
/** |
84 | 59 |
* Creates a button with an icon. |
85 | 60 |
* |
86 | 61 |
* @param icon |
87 |
* the Icon image to display on the button |
|
62 |
* the Icon image to display on the button.
|
|
88 | 63 |
* |
89 |
* @return a button |
|
64 |
* @return a button.
|
|
90 | 65 |
*/ |
91 | 66 |
JButton createJButton(Icon icon); |
92 | 67 |
|
... | ... | |
94 | 69 |
* Creates a button with text. |
95 | 70 |
* |
96 | 71 |
* @param text |
97 |
* the text of the button |
|
72 |
* the text of the button.
|
|
98 | 73 |
* |
99 |
* @return a button |
|
74 |
* @return a button.
|
|
100 | 75 |
*/ |
101 | 76 |
JButton createJButton(String text); |
102 | 77 |
|
... | ... | |
104 | 79 |
* Creates a button with initial text and icon. |
105 | 80 |
* |
106 | 81 |
* @param text |
107 |
* the text of the button |
|
82 |
* the text of the button.
|
|
108 | 83 |
* @param icon |
109 |
* the Icon image to display on the button |
|
84 |
* the Icon image to display on the button.
|
|
110 | 85 |
* |
111 |
* @return a button |
|
86 |
* @return a button.
|
|
112 | 87 |
*/ |
113 | 88 |
JButton createJButton(String text, Icon icon); |
114 | 89 |
|
90 |
/** |
|
91 |
* Creates a tool button with text. |
|
92 |
* |
|
93 |
* @param text |
|
94 |
* the text of the tool button. |
|
95 |
* |
|
96 |
* @return a tool button. |
|
97 |
*/ |
|
115 | 98 |
JButton createJToolButton(String text); |
116 | 99 |
} |
Also available in: Unified diff