Revision 8765 branches/v10/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/panels/JPanelFieldDefinition.java

View differences:

JPanelFieldDefinition.java
35 35
public class JPanelFieldDefinition extends JWizardPanel {
36 36

  
37 37

  
38
	private static final int MAX_FIELD_LENGTH = 254;
39 38
	private JLabel jLabel = null;
40 39
	private JScrollPane jScrollPane = null;
41 40
	private JTable jTable = null;
42 41
	private JPanel jPanelEast = null;
43 42
	private JButton jButtonAddField = null;
44 43
	private JButton jButtonDeleteField = null;
44
	private int MAX_FIELD_LENGTH = 254;
45 45

  
46 46

  
47 47
	public JPanelFieldDefinition(JWizardComponents wizardComponents) {
......
59 59
		boolean valid=true;
60 60
		for (int i = 0;i<tm.getRowCount();i++) {
61 61
				String s=(String)tm.getValueAt(i,0);
62
				valid=validateFieldName(s);
62
				valid=validate(s);
63 63
				String type = (String) tm.getValueAt(i,1);
64 64
				int length = Integer.parseInt((String) tm.getValueAt(i,2));
65 65
				if (type.equals("String") && length > MAX_FIELD_LENGTH) {
......
70 70

  
71 71
		}
72 72

  
73
		//ensure no field name is used more than once
73
		// ensure no field name is used more than once
74 74
		ArrayList fieldNames = new ArrayList();
75 75
		for (int i = 0; i < jTable.getRowCount(); i++) {
76 76
			if (fieldNames.contains(tm.getValueAt(i,0))) {
......
90 90
	}
91 91

  
92 92

  
93

  
94
	private boolean validateFieldName(String s) {
93
	private boolean validate(String s) {
95 94
		boolean valid=true;
96 95
		if (s.indexOf(" ")!=-1) {
97 96
			valid=false;
......
141 140
	private JTable getJTable() {
142 141
		if (jTable == null) {
143 142
			jTable = new JTable();
143

  
144 144
			DefaultTableModel tm = (DefaultTableModel) jTable.getModel();
145 145
			tm.addColumn(PluginServices.getText(this,"field"));
146 146

  
......
231 231
					}
232 232
					String newFieldName = newField+(++index);
233 233

  
234

  
234 235
					// Add a new row
235 236
					Object[] newRow = new Object[tm.getColumnCount()];
236 237
					newRow[0] = newFieldName;
......
310 311
			if (strType.equals("Date"))
311 312
				fieldsDesc[i].setFieldType(Types.DATE);
312 313
			int fieldLength = Integer.parseInt((String) tm.getValueAt(i,2));
313

  
314

  
315 314
			fieldsDesc[i].setFieldLength(fieldLength);
316 315

  
317 316
			// TODO: HACERLO BIEN

Also available in: Unified diff