public void setOptions(BeautiOptions options) {

    this.options = options;

    resetPanel();

    settingOptions = true;

    int selRow = partitionTable.getSelectedRow();
    partitionTableModel.fireTableDataChanged();
    if (options.getDataPartitions().size() > 0) {
      if (selRow < 0) {
        selRow = 0;
      }
      partitionTable.getSelectionModel().setSelectionInterval(selRow, selRow);

      setCurrentPartition(options.getDataPartitions().get(selRow));
    }

    AncestralStatesOptionsPanel panel = optionsPanels.get(currentPartition);
    if (panel != null) {
      panel.setupPanel();
    }

    settingOptions = false;

    validate();
    repaint();
  }
예제 #2
0
  /** Removes the room that is currently selected. */
  void removeSelectedRoom() {
    ChatRoomWrapper chatRoomWrapper = chatRoomsTableModel.getValueAt(chatRoomList.getSelectedRow());

    ConferenceChatManager conferenceManager =
        GuiActivator.getUIService().getConferenceChatManager();
    conferenceManager.removeChatRoom(chatRoomWrapper);
  }
예제 #3
0
 /** 删除 */
 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();
 }
예제 #4
0
 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();
 }
  /** 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("");
    }
  }
 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(","));
   }
 }
예제 #7
0
    public void valueChanged(ListSelectionEvent e) {
      int baris = tabel.getSelectedRow();
      System.out.println("Baris " + baris + "dipilih");

      if (baris > -1) {
        Mahasiswa x = data.get(baris);
        System.out.println("NPM: " + x.getNpm());
      }
    }
 /** 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());
   }
 }
예제 #9
0
 /** 改变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);
   }
 }
예제 #10
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);
   }
 }
예제 #11
0
 @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);
   }
 }
예제 #12
0
 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;
 }
 /**
  * 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);
   }
 }
  private void selectionChanged() {
    if (settingOptions) return;

    int selRow = partitionTable.getSelectedRow();

    if (selRow >= options.getDataPartitions().size()) {
      selRow = 0;
      partitionTable.getSelectionModel().setSelectionInterval(selRow, selRow);
    }

    if (selRow >= 0) {
      setCurrentPartition(options.getDataPartitions().get(selRow));
      //            frame.modelSelectionChanged(!isUsed(selRow));
    }
  }
예제 #15
0
 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;
 }
  /** 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));
    }
  }
예제 #17
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();
   }
 }
 /** 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);
     }
   }
 }
  /** 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()));
    }
  }
예제 #20
0
  /** 编辑 */
  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();
    }
  }
예제 #21
0
  @SuppressWarnings("unused")
  @Override
  public void mouseClicked(MouseEvent e) {
    int iDongDaChon = jRoom.getSelectedRow();
    if (iDongDaChon == -1) {
      JOptionPane.showMessageDialog(this, "you select 1 row");
    } else {
      buttonDelete.setVisible(true);
      buttonUpdate.setEnabled(true);
      Vector vDongDaChon = (Vector) tableRecords.get(iDongDaChon);
      IDROOM = Integer.parseInt(vDongDaChon.get(0).toString());
      String roomNumber = vDongDaChon.get(1).toString();
      String roomType = vDongDaChon.get(2).toString();
      String numBeds = vDongDaChon.get(3).toString();
      String roomTypeRate = vDongDaChon.get(4).toString();
      String roomStatus = vDongDaChon.get(5).toString();
      String des = vDongDaChon.get(6).toString();

      txtRoomNumber.setText(roomNumber);
      boxRoomTypeID.setSelectedItem(roomType.toString());
      boxRoomStatusID.setSelectedItem(roomStatus.toString());
      txtDescription.setText(des);
      try {
        List<CheckIn> temp = CheckInController.checkInController.all();
        for (int i = 0; i < temp.size(); i++) {
          if (IDROOM == temp.get(i).getRoomID()) {
            this.error = 0;
            buttonUpdate.setEnabled(false);
            buttonDelete.setEnabled(false);
            break;
          } else {
            this.error = 0;
            buttonUpdate.setEnabled(true);
            buttonDelete.setEnabled(true);
          }
        }
      } catch (Exception e2) {
        e2.printStackTrace();
      }
    }
  }
예제 #22
0
 @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);
       }
     }
   }
 }
예제 #24
0
 @Override
 public void mouseClicked(MouseEvent e) {
   // TODO Auto-generated method stub
   if (e.getSource() == table) {
     if (e.getClickCount() == 2) {
       int row = table.getSelectedRow();
       String sabun = model.getValueAt(row, 0).toString();
       EmpDAO dao = new EmpDAO();
       EmpDTO d = dao.empDetailData(Integer.parseInt(sabun));
       String msg =
           "사번:"
               + d.getEmpno()
               + "\n"
               + "이름:"
               + d.getEname()
               + "\n"
               + "직위:"
               + d.getJob()
               + "\n"
               + "사수번호:"
               + d.getMgr()
               + "\n"
               + "입사일:"
               + d.getHiredate().toString()
               + "\n"
               + "급여:"
               + d.getSal()
               + "\n"
               + "성과급:"
               + d.getComm()
               + "\n"
               + "부서번호:"
               + d.getDeptno();
       JOptionPane.showMessageDialog(this, msg);
     }
   }
 }
예제 #25
0
 /**
  * Returns the currently selected room.
  *
  * @return the currently selected room.
  */
 ChatRoomWrapper getSelectedRoom() {
   return chatRoomsTableModel.getValueAt(chatRoomList.getSelectedRow());
 }
    /** Background thread used to receive data from the server. */
    public void run() {
      Long id;
      Integer message_type;
      String target;
      String soap;
      SOAPMonitorData data;
      int selected;
      int row;
      boolean update_needed;
      while (socket != null) {
        try {
          // Get the data from the server
          message_type = (Integer) in.readObject();
          // Process the data depending on its type
          switch (message_type.intValue()) {
            case SOAPMonitorConstants.SOAP_MONITOR_REQUEST:
              // Get the id, target and soap info
              id = (Long) in.readObject();
              target = (String) in.readObject();
              soap = (String) in.readObject();
              // Add new request data to the table
              data = new SOAPMonitorData(id, target, soap);
              model.addData(data);
              // If "most recent" selected then update
              // the details area if needed
              selected = table.getSelectedRow();
              if ((selected == 0) && model.filterMatch(data)) {
                valueChanged(null);
              }
              break;
            case SOAPMonitorConstants.SOAP_MONITOR_RESPONSE:
              // Get the id and soap info
              id = (Long) in.readObject();
              soap = (String) in.readObject();
              data = model.findData(id);
              if (data != null) {
                update_needed = false;
                // Get the selected row
                selected = table.getSelectedRow();
                // If "most recent", then always
                // update details area
                if (selected == 0) {
                  update_needed = true;
                }
                // If the data being updated is
                // selected then update details
                row = model.findRow(data);
                if ((row != -1) && (row == selected)) {
                  update_needed = true;
                }
                // Set the response and update table
                data.setSOAPResponse(soap);
                model.updateData(data);
                // Refresh details area (if needed)
                if (update_needed) {
                  valueChanged(null);
                }
              }
              break;
          }

        } catch (Exception e) {
          // Exceptions are expected here when the
          // server communication has been terminated.
          if (stop_button.isEnabled()) {
            stop();
            setErrorStatus(STATUS_CLOSED);
          }
        }
      }
    }
예제 #27
0
 void deleteButton_actionPerformed(ActionEvent e) {
   int row = filtersTable.getSelectedRow();
   m_model.removeRowData(row);
 }
예제 #28
0
  void goToSpecificColumn(int selectedIndex) {
    int row = table.getSelectedRow();

    table.changeSelection(row, selectedIndex, true, true);
  }
예제 #29
0
  /**
   * Move the currently selected cell up or down by one cell.
   *
   * @param direction -1 for previous, +1 for next.
   */
  public void goToRow(int direction) {
    int row = table.getSelectedRow();
    int column = table.getSelectedColumn();

    table.changeSelection(row + direction, column, false, false);
  }
예제 #30
0
 void upButton_actionPerformed(ActionEvent e) {
   int row = filtersTable.getSelectedRow();
   m_model.moveData(row, row - 1);
 }