Example usage for weka.gui InstancesSummaryPanel InstancesSummaryPanel

List of usage examples for weka.gui InstancesSummaryPanel InstancesSummaryPanel

Introduction

In this page you can find the example usage for weka.gui InstancesSummaryPanel InstancesSummaryPanel.

Prototype

public InstancesSummaryPanel() 

Source Link

Document

Creates the instances panel with no initial instances.

Usage

From source file:meka.gui.explorer.PreprocessTab.java

License:Open Source License

/**
 * Initializes the widgets.//  ww w  .jav  a2 s .c o m
 */
@Override
protected void initGUI() {
    JPanel panel;
    JPanel panelLeft;
    JPanel panelRight;

    super.initGUI();

    panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createTitledBorder("Filter"));
    add(panel, BorderLayout.NORTH);
    panel.add(m_GenericObjectEditor.getCustomPanel(), BorderLayout.CENTER);
    m_ButtonApplyFilter = new JButton("Apply");
    m_ButtonApplyFilter.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            getOwner().addUndoPoint();
            filterData((Filter) m_GenericObjectEditor.getValue(), null);
        }
    });
    panel.add(m_ButtonApplyFilter, BorderLayout.EAST);

    // split view
    m_PanelSplit = new JPanel(new GridLayout(1, 2));
    add(m_PanelSplit, BorderLayout.CENTER);
    panelLeft = new JPanel(new BorderLayout());
    panelRight = new JPanel(new BorderLayout());
    m_PanelSplit.add(panelLeft);
    m_PanelSplit.add(panelRight);

    // left view
    m_PanelDataSummary = new InstancesSummaryPanel();
    m_PanelDataSummary.setBorder(BorderFactory.createTitledBorder("Current data set"));
    panelLeft.add(m_PanelDataSummary, BorderLayout.NORTH);

    panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createTitledBorder("Attributes"));
    panelLeft.add(panel, BorderLayout.CENTER);

    m_PanelAttributes = new AttributeSelectionPanel();
    m_PanelAttributes.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting())
                return;
            ListSelectionModel lm = (ListSelectionModel) e.getSource();
            for (int i = e.getFirstIndex(); i <= e.getLastIndex(); i++) {
                if (lm.isSelectedIndex(i)) {
                    m_PanelAttributeSummary.setAttribute(i);
                    break;
                }
            }
        }
    });
    panel.add(m_PanelAttributes, BorderLayout.CENTER);

    m_ButtonRemoveAttributes = new JButton("Remove");
    m_ButtonRemoveAttributes.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            removeAttributes();
        }
    });
    panel.add(m_ButtonRemoveAttributes, BorderLayout.SOUTH);

    // right view
    panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createTitledBorder("Classes"));
    panelRight.add(panel, BorderLayout.NORTH);
    m_PanelClassAttributes = new AttributeSelectionPanel();
    panel.add(m_PanelClassAttributes, BorderLayout.CENTER);

    m_ButtonSetClassAttributes = new JButton("Use class attributes");
    m_ButtonSetClassAttributes.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            useClassAttributes();
        }
    });
    panel.add(m_ButtonSetClassAttributes, BorderLayout.SOUTH);

    panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createTitledBorder("Selected attribute"));
    panelRight.add(panel, BorderLayout.CENTER);
    m_PanelAttributeSummary = new AttributeSummaryPanel();
    panel.add(m_PanelAttributeSummary, BorderLayout.CENTER);
}