use of cbit.vcell.client.desktop.biomodel.BioModelEditor in project vcell by virtualcell.
the class NetworkConstraintsPanel method activateConsole.
public void activateConsole() {
boolean found = false;
Container parent = getParent();
while (parent != null) {
parent = parent.getParent();
if (parent instanceof BioModelEditor) {
found = true;
break;
}
}
if (found) {
System.out.println("Parent Found");
BioModelEditor e = (BioModelEditor) parent;
// e.getRightBottomTabbedPane().setSelectedComponent(e.getSimulationConsolePanel());
Component[] cList = e.getRightBottomTabbedPane().getComponents();
for (Component c : cList) {
if (c instanceof SimulationConsolePanel) {
e.getRightBottomTabbedPane().setSelectedComponent(c);
break;
}
}
}
}
use of cbit.vcell.client.desktop.biomodel.BioModelEditor in project vcell by virtualcell.
the class DatabaseWindowPanel method dbTreePanelActionPerformed.
private void dbTreePanelActionPerformed(java.awt.event.ActionEvent e) {
String actionCommand = e.getActionCommand();
if (actionCommand.equals("Open") || actionCommand.equals(DatabaseWindowManager.BM_MM_GM_DOUBLE_CLICK_ACTION)) {
// check to see if open in new or this window
BioModelEditor bioModelEditor = null;
Container c = this;
while (c != null) {
if (c instanceof BioModelEditor) {
bioModelEditor = (BioModelEditor) c;
break;
}
c = c.getParent();
}
if (bioModelEditor != null && getSelectedDocumentInfo() instanceof BioModelInfo) {
if (bioModelEditor.getBioModelWindowManager().hasBlankDocument()) {
getDatabaseWindowManager().openSelected(bioModelEditor.getBioModelWindowManager(), false);
} else {
getDatabaseWindowManager().openSelected(bioModelEditor.getBioModelWindowManager(), true);
}
} else {
getDatabaseWindowManager().openSelected();
}
} else if (actionCommand.equals("Delete")) {
getDatabaseWindowManager().deleteSelected();
} else if (actionCommand.equals("Permission")) {
getDatabaseWindowManager().accessPermissions();
} else if (actionCommand.equals("Export")) {
getDatabaseWindowManager().exportDocument();
} else if (actionCommand.equals("Latest Edition")) {
getDatabaseWindowManager().compareLatestEdition();
} else if (actionCommand.equals("Previous Edition")) {
getDatabaseWindowManager().comparePreviousEdition();
} else if (actionCommand.equals("Another Edition...")) {
getDatabaseWindowManager().compareAnotherEdition();
} else if (actionCommand.equals("Another Model...")) {
getDatabaseWindowManager().compareAnotherModel();
} else if (actionCommand.equals("Models Using Geometry")) {
getDatabaseWindowManager().findModelsUsingSelectedGeometry();
} else if (actionCommand.equals("Archive")) {
getDatabaseWindowManager().archive();
} else if (actionCommand.equals("Publish")) {
getDatabaseWindowManager().publish();
} else if (actionCommand.equals(NEW_GEOMETRY)) {
getDatabaseWindowManager().createNewGeometry();
}
}
use of cbit.vcell.client.desktop.biomodel.BioModelEditor in project vcell by virtualcell.
the class ReactionCartoonTool method detailsDeleteSpecies.
private static DeleteSpeciesInfo detailsDeleteSpecies(Component requester, SpeciesContext[] speciesContextArr, ReactionStep[] toBeDeletedReactStepArr, ReactionCartoon rxCartoon) throws Exception, UserCancelException {
if (speciesContextArr == null || speciesContextArr.length == 0) {
return null;
}
// Warn user that there may be some BioModel components that reference speciesContext to be removed
// Get ReactionParticipant list
Collection<Shape> rxPartColl = rxCartoon.getShapes();
HashMap<SpeciesContext, HashSet<ReactionParticipant>> rxPartHashMap = new HashMap<SpeciesContext, HashSet<ReactionParticipant>>();
for (Shape objShape : rxPartColl) {
if (objShape instanceof ReactionParticipantShape) {
ReactionParticipant objReactionParticipant = ((ReactionParticipantShape) objShape).getReactionParticipant();
if (Arrays.asList(speciesContextArr).contains(objReactionParticipant.getSpeciesContext())) {
if (!rxPartHashMap.containsKey(objReactionParticipant.getSpeciesContext())) {
rxPartHashMap.put(objReactionParticipant.getSpeciesContext(), new HashSet<ReactionParticipant>());
}
if (!rxPartHashMap.get(objReactionParticipant.getSpeciesContext()).contains(objReactionParticipant)) {
rxPartHashMap.get(objReactionParticipant.getSpeciesContext()).add(objReactionParticipant);
}
}
}
}
int reactionParticipantCount = 0;
for (HashSet<ReactionParticipant> objReactPart : rxPartHashMap.values()) {
reactionParticipantCount += objReactPart.size();
}
// find bioModel and get SymbolTable references to SpeciesContext
BioModelEditor bioModelEditor = (BioModelEditor) BeanUtils.findTypeParentOfComponent(requester, BioModelEditor.class);
if (bioModelEditor == null) {
throw new Exception("Error deleting Speciescontext, Can't find BiomodelEditor");
}
BioModel bioModel = bioModelEditor.getBioModelWindowManager().getVCDocument();
HashMap<SpeciesContext, HashSet<SymbolTableEntry>> referencingSymbolsHashMap = new HashMap<SpeciesContext, HashSet<SymbolTableEntry>>();
for (int i = 0; i < speciesContextArr.length; i++) {
List<SymbolTableEntry> referencingSymbolsList = bioModel.findReferences(speciesContextArr[i]);
if (referencingSymbolsList != null && referencingSymbolsList.size() > 0) {
if (!referencingSymbolsHashMap.containsKey(speciesContextArr[i])) {
referencingSymbolsHashMap.put(speciesContextArr[i], new HashSet<SymbolTableEntry>());
}
referencingSymbolsHashMap.get(speciesContextArr[i]).addAll(referencingSymbolsList);
}
}
int referencingSymbolsCount = 0;
for (HashSet<SymbolTableEntry> objSimTableEntry : referencingSymbolsHashMap.values()) {
referencingSymbolsCount += objSimTableEntry.size();
}
// Warn user about delete
HashMap<SpeciesContext, Boolean> bUnresolvableHashMap = new HashMap<SpeciesContext, Boolean>();
for (int i = 0; i < speciesContextArr.length; i++) {
bUnresolvableHashMap.put(speciesContextArr[i], Boolean.FALSE);
}
String[][] rowData = null;
if (rxPartHashMap.size() == 0 && referencingSymbolsHashMap.size() == 0) {
rowData = new String[speciesContextArr.length][4];
for (int i = 0; i < speciesContextArr.length; i++) {
rowData[i][0] = speciesContextArr[i].getName();
rowData[i][1] = "";
rowData[i][2] = "";
rowData[i][3] = "";
}
Arrays.sort(rowData, new Comparator<String[]>() {
@Override
public int compare(String[] o1, String[] o2) {
return o1[0].compareToIgnoreCase(o2[0]);
}
});
} else {
// find SpeciesContext that had no reference warnings
Vector<SpeciesContext> speciesContextNoReferences = new Vector<SpeciesContext>();
for (int i = 0; i < speciesContextArr.length; i++) {
if (!rxPartHashMap.containsKey(speciesContextArr[i]) && !referencingSymbolsHashMap.containsKey(speciesContextArr[i])) {
speciesContextNoReferences.add(speciesContextArr[i]);
}
}
rowData = new String[reactionParticipantCount + referencingSymbolsCount + speciesContextNoReferences.size()][4];
int count = 0;
for (SpeciesContext objSpeciesContext : speciesContextNoReferences) {
rowData[count][0] = objSpeciesContext.getName();
rowData[count][1] = "";
rowData[count][2] = "";
rowData[count][3] = "";
count++;
}
for (SpeciesContext objSpeciesContext : rxPartHashMap.keySet()) {
Iterator<ReactionParticipant> iterRxPart = rxPartHashMap.get(objSpeciesContext).iterator();
while (iterRxPart.hasNext()) {
rowData[count][0] = objSpeciesContext.getName();
rowData[count][1] = "";
rowData[count][2] = "Reaction Diagram stoichiometry '" + iterRxPart.next().getReactionStep().getName() + "'";
rowData[count][3] = "";
count++;
}
}
for (SpeciesContext objSpeciesContext : referencingSymbolsHashMap.keySet()) {
Iterator<SymbolTableEntry> iterSymbolTableEntry = referencingSymbolsHashMap.get(objSpeciesContext).iterator();
while (iterSymbolTableEntry.hasNext()) {
rowData[count][0] = objSpeciesContext.getName();
rowData[count][1] = "";
SymbolTableEntry objSymbolTableEntry = iterSymbolTableEntry.next();
boolean bKineticsParameter = objSymbolTableEntry instanceof KineticsParameter;
if (bKineticsParameter) {
KineticsParameter kp = (KineticsParameter) objSymbolTableEntry;
boolean isOK = kp.isRegenerated();
for (int i = 0; toBeDeletedReactStepArr != null && i < toBeDeletedReactStepArr.length; i++) {
if (toBeDeletedReactStepArr[i] == kp.getKinetics().getReactionStep()) {
// OK to delete this Speciescontext if were deleting the reaction that contained the reference
isOK = true;
}
}
rowData[count][1] = (isOK ? "" : RXSPECIES_ERROR);
bUnresolvableHashMap.put(objSpeciesContext, bUnresolvableHashMap.get(objSpeciesContext) || !isOK);
}
boolean bReaction = objSymbolTableEntry.getNameScope() instanceof ReactionNameScope;
rowData[count][2] = (bReaction ? "Reaction" : objSymbolTableEntry.getNameScope().getClass().getName()) + "( " + objSymbolTableEntry.getNameScope().getName() + " )";
rowData[count][3] = (bKineticsParameter ? "Parameter" : objSymbolTableEntry.getClass().getName()) + "( " + objSymbolTableEntry.getName() + " )";
count++;
}
}
// for (SymbolTableEntry referencingSTE : referencingSymbols) {
// System.out.println("REFERENCE "+referencingSTE.getClass().getName()+"("+referencingSTE.getName()+") nameScope "+referencingSTE.getNameScope().getClass().getName()+"("+referencingSTE.getNameScope().getName()+")");
// }
Arrays.sort(rowData, new Comparator<String[]>() {
@Override
public int compare(String[] o1, String[] o2) {
return o1[0].compareToIgnoreCase(o2[0]);
}
});
}
if (rowData == null || rowData.length == 0) {
return null;
}
return new DeleteSpeciesInfo(rxPartHashMap, bUnresolvableHashMap, rowData);
}
use of cbit.vcell.client.desktop.biomodel.BioModelEditor in project vcell by virtualcell.
the class NetworkFreePanel method activateConsole.
public void activateConsole() {
boolean found = false;
Container parent = getParent();
while (parent != null) {
parent = parent.getParent();
if (parent instanceof BioModelEditor) {
found = true;
break;
}
}
if (found) {
System.out.println("Parent Found");
BioModelEditor e = (BioModelEditor) parent;
// e.getRightBottomTabbedPane().setSelectedComponent(e.getSimulationConsolePanel());
Component[] cList = e.getRightBottomTabbedPane().getComponents();
for (Component c : cList) {
if (c instanceof SimulationConsolePanel) {
e.getRightBottomTabbedPane().setSelectedComponent(c);
break;
}
}
}
}
use of cbit.vcell.client.desktop.biomodel.BioModelEditor in project vcell by virtualcell.
the class SimulationListPanel method activateConsole.
public void activateConsole() {
boolean found = false;
Container parent = getParent();
while (parent != null) {
parent = parent.getParent();
if (parent instanceof BioModelEditor) {
found = true;
break;
}
}
if (found) {
System.out.println("Parent Found");
BioModelEditor e = (BioModelEditor) parent;
// e.getRightBottomTabbedPane().setSelectedComponent(e.getSimulationConsolePanel());
Component[] cList = e.getRightBottomTabbedPane().getComponents();
for (Component c : cList) {
if (c instanceof SimulationConsolePanel) {
e.getRightBottomTabbedPane().setSelectedComponent(c);
break;
}
}
}
}
Aggregations