Search in sources :

Example 6 with XmlTreeDiff

use of cbit.xml.merge.XmlTreeDiff in project vcell by virtualcell.

the class DatabaseWindowManager method compareWithOther.

// Processes the model comparison,
private void compareWithOther(final VCDocumentInfo docInfo1, final VCDocumentInfo docInfo2) {
    final MDIManager mdiManager = new ClientMDIManager(getRequestManager());
    mdiManager.blockWindow(getManagerID());
    String taskName = "Comparing " + docInfo1.getVersion().getName() + " with " + docInfo2.getVersion().getName();
    AsynchClientTask task1 = new AsynchClientTask(taskName, AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            XmlTreeDiff xmlTreeDiff = getRequestManager().compareWithOther(docInfo1, docInfo2);
            hashTable.put("xmlTreeDiff", xmlTreeDiff);
        }
    };
    AsynchClientTask task2 = new AsynchClientTask(taskName, AsynchClientTask.TASKTYPE_SWING_BLOCKING, false, false) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            try {
                if (hashTable.get(ClientTaskDispatcher.TASK_ABORTED_BY_ERROR) == null) {
                    XmlTreeDiff xmlTreeDiff = (XmlTreeDiff) hashTable.get("xmlTreeDiff");
                    String baselineDesc = docInfo1.getVersion().getName() + ", " + docInfo1.getVersion().getDate();
                    String modifiedDesc = docInfo2.getVersion().getName() + ", " + docInfo2.getVersion().getDate();
                    getRequestManager().showComparisonResults(DatabaseWindowManager.this, xmlTreeDiff, baselineDesc, modifiedDesc);
                }
            } finally {
                mdiManager.unBlockWindow(getManagerID());
            }
        }
    };
    ClientTaskDispatcher.dispatch(getComponent(), new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 }, false);
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) XmlTreeDiff(cbit.xml.merge.XmlTreeDiff)

Example 7 with XmlTreeDiff

use of cbit.xml.merge.XmlTreeDiff in project vcell by virtualcell.

the class DocumentWindowManager method compareWithSaved.

// /**
// * Insert the method's description here.
// * Creation date: (6/1/2004 2:50:14 AM)
// */
// public static void close(JInternalFrame[] editorFrames) {
// if (editorFrames != null && editorFrames.length > 0) {
// for (int i = 0; i < editorFrames.length; i++){
// close(editorFrames[i]);
// }
// }
// }
// 
// /**
// * Insert the method's description here.
// * Creation date: (6/1/2004 2:50:14 AM)
// */
// public static void close(JFrame editorFrame) {
// pane.getDesktopManager().closeFrame(editorFrame);
// editorFrame.dispose();
// }
// 
/**
 *Processes the comparison (XML based) of the loaded model with its saved edition.
 * Creation date: (6/1/2004 9:58:46 PM)
 */
public void compareWithSaved() {
    if (getVCDocument().getVersion() == null) {
        // shouldn't happen (menu should not be available), but check anyway...
        PopupGenerator.showErrorDialog(this, "There is no saved version of this document");
        return;
    }
    final MDIManager mdiManager = new ClientMDIManager(getRequestManager());
    mdiManager.blockWindow(getManagerID());
    String taskName = "Comparing with saved";
    AsynchClientTask task1 = new AsynchClientTask(taskName, AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            XmlTreeDiff xmlTreeDiff = getRequestManager().compareWithSaved(getVCDocument());
            hashTable.put("xmlTreeDiff", xmlTreeDiff);
        }
    };
    AsynchClientTask task2 = new AsynchClientTask(taskName, AsynchClientTask.TASKTYPE_SWING_BLOCKING, false, false) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            try {
                if (hashTable.get(ClientTaskDispatcher.TASK_ABORTED_BY_ERROR) == null) {
                    XmlTreeDiff xmlTreeDiff = (XmlTreeDiff) hashTable.get("xmlTreeDiff");
                    String baselineDesc = getVCDocument() + ", " + (getVCDocument().getVersion() == null ? "not saved" : getVCDocument().getVersion().getDate());
                    String modifiedDesc = "Opened document instance";
                    getRequestManager().showComparisonResults(DocumentWindowManager.this, xmlTreeDiff, baselineDesc, modifiedDesc);
                }
            } finally {
                mdiManager.unBlockWindow(getManagerID());
            }
        }
    };
    ClientTaskDispatcher.dispatch(getComponent(), new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 }, false);
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) XmlTreeDiff(cbit.xml.merge.XmlTreeDiff)

Aggregations

XmlTreeDiff (cbit.xml.merge.XmlTreeDiff)7 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)2 NodeInfo (cbit.xml.merge.NodeInfo)2 Hashtable (java.util.Hashtable)2 BioModel (cbit.vcell.biomodel.BioModel)1 ChildWindowManager (cbit.vcell.client.ChildWindowManager)1 ChildWindow (cbit.vcell.client.ChildWindowManager.ChildWindow)1 SimulationContext (cbit.vcell.mapping.SimulationContext)1 MathMappingCallback (cbit.vcell.mapping.SimulationContext.MathMappingCallback)1 MathModel (cbit.vcell.mathmodel.MathModel)1 ExpressionException (cbit.vcell.parser.ExpressionException)1 XmlParseException (cbit.vcell.xml.XmlParseException)1 Xmlproducer (cbit.vcell.xml.Xmlproducer)1 ChangedNodeInfo (cbit.xml.merge.ChangedNodeInfo)1 DiffConfiguration (cbit.xml.merge.XmlTreeDiff.DiffConfiguration)1 TMLPanel (cbit.xml.merge.gui.TMLPanel)1 Dimension (java.awt.Dimension)1 IOException (java.io.IOException)1 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)1 TreePath (javax.swing.tree.TreePath)1