@SuppressWarnings("unchecked")
      private Object initDynamicDefinitionComponent() {
        final String selectedPrimitiveFormName =
            _dotDefinitionDialogFrame.getSelectedPrimitiveForm();
        final DOTProperty currentProperty = _dotDefinitionDialogFrame.getSelectedProperty();
        PrimitiveFormPropertyPair pfpPair =
            new PrimitiveFormPropertyPair(selectedPrimitiveFormName, currentProperty);
        final JTable workWithThisTable = _dynamicTables.get(pfpPair);

        int selectedRow = workWithThisTable.getSelectedRow();
        if (selectedRow == -1) {
          if (workWithThisTable.getModel().getRowCount() > 0) {
            selectedRow = 0;
          } else {
            return null;
          }
        }
        selectedRow = workWithThisTable.convertRowIndexToModel(selectedRow);
        final TableModel model = workWithThisTable.getModel();
        DynamicDOTItemManager dynamicDOTItemManager = (DynamicDOTItemManager) model;
        final DisplayObjectTypeItemWithInterval dotItemWithInterval =
            dynamicDOTItemManager.get(selectedRow);
        _dynamicDefinitionComponent.fillComponents(dotItemWithInterval);
        return dotItemWithInterval.getItem().getPropertyValue();
      }
  /**
   * This method indicates whether changes to the model should cause the width to be dynamically
   * recalculated.
   *
   * @param isDynamicAdjustment Boolean value to determine if the width should be dynamically
   *     calculated
   */
  public void setDynamicAdjustment(boolean isDynamicAdjustment) {
    //  May need to add or remove the TableModelListener when changed

    if (this.isDynamicAdjustment != isDynamicAdjustment) {
      if (isDynamicAdjustment) {
        table.addPropertyChangeListener(this);
        table.getModel().addTableModelListener(this);
      } else {
        table.removePropertyChangeListener(this);
        table.getModel().removeTableModelListener(this);
      }
    }

    this.isDynamicAdjustment = isDynamicAdjustment;
  }
Esempio n. 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();
 }
  @Override
  protected void customizeCellRenderer(
      JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {
    if (!(value instanceof String)) {
      return;
    }

    String s = (String) value;
    if (shouldClip(s)) {
      s = clip(s);
    }

    SimpleTextAttributes attributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
    String problem = ((StringResourceTableModel) table.getModel()).getCellProblem(row, column);
    if (problem != null) {
      if (ConstantColumn.KEY.ordinal() == column) {
        attributes = SimpleTextAttributes.ERROR_ATTRIBUTES;
      } else {
        attributes = CELL_ERROR_ATTRIBUTES;
      }
    }

    Font currentFont = table.getFont();
    Font f = FontUtil.getFontAbleToDisplay(s, currentFont);
    if (currentFont != f) {
      setFont(f);
    }

    setToolTipText(problem);
    append(s, attributes);
  }
Esempio n. 5
0
 @Override
 public void actionPerformed(ActionEvent e) {
   // Object o = table.getModel().getValueAt(table.getSelectedRow(), 0);
   int row = table.convertRowIndexToModel(table.getEditingRow());
   Object o = table.getModel().getValueAt(row, 0);
   JOptionPane.showMessageDialog(table, "Editing: " + o);
 }
  @Override
  protected void updateButtons() {
    final CommonActionsPanel p = getActionsPanel();
    if (p != null) {
      boolean someElementSelected;
      if (myTable.isEnabled()) {
        final int index = myTable.getSelectedRow();
        final int size = myTable.getModel().getRowCount();
        someElementSelected = 0 <= index && index < size;
        if (someElementSelected) {
          final boolean downEnable = myTable.getSelectionModel().getMaxSelectionIndex() < size - 1;
          final boolean upEnable = myTable.getSelectionModel().getMinSelectionIndex() > 0;
          final boolean editEnabled = myTable.getSelectedRowCount() == 1;
          p.setEnabled(CommonActionsPanel.Buttons.EDIT, editEnabled);
          p.setEnabled(CommonActionsPanel.Buttons.UP, upEnable);
          p.setEnabled(CommonActionsPanel.Buttons.DOWN, downEnable);
        } else {
          p.setEnabled(CommonActionsPanel.Buttons.EDIT, false);
          p.setEnabled(CommonActionsPanel.Buttons.UP, false);
          p.setEnabled(CommonActionsPanel.Buttons.DOWN, false);
        }
        p.setEnabled(
            CommonActionsPanel.Buttons.ADD, myProducer == null || myProducer.canCreateElement());
      } else {
        someElementSelected = false;
        p.setEnabled(CommonActionsPanel.Buttons.ADD, false);
        p.setEnabled(CommonActionsPanel.Buttons.EDIT, false);
        p.setEnabled(CommonActionsPanel.Buttons.UP, false);
        p.setEnabled(CommonActionsPanel.Buttons.DOWN, false);
      }

      p.setEnabled(CommonActionsPanel.Buttons.REMOVE, someElementSelected);
      updateExtraElementActions(someElementSelected);
    }
  }
    public void popuniSaPodacima(long idSelektiranogKlijenta) {
        // Isprazni tabelu dostava
        //obracuniJTable.setModel(new ObracuniTableModel());

        // Uzmi sve klijente iz baze
        Baza baza = Baza.getBaza();
        List<Klijent> sviKlijenti = baza.dajSve(Klijent.class);
        // izfiltriraj one klijente koji su obrisani
        ukloniObrisaneKlijenteIz(sviKlijenti);

        // Napravi jComboBoxItem-ove sa svim klijentima
        List<JComboBoxItem> sviKlijentiJComboBoxItemi = new ArrayList<JComboBoxItem>();
        for (Klijent k : sviKlijenti) {
            sviKlijentiJComboBoxItemi.add(new JComboBoxItem(k.getId(), k.getIme()));
        }
        // Popuni obracunZaJComboBox sa JComboBoxItem-ovima
        GuiUtilities.popuniJComboBoxSa(sviKlijentiJComboBoxItemi, obracunZaJComboBox, idSelektiranogKlijenta);

        // Popuni tabelu obracuni sa obracunima za klijenta koji ima idSelektiranogKlijenta
        Klijent selektiraniKlijent = baza.dajPoId(Klijent.class, idSelektiranogKlijenta);
        popuniObracuniJTableSaPodacimaOKlijentu(selektiraniKlijent);
        // Oznaci prvi red u tabeli za dostave
        if (obracuniJTable.getRowCount() > 0) {
            ListSelectionModel selectionModel = obracuniJTable.getSelectionModel();
            selectionModel.setSelectionInterval(0, 0);

            // Uzmi oznaceni obracun iz tabele Racun
            Racun oznaceniRacun = ((ObracuniTableModel) obracuniJTable.getModel()).getRacuniZaKlijenta()
                    .get(obracuniJTable.getSelectedRow());
        }

        // Refreshati panel
        osvjeziJPanel();
    }
    @Override
    public void valueChanged(ListSelectionEvent e) {

      if (!e.getValueIsAdjusting()) {
        int rowNum = table.getSelectedRow();
        if (rowNum >= 0) {
          // get table model
          PeptideSpeciesPSMTableModel pepTableModel =
              (PeptideSpeciesPSMTableModel) table.getModel();

          // get spectrum reference column
          int identColNum =
              pepTableModel.getColumnIndex(PeptideTableHeader.IDENTIFICATION_ID.getHeader());
          int peptideColNum =
              pepTableModel.getColumnIndex(PeptideTableHeader.PEPTIDE_ID.getHeader());

          // get spectrum id
          int modelRowIndex = table.convertRowIndexToModel(rowNum);
          Comparable identId = (Comparable) pepTableModel.getValueAt(modelRowIndex, identColNum);
          Comparable peptideId =
              (Comparable) pepTableModel.getValueAt(modelRowIndex, peptideColNum);

          logger.debug(
              "Peptide table selection:  Protein id: " + identId + " Peptide Id: " + peptideId);

          // fire a background task to retrieve peptide
          if (peptideId != null && identId != null) {
            // publish the event to local event bus
            EventService eventBus =
                ContainerEventServiceFinder.getEventService(PeptidePSMPane.this);
            eventBus.publish(new PSMEvent(PeptidePSMPane.this, controller, identId, peptideId));
          }
        }
      }
    }
 public CenterPanel(RegisterPanel rp) {
   super();
   setLayout(new BorderLayout());
   this.rp = rp;
   rp.setJT(jt);
   JScrollPane jsp = new JScrollPane(jt);
   setBackground(Color.BLACK);
   add(jsp, BorderLayout.CENTER);
   tm = (DefaultTableModel) jt.getModel();
   tm.addColumn("ID");
   tm.addColumn("Barcode");
   tm.addColumn("Name");
   tm.addColumn("Qty");
   tm.addColumn("Price");
   tm.addColumn("Tax");
   tm.addColumn("Total");
   // tm.setRowCount(50);
   // jt.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
   jt.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
   jt.getColumnModel().getColumn(0).setPreferredWidth(20);
   jt.getColumnModel().getColumn(1).setPreferredWidth(150);
   jt.getColumnModel().getColumn(2).setPreferredWidth(300);
   jt.getColumnModel().getColumn(3).setPreferredWidth(20);
   jt.setFont(new Font("Arial", Font.BOLD, 18));
   jt.setRowHeight(30);
 }
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   final Color color = UIUtil.getTableFocusCellBackground();
   Component component;
   T t = (T) value;
   try {
     UIManager.put(UIUtil.TABLE_FOCUS_CELL_BACKGROUND_PROPERTY, table.getSelectionBackground());
     component =
         super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
     setText(t != null ? getItemText(t) : "");
     if (component instanceof JLabel) {
       ((JLabel) component).setBorder(noFocusBorder);
     }
   } finally {
     UIManager.put(UIUtil.TABLE_FOCUS_CELL_BACKGROUND_PROPERTY, color);
   }
   final MyTableModel model = (MyTableModel) table.getModel();
   component.setEnabled(
       ElementsChooser.this.isEnabled()
           && (myColorUnmarkedElements ? model.isElementMarked(row) : true));
   final ElementProperties properties = myElementToPropertiesMap.get(t);
   if (component instanceof JLabel) {
     final Icon icon =
         properties != null ? properties.getIcon() : t != null ? getItemIcon(t) : null;
     JLabel label = (JLabel) component;
     label.setIcon(icon);
     label.setDisabledIcon(icon);
   }
   component.setForeground(
       properties != null && properties.getColor() != null
           ? properties.getColor()
           : (isSelected ? table.getSelectionForeground() : table.getForeground()));
   return component;
 }
 @Override
 protected void customizeParametersTable(
     TableView<ParameterTableModelItemBase<ParameterInfoImpl>> table) {
   final JTable t = table.getComponent();
   final TableColumn defaultValue = t.getColumnModel().getColumn(2);
   final TableColumn varArg = t.getColumnModel().getColumn(3);
   t.removeColumn(defaultValue);
   t.removeColumn(varArg);
   t.getModel()
       .addTableModelListener(
           new TableModelListener() {
             @Override
             public void tableChanged(TableModelEvent e) {
               if (e.getType() == TableModelEvent.INSERT) {
                 t.getModel().removeTableModelListener(this);
                 final TableColumnAnimator animator = new TableColumnAnimator(t);
                 animator.setStep(48);
                 animator.addColumn(defaultValue, (t.getWidth() - 48) / 3);
                 animator.addColumn(varArg, 48);
                 animator.startAndDoWhenDone(
                     new Runnable() {
                       @Override
                       public void run() {
                         t.editCellAt(t.getRowCount() - 1, 0);
                       }
                     });
                 animator.start();
               }
             }
           });
 }
 /** Creates and displays the main GUI This GUI has the list and the main * buttons */
 public void showGUI() {
   final JScrollPane scrollPane = new JScrollPane();
   table =
       new JTable(
           new DefaultTableModel(
               new Object[][] {}, new String[] {"Username", "Password", "Pin", "Reward"}));
   AccountManager.loadAccounts();
   if (AccountManager.hasAccounts()) {
     for (Account account : AccountManager.getAccounts()) {
       ((DefaultTableModel) table.getModel())
           .addRow(
               new Object[] {
                 account.getUsername(), account.getReward(), account.getPin(), account.getReward()
               });
     }
   }
   final JToolBar bar = new JToolBar();
   bar.setMargin(new Insets(1, 1, 1, 1));
   bar.setFloatable(false);
   removeButton = new JButton("Remove");
   final JButton newButton = new JButton("Add");
   final JButton doneButton = new JButton("Save");
   table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   table.getSelectionModel().addListSelectionListener(new TableSelectionListener());
   table.setShowGrid(true);
   final TableColumnModel cm = table.getColumnModel();
   cm.getColumn(cm.getColumnIndex("Password")).setCellRenderer(new PasswordCellRenderer());
   cm.getColumn(cm.getColumnIndex("Password")).setCellEditor(new PasswordCellEditor());
   cm.getColumn(cm.getColumnIndex("Pin")).setCellRenderer(new PasswordCellRenderer());
   cm.getColumn(cm.getColumnIndex("Pin")).setCellEditor(new PasswordCellEditor());
   cm.getColumn(cm.getColumnIndex("Reward")).setCellEditor(new RandomRewardEditor());
   scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
   scrollPane.setViewportView(table);
   add(scrollPane, BorderLayout.CENTER);
   newButton.setFocusable(false);
   newButton.setToolTipText(newButton.getText());
   newButton.setText("+");
   bar.add(newButton);
   removeButton.setFocusable(false);
   removeButton.setToolTipText(removeButton.getText());
   removeButton.setText("-");
   bar.add(removeButton);
   bar.add(Box.createHorizontalGlue());
   doneButton.setToolTipText(doneButton.getText());
   bar.add(doneButton);
   newButton.addActionListener(this);
   removeButton.addActionListener(this);
   doneButton.addActionListener(this);
   add(bar, BorderLayout.SOUTH);
   final int row = table.getSelectedRow();
   removeButton.setEnabled(row >= 0 && row < table.getRowCount());
   table.clearSelection();
   doneButton.requestFocus();
   setPreferredSize(new Dimension(600, 300));
   pack();
   setLocationRelativeTo(getOwner());
   setResizable(false);
 }
 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;
 }
 public void saveData() {
   TableUtil.stopEditing(myTable);
   final int count = myTable.getRowCount();
   String[] urls = ArrayUtil.newStringArray(count);
   for (int row = 0; row < count; row++) {
     final TableItem item = ((MyTableModel) myTable.getModel()).getTableItemAt(row);
     urls[row] = item.getUrl();
   }
   getModel().setRootUrls(AnnotationOrderRootType.getInstance(), urls);
 }
  @NotNull
  private static MyModel setTableModel(
      @NotNull JTable table,
      @NotNull UsageViewImpl usageView,
      @NotNull final List<UsageNode> data) {
    ApplicationManager.getApplication().assertIsDispatchThread();
    final int columnCount = calcColumnCount(data);
    MyModel model = table.getModel() instanceof MyModel ? (MyModel) table.getModel() : null;
    if (model == null || model.getColumnCount() != columnCount) {
      model = new MyModel(data, columnCount);
      table.setModel(model);

      ShowUsagesTableCellRenderer renderer = new ShowUsagesTableCellRenderer(usageView);
      for (int i = 0; i < table.getColumnModel().getColumnCount(); i++) {
        TableColumn column = table.getColumnModel().getColumn(i);
        column.setCellRenderer(renderer);
      }
    }
    return model;
  }
Esempio n. 16
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();
    }
  }
Esempio n. 17
0
  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();
  }
Esempio n. 18
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);
   }
 }
Esempio n. 19
0
 public void valueChanged(ListSelectionEvent e) {
   if (table.getSelectedRow() == -1) {
     // Clear the messageTextArea since there is none packet selected
     messageTextArea.setText(null);
   } else {
     // Set the detail of the packet in the messageTextArea
     messageTextArea.setText((String) table.getModel().getValueAt(table.getSelectedRow(), 0));
     // Scroll up to the top
     messageTextArea.setCaretPosition(0);
   }
 }
 public void actionPerformed(final ActionEvent e) {
   if (e.getSource() instanceof JButton) {
     final JButton button = (JButton) e.getSource();
     if (button.getText().equals("Save")) {
       AccountManager.getAccounts().clear();
       String[] data = new String[4];
       for (int i = 0; i < table.getRowCount(); i++) {
         for (int x = 0; x < table.getColumnCount(); x++) {
           data[x] = (String) table.getValueAt(i, x);
         }
         AccountManager.getAccounts().add(new Account(data[0], data[1], data[2], data[3]));
       }
       AccountManager.saveAccounts();
       dispose();
     } else if (button.getToolTipText().equals("Add")) {
       final String str =
           JOptionPane.showInputDialog(
               getParent(),
               "Enter the account username:"******"New Account",
               JOptionPane.QUESTION_MESSAGE);
       if (str == null || str.isEmpty()) {
         return;
       }
       final int row = table.getRowCount();
       ((DefaultTableModel) table.getModel()).addRow(new Object[] {str, null, null, null});
       ((DefaultTableModel) table.getModel()).fireTableRowsInserted(row, row);
     } else if (button.getToolTipText().equals("Remove")) {
       final int row = table.getSelectedRow();
       final String user = (String) table.getModel().getValueAt(table.getSelectedRow(), 0);
       if (user != null) {
         for (int i = 0; i < AccountManager.getAccounts().size(); i++) {
           if (AccountManager.getAccounts().get(i).getUsername().equals(user)) {
             AccountManager.getAccounts().remove(i);
           }
         }
         ((DefaultTableModel) table.getModel()).fireTableRowsDeleted(row, row);
       }
     }
   }
 }
    @Nullable
    private SvnFileRevision getSelectedRevision(final MouseEvent e) {
      JTable table = (JTable) e.getSource();
      int row = table.rowAtPoint(e.getPoint());
      int column = table.columnAtPoint(e.getPoint());

      final Object value = table.getModel().getValueAt(row, column);
      if (value instanceof SvnFileRevision) {
        return (SvnFileRevision) value;
      }
      return null;
    }
Esempio n. 22
0
  public void createviewPanel() {

    viewPanel = new JPanel();
    viewPanel.setLayout(new BorderLayout());
    // viewPanel.setPreferredSize( new Dimension(500,500 ));
    // viewPanel.setMinimumSize( new Dimension(100,50));
    // viewPanel.add( new JLabel("Notes:"),BorderLayout.NORTH );
    //		viewPanel.add( new JTextArea(), BorderLayout.CENTER );
    viewPanel.setPreferredSize(new Dimension(200, 520));
    viewPanel.setMinimumSize(new Dimension(100, 100));
    // Create columns
    CreateColumns(colcnt);
    CreateData(rowcnt, colcnt);
    setSize(300, 200);

    table =
        new JTable(dataValues, columnNames) {

          public boolean isCellEditable(int rowIndex, int vColIndex) {
            return false;
          }
        };

    table
        .getModel()
        .addTableModelListener(
            new TableModelListener() {

              public void tableChanged(TableModelEvent e) {
                System.out.println("........" + e);
              }
            });
    // table.setValueAt("1,2",0,0);

    System.out.println("Row   :" + rowcnt);
    System.out.println("Col  :" + colcnt);

    // Configure some of JTable's paramters
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);
    table.setRowSelectionAllowed(false);
    table.setColumnSelectionAllowed(false);

    // Change the selection colour
    table.setSelectionForeground(Color.white);
    table.setSelectionBackground(Color.red);

    // Add the table to a scrolling pane
    scrollPaneTable = JTable.createScrollPaneForTable(table);
    viewPanel.add(scrollPaneTable, BorderLayout.CENTER);
    viewPanel.add(table, BorderLayout.CENTER);
  }
Esempio n. 23
0
    @Override
    public Component getTableCellEditorComponent(
        JTable table, Object value, boolean isSelected, int row, int column) {
      MyTableModel tableModel = (MyTableModel) table.getModel();
      DefaultComboBoxModel comboModel = new DefaultComboBoxModel();

      for (ValidationResult.Option each : tableModel.getOptions(row)) {
        comboModel.addElement(each);
      }
      ((JComboBox) editorComponent).setModel(comboModel);

      return super.getTableCellEditorComponent(table, value, isSelected, row, column);
    }
Esempio n. 24
0
 @Override
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   JLabel l =
       (JLabel)
           tcr.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
   PluginTableModel model = (PluginTableModel) table.getModel();
   Icon icon =
       (column == model.sortType) ? (model.sortDirection == 1) ? ASC_ICON : DESC_ICON : null;
   l.setIcon(icon);
   // l.setHorizontalTextPosition(l.LEADING);
   return l;
 }
  private void onOk() {
    // check if we have any subscriptions added
    if (subscriptionTable.getModel().getRowCount() == 0) {
      JOptionPane.showMessageDialog(
          this,
          "Please Sign In/Import your Azure subscription(s).",
          "Manage Azure Subscriptions",
          JOptionPane.INFORMATION_MESSAGE);
      return;
    }

    dialogResult = DialogResult.OK;
    dispose();
  }
 public void updateMetricsResults(
     MetricsRun run, MetricDisplaySpecification displaySpecification) {
   final MetricCategory[] categories = MetricCategory.values();
   for (final MetricCategory category : categories) {
     final JTable table = tables.get(category);
     final MetricTableModel model = (MetricTableModel) table.getModel();
     model.setResults(run.getResultsForCategory(category));
     final String shortName = MetricsCategoryNameUtil.getShortNameForCategory(category);
     setRenderers(table, shortName);
     final MetricTableSpecification specification =
         displaySpecification.getSpecification(category);
     setColumnWidths(table, specification);
   }
 }
Esempio n. 27
0
    @Override
    public void onEvent(ChangeRankingThresholdEvent event) {
      int rankingThreshold = event.getRankingThreshold();

      // table model
      PeptideSpeciesPSMTableModel peptideSpeciesTableModel =
          (PeptideSpeciesPSMTableModel) table.getModel();
      peptideSpeciesTableModel.setRankingThreshold(rankingThreshold);
      table.changeSelection(
          0,
          peptideSpeciesTableModel.getColumnIndex(PeptideTableHeader.PEPTIDE_COLUMN.getHeader()),
          false,
          false);
    }
Esempio n. 28
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();
   }
 }
  public void fixSelection(int rows[]) {
    if (rows.length == 0) return;

    table.getSelectionModel().setValueIsAdjusting(true);

    int rowcount = table.getModel().getRowCount();

    for (int x = 0; x < rows.length; x++) {
      if (rows[x] < rowcount) {
        table.getSelectionModel().addSelectionInterval(rows[x], rows[x]);
      }
    }

    table.getSelectionModel().setValueIsAdjusting(false);
  }
 @SuppressWarnings("unchecked")
 protected void whenClassroomsTableSelectionChanged(ListSelectionEvent anEvent) {
   DefaultListSelectionModel source = (DefaultListSelectionModel) anEvent.getSource();
   if (source.isSelectionEmpty()) {
     classroomSelected = null;
     moveAssignmentOfClassroomButton.setEnabled(false);
   } else {
     int index = source.getMinSelectionIndex();
     List<Classroom> model =
         ((ReadOnlyTableModel<Classroom>) classroomsTable.getModel()).getModel();
     classroomSelected = model.get(index);
     moveAssignmentOfClassroomButton.setEnabled(
         !classroomSelected.equals(assignment.getAssignableItem()));
   }
 }