public ShowAboutDialogCommand() {
   putValue(Action.NAME, resources.getResourceByKey("ShowAboutDialogCommand.name"));
   putValue(Action.SMALL_ICON, resources.getIcon("icon.about"));
   putValue(
       Action.SHORT_DESCRIPTION, resources.getResourceByKey("ShowAboutDialogCommand.description"));
   putValue(
       Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F1, InputEvent.CTRL_DOWN_MASK));
 }
  @Override
  public void execute(ActionEvent e) {

    final ApplicationContext ctx = AppContext.getContext();
    final ResourceService resources = ctx.getBean(ResourceService.class);
    final ApplicationWindow win = ctx.getBean(ApplicationWindow.class);

    ImageIcon icon = resources.getIcon("icon.dialog.about");

    String title = "About";
    String subTitle = "Who created this Application.";

    AboutDialog aboutDialog = new AboutDialog(title, subTitle, icon, win);
    aboutDialog.setVisible(true);
  }
  /**
   * Creates the panel for a view class according to a <code>HashMap</code> of values
   *
   * @param className the full qualified class name
   * @param defaults the defaults to create the panel for
   * @return a jpanel containing ui elements for a specific set of properties
   */
  @SuppressWarnings("unchecked")
  public JPanel createParamPanel(String className, HashMap defaults) {

    JPanel panel = new JPanel(new GridBagLayout());
    panel.setBackground(Color.WHITE);
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.gridwidth = 1;
    constraints.insets = new Insets(3, 3, 3, 3);
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 1.0;

    int row = 0;

    Object[] keys = defaults.keySet().toArray();
    Arrays.sort(keys);

    for (int k = 0; k < keys.length; k++) {

      String key = (String) keys[k];

      if (key.startsWith(className) && !key.endsWith("optionValues")) {

        constraints.gridy = row;
        constraints.gridx = 0;

        JLabel label = new JLabel(resources.getResourceByKey(key));
        panel.add(label, constraints);

        if (defaults.get(key) instanceof String) {

          if (defaults.get(key + ".optionValues") != null) {

            String optionValues = (String) defaults.get(key + ".optionValues");

            JComboBox comboBox = new JComboBox();
            comboBox.setName(key);

            String value = (String) defaults.get(key);

            String[] options = optionValues.split(",");

            for (int i = 0; i < options.length; i++) {
              comboBox.addItem(options[i]);
            }

            comboBox.setSelectedItem(value);

            constraints.gridx = 1;
            panel.add(comboBox, constraints);

          } else {

            JTextField textfield = new JTextField(30);
            textfield.setName(key);
            String value = (String) defaults.get(key);
            textfield.setText(value);
            constraints.gridx = 1;
            panel.add(textfield, constraints);
          }

        } else if (defaults.get(key) instanceof Boolean) {
          JCheckBox checkBox = new JCheckBox();
          checkBox.setName(key);
          checkBox.setBackground(Color.WHITE);
          Boolean value = (Boolean) defaults.get(key);
          checkBox.setSelected(value);
          constraints.gridx = 1;
          panel.add(checkBox, constraints);
        } else if (defaults.get(key) instanceof Integer) {
          JSpinner spinner = new JSpinner();
          spinner.setName(key);
          Integer value = (Integer) defaults.get(key);
          spinner.setValue(value);
          constraints.gridx = 1;
          panel.add(spinner, constraints);
        } else if (defaults.get(key) instanceof FileObject) {
          FileBrowserTextfield textField = new FileBrowserTextfield();
          textField.setBackground(Color.WHITE);
          textField.setName(key);
          FileObject value = (FileObject) defaults.get(key);
          textField.getPathField().setText(value.getAbsolutePath());
          textField.getPathField().setBackground(Color.WHITE);
          constraints.gridx = 1;
          panel.add(textField, constraints);
        }

        row++;
      }
    }

    /** Add fill label for GridBagLayout */
    constraints.weighty = 1.0;
    constraints.fill = GridBagConstraints.BOTH;
    panel.add(new JLabel(), constraints);

    return panel;
  }
  @Override
  protected void initializeComponents() {

    final Dimension size = new Dimension(800, 500);
    setSize(size);
    setBounds(new Rectangle(size));

    panels = new HashMap<String, JPanel>();
    resources = AppContext.getContext().getBean(ResourceService.class);

    preferencesPanel = new PreferencesPanel();
    model =
        new ModuleTreeModel(
            new DefaultMutableTreeNode(resources.getResourceByKey("perspectives.text")));
    preferencesPanel.getModuleTree().setModel(model);
    preferencesPanel.getModuleTree().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    UIUtils.flattenSplitPane(preferencesPanel.getSplitPane());
    preferencesPanel.getModuleTree().setCellRenderer(new ModuleTreeRenderer());
    preferencesPanel
        .getModuleTree()
        .addTreeSelectionListener(
            new TreeSelectionListener() {

              @Override
              public void valueChanged(TreeSelectionEvent e) {

                DefaultMutableTreeNode node =
                    (DefaultMutableTreeNode) e.getPath().getLastPathComponent();
                Object o = node.getUserObject();

                if (o instanceof String) {

                  String moduleClassName = (String) o;
                  preferencesPanel.getSplitPane().setDividerLocation(0.3);
                  preferencesPanel
                      .getSplitPane()
                      .setRightComponent(new JScrollPane(panels.get(moduleClassName)));
                }
              }
            });

    getContentPanel().add(preferencesPanel, BorderLayout.CENTER);

    ApplicationPerspectiveProvider perspectiveProvider =
        ctx.getBean(ApplicationPerspectiveProvider.class);
    ArrayList<ApplicationPerspective> perspectives = perspectiveProvider.getPerspectives();

    for (ApplicationPerspective a : perspectives) {
      model.addModule(
          (DefaultMutableTreeNode) preferencesPanel.getModuleTree().getModel().getRoot(),
          a.getPerspectiveClass());
      panels.put(
          a.getPerspectiveClass(), createParamPanel(a.getPerspectiveClass(), Preferences.values));
    }

    getOkButton()
        .addActionListener(
            new ActionListener() {

              @Override
              public void actionPerformed(ActionEvent e) {
                syncPreferences();
                result = OPTION_OK;
                setVisible(false);
                Preferences.store();

                for (BoardEditor ed :
                    EditorUtils.getCurrentPerspectiveOpenEditors(
                        AppContext.getContext()
                            .getBean(ApplicationWindowAdvisor.class)
                            .getCurrentPerspective())) ed.updateStatusBar();
              }
            });

    getCancelButton()
        .addActionListener(
            new ActionListener() {

              @Override
              public void actionPerformed(ActionEvent e) {
                result = OPTION_CANCEL;
                setVisible(false);
              }
            });

    setLocationRelativeTo(getRootPane());

    // preferencesPanel.getSplitPane().setRightComponent(new
    // JScrollPane(panels.get("org.pmedv.blackboard.BoardDesignerPerspective")));

  }