예제 #1
0
 public void valueChanged(ListSelectionEvent e) {
   if (!e.getValueIsAdjusting()) {
     if (userInputListener.isModified()) {
       // the user has modified the config, but not stored it
       int decision =
           JOptionPane.showConfirmDialog(
               this,
               "The configuration for project '"
                   + selectedProjectName
                   + "' has unsaved changes. Do you wish to save them?",
               "Save Changes?",
               JOptionPane.YES_NO_CANCEL_OPTION);
       if (decision == JOptionPane.YES_OPTION) { // store
         try {
           storeConfig(false);
         } catch (Exception ex) {
           Main.fatalError(ex);
         }
       }
       if (decision == JOptionPane.CANCEL_OPTION) {
         selection.removeListSelectionListener(this);
         selection.setSelectedValue(selectedProjectName, true);
         selection.addListSelectionListener(this);
         return;
       }
     }
     selectedProjectName = (String) selection.getSelectedValue();
     generateGUIGonfiguration(selectedProjectName);
     generateGUIDescription(selectedProjectName);
   }
 }
예제 #2
0
  public void valueChanged(ListSelectionEvent e) {

    if (e.getSource() == typeList) {
      typeList.removeListSelectionListener(this);
      objectType = typeList.getSelectedIndex();
      // fldName.setText("");
      createNewGeo();
      typeList.addListSelectionListener(this);
    }
  }
예제 #3
0
  protected void detachFrom(Component jc) {
    listenedTo.remove(jc);
    if (extListener != null && extListener.accept(jc)) {
      extListener.stopListeningTo(jc);
    }
    if (isProbablyAContainer(jc)) {
      detachFromHierarchyOf((Container) jc);
    } else if (jc instanceof JList) {
      ((JList) jc).removeListSelectionListener(this);
    } else if (jc instanceof JComboBox) {
      ((JComboBox) jc).removeActionListener(this);
    } else if (jc instanceof JTree) {
      ((JTree) jc).getSelectionModel().removeTreeSelectionListener(this);
    } else if (jc instanceof JToggleButton) {
      ((AbstractButton) jc).removeActionListener(this);
    } else if (jc instanceof JTextComponent) {
    } else if (jc
        instanceof JFormattedTextField) { // JFormattedTextField must be tested before JTextCompoent
      jc.removePropertyChangeListener("value", this);
      ((JTextComponent) jc).getDocument().removeDocumentListener(this);
    } else if (jc instanceof JColorChooser) {
      ((JColorChooser) jc).getSelectionModel().removeChangeListener(this);
    } else if (jc instanceof JSpinner) {
      ((JSpinner) jc).removeChangeListener(this);
    } else if (jc instanceof JSlider) {
      ((JSlider) jc).removeChangeListener(this);
    } else if (jc instanceof JTable) {
      ((JTable) jc).getSelectionModel().removeListSelectionListener(this);
    }

    if (accept(jc) && !(jc instanceof JPanel)) {
      jc.removePropertyChangeListener("name", this);
      Object key = wizardPage.getMapKeyFor(jc);

      if (key != null) {
        if (logger.isLoggable(Level.FINE)) {
          logger.fine(
              "Named component removed from hierarchy: "
                  + // NOI18N
                  key
                  + ".  Removing any corresponding "
                  + // NOI18N
                  "value from the wizard settings map."); // NOI18N
        }

        wizardPage.removeFromMap(key);
      }
    }

    if (logger.isLoggable(Level.FINE) && accept(jc)) {
      logger.fine("Stop listening to " + jc); // NOI18N
    }
  }