Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

com/ohrasys/app/gdsparser/GDSParserController.java

Go to the documentation of this file.
00001 /* Copyright (C) 2004 Thomas N. Valine
00002  * tvaline@users.sourceforge.net
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00017  * 02111-1307, USA. */
00018 
00019 package com.ohrasys.app.gdsparser;
00020 import com.ohrasys.app.*;
00021 
00022 import java.awt.event.*;
00023 import java.io.*;
00024 
00032 public class GDSParserController
00033 extends AbstractAppController {
00035   private GDSParserI18NFactory i18n;
00036 
00046   public GDSParserController(AbstractAppModel model, AbstractAppView view,
00047       AppOption options[])
00048     throws AppException{super(model, view, options);}
00049 
00059   public ActionEvent processEvent(java.awt.event.ActionEvent evt) {
00060     if(evt != null) {
00061       if(evt.getSource() == model){notifyViews(evt);}
00062       else{notifyModel(evt);}
00063       if(evt.getID() == GDSParserEvents.INFO_EVENT) {
00064         System.out.println(
00065           i18n.getString(i18n.i18n_INFO) + evt.getActionCommand());
00066       }
00067       if(evt.getID() == GDSParserEvents.ERROR_EVENT) {
00068         System.out.println(
00069           i18n.getString(i18n.i18n_ERROR) + evt.getActionCommand());
00070       }
00071       if(evt.getID() == GDSParserEvents.APPEXIT_EVENT){exitApp();}
00072     }
00073 
00074     return null;
00075   }
00076 
00084   public void startController() {
00085     AppOption option;
00086     if(AppOption.findOption(GDSParserUtil.VERSION_FLAG, options) != null) {
00087       System.out.println(GDSParserUtil.getVersion());
00088       System.exit(0);
00089     }
00090     if(AppOption.findOption(GDSParserUtil.HELP_FLAG, options) != null) {
00091       System.out.println(GDSParserUtil.getUsage());
00092       System.exit(0);
00093     }
00094     System.out.println(GDSParserUtil.getVersion());
00095     System.out.println(GDSParserUtil.getCopyright());
00096     if((option = AppOption.findOption(GDSParserUtil.LOG_FLAG, options)) !=
00097         null) {
00098       System.out.println(
00099         i18n.getString(i18n.i18n_INFO_LOG_SET_TO) + option.getValue());
00100       notifyViews(new ActionEvent(this,
00101           GDSParserEvents.SETLOG_EVENT, option.getValue()));
00102     }
00103     if((option = AppOption.findOption(GDSParserUtil.GDSIN_FLAG, options)) !=
00104         null) {
00105       System.out.println(
00106         i18n.getString(i18n.i18n_INFO_GDS_SET_TO) + option.getValue());
00107       notifyViews(new ActionEvent(this,
00108           GDSParserEvents.SETGDS_EVENT, option.getValue()));
00109     }
00110     if(AppOption.findOption(GDSParserUtil.NOGUI_FLAG, options) != null) {
00111       notifyViews(new ActionEvent(this,
00112           GDSParserEvents.PARSE_EVENT, null));
00113     } else{((GDSParserView)views.get(0)).show();}
00114   } // end method startController
00115 
00121   public String toString(){return super.toString();}
00122 
00124   private void exitApp() {
00125     System.out.println(i18n.getString(i18n.i18n_INFO_DONE));
00126     System.exit(0);
00127   }
00128 } // end class GDSParserController
00129 
00130 
00131 /* This material is distributed under the GNU General Public License.
00132  * For more information please go to http://www.gnu.org/copyleft/gpl.html */

Generated on Mon May 23 13:48:55 2005 for Java GDS Parser (JGDSParser) by  doxygen 1.4.2