1 package net.suberic.util.gui.propedit; 2 import net.suberic.util.VariableBundle; 3 4 import java.util.List ; 5 6 11 public class UniqueFilter extends PropertyEditorAdapter implements ConfigurablePropertyEditorListener { 12 String parentProperty; 13 PropertyEditorManager manager; 14 15 18 public void configureListener(String key, String property, String propertyBase, String editorTemplate, PropertyEditorManager pManager) { 19 20 String parentProp = pManager.getProperty(key + ".listProperty", ""); 21 if (parentProp.length() > 0) { 22 if (parentProp.startsWith(".")) { 23 parentProperty=propertyBase + parentProp; 24 } else { 25 parentProperty=parentProp; 26 } 27 } 28 29 manager = pManager; 30 31 } 32 33 40 public void propertyChanging(PropertyEditorUI source, String property, String newValue) throws PropertyValueVetoException { 41 String parentValue = manager.getCurrentProperty(parentProperty, ""); 42 List <String > parentValueList = VariableBundle.convertToList(parentValue); 43 if (parentValueList.contains(newValue)) { 44 throw new PropertyValueVetoException(property, newValue, manager.formatMessage("Message.uniquFilter.notUnique", newValue, parentProperty), this); 45 } 46 } 47 48 } 49 | Popular Tags |