public void propertyChange(PropertyChangeEvent evt) { if (inReplaceInner) { // wantNextChange=false; return; } if (wantNextChange || (evt.getNewValue() == PropertyEnv.STATE_VALID && evt.getNewValue() != lastKnownState)) { wantNextChange = false; replaceInner(); lastKnownState = ((PropertyEnv) evt.getSource()).getState(); } if (remoteEnvListener != null) { remoteEnvListener.propertyChange(evt); } }
public void propertyChange(PropertyChangeEvent evt) { if (inReplaceInner) { // wantNextChange=false; return; } if (wantNextChange || (evt.getNewValue() == PropertyEnv.STATE_VALID && evt.getNewValue() != lastKnownState)) { wantNextChange = false; replaceInner(); lastKnownState = ((PropertyEnv) evt.getSource()).getState(); } if (remoteEnvListener != null) { remoteEnvListener.propertyChange(evt); } }
public void propertyChange(PropertyChangeEvent evt) { if (inReplaceInner) { // wantNextChange=false; return; } if ( wantNextChange || ((evt.getNewValue() == PropertyEnv.STATE_VALID) && (evt.getNewValue() != lastKnownState)) ) { wantNextChange = false; replaceInner(); lastKnownState = ((PropertyEnv) evt.getSource()).getState(); } if (remoteEnvListener != null) { remoteEnvListener.propertyChange(evt); } } }
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { // if (evt.getSource() != attachedEnv) { // return; // } // System.err.println("Got vetoable change: " + evt + " oldvalue=" + evt.getOldValue() + " newvalue=" + evt.getNewValue()); if (PropertyEnv.PROP_STATE.equals(evt.getPropertyName())) { wantNextChange = (evt.getNewValue() != getPropertyEnv().getState() && getPropertyEnv().getState() != null) && (evt.getNewValue() != PropertyEnv.STATE_NEEDS_VALIDATION || (evt.getNewValue() == PropertyEnv.STATE_NEEDS_VALIDATION && evt.getOldValue() == PropertyEnv.STATE_VALID)); } if (!inReplaceInner && remotevEnvListener != null) { remotevEnvListener.vetoableChange(evt); } }
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { // if (evt.getSource() != attachedEnv) { // return; // } // System.err.println("Got vetoable change: " + evt + " oldvalue=" + evt.getOldValue() + " newvalue=" + evt.getNewValue()); if (PropertyEnv.PROP_STATE.equals(evt.getPropertyName())) { wantNextChange = ((evt.getNewValue() != getPropertyEnv().getState()) && (getPropertyEnv().getState() != null)) && ((evt.getNewValue() != PropertyEnv.STATE_NEEDS_VALIDATION) || ((evt.getNewValue() == PropertyEnv.STATE_NEEDS_VALIDATION) && (evt.getOldValue() == PropertyEnv.STATE_VALID))); } if (!inReplaceInner && (remotevEnvListener != null)) { remotevEnvListener.vetoableChange(evt); } }
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { // if (evt.getSource() != attachedEnv) { // return; // } // System.err.println("Got vetoable change: " + evt + " oldvalue=" + evt.getOldValue() + " newvalue=" + evt.getNewValue()); if (PropertyEnv.PROP_STATE.equals(evt.getPropertyName())) { wantNextChange = (evt.getNewValue() != getPropertyEnv().getState() && getPropertyEnv().getState() != null) && (evt.getNewValue() != PropertyEnv.STATE_NEEDS_VALIDATION || (evt.getNewValue() == PropertyEnv.STATE_NEEDS_VALIDATION && evt.getOldValue() == PropertyEnv.STATE_VALID)); } if (!inReplaceInner && remotevEnvListener != null) { remotevEnvListener.vetoableChange(evt); } }
/** * A setter that should be used by the property editor * to change the state of the environment. * Even the state property is bound, changes made from the editor itself * are allowed without restrictions. */ public void setState (Object newState) { if (getState ().equals (newState)) // no change, no fire vetoable and property change return ; try { getSupport().fireVetoableChange(PROP_STATE, getState (), newState); state = newState; // always notify state change getChange ().firePropertyChange (PROP_STATE, null, newState); } catch (PropertyVetoException pve) { // and notify the user that the change cannot happen PropertyDialogManager.notify(pve); } }
/** * A setter that should be used by the property editor * to change the state of the environment. * Even the state property is bound, changes made from the editor itself * are allowed without restrictions. */ public void setState (Object newState) { if (getState ().equals (newState)) // no change, no fire vetoable and property change return ; try { getSupport().fireVetoableChange(PROP_STATE, getState (), newState); state = newState; // always notify state change getChange ().firePropertyChange (PROP_STATE, null, newState); } catch (PropertyVetoException pve) { // and notify the user that the change cannot happen PropertyDialogManager.notify(pve); } }
/** 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(); } } }
private void updateIcon() { if (env != null) { Icon ic=null; FeatureDescriptor fd = env.getFeatureDescriptor(); if (env.getState() == env.STATE_INVALID) { ic = new ImageIcon( Utilities.loadImage ( "org/openide/resources/propertysheet/invalid.gif")); //NOI18N } else if (fd != null) { ic = (Icon) fd.getValue("valueIcon"); //NOI18N } setIcon(ic); needLayout=true; } }
private void updateIcon() { if (env != null) { Icon ic=null; FeatureDescriptor fd = env.getFeatureDescriptor(); if (env.getState() == env.STATE_INVALID) { ic = new ImageIcon( Utilities.loadImage ( "org/openide/resources/propertysheet/invalid.gif")); //NOI18N } else if (fd != null) { ic = (Icon) fd.getValue("valueIcon"); //NOI18N } setIcon(ic); needLayout=true; } }
/** Allow setting of state without triggering a dialog. */ String silentlySetState(Object newState, Object newValue) { if (getState().equals(newState)) { // no change, no fire vetoable and property change return null; } try { getSupport().fireVetoableChange(PROP_STATE, getState(), newState); state = newState; // always notify state change getChange().firePropertyChange(PROP_STATE, null, newState); } catch (PropertyVetoException pve) { // and notify the user that the change cannot happen LOG.log(Level.INFO, "Cannot change property: " + pve.getPropertyChangeEvent().getPropertyName(), pve); String name = (getFeatureDescriptor() == null) ? null : getFeatureDescriptor().getDisplayName(); return PropUtils.findLocalizedMessage(pve, newValue, name); } return null; }
/** Allow setting of state without triggering a dialog. */ String silentlySetState (Object newState, Object newValue) { if (getState ().equals (newState)) // no change, no fire vetoable and property change return null; try { getSupport().fireVetoableChange(PROP_STATE, getState (), newState); state = newState; // always notify state change getChange ().firePropertyChange (PROP_STATE, null, newState); } catch (PropertyVetoException pve) { // and notify the user that the change cannot happen pve.printStackTrace(); String name = getFeatureDescriptor() == null ? null : getFeatureDescriptor().getDisplayName(); return PropUtils.findLocalizedMessage (pve, newValue, name); } return null; }
/** Allow setting of state without triggering a dialog. */ String silentlySetState (Object newState, Object newValue) { if (getState ().equals (newState)) // no change, no fire vetoable and property change return null; try { getSupport().fireVetoableChange(PROP_STATE, getState (), newState); state = newState; // always notify state change getChange ().firePropertyChange (PROP_STATE, null, newState); } catch (PropertyVetoException pve) { // and notify the user that the change cannot happen pve.printStackTrace(); String name = getFeatureDescriptor() == null ? null : getFeatureDescriptor().getDisplayName(); return PropUtils.findLocalizedMessage (pve, newValue, name); } return null; }
private void updateIcon() { if (env != null) { Icon ic = null; FeatureDescriptor fd = env.getFeatureDescriptor(); if (env.getState() == env.STATE_INVALID) { ic = ImageUtilities.loadImageIcon("org/openide/resources/propertysheet/invalid.gif", false); //NOI18N } else if (fd != null) { ic = (Icon) fd.getValue("valueIcon"); //NOI18N } setIcon(ic); needLayout = true; } }
/** Getter for the state of the property editor. The editor can be in * not valid states just if it implements the <link>ExPropertyEditor</link> * and changes state by the <code>setState</code> method of the <link>PropertyEnv</link> * environment. * <P> * @return <code>PropertyEnv.STATE_VALID</code> if the editor is not the <code>ExPropertyEditor</code> * one or other constant from <code>PropertyEnv.STATE_*</code> that was assigned to <code>PropertyEnv</code> * @since 2.20 */ public final Object getState() { if ((displayer != null) && displayer instanceof PropertyDisplayer_Editable) { return ((PropertyDisplayer_Editable) displayer).getPropertyEnv().getState(); } else { PropertyEditor ed = propertyEditor(); if (ed instanceof ExPropertyEditor) { //XXX until we kill ReusablePropertyModel, anyway ReusablePropertyEnv env = reusableEnv; reusableModel.setProperty(prop); ((ExPropertyEditor) ed).attachEnv(env); return env.getState(); } } return PropertyEnv.STATE_VALID; }
/** Getter for the state of the property editor. The editor can be in * not valid states just if it implements the <link>ExPropertyEditor</link> * and changes state by the <code>setState</code> method of the <link>PropertyEnv</link> * environment. * <P> * @return <code>PropertyEnv.STATE_VALID</code> if the editor is not the <code>ExPropertyEditor</code> * one or other constant from <code>PropertyEnv.STATE_*</code> that was assigned to <code>PropertyEnv</code> * @since 2.20 */ public final Object getState () { if (displayer != null && displayer instanceof PropertyDisplayer_Editable) { return ((PropertyDisplayer_Editable) displayer).getPropertyEnv().getState(); } else { PropertyEditor ed = propertyEditor(); if (ed instanceof ExPropertyEditor) { //XXX until we kill ReusablePropertyModel, anyway ReusablePropertyEnv env = reusableEnv; reusableModel.setProperty(prop); ((ExPropertyEditor) ed).attachEnv(env); return env.getState(); } } return PropertyEnv.STATE_VALID; }
/** Getter for the state of the property editor. The editor can be in * not valid states just if it implements the <link>ExPropertyEditor</link> * and changes state by the <code>setState</code> method of the <link>PropertyEnv</link> * environment. * <P> * @return <code>PropertyEnv.STATE_VALID</code> if the editor is not the <code>ExPropertyEditor</code> * one or other constant from <code>PropertyEnv.STATE_*</code> that was assigned to <code>PropertyEnv</code> * @since 2.20 */ public final Object getState () { if (displayer != null && displayer instanceof PropertyDisplayer_Editable) { return ((PropertyDisplayer_Editable) displayer).getPropertyEnv().getState(); } else { PropertyEditor ed = propertyEditor(); if (ed instanceof ExPropertyEditor) { //XXX until we kill ReusablePropertyModel, anyway ReusablePropertyEnv env = reusableEnv; reusableModel.setProperty(prop); ((ExPropertyEditor) ed).attachEnv(env); return env.getState(); } } return PropertyEnv.STATE_VALID; }
public void reset() { setText (editor.getAsText()); Image i=null; if (env != null) { if (env.getState() == env.STATE_INVALID) { setForeground(PropUtils.getErrorColor()); i = Utilities.loadImage ( "org/openide/resources/propertysheet/invalid.gif"); //NOI18N } else { Object o = env.getFeatureDescriptor().getValue("valueIcon"); //NOI18N if (o instanceof Icon) { setIcon((Icon) o); } else if (o instanceof Image) { i = (Image) o; } } } if (i != null) { setIcon (new ImageIcon(i)); } }
@Override public void reset() { setText(editor.getAsText()); Image i = null; FeatureDescriptor fd; if (env != null) { if (env.getState() == PropertyEnv.STATE_INVALID) { setForeground(PropUtils.getErrorColor()); i = ImageUtilities.loadImage("org/openide/resources/propertysheet/invalid.gif"); //NOI18N } else { fd = env.getFeatureDescriptor(); Object o = fd == null ? null : fd.getValue("valueIcon"); //NOI18N if (o instanceof Icon) { setIcon((Icon) o); } else if (o instanceof Image) { i = (Image) o; } } } if (i != null) { setIcon(new ImageIcon(i)); } }