List of usage examples for javax.swing BoxLayout X_AXIS
int X_AXIS
To view the source code for javax.swing BoxLayout X_AXIS.
Click Source Link
From source file:org.pentaho.reporting.ui.datasources.pmd.PmdDataSourceEditor.java
private JPanel createGlobalPropertiesPanel() { final JPanel filePanel = new JPanel(); filePanel.setLayout(new BoxLayout(filePanel, BoxLayout.X_AXIS)); filePanel.add(filenameField);/* w w w .java 2 s .co m*/ filePanel.add(new JButton(new BrowseAction())); final JPanel queryListButtonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); queryListButtonsPanel.add(queryAddButton); queryListButtonsPanel.add(queryRemoveButton); final JPanel queryListButtonsPanelWrapper = new JPanel(new BorderLayout()); queryListButtonsPanelWrapper.add(new JLabel(Messages.getString("PmdDataSourceEditor.AvailableQueries")), BorderLayout.WEST); queryListButtonsPanelWrapper.add(queryListButtonsPanel, BorderLayout.EAST); final JPanel dataSourceConfigurationPanel = new JPanel(); dataSourceConfigurationPanel.setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP)); dataSourceConfigurationPanel.add(new JLabel(Messages.getString("PmdDataSourceEditor.XmiFileLabel"))); dataSourceConfigurationPanel.add(filePanel); dataSourceConfigurationPanel.add(new JLabel(Messages.getString("PmdDataSourceEditor.DomainId"))); dataSourceConfigurationPanel.add(domainIdTextField); dataSourceConfigurationPanel.add(queryListButtonsPanelWrapper); dataSourceConfigurationPanel.add(new JScrollPane(queryNameList)); dataSourceConfigurationPanel.add(new JLabel(Messages.getString("PmdDataSourceEditor.QueryName"))); dataSourceConfigurationPanel.add(queryNameTextField); return dataSourceConfigurationPanel; }
From source file:org.photovault.swingui.PhotoInfoDlg.java
/** Creates the UI components needed for this dialog. *//*from w w w.j ava 2 s .c o m*/ protected void createUI() { Container parentView = getParentController().getView(); Window wnd = SwingUtilities.getWindowAncestor(parentView); dialogWindow = new JDialog((Frame) wnd); editor = new PhotoInfoEditor(this); addView(editor); dialogWindow.getContentPane().add(editor, BorderLayout.NORTH); final PhotoInfoDlg staticThis = this; registerAction("save_close", new DataAccessAction("OK") { public void actionPerformed(ActionEvent actionEvent, org.hibernate.Session currentSession) { save(); dialogWindow.setVisible(false); } }); registerAction("discard_close", new DataAccessAction("Cancel") { public void actionPerformed(ActionEvent actionEvent, org.hibernate.Session currentSession) { discard(); dialogWindow.setVisible(false); } }); JButton okBtn = new JButton(this.getActionAdapter("save_close")); // okBtn.addActionListener( new ActionListener() { // public void actionPerformed( ActionEvent e ) { // try { // ChangePhotoInfoCommand cmd = ctrl.getChangeCommand(); // masterCtrl.getCommandHandler().executeCommand( cmd ); // photoChanged = true; // setVisible( false ); // } catch ( Exception ex ) { // JOptionPane.showMessageDialog( // staticThis, // "Error while saving changes: \n" + ex.getMessage(), // "Error saving changes", // JOptionPane.ERROR_MESSAGE, // null ); // log.warn( "problem while saving changes: " + ex.getMessage() ); // } // } // } ); JButton applyBtn = new JButton(getActionAdapter("save")); // applyBtn.addActionListener( new ActionListener() { // public void actionPerformed( ActionEvent e ) { // try { // ChangePhotoInfoCommand cmd = ctrl.getChangeCommand(); // masterCtrl.getCommandHandler().executeCommand( cmd ); // photoChanged = true; // } catch ( Exception ex ) { // JOptionPane.showMessageDialog( // staticThis, // "Error while saving changes: \n" + ex.getMessage(), // "Error saving changes", // JOptionPane.ERROR_MESSAGE, // null ); // log.warn( "problem while saving changes: " + ex.getMessage() ); // } // } // } ); JButton discardBtn = new JButton(getActionAdapter("discard")); // discardBtn.addActionListener( new ActionListener() { // public void actionPerformed( ActionEvent e ) { // ctrl.discard(); // } // } ); JButton closeBtn = new JButton(getActionAdapter("discard_close")); // closeBtn.addActionListener( new ActionListener() { // public void actionPerformed( ActionEvent e ) { // ctrl.discard(); // setVisible( false ); // } // } ); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS)); buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); buttonPane.add(Box.createHorizontalGlue()); buttonPane.add(okBtn); buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); buttonPane.add(applyBtn); buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); buttonPane.add(discardBtn); buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); buttonPane.add(closeBtn); dialogWindow.getContentPane().add(buttonPane, BorderLayout.SOUTH); dialogWindow.getRootPane().setDefaultButton(applyBtn); dialogWindow.pack(); }
From source file:org.processmining.analysis.performance.fsmevaluator.FSMEvaluationMenuUI.java
protected void showConfigurationPanel() { if (configurationPanel == null) { // setup configuration panel updateFrameworkResources();/*from w w w .j a v a 2 s. c o m*/ configurationPanel = new JPanel(); configurationPanel.setLayout(new BorderLayout()); configurationPanel.setBackground(COLOR_OUTER_BG); // setup logs panel ArrayList<String> values = new ArrayList<String>(); Iterator<String> itr = logReaders.keySet().iterator(); while (itr.hasNext()) { values.add(itr.next()); } logsEnumeration = new GUIPropertyListEnumeration("Event Log :", null, values, null, 180); // initializing Logs RoundedPanel content = new RoundedPanel(10, 5, 5); content.setBackground(COLOR_BG); content.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); content.setLayout(new BoxLayout(content, BoxLayout.LINE_AXIS)); content.add(logsEnumeration.getPropertyPanel()); // initializing Time Sort initTimeSort(); RoundedPanel content2 = new RoundedPanel(10, 5, 5); content2.setBackground(COLOR_BG); content2.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); content2.setLayout(new BoxLayout(content2, BoxLayout.LINE_AXIS)); content2.add(timeUnitSort.getPropertyPanel()); // initializing Measure ArrayList<String> values2 = new ArrayList<String>(); values2.add(MEAN); values2.add(MEDIAN); values2.add(MIN); values2.add(HEUST1); values2.add(HEUST2); estimatorSort = new GUIPropertyListEnumeration("Estimator:", null, values2, null, 180); RoundedPanel content3 = new RoundedPanel(10, 5, 5); content3.setBackground(COLOR_BG); content3.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); content3.setLayout(new BoxLayout(content3, BoxLayout.LINE_AXIS)); content3.add(estimatorSort.getPropertyPanel()); // setup reference model / log configuration panel JPanel startPanel = new JPanel(); startPanel.setOpaque(false); startPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); startPanel.setLayout(new BoxLayout(startPanel, BoxLayout.X_AXIS)); startButton = new AutoFocusButton("start calculation"); if (RuntimeUtils.isRunningMacOsX() == true) { startButton.setOpaque(true); } startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { startCalculation(); } }); startButton.setEnabled(true); startPanel.add(Box.createHorizontalGlue()); startPanel.add(startButton); rightPanel = new JPanel(); rightPanel.setOpaque(false); rightPanel.setBorder(BorderFactory.createEmptyBorder()); rightPanel.setLayout(new BorderLayout()); // blank panel JPanel blankPanel = new JPanel(); blankPanel.setOpaque(false); blankPanel.setBorder(BorderFactory.createEmptyBorder()); blankPanel.setLayout(new BorderLayout()); JPanel leftPanel = new JPanel(); leftPanel.setOpaque(false); leftPanel.setBorder(BorderFactory.createEmptyBorder()); leftPanel.setLayout(new BorderLayout()); leftPanel.add(content, BorderLayout.CENTER); leftPanel.add(content2, BorderLayout.SOUTH); leftPanel.add(content3, BorderLayout.NORTH); // add benchmark item list to west rightPanel.add(blankPanel, BorderLayout.CENTER); rightPanel.add(startPanel, BorderLayout.SOUTH); configurationPanel.add(leftPanel, BorderLayout.WEST); configurationPanel.add(rightPanel, BorderLayout.CENTER); } // switch to configuration view setView(configurationPanel); }
From source file:org.processmining.analysis.performance.fsmevaluator.FSMEvaluationMenuUI.java
protected static JPanel packHorizontallyLeftAligned(Component[] components, int leftOffset) { JPanel packed = new JPanel(); packed.setOpaque(false);/*from w w w . j a va 2s . c om*/ packed.setLayout(new BoxLayout(packed, BoxLayout.X_AXIS)); if (leftOffset > 0) { packed.add(Box.createHorizontalStrut(leftOffset)); } int minW = 0, minH = 0; for (Component comp : components) { packed.add(comp); Dimension dim = comp.getMinimumSize(); minW += dim.getWidth(); minH = Math.max(minH, (int) dim.getHeight()); } packed.add(Box.createHorizontalGlue()); packed.setMinimumSize(new Dimension(minW, minH)); packed.setMaximumSize(new Dimension(4000, minH)); packed.setPreferredSize(new Dimension(4000, minH)); return packed; }
From source file:org.processmining.analysis.performance.PerformanceAnalysisGUI.java
/** * Actually builds the UI//from w w w .j a va 2 s.co m * * @throws Exception */ private void jbInit() throws Exception { // Initialize the table which contains the log traces processInstanceIDsTable = new DoubleClickTable(new ExtendedLogTable(), updateButton); // select all rows as at the beginning the results count for the whole // log processInstanceIDsTable.getSelectionModel().addSelectionInterval(0, extendedLog.getSizeOfLog() - 1); tableContainer = new JScrollPane(processInstanceIDsTable); // initialize the westPanel (which contains the processInstanceIDsTable) westPanel.setPreferredSize(new Dimension(100, 300)); westPanel.setLayout(new BorderLayout()); westPanel.add(tableContainer, BorderLayout.CENTER); updateButton.setToolTipText("Update metrics to the selected process instances"); westPanel.add(piButtonsPanel, BorderLayout.SOUTH); piButtonsPanel.setLayout(new BorderLayout()); piButtonsPanel.add(updateButton, BorderLayout.CENTER); piButtonsPanel.add(invertButton, BorderLayout.SOUTH); // initialize the eastpanel (which contains the process-metrics) eastPanel.setPreferredSize(new Dimension(240, 390)); eastPanel.setMinimumSize(new Dimension(240, 390)); eastPanel.setLayout(new GridBagLayout()); GridBagConstraints cons = new GridBagConstraints(); cons.gridx = 0; cons.gridy = 0; cons.insets = new Insets(0, 5, 5, 0); cons.anchor = GridBagConstraints.WEST; processLabel.setFont(new Font("SansSerif", Font.BOLD, 16)); eastPanel.add(processLabel, cons); cons.gridx = 0; cons.gridy = 1; cons.insets = new Insets(8, 8, 0, 0); eastPanel.add(numberProcessLabel, cons); casesProcessLabel.setText(extendedLog.getSizeOfLog() + " cases"); casesProcessLabel.setFont(new Font("SansSerif", Font.PLAIN, 11)); cons.gridx = 0; cons.gridy = 2; eastPanel.add(casesProcessLabel, cons); cons.gridx = 0; cons.gridy = 3; eastPanel.add(properLabel, cons); completedLabel.setFont(new Font("SansSerif", Font.PLAIN, 11)); cons.gridx = 0; cons.gridy = 4; eastPanel.add(completedLabel, cons); cons.gridx = 0; cons.gridy = 5; eastPanel.add(arrivalProcessLabel, cons); rateProcessLabel.setFont(new Font("SansSerif", Font.PLAIN, 11)); cons.gridx = 0; cons.gridy = 6; eastPanel.add(rateProcessLabel, cons); cons.gridx = 0; cons.gridy = 7; cons.gridwidth = 2; cons.insets = new Insets(15, 5, 0, 2); cons.ipadx = 300; eastPanel.add(processTablePanel, cons); cons.gridx = 0; cons.gridy = 8; cons.gridwidth = 1; cons.insets = new Insets(0, 5, 0, 0); cons.weightx = 1; cons.ipadx = 0; exportProcessButton.setPreferredSize(new Dimension(110, 42)); exportProcessButton.setMaximumSize(new Dimension(110, 42)); changeProcessPercButton.setPreferredSize(new Dimension(110, 42)); changeProcessPercButton.setMaximumSize(new Dimension(110, 42)); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.setPreferredSize(new Dimension(240, 42)); buttonPanel.add(changeProcessPercButton); buttonPanel.add(exportProcessButton); eastPanel.add(buttonPanel, cons); processContainer = new JScrollPane(eastPanel); processContainer.setPreferredSize(new Dimension(240, 390)); // initialize the processTablePanel (which contains the table with // throughput times) processTablePanel.setLayout(new BorderLayout()); processTablePanel.setMinimumSize(new Dimension(240, 130)); processTablePanel.setPreferredSize(new Dimension(240, 130)); processTable.setRowSelectionAllowed(false); processTablePanel.add(processTable.getTableHeader(), BorderLayout.PAGE_START); processTablePanel.add(processTable, BorderLayout.CENTER); // initialize the grappaPanel (which contains the Petri net UI) and // place // it on the centerPanel grappaPanel = replayResult.getVisualization(extendedLog.getLogTraceIDs()); grappaPanel.addGrappaListener(new ExtendedGrappaAdapter()); mapping = new HashMap(); buildGraphMapping(mapping, grappaPanel.getSubgraph()); modelContainer = new JScrollPane(grappaPanel); centerPanel.setLayout(new BorderLayout()); centerPanel.add(modelContainer, BorderLayout.CENTER); // initialize the colored panels Color tCol = (Color) levelColors.get(0); lowPanel.setBackground(tCol); lowPanel.setBorder(BorderFactory.createEtchedBorder()); lowPanel.setPreferredSize(new Dimension(25, 12)); tCol = (Color) levelColors.get(1); mediumPanel.setBackground(tCol); mediumPanel.setBorder(BorderFactory.createEtchedBorder()); mediumPanel.setPreferredSize(new Dimension(25, 12)); tCol = (Color) levelColors.get(2); highPanel.setBackground(tCol); highPanel.setBorder(BorderFactory.createEtchedBorder()); highPanel.setPreferredSize(new Dimension(25, 12)); // initialize the levelPanel (which contains the waiting time settings) levelPanel.setBorder(BorderFactory.createRaisedBevelBorder()); levelPanel.setLayout(new GridBagLayout()); cons.gridx = 0; cons.gridy = 0; cons.gridwidth = 2; cons.insets = new Insets(2, 2, 0, 5); cons.weightx = 0; levelPanel.add(waitingLabel, cons); cons.gridx = 0; cons.gridy = 1; cons.anchor = GridBagConstraints.WEST; cons.insets = new Insets(2, 2, 0, 5); cons.gridwidth = 1; levelPanel.add(highPanel, cons); cons.gridx = 1; cons.gridy = 1; levelPanel.add(highLabel, cons); cons.gridx = 0; cons.gridy = 2; cons.insets = new Insets(1, 2, 0, 5); levelPanel.add(mediumPanel, cons); cons.gridx = 1; cons.gridy = 2; levelPanel.add(mediumLabel, cons); cons.gridx = 0; cons.gridy = 3; cons.insets = new Insets(2, 2, 2, 5); levelPanel.add(lowPanel, cons); cons.gridx = 1; cons.gridy = 3; levelPanel.add(lowLabel, cons); cons.gridx = 0; cons.gridy = 4; cons.gridwidth = 2; cons.insets = new Insets(2, 2, 2, 2); changeSettingsButton.setMnemonic(KeyEvent.VK_S); levelPanel.add(changeSettingsButton, cons); levelPanel.setBackground(new Color(220, 220, 220)); // initialize the selectionPanel (which contains the selected // transitions/place) initializeSelection(); // initialize the metricsBottomPanel metricsBottomPanel.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.gridx = 0; cons.gridy = 0; cons.gridwidth = 5; cons.anchor = GridBagConstraints.WEST; cons.insets = new Insets(1, 2, 5, 0); titleLabel.setFont(new Font("SansSerif", Font.BOLD, 14)); metricsBottomPanel.add(titleLabel, cons); cons.gridx = 0; cons.gridy = 1; cons.gridwidth = 1; cons.insets = new Insets(1, 2, 2, 0); metricsBottomPanel.add(numberObjectLabel, cons); cons.gridx = 1; cons.gridy = 1; cons.gridwidth = 1; freqObjectLabel.setFont(new Font("SansSerif", Font.PLAIN, 12)); metricsBottomPanel.add(freqObjectLabel, cons); cons.gridx = 0; cons.gridy = 2; cons.gridwidth = 1; metricsBottomPanel.add(arrivalPlaceLabel, cons); cons.gridx = 1; cons.gridy = 2; cons.gridwidth = 1; ratePlaceLabel.setFont(new Font("SansSerif", Font.PLAIN, 12)); metricsBottomPanel.add(ratePlaceLabel, cons); cons.gridx = 0; cons.gridy = 3; cons.gridwidth = 5; metricsBottomPanel.add(tablePanel, cons); cons.gridx = 0; cons.gridy = 4; cons.gridwidth = 2; changePercentagesButton.setPreferredSize(new Dimension(170, 25)); metricsBottomPanel.add(changePercentagesButton, cons); cons.gridx = 2; cons.gridy = 4; cons.gridwidth = 2; metricsBottomPanel.add(exportButton, cons); // hide all place/transition metrics hideAllMetrics(); metricsBottomContainer = new JScrollPane(metricsBottomPanel); metricsBottomContainer.setPreferredSize(new Dimension(550, 140)); metricsBottomContainer.setMinimumSize(new Dimension(550, 140)); metricsBottomContainer.setMaximumSize(new Dimension(550, 800)); metricsBottomContainer.setBorder(BorderFactory.createEmptyBorder()); // initialize the bottomPanel bottomPanel.setBorder(BorderFactory.createEtchedBorder()); bottomPanel.setPreferredSize(new Dimension(650, 143)); bottomPanel.setMinimumSize(new Dimension(650, 143)); bottomPanel.setLayout(new GridBagLayout()); GridBagConstraints con = new GridBagConstraints(); con.gridx = 0; con.gridy = 0; con.gridwidth = 4; con.weightx = 2; bottomPanel.add(metricsBottomContainer, con); con.gridx = 4; con.gridy = 0; con.gridwidth = 1; con.weightx = 1; con.anchor = GridBagConstraints.EAST; bottomPanel.add(levelPanel, con); con.gridx = 5; con.gridy = 0; // con.gridwidth = 2; con.weightx = 1; con.anchor = GridBagConstraints.EAST; bottomPanel.add(selectionPanel, con); // Divide the upper panels by using splitPanes leftSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, westPanel, centerPanel); leftSplitPane.setDividerLocation(130); leftSplitPane.setOneTouchExpandable(true); rightSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSplitPane, processContainer); rightSplitPane.setDividerLocation(rightSplitPane.getSize().width - rightSplitPane.getInsets().right - rightSplitPane.getDividerSize() - 240); // processContainer.getWidth()); rightSplitPane.setOneTouchExpandable(true); rightSplitPane.setResizeWeight(1.0); rightSplitPane.setDividerSize(3); // set tooltips processTable.setToolTipText("Throughput time of the process, based on" + " the selected cases"); rateProcessLabel.setToolTipText("Arrival rate of the selected cases"); arrivalProcessLabel.setToolTipText("Arrival rate of the selected cases"); completedLabel.setToolTipText( "Total number of the selected cases that" + " have completed properly and successfully"); properLabel.setToolTipText( "Total number of the selected cases that" + " have completed properly and successfully"); casesProcessLabel.setToolTipText("Total number of cases selected in" + " the table on the left"); numberProcessLabel.setToolTipText("Total number of cases selected in" + " the table on the left"); changeSettingsButton.setToolTipText("Adjust the current waiting time" + " classifications"); placeTable.setToolTipText("Time-metrics of the selected place, based on" + " the selected cases"); transitionTable.setToolTipText( "Time cases spend in between the" + " selected transitions, based on the selected cases"); activityTable.setToolTipText( "Time-metrics of activity related to the" + " selected transition, based on the selected cases"); processInstanceIDsTable.setToolTipText("Selected cases"); changePercentagesButton.setToolTipText("Change percentages of slow," + " fast and normal"); changeProcessPercButton.setToolTipText("Change percentages of slow," + " fast and normal"); exportButton.setToolTipText("Export the values of all measurements of" + " the metrics in the table above to a comma-seperated" + " text-file"); exportProcessButton.setToolTipText("Export the value of the throughput" + " time of all selected process instances to a comma-seperated" + " text-file"); // initialize the performanceAnalysisGUI this.setLayout(new BorderLayout()); this.add(bottomPanel, BorderLayout.SOUTH); this.add(rightSplitPane, BorderLayout.CENTER); this.validate(); this.repaint(); }
From source file:org.processmining.analysis.performance.PerformanceAnalysisGUI.java
/** * Creates a new frame, containing the current PerformanceConfiguration. In * the new frame, the user can change the current settings, after which the * PerformanceAnalysisGUI is updated./*from w w w .j a va 2 s .c o m*/ */ private void createPerformanceOptionsScreen() { // initialize the settings screen JPanel firstPanel = new JPanel(new BorderLayout()); JPanel secondPanel = new JPanel(); JButton okButton = new JButton("Apply Changes"); JButton cancelButton = new JButton("Cancel"); String sel = (String) sb1.getSelectedItem(); Dimension dim = new Dimension(380, 460); // create a new PerformanceConfiguration-object, containing the current // settings final PerformanceConfiguration performanceOptions = new PerformanceConfiguration(levelColors, bounds, timeSort, decimalPlaces, advancedSettings.clone()); if (boxMap.get(sel) instanceof ExtendedPlace) { // adjust the performanceOptions to the settings of the selected // place performanceOptions.changeDisplay((ExtendedPlace) boxMap.get(sel)); dim = new Dimension(380, 525); } else { performanceOptions.changeDisplay(null); } JScrollPane scroll = new JScrollPane(performanceOptions); firstPanel.add(scroll, BorderLayout.CENTER); firstPanel.add(secondPanel, BorderLayout.SOUTH); secondPanel.setLayout(new BoxLayout(secondPanel, BoxLayout.X_AXIS)); secondPanel.add(Box.createRigidArea(new Dimension(40, 0))); secondPanel.add(okButton); secondPanel.add(Box.createRigidArea(new Dimension(20, 0))); secondPanel.add(cancelButton); okButton.addActionListener(new ActionListener() { // the action to be taken when the OK-button is pressed public void actionPerformed(ActionEvent e) { if (performanceOptions.getAllSelected()) { // settings should be applied to all places timeDivider = performanceOptions.getTimeDivider(); timeSort = performanceOptions.getTimesort(); decimalPlaces = performanceOptions.getDecimalPlaces(); bounds = performanceOptions.getBoundaries(); levelColors = performanceOptions.getColors(); advancedSettings = performanceOptions.getAdvancedSettings().clone(); manualSettings = true; ListIterator lit = extendedPetriNet.getPlaces().listIterator(); while (lit.hasNext()) { ExtendedPlace p = (ExtendedPlace) lit.next(); p.setHasOwnSettings(false); } } else { // apply settings to the selected place only performanceOptions.getSelectedPlace().setOwnSettings(performanceOptions.getBoundaries(), performanceOptions.getColors()); timeDivider = performanceOptions.getTimeDivider(); timeSort = performanceOptions.getTimesort(); decimalPlaces = performanceOptions.getDecimalPlaces(); advancedSettings = performanceOptions.getAdvancedSettings().clone(); manualSettings = true; } // close all frames containing AdvancedSettings opened from // performanceOptions performanceOptions.closeAdvancedFrames(); // close the performanceOptions-frame MainUI.getInstance().getDesktop().getSelectedFrame().doDefaultCloseAction(); // adjust the PerformanceAnalysisGUI adjustGUI(); } }); cancelButton.addActionListener(new ActionListener() { // the action to be taken when the cancel button has been pressed public void actionPerformed(ActionEvent e) { // close all frames containing AdvancedSettings opened from // performanceOptions performanceOptions.closeAdvancedFrames(); // close the PerformanceOptions-frame MainUI.getInstance().getDesktop().getSelectedFrame().doDefaultCloseAction(); } }); // show the panel in a new frame MainUI.getInstance().createFrame("Performance analysis options:", firstPanel); JInternalFrame frame = MainUI.getInstance().getDesktop().getSelectedFrame(); frame.setSize(dim); }
From source file:org.prom5.analysis.performance.PerformanceAnalysisGUI.java
/** * Actually builds the UI/*from w w w . jav a2s. co m*/ * @throws Exception */ private void jbInit() throws Exception { //Initialize the table which contains the log traces processInstanceIDsTable = new DoubleClickTable(new ExtendedLogTable(), updateButton); // select all rows as at the beginning the results count for the whole log processInstanceIDsTable.getSelectionModel().addSelectionInterval(0, extendedLog.getSizeOfLog() - 1); tableContainer = new JScrollPane(processInstanceIDsTable); //initialize the westPanel (which contains the processInstanceIDsTable) westPanel.setPreferredSize(new Dimension(100, 300)); westPanel.setLayout(new BorderLayout()); westPanel.add(tableContainer, BorderLayout.CENTER); updateButton.setToolTipText("Update metrics to the selected process instances"); westPanel.add(piButtonsPanel, BorderLayout.SOUTH); piButtonsPanel.setLayout(new BorderLayout()); piButtonsPanel.add(updateButton, BorderLayout.CENTER); piButtonsPanel.add(invertButton, BorderLayout.SOUTH); //initialize the eastpanel (which contains the process-metrics) eastPanel.setPreferredSize(new Dimension(240, 390)); eastPanel.setMinimumSize(new Dimension(240, 390)); eastPanel.setLayout(new GridBagLayout()); GridBagConstraints cons = new GridBagConstraints(); cons.gridx = 0; cons.gridy = 0; cons.insets = new Insets(0, 5, 5, 0); cons.anchor = GridBagConstraints.WEST; processLabel.setFont(new Font("SansSerif", Font.BOLD, 16)); eastPanel.add(processLabel, cons); cons.gridx = 0; cons.gridy = 1; cons.insets = new Insets(8, 8, 0, 0); eastPanel.add(numberProcessLabel, cons); casesProcessLabel.setText(extendedLog.getSizeOfLog() + " cases"); casesProcessLabel.setFont(new Font("SansSerif", Font.PLAIN, 11)); cons.gridx = 0; cons.gridy = 2; eastPanel.add(casesProcessLabel, cons); cons.gridx = 0; cons.gridy = 3; eastPanel.add(properLabel, cons); completedLabel.setFont(new Font("SansSerif", Font.PLAIN, 11)); cons.gridx = 0; cons.gridy = 4; eastPanel.add(completedLabel, cons); cons.gridx = 0; cons.gridy = 5; eastPanel.add(arrivalProcessLabel, cons); rateProcessLabel.setFont(new Font("SansSerif", Font.PLAIN, 11)); cons.gridx = 0; cons.gridy = 6; eastPanel.add(rateProcessLabel, cons); cons.gridx = 0; cons.gridy = 7; cons.gridwidth = 2; cons.insets = new Insets(15, 5, 0, 2); cons.ipadx = 300; eastPanel.add(processTablePanel, cons); cons.gridx = 0; cons.gridy = 8; cons.gridwidth = 1; cons.insets = new Insets(0, 5, 0, 0); cons.weightx = 1; cons.ipadx = 0; exportProcessButton.setPreferredSize(new Dimension(110, 42)); exportProcessButton.setMaximumSize(new Dimension(110, 42)); changeProcessPercButton.setPreferredSize(new Dimension(110, 42)); changeProcessPercButton.setMaximumSize(new Dimension(110, 42)); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.setPreferredSize(new Dimension(240, 42)); buttonPanel.add(changeProcessPercButton); buttonPanel.add(exportProcessButton); eastPanel.add(buttonPanel, cons); processContainer = new JScrollPane(eastPanel); processContainer.setPreferredSize(new Dimension(240, 390)); //initialize the processTablePanel (which contains the table with throughput times) processTablePanel.setLayout(new BorderLayout()); processTablePanel.setMinimumSize(new Dimension(240, 130)); processTablePanel.setPreferredSize(new Dimension(240, 130)); processTable.setRowSelectionAllowed(false); processTablePanel.add(processTable.getTableHeader(), BorderLayout.PAGE_START); processTablePanel.add(processTable, BorderLayout.CENTER); //initialize the grappaPanel (which contains the Petri net UI) and place //it on the centerPanel grappaPanel = replayResult.getVisualization(extendedLog.getLogTraceIDs()); grappaPanel.addGrappaListener(new ExtendedGrappaAdapter()); mapping = new HashMap(); buildGraphMapping(mapping, grappaPanel.getSubgraph()); modelContainer = new JScrollPane(grappaPanel); centerPanel.setLayout(new BorderLayout()); centerPanel.add(modelContainer, BorderLayout.CENTER); //initialize the colored panels Color tCol = (Color) levelColors.get(0); lowPanel.setBackground(tCol); lowPanel.setBorder(BorderFactory.createEtchedBorder()); lowPanel.setPreferredSize(new Dimension(25, 12)); tCol = (Color) levelColors.get(1); mediumPanel.setBackground(tCol); mediumPanel.setBorder(BorderFactory.createEtchedBorder()); mediumPanel.setPreferredSize(new Dimension(25, 12)); tCol = (Color) levelColors.get(2); highPanel.setBackground(tCol); highPanel.setBorder(BorderFactory.createEtchedBorder()); highPanel.setPreferredSize(new Dimension(25, 12)); //initialize the levelPanel (which contains the waiting time settings) levelPanel.setBorder(BorderFactory.createRaisedBevelBorder()); levelPanel.setLayout(new GridBagLayout()); cons.gridx = 0; cons.gridy = 0; cons.gridwidth = 2; cons.insets = new Insets(2, 2, 0, 5); cons.weightx = 0; levelPanel.add(waitingLabel, cons); cons.gridx = 0; cons.gridy = 1; cons.anchor = GridBagConstraints.WEST; cons.insets = new Insets(2, 2, 0, 5); cons.gridwidth = 1; levelPanel.add(highPanel, cons); cons.gridx = 1; cons.gridy = 1; levelPanel.add(highLabel, cons); cons.gridx = 0; cons.gridy = 2; cons.insets = new Insets(1, 2, 0, 5); levelPanel.add(mediumPanel, cons); cons.gridx = 1; cons.gridy = 2; levelPanel.add(mediumLabel, cons); cons.gridx = 0; cons.gridy = 3; cons.insets = new Insets(2, 2, 2, 5); levelPanel.add(lowPanel, cons); cons.gridx = 1; cons.gridy = 3; levelPanel.add(lowLabel, cons); cons.gridx = 0; cons.gridy = 4; cons.gridwidth = 2; cons.insets = new Insets(2, 2, 2, 2); changeSettingsButton.setMnemonic(KeyEvent.VK_S); levelPanel.add(changeSettingsButton, cons); levelPanel.setBackground(new Color(220, 220, 220)); //initialize the selectionPanel (which contains the selected transitions/place) initializeSelection(); //initialize the metricsBottomPanel metricsBottomPanel.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.gridx = 0; cons.gridy = 0; cons.gridwidth = 5; cons.anchor = GridBagConstraints.WEST; cons.insets = new Insets(1, 2, 5, 0); titleLabel.setFont(new Font("SansSerif", Font.BOLD, 14)); metricsBottomPanel.add(titleLabel, cons); cons.gridx = 0; cons.gridy = 1; cons.gridwidth = 1; cons.insets = new Insets(1, 2, 2, 0); metricsBottomPanel.add(numberObjectLabel, cons); cons.gridx = 1; cons.gridy = 1; cons.gridwidth = 1; freqObjectLabel.setFont(new Font("SansSerif", Font.PLAIN, 12)); metricsBottomPanel.add(freqObjectLabel, cons); cons.gridx = 0; cons.gridy = 2; cons.gridwidth = 1; metricsBottomPanel.add(arrivalPlaceLabel, cons); cons.gridx = 1; cons.gridy = 2; cons.gridwidth = 1; ratePlaceLabel.setFont(new Font("SansSerif", Font.PLAIN, 12)); metricsBottomPanel.add(ratePlaceLabel, cons); cons.gridx = 0; cons.gridy = 3; cons.gridwidth = 5; metricsBottomPanel.add(tablePanel, cons); cons.gridx = 0; cons.gridy = 4; cons.gridwidth = 2; changePercentagesButton.setPreferredSize(new Dimension(170, 25)); metricsBottomPanel.add(changePercentagesButton, cons); cons.gridx = 2; cons.gridy = 4; cons.gridwidth = 2; metricsBottomPanel.add(exportButton, cons); //hide all place/transition metrics hideAllMetrics(); metricsBottomContainer = new JScrollPane(metricsBottomPanel); metricsBottomContainer.setPreferredSize(new Dimension(550, 140)); metricsBottomContainer.setMinimumSize(new Dimension(550, 140)); metricsBottomContainer.setMaximumSize(new Dimension(550, 800)); metricsBottomContainer.setBorder(BorderFactory.createEmptyBorder()); //initialize the bottomPanel bottomPanel.setBorder(BorderFactory.createEtchedBorder()); bottomPanel.setPreferredSize(new Dimension(650, 143)); bottomPanel.setMinimumSize(new Dimension(650, 143)); bottomPanel.setLayout(new GridBagLayout()); GridBagConstraints con = new GridBagConstraints(); con.gridx = 0; con.gridy = 0; con.gridwidth = 4; con.weightx = 2; bottomPanel.add(metricsBottomContainer, con); con.gridx = 4; con.gridy = 0; con.gridwidth = 1; con.weightx = 1; con.anchor = GridBagConstraints.EAST; bottomPanel.add(levelPanel, con); con.gridx = 5; con.gridy = 0; //con.gridwidth = 2; con.weightx = 1; con.anchor = GridBagConstraints.EAST; bottomPanel.add(selectionPanel, con); //Divide the upper panels by using splitPanes leftSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, westPanel, centerPanel); leftSplitPane.setDividerLocation(130); leftSplitPane.setOneTouchExpandable(true); rightSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSplitPane, processContainer); rightSplitPane.setDividerLocation(rightSplitPane.getSize().width - rightSplitPane.getInsets().right - rightSplitPane.getDividerSize() - 240); //processContainer.getWidth()); rightSplitPane.setOneTouchExpandable(true); rightSplitPane.setResizeWeight(1.0); rightSplitPane.setDividerSize(3); //set tooltips processTable.setToolTipText("Throughput time of the process, based on" + " the selected cases"); rateProcessLabel.setToolTipText("Arrival rate of the selected cases"); arrivalProcessLabel.setToolTipText("Arrival rate of the selected cases"); completedLabel.setToolTipText( "Total number of the selected cases that" + " have completed properly and successfully"); properLabel.setToolTipText( "Total number of the selected cases that" + " have completed properly and successfully"); casesProcessLabel.setToolTipText("Total number of cases selected in" + " the table on the left"); numberProcessLabel.setToolTipText("Total number of cases selected in" + " the table on the left"); changeSettingsButton.setToolTipText("Adjust the current waiting time" + " classifications"); placeTable.setToolTipText("Time-metrics of the selected place, based on" + " the selected cases"); transitionTable.setToolTipText( "Time cases spend in between the" + " selected transitions, based on the selected cases"); activityTable.setToolTipText( "Time-metrics of activity related to the" + " selected transition, based on the selected cases"); processInstanceIDsTable.setToolTipText("Selected cases"); changePercentagesButton.setToolTipText("Change percentages of slow," + " fast and normal"); changeProcessPercButton.setToolTipText("Change percentages of slow," + " fast and normal"); exportButton.setToolTipText("Export the values of all measurements of" + " the metrics in the table above to a comma-seperated" + " text-file"); exportProcessButton.setToolTipText("Export the value of the throughput" + " time of all selected process instances to a comma-seperated" + " text-file"); //initialize the performanceAnalysisGUI this.setLayout(new BorderLayout()); this.add(bottomPanel, BorderLayout.SOUTH); this.add(rightSplitPane, BorderLayout.CENTER); this.validate(); this.repaint(); }
From source file:org.prom5.analysis.performance.PerformanceAnalysisGUI.java
/** * Creates a new frame, containing the current PerformanceConfiguration. * In the new frame, the user can change the current settings, after which * the PerformanceAnalysisGUI is updated. *///w w w . j a va 2 s. c o m private void createPerformanceOptionsScreen() { //initialize the settings screen JPanel firstPanel = new JPanel(new BorderLayout()); JPanel secondPanel = new JPanel(); JButton okButton = new JButton("Apply Changes"); JButton cancelButton = new JButton("Cancel"); String sel = (String) sb1.getSelectedItem(); Dimension dim = new Dimension(380, 460); //create a new PerformanceConfiguration-object, containing the current //settings final PerformanceConfiguration performanceOptions = new PerformanceConfiguration(levelColors, bounds, timeSort, decimalPlaces, advancedSettings.clone()); if (boxMap.get(sel) instanceof ExtendedPlace) { //adjust the performanceOptions to the settings of the selected place performanceOptions.changeDisplay((ExtendedPlace) boxMap.get(sel)); dim = new Dimension(380, 525); } else { performanceOptions.changeDisplay(null); } JScrollPane scroll = new JScrollPane(performanceOptions); firstPanel.add(scroll, BorderLayout.CENTER); firstPanel.add(secondPanel, BorderLayout.SOUTH); secondPanel.setLayout(new BoxLayout(secondPanel, BoxLayout.X_AXIS)); secondPanel.add(Box.createRigidArea(new Dimension(40, 0))); secondPanel.add(okButton); secondPanel.add(Box.createRigidArea(new Dimension(20, 0))); secondPanel.add(cancelButton); okButton.addActionListener(new ActionListener() { // the action to be taken when the OK-button is pressed public void actionPerformed(ActionEvent e) { if (performanceOptions.getAllSelected()) { //settings should be applied to all places timeDivider = performanceOptions.getTimeDivider(); timeSort = performanceOptions.getTimesort(); decimalPlaces = performanceOptions.getDecimalPlaces(); bounds = performanceOptions.getBoundaries(); levelColors = performanceOptions.getColors(); advancedSettings = performanceOptions.getAdvancedSettings().clone(); manualSettings = true; ListIterator lit = extendedPetriNet.getPlaces().listIterator(); while (lit.hasNext()) { ExtendedPlace p = (ExtendedPlace) lit.next(); p.setHasOwnSettings(false); } } else { //apply settings to the selected place only performanceOptions.getSelectedPlace().setOwnSettings(performanceOptions.getBoundaries(), performanceOptions.getColors()); timeDivider = performanceOptions.getTimeDivider(); timeSort = performanceOptions.getTimesort(); decimalPlaces = performanceOptions.getDecimalPlaces(); advancedSettings = performanceOptions.getAdvancedSettings().clone(); manualSettings = true; } //close all frames containing AdvancedSettings opened from performanceOptions performanceOptions.closeAdvancedFrames(); //close the performanceOptions-frame MainUI.getInstance().getDesktop().getSelectedFrame().doDefaultCloseAction(); //adjust the PerformanceAnalysisGUI adjustGUI(); } }); cancelButton.addActionListener(new ActionListener() { // the action to be taken when the cancel button has been pressed public void actionPerformed(ActionEvent e) { //close all frames containing AdvancedSettings opened from performanceOptions performanceOptions.closeAdvancedFrames(); //close the PerformanceOptions-frame MainUI.getInstance().getDesktop().getSelectedFrame().doDefaultCloseAction(); } }); //show the panel in a new frame MainUI.getInstance().createFrame("Performance analysis options:", firstPanel); JInternalFrame frame = MainUI.getInstance().getDesktop().getSelectedFrame(); frame.setSize(dim); }
From source file:org.rhwlab.ace3d.SelectedNucleusFrame.java
public SelectedNucleusFrame(Ace3D_Frame owner, ImagedEmbryo emb) { this.embryo = emb; this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); // this.setLocationRelativeTo(owner); // this.setLocationByPlatform(true); this.setTitle("Selected Nucleus"); JPanel content = new JPanel(); content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS)); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.X_AXIS)); npPanel = new NucleusPropertiesPanel(); embryo.addListener(npPanel);//from w ww . ja va 2 s .co m mainPanel.add(npPanel); radiusControl = new RadiusControlPanel(owner); radiusControl.setEmbryo(embryo); embryo.addListener(radiusControl); mainPanel.add(radiusControl); /* MarkedNucleiPanel nucPanel = new MarkedNucleiPanel(); embryo.addListener(nucPanel); panel.add(nucPanel); */ JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(4, 3)); JButton unselectButton = new JButton("Unselect"); unselectButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { embryo.setSelectedNucleus(null); } }); buttonPanel.add(unselectButton); JButton unmarkButton = new JButton("Unmark"); unmarkButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { embryo.setMarked(null); } }); buttonPanel.add(unmarkButton); /* JButton calcExp = new JButton("Calc Expression"); calcExp.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { List<String> datasets = Ace3D_Frame.datasetsSelected(); if (datasets.isEmpty()) return; Nucleus nuc = embryo.selectedNucleus(); TimePointImage tpi = embryo.getTimePointImage(datasets.get(0), nuc.getTime()); double[][] eigen = nuc.getEigenVectors(); try { double exp = embryo.calculateExpression(nuc,tpi,eigen); embryo.setExpression(nuc, exp); } catch (Exception exc){ exc.printStackTrace(); } } }); buttonPanel.add(calcExp); */ unlink = new JButton("Unlink"); unlink.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (embryo.selectedNucleus() != null) { embryo.getNucleusFile().unlinkNucleus(embryo.selectedNucleus(), true); } } }); buttonPanel.add(unlink); link = new JButton("Link"); link.setEnabled(false); buttonPanel.add(link); link.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { embryo.formLink(); } }); JButton join = new JButton("Join"); buttonPanel.add(join); join.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { if (embryo.getMarked() != null) { embryo.joinSelectedToMarked(); } else { embryo.joinSelectedNucleus(); } } catch (Exception exc) { exc.printStackTrace(); } } }); JButton split = new JButton("Split"); buttonPanel.add(split); split.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { embryo.splitSelectedNucleus(); } catch (Exception exc) { exc.printStackTrace(); } } }); JButton remove = new JButton("Remove Nucleus"); buttonPanel.add(remove); remove.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (embryo.selectedNucleus() != null) { embryo.getNucleusFile().removeNucleus(embryo.selectedNucleus(), true); } } }); JButton removeCell = new JButton("Remove Cell"); buttonPanel.add(removeCell); removeCell.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (embryo.selectedNucleus() != null) { embryo.getNucleusFile().removeCell(embryo.selectedNucleus(), true); } } }); JButton nameChildren = new JButton("Toggle Cell Name"); buttonPanel.add(nameChildren); nameChildren.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (embryo.selectedNucleus() != null) { ((NamedNucleusFile) embryo.getNucleusFile()).toggleCellName(embryo.selectedNucleus(), true); } } }); JButton confirm = new JButton("Orient Embryo"); buttonPanel.add(confirm); confirm.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (embryo.selectedNucleus() != null) { RealMatrix r = ((NamedNucleusFile) embryo.getNucleusFile()) .orientEmbryo(embryo.selectedNucleus().getTime()); NamedNucleusFile.setOrientation(r); embryo.nameAllRoots(); embryo.notifyListeners(); } } }); content.add(mainPanel); content.add(buttonPanel); this.setContentPane(content); pack(); }
From source file:org.tellervo.desktop.io.ImportDialog.java
/** * Set up the button bar//from w w w . ja v a2s.c om */ private void setupButtonBar() { bottombar = new JPanel(); bottombar.setLayout(new BoxLayout(bottombar, BoxLayout.X_AXIS)); editEntity = new JToggleButton(); editEntity.setIcon(Builder.getIcon("lock.png", Builder.ICONS, 22)); editEntity.setSelectedIcon(Builder.getIcon("unlock.png", Builder.ICONS, 22)); editEntity.setBorderPainted(false); editEntity.setContentAreaFilled(false); editEntity.setFocusable(false); editEntity.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!editEntity.isSelected() && hasChanged) { if (!warnLosingChanges()) { editEntity.setSelected(true); return; } else { editEntity.setSelected(false); hasChanged = false; } } //enableEditing(editEntity.isSelected()); } }); bottombar.add(editEntity); editEntityText = new JLabel(I18n.getText("general.initializing").toLowerCase()); editEntityText.setLabelFor(editEntity); bottombar.add(editEntityText); editEntitySave = new JButton(I18n.getText("general.saveChanges")); editEntityCancel = new JButton(I18n.getText("general.cancel")); // don't let an errant enter key fire these buttons! editEntitySave.setDefaultCapable(false); editEntityCancel.setDefaultCapable(false); editEntitySave.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //doSave(); } }); editEntityCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { hasChanged = false; editEntity.setSelected(false); //enableEditing(false); } }); bottombar.add(Box.createHorizontalGlue()); bottombar.add(editEntitySave); bottombar.add(Box.createHorizontalStrut(6)); bottombar.add(editEntityCancel); bottombar.add(Box.createHorizontalStrut(6)); }