Search in sources :

Example 66 with TableCellEditor

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

the class AddRemoveTableRowsDialog method doOKAction.

protected void doOKAction() {
    final TableCellEditor cellEditor = myTable.getCellEditor();
    if (cellEditor != null) {
        // apply currently edited value if any
        cellEditor.stopCellEditing();
    }
    super.doOKAction();
}
Also used : TableCellEditor(javax.swing.table.TableCellEditor)

Example 67 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 68 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 69 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)

Example 70 with TableCellEditor

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

the class BindToNewBeanStep method _commit.

public void _commit(boolean finishChosen) throws CommitStepException {
    // Stop editing if any
    final TableCellEditor cellEditor = myTable.getCellEditor();
    if (cellEditor != null) {
        cellEditor.stopCellEditing();
    }
    // Check that all included fields are bound to valid bean properties
    final PsiNameHelper nameHelper = PsiNameHelper.getInstance(myData.myProject);
    for (int i = 0; i < myData.myBindings.length; i++) {
        final FormProperty2BeanProperty binding = myData.myBindings[i];
        if (binding.myBeanProperty == null) {
            continue;
        }
        if (!nameHelper.isIdentifier(binding.myBeanProperty.myName)) {
            throw new CommitStepException(UIDesignerBundle.message("error.X.is.not.a.valid.property.name", binding.myBeanProperty.myName));
        }
    }
    myData.myGenerateIsModified = myChkIsModified.isSelected();
}
Also used : PsiNameHelper(com.intellij.psi.PsiNameHelper) CommitStepException(com.intellij.ide.wizard.CommitStepException) TableCellEditor(javax.swing.table.TableCellEditor)

Aggregations

TableCellEditor (javax.swing.table.TableCellEditor)129 JButton (javax.swing.JButton)41 ButtonEditor (jmri.util.table.ButtonEditor)33 ButtonRenderer (jmri.util.table.ButtonRenderer)33 TableColumnModel (javax.swing.table.TableColumnModel)24 JTable (javax.swing.JTable)22 ActionEvent (java.awt.event.ActionEvent)21 TableCellRenderer (javax.swing.table.TableCellRenderer)21 TableColumn (javax.swing.table.TableColumn)20 JLabel (javax.swing.JLabel)16 JScrollPane (javax.swing.JScrollPane)16 ActionListener (java.awt.event.ActionListener)15 MouseEvent (java.awt.event.MouseEvent)13 JPanel (javax.swing.JPanel)13 Component (java.awt.Component)11 Dimension (java.awt.Dimension)11 EventObject (java.util.EventObject)10 TableModel (javax.swing.table.TableModel)10 JComponent (javax.swing.JComponent)9 JTextField (javax.swing.JTextField)9