List of usage examples for javax.swing BoxLayout Y_AXIS
int Y_AXIS
To view the source code for javax.swing BoxLayout Y_AXIS.
Click Source Link
From source file:org.parosproxy.paros.view.MainFrame.java
/** * This method initializes paneContent/*w ww . j av a 2 s.c om*/ * * @return JPanel */ private JPanel getPaneContent() { if (paneContent == null) { paneContent = new JPanel(); paneContent.setLayout(new BoxLayout(getPaneContent(), BoxLayout.Y_AXIS)); paneContent.setEnabled(true); paneContent.add(getMainToolbarPanel(), null); paneContent.add(getPaneDisplay(), null); paneContent.add(getMainFooterPanel(), null); } return paneContent; }
From source file:org.pdfsam.guiclient.commons.panels.JVisualPdfPageSelectionPanel.java
private void initButtonPanel(PagesWorker pagesWorker) { buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS)); buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); pageActionListener = new PagesActionsMediator(pagesWorker); //move up button moveUpButton = new JButton(); moveUpButton.setMargin(new Insets(2, 2, 2, 2)); moveUpButton.addActionListener(pageActionListener); moveUpButton.setIcon(new ImageIcon(this.getClass().getResource("/images/up.png"))); moveUpButton.setActionCommand(PagesWorker.MOVE_UP); moveUpButton.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Move Up")); moveUpButton// w ww . ja v a 2 s.c o m .setToolTipText(GettextResource.gettext(config.getI18nResourceBundle(), "Move up selected pages") + " " + GettextResource.gettext(config.getI18nResourceBundle(), "(Alt+ArrowUp)")); moveUpButton.addKeyListener(new EnterDoClickListener(moveUpButton)); moveUpButton.setAlignmentX(Component.CENTER_ALIGNMENT); addButtonToButtonPanel(moveUpButton); //move down button moveDownButton = new JButton(); moveDownButton.addActionListener(pageActionListener); moveDownButton.setIcon(new ImageIcon(this.getClass().getResource("/images/down.png"))); moveDownButton.setActionCommand(PagesWorker.MOVE_DOWN); moveDownButton.setMargin(new Insets(2, 2, 2, 2)); moveDownButton.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Move Down")); moveDownButton .setToolTipText(GettextResource.gettext(config.getI18nResourceBundle(), "Move down selected pages") + " " + GettextResource.gettext(config.getI18nResourceBundle(), "(Alt+ArrowDown)")); moveDownButton.addKeyListener(new EnterDoClickListener(moveDownButton)); moveDownButton.setAlignmentX(Component.CENTER_ALIGNMENT); addButtonToButtonPanel(moveDownButton); //delete button removeButton = new JButton(); removeButton.addActionListener(pageActionListener); removeButton.setIcon(new ImageIcon(this.getClass().getResource("/images/remove.png"))); removeButton.setActionCommand(PagesWorker.REMOVE); removeButton.setMargin(new Insets(2, 2, 2, 2)); removeButton.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Delete")); removeButton.setToolTipText(GettextResource.gettext(config.getI18nResourceBundle(), "Delete selected pages") + " " + GettextResource.gettext(config.getI18nResourceBundle(), "(Canc)")); removeButton.addKeyListener(new EnterDoClickListener(removeButton)); removeButton.setAlignmentX(Component.CENTER_ALIGNMENT); addButtonToButtonPanel(removeButton); //undelete button if (drawDeletedItems) { undeleteButton = new JButton(); undeleteButton.addActionListener(pageActionListener); undeleteButton.setIcon(new ImageIcon(this.getClass().getResource("/images/remove.png"))); undeleteButton.setActionCommand(PagesWorker.UNDELETE); undeleteButton.setMargin(new Insets(2, 2, 2, 2)); undeleteButton.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Undelete")); undeleteButton.setToolTipText( GettextResource.gettext(config.getI18nResourceBundle(), "Undelete selected pages") + " " + GettextResource.gettext(config.getI18nResourceBundle(), "(Ctrl+Z)")); undeleteButton.addKeyListener(new EnterDoClickListener(undeleteButton)); undeleteButton.setAlignmentX(Component.CENTER_ALIGNMENT); addButtonToButtonPanel(undeleteButton); } //rotate button rotateButton = new JButton(); rotateButton.addActionListener(pageActionListener); rotateButton.setIcon(new ImageIcon(this.getClass().getResource("/images/clockwise.png"))); rotateButton.setActionCommand(PagesWorker.ROTATE_CLOCK); rotateButton.setMargin(new Insets(2, 2, 2, 2)); rotateButton.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Rotate right")); rotateButton.setToolTipText( GettextResource.gettext(config.getI18nResourceBundle(), "Rotate clockwise selected pages") + " " + GettextResource.gettext(config.getI18nResourceBundle(), "(Alt+ArrowRight)")); rotateButton.addKeyListener(new EnterDoClickListener(rotateButton)); rotateButton.setAlignmentX(Component.CENTER_ALIGNMENT); addButtonToButtonPanel(rotateButton); //rotate button rotateAntiButton = new JButton(); rotateAntiButton.addActionListener(pageActionListener); rotateAntiButton.setIcon(new ImageIcon(this.getClass().getResource("/images/anticlockwise.png"))); rotateAntiButton.setActionCommand(PagesWorker.ROTATE_ANTICLOCK); rotateAntiButton.setMargin(new Insets(2, 2, 2, 2)); rotateAntiButton.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Rotate left")); rotateAntiButton.setToolTipText( GettextResource.gettext(config.getI18nResourceBundle(), "Rotate anticlockwise selected pages") + " " + GettextResource.gettext(config.getI18nResourceBundle(), "(Alt+ArrowLeft)")); rotateAntiButton.addKeyListener(new EnterDoClickListener(rotateAntiButton)); rotateAntiButton.setAlignmentX(Component.CENTER_ALIGNMENT); addButtonToButtonPanel(rotateAntiButton); //reverse button reverseButton = new JButton(); reverseButton.addActionListener(pageActionListener); reverseButton.setIcon(new ImageIcon(this.getClass().getResource("/images/reverse.png"))); reverseButton.setActionCommand(PagesWorker.REVERSE); reverseButton.setMargin(new Insets(2, 2, 2, 2)); reverseButton.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Reverse")); reverseButton .setToolTipText(GettextResource.gettext(config.getI18nResourceBundle(), "Reverse pages order")); reverseButton.addKeyListener(new EnterDoClickListener(reverseButton)); reverseButton.setAlignmentX(Component.CENTER_ALIGNMENT); addButtonToButtonPanel(reverseButton); }
From source file:org.pegadi.client.LoginDialog.java
private void jbInit() { Locale.setDefault(new Locale("no", "NO")); this.setTitle(str.getString("title")); this.addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(WindowEvent e) { this_windowOpened(e); }/*www.j a v a 2s . co m*/ }); loginLabel.setText(str.getString("login")); userNameLabel.setText(str.getString("username")); okButton.setText("OK"); okButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { okButton_actionPerformed(e); } }); quitButton.setText(str.getString("quit")); quitButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { quitButton_actionPerformed(e); } }); userNameField.setColumns(10); userNameField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(KeyEvent e) { userNameField_keyReleased(e); } }); passwordLabel.setText(str.getString("password")); passwordField.setColumns(10); passwordField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(KeyEvent e) { passwordField_keyReleased(e); } }); serverLabel.setText(str.getString("server")); Set keyset = servers.keySet(); for (Object aKeyset : keyset) { String serverKey = (String) aKeyset; serverChooser.addItem(serverKey); } serverChooser.setEnabled(false); // gui starts JPanel mainPanel = new JPanel(); this.getContentPane().add(mainPanel); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); JPanel labelPanel = new JPanel(); loginLabel.setFont(new Font(null, Font.PLAIN, 20)); // add icon URL iu = getClass().getResource("/images/pegadi_icon.png"); Image icon = Toolkit.getDefaultToolkit().getImage(iu); MediaTracker mt = new MediaTracker(this); mt.addImage(icon, 0); try { mt.waitForID(0); } catch (InterruptedException ie) { icon = null; } if (icon != null) { loginLabel.setIcon(new ImageIcon(icon)); loginLabel.setVerticalTextPosition(JLabel.BOTTOM); loginLabel.setHorizontalTextPosition(JLabel.CENTER); } labelPanel.add(loginLabel); labelPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); mainPanel.add(labelPanel); JPanel fieldPanel = new JPanel(new SpringLayout()); fieldPanel.add(userNameLabel); fieldPanel.add(userNameField); fieldPanel.add(passwordLabel); fieldPanel.add(passwordField); fieldPanel.add(serverLabel); fieldPanel.add(serverChooser); SpringUtilities.makeCompactGrid(fieldPanel, 3, 2, //rows, cols 5, 5, //initialX, initialY 10, 5);//xPad, yPad mainPanel.add(fieldPanel); JPanel buttonPanel = new JPanel(); JPanel buttonWrapperPanel = new JPanel(); buttonPanel.setLayout(new BorderLayout()); buttonWrapperPanel.add(okButton); buttonWrapperPanel.add(quitButton); buttonPanel.add(buttonWrapperPanel, BorderLayout.CENTER); buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); mainPanel.add(buttonPanel); }
From source file:org.processmining.analysis.performance.dottedchart.ui.MetricsPanel.java
/** * Displays the performance metrics of each pattern on the east side of the * plug-in window.//from ww w . j a v a 2s . c om * * @param sortedArray * int[] */ public void displayPerformanceMetrics() { String type = dcPanel.getTimeOption(); ArrayList<DescriptiveStatistics> aList = dcModel.getTimeStatistics(); ArrayList<String> aTitles = dcModel.getDescriptiveStatisticsTitles(); ArrayList<String> sortedTitleList = dcModel.getSortedKeySetList(); this.removeAll(); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // add time option menu this.add(Box.createRigidArea(new Dimension(5, 10))); JPanel menuPanel = new JPanel(new BorderLayout()); menuPanel.setPreferredSize(new Dimension(160, 45)); menuPanel.setMaximumSize(new Dimension(180, 45)); timeSortLabel.setAlignmentX(LEFT_ALIGNMENT); menuPanel.add(timeSortLabel, BorderLayout.NORTH); timeBox.setMaximumSize(new Dimension(160, 20)); timeBox.setAlignmentX(LEFT_ALIGNMENT); menuPanel.add(Box.createRigidArea(new Dimension(5, 0))); menuPanel.add(timeBox, BorderLayout.CENTER); this.add(menuPanel); this.add(Box.createRigidArea(new Dimension(5, 10))); // for each frequency get the set of patterns that have that frequency // (run from high frequency to low) int size = 0; for (int i = 0; i < aList.size(); i++) { try { String key; DescriptiveStatistics currentDS = null; if (i != 0) key = sortedTitleList.get(i - 1); else { key = aTitles.get(0); currentDS = aList.get(i); } if (i > 0 && dcModel.getTypeHashMap().equals(DottedChartPanel.ST_INST) && !dcModel.getInstanceTypeToKeep().contains(key)) continue; size++; if (i > 0) { for (int j = 1; j < aTitles.size(); j++) { if (aTitles.get(j).equals(key)) currentDS = aList.get(j); } } AbstractTableModel otm; // create labels that contains information about the pattern if (i == 0) otm = new OverallMetricTableModel(); else otm = new OneMetricTableModel(); DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer(); dtcr.setBackground(new Color(235, 235, 235)); JTable table = new JTable(otm); table.setPreferredSize(new Dimension(200, 55)); table.setMaximumSize(new Dimension(200, 55)); table.getColumnModel().getColumn(0).setPreferredWidth(70); table.getColumnModel().getColumn(0).setMaxWidth(100); table.getTableHeader().setFont(new Font("SansSerif", Font.PLAIN, 12)); table.getColumnModel().getColumn(0).setCellRenderer(dtcr); table.setBorder(BorderFactory.createEtchedBorder()); // place throughput times in table if (type.equals(DottedChartPanel.TIME_ACTUAL)) { if (i == 0) { table.setValueAt(DateFormat.getInstance().format(dcModel.getLogBoundaryLeft()), 0, 1); table.setValueAt(DateFormat.getInstance().format(dcModel.getLogBoundaryRight()), 1, 1); } else { table.setValueAt(DateFormat.getInstance().format(dcModel.getStartDateofLogUniList(key)), 0, 1); table.setValueAt(DateFormat.getInstance().format(dcModel.getEndDateofLogUniList(key)), 1, 1); } table.setValueAt(formatString(currentDS.getMean() / timeDivider, 5), 2, 1); table.setValueAt(formatString(currentDS.getMin() / timeDivider, 5), 3, 1); table.setValueAt(formatString(currentDS.getMax() / timeDivider, 5), 4, 1); } else if (type.equals(DottedChartPanel.TIME_RELATIVE_TIME)) { if (i == 0) { table.setValueAt(formatDate(dcModel.getLogBoundaryLeft()), 0, 1); table.setValueAt(formatDate(dcModel.getLogBoundaryRight()), 1, 1); } else { table.setValueAt(formatDate(dcModel.getStartDateofLogUniList(key)), 0, 1); table.setValueAt(formatDate(dcModel.getEndDateofLogUniList(key)), 1, 1); } table.setValueAt(formatString(currentDS.getMean() / timeDivider, 5), 2, 1); table.setValueAt(formatString(currentDS.getMin() / timeDivider, 5), 3, 1); table.setValueAt(formatString(currentDS.getMax() / timeDivider, 5), 4, 1); } else if (type.equals(DottedChartPanel.TIME_RELATIVE_RATIO)) { if (i == 0) { table.setValueAt(formatRatio(dcModel.getLogBoundaryLeft()), 0, 1); table.setValueAt(formatRatio(dcModel.getLogBoundaryRight()), 1, 1); } else { table.setValueAt(formatRatio(dcModel.getStartDateofLogUniList(key)), 0, 1); table.setValueAt(formatRatio(dcModel.getEndDateofLogUniList(key)), 1, 1); } table.setValueAt(formatString(currentDS.getMean() / 100, 5), 2, 1); table.setValueAt(formatString(currentDS.getMin() / 100, 5), 3, 1); table.setValueAt(formatString(currentDS.getMax() / 100, 5), 4, 1); } else if (type.equals(DottedChartPanel.TIME_LOGICAL) || type.equals(DottedChartPanel.TIME_LOGICAL_RELATIVE)) { if (i == 0) { table.setValueAt(formatString(dcModel.getLogBoundaryLeft().getTime(), 5), 0, 1); table.setValueAt(formatString(dcModel.getLogBoundaryRight().getTime(), 5), 1, 1); } else { table.setValueAt(formatString((dcModel.getStartDateofLogUniList(key)).getTime(), 5), 0, 1); table.setValueAt(formatString((dcModel.getEndDateofLogUniList(key)).getTime(), 5), 1, 1); } table.setValueAt(formatString(currentDS.getMean(), 5), 2, 1); table.setValueAt(formatString(currentDS.getMin(), 5), 3, 1); table.setValueAt(formatString(currentDS.getMax(), 5), 4, 1); } JPanel tempPanel = new JPanel(new BorderLayout()); table.setAlignmentX(CENTER_ALIGNMENT); tempPanel.setPreferredSize(new Dimension(160, 98)); tempPanel.setMaximumSize(new Dimension(180, 98)); tempPanel.add(table.getTableHeader(), BorderLayout.NORTH); tempPanel.add(table, BorderLayout.CENTER); JPanel tempPanel2 = new JPanel(new BorderLayout()); JLabel patternLabel = new JLabel("Component " + key + ":"); patternLabel.setAlignmentX(LEFT_ALIGNMENT); JLabel frequencyLabel = null; if (i == 0) frequencyLabel = new JLabel("# of components: " + currentDS.getN()); else frequencyLabel = new JLabel("# of dots: " + dcModel.getNumberOfLogUnits(key)); frequencyLabel.setAlignmentX(LEFT_ALIGNMENT); frequencyLabel.setFont(new Font("SansSerif", Font.PLAIN, 12)); tempPanel2.add(patternLabel, BorderLayout.NORTH); tempPanel2.add(frequencyLabel, BorderLayout.CENTER); tempPanel2.add(tempPanel, BorderLayout.SOUTH); this.add(tempPanel2); this.add(Box.createRigidArea(new Dimension(5, 10))); } catch (NullPointerException ex) { // can occur when patternMap does not contain a pattern with // this frequency size--; } } // make sure the pattern performance information is displayed properly this.setPreferredSize(new Dimension(200, 140 * (size + 1))); this.revalidate(); this.repaint(); }
From source file:org.processmining.analysis.performance.fsmevaluator.FSMEvaluationAnalysisUI.java
public void buildMainMenuGui() { // create configuration panel configurationPanel = new JPanel(); configurationPanel.setBackground(colorTextAreaBg); configurationPanel.setForeground(colorFg); configurationPanel.setLayout(new BoxLayout(configurationPanel, BoxLayout.Y_AXIS)); configurationPanel.setBorder(BorderFactory.createEmptyBorder()); // add header configurationPanel = new JPanel(); configurationPanel.setBorder(BorderFactory.createEmptyBorder()); configurationPanel.setLayout(new BorderLayout()); configurationPanel.add(splitPane, BorderLayout.CENTER); // set configuration panel as displayed configurationPanel.revalidate();//from w w w. j a va2 s . c om this.removeAll(); this.add(configurationPanel, BorderLayout.CENTER); this.revalidate(); this.repaint(); }
From source file:org.processmining.analysis.performance.fsmevaluator.FSMEvaluationMenuUI.java
protected void showConfigurationPanel() { if (configurationPanel == null) { // setup configuration panel updateFrameworkResources();/* w w w . ja va 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.PerformanceAnalysisGUI.java
/** * Initializes the selectionPanel: Fills one combobox with all transitions * and places of the used Petri net, and one combobox with only transitions. * Initially nothing is selected in both comboboxes and the second combobox * is disabled./*from w w w . j a va 2 s. com*/ */ private void initializeSelection() { sb1 = new JComboBox(); sb1.setMaximumSize(new Dimension(200, 20)); // SteppedComboBoxUI allows the pop-up menu to be of different width // than the width of the combobox, here sb1, itself sb1.setUI(new SteppedComboBoxUI()); sb1.setBorder(BorderFactory.createEtchedBorder()); sb2 = new JComboBox(); sb2.setUI(new SteppedComboBoxUI()); sb2.setMaximumSize(new Dimension(200, 20)); sb2.setBorder(BorderFactory.createEtchedBorder()); // Fill the boxes sb1.addItem("-------------"); sb2.addItem("-------------"); // add all places of the Petri net to the first selection box Iterator it = extendedPetriNet.getPlaces().iterator(); while (it.hasNext()) { Element current = (Element) it.next(); ExtendedPlace ep = (ExtendedPlace) current; String placeString = "Place - " + ep.getIdentifier(); sb1.addItem(placeString); if (boxMap.get(placeString) == null) { // and add the place to the boxMap if it is not already in it boxMap.put(placeString, current); } } // add all transitions of the Petri net to both selection boxes Iterator dit = extendedPetriNet.getTransitions().iterator(); while (dit.hasNext()) { Element current = (Element) dit.next(); ExtendedTransition et = (ExtendedTransition) current; try { String transString = "Transition - " + et.getLogEvent().getModelElementName() + " " + et.getLogEvent().getEventType(); if (boxMap.get(transString) == null) { // place transition in sb1 & sb2 sb1.addItem(transString); sb2.addItem(transString); // and add the transition to the boxMap boxMap.put(transString, current); } else { // at least one transition with the same name within the // boxMap // count the number of transitions in the boxMap having this // same name Iterator keys = boxMap.keySet().iterator(); int number = 0; while (keys.hasNext()) { String key = (String) keys.next(); if (key.startsWith(transString)) { number++; } } // add current transition to the boxMap, with between // brackets // its number (>=1) transString = "Transition - " + et.getLogEvent().getModelElementName() + " (" + number + ") " + " " + et.getLogEvent().getEventType(); // place transition in sb1 & sb2 sb1.addItem(transString); sb2.addItem(transString); boxMap.put(transString, current); } } catch (NullPointerException ne) { /* * Invisible transitions do not have a ModelElementName or * EventType, thus an exception occurs. It is caught here */ } } // place objects on the selectionPanel selectionPanel.setLayout(new BoxLayout(selectionPanel, BoxLayout.Y_AXIS)); selectionPanel.add(Box.createRigidArea(new Dimension(15, 10))); selectLabel.setFont(new Font("SansSerif", Font.BOLD, 14)); selectionPanel.add(selectLabel); selectionPanel.add(Box.createRigidArea(new Dimension(5, 5))); selectionPanel.add(sb1); selectionPanel.add(Box.createRigidArea(new Dimension(5, 10))); andLabel.setForeground(Color.GRAY); selectionPanel.add(andLabel); selectionPanel.add(Box.createRigidArea(new Dimension(5, 5))); sb1.setBackground(Color.white); sb2.setBackground(Color.white); sb2.setEnabled(false); selectionPanel.add(sb2); selectionPanel.setBackground(new Color(220, 220, 220)); selectLabel.setAlignmentX(LEFT_ALIGNMENT); sb1.setAlignmentX(LEFT_ALIGNMENT); andLabel.setAlignmentX(LEFT_ALIGNMENT); sb2.setAlignmentX(LEFT_ALIGNMENT); selectionPanel.setBorder(BorderFactory.createEtchedBorder()); selectionPanel.setPreferredSize(new Dimension(240, 140)); selectionPanel.setMinimumSize(new Dimension(240, 140)); }
From source file:org.prom5.analysis.performance.dottedchart.ui.MetricsPanel.java
/** * Displays the performance metrics of each pattern on the east side of the * plug-in window./*from w w w. j a v a 2 s. c o m*/ * @param sortedArray int[] */ public void displayPerformanceMetrics() { String type = dcPanel.getTimeOption(); ArrayList<DescriptiveStatistics> aList = dcModel.getTimeStatistics(); ArrayList<String> aTitles = dcModel.getDescriptiveStatisticsTitles(); ArrayList<String> sortedTitleList = dcModel.getSortedKeySetList(); this.removeAll(); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); //add time option menu this.add(Box.createRigidArea(new Dimension(5, 10))); JPanel menuPanel = new JPanel(new BorderLayout()); menuPanel.setPreferredSize(new Dimension(160, 45)); menuPanel.setMaximumSize(new Dimension(180, 45)); timeSortLabel.setAlignmentX(LEFT_ALIGNMENT); menuPanel.add(timeSortLabel, BorderLayout.NORTH); timeBox.setMaximumSize(new Dimension(160, 20)); timeBox.setAlignmentX(LEFT_ALIGNMENT); menuPanel.add(Box.createRigidArea(new Dimension(5, 0))); menuPanel.add(timeBox, BorderLayout.CENTER); this.add(menuPanel); this.add(Box.createRigidArea(new Dimension(5, 10))); //for each frequency get the set of patterns that have that frequency //(run from high frequency to low) int size = 0; for (int i = 0; i < aList.size(); i++) { try { String key; DescriptiveStatistics currentDS = null; if (i != 0) key = sortedTitleList.get(i - 1); else { key = aTitles.get(0); currentDS = aList.get(i); } if (i > 0 && dcModel.getTypeHashMap().equals(DottedChartPanel.ST_INST) && !dcModel.getInstanceTypeToKeep().contains(key)) continue; size++; if (i > 0) { for (int j = 1; j < aTitles.size(); j++) { if (aTitles.get(j).equals(key)) currentDS = aList.get(j); } } AbstractTableModel otm; //create labels that contains information about the pattern if (i == 0) otm = new OverallMetricTableModel(); else otm = new OneMetricTableModel(); DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer(); dtcr.setBackground(new Color(235, 235, 235)); JTable table = new JTable(otm); table.setPreferredSize(new Dimension(200, 55)); table.setMaximumSize(new Dimension(200, 55)); table.getColumnModel().getColumn(0).setPreferredWidth(70); table.getColumnModel().getColumn(0).setMaxWidth(100); table.getTableHeader().setFont(new Font("SansSerif", Font.PLAIN, 12)); table.getColumnModel().getColumn(0).setCellRenderer(dtcr); table.setBorder(BorderFactory.createEtchedBorder()); //place throughput times in table if (type.equals(DottedChartPanel.TIME_ACTUAL)) { if (i == 0) { table.setValueAt(DateFormat.getInstance().format(dcModel.getLogBoundaryLeft()), 0, 1); table.setValueAt(DateFormat.getInstance().format(dcModel.getLogBoundaryRight()), 1, 1); } else { table.setValueAt(DateFormat.getInstance().format(dcModel.getStartDateofLogUniList(key)), 0, 1); table.setValueAt(DateFormat.getInstance().format(dcModel.getEndDateofLogUniList(key)), 1, 1); } table.setValueAt(formatString(currentDS.getMean() / timeDivider, 5), 2, 1); table.setValueAt(formatString(currentDS.getMin() / timeDivider, 5), 3, 1); table.setValueAt(formatString(currentDS.getMax() / timeDivider, 5), 4, 1); } else if (type.equals(DottedChartPanel.TIME_RELATIVE_TIME)) { if (i == 0) { table.setValueAt(formatDate(dcModel.getLogBoundaryLeft()), 0, 1); table.setValueAt(formatDate(dcModel.getLogBoundaryRight()), 1, 1); } else { table.setValueAt(formatDate(dcModel.getStartDateofLogUniList(key)), 0, 1); table.setValueAt(formatDate(dcModel.getEndDateofLogUniList(key)), 1, 1); } table.setValueAt(formatString(currentDS.getMean() / timeDivider, 5), 2, 1); table.setValueAt(formatString(currentDS.getMin() / timeDivider, 5), 3, 1); table.setValueAt(formatString(currentDS.getMax() / timeDivider, 5), 4, 1); } else if (type.equals(DottedChartPanel.TIME_RELATIVE_RATIO)) { if (i == 0) { table.setValueAt(formatRatio(dcModel.getLogBoundaryLeft()), 0, 1); table.setValueAt(formatRatio(dcModel.getLogBoundaryRight()), 1, 1); } else { table.setValueAt(formatRatio(dcModel.getStartDateofLogUniList(key)), 0, 1); table.setValueAt(formatRatio(dcModel.getEndDateofLogUniList(key)), 1, 1); } table.setValueAt(formatString(currentDS.getMean() / 100, 5), 2, 1); table.setValueAt(formatString(currentDS.getMin() / 100, 5), 3, 1); table.setValueAt(formatString(currentDS.getMax() / 100, 5), 4, 1); } else if (type.equals(DottedChartPanel.TIME_LOGICAL) || type.equals(DottedChartPanel.TIME_LOGICAL_RELATIVE)) { if (i == 0) { table.setValueAt(formatString(dcModel.getLogBoundaryLeft().getTime(), 5), 0, 1); table.setValueAt(formatString(dcModel.getLogBoundaryRight().getTime(), 5), 1, 1); } else { table.setValueAt(formatString((dcModel.getStartDateofLogUniList(key)).getTime(), 5), 0, 1); table.setValueAt(formatString((dcModel.getEndDateofLogUniList(key)).getTime(), 5), 1, 1); } table.setValueAt(formatString(currentDS.getMean(), 5), 2, 1); table.setValueAt(formatString(currentDS.getMin(), 5), 3, 1); table.setValueAt(formatString(currentDS.getMax(), 5), 4, 1); } JPanel tempPanel = new JPanel(new BorderLayout()); table.setAlignmentX(CENTER_ALIGNMENT); tempPanel.setPreferredSize(new Dimension(160, 98)); tempPanel.setMaximumSize(new Dimension(180, 98)); tempPanel.add(table.getTableHeader(), BorderLayout.NORTH); tempPanel.add(table, BorderLayout.CENTER); JPanel tempPanel2 = new JPanel(new BorderLayout()); JLabel patternLabel = new JLabel("Component " + key + ":"); patternLabel.setAlignmentX(LEFT_ALIGNMENT); JLabel frequencyLabel = null; if (i == 0) frequencyLabel = new JLabel("# of components: " + currentDS.getN()); else frequencyLabel = new JLabel("# of dots: " + dcModel.getNumberOfLogUnits(key)); frequencyLabel.setAlignmentX(LEFT_ALIGNMENT); frequencyLabel.setFont(new Font("SansSerif", Font.PLAIN, 12)); tempPanel2.add(patternLabel, BorderLayout.NORTH); tempPanel2.add(frequencyLabel, BorderLayout.CENTER); tempPanel2.add(tempPanel, BorderLayout.SOUTH); this.add(tempPanel2); this.add(Box.createRigidArea(new Dimension(5, 10))); } catch (NullPointerException ex) { //can occur when patternMap does not contain a pattern with this frequency size--; } } //make sure the pattern performance information is displayed properly this.setPreferredSize(new Dimension(200, 140 * (size + 1))); this.revalidate(); this.repaint(); }
From source file:org.prom5.analysis.performance.PerformanceAnalysisGUI.java
/** * Initializes the selectionPanel:// www .j av a 2 s. c om * Fills one combobox with all transitions and places of the used Petri net, * and one combobox with only transitions. * Initially nothing is selected in both comboboxes and the second combobox * is disabled. */ private void initializeSelection() { sb1 = new JComboBox(); sb1.setMaximumSize(new Dimension(200, 20)); //SteppedComboBoxUI allows the pop-up menu to be of different width //than the width of the combobox, here sb1, itself sb1.setUI(new SteppedComboBoxUI()); sb1.setBorder(BorderFactory.createEtchedBorder()); sb2 = new JComboBox(); sb2.setUI(new SteppedComboBoxUI()); sb2.setMaximumSize(new Dimension(200, 20)); sb2.setBorder(BorderFactory.createEtchedBorder()); //Fill the boxes sb1.addItem("-------------"); sb2.addItem("-------------"); //add all places of the Petri net to the first selection box Iterator it = extendedPetriNet.getPlaces().iterator(); while (it.hasNext()) { Element current = (Element) it.next(); ExtendedPlace ep = (ExtendedPlace) current; String placeString = "Place - " + ep.getIdentifier(); sb1.addItem(placeString); if (boxMap.get(placeString) == null) { //and add the place to the boxMap if it is not already in it boxMap.put(placeString, current); } } //add all transitions of the Petri net to both selection boxes Iterator dit = extendedPetriNet.getTransitions().iterator(); while (dit.hasNext()) { Element current = (Element) dit.next(); ExtendedTransition et = (ExtendedTransition) current; try { String transString = "Transition - " + et.getLogEvent().getModelElementName() + " " + et.getLogEvent().getEventType(); if (boxMap.get(transString) == null) { //place transition in sb1 & sb2 sb1.addItem(transString); sb2.addItem(transString); //and add the transition to the boxMap boxMap.put(transString, current); } else { //at least one transition with the same name within the boxMap //count the number of transitions in the boxMap having this same name Iterator keys = boxMap.keySet().iterator(); int number = 0; while (keys.hasNext()) { String key = (String) keys.next(); if (key.startsWith(transString)) { number++; } } //add current transition to the boxMap, with between brackets //its number (>=1) transString = "Transition - " + et.getLogEvent().getModelElementName() + " (" + number + ") " + " " + et.getLogEvent().getEventType(); //place transition in sb1 & sb2 sb1.addItem(transString); sb2.addItem(transString); boxMap.put(transString, current); } } catch (NullPointerException ne) { /* Invisible transitions do not have a ModelElementName or EventType, thus an exception occurs. It is caught here */ } } //place objects on the selectionPanel selectionPanel.setLayout(new BoxLayout(selectionPanel, BoxLayout.Y_AXIS)); selectionPanel.add(Box.createRigidArea(new Dimension(15, 10))); selectLabel.setFont(new Font("SansSerif", Font.BOLD, 14)); selectionPanel.add(selectLabel); selectionPanel.add(Box.createRigidArea(new Dimension(5, 5))); selectionPanel.add(sb1); selectionPanel.add(Box.createRigidArea(new Dimension(5, 10))); andLabel.setForeground(Color.GRAY); selectionPanel.add(andLabel); selectionPanel.add(Box.createRigidArea(new Dimension(5, 5))); sb1.setBackground(Color.white); sb2.setBackground(Color.white); sb2.setEnabled(false); selectionPanel.add(sb2); selectionPanel.setBackground(new Color(220, 220, 220)); selectLabel.setAlignmentX(LEFT_ALIGNMENT); sb1.setAlignmentX(LEFT_ALIGNMENT); andLabel.setAlignmentX(LEFT_ALIGNMENT); sb2.setAlignmentX(LEFT_ALIGNMENT); selectionPanel.setBorder(BorderFactory.createEtchedBorder()); selectionPanel.setPreferredSize(new Dimension(240, 140)); selectionPanel.setMinimumSize(new Dimension(240, 140)); }
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 w w . j a v a 2 s. c o 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(); }