/*-------------------------------------------------------------------------*/
 public List<FoeType> getFoeTypes() {
   List<FoeType> result = new ArrayList<FoeType>();
   for (JCheckBox cb : checkBoxes.values()) {
     if (cb.isSelected()) {
       result.add(Database.getInstance().getFoeTypes().get(cb.getText()));
     }
   }
   return result;
 }
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == create) {
     boolean flag = false;
     for (JCheckBox cur : checks) if (cur.isSelected()) flag = true;
     if (flag) {
       File path = chooser.getCurrentDirectory();
       ArrayList<String> cath_selected = new ArrayList<String>();
       for (JCheckBox cur : checks)
         if (cur.isSelected())
           if (cur.getText().compareTo("выбрать все...") != 0) cath_selected.add(cur.getText());
       String mode = new String();
       if (semester_combo.getSelectedItem().toString().compareTo("летний") == 0) mode = "summer";
       else mode = "winter";
       Dispatcher.createEducAssignment(cath_selected, path, mode);
       this.dispose();
     } else
       JOptionPane.showMessageDialog(
           null, "ƒл¤ формировани¤ учебных поручений необходимо определить кафедры.");
   }
   if (e.getSource() == cancel) this.dispose();
 }
  private void setupDialog() {
    myReplaceAll.setMnemonic(KeyEvent.VK_A);
    myNameLabel.setLabelFor(myNameComboBox);

    // Replace occurrences check box setup
    if (myOccurrencesCount > 1) {
      myReplaceAll.setSelected(false);
      myReplaceAll.setEnabled(true);
      myReplaceAll.setText(myReplaceAll.getText() + " (" + myOccurrencesCount + " occurrences)");
    } else {
      myReplaceAll.setSelected(false);
      myReplaceAll.setEnabled(false);
    }
  }
 private void explainTrailingSpaces(
     @NotNull @EditorSettingsExternalizable.StripTrailingSpaces String stripTrailingSpaces) {
   if (EditorSettingsExternalizable.STRIP_TRAILING_SPACES_NONE.equals(stripTrailingSpaces)) {
     myStripTrailingSpacesExplanationLabel.setVisible(false);
     return;
   }
   myStripTrailingSpacesExplanationLabel.setVisible(true);
   boolean isVirtualSpace = myCbVirtualSpace.isSelected();
   String text;
   String virtSpaceText = myCbVirtualSpace.getText();
   if (isVirtualSpace) {
     text =
         "Trailing spaces will be trimmed even in the line under caret.<br>To disable trimming in that line uncheck the '<b>"
             + virtSpaceText
             + "</b>' above.";
   } else {
     text =
         "Trailing spaces will <b><font color=red>NOT</font></b> be trimmed in the line under caret.<br>To enable trimming in that line too check the '<b>"
             + virtSpaceText
             + "</b>' above.";
   }
   myStripTrailingSpacesExplanationLabel.setText(XmlStringUtil.wrapInHtml(text));
 }
  /**
   * Saves all configuration settings when the "Save" button is pressed.
   *
   * @param e the <tt>ActionEvent</tt> that notified us of the button action
   */
  public void actionPerformed(ActionEvent e) {
    JButton button = (JButton) e.getSource();

    if (button.equals(saveButton)) {
      Iterator<ChatRoomConfigurationFormField> configurationSet = configForm.getConfigurationSet();

      while (configurationSet.hasNext()) {
        ChatRoomConfigurationFormField formField = configurationSet.next();

        // If the field is of type fixed the user could not change it,
        // so we skip it.
        if (formField.getType().equals(ChatRoomConfigurationFormField.TYPE_TEXT_FIXED)) continue;

        JComponent c = uiFieldsTable.get(formField.getName());

        if (c instanceof JTextComponent) {
          String newValue = ((JTextComponent) c).getText();

          if (formField.getType().equals(ChatRoomConfigurationFormField.TYPE_ID_MULTI)) {
            // extract values
            StringTokenizer idTokens =
                new StringTokenizer(newValue, System.getProperty("line.separator"));
            while (idTokens.hasMoreTokens()) {
              formField.addValue(idTokens.nextToken());
            }
          } else formField.addValue(newValue);
        } else if (c instanceof AbstractButton) {
          boolean isSelected = ((AbstractButton) c).isSelected();

          formField.addValue(isSelected);
        } else if (c instanceof JComboBox) {
          Object selectedObject = ((JComboBox) c).getSelectedItem();

          formField.addValue(selectedObject);
        } else if (c instanceof JPanel) {
          Component[] components = c.getComponents();

          for (Component comp : components) {
            if (!(comp instanceof JCheckBox)) continue;

            JCheckBox checkBox = (JCheckBox) comp;

            formField.addValue(checkBox.getText());
          }
        }
      }

      new Thread() {
        @Override
        public void run() {
          try {
            configForm.submit();
          } catch (Exception e) {
            new ErrorDialog(
                    ChatRoomConfigurationWindow.this,
                    GuiActivator.getResources().getI18NString("service.gui.ERROR"),
                    GuiActivator.getResources()
                        .getI18NString("service.gui.CHAT_ROOM_CONFIGURATION_SUBMIT_FAILED"),
                    e)
                .showDialog();
          }
        }
      }.start();
    }

    this.dispose();
  }