All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.mb.DesktopBeanBagView

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----com.ibm.beans.mb.BeanBagView
                                   |
                                   +----com.ibm.beans.mb.DesktopBeanBagView

public class DesktopBeanBagView
extends BeanBagView
implements ActionListener, ItemSelectable
This class provides a simple view for BeanBagModel objects that uses icons to represent individual managed beans. This view supports single and multiple selection. This class is suggested for use as a guide for developing more sophisticated BeanBag views; however, it has enough function to support typical usages of BeanBag views and models.

If the default size of the view is unacceptable, call the setSize() method with the desired dimension immediately after construction.

See Also:
BeanBagView, ActionListener

Constructor Index

 o DesktopBeanBagView()
Default constructor.
 o DesktopBeanBagView(BeanBagModel)
Constructs a DesktopBeanBagView object containing the specified model using the default LayoutManager object and default LabeledIconStyle object.
 o DesktopBeanBagView(BeanBagModel, LayoutManager, LabeledIconStyle)
Constructs a DesktopBeanBagView object containing the specified model using the specified LayoutManager object and specified LabeledIconStyle object.

Method Index

 o actionPerformed(ActionEvent)
Handles the event generated when the mouse selects an icon in the view.
 o addIcon(ManagedBean)
Adds an icon to the view representing the specified managed bean.
 o addIcons(Vector)
Adds icons to the view representing the specified managed beans.
 o addItemListener(ItemListener)
 o destruct()
Removes all icons from the view and then calls the destruct() method of base class.
 o fireItem(Object)
 o getIconStyle()
Gets the icon style that the view currently is using when adding icons.
 o getPreferredSize()
Gets the preferred size of the view.
 o getSelectedObjects()
 o handleAdd(ModelEvent)
Handles the event generated when items are added to the BeanBagModel object.
 o handleRemove(ModelEvent)
Handles the event generated when items are removed from our BeanBagModel object.
 o isSingleSelect()
Gets the selection behavior.
 o itemStateChanged(ItemEvent)
Manages selection changes.
 o mouseClicked(MouseEvent)
Handles the event generated when the mouse is clicked in the view.
 o paint(Graphics)
Paints the DesktopBeanBagView object.
 o refresh()
Refreshes the view.
 o removeAllIcons()
Removes all icons from the view.
 o removeIcon(ManagedBean)
Removes the icon representing the specified managed bean from the view.
 o removeIcons(Vector)
Removes the icons representing the specified managed beans from the view.
 o removeItemListener(ItemListener)
 o select(ManagedBean)
Selects or deselects, using the appropriate selection behavior, the specified managed bean.
 o setIconStyle(LabeledIconStyle)
Sets the icon style for future icons added to the view.
 o setSingleSelect(boolean)
Sets the selection behavior as single or multiple.
 o setSize(int, int)
Sets the size of the current view.

Constructors

 o DesktopBeanBagView
 public DesktopBeanBagView()
Default constructor.

 o DesktopBeanBagView
 public DesktopBeanBagView(BeanBagModel model)
Constructs a DesktopBeanBagView object containing the specified model using the default LayoutManager object and default LabeledIconStyle object.

Parameters:
model - The BeanBagModel to be viewed.
See Also:
BeanBagModel
 o DesktopBeanBagView
 public DesktopBeanBagView(BeanBagModel model,
                           LayoutManager lm,
                           LabeledIconStyle iconStyle)
Constructs a DesktopBeanBagView object containing the specified model using the specified LayoutManager object and specified LabeledIconStyle object.

The LabeledIconStyle object specified is used when icons are added to the view. This property can be set at any time. Changing the icon style does not affect the existing icons in the view, but it will change all subsequent icons added to this view.

Parameters:
model - The BeanBagModel object to be viewed.
lm - The LayoutManager object to use when adding icons to the view.
iconStyle -
The LabeledIconStyle object describing the appearance of subsequent icons added to the view.
See Also:
BeanBagModel

Methods

 o setSingleSelect
 public void setSingleSelect(boolean singleSelect)
Sets the selection behavior as single or multiple.

Parameters:
singleSelect - true sets the selection behavior to single; false, to multiple.
 o isSingleSelect
 public boolean isSingleSelect()
Gets the selection behavior.

Returns:
The select behavior for a view. true indicates a single selection; false, multiple.
 o getPreferredSize
 public Dimension getPreferredSize()
Gets the preferred size of the view.

Returns:
The preferred size for the view.
Overrides:
getPreferredSize in class Container
 o setSize
 public void setSize(int width,
                     int height)
Sets the size of the current view.

Parameters:
width - The desired width of the view.
height - The desired height of the view.
Overrides:
setSize in class Component
 o setIconStyle
 public void setIconStyle(LabeledIconStyle iconStyle)
Sets the icon style for future icons added to the view.

Parameters:
iconStyle - The LabeledIconStyle type describing the appearance of icons added to the view.
 o getIconStyle
 public LabeledIconStyle getIconStyle()
Gets the icon style that the view currently is using when adding icons.

Returns:
The LabeledIconStyle type describing the appearance of icons added to the view.
 o addIcon
 protected void addIcon(ManagedBean mb)
Adds an icon to the view representing the specified managed bean.

Parameters:
mb - The managed bean to be added as an icon to the view.
See Also:
ManagedBean
 o addIcons
 protected void addIcons(Vector mbeans)
Adds icons to the view representing the specified managed beans.

Parameters:
mbeans - The Vector of ManagedBean objects to be added as icons to the view.
 o removeIcon
 protected void removeIcon(ManagedBean mb)
Removes the icon representing the specified managed bean from the view.

Parameters:
mb - The managed bean whose icon is to be removed from the view.
See Also:
ManagedBean
 o removeIcons
 protected void removeIcons(Vector mbeans)
Removes the icons representing the specified managed beans from the view.

Parameters:
mb - The Vector of ManagedBean objects whose icons are to be removed from the view.
 o removeAllIcons
 protected void removeAllIcons()
Removes all icons from the view.

 o paint
 public void paint(Graphics g)
Paints the DesktopBeanBagView object. Painting is performed by first painting the unselected icons, then painting the selected icons.

Parameters:
g - The specified graphics window.
Overrides:
paint in class Container
 o refresh
 public void refresh()
Refreshes the view. This method removes and then recreates and adds icons corresponding to the managed beans of this BeanBag model, and then calls the paintAll() method.

 o select
 protected void select(ManagedBean mb)
Selects or deselects, using the appropriate selection behavior, the specified managed bean.

Parameters:
mb - The target bean for the selection action.
See Also:
ManagedBean
 o destruct
 public synchronized void destruct()
Removes all icons from the view and then calls the destruct() method of base class.

Overrides:
destruct in class BeanBagView
 o mouseClicked
 public void mouseClicked(MouseEvent e)
Handles the event generated when the mouse is clicked in the view. Deselects all beans in the model.

Parameters:
e - The generated event.
Overrides:
mouseClicked in class BeanBagView
See Also:
MouseListener, MouseEvent
 o actionPerformed
 public void actionPerformed(ActionEvent e)
Handles the event generated when the mouse selects an icon in the view. This method causes the managed bean represented by the icon to be selected or deselected depending on its current selection state. In single selection mode, all the other managed beans are deselected.

Parameters:
e - The generated ActionEvent object.
See Also:
ActionListener, ActionEvent
 o handleAdd
 public void handleAdd(ModelEvent e)
Handles the event generated when items are added to the BeanBagModel object. Adds the corresponding bean icons to the view.

Parameters:
e - The ModelEvent object generated by the BeanBagModel object.
Overrides:
handleAdd in class BeanBagView
See Also:
ModelChangeListener, ModelEvent
 o handleRemove
 public void handleRemove(ModelEvent e)
Handles the event generated when items are removed from our BeanBagModel object. Removes the corresponding bean icons from the view.

Parameters:
e - The ModelEvent object generated by the BeanBagModel object.
Overrides:
handleRemove in class BeanBagView
See Also:
ModelChangeListener, ModelEvent
 o itemStateChanged
 public void itemStateChanged(ItemEvent e)
Manages selection changes. This method is invoked when the selection changes in the BeanBagModel instance. Refreshes the view of selected beans.

Parameters:
e - The ItemEvent object generated by our BeanBagModel object.
Overrides:
itemStateChanged in class BeanBagView
 o fireItem
 public void fireItem(Object item)
 o addItemListener
 public synchronized void addItemListener(ItemListener l)
 o removeItemListener
 public synchronized void removeItemListener(ItemListener l)
 o getSelectedObjects
 public Object[] getSelectedObjects()

All Packages  Class Hierarchy  This Package  Previous  Next  Index