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;
}
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);
}
}
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();
}
}
}
}
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;
}
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);
}
}
Aggregations