Skip to content

Commit

Permalink
Adding the new Search annotation feature
Browse files Browse the repository at this point in the history
  • Loading branch information
danv61 committed May 6, 2024
1 parent 78bebaf commit 9899eb6
Showing 1 changed file with 36 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public class AnnotationsPanel extends DocumentEditorSubPanel {
MiriamTreeModel miriamTreeModel = null;

private Identifiable selectedObject = null;


public static final String ACTION_SEARCH ="Search...";
public static final String ACTION_ADD ="Add...";
public static final String ACTION_DELETE ="Delete";
public static final String ACTION_REMOVE_TEXT = "Delete";
Expand All @@ -130,7 +131,8 @@ public class AnnotationsPanel extends DocumentEditorSubPanel {
private DefaultComboBoxModel defaultComboBoxModelQualifier = new DefaultComboBoxModel();

private JTextField jTextFieldFormalID = null; // immortal ID text
private JButton jButtonAddRef = null; // add a cross-reference
private JButton jButtonAddRef = null; // add a known cross-reference to a provider database entity
private JButton jButtonSearchRef = null; // add a cross-reference by provider database search of entity
private JButton jButtonDeleteRef = null; // delete selected cross-reference
private JButton jButtonRemoveText = null; // remove text annotation

Expand Down Expand Up @@ -180,6 +182,8 @@ public void propertyChange(PropertyChangeEvent evt) {
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() == getJButtonAddRef()) {
addIdentifier();
} else if(evt.getSource() == getJButtonSearchRef()) {
searchIdentifier();
} else if(evt.getSource() == getJButtonDeleteRef()) {
removeIdentifier();
} else if(evt.getSource() == getJButtonRemoveText()) {
Expand Down Expand Up @@ -444,6 +448,13 @@ private JPanel getJPanelIdentifierManager() {
gbc.gridy = 0;
jPanelIdentifierManager.add(getJComboBoxURI(), gbc);

gridx++;
gbc = new GridBagConstraints();
gbc.insets = new Insets(3, 5, 3, 4);
gbc.gridx = gridx;
gbc.gridy = 0;
jPanelIdentifierManager.add(getJButtonSearchRef(), gbc);

gridx++;
gbc = new GridBagConstraints();
gbc.insets = new Insets(3, 5, 3, 5);
Expand All @@ -459,8 +470,9 @@ private JPanel getJPanelIdentifierManager() {
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
jPanelIdentifierManager.add(new JLabel(""), gbc);

getJButtonAddRef().addActionListener(eventHandler);
getJButtonSearchRef().addActionListener(eventHandler);
}
return jPanelIdentifierManager;
}
Expand Down Expand Up @@ -642,7 +654,7 @@ private JSplitPane getSplitPane() {
splitPane.setLeftComponent(leftPanel);
splitPane.setRightComponent(rightPanel);
splitPane.setResizeWeight(0.1);
splitPane.setDividerLocation(0.3);
splitPane.setDividerLocation(0.4);

annotationTextArea.addKeyListener(eventHandler);
}
Expand Down Expand Up @@ -839,6 +851,7 @@ private void updateInterface() {
if(selectedObject != null && entity != null) {
getJComboBoxURI().setEnabled(true);
getJTextFieldFormalID().setEnabled(true);
getJButtonSearchRef().setEnabled(true);
getJButtonAddRef().setEnabled(true);
getJButtonRemoveText().setEnabled(true);
VCMetaDataDataType mdt = (VCMetaDataDataType)getJComboBoxURI().getSelectedItem();
Expand All @@ -855,6 +868,7 @@ private void updateInterface() {
} else {
getJComboBoxURI().setEnabled(false);
getJTextFieldFormalID().setEnabled(false);
getJButtonSearchRef().setEnabled(false);
getJButtonAddRef().setEnabled(false);
getJButtonRemoveText().setEnabled(false);
miriamTreeModel.createTree(null);
Expand Down Expand Up @@ -926,6 +940,9 @@ protected void onSelectedObjectsChange(Object[] selectedObjects) {
}

// -------------------------------------------------------------------------------------------------------
private void searchIdentifier() {

}

private void addIdentifier() {
if(PopupGenerator.showComponentOKCancelDialog(AnnotationsPanel.this, getJPanelNewIdentifier(), "Define New Formal Identifier") != JOptionPane.OK_OPTION) {
Expand Down Expand Up @@ -1054,14 +1071,22 @@ private void initializeComboBoxQualifier() {
}
}

private JButton getJButtonAddRef() {
if (jButtonAddRef == null) {
jButtonAddRef = new JButton();
jButtonAddRef.setText(ACTION_ADD);
jButtonAddRef.setToolTipText("Add a new reference with this provider");
private JButton getJButtonSearchRef() {
if (jButtonSearchRef == null) {
jButtonSearchRef = new JButton();
jButtonSearchRef.setText(ACTION_SEARCH);
jButtonSearchRef.setToolTipText("Search a reference within this provider database");
}
return jButtonSearchRef;
}
private JButton getJButtonAddRef() {
if (jButtonAddRef == null) {
jButtonAddRef = new JButton();
jButtonAddRef.setText(ACTION_ADD);
jButtonAddRef.setToolTipText("Add a known reference with this provider");
}
return jButtonAddRef;
}
return jButtonAddRef;
}
private JButton getJButtonDeleteRef() {
if (jButtonDeleteRef == null) {
jButtonDeleteRef = new JButton();
Expand Down

0 comments on commit 9899eb6

Please sign in to comment.