Package ucar.nc2.ui.gis
Class MapBean
- java.lang.Object
-
- ucar.nc2.ui.gis.MapBean
-
- Direct Known Subclasses:
ShapeFileBean,WorldMapBean
public abstract class MapBean extends Object
Wrap map Renderers as beans.
-
-
Constructor Summary
Constructors Constructor Description MapBean()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(PropertyChangeListener l)Add a PropertyChangeEvent Listener.protected voidfirePropertyChangeEvent(PropertyChangeEvent event)protected voidfirePropertyChangeEvent(Object source, String propertyName, Object oldValue, Object newValue)ActiongetAction()Construct the Action that is called when this bean's menu item/buttcon is selected.abstract StringgetActionDesc()abstract StringgetActionName()abstract ImageIcongetIcon()abstract RenderergetRenderer()Each bean has one Renderer, made current when Action is calledstatic ucar.ui.widget.PopupMenugetStandardMapSelectButton(PropertyChangeListener pcl)static ucar.ui.widget.PopupMenumakeMapSelectButton()Convenience routine to make a button with a popup menu attached.voidremovePropertyChangeListener(PropertyChangeListener l)Remove a PropertyChangeEvent Listener.
-
-
-
Method Detail
-
getIcon
public abstract ImageIcon getIcon()
-
getActionName
public abstract String getActionName()
-
getActionDesc
public abstract String getActionDesc()
-
getRenderer
public abstract Renderer getRenderer()
Each bean has one Renderer, made current when Action is called
-
getAction
public Action getAction()
Construct the Action that is called when this bean's menu item/buttcon is selected. Typically this routine is only called once when the bean is added. The Action itself is called whenever the menu/buttcon is selected. The action should have NAME, SMALL_ICON and SHORT_DESC properties set. The applications uses these to put up a buttcon and menu item. The actionPerformed() method may do various things, but it must send a PropertyChangeEvent with newValue = Renderer.- Returns:
- the Action to be called.
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener l)
Add a PropertyChangeEvent Listener.
-
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener l)
Remove a PropertyChangeEvent Listener.
-
firePropertyChangeEvent
protected void firePropertyChangeEvent(Object source, String propertyName, Object oldValue, Object newValue)
-
firePropertyChangeEvent
protected void firePropertyChangeEvent(PropertyChangeEvent event)
-
makeMapSelectButton
public static ucar.ui.widget.PopupMenu makeMapSelectButton()
Convenience routine to make a button with a popup menu attached. to use:thredds.ui.PopupMenu mapBeanMenu = MapBean.makeMapSelectButton(); AbstractButton butt = (AbstractButton) mapBeanMenu.getParentComponent(); addToMenu (butt); // add map beans here mapBeanMenu.addAction( mb.getActionDesc(), mb.getIcon(), mb.getAction()); mb.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange( java.beans.PropertyChangeEvent e) { if (e.getPropertyName().equals("Renderer")) { mapRender = (thredds.viewer.ui.Renderer) e.getNewValue(); mapRender.setProjection( np.getProjectionImpl()); redraw(); } } });
-
getStandardMapSelectButton
public static ucar.ui.widget.PopupMenu getStandardMapSelectButton(PropertyChangeListener pcl)
-
-