Ejemplo n.º 1
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.º 2
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);
        }
      }
  /**
   * 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);
      }
    }
  }
Ejemplo n.º 4
0
 @Override
 public void propertyChange(PropertyChangeEvent evt) {
   if (evt.getSource() != beanHelper.getBean()
       || evt.getPropagationId() == JBeanEditor.class) {
     return;
   }
   refresh();
 }
Ejemplo n.º 5
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.º 6
0
 public void propertyChange(PropertyChangeEvent e) {
   String prop = e.getPropertyName();
   if (prop == JFileChooser.SELECTED_FILE_CHANGED_PROPERTY) {
     if (isShowing()) {
       loadImage((File) e.getNewValue());
       repaint();
     }
   }
 }
 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.º 8
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.º 9
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.º 10
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.º 11
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.º 12
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.º 13
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();
     }
   }
 }
  //
  //  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.º 15
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.º 16
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.º 17
0
  //
  //  Implement the PropertyChangeListener
  //
  public void propertyChange(PropertyChangeEvent e) {
    //  Keep the row table in sync with the main table

    if ("selectionModel".equals(e.getPropertyName())) {
      setSelectionModel(main.getSelectionModel());
    }

    if ("rowHeight".equals(e.getPropertyName())) {
      repaint();
    }

    if ("model".equals(e.getPropertyName())) {
      main.getModel().addTableModelListener(this);
      revalidate();
    }
  }
Ejemplo n.º 18
0
  public void propertyChange(PropertyChangeEvent e) {
    String prop = e.getPropertyName();

    if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) fc.setSelectedFile(new File(name));
    else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)
        && !fc.getSelectedFile().isDirectory()) name = fc.getSelectedFile().getName();
  }
    /**
     * Function called when an audio device is plugged or unplugged.
     *
     * @param event The property change event which may concern the audio device.
     */
    public void propertyChange(PropertyChangeEvent event) {
      if (DeviceConfiguration.PROP_AUDIO_SYSTEM_DEVICES.equals(event.getPropertyName())) {
        NotificationService notificationService = getNotificationService();

        if (notificationService != null) {
          // Registers only once to the  popup message notification
          // handler.
          if (!isRegisteredToPopupMessageListener) {
            isRegisteredToPopupMessageListener = true;
            managePopupMessageListenerRegistration(true);
          }

          // Fires the popup notification.
          ResourceManagementService resources = NeomediaActivator.getResources();
          Map<String, Object> extras = new HashMap<String, Object>();

          extras.put(NotificationData.POPUP_MESSAGE_HANDLER_TAG_EXTRA, this);
          notificationService.fireNotification(
              DEVICE_CONFIGURATION_HAS_CHANGED,
              resources.getI18NString("impl.media.configform" + ".AUDIO_DEVICE_CONFIG_CHANGED"),
              resources.getI18NString(
                  "impl.media.configform" + ".AUDIO_DEVICE_CONFIG_MANAGMENT_CLICK"),
              null,
              extras);
        }
      }
    }
 public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException {
   try {
     eventProcessor.processExceptionableEvent(e.getPropertyName(), new Object[] {e});
   } catch (PropertyVetoException ex) {
     throw ex;
   } catch (Exception ex) {
   }
 }
Ejemplo n.º 21
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);
    }
  }
Ejemplo n.º 22
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();
    }
  }
    public void propertyChange(PropertyChangeEvent event) {
      // session list changed
      if (event.getSource() instanceof CollabManager) {
        attachListeners();
      }

      // either session list or session status changed
      updateStatus();
    }
Ejemplo n.º 24
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.º 25
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 {@link
   * #speechActivity}.
   *
   * @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 speechActivityPropertyChange(PropertyChangeEvent ev) {
    String propertyName = ev.getPropertyName();

    if (ConferenceSpeechActivity.DOMINANT_ENDPOINT_PROPERTY_NAME.equals(propertyName)) {
      // The dominant speaker in this Conference has changed. We will
      // likely want to notify the Endpoints participating in this
      // Conference.
      dominantSpeakerChanged();
    } else if (ConferenceSpeechActivity.ENDPOINTS_PROPERTY_NAME.equals(propertyName)) {
      speechActivityEndpointsChanged();
    }
  }
Ejemplo n.º 27
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.º 28
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.º 29
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);
            }
          }
Ejemplo n.º 30
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);
 }