Changeset 9943
- Timestamp:
- 2005-05-24T17:00:37+12:00 (19 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/gems
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gems/AttributeTableModel.java
r8270 r9943 97 97 } 98 98 99 /** 100 * Checks to see if the table contains a given value in a given column 101 * 102 * @param value the <strong>String</strong> to check for 103 * @param column the column number to check in, as an <strong>int</strong> 104 * @return boolean - true if the table contains the value. 105 */ 99 106 public boolean contains(String value, int column) { 100 107 boolean result = false; … … 107 114 } 108 115 return result; 116 } 117 118 /** 119 * Checks to see if the table contains a given value in a given language 120 * 121 * @param value the <strong>String</strong> to check for 122 * @param language_code the language code to check for, as a <strong>String</strong> 123 * @return boolean - true if the table contains the value. 124 */ 125 public boolean contains(String value, String language_code) { 126 Iterator iterator = attributes.iterator(); 127 while(iterator.hasNext()) { 128 Attribute attribute = (Attribute) iterator.next(); 129 String attributeLanguage = attribute.language; 130 if(attributeLanguage == null) { 131 attributeLanguage = ""; 132 } 133 if(language_code == null) { 134 language_code = ""; 135 } 136 137 if(value.equals(attribute.name) && language_code.equalsIgnoreCase(attribute.language)) { 138 return true; 139 } 140 } 141 return false; 109 142 } 110 143 -
trunk/gli/src/org/greenstone/gatherer/gems/GEMS.java
r9855 r9943 1056 1056 String new_name_str = name.getSelectedItem().toString(); 1057 1057 String value_str = Codec.transform(Codec.transformUnicode(value.getText()), Codec.TEXT_TO_DOM); 1058 String language_code = (String) language_box.getSelectedItem(); 1058 1059 String old_name_str = null; 1059 1060 boolean cont = false; … … 1067 1068 1068 1069 // Check that there isn't already an entry for this attribute 1069 if (!model.contains(new_name_str, 0) || (edit && new_name_str.equals(old_name_str)))1070 if (!model.contains(new_name_str, language_code) || (edit && new_name_str.equals(old_name_str))) 1070 1071 { 1071 1072 if(edit) //If edit, remove old attribute … … 1085 1086 { 1086 1087 cont = false; 1087 JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Attribute_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 1088 JOptionPane.showMessageDialog(self, 1089 Dictionary.get("GEMS.Attribute_Already_Exists"), 1090 Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 1088 1091 } 1089 1092 … … 1115 1118 1116 1119 //Check that there isn't already an entry for this attribute 1117 if (!model.contains(new_name_str, 0) || (edit && new_name_str.equals(old_name_str)))1120 if (!model.contains(new_name_str, language_code) || (edit && new_name_str.equals(old_name_str))) 1118 1121 { 1119 1122 if(edit) //If this is an edit, remove the old attribute … … 1135 1138 { 1136 1139 cont = false; 1137 JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Attribute_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 1140 JOptionPane.showMessageDialog(self, 1141 Dictionary.get("GEMS.Attribute_Already_Exists"), 1142 Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 1138 1143 } 1139 1144
Note:
See TracChangeset
for help on using the changeset viewer.