super(MainFrame.getInstance());
mInstance = this;
UiUtilities.registerForClosing(this);
this.getContentPane().setLayout(new FormLayout("fill:pref:grow", "pref, 3dlu, fill:min:grow, 3dlu, pref, 3dlu, pref"));
((JPanel) this.getContentPane()).setBorder(BorderFactory.createEmptyBorder(
0, 6, 2, 6));
// Initialize the buttonPanel and fill the vectors with the actions.
final DefaultToolBarModel toolbarModel = DefaultToolBarModel.getInstance();
Action[] currentActions = toolbarModel.getActions();
ArrayList<Action> notSelectedActionsList = new ArrayList<Action>(Arrays.asList(toolbarModel
.getAvailableActions()));
for (Action a : currentActions) {
mCurrentActions.addElement(a);
}
for (Action a : currentActions) {
if (notSelectedActionsList.contains(a)) {
notSelectedActionsList.remove(a);
}
}
Action[] availableActions = new Action[notSelectedActionsList.size()];
notSelectedActionsList.toArray(availableActions);
for (Action a : availableActions) {
mAvailableActions.addElement(a);
}
mAvailableActions.insertElementAt(toolbarModel.getSeparatorAction(), 0);
mAvailableActions.insertElementAt(toolbarModel.getGlueAction(), 1);
mAvailableActions.insertElementAt(toolbarModel.getSpaceAction(), 2);
// Initialize the Panel with the available Buttons
mButtonPanel = new JPanel();
mButtonPanel.setLayout(new GridLayout(0, 4, 2, 2));
mButtonPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
// Make the buttonPanel scrollable
JScrollPane pane = new JScrollPane(mButtonPanel);
pane.setAlignmentX(Component.LEFT_ALIGNMENT);
pane.getVerticalScrollBar().setUnitIncrement(73);
pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
addMouseAdapterForHandCursorToComponent(pane);
// Initialize the Panel for selecting toolBars visibility
final JPanel tVisPanel = new JPanel();
tVisPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
tVisPanel.setLayout(new BoxLayout(tVisPanel, BoxLayout.X_AXIS));
tVisPanel.setBorder(new CompoundBorder(BorderFactory.createMatteBorder(0,
0, 1, 0, Color.GRAY), BorderFactory.createEmptyBorder(10, 5, 9, 5)));
mShowToolbarCb = new JCheckBox(mLocalizer
.msg("showToolbar", "Show toolbar"));
mShowToolbarCb.setSelected(Settings.propIsToolbarVisible.getBoolean());
tVisPanel.add(mShowToolbarCb);
tVisPanel.add(Box.createHorizontalGlue());
mShowSearchFieldCb = new JCheckBox(mLocalizer.msg("showSearchField",
"Show Search field"));
mShowSearchFieldCb.setSelected(Settings.propIsSearchFieldVisible
.getBoolean());
tVisPanel.add(mShowSearchFieldCb);
// Initialize the panel for the ToolBar settings
JPanel tSetPanel = new JPanel(new FormLayout("default,5dlu,default,0dlu:grow,default,5dlu,default,5dlu,default","default"));
tSetPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
mLocationCB = new JComboBox(new String[] { mLocalizer.msg("top", "top"),
Localizer.getLocalization(Localizer.I18N_LEFT), });