From: <Jen...@us...> - 2008-09-09 13:44:33
|
Revision: 1186 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1186&view=rev Author: JensLehmann Date: 2008-09-09 13:44:25 +0000 (Tue, 09 Sep 2008) Log Message: ----------- GUI update: - improved file chooser - tabs enable/disable appropriately - status panel for messages - cleanup Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java trunk/src/dl-learner/org/dllearner/gui/Config.java trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/gui/ExampleFileChooser.java trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java Modified: trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007-2008, 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/>. + * + */ package org.dllearner.gui; import java.net.URL; Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -24,11 +24,11 @@ import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; +import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; import org.dllearner.core.LearningProblemUnsupportedException; +import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningService; -import org.dllearner.core.LearningAlgorithm; -import org.dllearner.core.ReasonerComponent; import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.ConfigOption; @@ -58,6 +58,10 @@ // have changed configuration options, which require initialisation) private boolean[] needsInit = new boolean[4]; + // specifies whether the panel is enabled, i.e. the user + // can select it (all mandatory variables in selected components have been choosen) + private boolean[] isEnabled = new boolean[4]; + // learning algorithm status private boolean threadIsRunning = false; private Long algorithmRunStartTime = null; @@ -70,6 +74,8 @@ // none of the components is initialised for(int i=0; i<4; i++) { needsInit[i] = true; + // TODO there might be knowledge source without mandatory options + isEnabled[i] = false; } } @@ -282,6 +288,14 @@ return needsInit[3]; } + public boolean needsInit(int tabIndex) { + return needsInit[tabIndex]; + } + + public boolean isEnabled(int tabIndex) { + return isEnabled[tabIndex]; + } + /** * set true if you run LearningAlgorithm.init */ @@ -386,6 +400,9 @@ needsInit[1] = true; needsInit[2] = true; needsInit[3] = true; + if(mandatoryOptionsSpecified(component)) { + isEnabled[1] = true; + } } else if(component instanceof ReasonerComponent) { needsInit[1] = true; needsInit[2] = true; @@ -399,6 +416,10 @@ gui.updateTabColors(); } + private boolean mandatoryOptionsSpecified(Component component) { + return false; + } + // delegate method for getting config option values public <T> T getConfigOptionValue(Component component, ConfigOption<T> option) { return cm.getConfigOptionValue(component, option); Added: trunk/src/dl-learner/org/dllearner/gui/ExampleFileChooser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ExampleFileChooser.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/ExampleFileChooser.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -0,0 +1,58 @@ +/** + * Copyright (C) 2007-2008, 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/>. + * + */ +package org.dllearner.gui; + +import java.io.File; + +import javax.swing.JFileChooser; +import javax.swing.filechooser.FileFilter; + +/** + * Convenience class for choosing files from the example directory with a specific file ending. + * + * @author Jens Lehmann + * + */ +public class ExampleFileChooser extends JFileChooser { + + private static final long serialVersionUID = 1566010391199697892L; + + public ExampleFileChooser(final String fileEnding) { + super(new File("examples/")); + + FileFilter filter = new FileFilter() { + @Override + public boolean accept(File f) { + if (f.isDirectory()) + return true; + return f.getName().toLowerCase().endsWith("." + fileEnding); + } + + @Override + public String getDescription() { + return fileEnding + " files"; // name for filter + } + }; + + addChoosableFileFilter(filter); + setFileFilter(filter); + } + +} Modified: trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -20,7 +20,6 @@ package org.dllearner.gui; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; @@ -29,14 +28,16 @@ import javax.swing.JComboBox; import javax.swing.JPanel; -import org.dllearner.core.ComponentInitException; import org.dllearner.core.KnowledgeSource; +import org.dllearner.kb.OWLAPIOntology; +import org.dllearner.kb.OWLFile; /** - * KnowledgeSourcePanel, tab 0. Choose Source, change Options and final initiate - * KnowledgeSource. + * Knowledge source panel, tab 0. Choose source, change mandatory options and finally initialise + * knowledge source. * + * @author Jens Lehmann * @author Tilo Hielscher */ public class KnowledgeSourcePanel extends JPanel implements ActionListener { @@ -44,14 +45,14 @@ private static final long serialVersionUID = -7678275020058043937L; private Config config; - private StartGUI startGUI; - private JButton initButton; +// private StartGUI startGUI; +// private JButton initButton; private JButton setButton; private JButton clearButton; private String[] kbBoxItems = {}; private JComboBox cb = new JComboBox(kbBoxItems); private JPanel choosePanel = new JPanel(); - private JPanel initPanel = new JPanel(); +// private JPanel initPanel = new JPanel(); private int choosenClassIndex; private List<Class<? extends KnowledgeSource>> selectableSources; private OptionPanel optionPanel; @@ -60,16 +61,21 @@ super(new BorderLayout()); this.config = config; - this.startGUI = startGUI; +// this.startGUI = startGUI; selectableSources = config.getComponentManager().getKnowledgeSources(); + // to set a default source, we move it to the beginning of the list + selectableSources.remove(OWLFile.class); + selectableSources.add(0, OWLFile.class); + // OWL API ontology is only useful programmatically (not in the GUI itself) + selectableSources.remove(OWLAPIOntology.class); setButton = new JButton("Set"); setButton.addActionListener(this); setButton = new JButton("Clear All"); setButton.addActionListener(this); - initButton = new JButton("Init KnowledgeSource"); - initButton.addActionListener(this); - initButton.setEnabled(true); +// initButton = new JButton("Init KnowledgeSource"); +// initButton.addActionListener(this); +// initButton.setEnabled(true); // add to comboBox for (int i = 0; i < selectableSources.size(); i++) { @@ -90,10 +96,12 @@ add(choosePanel, BorderLayout.PAGE_START); add(optionPanel, BorderLayout.CENTER); - add(initPanel, BorderLayout.PAGE_END); +// add(initPanel, BorderLayout.PAGE_END); - setSource(); - updateAll(); + choosenClassIndex = cb.getSelectedIndex(); + +// setSource(); +// updateAll(); } public void actionPerformed(ActionEvent e) { @@ -101,7 +109,10 @@ choosenClassIndex = cb.getSelectedIndex(); // create a new knowledge source component config.newKnowledgeSource(selectableSources.get(choosenClassIndex)); - updateAll(); +// updateAll(); + updateOptionPanel(); + + System.out.println("update"); // config.setInitKnowledgeSource(false); // init(); } @@ -110,9 +121,9 @@ setSource(); } - if (e.getSource() == initButton) { - init(); - } +// if (e.getSource() == initButton) { +// init(); +// } if (e.getSource() == clearButton) { config.reInit(); @@ -132,6 +143,7 @@ /** * after this, next tab can be used */ + /* public void init() { setSource(); if (config.getKnowledgeSource() != null && config.isSetURL()) { @@ -145,19 +157,21 @@ } } } + */ /** * updateAll */ public void updateAll() { - updateComboBox(); +// updateComboBox(); updateOptionPanel(); - updateInitButtonColor(); +// updateInitButtonColor(); } /** * set ComboBox to selected class */ + /* public void updateComboBox() { if (config.getKnowledgeSource() != null) for (int i = 0; i < selectableSources.size(); i++) @@ -166,7 +180,7 @@ cb.setSelectedIndex(i); } this.choosenClassIndex = cb.getSelectedIndex(); - } + }*/ /** * update OptionPanel with new selection @@ -178,11 +192,13 @@ /** * make init-button red if you have to click */ + /* public void updateInitButtonColor() { if (!config.needsInitKnowledgeSource()) { initButton.setForeground(Color.RED); } else initButton.setForeground(Color.BLACK); } + */ } Modified: trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -31,7 +31,6 @@ import org.dllearner.algorithms.DBpediaNavigationSuggestor; import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; -import org.dllearner.core.ComponentInitException; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblemUnsupportedException; @@ -46,8 +45,8 @@ private static final long serialVersionUID = 8721490771860452959L; private Config config; - private StartGUI startGUI; - private List<Class<? extends LearningAlgorithm>> learner; +// private StartGUI startGUI; + private List<Class<? extends LearningAlgorithm>> selectableAlgorithms; private JPanel choosePanel = new JPanel(); private OptionPanel optionPanel; private JPanel initPanel = new JPanel(); @@ -60,14 +59,14 @@ super(new BorderLayout()); this.config = config; - this.startGUI = startGUI; - learner = config.getComponentManager().getLearningAlgorithms(); +// this.startGUI = startGUI; + selectableAlgorithms = config.getComponentManager().getLearningAlgorithms(); // to set a default learning algorithm, we move it to the beginning of the list - learner.remove(ExampleBasedROLComponent.class); - learner.add(0, ExampleBasedROLComponent.class); + selectableAlgorithms.remove(ExampleBasedROLComponent.class); + selectableAlgorithms.add(0, ExampleBasedROLComponent.class); // we also remove the DBpedia Navigation Suggestor (maybe shouldn't be declared as a learning algorithm at all; // at least it is not doing anything useful at the moment) - learner.remove(DBpediaNavigationSuggestor.class); + selectableAlgorithms.remove(DBpediaNavigationSuggestor.class); initButton = new JButton("Init LearingAlgorithm"); initButton.addActionListener(this); @@ -77,8 +76,8 @@ autoInitButton.addActionListener(this); // add into comboBox - for (int i = 0; i < learner.size(); i++) { - cb.addItem(config.getComponentManager().getComponentName(learner.get(i))); + for (int i = 0; i < selectableAlgorithms.size(); i++) { + cb.addItem(config.getComponentManager().getComponentName(selectableAlgorithms.get(i))); } choosePanel.add(cb); @@ -87,9 +86,9 @@ LearningAlgorithm la = null; try { - la = config.newLearningAlgorithm(learner.get(cb.getSelectedIndex())); + la = config.newLearningAlgorithm(selectableAlgorithms.get(cb.getSelectedIndex())); } catch (LearningProblemUnsupportedException e) { - // TODO Auto-generated catch block + // TODO display message (or avoid selection at all) e.printStackTrace(); } optionPanel = new OptionPanel(config, la); @@ -99,7 +98,7 @@ add(initPanel, BorderLayout.PAGE_END); choosenClassIndex = cb.getSelectedIndex(); - updateInitButtonColor(); +// updateInitButtonColor(); } public void actionPerformed(ActionEvent e) { @@ -124,7 +123,7 @@ if (config.getLearningProblem() != null && config.getReasoningService() != null) { try { config.setLearningAlgorithm(config.getComponentManager().learningAlgorithm( - learner.get(choosenClassIndex), config.getLearningProblem(), + selectableAlgorithms.get(choosenClassIndex), config.getLearningProblem(), config.getReasoningService())); updateOptionPanel(); } catch (LearningProblemUnsupportedException e) { @@ -165,7 +164,7 @@ */ public void updateComboBox() { if (config.getLearningAlgorithm() != null) - for (int i = 0; i < learner.size(); i++) + for (int i = 0; i < selectableAlgorithms.size(); i++) if (config.getLearningAlgorithm().getClass().equals( config.getComponentManager().getLearningAlgorithms().get(i))) { cb.setSelectedIndex(i); Modified: trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -21,7 +21,6 @@ */ import java.awt.BorderLayout; -import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; @@ -50,7 +49,7 @@ private JPanel choosePanel = new JPanel(); private OptionPanel optionPanel; private JPanel initPanel = new JPanel(); - private JButton initButton, setButton; + private JButton setButton; private int choosenClassIndex; LearningProblemPanel(final Config config, StartGUI startGUI) { Modified: trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -30,7 +30,6 @@ import javax.swing.JComboBox; import javax.swing.JPanel; -import org.dllearner.core.ComponentInitException; import org.dllearner.core.ReasonerComponent; import org.dllearner.reasoning.OWLAPIReasoner; @@ -45,7 +44,7 @@ private static final long serialVersionUID = -7678275020058043937L; private Config config; - private StartGUI startGUI; +// private StartGUI startGUI; private List<Class<? extends ReasonerComponent>> reasoner; private JPanel choosePanel = new JPanel(); private JPanel initPanel = new JPanel(); @@ -59,7 +58,7 @@ super(new BorderLayout()); this.config = config; - this.startGUI = startGUI; +// this.startGUI = startGUI; reasoner = config.getComponentManager().getReasonerComponents(); // to set a default reasoner, we move it to the beginning of the list reasoner.remove(OWLAPIReasoner.class); Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -19,25 +19,32 @@ */ package org.dllearner.gui; -import javax.swing.*; -import javax.swing.event.*; - +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.File; +import java.io.FileWriter; +import java.io.PrintWriter; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JTabbedPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.filechooser.FileFilter; + import org.apache.log4j.ConsoleAppender; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.SimpleLayout; -import org.dllearner.core.ComponentInitException; -import java.io.File; -import java.io.PrintWriter; -import java.io.FileWriter; -import javax.swing.filechooser.FileFilter; - /** * This class builds the basic GUI elements and is used to start the DL-Learner * GUI. @@ -71,6 +78,8 @@ private JMenuItem aboutItem = new JMenuItem("About"); private JMenuItem tutorialItem = new JMenuItem("Quick Tutorial"); + private StatusPanel statusPanel = new StatusPanel(); + public StartGUI() { this(null); } @@ -111,7 +120,8 @@ menuHelp.add(aboutItem); aboutItem.addActionListener(this); - add(tabPane); + add(tabPane, BorderLayout.CENTER); + add(statusPanel, BorderLayout.SOUTH); setVisible(true); updateTabColors(); @@ -177,8 +187,9 @@ // force platform look and feel try { UIManager.setLookAndFeel( - // "com.sun.java.swing.plaf.motif.MotifLookAndFeel"); - UIManager.getSystemLookAndFeelClassName()); + UIManager.getCrossPlatformLookAndFeelClassName()); +// "com.sun.java.swing.plaf.motif.MotifLookAndFeel"); +// UIManager.getSystemLookAndFeelClassName()); // TODO: currently everything is in bold on Linux (and Win?) } catch (ClassNotFoundException e) { e.printStackTrace(); @@ -197,21 +208,7 @@ // open config file if (e.getSource() == openItem) { // file dialog - JFileChooser fc = new JFileChooser(new File("examples/")); - // FileFilter only *.conf - fc.addChoosableFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - if (f.isDirectory()) - return true; - return f.getName().toLowerCase().endsWith(".conf"); - } - - @Override - public String getDescription() { - return "*.conf"; // name for filter - } - }); + JFileChooser fc = new ExampleFileChooser("conf"); if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { System.out.println("FILE: " + fc.getSelectedFile()); configLoad.openFile(fc.getSelectedFile()); @@ -264,25 +261,41 @@ * Update colors of tabulators; red should be clicked, black for OK. */ public void updateTabColors() { - if (config.needsInitKnowledgeSource()) - tabPane.setForegroundAt(0, Color.RED); - else - tabPane.setForegroundAt(0, Color.BLACK); - if (config.needsInitReasoner()) - tabPane.setForegroundAt(1, Color.RED); - else - tabPane.setForegroundAt(1, Color.BLACK); - if (config.needsInitLearningProblem()) - tabPane.setForegroundAt(2, Color.RED); - else - tabPane.setForegroundAt(2, Color.BLACK); - if (config.needsInitLearningAlgorithm()) { - tabPane.setForegroundAt(3, Color.RED); - tabPane.setForegroundAt(4, Color.RED); - } else { - tabPane.setForegroundAt(3, Color.BLACK); - tabPane.setForegroundAt(4, Color.BLACK); + for(int i=0; i<4; i++) { + // red = needs init, black = initialised + if(config.needsInit(i)) { + tabPane.setForegroundAt(i, Color.RED); + } else { + tabPane.setForegroundAt(i, Color.BLACK); + } + + // only enable tabs, which can be selected + // (note the i+1: knowledge source always enabled) + tabPane.setEnabledAt(i+1, config.isEnabled(i)); } + + // run panel is enabled if all mandatory algorithm parameters have been set +// tabPane.setEnabledAt(4, config.isEnabled(4)); + +// if (config.needsInitKnowledgeSource()) +// tabPane.setForegroundAt(0, Color.RED); +// else +// tabPane.setForegroundAt(0, Color.BLACK); +// if (config.needsInitReasoner()) +// tabPane.setForegroundAt(1, Color.RED); +// else +// tabPane.setForegroundAt(1, Color.BLACK); +// if (config.needsInitLearningProblem()) +// tabPane.setForegroundAt(2, Color.RED); +// else +// tabPane.setForegroundAt(2, Color.BLACK); +// if (config.needsInitLearningAlgorithm()) { +// tabPane.setForegroundAt(3, Color.RED); +// tabPane.setForegroundAt(4, Color.RED); +// } else { +// tabPane.setForegroundAt(3, Color.BLACK); +// tabPane.setForegroundAt(4, Color.BLACK); +// } // commented out as I do not see any reason why the method should update // everything @@ -294,4 +307,8 @@ // tab3.updateAll(); } + + public void setStatusMessage(String message) { + statusPanel.setStatus(message); + } } Added: trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2007-2008, 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/>. + * + */ +package org.dllearner.gui; + +import javax.swing.JLabel; +import javax.swing.JPanel; + +/** + * Status panel showing help messages, exceptions etc. + * + * @author Jens Lehmann + * + */ +public class StatusPanel extends JPanel { + + private static final long serialVersionUID = 2426470148153461670L; + + private String initText = "Please fill in the mandatory config options and proceed to the next tab."; + + private JLabel statusLabel = new JLabel(initText); + + public StatusPanel() { + super(); + add(statusLabel); + } + + public void setStatus(String message) { + statusLabel.setText(message); + } + +} Modified: trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -19,6 +19,8 @@ */ package org.dllearner.gui; +import java.awt.Dimension; + import javax.swing.JFrame; import javax.swing.JLabel; @@ -36,7 +38,7 @@ setTitle("Quick Tutorial"); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setLocationByPlatform(true); - setSize(300, 500); + setSize(300, 600); // display tutorial text String text = "<html><h2>Quick Tutorial</h2><p align=\"justify\">DL-Learner has a component" + @@ -50,12 +52,20 @@ "you have to choose and configure all four types of components." + " The run tab plays a special role: It is used to start the learning algorithm" + " and display statistical information.</p>" + + "<br /><p><i>Tab color explanation:</i> <br />gray = cannot be configured yet (mandatory configuration values missing)<br />" + + "red = needs to be initialised<br />black = component has been initialised</p>" + "<br /><p><i>Further references:</i><br />" + "Homepage: <a href=\"http://dl-learner.org\">http://dl-learner.org</a><br />" + "DL-Learner Architecture: <a href=\"http://dl-learner.org/wiki/Architecture\">http://dl-learner.org/wiki/Architecture</a>" + "</p><br /><p>Please send questions to le...@in....</p></html>"; JLabel label = new JLabel(text); + label.setMaximumSize(new Dimension(300,500)); add(label); +// JScrollPane scrollPane = new JScrollPane(label); +// scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); +// scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); +// scrollPane.setPreferredSize(new Dimension(300,500)); +// add(scrollPane); setVisible(true); } Modified: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -21,7 +21,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.File; import javax.swing.JButton; import javax.swing.JFileChooser; @@ -29,6 +28,7 @@ import org.dllearner.core.Component; import org.dllearner.core.config.StringConfigOption; +import org.dllearner.kb.OWLFile; /** * Panel for option String, defined in @@ -54,9 +54,14 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == setButton) { - if (checkForFilename()) { - // file dialog - JFileChooser fc = new JFileChooser(new File("examples/")); + if (configOption.getName().equals("filename")) { + JFileChooser fc; + if(component instanceof OWLFile) { + fc = new ExampleFileChooser("owl"); + } else { + fc = new ExampleFileChooser("kb"); + } + int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { value = fc.getSelectedFile().toString(); @@ -92,14 +97,6 @@ System.out.println("String: not valid value"); }*/ - /** - * Widget filename getName() == filename you should open a file dialog in - * ActionPerformed - */ - private Boolean checkForFilename() { - return configOption.getName().equalsIgnoreCase("filename"); - } - @Override public void buildWidgetPanel() { add(getLabel()); @@ -123,7 +120,8 @@ add(stringField); add(setButton); - if (checkForFilename()) + // special handling for filename option + if (configOption.getName().equals("filename")) setButton.setText("choose local file"); } Modified: trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -21,12 +21,20 @@ private OWLOntology ontology; + public OWLAPIOntology() { + this(null); + } + public OWLAPIOntology(OWLOntology onto) { this.ontology = onto; this.configurator = new OWLAPIOntologyConfigurator(this); } + public static String getName() { + return "OWL API Ontology"; + } + @Override public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |