/** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user changed the service filter option
   if (e.getSource() == service_box) {
     service_list.setEnabled(service_box.isSelected());
     service_list.clearSelection();
     remove_service_button.setEnabled(false);
     add_service_field.setEnabled(service_box.isSelected());
     add_service_field.setText("");
     add_service_button.setEnabled(false);
   }
   // Check if the user pressed the add service button
   if ((e.getSource() == add_service_button) || (e.getSource() == add_service_field)) {
     String text = add_service_field.getText();
     if ((text != null) && (text.length() > 0)) {
       service_data.addElement(text);
       service_list.setListData(service_data);
     }
     add_service_field.setText("");
     add_service_field.requestFocus();
   }
   // Check if the user pressed the remove service button
   if (e.getSource() == remove_service_button) {
     Object[] sels = service_list.getSelectedValues();
     for (int i = 0; i < sels.length; i++) {
       service_data.removeElement(sels[i]);
     }
     service_list.setListData(service_data);
     service_list.clearSelection();
   }
 }
예제 #2
0
 private void setNumberOfEigenvalues() {
   if (sourceProducts != null && sourceProducts.length > 0) {
     if (bandList.getSelectedValues().length > 0) {
       numberOfEigenvalues.setText(String.valueOf(bandList.getSelectedValues().length));
     } else {
       numberOfEigenvalues.setText(String.valueOf(getBandNames().length));
     }
   } else {
     numberOfEigenvalues.setText(String.valueOf(paramMap.get("numPCA")));
   }
 }
예제 #3
0
  private DefaultActionGroup createActionGroup() {
    DefaultActionGroup group = new DefaultActionGroup();

    final Object[] selectedValues = myList.getSelectedValues();
    if (selectedValues.length > 0) {
      StringBuilder sb = new StringBuilder();
      for (Object o : myList.getSelectedValues()) {
        sb.append(((IMessage) o).getText());
        sb.append("\n");
      }
      group.add(new CopyToClipboardAction("Copy Text").setTextToCopy(sb.toString()));
      Object hintObj;
      if (selectedValues.length == 1
          && (hintObj = ((IMessage) selectedValues[0]).getHintObject()) != null) {
        SNodeId nodeId =
            hintObj instanceof SNodeReference ? ((SNodeReference) hintObj).getNodeId() : null;
        if (nodeId != null) {
          group.add(new CopyToClipboardAction("Copy Node Id").setTextToCopy(nodeId.toString()));
        }
      }
    }

    group.addSeparator();

    group.add(
        new AnAction("Show Help for This Message", null, null) {
          @Override
          public void update(AnActionEvent e) {
            boolean enabled = getHelpUrlForCurrentMessage() != null;
            Presentation presentation = e.getPresentation();
            presentation.setEnabled(enabled);
            presentation.setVisible(enabled);
          }

          @Override
          public void actionPerformed(AnActionEvent e) {
            showHelpForCurrentMessage();
          }
        });

    group.addSeparator();
    populateActions(myList, group);
    group.addSeparator();

    group.add(
        new AnAction("Clear", null, null) {
          @Override
          public void actionPerformed(AnActionEvent e) {
            clear();
          }
        });

    return group;
  }
예제 #4
0
 public void receiveMsg(Message msg) {
   // System.out.println(msg.getSubject() + " : " + msg.getBody());
   String subject = msg.getSubject();
   if (subject != null) {
     if (subject.equals("online")) {
       onlineUsers.addElement(new HostItem(msg.getBody()));
       displayMessage(msg.getBody() + " : Online", onlineClientAttrSet);
     } else if (subject.equals("offline")) {
       onlineUsers.removeElement(new HostItem(msg.getBody()));
       displayMessage(msg.getBody() + " : Offline", offlineClientAttrSet);
     } else if (subject.equals("eavesdrop enabled")) {
       Object[] values = jListOnlineUsers.getSelectedValues();
       if (values == null) return;
       for (int i = 0; i < values.length; i++) {
         ((HostItem) values[i]).eavesDroppingEnabled = true;
       }
       jListOnlineUsers.updateUI();
     } else if (subject.equals("eavesdrop disabled")) {
       Object[] values = jListOnlineUsers.getSelectedValues();
       if (values == null) return;
       for (int i = 0; i < values.length; i++) {
         ((HostItem) values[i]).eavesDroppingEnabled = false;
       }
       jListOnlineUsers.updateUI();
     } else if (subject.equals("globaleavesdrop enabled")) {
       displayMessage("Global Eavesdropping Enabled", onlineClientAttrSet);
     } else if (subject.equals("globaleavesdrop disabled")) {
       displayMessage("Global Eavesdropping Disabled", offlineClientAttrSet);
     } else {
       String to = msg.getTo();
       String from = msg.getFrom() == null ? "server" : msg.getFrom();
       String body = msg.getBody() != null ? msg.getBody() : "";
       if (jTextFieldUser.getText().equals(to)) { // this message is sent to us
         displayMessage(subject, from, body, incomingMsgAttrSet);
       } else { // this is an eavesdrop message
         displayMessage(subject, to, from, body, eavesdropAttrSet);
       }
     }
   } else {
     subject = "";
     String to = msg.getTo();
     String from = msg.getFrom() == null ? "server" : msg.getFrom();
     String body = msg.getBody() != null ? msg.getBody() : "";
     if (jTextFieldUser.getText().equals(to)) { // this message is sent to us
       displayMessage(subject, from, body, incomingMsgAttrSet);
     } else { // this is an eavesdrop message
       displayMessage(subject, to, from, body, eavesdropAttrSet);
     }
   }
 }
예제 #5
0
    @Override
    @SuppressWarnings({"deprecation", "unchecked"}) // FIXME in Java7
    public void mousePressed(MouseEvent e) {
      if (!enabled && e.getClickCount() == 1 && !e.isConsumed()) {
        enabled = true;
      }

      if (enabled) {
        JList source = (JList) e.getSource();
        if ((e.getButton() == MouseEvent.BUTTON3 || e.isPopupTrigger())) {
          int index = source.locationToIndex(e.getPoint());
          BuildableType type = (BuildableType) source.getModel().getElementAt(index);
          getGUI().showColopediaPanel(type.getId());
        } else if ((e.getClickCount() > 1 && !e.isConsumed())) {
          DefaultListModel model = (DefaultListModel) buildQueueList.getModel();
          if (source.getSelectedIndex() == -1) {
            source.setSelectedIndex(source.locationToIndex(e.getPoint()));
          }
          for (Object type : source.getSelectedValues()) {
            if (add) {
              model.addElement(type);
            } else {
              model.removeElement(type);
            }
          }
          updateAllLists();
        }
      }
    }
예제 #6
0
 private void clearDestinationSelected() {
   Object selected[] = destList.getSelectedValues();
   for (int i = selected.length - 1; i >= 0; --i) {
     destListModel.removeElement(selected[i]);
   }
   destList.getSelectionModel().clearSelection();
 }
예제 #7
0
 /**
  * Shows a dialog that enables the user to select audio input devices.
  *
  * @param multipleSelectionAllowed if <code>true</code>, indicates that more than one output
  *     device can be selected.
  * @return The selected <code>AudioDeviceDescriptor</code>s as an array, or <code>null</code> if
  *     the dialog was cancelled.
  */
 public static AudioDeviceDescriptor[] showSelectAudioInputDeviceDialog(
     boolean multipleSelectionAllowed) {
   JList list =
       new JList(
           SgEngine.getInstance()
               .getProperties()
               .getAudioInputDeviceList()
               .getDeviceDescriptors());
   list.setSelectionMode(
       multipleSelectionAllowed
           ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
           : ListSelectionModel.SINGLE_SELECTION);
   Object[] message = new Object[] {new JScrollPane(list)};
   int option =
       JOptionPane.showConfirmDialog(
           getMainFrame(),
           message,
           SgEngine.getInstance().getResourceBundle().getString("device.select.input.audio"),
           JOptionPane.OK_CANCEL_OPTION,
           JOptionPane.PLAIN_MESSAGE,
           null);
   if (option == JOptionPane.OK_OPTION) {
     Object[] o = list.getSelectedValues();
     AudioDeviceDescriptor[] result = new AudioDeviceDescriptor[o.length];
     for (int i = 0; i < o.length; i++) {
       result[i] = (AudioDeviceDescriptor) o[i];
     }
     return result;
   }
   return null;
 }
예제 #8
0
 /**
  * Shows a dialog that allows the user to select a VST plugin from list that displays all
  * VSTPlugins that are available in the system.
  *
  * @param preSelection The pre-selected element.
  * @return A <code>VstPlugin</code> if the user selcted one, or <code>null</code> if the user
  *     selected none or cancelled the dialog.
  */
 public static VstPluginDescriptor showSelectVstPluginDialog(VstPluginDescriptor preSelection) {
   VstPluginDescriptor[] vstPlugins = VstContainer.getInstance().getAllVstPluginDescriptors();
   VstItem[] items = new VstItem[vstPlugins.length];
   VstItem sel = null;
   for (int i = 0; i < vstPlugins.length; i++) {
     items[i] = new VstItem(vstPlugins[i]);
     if (vstPlugins[i] == preSelection) {
       sel = items[i];
     }
   }
   JList list = new JList(items);
   list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   if (sel != null) {
     list.setSelectedValue(sel, true);
   }
   Object[] message = new Object[] {new JScrollPane(list)};
   int option =
       JOptionPane.showConfirmDialog(
           getMainFrame(),
           message,
           SgEngine.getInstance().getResourceBundle().getString("vstplugin.select"),
           JOptionPane.OK_CANCEL_OPTION,
           JOptionPane.PLAIN_MESSAGE,
           null);
   if (option == JOptionPane.OK_OPTION) {
     Object[] o = list.getSelectedValues();
     if (o != null && o.length > 0) {
       VstPluginDescriptor result = ((VstItem) o[0]).vstPlugin;
       return result;
     }
   }
   return null;
 }
예제 #9
0
 public Set<ModuleReference> getSelectedModules() {
   HashSet<ModuleReference> res = new HashSet<ModuleReference>();
   for (Object o : myList.getSelectedValues()) {
     res.add((ModuleReference) o);
   }
   return res;
 }
예제 #10
0
 /**
  * Shows a dialog that allows the user to select an Audio Unit from list that displays all
  * AudioUnits that are available in the system.
  *
  * @param preSelection The pre-selected element.
  * @return An <code>AudioUnitDescriptor</code> if the user selcted one, or <code>null</code> if
  *     the user selected none or cancelled the dialog.
  */
 public static AudioUnitDescriptor showSelectAudioUnitDialog(AudioUnitDescriptor preSelection) {
   AudioUnitDescriptor[] audioUnits = AUContainer.getInstance().getAllAudioUnitDescriptors();
   AuItem[] items = new AuItem[audioUnits.length];
   AuItem sel = null;
   for (int i = 0; i < audioUnits.length; i++) {
     items[i] = new AuItem(audioUnits[i]);
     if (audioUnits[i] == preSelection) {
       sel = items[i];
     }
   }
   JList list = new JList(items);
   list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   if (sel != null) {
     list.setSelectedValue(sel, true);
   }
   Object[] message = new Object[] {new JScrollPane(list)};
   int option =
       JOptionPane.showConfirmDialog(
           getMainFrame(),
           message,
           SgEngine.getInstance().getResourceBundle().getString("audiounit.select"),
           JOptionPane.OK_CANCEL_OPTION,
           JOptionPane.PLAIN_MESSAGE,
           null);
   if (option == JOptionPane.OK_OPTION) {
     Object[] o = list.getSelectedValues();
     if (o != null && o.length > 0) {
       AudioUnitDescriptor result = ((AuItem) o[0]).audioUnit;
       return result;
     }
   }
   return null;
 }
예제 #11
0
 private void clearSourceSelected() {
   Object selected[] = sourceList.getSelectedValues();
   for (int i = selected.length - 1; i >= 0; --i) {
     sourceListModel.removeElement(selected[i]);
   }
   sourceList.getSelectionModel().clearSelection();
 }
  /** Called when the user presses Next on this panel */
  public void exitingToRight() throws Exception {
    // ponemos en un objeto listaTablas las capas qeu se utilizan

    // DefaultListModel recuperar = (DefaultListModel) lstCapas.getModel();

    java.util.List listaTablasInformes = null;
    GeopistaObjetoInformeDatosGenerales objetoDatosGenerales =
        new GeopistaObjetoInformeDatosGenerales();
    listaTablasInformes = Arrays.asList(lstCapas.getSelectedValues());

    // Pasamos los datos al objeto
    objetoDatosGenerales.setCapas(listaTablasInformes);
    objetoDatosGenerales.setModulo((String) cmbModulos.getSelectedItem());
    objetoDatosGenerales.setTitulo(txtTituloInforme.getText());
    if (optVertical.isSelected()) {
      objetoDatosGenerales.setOrientacion(optVertical.getText());
    } else {
      objetoDatosGenerales.setOrientacion(optHorizontal.getText());
    }

    objetoDatosGenerales.setNombreFichero(txtNombreFichero.getText());
    objetoDatosGenerales.setDescripcion(txtDescripcion.getText());

    blackboardInformes.put("datosGenerales", objetoDatosGenerales);
  }
예제 #13
0
파일: List.java 프로젝트: Baschdl578/SWT
  public void removePictures() {
    entrys.removeAll();
    v_file.removeAllElements();
    v_names.removeAllElements();

    entrys.getSelectedValues();
  }
예제 #14
0
  /** deletes the chosen attributes */
  public void deleteAttributes() {
    ListSelectorDialog dialog;
    ArffSortedTableModel model;
    Object[] atts;
    int[] indices;
    int i;
    JList list;
    int result;

    list = new JList(getAttributes());
    dialog = new ListSelectorDialog(null, list);
    result = dialog.showDialog();

    if (result != ListSelectorDialog.APPROVE_OPTION) return;

    atts = list.getSelectedValues();

    // really?
    if (ComponentHelper.showMessageBox(
            getParent(),
            "Confirm...",
            "Do you really want to delete these " + atts.length + " attributes?",
            JOptionPane.YES_NO_OPTION,
            JOptionPane.QUESTION_MESSAGE)
        != JOptionPane.YES_OPTION) return;

    model = (ArffSortedTableModel) m_TableArff.getModel();
    indices = new int[atts.length];
    for (i = 0; i < atts.length; i++) indices[i] = model.getAttributeColumn(atts[i].toString());

    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    model.deleteAttributes(indices);
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
  }
예제 #15
0
 public void nextPressed() {
   Object[] selValues = list.getSelectedValues();
   for (int i = 0; i < selValues.length; i++) {
     URI curURI = (URI) selValues[i];
     Repository rep = getImportWizard().getOWLModel().getRepositoryManager().getRepository(curURI);
     getImportWizard().getImportData().addImportEntry(new RepositoryImportEntry(curURI, rep));
   }
 }
예제 #16
0
파일: List.java 프로젝트: Baschdl578/SWT
  public Vector<File> getSelectedValues() {
    Vector<File> files = new Vector<File>();
    Object e[] = entrys.getSelectedValues();

    for (int i = 0; i < e.length; i++) files.addElement((File) e[i]);

    return files;
  }
예제 #17
0
  /** _more_ */
  private void getSelectedTimes() {
    if (isHourly()) {
      Object[] selects = chartTimeBox.getSelectedValues();
      if (forecastHours == null) {
        forecastHours = new ArrayList();
      }
      for (int i = 0; i < selects.length; i++) {
        Object select = selects[i];
        TwoFacedObject tfo = (TwoFacedObject) select;
        Integer hour = (Integer) tfo.getId();
        forecastHours.add(hour);
      }

    } else {
      forecastTimes = (List<DateTime>) Misc.toList(chartTimeBox.getSelectedValues());
    }
  }
예제 #18
0
 public void toggleShowMeasurements() {
   if (showMeasurements.isSelected()) {
     measurements.setStructures(currentNucId, currentStructureIdx);
     measurements.setObjects(list.getSelectedValues());
     this.container.add(measurements);
   } else this.container.remove(measurements);
   core.refreshDisplay();
 }
예제 #19
0
    public void valueChanged(ListSelectionEvent evt) {
      if (!evt.getValueIsAdjusting()) {
        JFileChooser chooser = getFileChooser();
        FileSystemView fsv = chooser.getFileSystemView();
        JList list = (JList) evt.getSource();

        int fsm = chooser.getFileSelectionMode();
        boolean useSetDirectory = usesSingleFilePane && (fsm == JFileChooser.FILES_ONLY);

        if (chooser.isMultiSelectionEnabled()) {
          File[] files = null;
          Object[] objects = list.getSelectedValues();
          if (objects != null) {
            if (objects.length == 1
                && ((File) objects[0]).isDirectory()
                && chooser.isTraversable(((File) objects[0]))
                && (useSetDirectory || !fsv.isFileSystem(((File) objects[0])))) {
              setDirectorySelected(true);
              setDirectory(((File) objects[0]));
            } else {
              ArrayList<File> fList = new ArrayList<File>(objects.length);
              for (Object object : objects) {
                File f = (File) object;
                boolean isDir = f.isDirectory();
                if ((chooser.isFileSelectionEnabled() && !isDir)
                    || (chooser.isDirectorySelectionEnabled() && fsv.isFileSystem(f) && isDir)) {
                  fList.add(f);
                }
              }
              if (fList.size() > 0) {
                files = fList.toArray(new File[fList.size()]);
              }
              setDirectorySelected(false);
            }
          }
          chooser.setSelectedFiles(files);
        } else {
          File file = (File) list.getSelectedValue();
          if (file != null
              && file.isDirectory()
              && chooser.isTraversable(file)
              && (useSetDirectory || !fsv.isFileSystem(file))) {

            setDirectorySelected(true);
            setDirectory(file);
            if (usesSingleFilePane) {
              chooser.setSelectedFile(null);
            }
          } else {
            setDirectorySelected(false);
            if (file != null) {
              chooser.setSelectedFile(file);
            }
          }
        }
      }
    }
예제 #20
0
 private void saveCurrentSelection() {
   System.out.println("Saving current selection");
   if (!delimitSelection()) return;
   // Now we have valid start and end times
   File saveWav = new File(extractedWavDir, saveFilename.getText() + db.getProp(db.WAVEXT));
   File saveLab = new File(extractedLabDir, saveFilename.getText() + db.getProp(db.LABEXT));
   AudioInputStream selectedAudio = getSelectedAudio();
   try {
     // Write audio extract:
     AudioSystem.write(selectedAudio, AudioFileFormat.Type.WAVE, saveWav);
     System.out.println("Wrote audio to " + saveWav.getAbsolutePath());
     // Write label file extract:
     Object[] selection = labels.getSelectedValues();
     PrintWriter toLab = new PrintWriter(new FileWriter(saveLab));
     // these header lines, by the way, serve no discernible purpose here:
     toLab.println("separator ;");
     toLab.println("nfields 1");
     toLab.println("#");
     for (int i = 0; i < selection.length; i++) {
       String[] parts = ((String) selection[i]).trim().split("\\s+");
       double time = Double.parseDouble(parts[0]);
       double newTime = time - tStart;
       parts[0] = new PrintfFormat(Locale.ENGLISH, "%.5f").sprintf(newTime);
       for (int j = 0; j < parts.length; j++) {
         if (j > 0) toLab.print("    ");
         toLab.print(parts[j]);
       }
       toLab.println();
     }
     toLab.close();
     System.out.println("Wrote labels to " + saveLab.getAbsolutePath());
     // Optionally, write pitchmark extract:
     if (pitchmarks != null) {
       int firstpm = -1;
       int lastPlus1pm = -1;
       for (int i = 0; i < pitchmarks.length; i++) {
         if (firstpm == -1) {
           if (pitchmarks[i] > tStart) firstpm = i;
         } else if (lastPlus1pm == -1) {
           if (pitchmarks[i] > tEnd) lastPlus1pm = i;
         }
       }
       if (lastPlus1pm == -1) lastPlus1pm = pitchmarks.length;
       float[] pmExtract = new float[lastPlus1pm - firstpm];
       for (int i = 0; i < pmExtract.length; i++) {
         pmExtract[i] = (float) (pitchmarks[firstpm + i] - tStart);
       }
       String extractedPmFile = extractedPmDir + saveFilename.getText() + db.getProp(PMEXT);
       new ESTTrackWriter(pmExtract, null, "pitchmarks")
           .doWriteAndClose(extractedPmFile, false, false);
       System.out.println("Wrote pitchmarks to " + extractedPmFile);
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
예제 #21
0
  private Collection<Config.ConfigEntry> getSelectedCharacters() {
    final Collection<Config.ConfigEntry> entries = new ArrayList<Config.ConfigEntry>();

    Object[] selectedValues = herolabsCharacterList.getSelectedValues();
    for (Object object : selectedValues) {
      entries.add(config.getOrCreate(((Character) object).getName()));
    }

    return entries;
  }
 public void valueChanged(ListSelectionEvent e) {
   if (e.getValueIsAdjusting() == false) {
     Object[] tcs = list.getSelectedValues();
     typeCodes = new ArrayList<String>();
     for (int i = 0; i < tcs.length; i++) {
       String typeCode = (String) tcs[i];
       typeCodes.add(typeCode);
     }
   }
 }
예제 #23
0
 protected Transferable createTransferable(JComponent c) {
   JList lista = (JList) c;
   origem = c;
   Sistema[] sistemas = null;
   if (lista.getSelectedIndices() != null && lista.getSelectedIndices().length > 0) {
     sistemas = new Sistema[lista.getSelectedIndices().length];
     System.arraycopy(
         lista.getSelectedValues(), 0, sistemas, 0, lista.getSelectedIndices().length);
   }
   return new SistemaTransferable(sistemas);
 }
예제 #24
0
  private void showContextMenu(JList characterList, MouseEvent mouseEvent) {
    // TODO: handle right-click outside of selected range correctly (should treat as single
    // selection, but not deselect)
    boolean multipleSelected = herolabsCharacterList.getSelectedValues().length > 1;
    if (mouseEvent.isPopupTrigger() && mouseEvent.getClickCount() == 1) {
      if (!multipleSelected) {
        herolabsCharacterList.setSelectedIndex(
            herolabsCharacterList.locationToIndex(mouseEvent.getPoint()));
      }

      if (contextMenuEnabled) {
        JPopupMenu menu = new JPopupMenu();
        JMenuItem menuItem;

        menuItem = new JMenuItem("Configure character" + (multipleSelected ? "s" : "") + "...");
        menuItem.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent actionEvent) {
                configureSelectedCharacters();
              }
            });
        menu.add(menuItem);

        menuItem = new JMenuItem("Configure using portfolio defaults");
        menuItem.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent actionEvent) {
                resetToDefaultsForSelectedCharacters();
              }
            });
        menu.add(menuItem);

        menuItem = new JMenuItem("Export character" + (multipleSelected ? "s" : ""));
        menuItem.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent actionEvent) {
                exportSelectedCharacters();
              }
            });
        menu.add(menuItem);

        menuItem = new JMenuItem("Clear configuration" + (multipleSelected ? "s" : ""));
        menuItem.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent actionEvent) {
                clearConfigForSelectedCharacters();
              }
            });
        menu.add(menuItem);

        menu.show(characterList, mouseEvent.getX(), mouseEvent.getY());
      }
    }
  }
예제 #25
0
 public String getValue() {
   final Object[] selectedValues = comp.getSelectedValues();
   final StringBuilder sb = new StringBuilder();
   for (int i = 0; i < selectedValues.length; i++) {
     sb.append(selectedValues[i]);
     if (i + 1 != selectedValues.length) {
       sb.append(SEPARATOR);
     }
   }
   return sb.toString();
 }
예제 #26
0
 /**
  * Returns a <code>Transferable</code> suitable for wrapping the build queue.
  *
  * @param comp The source of the build queue.
  * @return A Transferable suitable for wrapping the build queue.
  */
 @Override
 @SuppressWarnings("deprecation") // FIXME in Java7
 protected Transferable createTransferable(JComponent comp) {
   if (comp instanceof JList) {
     source = (JList) comp;
     indices = source.getSelectedIndices();
     List<BuildableType> buildQueue = getBuildableTypes(source.getSelectedValues());
     return new BuildQueueTransferable(buildQueue);
   } else {
     return null;
   }
 }
  private void left() {
    Object[] o = rlist.getSelectedValues();
    if (o != null) {
      //			DefaultListModel ldlm = (DefaultListModel)llist.getModel();
      //			ldlm.addElement(o);
      //			llist.setSelectedValue(o, true);

      DefaultListModel rdlm = (DefaultListModel) rlist.getModel();
      for (Object element : o) {
        rdlm.removeElement(element);
      }
    }
  }
  static List<Bookmark> getSelectedBookmarks(JList list) {
    List<Bookmark> answer = new ArrayList<Bookmark>();

    //noinspection deprecation
    for (Object value : list.getSelectedValues()) {
      if (value instanceof BookmarkItem) {
        answer.add(((BookmarkItem) value).getBookmark());
      } else {
        return Collections.emptyList();
      }
    }

    return answer;
  }
예제 #29
0
 protected HashMap<Integer, ArrayList<Object3DGui>> getSplitSelection() {
   System.out.println(
       "get split selection: currenChannels==null?" + (this.currentChannels == null));
   if (this.currentChannels == null) return new HashMap<Integer, ArrayList<Object3DGui>>(0);
   HashMap<Integer, ArrayList<Object3DGui>> res =
       new HashMap<Integer, ArrayList<Object3DGui>>(this.currentChannels.length);
   for (ObjectStructure ass : currentChannels) res.put(ass.getIdx(), new ArrayList<Object3DGui>());
   for (Object o : list.getSelectedValues()) {
     Object3DGui o3D = (Object3DGui) (o);
     int idx = o3D.getChannel().getIdx();
     res.get(idx).add(o3D);
   }
   return res;
 }
  protected List<String> getSelectedValues() {
    Object[] objects = list.getSelectedValues();
    if (objects == null || objects.length == 0) {
      return Collections.emptyList();
    }

    List<String> nodes = new ArrayList<String>();

    for (int index = 0; index < objects.length; index++) {
      Object object = objects[index];
      nodes.add((String) object);
    }

    return nodes;
  }