use of cbit.vcell.client.ChildWindowManager in project vcell by virtualcell.
the class BioModelEditorApplicationsPanel method compareButtonPressed.
private void compareButtonPressed() {
int[] rows = table.getSelectedRows();
if (rows == null || rows.length != 2) {
return;
}
try {
SimulationContext simContext1 = tableModel.getValueAt(rows[0]);
SimulationContext simContext2 = tableModel.getValueAt(rows[1]);
BioModel bioModel = simContext1.getBioModel();
MathMappingCallback callback = new MathMappingCallback() {
@Override
public void setProgressFraction(float fractionDone) {
Thread.dumpStack();
System.out.println("---> stdout mathMapping: progress = " + (fractionDone * 100.0) + "% done");
}
@Override
public void setMessage(String message) {
Thread.dumpStack();
System.out.println("---> stdout mathMapping: message = " + message);
}
@Override
public boolean isInterrupted() {
return false;
}
};
simContext1.refreshMathDescription(callback, NetworkGenerationRequirements.ComputeFullStandardTimeout);
simContext2.refreshMathDescription(callback, NetworkGenerationRequirements.ComputeFullStandardTimeout);
Xmlproducer xmlProducer = new Xmlproducer(false);
String simContext1XML = XmlUtil.xmlToString(xmlProducer.getXML(simContext1, bioModel));
String simContext2XML = XmlUtil.xmlToString(xmlProducer.getXML(simContext2, bioModel));
DiffConfiguration comparisonSetting = DiffConfiguration.COMPARE_DOCS_OTHER;
XmlTreeDiff diffTree = XmlHelper.compareMerge(simContext1XML, simContext2XML, comparisonSetting, true);
String baselineDesc = "application " + simContext1.getName();
String modifiedDesc = "application " + simContext2.getName();
TMLPanel comparePanel = new TMLPanel();
comparePanel.setXmlTreeDiff(diffTree);
comparePanel.setBaselineVersionDescription(baselineDesc);
comparePanel.setModifiedVersionDescription(modifiedDesc);
ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(this);
String title = "comparing application " + simContext1.getName() + " and " + simContext2.getName();
ChildWindow childWindow = childWindowManager.addChildWindow(comparePanel, diffTree, title, true);
childWindow.setSize(new Dimension(600, 600));
childWindow.show();
} catch (XmlParseException e) {
e.printStackTrace();
DialogUtils.showErrorDialog(this, "failed to compare applications: \n\n" + e.getMessage());
}
}
use of cbit.vcell.client.ChildWindowManager in project vcell by virtualcell.
the class DataValueSurfaceViewer method jButtonDSR_ActionPerformed.
/**
* Comment
*/
private void jButtonDSR_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
dsr.setModeInstruction("(CTRL-CLICK on surface to add/remove from selection)");
ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(DataValueSurfaceViewer.this);
ChildWindow childWindow = childWindowManager.getChildWindowFromContentPane(dsr);
if (childWindow == null) {
childWindow = childWindowManager.addChildWindow(dsr, dsr, "Define Region Of Interest");
childWindow.pack();
childWindow.setIsCenteredOnParent();
}
childWindow.show();
}
use of cbit.vcell.client.ChildWindowManager in project vcell by virtualcell.
the class BioModelEditorModelPanel method showDiagramView.
private void showDiagramView() {
if (tabbedPane.getSelectedIndex() == ModelPanelTabID.reaction_diagram.ordinal()) {
if (tabbedPane.getComponentAt(ModelPanelTabID.reaction_diagram.ordinal()) != modelPanelTabs[ModelPanelTabID.reaction_diagram.ordinal()].getComponent()) {
ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(this);
if (childWindowManager != null) {
ChildWindow childWindow = childWindowManager.getChildWindowFromContext(this.reactionCartoonEditorPanel);
if (childWindow != null) {
childWindow.setIsCenteredOnParent();
childWindow.show();
}
}
}
}
}
use of cbit.vcell.client.ChildWindowManager in project vcell by virtualcell.
the class BioModelEditorModelPanel method floatDiagramView.
private void floatDiagramView(boolean bFloating) {
ChildWindowManager childWindowManager = null;
try {
childWindowManager = ChildWindowManager.findChildWindowManager(this);
if (childWindowManager != null) {
lastChildWindowManager = childWindowManager;
}
} catch (Exception e) {
if (childWindowManager == null && lastChildWindowManager != null) {
childWindowManager = lastChildWindowManager;
} else {
throw (e);
}
}
if (bFloating) {
//
// insert dummy panel into tabbed pane, real one is floating now.
//
tabbedPane.setComponentAt(ModelPanelTabID.reaction_diagram.ordinal(), new JPanel());
//
// create new panel to add to client window (and hold the reactionCartoonEditorPanel)
//
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
panel.add(p, BorderLayout.NORTH);
panel.add(reactionCartoonEditorPanel, BorderLayout.CENTER);
ChildWindow childWindow = childWindowManager.addChildWindow(panel, reactionCartoonEditorPanel, "model diagram");
childWindow.setSize(500, 400);
childWindow.setIsCenteredOnParent();
childWindow.addChildWindowListener(new ChildWindowListener() {
public void closing(ChildWindow childWindow) {
reactionCartoonEditorPanel.setFloatingRequested(false);
}
});
childWindow.show();
// diagramViewInternalFrame.setFrameIcon(new ImageIcon(getClass().getResource("/images/step.gif")));
} else {
if (childWindowManager != null) {
ChildWindow childWindow = childWindowManager.getChildWindowFromContext(reactionCartoonEditorPanel);
if (childWindow != null) {
childWindowManager.closeChildWindow(childWindow);
}
}
tabbedPane.setComponentAt(ModelPanelTabID.reaction_diagram.ordinal(), modelPanelTabs[ModelPanelTabID.reaction_diagram.ordinal()].getComponent());
tabbedPane.setSelectedIndex(ModelPanelTabID.reaction_diagram.ordinal());
}
}
use of cbit.vcell.client.ChildWindowManager in project vcell by virtualcell.
the class ApplicationComponents method getDataViewerFrames.
/**
* Insert the method's description here.
* Creation date: (6/3/2004 4:40:40 PM)
*/
public ChildWindow[] getDataViewerFrames(Component component) {
SimulationWindow[] simWindows = (SimulationWindow[]) BeanUtils.getArray(simulationWindowsHash.elements(), SimulationWindow.class);
ArrayList<ChildWindow> childWindows = new ArrayList<ChildWindow>();
ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(component);
for (int i = 0; i < simWindows.length; i++) {
ChildWindow childWindow = childWindowManager.getChildWindowFromContext(simWindows[i]);
if (childWindow != null) {
childWindows.add(childWindow);
}
}
return childWindows.toArray(new ChildWindow[childWindows.size()]);
}
Aggregations