.addOkListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) {
m_Backup = copyObject(m_Object); setLayout(new BorderLayout()); top.add(chooseButton, BorderLayout.WEST); top.add(m_ClassNameLabel, BorderLayout.CENTER); add(top, BorderLayout.NORTH); } else { add(m_ClassNameLabel, BorderLayout.NORTH); add(m_ChildPropertySheet, BorderLayout.CENTER); okcButs.add(m_okBut); okcButs.add(m_cancelBut); add(okcButs, BorderLayout.SOUTH); if (m_Object != null) { updateObjectNames(); updateChildPropertySheet();
.addOkListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { .addCancelListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) {
.addOkListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) {
.addOkListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) {
.addOkListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) {
m_Backup = copyObject(m_Object); setLayout(new BorderLayout()); top.add(chooseButton, BorderLayout.WEST); top.add(m_ClassNameLabel, BorderLayout.CENTER); add(top, BorderLayout.NORTH); } else { add(m_ClassNameLabel, BorderLayout.NORTH); add(m_ChildPropertySheet, BorderLayout.CENTER); okcButs.add(m_okBut); okcButs.add(m_cancelBut); add(okcButs, BorderLayout.SOUTH); if (m_Object != null) { updateObjectNames(); updateChildPropertySheet();
.addOkListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { .addCancelListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) {
((GOEPanel) m_Editor.getCustomEditor()).removeOkListener(this); getContentPane().remove(0); ((GOEPanel) m_Editor.getCustomEditor()).addOkListener(this); if (m_Editor.supportsCustomEditor()) { view = (Component) m_Editor.getCustomEditor();
((GOEPanel) m_Editor.getCustomEditor()).removeOkListener(this); getContentPane().remove(0); ((GOEPanel) m_Editor.getCustomEditor()).addOkListener(this); if (m_Editor.supportsCustomEditor()) { view = (Component) m_Editor.getCustomEditor();
((GOEPanel) goe.getCustomEditor()).addOkListener(new ActionListener() {
m_EditorComponent.repaint();
m_EditorComponent.repaint();
/** * Pops up generic object editor with list of conversion filters * * @param f the File */ private void converterQuery(final File f) { final GenericObjectEditor convEd = new GenericObjectEditor(true); try { convEd.setClassType(weka.core.converters.Loader.class); convEd.setValue(new weka.core.converters.CSVLoader()); ((GenericObjectEditor.GOEPanel) convEd.getCustomEditor()) .addOkListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tryConverter((Loader) convEd.getValue(), f); } }); } catch (Exception ex) { } PropertyDialog pd; if (PropertyDialog.getParentDialog(this) != null) pd = new PropertyDialog(PropertyDialog.getParentDialog(this), convEd, -1, -1); else pd = new PropertyDialog(PropertyDialog.getParentFrame(this), convEd, -1, -1); pd.setVisible(true); }
/** * Pops up generic object editor with list of conversion filters * * @param f the File */ private void converterQuery(final File f) { final GenericObjectEditor convEd = new GenericObjectEditor(true); try { convEd.setClassType(weka.core.converters.Loader.class); convEd.setValue(new weka.core.converters.CSVLoader()); ((GenericObjectEditor.GOEPanel) convEd.getCustomEditor()) .addOkListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tryConverter((Loader) convEd.getValue(), f); } }); } catch (Exception ex) { } PropertyDialog pd; if (PropertyDialog.getParentDialog(this) != null) pd = new PropertyDialog(PropertyDialog.getParentDialog(this), convEd, -1, -1); else pd = new PropertyDialog(PropertyDialog.getParentFrame(this), convEd, -1, -1); pd.setVisible(true); }
/** * Saves an object to a file selected by the user. * * @param object the object to save */ protected void saveObject(Object object) { if (m_FileChooser == null) { createFileChooser(); } int returnVal = m_FileChooser.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File sFile = m_FileChooser.getSelectedFile(); try { ObjectOutputStream oo = new ObjectOutputStream( new BufferedOutputStream(new FileOutputStream(sFile))); oo.writeObject(object); oo.close(); } catch (Exception ex) { JOptionPane.showMessageDialog(this, "Couldn't write to file: " + sFile.getName() + "\n" + ex.getMessage(), "Save object", JOptionPane.ERROR_MESSAGE); } } }
/** * Saves an object to a file selected by the user. * * @param object the object to save */ protected void saveObject(Object object) { if (m_FileChooser == null) { createFileChooser(); } int returnVal = m_FileChooser.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File sFile = m_FileChooser.getSelectedFile(); try { ObjectOutputStream oo = new ObjectOutputStream( new BufferedOutputStream(new FileOutputStream(sFile))); oo.writeObject(object); oo.close(); } catch (Exception ex) { JOptionPane.showMessageDialog(this, "Couldn't write to file: " + sFile.getName() + "\n" + ex.getMessage(), "Save object", JOptionPane.ERROR_MESSAGE); } } }
/** * Updates the child property sheet, and creates if needed. */ public void updateChildPropertySheet() { // Update the object name displayed String className = "None"; if (m_Object != null) { className = m_Object.getClass().getName(); } m_ClassNameLabel.setText(className); // Set the object as the target of the propertysheet m_ChildPropertySheet.setTarget(m_Object); // Adjust size of containing window if possible if ((getTopLevelAncestor() != null) && (getTopLevelAncestor() instanceof Window)) { ((Window) getTopLevelAncestor()).pack(); } } }