From: <ton...@us...> - 2008-01-24 01:10:04
|
Revision: 422 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=422&view=rev Author: tonytacker Date: 2008-01-23 17:10:00 -0800 (Wed, 23 Jan 2008) Log Message: ----------- changed widgets Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelInteger.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/gui/AbstractWidgetPanel.java Deleted: trunk/src/dl-learner/org/dllearner/gui/AbstractWidgetPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/AbstractWidgetPanel.java 2008-01-23 12:41:32 UTC (rev 421) +++ trunk/src/dl-learner/org/dllearner/gui/AbstractWidgetPanel.java 2008-01-24 01:10:00 UTC (rev 422) @@ -1,88 +0,0 @@ -package org.dllearner.gui; - -/** - * Copyright (C) 2007, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -//import java.util.List; - -import javax.swing.JTextField; -import javax.swing.JLabel; -import javax.swing.JPanel; -//import javax.swing.JTable; -//import javax.swing.table.DefaultTableModel; - -//import org.dllearner.core.Component; -//import org.dllearner.core.ComponentManager; -//import org.dllearner.core.config.ConfigOption; -//import org.dllearner.core.ComponentManager; -import org.dllearner.core.config.ConfigOption; - - -/** - * AbstractWidgetPanel - * - * @author Tilo Hielscher - * - */ -public class AbstractWidgetPanel extends JPanel implements ActionListener { - - private static final long serialVersionUID = -1802111225835164644L; - - //private Config config; - //private ConfigOption<?> configOption; - //private JLabel nameLabel; - private JPanel centerPanel = new JPanel(); - - public AbstractWidgetPanel(Config config, ConfigOption<?> configOption) { - super(new BorderLayout()); - //this.config = config; - //this.configOption = configOption; - - if (configOption.toString().contains("IntegerConfigOption")) { - JLabel nameLabel = new JLabel(configOption.getName()); - JTextField integerField = new JTextField(3); - integerField.setText("100"); - System.out.println(configOption.getDefaultValue()); - centerPanel.add(nameLabel); - centerPanel.add(integerField); - add(centerPanel, BorderLayout.CENTER); - } - else if (false) { - - } - else { - JLabel nameLabel = new JLabel(configOption.getName()); - JLabel notImplementedLabel = new JLabel("not implemented"); - centerPanel.add(nameLabel); - centerPanel.add(notImplementedLabel); - add(centerPanel, BorderLayout.CENTER); - } - - - - } - - public void actionPerformed(ActionEvent e) { - - } -} Modified: trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java 2008-01-23 12:41:32 UTC (rev 421) +++ trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java 2008-01-24 01:10:00 UTC (rev 422) @@ -32,6 +32,7 @@ import org.dllearner.core.Component; import org.dllearner.core.ComponentManager; +import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.ConfigOption; /** @@ -87,6 +88,9 @@ // show as table if (e.getSource() == tableButton) { optionList = ComponentManager.getConfigOptions(componentClass); + + // clear + centerPanel.removeAll(); /* System.out.println("name: " + optionList.get(i).getName()); // name System.out.println("default value: " + optionList.get(i).getDefaultValue()); // default value @@ -110,19 +114,26 @@ // show normal if (e.getSource() == normalButton) { optionList = ComponentManager.getConfigOptions(componentClass); // get class for options - for (int i=0; i<optionList.size(); i++) { +/* for (int i=0; i<optionList.size(); i++) { System.out.println("option: " + optionList.get(i)); } - +*/ // clear centerPanel.removeAll(); - //get an AbstractWidgetPanel TEST - AbstractWidgetPanel firstPanel = new AbstractWidgetPanel(config, optionList.get(0)); - AbstractWidgetPanel secondPanel = new AbstractWidgetPanel(config, optionList.get(1)); + //get a WidgetPanel TEST + WidgetPanelInteger firstPanel = new WidgetPanelInteger(config, optionList.get(0)); centerPanel.add(firstPanel); - centerPanel.add(secondPanel); + //ConfigEntry(ConfigOption<T> option, T value); + + + // PROBLEM + //ConfigEntry testEntry = new ConfigEntry(optionList.get(0), (int)10); + + + + // update graphic centerPanel.updateUI(); Added: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelInteger.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelInteger.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelInteger.java 2008-01-24 01:10:00 UTC (rev 422) @@ -0,0 +1,99 @@ +package org.dllearner.gui; + +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.Color; +//import java.util.List; + +import javax.swing.JTextField; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JButton; + +//import javax.swing.JTable; +//import javax.swing.table.DefaultTableModel; + + +import org.dllearner.core.config.ConfigOption; + + +/** + * WidgetPanel + * + * @author Tilo Hielscher + * + */ +public class WidgetPanelInteger extends JPanel implements ActionListener { + + private static final long serialVersionUID = -1802111225835164644L; + + //private Config config; + private ConfigOption<?> configOption; + private JLabel nameLabel; + private JPanel centerPanel = new JPanel(); + private JButton setButton = new JButton("Set"); + + + public WidgetPanelInteger(Config config, ConfigOption<?> configOption) { + //this.config = config; + this.configOption = configOption; + + // default + nameLabel = new JLabel(configOption.getName()); + setButton.addActionListener(this); + + // IntegerConfigOption + if (configOption.toString().contains("IntegerConfigOption")) { + JTextField integerField = new JTextField(3); + integerField.setText("100"); + System.out.println(configOption.getDefaultValue()); + centerPanel.add(nameLabel); + centerPanel.add(integerField); + centerPanel.add(setButton); + } + // UNKNOWN + else { + nameLabel = new JLabel(configOption.getName()); + JLabel notImplementedLabel = new JLabel("not an integer"); + notImplementedLabel.setForeground(Color.RED); + centerPanel.add(nameLabel); + centerPanel.add(notImplementedLabel); + } + + // default + add(centerPanel, BorderLayout.CENTER); + } + + public JPanel getPanel() { + return this; + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == setButton) { + int number = 10; + System.out.println(number); + System.out.println(configOption); + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |