use of cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView in project vcell by virtualcell.
the class BioPaxObjectPropertiesPanel method initialize.
private void initialize() {
try {
table = new ScrollTable();
tableModel = new BioPaxObjectPropertiesTableModel(table);
table.setModel(tableModel);
details = new JTextPane();
details.setContentType("text/html");
details.setEditable(false);
JScrollPane scrl = new JScrollPane(details);
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
BioPaxObjectProperty property = tableModel.getValueAt(table.getSelectedRow());
if (property != null) {
final String htmlStart = "<html><font face = \"Arial\"><font size =\"-2\">";
final String htmlEnd = "</font></font></html>";
if (!property.getDetails().isEmpty()) {
details.setText(htmlStart + property.getDetails() + htmlEnd);
} else if ((property.value != null) && !property.value.isEmpty()) {
String text = FormatDetails(property);
details.setText(htmlStart + text + htmlEnd);
} else {
details.setText(htmlStart + "row: " + table.getSelectedRow() + ", col: " + table.getSelectedColumn() + htmlEnd);
}
}
}
}
});
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, table.getEnclosingScrollPane(), scrl);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(150);
// provide minimum sizes for the two components in the split pane
Dimension minimumSize = new Dimension(100, 50);
table.getEnclosingScrollPane().setMinimumSize(minimumSize);
scrl.setMinimumSize(minimumSize);
setLayout(new BorderLayout());
// add(table.getEnclosingScrollPane(), BorderLayout.CENTER);
// add(details, BorderLayout.CENTER);
add(splitPane, BorderLayout.CENTER);
setBackground(Color.white);
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
// launch the browser when double click on hyperlinks
Point pt = e.getPoint();
int crow = table.rowAtPoint(pt);
int ccol = table.columnAtPoint(pt);
if (table.convertColumnIndexToModel(ccol) == BioPaxObjectPropertiesTableModel.Column_Value) {
BioPaxObjectProperty property = tableModel.getValueAt(crow);
BioPaxObject bioPaxObject = property.bioPaxObject;
if (bioPaxObject == null) {
BioModelEntityObject bioModelEntityObject = property.bioModelEntityObject;
if (bioModelEntityObject != null) {
if (bioModelEntityObject instanceof SpeciesContext) {
selectionManager.followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.REACTION_DIAGRAM_NODE, ActiveViewID.reaction_diagram), new Object[] { bioModelEntityObject });
} else if (bioModelEntityObject instanceof MolecularType) {
selectionManager.followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE, ActiveViewID.species_definitions), new Object[] { bioModelEntityObject });
}
} else if (((Entity) BioPaxObjectPropertiesPanel.this.bioPaxObject).getFormalNames() == null || ((Entity) BioPaxObjectPropertiesPanel.this.bioPaxObject).getFormalNames().size() == 0) {
lookupFormalName(crow);
}
} else if (bioPaxObject instanceof Xref) {
// if xRef, get url
String url = ((Xref) bioPaxObject).getURL();
DialogUtils.browserLauncher(BioPaxObjectPropertiesPanel.this, url, "Wrong URL.");
} else if (bioPaxObject instanceof SBEntity) {
// TODO: kineticLaw
SBEntity sbE = (SBEntity) bioPaxObject;
if (sbE.getID().contains("kineticLaw")) {
// String url = "http://sabio.h-its.org/sabioRestWebServices/kineticLaws/" + sbE.getID().substring(sbE.getID().indexOf("kineticLaw") + 10);
String url = "http://sabiork.h-its.org/kindatadirectiframe.jsp?kinlawid=" + sbE.getID().substring(sbE.getID().indexOf("kineticLaw") + 10);
DialogUtils.browserLauncher(BioPaxObjectPropertiesPanel.this, url, "Wrong URL.");
}
}
}
}
}
});
// --- end of addMouseListener()
table.getColumnModel().getColumn(BioPaxObjectPropertiesTableModel.Column_Value).setCellRenderer(new DefaultScrollTableCellRenderer() {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (column == BioPaxObjectPropertiesTableModel.Column_Value) {
BioPaxObjectProperty property = tableModel.getValueAt(row);
BioPaxObject bpObject = property.bioPaxObject;
String text = property.value;
// colorize BLUE and add surround text with <html></html> tags
if (bpObject == null) {
BioModelEntityObject bioModelEntityObject = property.bioModelEntityObject;
if (bioModelEntityObject != null) {
if (!isSelected) {
setForeground(Color.blue);
}
setText("<html><u>" + text + "</u></html>");
}
} else {
if (bpObject instanceof Xref) {
String url = ((Xref) bpObject).getURL();
if (url != null) {
setToolTipText(url);
if (!isSelected) {
setForeground(Color.blue);
}
setText("<html><u>" + text + "</u></html>");
}
} else if (bpObject instanceof SBEntity) {
String url = ((SBEntity) bpObject).getID();
if (url.contains("kineticLaw")) {
setToolTipText(url);
if (!isSelected) {
setForeground(Color.blue);
}
if (url.contains("http")) {
setText("<html><u>" + text + "</u></html>");
}
}
}
}
}
BioPaxObjectProperty property = tableModel.getValueAt(row);
if (!property.tooltip.isEmpty()) {
setToolTipText(property.tooltip);
}
return this;
}
});
// --- end of setCellRenderer()
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
use of cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView in project vcell by virtualcell.
the class ApplicationGeometryPanel method getActiveView.
@Override
public ActiveView getActiveView() {
Component selectedComponent = tabbedPane.getSelectedComponent();
ActiveViewID activeViewID = null;
if (selectedComponent == structureMappingCartoonPanel) {
activeViewID = ActiveViewID.structure_mapping;
} else if (selectedComponent == geometryViewer) {
activeViewID = ActiveViewID.geometry_definition;
} else if (selectedComponent == spatialEntitiesPanel) {
activeViewID = ActiveViewID.spatial_entities;
} else if (selectedComponent == spatialObjectDisplayPanel) {
activeViewID = ActiveViewID.spatial_objects;
} else if (selectedComponent == spatialProcessDisplayPanel) {
activeViewID = ActiveViewID.spatial_processes;
}
return new ActiveView(simulationContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, activeViewID);
}
use of cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView in project vcell by virtualcell.
the class ApplicationProtocolsPanel method getActiveView.
@Override
public ActiveView getActiveView() {
Component selectedComponent = tabbedPane.getSelectedComponent();
ActiveViewID activeViewID = null;
if (selectedComponent == eventsDisplayPanel) {
activeViewID = ActiveViewID.events;
} else if (selectedComponent == electricalMembraneMappingPanel) {
activeViewID = ActiveViewID.electrical;
} else if (selectedComponent == microscopeMeasurementPanel) {
activeViewID = ActiveViewID.microscope_measuremments;
} else if (selectedComponent == rateRulesDisplayPanel) {
activeViewID = ActiveViewID.rateRules;
}
return new ActiveView(simulationContext, DocumentEditorTreeFolderClass.PROTOCOLS_NODE, activeViewID);
}
use of cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView in project vcell by virtualcell.
the class ApplicationSimulationsPanel method getActiveView.
@Override
public ActiveView getActiveView() {
Component selectedComponent = tabbedPane.getSelectedComponent();
ActiveViewID activeViewID = null;
if (selectedComponent == simulationListPanel) {
activeViewID = ActiveViewID.simulations;
} else if (selectedComponent == outputFunctionsPanel) {
activeViewID = ActiveViewID.output_functions;
} else if (selectedComponent == mathematicsPanel) {
activeViewID = ActiveViewID.generated_math;
}
return new ActiveView(simulationContext, DocumentEditorTreeFolderClass.SIMULATIONS_NODE, activeViewID);
}
use of cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView in project vcell by virtualcell.
the class ApplicationSpecificationsPanel method getActiveView.
@Override
public ActiveView getActiveView() {
Component selectedComponent = tabbedPane.getSelectedComponent();
ActiveViewID activeViewID = null;
for (SpecifierComponent spc : subPanels) {
if (selectedComponent == spc.component) {
activeViewID = spc.setter.getActiveView();
break;
}
}
return new ActiveView(simulationContext, DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, activeViewID);
}
Aggregations