Search in sources :

Example 1 with DefaultCellEditor

use of javax.swing.DefaultCellEditor in project adempiere by adempiere.

the class MiniTable method setColumnClass.

/**
	 *  Set Column Editor & Renderer to Class
	 *  (after all columns were added)
	 *  Layout of IDColumn depends on multiSelection
	 *  @param index column index
	 *  @param c   class of column - determines renderer/editors supported:
	 *  @param DisplayType define Type Value
	 *  IDColumn, Boolean, Double (Quantity), BigDecimal (Amount), Integer, Timestamp, String (default)
	 *  @param readOnly read only flag
	 *  @param header optional header value
	 */
public void setColumnClass(int index, @SuppressWarnings("rawtypes") Class c, int displayType, boolean readOnly, String header) {
    //	log.config( "MiniTable.setColumnClass - " + index, c.getName() + ", r/o=" + readOnly);
    TableColumn tc = getColumnModel().getColumn(index);
    if (tc == null)
        return;
    //  Set R/O
    setColumnReadOnly(index, readOnly);
    //  Header
    if (header != null && header.length() > 0)
        tc.setHeaderValue(Util.cleanAmp(header));
    //  ID Column & Selection
    if (c == IDColumn.class) {
        IDColumnRenderer idcr = new IDColumnRenderer(m_multiSelection);
        tc.setCellRenderer(idcr);
        if (m_multiSelection) {
            VHeaderRenderer vhr = new VHeaderRenderer(m_multiSelection);
            tc.setCellEditor(new IDColumnEditor());
            tc.setHeaderRenderer(vhr);
            //  Connect the IDColumn with the header
            idcr.addChangeListener(vhr);
            setColumnReadOnly(index, false);
        } else {
            tc.setCellEditor(new ROCellEditor());
            tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
        }
        m_minWidth.add(new Integer(10));
        tc.setMaxWidth(20);
        tc.setPreferredWidth(20);
        tc.setResizable(false);
    } else //  Boolean
    if (DisplayType.YesNo == displayType || c == Boolean.class) {
        CheckRenderer cr = new CheckRenderer();
        tc.setCellRenderer(cr);
        if (readOnly) {
            tc.setCellEditor(new ROCellEditor());
            tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.YesNo));
        } else {
            if (m_multiSelection) {
                VHeaderRenderer vhr = new VHeaderRenderer(m_multiSelection);
                setColumnReadOnly(index, false);
                CCheckBox check = new CCheckBox();
                check.setMargin(new Insets(0, 0, 0, 0));
                check.setHorizontalAlignment(SwingConstants.CENTER);
                tc.setCellEditor(new DefaultCellEditor(check));
                tc.setHeaderRenderer(vhr);
                //  Connect the check control with the header
                cr.addChangeListener(vhr);
            }
        }
        m_minWidth.add(new Integer(30));
    } else //  Date
    if (DisplayType.Date == displayType || DisplayType.DateTime == displayType || c == Timestamp.class) {
        if (DisplayType.DateTime == displayType)
            tc.setCellRenderer(new VCellRenderer(DisplayType.DateTime));
        else
            tc.setCellRenderer(new VCellRenderer(DisplayType.Date));
        if (readOnly)
            tc.setCellEditor(new ROCellEditor());
        else if (DisplayType.Date == displayType || DisplayType.DateTime == displayType)
            tc.setCellEditor(new MiniCellEditor(c, displayType));
        else
            tc.setCellEditor(new MiniCellEditor(c));
        m_minWidth.add(new Integer(30));
        if (DisplayType.DateTime == displayType)
            tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.DateTime));
        else
            tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.Date));
    } else //  Amount
    if (DisplayType.Amount == displayType || c == BigDecimal.class) {
        tc.setCellRenderer(new VCellRenderer(DisplayType.Amount));
        if (readOnly) {
            tc.setCellEditor(new ROCellEditor());
            m_minWidth.add(new Integer(70));
        } else {
            tc.setCellEditor(new MiniCellEditor(c));
            m_minWidth.add(new Integer(80));
        }
        tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
    } else //  Number
    if (DisplayType.Number == displayType || c == Double.class) {
        tc.setCellRenderer(new VCellRenderer(DisplayType.Number));
        if (readOnly) {
            tc.setCellEditor(new ROCellEditor());
            m_minWidth.add(new Integer(70));
        } else {
            tc.setCellEditor(new MiniCellEditor(c));
            m_minWidth.add(new Integer(80));
        }
        tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
    } else //  Integer
    if (DisplayType.Integer == displayType || c == Integer.class) {
        tc.setCellRenderer(new VCellRenderer(DisplayType.Integer));
        if (readOnly)
            tc.setCellEditor(new ROCellEditor());
        else
            tc.setCellEditor(new MiniCellEditor(c));
        m_minWidth.add(new Integer(30));
        tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
    } else //  String
    {
        tc.setCellRenderer(new VCellRenderer(DisplayType.String));
        if (readOnly)
            tc.setCellEditor(new ROCellEditor());
        else
            tc.setCellEditor(new MiniCellEditor(String.class));
        m_minWidth.add(new Integer(30));
        tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.String));
    }
//	log.fine( "Renderer=" + tc.getCellRenderer().toString() + ", Editor=" + tc.getCellEditor().toString());
}
Also used : Insets(java.awt.Insets) VCellRenderer(org.compiere.grid.ed.VCellRenderer) TableColumn(javax.swing.table.TableColumn) Timestamp(java.sql.Timestamp) DefaultCellEditor(javax.swing.DefaultCellEditor) CCheckBox(org.compiere.swing.CCheckBox) VHeaderRenderer(org.compiere.grid.ed.VHeaderRenderer)

Example 2 with DefaultCellEditor

use of javax.swing.DefaultCellEditor in project adempiere by adempiere.

the class POSTable method setColumnClass.

@Override
public void setColumnClass(int index, @SuppressWarnings("rawtypes") Class c, int displayType, boolean readOnly, String header) {
    //	logger.config( "MiniTable.setColumnClass - " + index, c.getName() + ", r/o=" + readOnly);
    TableColumn tableColumn = getColumnModel().getColumn(index);
    if (tableColumn == null)
        return;
    //  Set R/O
    setColumnReadOnly(index, readOnly);
    //  Header
    if (header != null && header.length() > 0)
        tableColumn.setHeaderValue(Util.cleanAmp(header));
    ArrayList<Integer> minWidth = new ArrayList<Integer>();
    boolean multiSelection = false;
    //  ID Column & Selection
    if (c == IDColumn.class) {
        IDColumnRenderer columnRenderer = new IDColumnRenderer(multiSelection);
        tableColumn.setCellRenderer(columnRenderer);
        if (multiSelection) {
            VHeaderRenderer headerRenderer = new VHeaderRenderer(multiSelection);
            tableColumn.setCellEditor(new IDColumnEditor());
            tableColumn.setHeaderRenderer(headerRenderer);
            //  Connect the IDColumn with the header
            columnRenderer.addChangeListener(headerRenderer);
            setColumnReadOnly(index, false);
        } else {
            tableColumn.setCellEditor(new ROCellEditor());
            tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
        }
        minWidth.add(new Integer(10));
        tableColumn.setMaxWidth(20);
        tableColumn.setPreferredWidth(20);
        tableColumn.setResizable(false);
    } else //  Boolean
    if (DisplayType.YesNo == displayType || c == Boolean.class) {
        CheckRenderer checkRenderer = new CheckRenderer();
        tableColumn.setCellRenderer(checkRenderer);
        if (readOnly) {
            tableColumn.setCellEditor(new ROCellEditor());
            tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.YesNo));
        } else {
            if (multiSelection) {
                VHeaderRenderer headerRenderer = new VHeaderRenderer(multiSelection);
                setColumnReadOnly(index, false);
                CCheckBox check = new CCheckBox();
                check.setMargin(new Insets(0, 0, 0, 0));
                check.setHorizontalAlignment(SwingConstants.CENTER);
                tableColumn.setCellEditor(new DefaultCellEditor(check));
                tableColumn.setHeaderRenderer(headerRenderer);
                //  Connect the check control with the header
                checkRenderer.addChangeListener(headerRenderer);
            }
        }
        minWidth.add(new Integer(30));
    } else //  Date
    if (DisplayType.Date == displayType || DisplayType.DateTime == displayType || c == Timestamp.class) {
        if (DisplayType.DateTime == displayType)
            tableColumn.setCellRenderer(new VCellRenderer(DisplayType.DateTime));
        else
            tableColumn.setCellRenderer(new VCellRenderer(DisplayType.Date));
        if (readOnly)
            tableColumn.setCellEditor(new ROCellEditor());
        else if (DisplayType.Date == displayType || DisplayType.DateTime == displayType)
            tableColumn.setCellEditor(new MiniCellEditor(c, displayType));
        else
            tableColumn.setCellEditor(new MiniCellEditor(c));
        minWidth.add(new Integer(30));
        if (DisplayType.DateTime == displayType)
            tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.DateTime));
        else
            tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.Date));
    } else //  Amount
    if (DisplayType.Amount == displayType || c == BigDecimal.class) {
        tableColumn.setCellRenderer(new VCellRenderer(DisplayType.Amount));
        if (readOnly) {
            tableColumn.setCellEditor(new ROCellEditor());
            minWidth.add(new Integer(70));
        } else {
            tableColumn.setCellEditor(new MiniCellEditor(c));
            minWidth.add(new Integer(80));
        }
        tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
    } else //  Number
    if (DisplayType.Number == displayType || c == Double.class) {
        tableColumn.setCellRenderer(new VCellRenderer(DisplayType.Number));
        if (readOnly) {
            tableColumn.setCellEditor(new ROCellEditor());
            minWidth.add(new Integer(70));
        } else {
            tableColumn.setCellEditor(new MiniCellEditor(c));
            minWidth.add(new Integer(80));
        }
        tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
    } else //  Integer
    if (DisplayType.Integer == displayType || c == Integer.class) {
        tableColumn.setCellRenderer(new VCellRenderer(DisplayType.Integer));
        if (readOnly)
            tableColumn.setCellEditor(new ROCellEditor());
        else
            tableColumn.setCellEditor(new MiniCellEditor(c));
        minWidth.add(new Integer(30));
        tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
    } else //  String
    {
        tableColumn.setCellRenderer(new VCellRenderer(DisplayType.String));
        if (readOnly)
            tableColumn.setCellEditor(new ROCellEditor());
        else
            tableColumn.setCellEditor(new MiniCellEditor(String.class));
        minWidth.add(new Integer(30));
        tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.String));
    }
//	logger.fine( "Renderer=" + tc.getCellRenderer().toString() + ", Editor=" + tc.getCellEditor().toString());
}
Also used : Insets(java.awt.Insets) CheckRenderer(org.compiere.minigrid.CheckRenderer) ArrayList(java.util.ArrayList) IDColumnRenderer(org.compiere.minigrid.IDColumnRenderer) VCellRenderer(org.compiere.grid.ed.VCellRenderer) IDColumnEditor(org.compiere.minigrid.IDColumnEditor) TableColumn(javax.swing.table.TableColumn) Timestamp(java.sql.Timestamp) ROCellEditor(org.compiere.minigrid.ROCellEditor) DefaultCellEditor(javax.swing.DefaultCellEditor) CCheckBox(org.compiere.swing.CCheckBox) MiniCellEditor(org.compiere.minigrid.MiniCellEditor) VHeaderRenderer(org.compiere.grid.ed.VHeaderRenderer)

Example 3 with DefaultCellEditor

use of javax.swing.DefaultCellEditor in project omegat by omegat-org.

the class RepositoriesMappingController method reinitRepoUrlDropdown.

void reinitRepoUrlDropdown() {
    JComboBox<String> comboBox = new JComboBox<>();
    for (RowRepo r : listRepo) {
        comboBox.addItem(r.url);
    }
    dialog.tableMapping.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(comboBox));
}
Also used : JComboBox(javax.swing.JComboBox) DefaultCellEditor(javax.swing.DefaultCellEditor)

Example 4 with DefaultCellEditor

use of javax.swing.DefaultCellEditor in project JMRI by JMRI.

the class LogixTableAction method createModel.

// *********** Methods for Logix Table Window ********************
/**
     * Create the JTable DataModel, along with the changes (overrides of
     * BeanTableDataModel) for the specific case of a Logix table.
     * <p>
     * Note: Table Models for the Conditional table in the Edit Logix window,
     * and the State Variable table in the Edit Conditional window are at
     * the end of this module.
     */
@Override
protected void createModel() {
    m = new BeanTableDataModel() {

        // overlay the state column with the edit column
        public static final int ENABLECOL = VALUECOL;

        public static final int EDITCOL = DELETECOL;

        protected String enabledString = Bundle.getMessage("ColumnHeadEnabled");

        @Override
        public String getColumnName(int col) {
            if (col == EDITCOL) {
                // no heading on "Edit"
                return "";
            }
            if (col == ENABLECOL) {
                return enabledString;
            }
            return super.getColumnName(col);
        }

        @Override
        public Class<?> getColumnClass(int col) {
            if (col == EDITCOL) {
                return String.class;
            }
            if (col == ENABLECOL) {
                return Boolean.class;
            }
            return super.getColumnClass(col);
        }

        @Override
        public int getPreferredWidth(int col) {
            // override default value for SystemName and UserName columns
            if (col == SYSNAMECOL) {
                return new JTextField(12).getPreferredSize().width;
            }
            if (col == USERNAMECOL) {
                return new JTextField(17).getPreferredSize().width;
            }
            if (col == EDITCOL) {
                return new JTextField(12).getPreferredSize().width;
            }
            if (col == ENABLECOL) {
                return new JTextField(5).getPreferredSize().width;
            }
            return super.getPreferredWidth(col);
        }

        @Override
        public boolean isCellEditable(int row, int col) {
            if (col == EDITCOL) {
                return true;
            }
            if (col == ENABLECOL) {
                return true;
            }
            return super.isCellEditable(row, col);
        }

        @Override
        public Object getValueAt(int row, int col) {
            if (col == EDITCOL) {
                return Bundle.getMessage("ButtonSelect");
            } else if (col == ENABLECOL) {
                Logix logix = (Logix) getBySystemName((String) getValueAt(row, SYSNAMECOL));
                if (logix == null) {
                    return null;
                }
                return Boolean.valueOf(logix.getEnabled());
            } else {
                return super.getValueAt(row, col);
            }
        }

        @Override
        public void setValueAt(Object value, int row, int col) {
            if (col == EDITCOL) {
                // set up to edit
                String sName = (String) getValueAt(row, SYSNAMECOL);
                if (Bundle.getMessage("ButtonEdit").equals(value)) {
                    editPressed(sName);
                } else if (rbx.getString("BrowserButton").equals(value)) {
                    conditionalRowNumber = row;
                    browserPressed(sName);
                } else if (Bundle.getMessage("ButtonCopy").equals(value)) {
                    copyPressed(sName);
                } else if (Bundle.getMessage("ButtonDelete").equals(value)) {
                    deletePressed(sName);
                }
            } else if (col == ENABLECOL) {
                // alternate
                Logix x = (Logix) getBySystemName((String) getValueAt(row, SYSNAMECOL));
                boolean v = x.getEnabled();
                x.setEnabled(!v);
            } else {
                super.setValueAt(value, row, col);
            }
        }

        /**
             * Delete the bean after all the checking has been done.
             * <p>
             * Deactivates the Logix and remove it's conditionals.
             *
             * @param bean of the Logix to delete
             */
        @Override
        void doDelete(NamedBean bean) {
            Logix l = (Logix) bean;
            l.deActivateLogix();
            // delete the Logix and all its Conditionals
            _logixManager.deleteLogix(l);
        }

        @Override
        protected boolean matchPropertyName(java.beans.PropertyChangeEvent e) {
            if (e.getPropertyName().equals(enabledString)) {
                return true;
            }
            return super.matchPropertyName(e);
        }

        @Override
        public Manager getManager() {
            return InstanceManager.getDefault(jmri.LogixManager.class);
        }

        @Override
        public NamedBean getBySystemName(String name) {
            return InstanceManager.getDefault(jmri.LogixManager.class).getBySystemName(name);
        }

        @Override
        public NamedBean getByUserName(String name) {
            return InstanceManager.getDefault(jmri.LogixManager.class).getByUserName(name);
        }

        @Override
        protected String getMasterClassName() {
            return getClassName();
        }

        @Override
        public void configureTable(JTable table) {
            table.setDefaultRenderer(Boolean.class, new EnablingCheckboxRenderer());
            table.setDefaultRenderer(JComboBox.class, new jmri.jmrit.symbolicprog.ValueRenderer());
            table.setDefaultEditor(JComboBox.class, new jmri.jmrit.symbolicprog.ValueEditor());
            super.configureTable(table);
        }

        /**
             * Replace delete button with comboBox to edit/delete/copy/select Logix.
             *
             * @param table name of the Logix JTable holding the column
             */
        @Override
        protected void configDeleteColumn(JTable table) {
            JComboBox<String> editCombo = new JComboBox<String>();
            editCombo.addItem(Bundle.getMessage("ButtonSelect"));
            editCombo.addItem(Bundle.getMessage("ButtonEdit"));
            editCombo.addItem(rbx.getString("BrowserButton"));
            editCombo.addItem(Bundle.getMessage("ButtonCopy"));
            editCombo.addItem(Bundle.getMessage("ButtonDelete"));
            TableColumn col = table.getColumnModel().getColumn(BeanTableDataModel.DELETECOL);
            col.setCellEditor(new DefaultCellEditor(editCombo));
        }

        // Not needed - here for interface compatibility
        @Override
        public void clickOn(NamedBean t) {
        }

        @Override
        public String getValue(String s) {
            return "";
        }

        @Override
        protected String getBeanType() {
            return Bundle.getMessage("BeanNameLogix");
        }
    };
}
Also used : NamedBean(jmri.NamedBean) LogixManager(jmri.LogixManager) JTextField(javax.swing.JTextField) LightManager(jmri.LightManager) InstanceManager(jmri.InstanceManager) MemoryManager(jmri.MemoryManager) LogixManager(jmri.LogixManager) ConditionalManager(jmri.ConditionalManager) TurnoutManager(jmri.TurnoutManager) UserPreferencesManager(jmri.UserPreferencesManager) OBlockManager(jmri.jmrit.logix.OBlockManager) SensorManager(jmri.SensorManager) WarrantManager(jmri.jmrit.logix.WarrantManager) Manager(jmri.Manager) SignalHeadManager(jmri.SignalHeadManager) SignalMastManager(jmri.SignalMastManager) JComboBox(javax.swing.JComboBox) TableColumn(javax.swing.table.TableColumn) DefaultCellEditor(javax.swing.DefaultCellEditor) Logix(jmri.Logix) JTable(javax.swing.JTable)

Example 5 with DefaultCellEditor

use of javax.swing.DefaultCellEditor in project JMRI by JMRI.

the class TableFrames method makeBlockFrame.

/*
     * ********************* BlockFrame *****************************
     */
protected JInternalFrame makeBlockFrame() {
    JInternalFrame frame = new JInternalFrame(Bundle.getMessage("TitleBlockTable"), true, false, false, true);
    _oBlockModel = new OBlockTableModel(this);
    _oBlockTable = new JTable(_oBlockModel);
    TableRowSorter<OBlockTableModel> sorter = new TableRowSorter<>(_oBlockModel);
    sorter.setComparator(OBlockTableModel.SYSNAMECOL, new jmri.util.SystemNameComparator());
    _oBlockTable.setRowSorter(sorter);
    _oBlockTable.setTransferHandler(new jmri.util.DnDTableImportExportHandler(new int[] { OBlockTableModel.EDIT_COL, OBlockTableModel.DELETE_COL, OBlockTableModel.REPORT_CURRENTCOL, OBlockTableModel.SPEEDCOL, OBlockTableModel.PERMISSIONCOL, OBlockTableModel.UNITSCOL }));
    _oBlockTable.setDragEnabled(true);
    // Use XTableColumnModel so we can control which columns are visible
    XTableColumnModel tcm = new XTableColumnModel();
    _oBlockTable.setColumnModel(tcm);
    _oBlockTable.getTableHeader().setReorderingAllowed(true);
    _oBlockTable.createDefaultColumnsFromModel();
    _oBlockModel.addHeaderListener(_oBlockTable);
    _oBlockTable.setDefaultEditor(JComboBox.class, new jmri.jmrit.symbolicprog.ValueEditor());
    _oBlockTable.getColumnModel().getColumn(OBlockTableModel.EDIT_COL).setCellEditor(new ButtonEditor(new JButton()));
    _oBlockTable.getColumnModel().getColumn(OBlockTableModel.EDIT_COL).setCellRenderer(new ButtonRenderer());
    _oBlockTable.getColumnModel().getColumn(OBlockTableModel.DELETE_COL).setCellEditor(new ButtonEditor(new JButton()));
    _oBlockTable.getColumnModel().getColumn(OBlockTableModel.DELETE_COL).setCellRenderer(new ButtonRenderer());
    _oBlockTable.getColumnModel().getColumn(OBlockTableModel.UNITSCOL).setCellRenderer(new MyBooleanRenderer(Bundle.getMessage("cm"), Bundle.getMessage("in")));
    JComboBox<String> box = new JComboBox<String>(OBlockTableModel.curveOptions);
    _oBlockTable.getColumnModel().getColumn(OBlockTableModel.CURVECOL).setCellEditor(new DefaultCellEditor(box));
    _oBlockTable.getColumnModel().getColumn(OBlockTableModel.REPORT_CURRENTCOL).setCellRenderer(new MyBooleanRenderer(Bundle.getMessage("Current"), Bundle.getMessage("Last")));
    box = new JComboBox<String>(jmri.InstanceManager.getDefault(SignalSpeedMap.class).getValidSpeedNames());
    box.addItem("");
    _oBlockTable.getColumnModel().getColumn(OBlockTableModel.SPEEDCOL).setCellEditor(new DefaultCellEditor(box));
    _oBlockTable.getColumnModel().getColumn(OBlockTableModel.PERMISSIONCOL).setCellRenderer(new MyBooleanRenderer(Bundle.getMessage("Permissive"), Bundle.getMessage("Absolute")));
    _oBlockTable.addMouseListener(new MouseAdapter() {

        @Override
        public void mousePressed(MouseEvent me) {
            showPopup(me);
        }

        @Override
        public void mouseReleased(MouseEvent me) {
            showPopup(me);
        }
    });
    for (int i = 0; i < _oBlockModel.getColumnCount(); i++) {
        int width = _oBlockModel.getPreferredWidth(i);
        _oBlockTable.getColumnModel().getColumn(i).setPreferredWidth(width);
    }
    _oBlockTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    ROW_HEIGHT = _oBlockTable.getRowHeight();
    int tableWidth = _desktop.getPreferredSize().width;
    _oBlockTable.setPreferredScrollableViewportSize(new java.awt.Dimension(tableWidth, ROW_HEIGHT * 10));
    _blockTablePane = new JScrollPane(_oBlockTable);
    tcm.setColumnVisible(tcm.getColumnByModelIndex(OBlockTableModel.REPORTERCOL), false);
    tcm.setColumnVisible(tcm.getColumnByModelIndex(OBlockTableModel.REPORT_CURRENTCOL), false);
    tcm.setColumnVisible(tcm.getColumnByModelIndex(OBlockTableModel.PERMISSIONCOL), false);
    //        tcm.setColumnVisible(tcm.getColumnByModelIndex(OBlockTableModel.SPEEDCOL), false);
    //        tcm.setColumnVisible(tcm.getColumnByModelIndex(OBlockTableModel.ERR_SENSORCOL), false);
    tcm.setColumnVisible(tcm.getColumnByModelIndex(OBlockTableModel.CURVECOL), false);
    JPanel contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout(5, 5));
    JLabel prompt = new JLabel(Bundle.getMessage("AddBlockPrompt"));
    contentPane.add(prompt, BorderLayout.NORTH);
    contentPane.add(_blockTablePane, BorderLayout.CENTER);
    frame.setContentPane(contentPane);
    frame.pack();
    return frame;
}
Also used : JPanel(javax.swing.JPanel) ButtonEditor(jmri.util.table.ButtonEditor) JButton(javax.swing.JButton) SignalSpeedMap(jmri.implementation.SignalSpeedMap) BorderLayout(java.awt.BorderLayout) TableRowSorter(javax.swing.table.TableRowSorter) JScrollPane(javax.swing.JScrollPane) MouseEvent(java.awt.event.MouseEvent) JComboBox(javax.swing.JComboBox) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) XTableColumnModel(jmri.util.swing.XTableColumnModel) Point(java.awt.Point) DefaultCellEditor(javax.swing.DefaultCellEditor) Dimension(java.awt.Dimension) JTable(javax.swing.JTable) JInternalFrame(javax.swing.JInternalFrame) ButtonRenderer(jmri.util.table.ButtonRenderer)

Aggregations

DefaultCellEditor (javax.swing.DefaultCellEditor)72 JComboBox (javax.swing.JComboBox)41 JTable (javax.swing.JTable)28 TableColumn (javax.swing.table.TableColumn)28 JScrollPane (javax.swing.JScrollPane)18 JPanel (javax.swing.JPanel)14 Component (java.awt.Component)13 JButton (javax.swing.JButton)13 ActionEvent (java.awt.event.ActionEvent)12 JLabel (javax.swing.JLabel)11 JTextField (javax.swing.JTextField)11 TableColumnModel (javax.swing.table.TableColumnModel)10 FlowLayout (java.awt.FlowLayout)9 ActionListener (java.awt.event.ActionListener)9 BoxLayout (javax.swing.BoxLayout)9 PaddedComboBox (CCDD.CcddClassesComponent.PaddedComboBox)8 Point (java.awt.Point)8 TableCellEditor (javax.swing.table.TableCellEditor)8 JCheckBox (javax.swing.JCheckBox)7 Dimension (java.awt.Dimension)6