List of usage examples for javax.swing BorderFactory createEtchedBorder
public static Border createEtchedBorder()
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 . jav a 2 s . c om */ 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.processmining.analysis.performance.PerformanceAnalysisGUI.java
/** * Retrieves the values of process-related metrics, based on the process * instances in piList and displays these on the UI. * /*w ww. jav a 2 s . c o m*/ * @param piList * ArrayList: Process instances */ private void displayProcessMetrics(ArrayList piList) { try { // calculate the process metrics, based on the selected instances, // using the advancedSettings on how to deal with fitting. replayResult.calculateMetrics(piList, advancedSettings[0]); // initialize the processTable OneMetricTableModel ptm = new OneMetricTableModel(); ptm.setHeadings("", "Throughput time (" + timeSort + ")"); DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer(); dtcr.setBackground(new Color(235, 235, 235)); processTable.setModel(ptm); processTable.setPreferredSize(new Dimension(240, 112)); processTable.getColumnModel().getColumn(0).setPreferredWidth(50); processTable.getColumnModel().getColumn(0).setMaxWidth(150); processTable.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 12)); processTable.getColumnModel().getColumn(0).setCellRenderer(dtcr); processTable.setBorder(BorderFactory.createEtchedBorder()); // initialize labels arrivalProcessLabel.setText("Arrival rate:"); rateProcessLabel.setText(formatString(replayResult.getArrivalRate() * timeDivider, decimalPlaces) + " cases per " + timeSort.substring(0, timeSort.length() - 1)); casesProcessLabel.setText(piList.size() + " cases"); completedLabel.setText(replayResult.getProperFrequency() + " cases"); // fill the first column of the process table processTable.setValueAt("avg", 0, 0); processTable.setValueAt("min", 1, 0); processTable.setValueAt("max", 2, 0); processTable.setValueAt("stdev", 3, 0); DecimalFormat df = new DecimalFormat("0.00"); int[] sizes = replayResult.getSizes(fastestProcessPercentage, slowestProcessPercentage); processTable.setValueAt("fast " + df.format(fastestProcessPercentage) + "% (" + sizes[0] + ")", 4, 0); processTable.setValueAt("slow " + df.format(slowestProcessPercentage) + "%(" + sizes[1] + ")", 5, 0); processTable.setValueAt("normal " + df.format(100 - fastestProcessPercentage - slowestProcessPercentage) + "%(" + sizes[2] + ")", 6, 0); // place calculated values in the table processTable.setValueAt(formatString(replayResult.getMeanThroughputTime() / timeDivider, decimalPlaces), 0, 1); processTable.setValueAt( formatString((replayResult.getMinThroughputTime() * 1.0) / timeDivider, decimalPlaces), 1, 1); processTable.setValueAt( formatString((replayResult.getMaxThroughputTime() * 1.0) / timeDivider, decimalPlaces), 2, 1); processTable.setValueAt( formatString(replayResult.getStdevThroughputTime() / timeDivider, decimalPlaces), 3, 1); double[] avgTimes = replayResult.getAverageTimes(fastestProcessPercentage, slowestProcessPercentage); processTable.setValueAt(formatString(avgTimes[0] / timeDivider, decimalPlaces), 4, 1); processTable.setValueAt(formatString(avgTimes[1] / timeDivider, decimalPlaces), 5, 1); processTable.setValueAt(formatString(avgTimes[2] / timeDivider, decimalPlaces), 6, 1); processTable.revalidate(); } catch (Exception ex) { Message.add("Program exception while calculating process metrics.\n" + ex.toString(), 2); ex.printStackTrace(); } }
From source file:org.processmining.analysis.performance.PerformanceAnalysisGUI.java
/** * Calculates the metrics belonging to a place and displays the results. * /* w w w . ja v a2 s . c o m*/ * @param place * ExtendedPlace: the place of which the values of metrics are * calculated. */ private void displayPlaceMetrics(ExtendedPlace place) { ArrayList instanceIDList = getSelectedInstanceIDs(); tablePanel.removeAll(); tablePanel.add(placeTable.getTableHeader(), BorderLayout.PAGE_START); tablePanel.add(placeTable, BorderLayout.CENTER); try { // calculate place metrics place.calculateMetrics(instanceIDList, advancedSettings[1], failedInstances); // initialize the placeTable ThreeMetricsTableModel ptm = new ThreeMetricsTableModel(); ptm.setHeadings("", "Waiting time (" + timeSort + ")", "Synchronization time (" + timeSort + ")", "Sojourn time (" + timeSort + ")"); placeTable.setModel(ptm); placeTable.setBorder(BorderFactory.createEtchedBorder()); placeTable.setPreferredSize(new Dimension(480, 112)); placeTable.setMinimumSize(new Dimension(480, 112)); placeTable.getColumnModel().getColumn(0).setPreferredWidth(60); placeTable.getColumnModel().getColumn(0).setMaxWidth(150); placeTable.getColumnModel().getColumn(2).setPreferredWidth(100); placeTable.setRowSelectionAllowed(false); placeTable.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 12)); DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer(); dtcr.setBackground(new Color(235, 235, 235)); dtcr.setFont(new Font("SansSerif", Font.BOLD, 12)); placeTable.getColumnModel().getColumn(0).setCellRenderer(dtcr); // place time metrics in the table placeTable.setValueAt(formatString(place.getMeanWaitingTime() / timeDivider, decimalPlaces), 0, 1); placeTable.setValueAt(formatString(place.getMeanSynchronizationTime() / timeDivider, decimalPlaces), 0, 2); placeTable.setValueAt(formatString(place.getMeanSojournTime() / timeDivider, decimalPlaces), 0, 3); placeTable.setValueAt(formatString((place.getMinWaitingTime() * 1.0) / timeDivider, decimalPlaces), 1, 1); placeTable.setValueAt( formatString((place.getMinSynchronizationTime() * 1.0) / timeDivider, decimalPlaces), 1, 2); placeTable.setValueAt(formatString((place.getMinSojournTime() * 1.0) / timeDivider, decimalPlaces), 1, 3); placeTable.setValueAt(formatString((place.getMaxWaitingTime() * 1.0) / timeDivider, decimalPlaces), 2, 1); placeTable.setValueAt( formatString((place.getMaxSynchronizationTime() * 1.0) / timeDivider, decimalPlaces), 2, 2); placeTable.setValueAt(formatString((place.getMaxSojournTime() * 1.0) / timeDivider, decimalPlaces), 2, 3); placeTable.setValueAt(formatString(place.getStdevWaitingTime() / timeDivider, decimalPlaces), 3, 1); placeTable.setValueAt(formatString(place.getStdevSynchronizationTime() / timeDivider, decimalPlaces), 3, 2); placeTable.setValueAt(formatString(place.getStdevSojournTime() / timeDivider, decimalPlaces), 3, 3); double[] avgTimes = place.getAvgTimes(fastestPlacePercentage, slowestPlacePercentage); placeTable.setValueAt(formatString(avgTimes[0] / timeDivider, decimalPlaces), 4, 1); placeTable.setValueAt(formatString(avgTimes[1] / timeDivider, decimalPlaces), 4, 2); placeTable.setValueAt(formatString(avgTimes[2] / timeDivider, decimalPlaces), 4, 3); placeTable.setValueAt(formatString(avgTimes[3] / timeDivider, decimalPlaces), 5, 1); placeTable.setValueAt(formatString(avgTimes[4] / timeDivider, decimalPlaces), 5, 2); placeTable.setValueAt(formatString(avgTimes[5] / timeDivider, decimalPlaces), 5, 3); placeTable.setValueAt(formatString(avgTimes[6] / timeDivider, decimalPlaces), 6, 1); placeTable.setValueAt(formatString(avgTimes[7] / timeDivider, decimalPlaces), 6, 2); placeTable.setValueAt(formatString(avgTimes[8] / timeDivider, decimalPlaces), 6, 3); DecimalFormat df = new DecimalFormat("0.00"); int[] sizes = place.getSizes(fastestPlacePercentage, slowestPlacePercentage); placeTable.setValueAt("fast " + df.format(fastestPlacePercentage) + "%(" + sizes[0] + ")", 4, 0); placeTable.setValueAt("slow " + df.format(slowestPlacePercentage) + "%(" + sizes[1] + ")", 5, 0); placeTable.setValueAt("normal " + df.format(100 - fastestPlacePercentage - slowestPlacePercentage) + "%(" + sizes[2] + ")", 6, 0); titleLabel.setText("Performance information of the selected place:"); // display frequency of visits freqObjectLabel.setText(place.getFrequency() + " visits"); // display the arrival rate ratePlaceLabel.setText(formatString(place.getArrivalRate() * timeDivider, decimalPlaces) + " visits per " + timeSort.substring(0, timeSort.length() - 1)); placeTable.getTableHeader().setVisible(true); titleLabel.setVisible(true); numberObjectLabel.setVisible(true); freqObjectLabel.setVisible(true); arrivalPlaceLabel.setVisible(true); ratePlaceLabel.setVisible(true); changePercentagesButton.setVisible(true); changePercentagesButton.setPreferredSize(new Dimension(170, 25)); exportButton.setVisible(true); placeTable.repaint(); metricsBottomPanel.revalidate(); } catch (Exception ex) { Message.add("An internal error occured while calculating " + "place metrics.\n" + ex.toString(), 2); ex.printStackTrace(); } }
From source file:org.processmining.analysis.performance.PerformanceAnalysisGUI.java
/** * Calculates and displays values of 'time in between' metrics of two * transitions./*from w w w . j a v a 2 s . c o m*/ * * @param lastTransition * ExtendedTransition: one of the two transitions * @param otherTransition * ExtendedTransition: one of the two transitions */ private void displayTransitionMetrics(ExtendedTransition lastTransition, ExtendedTransition otherTransition) { // clear the table Panel tablePanel.removeAll(); // create a transition analysis object TransitionAnalysis ta = new TransitionAnalysis(lastTransition, otherTransition); try { // calculate the time-metrics ta.calculateMetrics(getSelectedInstanceIDs(), advancedSettings[2], failedInstances); // initialize the transition time-metrics table OneMetricTableModel ttm = new OneMetricTableModel(); ttm.setHeadings("", "Time in between (" + timeSort + ")"); transitionTable = new JTable(ttm); transitionTable.setBorder(BorderFactory.createEtchedBorder()); transitionTable.setPreferredSize(new Dimension(300, 112)); transitionTable.setMinimumSize(new Dimension(280, 112)); transitionTable.getColumnModel().getColumn(0).setPreferredWidth(80); transitionTable.getColumnModel().getColumn(0).setMaxWidth(150); transitionTable.setRowSelectionAllowed(false); transitionTable.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 12)); DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer(); dtcr.setBackground(new Color(235, 235, 235)); dtcr.setFont(new Font("SansSerif", Font.BOLD, 12)); transitionTable.getColumnModel().getColumn(0).setCellRenderer(dtcr); // add the table to the tablePanel tablePanel.add(transitionTable.getTableHeader(), BorderLayout.PAGE_START); tablePanel.add(transitionTable, BorderLayout.CENTER); // frequency of process instances in which both transitions occur freqObjectLabel.setText(ta.getFrequency() + "" + " cases"); // fill table with 'in-between-times' transitionTable.setValueAt(formatString(ta.getMeanTime() / timeDivider, decimalPlaces), 0, 1); transitionTable.setValueAt(formatString((ta.getMinTime() * 1.0) / timeDivider, decimalPlaces), 1, 1); transitionTable.setValueAt(formatString((ta.getMaxTime() * 1.0) / timeDivider, decimalPlaces), 2, 1); transitionTable.setValueAt(formatString(ta.getStdevTimeInBetween() / timeDivider, decimalPlaces), 3, 1); // place average of fastest traces in the table DecimalFormat df = new DecimalFormat("0.00"); int[] sizes = ta.getSizes(fastestBetweenPercentage, slowestBetweenPercentage); transitionTable.setValueAt("fast " + df.format(fastestBetweenPercentage) + "%(" + sizes[0] + ")", 4, 0); transitionTable.setValueAt("slow " + df.format(slowestBetweenPercentage) + "%(" + sizes[1] + ")", 5, 0); transitionTable.setValueAt("normal " + df.format(100 - fastestBetweenPercentage - slowestBetweenPercentage) + "%(" + sizes[2] + ")", 6, 0); double[] avgTimes = ta.getAverageTimes(fastestBetweenPercentage, slowestBetweenPercentage); transitionTable.setValueAt(formatString(avgTimes[0] / timeDivider, decimalPlaces), 4, 1); // place average of slowest traces in the table transitionTable.setValueAt(formatString(avgTimes[1] / timeDivider, decimalPlaces), 5, 1); // place average of other traces in the table transitionTable.setValueAt(formatString(avgTimes[2] / timeDivider, decimalPlaces), 6, 1); // make metrics visible changePercentagesButton.setVisible(true); exportButton.setVisible(true); titleLabel.setVisible(true); titleLabel.setText("Performance information of the selected transitions:"); numberObjectLabel.setVisible(true); freqObjectLabel.setVisible(true); transitionTable.repaint(); metricsBottomPanel.revalidate(); } catch (Exception ex) { Message.add( "An internal error occured while calculating" + " time in between metrics.\n" + ex.toString(), 2); ex.printStackTrace(); } }
From source file:org.processmining.analysis.performance.PerformanceAnalysisGUI.java
/** * Calculates metrics related to activities, such as waiting time, execution * time and throughput time. and displays these on the metricsBottomPanel, * //from w ww.j a v a 2 s . c o m * @param activity * ExtendedActivity: the activity involved */ private void displayActivityMetrics(ExtendedActivity activity) { tablePanel.removeAll(); try { // calculate time-metrics of the activity based on the selected // instances activity.calculateMetrics(getSelectedInstanceIDs(), advancedSettings[3], failedInstances); activity.checkWhichMetricsToUse(); // initialize the activityTable ThreeMetricsRowExtraTableModel atm = new ThreeMetricsRowExtraTableModel(); atm.setHeadings("", "Waiting time (" + timeSort + ")", "Execution" + " time (" + timeSort + ")", "Sojourn time (" + timeSort + ")"); activityTable.setModel(atm); activityTable.setBorder(BorderFactory.createEtchedBorder()); activityTable.setPreferredSize(new Dimension(480, 128)); activityTable.setMinimumSize(new Dimension(480, 128)); activityTable.getColumnModel().getColumn(0).setPreferredWidth(60); activityTable.getColumnModel().getColumn(0).setMaxWidth(150); DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer(); dtcr.setBackground(new Color(235, 235, 235)); activityTable.getColumnModel().getColumn(0).setCellRenderer(dtcr); activityTable.setRowSelectionAllowed(false); activityTable.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 12)); /* * Iterator entries = mapping.entrySet().iterator(); while * (entries.hasNext()) { Map.Entry entr = (Map.Entry) * entries.next(); if (entr.getKey() instanceof ExtendedTransition) * { ExtendedTransition transition = (ExtendedTransition) * entr.getKey(); ExtendedActivity act = * transition.getAssociatedActivity(); if (act != null) { * act.calculateMetrics(getSelectedInstanceIDs(), * advancedSettings[3], failedInstances); * act.checkWhichMetricsToUse(); act.getArrivalRate(); } } } */ // fill table with the calculated activity time-metrics TableCellRenderer renderer = new CustomTableCellRenderer(activity.getBoundWaitingUsed(), activity.getBoundExecutionUsed(), activity.getBoundSojournUsed()); activityTable.setDefaultRenderer(Class.forName("java.lang.String"), renderer); activityTable.setValueAt(formatString(activity.getMeanWaitTime() / timeDivider, decimalPlaces), 0, 1); activityTable.setValueAt(formatString(activity.getMeanExecutionTime() / timeDivider, decimalPlaces), 0, 2); activityTable.setValueAt(formatString(activity.getMeanSojournTime() / timeDivider, decimalPlaces), 0, 3); activityTable.setValueAt(formatString(activity.getMinWaitTime() / timeDivider, decimalPlaces), 1, 1); activityTable.setValueAt(formatString(activity.getMinExecutionTime() / timeDivider, decimalPlaces), 1, 2); activityTable.setValueAt(formatString(activity.getMinSojournTime() / timeDivider, decimalPlaces), 1, 3); activityTable.setValueAt(formatString(activity.getMaxWaitTime() / timeDivider, decimalPlaces), 2, 1); activityTable.setValueAt(formatString(activity.getMaxExecutionTime() / timeDivider, decimalPlaces), 2, 2); activityTable.setValueAt(formatString(activity.getMaxSojournTime() / timeDivider, decimalPlaces), 2, 3); activityTable.setValueAt(formatString(activity.getStdevWaitTime() / timeDivider, decimalPlaces), 3, 1); activityTable.setValueAt(formatString(activity.getStdevExecutionTime() / timeDivider, decimalPlaces), 3, 2); activityTable.setValueAt(formatString(activity.getStdevSojournTime() / timeDivider, decimalPlaces), 3, 3); double[] avgWaitTimes = activity.getAvgWaitTimes(fastestActivityPercentage, slowestActivityPercentage); double[] avgExecutionTimes = activity.getAvgExecutionTimes(fastestActivityPercentage, slowestActivityPercentage); double[] avgThroughputTimes = activity.getAvgSojournTimes(fastestActivityPercentage, slowestActivityPercentage); activityTable.setValueAt(formatString(avgWaitTimes[0] / timeDivider, decimalPlaces), 4, 1); activityTable.setValueAt(formatString(avgExecutionTimes[0] / timeDivider, decimalPlaces), 4, 2); activityTable.setValueAt(formatString(avgThroughputTimes[0] / timeDivider, decimalPlaces), 4, 3); activityTable.setValueAt(formatString(avgWaitTimes[1] / timeDivider, decimalPlaces), 5, 1); activityTable.setValueAt(formatString(avgExecutionTimes[1] / timeDivider, decimalPlaces), 5, 2); activityTable.setValueAt(formatString(avgThroughputTimes[1] / timeDivider, decimalPlaces), 5, 3); activityTable.setValueAt(formatString(avgWaitTimes[2] / timeDivider, decimalPlaces), 6, 1); activityTable.setValueAt(formatString(avgExecutionTimes[2] / timeDivider, decimalPlaces), 6, 2); activityTable.setValueAt(formatString(avgThroughputTimes[2] / timeDivider, decimalPlaces), 6, 3); activityTable.setValueAt(activity.getFrequencyWait() + "", 7, 1); activityTable.setValueAt(activity.getFrequencyExecution() + "", 7, 2); activityTable.setValueAt(activity.getFrequencySojourn() + "", 7, 3); DecimalFormat df = new DecimalFormat("0.00"); activityTable.setValueAt("fast " + df.format(fastestActivityPercentage) + "%", 4, 0); activityTable.setValueAt("slow " + df.format(slowestActivityPercentage) + "%", 5, 0); activityTable.setValueAt( "normal " + df.format(100 - fastestActivityPercentage - slowestActivityPercentage) + "%", 6, 0); ratePlaceLabel.setText(formatString(activity.getArrivalRate() * timeDivider, decimalPlaces) + " visits per " + timeSort.substring(0, timeSort.length() - 1)); // add the table to the tablePanel tablePanel.add(activityTable.getTableHeader(), BorderLayout.PAGE_START); tablePanel.add(activityTable, BorderLayout.CENTER); // display the title titleLabel.setText("Performance information of activity " + activity.getName() + ":"); titleLabel.setVisible(true); arrivalPlaceLabel.setVisible(true); ratePlaceLabel.setVisible(true); changePercentagesButton.setVisible(true); exportButton.setVisible(true); activityTable.repaint(); metricsBottomPanel.revalidate(); } catch (Exception ex) { Message.add("An internal error occured while calculating " + " activity metrics.\n" + ex.toString(), 2); ex.printStackTrace(); } }
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 www. j a va2 s . com*/ * @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
/** * Actually builds the UI/*from w w w . jav a2 s . c om*/ * @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
/** * Initializes the selectionPanel:/*w w w.jav a 2 s .co m*/ * 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.prom5.analysis.performance.PerformanceAnalysisGUI.java
/** * Retrieves the values of process-related metrics, based on the process * instances in piList and displays these on the UI. * @param piList ArrayList: Process instances *///from ww w . j ava 2 s . co m private void displayProcessMetrics(ArrayList piList) { try { //calculate the process metrics, based on the selected instances, //using the advancedSettings on how to deal with fitting. replayResult.calculateMetrics(piList, advancedSettings[0]); //initialize the processTable OneMetricTableModel ptm = new OneMetricTableModel(); ptm.setHeadings("", "Throughput time (" + timeSort + ")"); DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer(); dtcr.setBackground(new Color(235, 235, 235)); processTable.setModel(ptm); processTable.setPreferredSize(new Dimension(240, 112)); processTable.getColumnModel().getColumn(0).setPreferredWidth(50); processTable.getColumnModel().getColumn(0).setMaxWidth(150); processTable.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 12)); processTable.getColumnModel().getColumn(0).setCellRenderer(dtcr); processTable.setBorder(BorderFactory.createEtchedBorder()); //initialize labels arrivalProcessLabel.setText("Arrival rate:"); rateProcessLabel.setText(formatString(replayResult.getArrivalRate() * timeDivider, decimalPlaces) + " cases per " + timeSort.substring(0, timeSort.length() - 1)); casesProcessLabel.setText(piList.size() + " cases"); completedLabel.setText(replayResult.getProperFrequency() + " cases"); //fill the first column of the process table processTable.setValueAt("avg", 0, 0); processTable.setValueAt("min", 1, 0); processTable.setValueAt("max", 2, 0); processTable.setValueAt("stdev", 3, 0); DecimalFormat df = new DecimalFormat("0.00"); int[] sizes = replayResult.getSizes(fastestProcessPercentage, slowestProcessPercentage); processTable.setValueAt("fast " + df.format(fastestProcessPercentage) + "% (" + sizes[0] + ")", 4, 0); processTable.setValueAt("slow " + df.format(slowestProcessPercentage) + "%(" + sizes[1] + ")", 5, 0); processTable.setValueAt("normal " + df.format(100 - fastestProcessPercentage - slowestProcessPercentage) + "%(" + sizes[2] + ")", 6, 0); //place calculated values in the table processTable.setValueAt(formatString(replayResult.getMeanThroughputTime() / timeDivider, decimalPlaces), 0, 1); processTable.setValueAt( formatString((replayResult.getMinThroughputTime() * 1.0) / timeDivider, decimalPlaces), 1, 1); processTable.setValueAt( formatString((replayResult.getMaxThroughputTime() * 1.0) / timeDivider, decimalPlaces), 2, 1); processTable.setValueAt( formatString(replayResult.getStdevThroughputTime() / timeDivider, decimalPlaces), 3, 1); double[] avgTimes = replayResult.getAverageTimes(fastestProcessPercentage, slowestProcessPercentage); processTable.setValueAt(formatString(avgTimes[0] / timeDivider, decimalPlaces), 4, 1); processTable.setValueAt(formatString(avgTimes[1] / timeDivider, decimalPlaces), 5, 1); processTable.setValueAt(formatString(avgTimes[2] / timeDivider, decimalPlaces), 6, 1); processTable.revalidate(); } catch (Exception ex) { Message.add("Program exception while calculating process metrics.\n" + ex.toString(), 2); ex.printStackTrace(); } }
From source file:org.prom5.analysis.performance.PerformanceAnalysisGUI.java
/** * Calculates the metrics belonging to a place and displays the * results.//from ww w .j a v a 2 s . com * @param place ExtendedPlace: the place of which the values of metrics are * calculated. */ private void displayPlaceMetrics(ExtendedPlace place) { ArrayList instanceIDList = getSelectedInstanceIDs(); tablePanel.removeAll(); tablePanel.add(placeTable.getTableHeader(), BorderLayout.PAGE_START); tablePanel.add(placeTable, BorderLayout.CENTER); try { //calculate place metrics place.calculateMetrics(instanceIDList, advancedSettings[1], failedInstances); //initialize the placeTable ThreeMetricsTableModel ptm = new ThreeMetricsTableModel(); ptm.setHeadings("", "Waiting time (" + timeSort + ")", "Synchronization time (" + timeSort + ")", "Sojourn time (" + timeSort + ")"); placeTable.setModel(ptm); placeTable.setBorder(BorderFactory.createEtchedBorder()); placeTable.setPreferredSize(new Dimension(480, 112)); placeTable.setMinimumSize(new Dimension(480, 112)); placeTable.getColumnModel().getColumn(0).setPreferredWidth(60); placeTable.getColumnModel().getColumn(0).setMaxWidth(150); placeTable.getColumnModel().getColumn(2).setPreferredWidth(100); placeTable.setRowSelectionAllowed(false); placeTable.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 12)); DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer(); dtcr.setBackground(new Color(235, 235, 235)); dtcr.setFont(new Font("SansSerif", Font.BOLD, 12)); placeTable.getColumnModel().getColumn(0).setCellRenderer(dtcr); //place time metrics in the table placeTable.setValueAt(formatString(place.getMeanWaitingTime() / timeDivider, decimalPlaces), 0, 1); placeTable.setValueAt(formatString(place.getMeanSynchronizationTime() / timeDivider, decimalPlaces), 0, 2); placeTable.setValueAt(formatString(place.getMeanSojournTime() / timeDivider, decimalPlaces), 0, 3); placeTable.setValueAt(formatString((place.getMinWaitingTime() * 1.0) / timeDivider, decimalPlaces), 1, 1); placeTable.setValueAt( formatString((place.getMinSynchronizationTime() * 1.0) / timeDivider, decimalPlaces), 1, 2); placeTable.setValueAt(formatString((place.getMinSojournTime() * 1.0) / timeDivider, decimalPlaces), 1, 3); placeTable.setValueAt(formatString((place.getMaxWaitingTime() * 1.0) / timeDivider, decimalPlaces), 2, 1); placeTable.setValueAt( formatString((place.getMaxSynchronizationTime() * 1.0) / timeDivider, decimalPlaces), 2, 2); placeTable.setValueAt(formatString((place.getMaxSojournTime() * 1.0) / timeDivider, decimalPlaces), 2, 3); placeTable.setValueAt(formatString(place.getStdevWaitingTime() / timeDivider, decimalPlaces), 3, 1); placeTable.setValueAt(formatString(place.getStdevSynchronizationTime() / timeDivider, decimalPlaces), 3, 2); placeTable.setValueAt(formatString(place.getStdevSojournTime() / timeDivider, decimalPlaces), 3, 3); double[] avgTimes = place.getAvgTimes(fastestPlacePercentage, slowestPlacePercentage); placeTable.setValueAt(formatString(avgTimes[0] / timeDivider, decimalPlaces), 4, 1); placeTable.setValueAt(formatString(avgTimes[1] / timeDivider, decimalPlaces), 4, 2); placeTable.setValueAt(formatString(avgTimes[2] / timeDivider, decimalPlaces), 4, 3); placeTable.setValueAt(formatString(avgTimes[3] / timeDivider, decimalPlaces), 5, 1); placeTable.setValueAt(formatString(avgTimes[4] / timeDivider, decimalPlaces), 5, 2); placeTable.setValueAt(formatString(avgTimes[5] / timeDivider, decimalPlaces), 5, 3); placeTable.setValueAt(formatString(avgTimes[6] / timeDivider, decimalPlaces), 6, 1); placeTable.setValueAt(formatString(avgTimes[7] / timeDivider, decimalPlaces), 6, 2); placeTable.setValueAt(formatString(avgTimes[8] / timeDivider, decimalPlaces), 6, 3); DecimalFormat df = new DecimalFormat("0.00"); int[] sizes = place.getSizes(fastestPlacePercentage, slowestPlacePercentage); placeTable.setValueAt("fast " + df.format(fastestPlacePercentage) + "%(" + sizes[0] + ")", 4, 0); placeTable.setValueAt("slow " + df.format(slowestPlacePercentage) + "%(" + sizes[1] + ")", 5, 0); placeTable.setValueAt("normal " + df.format(100 - fastestPlacePercentage - slowestPlacePercentage) + "%(" + sizes[2] + ")", 6, 0); titleLabel.setText("Performance information of the selected place:"); //display frequency of visits freqObjectLabel.setText(place.getFrequency() + " visits"); //display the arrival rate ratePlaceLabel.setText(formatString(place.getArrivalRate() * timeDivider, decimalPlaces) + " visits per " + timeSort.substring(0, timeSort.length() - 1)); placeTable.getTableHeader().setVisible(true); titleLabel.setVisible(true); numberObjectLabel.setVisible(true); freqObjectLabel.setVisible(true); arrivalPlaceLabel.setVisible(true); ratePlaceLabel.setVisible(true); changePercentagesButton.setVisible(true); changePercentagesButton.setPreferredSize(new Dimension(170, 25)); exportButton.setVisible(true); placeTable.repaint(); metricsBottomPanel.revalidate(); } catch (Exception ex) { Message.add("An internal error occured while calculating " + "place metrics.\n" + ex.toString(), 2); ex.printStackTrace(); } }