use of cbit.vcell.biomodel.meta.VCMetaDataMiriamManager.VCMetaDataDataType in project vcell by virtualcell.
the class AnnotationsPanel method updateInterface.
private void updateInterface() {
if (bioModel == null) {
return;
}
Identifiable entity = getIdentifiable(selectedObject);
if (selectedObject != null && entity != null) {
getJComboBoxURI().setEnabled(true);
getJTextFieldFormalID().setEnabled(true);
getJButtonAddRef().setEnabled(true);
getJButtonRemoveText().setEnabled(true);
VCMetaDataDataType mdt = (VCMetaDataDataType) getJComboBoxURI().getSelectedItem();
miriamTreeModel.createTree(entity);
String freeText = bioModel.getVCMetaData().getFreeTextAnnotation(entity);
if (freeText == null || freeText.isEmpty()) {
annotationTextArea.setText(null);
} else {
annotationTextArea.setText(freeText);
}
annotationTextArea.setEditable(true);
annotationTextArea.setCaretPosition(0);
} else {
getJComboBoxURI().setEnabled(false);
getJTextFieldFormalID().setEnabled(false);
getJButtonAddRef().setEnabled(false);
getJButtonRemoveText().setEnabled(false);
miriamTreeModel.createTree(null);
annotationTextArea.setText(null);
annotationTextArea.setEditable(false);
}
}
use of cbit.vcell.biomodel.meta.VCMetaDataMiriamManager.VCMetaDataDataType in project vcell by virtualcell.
the class AnnotationsPanel method getJPanelNewIdentifier.
private JPanel getJPanelNewIdentifier() {
jPanelNewIdentifier = new JPanel();
jPanelNewIdentifier.setLayout(new GridBagLayout());
// jPanelNewIdentifier.setPreferredSize(new Dimension(725, 37));
// jPanelNewIdentifier.setBorder(BorderFactory.createLineBorder(SystemColor.windowBorder, 2));
VCMetaDataDataType mdt = (VCMetaDataDataType) getJComboBoxURI().getSelectedItem();
int gridx = 0;
int gridy = 0;
GridBagConstraints gbc = new GridBagConstraints();
// top left bottom right
gbc.insets = new Insets(3, 15, 3, 0);
gbc.gridx = gridx;
gbc.gridy = gridy;
gbc.anchor = GridBagConstraints.WEST;
jPanelNewIdentifier.add(new JLabel("Provider: "), gbc);
gridx++;
gbc = new GridBagConstraints();
gbc.insets = new Insets(3, 5, 3, 4);
gbc.gridx = gridx;
gbc.gridy = gridy;
gbc.anchor = GridBagConstraints.WEST;
jPanelNewIdentifier.add(new JLabel("<html><b>" + mdt.getDataTypeName() + "</b></html>"), gbc);
// ------------------------------------- Qualifier combobox -----------------------------
gridx++;
gbc = new GridBagConstraints();
// top left bottom right
gbc.insets = new Insets(3, 15, 3, 0);
gbc.gridx = gridx;
gbc.gridy = gridy;
jPanelNewIdentifier.add(new JLabel("Qualifier"), gbc);
gridx++;
gbc = new GridBagConstraints();
gbc.insets = new Insets(3, 5, 3, 4);
gbc.gridx = gridx;
gbc.gridy = gridy;
jPanelNewIdentifier.add(getJComboBoxQualifier(), gbc);
// -------------------------------------------------------------------------------
gridx++;
gbc = new GridBagConstraints();
gbc.insets = new Insets(3, 15, 3, 0);
gbc.gridx = gridx;
gbc.gridy = gridy;
gbc.anchor = GridBagConstraints.WEST;
jPanelNewIdentifier.add(new JLabel("Identifier ID"), gbc);
gridx++;
gbc = new GridBagConstraints();
gbc.insets = new Insets(3, 5, 3, 4);
gbc.gridx = gridx;
gbc.gridy = gridy;
gbc.anchor = GridBagConstraints.WEST;
jPanelNewIdentifier.add(getJTextFieldFormalID(), gbc);
getJTextFieldFormalID().setText("NewID");
gridx++;
gbc = new GridBagConstraints();
gbc.insets = new Insets(3, 15, 3, 0);
gbc.gridx = gridx;
gbc.gridy = gridy;
gbc.anchor = GridBagConstraints.WEST;
jPanelNewIdentifier.add(new JLabel("<html>Example: <b>" + mdt.getExample() + "</b></html>"), gbc);
gridx++;
gbc = new GridBagConstraints();
gbc.insets = new Insets(3, 15, 3, 0);
gbc.gridx = gridx;
gbc.gridy = gridy;
gbc.weightx = 1.0;
gbc.anchor = GridBagConstraints.EAST;
jPanelNewIdentifier.add(new JLabel(), gbc);
// ---------------------------------------------------------------------
gridx = 0;
gridy++;
JLabel linkLabel = new JLabel();
String s = "<html>" + "Navigate to" + " <font color=\"" + "blue" + "\"><a href=" + mdt.getDataTypeURL() + ">" + mdt.getDataTypeURL() + "</a></font> ";
s += "and find the identifier ID, then paste it in the box above." + "</html>";
linkLabel.setToolTipText("Double-click to open link");
linkLabel.setText(s);
linkLabel.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if (e.getClickCount() == 2) {
showBrowseToLink(mdt);
}
}
});
gbc = new GridBagConstraints();
gbc.insets = new Insets(3, 15, 3, 0);
gbc.gridx = gridx;
gbc.gridy = gridy;
gbc.gridwidth = 8;
gbc.anchor = GridBagConstraints.WEST;
jPanelNewIdentifier.add(linkLabel, gbc);
// ---------------------------------------------------------------------
List<String> rows = new ArrayList<>();
String value = mdt.getDescription();
StringTokenizer tokenizer = new StringTokenizer(value, " ");
String row = "";
while (tokenizer.hasMoreTokens()) {
String word = tokenizer.nextToken();
if ((row.length() + word.length()) > MAX_DESCRIPTION_LENGTH) {
rows.add(row);
row = word + " ";
} else {
row += word + " ";
}
}
if (!row.isEmpty()) {
rows.add(row);
}
for (String currentRow : rows) {
gridx = 0;
gridy++;
gbc = new GridBagConstraints();
gbc.insets = new Insets(3, 15, 3, 0);
gbc.gridx = gridx;
gbc.gridy = gridy;
gbc.gridwidth = 8;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
jPanelNewIdentifier.add(new JLabel(currentRow), gbc);
}
return jPanelNewIdentifier;
}
Aggregations