Package javax.swing.event

Examples of javax.swing.event.SwingPropertyChangeSupport


  }
 
  private void test1(TestHarness harness)
  {
    harness.checkPoint("(PropertyChangeEvent)");
    SwingPropertyChangeSupport s = new SwingPropertyChangeSupport(this);
    s.addPropertyChangeListener(this);
    PropertyChangeEvent e = new PropertyChangeEvent("SOURCE", "X", "Y", "Z");
    s.firePropertyChange(e);
    harness.check(this.lastEvent.getSource(), "SOURCE");
    harness.check(this.lastEvent.getPropertyName(), "X");
    harness.check(this.lastEvent.getOldValue(), "Y");
    harness.check(this.lastEvent.getNewValue(), "Z");
   
    // if the old and new values are the same (and non-null), then no listeners
    // are notified
    this.lastEvent = null;
    e = new PropertyChangeEvent("SOURCE", "X", "YY", "YY");
    s.firePropertyChange(e);
    harness.check(lastEvent, null);
   
    // but if the old and new values are both null, listeners ARE notified
    this.lastEvent = null;
    e = new PropertyChangeEvent("SOURCE", "X", null, null);
    s.firePropertyChange(e);
    harness.check(lastEvent, e);   
   
    // check that a null argument throws a null pointer exception
    this.lastEvent = null;
    boolean pass = false;
    try
    {
      s.firePropertyChange(null);
    }
    catch (NullPointerException npe)
    {
      pass = true;
    }
View Full Code Here


  }

  private void test2(TestHarness harness)
  {
    harness.checkPoint("(String, Object, Object)");
    SwingPropertyChangeSupport s = new SwingPropertyChangeSupport("SOURCE");
    s.addPropertyChangeListener(this);
    s.firePropertyChange("X", "Y", "Z");
    harness.check(this.lastEvent.getSource(), "SOURCE");
    harness.check(this.lastEvent.getPropertyName(), "X");
    harness.check(this.lastEvent.getOldValue(), "Y");
    harness.check(this.lastEvent.getNewValue(), "Z");
    this.lastEvent = null;
   
    // if both Objects are equal and non-null, no event is generated
    this.lastEvent = null;
    s.firePropertyChange("X", "Z", "Z");
    harness.check(this.lastEvent, null);

    // the following should not throw any exceptions
//    s.firePropertyChange(null, "Y", "Z");
//    s.firePropertyChange("X", null, "Z");
View Full Code Here

  }

  private void test3(TestHarness harness)
  {
    harness.checkPoint("(String, boolean, boolean)");
    SwingPropertyChangeSupport s = new SwingPropertyChangeSupport("SOURCE");
    s.addPropertyChangeListener(this);
    s.firePropertyChange("X", false, true);
    harness.check(this.lastEvent.getSource(), "SOURCE");
    harness.check(this.lastEvent.getPropertyName(), "X");
    harness.check(this.lastEvent.getOldValue(), Boolean.FALSE);
    harness.check(this.lastEvent.getNewValue(), Boolean.TRUE);
   
    // if both booleans are equal, no event is generated
    this.lastEvent = null;
    s.firePropertyChange("X", true, true);
    harness.check(this.lastEvent, null);
  }
View Full Code Here

  }

  private void test4(TestHarness harness)
  {
    harness.checkPoint("(String, int, int)");
    SwingPropertyChangeSupport s = new SwingPropertyChangeSupport("SOURCE");
    s.addPropertyChangeListener(this);
    s.firePropertyChange("X", 12, 34);
    harness.check(this.lastEvent.getSource(), "SOURCE");
    harness.check(this.lastEvent.getPropertyName(), "X");
    harness.check(this.lastEvent.getOldValue(), new Integer(12));
    harness.check(this.lastEvent.getNewValue(), new Integer(34));
   
    // if both ints are equal, no event is generated
    this.lastEvent = null;
    s.firePropertyChange("X", 99, 99);
    harness.check(this.lastEvent, null);
  }
View Full Code Here

    private static final int ADD_SELECTED_PATHS = 3;
    private static final int SET_SELECTED_PATHS = 4;

    public void addPropertyChangeListener(final PropertyChangeListener l) {
        if (changeSupport == null) {
            changeSupport = new SwingPropertyChangeSupport(this);
        }
        changeSupport.addPropertyChangeListener(l);
    }
View Full Code Here

                                  ToolWindowContainer dockedContainer) {
        this.descriptor = toolWindowDescriptor;
        this.toolWindow = toolWindowDescriptor.getToolWindow();
        this.resourceManager = dockedContainer.getResourceManager();
        this.dockedContainer = dockedContainer;
        this.propertyChangeSupport = new SwingPropertyChangeSupport(this);

        descriptor.getCleaner().addCleaner(this);

        initComponents();
        initListeners();
View Full Code Here

    public DefaultTitleBarButtons(ToolWindowDescriptor toolWindowDescriptor, DockedContainer dockedContainer) {
        this.descriptor = toolWindowDescriptor;
        this.toolWindow = toolWindowDescriptor.getToolWindow();
        this.resourceManager = dockedContainer.getResourceManager();
        this.dockedContainer = dockedContainer;
        this.propertyChangeSupport = new SwingPropertyChangeSupport(this);

        initComponents();
        initListeners();
    }
View Full Code Here

     *
     * @see Action#addPropertyChangeListener
     */
    public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
        if (changeSupport == null) {
            changeSupport = new SwingPropertyChangeSupport(this);
        }
        changeSupport.addPropertyChangeListener(listener);
    }
View Full Code Here

         * with true, null will be returned.
         */
        public synchronized SwingPropertyChangeSupport
                                 getPropertyChangeSupport(boolean create) {
            if (create && changeSupport == null) {
                changeSupport = new SwingPropertyChangeSupport(
                                         UIManager.class);
            }
            return changeSupport;
        }
View Full Code Here

     *
     */
    public synchronized void addPropertyChangeListener(
                                PropertyChangeListener listener) {
        if (changeSupport == null) {
            changeSupport = new SwingPropertyChangeSupport(this);
        }
        changeSupport.addPropertyChangeListener(listener);
    }
View Full Code Here

TOP

Related Classes of javax.swing.event.SwingPropertyChangeSupport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.