From 734fad480d3d0eaa652724ed2b34ad7566183388 Mon Sep 17 00:00:00 2001 From: Bob Dionne Date: Mon, 2 Dec 2024 15:23:25 -0500 Subject: [PATCH] remove EditTab configurability --- pom.xml | 2 +- .../java/gov/nih/nci/ui/ComplexEditPanel.java | 64 +- .../nci/ui/NCIComplexEditViewComponent.java | 12 +- src/main/java/gov/nih/nci/ui/NCIEditTab.java | 7 +- .../NCIEditTabOwlEntityListCellRenderer.java | 8 +- .../gov/nih/nci/ui/NCIEditTabPreferences.java | 685 -------- .../nci/ui/NCIEditTabPreferencesPanel.java | 1562 ----------------- .../nih/nci/ui/NCIRetireViewComponent.java | 28 +- .../nci/ui/event/PreferencesChangeEvent.java | 33 - .../ui/event/PreferencesChangeListener.java | 7 - src/main/resources/update.properties | 4 +- 11 files changed, 65 insertions(+), 2347 deletions(-) delete mode 100644 src/main/java/gov/nih/nci/ui/NCIEditTabPreferences.java delete mode 100644 src/main/java/gov/nih/nci/ui/NCIEditTabPreferencesPanel.java delete mode 100644 src/main/java/gov/nih/nci/ui/event/PreferencesChangeEvent.java delete mode 100644 src/main/java/gov/nih/nci/ui/event/PreferencesChangeListener.java diff --git a/pom.xml b/pom.xml index f505864..dd5e4b7 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ gov.nih.nci nci-edit-tab - 1.5.3-SNAPSHOT + 1.5.4-SNAPSHOT Edit Tab An editing tab for NCI's complex editing operations bundle diff --git a/src/main/java/gov/nih/nci/ui/ComplexEditPanel.java b/src/main/java/gov/nih/nci/ui/ComplexEditPanel.java index 8ca6055..1f2f4a8 100644 --- a/src/main/java/gov/nih/nci/ui/ComplexEditPanel.java +++ b/src/main/java/gov/nih/nci/ui/ComplexEditPanel.java @@ -254,26 +254,26 @@ private JPanel createRadioButtonPanel() { radioButtonPanel = new JPanel(); radioButtonGroup = new ButtonGroup(); - if(NCIEditTabPreferences.getFnSplit()) { + //if(NCIEditTabPreferences.getFnSplit()) { //splitButton = new JRadioButton("Split"); radioButtonGroup.add(splitButton); radioButtonPanel.add(splitButton); - } - if(NCIEditTabPreferences.getFnCopy()) { + //} + //if(NCIEditTabPreferences.getFnCopy()) { //cloneButton = new JRadioButton("Copy"); radioButtonGroup.add(cloneButton); radioButtonPanel.add(cloneButton); - } - if(NCIEditTabPreferences.getFnMerge()) { + //} + //if(NCIEditTabPreferences.getFnMerge()) { //mergeButton = new JRadioButton("Merge"); radioButtonGroup.add(mergeButton); radioButtonPanel.add(mergeButton); - } - if(NCIEditTabPreferences.getFnDualEdits()) { + //} + //if(NCIEditTabPreferences.getFnDualEdits()) { //dualButton = new JRadioButton("Dual Edits"); radioButtonGroup.add(dualButton); radioButtonPanel.add(dualButton); - } + //} ActionListener cbl = new ActionListener() { @@ -324,42 +324,42 @@ public void actionPerformed(ActionEvent e) { public void setRadioButtons() { radioButtonGroup.clearSelection(); - if(NCIEditTabPreferences.getFnSplit()) { + //if(NCIEditTabPreferences.getFnSplit()) { radioButtonGroup.add(splitButton); radioButtonPanel.add(splitButton); splitButton.setEnabled(true); - } else { - splitButton.setEnabled(false); - radioButtonGroup.remove(splitButton); - radioButtonPanel.remove(splitButton); - } - if(NCIEditTabPreferences.getFnCopy()) { + //} else { + //splitButton.setEnabled(false); + //radioButtonGroup.remove(splitButton); + //radioButtonPanel.remove(splitButton); + //} + //if(NCIEditTabPreferences.getFnCopy()) { radioButtonGroup.add(cloneButton); radioButtonPanel.add(cloneButton); cloneButton.setEnabled(true); - } else { - cloneButton.setEnabled(false); - radioButtonGroup.remove(cloneButton); - radioButtonPanel.remove(cloneButton); - } - if(NCIEditTabPreferences.getFnMerge()) { + //} else { + //cloneButton.setEnabled(false); + //radioButtonGroup.remove(cloneButton); + //radioButtonPanel.remove(cloneButton); + //} + //if(NCIEditTabPreferences.getFnMerge()) { radioButtonGroup.add(mergeButton); radioButtonPanel.add(mergeButton); mergeButton.setEnabled(true); - } else { - mergeButton.setEnabled(false); - radioButtonGroup.remove(mergeButton); - radioButtonPanel.remove(mergeButton); - } - if(NCIEditTabPreferences.getFnDualEdits()) { + //} else { + //mergeButton.setEnabled(false); + //radioButtonGroup.remove(mergeButton); + //radioButtonPanel.remove(mergeButton); + //} + //if(NCIEditTabPreferences.getFnDualEdits()) { radioButtonGroup.add(dualButton); radioButtonPanel.add(dualButton); dualButton.setEnabled(true); - } else { - dualButton.setEnabled(false); - radioButtonGroup.remove(dualButton); - radioButtonPanel.remove(dualButton); - } + //} else { + //dualButton.setEnabled(false); + //radioButtonGroup.remove(dualButton); + //radioButtonPanel.remove(dualButton); + //} } public boolean isSplitBtnSelected() { diff --git a/src/main/java/gov/nih/nci/ui/NCIComplexEditViewComponent.java b/src/main/java/gov/nih/nci/ui/NCIComplexEditViewComponent.java index baa87e3..ef1cd5c 100644 --- a/src/main/java/gov/nih/nci/ui/NCIComplexEditViewComponent.java +++ b/src/main/java/gov/nih/nci/ui/NCIComplexEditViewComponent.java @@ -10,10 +10,10 @@ import gov.nih.nci.ui.event.ComplexEditType; import gov.nih.nci.ui.event.EditTabChangeEvent; import gov.nih.nci.ui.event.EditTabChangeListener; -import gov.nih.nci.ui.event.PreferencesChangeEvent; -import gov.nih.nci.ui.event.PreferencesChangeListener; +//import gov.nih.nci.ui.event.PreferencesChangeEvent; +//import gov.nih.nci.ui.event.PreferencesChangeListener; -public class NCIComplexEditViewComponent extends OWLClassAnnotationsViewComponent implements EditTabChangeListener, PreferencesChangeListener { +public class NCIComplexEditViewComponent extends OWLClassAnnotationsViewComponent implements EditTabChangeListener{ private static final long serialVersionUID = 1L; private ComplexEditPanel complexEditPanel; @@ -26,7 +26,7 @@ public void initialiseClassView() throws Exception { setLayout(new BorderLayout()); add(complexEditPanel); NCIEditTab.addListener(this); - NCIEditTab.addPrefListener(this); + //NCIEditTab.addPrefListener(this); } @@ -100,10 +100,12 @@ private OWLClass getOpTarget() { return NCIEditTab.currentTab().getCurrentOp().getTarget(); } + /** @Override public void handleChange(PreferencesChangeEvent event) { if (event.isType(ComplexEditType.PREFMODIFY)) { complexEditPanel.setRadioButtons(); } - } + } + **/ } diff --git a/src/main/java/gov/nih/nci/ui/NCIEditTab.java b/src/main/java/gov/nih/nci/ui/NCIEditTab.java index 05be72b..5f2bc44 100644 --- a/src/main/java/gov/nih/nci/ui/NCIEditTab.java +++ b/src/main/java/gov/nih/nci/ui/NCIEditTab.java @@ -114,8 +114,8 @@ import gov.nih.nci.ui.event.ComplexEditType; import gov.nih.nci.ui.event.EditTabChangeEvent; import gov.nih.nci.ui.event.EditTabChangeListener; -import gov.nih.nci.ui.event.PreferencesChangeEvent; -import gov.nih.nci.ui.event.PreferencesChangeListener; +//import gov.nih.nci.ui.event.PreferencesChangeEvent; +//import gov.nih.nci.ui.event.PreferencesChangeListener; import gov.nih.nci.utils.CharMapper; import gov.nih.nci.utils.CuratorChecks; import gov.nih.nci.utils.NCIClassSearcher; @@ -437,7 +437,7 @@ public void fireChange(EditTabChangeEvent ev) { l.handleChange(ev); } } - + /** private static ArrayList Prefevent_listeners = new ArrayList(); public static void addPrefListener(PreferencesChangeListener l) { @@ -452,6 +452,7 @@ public void fireChange(PreferencesChangeEvent ev) { l.handleChange(ev); } } + **/ private List complex_properties = new ArrayList(); diff --git a/src/main/java/gov/nih/nci/ui/NCIEditTabOwlEntityListCellRenderer.java b/src/main/java/gov/nih/nci/ui/NCIEditTabOwlEntityListCellRenderer.java index 7ab2b71..5c12857 100644 --- a/src/main/java/gov/nih/nci/ui/NCIEditTabOwlEntityListCellRenderer.java +++ b/src/main/java/gov/nih/nci/ui/NCIEditTabOwlEntityListCellRenderer.java @@ -25,10 +25,10 @@ public NCIEditTabOwlEntityListCellRenderer(@Nonnull OWLEditorKit editorKit, @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component label = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - if(value instanceof NCIEditTabPreferencesPanel.OwlEntityListItem) { - OWLEntity entity = ((NCIEditTabPreferencesPanel.OwlEntityListItem) value).getEntity(); - label = owlCellRenderer.getListCellRendererComponent(list, entity, index, isSelected, cellHasFocus); - } + //if(value instanceof NCIEditTabPreferencesPanel.OwlEntityListItem) { + //OWLEntity entity = ((NCIEditTabPreferencesPanel.OwlEntityListItem) value).getEntity(); + //label = owlCellRenderer.getListCellRendererComponent(list, entity, index, isSelected, cellHasFocus); + //} return label; } } diff --git a/src/main/java/gov/nih/nci/ui/NCIEditTabPreferences.java b/src/main/java/gov/nih/nci/ui/NCIEditTabPreferences.java deleted file mode 100644 index 5a9421a..0000000 --- a/src/main/java/gov/nih/nci/ui/NCIEditTabPreferences.java +++ /dev/null @@ -1,685 +0,0 @@ -package gov.nih.nci.ui; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Optional; - -import javax.annotation.Nonnull; -import javax.swing.JButton; -import javax.swing.JTextField; - -import org.apache.commons.io.FileUtils; -import org.protege.editor.core.prefs.Preferences; -import org.protege.editor.core.prefs.PreferencesManager; -import org.protege.editor.core.ui.error.ErrorLogPanel; -import org.semanticweb.owlapi.model.IRI; -import org.semanticweb.owlapi.model.OWLEntity; -import org.semanticweb.owlapi.model.OWLOntology; -import org.semanticweb.owlapi.model.OWLProperty; -import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import edu.stanford.protege.search.lucene.tab.ui.OwlEntityComboBox; -import uk.ac.manchester.cs.owl.owlapi.OWLAnnotationPropertyImpl; - -public class NCIEditTabPreferences { - private static final Logger logger = LoggerFactory.getLogger(NCIEditTabPreferences.class); - - private static final int ONTOLOGY_IRI_ATTRIBUTE = 0; - private static final int INDEX_DIRECTORY_ATTRIBUTE = 1; - - public static final String NCIEDITTAB_PREFERENCES_KEY = "NCIEditTabPreferences"; - - public static final String BASE_DIR = "BASE_DIR"; - public static final String INDEX_RECORD_KEYS = "INDEX_RECORD_KEYS"; - - - public static final String PREFIX_INDEX_DIR = "ProtegeIndex"; - - private static final String FN_SPLIT = "FnSplit"; - private static final String FN_COPY = "FnCopy"; - private static final String FN_MERGE = "FnMerge"; - private static final String FN_DUALEDITS = "FnDualEdits"; - private static final String FN_RETIRE = "FnRetire"; - - private static final String IMMUTABLE_PROPERTYLIST = "ImmutPropList"; - private static final String COMPLEX_PROPERTYLIST = "ComplexPropList"; - private static final String RETIRE_CONCEPTROOT = "RetireConceptRoot"; - private static final String RETIRE_DESIGNNOTE = "RetireDesignNote"; - private static final String RETIRE_EDITORNOTE = "RetireEditorNote"; - private static final String RETIRE_CONCEPTSTATUS = "RetireConceptStatus"; - private static final String RETIRE_PARENT = "RetireParent"; - private static final String RETIRE_CHILD = "RetireChild"; - private static final String RETIRE_ROLE = "RetireRole"; - private static final String RETIRE_INROLE = "RetireInRole"; - private static final String RETIRE_ASSOC = "RetireAssoc"; - private static final String RETIRE_INASSOC = "RetireInAssoc"; - - private static final String SPLIT_FROM = "SplitFrom"; - private static final String MERGE_SOURCE = "MergeSource"; - private static final String MERGE_TARGET = "MergeTarget"; - private static final String MERGE_DESIGNNOTE = "MergeDesignNote"; - private static final String MERGE_EDITORNOTE = "MergeEditorNote"; - private static final String CODE_PROP = "CodeProp"; - private static final String LABEL_PROP = "LabelProp"; - private static final String PREF_NAME = "PrefName"; - private static final String DEFINITION = "Definition"; - private static final String FULLY_QUAL_SYN = "FullyQualSyn"; - private static final String REVIEW_DATE = "ReviewDate"; - private static final String REVIEWER_NAME = "ReviewerName"; - private static final String DEF_SOURCE = "DefSource"; - private static final String SYN_TYPE = "SynType"; - private static final String SYN_SOURCE = "SynSource"; - private static final String SEMANTIC_TYPE = "SemanticType"; - - public static final String PROTEGE_DIR = ".protege"; - - public static final String COLLECTOR_DIR = "nciedittab"; - - private static String fileSystemSeparator = System.getProperty("file.separator"); - - private static List immutablePropList = new ArrayList(); - - private static Preferences getPreferences() { - return PreferencesManager.getInstance().getApplicationPreferences(NCIEDITTAB_PREFERENCES_KEY); - } - - /** - * Gets the system temporary directory path. - * - * @return Returns the system temporary directory path. - */ - @Nonnull - public static String getTempDirectory() { - return normalizePathName(System.getProperty("java.io.tmpdir")); - } - - /** - * Gets the user home directory path. - * - * @return Returns the user home directory path. - */ - @Nonnull - public static String getNCIEditTabBaseDirectory() { - return PROTEGE_DIR + fileSystemSeparator + COLLECTOR_DIR; - } - - public static boolean getFnSplit() { - return getPreferences().getBoolean(FN_SPLIT, true); - } - - public static void setFnSplit(boolean isSelected) { - getPreferences().putBoolean(FN_SPLIT, isSelected); - } - - public static boolean getFnCopy() { - return getPreferences().getBoolean(FN_COPY, true); - } - - public static void setFnCopy(boolean isSelected) { - getPreferences().putBoolean(FN_COPY, isSelected); - } - - public static boolean getFnMerge() { - return getPreferences().getBoolean(FN_MERGE, true); - } - - public static void setFnMerge(boolean isSelected) { - getPreferences().putBoolean(FN_MERGE, isSelected); - } - - public static boolean getFnDualEdits() { - return getPreferences().getBoolean(FN_DUALEDITS, true); - } - - public static void setFnDualEdits(boolean isSelected) { - getPreferences().putBoolean(FN_DUALEDITS, isSelected); - } - - public static boolean getFnRetire() { - return getPreferences().getBoolean(FN_RETIRE, true); - } - - public static void setFnRetire(boolean isSelected) { - getPreferences().putBoolean(FN_RETIRE, isSelected); - } - - // - public static List getImmutPropList() { - return getPreferences().getStringList(IMMUTABLE_PROPERTYLIST, new ArrayList()); - //return getPreferences().getString(IMMUTABLE_PROPERTYLIST, ""); - } - - public static void setImmutPropList(List iplist) { - getPreferences().putStringList(IMMUTABLE_PROPERTYLIST, iplist); - //getPreferences().putString(IMMUTABLE_PROPERTYLIST, ipl); - } - - /*public static void setImmutProps(List iplist){ - immutablePropList = iplist; - writeImmutProps(); - } - - public static List getImmutPropList(){ - //return new ArrayList<>(immutablePropIRIs); - return immutablePropList; - }*/ - - /*private static void loadImmutProps() { - final List defaultValues = Collections.emptyList(); - List values = getPreferences().getStringList(IMMUTABLE_PROPERTYLIST, defaultValues); - - if (values.equals(defaultValues)){ - - } - else{ - for (String value : values){ - try { - IRI iri = IRI.create(new URI(value.trim())); - immutablePropList.add(new OWLiri); - } - catch (URISyntaxException e) { - ErrorLogPanel.showErrorDialog(e); - } - } - } - }*/ - - /*private static void writeImmutProps() { - - //for (String str : immutablePropList){ - //StringBuilder str = new StringBuilder(obj.toString()); - //str.append(langStringBuilder.toString()); - //values.add(str); - //} - //getPreferences().putStringList(IMMUTABLE_PROPERTYLIST, values); - - List values = new ArrayList<>(); - StringBuilder langStringBuilder = new StringBuilder(); - - for (IRI iri : immutablePropIRIs){ - StringBuilder str = new StringBuilder(iri.toString()); - str.append(langStringBuilder.toString()); - values.add(str.toString()); - } - getPreferences().putStringList(IMMUTABLE_PROPERTYLIST, values); - }*/ - - public static List getComplexPropList() { - return getPreferences().getStringList(COMPLEX_PROPERTYLIST, new ArrayList()); - //return getPreferences().getString(COMPLEX_PROPERTYLIST, ""); - } - - public static void setComplexPropList(List cplist) { - getPreferences().putStringList(COMPLEX_PROPERTYLIST, cplist); - //getPreferences().putString(COMPLEX_PROPERTYLIST, cpl); - } - - public static List getComplexPropAnnotationList(String annot) { - StringBuilder strBld = new StringBuilder(); - strBld.append(COMPLEX_PROPERTYLIST); - strBld.append("/"); - strBld.append(annot); - return getPreferences().getStringList(strBld.toString(), new ArrayList()); - } - - public static void setComplexPropAnnotationList(String annot, List cplist) { - StringBuilder strBld = new StringBuilder(); - strBld.append(COMPLEX_PROPERTYLIST); - strBld.append("/"); - strBld.append(annot); - getPreferences().putStringList(strBld.toString(), cplist); - } - - public static String getRetireConceptRoot() { - return getPreferences().getString(RETIRE_CONCEPTROOT, ""); - } - - public static void setRetireConceptRoot(String rcr) { - getPreferences().putString(RETIRE_CONCEPTROOT, rcr); - } - - public static String getRetireDesignNote() { - return getPreferences().getString(RETIRE_DESIGNNOTE, ""); - } - - public static void setRetireDesignNote(String rdn) { - getPreferences().putString(RETIRE_DESIGNNOTE, rdn); - } - - public static String getRetireEditorNote() { - return getPreferences().getString(RETIRE_EDITORNOTE, ""); - } - - public static void setRetireEditorNote(String ren) { - getPreferences().putString(RETIRE_EDITORNOTE, ren); - } - - public static String getRetireConceptStatus() { - return getPreferences().getString(RETIRE_CONCEPTSTATUS, ""); - } - - public static void setRetireConceptStatus(String rcs) { - getPreferences().putString(RETIRE_CONCEPTSTATUS, rcs); - } - - public static String getRetireParent() { - return getPreferences().getString(RETIRE_PARENT, ""); - } - - public static void setRetireParent(String rp) { - getPreferences().putString(RETIRE_PARENT, rp); - } - - public static String getRetireChild() { - return getPreferences().getString(RETIRE_CHILD, ""); - } - - public static void setRetireChild(String rc) { - getPreferences().putString(RETIRE_CHILD, rc); - } - - public static String getRetireRole() { - return getPreferences().getString(RETIRE_ROLE, ""); - } - - public static void setRetireRole(String rr) { - getPreferences().putString(RETIRE_ROLE, rr); - } - - public static String getRetireInRole() { - return getPreferences().getString(RETIRE_INROLE, ""); - } - - public static void setRetireInRole(String rir) { - getPreferences().putString(RETIRE_INROLE, rir); - } - - public static String getRetireAssoc() { - return getPreferences().getString(RETIRE_ASSOC, ""); - } - - public static void setRetireAssoc(String ra) { - getPreferences().putString(RETIRE_ASSOC, ra); - } - - public static String getRetireInAssoc() { - return getPreferences().getString(RETIRE_INASSOC, ""); - } - - public static void setRetireInAssoc(String ria) { - getPreferences().putString(RETIRE_INASSOC, ria); - } - - public static String getSplitFrom() { - return getPreferences().getString(SPLIT_FROM, ""); - } - - public static void setSplitFrom(String sf) { - getPreferences().putString(SPLIT_FROM, sf); - } - - public static String getCodeProp() { - return getPreferences().getString(CODE_PROP, ""); - } - - public static void setCodeProp(String cp) { - getPreferences().putString(CODE_PROP, cp); - } - - public static String getLabelProp() { - return getPreferences().getString(LABEL_PROP, ""); - } - - public static void setLabelProp(String lp) { - getPreferences().putString(LABEL_PROP, lp); - } - - public static String getPrefName() { - return getPreferences().getString(PREF_NAME, ""); - } - - public static void setPrefName(String pn) { - getPreferences().putString(PREF_NAME, pn); - } - - public static String getDefinition() { - return getPreferences().getString(DEFINITION, ""); - } - - public static void setDefinition(String df) { - getPreferences().putString(DEFINITION, df); - } - - public static String getFullyQualSyn() { - return getPreferences().getString(FULLY_QUAL_SYN, ""); - } - - public static void setFullyQualSyn(String fqs) { - getPreferences().putString(FULLY_QUAL_SYN, fqs); - } - - public static String getReviewDate() { - return getPreferences().getString(REVIEW_DATE, ""); - } - - public static void setReviewDate(String rd) { - getPreferences().putString(REVIEW_DATE, rd); - } - - public static String getReviewerName() { - return getPreferences().getString(REVIEWER_NAME, ""); - } - - public static void setReviewerName(String rn) { - getPreferences().putString(REVIEWER_NAME, rn); - } - - public static String getDefSource() { - return getPreferences().getString(DEF_SOURCE, ""); - } - - public static void setDefSource(String ds) { - getPreferences().putString(DEF_SOURCE, ds); - } - - public static String getSynType() { - return getPreferences().getString(SYN_TYPE, ""); - } - - public static void setSynType(String st) { - getPreferences().putString(SYN_TYPE, st); - } - - public static String getSynSource() { - return getPreferences().getString(SYN_SOURCE, ""); - } - - public static void setSynSource(String ss) { - getPreferences().putString(SYN_SOURCE, ss); - } - - public static String getSemanticType() { - return getPreferences().getString(SEMANTIC_TYPE, ""); - } - - public static void setSemanticType(String st) { - getPreferences().putString(SEMANTIC_TYPE, st); - } - - public static String getMergeSource() { - return getPreferences().getString(MERGE_SOURCE, ""); - } - - public static void setMergeSource(String ms) { - getPreferences().putString(MERGE_SOURCE, ms); - } - - public static String getMergeTarget() { - return getPreferences().getString(MERGE_TARGET, ""); - } - - public static void setMergeTarget(String mt) { - getPreferences().putString(MERGE_TARGET, mt); - } - - public static String getMergeDesignNote() { - return getPreferences().getString(MERGE_DESIGNNOTE, ""); - } - - public static void setMergeDesignNote(String mdn) { - getPreferences().putString(MERGE_DESIGNNOTE, mdn); - } - - public static String getMergeEditorNote() { - return getPreferences().getString(MERGE_EDITORNOTE, ""); - } - - public static void setMergeEditorNote(String men) { - getPreferences().putString(MERGE_EDITORNOTE, men); - } - - /** - * Gets the base directory to store the index files. By default, the base - * directory is the user home directory. - * - * @return Returns the base directory location. - */ - @Nonnull - public static String getBaseDirectory() { - return getPreferences().getString(BASE_DIR, getNCIEditTabBaseDirectory()); - } - - /** - * Sets the base directory to store the index files. - * - * @param baseDirectory - * A directory location set by the user. - */ - public static void setBaseDirectory(@Nonnull String baseDirectory) { - checkNotNull(baseDirectory); - getPreferences().putString(BASE_DIR, normalizePathName(baseDirectory)); - } - - /** - * Adds an index record to the index preference given the input ontology. - * The record will contain the information about the ontology IRI, the index - * directory location and the index checksum. This method will do nothing if - * the input is an anonymous ontology. - * - * @param ontology - * The input ontology to create the index record - */ - public static void addIndexRecord(String indexDirId) { - - final String indexRecordKey = createIndexRecordKey(indexDirId); - getPreferences().putStringList(indexRecordKey, createIndexAttributes(indexDirId)); - collectIndexRecordKey(indexRecordKey); - - } - - /** - * Removes the index record given the ontology IRI. This method will also - * remove the index directory from the file system. - * - * @param indexDirId - * The directory id for the index - */ - public static void removeIndexRecord(String indexDirId) { - - final String indexRecordKey = createIndexRecordKey(indexDirId); - deleteIndexDirectory(indexRecordKey); - getPreferences().putString(indexRecordKey, null); - discardIndexRecordKey(indexRecordKey); - } - - /** - * Checks if the index preference contains the index record for the given - * input ontology. When the method finds an index record associated with - * the input ontology, it will check if the index directory location is - * still valid. The method will check as well if the index checksum agrees - * with the input ontology such that the index record is still valid. - * - * This method will always return false if the input is an - * anonymous ontology. - * - * @param indexDirId - * The unique id that neames the directory where the index is stored - * @return Returns true if the index record is still relevant - * with the given input ontology, or false otherwise. - */ - public static boolean containsIndexRecord(String indexDirId) { - - boolean doesContain = true; - String indexRecordKey = createIndexRecordKey(indexDirId); - Optional> indexRecord = getIndexRecord(indexRecordKey); - if (indexRecord.isPresent()) { - String directoryLocation = getIndexDirectoryLocation(indexDirId); - if (doesDirectoryExist(directoryLocation)) { - - } else { - doesContain = false; - } - } else { - doesContain = false; - } - return doesContain; - } - - private static boolean doesDirectoryExist(String directoryLocation) { - if (directoryLocation == null) { - return false; - } - if (directoryLocation.isEmpty()) { - return false; - } - return new File(directoryLocation).exists(); - } - - /** - * Returns the index record table. The table consists of the record key, the ontology IRI, - * the index directory location and the index checksum. - * - * @return A index record table. - */ - @Nonnull - public static List> getIndexRecordTable() { - List> indexRecordTable = new ArrayList<>(); - List indexMapKeys = getPreferences().getStringList(INDEX_RECORD_KEYS, new ArrayList<>()); - for (String indexMapKey : indexMapKeys) { - List indexRecord = new ArrayList<>(); - indexRecord.add(indexMapKey); - indexRecord.addAll(getCheckedIndexRecord(indexMapKey)); - indexRecordTable.add(indexRecord); - } - return indexRecordTable; - } - - /** - * Gets the index directory path given the input ontology IRI. - * - * @param indexDirId - * The unique integer id that identifies the index directory path. - * @return A full path location of the index directory - */ - @Nonnull - public static String getIndexDirectoryLocation(String indexDirId) { - String indexMapKey = createIndexRecordKey(indexDirId); - List indexAttributes = getCheckedIndexRecord(indexMapKey); - return indexAttributes.get(INDEX_DIRECTORY_ATTRIBUTE); - } - - /** - * Clears all ontology versions and the associated index location from the preference. - * Note that no physical files or folders are deleted from the file system. - */ - public static void clear() { - Preferences preferences = getPreferences(); - preferences.clear(); - preferences.putString(BASE_DIR, getBaseDirectory()); - } - - /* - * Private utility methods - */ - - private static Optional> getIndexRecord(String indexRecordKey) { - return Optional.ofNullable(getPreferences().getStringList(indexRecordKey, null)); - } - - private static List getCheckedIndexRecord(String indexRecordKey) { - Optional> uncheckedIndexRecord = getIndexRecord(indexRecordKey); - List indexRecord = new ArrayList<>(); - if (!uncheckedIndexRecord.isPresent()) { - indexRecord.add(ONTOLOGY_IRI_ATTRIBUTE, ""); - indexRecord.add(INDEX_DIRECTORY_ATTRIBUTE, ""); - } else { - indexRecord.addAll(uncheckedIndexRecord.get()); - } - return indexRecord; - } - - private static String createIndexRecordKey(String id) { - return "KEY:" + id; - } - - private static List createIndexAttributes(String indexDirId) { - List indexAttributes = new ArrayList<>(); - indexAttributes.add(ONTOLOGY_IRI_ATTRIBUTE, indexDirId); - indexAttributes.add(INDEX_DIRECTORY_ATTRIBUTE, createIndexDirectoryLocation(indexDirId)); - return indexAttributes; - } - - private static String fetchOntologyIri(OWLOntology ontology) { - return ontology.getOntologyID().getOntologyIRI().get().toString(); - } - - private static String createIndexDirectoryLocation(String indexDirId) { - StringBuffer directoryLocation = new StringBuffer(); - directoryLocation.append(getBaseDirectory()); - directoryLocation.append(fileSystemSeparator); - directoryLocation.append(createDirectoryName(indexDirId)); - return directoryLocation.toString(); - } - - private static void collectIndexRecordKey(String indexMapKey) { - List indexRecordKeys = getPreferences().getStringList( - INDEX_RECORD_KEYS, - new ArrayList<>()); - if (!indexRecordKeys.contains(indexMapKey)) { // to prevent duplication in the list - indexRecordKeys.add(indexMapKey); - } - getPreferences().putStringList(INDEX_RECORD_KEYS, indexRecordKeys); - } - - private static void discardIndexRecordKey(String indexMapKey) { - List indexMapKeys = getPreferences().getStringList( - INDEX_RECORD_KEYS, - new ArrayList<>()); - indexMapKeys.remove(indexMapKey); - getPreferences().putStringList(INDEX_RECORD_KEYS, indexMapKeys); - } - - private static String createDirectoryName(String indexDirId) { - String ontologyIdHex = indexDirId; - String timestampHex = Integer.toHexString(new Date().hashCode()); - return String.format("%s-%s-%s", PREFIX_INDEX_DIR, ontologyIdHex, timestampHex); - } - - private static void deleteIndexDirectory(String indexMapKey) { - List indexAttributes = getCheckedIndexRecord(indexMapKey); - String directoryLocation = indexAttributes.get(INDEX_DIRECTORY_ATTRIBUTE); - try { - File indexDirectory = new File(directoryLocation); - if (indexDirectory.exists()) { - FileUtils.deleteDirectory(indexDirectory); - } - } catch (IOException e) { - logger.error("Error while removing index directory: " + directoryLocation, e); - } - } - - /** - * Make sure the path directory contains no file separator at the end of the string - * - * @param directory - * input path directory - * @return clean path directory. - */ - private static String normalizePathName(String directory) { - if (directory.endsWith(fileSystemSeparator)) { - directory = directory.substring(0, directory.length()-1); - } - return directory; - } - -} diff --git a/src/main/java/gov/nih/nci/ui/NCIEditTabPreferencesPanel.java b/src/main/java/gov/nih/nci/ui/NCIEditTabPreferencesPanel.java deleted file mode 100644 index 853d6a6..0000000 --- a/src/main/java/gov/nih/nci/ui/NCIEditTabPreferencesPanel.java +++ /dev/null @@ -1,1562 +0,0 @@ -package gov.nih.nci.ui; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.TreeSet; -import java.util.Vector; -import java.util.stream.Collectors; - -import javax.swing.FocusManager; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.JTabbedPane; -import javax.swing.JTextField; -import javax.swing.ListModel; -import javax.swing.ListSelectionModel; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ListSelectionListener; - -import org.protege.editor.core.ProtegeManager; -import org.protege.editor.core.ui.list.MList; -import org.protege.editor.core.ui.list.MListButton; -import org.protege.editor.core.ui.list.MListItem; -import org.protege.editor.core.ui.list.MListSectionHeader; -import org.protege.editor.core.ui.preferences.PreferencesLayoutPanel; -import org.protege.editor.core.ui.util.UIUtil; -import org.protege.editor.owl.OWLEditorKit; -import org.protege.editor.owl.ui.framelist.AxiomAnnotationButton; -import org.protege.editor.owl.ui.preferences.OWLPreferencesPanel; -import org.semanticweb.owlapi.model.OWLClass; -import org.semanticweb.owlapi.model.OWLEntity; -import org.semanticweb.owlapi.model.OWLProperty; - -import com.google.common.base.Objects; - -import edu.stanford.protege.csv.export.ui.UiUtils; -import edu.stanford.protege.metaproject.api.ProjectOptions; -import edu.stanford.protege.metaproject.impl.ProjectOptionsImpl; -import edu.stanford.protege.search.lucene.tab.ui.LuceneUiUtils; -import gov.nih.nci.ui.event.ComplexEditType; -import gov.nih.nci.ui.event.PreferencesChangeEvent; -import gov.nih.nci.utils.OwlEntityComboBox; -import gov.nih.nci.utils.ProjectOptionsConfigManager; - -public class NCIEditTabPreferencesPanel extends OWLPreferencesPanel { - //Add comments here - private static final long serialVersionUID = 1L; - - private MList immutablepropList; - private MList complexpropList; - - private AxiomAnnotationButton immutAxiomAnnotationButton; - private AxiomAnnotationButton complexAxiomAnnotationButton; - - private Map> immutDependentAnnotations = new HashMap>(); - private Map> complexDependentAnnotations = new HashMap>(); - - private OwlEntityListItem selectedImmutablePropertyListItem; - private OwlEntityListItem selectedComplexPropertyListItem; - private OWLClass retireCptRootClass; - - private JTextField retireCptRootTxtfld; - private JButton retireCptRootSearchBtn; - private File selectedFile; - private JLabel exportFilepathlbl; - private JTextField userSelectedFilePathTxtfld; - private JButton exportBtn; - private OwlEntityComboBox retireDesignNoteComboBox; - private OwlEntityComboBox retireEditorNoteComboBox; - private OwlEntityComboBox retireCptStatusComboBox; - private OwlEntityComboBox retireParentComboBox; - private OwlEntityComboBox retireChildComboBox; - private OwlEntityComboBox retireRoleComboBox; - private OwlEntityComboBox retireInRoleComboBox; - private OwlEntityComboBox retireAssocComboBox; - private OwlEntityComboBox retireInAssocComboBox; - - private OwlEntityComboBox mergeSourceComboBox; - private OwlEntityComboBox mergeTargetComboBox; - private OwlEntityComboBox mergeDesignNoteComboBox; - private OwlEntityComboBox mergeEditorNoteComboBox; - private OwlEntityComboBox splitFromComboBox; - private OwlEntityComboBox codePropComboBox; - private OwlEntityComboBox labelPropComboBox; - private OwlEntityComboBox prefNameComboBox; - private OwlEntityComboBox definitionComboBox; - private OwlEntityComboBox fullyQualSynComboBox; - private OwlEntityComboBox reviewDateComboBox; - private OwlEntityComboBox reviewerNameComboBox; - private OwlEntityComboBox defSourceComboBox; - private OwlEntityComboBox synTypeComboBox; - private OwlEntityComboBox synSourceComboBox; - private OwlEntityComboBox semanticTypeComboBox; - - private OWLEditorKit editorKit = null; - List properties = new ArrayList(); - private Map> projectOptions = new HashMap<>(); - - JCheckBox cbSplit = new JCheckBox("Split"); - JCheckBox cbCopy = new JCheckBox("Copy"); - JCheckBox cbMerge = new JCheckBox("Merge"); - JCheckBox cbDualEdits = new JCheckBox("Dual Edits"); - JCheckBox cbRetire = new JCheckBox("Retire"); - - @Override - public void initialise() throws Exception { - setLayout(new BorderLayout()); - - PreferencesLayoutPanel panel = new PreferencesLayoutPanel(); - panel.setPreferredSize(new Dimension(400, 140)); - add(panel, BorderLayout.SOUTH); - - panel.addGroup("ComplexEdit"); - - cbSplit.setSelected(NCIEditTabPreferences.getFnSplit()); - cbCopy.setSelected(NCIEditTabPreferences.getFnCopy()); - cbMerge.setSelected(NCIEditTabPreferences.getFnMerge()); - cbDualEdits.setSelected(NCIEditTabPreferences.getFnDualEdits()); - cbRetire.setSelected(NCIEditTabPreferences.getFnRetire()); - - panel.addGroupComponent(cbSplit); - panel.addGroupComponent(cbCopy); - panel.addGroupComponent(cbMerge); - panel.addGroupComponent(cbDualEdits); - panel.addGroupComponent(cbRetire); - - panel.addVerticalPadding(); - - cbSplit.addActionListener(e -> { - NCIEditTabPreferences.setFnSplit(cbSplit.isSelected()); - }); - cbCopy.addActionListener(e -> { - NCIEditTabPreferences.setFnCopy(cbCopy.isSelected()); - }); - cbMerge.addActionListener(e -> { - NCIEditTabPreferences.setFnMerge(cbMerge.isSelected()); - }); - cbDualEdits.addActionListener(e -> { - NCIEditTabPreferences.setFnDualEdits(cbDualEdits.isSelected()); - }); - cbRetire.addActionListener(e -> { - NCIEditTabPreferences.setFnRetire(cbRetire.isSelected()); - }); - - if (getEditorKit() == null) { - this.add(panel); - return; - } - - setupPropertyList(); - - // panel.addGroup("Server Configuration"); - JPanel immutPanel =new JPanel(); - immutPanel.setLayout(new GridBagLayout()); - immutPanel.setPreferredSize(new Dimension(400, 250)); - JScrollPane immutablepropScrollpane = new JScrollPane(immutablepropList); - immutablepropScrollpane.setPreferredSize(new Dimension(400, 250)); - immutablepropScrollpane.setBorder(UiUtils.MATTE_BORDER); - JLabel immutablepropLbl = new JLabel("Immutable Properties"); - immutPanel.add(immutablepropScrollpane, new GridBagConstraints(0, 0, 1, 1, 0.5, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0)); - - JPanel complexPanel =new JPanel(); - complexPanel.setLayout(new GridBagLayout()); - complexPanel.setPreferredSize(new Dimension(400, 250)); - JScrollPane complexpropScrollpane = new JScrollPane(complexpropList); - complexpropScrollpane.setPreferredSize(new Dimension(400, 250)); - complexpropScrollpane.setBorder(UiUtils.MATTE_BORDER); - complexPanel.add(complexpropScrollpane, new GridBagConstraints(0, 0, 1, 1, 0.5, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0)); - - JPanel retirePanel =new JPanel(); - retirePanel.setLayout(new GridBagLayout()); - retirePanel.setPreferredSize(new Dimension(400, 250)); - JLabel retireCptRoot = new JLabel("Retired Concept Root"); - retireCptRoot.setPreferredSize(new Dimension(100, 35)); - JLabel retiredesignnote = new JLabel("Design Note"); - retiredesignnote.setPreferredSize(new Dimension(100, 35)); - JLabel retireeditornote = new JLabel("Editor Note"); - retireeditornote.setPreferredSize(new Dimension(100, 35)); - JLabel retireCptStatus = new JLabel("Deprecated Concept Status"); - retireCptStatus.setPreferredSize(new Dimension(100, 35)); - JLabel retireParent = new JLabel("Deprecated Parent"); - retireParent.setPreferredSize(new Dimension(100, 35)); - JLabel retireChild = new JLabel("Deprecated Child"); - retireChild.setPreferredSize(new Dimension(100, 35)); - JLabel retireRole = new JLabel("Deprecated Role"); - retireRole.setPreferredSize(new Dimension(100, 35)); - JLabel retireInRole = new JLabel("Deprecated In Role"); - retireInRole.setPreferredSize(new Dimension(100, 35)); - JLabel retireAssoc = new JLabel("Deprecated Association"); - retireAssoc.setPreferredSize(new Dimension(100, 35)); - JLabel retireInAssoc = new JLabel("Deprecated In Association"); - retireInAssoc.setPreferredSize(new Dimension(100, 35)); - - retireCptRootTxtfld = new JTextField(); - retireCptRootTxtfld.setPreferredSize(new Dimension(370, 35)); - retireCptRootTxtfld.setEditable(false); - retireCptRootTxtfld.setBackground(Color.WHITE); - retireCptRootTxtfld.setText(NCIEditTabPreferences.getRetireConceptRoot()); - - retireCptRootSearchBtn = new JButton("Search"); - retireCptRootSearchBtn.setPreferredSize(new Dimension(55, 35)); - - retireCptRootSearchBtn.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) - { - Component focusOwner = FocusManager.getCurrentManager().getFocusOwner(); - if(focusOwner == null) { - return; - } - - retireCptRootClass = NCIEditTab.currentTab().getOWLEditorKit().getWorkspace().searchForClass(focusOwner); - if (retireCptRootClass != null) { - String retireCptRootStr = retireCptRootClass.getIRI().getRemainder().get(); - retireCptRootTxtfld.setText(retireCptRootStr); - NCIEditTabPreferences.setRetireConceptRoot(retireCptRootStr); - } - } - }); - - retireDesignNoteComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - retireDesignNoteComboBox.addItemListener(retireDesignNoteItemListener); - retireDesignNoteComboBox.setPreferredSize(new Dimension(440, 35)); - retireDesignNoteComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getRetireDesignNote())); - - retireEditorNoteComboBox = new OwlEntityComboBox(getEditorKit(), getProperties()); - retireEditorNoteComboBox.addItemListener(retireEditorNoteItemListener); - retireEditorNoteComboBox.setPreferredSize(new Dimension(440, 35)); - retireEditorNoteComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getRetireEditorNote())); - - retireCptStatusComboBox = new OwlEntityComboBox(getEditorKit(), getProperties()); - retireCptStatusComboBox.addItemListener(retireCptStatusItemListener); - retireCptStatusComboBox.setPreferredSize(new Dimension(440, 35)); - retireCptStatusComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getRetireConceptStatus())); - - retireParentComboBox = new OwlEntityComboBox(getEditorKit(), getProperties()); - retireParentComboBox.addItemListener(retireParentItemListener); - retireParentComboBox.setPreferredSize(new Dimension(440, 35)); - retireParentComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getRetireParent())); - - retireChildComboBox = new OwlEntityComboBox(getEditorKit(), getProperties()); - retireChildComboBox.addItemListener(retireChildItemListener); - retireChildComboBox.setPreferredSize(new Dimension(440, 35)); - retireChildComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getRetireChild())); - - retireRoleComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - retireRoleComboBox.addItemListener(retireRoleItemListener); - retireRoleComboBox.setPreferredSize(new Dimension(440, 35)); - retireRoleComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getRetireRole())); - - retireInRoleComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - retireInRoleComboBox.addItemListener(retireInRoleItemListener); - retireInRoleComboBox.setPreferredSize(new Dimension(440, 35)); - retireInRoleComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getRetireInRole())); - - retireAssocComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - retireAssocComboBox.addItemListener(retireAssocItemListener); - retireAssocComboBox.setPreferredSize(new Dimension(440, 35)); - retireAssocComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getRetireAssoc())); - - retireInAssocComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - retireInAssocComboBox.addItemListener(retireInAssocItemListener); - retireInAssocComboBox.setPreferredSize(new Dimension(440, 35)); - retireInAssocComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getRetireInAssoc())); - - retirePanel.add(retireCptRoot, new GridBagConstraints(0, 0, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(8, 0, 2, 0), 0, 0)); - retirePanel.add(retireCptRootTxtfld, new GridBagConstraints(1, 0, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(8, 0, 2, 8), 0, 0)); - retirePanel.add(retireCptRootSearchBtn, new GridBagConstraints(2, 0, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(8, 8, 2, 0), 0, 0)); - - retirePanel.add(retiredesignnote, new GridBagConstraints(0, 1, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - retirePanel.add(retireDesignNoteComboBox, new GridBagConstraints(1, 1, 2, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - - retirePanel.add(retireeditornote, new GridBagConstraints(0, 2, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - retirePanel.add(retireEditorNoteComboBox, new GridBagConstraints(1, 2, 2, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - - retirePanel.add(retireCptStatus, new GridBagConstraints(0, 3, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - retirePanel.add(retireCptStatusComboBox, new GridBagConstraints(1, 3, 2, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - - retirePanel.add(retireParent, new GridBagConstraints(0, 4, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - retirePanel.add(retireParentComboBox, new GridBagConstraints(1, 4, 2, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - - retirePanel.add(retireChild, new GridBagConstraints(0, 5, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - retirePanel.add(retireChildComboBox, new GridBagConstraints(1, 5, 2, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - - retirePanel.add(retireRole, new GridBagConstraints(0, 6, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - retirePanel.add(retireRoleComboBox, new GridBagConstraints(1, 6, 2, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - - retirePanel.add(retireInRole, new GridBagConstraints(0, 7, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - retirePanel.add(retireInRoleComboBox, new GridBagConstraints(1, 7, 2, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - - retirePanel.add(retireAssoc, new GridBagConstraints(0, 8, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - retirePanel.add(retireAssocComboBox, new GridBagConstraints(1, 8, 2, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - - retirePanel.add(retireInAssoc, new GridBagConstraints(0, 9, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - retirePanel.add(retireInAssocComboBox, new GridBagConstraints(1, 9, 2, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - - JPanel mergePanel =new JPanel(); - mergePanel.setLayout(new GridBagLayout()); - mergePanel.setPreferredSize(new Dimension(400, 140)); - JLabel mergesrc = new JLabel("Source"); - mergesrc.setPreferredSize(new Dimension(40, 35)); - JLabel mergetgt = new JLabel("Target"); - mergetgt.setPreferredSize(new Dimension(40, 35)); - JLabel mergedesignnote = new JLabel("Design Note"); - mergedesignnote.setPreferredSize(new Dimension(40, 35)); - JLabel mergeeditornote = new JLabel("Editor Note"); - mergeeditornote.setPreferredSize(new Dimension(40, 35)); - - mergeSourceComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - mergeSourceComboBox.addItemListener(mergeSourceItemListener); - mergeSourceComboBox.setPreferredSize(new Dimension(500, 35)); - mergeSourceComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getMergeSource())); - - mergeTargetComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - mergeTargetComboBox.addItemListener(mergeTargetItemListener); - mergeTargetComboBox.setPreferredSize(new Dimension(500, 35)); - mergeTargetComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getMergeTarget())); - - mergeDesignNoteComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - mergeDesignNoteComboBox.addItemListener(mergeDNItemListener); - mergeDesignNoteComboBox.setPreferredSize(new Dimension(500, 35)); - mergeDesignNoteComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getMergeDesignNote())); - - mergeEditorNoteComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - mergeEditorNoteComboBox.addItemListener(mergeENItemListener); - mergeEditorNoteComboBox.setPreferredSize(new Dimension(500, 35)); - mergeEditorNoteComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getMergeEditorNote())); - - mergePanel.add(mergesrc, new GridBagConstraints(0, 0, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(8, 0, 2, 0), 0, 0)); - mergePanel.add(mergeSourceComboBox, new GridBagConstraints(1, 0, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(8, 0, 2, 0), 0, 0)); - mergePanel.add(mergetgt, new GridBagConstraints(0, 1, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - mergePanel.add(mergeTargetComboBox, new GridBagConstraints(1, 1, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - mergePanel.add(mergedesignnote, new GridBagConstraints(0, 2, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - mergePanel.add(mergeDesignNoteComboBox, new GridBagConstraints(1, 2, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - mergePanel.add(mergeeditornote, new GridBagConstraints(0, 3, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - mergePanel.add(mergeEditorNoteComboBox, new GridBagConstraints(1, 3, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), 0, 0)); - - JPanel splitPanel =new JPanel(); - splitPanel.setLayout(new FlowLayout()); - splitPanel.setPreferredSize(new Dimension(400, 40)); - JLabel splitfrom = new JLabel("Split from"); - splitfrom.setPreferredSize(new Dimension(150, 40)); - - splitFromComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - splitFromComboBox.addItemListener(splitFromItemListener); - splitFromComboBox.setPreferredSize(new Dimension(500, 40)); - splitFromComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getSplitFrom())); - - splitPanel.add(splitfrom); - splitPanel.add(splitFromComboBox); - - /* JPanel codePanel =new JPanel(); - codePanel.setLayout(new FlowLayout()); - codePanel.setPreferredSize(new Dimension(400, 40)); - JLabel codeProp = new JLabel("Code Prop"); - codeProp.setPreferredSize(new Dimension(150, 120)); - - codePropComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - codePropComboBox.addItemListener(codePropItemListener); - codePropComboBox.setPreferredSize(new Dimension(500, 40)); - codePropComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getCodeProp())); - - codePanel.add(codeProp); - codePanel.add(codePropComboBox);*/ - JPanel codePanel =new JPanel(); - codePanel.setLayout(new GridBagLayout()); - codePanel.setPreferredSize(new Dimension(400, 250)); - JLabel codeProp = new JLabel("Code Prop"); - codeProp.setPreferredSize(new Dimension(40, 35)); - JLabel labelProp = new JLabel("Label Prop"); - labelProp.setPreferredSize(new Dimension(40, 35)); - JLabel prefName = new JLabel("Pref Name"); - prefName.setPreferredSize(new Dimension(40, 35)); - JLabel definition = new JLabel("Definition"); - definition.setPreferredSize(new Dimension(40, 35)); - JLabel fullyQualSyn = new JLabel("Fully Qual Syn"); - fullyQualSyn.setPreferredSize(new Dimension(40, 35)); - JLabel reviewDate = new JLabel("Review Date"); - reviewDate.setPreferredSize(new Dimension(40, 35)); - JLabel reviewerName = new JLabel("Reviewer Name"); - reviewerName.setPreferredSize(new Dimension(40, 35)); - JLabel defSource = new JLabel("Def Source"); - defSource.setPreferredSize(new Dimension(40, 35)); - JLabel synType = new JLabel("Syn Type"); - synType.setPreferredSize(new Dimension(40, 35)); - JLabel synSource = new JLabel("Syn Source"); - synSource.setPreferredSize(new Dimension(40, 35)); - JLabel semanticType = new JLabel("Semantic Type"); - semanticType.setPreferredSize(new Dimension(40, 35)); - - codePropComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - codePropComboBox.addItemListener(codePropItemListener); - codePropComboBox.setPreferredSize(new Dimension(500, 40)); - codePropComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getCodeProp())); - - labelPropComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - labelPropComboBox.addItemListener(labelPropItemListener); - labelPropComboBox.setPreferredSize(new Dimension(500, 35)); - labelPropComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getLabelProp())); - - prefNameComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - prefNameComboBox.addItemListener(prefNameItemListener); - prefNameComboBox.setPreferredSize(new Dimension(500, 35)); - prefNameComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getPrefName())); - - definitionComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - definitionComboBox.addItemListener(definitionItemListener); - definitionComboBox.setPreferredSize(new Dimension(500, 35)); - definitionComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getDefinition())); - - fullyQualSynComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - fullyQualSynComboBox.addItemListener(fullyQualSynItemListener); - fullyQualSynComboBox.setPreferredSize(new Dimension(500, 35)); - fullyQualSynComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getFullyQualSyn())); - - reviewDateComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - reviewDateComboBox.addItemListener(reviewDateItemListener); - reviewDateComboBox.setPreferredSize(new Dimension(500, 35)); - reviewDateComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getReviewDate())); - - reviewerNameComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - reviewerNameComboBox.addItemListener(reviewerNameItemListener); - reviewerNameComboBox.setPreferredSize(new Dimension(500, 35)); - reviewerNameComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getReviewerName())); - - defSourceComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - defSourceComboBox.addItemListener(defSourceItemListener); - defSourceComboBox.setPreferredSize(new Dimension(500, 35)); - defSourceComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getDefSource())); - - synTypeComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - synTypeComboBox.addItemListener(synTypeItemListener); - synTypeComboBox.setPreferredSize(new Dimension(500, 35)); - synTypeComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getSynType())); - - synSourceComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - synSourceComboBox.addItemListener(synSourceItemListener); - synSourceComboBox.setPreferredSize(new Dimension(500, 35)); - synSourceComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getSynSource())); - - semanticTypeComboBox = new OwlEntityComboBox(getEditorKit(), getProperties() ); - semanticTypeComboBox.addItemListener(semanticTypeItemListener); - semanticTypeComboBox.setPreferredSize(new Dimension(500, 35)); - semanticTypeComboBox.setSelectedItem(getProps(NCIEditTabPreferences.getSemanticType())); - - codePanel.add(codeProp, new GridBagConstraints(0, 0, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(8, 0, 2, 0), 0, 0)); - codePanel.add(codePropComboBox, new GridBagConstraints(1, 0, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(8, 0, 2, 0), 0, 0)); - codePanel.add(labelProp, new GridBagConstraints(0, 1, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(labelPropComboBox, new GridBagConstraints(1, 1, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(prefName, new GridBagConstraints(0, 2, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(prefNameComboBox, new GridBagConstraints(1, 2, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(definition, new GridBagConstraints(0, 3, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(definitionComboBox, new GridBagConstraints(1, 3, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(fullyQualSyn, new GridBagConstraints(0, 4, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(fullyQualSynComboBox, new GridBagConstraints(1, 4, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(reviewDate, new GridBagConstraints(0, 5, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(reviewDateComboBox, new GridBagConstraints(1, 5, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(reviewerName, new GridBagConstraints(0, 6, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(reviewerNameComboBox, new GridBagConstraints(1, 6, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(defSource, new GridBagConstraints(0, 7, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(defSourceComboBox, new GridBagConstraints(1, 7, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(synType, new GridBagConstraints(0, 8, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(synTypeComboBox, new GridBagConstraints(1, 8, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(synSource, new GridBagConstraints(0, 9, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(synSourceComboBox, new GridBagConstraints(1, 9, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(semanticType, new GridBagConstraints(0, 10, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - codePanel.add(semanticTypeComboBox, new GridBagConstraints(1, 10, 1, 1, 0.5, 0.5, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0)); - - JTabbedPane tabbedPane = new JTabbedPane(); - tabbedPane.setPreferredSize(new Dimension(400, 250)); - tabbedPane.add(new JScrollPane(retirePanel), "Retire"); - tabbedPane.add(new JScrollPane(mergePanel), "Merge"); - tabbedPane.add(new JScrollPane(splitPanel), "Split"); - tabbedPane.add(new JScrollPane(codePanel), "Others"); - tabbedPane.add(new JScrollPane(immutPanel), "Immutable"); - tabbedPane.add(new JScrollPane(complexPanel), "Complex"); - - JPanel panel2 = new JPanel(); - panel2.setLayout(new GridBagLayout()); - panel2.setMinimumSize(new Dimension(400, 285)); - panel2.add(tabbedPane, new GridBagConstraints(0, 0, 1, 1, 0.5, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0)); - - exportFilepathlbl = new JLabel(); - exportFilepathlbl.setText("File will be saved to working directory if not specified"); - exportFilepathlbl.setFont(new Font("Verdana", Font.PLAIN, 14)); - userSelectedFilePathTxtfld = new JTextField(28); - userSelectedFilePathTxtfld.setBackground(Color.WHITE); - userSelectedFilePathTxtfld.setPreferredSize(new Dimension(300, 35)); - - exportBtn = new JButton("Export"); - //exportBtn.setPreferredSize(new Dimension(100, 35)); - - exportBtn.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) - { - selectedFile = UIUtil.saveFile(NCIEditTabPreferencesPanel.this.getRootPane(), "Specify export json file", "JSON file", Collections.singleton("json"), "export.json"); - if(selectedFile != null) { - userSelectedFilePathTxtfld.setText(selectedFile.getAbsolutePath()); - } - } - }); - - JPanel exportPanel = new JPanel(); - exportPanel.setLayout(new GridBagLayout()); - exportPanel.setPreferredSize(new Dimension(400, 75)); - exportPanel.add(exportFilepathlbl, new GridBagConstraints(0, 0, 2, 1, 0.5, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0)); - exportPanel.add(userSelectedFilePathTxtfld, new GridBagConstraints(0, 1, 1, 1, 0.5, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0)); - exportPanel.add(exportBtn, new GridBagConstraints(1, 1, 1, 1, 0.5, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0)); - - panel2.add(exportPanel, new GridBagConstraints(0, 1, 1, 1, 0.5, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0)); - - if (NCIEditTab.currentTab() != null && isModeler()) { - immutablepropList.setEnabled(false); - complexpropList.setEnabled(false); - userSelectedFilePathTxtfld.setEnabled(false); - exportBtn.setEnabled(false); - disableComponents(immutPanel); - disableComponents(complexPanel); - disableComponents(retirePanel); - disableComponents(mergePanel); - disableComponents(splitPanel); - disableComponents(codePanel); - tabbedPane.setEnabled(false); - panel2.setEnabled(false); - } - - JSplitPane splitPane = new JSplitPane(SwingConstants.HORIZONTAL, panel, panel2); - this.add(splitPane); - } - - private boolean isModeler() { - return NCIEditTab.currentTab().getWorkspace().isReadOnly(null); - //return false; - } - - private void disableComponents(JComponent component) { - Component[] com = component.getComponents(); - //Inside you action event where you want to disable everything - //Do the following - for (int a = 0; a < com.length; a++) { - com[a].setEnabled(false); - } - } - - public OWLEditorKit getEditorKit() { - if (editorKit != null) { - return editorKit; - } - if (NCIEditTab.currentTab() != null) { - editorKit = NCIEditTab.currentTab().getOWLEditorKit(); - } else if (ProtegeManager.getInstance().getEditorKitManager().getEditorKitCount() > 0) { - editorKit = (OWLEditorKit)ProtegeManager.getInstance().getEditorKitManager().getEditorKits().get(0); - } - return editorKit; - } - - private OWLEntity getProps (String prop) { - OWLEntity propResult = null; - List propList = getProperties(); - for (OWLEntity ent : propList) { - if (ent.getIRI().getRemainder().get().equals(prop)) { - propResult = ent; - } - } - return propResult; - } - - private void setupPropertyList() { - setupImmutablePropertyList(); - setupComplexPropertyList(); - } - - protected List getProperties() { - if (properties.isEmpty()) { - properties = LuceneUiUtils.getProperties(getEditorKit()); - } - return properties; - } - - private void setupImmutablePropertyList() { - immutablepropList = new MList() { - protected void handleAdd() { - addImmutableProperty(); - } - - protected void handleDelete() { - deleteImmutableProperty(); - } - - @Override - protected List getButtons(Object o) { - - List buttons = new ArrayList<>(super.getButtons(o)); - - return buttons; - } - }; - - immutablepropList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - immutablepropList.addListSelectionListener(immutablepropListSelectionListener); - immutablepropList.setCellRenderer(new NCIEditTabOwlEntityListCellRenderer(getEditorKit(), immutDependentAnnotations)); - immutablepropList.addKeyListener(keyAdapter); - immutablepropList.addMouseListener(mouseAdapter); - immutablepropList.setVisibleRowCount(5); - immutablepropList.setBorder(new EmptyBorder(2, 2, 0, 2)); - - Vector propertylabel = new Vector(); - List data = new ArrayList(); - propertylabel.add(new OwlPropertyListHeaderItem()); - List imPropList = NCIEditTabPreferences.getImmutPropList(); - for (String str : imPropList) { - data.add(getProps(str)); - } - this.immutablepropList.setListData(propertylabel); - this.addEntitiesToList(data, immutablepropList); - immutAxiomAnnotationButton = new AxiomAnnotationButton(event -> invokeImmutAxiomAnnotationHandler()); - } - - private void setupComplexPropertyList() { - complexpropList = new MList() { - protected void handleAdd() { - addComplexProperty(); - } - - protected void handleDelete() { - deleteComplexProperty(); - } - - @Override - protected List getButtons(Object o) { - - List buttons = new ArrayList<>(super.getButtons(o)); - - if (o instanceof MListItem) { - complexAxiomAnnotationButton.setAnnotationPresent(true); - buttons.add(complexAxiomAnnotationButton); - } - - return buttons; - } - }; - - complexpropList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - complexpropList.addListSelectionListener(complexpropListSelectionListener); - complexpropList.setCellRenderer(new NCIEditTabOwlEntityListCellRenderer(getEditorKit(), complexDependentAnnotations)); - complexpropList.addKeyListener(keyAdapter); - complexpropList.addMouseListener(mouseAdapter); - complexpropList.setVisibleRowCount(5); - complexpropList.setBorder(new EmptyBorder(2, 2, 0, 2)); - - Vector propertylabel = new Vector(); - List data = new ArrayList(); - propertylabel.add(new OwlPropertyListHeaderItem()); - List cPropList = NCIEditTabPreferences.getComplexPropList(); - List cPropAnnotList = new ArrayList(); - OWLEntity compProp; - for (String str : cPropList) { - cPropAnnotList.clear(); - List dataAnnot = new ArrayList(); - compProp = getProps(str); - data.add(compProp); - cPropAnnotList = NCIEditTabPreferences.getComplexPropAnnotationList(str); - for (String annot : cPropAnnotList) { - dataAnnot.add(getProps(annot)); - } - complexDependentAnnotations.put(compProp, dataAnnot); - } - complexpropList.setListData(propertylabel); - this.addEntitiesToList(data, complexpropList); - complexAxiomAnnotationButton = new AxiomAnnotationButton(event -> invokeComplexAxiomAnnotationHandler()); - } - - private ListSelectionListener immutablepropListSelectionListener = e -> { - if(immutablepropList.getSelectedValue() != null && !e.getValueIsAdjusting()) { - if(immutablepropList.getSelectedValue() instanceof OwlEntityListItem) { - selectedImmutablePropertyListItem = (OwlEntityListItem) immutablepropList.getSelectedValue(); - } - } - }; - - private ListSelectionListener complexpropListSelectionListener = e -> { - if(complexpropList.getSelectedValue() != null && !e.getValueIsAdjusting()) { - if(complexpropList.getSelectedValue() instanceof OwlEntityListItem) { - selectedComplexPropertyListItem = (OwlEntityListItem) complexpropList.getSelectedValue(); - } - } - }; - - private ItemListener retireDesignNoteItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)retireDesignNoteComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setRetireDesignNote(obj.toString()); - } - } - } - }; - - private ItemListener retireEditorNoteItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)retireEditorNoteComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setRetireEditorNote(obj.toString()); - } - } - } - }; - - private ItemListener retireCptStatusItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)retireCptStatusComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setRetireConceptStatus(obj.toString()); - } - } - } - }; - - private ItemListener retireParentItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)retireParentComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setRetireParent(obj.toString()); - } - } - } - }; - - private ItemListener retireChildItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)retireChildComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setRetireChild(obj.toString()); - } - } - } - }; - - private ItemListener retireRoleItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)retireRoleComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setRetireRole(obj.toString()); - } - } - } - }; - - private ItemListener retireInRoleItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)retireInRoleComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setRetireInRole(obj.toString()); - } - } - } - }; - - private ItemListener retireAssocItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)retireAssocComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setRetireAssoc(obj.toString()); - } - } - } - }; - - private ItemListener retireInAssocItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)retireInAssocComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setRetireInAssoc(obj.toString()); - } - } - } - }; - - private ItemListener mergeSourceItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)mergeSourceComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setMergeSource(obj.toString()); - } - } - } - }; - - private ItemListener mergeTargetItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)mergeTargetComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setMergeTarget(obj.toString()); - } - } - } - }; - - private ItemListener mergeDNItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)mergeDesignNoteComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setMergeDesignNote(obj.toString()); - } - } - } - }; - - private ItemListener mergeENItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)mergeEditorNoteComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setMergeEditorNote(obj.toString()); - } - } - } - }; - - private ItemListener splitFromItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)splitFromComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setSplitFrom(obj.toString()); - } - } - } - }; - - private ItemListener codePropItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)codePropComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setCodeProp(obj.toString()); - } - } - } - }; - - private ItemListener labelPropItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)labelPropComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setLabelProp(obj.toString()); - } - } - } - }; - - private ItemListener prefNameItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)prefNameComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - //NCIEditTabPreferences.setPrefName(obj.toString()); - } - } - } - }; - - private ItemListener definitionItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)definitionComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - } - } - } - }; - - private ItemListener fullyQualSynItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)fullyQualSynComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - } - } - } - }; - - private ItemListener reviewDateItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)reviewDateComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - } - } - } - }; - - private ItemListener reviewerNameItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)reviewerNameComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - } - } - } - }; - - private ItemListener defSourceItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)defSourceComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - } - } - } - }; - - private ItemListener synTypeItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)synTypeComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - } - } - } - }; - - private ItemListener synSourceItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)synSourceComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - } - } - } - }; - - private ItemListener semanticTypeItemListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object obj = e.getItem(); - if (obj instanceof String) { - ((JTextField)semanticTypeComboBox.getEditor().getEditorComponent()).setText(obj.toString()); - } - } - } - }; - - private KeyAdapter keyAdapter = new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - if(e.getKeyCode() == KeyEvent.VK_ENTER) { - if(e.getSource().equals(immutablepropList) && immutablepropList.getSelectedValue() instanceof OwlPropertyListHeaderItem) { - addImmutableProperty(); - } else if(e.getSource().equals(complexpropList) && complexpropList.getSelectedValue() instanceof OwlPropertyListHeaderItem) { - addComplexProperty(); - } - } else if(e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { - if(e.getSource().equals(immutablepropList) && immutablepropList.getSelectedValue() instanceof OwlEntityListItem) { - deleteImmutableProperty(); - } else if(e.getSource().equals(complexpropList) && complexpropList.getSelectedValue() instanceof OwlEntityListItem) { - deleteComplexProperty(); - } - } - } - }; - - private MouseAdapter mouseAdapter = new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - if(e.getClickCount() == 2) { - if(e.getSource().equals(immutablepropList) && immutablepropList.getSelectedValue() instanceof OwlPropertyListHeaderItem) { - addImmutableProperty(); - } else if(e.getSource().equals(complexpropList) && complexpropList.getSelectedValue() instanceof OwlPropertyListHeaderItem) { - addComplexProperty(); - } - } - } - }; - - private void addImmutableProperty() { - AddPropertiesToPreferencesPanel.showDialog(getEditorKit(), getEntities(immutablepropList), - immutDependentAnnotations, null).ifPresent(owlEntities -> addEntitiesToList(owlEntities, immutablepropList)); - } - - private void deleteImmutableProperty() { - List items = getListItems(immutablepropList); - items.remove(selectedImmutablePropertyListItem); - immutablepropList.setListData(items.toArray()); - } - - private void addComplexProperty() { - AddPropertiesToPreferencesPanel.showDialog(getEditorKit(), getEntities(complexpropList), - complexDependentAnnotations, null).ifPresent(owlEntities -> addEntitiesToList(owlEntities, complexpropList)); - } - - private void deleteComplexProperty() { - List items = getListItems(complexpropList); - items.remove(selectedComplexPropertyListItem); - complexpropList.setListData(items.toArray()); - } - - private List getEntities(JList list) { - List entities = new ArrayList<>(); - for(Object obj : getListItems(list)) { - if(obj instanceof OwlEntityListItem) { - entities.add(((OwlEntityListItem)obj).getEntity()); - } - } - return entities; - } - - private List getListItems(JList list) { - List properties = new ArrayList<>(); - ListModel model = list.getModel(); - for(int i = 0; i < model.getSize(); i++) { - properties.add(model.getElementAt(i)); - } - return properties; - } - - private void invokeImmutAxiomAnnotationHandler() { - Object obj = immutablepropList.getSelectedValue(); - if (obj instanceof OwlEntityListItem) - addImmutDepProps(((OwlEntityListItem)obj).getEntity()); - - } - - private void invokeComplexAxiomAnnotationHandler() { - Object obj = complexpropList.getSelectedValue(); - if (obj instanceof OwlEntityListItem) - addComplexDepProps(((OwlEntityListItem)obj).getEntity()); - - } - - private void addImmutDepProps(OWLEntity ent) { - AddPropertiesToPreferencesPanel.showDialog(getEditorKit(), getEntities(immutablepropList), - immutDependentAnnotations, ent).ifPresent(owlEntities -> addImmutDepProps(owlEntities, ent)); - } - - private void addComplexDepProps(OWLEntity ent) { - AddPropertiesToPreferencesPanel.showDialog(getEditorKit(), getEntities(complexpropList), - complexDependentAnnotations, ent).ifPresent(owlEntities -> addComplexDepProps(owlEntities, ent)); - } - - private void addImmutDepProps(List entities, OWLEntity ent) { - immutDependentAnnotations.put(ent, entities); - addEntitiesToList(new ArrayList(), immutablepropList); - //NCIEditTabPreferences.setImmutProps(immutablepropList.); - } - - private void addComplexDepProps(List entities, OWLEntity ent) { - complexDependentAnnotations.put(ent, entities); - addEntitiesToList(new ArrayList(), complexpropList); - - } - - private void addEntitiesToList(List entities, JList list) { - List items = getListItems(list); - items.addAll(entities.stream().map(OwlEntityListItem::new).collect(Collectors.toList())); - list.setListData(items.toArray()); - - } - - public OWLClass getRetireCptRootClass() { - return retireCptRootClass; - } - - public OWLProperty getRetireDNProperty() { - return (OWLProperty) retireDesignNoteComboBox.getSelectedItem(); - } - - public OWLProperty getRetireENProperty() { - return (OWLProperty) retireEditorNoteComboBox.getSelectedItem(); - } - - public OWLProperty getRetireCptStatusProperty() { - return (OWLProperty) retireCptStatusComboBox.getSelectedItem(); - } - - public OWLProperty getRetireParentProperty() { - return (OWLProperty) retireParentComboBox.getSelectedItem(); - } - - public OWLProperty getRetireChildProperty() { - return (OWLProperty) retireChildComboBox.getSelectedItem(); - } - - public OWLProperty getRetireRoleProperty() { - return (OWLProperty) retireRoleComboBox.getSelectedItem(); - } - - public OWLProperty getRetireInRoleProperty() { - return (OWLProperty) retireInRoleComboBox.getSelectedItem(); - } - - public OWLProperty getRetireAssocProperty() { - return (OWLProperty) retireAssocComboBox.getSelectedItem(); - } - - public OWLProperty getRetireInAssocProperty() { - return (OWLProperty) retireInAssocComboBox.getSelectedItem(); - } - - public OWLProperty getMergeSourceProperty() { - return (OWLProperty) mergeSourceComboBox.getSelectedItem(); - } - - public OWLProperty getMergeTargetProperty() { - return (OWLProperty) mergeTargetComboBox.getSelectedItem(); - } - - public OWLProperty getMergeDNProperty() { - return (OWLProperty) mergeDesignNoteComboBox.getSelectedItem(); - } - - public OWLProperty getMergeENProperty() { - return (OWLProperty) mergeEditorNoteComboBox.getSelectedItem(); - } - - public OWLProperty getSplitFromProperty() { - return (OWLProperty) splitFromComboBox.getSelectedItem(); - } - - public OWLProperty getCodePropProperty() { - return (OWLProperty) codePropComboBox.getSelectedItem(); - } - - public OWLProperty getLabelPropProperty() { - return (OWLProperty) labelPropComboBox.getSelectedItem(); - } - - public OWLProperty getPrefNameProperty() { - return (OWLProperty) prefNameComboBox.getSelectedItem(); - } - - public OWLProperty getDefinitionProperty() { - return (OWLProperty) definitionComboBox.getSelectedItem(); - } - - public OWLProperty getFullyQualSynProperty() { - return (OWLProperty) fullyQualSynComboBox.getSelectedItem(); - } - - public OWLProperty getReviewDateProperty() { - return (OWLProperty) reviewDateComboBox.getSelectedItem(); - } - - public OWLProperty getReviewerNameProperty() { - return (OWLProperty) reviewerNameComboBox.getSelectedItem(); - } - - public OWLProperty getDefSourceProperty() { - return (OWLProperty) defSourceComboBox.getSelectedItem(); - } - - public OWLProperty getSynTypeProperty() { - return (OWLProperty) synTypeComboBox.getSelectedItem(); - } - - public OWLProperty getSynSourceProperty() { - return (OWLProperty) synSourceComboBox.getSelectedItem(); - } - - public OWLProperty getSemanticTypeProperty() { - return (OWLProperty) semanticTypeComboBox.getSelectedItem(); - } - - @Override - public void dispose() throws Exception { - // NO-OP - } - - @Override - public void applyChanges() { - NCIEditTabPreferences.setFnSplit(cbSplit.isSelected()); - NCIEditTabPreferences.setFnCopy(cbCopy.isSelected()); - NCIEditTabPreferences.setFnMerge(cbMerge.isSelected()); - NCIEditTabPreferences.setFnDualEdits(cbDualEdits.isSelected()); - NCIEditTabPreferences.setFnRetire(cbRetire.isSelected()); - - NCIEditTab.currentTab().fireChange(new PreferencesChangeEvent(NCIEditTab.currentTab(), - ComplexEditType.PREFMODIFY)); - - SaveProjectOptions(); - } - - public void SaveProjectOptions() { - LoadProjectOptions(); - ProjectOptions projOptions = new ProjectOptionsImpl(projectOptions); - String filePath = userSelectedFilePathTxtfld.getText(); - if (filePath == null || filePath.isEmpty()) { - filePath = "project-options.json"; - } - ProjectOptionsConfigManager.saveProjectOptionsFile(projOptions, filePath); - } - - private void LoadProjectOptions() { - Set retireCptRootValue = new TreeSet(); - Set designNoteValue = new TreeSet(); - Set editorNoteValue = new TreeSet(); - Set retireCptStatusValue = new TreeSet(); - Set retireParentValue = new TreeSet(); - Set retireChildValue = new TreeSet(); - Set retireRoleValue = new TreeSet(); - Set retireInRoleValue = new TreeSet(); - Set retireAssocValue = new TreeSet(); - Set retireInAssocValue = new TreeSet(); - Set mergeSourceValue = new TreeSet(); - Set mergeTargetValue = new TreeSet(); - Set splitFromValue = new TreeSet(); - Set codePropValue = new TreeSet(); - Set labelPropValue = new TreeSet(); - Set prefNameValue = new TreeSet(); - Set definitionValue = new TreeSet(); - Set fullyQualSynValue = new TreeSet(); - Set reviewDateValue = new TreeSet(); - Set reviewerNameValue = new TreeSet(); - Set defSourceValue = new TreeSet(); - Set synTypeValue = new TreeSet(); - Set synSourceValue = new TreeSet(); - Set semanticTypeValue = new TreeSet(); - - if (getRetireCptRootClass() != null) { - retireCptRootValue.add(getRetireCptRootClass().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.RETIRE_CONCEPTS_ROOT_NAME, retireCptRootValue); - NCIEditTabPreferences.setRetireConceptRoot(getRetireCptRootClass().getIRI().getRemainder().get()); - } - if (getRetireDNProperty() != null) { - designNoteValue.add(getRetireDNProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.DESIGN_NOTE_NAME, designNoteValue); - NCIEditTabPreferences.setRetireDesignNote(getRetireDNProperty().getIRI().getRemainder().get()); - } - if (getRetireENProperty() != null) { - editorNoteValue.add(getRetireENProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.EDITOR_NOTE_NAME, editorNoteValue); - NCIEditTabPreferences.setRetireEditorNote(getRetireENProperty().getIRI().getRemainder().get()); - } - if (getRetireCptStatusProperty() != null) { - retireCptStatusValue.add(getRetireCptStatusProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.DEPR_CONCEPT_STATUS_PROP_NAME, retireCptStatusValue); - NCIEditTabPreferences.setRetireConceptStatus(getRetireCptStatusProperty().getIRI().getRemainder().get()); - } - if (getRetireParentProperty() != null) { - retireParentValue.add(getRetireParentProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.DEPR_PARENT_NAME, retireParentValue); - NCIEditTabPreferences.setRetireParent(getRetireParentProperty().getIRI().getRemainder().get()); - } - if (getRetireChildProperty() != null) { - retireChildValue.add(getRetireChildProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.DEPR_CHILD_NAME, retireChildValue); - NCIEditTabPreferences.setRetireChild(getRetireChildProperty().getIRI().getRemainder().get()); - } - if (getRetireRoleProperty() != null) { - retireRoleValue.add(getRetireRoleProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.DEPR_ROLE_NAME, retireRoleValue); - NCIEditTabPreferences.setRetireRole(getRetireRoleProperty().getIRI().getRemainder().get()); - } - if (getRetireInRoleProperty() != null) { - retireInRoleValue.add(getRetireInRoleProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.DEPR_IN_ROLE_NAME, retireInRoleValue); - NCIEditTabPreferences.setRetireInRole(getRetireInRoleProperty().getIRI().getRemainder().get()); - } - if (getRetireAssocProperty() != null) { - retireAssocValue.add(getRetireAssocProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.DEPR_ASSOC_NAME, retireAssocValue); - NCIEditTabPreferences.setRetireAssoc(getRetireAssocProperty().getIRI().getRemainder().get()); - } - if (getRetireInAssocProperty() != null) { - retireInAssocValue.add(getRetireInAssocProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.DEPR_IN_ASSOC_NAME, retireInAssocValue); - NCIEditTabPreferences.setRetireInAssoc(getRetireInAssocProperty().getIRI().getRemainder().get()); - } - if (getMergeSourceProperty() != null) { - mergeSourceValue.add(getMergeSourceProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.MERGE_SOURCE_NAME, mergeSourceValue); - NCIEditTabPreferences.setMergeSource(getMergeSourceProperty().getIRI().getRemainder().get()); - } - if (getMergeTargetProperty() != null) { - mergeTargetValue.add(getMergeTargetProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.MERGE_TARGET_NAME, mergeTargetValue); - NCIEditTabPreferences.setMergeTarget(getMergeTargetProperty().getIRI().getRemainder().get()); - } - if (getSplitFromProperty() != null) { - splitFromValue.add(getSplitFromProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.SPLIT_FROM_NAME, splitFromValue); - NCIEditTabPreferences.setSplitFrom(getSplitFromProperty().getIRI().getRemainder().get()); - } - if (getCodePropProperty() != null) { - codePropValue.add(getCodePropProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.CODE_PROP_NAME, codePropValue); - NCIEditTabPreferences.setCodeProp(getCodePropProperty().getIRI().getRemainder().get()); - } - if (getLabelPropProperty() != null) { - labelPropValue.add(getLabelPropProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.LABEL_PROP_NAME, labelPropValue); - NCIEditTabPreferences.setLabelProp(getLabelPropProperty().getIRI().getRemainder().get()); - } - if (getPrefNameProperty() != null) { - prefNameValue.add(getPrefNameProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.PREF_NAME_NAME, prefNameValue); - NCIEditTabPreferences.setPrefName(getPrefNameProperty().getIRI().getRemainder().get()); - } - if (getDefinitionProperty() != null) { - definitionValue.add(getDefinitionProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.DEFINITION_NAME, definitionValue); - NCIEditTabPreferences.setDefinition(getDefinitionProperty().getIRI().getRemainder().get()); - } - if (getFullyQualSynProperty() != null) { - fullyQualSynValue.add(getFullyQualSynProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.FULLY_QUAL_SYN_NAME, fullyQualSynValue); - NCIEditTabPreferences.setFullyQualSyn(getFullyQualSynProperty().getIRI().getRemainder().get()); - } - if (getReviewDateProperty() != null) { - reviewDateValue.add(getReviewDateProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.REVIEW_DATE_NAME, reviewDateValue); - NCIEditTabPreferences.setReviewDate(getReviewDateProperty().getIRI().getRemainder().get()); - } - if (getReviewerNameProperty() != null) { - reviewerNameValue.add(getReviewerNameProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.REVIEWER_NAME_NAME, reviewerNameValue); - NCIEditTabPreferences.setReviewerName(getReviewerNameProperty().getIRI().getRemainder().get()); - } - if (getDefSourceProperty() != null) { - defSourceValue.add(getDefSourceProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.DEF_SOURCE_NAME, defSourceValue); - NCIEditTabPreferences.setDefSource(getDefSourceProperty().getIRI().getRemainder().get()); - } - if (getSynTypeProperty() != null) { - synTypeValue.add(getSynTypeProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.SYN_TYPE_NAME, synTypeValue); - NCIEditTabPreferences.setSynType(getSynTypeProperty().getIRI().getRemainder().get()); - } - if (getSynSourceProperty() != null) { - synSourceValue.add(getSynSourceProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.SYN_SOURCE_NAME, synSourceValue); - NCIEditTabPreferences.setSynSource(getSynSourceProperty().getIRI().getRemainder().get()); - } - if (getSemanticTypeProperty() != null) { - semanticTypeValue.add(getSemanticTypeProperty().getIRI().getIRIString()); - this.projectOptions.put(NCIEditTabConstants.SEMANTIC_TYPE_NAME, semanticTypeValue); - NCIEditTabPreferences.setSemanticType(getSemanticTypeProperty().getIRI().getRemainder().get()); - } - - //Load immutable properties - ListModel immutListModel = null; - OwlEntityListItem entity = null; - Set immutPropSet = new TreeSet(); - List immutPropList = new ArrayList(); - if (this.immutablepropList != null) { - immutListModel = this.immutablepropList.getModel(); - for (int i=0; i < immutListModel.getSize(); i++) { - if (immutListModel.getElementAt(i) instanceof OwlEntityListItem) { - entity = (OwlEntityListItem)immutListModel.getElementAt(i); - immutPropSet.add(entity.getEntity().getIRI().getIRIString()); - immutPropList.add(entity.getEntity().getIRI().getRemainder().get()); - } - } - this.projectOptions.put(NCIEditTabConstants.IMMUTABLE_PROPS, immutPropSet); - NCIEditTabPreferences.setImmutPropList(immutPropList); - } - //Load complex properties - ListModel compPropListModel = null; - OwlEntityListItem cpentity = null; - Set complexPropSet = new TreeSet(); - List compPropList = new ArrayList(); - if (this.complexpropList != null) { - compPropListModel = this.complexpropList.getModel(); - for (int i=0; i < compPropListModel.getSize(); i++) { - if (compPropListModel.getElementAt(i) instanceof OwlEntityListItem) { - cpentity = (OwlEntityListItem)compPropListModel.getElementAt(i); - complexPropSet.add(cpentity.getEntity().getIRI().getIRIString()); - compPropList.add(cpentity.getEntity().getIRI().getRemainder().get()); - } - } - this.projectOptions.put(NCIEditTabConstants.COMPLEX_PROPS, complexPropSet); - NCIEditTabPreferences.setComplexPropList(compPropList); - } - //Load complex property dependent annotations - List compPropAnnotList = new ArrayList(); - for (Entry> entry: complexDependentAnnotations.entrySet()) { - OWLEntity comppropKey = entry.getKey(); - List compAnnotationList = entry.getValue(); - OWLEntity cpannotent = null; - Set compDependentAnnotationSet = new TreeSet(); - compPropAnnotList.clear(); - for (int i=0; i