From: <ton...@us...> - 2008-03-09 17:49:19
|
Revision: 698 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=698&view=rev Author: tonytacker Date: 2008-03-09 10:49:11 -0700 (Sun, 09 Mar 2008) Log Message: ----------- removed set-button from checkBoxList (special layout for WidgetPanelStringSet) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/CheckBoxList.java trunk/src/dl-learner/org/dllearner/gui/RunPanel.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java Modified: trunk/src/dl-learner/org/dllearner/gui/CheckBoxList.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/CheckBoxList.java 2008-03-09 11:49:21 UTC (rev 697) +++ trunk/src/dl-learner/org/dllearner/gui/CheckBoxList.java 2008-03-09 17:49:11 UTC (rev 698) @@ -20,7 +20,8 @@ package org.dllearner.gui; import javax.swing.*; - +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.BorderLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -33,17 +34,19 @@ * * @author Tilo Hielscher */ -public class CheckBoxList extends JPanel { +public class CheckBoxList extends JPanel implements ActionListener { private static final long serialVersionUID = -7119007550662195455L; private JPanel checkBoxPanel = new JPanel(); private LinkedList<JCheckBox> list = new LinkedList<JCheckBox>(); private GridBagLayout gridbag = new GridBagLayout(); private GridBagConstraints constraints = new GridBagConstraints(); + private WidgetPanelStringSet panel; /** * Make a JPanel with GridBagLayout. */ - public CheckBoxList() { + public CheckBoxList(WidgetPanelStringSet panel) { + this.panel = panel; checkBoxPanel.setLayout(gridbag); add(checkBoxPanel, BorderLayout.CENTER); constraints.anchor = GridBagConstraints.WEST; @@ -57,7 +60,9 @@ * will add to list. */ public void add(String label) { - list.add(new JCheckBox(label)); + JCheckBox chkBox = new JCheckBox(label); + list.add(chkBox); + chkBox.addActionListener(this); update(); } @@ -113,4 +118,8 @@ gbc.weightx = wx; gbc.weighty = wy; } + + public void actionPerformed(ActionEvent e) { + panel.specialSet(); + } } \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-03-09 11:49:21 UTC (rev 697) +++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-03-09 17:49:11 UTC (rev 698) @@ -153,6 +153,7 @@ } // tree if (e.getSource() == treeButton) { + @SuppressWarnings("unused") TreeWindow a = new TreeWindow(config); } } Modified: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java 2008-03-09 11:49:21 UTC (rev 697) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java 2008-03-09 17:49:11 UTC (rev 698) @@ -79,8 +79,7 @@ private JList stringList = new JList(); private DefaultListModel listModel = new DefaultListModel(); - private JButton setButton = new JButton("set"); - private CheckBoxList cBL = new CheckBoxList(); + private CheckBoxList cBL = new CheckBoxList(this); public WidgetPanelStringSet(Config config, Component component, Component oldComponent, Class<? extends Component> componentOption, ConfigOption<?> configOption) { @@ -100,7 +99,6 @@ addButton.addActionListener(this); removeButton.addActionListener(this); clearButton.addActionListener(this); - setButton.addActionListener(this); } public void actionPerformed(ActionEvent e) { @@ -132,15 +130,17 @@ // set entry value = exampleSet; setEntry(); - } else { - // SPECIAL LAYOUT - // setButton - if (e.getSource() == setButton) { - value = cBL.getSelections(); - setEntry(); - } } + } + /** + * Use this, to set entry for layout 2. + */ + public void specialSet() { + if (isSpecial()) { + this.value = cBL.getSelections(); + setEntry(); + } } @Override @@ -216,10 +216,6 @@ buildConstraints(constraints, 0, 1, 1, 1, 100, 100); gridbag.setConstraints(cBL, constraints); widgetPanel.add(cBL, constraints); - // setButton - buildConstraints(constraints, 1, 1, 1, 1, 100, 100); - gridbag.setConstraints(setButton, constraints); - widgetPanel.add(setButton, constraints); // DEFINE LIST // positiveExamples or negativeExamples if (configOption.getName().equalsIgnoreCase("positiveExamples") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |