1 package net.suberic.pooka.gui.filter; 2 import net.suberic.pooka.gui.propedit.FolderSelectorPane; 3 import net.suberic.util.gui.propedit.PropertyValueVetoException; 4 import java.util.Properties ; 5 import javax.swing.SpringLayout ; 6 7 8 11 public class MoveFilterEditor extends FilterEditor { 12 String originalFolderName; 13 14 FolderSelectorPane fsp; 15 16 public static String FILTER_CLASS = "net.suberic.pooka.filter.MoveFilterAction"; 17 18 22 public void configureEditor(net.suberic.util.gui.propedit.PropertyEditorManager newManager, String propertyName) { 23 property = propertyName; 24 manager = newManager; 25 26 fsp = new FolderSelectorPane(); 27 fsp.configureEditor(propertyName + ".targetFolder", manager); 28 29 SpringLayout layout = new SpringLayout (); 30 this.setLayout(layout); 31 32 this.add(fsp.getLabelComponent()); 33 this.add(fsp.getValueComponent()); 34 35 layout.putConstraint(SpringLayout.NORTH, fsp.getLabelComponent(), 0, SpringLayout.NORTH, this); 36 layout.putConstraint(SpringLayout.WEST, fsp.getLabelComponent(), 0, SpringLayout.WEST, this); 37 layout.putConstraint(SpringLayout.SOUTH, this, 0, SpringLayout.SOUTH, fsp.getLabelComponent()); 38 layout.putConstraint(SpringLayout.WEST, fsp.getValueComponent(), 5, SpringLayout.EAST, fsp.getLabelComponent()); 39 layout.putConstraint(SpringLayout.EAST, this, 5, SpringLayout.EAST, fsp.getValueComponent()); 40 41 this.setPreferredSize(new java.awt.Dimension (150, fsp.getLabelComponent().getMinimumSize().height)); 42 this.setMaximumSize(new java.awt.Dimension (Integer.MAX_VALUE, fsp.getLabelComponent().getMinimumSize().height)); 43 44 } 45 46 49 public java.util.Properties getValue() { 50 Properties props = fsp.getValue(); 51 52 String oldClassName = manager.getProperty(property + ".class", ""); 53 if (!oldClassName.equals(FILTER_CLASS)) 54 props.setProperty(property + ".class", FILTER_CLASS); 55 56 return props; 57 } 58 59 62 public void setValue() throws PropertyValueVetoException { 63 64 fsp.setValue(); 65 66 String oldClassName = manager.getProperty(property + ".class", ""); 67 if (!oldClassName.equals(FILTER_CLASS)) 68 manager.setProperty(property + ".class", FILTER_CLASS); 69 } 70 71 74 public String getFilterClassValue() { 75 return FILTER_CLASS; 76 } 77 78 } 79 | Popular Tags |