Search in sources :

Example 31 with TableCellEditor

use of javax.swing.table.TableCellEditor in project intellij-community by JetBrains.

the class ProcessorProfilePanel method createTablePanel.

private static JPanel createTablePanel(final JBTable table) {
    return ToolbarDecorator.createDecorator(table).disableUpAction().disableDownAction().setAddAction(new AnActionButtonRunnable() {

        @Override
        public void run(AnActionButton anActionButton) {
            final TableCellEditor cellEditor = table.getCellEditor();
            if (cellEditor != null) {
                cellEditor.stopCellEditing();
            }
            final TableModel model = table.getModel();
            ((EditableModel) model).addRow();
            TableUtil.editCellAt(table, model.getRowCount() - 1, 0);
        }
    }).createPanel();
}
Also used : EditableModel(com.intellij.util.ui.EditableModel) TableCellEditor(javax.swing.table.TableCellEditor) AbstractTableModel(javax.swing.table.AbstractTableModel) TableModel(javax.swing.table.TableModel)

Example 32 with TableCellEditor

use of javax.swing.table.TableCellEditor in project intellij-community by JetBrains.

the class EncapsulateFieldsDialog method doAction.

protected void doAction() {
    if (myTable.isEditing()) {
        TableCellEditor editor = myTable.getCellEditor();
        if (editor != null) {
            editor.stopCellEditing();
        }
    }
    String errorString = validateData();
    if (errorString != null) {
        // were errors
        CommonRefactoringUtil.showErrorMessage(REFACTORING_NAME, errorString, HelpID.ENCAPSULATE_FIELDS, myProject);
        return;
    }
    if (getCheckedRows().length == 0) {
        CommonRefactoringUtil.showErrorMessage(REFACTORING_NAME, "Nothing found to encapsulate", HelpID.ENCAPSULATE_FIELDS, myProject);
        return;
    }
    invokeRefactoring(new EncapsulateFieldsProcessor(myProject, this));
    JavaRefactoringSettings settings = JavaRefactoringSettings.getInstance();
    settings.ENCAPSULATE_FIELDS_USE_ACCESSORS_WHEN_ACCESSIBLE = myCbUseAccessorsWhenAccessible.isSelected();
}
Also used : JavaRefactoringSettings(com.intellij.refactoring.JavaRefactoringSettings) TableCellEditor(javax.swing.table.TableCellEditor)

Example 33 with TableCellEditor

use of javax.swing.table.TableCellEditor in project intellij-community by JetBrains.

the class ArrangementMatchingRulesControl method hideEditor.

public void hideEditor() {
    if (myEditorRow < 0) {
        return;
    }
    if (isEditing()) {
        TableCellEditor editor = getCellEditor();
        if (editor != null) {
            editor.stopCellEditing();
        }
    }
    mySkipSelectionChange = true;
    try {
        ArrangementMatchingRulesModel model = getModel();
        model.removeRow(myEditorRow);
        if (myEditorRow > 0 && model.getElementAt(myEditorRow - 1) instanceof EmptyArrangementRuleComponent) {
            model.removeRow(myEditorRow - 1);
        }
    } finally {
        mySkipSelectionChange = false;
    }
    myEditorRow = -1;
}
Also used : AbstractTableCellEditor(com.intellij.util.ui.AbstractTableCellEditor) TableCellEditor(javax.swing.table.TableCellEditor)

Example 34 with TableCellEditor

use of javax.swing.table.TableCellEditor in project intellij-community by JetBrains.

the class RegistryUi method show.

public boolean show() {
    DialogWrapper dialog = new DialogWrapper(true) {

        {
            setTitle("Registry");
            setModal(true);
            init();
            revaliateActions();
        }

        private AbstractAction myCloseAction;

        @Nullable
        @Override
        protected JComponent createNorthPanel() {
            if (!ApplicationManager.getApplication().isInternal()) {
                JLabel warningLabel = new JLabel(XmlStringUtil.wrapInHtml("<b>Changing these values may cause unwanted behavior of " + ApplicationNamesInfo.getInstance().getFullProductName() + ". Please do not change these unless you have been asked.</b>"));
                warningLabel.setIcon(UIUtil.getWarningIcon());
                warningLabel.setForeground(JBColor.RED);
                return warningLabel;
            }
            return null;
        }

        @Override
        protected JComponent createCenterPanel() {
            return myContent;
        }

        @Override
        protected void dispose() {
            super.dispose();
            RegistryUi.this.dispose();
        }

        @Override
        protected String getDimensionServiceKey() {
            return "Registry";
        }

        @Override
        public JComponent getPreferredFocusedComponent() {
            return myTable;
        }

        @NotNull
        @Override
        protected Action[] createActions() {
            return new Action[] { myRestoreDefaultsAction, myCloseAction };
        }

        @Override
        protected void createDefaultActions() {
            super.createDefaultActions();
            myCloseAction = new AbstractAction("Close") {

                @Override
                public void actionPerformed(@NotNull ActionEvent e) {
                    processClose();
                    doOKAction();
                }
            };
            myCloseAction.putValue(DialogWrapper.DEFAULT_ACTION, true);
        }

        @Override
        public void doCancelAction() {
            final TableCellEditor cellEditor = myTable.getCellEditor();
            if (cellEditor != null) {
                cellEditor.stopCellEditing();
            }
            processClose();
            super.doCancelAction();
        }
    };
    return dialog.showAndGet();
}
Also used : ShadowAction(com.intellij.openapi.ui.ShadowAction) ActionEvent(java.awt.event.ActionEvent) TableCellEditor(javax.swing.table.TableCellEditor) DialogWrapper(com.intellij.openapi.ui.DialogWrapper)

Example 35 with TableCellEditor

use of javax.swing.table.TableCellEditor in project intellij-community by JetBrains.

the class BindToExistingBeanStep method _commit.

public void _commit(boolean finishChosen) {
    // Stop editing if any
    final TableCellEditor cellEditor = myTable.getCellEditor();
    if (cellEditor != null) {
        cellEditor.stopCellEditing();
    }
    myData.myGenerateIsModified = myChkIsModified.isSelected();
// TODO[vova] check that at least one binding field exists
}
Also used : TableCellEditor(javax.swing.table.TableCellEditor)

Aggregations

TableCellEditor (javax.swing.table.TableCellEditor)62 JButton (javax.swing.JButton)37 ButtonEditor (jmri.util.table.ButtonEditor)33 ButtonRenderer (jmri.util.table.ButtonRenderer)33 TableColumnModel (javax.swing.table.TableColumnModel)23 JLabel (javax.swing.JLabel)14 JTable (javax.swing.JTable)13 ActionEvent (java.awt.event.ActionEvent)11 ActionListener (java.awt.event.ActionListener)9 BoxLayout (javax.swing.BoxLayout)9 JPanel (javax.swing.JPanel)9 JScrollPane (javax.swing.JScrollPane)9 TableColumn (javax.swing.table.TableColumn)9 TableCellRenderer (javax.swing.table.TableCellRenderer)8 FlowLayout (java.awt.FlowLayout)6 MouseEvent (java.awt.event.MouseEvent)6 XTableColumnModel (jmri.util.swing.XTableColumnModel)6 Container (java.awt.Container)5 JTextField (javax.swing.JTextField)5 JmriJFrame (jmri.util.JmriJFrame)5