Package org.geoforge.guillc.dialog

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

/*
*  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.Rectangle;
import java.util.ArrayList;
import java.util.EventObject;
import java.util.logging.Logger;
import javax.swing.JFrame;
import org.geoforge.guillc.dialog.GfrDlgPgsAbs;
import org.geoforge.guillc.optionpane.GfrOptionPaneAbs;
import org.geoforge.guillc.thread.GfrPgsThrRdrHeadSheetAbs;
import org.geoforge.guillc.handler.IGfrHandlerListenerPanelDialog;
import org.geoforge.lang.util.eventobject.GfrEventObjectAbs;
import org.geoforge.lang.handler.IGfrHandlerEventListenerThreadJobProgress;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;

/**
*
* @author bantchao
*
* email: bantchao_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*/
public abstract class GfrDlgIoVarRdrHeadSheetAbs extends GfrDlgIoVarAbs implements
        IGfrHandlerEventListenerThreadJobProgress
{
   // ----
   // begin: instantiate logger for this class

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

   static
   {
      GfrDlgIoVarRdrHeadSheetAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
   }

   // end: instantiate logger for this class
   // ----
  
   final protected static int INT_WIDTH_LABEL = 110;
   final protected static int INT_WIDTH_CONTENT = 220;
   final protected static int INT_WIDTH_BUTTON = 90;
   //--end static fields
   //--
  
   public ArrayList<Object[]> getResultList() { return this._alt_; }
   public int getResultNbColumn() { return this._intNbColumn_; }
  
   private ArrayList<Object[]> _alt_ = null;
   private int _intNbColumn_ = -1;
  
   protected int _intColumnMin = -1;
  
   @Override
   protected boolean _noErrorToDisplay()
   {
      return true;
   }
  
   protected GfrDlgIoVarRdrHeadSheetAbs(
           JFrame frmOwner,
           String[] strsExistingItems,
           String strSentence,
           int intColumnMin)
   {
      super(
              frmOwner,
              strsExistingItems,
              strSentence);
     
      this._intColumnMin = intColumnMin;
   }

   @Override
   public boolean init()
   {
      if (!super.init())
         return false;

      // !!!
      super._pnlIoChooser.addPanelListener((IGfrHandlerListenerPanelDialog) this);
     
      super.pack();
      super.setMinimumSize(super.getSize());

      return true;
   }

   protected GfrDlgPgsAbs _dlgProgress = null;
  
   protected void _centerDialogProgress()
   {
        Rectangle rec = super.getBounds();
        int x = rec.x + (rec.width - super.getSize().width)/2;
        int y = rec.y + (rec.height - super.getSize().height)/2;
        this._dlgProgress.setLocation(x, y);
    }

   @Override
   public void handleEventThreadJobDone(EventObject e)
   {
      if (this._dlgProgress != null)
      {
         this._dlgProgress.setVisible(false);
         this._dlgProgress.destroy();
         this._dlgProgress = null;
      }
     
     
      GfrEventObjectAbs evt = (GfrEventObjectAbs) e;
     
      String strError = evt.getError();
     
      if (strError != null)
      {
         // TODO: show error dialog
         GfrDlgIoVarRdrHeadSheetAbs._LOGGER_.warning("strError=" + strError);
         GfrOptionPaneAbs.s_showDialogWarning(this, strError);
         return;
      }
     
      GfrPgsThrRdrHeadSheetAbs thr = (GfrPgsThrRdrHeadSheetAbs) evt.getSource();
      this._alt_ = thr.getResultList();
      this._intNbColumn_ = thr.getResultNbColumn();
     
      _performAction();
      super.setVisible(false);
   }
}
TOP

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

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.