Revision 1268

View differences:

org.gvsig.tools/library/tags/org.gvsig.tools-3.0.63/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.63/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.63/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.63/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 addActionToPopupMenu(DataType tipo, String name, Action action);
101
	public void addSeparatorToPopupMenu(DataType tipo);
102

  
103
	public void setUseScrollBars(boolean usesScrolls);
104
	public boolean getUseScrollBars();
105

  
106
	public void getFormValues(DynObject values);
107

  
108

  
109
}
0 110

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.63/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.63/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.63/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.63/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.63/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.63/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
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.63/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.63</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.63/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.63</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.63/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/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
  <parent>
5
    <groupId>org.gvsig</groupId>
6
    <artifactId>org.gvsig.tools.dynform</artifactId>
7
    <version>3.0.63</version>
8
  </parent>
9
  <artifactId>org.gvsig.tools.dynform.spi</artifactId>
10
  <name>org.gvsig.tools.dynform.spi</name>
11
  <description>DynForms SPI</description>
12
  
13
	<dependencies>
14
		<dependency>
15
			<groupId>org.gvsig</groupId>
16
			<artifactId>org.gvsig.tools.lib</artifactId>
17
			<scope>compile</scope>
18
		</dependency>
19
		<dependency>
20
			<groupId>org.gvsig</groupId>
21
			<artifactId>org.gvsig.tools.swing.api</artifactId>
22
			<scope>compile</scope>
23
		</dependency>
24
		<dependency>
25
			<groupId>org.gvsig</groupId>
26
			<artifactId>org.gvsig.tools.dynform.api</artifactId>
27
			<scope>compile</scope>
28
		</dependency>
29
                <dependency>
30
                    <groupId>org.apache.commons</groupId>
31
                    <artifactId>commons-lang3</artifactId>
32
			<scope>compile</scope>
33
                </dependency>                
34
	</dependencies>
35
</project>
0 36

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.63/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.63/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/JDynFormFieldFactory.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.service.spi.ServiceFactory;
27

  
28
public interface JDynFormFieldFactory extends ServiceFactory {
29

  
30
}
0 31

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.63/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/DynFormSPIManager.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 javax.swing.JPopupMenu;
27
import javax.swing.text.JTextComponent;
28

  
29
import org.gvsig.tools.dataTypes.DataType;
30
import org.gvsig.tools.dynform.DynFormFieldDefinition;
31
import org.gvsig.tools.dynform.DynFormManager;
32
import org.gvsig.tools.dynform.JDynFormField;
33
import org.gvsig.tools.dynform.spi.dynformfield.JProblemIndicator;
34
import org.gvsig.tools.dynform.spi.dynformfield.JZoomDialog;
35
import org.gvsig.tools.service.Manager;
36
import org.gvsig.tools.service.ServiceException;
37
import org.gvsig.tools.service.spi.ServiceManager;
38

  
39
public interface DynFormSPIManager extends Manager, ServiceManager {
40

  
41
	public static final String FIELD_FORMSETDEFINITION = "definition";
42
	public static final String FIELD_FIELDDEFINITION = "fieldDefinition";
43
	public static final String FIELD_VALUE = "value";
44

  
45
	public static final String SERVICE_NAME_PREFIX = "org.gvsig.tools.dynform.field.";
46
	
47
	public String makeServiceName(int dataType, String className, String subtype);
48
	public String makeServiceName(int dataType, String subtype);
49
	public String makeServiceName(DataType dataType, String subtype);
50
	public String makeServiceName(DataType dataType, String className, String subtype);
51

  
52
	public DynFormManager getDynFormManager();
53
	
54
	public JZoomDialog createJZoomDialog(String title, String message, String text);
55
	public JProblemIndicator createProblemIndicator(JDynFormField field);
56
	
57
    public JDynFormField createJDynFormField(DynFormFieldDefinition definition,Object value) throws ServiceException  ;
58

  
59
    public JPopupMenu createTextFieldPopupMenu(String title, JTextComponent component, boolean zoom);
60
}
0 61

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.63/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/AbstractJDynFormSet.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.tools.dynform.spi;
7

  
8
import java.util.ArrayList;
9
import java.util.List;
10
import javax.swing.Action;
11
import javax.swing.JComponent;
12
import javax.swing.JOptionPane;
13
import org.gvsig.tools.dataTypes.CoercionException;
14
import org.gvsig.tools.dataTypes.DataType;
15
import org.gvsig.tools.dispose.DisposableIterator;
16
import org.gvsig.tools.dynform.DynFormDefinition;
17
import org.gvsig.tools.dynform.JDynFormSet;
18
import org.gvsig.tools.dynform.spi.dynformfield.VisitableSet;
19
import org.gvsig.tools.dynobject.DynField_v2;
20
import org.gvsig.tools.dynobject.DynObject;
21
import org.gvsig.tools.dynobject.DynObjectSet;
22
import org.gvsig.tools.exception.BaseException;
23
import org.gvsig.tools.service.Manager;
24
import org.gvsig.tools.service.Service;
25
import org.gvsig.tools.service.ServiceException;
26
import org.gvsig.tools.service.spi.ServiceManager;
27
import org.gvsig.tools.visitor.VisitCanceledException;
28
import org.gvsig.tools.visitor.Visitor;
29
import org.slf4j.Logger;
30
import org.slf4j.LoggerFactory;
31

  
32
public abstract class AbstractJDynFormSet implements JDynFormSet, Service {
33

  
34
    private static final Logger logger = LoggerFactory.getLogger(AbstractJDynFormSet.class);
35

  
36
    protected DynFormSPIManager manager = null;
37
    protected DynFormDefinition definition = null;
38

  
39
    protected JComponent contents = null;
40

  
41
    protected List<DynObject> values = null;
42
    protected VisitableSet listeners = null;
43
    protected boolean readOnly = false;
44

  
45
    protected boolean autosave = true;
46

  
47
    protected int layoutMode = USE_PLAIN;
48

  
49
    protected int formWidth = -1;
50
    protected int formHeight = -1;
51

  
52
    protected List<ActionStore> actionsBuffer = new ArrayList<ActionStore>();
53

  
54
    private boolean useScrollBars = true;
55
    private boolean _allowUpdate;
56
    private boolean _allowDelete;
57
    private boolean _allowNew;
58
    private boolean _allowSearch;
59
    private boolean _allowClose;
60

  
61
    public AbstractJDynFormSet(ServiceManager manager, DynFormDefinition definition) throws ServiceException {
62
        this.manager = (DynFormSPIManager) manager;
63
        this.definition = definition;
64
        this.listeners = new DefaultVisitableSet();
65
    }
66

  
67
    public void addListener(JDynFormSetListener listener) {
68
        this.listeners.add(listener);
69
    }
70

  
71
    public void removeListener(JDynFormSetListener listener) {
72
        this.listeners.remove(listener);
73
    }
74

  
75
    protected void fireMessageEvent(final String message) {
76
        try {
77
            this.listeners.accept(new Visitor() {
78
                public void visit(Object listener) throws VisitCanceledException, BaseException {
79
                    ((JDynFormSetListener) listener).formMessage(message);
80
                }
81
            });
82

  
83
        } catch (Exception e) {
84
            logger.info("Error calling to the form message event.", e);
85
        }
86
    }
87

  
88
    protected void fireCloseEvent() {
89
        try {
90
            this.listeners.accept(new Visitor() {
91
                public void visit(Object listener) throws VisitCanceledException, BaseException {
92
                    ((JDynFormSetListener) listener).formClose();
93
                }
94
            });
95
        } catch (Exception e) {
96
            logger.info("Error calling to the form close event.", e);
97
        }
98
    }
99

  
100
    protected void fireFormMovedToEvent(final int position) {
101
        try {
102
            this.listeners.accept(new Visitor() {
103
                public void visit(Object listener) throws VisitCanceledException, BaseException {
104
                    ((JDynFormSetListener) listener).formMovedTo(position);
105
                }
106
            });
107
        } catch (Exception e) {
108
            logger.info("Error calling to the form moved to event.", e);
109
        }
110
    }
111

  
112
    public int getLayoutMode() {
113
        return this.layoutMode;
114
    }
115

  
116
    public void setLayoutMode(int layoutMode) {
117
        if ( layoutMode < 0 || layoutMode > USE_SEPARATORS ) {
118
            throw new IllegalArgumentException("layoutMode (" + layoutMode + ") out of range. Valid values are 0 .. " + USE_SEPARATORS + ".");
119
        }
120
        this.layoutMode = layoutMode;
121
    }
122

  
123
    public boolean isReadOnly() {
124
        return readOnly;
125
    }
126

  
127
    public void setReadOnly(boolean readOnly) {
128
        this.readOnly = readOnly;
129
    }
130

  
131
    public boolean isAutosave() {
132
        return this.autosave;
133
    }
134

  
135
    public void setAutosave(boolean autosave) {
136
        this.autosave = autosave;
137
    }
138

  
139
    protected int confirmDialog(final String message, final String title, final int optionType,
140
            final int messageType) {
141
        return JOptionPane.showConfirmDialog(
142
                this.contents, message, title, optionType, messageType);
143
    }
144

  
145
    public void setFormSize(int width, int height) {
146
        this.formHeight = height;
147
        this.formWidth = width;
148
    }
149

  
150
    public int countValues() {
151
        return this.values.size();
152
    }
153

  
154
    public void setValues(DynObjectSet values) throws ServiceException {
155
        List x = new ArrayList();
156
        DisposableIterator it;
157
        try {
158
            it = values.iterator();
159
        } catch (BaseException e) {
160
            logger.info("Uf! o se que hacer con este error, lo relanzo sin mas.", e);
161
            throw new RuntimeException(e);
162
        }
163
        while ( it.hasNext() ) {
164
            DynObject obj = (DynObject) it.next();
165
            if ( obj instanceof org.gvsig.tools.lang.Cloneable ) {
166
                try {
167
                    obj = (DynObject) ((org.gvsig.tools.lang.Cloneable) obj).clone();
168
                } catch (CloneNotSupportedException e) {
169
                    // Do nothing
170
                }
171
            }
172
            x.add(obj);
173
        }
174
        this.values = x;
175
    }
176

  
177
    public void setValues(List values) throws ServiceException {
178
//        this.values = new ArrayList<DynObject>();
179
//        this.values.addAll(values);
180
        this.values = values;
181
    }
182

  
183
    public DynObject get(int position) {
184
        return (DynObject) this.values.get(position);
185
    }
186

  
187
    public void addActionToPopupMenu(DataType tipo, String name, Action action) {
188
        try {
189
            this.actionsBuffer.add(new ActionStore(tipo, name, action));
190
        } catch (Exception ex) {
191
            String s = (tipo == null) ? "(null)" : tipo.getName();
192
            logger.warn("Can't add popup menu '" + name + "' to the fields of type '" + s + "' of the form.", ex);
193
        }
194
    }
195

  
196
    public void addSeparatorToPopupMenu(DataType tipo) {
197
        try {
198
            this.actionsBuffer.add(new ActionStore(tipo));
199
        } catch (Exception ex) {
200
            String s = (tipo == null) ? "(null)" : tipo.getName();
201
            logger.warn("Can't add separator to the popup menu to the fields of type '" + s + "' of the form.", ex);
202
        }
203

  
204
    }
205

  
206
    public void setUseScrollBars(boolean usesScrolls) {
207
        this.useScrollBars = usesScrolls;
208
    }
209

  
210
    public boolean getUseScrollBars() {
211
        return useScrollBars;
212
    }
213

  
214
    public Manager getManager() {
215
        return this.manager;
216
    }
217

  
218
    public DynFormSPIManager getServiceManager() {
219
        return this.manager;
220
    }
221

  
222
    public void message() {
223
        // Do nothing, ignore message handling
224
    }
225

  
226
    public void message(String msg) {
227
        // Do nothing, ignore message handling
228
    }
229

  
230
    public boolean allowUpdate() {
231
        return this._allowUpdate;
232
    }
233

  
234
    public boolean allowClose() {
235
        return this._allowClose;
236
    }
237

  
238
    public boolean allowDelete() {
239
        return this._allowDelete;
240
    }
241

  
242
    public boolean allowNew() {
243
        return this._allowNew ;
244
    }
245

  
246
    public boolean allowSearch() {
247
        return this._allowSearch;
248
    }
249

  
250
    public void setAllowUpdate(boolean allowUpdate) {
251
        this._allowUpdate = allowUpdate;
252
    }
253

  
254
    public void setAllowDelete(boolean allowDelete) {
255
        this._allowDelete = allowDelete;
256
    }
257

  
258
    public void setAllowNew(boolean allowNew) {
259
        this._allowNew = allowNew;
260
    }
261

  
262
    public void setAllowSearch(boolean allowSearch) {
263
        this._allowSearch = allowSearch;
264
    }
265

  
266
    public void setAllowClose(boolean allowClose) {
267
        this._allowClose = allowClose;
268
    }
269

  
270
    public void getFormValues(DynObject values) {
271
        throw new UnsupportedOperationException();
272
    }
273

  
274
    protected int getTagValueAsInt(String tagname, int defaultVaue) {
275
        if( definition.getTags().has(tagname) ) {
276
            try {
277
                int value = definition.getTags().getInt(tagname);
278
                return value;
279
            } catch (CoercionException ex) {
280
                logger.warn("Can't parse tag '"+tagname+"' as int for text field '"+definition.getName()+"'.",ex);
281
            }
282
        }
283
        return defaultVaue;
284
    }
285

  
286
    protected boolean getTagValueAsBoolean(String tagname, boolean defaultVaue) {
287
        if( definition.getTags().has(tagname) ) {
288
            try {
289
                boolean value = definition.getTags().getBoolean(tagname);
290
                return value;
291
            } catch (CoercionException ex) {
292
                logger.warn("Can't parse tag '"+tagname+"' as boolean for text field '"+definition.getName()+"'.",ex);
293
            }
294
        }
295
        return defaultVaue;
296
    }
297
    
298
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.63/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/ActionStore.java
1
package org.gvsig.tools.dynform.spi;
2

  
3
import javax.swing.Action;
4

  
5
import org.gvsig.tools.dataTypes.DataType;
6

  
7
public class ActionStore{
8
	private DataType tipo;
9
	private String name;
10
	private Action action;
11
	private boolean isSeparator = false;
12
	
13
	public ActionStore(DataType tipo,String name, Action action){
14
		this.tipo = tipo;
15
		this.name = name;
16
		this.action = action;
17
	}
18
	
19
	public ActionStore(DataType tipo){
20
		this.tipo = tipo;
21
		this.isSeparator = true;
22
	}
23
	
24
	public DataType getDataType(){
25
		return tipo;
26
	}
27
	
28
	public String getActionName(){
29
		return name;
30
	}
31
	
32
	public Action getAction(){
33
		return action;
34
	}
35
	
36
	public boolean isSeparator(){
37
		return isSeparator;
38
	}
39
}
0 40

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.63/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.63/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.63/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

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff