class GeneralChooseColumnsUI extends javax.swing.JPanel implements ManipulatorUI {

    private GeneralColumnsChooser columnsChooser;
    private ColumnCheckBox[] columnsCheckBoxes;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel contentPanel;
    private javax.swing.JScrollPane contentScrollPane;
    private javax.swing.JLabel descriptionLabel;
    // End of variables declaration//GEN-END:variables

    /**
     * Creates new form GeneralChooseColumnsUI
     */
    public GeneralChooseColumnsUI(String descriptionText) {
        initComponents();
        descriptionLabel.setText(descriptionText);
    }

    @Override
    public void setup(Manipulator m, DialogControls dialogControls) {
        this.columnsChooser = (GeneralColumnsChooser) m;
        refreshColumns();
    }

    @Override
    public void unSetup() {
        columnsChooser.setColumns(getChosenColumns());
    }

    @Override
    public String getDisplayName() {
        return columnsChooser.getName();
    }

    @Override
    public JPanel getSettingsPanel() {
        return this;
    }

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

    public Column[] getChosenColumns() {
        ArrayList<Column> columnsToClearDataList = new ArrayList<>();
        for (ColumnCheckBox c : columnsCheckBoxes) {
            if (c.isSelected()) {
                columnsToClearDataList.add(c.getColumn());
            }
        }
        return columnsToClearDataList.toArray(new Column[0]);
    }

    private void refreshColumns() {
        Column[] columns = columnsChooser.getColumns();
        columnsCheckBoxes = new ColumnCheckBox[columns.length];
        contentPanel.removeAll();
        contentPanel.setLayout(new MigLayout("", "[pref!]"));
        for (int i = 0; i < columns.length; i++) {
            columnsCheckBoxes[i] = new ColumnCheckBox(columns[i], true);
            contentPanel.add(columnsCheckBoxes[i].getCheckBox(), "wrap");
        }
        contentPanel.revalidate();
        contentPanel.repaint();
    }

    /**
     * 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

    private static class ColumnCheckBox {

        private final JCheckBox checkBox;
        private final Column column;

        public ColumnCheckBox(Column column, boolean selected) {
            checkBox = new JCheckBox(column.getTitle(), selected);
            this.column = column;
        }

        public boolean isSelected() {
            return checkBox.isSelected();
        }

        public void setSelected(boolean selected) {
            checkBox.setSelected(selected);
        }

        public JCheckBox getCheckBox() {
            return checkBox;
        }

        public Column getColumn() {
            return column;
        }
    }
}


        contentScrollPane = new javax.swing.JScrollPane();
        contentPanel = new javax.swing.JPanel();
        descriptionLabel = new javax.swing.JLabel();

        contentPanel.setLayout(new java.awt.GridLayout(1, 0));
        contentScrollPane.setViewportView(contentPanel);

        descriptionLabel.setText(null);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(descriptionLabel, javax.swing.GroupLayout.Alignment.LEADING,
                            javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE)
                        .addComponent(contentScrollPane, javax.swing.GroupLayout.Alignment.LEADING,
                            javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE))
                    .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 26,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(contentScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
                    .addContainerGap())
        );
    
<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