Ejemplo n.º 1
0
      public void propertyChange(PropertyChangeEvent e) {
        if (e.getPropertyName().equals("minimum") && startAtMin) {
          start = getMinimum();
        }

        if (e.getPropertyName().equals("minimum") || e.getPropertyName().equals("maximum")) {

          Enumeration keys = getLabelTable().keys();
          Hashtable<Object, Object> hashtable = new Hashtable<Object, Object>();

          // Save the labels that were added by the developer
          while (keys.hasMoreElements()) {
            Object key = keys.nextElement();
            Object value = labelTable.get(key);
            if (!(value instanceof LabelUIResource)) {
              hashtable.put(key, value);
            }
          }

          clear();
          createLabels();

          // Add the saved labels
          keys = hashtable.keys();
          while (keys.hasMoreElements()) {
            Object key = keys.nextElement();
            put(key, hashtable.get(key));
          }

          ((JSlider) e.getSource()).setLabelTable(this);
        }
      }
Ejemplo n.º 2
0
  public void propertyChange(PropertyChangeEvent e) {
    String prop = e.getPropertyName();

    if (isVisible()
        && (e.getSource() == optionPane)
        && (JOptionPane.VALUE_PROPERTY.equals(prop)
            || JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) {
      Object value = optionPane.getValue();

      if (value == JOptionPane.UNINITIALIZED_VALUE) return;
      optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);

      if (button1.equals(value)) {
        try {
          double a = Double.parseDouble(left.getText());
          double b = Double.parseDouble(right.getText());
          double err = Double.parseDouble(error.getText());

          if (a > b) {
            JOptionPane.showMessageDialog(this, "A < B!!!", null, JOptionPane.ERROR_MESSAGE);
          } else {
            hideIt();
            graphic.startApplyingMethod(parentFrame.getSelectedMethod(), err, a, b);
          }
        } catch (Exception ex) {
          JOptionPane.showMessageDialog(
              this, "Trebuie sa fie numar real!", null, JOptionPane.ERROR_MESSAGE);
        }
      } else if (button2.equals(value)) {
        hideIt();
      }
    }
  }
Ejemplo n.º 3
0
 @Override
 public void propertyChange(PropertyChangeEvent evt) {
   if (evt.getSource() != beanHelper.getBean()
       || evt.getPropagationId() == JBeanEditor.class) {
     return;
   }
   refresh();
 }
    public void propertyChange(PropertyChangeEvent event) {
      // session list changed
      if (event.getSource() instanceof CollabManager) {
        attachListeners();
      }

      // either session list or session status changed
      updateStatus();
    }
 /**
  * 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()));
     }
   }
 }
Ejemplo n.º 6
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);
           }
         }
       }
     }
   }
 }
Ejemplo n.º 7
0
          public void propertyChange(PropertyChangeEvent event) {

            try {
              accept((ScalarMapAdapter) event.getSource(), (ScalarMap) event.getOldValue());
            } catch (Exception e) {
              System.err.println(
                  getClass().getName()
                      + ".propertyChange(): "
                      + "Couldn't handle change to ScalarMap: "
                      + e);
            }
          }
Ejemplo n.º 8
0
          public void propertyChange(PropertyChangeEvent event) {

            // A ConstantMap of the adapted data has changed.
            try {
              setChanged((DataAdapter) event.getSource());
            } catch (Exception e) {
              System.err.println(
                  getClass().getName()
                      + ".propertyChange(): "
                      + "Couldn't handle change to data: "
                      + e);
            }
          }
  /**
   * 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());
    }
  }
Ejemplo n.º 10
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.º 11
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.º 12
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.º 13
0
    public void propertyChange(PropertyChangeEvent e) {
      if (_squelchChangeEvents) return;

      PropertyEditor editor = (PropertyEditor) e.getSource();
      PropertyDescriptor prop = (PropertyDescriptor) _editor2Prop.get(editor);
      Method writer = prop.getWriteMethod();
      if (writer != null) {
        try {
          Object[] params = {editor.getValue()};
          writer.invoke(_value, params);
          setObject(_value);
          firePropertyChange(_value, prop.getName(), null, editor.getValue());
        } catch (IllegalAccessException ex) {
          ex.printStackTrace();
        } catch (InvocationTargetException ex) {
          ex.getTargetException().printStackTrace();
        }
      }
    }
Ejemplo n.º 14
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
        }
      }
    }
  /**
   * Notifies this instance that there was a change in the value of a property of an object in which
   * this instance is interested.
   *
   * @param ev a <tt>PropertyChangeEvent</tt> which specifies the object of interest, the name of
   *     the property and the old and new values of that property
   */
  @Override
  public void propertyChange(PropertyChangeEvent ev) {
    Object source = ev.getSource();

    if (isExpired()) {
      // An expired Conference is to be treated like a null Conference
      // i.e. it does not handle any PropertyChangeEvents. If possible,
      // make sure that no further PropertyChangeEvents will be delivered
      // to this Conference.
      if (source instanceof PropertyChangeNotifier) {
        ((PropertyChangeNotifier) source).removePropertyChangeListener(propertyChangeListener);
      }
    } else if (source == speechActivity) {
      speechActivityPropertyChange(ev);
    } else if (source instanceof Endpoint) {
      // We care about PropertyChangeEvents from Endpoint but only if the
      // Endpoint in question is still participating in this Conference.
      Endpoint endpoint = getEndpoint(((Endpoint) source).getID());

      if (endpoint != null) endpointPropertyChange(endpoint, ev);
    }
  }
Ejemplo n.º 16
0
 /**
  * Notifies this instance about a change in the value of a property of a source which of interest
  * to this instance. For example, <tt>FullScreenButton</tt> updates its user interface-related
  * properties upon changes in the value of the {@link CallContainer#PROP_FULL_SCREEN} property of
  * its associated {@link #callContainer}.
  *
  * @param ev a <tt>PropertyChangeEvent</tt> which identifies the source, the name of the property
  *     and the old and new values
  */
 public void propertyChange(PropertyChangeEvent ev) {
   if (CallContainer.PROP_FULL_SCREEN.equals(ev.getPropertyName())
       && this.callContainer.equals(ev.getSource())) {
     loadSkin();
   }
 }
Ejemplo n.º 17
0
 /** Implement the propertyChange event handler for this listener */
 public void propertyChange(final PropertyChangeEvent event) {
   _activeFileChooser = (JFileChooser) event.getSource();
 }
Ejemplo n.º 18
0
 /** {@inheritDoc} */
 @Override
 public void propertyChange(PropertyChangeEvent e) {
   if (SynthLookAndFeel.shouldUpdateStyle(e)) {
     updateStyle((AbstractButton) e.getSource());
   }
 }