use of cbit.xml.merge.gui.TMLPanel in project vcell by virtualcell.
the class ClientRequestManager method showComparisonResults.
public void showComparisonResults(TopLevelWindowManager requester, XmlTreeDiff diffTree, String baselineDesc, String modifiedDesc) {
TMLPanel comparePanel = new TMLPanel();
comparePanel.setXmlTreeDiff(diffTree);
comparePanel.setBaselineVersionDescription(baselineDesc);
comparePanel.setModifiedVersionDescription(modifiedDesc);
JOptionPane comparePane = new JOptionPane(null, JOptionPane.PLAIN_MESSAGE, 0, null, new Object[] { /*"Apply Changes", */
"Close" });
comparePane.setMessage(comparePanel);
JDialog compareDialog = comparePane.createDialog(requester.getComponent(), "Compare Models");
compareDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
compareDialog.setResizable(true);
compareDialog.pack();
compareDialog.setVisible(true);
// ZEnforcer.showModalDialogOnTop(compareDialog,JOptionPane.getFrameForComponent(requester.getComponent()));
if ("Apply Changes".equals(comparePane.getValue())) {
if (!comparePanel.tagsResolved()) {
DialogUtils.showErrorDialog(comparePanel, "Please resolve all tagged elements/attributes before proceeding.");
} else {
BeanUtils.setCursorThroughout((Container) requester.getComponent(), Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
processComparisonResult(comparePanel, requester);
} catch (RuntimeException e) {
throw e;
} finally {
BeanUtils.setCursorThroughout((Container) requester.getComponent(), Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
}
}
use of cbit.xml.merge.gui.TMLPanel 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());
}
}
Aggregations