Package org.geoforge.guillc.dialog

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

/*
*  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 2
*  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, write to the Free Software
*  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

package org.geoforge.guillc.dialog;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.event.DocumentListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import org.geoforge.guillc.panel.GfrPnlCmdCancelOk;
import org.geoforge.guillc.panel.PnlSelEditTblAbs;
import org.geoforge.guillc.optionpane.GfrOptionPaneAbs;
import org.geoforge.guillc.panel.PnlContentsOkTextNewSettingsMloPicksLineOpenFilled;
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
*
*/
abstract public class GfrDlgNewSettingsMloPicksLineAbs extends GfrDlgNewSettingsAbs implements
        TableModelListener,
        MouseListener
{
   // ----
   // begin: instantiate logger for this class

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

   static
   {
      GfrDlgNewSettingsMloPicksLineAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
   }
   // end: instantiate logger for this class
   // ----
  
   final static private int _F_INT_H_ = 120
           + PnlSelEditTblAbs.INT_H;

   public ArrayList<Point2D.Double> getValueLine()
   {
      return ((PnlContentsOkTextNewSettingsMloPicksLineOpenFilled) super._pnlContents).getValueLine();
   }

   protected GfrDlgNewSettingsMloPicksLineAbs(
           JFrame frmOwner,
           String[] strsExistingItems,
           Double[] dblsX,
           Double[] dblsY,
           String strWhat)
   {
      super(frmOwner,
              "New " + strWhat,
              GfrDlgOkNewTextAbs.INT_DIM_W,
              GfrDlgNewSettingsMloPicksLineAbs._F_INT_H_,
              strsExistingItems);

      super._pnlContents = new PnlContentsOkTextNewSettingsMloPicksLineOpenFilled(
              (DocumentListener) this,
              (java.awt.event.KeyListener) this,
              strsExistingItems,
              strWhat,
              dblsX,
              dblsY);

      super.setTitle(super.getTitle() + " from picks - step 2/2");
   }
  
   @Override
   public boolean init()
   {
      if (! super.init())
         return false;
     
      ((GfrPnlCmdCancelOk) super._pnlCommand).setEnabledOkCommandDialog(true);
     
      return true;
   }

   @Override
   public void tableChanged(TableModelEvent e)
   {
      super._updateFromSettings_();
   }

   @Override
   public void mouseClicked(MouseEvent e)
   {
      if (!(e.getSource() instanceof JTable))
      {

         String str = "! (e.getSource() instanceof JTable)";
         GfrDlgNewSettingsMloPicksLineAbs._LOGGER_.severe(str);
         GfrOptionPaneAbs.s_showDialogError(null, str);
         System.exit(1);
      }

      JTable tbl = (JTable) e.getSource();

      // get most recently selected row index

      int row = tbl.getSelectedRow();

      // get most recently selected column index

      int column = tbl.getSelectedColumn();

      if (row == -1 || column == -1)
         return; // can't determine selected cell

      if (!tbl.getModel().isCellEditable(row, column))
      {
         super._updateFromSettings_();
         return;
      }

      // user editing cell, should disable "OK" button
      ((GfrPnlCmdCancelOk) super._pnlCommand).setEnabledOkCommandDialog(false);
   }

   @Override
   public void mousePressed(MouseEvent e)
   {
   }

   @Override
   public void mouseReleased(MouseEvent e)
   {
   }

   @Override
   public void mouseEntered(MouseEvent e)
   {
   }

   @Override
   public void mouseExited(MouseEvent e)
   {
   }
}
TOP

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

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.