use of javax.swing.JTabbedPane in project vcell by virtualcell.
the class PDEDataViewer method getViewData.
/**
* Return the ViewData property value.
* @return javax.swing.JPanel
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JPanel getViewData() {
if (ivjViewData == null) {
try {
sliceViewPanel = new JPanel(new BorderLayout());
sliceViewPanel.add(getPDEDataContextPanel1(), BorderLayout.CENTER);
sliceViewPanel.add(getJPanelButtonsAndLabels(), BorderLayout.SOUTH);
ivjViewData = new javax.swing.JPanel();
ivjViewData.setName("ViewData");
ivjViewData.setLayout(new java.awt.BorderLayout());
viewDataTabbedPane = new JTabbedPane();
viewDataTabbedPane.addTab(CurrentView.SLICE_VIEW.title, sliceViewPanel);
viewDataTabbedPane.addChangeListener(ivjEventHandler);
ivjViewData.add(viewDataTabbedPane, BorderLayout.CENTER);
ivjViewData.add(getPDEPlotControlPanel1(), BorderLayout.WEST);
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjViewData;
}
use of javax.swing.JTabbedPane in project vcell by virtualcell.
the class ParameterEstimationRunTaskPanel method getSolutionPanel.
/**
* Return the JPanel7 property value.
* @return javax.swing.JPanel
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private JPanel getSolutionPanel() {
if (solutionPanel == null) {
try {
solutionPanel = new javax.swing.JPanel();
solutionPanel.setBorder(new TitledBorder(GuiConstants.TAB_PANEL_BORDER, "Solution", TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION, VCellLookAndFeel.defaultFont.deriveFont(Font.BOLD)));
solutionPanel.setLayout(new java.awt.GridBagLayout());
optimizationSolutionParameterTable = new ScrollTable();
optimizationSolutionParameterTableModel = new OptimizationSolutionParameterTableModel(optimizationSolutionParameterTable);
optimizationSolutionParameterTable.setModel(optimizationSolutionParameterTableModel);
JPanel solutionParametersPanel = new JPanel(new BorderLayout());
solutionParametersPanel.add(optimizationSolutionParameterTable.getEnclosingScrollPane(), BorderLayout.CENTER);
optimizationTaskSummaryTable = new ScrollTable();
// optimizationTaskSummaryTable.setTableHeader(null);
optimizationTaskSummaryTableModel = new OptimizationTaskSummaryTableModel(optimizationTaskSummaryTable);
optimizationTaskSummaryTable.setModel(optimizationTaskSummaryTableModel);
JPanel taskSummaryPanel = new JPanel(new BorderLayout());
taskSummaryPanel.add(optimizationTaskSummaryTable.getEnclosingScrollPane(), BorderLayout.CENTER);
JTabbedPane tabbedPane = new JTabbedPane();
solutionParametersPanel.setBorder(GuiConstants.TAB_PANEL_BORDER);
taskSummaryPanel.setBorder(GuiConstants.TAB_PANEL_BORDER);
tabbedPane.addTab("Parameters", solutionParametersPanel);
tabbedPane.addTab("Task Summary", taskSummaryPanel);
int gridy = 0;
GridBagConstraints gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.gridwidth = 4;
gbc.fill = java.awt.GridBagConstraints.BOTH;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
solutionPanel.add(tabbedPane, gbc);
JPanel panel = new javax.swing.JPanel();
panel.setLayout(new java.awt.FlowLayout());
panel.add(getPlotButton());
panel.add(getSaveSolutionAsNewSimButton());
// panel.add(getEvaluateConfidenceIntervalButton()); //TODO: put it back after implemented the confidence interval evaluations
gridy++;
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.gridwidth = 4;
gbc.fill = java.awt.GridBagConstraints.BOTH;
gbc.weightx = 1.0;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
solutionPanel.add(panel, gbc);
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return solutionPanel;
}
use of javax.swing.JTabbedPane in project vcell by virtualcell.
the class ChomboSolverSpecPanel method getRefinementPanel.
private JPanel getRefinementPanel() {
if (refinementPanel == null) {
membraneRoiPanel = new RefinementRoiPanel(RoiType.Membrane);
volumeRoiPanel = new RefinementRoiPanel(RoiType.Volume);
JTabbedPane tabbedPanel = new JTabbedPane();
tabbedPanel.addTab("Refine Near Membrane", membraneRoiPanel);
tabbedPanel.addTab("Refine Interior Region", volumeRoiPanel);
refinementPanel = new JPanel();
refinementPanel.setLayout(new GridBagLayout());
refinementPanel.setBorder(GuiConstants.TAB_PANEL_BORDER);
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new java.awt.Insets(5, 5, 0, 0);
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.gridwidth = 4;
gbc.fill = GridBagConstraints.BOTH;
refinementPanel.add(tabbedPanel, gbc);
gbc = new GridBagConstraints();
gbc.insets = new java.awt.Insets(0, 5, 0, 0);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridwidth = 4;
refinementPanel.add(getFinestInfoPanel(), gbc);
gbc = new GridBagConstraints();
gbc.insets = new java.awt.Insets(4, 10, 4, 1);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.anchor = GridBagConstraints.EAST;
JLabel lbl = new JLabel("View Level");
lbl.setFont(lbl.getFont().deriveFont(Font.BOLD));
refinementPanel.add(lbl, gbc);
gbc = new GridBagConstraints();
gbc.insets = new java.awt.Insets(4, 1, 4, 1);
gbc.gridx = 1;
gbc.gridy = 2;
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.HORIZONTAL;
refinementPanel.add(viewLevelFinestRadioButton, gbc);
gbc = new GridBagConstraints();
gbc.insets = new java.awt.Insets(4, 1, 4, 1);
gbc.gridx = 2;
gbc.gridy = 2;
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.HORIZONTAL;
refinementPanel.add(viewLevelUserSelectRadioButton, gbc);
gbc = new GridBagConstraints();
gbc.insets = new java.awt.Insets(4, 1, 4, 1);
gbc.gridx = 3;
gbc.gridy = 2;
gbc.anchor = GridBagConstraints.WEST;
refinementPanel.add(viewLevelComboBox, gbc);
}
return refinementPanel;
}
use of javax.swing.JTabbedPane in project vcell by virtualcell.
the class MainView method initializeContentPane.
private void initializeContentPane() {
JPanel contentPane = new JPanel();
BorderLayout borderLayout = new BorderLayout();
contentPane.setLayout(borderLayout);
// Project label initialization
lblProjectDescription = new JLabel(" ", SwingConstants.CENTER);
Font font = lblProjectDescription.getFont();
lblProjectDescription.setFont(new Font(font.getFontName(), Font.BOLD, 14));
// Tabbed pane initialization
Project project = model.getProject();
if (project != null) {
pnlData = new ListPanel<>(project.getData());
pnlGeometry = new ListPanel<>(project.getGeometry());
pnlModels = new ListPanel<>(project.getModels());
pnlResults = new ListPanel<>(project.getResults());
} else {
pnlData = new ListPanel<>(new ArrayList<>());
pnlGeometry = new ListPanel<>(new ArrayList<>());
pnlModels = new ListPanel<>(new ArrayList<>());
pnlResults = new ListPanel<>(new ArrayList<>());
}
tabbedPane = new JTabbedPane();
tabbedPane.addTab("Data", pnlData);
tabbedPane.addTab("Geometry", pnlGeometry);
tabbedPane.addTab("Models", pnlModels);
tabbedPane.addTab("Results", pnlResults);
JPanel leftPanel = new JPanel(new BorderLayout());
leftPanel.add(lblProjectDescription, BorderLayout.PAGE_START);
leftPanel.add(tabbedPane, BorderLayout.CENTER);
leftPanel.setPreferredSize(new Dimension(300, 400));
rightPanel = new JPanel(new BorderLayout());
rightPanel.setPreferredSize(new Dimension(400, 400));
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel);
splitPane.setBackground(Color.WHITE);
splitPane.setBorder(null);
contentPane.add(splitPane, BorderLayout.CENTER);
setContentPane(contentPane);
}
use of javax.swing.JTabbedPane in project vcell by virtualcell.
the class VCellClientTest method main.
/**
* Starts the application.
* @param args an array of command-line arguments
*/
public static void main(java.lang.String[] args) {
class ParseVCellUserEvents implements Runnable {
AWTEvent event;
public ParseVCellUserEvents(AWTEvent event) {
this.event = event;
}
@Override
public void run() {
if (event instanceof MouseEvent) {
MouseEvent mouseEvent = (MouseEvent) event;
Object details = null;
if (mouseEvent.getID() == MouseEvent.MOUSE_RELEASED) {
if (mouseEvent.getComponent() instanceof JTable) {
JTable comp = (JTable) mouseEvent.getComponent();
int[] selRows = comp.getSelectedRows();
if (selRows != null && selRows.length > 0) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < selRows.length; i++) {
for (int j = 0; j < comp.getColumnCount(); j++) {
try {
sb.append((j == 0 ? "" : ",") + comp.getColumnName(j) + "='" + comp.getModel().getValueAt(selRows[i], j) + "'");
} catch (Exception e) {
e.printStackTrace();
}
}
}
details = sb.toString();
}
} else if (mouseEvent.getComponent() instanceof JTree) {
JTree comp = (JTree) mouseEvent.getComponent();
TreePath treePath = comp.getSelectionPath();
if (treePath != null) {
details = treePath.getLastPathComponent();
// BioModel, MathModel, Geometry document tree selections
if (details instanceof BioModelNode) {
// VCellBasicCellRenderer.VCDocumentInfoNode
BioModelNode bioModelNode = (BioModelNode) details;
boolean isVCDocumentInfo = bioModelNode.getUserObject() instanceof VCDocumentInfo;
boolean isBioModelsNetModelInfo = bioModelNode.getUserObject() instanceof BioModelsNetModelInfo;
if (!isVCDocumentInfo && bioModelNode.getChildCount() > 0 && bioModelNode.getUserObject() instanceof VCellBasicCellRenderer.VCDocumentInfoNode) {
TreeNode treeNode = bioModelNode.getFirstChild();
if (treeNode instanceof BioModelNode && ((BioModelNode) treeNode).getUserObject() instanceof VCDocumentInfo) {
details = ((BioModelNode) treeNode).getUserObject();
}
} else if (isBioModelsNetModelInfo) {
details = BioModelsNetModelInfo.class.getSimpleName() + " '" + ((BioModelsNetModelInfo) bioModelNode.getUserObject()).getName() + "'";
}
}
}
} else if (mouseEvent.getComponent() instanceof JTabbedPane) {
JTabbedPane comp = (JTabbedPane) mouseEvent.getComponent();
details = "'" + comp.getTitleAt(comp.getSelectedIndex()) + "'";
} else if (mouseEvent.getComponent() instanceof JMenuItem) {
JMenuItem comp = (JMenuItem) mouseEvent.getComponent();
details = "'" + comp.getText() + "'";
} else if (mouseEvent.getComponent() instanceof AbstractButton) {
AbstractButton comp = (AbstractButton) mouseEvent.getComponent();
Boolean bSelected = (comp instanceof JToggleButton ? ((JToggleButton) comp).isSelected() : null);
details = (bSelected != null ? "(" + (bSelected ? "selected" : "unselected") + ")" : "") + "'" + comp.getText() + "'";
} else if (mouseEvent.getComponent() instanceof JComboBox<?>) {
JComboBox<?> comp = (JComboBox<?>) mouseEvent.getComponent();
details = "'" + comp.getSelectedItem().toString() + "'";
} else if (mouseEvent.getComponent() instanceof JList<?>) {
JList<?> comp = (JList<?>) mouseEvent.getComponent();
details = "'" + comp.getSelectedValue() + "'";
} else {
details = "TBD " + mouseEvent.getComponent();
}
Component parentComponent = mouseEvent.getComponent();
StringBuffer parentInfo = new StringBuffer();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(BeanUtils.vcDateFormat, Locale.US);
do {
String title = "";
if (parentComponent instanceof Dialog) {
title = ((Dialog) parentComponent).getTitle();
} else if (parentComponent instanceof Frame) {
title = ((Frame) parentComponent).getTitle();
}
parentInfo.append(parentComponent.getClass().getTypeName() + "(" + parentComponent.getName() + (title != null && title.length() > 0 ? ",title='" + title + "'" : "") + ")");
if (parentComponent instanceof DocumentWindow && ((DocumentWindow) parentComponent).getTopLevelWindowManager() instanceof DocumentWindowManager) {
VCDocument vcDocument = ((DocumentWindowManager) ((DocumentWindow) parentComponent).getTopLevelWindowManager()).getVCDocument();
if (vcDocument != null) {
String date = (vcDocument.getVersion() != null && vcDocument.getVersion().getDate() != null ? simpleDateFormat.format(vcDocument.getVersion().getDate()) : "nodate");
parentInfo.append("doc=" + vcDocument.getDocumentType() + " '" + vcDocument.getName() + "' " + date);
}
}
parentInfo.append(" -> ");
} while ((parentComponent = parentComponent.getParent()) != null);
// try to add event, if full remove an event from the top
while (!recordedUserEvents.offer(mouseEvent.getClickCount() + " " + (details == null ? "null" : details.toString()) + BeanUtils.PLAINTEXT_EMAIL_NEWLINE + parentInfo.toString())) {
recordedUserEvents.poll();
}
}
}
}
}
;
AWTEventListener awtEventListener = new AWTEventListener() {
@Override
public void eventDispatched(final AWTEvent event) {
if (event instanceof MouseEvent) {
if (((MouseEvent) event).getID() == MouseEvent.MOUSE_RELEASED) {
new Thread(new ParseVCellUserEvents(event)).start();
}
}
}
};
Toolkit.getDefaultToolkit().addAWTEventListener(awtEventListener, AWTEvent.MOUSE_EVENT_MASK);
// check synchronize Proxy prefs, Proxy Properties
Preferences prefs = Preferences.userNodeForPackage(RemoteProxyVCellConnectionFactory.class);
Boolean bHttp = (System.getProperty(NetworkProxyUtils.PROXY_HTTP_HOST) == null && System.getProperty(NetworkProxyUtils.PROXY_SOCKS_HOST) == null ? null : System.getProperty(NetworkProxyUtils.PROXY_HTTP_HOST) != null);
String currentProxyHost = (bHttp == null ? null : (bHttp ? System.getProperty(NetworkProxyUtils.PROXY_HTTP_HOST) : System.getProperty(NetworkProxyUtils.PROXY_SOCKS_HOST)));
String currentProxyPort = (bHttp == null ? null : (bHttp ? System.getProperty(NetworkProxyUtils.PROXY_HTTP_PORT) : System.getProperty(NetworkProxyUtils.PROXY_SOCKS_PORT)));
NetworkProxyUtils.setProxyProperties(false, null, prefs.get(NetworkProxyPreferences.prefProxyType, NetworkProxyPreferences.prefProxyType), currentProxyHost, currentProxyPort, prefs.get(NetworkProxyPreferences.prefProxyType, NetworkProxyPreferences.prefProxyType), prefs.get(NetworkProxyPreferences.prefProxyHost, NetworkProxyPreferences.prefProxyHost), prefs.get(NetworkProxyPreferences.prefProxyPort, NetworkProxyPreferences.prefProxyPort));
final boolean IS_DEBUG = ManagementFactory.getRuntimeMXBean().getInputArguments().toString().indexOf("-agentlib:jdwp") > 0;
if (!IS_DEBUG) {
String siteName = VCellSoftwareVersion.fromSystemProperty().getSite().name().toLowerCase();
ConsoleCapture.getInstance().captureStandardOutAndError(new File(ResourceUtil.getLogDir(), "vcellrun_" + siteName + ".log"));
}
Logging.init();
ErrorUtils.setDebug(IS_DEBUG);
if (args != null && args.length >= 1 && args[0].equals("-console")) {
// remove install4j parameter
List<String> newArgs = new ArrayList<String>();
newArgs.addAll(Arrays.asList(args));
newArgs.remove(0);
args = newArgs.toArray(new String[0]);
}
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < args.length; i++) {
stringBuffer.append("arg" + i + "=\"" + args[i] + "\" ");
}
System.out.println("starting with arguments [" + stringBuffer + "]");
System.out.println("Running under Java major version: ONE point " + ResourceUtil.getJavaVersion().toString() + ". Specifically: Java " + (System.getProperty("java.version")) + ", published by " + (System.getProperty("java.vendor")) + ", on the " + (System.getProperty("os.arch")) + " architecture running version " + (System.getProperty("os.version")) + " of the " + (System.getProperty("os.name")) + " operating system");
ClientServerInfo csInfo = null;
String hoststr = System.getProperty(PropertyLoader.vcellServerHost);
String[] hosts = null;
if (hoststr != null) {
StringTokenizer st = new StringTokenizer(hoststr, " ,;");
if (st.countTokens() >= 1) {
hosts = new String[st.countTokens()];
int count = 0;
while (st.hasMoreTokens()) {
hosts[count++] = st.nextToken();
}
}
}
if (hosts == null) {
hosts = new String[1];
}
String user = null;
String password = null;
VCDocument initialDocument = null;
if (args.length == 3) {
hosts[0] = args[0];
user = args[1];
password = args[2];
} else if (args.length == 0) {
// this is ok
} else if (args.length == 1) {
// Check if arg is drag-n-drop file or a 'hostname'
try {
// drag and drop file on install4j VCell launcher will pass filepath as single arg to VCell
File openThisVCellFile = new File(args[0]);
if (openThisVCellFile.exists() && openThisVCellFile.isFile()) {
initialDocument = startupWithOpen(args[0]);
}
} catch (Exception e) {
e.printStackTrace();
// continue to hostname check
}
// If startup file not exist assume arg is a hostname
if (initialDocument == null) {
hosts[0] = args[0];
}
// If install4j drag-n-drop, hosts[0] stays null and host is assumed to be loaded from a client property
} else if (args.length == 2 && args[0].equals("-open")) {
// hosts[0] = "-local";
initialDocument = startupWithOpen(args[1]);
} else {
System.out.println("usage: VCellClientTest ( ((-local|host[:port]) [userid password]) | ([-open] filename) )");
System.exit(1);
}
if (hosts[0] != null && hosts[0].equalsIgnoreCase("-local")) {
csInfo = ClientServerInfo.createLocalServerInfo(user, (password == null || password.length() == 0 ? null : new UserLoginInfo.DigestedPassword(password)));
} else {
String[] hostParts = hosts[0].split(":");
String apihost = hostParts[0];
int apiport = Integer.parseInt(hostParts[1]);
csInfo = ClientServerInfo.createRemoteServerInfo(apihost, apiport, user, (password == null || password.length() == 0 ? null : new UserLoginInfo.DigestedPassword(password)));
}
try {
String propertyFile = PropertyLoader.getProperty(PropertyLoader.propertyFileProperty, "");
if (propertyFile.length() > 0) {
PropertyLoader.loadProperties(ArrayUtils.addAll(REQUIRED_CLIENT_PROPERTIES, REQUIRED_LOCAL_PROPERTIES));
try {
VCMongoMessage.enabled = true;
VCMongoMessage.serviceStartup(ServiceName.client, null, null);
PropertyLoader.sendErrorsToMongo();
} catch (Exception e) {
System.out.println("failed to start Mongo logging");
}
} else {
PropertyLoader.loadProperties(REQUIRED_CLIENT_PROPERTIES);
VCMongoMessage.enabled = false;
}
// call in main thread, since it's quick and not necessarily thread safe
ResourceUtil.setNativeLibraryDirectory();
vcellClient = VCellClient.startClient(initialDocument, csInfo);
VCellClientDataService vcellClientDataService = new VCellClientDataServiceImpl(vcellClient);
VCellProxyServer.startVCellVisitDataServerThread(vcellClientDataService);
// starting loading libraries
new LibraryLoaderThread(true).start();
try {
PythonSupport.verifyInstallation(PythonPackage.values());
} catch (Exception e) {
e.printStackTrace(System.out);
}
// SimulationService.Iface simService = new SimulationServiceImpl();
// VCellIJServer.startVCellVisitDataServerThread(simService, false);
} catch (Throwable exception) {
ErrorUtils.sendRemoteLogMessage(csInfo.getUserLoginInfo(), csInfo.toString() + "\nvcell startup failed\n\n" + exception.getMessage());
JOptionPane.showMessageDialog(null, exception.getMessage(), "Fatal Error", JOptionPane.OK_OPTION);
System.err.println("Exception occurred in main() of VCellApplication");
exception.printStackTrace(System.out);
}
}
Aggregations