com.netbreeze.bbowl.gui
Class BeanBowlContext

java.lang.Object
  |
  +--com.netbreeze.bbowl.gui.BeanBowlContext
All Implemented Interfaces:
BeansContext

public class BeanBowlContext
extends java.lang.Object
implements BeansContext

A BeansContext implementation that uses a BeanBowlGUI.

Author:
Henrik Kniberg

Constructor Summary
BeanBowlContext(BeanBowlGUI gui)
          Creates a new context linked to the given GUI.
 
Method Summary
 boolean addBean(java.lang.Object bean)
          Adds a new bean, if it wasn't already there
 void addListener(BeansContextListener l)
          Adds a BeansContextListener to this context.
 boolean containsBean(java.lang.Object o)
          Checks if the context contains the given bean
 java.lang.Object findBean(java.lang.String name)
           
 java.util.Collection getActions(java.lang.Object bean)
          Returns all actions that can be carried out on the given bean
 java.lang.String getBeanName(java.lang.Object o)
           
 java.util.Collection getBeansOfType(java.lang.Class c)
          Returns all beans of the given type (including subclasses)
 BeanBowl getBowl()
           
 BeanBowlGUI getGUI()
           
 boolean removeBean(java.lang.Object bean)
          Removes a bean, if it is there
 void removeListener(BeansContextListener l)
          Adds a BeansContextListener to this context.
 void showBeanDetails(java.lang.Object bean)
          Opens up a GUI to show the details of the given bean
 void showBeanGUI(java.awt.Component bean)
          For beans that happen to be Components, this method can be used to cause the bean to be drawn as a component.
 void showError(java.lang.String msg, java.lang.Throwable error)
          Displays the given error message somehow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanBowlContext

public BeanBowlContext(BeanBowlGUI gui)
Creates a new context linked to the given GUI. All operations will use either the given GUI or the bean bowl that it represents
Method Detail

getBowl

public BeanBowl getBowl()

getBeansOfType

public java.util.Collection getBeansOfType(java.lang.Class c)
Description copied from interface: BeansContext
Returns all beans of the given type (including subclasses)
Specified by:
getBeansOfType in interface BeansContext

containsBean

public boolean containsBean(java.lang.Object o)
Description copied from interface: BeansContext
Checks if the context contains the given bean
Specified by:
containsBean in interface BeansContext

addListener

public void addListener(BeansContextListener l)
Description copied from interface: BeansContext
Adds a BeansContextListener to this context. The listener will find out when beans are added or removed.
Specified by:
addListener in interface BeansContext

removeListener

public void removeListener(BeansContextListener l)
Description copied from interface: BeansContext
Adds a BeansContextListener to this context. The listener will find out when beans are added or removed.
Specified by:
removeListener in interface BeansContext

findBean

public java.lang.Object findBean(java.lang.String name)
Specified by:
findBean in interface BeansContext

getBeanName

public java.lang.String getBeanName(java.lang.Object o)
Specified by:
getBeanName in interface BeansContext

addBean

public boolean addBean(java.lang.Object bean)
Adds a new bean, if it wasn't already there
Specified by:
addBean in interface BeansContext

removeBean

public boolean removeBean(java.lang.Object bean)
Removes a bean, if it is there
Specified by:
removeBean in interface BeansContext

getActions

public java.util.Collection getActions(java.lang.Object bean)
Returns all actions that can be carried out on the given bean
Specified by:
getActions in interface BeansContext

showBeanDetails

public void showBeanDetails(java.lang.Object bean)
                     throws java.lang.Exception
Opens up a GUI to show the details of the given bean
Specified by:
showBeanDetails in interface BeansContext

getGUI

public BeanBowlGUI getGUI()

showBeanGUI

public void showBeanGUI(java.awt.Component bean)
For beans that happen to be Components, this method can be used to cause the bean to be drawn as a component.

showError

public void showError(java.lang.String msg,
                      java.lang.Throwable error)
Description copied from interface: BeansContext
Displays the given error message somehow
Specified by:
showError in interface BeansContext