/*
* 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.list;
import javax.swing.JDialog;
import javax.swing.JList;
import javax.swing.ListSelectionModel;
import org.geoforge.java.awt.color.GfrColor;
import org.geoforge.lang.handler.IGfrHandlerLifeCycleObject;
import org.geoforge.guillc.listcellrenderer.GfrListCellRendererEnabledNo;
import org.geoforge.guillc.listcellrenderer.GfrListCellRendererEnabledYes;
/**
*
* @author Amadeus.Sowerby
*
* email: Amadeus.Sowerby_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*/
public class GfrLst extends JList implements IGfrHandlerLifeCycleObject
{
public GfrLst()
{
super();
}
public GfrLst(String[] strs)
{
super(strs);
}
@Override
public boolean init()
{
super.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
return true;
}
@Override
public void destroy()
{
//-- void
}
/*
* setEnable(true/false) updates the :
* -> list background
* -> the list cellRenderers
*
*/
@Override
public void setEnabled(boolean bln)
{
super.setEnabled(bln);
if (!bln)
{
super.setBackground(GfrColor.ULTRA_RED);
super.setCellRenderer(new GfrListCellRendererEnabledNo());
}
else
{
super.setBackground(GfrListCellRendererEnabledYes.COL_BG_ENABLED);
super.setCellRenderer(new GfrListCellRendererEnabledYes());
}
}
}