Ejemplo n.º 1
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();
 }
Ejemplo n.º 2
0
 /** 增加 */
 private void processAddEvent() {
   Frame frame = JActiveDComDM.MainApplication.MainWindow;
   JManageCTimeDialog ctimeDlg;
   ctimeDlg = new JManageCTimeDialog(frame, "添加时间方案", true);
   ctimeDlg.setSize(480, 310);
   ctimeDlg.setMinimumSize(480, 310);
   ctimeDlg.CenterWindow();
   ctimeDlg.setVisible(true);
   if (ctimeDlg.OPTION == ctimeDlg.OPTION_OK) {
     int index = timeTable.getRowCount();
     timeTable.getModel().setValueAt(ctimeDlg.getCTimeObject(), index, 0);
     timeTable.updateUI();
   }
 }
Ejemplo n.º 3
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();
    }
  }
Ejemplo n.º 4
0
  @Override
  public void updateUI() {
    // Bug ID: 6788475 Changing to Nimbus LAF and back doesn't reset look and feel of JTable
    // completely
    // http://bugs.java.com/view_bug.do?bug_id=6788475
    // XXX: set dummy ColorUIResource
    setSelectionForeground(new ColorUIResource(Color.RED));
    setSelectionBackground(new ColorUIResource(Color.RED));
    super.updateUI();

    putClientProperty("Table.isFileList", Boolean.TRUE);
    setCellSelectionEnabled(true);
    setIntercellSpacing(new Dimension());
    setShowGrid(false);
    setAutoCreateRowSorter(true);
    setFillsViewportHeight(true);

    setDefaultRenderer(
        Object.class,
        new DefaultTableCellRenderer() {
          @Override
          public Component getTableCellRendererComponent(
              JTable table,
              Object value,
              boolean isSelected,
              boolean hasFocus,
              int row,
              int column) {
            return super.getTableCellRendererComponent(table, value, false, false, row, column);
          }
        });

    TableColumn col = getColumnModel().getColumn(0);
    col.setCellRenderer(new FileNameRenderer(this));
    col.setPreferredWidth(200);
    col = getColumnModel().getColumn(1);
    col.setPreferredWidth(300);
  }
Ejemplo n.º 5
0
 private void updateTable(Benchmark.Quality q) {
   benchmarkTableModel.setPredictions(
       mode == PredictionType.BugCount ? q.bcPredictions : q.tePredictions);
   benchmarkTable.updateUI();
 }