001    /**
002     * Copyright (C) 2007-2008, Jens Lehmann
003     *
004     * This file is part of DL-Learner.
005     * 
006     * DL-Learner is free software; you can redistribute it and/or modify
007     * it under the terms of the GNU General Public License as published by
008     * the Free Software Foundation; either version 3 of the License, or
009     * (at your option) any later version.
010     *
011     * DL-Learner is distributed in the hope that it will be useful,
012     * but WITHOUT ANY WARRANTY; without even the implied warranty of
013     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014     * GNU General Public License for more details.
015     *
016     * You should have received a copy of the GNU General Public License
017     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
018     *
019     */
020    
021    package org.dllearner.tools.ore;
022    
023    import java.util.Locale;
024    
025    import javax.swing.UIManager;
026    import javax.swing.UnsupportedLookAndFeelException;
027    
028    
029    /**
030     * Main class starting the wizard and registering wizard panels.
031     * @author Lorenz Buehmann
032     *
033     */
034    public class Main {
035        
036            /**
037             * main method.
038             * @param args possible is to use OWL-File as parameter
039             */
040        public static void main(String[] args) {
041            try {
042                            UIManager.setLookAndFeel(
043                                    UIManager.getSystemLookAndFeelClassName());
044                    } catch (ClassNotFoundException e) {
045                            // TODO Auto-generated catch block
046                            e.printStackTrace();
047                    } catch (InstantiationException e) {
048                            // TODO Auto-generated catch block
049                            e.printStackTrace();
050                    } catch (IllegalAccessException e) {
051                            // TODO Auto-generated catch block
052                            e.printStackTrace();
053                    } catch (UnsupportedLookAndFeelException e) {
054                            // TODO Auto-generated catch block
055                            e.printStackTrace();
056                    }
057                    Locale.setDefault(Locale.ENGLISH);
058            Wizard wizard = new Wizard();
059            wizard.getDialog().setTitle("DL-Learner ORE-Tool");
060            wizard.getDialog().setSize(1300, 600);
061            
062            WizardPanelDescriptor descriptor1 = new IntroductionPanelDescriptor();
063            wizard.registerWizardPanel(IntroductionPanelDescriptor.IDENTIFIER, descriptor1);
064    
065            WizardPanelDescriptor descriptor2 = new KnowledgeSourcePanelDescriptor();
066            wizard.registerWizardPanel(KnowledgeSourcePanelDescriptor.IDENTIFIER, descriptor2);
067    
068            WizardPanelDescriptor descriptor3 = new ClassPanelOWLDescriptor();
069            wizard.registerWizardPanel(ClassPanelOWLDescriptor.IDENTIFIER, descriptor3);
070            
071            WizardPanelDescriptor descriptor4 = new ClassPanelSparqlDescriptor();
072            wizard.registerWizardPanel(ClassPanelSparqlDescriptor.IDENTIFIER, descriptor4);
073            
074            WizardPanelDescriptor descriptor5 = new LearningPanelDescriptor();
075            wizard.registerWizardPanel(LearningPanelDescriptor.IDENTIFIER, descriptor5);
076            
077            WizardPanelDescriptor descriptor6 = new RepairPanelDescriptor();
078            wizard.registerWizardPanel(RepairPanelDescriptor.IDENTIFIER, descriptor6);
079            
080            WizardPanelDescriptor descriptor7 = new SavePanelDescriptor();
081            wizard.registerWizardPanel(SavePanelDescriptor.IDENTIFIER, descriptor7);
082            
083            if (!(args.length == 1)){
084                     wizard.setCurrentPanel(IntroductionPanelDescriptor.IDENTIFIER);
085            } else{
086                    ((KnowledgeSourcePanelDescriptor) descriptor2).getPanel().setFileURL(args[0]); 
087                    wizard.setCurrentPanel(KnowledgeSourcePanelDescriptor.IDENTIFIER);
088                    wizard.setLeftPanel(1);
089                     
090            }
091                            
092           
093            int ret = wizard.showModalDialog();
094           
095            
096            System.out.println("Dialog return code is (0=Finish,1=Cancel,2=Error): " + ret);
097           
098            
099            System.exit(0);
100            
101        }
102        
103    }