Exemplo n.º 1
0
  /**
   * Method performed when button clicked.
   *
   * @param event event that triggers action, here clicking of the button.
   */
  public void actionPerformed(ActionEvent event) {

    if (choiceBox.getSelectedItem().equals(CUSTOM)) {
      JFileChooser chooser = new JFileChooser(System.getProperty("user.home"));
      int returnVal = chooser.showOpenDialog(settingsPanel);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        specifiedOntology = CUSTOM;
        openFile = chooser.getSelectedFile();
        choiceBox.setEditable(true);
        choiceBox.setSelectedItem(openFile.toString());
        choiceBox.setEditable(false);
        def = false;
        if (((String) choiceBox.getSelectedItem()).endsWith(".obo")) {
          settingsPanel.getNamespacePanel().choiceBox.setEnabled(true);
        } else {
          settingsPanel.getNamespacePanel().choiceBox.setEnabled(false);
        }
      }
      if (returnVal == JFileChooser.CANCEL_OPTION) {
        choiceBox.setSelectedItem(NONE);
        specifiedOntology = NONE;
        def = true;
        settingsPanel.getNamespacePanel().choiceBox.setEnabled(false);
      }
    } else if (choiceBox.getSelectedItem().equals(NONE)) {
      specifiedOntology = NONE;
      def = true;
      settingsPanel.getNamespacePanel().choiceBox.setEnabled(false);
    } else {
      specifiedOntology = (String) choiceBox.getSelectedItem();
      def = true;
      settingsPanel.getNamespacePanel().choiceBox.setEnabled(false);
    }
  }
 public void reset() {
   settingsPanel.setSettings(getState());
 }
 public void apply() throws ConfigurationException {
   settings = settingsPanel.getSettings();
   saveSettings();
 }
 public boolean isModified() {
   return !settings.equals(settingsPanel.getSettings());
 }