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());
    }
Ejemplo n.º 2
0
 public void valueChanged(ListSelectionEvent e) {
   if (e.getSource() == list.getSelectionModel()) {
     listChanged(e);
   } else if (e.getSource() == cmdTable.getSelectionModel()) {
     tableChanged(e);
   }
 }
  @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);
  }
Ejemplo n.º 4
0
 public void valueChanged(ListSelectionEvent e) {
   if (!myIsEnabled || e.getValueIsAdjusting()) {
     return;
   }
   final JList list = (JList) e.getSource();
   processListValue(list.getSelectedValue());
 }
Ejemplo n.º 5
0
  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();
    }
  }
  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);
  }
Ejemplo n.º 7
0
 @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);
   }
 }
    @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());
      }
    }
Ejemplo n.º 9
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;
      }
    }
Ejemplo n.º 10
0
 public void valueChanged(ListSelectionEvent e) {
   if (e.getValueIsAdjusting()) {
     return;
   }
   if (e.getSource() == getSelectedRobotsList()) {
     selectedRobotsListSelectionChanged();
   }
 }
 @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()) {
     if (e.getLastIndex() != -1) {
       requestDispatcher.clickedMethodInfoList();
     }
   }
 }
Ejemplo n.º 13
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.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);
      }
    }
  }
Ejemplo n.º 15
0
 @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);
   }
 }
Ejemplo n.º 16
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);
            }
          }
        }
      }
    }
Ejemplo n.º 17
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();
  }
Ejemplo n.º 18
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);
   }
 }
Ejemplo n.º 19
0
  @Override
  public void valueChanged(ListSelectionEvent e) {
    long val = actionList.get(e.getFirstIndex()).getTime();
    Date date = new Date(val);
    SimpleDateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
    String dateText = df.format(date);

    userLabel.setText(String.valueOf(actionList.get(e.getFirstIndex()).getUser()));
    dateLabel.setText(dateText);
  }
Ejemplo n.º 20
0
  public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting()) return;

    JList theList = (JList) e.getSource();
    if (theList.isSelectionEmpty()) {
      label.setText("Nothing selected.");
    } else {
      int index = theList.getSelectedIndex();
      label.setText("Selected image number " + index);
    }
  }
 @Override
 public void valueChanged(ListSelectionEvent lse) {
   if (!lse.getValueIsAdjusting()) {
     @SuppressWarnings("unchecked")
     JList<TLActivity> list = (JList<TLActivity>) lse.getSource();
     // Only set the selected TLA if the source of the event has focus
     if (list.hasFocus()) {
       setSelectedTLA(list.getSelectedValue());
     }
   }
 }
Ejemplo n.º 22
0
  void jList1_valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting()) return;

    JList theList = (JList) e.getSource();
    if (!theList.isSelectionEmpty()) {
      registerJID = (JID) services.get(theList.getSelectedValue());
      if (registerJID != null)
        backend.send(new InfoQuery(registerJID, "get", backend.getIdentifier(), new IQRegister()));
    }
    theList.clearSelection();
  }
Ejemplo n.º 23
0
    public void valueChanged(ListSelectionEvent e) {
      // Ignore extra messages.
      if (e.getValueIsAdjusting()) return;

      ListSelectionModel lsm = (ListSelectionModel) e.getSource();
      if (lsm.isSelectionEmpty()) {
        m_selectedRow = -1;
      } else {
        m_selectedRow = lsm.getMinSelectionIndex();
      }
      updateButtons();
    }
Ejemplo n.º 24
0
    @Override
    public void valueChanged(final ListSelectionEvent e) {
      if (!e.getValueIsAdjusting()) {
        final ListSelectionModel lsm = (ListSelectionModel) e.getSource();

        if (lsm.isSelectionEmpty()) {
          m_lFilter.setSelectedIndex(0);
        } else {
          updatePreview();
        }
      }
    }
Ejemplo n.º 25
0
 @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();
     }
   }
 }
Ejemplo n.º 26
0
 @Override
 public void valueChanged(ListSelectionEvent e) {
   if (availTable != null && !e.getValueIsAdjusting()) {
     if (e.getSource() == availTable.getSelectionModel()
         && availTable.getSelectedObject() instanceof InfoFacade) {
       InfoFacade target = (InfoFacade) availTable.getSelectedObject();
       InfoFactory factory = chooser.getInfoFactory();
       if (factory != null && target != null) {
         infoPane.setText(factory.getHTMLInfo(target));
       }
     }
   }
 }
Ejemplo n.º 27
0
          @SuppressWarnings("unchecked")
          public void valueChanged(ListSelectionEvent listSelectionEvent) {
            boolean adjust = listSelectionEvent.getValueIsAdjusting();
            if (!adjust) {
              JList<String> tmplist = (JList<String>) listSelectionEvent.getSource();
              currMapIndex = tmplist.getSelectedIndex();

              if (!loadNewImage("file://" + mapDirPath + trackNames.get(currMapIndex) + ".jpg")
                  || !loadNewData(mapDirPath + trackNames.get(currMapIndex) + ".track")) {
                JOptionPane.showMessageDialog(null, "Could not load .track or image.");
                return;
              }
            }
          }
Ejemplo n.º 28
0
    public void valueChanged(ListSelectionEvent e) {
      if (e.getValueIsAdjusting()) return;

      ListSelectionModel lsm = (ListSelectionModel) e.getSource();
      LabelTableModel ltm = (LabelTableModel) labelTable_.getModel();
      if (lsm.isSelectionEmpty()) {
        ltm.setData(model_, null);
      } else {
        String devName = (String) table.getValueAt(lsm.getMinSelectionIndex(), 0);
        ltm.setData(model_, devName);
      }
      ltm.fireTableStructureChanged();
      labelTable_.getColumnModel().getColumn(0).setWidth(40);
    }
Ejemplo n.º 29
0
  @Override
  public void valueChanged(ListSelectionEvent arg0) {
    if (arg0.getValueIsAdjusting() == false) {
      comboBox.removeAllItems();

      JList tmp = (JList) arg0.getSource();
      String login = (String) tmp.getSelectedValue();

      String nivel = listOfUsers.get(login).toString();

      comboBox.addItem(types.get(nivel));
      comboBox.addItem(nivel.equals("0") ? types.get("1") : types.get("0"));
    }
  }
  /**
   * ******************************************************* ListSelectionListener *
   * *******************************************************
   */
  public void valueChanged(ListSelectionEvent event) {
    if (isInserting && !event.getValueIsAdjusting()) {
      DatasetEditorModelRow insertRow = getInsertRow();
      if (insertRow != null) {
        int index = insertRow.getIndex();

        ListSelectionModel listSelectionModel = (ListSelectionModel) event.getSource();
        int selectionIndex = listSelectionModel.getLeadSelectionIndex();

        if (index != selectionIndex) {
          // postInsertRecord();
        }
      }
    }
  }