List of usage examples for javax.swing JPanel setMaximumSize
@BeanProperty(description = "The maximum size of the component.") public void setMaximumSize(Dimension maximumSize)
From source file:org.apache.jmeter.protocol.http.config.gui.HttpDefaultsGui.java
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) setLayout(new BorderLayout(0, 5)); setBorder(makeBorder());// w w w. ja v a2 s. co m // URL CONFIG urlConfigGui = new UrlConfigGui(false, true, false); // AdvancedPanel (embedded resources, source address and optional tasks) JPanel advancedPanel = new VerticalPanel(); advancedPanel.add(createEmbeddedRsrcPanel()); advancedPanel.add(createSourceAddrPanel()); advancedPanel.add(createOptionalTasksPanel()); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.add(JMeterUtils.getResString("web_testing_basic"), urlConfigGui); tabbedPane.add(JMeterUtils.getResString("web_testing_advanced"), advancedPanel); JPanel emptyPanel = new JPanel(); emptyPanel.setMaximumSize(new Dimension()); add(makeTitlePanel(), BorderLayout.NORTH); add(tabbedPane, BorderLayout.CENTER); add(emptyPanel, BorderLayout.SOUTH); }
From source file:org.broad.igv.hic.MainWindow.java
private void initComponents() { JPanel mainPanel = new JPanel(); JPanel toolbarPanel = new JPanel(); //======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); mainPanel.setLayout(new BorderLayout()); toolbarPanel.setBorder(null);/*from ww w .j ava 2 s. com*/ toolbarPanel.setLayout(new GridLayout()); JPanel chrSelectionPanel = new JPanel(); chrSelectionPanel.setBorder(LineBorder.createGrayLineBorder()); chrSelectionPanel.setMinimumSize(new Dimension(130, 57)); chrSelectionPanel.setPreferredSize(new Dimension(130, 57)); chrSelectionPanel.setLayout(new BorderLayout()); JPanel panel10 = new JPanel(); panel10.setBackground(new Color(204, 204, 204)); panel10.setLayout(new BorderLayout()); JLabel label3 = new JLabel(); label3.setText("Chromosomes"); label3.setHorizontalAlignment(SwingConstants.CENTER); panel10.add(label3, BorderLayout.CENTER); chrSelectionPanel.add(panel10, BorderLayout.PAGE_START); JPanel panel9 = new JPanel(); panel9.setBackground(new Color(238, 238, 238)); panel9.setLayout(new BoxLayout(panel9, BoxLayout.X_AXIS)); //---- chrBox1 ---- chrBox1 = new JComboBox(); chrBox1.setModel(new DefaultComboBoxModel(new String[] { "All" })); chrBox1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { chrBox1ActionPerformed(e); } }); panel9.add(chrBox1); //---- chrBox2 ---- chrBox2 = new JComboBox(); chrBox2.setModel(new DefaultComboBoxModel(new String[] { "All" })); chrBox2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { chrBox2ActionPerformed(e); } }); panel9.add(chrBox2); //---- refreshButton ---- JideButton refreshButton = new JideButton(); refreshButton .setIcon(new ImageIcon(getClass().getResource("/toolbarButtonGraphics/general/Refresh24.gif"))); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { refreshButtonActionPerformed(e); } }); panel9.add(refreshButton); chrSelectionPanel.add(panel9, BorderLayout.CENTER); toolbarPanel.add(chrSelectionPanel); //======== displayOptionPanel ======== JPanel displayOptionPanel = new JPanel(); JPanel panel1 = new JPanel(); displayOptionComboBox = new JComboBox(); displayOptionPanel.setBackground(new Color(238, 238, 238)); displayOptionPanel.setBorder(LineBorder.createGrayLineBorder()); displayOptionPanel.setLayout(new BorderLayout()); //======== panel14 ======== JPanel panel14 = new JPanel(); panel14.setBackground(new Color(204, 204, 204)); panel14.setLayout(new BorderLayout()); //---- label4 ---- JLabel label4 = new JLabel(); label4.setText("Show"); label4.setHorizontalAlignment(SwingConstants.CENTER); panel14.add(label4, BorderLayout.CENTER); displayOptionPanel.add(panel14, BorderLayout.PAGE_START); //======== panel1 ======== panel1.setBorder(new EmptyBorder(0, 10, 0, 10)); panel1.setLayout(new GridLayout(1, 0, 20, 0)); //---- comboBox1 ---- displayOptionComboBox .setModel(new DefaultComboBoxModel(new String[] { DisplayOption.OBSERVED.toString() })); displayOptionComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { displayOptionComboBoxActionPerformed(e); } }); panel1.add(displayOptionComboBox); displayOptionPanel.add(panel1, BorderLayout.CENTER); toolbarPanel.add(displayOptionPanel); //======== colorRangePanel ======== JPanel colorRangePanel = new JPanel(); JLabel colorRangeLabel = new JLabel(); colorRangeSlider = new RangeSlider(); colorRangePanel.setBorder(LineBorder.createGrayLineBorder()); colorRangePanel.setMinimumSize(new Dimension(96, 70)); colorRangePanel.setPreferredSize(new Dimension(202, 70)); colorRangePanel.setMaximumSize(new Dimension(32769, 70)); colorRangePanel.setLayout(new BorderLayout()); //======== panel11 ======== JPanel colorLabelPanel = new JPanel(); colorLabelPanel.setBackground(new Color(204, 204, 204)); colorLabelPanel.setLayout(new BorderLayout()); //---- colorRangeLabel ---- colorRangeLabel.setText("Color Range"); colorRangeLabel.setHorizontalAlignment(SwingConstants.CENTER); colorRangeLabel.setToolTipText("Range of color scale in counts per mega-base squared."); colorRangeLabel.setHorizontalTextPosition(SwingConstants.CENTER); colorRangeLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { ColorRangeDialog rangeDialog = new ColorRangeDialog(MainWindow.this, colorRangeSlider); rangeDialog.setVisible(true); } } @Override public void mouseClicked(MouseEvent e) { ColorRangeDialog rangeDialog = new ColorRangeDialog(MainWindow.this, colorRangeSlider); rangeDialog.setVisible(true); } }); colorLabelPanel.add(colorRangeLabel, BorderLayout.CENTER); colorRangePanel.add(colorLabelPanel, BorderLayout.PAGE_START); //---- colorRangeSlider ---- colorRangeSlider.setPaintTicks(true); colorRangeSlider.setPaintLabels(true); colorRangeSlider.setLowerValue(0); colorRangeSlider.setMajorTickSpacing(500); colorRangeSlider.setMaximumSize(new Dimension(32767, 52)); colorRangeSlider.setPreferredSize(new Dimension(200, 52)); colorRangeSlider.setMinimumSize(new Dimension(36, 52)); colorRangeSlider.setMaximum(2000); colorRangeSlider.setUpperValue(500); colorRangeSlider.setMinorTickSpacing(100); colorRangeSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { colorRangeSliderStateChanged(e); } }); colorRangePanel.add(colorRangeSlider, BorderLayout.PAGE_END); // JPanel colorRangeTextPanel = new JPanel(); // colorRangeTextPanel.setLayout(new FlowLayout()); // JTextField minField = new JTextField(); // minField.setPreferredSize(new Dimension(50, 15)); // colorRangeTextPanel.add(minField); // colorRangeTextPanel.add(new JLabel(" - ")); // JTextField maxField = new JTextField(); // maxField.setPreferredSize(new Dimension(50, 15)); // colorRangeTextPanel.add(maxField); // colorRangeTextPanel.setPreferredSize(new Dimension(200, 52)); // colorRangePanel.add(colorRangeTextPanel, BorderLayout.PAGE_END); toolbarPanel.add(colorRangePanel); //======== resolutionPanel ======== JLabel resolutionLabel = new JLabel(); JPanel resolutionPanel = new JPanel(); resolutionPanel.setBorder(LineBorder.createGrayLineBorder()); resolutionPanel.setLayout(new BorderLayout()); //======== panel12 ======== JPanel panel12 = new JPanel(); panel12.setBackground(new Color(204, 204, 204)); panel12.setLayout(new BorderLayout()); //---- resolutionLabel ---- resolutionLabel.setText("Resolution"); resolutionLabel.setHorizontalAlignment(SwingConstants.CENTER); resolutionLabel.setBackground(new Color(204, 204, 204)); panel12.add(resolutionLabel, BorderLayout.CENTER); resolutionPanel.add(panel12, BorderLayout.PAGE_START); //======== panel2 ======== JPanel panel2 = new JPanel(); panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS)); //---- resolutionSlider ---- resolutionSlider = new JSlider(); resolutionSlider.setMaximum(8); resolutionSlider.setMajorTickSpacing(1); resolutionSlider.setPaintTicks(true); resolutionSlider.setSnapToTicks(true); resolutionSlider.setPaintLabels(true); resolutionSlider.setMinorTickSpacing(1); Dictionary<Integer, JLabel> resolutionLabels = new Hashtable<Integer, JLabel>(); Font f = FontManager.getFont(8); for (int i = 0; i < HiCGlobals.zoomLabels.length; i++) { if ((i + 1) % 2 == 0) { final JLabel tickLabel = new JLabel(HiCGlobals.zoomLabels[i]); tickLabel.setFont(f); resolutionLabels.put(i, tickLabel); } } resolutionSlider.setLabelTable(resolutionLabels); // Setting the zoom should always be done by calling resolutionSlider.setValue() so work isn't done twice. resolutionSlider.addChangeListener(new ChangeListener() { // Change zoom level while staying centered on current location. // Centering is relative to the bounds of the data, which might not be the bounds of the window public void stateChanged(ChangeEvent e) { if (!resolutionSlider.getValueIsAdjusting()) { int idx = resolutionSlider.getValue(); idx = Math.max(0, Math.min(idx, MAX_ZOOM)); if (hic.zd != null && idx == hic.zd.getZoom()) { // Nothing to do return; } if (hic.xContext != null) { int centerLocationX = (int) hic.xContext .getChromosomePosition(getHeatmapPanel().getWidth() / 2); int centerLocationY = (int) hic.yContext .getChromosomePosition(getHeatmapPanel().getHeight() / 2); hic.setZoom(idx, centerLocationX, centerLocationY, false); } //zoomInButton.setEnabled(newZoom < MAX_ZOOM); //zoomOutButton.setEnabled(newZoom > 0); } } }); panel2.add(resolutionSlider); resolutionPanel.add(panel2, BorderLayout.CENTER); toolbarPanel.add(resolutionPanel); mainPanel.add(toolbarPanel, BorderLayout.NORTH); //======== hiCPanel ======== final JPanel hiCPanel = new JPanel(); hiCPanel.setLayout(new HiCLayout()); //---- rulerPanel2 ---- rulerPanel2 = new HiCRulerPanel(hic); rulerPanel2.setMaximumSize(new Dimension(4000, 50)); rulerPanel2.setMinimumSize(new Dimension(1, 50)); rulerPanel2.setPreferredSize(new Dimension(1, 50)); rulerPanel2.setBorder(null); JPanel panel2_5 = new JPanel(); panel2_5.setLayout(new BorderLayout()); panel2_5.add(rulerPanel2, BorderLayout.SOUTH); trackPanel = new TrackPanel(hic); trackPanel.setMaximumSize(new Dimension(4000, 50)); trackPanel.setPreferredSize(new Dimension(1, 50)); trackPanel.setMinimumSize(new Dimension(1, 50)); trackPanel.setBorder(null); // trackPanelScrollpane = new JScrollPane(); // trackPanelScrollpane.getViewport().add(trackPanel); // trackPanelScrollpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); // trackPanelScrollpane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); // trackPanelScrollpane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102))); // trackPanelScrollpane.setBackground(new java.awt.Color(237, 237, 237)); // trackPanelScrollpane.setVisible(false); // panel2_5.add(trackPanelScrollpane, BorderLayout.NORTH); // trackPanel.setVisible(false); panel2_5.add(trackPanel, BorderLayout.NORTH); hiCPanel.add(panel2_5, BorderLayout.NORTH); //---- rulerPanel1 ---- rulerPanel1 = new HiCRulerPanel(hic); rulerPanel1.setMaximumSize(new Dimension(50, 4000)); rulerPanel1.setPreferredSize(new Dimension(50, 500)); rulerPanel1.setBorder(null); rulerPanel1.setMinimumSize(new Dimension(50, 1)); hiCPanel.add(rulerPanel1, BorderLayout.WEST); //---- heatmapPanel ---- heatmapPanel = new HeatmapPanel(this, hic); heatmapPanel.setBorder(LineBorder.createBlackLineBorder()); heatmapPanel.setMaximumSize(new Dimension(500, 500)); heatmapPanel.setMinimumSize(new Dimension(500, 500)); heatmapPanel.setPreferredSize(new Dimension(500, 500)); heatmapPanel.setBackground(new Color(238, 238, 238)); hiCPanel.add(heatmapPanel, BorderLayout.CENTER); //======== panel8 ======== JPanel rightSidePanel = new JPanel(); rightSidePanel.setMaximumSize(new Dimension(120, 100)); rightSidePanel.setBorder(new EmptyBorder(0, 10, 0, 0)); rightSidePanel.setLayout(null); //---- thumbnailPanel ---- thumbnailPanel = new ThumbnailPanel(this, hic); thumbnailPanel.setMaximumSize(new Dimension(100, 100)); thumbnailPanel.setMinimumSize(new Dimension(100, 100)); thumbnailPanel.setPreferredSize(new Dimension(100, 100)); thumbnailPanel.setBorder(LineBorder.createBlackLineBorder()); thumbnailPanel.setPreferredSize(new Dimension(100, 100)); thumbnailPanel.setBounds(new Rectangle(new Point(20, 0), thumbnailPanel.getPreferredSize())); rightSidePanel.add(thumbnailPanel); //======== xPlotPanel ======== xPlotPanel = new JPanel(); xPlotPanel.setPreferredSize(new Dimension(250, 100)); xPlotPanel.setLayout(null); rightSidePanel.add(xPlotPanel); xPlotPanel.setBounds(10, 100, xPlotPanel.getPreferredSize().width, 228); //======== yPlotPanel ======== yPlotPanel = new JPanel(); yPlotPanel.setPreferredSize(new Dimension(250, 100)); yPlotPanel.setLayout(null); rightSidePanel.add(yPlotPanel); yPlotPanel.setBounds(10, 328, yPlotPanel.getPreferredSize().width, 228); // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < rightSidePanel.getComponentCount(); i++) { Rectangle bounds = rightSidePanel.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = rightSidePanel.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; rightSidePanel.setMinimumSize(preferredSize); rightSidePanel.setPreferredSize(preferredSize); hiCPanel.add(rightSidePanel, BorderLayout.EAST); mainPanel.add(hiCPanel, BorderLayout.CENTER); contentPane.add(mainPanel, BorderLayout.CENTER); JMenuBar menuBar = createMenuBar(hiCPanel); contentPane.add(menuBar, BorderLayout.NORTH); // setup the glass pane to display a wait cursor when visible, and to grab all mouse events rootPane.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); rootPane.getGlassPane().addMouseListener(new MouseAdapter() { }); }
From source file:org.dwfa.ace.classifier.CNFormsLabelPanel.java
private void setMinMaxSize(JPanel panel) { panel.setMinimumSize(minPartPanelSize); panel.setMaximumSize(maxPartPanelSize); }
From source file:org.jas.dnd.DragTooltipDialog.java
private DynamicPanel getDynamicPanel(IconType type, List<?> list) { if (list == null || list.isEmpty()) { return null; }/*ww w . ja va 2 s .c o m*/ JPanel dynamicPanel = null; JLabel dynamicText = null; String text = list.isEmpty() ? null : (list.size()) + " " + (type == null ? "ERROR" : type.getText()); if (list.size() == 1) { text = list.get(0) instanceof File ? ((File) list.get(0)).getName() : list.get(0).toString(); } dynamicText = new JLabel(text); dynamicText.setForeground(Color.WHITE); FontMetrics fontMetrics = dynamicText.getFontMetrics(dynamicText.getFont()); int width = fontMetrics.stringWidth(dynamicText.getText()) + DEFAULT_MIN_FONT_WIDTH; int realHeight = ROW_HEIGHT; String longestText = ""; while (text.contains("<br>")) { text = text.substring(text.indexOf("<br>") + DEFAULT_MIN_FONT_WIDTH); if (text.length() > longestText.length()) { longestText = text; } realHeight += ROW_HEIGHT; } if (!longestText.isEmpty()) { width = fontMetrics.stringWidth(longestText) + DEFAULT_MIN_FONT_WIDTH; } dynamicPanel = new JPanel(); dynamicPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); dynamicPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, realHeight)); dynamicPanel.setMinimumSize(new Dimension(0, realHeight)); dynamicPanel.setPreferredSize(new Dimension(100, realHeight)); dynamicPanel.setSize(new Dimension(100, realHeight)); if (type != null) { dynamicPanel.add(getDynamicIcon(type), null); JPanel spacer = new JPanel(); Dimension d = new Dimension(SPACER_WIDTH, SPACER_WIDTH); width += SPACER_WIDTH; spacer.setSize(d); spacer.setMinimumSize(d); spacer.setMaximumSize(d); spacer.setPreferredSize(d); dynamicPanel.add(spacer); width += type.width; } dynamicPanel.add(dynamicText); return new DynamicPanel(dynamicPanel, width, realHeight); }
From source file:org.jas.dnd.DragTooltipDialog.java
private JPanel getDynamicIcon(IconType type) { JPanel dynamicIcon = null; dynamicIcon = new JPanel(); dynamicIcon.setMaximumSize(new Dimension(type.width, type.height)); dynamicIcon.setPreferredSize(new Dimension(type.width, type.height)); dynamicIcon.setName(type.synthName); dynamicIcon.setMinimumSize(new Dimension(type.width, type.height)); return dynamicIcon; }
From source file:org.pentaho.reporting.engine.classic.demo.util.CompoundDemoFrame.java
protected Container createDefaultContentPane() { demoContent = new JPanel(); demoContent.setLayout(new BorderLayout()); demoContent.setMinimumSize(new Dimension(100, 100)); demoContent.add(getNoHandlerInfoPane(), BorderLayout.CENTER); JPanel placeHolder = new JPanel(); placeHolder.setMinimumSize(new Dimension(300, 0)); placeHolder.setPreferredSize(new Dimension(300, 0)); placeHolder.setMaximumSize(new Dimension(300, 0)); JPanel rootContent = new JPanel(); rootContent.setLayout(new BorderLayout()); rootContent.add(demoContent, BorderLayout.CENTER); rootContent.add(placeHolder, BorderLayout.NORTH); final DemoSelectorTreeNode root = new DemoSelectorTreeNode(null, demoSelector); final DefaultTreeModel model = new DefaultTreeModel(root); final JTree demoTree = new JTree(model); demoTree.addTreeSelectionListener(new TreeSelectionHandler()); JSplitPane rootSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(demoTree), rootContent);/*from w ww . j a va2s . c om*/ rootSplitPane.setContinuousLayout(true); rootSplitPane.setDividerLocation(200); rootSplitPane.setOneTouchExpandable(true); return rootSplitPane; }
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 w ww .j a v a 2 s . co 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.processmining.analysis.performance.fsmevaluator.FSMEvaluationMenuUI.java
protected static JPanel packHorizontallyLeftAligned(Component[] components, int leftOffset) { JPanel packed = new JPanel(); packed.setOpaque(false);//from w ww . j a v a2s . com 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.framework.log.filter.LogEventLogFilterEnh.java
/** * Returns a Panel for the setting of parameters. When a LogFilter can be * added to a list in the framework. This panel is shown, and parameters can * be set. When the dialog is closed, a new instance of a LogFilter is * created by the framework by calling the <code>getNewLogFilter</code> * method of the dialog./* ww w. j a v a 2 s .c o m*/ * * @param summary * A LogSummary to be used for setting parameters. * @return JPanel */ public LogFilterParameterDialog getParameterDialog(LogSummary summary) { return new LogFilterParameterDialog(summary, LogEventLogFilterEnh.this) { LogEventCheckBoxEnh[] checks; JSpinner percTaskSpinner; JSpinner percPiSpinner; JComboBox choiceBox; /** * Keep the statistics for all the tasks */ SummaryStatistics taskStatistics = null; /** * Keep the statistics for the occurrence of tasks in process * instances */ SummaryStatistics piStatistics = null; public LogFilter getNewLogFilter() { LogEvents e = new LogEvents(); for (int i = 0; i < checks.length; i++) { if (checks[i].isSelected()) { e.add(checks[i].getLogEvent()); } } return new LogEventLogFilterEnh(e, getDoubleValueFromSpinner(percTaskSpinner.getValue()), getDoubleValueFromSpinner(percPiSpinner.getValue()), choiceBox.getSelectedItem().toString()); } protected JPanel getPanel() { // add message to the test log for this plugin Message.add("<EnhEvtLogFilter>", Message.TEST); // statistics taskStatistics = SummaryStatistics.newInstance(); piStatistics = SummaryStatistics.newInstance(); // Set up an percentformatter NumberFormat percentFormatter = NumberFormat.getPercentInstance(); percentFormatter.setMinimumFractionDigits(2); percentFormatter.setMaximumFractionDigits(2); // Instantiate the spinners percTaskSpinner = new JSpinner(new SpinnerNumberModel(5.0, 0.0, 100.0, 1.0)); percPiSpinner = new JSpinner(new SpinnerNumberModel(5.0, 0.0, 100.0, 1.0)); // generate the buttons that are needed JButton jButtonCalculate = new JButton("Calculate"); JButton jButtonInvert = new JButton("Invert selection"); // set up a choicebox to indicate whether the relationship // between the two // percentages is AND or OR. percTaskSpinner.setValue(new Double(percentageTask)); percPiSpinner.setValue(new Double(percentagePI)); choiceBox = new JComboBox(); choiceBox.addItem("AND"); choiceBox.addItem("OR"); choiceBox.setSelectedItem(selectedItemComboBox); // Some values that are needed for the sequel. int size = summary.getLogEvents().size(); // For the new log reader sumATEs should be calculated in // another way int sumATEs = 0; if (summary instanceof ExtendedLogSummary) { sumATEs = summary.getNumberOfAuditTrailEntries(); } else if (summary instanceof LightweightLogSummary) { HashSet<ProcessInstance> pis = new HashSet<ProcessInstance>(); Iterator logEvents = summary.getLogEvents().iterator(); while (logEvents.hasNext()) { LogEvent evt = (LogEvent) logEvents.next(); pis.addAll(summary.getInstancesForEvent(evt)); } Iterator pis2 = pis.iterator(); while (pis2.hasNext()) { ProcessInstance pi = (ProcessInstance) pis2.next(); int simPis = MethodsForWorkflowLogDataStructures.getNumberSimilarProcessInstances(pi); int numberATEs = pi.getAuditTrailEntryList().size(); sumATEs += simPis * numberATEs; pi.isEmpty(); } } else { } // calculate the number of process Instances, taking into // account // the number of similar instances int sumPIs = 0; if (summary instanceof LightweightLogSummary) { sumPIs = calculateSumPIs(summary); } checks = new LogEventCheckBoxEnh[size]; // create panels and labels JPanel global = new JPanel(new BorderLayout()); JPanel sub2 = new JPanel(new BorderLayout()); sub2.setBackground(Color.white); JLabel labelPercTask = new JLabel("percentage task"); JLabel labelPercPI = new JLabel("percentage PI"); // create panel sub1 to put the checkboxes on JPanel sub1 = new JPanel(new SpringLayout()); sub1.setBackground(Color.lightGray); // Get percentage of task in the log and percentage of in how // many // different PIs it appears. Iterator it = summary.getLogEvents().iterator(); int i = 0; while (it.hasNext()) { LogEvent evt = (LogEvent) it.next(); double percent = 0.0; if (summary instanceof ExtendedLogSummary) { percent = ((double) evt.getOccurrenceCount() / (double) sumATEs); } else if (summary instanceof LightweightLogSummary) { Set instances = summary.getInstancesForEvent(evt); // getFrequencyTasks(evt, instances) percent = (double) getFrequencyTasks(evt, instances) / (double) sumATEs; } else { } // String percString = percentFormatter.format(percent); LogEventCheckBoxEnh check = new LogEventCheckBoxEnh(evt); check.setPercentageTask(percent * 100); // add percentage to the statistics for the tasks taskStatistics.addValue(percent); // Get percentage of in how many different PIs a task // appears, // taking into account whether the new or old logreader is // used if (summary instanceof LightweightLogSummary) { Set<ProcessInstance> pis = summary.getInstancesForEvent(evt); int numberInstancesTask = 0; Iterator it2 = pis.iterator(); while (it2.hasNext()) { ProcessInstance pi = (ProcessInstance) it2.next(); numberInstancesTask += MethodsForWorkflowLogDataStructures .getNumberSimilarProcessInstances(pi); } double fPI = (double) numberInstancesTask / (double) sumPIs; check.setPercentagePI(fPI * 100); // add percentage to the statistics for the PIs piStatistics.addValue(fPI); } else if (summary instanceof ExtendedLogSummary) { double percPIcheck = getPercentagePI(evt); check.setPercentagePI(percPIcheck); piStatistics.addValue(percPIcheck / 100); } else { // raise exception, unknown logreader } // add to the checks array checks[i++] = check; } // fill sub1 with statistics information sub1.add(new JLabel(" Statistics ( #tasks = " + taskStatistics.getN() + " )")); sub1.add(new JLabel(" ")); sub1.add(new JLabel(" ")); sub1.add(new JLabel(" Arithmetic Mean ")); sub1.add(new JLabel(percentFormatter.format(taskStatistics.getMean()))); sub1.add(new JLabel(percentFormatter.format(piStatistics.getMean()))); sub1.add(new JLabel(" Geometric Mean ")); sub1.add(new JLabel(percentFormatter.format(taskStatistics.getGeometricMean()))); sub1.add(new JLabel(percentFormatter.format(piStatistics.getGeometricMean()))); sub1.add(new JLabel(" Standard Deviation ")); sub1.add(new JLabel(percentFormatter.format(taskStatistics.getStandardDeviation()))); sub1.add(new JLabel(percentFormatter.format(piStatistics.getStandardDeviation()))); sub1.add(new JLabel(" Min ")); sub1.add(new JLabel(percentFormatter.format(taskStatistics.getMin()))); sub1.add(new JLabel(percentFormatter.format(piStatistics.getMin()))); sub1.add(new JLabel(" Max ")); sub1.add(new JLabel(percentFormatter.format(taskStatistics.getMax()))); sub1.add(new JLabel(percentFormatter.format(piStatistics.getMax()))); sub1.add(new JLabel(" ------------------ ")); sub1.add(new JLabel(" --------------- ")); sub1.add(new JLabel(" --------------- ")); sub1.add(new JLabel(" Tasks ")); sub1.add(new JLabel(" percentage task ")); sub1.add(new JLabel(" percentage PI ")); // generate messages for the test case for this plugin Message.add("number tasks: " + taskStatistics.getN(), Message.TEST); Message.add("<percentage task>", Message.TEST); Message.add("arithmetic mean: " + taskStatistics.getMean(), Message.TEST); Message.add("geometric mean: " + taskStatistics.getGeometricMean(), Message.TEST); Message.add("standard deviation: " + taskStatistics.getStandardDeviation(), Message.TEST); Message.add("min: " + taskStatistics.getMin(), Message.TEST); Message.add("max: " + taskStatistics.getMax(), Message.TEST); Message.add("<percentage task/>", Message.TEST); Message.add("<percentage PI>", Message.TEST); Message.add("arithmetic mean: " + piStatistics.getMean(), Message.TEST); Message.add("geometric mean: " + piStatistics.getGeometricMean(), Message.TEST); Message.add("standard deviation: " + piStatistics.getStandardDeviation(), Message.TEST); Message.add("min: " + piStatistics.getMin(), Message.TEST); Message.add("max: " + piStatistics.getMax(), Message.TEST); Message.add("<percentage PI/>", Message.TEST); // add the checkboxes to the GUI. Arrays.sort(checks); for (i = 0; i < checks.length; i++) { sub1.add(checks[i]); if ((eventsToKeep != null) && (!eventsToKeep.contains(checks[i].getLogEvent()))) { checks[i].setSelected(false); } // put the percentages on the GUI sub1.add(new JLabel(percentFormatter.format(checks[i].getPercentageTask() / 100))); sub1.add(new JLabel(percentFormatter.format(checks[i].getPercentagePI() / 100))); } // SpringUtilities util = new SpringUtilities(); util.makeCompactGrid(sub1, checks.length + 8, 3, 3, 3, 8, 3); // put the contents on the respective panels global.add(sub2, java.awt.BorderLayout.CENTER); global.add(sub1, java.awt.BorderLayout.SOUTH); // JPanel sub21 = new JPanel(new SpringLayout()); // sub21.setLayout(new BoxLayout(sub21, BoxLayout.PAGE_AXIS)); sub2.setBackground(Color.red); JPanel textPanel = new JPanel(new BorderLayout()); textPanel.setBackground(Color.yellow); JPanel sub221 = new JPanel(new FlowLayout()); sub221.setBackground(Color.yellow); JPanel sub222 = new JPanel(new FlowLayout()); sub222.setBackground(Color.yellow); // two different panels to be places on sub21 // JPanel sub21First = new JPanel(); // sub21First.setLayout(new BoxLayout(sub21First, // BoxLayout.LINE_AXIS)); // sub21First.setMaximumSize(new Dimension(1000, 25)); // sub21First.add(Box.createHorizontalGlue()); // sub21First.add(labelPercTask); // sub21First.add(percTaskSpinner, null); // percTaskSpinner.setMaximumSize(new Dimension(10, 20)); // sub21First.add(jButtonCalculate); // jButtonCalculate.setMaximumSize(new Dimension(10, 20)); // sub21First.add(labelPercPI); // sub21First.add(percPiSpinner, null); // percPiSpinner.setMaximumSize(new Dimension(10, 20)); // sub21First.add(choiceBox); // choiceBox.setMaximumSize(new Dimension(10, 20)); // sub21First.add(Box.createHorizontalGlue()); // JPanel sub21Second = new JPanel(); // sub21Second.setLayout(new BoxLayout(sub21Second, // BoxLayout.LINE_AXIS)); // sub21Second.setMaximumSize(new Dimension(1000, 25)); // sub21Second.add(Box.createHorizontalGlue()); // sub21Second.add(jButtonInvert); // sub21Second.add(Box.createHorizontalGlue()); // // sub21.add(sub21First); // sub21.add(sub21Second); sub21.add(labelPercTask); sub21.add(percTaskSpinner, null); sub21.add(jButtonCalculate); sub21.add(labelPercPI); sub21.add(percPiSpinner, null); sub21.add(choiceBox); // add the invert button sub21.add(new JLabel(" ")); sub21.add(new JLabel(" ")); sub21.add(jButtonInvert); sub21.add(new JLabel(" ")); sub21.add(new JLabel(" ")); sub21.add(new JLabel(" ")); sub21.setMaximumSize(sub21.getPreferredSize()); sub2.add(sub21, java.awt.BorderLayout.CENTER); sub2.add(textPanel, java.awt.BorderLayout.SOUTH); textPanel.add(new JLabel( "The Calculate button needs to be clicked to calculate which tasks need to be selected!!!"), java.awt.BorderLayout.CENTER); textPanel.add( new JLabel("Clicking the OK button only accepts, but nothing is again calculated!!!!"), java.awt.BorderLayout.SOUTH); util.makeCompactGrid(sub21, 2, 6, 3, 3, 8, 3); // // specify button action for the button ButtonPreview jButtonCalculate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // The preview button is clicked buttonClicked(); // end for } }); // specify button action for the button Invert jButtonInvert.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { invertButtonClicked(); } }); return global; } /** * When the preview button is clicked */ public void buttonClicked() { for (int k = 0; k < checks.length; k++) { boolean firstCheck = false; boolean secondCheck = false; LogEventCheckBoxEnh c = checks[k]; // check for the task in c whether its percentage is higher // than // perc firstCheck = checkTask(c, percTaskSpinner.getValue()); // Also check whether the task occurs in more than percTr // percent of the traces secondCheck = checkPI(c, percPiSpinner.getValue()); // Check whether for choiceBox OR or AND is selected boolean logicalResult = true; if (((String) choiceBox.getSelectedItem()).equals("AND")) { logicalResult = firstCheck && secondCheck; } else if (((String) choiceBox.getSelectedItem()).equals("OR")) { logicalResult = firstCheck || secondCheck; } // set the checkbox selected or not if (logicalResult == true) { c.setSelected(true); } else { c.setSelected(false); } } // add messages to the test log for this case int numberCheckedBoxes = 0; for (int i = 0; i < checks.length; i++) { if (checks[i].isSelected()) { numberCheckedBoxes++; } } Message.add("number of selected tasks: " + numberCheckedBoxes, Message.TEST); Message.add("<EnhEvtLogFilter/>", Message.TEST); } /** * */ public void invertButtonClicked() { for (int i = 0; i < checks.length; i++) { checks[i].setSelected(!checks[i].isSelected()); } } /** * Checks whether the task in c occurs with a lower percentage in * the log than the percentage given by percTask. * * @param c * LogEventCheckBoxEnh the checkbox that contains the * task. * @param percTask * Object the percentage * @return boolean True if the percentage of which the task in c * occurs in the log is greater or equal than percTaks, * false otherwise. */ private boolean checkTask(LogEventCheckBoxEnh c, Object percTask) { boolean returnBoolean = false; double percT = 0.0; percT = getDoubleValueFromSpinner(percTask); // check whether its percentage is higher than percT if (c.getPercentageTask() >= percT) { returnBoolean = true; } else { returnBoolean = false; } return returnBoolean; } /** * Checks whether the task in c occurs with a lower percentage in * different process instances than the percentage given by * percTrace. * * @param c * LogEventCheckBoxEnh the checkbox that contains the * task. * @param percTrace * Object the percentage. * @return boolean True, if the percentage of which the task in * different process instances occurs in the log is greater * or equal than percTrace, false otherwise. */ private boolean checkPI(LogEventCheckBoxEnh c, Object percPIobj) { boolean returnBoolean = false; double percPI = 0.0; percPI = getDoubleValueFromSpinner(percPIobj); // check whether its percentage is higher than percPI if (c.getPercentagePI() >= percPI) { returnBoolean = true; } else { returnBoolean = false; } return returnBoolean; } /** * Get the percentage of that this task occurs in different PIs * * @param evt * LogEvent the logEvent in which the task can be found * @return double the percentage of which this task in the log * occurs */ private double getPercentagePI(LogEvent evt) { double returnPercent = 0.0; HashMap mapping = ((ExtendedLogSummary) summary).getMappingAtesToNumberPIs(); int numberPI = summary.getNumberOfProcessInstances(); // Get the frequency of PI in which the task occurs Object value = null; Iterator it = mapping.keySet().iterator(); while (it.hasNext()) { Object keyObj = it.next(); String key = (String) keyObj; if (key.equals( evt.getModelElementName().trim() + " " + "(" + evt.getEventType().trim() + ")")) { value = mapping.get(keyObj); break; } } if (value != null) { // calculate frequency returnPercent = (((Integer) value).doubleValue() / new Double(numberPI).doubleValue()) * 100; } return returnPercent; } private int getFrequencyTasks(LogEvent evt, Set instances) { int returnFrequency = 0; Iterator instIterator = instances.iterator(); while (instIterator.hasNext()) { ProcessInstance pi = (ProcessInstance) instIterator.next(); Iterator ates = pi.getAuditTrailEntryList().iterator(); while (ates.hasNext()) { AuditTrailEntry ate = (AuditTrailEntry) ates.next(); if (ate.getElement().trim().equals(evt.getModelElementName().trim()) && ate.getType().equals(evt.getEventType())) { returnFrequency += MethodsForWorkflowLogDataStructures .getNumberSimilarProcessInstances(pi); } } } return returnFrequency; } /** * Gets the double value of an object, provided that value is a * Double or Long object * * @param value * Object * @return double the double value */ private double getDoubleValueFromSpinner(Object value) { double returnDouble = 0.0; if (value instanceof Long) { returnDouble = (((Long) value).doubleValue()); } else if (value instanceof Double) { returnDouble = (((Double) value).doubleValue()); } return returnDouble; } /** * Returns the number of process instances, taking into account the * number of similar instances * * @param summary * LogSummary the log summary * @return int the number of process instances */ private int calculateSumPIs(LogSummary summary) { int returnSum = 0; HashSet pis = new HashSet<ProcessInstance>(); Iterator it = summary.getLogEvents().iterator(); while (it.hasNext()) { LogEvent evt = (LogEvent) it.next(); pis.addAll(summary.getInstancesForEvent(evt)); } // for each process instance in pis, get the number of similar // instances Iterator it2 = pis.iterator(); while (it2.hasNext()) { ProcessInstance pi = (ProcessInstance) it2.next(); returnSum += MethodsForWorkflowLogDataStructures.getNumberSimilarProcessInstances(pi); } return returnSum; } protected boolean getAllParametersSet() { // calculate values // buttonClicked(); return true; } }; }
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 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(); }