Search in sources :

Example 1 with ValidateConstraintsPanel

use of org.vcell.model.rbm.gui.ValidateConstraintsPanel in project vcell by virtualcell.

the class ReturnBNGOutput method validateConstraints.

private void validateConstraints(BNGOutputSpec outputSpec) {
    ValidateConstraintsPanel panel = new ValidateConstraintsPanel(owner);
    ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(owner);
    ChildWindow childWindow = childWindowManager.addChildWindow(panel, panel, "Apply the new constraints?");
    // 320, 160 without the warning line
    Dimension dim = new Dimension(376, 163);
    childWindow.pack();
    panel.setChildWindow(childWindow);
    childWindow.setPreferredSize(dim);
    childWindow.showModal();
    if (panel.getButtonPushed() == ValidateConstraintsPanel.ActionButtons.Apply) {
        System.out.println("pressed APPLY from task");
        TaskCallbackMessage tcm = new TaskCallbackMessage(TaskCallbackStatus.TaskEndAdjustSimulationContextFlagsOnly, "");
        owner.setNewCallbackMessage(tcm);
        String string = "Updating the network constraints with the test values.";
        System.out.println(string);
        owner.updateOutputSpecToSimulationContext(outputSpec);
        sc.getNetworkConstraints().updateConstraintsFromTest();
        tcm = new TaskCallbackMessage(TaskCallbackStatus.Notification, string);
        sc.firePropertyChange("appendToConsole", "", tcm);
        return;
    } else {
        System.out.println("pressed CANCEL from task");
        owner.updateOutputSpecToSimulationContext(null);
        TaskCallbackMessage tcm = new TaskCallbackMessage(TaskCallbackStatus.Clean, "");
        sc.appendToConsole(tcm);
        String string = "The Network constraints were not updated with the test values.";
        tcm = new TaskCallbackMessage(TaskCallbackStatus.Notification, string);
        sc.firePropertyChange("appendToConsole", "", tcm);
        // owner.refreshInterface();
        return;
    }
}
Also used : TaskCallbackMessage(cbit.vcell.mapping.TaskCallbackMessage) ChildWindowManager(cbit.vcell.client.ChildWindowManager) Dimension(java.awt.Dimension) ValidateConstraintsPanel(org.vcell.model.rbm.gui.ValidateConstraintsPanel) ChildWindow(cbit.vcell.client.ChildWindowManager.ChildWindow)

Aggregations

ChildWindowManager (cbit.vcell.client.ChildWindowManager)1 ChildWindow (cbit.vcell.client.ChildWindowManager.ChildWindow)1 TaskCallbackMessage (cbit.vcell.mapping.TaskCallbackMessage)1 Dimension (java.awt.Dimension)1 ValidateConstraintsPanel (org.vcell.model.rbm.gui.ValidateConstraintsPanel)1