class GeneralColumnTitleChooserUI extends javax.swing.JPanel implements ManipulatorUI {

    private GeneralColumnTitleChooser manipulator;
    private DialogControls dialogControls;
    private Table table;
    private String displayName;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel titleLabel;
    private javax.swing.JTextField titleTextField;
    // End of variables declaration//GEN-END:variables

    /**
     * Creates new form GeneralColumnTitleChooserUI
     */
    public GeneralColumnTitleChooserUI() {
        initComponents();
        titleTextField.getDocument().addDocumentListener(new DocumentListener() {

            @Override
            public void insertUpdate(DocumentEvent e) {
                refreshOkButton();
            }

            @Override
            public void removeUpdate(DocumentEvent e) {
                refreshOkButton();
            }

            @Override
            public void changedUpdate(DocumentEvent e) {
                refreshOkButton();
            }
        });
    }

    private void refreshOkButton() {
        String text = titleTextField.getText();
        dialogControls.setOkButtonEnabled(text != null && !text.isEmpty() && table != null &&
            !table.hasColumn(text));//Title not empty and not repeated.
    }

    @Override
    public void setup(Manipulator m, DialogControls dialogControls) {
        this.manipulator = (GeneralColumnTitleChooser) m;
        this.table = manipulator.getTable();
        this.dialogControls = dialogControls;
        this.displayName = m.getName();
        titleTextField.setText(manipulator.getColumnTitle());
        refreshOkButton();
    }

    @Override
    public void unSetup() {
        manipulator.setColumnTitle(titleTextField.getText());
    }

    @Override
    public String getDisplayName() {
        return displayName;
    }

    @Override
    public JPanel getSettingsPanel() {
        ValidationPanel validationPanel = new ValidationPanel();
        validationPanel.setInnerComponent(this);

        ValidationGroup group = validationPanel.getValidationGroup();

        group.add(titleTextField, new ColumnTitleValidator(table));

        return validationPanel;
    }

    @Override
    public boolean isModal() {
        return true;
    }

    /**
     * This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {<FILL_FUNCTION_BODY>}// </editor-fold>//GEN-END:initComponents
}


        titleLabel = new javax.swing.JLabel();
        titleTextField = new javax.swing.JTextField();

        titleLabel.setText(org.openide.util.NbBundle
            .getMessage(GeneralColumnTitleChooserUI.class, "GeneralColumnTitleChooserUI.titleLabel.text")); // NOI18N

        titleTextField.setText(org.openide.util.NbBundle.getMessage(GeneralColumnTitleChooserUI.class,
            "GeneralColumnTitleChooserUI.titleTextField.text")); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(titleLabel)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(titleTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                    .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(titleLabel)
                        .addComponent(titleTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID