Exemplo n.º 1
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;
      }
    }
    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);
  }
 @Override
 public void valueChanged(ListSelectionEvent e) {
   if (e.getValueIsAdjusting()) {
     if (e.getLastIndex() != -1) {
       requestDispatcher.clickedMethodInfoList();
     }
   }
 }
Exemplo n.º 5
0
 @Override
 public void valueChanged(ListSelectionEvent e) {
   // First index can be set to -1 when the list is refreshed, so discard all map rectangles
   // and polygons
   if (e.getFirstIndex() == -1) {
     clearMap();
   } else if (!e.getValueIsAdjusting()) {
     // Only process complete (final) selection events
     for (int i = e.getFirstIndex(); i <= e.getLastIndex(); i++) {
       updateBoundsAndShapes(i);
     }
     // If needed, adjust map to show all map rectangles and polygons
     if (!mapRectangles.isEmpty() || !mapPolygons.isEmpty()) {
       defaultMap.setDisplayToFitMapElements(false, true, true);
       defaultMap.zoomOut();
     }
   }
 }
Exemplo n.º 6
0
 @Override
 public void valueChanged(ListSelectionEvent e) {
   int firstIndex = e.getFirstIndex();
   int lastIndex = e.getLastIndex();
   if (firstIndex == -1 && lastIndex == -1) {
     repaint();
   }
   Rectangle dirtyRegion = getCellRect(firstIndex, 0, false);
   int numColumns = getColumnCount();
   int index = firstIndex;
   for (int i = 0; i < numColumns; i++) {
     dirtyRegion.add(getCellRect(index, i, false));
   }
   index = lastIndex;
   for (int i = 0; i < numColumns; i++) {
     dirtyRegion.add(getCellRect(index, i, false));
   }
   repaint(dirtyRegion.x, dirtyRegion.y, dirtyRegion.width, dirtyRegion.height);
 }
Exemplo n.º 7
0
 public void valueChanged(ListSelectionEvent e) {
   int first = e.getFirstIndex();
   int last = e.getLastIndex();
   if (e.getFirstIndex() != -1) {
     int min = Math.min(first, last);
     int max = Math.max(first, last);
     for (int i = min; i <= max; i++) {
       if (!table.isRowSelected(i)) {
         continue;
       }
       Object marker = tableModel.getValueAt(i, 0);
       if (marker instanceof MarkedItem && !((MarkedItem) marker).movable) {
         button.setEnabled(false);
         return;
       }
     }
     button.setEnabled(true);
   } else {
     button.setEnabled(false);
   }
 }
Exemplo n.º 8
0
  /**
   * Implements ListSelectionListener.valueChanged. Enables or disables call and hangup buttons
   * depending on the selection in the contactlist.
   */
  public void valueChanged(ListSelectionEvent e) {
    Object o = mainFrame.getContactListPanel().getContactList().getSelectedValue();

    if ((e.getFirstIndex() != -1 || e.getLastIndex() != -1) && (o instanceof MetaContact)) {
      setCallMetaContact(true);

      // Switch automatically to the appropriate pps in account selector
      // box and enable callButton if telephony is supported.
      Contact contact = ((MetaContact) o).getDefaultContact(OperationSetBasicTelephony.class);

      if (contact != null) {
        callButton.setEnabled(true);

        if (contact.getProtocolProvider().isRegistered())
          getAccountSelectorBox().setSelected(contact.getProtocolProvider());
      } else {
        callButton.setEnabled(false);
      }
    } else if (phoneNumberCombo.isComboFieldEmpty()) {
      callButton.setEnabled(false);
    }
  }