Generated on Fri Oct 6 16:26:43 2006 for Gecode/J by doxygen 1.4.7

Explorer.java

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Guido Tack <tack@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Guido Tack, 2006
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-09-11 17:06:50 +0200 (Mon, 11 Sep 2006) $ by $Author: zayenz $
00010  *     $Revision: 3650 $
00011  *
00012  *  This file is part of Gecode, the generic constraint
00013  *  development environment:
00014  *     http://www.gecode.org
00015  *
00016  *  See the file "LICENSE" for information on usage and
00017  *  redistribution of this file, and for a
00018  *     DISCLAIMER OF ALL WARRANTIES.
00019  *
00020  */
00021 
00022 package org.gecode.explorer;
00023 
00024 import org.gecode.Space;
00025 import org.gecode.explorer.swing.SwingUI;
00026 
00027 import javax.swing.UIManager;
00028 
00029 public class Explorer {
00030     ExplorerUIInterface ui;
00031     ExplorerController ctrl;
00032 
00033     private void setSystemLAF() {
00034         try {
00035             UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
00036         } 
00037         catch(ClassNotFoundException ex) {}
00038         catch(InstantiationException ex) {}
00039         catch(IllegalAccessException ex) {}
00040         catch(javax.swing.UnsupportedLookAndFeelException ex) {}
00041     }
00042 
00043     public Explorer(Space rootSpace) {
00044         setSystemLAF();
00045         ctrl = new ExplorerController(rootSpace, false);
00046         ui = new SwingUI(ctrl);
00047     }
00048 
00049     public Explorer(Space rootSpace, boolean bab) {
00050         setSystemLAF();
00051         ctrl = new ExplorerController(rootSpace, bab);
00052         ui = new SwingUI(ctrl);
00053     }
00054 
00055     public void openUI() {
00056         ui.open();
00057     }
00058 
00059     public void exploreOne() {
00060         ctrl.exploreOne();
00061     }
00062 
00063     public void exploreAll() {
00064         ctrl.exploreAll();
00065     }
00066 
00067     public void addEventListener(ExplorerEventListener e) {
00068         ctrl.addEventListener(e);
00069     }
00070     
00071 }