コード例 #1
0
  private void tableSelectionChanged() {

    if (selectedDownload != null) selectedDownload.deleteObserver(DownloadGUI.this);

    if (!clearing && table.getSelectedRow() > -1) {
      selectedDownload = tableModel.getDownload(table.getSelectedRow());
      selectedDownload.addObserver(DownloadGUI.this);
      updateButtons();
    }
  }
コード例 #2
0
  /** Observer method to update the insuranceCompanyTable */
  public void updateTable() {

    tableData.update(
        model.getInsuranceCompanies(), model.getSortingStrategy()); // Populate the table

    // Check if InsuranceCompany map is empty
    if (model.getInsuranceCompanies().size() > 0) {
      selectRow();
      int selectedCompanyId =
          Integer.valueOf(
              (String)
                  insuranceCompaniesTable.getValueAt(insuranceCompaniesTable.getSelectedRow(), 0));
      controller.selectInsuranceCompany(selectedCompanyId);
      recordEdited = -1; // Reset the recordEdited field
    } else {
      // If all records are deleted, clear the edit panel
      companyIdTextField.setText("");
      companyNameTextField.setText("");
      urlTextField.setText("");
      generalDescriptionTextField.setText("");
      insuranceTypesTextField.setText("");
      telephoneTextField.setText("");
      percentageTextField.setText("");
    }
  }
コード例 #3
0
ファイル: Ssys3.java プロジェクト: scyptnex/computing
 public void secureDelete() {
   int rw = tblItems.getSelectedRow();
   if (rw == -1) {
     JOptionPane.showMessageDialog(frm, "No item selected", "Error", JOptionPane.ERROR_MESSAGE);
     return;
   }
   int idx = tblItems.convertRowIndexToModel(rw);
   if (JOptionPane.showConfirmDialog(
           frm,
           "Delete " + store.plainName(idx) + "?",
           "Confirm Delete",
           JOptionPane.YES_NO_OPTION)
       != JOptionPane.YES_OPTION) return;
   File del = store.delete(idx);
   store.fireTableDataChanged();
   if (del != null) {
     if (del.delete()) {
       // successful
       needsSave = true;
     } else {
       System.err.println("Delete " + del.getAbsolutePath() + " failed");
     }
   }
   updateStatus();
 }
コード例 #4
0
 private void actionClear() {
   clearing = true;
   tableModel.clearDownload(table.getSelectedRow());
   clearing = false;
   selectedDownload = null;
   updateButtons();
 }
コード例 #5
0
ファイル: InputPanel.java プロジェクト: 4ment/beast-mcmc
 public void editSelection() {
   int selRow = dataTable.getSelectedRow();
   if (selRow >= 0) {
     InputFile inputFile = document.getInputFiles().get(selRow);
     editSettings(inputFile);
   }
 }
コード例 #6
0
  /** Removes the room that is currently selected. */
  void removeSelectedRoom() {
    ChatRoomWrapper chatRoomWrapper = chatRoomsTableModel.getValueAt(chatRoomList.getSelectedRow());

    ConferenceChatManager conferenceManager =
        GuiActivator.getUIService().getConferenceChatManager();
    conferenceManager.removeChatRoom(chatRoomWrapper);
  }
コード例 #7
0
ファイル: JCTimePanel.java プロジェクト: esprayer/EMPPlatform
 /** 删除 */
 private void processDeleteEvent() {
   int index = timeTable.getSelectedRow();
   if (index == -1) return;
   JTimeTableModel model = (JTimeTableModel) timeTable.getModel();
   if (index < model.timeList.size()) model.timeList.removeElementAt(index);
   timeTable.updateUI();
 }
コード例 #8
0
 private void addRow() {
   if (table.getSelectedRow() != -1) {
     // inserts row below the selected one else bottom
     int numRow = table.getRowCount();
     dtm.insertRow(numRow + 1, ",".split(","));
   } else {
     dtm.addRow(",".split(","));
   }
 }
コード例 #9
0
 public void mouseClicked(MouseEvent me) {
   int Index = _PersonnelTable.getSelectedRow();
   _CurrentPersonnel = _Unit.getPersonnel().elementAt(Index);
   if (_CurrentPersonnel != _PreviousPersonnel) {
     GetFields();
     _PreviousPersonnel = _CurrentPersonnel;
     SetFields();
   }
 }
コード例 #10
0
 private ToolAdapterOperatorDescriptor requestSelection() {
   ToolAdapterOperatorDescriptor selected = null;
   int selectedRow = operatorsTable.getSelectedRow();
   if (selectedRow >= 0) {
     selected = ((OperatorsTableModel) operatorsTable.getModel()).getObjectAt(selectedRow);
   } else {
     SnapDialogs.showWarning(Bundle.MessageNoSelection_Text());
   }
   return selected;
 }
コード例 #11
0
 private void moveItemUp() {
   int index = menuItemsTable.getSelectedRow();
   // Return if nothing was selected.
   if (index == -1) return;
   // Return if the first item is selected.
   if (index == 0) return;
   nodeAttributesDialog.moveParameterItemUp(parameter, index);
   // TODO: Changing the selection doesn't have any effect on Mac.
   menuItemsTable.changeSelection(index - 1, 1, false, false);
 }
コード例 #12
0
 /** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user pressed the remove button
   if (e.getSource() == remove_button) {
     int row = table.getSelectedRow();
     model.removeRow(row);
     table.clearSelection();
     table.repaint();
     valueChanged(null);
   }
   // Check if the user pressed the remove all button
   if (e.getSource() == remove_all_button) {
     model.clearAll();
     table.setRowSelectionInterval(0, 0);
     table.repaint();
     valueChanged(null);
   }
   // Check if the user pressed the filter button
   if (e.getSource() == filter_button) {
     filter.showDialog();
     if (filter.okPressed()) {
       // Update the display with new filter
       model.setFilter(filter);
       table.repaint();
     }
   }
   // Check if the user pressed the start button
   if (e.getSource() == start_button) {
     start();
   }
   // Check if the user pressed the stop button
   if (e.getSource() == stop_button) {
     stop();
   }
   // Check if the user wants to switch layout
   if (e.getSource() == layout_button) {
     details_panel.remove(details_soap);
     details_soap.removeAll();
     if (details_soap.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
       details_soap = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
     } else {
       details_soap = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
     }
     details_soap.setTopComponent(request_panel);
     details_soap.setRightComponent(response_panel);
     details_soap.setResizeWeight(.5);
     details_panel.add(details_soap, BorderLayout.CENTER);
     details_panel.validate();
     details_panel.repaint();
   }
   // Check if the user is changing the reflow option
   if (e.getSource() == reflow_xml) {
     request_text.setReflowXML(reflow_xml.isSelected());
     response_text.setReflowXML(reflow_xml.isSelected());
   }
 }
コード例 #13
0
 private void moveItemDown() {
   int index = menuItemsTable.getSelectedRow();
   // Return if nothing was selected.
   if (index == -1) return;
   java.util.List<Parameter.MenuItem> items = parameter.getMenuItems();
   // Return if the last item is selected.
   if (index >= items.size() - 1) return;
   nodeAttributesDialog.moveParameterItemDown(parameter, index);
   // TODO: Changing the selection doesn't have any effect on Mac.
   menuItemsTable.changeSelection(index + 1, 1, false, false);
 }
コード例 #14
0
                          // appointment time and what not
 public void mouseClicked(MouseEvent e) {
   int row = Cal.getSelectedRow(); // this will give you the row number
   int col = Cal.getSelectedColumn(); // this will give you the column number
   if (row != -1
       && col != -1
       && Cal.getValueAt(row, col)
           != null) { // this now will only activate when there is an actual date associated with
                      // that day
     input(row, col, currentYear);
   }
 }
コード例 #15
0
ファイル: JCTimePanel.java プロジェクト: esprayer/EMPPlatform
 /** 改变ScheduleObject对象. */
 private void processTaskTable() {
   Vector v = getCTimeList();
   if (taskTable == null) return;
   int index = taskTable.getSelectedRow();
   if (index > -1) {
     JTaskTableModel model = (JTaskTableModel) taskTable.getModel();
     JTaskObject task = (JTaskObject) model.taskList.get(index);
     task.schedule.modeContent = v;
     model.setValueAt(task, index, 0);
   }
 }
コード例 #16
0
 @Override
 public void mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 2) {
     JTable table = (JTable) e.getSource();
     ListTableModel<PatientModel> tableModel = getTableModel();
     PatientModel value = (PatientModel) tableModel.getObject(table.getSelectedRow());
     if (value != null) {
       openKarte();
     }
   }
 }
コード例 #17
0
 @Override
 public void valueChanged(ListSelectionEvent e) {
   if (e.getValueIsAdjusting() == false) {
     JTable table = view.getTable();
     ListTableModel<PatientModel> tableModel = getTableModel();
     int row = table.getSelectedRow();
     // PatientModel patient = (PatientModel) tableModel.getObject(row);
     PatientModel patient = (PatientModel) sorter.getObject(row);
     setSelectedPatinet(patient);
   }
 }
コード例 #18
0
  public void comprar(JTable table) {
    Cliente c = null;
    Producto p = null;
    double precio = 0;
    try {
      c = busquedaCliente(table);
      p = sistema.getEmpresa().getProductos().get(table.getSelectedRow());
      precio = p.getPrecio();

      // Codigo para la compra
      sistema
          .getEmpresa()
          .nuevaCompra(
              c.getNombre(),
              c.getApellido(),
              c.getCedula(),
              p.getMarca(),
              p.getModelo(),
              p.getPrecio(),
              p.getClave());
      JOptionPane.showMessageDialog(
          this,
          "El cliente "
              + "ha comprado exitosamente este producto.\n"
              + "Producto: "
              + sistema.getEmpresa().getProductos().get(table.getSelectedRow()).getMarca()
              + " "
              + sistema.getEmpresa().getProductos().get(table.getSelectedRow()).getModelo()
              + "\n"
              + "Ingreso para la empresa: "
              + precio);
      sistema.getGuardar().guardarVentas(sistema, null);
      sistema.getEmpresa().setIngreso(precio);
      sistema.getEmpresa().setNumVentas(1);
      guardarVentaIngreso();
      abrirMenuFacturar(c, p);
      sistema.mostrarPanel(PanelBase.PANEL_INICIO);
    } catch (ArrayIndexOutOfBoundsException ex) {
      JOptionPane.showMessageDialog(this, "No se ha seleccionado una computadora");
    }
  }
コード例 #19
0
ファイル: BodyPan.java プロジェクト: UlTMATE/Lookout
 @Override
 public void valueChanged(ListSelectionEvent lsEve) {
   int rowNum = table.getSelectedRow();
   int colNum = table.getSelectedColumn();
   //            System.out.println("Reached in else");
   if (colNum > 0) {
     selectAllCB.setVisible(false);
     deleteBut.setVisible(false);
     new MessagePan(rowNum, workingSet);
     backBut.setVisible(true);
     Home.home.homeFrame.setVisible(true);
   }
 }
コード例 #20
0
ファイル: Ssys3.java プロジェクト: scyptnex/computing
 public void secureAnalysis() {
   int rw = tblItems.getSelectedRow();
   if (rw != -1) {
     int idx = tblItems.convertRowIndexToModel(rw);
     String desc = store.describe(idx);
     if (JOptionPane.showConfirmDialog(frm, desc, "Details", JOptionPane.OK_CANCEL_OPTION)
         == JOptionPane.CANCEL_OPTION) return;
   }
   if (JOptionPane.showConfirmDialog(frm, store.tagDesc(), "Tags", JOptionPane.OK_CANCEL_OPTION)
       == JOptionPane.CANCEL_OPTION) return;
   if (JOptionPane.showConfirmDialog(
           frm, store.storeDesc(), "Storage", JOptionPane.OK_CANCEL_OPTION)
       == JOptionPane.CANCEL_OPTION) return;
 }
コード例 #21
0
 /**
  * Searches for InsuranceCompanies. Calls the controller and updates the tableData to the
  * searchMap.
  */
 private void searchInsuranceCompany() {
   String query = searchTextField.getText();
   controller.searchInsuranceCompanies(query);
   tableData.update(
       model.getSearchMap(), model.getSortingStrategy()); // Updates tableData and sortingStrategy
   // Enable automatic selection while searching
   if (tableData.getRowCount() > 0) {
     selectRow();
     int selectedCompanyId =
         Integer.valueOf(
             (String)
                 insuranceCompaniesTable.getValueAt(insuranceCompaniesTable.getSelectedRow(), 0));
     controller.selectInsuranceCompany(selectedCompanyId);
   }
 }
コード例 #22
0
ファイル: Ssys3.java プロジェクト: scyptnex/computing
 public void secureMove() {
   int rw = tblItems.getSelectedRow();
   if (rw == -1) {
     JOptionPane.showMessageDialog(frm, "No item selected", "Error", JOptionPane.ERROR_MESSAGE);
     return;
   }
   int idx = tblItems.convertRowIndexToModel(rw);
   String[] opts = new String[storeLocs.size()];
   for (int i = 0; i < opts.length; i++) opts[i] = storeLocs.get(i).getAbsolutePath();
   JComboBox cmbMove = new JComboBox(opts);
   cmbMove.setSelectedIndex(store.curStore(idx));
   if (JOptionPane.showConfirmDialog(frm, cmbMove, "Move item", JOptionPane.OK_CANCEL_OPTION)
       != JOptionPane.OK_OPTION) return;
   File newLoc = store.move(idx, cmbMove.getSelectedIndex());
   if (newLoc == null) System.err.println("move " + store.plainName(idx) + " unsuccessful");
   else needsSave = true;
 }
コード例 #23
0
  /** Initial method to populate the insuranceCompaniesTable */
  public void loadTable() {

    Map<Integer, InsuranceCompany> data = model.getInsuranceCompanies();
    tableData = new InsuranceCompanyTableModel(data);
    insuranceCompaniesTable.setModel(tableData);
    insuranceCompaniesTable.getColumnModel().getColumn(0).setMaxWidth(50);
    insuranceCompaniesTable
        .getSelectionModel()
        .setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    // Check if db is empty and proceed with selecting only if the table is populated
    if (insuranceCompaniesTable.getRowCount() > 0) {
      // Set selected company according to selected row on load
      selectRow();
      int selectedCompanyId =
          Integer.valueOf(
              (String)
                  insuranceCompaniesTable.getValueAt(insuranceCompaniesTable.getSelectedRow(), 0));
    }
  }
コード例 #24
0
 private void maybeGrabSelection() {
   if (table.getSelectedRow() != -1) {
     // Grab selection
     ListSelectionModel rowSel = table.getSelectionModel();
     ListSelectionModel colSel = table.getColumnModel().getSelectionModel();
     if (!haveAnchor()) {
       //        System.err.println("Updating from table's selection");
       setSelection(
           rowSel.getAnchorSelectionIndex(), rowSel.getLeadSelectionIndex(),
           colSel.getAnchorSelectionIndex(), colSel.getLeadSelectionIndex());
     } else {
       //        System.err.println("Updating lead from table's selection");
       setSelection(
           getRowAnchor(), rowSel.getLeadSelectionIndex(),
           getColAnchor(), colSel.getLeadSelectionIndex());
     }
     //      printSelection();
   }
 }
コード例 #25
0
 /** Listener to handle table selection changes */
 public void valueChanged(ListSelectionEvent e) {
   int row = table.getSelectedRow();
   // Check if they selected a specific row
   if (row > 0) {
     remove_button.setEnabled(true);
   } else {
     remove_button.setEnabled(false);
   }
   // Check for "most recent" selection
   if (row == 0) {
     row = model.getRowCount() - 1;
     if (row == 0) {
       row = -1;
     }
   }
   if (row == -1) {
     // Clear the details panel
     details_time_value.setText("");
     details_target_value.setText("");
     details_status_value.setText("");
     request_text.setText("");
     response_text.setText("");
   } else {
     // Show the details for the row
     SOAPMonitorData soap = model.getData(row);
     details_time_value.setText(soap.getTime());
     details_target_value.setText(soap.getTargetService());
     details_status_value.setText(soap.getStatus());
     if (soap.getSOAPRequest() == null) {
       request_text.setText("");
     } else {
       request_text.setText(soap.getSOAPRequest());
       request_text.setCaretPosition(0);
     }
     if (soap.getSOAPResponse() == null) {
       response_text.setText("");
     } else {
       response_text.setText(soap.getSOAPResponse());
       response_text.setCaretPosition(0);
     }
   }
 }
コード例 #26
0
  /** Observer method to update the editPanel and it's contents */
  public void updateEditPanel() {

    InsuranceCompany insuranceCompany = model.getCurrentInsuranceCompany();

    if (insuranceCompany != null) { // If no currentInsuranceCompany is set (if the db is empty)
      // Update all text fields
      String id =
          (String) insuranceCompaniesTable.getValueAt(insuranceCompaniesTable.getSelectedRow(), 0);
      companyIdTextField.setText(id);
      companyNameTextField.setText(insuranceCompany.getCompanyName());
      urlTextField.setText(insuranceCompany.getUrl());
      urlTextField.setCaretPosition(0);
      generalDescriptionTextField.setText(insuranceCompany.getGeneralDescription());
      generalDescriptionTextField.setCaretPosition(0);
      insuranceTypesTextField.setText(insuranceCompany.getInsuranceTypes());
      insuranceTypesTextField.setCaretPosition(0);
      telephoneTextField.setText(insuranceCompany.getTelephone());
      percentageTextField.setText(Float.toString(insuranceCompany.getPercentage()));
    }
  }
コード例 #27
0
ファイル: prueba.java プロジェクト: whoeverxd/myrepo
  protected void moveSelectedRow(JTable from, JTable to) {

    SimpleColorTableModel fromModel = (SimpleColorTableModel) from.getModel();
    SimpleColorTableModel toModel = (SimpleColorTableModel) to.getModel();

    for (int index : from.getSelectedRows()) {

      Vector rowValue = (Vector) fromModel.getDataVector().get(index);

      toModel.addRow(rowValue);
    }

    int selectedRow = -1;
    while ((selectedRow = from.getSelectedRow()) != -1) {

      fromModel.removeRow(selectedRow);
    }

    from.clearSelection();
  }
コード例 #28
0
ファイル: JCTimePanel.java プロジェクト: esprayer/EMPPlatform
  /** 编辑 */
  private void processEditEvent() {
    int count = timeTable.getModel().getRowCount();
    if (count == 0) return;
    int index = timeTable.getSelectedRow();
    if (index < 0) return;
    JTimeTableModel model = (JTimeTableModel) timeTable.getModel();
    JCTimeObject obj = (JCTimeObject) model.timeList.get(index);

    Frame frame = JActiveDComDM.MainApplication.MainWindow;
    JManageCTimeDialog actionDlg;
    actionDlg = new JManageCTimeDialog(frame, "编辑时间方案", true);
    actionDlg.setSize(480, 310);
    actionDlg.CenterWindow();
    actionDlg.setCTimeObject(obj);
    actionDlg.setVisible(true);
    if (actionDlg.OPTION == actionDlg.OPTION_OK) {
      timeTable.getModel().setValueAt(actionDlg.getCTimeObject(), index, 0);
      timeTable.updateUI();
    }
  }
コード例 #29
0
ファイル: BookMain.java プロジェクト: SenyMin/JavaBasic
 @Override
 public void mouseClicked(MouseEvent e) {
   // TODO Auto-generated method stub
   if (e.getSource() == table) {
     if (e.getClickCount() == 2) // 더블클릭
     {
       int row = table.getSelectedRow();
       String no = model.getValueAt(row, 0).toString();
       bp.setPoster(Integer.parseInt(no));
       bp.repaint();
       Book book = bm.bookDetail(Integer.parseInt(no));
       la1.setText("번호:" + no);
       la2.setText("제목:" + book.getTitle());
       la3.setText("저자:" + book.getAuthor());
       la4.setText("출판사:" + book.getPublisher());
       la5.setText("가격:" + book.getPrice());
     }
   } else if (e.getSource() == b) {
     getData();
   }
 }
 public void setSwingFocus(ICFLibAnyObj value) {
   final String S_ProcName = "setSwingFocus";
   if ((value == null) || (value instanceof ICFSecurityISOCountryObj)) {
     super.setSwingFocus(value);
   } else {
     throw CFLib.getDefaultExceptionFactory()
         .newUnsupportedClassException(
             getClass(), S_ProcName, "value", value, "ICFSecurityISOCountryObj");
   }
   if (dataTable == null) {
     return;
   }
   if (value == null) {
     dataTable.clearSelection();
   } else {
     ICFInternetISOCountryObj curSelected;
     PickerTableModel tblDataModel = getDataModel();
     int selectedRow = dataTable.getSelectedRow();
     int modelIndex = dataTable.convertRowIndexToModel(selectedRow);
     if (selectedRow >= 0) {
       Object selectedRowData = tblDataModel.getValueAt(modelIndex, COLID_ROW_HEADER);
       curSelected = (ICFInternetISOCountryObj) selectedRowData;
     } else {
       curSelected = null;
     }
     if (curSelected != value) {
       int len = tblDataModel.getRowCount();
       int idx = 0;
       while ((idx < len) && (tblDataModel.getValueAt(idx, COLID_ROW_HEADER) != value)) {
         idx++;
       }
       if (idx < len) {
         int viewRow = dataTable.convertRowIndexToView(idx);
         dataTable.clearSelection();
         dataTable.addRowSelectionInterval(viewRow, viewRow);
       }
     }
   }
 }