/*
* 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.panel;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Observable;
import java.util.logging.Logger;
import javax.swing.JComponent;
import org.geoforge.guillc.jfree.chart.GfrChartPanelDstLgrStepLogsTloAbs;
import org.geoforge.guillc.optionpane.GfrOptionPaneAbs;
import org.geoforge.guillc.togglebutton.GfrTbnAbs;
import org.geoforge.guillc.togglebutton.GfrTbnStepRenderingJfcChart;
import org.geoforge.jfreechart.data.xy.GfrXYSeriesDepVarAbs;
import org.geoforge.jfreechart.handler.IHandlerContainerLogsTlo;
import org.geoforge.jfreechart.handler.IHandlerStepRenderer;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
import org.geoforge.mdldat.event.*;
import org.jfree.chart.ChartMouseEvent;
/**
*
* @author bantchao
*/
abstract public class GfrPnlPrintableSctAwtDspSecTloJfcChartLgrStepLogsTloAbs extends GfrPnlPrintableSctAwtDspSecTloJfcChartLgrAbs implements
PropertyChangeListener,
IHandlerContainerLogsTlo
{
// ----
// begin: instantiate logger for this class
final private static Logger _LOGGER_ = Logger.getLogger(GfrPnlPrintableSctAwtDspSecTloJfcChartLgrStepLogsTloAbs.class.getName());
static
{
GfrPnlPrintableSctAwtDspSecTloJfcChartLgrStepLogsTloAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
}
// end: instantiate logger for this class
// ----
@Override
abstract public void chartMouseMoved(ChartMouseEvent evt);
protected GfrPnlPrintableSctAwtDspSecTloJfcChartLgrStepLogsTloAbs(
GfrPnlStatusBarAbs pnlStatusBar,
String strIdTlo,
String strIdViewer,
String strLocationToolbar)
{
super(pnlStatusBar,
strIdTlo,
strIdViewer,
strLocationToolbar
);
}
@Override
public void actionPerformed(ActionEvent e)
{
Object objSource = e.getSource();
if (objSource instanceof GfrTbnStepRenderingJfcChart)
{
GfrTbnAbs tbn = (GfrTbnAbs) objSource;
boolean bln = tbn.isSelected();
try
{
((IHandlerStepRenderer) super._tot).setRendererStep(bln);
}
catch(Exception exc)
{
exc.printStackTrace();
return;
}
super.revalidate();
if (super.isVisible())
super.repaint();
return;
}
super.actionPerformed(e);
}
@Override
public void propertyChange(PropertyChangeEvent evt)
{
if (! (evt.getSource() instanceof GfrXYSeriesDepVarAbs))
return;
String strNameProperty = evt.getPropertyName();
if (strNameProperty.compareTo("Key") != 0)
return;
((JComponent) super._tot).revalidate();
((JComponent) super._tot).repaint();
super.revalidate();
if (super.isVisible())
super.repaint();
String strOldValue = (String) evt.getOldValue();
String strNewValue = (String) evt.getNewValue();
// beg tempo
if (super._tot instanceof GfrChartPanelDstLgrStepLogsTloAbs)
((GfrChartPanelDstLgrStepLogsTloAbs) super._tot).updateSeriesNameChanged(
strOldValue,
strNewValue);
// end tempo
}
@Override
public void update(Observable obs, Object objEvt)
{
try
{
if (objEvt instanceof GfrEvtMdlIdDatRemovedAllLloLogs)
{
GfrEvtMdlIdDatRemovedAllLloLogs evt = (GfrEvtMdlIdDatRemovedAllLloLogs) objEvt;
// TODO
String strIdTlo = evt.getId();
if (strIdTlo.compareTo(super._strIdTlo) != 0)
return;
removeAllLogsTlo();
// ending
return;
}
}
catch (Exception exc)
{
exc.printStackTrace();
String str = exc.getMessage();
GfrPnlPrintableSctAwtDspSecTloJfcChartLgrStepLogsTloAbs._LOGGER_.severe(str);
GfrOptionPaneAbs.s_showDialogError(null, str);
return;
}
super.update(obs, objEvt);
}
// ATTN: TO BE CHECKED
@Override
public boolean removeAllLogsTlo() throws Exception
{
return ((IHandlerContainerLogsTlo) super._tot).removeAllLogsTlo();
}
@Override
protected boolean _toggleCheckboxObject(String strIdObject, boolean blnValue) throws Exception
{
return false;
}
}