Package org.geoforge.guillc.dialog

Source Code of org.geoforge.guillc.dialog.GfrDlgPgsBldObjsAbs

/*
*  Copyright (C) 2011-2014 GeoForge Project
*
*  This program is free software: you can redistribute it and/or modify
*  it under the terms of the GNU Lesser General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  This program 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 Lesser General Public License for more details.
*
*  You should have received a copy of the GNU Lesser General Public License
*  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package org.geoforge.guillc.dialog;

import java.awt.BorderLayout;
import java.util.EventObject;
import java.util.logging.Logger;
import javax.swing.JFrame;
import org.geoforge.lang.util.eventobject.GfrEventObjectAbs;
import org.geoforge.lang.handler.IGfrHandlerEventListenerThreadJobProgress;
import org.geoforge.lang.util.GfrResBundleLang;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;

/**
*
* @author bantchao
*/
/*
* "Objs" means "Objects"
*/
abstract public class GfrDlgPgsBldObjsAbs extends GfrDlgPgsAbs implements
        IGfrHandlerEventListenerThreadJobProgress
{
  
   // ----
   // begin: instantiate logger for this class

   final private static Logger _LOGGER_ = Logger.getLogger(GfrDlgPgsBldObjsAbs.class.getName());

   static
   {
      GfrDlgPgsBldObjsAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
   }
   // end: instantiate logger for this class
   // ----
  
  
   protected GfrDlgPgsBldObjsAbs(
           JFrame frmOwner,
           String strTitleWhat,
           String strMessageTextfield)
   {
      super(frmOwner,
              strMessageTextfield,
              strTitleWhat,
              "Processing", // !!!!
              BorderLayout.CENTER);
   }
  

  
   @Override
   public void handleEventThreadJobDone(EventObject e)
   {
      super.setVisible(false);
      GfrEventObjectAbs evt = (GfrEventObjectAbs) e;
     
      String strError = evt.getError();
     
      if (strError == null)
      {
         destroy();
         return;
      }
     
      // ---
     
      if (super._thr != null) // !!! && isAlive() !!!
         super._thr.interrupt();


      if (! super._blnCancelled)
      {
         String strWarning = "Sorry, failed to write objects in project";

         strWarning += "\n\n";
         strWarning += GfrResBundleLang.s_getInstance().getValue("word.details") + "\n";


         strWarning += "   " + strError;       

         GfrDlgPgsBldObjsAbs._LOGGER_.warning(strWarning);
         //GfrOptionPaneAbs.s_showDialogWarning(super._frmOwner, strWarning);

         destroy();
      }
     
   }
  
   @Override
   protected void _invokeLaterCleanUp()
   {
      // no need for cleaning up, job done in child's thread     
      destroy();
   }
}
TOP

Related Classes of org.geoforge.guillc.dialog.GfrDlgPgsBldObjsAbs

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.