Revision 1359
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/README.txt | ||
---|---|---|
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 |
|
|
25 |
The first time you checkout the current project to a new workspace, |
|
26 |
you have to prepare it to be able to work easily with maven from |
|
27 |
eclipse itself. |
|
28 |
|
|
29 |
Perform the following steps: |
|
30 |
|
|
31 |
1.- Launch the *prepare-workspace.xml* ant build file. |
|
32 |
You can do it by loading the file into the ant view, |
|
33 |
and running the default task, or right-clicking the |
|
34 |
file from the package explorer or the navigator and |
|
35 |
select the option: *Run as > Ant build*. |
|
36 |
|
|
37 |
2.- Restart eclipse. |
|
38 |
|
|
39 |
3.- Import the subprojects of the project you have just checked out. |
|
40 |
|
|
41 |
Those steps are only needed once per workspace. |
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<packaging>jar</packaging> |
|
4 |
<artifactId>org.gvsig.tools.dynform.api</artifactId> |
|
5 |
<name>org.gvsig.tools.dynform.api</name> |
|
6 |
<description>DynForms API</description> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.tools.dynform</artifactId> |
|
10 |
<version>3.0.75</version> |
|
11 |
</parent> |
|
12 |
<dependencies> |
|
13 |
<dependency> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
16 |
</dependency> |
|
17 |
<dependency> |
|
18 |
<groupId>org.gvsig</groupId> |
|
19 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
20 |
</dependency> |
|
21 |
</dependencies> |
|
22 |
</project> |
|
0 | 23 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormDefinition.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 3 |
|
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.dynform; |
|
25 |
|
|
26 |
import java.util.List; |
|
27 |
|
|
28 |
import org.gvsig.tools.dynobject.DynField; |
|
29 |
import org.gvsig.tools.dynobject.DynObject; |
|
30 |
import org.gvsig.tools.dynobject.DynStruct; |
|
31 |
import org.gvsig.tools.dynobject.Tags; |
|
32 |
|
|
33 |
@SuppressWarnings("rawtypes") |
|
34 |
public interface DynFormDefinition { |
|
35 |
|
|
36 |
public String getName(); |
|
37 |
|
|
38 |
/** |
|
39 |
* Return the list of groups names ordered, |
|
40 |
* |
|
41 |
* @return list of groups names |
|
42 |
*/ |
|
43 |
public List getGroups(); |
|
44 |
|
|
45 |
public List getSubgroups(String group); |
|
46 |
|
|
47 |
public List getDefinitions(); |
|
48 |
|
|
49 |
public List getDefinitions(String group); |
|
50 |
|
|
51 |
public List getDefinitions(String group, String subgroup); |
|
52 |
|
|
53 |
public int getGroupOrder(String group); |
|
54 |
|
|
55 |
public void setGroupOrder(String group, int order); |
|
56 |
|
|
57 |
public void add(DynStruct definition); |
|
58 |
|
|
59 |
public DynFormFieldDefinition add(DynField definition); |
|
60 |
|
|
61 |
public DynFormFieldDefinition get(String name); |
|
62 |
|
|
63 |
public DynFormFieldDefinition get(int index); |
|
64 |
|
|
65 |
public void remove(String name); |
|
66 |
|
|
67 |
public int size(); |
|
68 |
|
|
69 |
public Tags getTags(); |
|
70 |
|
|
71 |
public DynObject createElement(); |
|
72 |
|
|
73 |
public void setElementsType(DynStruct struct); |
|
74 |
|
|
75 |
public DynStruct getElementsType(); |
|
76 |
|
|
77 |
} |
|
0 | 78 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynForm.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 3 |
|
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.dynform; |
|
25 |
|
|
26 |
import java.util.Collection; |
|
27 |
import java.util.List; |
|
28 |
|
|
29 |
import javax.swing.Action; |
|
30 |
|
|
31 |
import org.gvsig.tools.dataTypes.DataType; |
|
32 |
import org.gvsig.tools.dynobject.DynObject; |
|
33 |
import org.gvsig.tools.swing.api.Component; |
|
34 |
|
|
35 |
public interface JDynForm extends Component { |
|
36 |
|
|
37 |
public interface JDynFormListener { |
|
38 |
public void message(String message); |
|
39 |
/** |
|
40 |
* This event is fired when a field of the form is changed by the user. |
|
41 |
* |
|
42 |
* Now this is not yet implemented. |
|
43 |
* |
|
44 |
* @param field |
|
45 |
*/ |
|
46 |
public void fieldChanged(JDynFormField field); |
|
47 |
} |
|
48 |
|
|
49 |
public static final int USE_PLAIN = 0; |
|
50 |
public static final int USE_TABS = 1; |
|
51 |
public static final int USE_SEPARATORS = 2; |
|
52 |
public static final int USE_TREE = 3; |
|
53 |
|
|
54 |
public void setLayoutMode(int layoutMode); |
|
55 |
public int getLayoutMode(); |
|
56 |
|
|
57 |
public int getFormWidth(); |
|
58 |
public int getFormHeight(); |
|
59 |
public void setFormSize(int width, int height); |
|
60 |
|
|
61 |
public JDynFormField getField(String fieldName); |
|
62 |
|
|
63 |
public Collection getShowFields(); |
|
64 |
|
|
65 |
public DynFormDefinition getDefinition(); |
|
66 |
|
|
67 |
public void setValues(DynObject values); |
|
68 |
public void getValues(DynObject values); |
|
69 |
|
|
70 |
public Object getValue(String fieldName); |
|
71 |
public void setValue(String fieldName, Object value); |
|
72 |
|
|
73 |
public boolean hasValidValues(); |
|
74 |
public boolean hasValidValues(List<String> fieldsName); |
|
75 |
|
|
76 |
public void message(); |
|
77 |
|
|
78 |
public void message(String msg); |
|
79 |
|
|
80 |
public void setReadOnly(boolean readOnly); |
|
81 |
public boolean isReadOnly(); |
|
82 |
|
|
83 |
public void setShowMessageStatus(boolean showMessageStatus); |
|
84 |
|
|
85 |
public boolean isShowMessageStatus(); |
|
86 |
|
|
87 |
public void setUseScrollBars(boolean usesScrolls); |
|
88 |
public boolean getUseScrollBars(); |
|
89 |
|
|
90 |
public boolean isModified(); |
|
91 |
|
|
92 |
public void addListener(JDynFormListener listener); |
|
93 |
public void removeListener(JDynFormListener listener); |
|
94 |
|
|
95 |
public void addActionToPopupMenu(DataType tipo, String name, Action action); |
|
96 |
public void addSeparatorToPopupMenu(DataType tipo); |
|
97 |
|
|
98 |
public void clear(); |
|
99 |
} |
|
0 | 100 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormManager.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 3 |
|
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.dynform; |
|
25 |
|
|
26 |
import java.util.List; |
|
27 |
|
|
28 |
import org.gvsig.tools.dynobject.DynObject; |
|
29 |
import org.gvsig.tools.dynobject.DynObjectSet; |
|
30 |
import org.gvsig.tools.dynobject.DynStruct; |
|
31 |
import org.gvsig.tools.service.Manager; |
|
32 |
import org.gvsig.tools.service.ServiceException; |
|
33 |
|
|
34 |
public interface DynFormManager extends Manager { |
|
35 |
|
|
36 |
public DynFormDefinition getDefinition(String name); |
|
37 |
public DynFormDefinition getDefinition(DynStruct definition); |
|
38 |
public DynFormDefinition getDefinition(DynObject obj); |
|
39 |
|
|
40 |
public JDynForm createJDynForm(DynFormDefinition definition) throws ServiceException; |
|
41 |
public JDynForm createJDynForm(DynStruct struct) throws ServiceException; |
|
42 |
public JDynForm createJDynForm(DynObject obj) throws ServiceException; |
|
43 |
|
|
44 |
public String getDefaultJDynFormSetName(); |
|
45 |
public void setDefaultJDynFormSetName(String name); |
|
46 |
|
|
47 |
public JDynFormSet createJDynFormSet(DynFormDefinition definition) throws ServiceException; |
|
48 |
public JDynFormSet createJDynFormSet(DynStruct struct) throws ServiceException; |
|
49 |
public JDynFormSet createJDynFormSet(List data) throws ServiceException; |
|
50 |
public JDynFormSet createJDynFormSet(DynObjectSet data) throws ServiceException; |
|
51 |
|
|
52 |
public JDynFormSet createJDynFormSet(String type, DynFormDefinition definition) throws ServiceException; |
|
53 |
public JDynFormSet createJDynFormSet(String type, DynStruct struct) throws ServiceException; |
|
54 |
public JDynFormSet createJDynFormSet(String type, List data) throws ServiceException; |
|
55 |
public JDynFormSet createJDynFormSet(String type, DynObjectSet data) throws ServiceException; |
|
56 |
|
|
57 |
} |
|
0 | 58 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormFieldDefinition.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 3 |
|
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.dynform; |
|
25 |
|
|
26 |
import org.gvsig.tools.dynobject.DynField; |
|
27 |
import org.gvsig.tools.dynobject.DynField_v2; |
|
28 |
|
|
29 |
public interface DynFormFieldDefinition extends DynField_v2 { |
|
30 |
|
|
31 |
public String getGroup(); |
|
32 |
public String getSubgroup(); |
|
33 |
|
|
34 |
public String getGroups(); |
|
35 |
public String getLabel(); |
|
36 |
|
|
37 |
public DynField setLabel(String label); |
|
38 |
public void setGroups(String groups); |
|
39 |
|
|
40 |
} |
|
0 | 41 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynFormField.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 3 |
|
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.dynform; |
|
25 |
|
|
26 |
import javax.swing.Action; |
|
27 |
import javax.swing.JComponent; |
|
28 |
|
|
29 |
import org.gvsig.tools.service.Service; |
|
30 |
import org.gvsig.tools.swing.api.Component; |
|
31 |
|
|
32 |
public interface JDynFormField extends Component, Service { |
|
33 |
|
|
34 |
public interface JDynFormFieldListener { |
|
35 |
public void fieldEnter(JDynFormField field); |
|
36 |
public void fieldExit(JDynFormField field); |
|
37 |
public void fieldChanged(JDynFormField field); |
|
38 |
public void message(JDynFormField field, String message); |
|
39 |
} |
|
40 |
|
|
41 |
public DynFormFieldDefinition getDefinition(); |
|
42 |
|
|
43 |
public String getName(); |
|
44 |
|
|
45 |
public String getLabel(); |
|
46 |
|
|
47 |
public JComponent getJLabel(); |
|
48 |
|
|
49 |
public boolean hasValidValue(); |
|
50 |
|
|
51 |
public void setValue(Object value); |
|
52 |
|
|
53 |
public boolean isModified(); |
|
54 |
|
|
55 |
/** |
|
56 |
* Get the value of field from the form. |
|
57 |
* |
|
58 |
* Throw an exception if the value of form is not valid |
|
59 |
* for this field. |
|
60 |
* |
|
61 |
* @return value of field |
|
62 |
*/ |
|
63 |
public Object getValue(); |
|
64 |
|
|
65 |
public void addListener(JDynFormFieldListener listener); |
|
66 |
|
|
67 |
public void removeListener(JDynFormFieldListener listener); |
|
68 |
|
|
69 |
public void setReadOnly(boolean readonly); |
|
70 |
|
|
71 |
public boolean isReadOnly(); |
|
72 |
|
|
73 |
public void addActionToPopupMenu(String name, Action action); |
|
74 |
|
|
75 |
public void addSeparatorToPopupMenu(); |
|
76 |
|
|
77 |
public void fireMessageEvent(String message); |
|
78 |
|
|
79 |
public void clear(); |
|
80 |
|
|
81 |
public JDynForm getForm(); |
|
82 |
} |
|
0 | 83 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormLocator.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 3 |
|
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.dynform; |
|
25 |
|
|
26 |
import org.gvsig.tools.locator.AbstractLocator; |
|
27 |
import org.gvsig.tools.locator.Locator; |
|
28 |
import org.gvsig.tools.locator.LocatorException; |
|
29 |
|
|
30 |
@SuppressWarnings("rawtypes") |
|
31 |
public class DynFormLocator extends AbstractLocator { |
|
32 |
|
|
33 |
private static final String LOCATOR_NAME = "DynFormsLocator"; |
|
34 |
|
|
35 |
public static final String DYNFORM_MANAGER_NAME = |
|
36 |
"org.gvsig.tools.dynform.manager"; |
|
37 |
|
|
38 |
private static final String DYNFORM_MANAGER_DESCRIPTION = |
|
39 |
"Persistence Manager of gvSIG"; |
|
40 |
|
|
41 |
private static final DynFormLocator instance = new DynFormLocator(); |
|
42 |
|
|
43 |
private DynFormLocator() { |
|
44 |
|
|
45 |
} |
|
46 |
|
|
47 |
/** |
|
48 |
* Return the singleton instance. |
|
49 |
* |
|
50 |
* @return the singleton instance |
|
51 |
*/ |
|
52 |
public static DynFormLocator getInstance() { |
|
53 |
return instance; |
|
54 |
} |
|
55 |
|
|
56 |
public String getLocatorName() { |
|
57 |
return LOCATOR_NAME; |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Return a reference to DynFormManager. |
|
62 |
* |
|
63 |
* @return a reference to DynFormManager |
|
64 |
* @throws LocatorException |
|
65 |
* if there is no access to the class or the class cannot be |
|
66 |
* instantiated |
|
67 |
* @see Locator#get(String) |
|
68 |
*/ |
|
69 |
public static DynFormManager getDynFormManager() |
|
70 |
throws LocatorException { |
|
71 |
return (DynFormManager) getInstance().get(DYNFORM_MANAGER_NAME); |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* Registers the Class implementing the DynFormManager interface. |
|
76 |
* |
|
77 |
* @param clazz |
|
78 |
* implementing the DynFormManager interface |
|
79 |
*/ |
|
80 |
public static void registerDynFormManager(Class clazz) { |
|
81 |
getInstance().register(DYNFORM_MANAGER_NAME, |
|
82 |
DYNFORM_MANAGER_DESCRIPTION, clazz); |
|
83 |
} |
|
84 |
|
|
85 |
public static void registerDefaultDynFormManager(Class clazz) { |
|
86 |
getInstance().registerDefault(DYNFORM_MANAGER_NAME, |
|
87 |
DYNFORM_MANAGER_DESCRIPTION, clazz); |
|
88 |
} |
|
89 |
|
|
90 |
|
|
91 |
} |
|
0 | 92 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/DynFormLibrary.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 3 |
|
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.dynform; |
|
25 |
|
|
26 |
import org.gvsig.tools.ToolsLibrary; |
|
27 |
import org.gvsig.tools.library.AbstractLibrary; |
|
28 |
import org.gvsig.tools.library.LibraryException; |
|
29 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
30 |
|
|
31 |
public class DynFormLibrary extends AbstractLibrary { |
|
32 |
|
|
33 |
public void doRegistration() { |
|
34 |
super.doRegistration(); |
|
35 |
registerAsAPI(DynFormLibrary.class); |
|
36 |
this.require(ToolsLibrary.class); |
|
37 |
} |
|
38 |
|
|
39 |
protected void doInitialize() throws LibraryException { |
|
40 |
|
|
41 |
} |
|
42 |
|
|
43 |
protected void doPostInitialize() throws LibraryException { |
|
44 |
// Validate there is any implementation registered. |
|
45 |
DynFormManager manager = DynFormLocator.getDynFormManager(); |
|
46 |
if (manager == null) { |
|
47 |
throw new ReferenceNotRegisteredException( |
|
48 |
DynFormLocator.DYNFORM_MANAGER_NAME, DynFormLocator |
|
49 |
.getInstance()); |
|
50 |
} |
|
51 |
|
|
52 |
} |
|
53 |
|
|
54 |
} |
|
0 | 55 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/AbortActionException.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 3 |
|
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.dynform; |
|
25 |
|
|
26 |
import org.gvsig.tools.exception.BaseException; |
|
27 |
|
|
28 |
public class AbortActionException extends BaseException { |
|
29 |
|
|
30 |
/** |
|
31 |
* |
|
32 |
*/ |
|
33 |
private static final long serialVersionUID = 3461167266495124406L; |
|
34 |
|
|
35 |
protected AbortActionException(String message, String key, long code){ |
|
36 |
super(message, key, code); |
|
37 |
} |
|
38 |
|
|
39 |
protected AbortActionException(String message, Throwable cause, String key, long code) { |
|
40 |
super(message, cause, key, code); |
|
41 |
} |
|
42 |
} |
|
0 | 43 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynFormSet.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 3 |
|
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.dynform; |
|
25 |
|
|
26 |
import java.util.List; |
|
27 |
|
|
28 |
import javax.swing.Action; |
|
29 |
|
|
30 |
import org.gvsig.tools.dataTypes.DataType; |
|
31 |
import org.gvsig.tools.dynobject.DynObject; |
|
32 |
import org.gvsig.tools.dynobject.DynObjectSet; |
|
33 |
import org.gvsig.tools.service.ServiceException; |
|
34 |
import org.gvsig.tools.swing.api.Component; |
|
35 |
|
|
36 |
public interface JDynFormSet extends Component { |
|
37 |
|
|
38 |
public static final int USE_PLAIN = 0; |
|
39 |
public static final int USE_TABS = 1; |
|
40 |
public static final int USE_SEPARATORS = 2; |
|
41 |
|
|
42 |
public interface JDynFormSetListener { |
|
43 |
public void formMessage(String message); |
|
44 |
public void formClose(); |
|
45 |
public void formMovedTo(int currentPosition) throws AbortActionException; |
|
46 |
|
|
47 |
public void formBeforeSave(JDynFormSet dynformSet) throws AbortActionException; |
|
48 |
public void formBeforeNew(JDynFormSet dynformSet) throws AbortActionException; |
|
49 |
public void formBeforeDelete(JDynFormSet dynformSet) throws AbortActionException; |
|
50 |
public void formBeforeSearch(JDynFormSet dynformSet) throws AbortActionException; |
|
51 |
|
|
52 |
public void formAfterSave(JDynFormSet dynformSet) throws AbortActionException; |
|
53 |
public void formAfterNew(JDynFormSet dynformSet) throws AbortActionException; |
|
54 |
public void formAfterDelete(JDynFormSet dynformSet) throws AbortActionException; |
|
55 |
public void formAfterSearch(JDynFormSet dynformSet) throws AbortActionException; |
|
56 |
} |
|
57 |
|
|
58 |
public void setLayoutMode(int layoutMode); |
|
59 |
public int getLayoutMode(); |
|
60 |
|
|
61 |
public boolean hasValidValues(); |
|
62 |
public boolean hasValidValues(List<String> fieldsName); |
|
63 |
|
|
64 |
public void setValues(DynObjectSet values) throws ServiceException; |
|
65 |
public void setValues(List values) throws ServiceException; |
|
66 |
|
|
67 |
public List getValues(); |
|
68 |
|
|
69 |
public void message(); |
|
70 |
public void message(String msg); |
|
71 |
|
|
72 |
public void setReadOnly(boolean readOnly); |
|
73 |
public boolean isReadOnly(); |
|
74 |
|
|
75 |
public void addListener(JDynFormSetListener listener); |
|
76 |
public void removeListener(JDynFormSetListener listener); |
|
77 |
|
|
78 |
public boolean isAutosave(); |
|
79 |
public void setAutosave(boolean autosave); |
|
80 |
|
|
81 |
public boolean allowUpdate(); |
|
82 |
public boolean allowDelete(); |
|
83 |
public boolean allowNew(); |
|
84 |
public boolean allowSearch(); |
|
85 |
public boolean allowClose(); |
|
86 |
|
|
87 |
public void setAllowUpdate(boolean allowUpdate); |
|
88 |
public void setAllowDelete(boolean allowDelete); |
|
89 |
public void setAllowNew(boolean allowNew); |
|
90 |
public void setAllowSearch(boolean allowSearch); |
|
91 |
public void setAllowClose(boolean allowClose); |
|
92 |
|
|
93 |
public void setFormSize(int width, int height); |
|
94 |
|
|
95 |
public DynObject get(int position); |
|
96 |
public int getCurrentIndex(); |
|
97 |
public int countValues(); |
|
98 |
public void setCurrentIndex(int index); |
|
99 |
|
|
100 |
public void addAction(Action action); |
|
101 |
public void addActionToPopupMenu(DataType tipo, String name, Action action); |
|
102 |
public void addSeparatorToPopupMenu(DataType tipo); |
|
103 |
|
|
104 |
public void setUseScrollBars(boolean usesScrolls); |
|
105 |
public boolean getUseScrollBars(); |
|
106 |
|
|
107 |
public void getFormValues(DynObject values); |
|
108 |
|
|
109 |
|
|
110 |
} |
|
0 | 111 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.tools.dynform.DynFormLibrary |
|
0 | 2 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.tools.dynform</artifactId> |
|
5 |
<packaging>pom</packaging> |
|
6 |
<name>org.gvsig.tools.dynform</name> |
|
7 |
<description>Add support to DynForms</description> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.tools</artifactId> |
|
11 |
<version>3.0.75</version> |
|
12 |
</parent> |
|
13 |
|
|
14 |
<modules> |
|
15 |
<module>org.gvsig.tools.dynform.api</module> |
|
16 |
<module>org.gvsig.tools.dynform.spi</module> |
|
17 |
<module>org.gvsig.tools.dynform.services</module> |
|
18 |
<module>org.gvsig.tools.dynform.impl</module> |
|
19 |
</modules> |
|
20 |
</project> |
|
0 | 21 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.tools.dynform.spi.DynFormSPILibrary |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/JDynFormSetFactory.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.tools.dynform.spi; |
|
3 |
|
|
4 |
import org.gvsig.tools.service.spi.ServiceFactory; |
|
5 |
|
|
6 |
|
|
7 |
public interface JDynFormSetFactory extends ServiceFactory { |
|
8 |
|
|
9 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPILocator.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 3 |
|
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.dynform.spi; |
|
25 |
|
|
26 |
import org.gvsig.tools.locator.AbstractLocator; |
|
27 |
import org.gvsig.tools.locator.Locator; |
|
28 |
import org.gvsig.tools.locator.LocatorException; |
|
29 |
|
|
30 |
@SuppressWarnings("rawtypes") |
|
31 |
public class DynFormSPILocator extends AbstractLocator { |
|
32 |
|
|
33 |
private static final String LOCATOR_NAME = "DynFormsSPILocator"; |
|
34 |
|
|
35 |
public static final String DYNFORM_SPI_MANAGER_NAME = |
|
36 |
"org.gvsig.tools.dynform.spi.manager"; |
|
37 |
|
|
38 |
private static final String DYNFORM_SPI_MANAGER_DESCRIPTION = |
|
39 |
"SPI manager for gvSIG's DynForms"; |
|
40 |
|
|
41 |
private static final DynFormSPILocator instance = new DynFormSPILocator(); |
|
42 |
|
|
43 |
private DynFormSPILocator() { |
|
44 |
|
|
45 |
} |
|
46 |
|
|
47 |
/** |
|
48 |
* Return the singleton instance. |
|
49 |
* |
|
50 |
* @return the singleton instance |
|
51 |
*/ |
|
52 |
public static DynFormSPILocator getInstance() { |
|
53 |
return instance; |
|
54 |
} |
|
55 |
|
|
56 |
public String getLocatorName() { |
|
57 |
return LOCATOR_NAME; |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Return a reference to DynFormManager. |
|
62 |
* |
|
63 |
* @return a reference to DynFormManager |
|
64 |
* @throws LocatorException |
|
65 |
* if there is no access to the class or the class cannot be |
|
66 |
* instantiated |
|
67 |
* @see Locator#get(String) |
|
68 |
*/ |
|
69 |
public static DynFormSPIManager getDynFormSPIManager() |
|
70 |
throws LocatorException { |
|
71 |
return (DynFormSPIManager) getInstance().get(DYNFORM_SPI_MANAGER_NAME); |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* Registers the Class implementing the DynFormManager interface. |
|
76 |
* |
|
77 |
* @param clazz |
|
78 |
* implementing the DynFormManager interface |
|
79 |
*/ |
|
80 |
public static void registerDynFormSPIManager(Class clazz) { |
|
81 |
getInstance().register(DYNFORM_SPI_MANAGER_NAME, |
|
82 |
DYNFORM_SPI_MANAGER_DESCRIPTION, clazz); |
|
83 |
} |
|
84 |
|
|
85 |
public static void registerDefaultDynFormSPIManager(Class clazz) { |
|
86 |
getInstance().registerDefault(DYNFORM_SPI_MANAGER_NAME, |
|
87 |
DYNFORM_SPI_MANAGER_DESCRIPTION, clazz); |
|
88 |
} |
|
89 |
|
|
90 |
|
|
91 |
} |
|
0 | 92 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPILibrary.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 3 |
|
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.dynform.spi; |
|
25 |
|
|
26 |
import org.gvsig.tools.dynform.DynFormLibrary; |
|
27 |
import org.gvsig.tools.library.AbstractLibrary; |
|
28 |
import org.gvsig.tools.library.LibraryException; |
|
29 |
|
|
30 |
public class DynFormSPILibrary extends AbstractLibrary { |
|
31 |
|
|
32 |
public void doRegistration() { |
|
33 |
super.doRegistration(); |
|
34 |
registerAsServiceOf(DynFormLibrary.class); |
|
35 |
} |
|
36 |
|
|
37 |
protected void doInitialize() throws LibraryException { |
|
38 |
|
|
39 |
} |
|
40 |
|
|
41 |
protected void doPostInitialize() throws LibraryException { |
|
42 |
|
|
43 |
} |
|
44 |
|
|
45 |
} |
|
0 | 46 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JCustomTextField.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 3 |
|
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.dynform.spi.dynformfield; |
|
25 |
|
|
26 |
import java.awt.Color; |
|
27 |
|
|
28 |
import javax.swing.Action; |
|
29 |
import javax.swing.JPopupMenu; |
|
30 |
import javax.swing.JTextField; |
|
31 |
import javax.swing.UIManager; |
|
32 |
|
|
33 |
import org.gvsig.tools.dynform.spi.DynFormSPILocator; |
|
34 |
|
|
35 |
public class JCustomTextField extends JTextField implements SupportPopupMenu{ |
|
36 |
|
|
37 |
/** |
|
38 |
* |
|
39 |
*/ |
|
40 |
private static final long serialVersionUID = 1575097883238348147L; |
|
41 |
private JPopupMenu popupMenu = null; |
|
42 |
private boolean hasEditor = true; |
|
43 |
private String title = null; |
|
44 |
|
|
45 |
private static Color backgroundColor = null; |
|
46 |
|
|
47 |
public JCustomTextField(String title){ |
|
48 |
super(); |
|
49 |
if( backgroundColor == null ) { |
|
50 |
backgroundColor = UIManager.getLookAndFeel().getDefaults().getColor("TextField.background"); |
|
51 |
} |
|
52 |
this.title = title; |
|
53 |
initContextMenu(); |
|
54 |
} |
|
55 |
|
|
56 |
public JCustomTextField(String title, boolean withEditor){ |
|
57 |
super(); |
|
58 |
this.title = title; |
|
59 |
this.hasEditor = withEditor; |
|
60 |
initContextMenu(); |
|
61 |
} |
|
62 |
|
|
63 |
private void setActionEnabled(String name, boolean enabled) { |
|
64 |
Action action = this.getActionMap().get(name); |
|
65 |
if( action != null ) { |
|
66 |
action.setEnabled(enabled); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
public void setEnabled(boolean enabled){ |
|
71 |
setActionEnabled("Cut", enabled); |
|
72 |
setActionEnabled("Paste", enabled); |
|
73 |
super.setEnabled(enabled); |
|
74 |
} |
|
75 |
|
|
76 |
|
|
77 |
public void setEditable(boolean enabled){ |
|
78 |
setActionEnabled("Cut", enabled); |
|
79 |
setActionEnabled("Paste", enabled); |
|
80 |
super.setEditable(enabled); |
|
81 |
this.setBackground(backgroundColor); |
|
82 |
} |
|
83 |
|
|
84 |
private void initContextMenu() { |
|
85 |
this.add(getJPopupMenu()); |
|
86 |
this.setComponentPopupMenu(getJPopupMenu()); |
|
87 |
} |
|
88 |
|
|
89 |
public JPopupMenu getJPopupMenu(){ |
|
90 |
if(this.popupMenu == null){ |
|
91 |
this.popupMenu = DynFormSPILocator.getDynFormSPIManager().createTextFieldPopupMenu(title, this, hasEditor); |
|
92 |
} |
|
93 |
return this.popupMenu; |
|
94 |
} |
|
95 |
|
|
96 |
public void addActionToPopupMenu(String name, Action action){ |
|
97 |
if(name != null && !name.isEmpty()){ |
|
98 |
action.putValue(Action.NAME, name); |
|
99 |
} |
|
100 |
getJPopupMenu().add(action); |
|
101 |
} |
|
102 |
|
|
103 |
public void addSeparatorToPopupMenu(){ |
|
104 |
getJPopupMenu().addSeparator(); |
|
105 |
} |
|
106 |
|
|
107 |
} |
|
0 | 108 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/JZoomDialog.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 3 |
|
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.dynform.spi.dynformfield; |
|
25 |
|
|
26 |
import java.awt.Dialog; |
|
27 |
|
|
28 |
import javax.swing.JDialog; |
|
29 |
|
|
30 |
public abstract class JZoomDialog extends JDialog { |
|
31 |
|
|
32 |
/** |
|
33 |
* |
|
34 |
*/ |
|
35 |
private static final long serialVersionUID = 8590635169959772532L; |
|
36 |
|
|
37 |
public JZoomDialog(String title) { |
|
38 |
super((Dialog)null, title, true); |
|
39 |
} |
|
40 |
|
|
41 |
public abstract String getText(); |
|
42 |
|
|
43 |
public abstract void setEditable(boolean editable); |
|
44 |
} |
|
0 | 45 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/VisitableSet.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 3 |
|
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.dynform.spi.dynformfield; |
|
25 |
|
|
26 |
import java.util.Set; |
|
27 |
|
|
28 |
import org.gvsig.tools.visitor.Visitable; |
|
29 |
|
|
30 |
@SuppressWarnings("rawtypes") |
|
31 |
public interface VisitableSet extends Set, Visitable { |
|
32 |
|
|
33 |
} |
|
0 | 34 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.75/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformfield/AbstractJDynFormField.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 3 |
|
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.dynform.spi.dynformfield; |
|
25 |
|
|
26 |
import java.awt.BorderLayout; |
|
27 |
import java.awt.Color; |
|
28 |
import java.util.ArrayList; |
|
29 |
import java.util.HashSet; |
|
30 |
import java.util.Iterator; |
|
31 |
import java.util.List; |
|
32 |
import java.util.Set; |
|
33 |
|
|
34 |
import javax.swing.Action; |
|
35 |
import javax.swing.JComboBox; |
|
36 |
import javax.swing.JComponent; |
|
37 |
import javax.swing.JLabel; |
|
38 |
import javax.swing.JList; |
|
39 |
import javax.swing.JPanel; |
|
40 |
import javax.swing.JScrollPane; |
|
41 |
import javax.swing.JSpinner; |
|
42 |
import javax.swing.JTextField; |
|
43 |
import javax.swing.JViewport; |
|
44 |
import javax.swing.text.JTextComponent; |
|
45 |
import org.gvsig.tools.dataTypes.CoercionException; |
|
46 |
import org.gvsig.tools.dataTypes.DataTypes; |
|
47 |
|
|
48 |
import org.gvsig.tools.dynform.DynFormFieldDefinition; |
|
49 |
import org.gvsig.tools.dynform.JDynForm; |
|
50 |
import org.gvsig.tools.dynform.JDynFormField; |
|
51 |
import org.gvsig.tools.dynform.spi.DynFormSPIManager; |
|
52 |
import org.gvsig.tools.dynobject.DynField_v2; |
|
53 |
import org.gvsig.tools.dynobject.DynObject; |
|
54 |
import org.gvsig.tools.service.Manager; |
|
55 |
import org.gvsig.tools.service.spi.ServiceManager; |
|
56 |
import org.slf4j.Logger; |
|
57 |
import org.slf4j.LoggerFactory; |
|
58 |
|
|
59 |
@SuppressWarnings({"rawtypes", "unchecked"}) |
|
60 |
public abstract class AbstractJDynFormField implements JDynFormField{ |
|
61 |
|
|
62 |
protected static final Logger logger = LoggerFactory |
|
63 |
.getLogger(AbstractJDynFormField.class); |
|
64 |
|
|
65 |
private DynFormSPIManager manager = null; |
|
66 |
private DynFormFieldDefinition definition = null; |
|
67 |
private JLabel jlabel = null; |
|
68 |
private JPanel jlabelpanel = null; |
|
69 |
private Set listeners = null; |
|
70 |
private JProblemIndicator problemIndicator = null; |
|
71 |
|
|
72 |
protected DynObject parameters = null; |
|
73 |
protected JComponent contents = null; |
|
74 |
|
|
75 |
private boolean readOnly = false; |
|
76 |
private List customActions; |
|
77 |
protected boolean emptyToNull = false; |
|
78 |
private JDynForm form; |
|
79 |
|
|
80 |
|
|
81 |
public AbstractJDynFormField(DynObject parameters, |
|
82 |
ServiceManager serviceManager) { |
|
83 |
this.parameters = parameters; |
|
84 |
this.manager = (DynFormSPIManager) serviceManager; |
|
85 |
this.definition = this.getDefinition(); |
|
86 |
this.listeners = new HashSet(); |
|
87 |
this.readOnly = this.definition.isReadOnly(); |
|
88 |
this.problemIndicator = this.manager.createProblemIndicator(this); |
|
89 |
this.customActions = new ArrayList<Action>(); |
|
90 |
} |
|
91 |
|
|
92 |
public abstract void initComponent(); |
|
93 |
public abstract Object getAssignedValue(); |
|
94 |
|
|
95 |
public Object getParameterValue() { |
|
96 |
return this.parameters.getDynValue(DynFormSPIManager.FIELD_VALUE); |
|
97 |
} |
|
98 |
|
|
99 |
public JComponent asJComponent() { |
|
100 |
if (this.contents == null) { |
|
101 |
this.initComponent(); |
|
102 |
if(!this.customActions.isEmpty()){ |
|
103 |
addPopupComponents(); |
|
104 |
} |
|
105 |
if( this.readOnly ) { |
|
106 |
this.setReadOnly(readOnly); |
|
107 |
} |
|
108 |
} |
|
109 |
return this.contents; |
|
110 |
} |
|
111 |
|
|
112 |
public String getName() { |
|
113 |
return this.definition.getName(); |
|
114 |
} |
|
115 |
|
|
116 |
public String getLabel() { |
|
117 |
if(definition.getLabel() != null) |
|
118 |
return definition.getLabel(); |
|
119 |
else |
|
120 |
return this.getName(); |
|
121 |
} |
|
122 |
|
|
123 |
public JComponent getJLabel() { |
|
124 |
if (this.jlabel == null) { |
|
125 |
if( getTagValueAsBoolean("dynform.label.empty", false) ) { |
|
126 |
this.jlabel = new JLabel(""); |
|
127 |
} else { |
|
128 |
this.jlabel = new JLabel(this.getLabel()); |
|
129 |
} |
|
130 |
this.jlabel.setLabelFor(this.contents); |
|
131 |
if( this.getDefinition().isMandatory() ) { |
|
132 |
this.jlabel.setForeground(Color.red.darker()); |
|
133 |
} |
|
134 |
this.jlabelpanel = new JPanel(); |
|
135 |
this.jlabelpanel.setLayout(new BorderLayout()); |
|
136 |
this.jlabelpanel.add(jlabel,BorderLayout.CENTER); |
|
137 |
this.jlabelpanel.add(problemIndicator.asJComponent(), BorderLayout.LINE_END); |
|
138 |
} |
|
139 |
return this.jlabelpanel; |
|
140 |
} |
|
141 |
|
|
142 |
public DynFormFieldDefinition getDefinition() { |
|
143 |
return (DynFormFieldDefinition) this.parameters |
|
144 |
.getDynValue(DynFormSPIManager.FIELD_FIELDDEFINITION); |
|
145 |
} |
|
146 |
|
|
147 |
public Manager getManager() { |
|
148 |
return this.manager; |
|
149 |
} |
|
150 |
|
|
151 |
public DynFormSPIManager getServiceManager(){ |
|
152 |
return this.manager; |
|
153 |
} |
|
154 |
|
|
155 |
public void addListener(JDynFormFieldListener listener) { |
|
156 |
this.listeners.add(listener); |
|
157 |
} |
|
158 |
|
|
159 |
public void removeListener(JDynFormFieldListener listener) { |
|
160 |
this.listeners.remove(listener); |
|
161 |
} |
|
162 |
|
|
163 |
protected void fireFieldChangedEvent() { |
|
164 |
Iterator it = this.listeners.iterator(); |
|
165 |
while (it.hasNext()) { |
|
166 |
JDynFormFieldListener listener = (JDynFormFieldListener) it.next(); |
|
167 |
try { |
|
168 |
listener.fieldChanged(this); |
|
169 |
} catch (Exception ex) { |
|
170 |
logger.info("Error calling listener " + listener.toString() |
|
171 |
+ "(" + listener.getClass().getName() + ") from " |
|
172 |
+ this.toString() + "(" + this.getClass().getName() |
|
173 |
+ ").", ex); |
|
174 |
} |
|
175 |
} |
|
176 |
} |
|
177 |
|
|
178 |
protected void fireFieldEnterEvent() { |
|
179 |
Iterator it = this.listeners.iterator(); |
|
180 |
while (it.hasNext()) { |
|
181 |
JDynFormFieldListener listener = (JDynFormFieldListener) it.next(); |
|
182 |
try { |
|
183 |
listener.fieldEnter(this); |
|
184 |
} catch (Exception ex) { |
|
185 |
logger.info("Error calling listener " + listener.toString() |
|
186 |
+ "(" + listener.getClass().getName() + ") from " |
|
187 |
+ this.toString() + "(" + this.getClass().getName() |
|
188 |
+ ").", ex); |
|
189 |
} |
|
190 |
} |
|
191 |
} |
|
192 |
|
|
193 |
protected void fireFieldExitEvent() { |
|
194 |
Iterator it = this.listeners.iterator(); |
|
195 |
while (it.hasNext()) { |
|
196 |
JDynFormFieldListener listener = (JDynFormFieldListener) it.next(); |
|
197 |
try { |
|
198 |
listener.fieldExit(this); |
|
199 |
} catch (Exception ex) { |
|
200 |
logger.info("Error calling listener " + listener.toString() |
|
201 |
+ "(" + listener.getClass().getName() + ") from " |
|
202 |
+ this.toString() + "(" + this.getClass().getName() |
|
203 |
+ ").", ex); |
|
204 |
} |
|
205 |
} |
|
206 |
} |
|
207 |
|
|
208 |
public void fireMessageEvent(String message) { |
|
209 |
Iterator it = this.listeners.iterator(); |
|
210 |
while (it.hasNext()) { |
|
211 |
JDynFormFieldListener listener = (JDynFormFieldListener) it.next(); |
|
212 |
try { |
Also available in: Unified diff