Example usage for javax.swing.table DefaultTableCellRenderer setFont

List of usage examples for javax.swing.table DefaultTableCellRenderer setFont

Introduction

In this page you can find the example usage for javax.swing.table DefaultTableCellRenderer setFont.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The font for the component.")
public void setFont(Font font) 

Source Link

Document

Sets the font for this component.

Usage

From source file:org.processmining.analysis.performance.PerformanceAnalysisGUI.java

/**
 * Calculates the metrics belonging to a place and displays the results.
 * /*w w  w.j a  v a  2 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 2s  .c  om
 * 
 * @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.prom5.analysis.performance.PerformanceAnalysisGUI.java

/**
 * Calculates the metrics belonging to a place and displays the
 * results.//from   ww w  . j  av a 2 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.prom5.analysis.performance.PerformanceAnalysisGUI.java

/**
 * Calculates and displays values of 'time in between' metrics of two
 * transitions.//from   ww w .ja 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();
    }
}