⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uniquefilter.java

📁 本系统是用 java 语言实现的一个 Email客户端
💻 JAVA
字号:
package net.suberic.util.gui.propedit;import net.suberic.util.VariableBundle;import java.util.List;/** * A PropertyEditorListener which disallows entries which already exist * for a particular property. * */public class UniqueFilter extends PropertyEditorAdapter implements ConfigurablePropertyEditorListener {  String parentProperty;  PropertyEditorManager manager;  /**   * Configures this filter from the given key.   */  public void configureListener(String key, String property, String propertyBase, String editorTemplate, PropertyEditorManager pManager) {    String parentProp = pManager.getProperty(key + ".listProperty", "");    if (parentProp.length() > 0) {      if (parentProp.startsWith(".")) {        parentProperty=propertyBase + parentProp;      } else {        parentProperty=parentProp;      }    }    manager = pManager;  }  /**   * Called when a property is about to change.  If the value is not ok   * with the listener, a PropertyValueVetoException should be thrown.   *   * In this case, if the entry already exists in the parentProperty we   * throw an Exception.   */  public void propertyChanging(PropertyEditorUI source, String property, String newValue) throws PropertyValueVetoException {    String parentValue = manager.getCurrentProperty(parentProperty, "");    List<String> parentValueList = VariableBundle.convertToList(parentValue);    if (parentValueList.contains(newValue)) {      throw new PropertyValueVetoException(property, newValue, manager.formatMessage("Message.uniquFilter.notUnique", newValue, parentProperty), this);    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -