Revision 2599

View differences:

org.gvsig.tools/library/tags/org.gvsig.tools-3.0.295/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.295/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.295/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynFormFieldListenerAdapter.java
1
package org.gvsig.tools.dynform;
2

  
3
/**
4
 *
5
 * @author jjdelcerro
6
 */
7
abstract class JDynFormFieldListenerAdapter implements JDynFormField.JDynFormFieldListener {
8

  
9
    @Override
10
    public void fieldEnter(JDynFormField jdff) {
11
    }
12

  
13
    @Override
14
    public void fieldExit(JDynFormField jdff) {
15
    }
16

  
17
    @Override
18
    public void fieldChanged(JDynFormField jdff) {
19
    }
20

  
21
    @Override
22
    public void message(JDynFormField jdff, String string) {
23
    }
24

  
25
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.295/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.295/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
import javax.swing.JComponent;
30

  
31
import org.gvsig.tools.dataTypes.DataType;
32
import org.gvsig.tools.dynobject.DynObject;
33
import org.gvsig.tools.dynobject.DynObjectSet;
34
import org.gvsig.tools.swing.api.Component;
35

  
36
public interface JDynFormSet  extends Component {
37

  
38
        public static final String ACTION_FIRST = "first";
39
        public static final String ACTION_PREVIOUS = "previous";
40
        public static final String ACTION_NEXT = "next";
41
        public static final String ACTION_LAST = "last";
42
        public static final String ACTION_SAVE = "save";
43
        public static final String ACTION_NEW = "new";
44
        public static final String ACTION_CANCEL_NEW = "cancel-new";
45
        public static final String ACTION_DELETE = "delete";
46
        public static final String ACTION_SEARCH = "search";
47
        public static final String ACTION_CLOSE = "close";
48
        public static final String ACTION_SET_CURRENT_RECORD = "set-current-record";
49

  
50
        public static final String ACTION_NAVIGATION = "#navigation";
51
        
52
	public interface JDynFormSetListener {
53
		public void formMessage(String message);
54
		public void formClose();
55
		public void formMovedTo(int currentPosition) throws AbortActionException;
56

  
57
		public void formBeforeSave(JDynFormSet dynformSet) throws AbortActionException;
58
		public void formBeforeNew(JDynFormSet dynformSet) throws AbortActionException;
59
		public void formBeforeCancelNew(JDynFormSet dynformSet) throws AbortActionException;
60
		public void formBeforeDelete(JDynFormSet dynformSet) throws AbortActionException;
61
		public void formBeforeSearch(JDynFormSet dynformSet) throws AbortActionException;
62

  
63
		public void formAfterSave(JDynFormSet dynformSet) throws AbortActionException;
64
		public void formAfterNew(JDynFormSet dynformSet) throws AbortActionException;
65
		public void formAfterCancelNew(JDynFormSet dynformSet) throws AbortActionException;
66
		public void formAfterDelete(JDynFormSet dynformSet) throws AbortActionException;
67
		public void formAfterSearch(JDynFormSet dynformSet) throws AbortActionException;
68
	}
69

  
70
	public void setLayoutMode(int layoutMode);
71
	public int getLayoutMode();
72

  
73
	public boolean hasValidValues();
74
	public boolean hasValidValues(List<String> fieldsName);
75

  
76
	public void setValues(DynObjectSet values);
77
	public void setValues(List values);
78

  
79
        public List getValues();
80

  
81
	public void message();
82
	public void message(String msg);
83

  
84
	public void setReadOnly(boolean readOnly);
85
	public boolean isReadOnly();
86

  
87
	public void addListener(JDynFormSetListener listener);
88
	public void removeListener(JDynFormSetListener listener);
89

  
90
	public boolean isAutosave();
91
	public void setAutosave(boolean autosave);
92

  
93
	public boolean allowUpdate();
94
	public boolean allowDelete();
95
	public boolean allowNew();
96
	public boolean allowSearch();
97
	public boolean allowClose();
98

  
99
	public void setAllowUpdate(boolean allowUpdate);
100
	public void setAllowDelete(boolean allowDelete);
101
	public void setAllowNew(boolean allowNew);
102
	public void setAllowSearch(boolean allowSearch);
103
	public void setAllowClose(boolean allowClose);
104

  
105
	public void setFormSize(int width, int height);
106

  
107
	public DynObject get(int position);
108
	public int getCurrentIndex();
109
	public int countValues();
110
        
111
        /**
112
         * Set the current element of form.
113
         * If the form is modified, the changes will be lost.
114
         * @param index 
115
         */
116
	public void setCurrentIndex(int index);
117
        public boolean isInNewState();
118

  
119
        public void addAction(Action action);
120
        public Action getAction(String actionId);
121
        public List<Action> getActions();
122
        public void setActionVisible(String action, boolean visible);
123
        public void setActionEnabled(String action, boolean enabled);
124
        public boolean isActionVisible(String action);
125
        public boolean isActionEnabled(String action);
126
        public JComponent getActionButton(String action);
127
        public void fireEvent(String action, Object value);
128
        
129
	public void addActionToPopupMenu(DataType tipo, String name, Action action);
130
	public void addSeparatorToPopupMenu(DataType tipo);
131

  
132
	public void setUseScrollBars(boolean usesScrolls);
133
	public boolean getUseScrollBars();
134

  
135
	public void getFormValues(DynObject values);
136

  
137
        public JDynForm getForm();
138

  
139

  
140
}
0 141

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.295/org.gvsig.tools.dynform/org.gvsig.tools.dynform.api/src/main/java/org/gvsig/tools/dynform/JDynFormSetAdapter.java
1
package org.gvsig.tools.dynform;
2

  
3
import org.gvsig.tools.dynform.JDynFormSet.JDynFormSetListener;
4

  
5
/**
6
 *
7
 * @author gvSIG Team
8
 */
9
public abstract class JDynFormSetAdapter implements JDynFormSetListener {
10

  
11
    @Override
12
    public void formMessage(String message) {
13
    }
14

  
15
    @Override
16
    public void formClose() {
17
    }
18

  
19
    @Override
20
    public void formMovedTo(int currentPosition) throws AbortActionException {
21
    }
22

  
23
    @Override
24
    public void formBeforeSave(JDynFormSet dynformSet) throws AbortActionException {
25
    }
26

  
27
    @Override
28
    public void formBeforeNew(JDynFormSet dynformSet) throws AbortActionException {
29
    }
30

  
31
    @Override
32
    public void formBeforeCancelNew(JDynFormSet dynformSet) throws AbortActionException {
33
    }
34

  
35
    @Override
36
    public void formBeforeDelete(JDynFormSet dynformSet) throws AbortActionException {
37
    }
38

  
39
    @Override
40
    public void formBeforeSearch(JDynFormSet dynformSet) throws AbortActionException {
41
    }
42

  
43
    @Override
44
    public void formAfterSave(JDynFormSet dynformSet) throws AbortActionException {
45
    }
46

  
47
    @Override
48
    public void formAfterNew(JDynFormSet dynformSet) throws AbortActionException {
49
    }
50

  
51
    @Override
52
    public void formAfterCancelNew(JDynFormSet dynformSet) throws AbortActionException {
53
    }
54

  
55
    @Override
56
    public void formAfterDelete(JDynFormSet dynformSet) throws AbortActionException {
57
    }
58

  
59
    @Override
60
    public void formAfterSearch(JDynFormSet dynformSet) throws AbortActionException {
61
    }
62
    
63
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.295/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
public interface DynFormDefinition extends Iterable<DynFormFieldDefinition> {
34

  
35
	public String getName();
36
	
37
        public String getLabel();
38
        
39
        public void setLabel(String label);
40
        /**
41
         * Return the list of groups names ordered,
42
         * 
43
         * @return list of groups names
44
         */
45
	public List<String> getGroups();
46
	
47
	public List<String> getSubgroups(String group);
48
	
49
	public List<DynFormFieldDefinition> getDefinitions();
50

  
51
	public List<DynFormFieldDefinition> getDefinitions(String group);
52
	
53
	public List<DynFormFieldDefinition> getDefinitions(String group, String subgroup);
54
	
55
	public int getGroupOrder(String group);
56
	
57
	public void setGroupOrder(String group, int order);
58
	
59
	public void add(DynStruct definition);
60
	
61
	public DynFormFieldDefinition add(DynField definition);
62
	
63
	public DynFormFieldDefinition get(String name);
64
	
65
	public DynFormFieldDefinition get(int index);
66
	
67
	public void remove(String name);
68
	
69
	public int size();
70
	
71
	public Tags getTags();
72

  
73
	public DynObject createElement();
74
	
75
	public void setElementsType(DynStruct struct);
76

  
77
	public DynStruct getElementsType();
78

  
79
}
0 80

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.295/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.List;
27

  
28
import javax.swing.Action;
29
import javax.swing.JComponent;
30

  
31
import org.gvsig.tools.dataTypes.DataType;
32
import org.gvsig.tools.dynobject.DynObject;
33
import org.gvsig.tools.swing.api.Component;
34
import org.gvsig.tools.util.PropertiesSupport;
35
import org.gvsig.tools.resourcesstorage.ResourcesStorage;
36
import org.gvsig.tools.script.Script;
37
import org.gvsig.tools.script.ScriptManager;
38

  
39
public interface JDynForm extends Component, PropertiesSupport {
40

  
41
	public interface JDynFormListener {
42
		public void message(String message);
43
                /**
44
                 * This event is fired when a field of the form is changed by the user.
45
                 * 
46
                 * Now this is not yet implemented.
47
                 * 
48
                 * @param field 
49
                 */
50
		public void fieldChanged(JDynFormField field);
51
	}
52
        
53
        public interface DynFormContext {
54
            public ResourcesStorage getResourcesStorage();
55
            
56
            public ScriptManager getScriptManager();
57
        }
58
        
59
	public static final int USE_PLAIN = 0;
60
	public static final int USE_TABS = 1;
61
	public static final int USE_SEPARATORS = 2;
62
	public static final int USE_TREE = 3;
63
	
64
	public void setLayoutMode(int layoutMode);
65
	public int getLayoutMode();
66
	
67
	public int getFormWidth();
68
	public int getFormHeight();
69
	public void setFormSize(int width, int height);
70
	
71
	public JDynFormField getField(String fieldName);
72
        
73
//        public Collection<JDynFormField> getShowFields();
74
	
75
	public DynFormDefinition getDefinition();
76
	
77
	public void setValues(DynObject values);
78
	public void getValues(DynObject values);
79
	
80
        public Object getValue(String fieldName);
81
	public void setValue(String fieldName, Object value);
82
	
83
	public boolean hasValidValues();
84
	public boolean hasValidValues(List<String> fieldsName);
85
	
86
	public void message();
87
	
88
	public void message(String msg);
89

  
90
	public void setReadOnly(boolean readOnly);
91
	public boolean isReadOnly();
92
	
93
	public void setShowMessageStatus(boolean showMessageStatus);
94
	
95
	public boolean isShowMessageStatus();
96
	
97
	public void setUseScrollBars(boolean usesScrolls);
98
	public boolean getUseScrollBars();
99
	
100
	public boolean isModified();
101
	
102
	public void addListener(JDynFormListener listener);
103
	public void removeListener(JDynFormListener listener);
104
	
105
	public void addActionToPopupMenu(DataType tipo, String name, Action action);
106
	public void addSeparatorToPopupMenu(DataType tipo);
107
        
108
        public JComponent getFieldsContainer();
109
        
110
        public void clear();
111
        
112
        public DynFormContext getContext();
113
        
114
        public void setContext(DynFormContext context);
115

  
116
        public Script getScript();
117
        
118
        public Object callUserFunction(String function, Object...args) throws Exception;
119
        
120
}
0 121

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

  
27
import org.gvsig.tools.dynobject.DynObject;
28
import org.gvsig.tools.dynobject.DynStruct;
29
import org.gvsig.tools.dynform.JDynForm.DynFormContext;
30
import org.gvsig.tools.dynobject.DynObjectSet;
31
import org.gvsig.tools.dynobject.Tags;
32

  
33
public interface DynFormManager { //extends Manager {
34

  
35
        public DynFormDefinition createDefinition(DynStruct definition);
36
	public DynFormDefinition getDefinition(String name);
37
	public DynFormDefinition getDefinition(DynStruct definition);
38
	public DynFormDefinition getDefinition(DynObject obj);
39
        public void removeDefinition(String name);
40
	
41
	public JDynForm createJDynForm(DynFormDefinition definition) ;
42
	public JDynForm createJDynForm(DynStruct struct) ;
43
	public JDynForm createJDynForm(DynObject obj) ;
44
	
45
	public JDynForm createJDynForm(DynFormContext context, DynFormDefinition definition) ;
46
	public JDynForm createJDynForm(DynFormContext context, DynStruct struct) ;
47
	public JDynForm createJDynForm(DynFormContext context, DynObject obj) ;
48
	
49
	public JDynFormSet createJDynFormSet(DynFormContext context, DynFormDefinition definition);
50
	public JDynFormSet createJDynFormSet(DynFormContext context, DynFormDefinition definition, Tags contextTags);
51
	public JDynFormSet createJDynFormSet(DynFormContext context, DynObjectSet data);
52
        
53
}
0 54

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.295/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
//        public boolean hasLabel();
37
	
38
	public DynField setLabel(String label);
39
	public void setGroups(String groups);
40
	
41
}
0 42

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.295/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
import org.gvsig.tools.dynobject.DynObject;
29

  
30
import org.gvsig.tools.swing.api.Component;
31

  
32
public interface JDynFormField extends Component {
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 useEmptyLabel();
50
        
51
        public String getSeparatorTitleToUseBefore();
52
        
53
	public boolean hasValidValue();
54
	
55
	public void setValue(Object value);
56
	
57
	public boolean isModified();
58
	
59
	/**
60
	 * Get the value of field from the form.
61
	 * 
62
	 * Throw an exception if the value of form is not valid
63
	 * for this field.
64
	 * 
65
	 * @return value of field 
66
	 */
67
	public Object getValue();
68
        
69
        /**
70
         * Get the value from field and put it in the container.
71
         * 
72
         * @param container 
73
         */
74
        public void fetch(DynObject container);
75
	
76
	public void addListener(JDynFormFieldListener listener);
77
	
78
	public void removeListener(JDynFormFieldListener listener);
79
	
80
	public void setReadOnly(boolean readonly);
81
	
82
	public boolean isReadOnly();
83
	
84
	public void addActionToPopupMenu(String name, Action action);
85

  
86
	public void addSeparatorToPopupMenu();
87

  
88
	public void fireMessageEvent(String message);
89
        
90
        public void clear();
91
        
92
        public JDynForm getForm();
93
        
94
        public double getResizeWeight();
95
}
0 96

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.295/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.295/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.295</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.295/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.295</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.295/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.295/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformset/JDynFormSetFactory.java
1
package org.gvsig.tools.dynform.spi.dynformset;
2

  
3
import org.gvsig.tools.dynform.DynFormDefinition;
4
import org.gvsig.tools.dynform.JDynForm.DynFormContext;
5
import org.gvsig.tools.dynform.JDynFormSet;
6
import org.gvsig.tools.dynform.spi.DynFormSPIManager;
7
import org.gvsig.tools.dynobject.Tags;
8

  
9
public interface JDynFormSetFactory {
10

  
11
    public String getName();
12
    
13
    public boolean isApplicableTo(DynFormContext context, DynFormDefinition definition, Tags contextTags);
14

  
15
    public JDynFormSet create(DynFormSPIManager manager,  DynFormContext context, DynFormDefinition definition, Tags contextTags);
16

  
17
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.295/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformset/AbstractJDynFormSetFactory.java
1
package org.gvsig.tools.dynform.spi.dynformset;
2

  
3
import org.gvsig.tools.dynobject.Tags;
4

  
5
/**
6
 *
7
 * @author jjdelcerro
8
 */
9
public abstract class AbstractJDynFormSetFactory implements JDynFormSetFactory {
10

  
11
    private final String name;
12

  
13
    protected AbstractJDynFormSetFactory(String name) {
14
        this.name = name;
15
    }
16
    
17
    @Override
18
    public String getName() {
19
        return this.name;
20
    }
21

  
22
    @Override
23
    public String toString() {
24
        return this.name;
25
    }
26

  
27
    protected Object getTagValue(String name, Tags tag1, Tags tag2) {
28
        Object value = null;
29
        if( tag1!=null ) {
30
            value = tag1.get(name);
31
        }
32
        if( value == null && tag2 != null) {
33
            value = tag2.get(name);
34
        }
35
        return value;
36
    } 
37
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.295/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformset/DefaultVisitableSet.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.dynformset;
25

  
26
import java.util.HashSet;
27
import java.util.Iterator;
28

  
29
import org.gvsig.tools.dynform.AbortActionException;
30
import org.gvsig.tools.dynform.spi.dynformfield.VisitableSet;
31
import org.gvsig.tools.exception.BaseException;
32
import org.gvsig.tools.visitor.Visitor;
33
import org.slf4j.Logger;
34
import org.slf4j.LoggerFactory;
35

  
36
public class DefaultVisitableSet extends HashSet implements VisitableSet {
37

  
38
	public static final Logger logger = LoggerFactory.getLogger(DefaultVisitableSet.class);
39
	/**
40
	 * 
41
	 */
42
	private static final long serialVersionUID = -5771630108958038764L;
43

  
44
	public void accept(Visitor visitor) throws BaseException {
45
		Iterator it = this.iterator();
46
		while (it.hasNext()) {
47
			Object value = it.next();
48
			try {
49
				visitor.visit(value);
50
			} catch (AbortActionException ex) {
51
				throw ex;
52
			} catch (Exception ex) {
53
				logger.info("Error visiting " + value.toString()
54
						+ "(" + value.getClass().getName() + ") with "
55
						+ visitor.toString() + "(" + visitor.getClass().getName()
56
						+ ").", ex);
57
			}
58
		}
59
	}
60

  
61
}
0 62

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.295/org.gvsig.tools.dynform/org.gvsig.tools.dynform.spi/src/main/java/org/gvsig/tools/dynform/spi/dynformset/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.dynformset;
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.JDynForm;
18
import org.gvsig.tools.dynform.JDynForm.DynFormContext;
19
import static org.gvsig.tools.dynform.JDynForm.USE_PLAIN;
20
import static org.gvsig.tools.dynform.JDynForm.USE_SEPARATORS;
21
import org.gvsig.tools.dynform.JDynFormSet;
22
import org.gvsig.tools.dynform.spi.DynFormSPIManager;
23
import static org.gvsig.tools.dynform.spi.dynform.AbstractJDynForm.getLayoutFromTags;
24
import org.gvsig.tools.dynform.spi.dynformfield.VisitableSet;
25
import org.gvsig.tools.dynobject.DynObject;
26
import org.gvsig.tools.dynobject.DynObjectSet;
27
import org.gvsig.tools.dynobject.Tags;
28
import org.gvsig.tools.exception.BaseException;
29
import org.gvsig.tools.service.ServiceException;
30
import org.gvsig.tools.visitor.VisitCanceledException;
31
import org.gvsig.tools.visitor.Visitor;
32
import org.slf4j.Logger;
33
import org.slf4j.LoggerFactory;
34

  
35
public abstract class AbstractJDynFormSet implements JDynFormSet {
36

  
37
    protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractJDynFormSet.class);
38

  
39
    private final DynFormSPIManager manager;
40
    private final JDynFormSetFactory factory;
41
    private final DynFormDefinition definition;
42

  
43
    protected JComponent contents = null;
44

  
45
    protected List<DynObject> values = null;
46
    protected VisitableSet listeners = null;
47
    protected boolean readOnly = false;
48

  
49
    protected boolean autosave = true;
50

  
51
    protected int layoutMode = USE_PLAIN;
52

  
53
    protected int formWidth = -1;
54
    protected int formHeight = -1;
55

  
56
    protected List<ActionStore> actionsBuffer = new ArrayList<>();
57

  
58
    private boolean useScrollBars = true;
59
    private boolean _allowUpdate;
60
    private boolean _allowDelete;
61
    private boolean _allowNew;
62
    private boolean _allowSearch;
63
    private boolean _allowClose;
64
    
65
    private boolean _isInNewState = false;
66
    private final JDynForm.DynFormContext context;
67
    private final Tags contextTags;
68

  
69
    public AbstractJDynFormSet(
70
            DynFormSPIManager manager, 
71
            JDynFormSetFactory factory,
72
            JDynForm.DynFormContext context,
73
            DynFormDefinition definition,
74
            Tags contextTags
75
        ) {
76
        this.manager = manager;
77
        this.factory = factory;
78
        this.context = context;
79
        this.definition = definition;
80
        this.contextTags = contextTags;
81
        this.listeners = new DefaultVisitableSet();
82
    }
83
    
84
    @Override
85
    public JDynForm getForm() {
86
        return null;
87
    }
88

  
89
    @Override
90
    public void fireEvent(String action, Object value) {
91
    }
92
     
93
    protected JDynFormSetFactory getFactory() {
94
        return this.factory;
95
    }
96
    
97
    protected DynFormDefinition getDefinition() {
98
        return this.definition;
99
    }
100

  
101
    protected DynFormContext getContext() {
102
        return this.context;
103
    }
104

  
105
    public DynFormSPIManager getManager() {
106
        return this.manager;
107
    }
108
    
109
    public void loadDefaultValueFromTags(Tags tags) {
110
        this.setLayoutMode(getLayoutFromTags(tags));
111
        
112
        this.formWidth = tags.getInt(DynFormSPIManager.TAG_DYNFORM_WIDTH, this.formWidth);
113
        this.formHeight = tags.getInt(DynFormSPIManager.TAG_DYNFORM_HEIGHT, this.formHeight);
114
        this.readOnly = tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_READONLY, this.readOnly);
115
        this.autosave = tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_AUTOSAVE, this.autosave);
116
        this.useScrollBars = tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_USESCROLLBARS, this.useScrollBars);
117
        this.setAllowNew( tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_ACTION_NEW, this._allowNew));
118
        this.setAllowUpdate(tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_ACTION_UPDATE, this._allowNew));
119
        this.setAllowDelete(tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_ACTION_DELETE, this._allowNew));
120
        this.setAllowSearch(tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_ACTION_SEARCH, this._allowNew));
121
        this.setAllowClose(tags.getBoolean(DynFormSPIManager.TAG_DYNFORM_ACTION_CLOSE, this._allowNew));
122
    }
123

  
124
    public boolean isInNewState() {
125
        return this._isInNewState;
126
    }
127
    
128
    protected void enterStateNew() {
129
        this._isInNewState = true;
130
    }
131
    
132
    protected void leaveTheNewState() {
133
        this._isInNewState = false;
134
    }
135
    
136
    public void addListener(JDynFormSetListener listener) {
137
        this.listeners.add(listener);
138
    }
139

  
140
    public void removeListener(JDynFormSetListener listener) {
141
        this.listeners.remove(listener);
142
    }
143

  
144
    protected void fireMessageEvent(final String message) {
145
        try {
146
            this.listeners.accept(new Visitor() {
147
                public void visit(Object listener) throws VisitCanceledException, BaseException {
148
                    ((JDynFormSetListener) listener).formMessage(message);
149
                }
150
            });
151

  
152
        } catch (Exception e) {
153
            LOGGER.info("Error calling to the form message event.", e);
154
        }
155
    }
156

  
157
    protected void fireCloseEvent() {
158
        try {
159
            this.listeners.accept(new Visitor() {
160
                public void visit(Object listener) throws VisitCanceledException, BaseException {
161
                    ((JDynFormSetListener) listener).formClose();
162
                }
163
            });
164
        } catch (Exception e) {
165
            LOGGER.info("Error calling to the form close event.", e);
166
        }
167
    }
168

  
169
    protected void fireFormMovedToEvent(final int position) {
170
        try {
171
            this.listeners.accept(new Visitor() {
172
                public void visit(Object listener) throws VisitCanceledException, BaseException {
173
                    ((JDynFormSetListener) listener).formMovedTo(position);
174
                }
175
            });
176
        } catch (Exception e) {
177
            LOGGER.info("Error calling to the form moved to event.", e);
178
        }
179
    }
180

  
181
    public int getLayoutMode() {
182
        return this.layoutMode;
183
    }
184

  
185
    public void setLayoutMode(int layoutMode) {
186
        if ( layoutMode < 0 || layoutMode > USE_SEPARATORS ) {
187
            throw new IllegalArgumentException("layoutMode (" + layoutMode + ") out of range. Valid values are 0 .. " + USE_SEPARATORS + ".");
188
        }
189
        this.layoutMode = layoutMode;
190
    }
191

  
192
    public boolean isReadOnly() {
193
        return readOnly;
194
    }
195

  
196
    public void setReadOnly(boolean readOnly) {
197
        this.readOnly = readOnly;
198
    }
199

  
200
    public boolean isAutosave() {
201
        return this.autosave;
202
    }
203

  
204
    public void setAutosave(boolean autosave) {
205
        this.autosave = autosave;
206
    }
207

  
208
    protected int confirmDialog(final String message, final String title, final int optionType,
209
            final int messageType) {
210
        return JOptionPane.showConfirmDialog(
211
                this.contents, message, title, optionType, messageType);
212
    }
213

  
214
    public void setFormSize(int width, int height) {
215
        this.formHeight = height;
216
        this.formWidth = width;
217
    }
218

  
219
    public int countValues() {
220
        return this.values.size();
221
    }
222

  
223
    public void setValues(DynObjectSet values) {
224
        List x = new ArrayList();
225
        DisposableIterator it;
226
        try {
227
            it = values.iterator();
228
        } catch (BaseException e) {
229
            LOGGER.info("Uf! o se que hacer con este error, lo relanzo sin mas.", e);
230
            throw new RuntimeException(e);
231
        }
232
        while ( it.hasNext() ) {
233
            DynObject obj = (DynObject) it.next();
234
            if ( obj instanceof org.gvsig.tools.lang.Cloneable ) {
235
                try {
236
                    obj = (DynObject) ((org.gvsig.tools.lang.Cloneable) obj).clone();
237
                } catch (CloneNotSupportedException e) {
238
                    // Do nothing
239
                }
240
            }
241
            x.add(obj);
242
        }
243
        this.values = x;
244
    }
245

  
246
    public void setValues(List values) {
247
//        this.values = new ArrayList<DynObject>();
248
//        this.values.addAll(values);
249
        this.values = values;
250
    }
251

  
252
    public DynObject get(int position) {
253
        return (DynObject) this.values.get(position);
254
    }
255

  
256
    public void addActionToPopupMenu(DataType tipo, String name, Action action) {
257
        try {
258
            this.actionsBuffer.add(new ActionStore(tipo, name, action));
259
        } catch (Exception ex) {
260
            String s = (tipo == null) ? "(null)" : tipo.getName();
261
            LOGGER.warn("Can't add popup menu '" + name + "' to the fields of type '" + s + "' of the form.", ex);
262
        }
263
    }
264

  
265
    public void addSeparatorToPopupMenu(DataType tipo) {
266
        try {
267
            this.actionsBuffer.add(new ActionStore(tipo));
268
        } catch (Exception ex) {
269
            String s = (tipo == null) ? "(null)" : tipo.getName();
270
            LOGGER.warn("Can't add separator to the popup menu to the fields of type '" + s + "' of the form.", ex);
271
        }
272

  
273
    }
274

  
275
    public void setUseScrollBars(boolean usesScrolls) {
276
        this.useScrollBars = usesScrolls;
277
    }
278

  
279
    public boolean getUseScrollBars() {
280
        return useScrollBars;
281
    }
282

  
283
    public DynFormSPIManager getServiceManager() {
284
        return this.manager;
285
    }
286

  
287
    public void message() {
288
        // Do nothing, ignore message handling
289
    }
290

  
291
    public void message(String msg) {
292
        // Do nothing, ignore message handling
293
    }
294

  
295
    public boolean allowUpdate() {
296
        return this._allowUpdate;
297
    }
298

  
299
    public boolean allowClose() {
300
        return this._allowClose;
301
    }
302

  
303
    public boolean allowDelete() {
304
        return this._allowDelete;
305
    }
306

  
307
    public boolean allowNew() {
308
        return this._allowNew ;
309
    }
310

  
311
    public boolean allowSearch() {
312
        return this._allowSearch;
313
    }
314

  
315
    public void setAllowUpdate(boolean allowUpdate) {
316
        this._allowUpdate = allowUpdate;
317
    }
318

  
319
    public void setAllowDelete(boolean allowDelete) {
320
        this._allowDelete = allowDelete;
321
    }
322

  
323
    public void setAllowNew(boolean allowNew) {
324
        this._allowNew = allowNew;
325
    }
326

  
327
    public void setAllowSearch(boolean allowSearch) {
328
        this._allowSearch = allowSearch;
329
    }
330

  
331
    public void setAllowClose(boolean allowClose) {
332
        this._allowClose = allowClose;
333
    }
334

  
335
    public void getFormValues(DynObject values) {
336
        throw new UnsupportedOperationException();
337
    }
338

  
339
    protected int getTagValueAsInt(String tagname, int defaultVaue) {
340
        if( definition.getTags().has(tagname) ) {
341
            try {
342
                int value = definition.getTags().getInt(tagname);
343
                return value;
344
            } catch (CoercionException ex) {
345
                LOGGER.warn("Can't parse tag '"+tagname+"' as int for text field '"+definition.getName()+"'.",ex);
346
            }
347
        }
348
        return defaultVaue;
349
    }
350

  
351
    protected boolean getTagValueAsBoolean(String tagname, boolean defaultVaue) {
352
        if( definition.getTags().has(tagname) ) {
353
            try {
354
                boolean value = definition.getTags().getBoolean(tagname);
355
                return value;
356
            } catch (CoercionException ex) {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff