Ejemplo n.º 1
0
  @Override
  public void componentLayoutChanged(int index, PropertyChangeEvent ev)
      throws PropertyVetoException {
    RADVisualComponent<?> radComp = radContainer.getSubComponent(index);

    if (ev != null && ev.getPropertyName() != null) {
      layoutDelegate.acceptComponentLayoutChange(index, ev);

      FormModel formModel = radContainer.getFormModel();
      formModel.fireComponentLayoutChanged(
          radComp, ev.getPropertyName(), ev.getOldValue(), ev.getNewValue());

      if (radComp.getNodeReference() != null) // propagate the change to node
      {
        radComp
            .getNodeReference()
            .firePropertyChangeHelper(ev.getPropertyName(), ev.getOldValue(), ev.getNewValue());
      }
    } else {
      if (radComp.getNodeReference() != null) // propagate the change to node
      {
        radComp.getNodeReference().fireComponentPropertySetsChange();
      }
      radComp.resetConstraintsProperties();
    }
  }
Ejemplo n.º 2
0
 public void propertyChange(PropertyChangeEvent e) {
   String propertyName = e.getPropertyName();
   if (e.getPropertyName().equals(Action.NAME)) {
     String text = (String) e.getNewValue();
     menuItem.setText(text);
   } else if (propertyName.equals("enabled")) {
     Boolean enabledState = (Boolean) e.getNewValue();
     menuItem.setEnabled(enabledState.booleanValue());
   }
 }
Ejemplo n.º 3
0
    /**
     * This method gets called when a bound property is changed.
     *
     * @param e A <code>PropertyChangeEvent</code> object describing the event source and the
     *     property that has changed. Must not be null.
     * @throws NullPointerException if the parameter is null.
     * @since 1.5
     */
    public void propertyChange(PropertyChangeEvent e) {
      String propertyName = e.getPropertyName();
      if (propertyName == "visible") {
        if (e.getOldValue() == Boolean.FALSE && e.getNewValue() == Boolean.TRUE) {
          handlePopupIsVisibleEvent(true);

        } else if (e.getOldValue() == Boolean.TRUE && e.getNewValue() == Boolean.FALSE) {
          handlePopupIsVisibleEvent(false);
        }
      }
    }
Ejemplo n.º 4
0
 public void propertyChange(PropertyChangeEvent e) {
   String propertyName = e.getPropertyName();
   if (e.getPropertyName().equals(Action.NAME)) {
     String text = (String) e.getNewValue();
     menuItem.setText(text);
   } else if (propertyName.equals("enabled")) {
     // System.out.println("Debug:TextViewer: ActionChangedListener enabled");
     Boolean enabledState = (Boolean) e.getNewValue();
     menuItem.setEnabled(enabledState.booleanValue());
   }
 }
Ejemplo n.º 5
0
 //
 //  Implement PropertyChangeListener interface
 //
 @Override
 public void propertyChange(PropertyChangeEvent evt) {
   if (evt.getNewValue() instanceof Font) {
     if (updateFont) {
       Font newFont = (Font) evt.getNewValue();
       setFont(newFont);
       lastDigits = 0;
       setPreferredWidth();
     } else {
       repaint();
     }
   }
 }
  /**
   * INTERNAL: This method marks the object as changed. This method is only called by EclipseLink
   */
  public void internalPropertyChange(PropertyChangeEvent evt) {
    if (evt.getNewValue() == evt.getOldValue()) {
      return;
    }

    DatabaseMapping mapping =
        descriptor.getObjectBuilder().getMappingForAttributeName(evt.getPropertyName());
    // Bug#4127952 Throw an exception indicating there is no mapping for the property name.
    if (mapping == null) {
      throw ValidationException.wrongPropertyNameInChangeEvent(
          owner.getClass(), evt.getPropertyName());
    }
    if (mapping instanceof AbstractDirectMapping
        || mapping instanceof AbstractTransformationMapping) {
      // If both newValue and oldValue are null, or newValue is not null and newValue equals
      // oldValue, don't build ChangeRecord
      if (((evt.getNewValue() == null) && (evt.getOldValue() == null))
          || ((evt.getNewValue() != null) && (evt.getNewValue()).equals(evt.getOldValue()))) {
        return;
      }
    }

    super.internalPropertyChange(evt);

    if (uow.getUnitOfWorkChangeSet() == null) {
      uow.setUnitOfWorkChangeSet(new UnitOfWorkChangeSet(uow));
    }
    if (objectChangeSet == null) { // only null if new or if in a new UOW
      // add to tracker list to prevent GC of clone if using weak references
      // put it in here so that it only occurs on the 1st change for a particular UOW
      uow.addToChangeTrackedHardList(owner);
      objectChangeSet =
          getDescriptor()
              .getObjectBuilder()
              .createObjectChangeSet(
                  owner, (UnitOfWorkChangeSet) uow.getUnitOfWorkChangeSet(), false, uow);
    }

    if (evt.getClass().equals(ClassConstants.PropertyChangeEvent_Class)) {
      mapping.updateChangeRecord(
          evt.getSource(), evt.getNewValue(), evt.getOldValue(), objectChangeSet, getUnitOfWork());
    } else if (evt.getClass().equals(ClassConstants.CollectionChangeEvent_Class)
        || (evt.getClass().equals(ClassConstants.MapChangeEvent_Class))) {
      mapping.updateCollectionChangeRecord(
          (CollectionChangeEvent) evt, objectChangeSet, getUnitOfWork());
    } else {
      throw ValidationException.wrongChangeEvent(evt.getClass());
    }
  }
  /**
   * Notifies this instance that there was a change in the value of a property of an
   * <tt>Endpoint</tt> participating in this multipoint conference.
   *
   * @param endpoint the <tt>Endpoint</tt> which is the source of the event/notification and is
   *     participating in this multipoint conference
   * @param ev a <tt>PropertyChangeEvent</tt> which specifies the source of the event/notification,
   *     the name of the property and the old and new values of that property
   */
  private void endpointPropertyChange(Endpoint endpoint, PropertyChangeEvent ev) {
    String propertyName = ev.getPropertyName();
    boolean maybeRemoveEndpoint;

    if (Endpoint.SCTP_CONNECTION_PROPERTY_NAME.equals(propertyName)) {
      // The SctpConnection of/associated with an Endpoint has changed. We
      // may want to fire initial events over that SctpConnection (as soon
      // as it is ready).
      SctpConnection oldValue = (SctpConnection) ev.getOldValue();
      SctpConnection newValue = (SctpConnection) ev.getNewValue();

      endpointSctpConnectionChanged(endpoint, oldValue, newValue);

      // The SctpConnection may have expired.
      maybeRemoveEndpoint = (newValue == null);
    } else if (Endpoint.CHANNELS_PROPERTY_NAME.equals(propertyName)) {
      // An RtpChannel may have expired.
      maybeRemoveEndpoint = true;
    } else {
      maybeRemoveEndpoint = false;
    }
    if (maybeRemoveEndpoint) {
      // It looks like there is a chance that the Endpoint may have
      // expired. Endpoints are held by this Conference via WeakReferences
      // but WeakReferences are unpredictable. We have functionality
      // though which could benefit from discovering that an Endpoint has
      // expired as quickly as possible (e.g. ConferenceSpeechActivity).
      // Consequently, try to expedite the removal of expired Endpoints.
      if (endpoint.getSctpConnection() == null && endpoint.getChannelCount(null) == 0) {
        removeEndpoint(endpoint);
      }
    }
  }
  /**
   * This method gets called when a property we're interested in is about to change. In case we
   * don't like the new value we throw a PropertyVetoException to prevent the actual change from
   * happening.
   *
   * @param evt a <tt>PropertyChangeEvent</tt> object describing the event source and the property
   *     that will change.
   * @exception PropertyVetoException if we don't want the change to happen.
   */
  public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
    if (evt.getPropertyName().equals(PROP_STUN_SERVER_ADDRESS)) {
      // make sure that we have a valid fqdn or ip address.

      // null or empty port is ok since it implies turning STUN off.
      if (evt.getNewValue() == null) return;

      String host = evt.getNewValue().toString();
      if (host.trim().length() == 0) return;

      boolean ipv6Expected = false;
      if (host.charAt(0) == '[') {
        // This is supposed to be an IPv6 litteral
        if (host.length() > 2 && host.charAt(host.length() - 1) == ']') {
          host = host.substring(1, host.length() - 1);
          ipv6Expected = true;
        } else {
          // This was supposed to be a IPv6 address, but it's not!
          throw new PropertyVetoException("Invalid address string" + host, evt);
        }
      }

      for (int i = 0; i < host.length(); i++) {
        char c = host.charAt(i);
        if (Character.isLetterOrDigit(c)) continue;

        if ((c != '.' && c != ':') || (c == '.' && ipv6Expected) || (c == ':' && !ipv6Expected))
          throw new PropertyVetoException(host + " is not a valid address nor host name", evt);
      }

    } // is prop_stun_server_address
    else if (evt.getPropertyName().equals(PROP_STUN_SERVER_PORT)) {

      // null or empty port is ok since it implies turning STUN off.
      if (evt.getNewValue() == null) return;

      String port = evt.getNewValue().toString();
      if (port.trim().length() == 0) return;

      try {
        Integer.valueOf(evt.getNewValue().toString());
      } catch (NumberFormatException ex) {
        throw new PropertyVetoException(port + " is not a valid port! " + ex.getMessage(), evt);
      }
    }
  }
Ejemplo n.º 9
0
  /**
   * The animation changed. Handle the change.
   *
   * @param evt The event
   */
  private void handleAnimationPropertyChange(PropertyChangeEvent evt) {
    //        System.err.println ("Handlechange:" +evt.getPropertyName());
    if (evt.getPropertyName().equals(Animation.ANI_VALUE)) {
      debug("handleAnimationPropertyChange value :" + evt.getPropertyName());
      Real eventValue = (Real) evt.getNewValue();
      // if there's nothing to do, return;
      if ((eventValue == null) || eventValue.isMissing()) {
        return;
      }

      /** The Animation associated with this widget */
      DateTime time = null;
      try {
        time = new DateTime(eventValue);
      } catch (VisADException ve) {;
      }
      final DateTime theDateTime = time;
      final int theIndex = ((anime != null) ? anime.getCurrent() : -1);
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              boolean oldValue = ignoreTimesCbxEvents;
              try {
                ignoreTimesCbxEvents = true;
                //                        synchronized (timesCbxMutex) {
                xcnt++;

                timesCbx.setSelectedItem(theDateTime);
                //                        }
                if ((boxPanel != null) && (theIndex >= 0)) {
                  boxPanel.setOnIndex(theIndex);
                }
                timesCbx.repaint();
              } finally {
                ignoreTimesCbxEvents = oldValue;
              }
            }
          });
      shareValue();
    } else if (evt.getPropertyName().equals(Animation.ANI_SET)) {
      if (ignoreAnimationSetChange) {
        return;
      }
      updateIndicatorInner((Set) evt.getNewValue(), true);
    }
  }
 /**
  * This method creates the object change set if necessary. It also creates/updates the change
  * record based on the new value. Object should check the if newValue and oldValue are identical.
  * If they are identical, do not create PropertyChangeEvent and call this method.
  */
 public void internalPropertyChange(PropertyChangeEvent evt) {
   super.internalPropertyChange(evt);
   // Also need to raise the event in the parent, to create a change set for it.
   // Only raise the event in parent if something actually changed.
   if (this.objectChangeSet != null && this.parentListener != null) {
     if (evt.getSource() == owner) {
       this.parentListener.internalPropertyChange(
           new PropertyChangeEvent(
               evt.getSource(), parentAttributeName, evt.getOldValue(), evt.getNewValue()));
     } else {
       // the event's source is not the owner of this change tracking policy - this is a nested
       // aggregate change.
       this.parentListener.internalPropertyChange(
           new PropertyChangeEvent(
               owner, parentAttributeName, evt.getOldValue(), evt.getNewValue()));
     }
   }
 }
 public void propertyChange(PropertyChangeEvent e) {
   String prop = e.getPropertyName();
   if (prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
     filters = (FileFilter[]) e.getNewValue();
     fireContentsChanged(this, -1, -1);
   } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
     fireContentsChanged(this, -1, -1);
   }
 }
Ejemplo n.º 12
0
 @Override
 public void propertyChange(PropertyChangeEvent evt) {
   String strPropertyName = evt.getPropertyName();
   if ("progress".equals(strPropertyName)) {
     progressBar.setIndeterminate(false);
     int progress = (Integer) evt.getNewValue();
     progressBar.setValue(progress);
   }
 }
Ejemplo n.º 13
0
 public void propertyChange(PropertyChangeEvent e) {
   String prop = e.getPropertyName();
   if (prop == JFileChooser.SELECTED_FILE_CHANGED_PROPERTY) {
     if (isShowing()) {
       loadImage((File) e.getNewValue());
       repaint();
     }
   }
 }
Ejemplo n.º 14
0
 /**
  * A property in the observed bean has changed. First checks, if this listener should handle the
  * event, because the event's property name is the one to be observed or the event indicates
  * that any property may have changed. In case the event provides no new value, it is read from
  * the source bean.
  *
  * @param evt the property change event to be handled
  */
 public void propertyChange(PropertyChangeEvent evt) {
   String sourcePropertyName = sourcePropertyDescriptor.getName();
   if ((evt.getPropertyName() == null) || (evt.getPropertyName().equals(sourcePropertyName))) {
     Object newValue = evt.getNewValue();
     if (newValue == null) {
       newValue = BeanUtils.getValue(sourceBean, sourcePropertyDescriptor);
     }
     setValueSilently(
         sourceBean, sourcePropertyDescriptor, targetBean, targetPropertyDescriptor, newValue);
   }
 }
Ejemplo n.º 15
0
 public void propertyChange(PropertyChangeEvent e) {
   if (e.getSource() instanceof PanelThreadMonitor) {
     if (e.getPropertyName().equals("Status")) {
       PanelThreadMonitor mntTmp = (PanelThreadMonitor) e.getSource();
       int iMonitorIndex = pnlThread.indexOfComponent(mntTmp);
       if (iMonitorIndex >= 0) {
         if (e.getNewValue().equals("Started")) {
           if (!pnlThread.getBackgroundAt(iMonitorIndex).equals(COLOR_STARTED)) {
             pnlThread.setBackgroundAt(iMonitorIndex, COLOR_STARTED);
             pnlThread.setForegroundAt(iMonitorIndex, COLOR_STARTED_FG);
           }
         } else if (e.getNewValue().equals("Stopped")) {
           if (!pnlThread.getBackgroundAt(iMonitorIndex).equals(SystemColor.controlShadow)) {
             pnlThread.setBackgroundAt(iMonitorIndex, UIManager.getColor("TabbedPane.background"));
             pnlThread.setForegroundAt(iMonitorIndex, SystemColor.textText);
           }
         }
       }
     }
   }
 }
  //
  //  Implement the PropertyChangeListener
  //
  public void propertyChange(PropertyChangeEvent e) {
    //  When the TableModel changes we need to update the listeners
    //  and column widths

    if ("model".equals(e.getPropertyName())) {
      TableModel model = (TableModel) e.getOldValue();
      model.removeTableModelListener(this);

      model = (TableModel) e.getNewValue();
      model.addTableModelListener(this);
      adjustColumns();
    }
  }
Ejemplo n.º 17
0
  /**
   * Called with a DjVuBean property has changed.
   *
   * @param e the PropertyChangeEvent.
   */
  public void propertyChange(final PropertyChangeEvent e) {
    try {
      final String name = e.getPropertyName();

      if ("page".equalsIgnoreCase(name)) {
        final Object object = e.getNewValue();

        if (object instanceof Number) {
          setCheckedPage(((Number) object).intValue() - 1);
        }
      } else if ("propertyName".equalsIgnoreCase(name)) {
        final String propertyName = (String) e.getNewValue();

        if ("navpane".equalsIgnoreCase(propertyName)) {
          setVisible("Outline".equalsIgnoreCase(djvuBean.properties.getProperty(propertyName)));
        }
      }
    } catch (final Throwable exp) {
      exp.printStackTrace(DjVuOptions.err);
      System.gc();
    }
  }
Ejemplo n.º 18
0
 @Override
 public void firePropertyChange(PropertyChangeEvent evt) {
   // do nothing if value not changed - the super method will check it anyway
   // but this way we don't have to log it
   if (ObjectUtils.equals(evt.getOldValue(), evt.getNewValue())) {
     return;
   }
   // improve log display for arrays
   Object newValue = evt.getNewValue();
   Object oldValue = evt.getOldValue();
   if (oldValue instanceof Object[]) {
     oldValue = Arrays.toString((Object[]) oldValue);
     newValue = Arrays.toString((Object[]) newValue);
   }
   // log change
   logger.log(
       Level.CONFIG,
       "Config changed - property: {0}, old: {1}, new: {2}",
       new Object[] {evt.getPropertyName(), oldValue, newValue});
   // fire change
   super.firePropertyChange(evt);
 }
 public void propertyChange(PropertyChangeEvent evt) {
   if (evt.getPropertyName().equals(InstallOptionsModel.PROPERTY_INDEX)) {
     mDialog.moveChild(mCurrentWidget, ((Integer) evt.getNewValue()).intValue());
   } else if (evt.getPropertyName().equals(InstallOptionsModel.PROPERTY_CHILDREN)) {
     if (Common.objectsAreEqual(mCurrentWidget, evt.getOldValue())
         && evt.getNewValue() instanceof InstallOptionsWidget) {
       InstallOptionsWidget widget = (InstallOptionsWidget) evt.getNewValue();
       mCurrentWidget.removeModelCommandListener(InstallOptionsWidgetEditorDialog.this);
       mCurrentWidget.removePropertyChangeListener(InstallOptionsWidgetEditorDialog.this);
       mCurrentWidget = widget;
       mSection = mCurrentWidget.getSection();
       mCurrentWidget.addModelCommandListener(InstallOptionsWidgetEditorDialog.this);
       mCurrentWidget.addPropertyChangeListener(InstallOptionsWidgetEditorDialog.this);
       Display.getDefault()
           .asyncExec(
               new Runnable() {
                 public void run() {
                   mPage.selectionChanged(null, new StructuredSelection(mCurrentWidget));
                 }
               });
     }
   }
 }
Ejemplo n.º 20
0
    @Override
    public void vetoableChange(PropertyChangeEvent ev) throws PropertyVetoException {
      Object source = ev.getSource();
      String eventName = ev.getPropertyName();
      if (source instanceof FormProperty<?> && FormProperty.PROP_VALUE.equals(eventName)) {
        ev =
            new PropertyChangeEvent(
                layoutDelegate,
                ((FormProperty<?>) source).getName(),
                ev.getOldValue(),
                ev.getNewValue());

        containerLayoutChanged(ev);
      }
    }
Ejemplo n.º 21
0
    public void propertyChange(PropertyChangeEvent e) {
      boolean isDisposed = (Boolean) e.getNewValue();
      if (isDisposed != true) {
        if (log.isLoggable(PlatformLogger.Level.FINE)) {
          log.fine(" Assertion (newValue != true) failed for AppContext.GUI_DISPOSED ");
        }
      }
      AppContext appContext = AppContext.getAppContext();
      synchronized (appContext) {
        appContext.remove(ACTIVE_WINDOWS_KEY);
        appContext.removePropertyChangeListener(AppContext.GUI_DISPOSED, this);

        KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        kfm.removePropertyChangeListener("activeWindow", activeWindowListener);
      }
    }
Ejemplo n.º 22
0
 public void propertyChange(PropertyChangeEvent e) {
   Window w = (Window) e.getNewValue();
   if (w == null) {
     return;
   }
   AppContext appContext = SunToolkit.targetToAppContext(w);
   synchronized (appContext) {
     WWindowPeer wp = (WWindowPeer) w.getPeer();
     // add/move wp to the end of the list
     List<WWindowPeer> l = (List<WWindowPeer>) appContext.get(ACTIVE_WINDOWS_KEY);
     if (l != null) {
       l.remove(wp);
       l.add(wp);
     }
   }
 }
Ejemplo n.º 23
0
  @Override
  public void propertyChange(final PropertyChangeEvent evt) {
    final String propertyName = evt.getPropertyName();

    if (AquaFocusHandler.FRAME_ACTIVE_PROPERTY.equals(propertyName)) {
      final JTextComponent comp = ((JTextComponent) evt.getSource());

      if (evt.getNewValue() == Boolean.TRUE) {
        setVisible(comp.hasFocus());
      } else {
        setVisible(false);
      }

      if (getDot() != getMark()) comp.getUI().damageRange(comp, getDot(), getMark());
    }
  }
Ejemplo n.º 24
0
    @Override
    public void propertyChange(PropertyChangeEvent ev) {
      Object source = ev.getSource();
      String eventName = ev.getPropertyName();
      if (source instanceof FormProperty<?> && FormProperty.PROP_VALUE.equals(eventName)) {
        ev =
            new PropertyChangeEvent(
                layoutDelegate,
                ((FormProperty<?>) source).getName(),
                ev.getOldValue(),
                ev.getNewValue());

        try {
          containerLayoutChanged(ev);
        } catch (PropertyVetoException ex) {
          // should not happen
        }
      }
    }
Ejemplo n.º 25
0
  // Called on EDT
  public void propertyChange(PropertyChangeEvent ev) {
    String prop = ev.getPropertyName();

    if (prop == JConsoleContext.CONNECTION_STATE_PROPERTY) {
      ConnectionState newState = (ConnectionState) ev.getNewValue();

      switch (newState) {
        case DISCONNECTED:
          synchronized (this) {
            long time = System.currentTimeMillis();
            times.add(time);
            for (Sequence seq : seqs) {
              seq.add(Long.MIN_VALUE);
            }
          }
          break;
      }
    }
  }
Ejemplo n.º 26
0
  @Override
  public void containerLayoutChanged(PropertyChangeEvent ev) throws PropertyVetoException {
    if (ev != null && ev.getPropertyName() != null) {
      layoutDelegate.acceptContainerLayoutChange(ev);

      FormModel formModel = radContainer.getFormModel();
      formModel.fireContainerLayoutChanged(
          radContainer, ev.getPropertyName(), ev.getOldValue(), ev.getNewValue());
    } else {
      propertySets = null;
    }

    LayoutNode node = radContainer.getLayoutNodeReference();
    if (node != null) {
      // propagate the change to node
      if (ev != null && ev.getPropertyName() != null) {
        node.fireLayoutPropertiesChange();
      } else {
        node.fireLayoutPropertySetsChange();
      }
    }
  }
  /*
   *  Track focus changes and update the current focus component
   *  for the current tab
   */
  public void propertyChange(PropertyChangeEvent e) {
    //  No need to track focus change

    if (exceptions == null && focusPolicy == RESET_FOCUS) return;

    //  Check for exceptions to the focus policy exist

    Component key = tabbedPane.getComponentAt(tabbedPane.getSelectedIndex());

    if (exceptions != null) {
      if (focusPolicy == RESET_FOCUS && !exceptions.contains(key)) return;

      if (focusPolicy == RETAIN_FOCUS && exceptions.contains(key)) return;
    }

    // Track focus changes for the tab

    Component value = (Component) e.getNewValue();

    if (value != null && SwingUtilities.isDescendingFrom(value, key)) {

      tabFocus.put(key, value);
    }
  }
Ejemplo n.º 28
0
  // one of the objects we're listening to may have changed.
  public void propertyChange(final PropertyChangeEvent evt) {
    // what sort is it?
    final String type = evt.getPropertyName();

    // is it one we're interested in?
    if (type.equals(MWC.GenericData.WatchableList.FILTERED_PROPERTY)) {
      // see if we have received the new time period
      final Object newVal = evt.getNewValue();

      // is this a valid time period?
      if (newVal instanceof somePeriod) {
        final somePeriod newPeriod = (somePeriod) newVal;

        // remove the old values
        _participants.remove(evt.getSource());

        // add the new one
        _participants.put(evt.getSource(), newPeriod);
      }

      // finally trigger a recalculation of the time limits
      recalcTimes();
    }
  }
Ejemplo n.º 29
0
  public void propertyChange(PropertyChangeEvent e) {
    boolean update = false;
    String prop = e.getPropertyName();

    // If the directory changed, don't show an image.
    if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) {
      file = null;
      update = true;

      // If a file became selected, find out which one.
    } else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {
      file = (File) e.getNewValue();
      update = true;
    }

    // Update the preview accordingly.
    if (update) {
      thumbnail = null;
      if (isShowing()) {
        loadImage();
        repaint();
      }
    }
  }
  /**
   * Fire an existing PropertyChangeEvent to any registered listeners. No event is fired if the
   * given event's old and new values are equal and non-null.
   *
   * @param evt The PropertyChangeEvent object.
   */
  public void firePropertyChange(PropertyChangeEvent evt) {
    Object oldValue = evt.getOldValue();
    Object newValue = evt.getNewValue();
    String propertyName = evt.getPropertyName();
    if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
      return;
    }

    if (listeners != null) {
      Object[] list = listeners.getListenersInternal();
      for (int i = 0; i < list.length; i++) {
        PropertyChangeListener target = (PropertyChangeListener) list[i];
        target.propertyChange(evt);
      }
    }

    if (children != null && propertyName != null) {
      PropertyChangeSupport child = null;
      child = (PropertyChangeSupport) children.get(propertyName);
      if (child != null) {
        child.firePropertyChange(evt);
      }
    }
  }