Closes #176
Esse commit está contido em:
+56
-56
@@ -63,25 +63,25 @@ public class NewEntitiesPreferencesPanel extends OWLPreferencesPanel implements
|
||||
|
||||
private Logger logger = Logger.getLogger(NewEntitiesPreferencesPanel.class);
|
||||
|
||||
// Entity URI panel
|
||||
private JRadioButton autoIDURIFragment;
|
||||
// Entity IRI panel
|
||||
private JRadioButton autoIDIriFragment;
|
||||
private JRadioButton colonButton;
|
||||
private JRadioButton hashButton;
|
||||
private JRadioButton nameAsURIFragment;
|
||||
private JRadioButton nameAsIriFragment;
|
||||
private JRadioButton slashButton;
|
||||
private JRadioButton uriBaseActiveOntology;
|
||||
private JRadioButton uriBaseSpecifiedURI;
|
||||
private JTextField uriDefaultBaseField;
|
||||
private JRadioButton iriBaseActiveOntology;
|
||||
private JRadioButton iriBaseSpecifiedIri;
|
||||
private JTextField iriDefaultBaseField;
|
||||
|
||||
// Entity Label panel
|
||||
private IRI labelAnnotation = null;
|
||||
private JButton annotationSelectButton;
|
||||
private JComboBox annotationLangSelector;
|
||||
private JLabel langLabel;
|
||||
private JLabel uriLabel;
|
||||
private JLabel iriLabel;
|
||||
private JRadioButton customLabelButton;
|
||||
private JRadioButton sameAsRendererLabelButton;
|
||||
private JTextField annotationURILabel;
|
||||
private JTextField annotationIriLabel;
|
||||
|
||||
// Auto-generated ID panel
|
||||
private JCheckBox saveIterativeIds;
|
||||
@@ -101,14 +101,14 @@ public class NewEntitiesPreferencesPanel extends OWLPreferencesPanel implements
|
||||
|
||||
public void initialise() throws Exception {
|
||||
setLayout(new GridLayout(3,1,0,12));
|
||||
add(createEntityURIPanel());
|
||||
add(createEntityIriPanel());
|
||||
add(createEntityLabelPanel());
|
||||
add(createAutoGeneratedIDPanel());
|
||||
}
|
||||
|
||||
private JPanel createEntityURIPanel() {
|
||||
private JPanel createEntityIriPanel() {
|
||||
JPanel panel = new JPanel();
|
||||
panel.setBorder(new TitledBorder("Entity URI"));
|
||||
panel.setBorder(new TitledBorder("Entity IRI"));
|
||||
panel.setLayout(new GridBagLayout());
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
|
||||
@@ -126,29 +126,29 @@ public class NewEntitiesPreferencesPanel extends OWLPreferencesPanel implements
|
||||
c.gridy = 0;
|
||||
c.gridwidth = 2;
|
||||
c.insets = new Insets(12,0,0,0);
|
||||
uriBaseActiveOntology = new JRadioButton("Active ontology URI");
|
||||
uriBaseActiveOntology.setSelected(!EntityCreationPreferences.useDefaultBaseIRI());
|
||||
panel.add(uriBaseActiveOntology, c);
|
||||
iriBaseActiveOntology = new JRadioButton("Active ontology IRI");
|
||||
iriBaseActiveOntology.setSelected(!EntityCreationPreferences.useDefaultBaseIRI());
|
||||
panel.add(iriBaseActiveOntology, c);
|
||||
|
||||
c.gridx = 1;
|
||||
c.gridy = 1;
|
||||
c.gridwidth = 1;
|
||||
c.insets = new Insets(0,0,0,5);
|
||||
uriBaseSpecifiedURI = new JRadioButton("Specified URI:");
|
||||
uriBaseSpecifiedURI.setSelected(EntityCreationPreferences.useDefaultBaseIRI());
|
||||
panel.add(uriBaseSpecifiedURI, c);
|
||||
iriBaseSpecifiedIri = new JRadioButton("Specified IRI:");
|
||||
iriBaseSpecifiedIri.setSelected(EntityCreationPreferences.useDefaultBaseIRI());
|
||||
panel.add(iriBaseSpecifiedIri, c);
|
||||
|
||||
c.gridx = 2;
|
||||
c.fill = GridBagConstraints.HORIZONTAL;
|
||||
c.weightx = 1.0;
|
||||
c.insets = new Insets(0,0,0,12);
|
||||
uriDefaultBaseField = new JTextField();
|
||||
uriDefaultBaseField.setText(EntityCreationPreferences.getDefaultBaseIRI().toString());
|
||||
panel.add(uriDefaultBaseField, c);
|
||||
iriDefaultBaseField = new JTextField();
|
||||
iriDefaultBaseField.setText(EntityCreationPreferences.getDefaultBaseIRI().toString());
|
||||
panel.add(iriDefaultBaseField, c);
|
||||
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(uriBaseActiveOntology);
|
||||
group.add(uriBaseSpecifiedURI);
|
||||
group.add(iriBaseActiveOntology);
|
||||
group.add(iriBaseSpecifiedIri);
|
||||
|
||||
// "Followed by:" section
|
||||
c.gridx = 0;
|
||||
@@ -190,30 +190,30 @@ public class NewEntitiesPreferencesPanel extends OWLPreferencesPanel implements
|
||||
c.gridx = 1;
|
||||
c.insets = new Insets(11,0,0,0);
|
||||
c.gridwidth = 2;
|
||||
nameAsURIFragment = new JRadioButton("User supplied name");
|
||||
nameAsURIFragment.setSelected(!EntityCreationPreferences.isFragmentAutoGenerated());
|
||||
nameAsURIFragment.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
handleActionEndWithName();
|
||||
}
|
||||
nameAsIriFragment = new JRadioButton("User supplied name");
|
||||
nameAsIriFragment.setSelected(!EntityCreationPreferences.isFragmentAutoGenerated());
|
||||
nameAsIriFragment.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
handleActionEndWithName();
|
||||
}
|
||||
});
|
||||
panel.add(nameAsURIFragment, c);
|
||||
panel.add(nameAsIriFragment, c);
|
||||
|
||||
c.gridy = 6;
|
||||
c.insets = new Insets(0,0,12,0);
|
||||
c.weighty = 1.0;
|
||||
autoIDURIFragment = new JRadioButton("Auto-generated ID");
|
||||
autoIDURIFragment.setSelected(EntityCreationPreferences.isFragmentAutoGenerated());
|
||||
autoIDURIFragment.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
handleActionEndWithID();
|
||||
}
|
||||
autoIDIriFragment = new JRadioButton("Auto-generated ID");
|
||||
autoIDIriFragment.setSelected(EntityCreationPreferences.isFragmentAutoGenerated());
|
||||
autoIDIriFragment.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
handleActionEndWithID();
|
||||
}
|
||||
});
|
||||
panel.add(autoIDURIFragment, c);
|
||||
panel.add(autoIDIriFragment, c);
|
||||
|
||||
ButtonGroup group3 = new ButtonGroup();
|
||||
group3.add(nameAsURIFragment);
|
||||
group3.add(autoIDURIFragment);
|
||||
group3.add(nameAsIriFragment);
|
||||
group3.add(autoIDIriFragment);
|
||||
|
||||
return panel;
|
||||
}
|
||||
@@ -251,21 +251,21 @@ public class NewEntitiesPreferencesPanel extends OWLPreferencesPanel implements
|
||||
c.gridy = 2;
|
||||
c.gridwidth = 1;
|
||||
c.insets = new Insets(5,30,0,5);
|
||||
uriLabel = new JLabel("URI");
|
||||
panel.add(uriLabel, c);
|
||||
iriLabel = new JLabel("IRI");
|
||||
panel.add(iriLabel, c);
|
||||
|
||||
c.gridx = 1;
|
||||
c.fill = GridBagConstraints.HORIZONTAL;
|
||||
c.insets = new Insets(5,0,0,0);
|
||||
c.weightx = 1.0;
|
||||
annotationURILabel = new JTextField();
|
||||
annotationIriLabel = new JTextField();
|
||||
labelAnnotation = EntityCreationPreferences.getNameLabelIRI();
|
||||
if (labelAnnotation == null){
|
||||
labelAnnotation = OWLRDFVocabulary.RDFS_LABEL.getIRI();
|
||||
}
|
||||
annotationURILabel.setText(labelAnnotation.toString());
|
||||
annotationURILabel.setEditable(false);
|
||||
panel.add(annotationURILabel, c);
|
||||
annotationIriLabel.setText(labelAnnotation.toString());
|
||||
annotationIriLabel.setEditable(false);
|
||||
panel.add(annotationIriLabel, c);
|
||||
|
||||
c.gridx = 2;
|
||||
c.fill = GridBagConstraints.NONE;
|
||||
@@ -451,8 +451,8 @@ public class NewEntitiesPreferencesPanel extends OWLPreferencesPanel implements
|
||||
c.weighty = 0;
|
||||
centerPanel.add(new JLabel(""));
|
||||
|
||||
enableAutoGeneratedIDPanel(autoIDURIFragment.isSelected());
|
||||
enableLabelCreationPanel(autoIDURIFragment.isSelected());
|
||||
enableAutoGeneratedIDPanel(autoIDIriFragment.isSelected());
|
||||
enableLabelCreationPanel(autoIDIriFragment.isSelected());
|
||||
|
||||
interiorPanel.add(leftPanel, BorderLayout.LINE_START);
|
||||
interiorPanel.add(centerPanel, BorderLayout.CENTER);
|
||||
@@ -484,7 +484,7 @@ public class NewEntitiesPreferencesPanel extends OWLPreferencesPanel implements
|
||||
annotationLangSelector.setEnabled(b);
|
||||
customLabelButton.setEnabled(b);
|
||||
sameAsRendererLabelButton.setEnabled(b);
|
||||
annotationURILabel.setEnabled(b);
|
||||
annotationIriLabel.setEnabled(b);
|
||||
}
|
||||
|
||||
private void enableNumericIterativeOptions(boolean b) {
|
||||
@@ -506,13 +506,13 @@ public class NewEntitiesPreferencesPanel extends OWLPreferencesPanel implements
|
||||
}
|
||||
|
||||
public void applyChanges() {
|
||||
EntityCreationPreferences.setUseDefaultBaseIRI(uriBaseSpecifiedURI.isSelected());
|
||||
EntityCreationPreferences.setUseDefaultBaseIRI(iriBaseSpecifiedIri.isSelected());
|
||||
try {
|
||||
IRI defaultBase = IRI.create(new URI(uriDefaultBaseField.getText()));
|
||||
IRI defaultBase = IRI.create(new URI(iriDefaultBaseField.getText()));
|
||||
EntityCreationPreferences.setDefaultBaseIRI(defaultBase);
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
logger.error("Ignoring invalid base URI (" + uriDefaultBaseField.getText() + ")");
|
||||
logger.error("Ignoring invalid base IRI (" + iriDefaultBaseField.getText() + ")");
|
||||
}
|
||||
|
||||
if (hashButton.isSelected()){
|
||||
@@ -525,9 +525,9 @@ public class NewEntitiesPreferencesPanel extends OWLPreferencesPanel implements
|
||||
EntityCreationPreferences.setDefaultSeparator(SEP_COLON);
|
||||
}
|
||||
|
||||
EntityCreationPreferences.setFragmentAutoGenerated(autoIDURIFragment.isSelected());
|
||||
EntityCreationPreferences.setFragmentAutoGenerated(autoIDIriFragment.isSelected());
|
||||
|
||||
EntityCreationPreferences.setGenerateNameLabel(autoIDURIFragment.isSelected());
|
||||
EntityCreationPreferences.setGenerateNameLabel(autoIDIriFragment.isSelected());
|
||||
EntityCreationPreferences.setGenerateIDLabel(false);
|
||||
|
||||
if (sameAsRendererLabelButton.isSelected()){
|
||||
@@ -537,7 +537,7 @@ public class NewEntitiesPreferencesPanel extends OWLPreferencesPanel implements
|
||||
EntityCreationPreferences.setLabelDescriptorClass(CustomLabelDescriptor.class);
|
||||
}
|
||||
|
||||
EntityCreationPreferences.setNameLabelIRI(IRI.create(annotationURILabel.getText()));
|
||||
EntityCreationPreferences.setNameLabelIRI(IRI.create(annotationIriLabel.getText()));
|
||||
Object lang = annotationLangSelector.getSelectedItem();
|
||||
if (lang != null && !lang.equals("")){
|
||||
EntityCreationPreferences.setNameLabelLang((String)lang);
|
||||
@@ -563,13 +563,13 @@ public class NewEntitiesPreferencesPanel extends OWLPreferencesPanel implements
|
||||
}
|
||||
|
||||
private void handleActionEndWithID() {
|
||||
boolean selected = autoIDURIFragment.isSelected();
|
||||
boolean selected = autoIDIriFragment.isSelected();
|
||||
enableAutoGeneratedIDPanel(selected);
|
||||
enableLabelCreationPanel(selected);
|
||||
}
|
||||
|
||||
private void handleActionEndWithName() {
|
||||
boolean selected = nameAsURIFragment.isSelected();
|
||||
boolean selected = nameAsIriFragment.isSelected();
|
||||
if (selected) {
|
||||
enableAutoGeneratedIDPanel(false);
|
||||
enableLabelCreationPanel(false);
|
||||
@@ -580,7 +580,7 @@ public class NewEntitiesPreferencesPanel extends OWLPreferencesPanel implements
|
||||
OWLAnnotationProperty prop = new UIHelper(getOWLEditorKit()).pickAnnotationProperty();
|
||||
if (prop != null){
|
||||
labelAnnotation = prop.getIRI();
|
||||
annotationURILabel.setText(labelAnnotation.toString());
|
||||
annotationIriLabel.setText(labelAnnotation.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário