void updateState() { if (env != null) { if ("".equals(acceleratorText.getText()) // NOI18N && (altCheckbox.isSelected() || controlCheckbox.isSelected() || metaCheckbox.isSelected() || shiftCheckbox.isSelected())) { env.setState(PropertyEnv.STATE_INVALID); } else { env.setState(PropertyEnv.STATE_NEEDS_VALIDATION); } } }
@Override public void attachEnv(PropertyEnv propertyEnv) { //System.out.println(":::::::::::::::: attachEnv: propertyEnv = " + propertyEnv); propertyEnv.addVetoableChangeListener(this); propertyEnv.setState(PropertyEnv.STATE_NEEDS_VALIDATION); }
/** * This method is called by the property sheet to pass the environment to the property editor. * The typical use case is for the ExPropertyEditor to call env.getFeatureDescriptor().getValue * (String key) to retrieve any hints the Property object may supply regarding how * the property editor should behave(such as providing alternate text representations of * "true" and "false" for a Boolean property editor). * @param allows an object (suchDef as a Node.Property instance) to communicate hints to * property editor instances */ public void attachEnv(PropertyEnv env) { env.setState(PropertyEnv.STATE_NEEDS_VALIDATION); env.addVetoableChangeListener(new VetoableChangeListener() { public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { customEditorOKButtonPressed(); } }); }
/** Creates new form DirectoryChooserPanel */ public DirectoryChooserPanel(String seed, PropertyEditorSupport editor, PropertyEnv propenv, FileSystem fileSystem) { initComponents(); this.seed = seed; this.editor = editor; this.fileSystem = fileSystem; directoryTextField.setText(seed); propenv.setState(PropertyEnv.STATE_NEEDS_VALIDATION); propenv.addPropertyChangeListener(this); }
@Override public void attachEnv(PropertyEnv env) { this.env = env; env.removeVetoableChangeListener(this); env.setState(PropertyEnv.STATE_NEEDS_VALIDATION); env.addVetoableChangeListener(this); }
public final void vetoableChange(PropertyChangeEvent event) throws PropertyVetoException { if (PropertyEnv.PROP_STATE.equals(event.getPropertyName())) { propertyEditor.setValue(getPropertyValue()); propertyEditor.getEnv().setState(PropertyEnv.STATE_VALID); } } }
private DirectoriesChooser(PropertyEditorSupport editor, PropertyEnv env, String baseDir, String path, FileSystem fileSystem){ super(getPathsFromString(path)); getDefaultButton().setVisible(false); this.editor = editor; this.baseDir = baseDir; this.path = path; this.fileSystem = fileSystem; env.setState(PropertyEnv.STATE_NEEDS_VALIDATION); env.addPropertyChangeListener(this); }
/** Create a StringCustomEditor. * @param value the initial value for the string * @param editable whether to show the editor in read only or read-write mode * @param oneline whether the text component should be a single-line or multi-line component * @param instructions any instructions that should be displayed */ StringCustomEditor (String value, boolean editable, boolean oneline, String instructions, PropertyEditor editor, PropertyEnv env) { this.oneline = oneline; this.instructions = instructions; this.env = env; this.editor = editor; this.env.setState(PropertyEnv.STATE_NEEDS_VALIDATION); this.env.addPropertyChangeListener(this); init (value, editable); }
public final void vetoableChange(PropertyChangeEvent event) throws PropertyVetoException { if (PropertyEnv.PROP_STATE.equals(event.getPropertyName())) { propertyEditor.setValue(getPropertyValue()); // In theory, it should not be necessary to fire a property change event // at this point, but NetBeans will not otherwise pick up the new value propertyEditor.firePropertyChange(); propertyEditor.getEnv().setState(PropertyEnv.STATE_VALID); } } }
/** * Reverts to old values. */ private void cancelValue() { if ( (!changed) || (component instanceof EnhancedCustomPropertyEditor) || ((env!=null)&&(!env.isChangeImmediate())) ) { if ((env != null) && (envStateBeforeDisplay != null)) { env.setState(envStateBeforeDisplay); } return; } try { model.setValue(oldValue); } catch (Exception e) { // Ignored, there can be number of exceptions // when asking for old values... } }
/** Creates new form NewJPanel */ public StringPanel(StringEditor stringEditor, PropertyEnv env) { this.stringEditor = stringEditor; initComponents(); textPane.setText(stringEditor.getAsText()); setPreferredSize(new Dimension(400, 300)); env.setState(PropertyEnv.STATE_NEEDS_VALIDATION); env.addPropertyChangeListener(this); }
@Override public Component getCustomEditor() { env.setState(PropertyEnv.STATE_NEEDS_VALIDATION); env.addVetoableChangeListener(this); toolsManagerPanel = ToolsCustomizerPanelFactory.getCustomizerByName(getAsText()); return toolsManagerPanel; }
public ChooseOneReferenceDataPanel(ChooseOneReferenceDataPropertyEditor propertyEditor, DesignProperty liveProperty) { super(propertyEditor, liveProperty); PropertyEnv propertyEnv = propertyEditor.getEnv(); if (propertyEnv != null) { propertyEnv.setState(PropertyEnv.STATE_NEEDS_VALIDATION); panelSubmissionListener = new PanelSubmissionListener(propertyEditor); propertyEnv.addVetoableChangeListener(panelSubmissionListener); this.propertyEditor = propertyEditor; } }
/** If the editor is <link>ExPropertyEditor</link> it tries to change the * <code>getState</code> property to <code>PropertyEnv.STATE_VALID</code> * state. This may be vetoed, in such case a warning is presented to the user * and the <code>getState</code> will still return the original value * (different from STATE_VALID). * <P> * Also updates the value if * <code>org.openide.explorer.propertysheet.editors.EnhancedCustomPropertyEditor</code> * is used. */ public void updateValue() { if ((displayer != null) && displayer instanceof PropertyDisplayer_Editable) { PropertyEnv env = ((PropertyDisplayer_Editable) displayer).getPropertyEnv(); if (PropertyEnv.STATE_NEEDS_VALIDATION.equals(env.getState())) { env.setState(PropertyEnv.STATE_VALID); } if (!changeImmediate) { commit(); } } }
/** * Create a new instance of PropertyPanelBase, for the property editor specified. * Property editors that extend {@link PropertyEditorBase} should pass themselves * as an argument to the constructor of their property panel when the panel is * created, in response to a call to {@link java.beans.PropertyEditor#getCustomEditor()}. */ public PropertyPanelBase(PropertyEditorBase propertyEditor) { PropertyEnv propertyEnv = propertyEditor.getEnv(); if (propertyEnv != null) { propertyEnv.setState(PropertyEnv.STATE_NEEDS_VALIDATION); panelSubmissionListener = new PanelSubmissionListener(propertyEditor); propertyEnv.addVetoableChangeListener(panelSubmissionListener); this.propertyEditor = propertyEditor; } }
/** Creates new form CustomizerCompile */ public ExceptionsPanel(PropertyEditorSupport propertyEditor, PropertyEnv env, Exceptions exceptions) { this.propertyEditor = propertyEditor; initComponents(); adjustButtons(); setPreferredSize(new java.awt.Dimension(500, 500)); // Arrange for propertyChange to get called when OK is pressed. env.setState(PropertyEnv.STATE_NEEDS_VALIDATION); env.addPropertyChangeListener(this); this.exceptions = exceptions; initValues(exceptions); }
private boolean checkValues() { Component[] components = myPanel.getComponents(); boolean valid=true; for (int i=0; i < components.length; i++) { if (components[i] instanceof JTextField) { valid &= validFor((JTextField) components[i]); } } if (getEnv() != null) { getEnv().setState(valid ? PropertyEnv.STATE_VALID : PropertyEnv.STATE_INVALID); } return valid; }
@Override public void attachEnv(PropertyEnv env) { this.env = env; env.setState(PropertyEnv.STATE_NEEDS_VALIDATION); env.addVetoableChangeListener(new VetoableChangeListener() { @Override public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { /* User has pushed OK */ for (Entry entry : editor.isoValNew.entrySet()){ isoVal.put((Double) entry.getKey(), (Boolean) entry.getValue()); } } }); }
/** Creates new form CustomizerCompile */ public PathmapPanel(PropertyEditorSupport propertyEditor, PropertyEnv env, Pathmap pathmap) { this.propertyEditor = propertyEditor; initComponents(); adjustButtons(); // Arrange for propertyChange to get called when OK is pressed. env.setState(PropertyEnv.STATE_NEEDS_VALIDATION); env.addPropertyChangeListener(this); this.pathmap = pathmap; initValues(pathmap); }
public CompilerSetEditorCustomizer(PropertyEnv propertyEnv) { this.setLayout(new BorderLayout()); this.setBorder(new EmptyBorder(6,6,0,6)); tpc = ToolsPanelSupport.getToolsPanelComponent(hostConfiguration.getExecutionEnvironment(), getValue()); delegate = (VetoableChangeListener) tpc.getClientProperty(ToolsPanelSupport.OK_LISTENER_KEY); add(tpc, BorderLayout.CENTER); this.putClientProperty("title", NbBundle.getMessage(CompilerSetNodeProp.class, "CompilerSetEditorCustomizerTitile", hostConfiguration.getExecutionEnvironment().getDisplayName())); propertyEnv.setState(PropertyEnv.STATE_NEEDS_VALIDATION); propertyEnv.addVetoableChangeListener(CompilerSetEditorCustomizer.this); }