Example usage for javax.swing JSplitPane setOpaque

List of usage examples for javax.swing JSplitPane setOpaque

Introduction

In this page you can find the example usage for javax.swing JSplitPane setOpaque.

Prototype

@BeanProperty(expert = true, description = "The component's opacity")
public void setOpaque(boolean isOpaque) 

Source Link

Document

If true the component paints every pixel within its bounds.

Usage

From source file:org.datacleaner.widgets.result.CategorizationResultSwingRenderer.java

@Override
public JComponent render(CategorizationResult analyzerResult) {
    final DefaultPieDataset dataset = new DefaultPieDataset();
    final Collection<String> categoryNames = analyzerResult.getCategoryNames();
    for (String categoryName : categoryNames) {
        final Number count = analyzerResult.getCategoryCount(categoryName);
        dataset.setValue(categoryName, count);
    }//www .java 2  s .c  om

    final DefaultTableModel model = prepareModel(analyzerResult, dataset);

    final DCTable table = new DCTable(model);
    table.setColumnControlVisible(false);
    table.setRowHeight(22);

    final JFreeChart chart = ChartFactory.createPieChart(null, dataset, true, false, false);
    ChartUtils.applyStyles(chart);

    final ChartPanel chartPanel = ChartUtils.createPanel(chart, false);

    final DCPanel leftPanel = WidgetUtils.decorateWithShadow(chartPanel);

    final DCPanel rightPanel = new DCPanel();
    rightPanel.setLayout(new VerticalLayout());
    rightPanel.add(WidgetUtils.decorateWithShadow(table.toPanel()));

    final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setOpaque(false);
    split.add(leftPanel);
    split.add(rightPanel);
    split.setDividerLocation(550);

    return split;
}

From source file:org.datacleaner.widgets.result.UniqueKeyCheckAnalyzerResultSwingRenderer.java

@Override
public JComponent render(UniqueKeyCheckAnalyzerResult result) {
    final int nullCount = result.getNullCount();
    final int nonUniqueCount = result.getNonUniqueCount();

    final DefaultKeyedValues keyedValues = new DefaultKeyedValues();
    keyedValues.addValue("Unique keys", result.getUniqueCount());

    final List<Title> subTitles = new ArrayList<Title>();
    subTitles.add(new ShortTextTitle("Row count: " + result.getRowCount()));
    subTitles.add(new ShortTextTitle("Unique key count: " + result.getUniqueCount()));

    if (nonUniqueCount > 0) {
        keyedValues.addValue("Non-unique keys", nonUniqueCount);
        subTitles.add(new ShortTextTitle("Non-unique key count: " + nonUniqueCount));
    }/*w  w  w.  ja v  a2s.co  m*/

    final String title;
    if (nullCount == 0) {
        title = "Unique and non-unique keys";
    } else {
        keyedValues.addValue(LabelUtils.NULL_LABEL, nullCount);
        title = "Unique, non-unique and <null> keys";
        subTitles.add(new ShortTextTitle("<null> key count: " + result.getNullCount()));
    }

    final DefaultPieDataset dataset = new DefaultPieDataset(keyedValues);
    final JFreeChart chart = ChartFactory.createRingChart(title, dataset, true, true, false);

    chart.setSubtitles(subTitles);

    ChartUtils.applyStyles(chart);
    ChartPanel chartPanel = ChartUtils.createPanel(chart, false);

    final DCPanel leftPanel = new DCPanel();
    leftPanel.setLayout(new VerticalLayout());
    leftPanel.add(WidgetUtils.decorateWithShadow(chartPanel));

    final Map<String, Integer> samples = result.getNonUniqueSamples();
    if (samples == null || samples.isEmpty()) {
        return leftPanel;
    }

    final DefaultTableModel samplesTableModel = new DefaultTableModel(new String[] { "Key", "Count" }, 0);
    for (final Entry<String, Integer> entry : samples.entrySet()) {
        final String key = entry.getKey();
        final Integer count = entry.getValue();
        samplesTableModel.addRow(new Object[] { key, count });
    }
    final DCTable samplesTable = new DCTable(samplesTableModel);

    final DCPanel rightPanel = new DCPanel();
    rightPanel.setLayout(new BorderLayout());
    rightPanel.add(DCLabel.dark("Sample non-unique keys:"));
    rightPanel.add(samplesTable.toPanel(), BorderLayout.CENTER);

    final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setOpaque(false);
    split.add(leftPanel);
    split.add(rightPanel);
    split.setDividerLocation(550);

    return split;
}

From source file:org.eobjects.datacleaner.widgets.result.UniqueKeyCheckAnalyzerResultSwingRenderer.java

@Override
public JComponent render(UniqueKeyCheckAnalyzerResult result) {
    final int nullCount = result.getNullCount();
    final int nonUniqueCount = result.getNonUniqueCount();

    final DefaultKeyedValues keyedValues = new DefaultKeyedValues();
    keyedValues.addValue("Unique keys", result.getUniqueCount());

    final List<Title> subTitles = new ArrayList<Title>();
    subTitles.add(new ShortTextTitle("Row count: " + result.getRowCount()));
    subTitles.add(new ShortTextTitle("Unique key count: " + result.getUniqueCount()));

    if (nonUniqueCount > 0) {
        keyedValues.addValue("Non-unique keys", nonUniqueCount);
        subTitles.add(new ShortTextTitle("Non-unique key count: " + nonUniqueCount));
    }/*from  w  ww. j  a  v a2 s. c  om*/

    final String title;
    if (nullCount == 0) {
        title = "Unique and non-unique keys";
    } else {
        keyedValues.addValue(LabelUtils.NULL_LABEL, nullCount);
        title = "Unique, non-unique and <null> keys";
        subTitles.add(new ShortTextTitle("<null> key count: " + result.getNullCount()));
    }

    final DefaultPieDataset dataset = new DefaultPieDataset(keyedValues);
    final JFreeChart chart = ChartFactory.createRingChart(title, dataset, true, true, false);

    chart.setSubtitles(subTitles);

    ChartUtils.applyStyles(chart);
    ChartPanel chartPanel = new ChartPanel(chart);

    final DCPanel leftPanel = new DCPanel();
    leftPanel.setLayout(new VerticalLayout());
    leftPanel.add(WidgetUtils.decorateWithShadow(chartPanel, true, 4));

    final Map<String, Integer> samples = result.getNonUniqueSamples();
    if (samples == null || samples.isEmpty()) {
        return leftPanel;
    }

    final DefaultTableModel samplesTableModel = new DefaultTableModel(new String[] { "Key", "Count" }, 0);
    for (final Entry<String, Integer> entry : samples.entrySet()) {
        final String key = entry.getKey();
        final Integer count = entry.getValue();
        samplesTableModel.addRow(new Object[] { key, count });
    }
    final DCTable samplesTable = new DCTable(samplesTableModel);

    final DCPanel rightPanel = new DCPanel();
    rightPanel.setLayout(new BorderLayout());
    rightPanel.add(DCLabel.dark("Sample non-unique keys:"));
    rightPanel.add(samplesTable.toPanel(), BorderLayout.CENTER);

    final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setOpaque(false);
    split.add(leftPanel);
    split.add(rightPanel);
    split.setDividerLocation(550);

    return split;
}

From source file:org.datacleaner.widgets.result.ValueDistributionResultSwingRendererGroupDelegate.java

public JSplitPane renderGroupResult(final ValueCountingAnalyzerResult result) {
    final Integer distinctCount = result.getDistinctCount();
    final Integer unexpectedValueCount = result.getUnexpectedValueCount();
    final int totalCount = result.getTotalCount();

    _valueCounts = result.getReducedValueFrequencies(_preferredSlices);
    _valueCounts = moveUniqueToEnd(_valueCounts);

    for (ValueFrequency valueCount : _valueCounts) {
        setDataSetValue(valueCount.getName(), valueCount.getCount());
    }/*from w  ww .  j a  v a 2  s  .  co  m*/

    logger.info("Rendering with {} slices", getDataSetItemCount());
    drillToOverview(result);

    // chart for display of the dataset
    String title = "Value distribution of " + _groupOrColumnName;
    final JFreeChart chart = ChartFactory.createBarChart(title, "Value", "Count", _dataset,
            PlotOrientation.HORIZONTAL, true, true, false);

    List<Title> titles = new ArrayList<Title>();
    titles.add(new ShortTextTitle("Total count: " + totalCount));
    if (distinctCount != null) {
        titles.add(new ShortTextTitle("Distinct count: " + distinctCount));
    }
    if (unexpectedValueCount != null) {
        titles.add(new ShortTextTitle("Unexpected value count: " + unexpectedValueCount));
    }
    chart.setSubtitles(titles);

    ChartUtils.applyStyles(chart);

    // code-block for tweaking style and coloring of chart
    {
        final CategoryPlot plot = (CategoryPlot) chart.getPlot();
        plot.getDomainAxis().setVisible(false);

        int colorIndex = 0;
        for (int i = 0; i < getDataSetItemCount(); i++) {
            final String key = getDataSetKey(i);
            final Color color;
            final String upperCaseKey = key.toUpperCase();
            if (_valueColorMap.containsKey(upperCaseKey)) {
                color = _valueColorMap.get(upperCaseKey);
            } else {
                if (i == getDataSetItemCount() - 1) {
                    // the last color should not be the same as the first
                    if (colorIndex == 0) {
                        colorIndex++;
                    }
                }

                Color colorCandidate = SLICE_COLORS[colorIndex];
                int darkAmount = i / SLICE_COLORS.length;
                for (int j = 0; j < darkAmount; j++) {
                    colorCandidate = WidgetUtils.slightlyDarker(colorCandidate);
                }
                color = colorCandidate;

                colorIndex++;
                if (colorIndex >= SLICE_COLORS.length) {
                    colorIndex = 0;
                }
            }

            plot.getRenderer().setSeriesPaint(i, color);
        }
    }

    final ChartPanel chartPanel = ChartUtils.createPanel(chart, false);

    final DCPanel leftPanel = new DCPanel();
    leftPanel.setLayout(new VerticalLayout());
    leftPanel.add(WidgetUtils.decorateWithShadow(chartPanel));

    _backButton.setMargin(new Insets(0, 0, 0, 0));
    _backButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            drillToOverview(result);
        }
    });

    _rightPanel.setLayout(new VerticalLayout());
    _rightPanel.add(_backButton);
    _rightPanel.add(WidgetUtils.decorateWithShadow(_table.toPanel()));

    final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setOpaque(false);
    split.add(leftPanel);
    split.add(_rightPanel);
    split.setDividerLocation(550);

    return split;
}

From source file:org.eobjects.datacleaner.widgets.result.ValueDistributionResultSwingRendererGroupDelegate.java

public JSplitPane renderGroupResult(final ValueCountingAnalyzerResult result) {
    final Integer distinctCount = result.getDistinctCount();
    final Integer unexpectedValueCount = result.getUnexpectedValueCount();
    final int totalCount = result.getTotalCount();

    _valueCounts = result.getReducedValueFrequencies(_preferredSlices);
    for (ValueFrequency valueCount : _valueCounts) {
        setDataSetValue(valueCount.getName(), valueCount.getCount());
    }//from  w ww . j a  va 2  s.  c  o m

    logger.info("Rendering with {} slices", getDataSetItemCount());
    drillToOverview(result);

    // chart for display of the dataset
    String title = "Value distribution of " + _groupOrColumnName;
    final JFreeChart chart = ChartFactory.createBarChart(title, "Value", "Count", _dataset,
            PlotOrientation.HORIZONTAL, true, true, false);

    List<Title> titles = new ArrayList<Title>();
    titles.add(new ShortTextTitle("Total count: " + totalCount));
    if (distinctCount != null) {
        titles.add(new ShortTextTitle("Distinct count: " + distinctCount));
    }
    if (unexpectedValueCount != null) {
        titles.add(new ShortTextTitle("Unexpected value count: " + unexpectedValueCount));
    }
    chart.setSubtitles(titles);

    ChartUtils.applyStyles(chart);

    // code-block for tweaking style and coloring of chart
    {
        final CategoryPlot plot = (CategoryPlot) chart.getPlot();
        plot.getDomainAxis().setVisible(false);

        int colorIndex = 0;
        for (int i = 0; i < getDataSetItemCount(); i++) {
            final String key = getDataSetKey(i);
            final Color color;
            final String upperCaseKey = key.toUpperCase();
            if (_valueColorMap.containsKey(upperCaseKey)) {
                color = _valueColorMap.get(upperCaseKey);
            } else {
                if (i == getDataSetItemCount() - 1) {
                    // the last color should not be the same as the first
                    if (colorIndex == 0) {
                        colorIndex++;
                    }
                }

                Color colorCandidate = SLICE_COLORS[colorIndex];
                int darkAmount = i / SLICE_COLORS.length;
                for (int j = 0; j < darkAmount; j++) {
                    colorCandidate = WidgetUtils.slightlyDarker(colorCandidate);
                }
                color = colorCandidate;

                colorIndex++;
                if (colorIndex >= SLICE_COLORS.length) {
                    colorIndex = 0;
                }
            }

            plot.getRenderer().setSeriesPaint(i, color);
        }
    }

    final ChartPanel chartPanel = new ChartPanel(chart);

    // chartPanel.addChartMouseListener(new ChartMouseListener() {
    //
    // @Override
    // public void chartMouseMoved(ChartMouseEvent event) {
    // ChartEntity entity = event.getEntity();
    // if (entity instanceof PieSectionEntity) {
    // PieSectionEntity pieSectionEntity = (PieSectionEntity) entity;
    // String sectionKey = (String) pieSectionEntity.getSectionKey();
    // if (_groups.containsKey(sectionKey)) {
    // chartPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    // } else {
    // chartPanel.setCursor(Cursor.getDefaultCursor());
    // }
    // } else {
    // chartPanel.setCursor(Cursor.getDefaultCursor());
    // }
    // }
    //
    // @Override
    // public void chartMouseClicked(ChartMouseEvent event) {
    // ChartEntity entity = event.getEntity();
    // if (entity instanceof PieSectionEntity) {
    // PieSectionEntity pieSectionEntity = (PieSectionEntity) entity;
    // String sectionKey = (String) pieSectionEntity.getSectionKey();
    // if (_groups.containsKey(sectionKey)) {
    // drillToGroup(result, sectionKey, true);
    // }
    // }
    // }
    // });

    final DCPanel leftPanel = new DCPanel();
    leftPanel.setLayout(new VerticalLayout());
    leftPanel.add(WidgetUtils.decorateWithShadow(chartPanel, true, 4));

    _backButton.setMargin(new Insets(0, 0, 0, 0));
    _backButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            drillToOverview(result);
        }
    });

    final DCPanel rightPanel = new DCPanel();
    rightPanel.setLayout(new BorderLayout());
    rightPanel.add(_backButton, BorderLayout.NORTH);
    rightPanel.add(_table.toPanel(), BorderLayout.CENTER);

    final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setOpaque(false);
    split.add(leftPanel);
    split.add(rightPanel);
    split.setDividerLocation(550);

    return split;
}

From source file:org.pentaho.reporting.engine.classic.core.modules.gui.base.PreviewPane.java

private void refreshReportController(final ReportController newReportController) {
    for (int i = 0; i < outerReportControllerHolder.getComponentCount(); i++) {
        final Component maybeSplitPane = outerReportControllerHolder.getComponent(i);
        if (maybeSplitPane instanceof JSplitPane) {
            final JSplitPane splitPane = (JSplitPane) maybeSplitPane;
            reportControllerSliderSize = splitPane.getDividerLocation();
            break;
        }/*w w w.j a  va  2 s .c  om*/
    }

    if (newReportController == null) {
        if (reportControllerComponent != null) {
            // thats relatively easy.
            outerReportControllerHolder.removeAll();
            outerReportControllerHolder.add(toolbarHolder, BorderLayout.NORTH);
            outerReportControllerHolder.add(reportPaneScrollPane, BorderLayout.CENTER);
            reportControllerComponent = null;
            reportControllerInner = false;
            reportControllerLocation = null;
        }
    } else {
        final JComponent rcp = newReportController.getControlPanel();
        if (rcp == null) {
            if (reportControllerComponent != null) {
                outerReportControllerHolder.removeAll();
                outerReportControllerHolder.add(toolbarHolder, BorderLayout.NORTH);
                outerReportControllerHolder.add(reportPaneScrollPane, BorderLayout.CENTER);
                reportControllerComponent = null;
                reportControllerInner = false;
                reportControllerLocation = null;
            }
        } else if (reportControllerComponent != rcp
                || reportControllerInner != newReportController.isInnerComponent()
                || ObjectUtilities.equal(reportControllerLocation,
                        newReportController.getControllerLocation()) == false) {
            // if either the controller component or its position (inner vs outer)
            // and border-position has changed, then refresh ..
            this.reportControllerLocation = newReportController.getControllerLocation();
            this.reportControllerInner = newReportController.isInnerComponent();
            this.reportControllerComponent = newReportController.getControlPanel();

            outerReportControllerHolder.removeAll();
            if (reportControllerInner) {
                final JSplitPane innerHolder = new JSplitPane();
                innerHolder.setOpaque(false);
                if (BorderLayout.SOUTH.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    innerHolder.setTopComponent(reportPaneScrollPane);
                    innerHolder.setBottomComponent(reportControllerComponent);
                } else if (BorderLayout.EAST.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
                    innerHolder.setLeftComponent(reportPaneScrollPane);
                    innerHolder.setRightComponent(reportControllerComponent);
                } else if (BorderLayout.WEST.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
                    innerHolder.setRightComponent(reportPaneScrollPane);
                    innerHolder.setLeftComponent(reportControllerComponent);
                } else {
                    innerHolder.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    innerHolder.setBottomComponent(reportPaneScrollPane);
                    innerHolder.setTopComponent(reportControllerComponent);
                }

                if (reportControllerSliderSize > 0) {
                    innerHolder.setDividerLocation(reportControllerSliderSize);
                }
                outerReportControllerHolder.add(toolbarHolder, BorderLayout.NORTH);
                outerReportControllerHolder.add(innerHolder, BorderLayout.CENTER);
            } else {
                final JPanel reportPaneHolder = new JPanel();
                reportPaneHolder.setOpaque(false);
                reportPaneHolder.setLayout(new BorderLayout());
                reportPaneHolder.add(toolbarHolder, BorderLayout.NORTH);
                reportPaneHolder.add(reportPaneScrollPane, BorderLayout.CENTER);

                final JSplitPane innerHolder = new JSplitPane();
                if (BorderLayout.SOUTH.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    innerHolder.setTopComponent(reportPaneHolder);
                    innerHolder.setBottomComponent(reportControllerComponent);
                } else if (BorderLayout.EAST.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
                    innerHolder.setLeftComponent(reportPaneHolder);
                    innerHolder.setRightComponent(reportControllerComponent);
                } else if (BorderLayout.WEST.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
                    innerHolder.setRightComponent(reportPaneHolder);
                    innerHolder.setLeftComponent(reportControllerComponent);
                } else {
                    innerHolder.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    innerHolder.setBottomComponent(reportPaneHolder);
                    innerHolder.setTopComponent(reportControllerComponent);
                }
                if (reportControllerSliderSize > 0) {
                    innerHolder.setDividerLocation(reportControllerSliderSize);
                }
                outerReportControllerHolder.add(innerHolder, BorderLayout.CENTER);
            }
        }
    }
}