use of cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.
the class BioModelEditor method setRightBottomPanelOnSelection.
@Override
protected void setRightBottomPanelOnSelection(Object[] selections) {
if (selections == null) {
return;
}
// TODO: here
JComponent bottomComponent = rightBottomEmptyPanel;
JComponent annotationComponent = rightBottomEmptyAnnotationsPanel;
// properties panel
int destComponentIndex = DocumentEditorTabID.object_properties.ordinal();
// annotations panel
int annComponentIndex = DocumentEditorTabID.annotations.ordinal();
boolean bShowInDatabaseProperties = false;
boolean bShowPathway = false;
if (selections.length == 1) {
annotationComponent = getAnnotationsPanel();
Object singleSelection = selections[0];
if (singleSelection instanceof ReactionStep) {
bottomComponent = getReactionPropertiesPanel();
} else if (singleSelection instanceof ReactionRule) {
bottomComponent = getReactionRulePropertiesPanel();
} else if (singleSelection instanceof SpeciesContext) {
bottomComponent = getSpeciesPropertiesPanel();
} else if (singleSelection instanceof MolecularType) {
bottomComponent = getMolecularTypePropertiesPanel();
} else if (singleSelection instanceof RbmObservable) {
bottomComponent = getObservablePropertiesPanel();
} else if (singleSelection instanceof Structure) {
bottomComponent = getStructurePropertiesPanel();
getStructurePropertiesPanel().setModel(bioModel.getModel());
} else if (singleSelection instanceof Parameter) {
bottomComponent = getParameterPropertiesPanel();
} else if (singleSelection instanceof SimulationContext) {
bottomComponent = getApplicationPropertiesPanel();
} else if (singleSelection instanceof ParameterEstimationTask) {
bottomComponent = parameterEstimationTaskPropertiesPanel;
} else if (singleSelection instanceof Product || singleSelection instanceof Reactant) {
bottomComponent = getReactionParticipantPropertiesPanel();
} else if (singleSelection instanceof BioModelNode.PublicationInfoNode) {
bShowInDatabaseProperties = true;
bottomComponent = bioModelMetaDataPanel;
} else if (singleSelection instanceof BioModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = bioModelMetaDataPanel;
} else if (singleSelection instanceof MathModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = mathModelMetaDataPanel;
} else if (singleSelection instanceof GeometryInfo) {
bShowInDatabaseProperties = true;
bottomComponent = geometryMetaDataPanel;
} else if (singleSelection instanceof SpeciesContextSpec) {
bottomComponent = getSpeciesContextSpecPanel();
} else if (singleSelection instanceof ReactionSpec) {
bottomComponent = getKineticsTypeTemplatePanel();
} else if (singleSelection instanceof ReactionRuleSpec) {
//
bottomComponent = getReactionRuleSpecPropertiesPanel();
} else if (singleSelection instanceof BioModelsNetModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = getBioModelsNetPropertiesPanel();
} else if (singleSelection instanceof Simulation) {
bottomComponent = getSimulationSummaryPanel();
} else if (singleSelection instanceof DataSymbol) {
bottomComponent = getDataSymbolsSpecPanel();
} else if (singleSelection instanceof BioEvent) {
bottomComponent = getEventPanel();
} else if (singleSelection instanceof SpatialObject) {
bottomComponent = getSpatialObjectPropertyPanel();
} else if (singleSelection instanceof SpatialProcess) {
bottomComponent = getSpatialProcessPropertyPanel();
} else if (singleSelection instanceof BioPaxObject) {
bottomComponent = bioPaxObjectPropertiesPanel;
} else if (singleSelection instanceof BioModel) {
// only contains Notes, is displayed in the Object Properties Panel
bottomComponent = bioModelEditorAnnotationPanel;
} else if (singleSelection instanceof VCMetaData) {
bottomComponent = bioModelEditorAnnotationPanel;
} else if (singleSelection instanceof PathwayData) {
bShowPathway = true;
bottomComponent = getBioModelEditorPathwayPanel();
} else if (singleSelection instanceof Model) {
} else if (singleSelection instanceof RuleParticipantSignature) {
bottomComponent = getReactionRuleParticipantSignaturePropertiesPanel();
} else if (singleSelection instanceof CSGObject) {
bottomComponent = csgObjectPropertiesPanel;
csgObjectPropertiesPanel.setSimulationContext(getSelectedSimulationContext());
} else if (singleSelection instanceof DocumentEditorTreeFolderNode) {
DocumentEditorTreeFolderClass folderClass = ((DocumentEditorTreeFolderNode) singleSelection).getFolderClass();
if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && !(singleSelection instanceof ReactionRule)) {
bottomComponent = getReactionPropertiesPanel();
} else if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && (singleSelection instanceof ReactionRule)) {
bottomComponent = getReactionRulePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.STRUCTURES_NODE) {
bottomComponent = getStructurePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.SPECIES_NODE) {
bottomComponent = getSpeciesPropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE) {
bottomComponent = getMolecularTypePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.OBSERVABLES_NODE) {
bottomComponent = getObservablePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.APPLICATIONS_NODE) {
bottomComponent = getApplicationsPropertiesPanel();
getApplicationsPropertiesPanel().setBioModel(bioModel);
} else if (folderClass == DocumentEditorTreeFolderClass.PARAMETER_ESTIMATION_NODE) {
bottomComponent = parameterEstimationTaskPropertiesPanel;
}
} else if (singleSelection instanceof SelectionManager.AnnotationNavigator) {
Object entity = ((SelectionManager.AnnotationNavigator) singleSelection).getEntity();
if (entity instanceof ReactionStep) {
bottomComponent = getReactionPropertiesPanel();
} else if (entity instanceof SpeciesContext) {
bottomComponent = getSpeciesPropertiesPanel();
} else if (entity instanceof Structure) {
// Observables. MolecularType, Structures
bottomComponent = getStructurePropertiesPanel();
} else if (entity instanceof MolecularType) {
bottomComponent = getMolecularTypePropertiesPanel();
} else if (entity instanceof RbmObservable) {
bottomComponent = getObservablePropertiesPanel();
} else {
bottomComponent = bioModelEditorAnnotationPanel;
}
}
}
if (bShowPathway) {
int numTabs = rightBottomTabbedPane.getTabCount();
for (destComponentIndex = 0; destComponentIndex < numTabs; destComponentIndex++) {
Component current = rightBottomTabbedPane.getComponentAt(destComponentIndex);
if (current == bottomComponent) {
break;
}
}
String tabTitle = "Pathway Preview";
if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
rightBottomTabbedPane.addTab(tabTitle, new TabCloseIcon(), bottomComponent);
}
} else if (bShowInDatabaseProperties) {
for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
Component c = rightBottomTabbedPane.getComponentAt(destComponentIndex);
if (c == bioModelMetaDataPanel || c == mathModelMetaDataPanel || c == geometryMetaDataPanel || c == getBioModelsNetPropertiesPanel()) {
break;
}
}
if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
rightBottomTabbedPane.addTab(DATABASE_PROPERTIES_TAB_TITLE, new TabCloseIcon(), bottomComponent);
}
}
if (rightBottomTabbedPane.getComponentAt(destComponentIndex) != bottomComponent) {
bottomComponent.setBorder(GuiConstants.TAB_PANEL_BORDER);
annotationComponent.setBorder(GuiConstants.TAB_PANEL_BORDER);
rightBottomTabbedPane.setComponentAt(destComponentIndex, bottomComponent);
rightBottomTabbedPane.setComponentAt(annComponentIndex, annotationComponent);
rightSplitPane.repaint();
}
Component selectedComponent = rightBottomTabbedPane.getSelectedComponent();
if (selections.length == 1 && selections[0] instanceof BioModel && bottomComponent instanceof BioModelEditorAnnotationPanel) {
// if the biomodel name is selected in the upper left tree, we select the Annotations tab
rightBottomTabbedPane.setSelectedComponent(annotationComponent);
} else if (selections.length == 1 && selections[0] instanceof SelectionManager.AnnotationNavigator && selections[0] instanceof SelectionManager.AnnotationNavigator) {
// we want to navigate to the AnnotationPanel
rightBottomTabbedPane.setSelectedComponent(annotationComponent);
// } else if(selections.length == 1 && selections[0] instanceof SelectionManager.AnnotationNavigator && bottomComponent instanceof BioModelEditorAnnotationPanel) {
// // we want to navigate to the AnnotationPanel (old way)
// rightBottomTabbedPane.setSelectedComponent(annotationComponent);
} else if (selectedComponent != bottomComponent) /* && rightBottomTabbedPane.getSelectedComponent() != annotationComponent */
{
rightBottomTabbedPane.setSelectedComponent(bottomComponent);
}
}
use of cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.
the class DatabaseWindowPanel method currentDocumentInfo.
/**
* Comment
*/
private void currentDocumentInfo() {
VCDocumentInfo selectedDocInfo = null;
switch(getJTabbedPane1().getSelectedIndex()) {
case 0:
{
// VCDocumentType.BIOMODEL_DOC
selectedDocInfo = (BioModelInfo) getBioModelDbTreePanel1().getSelectedVersionInfo();
break;
}
case 1:
{
// VCDocumentType.MATHMODEL_DOC
selectedDocInfo = (MathModelInfo) getMathModelDbTreePanel1().getSelectedVersionInfo();
break;
}
case 2:
{
// VCDocumentType.GEOMETRY_DOC
selectedDocInfo = (GeometryInfo) getGeometryTreePanel1().getSelectedVersionInfo();
break;
}
}
setSelectedDocumentInfo(selectedDocInfo);
}
use of cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.
the class VCDocumentDbTreeModel method initOwners.
protected static synchronized TreeMap<String, BioModelNode> initOwners(VCDocumentInfo[] vcDocumentInfos, User loginUser, VCDocumentDbTreeModel subTreeParent, Method subTreeMethod) {
//
// get list of users (owners)
//
Vector<User> userList = new Vector<User>();
userList.addElement(loginUser);
for (int i = 0; i < vcDocumentInfos.length; i++) {
VCDocumentInfo vcDocumentInfo = vcDocumentInfos[i];
if (!userList.contains(vcDocumentInfo.getVersion().getOwner())) {
userList.addElement(vcDocumentInfo.getVersion().getOwner());
}
}
//
// for each user
//
TreeMap<String, BioModelNode> treeMap = new TreeMap<String, BioModelNode>(new Comparator<String>() {
public int compare(String o1, String o2) {
return o1.compareToIgnoreCase(o2);
}
});
for (int ownerIndex = 0; ownerIndex < userList.size(); ownerIndex++) {
User owner = (User) userList.elementAt(ownerIndex);
BioModelNode ownerNode = null;
try {
if (vcDocumentInfos instanceof BioModelInfo[]) {
ownerNode = (BioModelNode) subTreeMethod.invoke(subTreeParent, new Object[] { owner, (BioModelInfo[]) vcDocumentInfos });
} else if (vcDocumentInfos instanceof MathModelInfo[]) {
ownerNode = (BioModelNode) subTreeMethod.invoke(subTreeParent, new Object[] { owner, (MathModelInfo[]) vcDocumentInfos });
} else if (vcDocumentInfos instanceof GeometryInfo[]) {
ownerNode = (BioModelNode) subTreeMethod.invoke(subTreeParent, new Object[] { owner, (GeometryInfo[]) vcDocumentInfos });
} else {
throw new Exception("Unimplemented VCDocumentInfo type=" + vcDocumentInfos.getClass().getName());
}
} catch (Exception e) {
e.printStackTrace();
ownerNode = new BioModelNode("Error" + e.getMessage());
}
if (owner.equals(loginUser) || ownerNode.getChildCount() > 0) {
treeMap.put(owner.getName(), ownerNode);
}
}
return treeMap;
}
use of cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.
the class GeometryTreePanel method actionsOnClick.
/**
* Comment
*/
protected void actionsOnClick(MouseEvent mouseEvent) {
if (mouseEvent.isPopupTrigger()) {
if (!getPopupMenuDisabled()) {
TreePath treePath = ((JTree) mouseEvent.getSource()).getPathForLocation(mouseEvent.getX(), mouseEvent.getY());
((JTree) mouseEvent.getSource()).setSelectionPath(treePath);
if (getSelectedVersionInfo() instanceof GeometryInfo) {
Version version = getSelectedVersionInfo().getVersion();
boolean isOwner = version.getOwner().compareEqual(getDocumentManager().getUser());
getJMenuItemPermission().setEnabled(isOwner);
getJMenuItemDelete().setEnabled(isOwner);
getJMenuItemGeomRefs().setEnabled(isOwner);
getGeometryPopupMenu().show(getJTree1(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
} else if (treePath != null) {
BioModelNode bioModelNode = (BioModelNode) treePath.getLastPathComponent();
Object object = bioModelNode.getUserObject();
if (object instanceof User) {
User selectedUser = (User) object;
boolean isOwner = selectedUser.compareEqual(getDocumentManager().getUser());
if (isOwner) {
JPopupMenu jPopupMenu = new JPopupMenu();
jPopupMenu.add(getJMenuItemCreateNewGeometry());
jPopupMenu.show(getJTree1(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
}
}
}
}
} else {
ifNeedsDoubleClickEvent(mouseEvent, GeometryInfo.class);
}
}
use of cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.
the class GeometryTreePanel method treeSelection.
/**
* Comment
*/
protected void treeSelection() {
TreePath treePath = getJTree1().getSelectionPath();
if (treePath == null) {
setSelectedVersionInfo(null);
return;
}
BioModelNode bioModelNode = (BioModelNode) treePath.getLastPathComponent();
Object object = bioModelNode.getUserObject();
try {
BeanUtils.setCursorThroughout(this, java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
if (object instanceof VersionInfo) {
setSelectedVersionInfo((VersionInfo) object);
} else if (object instanceof VCDocumentInfoNode && bioModelNode.getChildCount() > 0 && ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject() instanceof GeometryInfo) {
GeometryInfo geometryInfo = (GeometryInfo) ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject();
setSelectedVersionInfo(geometryInfo);
} else {
setSelectedVersionInfo(null);
}
} catch (Exception exc) {
handleException(exc);
} finally {
BeanUtils.setCursorThroughout(this, java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
}
}
Aggregations