コード例 #1
0
 private String getQuestionMessage(
     PropertyChangeEvent e, Question question, ExoSocialActivity comment) {
   String questionDetail = ActivityUtils.processContent(question.getDetail());
   if ("questionName".equals(e.getPropertyName())) {
     String questionName = question.getQuestion();
     I18NActivityUtils.addResourceKey(
         comment,
         "question-update-title",
         CommonUtils.decodeSpecialCharToHTMLnumberIgnore(questionName));
     return "Title has been updated to: "
         + CommonUtils.decodeSpecialCharToHTMLnumber(questionName);
   } else if ("questionDetail".equals(e.getPropertyName())) {
     I18NActivityUtils.addResourceKey(comment, "question-update-detail", questionDetail);
     return "Details has been edited to: " + questionDetail;
   } else if ("questionActivated".equals(e.getPropertyName())) {
     if (question.isActivated()) {
       I18NActivityUtils.addResourceKey(comment, "question-activated", null);
       return "Question has been activated.";
     } else {
       I18NActivityUtils.addResourceKey(comment, "question-unactivated", null);
       return "Question has been unactivated.";
     }
   } else if ("questionAttachment".equals(e.getPropertyName())) {
     I18NActivityUtils.addResourceKey(comment, "question-add-attachment", null);
     return "Attachment(s) has been added.";
   } else { // case of add new language
     int length = question.getMultiLanguages().length;
     I18NActivityUtils.addResourceKey(
         comment, "question-add-language", question.getMultiLanguages()[length - 1].getLanguage());
     return "Question has been added in " + question.getMultiLanguages()[length - 1].getLanguage();
   }
 }
コード例 #2
0
 public void propertyChange(PropertyChangeEvent e) {
   if (Control.showProperty)
     log.debug(
         "Property change {} old: {} new: {}",
         e.getPropertyName(),
         e.getOldValue(),
         e.getNewValue());
   if (e.getPropertyName().equals(TrainScheduleManager.LISTLENGTH_CHANGED_PROPERTY)
       || e.getPropertyName().equals(TrainSchedule.NAME_CHANGED_PROPERTY)) {
     updateControlPanel();
   }
   if (e.getPropertyName().equals(TrainManager.PRINTPREVIEW_CHANGED_PROPERTY)) {
     setPrintButtonText();
     setSwitchListButtonText();
   }
   if (e.getPropertyName().equals(TrainManager.TRAINS_BUILT_CHANGED_PROPERTY)) {
     switchListsButton.setEnabled(true);
   }
   if (e.getPropertyName().equals(Setup.REAL_TIME_PROPERTY_CHANGE)) {
     setSwitchListButtonText();
   }
   if (e.getPropertyName().equals(Location.STATUS_CHANGED_PROPERTY)
       || e.getPropertyName().equals(Location.SWITCHLIST_CHANGED_PROPERTY)) {
     updateSwitchListButton();
   }
 }
コード例 #3
0
  /**
   * Invoked when a property changes. <code>MetalRootPaneUI</code> is primarily interested in events
   * originating from the <code>JRootPane</code> it has been installed on identifying the property
   * <code>windowDecorationStyle</code>. If the <code>windowDecorationStyle</code> has changed to a
   * value other than <code>JRootPane.NONE</code>, this will add a <code>Component</code> to the
   * <code>JRootPane</code> to render the window decorations, as well as installing a <code>Border
   * </code> on the <code>JRootPane</code>. On the other hand, if the <code>windowDecorationStyle
   * </code> has changed to <code>JRootPane.NONE</code>, this will remove the <code>Component</code>
   * that has been added to the <code>JRootPane</code> as well resetting the Border to what it was
   * before <code>installUI</code> was invoked.
   *
   * @param e A PropertyChangeEvent object describing the event source and the property that has
   *     changed.
   */
  public void propertyChange(PropertyChangeEvent e) {
    super.propertyChange(e);

    String propertyName = e.getPropertyName();
    if (propertyName == null) {
      return;
    }

    if (propertyName.equals("windowDecorationStyle")) {
      JRootPane root = (JRootPane) e.getSource();
      int style = root.getWindowDecorationStyle();

      // This is potentially more than needs to be done,
      // but it rarely happens and makes the install/uninstall process
      // simpler. MetalTitlePane also assumes it will be recreated if
      // the decoration style changes.
      uninstallClientDecorations(root);
      if (style != JRootPane.NONE) {
        installClientDecorations(root);
      }
    } else if (propertyName.equals("ancestor")) {
      uninstallWindowListeners(root);
      if (((JRootPane) e.getSource()).getWindowDecorationStyle() != JRootPane.NONE) {
        installWindowListeners(root, root.getParent());
      }
    }
    return;
  }
コード例 #4
0
 @Override
 public void propertyChange(PropertyChangeEvent evt) {
   if (evt.getPropertyName().equals(PreviewUIController.SELECT)
       || evt.getPropertyName().equals(PreviewUIController.UNSELECT)) {
     setup();
   }
 }
コード例 #5
0
ファイル: ButtonPanel.java プロジェクト: automenta/lojix
  /**
   * Called when a property in the WorkPanelState is changed. This method calls initPanels to
   * rebuild the user interface to reflect the current application state.
   *
   * @param event The work panel state change event. All other event types are ignored.
   */
  public void propertyChange(PropertyChangeEvent event) {
    /*log.fine("void propertyChange(PropertyChangeEvent): called");*/

    // Check that the property change was sent by a WorkPanelState
    if (event.getSource() instanceof WorkPanelState) {
      // Get the state
      String state = ((WorkPanelState) event.getSource()).getState();

      // Check what the state to set is
      if (state.equals(WorkPanelState.NOT_SAVED)) {
        // Set the Cancel and Apply buttons to enabled
        cancelButton.setEnabled(true);
        applyButton.setEnabled(true);
      } else if (state.equals(WorkPanelState.READY)) {
        // Set the Cancel and Apply buttons to disabled
        cancelButton.setEnabled(false);
        applyButton.setEnabled(false);
      } else if (state.equals(WorkPanelState.NOT_INITIALIZED)) {
        // Disable all the buttons
        okButton.setEnabled(false);
        cancelButton.setEnabled(false);
        applyButton.setEnabled(false);
      }
    }
  }
コード例 #6
0
ファイル: GeoImageLayer.java プロジェクト: codesman/josm
 @Override
 public void propertyChange(PropertyChangeEvent evt) {
   if (NavigatableComponent.PROPNAME_CENTER.equals(evt.getPropertyName())
       || NavigatableComponent.PROPNAME_SCALE.equals(evt.getPropertyName())) {
     updateOffscreenBuffer = true;
   }
 }
コード例 #7
0
  public void propertyChange(PropertyChangeEvent e) {
    // System.out.println(e.getPropertyName());
    if (e.getSource() == wdfKW.getDisplay()
        && e.getNewValue() instanceof Date
        && e.getPropertyName().equals("date")) {
      wbuZeitenAbschliessen.setEnabled(false);
      Date d = (Date) e.getNewValue();

      Timestamp[] tVonBis = Helper.getTimestampVonBisEinerKW(new Timestamp(d.getTime()));

      wdfKW.setDate(d);
      //

      Calendar c = Calendar.getInstance();
      c.setTimeInMillis(wdfKW.getDate().getTime());
      try {
        wlaKW.setText(
            "KW: "
                + c.get(Calendar.WEEK_OF_YEAR)
                + "/"
                + Helper.berechneJahrDerKW(c)
                + " ("
                + Helper.formatDatum(tVonBis[0], LPMain.getTheClient().getLocUi())
                + "-"
                + Helper.formatDatum(tVonBis[1], LPMain.getTheClient().getLocUi())
                + ")");
      } catch (Throwable e1) {

        e1.printStackTrace();
      }
    }
  }
コード例 #8
0
    public void propertyChange(PropertyChangeEvent e) {
      log.finer("Property change event on local service: " + e.getPropertyName());

      // Prevent recursion
      if (e.getPropertyName().equals(EVENTED_STATE_VARIABLES)) return;

      String[] variableNames = ModelUtil.fromCommaSeparatedList(e.getPropertyName());
      log.fine("Changed variable names: " + Arrays.toString(variableNames));

      try {
        Collection<StateVariableValue> currentValues = getCurrentState(variableNames);

        if (!currentValues.isEmpty()) {
          getPropertyChangeSupport()
              .firePropertyChange(EVENTED_STATE_VARIABLES, null, currentValues);
        }

      } catch (Exception ex) {
        // TODO: Is it OK to only log this error? It means we keep running although we couldn't send
        // events?
        log.log(
            Level.SEVERE,
            "Error reading state of service after state variable update event: "
                + Exceptions.unwrap(ex),
            ex);
      }
    }
コード例 #9
0
  public void propertyChange(PropertyChangeEvent evt) {
    String propertyName = evt.getPropertyName();
    if (propertyName == null) return;
    if ((!JPDABreakpoint.PROP_ENABLED.equals(propertyName))
        && (!JPDABreakpoint.PROP_VALIDITY.equals(propertyName))
        && (!LineBreakpoint.PROP_CONDITION.equals(propertyName))
        && (!LineBreakpoint.PROP_URL.equals(propertyName))
        && (!LineBreakpoint.PROP_LINE_NUMBER.equals(propertyName)) // &&
    //             (!FieldBreakpoint.PROP_CLASS_NAME.equals( propertyName )) &&
    //             (!FieldBreakpoint.PROP_FIELD_NAME.equals( propertyName )) &&
    //             (!MethodBreakpoint.PROP_CLASS_FILTERS.equals( propertyName )) &&
    //             (!MethodBreakpoint.PROP_CLASS_EXCLUSION_FILTERS.equals( propertyName )) &&
    //             (!MethodBreakpoint.PROP_METHOD_NAME.equals( propertyName )) &&
    //             (!MethodBreakpoint.PROP_METHOD_SIGNATURE.equals( propertyName )

    ) return;
    //        JPDABreakpoint b = (JPDABreakpoint) evt.getSource();
    VisageLineBreakpoint b = (VisageLineBreakpoint) evt.getSource();
    DebuggerManager manager = DebuggerManager.getDebuggerManager();
    Breakpoint[] bkpts = manager.getBreakpoints();
    boolean found = false;
    for (int x = 0; x < bkpts.length; x++) {
      if (b == bkpts[x]) {
        found = true;
        break;
      }
    }
    if (!found) {
      // breakpoint has been removed
      return;
    }
    rp.post(new AnnotationRefresh(b, true, true));
  }
 /**
  * The value changed, notifier listeners that the display string and icon have (probably) changed.
  */
 protected void valueChanged(PropertyChangeEvent e) {
   this.firePropertyChanged(
       DISPLAY_STRING_PROPERTY,
       this.displayString(e.getOldValue()),
       this.displayString(e.getNewValue()));
   this.firePropertyChanged(ICON_PROPERTY, this.icon(e.getOldValue()), this.icon(e.getNewValue()));
 }
コード例 #11
0
ファイル: EventSupport.java プロジェクト: talios/infinitest
 public void assertStatesChanged(CoreStatus... expectedStates) {
   ArrayList<CoreStatus> actualStates = new ArrayList<CoreStatus>();
   for (PropertyChangeEvent event : propertyEvents) {
     actualStates.add((CoreStatus) event.getNewValue());
   }
   assertEquals(asList(expectedStates), actualStates);
 }
コード例 #12
0
 /**
  * Reacts to property changes fired by the{@link ServerEditor}.
  *
  * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
  */
 public void propertyChange(PropertyChangeEvent evt) {
   String name = evt.getPropertyName();
   if (ServerEditor.EDIT_PROPERTY.equals(name)) {
     Boolean value = (Boolean) evt.getNewValue();
     if (editor.isEditing()) finishButton.setEnabled(value);
     else {
       if (originalIndexSpeed == -1) {
         setControlEnabled(originalIndexSpeed);
       }
       if (buttonsGroup != null) {
         Enumeration en = buttonsGroup.getElements();
         JRadioButton button;
         int index;
         while (en.hasMoreElements()) {
           button = (JRadioButton) en.nextElement();
           if (button.isSelected()) {
             index = Integer.parseInt(button.getActionCommand());
             setControlEnabled(index);
           }
         }
       }
     }
   } else if (ServerEditor.ADD_MESSAGE_PROPERTY.equals(name)) {
     showMessagePanel(true, (JComponent) evt.getNewValue());
   } else if (ServerEditor.REMOVE_MESSAGE_PROPERTY.equals(name)) {
     showMessagePanel(false, (JComponent) evt.getNewValue());
   } else if (ServerEditor.APPLY_SERVER_PROPERTY.equals(name)) {
     apply();
   }
 }
コード例 #13
0
 @Override
 public void propertyChange(PropertyChangeEvent event) {
   boolean internal = myInternal;
   myInternal = true;
   Object value = event.getNewValue();
   if (ShortcutFilteringPanel.this == event.getSource()) {
     if (value instanceof KeyboardShortcut) {
       KeyboardShortcut shortcut = (KeyboardShortcut) value;
       myMousePanel.setShortcut(null);
       myKeyboardPanel.setShortcut(shortcut);
       if (null != shortcut.getSecondKeyStroke()) {
         myKeyboardPanel.mySecondStrokeEnable.setSelected(true);
       }
     } else {
       MouseShortcut shortcut =
           value instanceof MouseShortcut ? (MouseShortcut) value : null;
       String text = shortcut == null ? null : KeymapUtil.getMouseShortcutText(shortcut);
       myMousePanel.setShortcut(shortcut);
       myKeyboardPanel.setShortcut(null);
       myKeyboardPanel.myFirstStroke.setText(text);
       myKeyboardPanel.mySecondStroke.setText(null);
       myKeyboardPanel.mySecondStroke.setEnabled(false);
     }
   } else if (value instanceof Shortcut) {
     setShortcut((Shortcut) value);
   } else if (!internal) {
     setShortcut(null);
   }
   myInternal = internal;
 }
コード例 #14
0
 private String getAnswerMessage(PropertyChangeEvent e, Answer answer, ExoSocialActivity comment) {
   String answerContent = ActivityUtils.processContent(answer.getResponses());
   if ("answerEdit".equals(e.getPropertyName())) {
     I18NActivityUtils.addResourceKey(comment, "answer-update-content", answerContent);
     return "Answer has been edited to: " + answerContent;
   } else if ("answerPromoted".equals(e.getPropertyName())) {
     I18NActivityUtils.addResourceKey(comment, "answer-promoted", answerContent);
     return "Comment " + answerContent + " has been promoted as an answer";
   } else if ("answerActivated".equals(e.getPropertyName())) {
     if (answer.getActivateAnswers()) {
       I18NActivityUtils.addResourceKey(comment, "answer-activated", answerContent);
       return "Answer has been activated: " + answerContent + ".";
     } else {
       I18NActivityUtils.addResourceKey(comment, "answer-unactivated", answerContent);
       return "Answer has been unactivated: " + answerContent + ".";
     }
   } else {
     if (answer.getApprovedAnswers()) {
       I18NActivityUtils.addResourceKey(comment, "answer-approved", answerContent);
       return "Answer has been approved: " + answerContent + ".";
     } else {
       I18NActivityUtils.addResourceKey(comment, "answer-disapproved", answerContent);
       return "Answer has been disapproved: " + answerContent + ".";
     }
   }
 }
コード例 #15
0
 @Override
 public void propertyChange(PropertyChangeEvent evt) {
   int index = model.getDataProviders().indexOf(evt.getSource());
   if (index != -1) {
     viewer.getTree().getColumn(index + 1).setText((String) evt.getNewValue());
   }
 }
コード例 #16
0
  /**
   * 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);
      }
    }
  }
コード例 #17
0
ファイル: MetalSliderUI.java プロジェクト: Blueash/gcc
 /**
  * Handles property change events. Events with the name "JSlider.isFilled" are handled here, and
  * other events are passed to the superclass.
  *
  * @param e the property change event.
  */
 public void propertyChange(PropertyChangeEvent e) {
   if (e.getPropertyName().equals(SLIDER_FILL)) {
     Boolean b = (Boolean) e.getNewValue();
     if (b == null) filledSlider = false;
     else filledSlider = b.booleanValue();
   } else super.propertyChange(e);
 }
コード例 #18
0
 public void propertyChange(PropertyChangeEvent event) {
   // update the button
   if (event.getPropertyName().equals(_property)) {
     Boolean value = (Boolean) event.getNewValue();
     _button.setSelected(value.booleanValue());
   }
 }
コード例 #19
0
 @Override
 protected void propertyChangeUI(PropertyChangeEvent evt) {
   super.propertyChangeUI(evt);
   if (evt.getPropertyName().equals("name")
       || evt.getPropertyName().equals("stage")
       || evt.getPropertyName().equals("environments")) refreshVisuals();
 }
コード例 #20
0
 public final void vetoableChange(PropertyChangeEvent ev) throws PropertyVetoException {
   if (ev.getPropertyName().equals(JInternalFrame.IS_CLOSED_PROPERTY)
       && ((Boolean) ev.getNewValue()).booleanValue()) {
     if (inClose) return;
     if (!confirmApply(true)) throw new PropertyVetoException("", ev);
   }
 }
コード例 #21
0
 /**
  * Listener method.
  *
  * @param event The property change event.
  */
 @Override
 public void propertyChange(PropertyChangeEvent event) {
   if (CreateDatabaseWorker.COMPLETE.equals(event.getPropertyName())) {
     CreateDatabaseWorker worker = (CreateDatabaseWorker) event.getSource();
     try {
       Boolean databasesCreated = worker.get();
       if (databasesCreated) {
         JOptionPane.showMessageDialog(
             CreateDatabaseDialog.this,
             Messages.getMessage("database.created.message"),
             Messages.getMessage("database.created.title"),
             JOptionPane.INFORMATION_MESSAGE);
       } else {
         showExceptionDialog(
             worker.getCreationException(),
             "database.create.fail.title",
             "database.create.fail.message");
       }
     } catch (CancellationException e) {
       // Do nothing - the user knows they cancelled it.
     } catch (ExecutionException e) {
       logger.warn("ExecutionException getting result from create database worker:", e);
     } catch (InterruptedException e) {
       // Just leave.
     }
   }
 }
コード例 #22
0
ファイル: XLabel.java プロジェクト: sjroot/framework
    public void propertyChange(PropertyChangeEvent evt) {
      String propName = evt.getPropertyName();
      Object value = evt.getNewValue();

      if ("caption".equals(propName)) {
        String text = (value == null) ? "" : value + "";
        formatText(text, activeProperty.isRequired());

      } else if ("captionMnemonic".equals(propName)) {
        setDisplayedMnemonic((value + "").charAt(0));
        formatText(activeProperty.getCaption(), activeProperty.isRequired());

      } else if ("required".equals(propName)) {
        boolean req = Boolean.parseBoolean(value + "");
        formatText(activeProperty.getCaption(), req);

      } else if ("errorMessage".equals(propName)) {
        String message = (value != null) ? value + "" : null;
        boolean error = !ValueUtil.isEmpty(message);
        if (error) {
          oldFg = getForeground();
          setForeground(Color.RED);
        } else {
          setForeground(oldFg);
        }
        setToolTipText(message);
        if (activeComponent != null) {
          activeComponent.setToolTipText(message);
        }
      }
    }
コード例 #23
0
  public void propertyChange(PropertyChangeEvent evt) {
    String prop = evt.getPropertyName();
    Object newValue = evt.getNewValue();
    Object oldValue = evt.getOldValue();

    if ("focusOwner".equals(prop) && oldValue instanceof JTextArea) {
      JTextArea freeText = (JTextArea) oldValue;
      if (freeText.equals(freeTextPane)) {
        freeText.setEditable(false);
        if (contentTextChange) {
          contentTextChange = false;
          resetAppearanceShapes();
        }
        if (freeText instanceof FreeTextArea) {
          ((FreeTextArea) freeText).setActive(false);
        }
      }
    } else if ("focusOwner".equals(prop) && newValue instanceof JTextArea) {
      JTextArea freeText = (JTextArea) newValue;
      if (freeText.equals(freeTextPane) && !annotation.getFlagReadOnly()) {
        freeText.setEditable(true);
        if (freeText instanceof FreeTextArea) {
          ((FreeTextArea) freeText).setActive(true);
        }
      }
    }
  }
コード例 #24
0
    public void propertyChange(PropertyChangeEvent e) {
      log.finer("Property change event on local service: " + e.getPropertyName());

      // Prevent recursion
      if (e.getPropertyName().equals(EVENTED_STATE_VARIABLES)) return;

      List<String> variableNames = Arrays.asList(e.getPropertyName().split(","));

      try {
        log.fine(
            "Evented state variable value changed, reading state of service: " + variableNames);
        Collection<StateVariableValue> currentValues =
            readEventedStateVariableValues(variableNames);

        if (!currentValues.isEmpty()) {
          getPropertyChangeSupport()
              .firePropertyChange(EVENTED_STATE_VARIABLES, null, currentValues);
        }

      } catch (Exception ex) {
        // TODO: Is it OK to only log this error? It means we keep running although we couldn't send
        // events?
        log.severe(
            "Error reading state of service after state variable update event: "
                + Exceptions.unwrap(ex));
        ex.printStackTrace();
      }
    }
 @Override
 public void propertyChange(PropertyChangeEvent evt) {
   if (evt.getPropertyName().equals("transitDataBundlePath")) {
     String path = (String) evt.getNewValue();
     controller.setNextButtonEnabled(!(path == null || path.isEmpty()));
   }
 }
コード例 #26
0
ファイル: JSlider.java プロジェクト: CodeingBoy/Java8CN
      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);
        }
      }
コード例 #27
0
  @Override
  public void propertyChange(PropertyChangeEvent e) {
    String propertyName = e.getPropertyName();

    // Make sure we are responding to the right event.
    if (propertyName.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) {
      File selection = (File) e.getNewValue();
      String name;

      if (selection == null) return;
      else name = selection.getAbsolutePath();

      /*
       * Make reasonably sure we have an image format that AWT can
       * handle so we don't try to draw something silly.
       */
      if (name != null) {
        String nameLower = name.toLowerCase();
        if (nameLower.endsWith(".jpg")
            || nameLower.endsWith(".jpeg")
            || nameLower.endsWith(".gif")
            || nameLower.endsWith(".png")) {

          icon = new ImageIcon(name);
          image = icon.getImage();
          scaleImage();
          repaint();
        }
      }
    }
  }
コード例 #28
0
 public void propertyChange(PropertyChangeEvent pce) {
   Object source = pce.getSource();
   if (source == posSlider_x) {
     double posX = ((Double) pce.getNewValue()).doubleValue();
     posDisk.x = posX;
     Disk.setNode3D(ShapeNodeDisk);
     Disk.setPosition(posDisk);
     PlaceBNVectors();
   } else if (source == posSlider_y) {
     double posY = ((Double) pce.getNewValue()).doubleValue();
     posDisk.y = posY;
     Disk.setNode3D(ShapeNodeDisk);
     Disk.setPosition(posDisk);
     PlaceBNVectors();
   } else if (source == angDisk) {
     angleDisk = ((Double) pce.getNewValue()).doubleValue();
     double angDisk_rad = angleDisk * Math.PI / 180.;
     double compx = Math.cos(angDisk_rad);
     double compy = Math.sin(angDisk_rad);
     Disk.setNode3D(ShapeNodeDisk);
     Disk.setDirection(new Vector3d(compx, compy, 0.));
     flux_plot.setNormalDisk(new Vector3d(compx, compy, 0.));
     PlaceBNVectors();
   } else if (source == radDisk) {
     radiusDisk = ((Double) pce.getNewValue()).doubleValue();
     ShapeNodeDisk.setGeometry(Cylinder.makeGeometry(32, radiusDisk, heightDisk));
     Disk.setNode3D(ShapeNodeDisk);
     arrowScale = arrowScaleInitial * radiusDisk / radiusDiskInitial;
     flux_plot.setRadiusDisk(radiusDisk);
     PlaceBNVectors();
   } else {
     super.propertyChange(pce);
   }
 }
コード例 #29
0
 public void propertyChange(PropertyChangeEvent evt) {
   if (!evt.getNewValue().equals(Stateful.STATE_AVAILABLE)) {
     ((Application) evt.getSource()).removePropertyChangeListener(Stateful.PROPERTY_STATE, this);
     client.disconnectImpl(false);
     availabilityListener = null;
   }
 }
コード例 #30
0
 public void propertyChange(final PropertyChangeEvent e) {
   if (myAlarm.getActiveRequestCount() == 0) {
     myInitialFocusedWindow = (Window) e.getOldValue();
     final MenuElement[] selectedPath = MenuSelectionManager.defaultManager().getSelectedPath();
     if (selectedPath.length == 0) { // there is no visible popup
       return;
     }
     Component firstComponent = null;
     for (final MenuElement menuElement : selectedPath) {
       final Component component = menuElement.getComponent();
       if (component instanceof JMenuBar) {
         firstComponent = component;
         break;
       } else if (component instanceof JPopupMenu) {
         firstComponent = ((JPopupMenu) component).getInvoker();
         break;
       }
     }
     if (firstComponent == null) {
       return;
     }
     final Window window = SwingUtilities.getWindowAncestor(firstComponent);
     if (window != myInitialFocusedWindow) { // focused window doesn't have popup
       return;
     }
   }
   myLastFocusedWindow = (Window) e.getNewValue();
   myAlarm.cancelAllRequests();
   myAlarm.addRequest(myClearSelectedPathRunnable, 150);
 }