Search in sources :

Example 71 with WindowAdapter

use of java.awt.event.WindowAdapter in project knime-core by knime.

the class NodeDialog method initDialog.

/*
     * Inits the underlying dialog with title and icon.
     */
private JDialog initDialog(final String title) {
    JFrame dummy = new JFrame();
    if (KNIMEConstants.KNIME16X16 != null) {
        dummy.setIconImage(KNIMEConstants.KNIME16X16.getImage());
    }
    // init underlying dialog
    JDialog dialog = new JDialog(dummy);
    dialog.setTitle(title);
    dialog.setModal(true);
    // dialog.setResizable(false);
    dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    dialog.addWindowListener(new WindowAdapter() {

        /**
         * Invoked when the window close icon X is pressed.
         */
        @Override
        public void windowClosed(final WindowEvent e) {
            onClose(e);
        }

        /**
         * Invoked when the window is opened.
         */
        @Override
        public void windowOpened(final WindowEvent we) {
            onOpen(we);
        }
    });
    return dialog;
}
Also used : JFrame(javax.swing.JFrame) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) JDialog(javax.swing.JDialog)

Example 72 with WindowAdapter

use of java.awt.event.WindowAdapter in project vcell by virtualcell.

the class ExpressionCanvas method main.

/**
 * main entrypoint - starts the part when it is run as an application
 * @param args java.lang.String[]
 */
public static void main(String[] args) {
    try {
        JFrame frame = new JFrame();
        ExpressionCanvas aExpressionCanvas;
        aExpressionCanvas = new ExpressionCanvas();
        frame.setContentPane(aExpressionCanvas);
        frame.setSize(aExpressionCanvas.getSize());
        frame.addWindowListener(new WindowAdapter() {

            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
        frame.setVisible(true);
        Insets insets = frame.getInsets();
        frame.setSize(frame.getWidth() + insets.left + insets.right, frame.getHeight() + insets.top + insets.bottom);
        frame.setVisible(true);
    } catch (Throwable exception) {
        System.err.println("Exception occurred in main() of javax.swing.JPanel");
        exception.printStackTrace(System.out);
    }
}
Also used : Insets(java.awt.Insets) JFrame(javax.swing.JFrame) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter)

Example 73 with WindowAdapter

use of java.awt.event.WindowAdapter in project vcell by virtualcell.

the class WorkflowObjectsPanel method displayData.

private void displayData(TaskContext taskContext, WorkflowObject workflowObject) {
    if (workflowObject instanceof DataInput || workflowObject instanceof DataOutput) {
        String title = parametersFunctionsTableModel.getName(workflowObject);
        WindowListener listener = new WindowAdapter() {
        };
        Object data = null;
        if (workflowObject instanceof WorkflowDataSource) {
            WorkflowDataSource dataHolder = (WorkflowDataSource) workflowObject;
            data = taskContext.getRepository().getData(dataHolder);
        } else if (workflowObject instanceof DataInput) {
            DataInput dataInput = (DataInput) workflowObject;
            data = taskContext.getData(dataInput);
        }
        if (data instanceof RowColumnResultSet) {
            RowColumnResultSet rc = (RowColumnResultSet) data;
            try {
                new DisplayPlotOp().displayPlot(rc, title, listener);
            } catch (ExpressionException e) {
                e.printStackTrace();
            }
        } else if (data instanceof ROI) {
            ROI roi = (ROI) data;
            Image image = roi.getRoiImages()[0];
            new DisplayImageOp().displayImage(image, title, listener);
        } else if (data instanceof ProfileData[]) {
            ProfileData[] profileData = (ProfileData[]) data;
            new DisplayProfileLikelihoodPlotsOp().displayProfileLikelihoodPlots(profileData, title, listener);
        } else if (data instanceof Image) {
            Image image = (Image) data;
            new DisplayImageOp().displayImage(image, title, listener);
        } else if (data instanceof ImageTimeSeries) {
            ImageTimeSeries imageTimeSeries = (ImageTimeSeries) data;
            try {
                DisplayTimeSeries.displayImageTimeSeries(imageTimeSeries, title, listener);
            } catch (ImageException | IOException e) {
                e.printStackTrace();
            }
        }
    }
}
Also used : DataOutput(org.vcell.workflow.DataOutput) DisplayProfileLikelihoodPlotsOp(org.vcell.vmicro.op.display.DisplayProfileLikelihoodPlotsOp) WindowListener(java.awt.event.WindowListener) ImageException(cbit.image.ImageException) WindowAdapter(java.awt.event.WindowAdapter) ProfileData(org.vcell.optimization.ProfileData) IOException(java.io.IOException) Image(cbit.vcell.VirtualMicroscopy.Image) ROI(cbit.vcell.VirtualMicroscopy.ROI) WorkflowDataSource(org.vcell.workflow.WorkflowDataSource) ExpressionException(cbit.vcell.parser.ExpressionException) DataInput(org.vcell.workflow.DataInput) DisplayPlotOp(org.vcell.vmicro.op.display.DisplayPlotOp) DisplayImageOp(org.vcell.vmicro.op.display.DisplayImageOp) WorkflowObject(org.vcell.workflow.WorkflowObject) RowColumnResultSet(cbit.vcell.math.RowColumnResultSet) ImageTimeSeries(org.vcell.vmicro.workflow.data.ImageTimeSeries)

Example 74 with WindowAdapter

use of java.awt.event.WindowAdapter in project vcell by virtualcell.

the class WorkflowObjectsPanel method hasDisplayData.

private boolean hasDisplayData(TaskContext taskContext, WorkflowObject workflowObject) {
    if (workflowObject instanceof DataInput || workflowObject instanceof DataOutput) {
        String title = parametersFunctionsTableModel.getName(workflowObject);
        WindowListener listener = new WindowAdapter() {
        };
        Object data = null;
        if (workflowObject instanceof WorkflowDataSource) {
            WorkflowDataSource dataHolder = (WorkflowDataSource) workflowObject;
            data = taskContext.getRepository().getData(dataHolder);
        } else if (workflowObject instanceof DataInput) {
            DataInput dataInput = (DataInput) workflowObject;
            data = taskContext.getData(dataInput);
        }
        if (data instanceof RowColumnResultSet || data instanceof ROI || data instanceof ProfileData[] || data instanceof Image || data instanceof ImageTimeSeries) {
            return true;
        }
    }
    return false;
}
Also used : DataOutput(org.vcell.workflow.DataOutput) WindowListener(java.awt.event.WindowListener) WindowAdapter(java.awt.event.WindowAdapter) ProfileData(org.vcell.optimization.ProfileData) Image(cbit.vcell.VirtualMicroscopy.Image) ROI(cbit.vcell.VirtualMicroscopy.ROI) WorkflowDataSource(org.vcell.workflow.WorkflowDataSource) DataInput(org.vcell.workflow.DataInput) WorkflowObject(org.vcell.workflow.WorkflowObject) RowColumnResultSet(cbit.vcell.math.RowColumnResultSet) ImageTimeSeries(org.vcell.vmicro.workflow.data.ImageTimeSeries)

Example 75 with WindowAdapter

use of java.awt.event.WindowAdapter in project vcell by virtualcell.

the class VCSchedulerPanel method main.

public static void main(String[] args) {
    try {
        if (args.length != 3) {
            System.out.println("usage: VCellApiClient host userid password");
            System.exit(1);
        }
        String host = args[0];
        int port = 8080;
        String username = args[1];
        String password = args[2];
        JFrame jframe = new JFrame();
        VCSchedulerPanel panel = new VCSchedulerPanel();
        panel.setUsername(username);
        panel.setPassword(password);
        boolean bIgnoreCertProblems = true;
        boolean bIgnoreHostMismatch = true;
        panel.vcellApiClient = new VCellApiClient(host, port, bIgnoreCertProblems, bIgnoreHostMismatch);
        jframe.getContentPane().add(panel);
        jframe.setSize(800, 500);
        jframe.addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(WindowEvent e) {
                super.windowClosing(e);
                System.exit(0);
            }
        });
        jframe.setVisible(true);
    // test /biomodel[? query string]
    // boolean bFirstSimulationToStartStop = true;
    // if (biomodelReps.length>0){
    // // test /biomodel/[bmkey]
    // System.out.println(" ... re-fetching first biomodel owned by me ...");
    // BioModelsQuerySpec bioModelsQuerySpec = new BioModelsQuerySpec();
    // bioModelsQuerySpec.owner = username;
    // BiomodelRepresentation firstBiomodelRep = vcellApiClient.getBioModels(bioModelsQuerySpec)[0];
    // System.out.println("biomodel : "+firstBiomodelRep.getBmKey()+" : "+firstBiomodelRep.getName());
    // for (ApplicationRepresentation appRep : firstBiomodelRep.getApplications()){
    // System.out.println("   appRep : "+appRep.getName());
    // }
    // for (SimulationRepresentation simRep : firstBiomodelRep.getSimulations()){
    // System.out.println("   simRep (returned with BioModelRep) : "+simRep.getKey()+" : "+simRep.getName());
    // 
    // // test /biomodel/[bmkey]/simulation/simkey
    // SimulationRepresentation simulation = vcellApiClient.getSimulation(firstBiomodelRep.getBmKey(), simRep.getKey());
    // System.out.println("   simRep (retrieved separately) : "+simulation.getKey()+" : "+simulation.getName());
    // 
    // if (bFirstSimulationToStartStop){
    // bFirstSimulationToStartStop = false;
    // // test /biomodel/[bmkey]/simulation/[simkey]/startSimulation
    // SimTasksQuerySpec simTasksQuerySpec = new SimTasksQuerySpec();
    // simTasksQuerySpec.simId = simRep.getKey();
    // SimulationTaskRepresentation[] beforeStartSimTasks = vcellApiClient.getSimTasks(simTasksQuerySpec);
    // System.out.println("SENDING START SIMULATION");
    // SimulationTaskRepresentation[] justAfterStartSimTasks = vcellApiClient.startSimulation(firstBiomodelRep.getBmKey(), simRep.getKey());
    // System.out.println("SENT START SIMULATION");
    // 
    // System.out.println("WAITING 5 seconds");
    // try {
    // Thread.sleep(5000);
    // }catch (Exception e){}
    // SimulationTaskRepresentation[] longAfterStartSimTasks = vcellApiClient.getSimTasks(simTasksQuerySpec);
    // 
    // 
    // System.out.println("SENDING STOP SIMULATION");
    // SimulationTaskRepresentation[] justAfterStopSimTasks = vcellApiClient.stopSimulation(firstBiomodelRep.getBmKey(), simRep.getKey());
    // System.out.println("SENT STOP SIMULATION");
    // 
    // System.out.println("WAITING 5 seconds");
    // try {
    // Thread.sleep(5000);
    // }catch (Exception e){}
    // SimulationTaskRepresentation[] longAfterStopSimTasks = vcellApiClient.getSimTasks(simTasksQuerySpec);
    // 
    // System.out.println("\n\nsimulation status:");
    // for (SimulationTaskRepresentation simTaskRep : beforeStartSimTasks){
    // System.out.println("    BEFORE START Job = "+simTaskRep.getJobIndex()+", Task = "+simTaskRep.getTaskId()+", Status = "+simTaskRep.getStatus());
    // }
    // for (SimulationTaskRepresentation simTaskRep : justAfterStartSimTasks){
    // System.out.println("    JUST AFTER START Job = "+simTaskRep.getJobIndex()+", Task = "+simTaskRep.getTaskId()+", Status = "+simTaskRep.getStatus());
    // }
    // for (SimulationTaskRepresentation simTaskRep : longAfterStartSimTasks){
    // System.out.println("    LONG AFTER START Job = "+simTaskRep.getJobIndex()+", Task = "+simTaskRep.getTaskId()+", Status = "+simTaskRep.getStatus());
    // }
    // for (SimulationTaskRepresentation simTaskRep : justAfterStopSimTasks){
    // System.out.println("    JUST AFTER STOP Job = "+simTaskRep.getJobIndex()+", Task = "+simTaskRep.getTaskId()+", Status = "+simTaskRep.getStatus());
    // }
    // for (SimulationTaskRepresentation simTaskRep : longAfterStopSimTasks){
    // System.out.println("    LONG AFTER STOP Job = "+simTaskRep.getJobIndex()+", Task = "+simTaskRep.getTaskId()+", Status = "+simTaskRep.getStatus());
    // }
    // System.out.println("\n\n");
    // }
    // System.out.println("\n");
    // }
    // }
    // 
    // // test /simtask
    // SimulationTaskRepresentation[] simTaskReps = vcellApiClient.getSimTasks(new SimTasksQuerySpec());
    // for (SimulationTaskRepresentation simTaskRep : simTaskReps){
    // System.out.println("simTask : "+simTaskRep.getSimKey()+" : "+simTaskRep.getSimName());
    // }
    } catch (Throwable e) {
        e.printStackTrace(System.out);
    }
}
Also used : JFrame(javax.swing.JFrame) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) VCellApiClient(org.vcell.api.client.VCellApiClient)

Aggregations

WindowAdapter (java.awt.event.WindowAdapter)143 WindowEvent (java.awt.event.WindowEvent)140 JPanel (javax.swing.JPanel)40 JButton (javax.swing.JButton)36 JFrame (javax.swing.JFrame)34 BorderLayout (java.awt.BorderLayout)32 Dimension (java.awt.Dimension)30 JLabel (javax.swing.JLabel)26 JScrollPane (javax.swing.JScrollPane)25 ActionEvent (java.awt.event.ActionEvent)22 ActionListener (java.awt.event.ActionListener)20 FlowLayout (java.awt.FlowLayout)18 GridBagConstraints (java.awt.GridBagConstraints)18 GridBagLayout (java.awt.GridBagLayout)18 Insets (java.awt.Insets)14 Frame (java.awt.Frame)13 Container (java.awt.Container)12 JTextArea (javax.swing.JTextArea)12 JDialog (javax.swing.JDialog)11 IOException (java.io.IOException)9