use of org.vcell.util.UtilCancelException in project vcell by virtualcell.
the class MIRIAMAnnotationEditor method showEditFreehandText.
private void showEditFreehandText(DefaultMutableTreeNode node) {
final IdentifiableNode parentIdentifiableNode = (IdentifiableNode) ((BioModelNode) node).getParent();
final Annotation oldAnnotation = (Annotation) ((BioModelNode) node).getUserObject();
try {
String newAnnotation = DialogUtils.showAnnotationDialog(MIRIAMAnnotationEditor.this, oldAnnotation.toString());
if (BeanUtils.triggersPropertyChangeEvent(oldAnnotation, newAnnotation)) {
vcMetaData.setFreeTextAnnotation(parentIdentifiableNode.getIdentifiable(), newAnnotation);
}
} catch (UtilCancelException uce) {
// ignore
} catch (Exception exc) {
exc.printStackTrace();
DialogUtils.showErrorDialog(MIRIAMAnnotationEditor.this, "Error editing Annotation:\n" + exc.getMessage(), exc);
}
}
use of org.vcell.util.UtilCancelException in project vcell by virtualcell.
the class TestingFrameworkPanel method getLoadTestMenu.
private JPopupMenu getLoadTestMenu() {
JPopupMenu mainLoadTestMenu = new JPopupMenu();
if (getTreeSelection() instanceof String && ((String) getTreeSelection()).equals(TestingFrmwkTreeModel.LOAD_TEST_SUBTREE_NAME)) {
JMenuItem refreshThresholdMenuItem = new JMenuItem("Refresh (with load time threshold)...");
refreshThresholdMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
String result = DialogUtils.showInputDialog0(TestingFrameworkPanel.this, "Enter load time threshold (millseconds)", "10000");
slowLoadThreshold = (result == null || result.length() == 0 ? null : new Integer(result));
ActionEvent refresh = new ActionEvent(TestingFrameworkPanel.this, ActionEvent.ACTION_PERFORMED, TestingFrameworkPanel.REFRESH_XML_LOAD_TEST);
TestingFrameworkPanel.this.refireActionPerformed(refresh);
} catch (UtilCancelException uce) {
// ignore
} catch (Exception e2) {
e2.printStackTrace();
DialogUtils.showErrorDialog(TestingFrameworkPanel.this, e2.getMessage(), e2);
}
}
});
mainLoadTestMenu.add(refreshThresholdMenuItem);
JMenuItem loadTestSQLMenuItem = new JMenuItem("Add SQL Condition...");
loadTestSQLMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
String result = DialogUtils.showInputDialog0(TestingFrameworkPanel.this, "Enter SQL Condition", loadTestSQLCondition);
loadTestSQLCondition = (result == null || result.length() == 0 ? null : result);
ActionEvent refresh = new ActionEvent(TestingFrameworkPanel.this, ActionEvent.ACTION_PERFORMED, TestingFrameworkPanel.REFRESH_XML_LOAD_TEST);
TestingFrameworkPanel.this.refireActionPerformed(refresh);
} catch (UtilCancelException uce) {
// ignore
} catch (Exception e2) {
e2.printStackTrace();
DialogUtils.showErrorDialog(TestingFrameworkPanel.this, e2.getMessage(), e2);
}
}
});
mainLoadTestMenu.add(loadTestSQLMenuItem);
JMenuItem runXMLLoadTestAllMenuItem = new JMenuItem("Run XML Load Test for all models...");
runXMLLoadTestAllMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ActionEvent refresh = new ActionEvent(TestingFrameworkPanel.this, ActionEvent.ACTION_PERFORMED, TestingFrameworkPanel.RUN_XML_LOAD_TEST_All);
TestingFrameworkPanel.this.refireActionPerformed(refresh);
}
});
mainLoadTestMenu.add(runXMLLoadTestAllMenuItem);
}
if (getTreeSelection() instanceof LoadTestTreeInfo && ((LoadTestTreeInfo) getTreeSelection()).userid == null) {
JMenuItem deleteLoadTestMenuItem = new JMenuItem("Delete Load Test...");
deleteLoadTestMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ActionEvent refresh = new ActionEvent(TestingFrameworkPanel.this, ActionEvent.ACTION_PERFORMED, TestingFrameworkPanel.DELETE_XML_LOAD_TEST);
TestingFrameworkPanel.this.refireActionPerformed(refresh);
}
});
mainLoadTestMenu.add(deleteLoadTestMenuItem);
}
if (getTreeSelection() instanceof LoadTestTreeInfo && ((LoadTestTreeInfo) getTreeSelection()).userid != null) {
JMenuItem loadModelSelectedMenuItem = new JMenuItem(TestingFrameworkPanel.LOAD_MODEL);
loadModelSelectedMenuItem.setEnabled(getJTree1().getSelectionCount() == 1);
loadModelSelectedMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ActionEvent refresh = new ActionEvent(TestingFrameworkPanel.this, ActionEvent.ACTION_PERFORMED, TestingFrameworkPanel.LOAD_MODEL);
TestingFrameworkPanel.this.refireActionPerformed(refresh);
}
});
mainLoadTestMenu.add(loadModelSelectedMenuItem);
JMenuItem runXMLLoadTestModelsSelectedMenuItem = new JMenuItem("Run XML Load Test for selected models...");
runXMLLoadTestModelsSelectedMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ActionEvent refresh = new ActionEvent(TestingFrameworkPanel.this, ActionEvent.ACTION_PERFORMED, TestingFrameworkPanel.RUN_XML_LOAD_TEST_MODELS);
TestingFrameworkPanel.this.refireActionPerformed(refresh);
}
});
mainLoadTestMenu.add(runXMLLoadTestModelsSelectedMenuItem);
JMenuItem runXMLLoadTestUsersSelectedMenuItem = new JMenuItem("Run XML Load Test for selected Users...");
runXMLLoadTestUsersSelectedMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ActionEvent refresh = new ActionEvent(TestingFrameworkPanel.this, ActionEvent.ACTION_PERFORMED, TestingFrameworkPanel.RUN_XML_LOAD_TEST_USERS);
TestingFrameworkPanel.this.refireActionPerformed(refresh);
}
});
mainLoadTestMenu.add(runXMLLoadTestUsersSelectedMenuItem);
}
return mainLoadTestMenu;
}
use of org.vcell.util.UtilCancelException in project vcell by virtualcell.
the class GeometrySubVolumePanel method geometrySubVolumePanel_Initialize.
/**
* Comment
*/
private void geometrySubVolumePanel_Initialize() {
getScrollPaneTable().setDefaultRenderer(SubVolume.class, new GeometrySubVolumeTableCellRenderer());
getScrollPaneTable().setDefaultEditor(SubVolume.class, new DefaultCellEditor(new JTextField()) {
private int lastRow = -1;
private int lastCol = -1;
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
lastRow = row;
lastCol = column;
delegate.setValue(((SubVolume) value).getName());
return editorComponent;
}
public final boolean stopCellEditing() {
//
try {
String name = (String) delegate.getCellEditorValue();
while (true) {
if (name.equals(TokenMangler.fixTokenStrict(name))) {
break;
}
name = DialogUtils.showInputDialog0(getComponent(), "Subdomain name " + name + " has illegal characters." + "\nProvide new value.", name);
}
// VALIDATE_OK, delegate gets New Good value
delegate.setValue(name);
} catch (UtilCancelException e) {
// delegate gets Last Good value
delegate.setValue(((SubVolume) getScrollPaneTable().getValueAt(lastRow, lastCol)).getName());
} catch (Throwable e) {
// Delegate keeps UNVALIDATED value
}
return super.stopCellEditing();
}
});
getScrollPaneTable().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
refreshButtons();
}
use of org.vcell.util.UtilCancelException in project vcell by virtualcell.
the class ROIMultiPaintManager method duplicateROIDataAsk.
private void duplicateROIDataAsk() {
String extraInfo = null;
while (true) {
try {
String zCountS = DialogUtils.showInputDialog0(overlayEditorPanelJAI, "Convert 2D to 3D. Enter desired Z count:" + (extraInfo == null ? "" : "\n" + extraInfo), "1");
int zCount = Integer.parseInt(zCountS);
if (zCount == 1) {
throw UtilCancelException.CANCEL_GENERIC;
}
duplicateROIData(zCount);
break;
} catch (UtilCancelException uce) {
throw UserCancelException.CANCEL_GENERIC;
} catch (Exception e) {
extraInfo = "Error: Z count must be >= 1:\n'" + e.getMessage() + "'";
}
}
}
use of org.vcell.util.UtilCancelException in project vcell by virtualcell.
the class ROIMultiPaintManager method padCropDataset.
private void padCropDataset() {
int xm = 0;
int ym = 0;
int zm = 0;
int xp = 0;
int yp = 0;
int zp = 0;
String result = null;
do {
try {
result = DialogUtils.showInputDialog0(overlayEditorPanelJAI, "Enter the number of pixels to add or crop (negative number) at each border: (xlow,ylow,zlow,xhigh,yhigh,zhigh)", xm + "," + ym + "," + zm + "," + xp + "," + yp + "," + zp);
if (result != null) {
final String SEP = ",";
result = result.trim();
StringTokenizer st = new StringTokenizer(result, SEP);
xm = Integer.parseInt(st.nextToken());
ym = Integer.parseInt(st.nextToken());
zm = Integer.parseInt(st.nextToken());
xp = Integer.parseInt(st.nextToken());
yp = Integer.parseInt(st.nextToken());
zp = Integer.parseInt(st.nextToken());
if (st.hasMoreElements() || result.endsWith(SEP)) {
throw new Exception("Some input was not parsed, check input.");
}
break;
}
} catch (UtilCancelException e) {
throw UserCancelException.CANCEL_GENERIC;
} catch (Exception e) {
DialogUtils.showErrorDialog(overlayEditorPanelJAI, "Error parsing '" + result + "' Resetting to valid values. Enter 6 comma separated integers.");
}
} while (true);
final CoordinateIndex low = new CoordinateIndex(xm, ym, zm);
final CoordinateIndex high = new CoordinateIndex(xp, yp, zp);
final AsynchClientTask padTask = new AsynchClientTask("Changeing borders...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
resizeImpl(ResizeInfo.createPadCropResizeInfo(getImageDataSetChannel().getISize(), low, high), getClientTaskStatusSupport());
}
};
final AsynchClientTask updatePanelTask = getUpdateDisplayAfterCropTask();
ClientTaskDispatcher.dispatch(overlayEditorPanelJAI, new Hashtable<String, Object>(), new AsynchClientTask[] { padTask, updatePanelTask }, false, false, null, true);
}
Aggregations