summaryrefslogtreecommitdiff
path: root/java/beans/beancontext/BeanContextSupport.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/beans/beancontext/BeanContextSupport.java')
-rw-r--r--java/beans/beancontext/BeanContextSupport.java75
1 files changed, 59 insertions, 16 deletions
diff --git a/java/beans/beancontext/BeanContextSupport.java b/java/beans/beancontext/BeanContextSupport.java
index a12c078df..2dc2a4e4a 100644
--- a/java/beans/beancontext/BeanContextSupport.java
+++ b/java/beans/beancontext/BeanContextSupport.java
@@ -144,42 +144,61 @@ public class BeanContextSupport extends BeanContextChildSupport
*/
public BeanContextSupport ()
{
- this (null, null, true, true);
+ this (null, null, false, true);
}
/**
* Construct a BeanContextSupport instance.
+ *
+ * @param peer the bean context peer (<code>null</code> permitted).
*/
- public BeanContextSupport (BeanContext peer)
+ public BeanContextSupport(BeanContext peer)
{
- this (peer, null, true, true);
+ this (peer, null, false, true);
}
/**
* Construct a BeanContextSupport instance.
+ *
+ * @param peer the bean context peer (<code>null</code> permitted).
+ * @param locale the locale (<code>null</code> permitted, equivalent to
+ * the default locale).
*/
- public BeanContextSupport (BeanContext peer, Locale lcle)
+ public BeanContextSupport (BeanContext peer, Locale locale)
{
- this (peer, lcle, true, true);
+ this (peer, locale, false, true);
}
/**
* Construct a BeanContextSupport instance.
+ *
+ * @param peer the bean context peer (<code>null</code> permitted).
+ * @param locale the locale (<code>null</code> permitted, equivalent to
+ * the default locale).
+ * @param dtime a flag indicating whether or not the bean context is in
+ * design time mode.
*/
- public BeanContextSupport (BeanContext peer, Locale lcle, boolean dtime)
+ public BeanContextSupport (BeanContext peer, Locale locale, boolean dtime)
{
- this (peer, lcle, dtime, true);
+ this (peer, locale, dtime, true);
}
/**
* Construct a BeanContextSupport instance.
+ *
+ * @param peer the bean context peer (<code>null</code> permitted).
+ * @param locale the locale (<code>null</code> permitted, equivalent to
+ * the default locale).
+ * @param dtime a flag indicating whether or not the bean context is in
+ * design time mode.
+ * @param visible initial value of the <code>okToUseGui</code> flag.
*/
- public BeanContextSupport (BeanContext peer, Locale lcle, boolean dtime,
+ public BeanContextSupport (BeanContext peer, Locale locale, boolean dtime,
boolean visible)
{
super(peer);
- locale = lcle == null ? Locale.getDefault() : lcle;
+ this.locale = locale == null ? Locale.getDefault() : locale;
designTime = dtime;
okToUseGui = visible;
@@ -447,16 +466,40 @@ public class BeanContextSupport extends BeanContextChildSupport
}
}
- public BeanContext getBeanContextPeer ()
- throws NotImplementedException
+ /**
+ * Returns the bean context peer.
+ *
+ * @return The bean context peer.
+ *
+ * @see BeanContextChildSupport#beanContextChildPeer
+ */
+ public BeanContext getBeanContextPeer()
{
- throw new Error ("Not implemented");
+ return (BeanContext) beanContextChildPeer;
}
- protected static final BeanContextChild getChildBeanContextChild (Object child)
- throws NotImplementedException
- {
- throw new Error ("Not implemented");
+ /**
+ * Returns the {@link BeanContextChild} implementation for the given child.
+ *
+ * @param child the child (<code>null</code> permitted).
+ *
+ * @return The bean context child.
+ *
+ * @throws IllegalArgumentException if <code>child</code> implements both
+ * the {@link BeanContextChild} and {@link BeanContextProxy} interfaces.
+ */
+ protected static final BeanContextChild getChildBeanContextChild(Object child)
+ {
+ if (child == null)
+ return null;
+ if (child instanceof BeanContextChild && child instanceof BeanContextProxy)
+ throw new IllegalArgumentException("Child cannot implement "
+ + "BeanContextChild and BeanContextProxy simultaneously.");
+ if (child instanceof BeanContextChild)
+ return (BeanContextChild) child;
+ if (child instanceof BeanContextProxy)
+ return ((BeanContextProxy) child).getBeanContextProxy();
+ return null;
}
protected static final BeanContextMembershipListener getChildBeanContextMembershipListener (Object child)