/** * returns the currently selected DataGenerator * * @return the current data generator */ public DataGenerator getGenerator() { return (DataGenerator) m_GeneratorEditor.getValue(); }
/** * Returns a popup menu that allows the user to change the class of object. * * @return a JPopupMenu that when shown will let the user choose the class */ public JPopupMenu getChooseClassPopupMenu() { if (DEBUG) System.out.println("Objectnames: " + m_ObjectNames); return super.getChooseClassPopupMenu(); }
@Override public void propertyChange(PropertyChangeEvent e) { // user selected different class? if (!m_ResultMatrix.getClass().equals( m_ResultMatrixEditor.getValue().getClass())) { // if it's the preferred class, then automaticallly use the // Experimenter defaults if (m_ResultMatrixEditor.getValue().getClass() .equals(ExperimenterDefaults.getOutputFormat().getClass())) { m_ResultMatrix = ExperimenterDefaults.getOutputFormat(); m_ResultMatrixEditor.setValue(ExperimenterDefaults .getOutputFormat()); } else { m_ResultMatrix = (ResultMatrix) m_ResultMatrixEditor.getValue(); } setData(); } 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); }
GenericObjectEditor.registerEditors(); GenericObjectEditor ce = new GenericObjectEditor(true); ce.setClassType(weka.classifiers.Classifier.class); Object initial = new weka.classifiers.rules.ZeroR(); if (args.length > 0) { ce.setClassType(WekaPackageClassLoaderManager.forName(args[0])); if (args.length > 1) { ce.setValue(initial); } else { ce.setDefaultValue(); ce.setValue(initial);
m_AssociatorEditor.setClassType(Associator.class); m_AssociatorEditor.setValue(ExplorerDefaults.getAssociator()); m_AssociatorEditor.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) {
GenericObjectEditor m_ClassifierEditor = new GenericObjectEditor(); PropertyPanel m_CEPanel = new PropertyPanel(m_ClassifierEditor); m_ClassifierEditor.setClassType(Classifier.class); m_ClassifierEditor.setValue(wekaSegmentation.getClassifier()); Object c = (Object)m_ClassifierEditor.getValue(); String originalOptions = ""; String originalClassifierName = c.getClass().getName(); c = (Object)m_ClassifierEditor.getValue(); String options = ""; final String[] optionsArray = ((OptionHandler)c).getOptions();
public static void determineAllClasses() { weka.gui.GenericObjectEditor.determineClasses(); try { GenericPropertiesCreator creator = new GenericPropertiesCreator();
m_RPEditor.setClassType(ResultProducer.class); m_RPEditor.setEnabled(false); m_RPEditor.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { m_RLEditor.setClassType(ResultListener.class); m_RLEditor.setEnabled(false); m_RLEditor.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) {
m_Editor.setClassType(AbstractFileLoader.class); m_Editor.setValue(new weka.core.converters.ArffLoader()); } else { m_Editor.setClassType(AbstractFileSaver.class); m_Editor.setValue(new weka.core.converters.ArffSaver());
((GenericObjectEditor) m_Editor).setClassType(m_ElementClass); m_Editor.setValue(GenericObjectEditor.makeCopy(m_ElementList .getSelectedValue())); } catch (Exception ex) { || (!((GenericObjectEditor)m_Editor).wasCancelPressed())) { m_ListModel.set(m_ElementList.getSelectedIndex(), m_Editor.getValue());
/** * creates the panel */ public DataGeneratorPanel() { setLayout(new BorderLayout()); add(new PropertyPanel(m_GeneratorEditor), BorderLayout.CENTER); // editor m_GeneratorEditor.setClassType(DataGenerator.class); m_GeneratorEditor.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { repaint(); } }); // set default generator setGenerator(null); }
Hashtable<String, HierarchyPropertyParser> hpps = getClassesFromProperties(); HierarchyPropertyParser hpp = null; Enumeration<HierarchyPropertyParser> enm = hpps.elements(); setValue(WekaPackageClassLoaderManager.forName(defaultValue).newInstance());
m_RPEditor.setValue(m_Exp.getResultProducer()); m_RPEditor.setEnabled(true); m_RPEditorPanel.setEnabled(true); m_RPEditorPanel.repaint(); m_RLEditor.setValue(m_Exp.getResultListener()); m_RLEditor.setEnabled(true); m_RLEditorPanel.setEnabled(true); m_RLEditorPanel.repaint();
setAccessory(panel); m_Editor = new GenericObjectEditor(false); ((GenericObjectEditor.GOEPanel) m_Editor.getCustomEditor()) .addOkListener(new ActionListener() { @Override ((GenericObjectEditor.GOEPanel) m_Editor.getCustomEditor()) .addCancelListener(new ActionListener() { @Override
JButton chooseButton = createChooseClassButton(); JPanel top = new JPanel(); top.setLayout(new BorderLayout()); m_ObjectNames = getClassesFromProperties(); if (m_Object != null) { updateObjectNames(); updateChildPropertySheet();
/** * Updates the list of selectable object names, adding any new names to the * list. */ protected void updateObjectNames() { if (m_ObjectNames == null) { m_ObjectNames = getClassesFromProperties(); } if (m_Object != null) { String className = m_Object.getClass().getName(); String root = getRootFromClass(className, new HierarchyPropertyParser().getSeperator()); HierarchyPropertyParser hpp = m_ObjectNames.get(root); if (hpp != null) { if (!hpp.contains(className)) { hpp.add(className); } } } }
@Override public void actionPerformed(ActionEvent e) { m_ChildPropertySheet.closingCancel(); m_CancelWasPressed = true; if (m_Backup != null) { m_Object = copyObject(m_Backup); // To fire property change m_Support.firePropertyChange("", null, null); m_ObjectNames = getClassesFromProperties(); updateObjectNames(); updateChildPropertySheet(); } if ((getTopLevelAncestor() != null) && (getTopLevelAncestor() instanceof Window)) { Window w = (Window) getTopLevelAncestor(); w.dispose(); } } });
/** * Sets the class of values that can be edited. * * @param type a value of type 'Class' */ public void setClassType(Class<?> type) { m_ClassType = type; m_ObjectNames = getClassesFromProperties(); }