Ejemplo n.º 1
0
 @Deprecated
 public boolean editOrderCellAt(int row, int col) {
   if (row == -1 || col == -1) {
     return false;
   }
   boolean editCell = editCellAt(row, col, null);
   columnModel.getSelectionModel().setAnchorSelectionIndex(col);
   final TableCellEditor tableCellEditor = getCellEditor(row, col);
   if (tableCellEditor instanceof ComboCellEditor) {
     JComponent component = ((ComboCellEditor) tableCellEditor).getFocusComponent();
     if (component instanceof JComboBox) {
       component.requestFocus();
     }
   } else if (tableCellEditor instanceof DefaultCellEditor) {
     JTextField tf = (JTextField) ((DefaultCellEditor) tableCellEditor).getComponent();
     tf.requestFocus();
     tf.selectAll();
   } else if (tableCellEditor instanceof CheckBoxCellEditor) {
     ((CheckBoxCellEditor) tableCellEditor).getComponent().requestFocus();
   }
   getSelectionModel().setSelectionInterval(row, row);
   return editCell;
 }
Ejemplo n.º 2
0
 private void initTableCellComponents() {
   for (int k = 0; k < getModel().getColumnCount(); k++) {
     OrderTableColumn column = OrderTableColumn.valuerOf(k);
     TableColumn tableColumn = getColumnModel().getColumn(k);
     ComplexCell cellComp;
     switch (column) {
       case boardDef:
         tableColumn.setCellEditor(new BoardDefCellEditor(this));
         tableColumn.setCellRenderer(new EntityTableRenderer<BoardDef>());
         break;
       case texture:
         tableColumn.setCellEditor(new TextureCellEditor(this));
         tableColumn.setCellRenderer(new EntityTableRenderer<TextureEntity>());
         break;
       case manufacturer:
         TableEditorsRenders.ItemsComboBox<Manufacturer> cb =
             new TableEditorsRenders.ItemsComboBox<Manufacturer>();
         cb.getItems().addAll(FacadeContext.getManufacturerFacade().loadAllSortedBy("name"));
         tableColumn.setCellEditor(new DefaultCellEditor(cb));
         tableColumn.setCellRenderer(new EntityTableRenderer<Manufacturer>());
         break;
       case length:
       case width:
       case count:
         final JTextField tf = new JTextField();
         tf.setDocument(new NumericDocument());
         tableColumn.setCellEditor(new DefaultCellEditor(tf));
         break;
       case glueing:
         cellComp = new ComplexCell();
         tableColumn.setCellEditor(cellComp);
         tableColumn.setCellRenderer(new ButtonCellRenderer(true));
         break;
       case milling:
         millingCellEditor = new MillingCellEditor();
         tableColumn.setCellEditor(millingCellEditor);
         tableColumn.setCellRenderer(new DefaultTableRenderer(new MillingCheckBoxProvider()));
         break;
       case drilling:
         DrillingCellEditor editor = new DrillingCellEditor();
         editor.setContext(context);
         tableColumn.setCellEditor(editor);
         tableColumn.setCellRenderer(new ButtonCellRenderer(false));
         break;
       case groove:
         cellComp = new CommonCellEditor();
         tableColumn.setCellEditor(cellComp);
         tableColumn.setCellRenderer(new ButtonCellRenderer(true));
         break;
       case a45:
         cellComp = new TextSideCellEditor();
         tableColumn.setCellEditor(cellComp);
         tableColumn.setCellRenderer(new ButtonCellRenderer(true));
         break;
       case cutoff:
         tableColumn.setCellEditor(new PopupEditor(new CutoffComponentProvider()));
         tableColumn.setCellRenderer(new DefaultTableRenderer(new CutoffCheckBoxProvider()));
         break;
     }
     if (tableColumn.getCellEditor() instanceof DefaultCellEditor) {
       ((DefaultCellEditor) tableColumn.getCellEditor()).setClickCountToStart(1);
     }
   }
 }