/** * Check if this is already synchronizing the given AbstractButton. * * This may have the side-effect of releasing the weak reference to * the target button. * * @param button must not be null * @return true if this target button and the given comp are equal * false otherwise. * @throws NullPointerException if the button is null. */ public boolean isToggling(AbstractButton button) { // JW: should check identity instead of equality? return button.equals(checkReferent(null)); }
protected synchronized boolean shouldAddListener(Action action, AbstractButton button) { releasePCLs(action); // PENDING JW: revisit - we need a configurator to maintain at most a 1:1 from button to // action anyway: so a true in isToggling must not happen. // return !isToggling(action, button); // return true; }
if (l[i] instanceof ToggleActionPropertyChangeListener) { ToggleActionPropertyChangeListener togglePCL = (ToggleActionPropertyChangeListener) l[i]; if (togglePCL.isToggling(button)) { actionExt.removePropertyChangeListener(togglePCL); new ToggleActionPropertyChangeListener(a, button);
public ToggleActionPropertyChangeListener(Action action, AbstractButton button) { if (shouldAddListener(action, button)) { this.buttonRef = new WeakReference<AbstractButton>(button); action.addPropertyChangeListener(this); } }
protected boolean isToggling(Action action, AbstractButton button) { if (!(action instanceof AbstractAction)) return false; PropertyChangeListener[] listeners = ((AbstractAction)action).getPropertyChangeListeners(); for (int i = listeners.length - 1; i >= 0; i--) { if (listeners[i] instanceof ToggleActionPropertyChangeListener) { if (((ToggleActionPropertyChangeListener) listeners[i]).isToggling(button)) return true; } } return false; }
if (l[i] instanceof ToggleActionPropertyChangeListener) { ToggleActionPropertyChangeListener togglePCL = (ToggleActionPropertyChangeListener) l[i]; if (togglePCL.isToggling(button)) { actionExt.removePropertyChangeListener(togglePCL); new ToggleActionPropertyChangeListener(a, button);
public ToggleActionPropertyChangeListener(Action action, AbstractButton button) { if (shouldAddListener(action, button)) { this.buttonRef = new WeakReference<AbstractButton>(button); action.addPropertyChangeListener(this); } }
protected boolean isToggling(Action action, AbstractButton button) { if (!(action instanceof AbstractAction)) return false; PropertyChangeListener[] listeners = ((AbstractAction)action).getPropertyChangeListeners(); for (int i = listeners.length - 1; i >= 0; i--) { if (listeners[i] instanceof ToggleActionPropertyChangeListener) { if (((ToggleActionPropertyChangeListener) listeners[i]).isToggling(button)) return true; } } return false; }
protected synchronized boolean shouldAddListener(Action action, AbstractButton button) { releasePCLs(action); // PENDING JW: revisit - we need a configurator to maintain at most a 1:1 from button to // action anyway: so a true in isToggling must not happen. // return !isToggling(action, button); // return true; }
if (l[i] instanceof ToggleActionPropertyChangeListener) { ToggleActionPropertyChangeListener togglePCL = (ToggleActionPropertyChangeListener) l[i]; if (togglePCL.isToggling(button)) { actionExt.removePropertyChangeListener(togglePCL); new ToggleActionPropertyChangeListener(a, button);
/** * Check if this is already synchronizing the given AbstractButton. * * This may have the side-effect of releasing the weak reference to * the target button. * * @param button must not be null * @return true if this target button and the given comp are equal * false otherwise. * @throws NullPointerException if the button is null. */ public boolean isToggling(AbstractButton button) { // JW: should check identity instead of equality? return button.equals(checkReferent(null)); }
public ToggleActionPropertyChangeListener(Action action, AbstractButton button) { if (shouldAddListener(action, button)) { this.buttonRef = new WeakReference<AbstractButton>(button); action.addPropertyChangeListener(this); } }
protected boolean isToggling(Action action, AbstractButton button) { if (!(action instanceof AbstractAction)) return false; PropertyChangeListener[] listeners = ((AbstractAction)action).getPropertyChangeListeners(); for (int i = listeners.length - 1; i >= 0; i--) { if (listeners[i] instanceof ToggleActionPropertyChangeListener) { if (((ToggleActionPropertyChangeListener) listeners[i]).isToggling(button)) return true; } } return false; }
protected synchronized boolean shouldAddListener(Action action, AbstractButton button) { releasePCLs(action); // PENDING JW: revisit - we need a configurator to maintain at most a 1:1 from button to // action anyway: so a true in isToggling must not happen. // return !isToggling(action, button); // return true; }
if (l[i] instanceof ToggleActionPropertyChangeListener) { ToggleActionPropertyChangeListener togglePCL = (ToggleActionPropertyChangeListener) l[i]; if (togglePCL.isToggling(button)) { actionExt.removePropertyChangeListener(togglePCL); new ToggleActionPropertyChangeListener(a, button);
/** * Check if this is already synchronizing the given AbstractButton. * * This may have the side-effect of releasing the weak reference to * the target button. * * @param button must not be null * @return true if this target button and the given comp are equal * false otherwise. * @throws NullPointerException if the button is null. */ public boolean isToggling(AbstractButton button) { // JW: should check identity instead of equality? return button.equals(checkReferent(null)); }
public ToggleActionPropertyChangeListener(Action action, AbstractButton button) { if (shouldAddListener(action, button)) { this.buttonRef = new WeakReference<AbstractButton>(button); action.addPropertyChangeListener(this); } }
protected boolean isToggling(Action action, AbstractButton button) { if (!(action instanceof AbstractAction)) return false; PropertyChangeListener[] listeners = ((AbstractAction)action).getPropertyChangeListeners(); for (int i = listeners.length - 1; i >= 0; i--) { if (listeners[i] instanceof ToggleActionPropertyChangeListener) { if (((ToggleActionPropertyChangeListener) listeners[i]).isToggling(button)) return true; } } return false; }
protected synchronized boolean shouldAddListener(Action action, AbstractButton button) { releasePCLs(action); // PENDING JW: revisit - we need a configurator to maintain at most a 1:1 from button to // action anyway: so a true in isToggling must not happen. // return !isToggling(action, button); // return true; }
/** * Check if this is already synchronizing the given AbstractButton. * * This may have the side-effect of releasing the weak reference to * the target button. * * @param button must not be null * @return true if this target button and the given comp are equal * false otherwise. * @throws NullPointerException if the button is null. */ public boolean isToggling(AbstractButton button) { // JW: should check identity instead of equality? return button.equals(checkReferent(null)); }