Esempio n. 1
0
 public void valueChanged(ListSelectionEvent e) {
   if (e.getSource() == list.getSelectionModel()) {
     listChanged(e);
   } else if (e.getSource() == cmdTable.getSelectionModel()) {
     tableChanged(e);
   }
 }
  public void valueChanged(ListSelectionEvent e) {
    if (e.getSource() == fontList) {
      tempValue = (String) fontList.getSelectedValue();
      if (tempValue != null) {
        fontBox.setText(tempValue);
      } else fontBox.setText("");
    } else if (e.getSource() == styleList) {
      tempValue = (String) styleList.getSelectedValue();
      if (tempValue != null) {
        styleBox.setText(tempValue);
      } else styleBox.setText("");
    } else if (e.getSource() == sizeList) {
      tempValue = (String) sizeList.getSelectedValue();
      if (tempValue != null) {
        sizeBox.setText(tempValue);
      } else sizeBox.setText("");
    }

    if (fontValid()) {
      this.lastFont = new Font(getFontName(), getFontStyle(), getFontSize());
      this.lastColor = colorChooser.getColor();

      updatePreview();
    }
  }
 @Override
 public void valueChanged(ListSelectionEvent e) {
   if (e.getSource() instanceof JList) {
     @SuppressWarnings("unchecked")
     JList<String> list = (JList<String>) e.getSource();
     selItemJugador = list.getSelectedValue();
   }
 }
  @Override
  public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting()) return;
    ListSelectionModel lsm = (ListSelectionModel) e.getSource();
    if (e.getSource() == mapTable.getSelectionModel()) {
      mapErrorsLabel.setText("");
      if (lsm.isSelectionEmpty()) {
        mapDeleteButton.setEnabled(false);
        mapUpButton.setEnabled(false);
        mapDownButton.setEnabled(false);

        ruleTable.setModel(new DefaultTableModel());
        ruleInsertButton.setEnabled(false);
      } else {
        mapDeleteButton.setEnabled(true);

        int selrow = mapTable.getSelectedRow();
        int rows = mapTable.getRowCount();

        if (selrow > 0) mapUpButton.setEnabled(true);
        else mapUpButton.setEnabled(false);

        if (selrow < (rows - 1)) mapDownButton.setEnabled(true);
        else mapDownButton.setEnabled(false);

        MapRule maprule = this.editableSRX.getMappingRules().get(selrow);
        SegmentationRulesModel model = new SegmentationRulesModel(maprule.getRules());
        ruleTable.setModel(model);
        model.addExceptionListener(
            new ExceptionListener() {
              @Override
              public void exceptionThrown(Exception e) {
                ruleErrorsLabel.setText(e.getLocalizedMessage());
              }
            });
        ruleInsertButton.setEnabled(true);
      }
    } else if (e.getSource() == ruleTable.getSelectionModel()) {
      ruleErrorsLabel.setText("");
      if (lsm.isSelectionEmpty()) {
        ruleDeleteButton.setEnabled(false);
        ruleUpButton.setEnabled(false);
        ruleDownButton.setEnabled(false);
      } else {
        ruleDeleteButton.setEnabled(true);

        int rules = ruleTable.getRowCount();
        int rulerow = ruleTable.getSelectedRow();

        if (rulerow > 0) ruleUpButton.setEnabled(true);
        else ruleUpButton.setEnabled(false);

        if (rulerow < (rules - 1)) ruleDownButton.setEnabled(true);
        else ruleDownButton.setEnabled(false);
      }
    }
  }
Esempio n. 5
0
 public void valueChanged(ListSelectionEvent evt) {
   String tmp, ident;
   if ((ident = (String) choices.get(evt.getSource())) != null) {
     // It's a choice - get the text from the selected item
     JList list = (JList) evt.getSource();
     tmp = (String) choices.get(ident + list.getSelectedValue());
     if (tmp != null) processEvent(tmp);
   }
 }
Esempio n. 6
0
 public void valueChanged(ListSelectionEvent e) {
   ViewPane view = ViewPane.this;
   // If cell selection is enabled, both row and column change events are fired
   if (e.getSource() == view.getPacketTable().getSelectionModel()) {
     view.updateCurrentPacket();
   } else if (e.getSource() == view.getPacketTable().getColumnModel().getSelectionModel()
       && view.getPacketTable().getColumnSelectionAllowed()) {
   }
 }
 @Override
 public void valueChanged(ListSelectionEvent e) {
   if (e.getSource() instanceof JList) {
     JList list = (JList) e.getSource();
     String typeName = (String) list.getSelectedValue();
     nodePropertyParameters.propertyType = PropertyType.valueFromName(typeName);
     valueCardPanel.show(typeName);
   }
 }
 @Override
 public void valueChanged(ListSelectionEvent e) {
   if (e.getSource() instanceof JList) {
     @SuppressWarnings("unchecked")
     JList<String> list = (JList<String>) e.getSource();
     if (list.getName().equals("List_Sudokus_Modificar")) {
       selItemSudModificar = list.getSelectedValue();
     } else if (list.getName().equals("List_Sudokus_Borrar")) {
       selItemSudBorrar = list.getSelectedValue();
     }
   }
 }
Esempio n. 9
0
 public void valueChanged(ListSelectionEvent arg0) {
   if (arg0.getValueIsAdjusting()) return;
   int index = arg0.getFirstIndex();
   if (index < 0) return;
   if (arg0.getSource() == this) {
     Quest q = getSelectedValue();
     if (q != null) {
       update(q);
       if (qp.olist.getSelectedIndex() == -1) qp.op.clear();
     }
   } else if (arg0.getSource() == qp.olist) {
     Objective o = qp.olist.getSelectedValue();
     if (o != null) qp.op.loadData(o);
   }
 }
Esempio n. 10
0
    public void valueChanged(ListSelectionEvent e) {
      ListSelectionModel lsm = (ListSelectionModel) e.getSource();

      int index = list.getSelectedIndex();
      Directory dir = directoryList.getDirectory(index);

      waitField.setValue(dir.getWaitInterval());
      checkField.setValue(dir.getInterval());
      if (dir.copy) {
        copyButton.setSelected(true);
      } else {
        moveButton.setSelected(true);
      }
      if (dir.destination != null) {

        destination.setText("Destination Directory: " + dir.destination.toString());
        startButton.setEnabled(true);
        if (dir.backupNumber == 0) {
          startButton.setEnabled(true);
          stopButton.setEnabled(false);
        } else {
          startButton.setEnabled(false);
          stopButton.setEnabled(true);
        }
      } else {
        destination.setText("Destination Directory: ");
        startButton.setEnabled(false);
      }
    }
  @Override
  public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting()) {
      return;
    }
    configurationPanel.removeAll();
    ListSelectionModel m = (ListSelectionModel) e.getSource();
    // single selection, so max selection index is the only one selected.
    selectedIndex = m.getMaxSelectionIndex();

    JPanel panel = new DefaultReportConfigurationPanel();
    ReportModule module = modules.get(selectedIndex);
    boolean generalModuleSelected = false;
    if (module instanceof GeneralReportModule) {
      JPanel generalPanel = ((GeneralReportModule) module).getConfigurationPanel();
      panel = (generalPanel == null) ? new JPanel() : generalPanel;
      generalModuleSelected = true;
    }

    descriptionTextPane.setText(module.getDescription());
    configurationPanel.add(panel, BorderLayout.CENTER);
    configurationPanel.revalidate();

    wizPanel.setNext(!generalModuleSelected);
    wizPanel.setFinish(generalModuleSelected);
  }
Esempio n. 12
0
 public void valueChanged(ListSelectionEvent e) {
   if (!myIsEnabled || e.getValueIsAdjusting()) {
     return;
   }
   final JList list = (JList) e.getSource();
   processListValue(list.getSelectedValue());
 }
    @Override
    public void valueChanged(ListSelectionEvent e) {
      //            throw new UnsupportedOperationException("Not supported yet."); //To change body
      // of generated methods, choose Tools | Templates.
      try {

        if (e.getValueIsAdjusting()) {
          return;
        }
        ListSelectionModel lsm = (ListSelectionModel) e.getSource();
        if (lsm.isSelectionEmpty()) {

        } else {
          int lead = lsm.getLeadSelectionIndex();
          view.setDepartmentInfo(displayRowValues(lead));

          view.setBtnEditEnable(true);
          view.setBtnDeleteEnable(true);
          view.setBtnAddEnable(false);
        }
      } catch (Exception se) {
        JOptionPane.showMessageDialog(
            departmentView, se + "from ListSelectionListener " + getClass().getName());
      }
    }
    public void valueChanged(ListSelectionEvent e) {
      ListSelectionModel lsm = (ListSelectionModel) e.getSource();

      int firstIndex = e.getFirstIndex();
      int lastIndex = e.getLastIndex();
      boolean isAdjusting = e.getValueIsAdjusting();
      output.append(
          "Event for indexes "
              + firstIndex
              + " - "
              + lastIndex
              + "; isAdjusting is "
              + isAdjusting
              + "; selected indexes:");

      if (lsm.isSelectionEmpty()) {
        output.append(" <none>");
      } else {
        // Find out which indexes are selected.
        int minIndex = lsm.getMinSelectionIndex();
        int maxIndex = lsm.getMaxSelectionIndex();
        for (int i = minIndex; i <= maxIndex; i++) {
          if (lsm.isSelectedIndex(i)) {
            output.append(" " + i);
          }
        }
      }
      output.append(newline);
      output.setCaretPosition(output.getDocument().getLength());
    }
  public void itemSelected(ListSelectionEvent e) {

    for (int i = e.getFirstIndex(); i <= e.getLastIndex(); i++) {
      // read the manual ListSelectionEvent
      if (((javax.swing.DefaultListSelectionModel) (e.getSource())).isSelectedIndex(i)) {
        lastselected = i;
      }
    }

    if (preselected == lastselected) { // catch echos
      if (pretime - (pretime = System.currentTimeMillis()) < echotime) {
        return; // was a Echo
      }
    } else {
      preselected = lastselected;
      pretime = System.currentTimeMillis();
    }
    if (state == State.neu) {
      state = State.info;
    }
    if (state
        == State.register) { // we need another (UnknownBook)-Selection, must not make new event!
      return;
    }

    stateChanged(state);
  }
  // Implementation of valueChanged
  public void valueChanged(ListSelectionEvent e) {
    if (e.getSource() == table.getSelectionModel()) {
      ListSelectionModel ls = table.getSelectionModel();

      int index = ls.getMinSelectionIndex();
      long id = (long) table.getValueAt(index, 0);

      updateFeesData(id);
    } else {
      ListSelectionModel ls = feestable.getSelectionModel();

      int index = ls.getMinSelectionIndex();

      float feespayed = (float) feestable.getValueAt(index, 1);
      float totalfees = (float) feestable.getValueAt(index, 2);

      feespayedlabel.setText("Fees Payed: " + feespayed);
      totalfeeslabel.setText("Total Fees: " + totalfees);

      if (totalfees - feespayed > 0) {
        feesduelabel.setText("Fees Due: " + (totalfees - feespayed));
      }

      panel_6.revalidate();
    }
  }
Esempio n. 17
0
    public void valueChanged(ListSelectionEvent e) {
      ListSelectionModel lsm = (ListSelectionModel) e.getSource();

      int firstIndex = e.getFirstIndex();
      int lastIndex = e.getLastIndex();
      boolean isAdjusting = e.getValueIsAdjusting();

      if (lsm.isSelectionEmpty()) {

      } else {
        // Find out which indexes are selected.
        int selected = lsm.getMinSelectionIndex();
        int index = masterTable.convertRowIndexToModel(selected);
        EntityTableModel etm = (EntityTableModel) masterTable.getModel();
        Cita c = (Cita) etm.getBeanAt(index);

        Integer id = c.getIdCita();
        String nombreCliente = c.getCliente().getNombre() + " " + c.getCliente().getApellido();
        String nombreSesion = c.getSesion().getDescripcion();
        Date fechaCita = c.getFechaCita();
        Integer minutosMaquina = c.getDuracion();

        txtId.setText(id.toString());
        //            txtNombre.setText(nombre);
        //            txtDescripcion.setText(descripcion);
        //            txtCosto.setValue(costo);
        try {
          txtCosto.commitEdit();
        } catch (ParseException ex) {
          Logger.getLogger(CitasView.class.getName()).log(Level.SEVERE, null, ex);
        }

        modificar = true;
      }
    }
 private void ensureSingleListSelection(ListSelectionEvent e) {
   JList list = (JList) e.getSource();
   // Need to find which InstanceListPane
   InstanceListPane instanceList = figureOutInstanceListPane(list);
   // Need to clear selection in other place
   InstanceListPane[] lists =
       new InstanceListPane[] {
         changedList, newList, deleteInDBList, deleteList, localHasMoreIEList
       };
   // Remove the current selection listener to avoid bunching back
   for (int i = 0; i < lists.length; i++) {
     if (lists[i] == null) continue;
     lists[i].removeSelectionListener(selectionListener);
   }
   for (int i = 0; i < lists.length; i++) {
     if (lists[i] == null) continue;
     if (lists[i] == instanceList) continue;
     lists[i].clearSelection();
   }
   // Add the selection listener back
   for (int i = 0; i < lists.length; i++) {
     if (lists[i] == null) continue;
     lists[i].addSelectionListener(selectionListener);
   }
 }
Esempio n. 19
0
 @Override
 public void valueChanged(ListSelectionEvent e) {
   if (e.getSource() == listData && listData.getSelectedValue() != null) {
     Data tmp = rssFeed.searchByTitle((String) listData.getSelectedValue());
     if (tmp != null) this.desc.setText(tmp.getDesc());
   }
 }
 @Override
 public void valueChanged(ListSelectionEvent event) {
   System.out.println(event.toString());
   JList list = (JList) event.getSource();
   if (list.getSelectedValue() != null) {
     // check
     String buttonText = list.getSelectedValue().toString();
     item = model.getCatalog().getItem(buttonText);
     if (item instanceof PizzaSize) {
       setView(
           "Size",
           ((PizzaSize) item).getFullName(),
           ((PizzaSize) item).getShortName(),
           ((PizzaSize) item).getPrice());
     } else if (item instanceof Sauce) {
       setView("Sauce", ((Sauce) item).getFullName(), ((Sauce) item).getShortName(), -1.0);
     } else if (item instanceof Topping) {
       setView("Topping", ((Topping) item).getFullName(), ((Topping) item).getShortName(), -1.0);
     } else if (item instanceof Side) {
       setView("Side", ((SideItem) item).getName(), null, ((SideItem) item).getPrice());
     } else if (item instanceof Drink) {
       setView("Drink", ((SideItem) item).getName(), null, ((SideItem) item).getPrice());
     }
     components.get("typeComboBox").setEnabled(false);
   }
 }
Esempio n. 21
0
    public void valueChanged(ListSelectionEvent e) {
      if (e.getSource() == _table.getSelectionModel()) {
        _table.getPathForRow(_table.getSelectedRow());

        // is there already a highlighted part?
        if (_currentSelectedPart != null) {
          // unhighlight previous selected text
          // restoring its style
          try {
            String text =
                _hexStyledDoc.getText(
                    _currentSelectedPart.getOffset(), _currentSelectedPart.getLength());
            _hexStyledDoc.remove(
                _currentSelectedPart.getOffset(), _currentSelectedPart.getLength());
            _hexStyledDoc.insertString(
                _currentSelectedPart.getOffset(),
                text,
                _hexStyledDoc.getStyle(
                    _currentSelectedPart.getPacketNode().getModelPart().getType().getName()));
          } catch (BadLocationException e1) {
            e1.printStackTrace();
          }
        }
        TreePath tp = _table.getPathForRow(_table.getSelectedRow());
        if (tp != null && ((DataPartNode) tp.getLastPathComponent()).isLeaf()) {
          _currentSelectedPart = (DataPartNode) tp.getLastPathComponent();
          ViewPane.this.highlightSelectedPart(_currentSelectedPart);
        }
      }
    }
 @Override
 public void valueChanged(ListSelectionEvent e) {
   if (!isEnabled()) {
     return;
   }
   if (inProgrammedSelectionChange) {
     return;
   }
   inProgrammedSelectionChange = true;
   try {
     ImageListView sourceList = (ImageListView) e.getSource();
     int selIndex = sourceList.getLeadSelectionIndex();
     if (selIndex >= 0) {
       if (keepRelativeSelectionIndices) {
         Integer lastSourceSelIdx = listsAndSelectionIndices.get(sourceList);
         if (lastSourceSelIdx == null) {
           // nothing was selected in sourceList previously. Just remember the newly selected
           // index
           putSelectionIndex(sourceList, selIndex);
           updateSelectionBounds();
         } else {
           putSelectionIndex(sourceList, selIndex);
           int change = selIndex - lastSourceSelIdx;
           for (ImageListView l : getLists()) {
             if (l != sourceList) {
               Integer si = listsAndSelectionIndices.get(l);
               if (si != null) {
                 int newsi = si + change;
                 listsAndSelectionIndices.put(
                     l, newsi); // newsi==-1 is a valid value here, so DON'T call
                 // putSelectionIndex
                 if (newsi >= l.getLength()) {
                   newsi = l.getLength() - 1;
                 }
                 if (newsi < 0) {
                   newsi = 0;
                 }
                 l.getSelectionModel().setSelectionInterval(newsi, newsi);
               }
             }
           }
         }
       } else {
         putSelectionIndex(sourceList, selIndex);
         for (ImageListView l : getLists()) {
           if (l != sourceList) {
             l.getSelectionModel().setSelectionInterval(selIndex, selIndex);
             putSelectionIndex(l, selIndex);
           }
         }
       }
     } else {
       putSelectionIndex(sourceList, -1);
     }
   } finally {
     inProgrammedSelectionChange = false;
     // dumpSelectionIndices();
   }
 }
  public void valueChanged(ListSelectionEvent evt) {
    if (evt.getSource() == mYParamList.getJList()) {
      mSelYParam = mYParamList.getJList().getSelectedIndex();
      setAdvancedValues();
    }

    generatePlotName();
  }
Esempio n. 24
0
 public void valueChanged(ListSelectionEvent e) {
   if (e.getValueIsAdjusting()) {
     return;
   }
   if (e.getSource() == getSelectedRobotsList()) {
     selectedRobotsListSelectionChanged();
   }
 }
Esempio n. 25
0
 @Override
 public void valueChanged(ListSelectionEvent e) {
   Object source = e.getSource();
   if (source == searchList) {
     String word = searchList.getSelectedValue();
     wordSelected(word);
   }
 }
Esempio n. 26
0
  public void valueChanged(ListSelectionEvent event) {
    if (event.getValueIsAdjusting()) // ignore mouse down, dragging, etc.
    return;

    Object src = event.getSource();

    if (src == functionList) handleFuncListSelect();
    else if (src == keyList) handleKeyListSelect();
  }
Esempio n. 27
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);
            }
          }
        }
      }
    }
    /// Pass user's interaction with list to appropriate handler
    public void valueChanged(ListSelectionEvent e) {
      if (e.getSource() == sourceList) {
        if (!e.getValueIsAdjusting()) {
          int indexS = sourceList.getSelectedIndex();
          srcID = indexS + 1;
          drawTest.repaint();
        }
      }

      if (e.getSource() == destList) {
        if (!e.getValueIsAdjusting()) {
          int indexD = destList.getSelectedIndex();
          dstID = indexD + 17;
          drawTest.repaint();
        }
      }

      if (e.getSource() == routerList) {
        if (!e.getValueIsAdjusting()) {
          indexR = routerList.getSelectedIndex();

          Router temp = statMux.getRouter(indexR);
          int[] pList = temp.getPriorityList();
          audioVal.setText(String.valueOf(pList[0]));
          videoVal.setText(String.valueOf(pList[1]));
          textVal.setText(String.valueOf(pList[2]));
        }
      }

      if (e.getSource() == packTypeList) {
        if (!e.getValueIsAdjusting()) {
          int temp = packTypeList.getSelectedIndex();
          if (temp == 0) {
            type = PacketType.AUDIO;
          } else if (temp == 1) {
            type = PacketType.VIDEO;
          } else {
            type = PacketType.TEXT;
          }
          drawTest.repaint();
        }
      }
    }
Esempio n. 29
0
  public void valueChanged(ListSelectionEvent e) {

    if (e.getSource() == typeList) {
      typeList.removeListSelectionListener(this);
      objectType = typeList.getSelectedIndex();
      // fldName.setText("");
      createNewGeo();
      typeList.addListSelectionListener(this);
    }
  }
Esempio n. 30
0
  public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting() == false) {
      if (e.getSource() == list) {
        if (list.getSelectedIndex() != -1) {
          Person person = list.getSelectedValue();
          setPerson(person);
        }
      }

      if (e.getSource() == eventList) {
        if (eventList.getSelectedIndex() != -1) {
          int index = eventList.getSelectedIndex();
          Event event = events[index];

          eventText.setText(Utils.formatDate(event.getDate()) + ": " + event.getNote());
        }
      }
    }
  }