/*
* 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.Component;
import javax.help.HelpBroker;
import javax.swing.JSplitPane;
import org.geoforge.guihlp.handler.IGfrHandlerSetEnabledTrueHelpOnThisSection;
import org.geoforge.io.handler.IGfrHandlerUnserializedObject;
import org.geoforge.lang.handler.IGfrHandlerLifeCycleObject;
/**
*
* @author bantchao
*
* email: bantchao_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*
*/
abstract public class GfrSplHlpAbs extends JSplitPane implements
IGfrHandlerLifeCycleObject,
IGfrHandlerUnserializedObject, // !!!
IGfrHandlerSetEnabledTrueHelpOnThisSection
{
@Override
abstract public void setEnabledTrueHelpOnThisSection(HelpBroker hbr);
protected GfrSplHlpAbs()
{
super();
super.setOneTouchExpandable(true);
}
@Override
public boolean init()
{
return true;
}
@Override
public void destroy()
{
}
@Override
public void loadUnserializedObject() throws Exception
{
for (int i=0; i<super.getComponentCount(); i++)
{
Component cmpCur = super.getComponent(i);
if (cmpCur instanceof IGfrHandlerUnserializedObject)
{
IGfrHandlerUnserializedObject serCur = (IGfrHandlerUnserializedObject) cmpCur;
serCur.loadUnserializedObject();
}
}
}
@Override
public void releaseUnserializedObject() throws Exception
{
for (int i=0; i<super.getComponentCount(); i++)
{
Component cmpCur = super.getComponent(i);
if (cmpCur instanceof IGfrHandlerUnserializedObject)
{
IGfrHandlerUnserializedObject serCur = (IGfrHandlerUnserializedObject) cmpCur;
serCur.releaseUnserializedObject();
}
}
}
}