List of usage examples for weka.gui AttributeVisualizationPanel AttributeVisualizationPanel
public AttributeVisualizationPanel()
From source file:adams.flow.sink.WekaAttributeSummary.java
License:Open Source License
/** * Displays the token (the panel and dialog have already been created at * this stage)./*from ww w. j av a 2 s . c om*/ * * @param token the token to display */ @Override protected void display(Token token) { Instances inst; int[] indices; AttributeVisualizationPanel panel; inst = (Instances) token.getPayload(); m_Range.setData(inst); indices = m_Range.getIntIndices(); clearPanel(); if (indices.length == 1) { m_PanelAtt = new AttributeVisualizationPanel(); m_PanelAtt.setInstances(inst); m_PanelAtt.setAttribute(indices[0]); m_Panel.add(m_PanelAtt, BorderLayout.CENTER); } else if (indices.length > 1) { m_TabbedPane = new BaseTabbedPane(); m_Panel.add(m_TabbedPane, BorderLayout.CENTER); for (int index : indices) { panel = new AttributeVisualizationPanel(); panel.setInstances(inst); panel.setAttribute(index); m_TabbedPane.addTab(inst.attribute(index).name(), panel); } } }
From source file:adams.flow.sink.WekaAttributeSummary.java
License:Open Source License
/** * Creates a new display panel for the token. * * @param token the token to display in a new panel, can be null * @return the generated panel//from w w w . ja va 2s.c o m */ @Override public DisplayPanel createDisplayPanel(Token token) { AbstractDisplayPanel result; result = new AbstractComponentDisplayPanel(getClass().getSimpleName()) { private static final long serialVersionUID = 7384093089760722339L; protected BaseTabbedPane m_TabbedPane; protected AttributeVisualizationPanel m_PanelAtt; @Override protected void initGUI() { super.initGUI(); setLayout(new BorderLayout()); m_PanelAtt = new AttributeVisualizationPanel(); add(m_PanelAtt, BorderLayout.CENTER); } @Override public void display(Token token) { Instances inst; int[] indices; AttributeVisualizationPanel panel; inst = (Instances) token.getPayload(); m_Range.setData(inst); indices = m_Range.getIntIndices(); clearPanel(); if (indices.length == 1) { m_PanelAtt = new AttributeVisualizationPanel(); m_PanelAtt.setInstances(inst); m_PanelAtt.setAttribute(indices[0]); m_Panel.add(m_PanelAtt, BorderLayout.CENTER); } else if (indices.length > 1) { m_TabbedPane = new BaseTabbedPane(); m_Panel.add(m_TabbedPane, BorderLayout.CENTER); for (int index : indices) { panel = new AttributeVisualizationPanel(); panel.setInstances(inst); panel.setAttribute(index); m_TabbedPane.addTab(inst.attribute(index).name(), panel); } } } @Override public void cleanUp() { } @Override public void clearPanel() { removeAll(); } @Override public JComponent supplyComponent() { if (m_TabbedPane != null) return m_TabbedPane; else return m_PanelAtt; } }; if (token != null) result.display(token); return result; }
From source file:sirius.trainer.step3.SelectFeaturePane.java
License:Open Source License
public SelectFeaturePane(JInternalFrame parent, JTabbedPane tabbedPane, ApplicationData applicationData) { this.parent = parent; this.applicationData = applicationData; this.statusPane = applicationData.getStatusPane(); this.tabbedPane = tabbedPane; JPanel north = new JPanel(new BorderLayout()); north.setBorder(BorderFactory.createTitledBorder("Filter Features")); applyFilterButton = new JButton("Apply Filter"); applyFilterButton.addActionListener(this); filterEditor = new GenericObjectEditor(); /** Filter configuration */ PropertyPanel filterPanel = new PropertyPanel(filterEditor); filterEditor.setClassType(weka.filters.Filter.class); north.add(filterPanel, BorderLayout.CENTER); undoButton = new JButton("Undo (Remove/Filter)"); undoButton.setEnabled(false);// w w w. j ava 2 s . c o m undoButton.addActionListener(this); JPanel filterButtonsPanel = new JPanel(new GridLayout(1, 2)); filterButtonsPanel.add(applyFilterButton); north.add(filterButtonsPanel, BorderLayout.EAST); JPanel center = new JPanel(new GridLayout(1, 2)); //center_left JPanel center_left = new JPanel(new BorderLayout()); JPanel instancesSummaryPanel = new JPanel(new GridLayout(1, 2)); instancesSummaryPanel.setBorder(BorderFactory.createTitledBorder("Current File")); numberOfInstancesLabel = new JLabel(" Instances: "); numberOfFeaturesLabel = new JLabel("Features: "); instancesSummaryPanel.add(numberOfInstancesLabel); instancesSummaryPanel.add(numberOfFeaturesLabel); JPanel center_left_center = new JPanel(new BorderLayout()); center_left_center.setBorder(BorderFactory.createTitledBorder("Features")); myAttributeSelectionPanel = new MyAttributeSelectionPanel(); center_left_center.add(myAttributeSelectionPanel, BorderLayout.CENTER); JPanel removeAttributePanel = new JPanel(new GridLayout(1, 1)); removeAttributePanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5)); removeAttributeButton = new JButton("Remove Marked Features"); removeAttributeButton.setEnabled(false); removeAttributeButton.setToolTipText("Remove selected attributes."); removeAttributeButton.addActionListener(this); removeAttributePanel.add(removeAttributeButton); center_left_center.add(removeAttributePanel, BorderLayout.SOUTH); center_left.add(instancesSummaryPanel, BorderLayout.NORTH); center_left.add(center_left_center, BorderLayout.CENTER); this.saveArffButton = new JButton("Save as Arff (All)"); this.saveArffButton.addActionListener(this); this.saveArffNegOnlyButton = new JButton("Save as Arff (-ve Only)"); this.saveArffNegOnlyButton.addActionListener(this); this.saveArffPosOnlyButton = new JButton("Save as Arff (+ve Only)"); this.saveArffPosOnlyButton.addActionListener(this); JPanel outputPanel = new JPanel(new GridLayout(1, 3)); outputPanel.setBorder(BorderFactory.createTitledBorder("Output")); outputPanel.add(this.saveArffButton); outputPanel.add(this.saveArffPosOnlyButton); outputPanel.add(this.saveArffNegOnlyButton); center_left.add(outputPanel, BorderLayout.SOUTH); center.add(center_left); JPanel center_right = new JPanel(new GridLayout(2, 1)); attributeSummaryPanel = new AttributeSummaryPanel(); attributeSummaryPanel.setBorder(BorderFactory.createTitledBorder("Selected Features")); attributeVisualizePanel = new AttributeVisualizationPanel(); center_right.add(attributeSummaryPanel); center_right.add(attributeVisualizePanel); center.add(center_right); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); JPanel south = new JPanel(gridbag); south.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 5)); previousStepButton = new JButton("<<< BACK"); previousStepButton.addActionListener(this); c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weighty = 1.0; gridbag.setConstraints(previousStepButton, c); c.weightx = 3.0; c.weighty = 1.0; gridbag.setConstraints(this.undoButton, c); nextStepButton = new JButton("NEXT >>>"); nextStepButton.addActionListener(this); c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weighty = 1.0; gridbag.setConstraints(nextStepButton, c); south.add(previousStepButton); south.add(this.undoButton); south.add(nextStepButton); setLayout(new BorderLayout()); add(center, BorderLayout.CENTER); add(north, BorderLayout.NORTH); add(south, BorderLayout.SOUTH); myAttributeSelectionPanel.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { ListSelectionModel lm = (ListSelectionModel) e.getSource(); for (int i = e.getFirstIndex(); i <= e.getLastIndex(); i++) { if (lm.isSelectedIndex(i)) { attributeSummaryPanel.setAttribute(i); attributeVisualizePanel.setAttribute(i); break; } } } } }); }