/*
* 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.splitpane;
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.logging.Logger;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import org.geoforge.guillc.handler.IGfrHandlerToggableNode;
import org.geoforge.guillc.optionpane.GfrOptionPaneAbs;
import org.geoforge.guillc.treenode.GfrNodAbs;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
import org.geoforge.wrpbasprsdsp.selection.lastspace.GfrWrpDspLastSpaceProject;
/**
*
* @author bantchao
*
* email: bantchao_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*
*
*/
abstract public class GfrSplHlpMainAppCadPrjWwdEarthChkSelAbs extends GfrSplHlpMainAppCadPrjWwdEarthAbs implements
MouseListener
{
// ----
// begin: instantiate logger for this class
final private static Logger _LOGGER_ = Logger.getLogger(GfrSplHlpMainAppCadPrjWwdEarthChkSelAbs.class.getName());
static
{
GfrSplHlpMainAppCadPrjWwdEarthChkSelAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
}
// end: instantiate logger for this class
// ----
abstract protected void _invokedLaterUpdateCheckUncheckTlo(IGfrHandlerToggableNode nodCheck);
protected GfrSplHlpMainAppCadPrjWwdEarthChkSelAbs(
String strNameSuffixThreadOpenDisplay,
String strWhatViewer,
String strNameTabThis) throws Exception
{
super(
strNameSuffixThreadOpenDisplay,
strWhatViewer,
strNameTabThis);
}
@Override
public void mousePressed(MouseEvent evt)
{
if (! (evt.getSource() instanceof JTree))
{
String str = "! (e.getSource() instanceof JTree)";
GfrSplHlpMainAppCadPrjWwdEarthChkSelAbs._LOGGER_.severe(str);
GfrOptionPaneAbs.s_showDialogError(null, str);
return;
}
JTree tre = (JTree) evt.getSource();
if (SwingUtilities.isRightMouseButton(evt) | SwingUtilities.isMiddleMouseButton(evt))
return;
int intX = evt.getX();
int intY = evt.getY();
int intRow = tre.getRowForLocation(intX, intY);
javax.swing.tree.TreePath pth = tre.getPathForRow(intRow);
if (pth == null)
return;
GfrNodAbs nod = (GfrNodAbs) pth.getLastPathComponent();
if (! (nod instanceof IGfrHandlerToggableNode))
return;
final IGfrHandlerToggableNode nodCheck = (IGfrHandlerToggableNode) nod;
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
_invokedLaterUpdateCheckUncheckTlo(nodCheck);
}
});
}
@Override
protected void _saveValueLocationDivider(int intVal) throws Exception
{
GfrWrpDspLastSpaceProject.getInstance().setLastDividerLocationSplitGeolocatedSel(intVal);
}
@Override
protected int _loadValueLocationDivider() throws Exception
{
return GfrWrpDspLastSpaceProject.getInstance().getLastDividerLocationSplitGeolocatedSel();
}
// ---
@Override
public void mouseReleased(MouseEvent e) {}
@Override
public void mouseEntered(MouseEvent e) {}
@Override
public void mouseExited(MouseEvent e) {}
@Override
public void mouseClicked(MouseEvent e) {}
// ---
}