final javax.swing.JFrame jf = new javax.swing.JFrame("Instances Panel"); jf.getContentPane().setLayout(new BorderLayout()); final InstancesSummaryPanel p = new InstancesSummaryPanel(); p.setBorder(BorderFactory.createTitledBorder("Relation")); jf.getContentPane().add(p, BorderLayout.CENTER); jf.addWindowListener(new java.awt.event.WindowAdapter() { args[0])); Instances i = new Instances(r); p.setInstances(i);
setLayout(gbLayout); JLabel lab = new JLabel("Relation:", SwingConstants.RIGHT); lab.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); gbConstraints.gridx = 0; gbLayout.setConstraints(lab, gbConstraints); add(lab); gbConstraints = new GridBagConstraints(); gbConstraints.anchor = GridBagConstraints.WEST; add(m_RelationNameLab); m_RelationNameLab.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10)); gbConstraints.gridx = 0; gbLayout.setConstraints(lab, gbConstraints); add(lab); gbConstraints = new GridBagConstraints(); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.weightx = 100; gbLayout.setConstraints(m_NumInstancesLab, gbConstraints); add(m_NumInstancesLab); m_NumInstancesLab.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10)); gbConstraints.gridx = 2; gbLayout.setConstraints(lab, gbConstraints); add(lab); gbConstraints = new GridBagConstraints(); gbConstraints.anchor = GridBagConstraints.WEST;
/** * Gets called when the thread starts. */ @Override protected void executionStarted() { m_ButtonApplyFilter.setEnabled(false); m_ButtonRemoveAttributes.setEnabled(false); m_PanelDataSummary.setEnabled(false); m_PanelAttributes.setEnabled(false); }
m_PanelDataSummary = new InstancesSummaryPanel(); m_PanelDataSummary.setBorder(BorderFactory.createTitledBorder("Current data set")); panelLeft.add(m_PanelDataSummary, BorderLayout.NORTH);
/** * Gets called when the data changed. */ @Override protected void update() { m_ButtonApplyFilter.setEnabled(hasData()); m_PanelAttributes.setEnabled(hasData()); m_PanelDataSummary.setEnabled(hasData()); m_ButtonRemoveAttributes.setEnabled(hasData()); m_PanelAttributeSummary.setEnabled(hasData()); m_PanelClassAttributes.setEnabled(hasData()); m_ButtonSetClassAttributes.setEnabled(hasData()); if (hasData()) { m_PanelAttributes.setInstances(getData()); m_PanelDataSummary.setInstances(getData()); m_PanelAttributeSummary.setInstances(getData()); m_PanelClassAttributes.setInstances(getData()); } } }
/** * Updates the set of instances that is currently held by the panel. * * @param i a value of type 'Instances' */ public void setInstances(Instances i) { m_Instances = i; m_Summary.setInstances(m_Instances); if (m_showClassComboBox) { DefaultComboBoxModel model = (DefaultComboBoxModel) m_ClassComboBox .getModel(); model.removeAllElements(); model.addElement(NO_CLASS); for (int n = 0; n < m_Instances.numAttributes(); n++) { Attribute att = m_Instances.attribute(n); String type = "(" + Attribute.typeToStringShort(att) + ")"; model.addElement(type + " " + att.name()); } if (m_Instances.classIndex() == -1) m_ClassComboBox.setSelectedIndex(m_Instances.numAttributes()); else m_ClassComboBox.setSelectedIndex(m_Instances.classIndex() + 1); // +1 // because // of // NO_CLASS // element } // Fire property change event for those interested. m_Support.firePropertyChange("", null, null); }
m_Summary.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
/** * Loads instances from a URL. * * @param u the URL to load from. */ protected void setInstancesFromURL(URL u) { boolean incremental = m_readIncrementally; try { m_Loader = ConverterUtils.getURLLoaderForFile(u.toString()); if (m_Loader == null) throw new Exception("No suitable URLSourcedLoader found for URL!\n" + u); // not an incremental loader? if (!(m_Loader instanceof IncrementalConverter)) incremental = false; // load ((URLSourcedLoader) m_Loader).setURL(u.toString()); if (incremental) { m_Summary.setShowZeroInstancesAsUnknown(m_showZeroInstancesAsUnknown); setInstances(m_Loader.getStructure()); } else { m_Summary.setShowZeroInstancesAsUnknown(false); setInstances(m_Loader.getDataSet()); } } catch (Exception ex) { JOptionPane.showMessageDialog(this, "Couldn't read from URL:\n" + u, "Load Instances", JOptionPane.ERROR_MESSAGE); } }
m_PanelDataSummary = new InstancesSummaryPanel(); m_PanelDataSummary.setBorder(BorderFactory.createTitledBorder("Current data set")); panelLeft.add(m_PanelDataSummary, BorderLayout.NORTH);
/** * Gets called when the data changed. */ @Override protected void update() { m_ButtonApplyFilter.setEnabled(hasData()); m_PanelAttributes.setEnabled(hasData()); m_PanelDataSummary.setEnabled(hasData()); m_ButtonRemoveAttributes.setEnabled(hasData()); m_PanelAttributeSummary.setEnabled(hasData()); m_PanelClassAttributes.setEnabled(hasData()); m_ButtonSetClassAttributes.setEnabled(hasData()); if (hasData()) { m_PanelAttributes.setInstances(getData()); m_PanelDataSummary.setInstances(getData()); m_PanelAttributeSummary.setInstances(getData()); m_PanelClassAttributes.setInstances(getData()); } } }
/** * Updates the set of instances that is currently held by the panel. * * @param i a value of type 'Instances' */ public void setInstances(Instances i) { m_Instances = i; m_Summary.setInstances(m_Instances); if (m_showClassComboBox) { DefaultComboBoxModel model = (DefaultComboBoxModel) m_ClassComboBox .getModel(); model.removeAllElements(); model.addElement(NO_CLASS); for (int n = 0; n < m_Instances.numAttributes(); n++) { Attribute att = m_Instances.attribute(n); String type = "(" + Attribute.typeToStringShort(att) + ")"; model.addElement(type + " " + att.name()); } if (m_Instances.classIndex() == -1) m_ClassComboBox.setSelectedIndex(m_Instances.numAttributes()); else m_ClassComboBox.setSelectedIndex(m_Instances.classIndex() + 1); // +1 // because // of // NO_CLASS // element } // Fire property change event for those interested. m_Support.firePropertyChange("", null, null); }
m_Summary.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
/** * Loads instances from a URL. * * @param u the URL to load from. */ protected void setInstancesFromURL(URL u) { boolean incremental = m_readIncrementally; try { m_Loader = ConverterUtils.getURLLoaderForFile(u.toString()); if (m_Loader == null) throw new Exception("No suitable URLSourcedLoader found for URL!\n" + u); // not an incremental loader? if (!(m_Loader instanceof IncrementalConverter)) incremental = false; // load ((URLSourcedLoader) m_Loader).setURL(u.toString()); if (incremental) { m_Summary.setShowZeroInstancesAsUnknown(m_showZeroInstancesAsUnknown); setInstances(m_Loader.getStructure()); } else { m_Summary.setShowZeroInstancesAsUnknown(false); setInstances(m_Loader.getDataSet()); } } catch (Exception ex) { JOptionPane.showMessageDialog(this, "Couldn't read from URL:\n" + u, "Load Instances", JOptionPane.ERROR_MESSAGE); } }
final javax.swing.JFrame jf = new javax.swing.JFrame("Instances Panel"); jf.getContentPane().setLayout(new BorderLayout()); final InstancesSummaryPanel p = new InstancesSummaryPanel(); p.setBorder(BorderFactory.createTitledBorder("Relation")); jf.getContentPane().add(p, BorderLayout.CENTER); jf.addWindowListener(new java.awt.event.WindowAdapter() { args[0])); Instances i = new Instances(r); p.setInstances(i);
m_PanelDataSummary = new InstancesSummaryPanel(); m_PanelDataSummary.setBorder(BorderFactory.createTitledBorder("Current data set")); panelLeft.add(m_PanelDataSummary, BorderLayout.NORTH);
/** * Gets called when the data changed. */ @Override protected void update() { m_ButtonApplyFilter.setEnabled(hasData()); m_PanelAttributes.setEnabled(hasData()); m_PanelDataSummary.setEnabled(hasData()); m_ButtonRemoveAttributes.setEnabled(hasData()); m_PanelAttributeSummary.setEnabled(hasData()); m_PanelClassAttributes.setEnabled(hasData()); m_ButtonSetClassAttributes.setEnabled(hasData()); if (hasData()) { m_PanelAttributes.setInstances(getData()); m_PanelDataSummary.setInstances(getData()); m_PanelAttributeSummary.setInstances(getData()); m_PanelClassAttributes.setInstances(getData()); } } }
public void run() { boolean first = (m_AttPanel.getTableModel() == null); m_InstSummaryPanel.setInstances(m_Instances); m_AttPanel.setInstances(m_Instances);
m_InstSummaryPanel.setBorder(BorderFactory .createTitledBorder("Current relation")); JPanel attStuffHolderPanel = new JPanel();
setLayout(gbLayout); JLabel lab = new JLabel("Relation:", SwingConstants.RIGHT); lab.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); gbConstraints.gridx = 0; gbLayout.setConstraints(lab, gbConstraints); add(lab); gbConstraints = new GridBagConstraints(); gbConstraints.anchor = GridBagConstraints.WEST; add(m_RelationNameLab); m_RelationNameLab.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10)); gbConstraints.gridx = 0; gbLayout.setConstraints(lab, gbConstraints); add(lab); gbConstraints = new GridBagConstraints(); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.weightx = 100; gbLayout.setConstraints(m_NumInstancesLab, gbConstraints); add(m_NumInstancesLab); m_NumInstancesLab.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10)); gbConstraints.gridx = 2; gbLayout.setConstraints(lab, gbConstraints); add(lab); gbConstraints = new GridBagConstraints(); gbConstraints.anchor = GridBagConstraints.WEST;
/** * Gets called when the thread starts. */ @Override protected void executionStarted() { m_ButtonApplyFilter.setEnabled(false); m_ButtonRemoveAttributes.setEnabled(false); m_PanelDataSummary.setEnabled(false); m_PanelAttributes.setEnabled(false); }