예제 #1
0
  public void initialise() throws Exception {
    PreferencesLayoutPanel panel = new PreferencesLayoutPanel();
    setLayout(new BorderLayout());
    add(panel, BorderLayout.NORTH);

    OntologyPreferences prefs = OntologyPreferences.getInstance();

    panel.addGroup("Default ontology IRI base");
    panel.addGroupComponent(textField = new JTextField(prefs.getBaseURI().toString(), 40));
    panel.addGroupComponent(yearCheckBox = new JCheckBox("Include year", prefs.isIncludeYear()));
    panel.addGroupComponent(monthCheckBox = new JCheckBox("Include month", prefs.isIncludeMonth()));
    panel.addGroupComponent(dayCheckBox = new JCheckBox("Include day", prefs.isIncludeDay()));
    yearCheckBox.addActionListener(e -> updateState());
    monthCheckBox.addActionListener(e -> updateState());
    updateState();
  }
예제 #2
0
 public void applyChanges() {
   OntologyPreferences prefs = OntologyPreferences.getInstance();
   try {
     prefs.setBaseURI(new URI(textField.getText()));
     prefs.setIncludeYear(yearCheckBox.isSelected());
     prefs.setIncludeMonth(monthCheckBox.isSelected());
     prefs.setIncludeDay(dayCheckBox.isSelected());
   } catch (URISyntaxException e) {
     UIHelper uiHelper = new UIHelper(getOWLEditorKit());
     uiHelper.showOptionPane(
         "Error",
         "Couldn't set base URI: " + e.getMessage(),
         JOptionPane.OK_OPTION,
         JOptionPane.ERROR_MESSAGE);
   }
 }