You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2006/07/13 21:53:44 UTC
svn commit: r421695 [2/6] - in /beehive/trunk/netui/test/webapps/drt:
src/controls/binding/ src/controls/composition/ src/controls/context/
src/controls/contextevent/ src/controls/contextevent/beanrecord/
src/controls/contextevent/implrecord/ src/contr...
Added: beehive/trunk/netui/test/webapps/drt/src/controls/property/client_impl/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/property/client_impl/Controller.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/property/client_impl/Controller.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/property/client_impl/Controller.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package controls.property.client_impl;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.netui.test.controls.property.PropertyControlBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import java.beans.Beans;
+
+/**
+ * Tests getting and setting control property via control context on control implementation
+ * and getter/setter on control bean class.
+ */
+@Jpf.Controller(forwards = {@Jpf.Forward(name = "index", path = "../index.jsp")})
+public class Controller extends PageFlowController {
+
+ /**
+ * A control that declares some propertySets in its control interface.
+ * It has a method that allow accessing these property values via control context.
+ */
+ @Control
+ private PropertyControlBean _myControl;
+
+ @Jpf.Action
+ protected Forward begin() {
+ return new Forward("index");
+ }
+
+ @Jpf.Action
+ protected Forward clientImpl() {
+ _myControl.setAttribute1("New value for attribute1");
+ _myControl.setPropertyTwoAttribute3("New value for attribute3");
+
+ String newAttribute1 = _myControl.getAttribute1ByContext();
+ String newAttribute3 = _myControl.getAttribute3ByContext();
+
+ if (!newAttribute1.equals("New value for attribute1")
+ || !newAttribute3.equals("New value for attribute3")) {
+ return new Forward("index", "message", "clientImpl.do: ERROR");
+ }
+ return new Forward("index", "message", "clientImpl.do: PASSED");
+ }
+
+ @Jpf.Action
+ protected Forward clientImplP() {
+ try {
+ PropertyControlBean thebean = (PropertyControlBean) Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.property.PropertyControlBean");
+
+ thebean.setAttribute1("New value for attribute1");
+ thebean.setPropertyTwoAttribute3("New value for attribute3");
+
+ String newAttribute1 = _myControl.getAttribute1ByContext();
+ String newAttribute3 = _myControl.getAttribute3ByContext();
+
+ if (!newAttribute1.equals("New value for attribute1")
+ || !newAttribute3.equals("New value for attribute3")) {
+ return new Forward("index", "message", "clientImplP.do: ERROR");
+ }
+ }
+ catch (Exception e) {
+ return new Forward("index", "message", "clientImplP.do: ERROR: " + e.getMessage());
+ }
+ return new Forward("index", "message", "clientImplP.do: PASSED");
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/controls/property/client_impl/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/controls/property/impl_access/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/property/impl_access/Controller.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/property/impl_access/Controller.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/property/impl_access/Controller.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package controls.property.impl_access;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.netui.test.controls.property.PropertyControl;
+import org.apache.beehive.netui.test.controls.property.PropertyControlBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import java.beans.Beans;
+
+/**
+ * Tests getting control property via control context on control implementation class.
+ */
+@Jpf.Controller(forwards = {@Jpf.Forward(name = "index", path = "../index.jsp")})
+public class Controller extends PageFlowController {
+
+ /**
+ * A control that declares some propertySets in its control interface.
+ * It has a method that allow accessing these property values via control context.
+ */
+ @Control
+ private PropertyControlBean _myControl;
+
+ @Jpf.Action()
+ protected Forward begin() {
+ return new Forward("index");
+ }
+
+ @Jpf.Action()
+ protected Forward implAccess() {
+
+ String attribute1 = _myControl.getAttribute1ByContext();
+ String attribute3 = _myControl.getAttribute3ByContext();
+ if (!attribute1.equals(PropertyControl.DEFAULT_ATTRIBUTE_VALUE1)
+ || !attribute3.equals(PropertyControl.DEFAULT_ATTRIBUTE_VALUE3)) {
+ return new Forward("index", "message", "implAccess.do: ERROR: Attribute1:" + attribute1 + ". Attribute3:" + attribute3);
+ }
+ return new Forward("index", "message", "implAccess.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward implAccessP() {
+ try {
+ PropertyControlBean thebean = (PropertyControlBean) Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.property.PropertyControlBean");
+ String attribute1 = thebean.getAttribute1ByContext();
+ String attribute3 = thebean.getAttribute3ByContext();
+ if (!attribute1.equals(PropertyControl.DEFAULT_ATTRIBUTE_VALUE1)
+ || !attribute3.equals(PropertyControl.DEFAULT_ATTRIBUTE_VALUE3)) {
+ return new Forward("index", "message", "implAccessP.do: ERROR: Attribute1:" + attribute1 + ". Attribute3:" + attribute3);
+ }
+ }
+ catch (Exception e) {
+ return new Forward("index", "message", "implAccessP.do: ERROR: " + e.getMessage());
+ }
+ return new Forward("index", "message", "implAccessP.do: PASSED");
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/controls/property/impl_access/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/controls/property/property_constraints/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/property/property_constraints/Controller.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/property/property_constraints/Controller.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/property/property_constraints/Controller.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package controls.property.property_constraints;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.netui.test.controls.property.PropertyConstraintControlBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ * Tests control property constraint validator
+ */
+@Jpf.Controller(forwards = {@Jpf.Forward(name = "index", path = "../index.jsp")})
+public class Controller extends PageFlowController {
+
+ @Control
+ private PropertyConstraintControlBean myControl;
+
+ @Jpf.Action()
+ protected Forward begin() {
+ return new Forward("index");
+ }
+
+ @Jpf.Action()
+ protected Forward propertyConstraint() {
+
+ // Assigning a valid value to a text property
+ try {
+ myControl.setName("Bob");
+ }
+ catch (IllegalArgumentException e) {
+ return new Forward("index", "message", "propertyConstraint.do: ERROR: " + e.getMessage());
+ }
+
+ // Assigning a value longer than a text property's max length
+ try {
+ myControl.setName("Some name longer than 10 characters");
+ return new Forward("index", "message", "propertyConstraint.do: ERROR: " +
+ "Assigning a value longer than a text property's max length does not generate an exception.");
+ }
+ catch (IllegalArgumentException e) {
+ // expected exception
+ }
+
+ // Assigning a valid date to a date property
+ try {
+ myControl.setDob("1990/2/12");
+ }
+ catch (IllegalArgumentException e) {
+ return new Forward("index", "message", "propertyConstraint.do: ERROR: " +
+ "Assigning a valid date to a date property generated an exception.");
+ }
+
+ // Assigning an invalid date to a date property
+ try {
+ myControl.setName("Jan 12, 1993");
+ return new Forward("index", "message", "propertyConstraint.do: ERROR: " +
+ "Assigning a value with the an incorrect date format to a date property does not generate an exception.");
+ }
+ catch (IllegalArgumentException e) {
+ //expected exception
+ }
+
+ // Assigning a valid date to a date property
+ try {
+ myControl.setDob("1990/2/12");
+ }
+ catch (IllegalArgumentException e) {
+ return new Forward("index", "message", "propertyConstraint.do: ERROR: " +
+ "Assigning a valid date to a date property generated an exception.");
+ }
+
+ // Assigning an invalid number to an int property
+ try {
+ myControl.setAge(-1);
+ return new Forward("index", "message", "propertyConstraint.do: ERROR: " +
+ "Assigning a value less than an int property's min. value does not generate an exception.");
+ }
+ catch (IllegalArgumentException e) {
+ //expected exception
+ }
+ return new Forward("index", "message", "propertyConstraint.do: PASSED");
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/controls/property/property_constraints/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/controls/property/veto/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/property/veto/Controller.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/property/veto/Controller.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/property/veto/Controller.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,204 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package controls.property.veto;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.netui.test.controls.property.BoundPropertyControl;
+import org.apache.beehive.netui.test.controls.property.BoundPropertyControlBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyVetoException;
+import java.beans.VetoableChangeListener;
+
+@Jpf.Controller(forwards = {@Jpf.Forward(name = "index", path = "../index.jsp")})
+public class Controller extends PageFlowController {
+
+ private boolean propertyChanged = false;
+ private boolean vetoExceptionCaught = false;
+
+ @Control
+ private BoundPropertyControlBean _myControl;
+
+ @Jpf.Action
+ protected Forward begin() {
+ return new Forward("index");
+ }
+
+ @Jpf.Action
+ protected Forward testVetoChangeOnConstrainedProperty() {
+
+ propertyChanged = false;
+ vetoExceptionCaught = false;
+
+ // Create a new test listener and register it on the test bean
+ ChangeTestListener ctl = new ChangeTestListener();
+ _myControl.addPropertyChangeListener(ctl);
+
+ // Create a new test listener and register it on the test bean
+ VetoableTestListener vtl = new VetoableTestListener();
+ _myControl.addVetoableChangeListener(vtl);
+
+ try {
+ _myControl.setQuality("New_Quality");
+ }
+ catch (PropertyVetoException e) {
+ vetoExceptionCaught = true;
+ }
+
+ if (!vetoExceptionCaught) {
+ return new Forward("index", "message", "testVetoChangeOnConstrainedProperty.do: PropertyVetoException not caught.");
+ }
+
+ if (propertyChanged) {
+ return new Forward("index", "message", "testVetoChangeOnConstrainedProperty.do: PropertyChanged listener is invoked.");
+ }
+
+ String theQuality = _myControl.getQuality();
+ if (!theQuality.equals(BoundPropertyControl.QUALITY_DEFAULT)) {
+ return new Forward("index", "message", "testVetoChangeOnConstrainedProperty.do:" +
+ "Property value changed to:" + theQuality + ". Although PropertyChangedEvent not received.");
+ }
+ return new Forward("index", "message", "testVetoChangeOnConstrainedProperty.do: PASSED");
+ }
+
+ @Jpf.Action
+ protected Forward testVetoChangeOnUnConstrainedProperty() {
+
+ propertyChanged = false;
+ vetoExceptionCaught = false;
+
+ // Create a new test listener and register it on the test bean
+ ChangeTestListener ctl = new ChangeTestListener();
+ _myControl.addPropertyChangeListener(ctl);
+
+ // Create a new test listener and register it on the test bean
+ VetoableTestListener vtl = new VetoableTestListener();
+ _myControl.addVetoableChangeListener(vtl);
+
+ _myControl.setBrand("New_Brand");
+
+ if (vetoExceptionCaught) {
+ return new Forward("index", "message", "testVetoChangeOnUnConstrainedProperty.do: PropertyVetoException caught.");
+ }
+
+ if (!propertyChanged) {
+ return new Forward("index", "message", "testVetoChangeOnUnConstrainedProperty.do: PropertyChanged listener is NOT invoked.");
+ }
+
+ String theBrand = _myControl.getBrand();
+ if (!theBrand.equals("New_Brand")) {
+ return new Forward("index", "message", "testVetoChangeOnUnConstrainedProperty.do: " +
+ "Property value changed to:" + theBrand + " afterPropertyChangedEvent not received.");
+ }
+ return new Forward("index", "message", "testVetoChangeOnUnConstrainedProperty.do: PASSED");
+ }
+
+ @Jpf.Action
+ protected Forward testVetoChangeOnConstrainedExtProperty() {
+
+ propertyChanged = false;
+ vetoExceptionCaught = false;
+
+ // Create a new test listener and register it on the test bean
+ ChangeTestListener ctl = new ChangeTestListener();
+ _myControl.addPropertyChangeListener(ctl);
+
+ // Create a new test listener and register it on the test bean
+ VetoableTestListener vtl = new VetoableTestListener();
+ _myControl.addVetoableChangeListener(vtl);
+
+ try {
+ _myControl.setHeight(7.9f);
+ }
+ catch (PropertyVetoException e) {
+ vetoExceptionCaught = true;
+ }
+
+ if (!vetoExceptionCaught) {
+ return new Forward("index", "message", "testVetoChangeOnConstrainedExtProperty.do: PropertyVetoException not caught.");
+ }
+
+ if (propertyChanged) {
+ return new Forward("index", "message", "testVetoChangeOnUnConstrainedProperty.do: PropertyChanged listener is invoked.");
+ }
+
+ float height = _myControl.getHeight();
+ if (height != 0.0f) {
+ return new Forward("testVetoChangeOnConstrainedExtProperty: Property value changed to:" + height
+ + ". Although PropertyChangedEvent not received.");
+ }
+ return new Forward("index", "message", "testVetoChangeOnConstrainedExtProperty.do: PASSED");
+ }
+
+ @Jpf.Action
+ protected Forward testVetoChangeOnUnConstrainedExtProperty() {
+ propertyChanged = false;
+ vetoExceptionCaught = false;
+
+ // Create a new test listener and register it on the test bean
+ ChangeTestListener ctl = new ChangeTestListener();
+ _myControl.addPropertyChangeListener(ctl);
+
+ // Create a new test listener and register it on the test bean
+ VetoableTestListener vtl = new VetoableTestListener();
+ _myControl.addVetoableChangeListener(vtl);
+
+ _myControl.setAge(22);
+
+ if (vetoExceptionCaught) {
+ return new Forward("index", "message", "testVetoChangeOnUnConstrainedExtProperty.do: PropertyVetoException caught.");
+ }
+
+ if (!propertyChanged) {
+ return new Forward("index", "message", "testVetoChangeOnUnConstrainedExtProperty.do: PropertyChanged listener is NOT invoked.");
+ }
+
+ int age = _myControl.getAge();
+ if (age != 22) {
+ return new Forward("index", "message", "testVetoChangeOnUnConstrainedExtProperty.do: Property is changed to an unexpected value.");
+ }
+ return new Forward("index", "message", "testVetoChangeOnUnConstrainedExtProperty.do: PASSED");
+ }
+
+ class ChangeTestListener implements java.beans.PropertyChangeListener {
+ /**
+ * Implementation of PropertyChangeListener.propertyChange().
+ * Record all the chages
+ */
+ public void propertyChange(PropertyChangeEvent pce) {
+ //record it
+ propertyChanged = true;
+ }
+ }
+
+ class VetoableTestListener implements VetoableChangeListener {
+ /**
+ * Implementation of PropertyChangeListener.propertyChange().
+ * Veto all the change
+ */
+ public void vetoableChange(PropertyChangeEvent pce) throws PropertyVetoException {
+ // Veto attempts to set even values
+ throw new PropertyVetoException("Sorry", pce);
+ }
+ }
+
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/controls/property/veto/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.binding;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.properties.BaseProperties;
+
+@ControlInterface
+@BaseProperties(controlImplementation = "org.apache.beehive.netui.test.controls.binding.BindingTestControlImpl")
+public interface BindingTestControl {
+ public String getStatus();
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlImpl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlImpl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlImpl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.binding;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+
+@ControlImplementation(isTransient = true)
+public class BindingTestControlImpl
+ implements java.io.Serializable, BindingTestControl {
+ public String getStatus() {
+ return "FAIL";
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlOverrideImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlOverrideImpl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlOverrideImpl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlOverrideImpl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.binding;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+
+@ControlImplementation(isTransient = true)
+public class BindingTestControlOverrideImpl
+ implements java.io.Serializable, BindingTestControl {
+ public String getStatus() {
+ return "PASS";
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlOverrideImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.binding;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+
+@ControlInterface(
+ defaultBinding = "org.apache.beehive.netui.test.controls.binding.DefaultBindingTestOverrideControlImpl"
+)
+public interface DefaultBindingTestControl {
+ public String getStatus();
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControlImpl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControlImpl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControlImpl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.binding;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+
+@ControlImplementation(isTransient = true)
+public class DefaultBindingTestControlImpl
+ implements java.io.Serializable, DefaultBindingTestControl {
+ public String getStatus() {
+ return "FAIL";
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControlImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestOverrideControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestOverrideControlImpl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestOverrideControlImpl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestOverrideControlImpl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.binding;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+
+@ControlImplementation(isTransient = true)
+public class DefaultBindingTestOverrideControlImpl
+ implements java.io.Serializable, DefaultBindingTestControl {
+ public String getStatus() {
+ return "PASS";
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestOverrideControlImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.binding;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.properties.BaseProperties;
+
+@ControlInterface
+@BaseProperties(controlImplementation = "org.apache.beehive.netui.test.controls.binding.ExternalBindingTestControlImpl")
+public interface ExternalBindingTestControl {
+ public String getStatus();
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControlImpl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControlImpl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControlImpl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.binding;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+
+@ControlImplementation(isTransient = true)
+public class ExternalBindingTestControlImpl
+ implements java.io.Serializable, ExternalBindingTestControl {
+ public String getStatus() {
+ return "PASS";
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControlImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestOverrideControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestOverrideControlImpl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestOverrideControlImpl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestOverrideControlImpl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.binding;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+
+@ControlImplementation(isTransient = true)
+public class ExternalBindingTestOverrideControlImpl
+ implements java.io.Serializable, ExternalBindingTestControl {
+ public String getStatus() {
+ return "FAIL";
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestOverrideControlImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.composition;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.events.EventSet;
+import org.apache.beehive.controls.api.properties.PropertySet;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * A control interface designed to test control composition
+ */
+@ControlInterface
+public interface InnerControl {
+ static final String DEFAULT_NAME = "Bob";
+ static final String DEFAULT_JOB = "cleaner";
+
+ @PropertySet
+ @Target({ElementType.TYPE, ElementType.FIELD})
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Identity {
+ public String name() default DEFAULT_NAME;
+ //does not have a default value assigned
+
+ public String job();
+
+ public int rank() default 0;
+ }
+
+ @EventSet(unicast = true)
+ public interface Activity {
+ void wakeup();
+
+ int readMessage(String message);
+
+ String report();
+ }
+
+ @EventSet(unicast = true)
+ public interface Action {
+ public Object[] shopping(double credit);
+
+ public void doStuff(String value);
+ }
+
+ public void fireAllEvents();
+
+ public void fireEvent(String eventSet, String eventName);
+
+ /*Gets property value from context*/
+ public String getNameFromContext();
+
+ /*Gets property value from context*/
+ public String getJobFromContext();
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControlEventListener.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControlEventListener.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControlEventListener.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControlEventListener.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.composition;
+
+/**
+ * A listener class for event raised by InnerControl
+ */
+public class InnerControlEventListener implements InnerControl.Activity, InnerControl.Action, java.io.Serializable {
+
+ private boolean wakeupReceived = false;
+ private boolean readMessageReceived = false;
+ private boolean reportReceived = false;
+ private boolean shoppingReceived = false;
+ private boolean doStuffReceived = false;
+
+ /*
+ * BUG!!?? although the event declares methods wakeup, readMessage and
+ * report using default accessor,
+ * implmentation must change the method accessor to public,
+ * or, a compile error!
+ *
+ * attempting to assign weaker access privileges; was public
+ * [apt] void wakeup(){wakeupReceived=true;}
+ *
+ */
+
+ public void wakeup() {
+ wakeupReceived = true;
+ }
+
+ public int readMessage(String message) {
+ readMessageReceived = true;
+ return 0;
+ }
+
+ public String report() {
+ reportReceived = true;
+ return "a report from event listener";
+ }
+
+ public Object[] shopping(double credit) {
+ shoppingReceived = true;
+ //return (Object){"clothes","shoes","food"};
+ return null;
+ }
+
+ public void doStuff(String value) {
+ doStuffReceived = true;
+ }
+
+ public boolean getWakeupResult() {
+ return wakeupReceived;
+ }
+
+ public boolean getReadMessageResult() {
+ return readMessageReceived;
+ }
+
+ public boolean getReportResult() {
+ return reportReceived;
+ }
+
+ public boolean getShoppingResult() {
+ return shoppingReceived;
+ }
+
+ public boolean getDoStuffResult() {
+ return doStuffReceived;
+ }
+
+ /**
+ * Checks all the event records and returns '0' if all the events have been received.
+ */
+ public String getFinalResult() {
+
+ String result = "";
+
+ if (!wakeupReceived)
+ result = "WakeUp not received.";
+ if (!readMessageReceived)
+ result = result + "readMessage not received.";
+ if (!reportReceived)
+ result = result + "report not received.";
+ if (!shoppingReceived)
+ result = result + "shopping not received.";
+ if (!doStuffReceived)
+ result = result + "dostuff not received.";
+
+ if (result.length() == 0)
+ result = "0";
+
+ return result;
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControlEventListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControlImpl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControlImpl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControlImpl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.composition;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.context.Context;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.api.events.Client;
+
+@ControlImplementation
+public class InnerControlImpl implements InnerControl, java.io.Serializable {
+
+ @Context
+ ControlBeanContext context;
+
+ @Client
+ Activity activity;
+
+ @Client
+ Action action;
+
+ /*Gets property value from context*/
+ public String getNameFromContext() {
+ Identity identity = context.getControlPropertySet(Identity.class);
+ return identity.name();
+ }
+
+ /*Gets property value from context*/
+ public String getJobFromContext() {
+ Identity identity = context.getControlPropertySet(Identity.class);
+ return identity.job();
+ }
+
+ public void fireEvent(String eventSet, String eventName) {
+
+ if ((eventSet != null) && (eventName != null)) {
+
+ if (eventSet.equalsIgnoreCase("Activity")) {
+ if (eventName.equalsIgnoreCase("wakeup"))
+ activity.wakeup();
+ else if (eventName.equalsIgnoreCase("readMessage"))
+ activity.readMessage("message from nested control");
+ else if (eventName.equalsIgnoreCase("report"))
+ activity.report();
+ }
+ else if (eventSet.equalsIgnoreCase("Action")) {
+ if (eventName.equalsIgnoreCase("shopping"))
+ action.shopping(999.99d);
+ else if (eventName.equalsIgnoreCase("doStuff"))
+ action.doStuff("stuff to do");
+ }
+ }
+
+ }
+
+ public void fireAllEvents() {
+ activity.wakeup();
+ activity.readMessage("message from nested control");
+ activity.report();
+ action.shopping(999.99d);
+ action.doStuff("stuff to do");
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/InnerControlImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/Nested.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/Nested.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/Nested.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/Nested.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.composition;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.events.EventSet;
+import org.apache.beehive.controls.api.properties.PropertySet;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@ControlInterface
+public interface Nested {
+
+ public void fireEvent(String eventSet, String eventName);
+
+ @PropertySet
+ @Target({ElementType.TYPE, ElementType.FIELD})
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Index {
+ int value() default -1;
+ }
+
+ @EventSet(unicast = true)
+ public interface Return {
+ void returnVoid();
+
+ String returnString();
+
+ int returnInt();
+ }
+
+ @EventSet(unicast = true)
+ public interface Args {
+ public int argsInt(int value);
+
+ public String argsString(String value);
+
+ public Object [] argsMultiple(int val1, String val2);
+ }
+
+ @EventSet
+ public interface Except {
+ void exceptIO() throws java.io.IOException;
+
+ void exceptRuntime() throws RuntimeException;
+
+ void exceptLocal() throws LocalException;
+
+ void exceptMultiple() throws java.io.IOException, RuntimeException;
+ }
+
+ public class LocalException
+ extends Exception {
+ LocalException(String msg) {
+ super(msg);
+ }
+
+ LocalException(String msg, Throwable t) {
+ super(msg, t);
+ }
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/Nested.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/NestedAssembler.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/NestedAssembler.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/NestedAssembler.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/NestedAssembler.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.composition;
+
+import org.apache.beehive.controls.api.assembly.ControlAssembler;
+import org.apache.beehive.controls.api.assembly.ControlAssemblyContext;
+
+public class NestedAssembler
+ implements ControlAssembler {
+
+ public void assemble(ControlAssemblyContext cac) {
+ System.out.println("NestedAssembler:");
+ System.out.println(" context type=" + cac.getClass().getName());
+ System.out.println(" module=" + cac.getModuleDir());
+ System.out.println(" control type=" + cac.getControlType());
+ System.out.println(" control default impl=" + cac.getDefaultImplClassName());
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/NestedAssembler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/NestedImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/NestedImpl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/NestedImpl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/NestedImpl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.composition;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.events.Client;
+
+@ControlImplementation(assembler = NestedAssembler.class)
+public class NestedImpl implements Nested, java.io.Serializable {
+
+ @Client
+ Return returnClient;
+
+ @Client
+ Args argsClient;
+
+ @Client
+ Except exceptClient;
+
+ public void fireEvent(String set, String name) {
+ if (set.equals("Return")) {
+ if (name.equals("returnVoid"))
+ returnClient.returnVoid();
+
+ if (name.equals("returnInt"))
+ returnClient.returnInt();
+
+ if (name.equals("returnString"))
+ returnClient.returnString();
+
+ }
+ else if (set.equals("Args")) {
+ if (name.equals("argsInt"))
+ argsClient.argsInt(1);
+
+ if (name.equals("argsString"))
+ argsClient.argsString("foo");
+
+ if (name.equals("argsMultiple"))
+ argsClient.argsMultiple(2, "bar");
+
+ }
+ else if (set.equals("Except")) {
+ try {
+ if (name.equals("exceptIO"))
+ exceptClient.exceptIO();
+
+ if (name.equals("exceptRuntime"))
+ exceptClient.exceptRuntime();
+
+ if (name.equals("exceptLocal"))
+ exceptClient.exceptLocal();
+
+ if (name.equals("exceptMultiple"))
+ exceptClient.exceptMultiple();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/NestedImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/OuterControl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/OuterControl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/OuterControl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/OuterControl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.composition;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.events.EventSet;
+
+/**
+ * A control interface to test control composition.
+ */
+@ControlInterface
+public interface OuterControl {
+
+ @EventSet(unicast = true)
+ public interface OuterEvents {
+ int report(String message);
+ }
+
+ public void fireOuterEvents(String message);
+
+ public InnerControlBean getDeclaredNestedControl();
+
+ public InnerControlBean getDeclaredNestedControl2();
+
+ public InnerControlBean instantiateNestedControlProgrammatically();
+
+ public InnerControlBean instantiateNestedControlWithProperty();
+
+ /*
+ * Test outer control receiving event from nested control using
+ * EventHandler.
+ */
+ public String testActivityWakeup();
+
+ public String testActivityReadMessage();
+
+ public String testActivityReport();
+
+ public String testActionShopping();
+
+ public String testActionDostuff();
+
+ /*
+ * Tests outer control receiving event from nested control using
+ * event listener. The nested control is instantiated programmatically
+ */
+ public String testEventListener();
+
+ /*
+ * Tests outer control receiving event from nested control using
+ * event listener. The nested control is instantiated decalratively
+ */
+ public String testEventListenerByDeclare();
+
+ /*
+ * Tests outer control receiving event from nested control using
+ * inner class listener. The nested control is instantiated programmatically
+ */
+ public String testInnerClassListener();
+
+ /*
+ * Tests outer control receiving event from nested control using
+ * inner class listener. The nested control is instantiated decalratively
+ */
+ public String testInnerClassListenerByDeclare();
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/OuterControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/OuterControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/OuterControlImpl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/OuterControlImpl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/OuterControlImpl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,501 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.composition;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.events.Client;
+import org.apache.beehive.controls.api.events.EventHandler;
+import org.apache.beehive.controls.api.properties.BeanPropertyMap;
+
+/**
+ * A control implementation to test control composition. Makes two instances of nested control be declaration.
+ */
+@ControlImplementation
+public class OuterControlImpl implements OuterControl, java.io.Serializable {
+
+ static final long serialVersionUID = 1L;
+ static final String EVENT_RECEIVED = "Event Received";
+
+ private String innerControlEventHandlerWakeUp = "";
+ private String innerControlEventHandlerReadMessage = "";
+ private String innerControlEventHandlerReport = "";
+ private String innerControlEventHandlerShopping = "";
+ private String innerControlEventHandlerDoStuff = "";
+
+ private boolean innerClassWakeUp = false;
+ private boolean innerClassReadMessage = false;
+ private boolean innerClassReport = false;
+ private boolean innerClassShopping = false;
+ private boolean innerClassDoStuff = false;
+
+ private boolean innerControlInnerClassWakeUp = false;
+ private boolean innerControlInnerClassReadMessage = false;
+ private boolean innerControlInnerClassReport = false;
+ private boolean innerControlInnerClassShopping = false;
+ private boolean innerControlInnerClassDoStuff = false;
+
+ @Client
+ transient OuterEvents outerEvents;
+
+ /*Instantiates a nested control without reconfiguring the property*/
+ @Control
+ InnerControlBean innerControl;
+
+ @Control
+ @InnerControl.Identity(job = "farmer")
+ InnerControlBean innerControl2;
+
+ //
+ // Define various event handlers for the nested controls
+ //
+ @EventHandler(field = "innerControl", eventSet = InnerControl.Activity.class, eventName = "wakeup")
+ public void innerControlwakeup() {
+ innerControlEventHandlerWakeUp = EVENT_RECEIVED;
+ }
+
+ @EventHandler(field = "innerControl", eventSet = InnerControl.Activity.class, eventName = "readMessage")
+ public int innerControlreadMessage(String message) {
+ innerControlEventHandlerReadMessage = EVENT_RECEIVED;
+ return 0;
+ }
+
+ @EventHandler(field = "innerControl", eventSet = InnerControl.Activity.class, eventName = "report")
+ public String innerControlreport() {
+ innerControlEventHandlerReport = EVENT_RECEIVED;
+ return "a report";
+ }
+
+ @EventHandler(field = "innerControl", eventSet = InnerControl.Action.class, eventName = "shopping")
+ public Object [] innerControlshopping(double credit) {
+ innerControlEventHandlerShopping = EVENT_RECEIVED;
+ return null;
+ }
+
+ @EventHandler(field = "innerControl", eventSet = InnerControl.Action.class, eventName = "doStuff")
+ public void innerControldoStuff(String vakue) {
+ innerControlEventHandlerDoStuff = EVENT_RECEIVED;
+ }
+
+ @EventHandler(field = "innerControl2", eventSet = InnerControl.Activity.class, eventName = "wakeup")
+ public void innerControl2wakeup() {
+ }
+
+ @EventHandler(field = "innerControl2", eventSet = InnerControl.Activity.class, eventName = "readMessage")
+ public int innerControl2readMessage(String message) {
+ return 0;
+ }
+
+ @EventHandler(field = "innerControl2", eventSet = InnerControl.Activity.class, eventName = "report")
+ public String innerControl2report() {
+ return "a report";
+ }
+
+ @EventHandler(field = "innerControl2", eventSet = InnerControl.Action.class, eventName = "shopping")
+ public Object [] innerControl2shopping(double credit) {
+ return null;
+ }
+
+ @EventHandler(field = "innerControl2", eventSet = InnerControl.Action.class, eventName = "doStuff")
+ public void innerControl2doStuff(String vakue) {
+ }
+
+ public void fireOuterEvents(String message) {
+ outerEvents.report(message);
+ }
+
+ public InnerControlBean getDeclaredNestedControl() {
+ return innerControl;
+ }
+
+ public InnerControlBean getDeclaredNestedControl2() {
+ return innerControl2;
+ }
+
+ public InnerControlBean instantiateNestedControlProgrammatically() {
+ try {
+ InnerControlBean inner =
+ (InnerControlBean) java.beans.Beans.instantiate(Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.composition.InnerControlBean");
+ return inner;
+ }
+ catch (Exception e) {
+ return null;
+ }
+ }
+
+ public InnerControlBean instantiateNestedControlWithProperty() {
+ try {
+ BeanPropertyMap props = new BeanPropertyMap(InnerControl.Identity.class);
+ props.setProperty(InnerControlBean.NameKey, "ken");
+ props.setProperty(InnerControlBean.JobKey, "engineer");
+ props.setProperty(InnerControlBean.RankKey, new Integer(2));
+ InnerControlBean inner = (InnerControlBean) org.apache.beehive.controls.api.bean.Controls.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.composition.InnerControlBean", props);
+ return inner;
+ }
+ catch (Exception e) {
+ throw new RuntimeException("Failed to instantiate nested control", e);
+ }
+ }
+
+ public String testActivityWakeup() {
+
+ String result = "";
+ if (innerControl == null)
+ result = "inner control is NULL";
+ else {
+ innerControl.fireEvent("Activity", "wakeup");
+ /*Wait for the events*/
+ try {
+ Thread.sleep(1000);
+ if (innerControlEventHandlerWakeUp.equals(EVENT_RECEIVED))
+ result = "0";
+ else
+ result = "Acivity.wakeup not received by EventHandler";
+ }
+ catch (Exception e) {
+ result = "Thread sleep interrupted." + e.toString();
+ }
+ }
+ return result;
+ }
+
+ public String testActivityReadMessage() {
+
+ String result = "";
+ if (innerControl == null)
+ result = "inner control is NULL";
+ else {
+ innerControl.fireEvent("Activity", "readMessage");
+ /*Wait for the events*/
+ try {
+ Thread.sleep(1000);
+
+ if (innerControlEventHandlerReadMessage.equals(EVENT_RECEIVED))
+ result = "0";
+ else
+ result = "Acivity.readMessage not received by EventHandler";
+ }
+ catch (Exception e) {
+ result = "Thread sleep interrupted." + e.toString();
+ }
+ }
+ return result;
+
+ }
+
+ public String testActivityReport() {
+
+ String result = "";
+ if (innerControl == null)
+ result = "inner control is NULL";
+ else {
+ innerControl.fireEvent("Activity", "report");
+ /*Wait for the events*/
+ try {
+ Thread.sleep(1000);
+
+ if (innerControlEventHandlerReport.equals(EVENT_RECEIVED))
+ result = "0";
+ else
+ result = "Acivity.report not received by EventHandler";
+ }
+ catch (Exception e) {
+ result = "Thread sleep interrupted." + e.toString();
+ }
+ }
+ return result;
+
+ }
+
+ public String testActionShopping() {
+
+ String result = "";
+ if (innerControl == null)
+ result = "inner control is NULL";
+ else {
+ innerControl.fireEvent("Action", "shopping");
+ /*Wait for the events*/
+ try {
+ Thread.sleep(1000);
+
+ if (innerControlEventHandlerShopping.equals(EVENT_RECEIVED))
+ result = "0";
+ else
+ result = "Action.shopping not received by EventHandler";
+ }
+ catch (Exception e) {
+ result = "Thread sleep interrupted." + e.toString();
+ }
+ }
+ return result;
+
+ }
+
+ public String testActionDostuff() {
+
+ String result = "";
+ if (innerControl == null)
+ result = "inner control is NULL";
+ else {
+ innerControl.fireEvent("Action", "doStuff");
+ /*Wait for the events*/
+ try {
+ Thread.sleep(1000);
+
+ if (innerControlEventHandlerDoStuff.equals(EVENT_RECEIVED))
+ result = "0";
+ else
+ result = "Action.doStuff not received by EventHandler";
+ }
+ catch (Exception e) {
+ result = "Thread sleep interrupted." + e.toString();
+ }
+ }
+ return result;
+
+ }
+
+ /*Tests outer control receiving event from nested control using
+ * event listener. The nested control is instantiated programmatically
+ */
+ public String testEventListener() {
+
+ String result = "init";
+ try {
+
+ InnerControlBean nested = (InnerControlBean) java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.composition.InnerControlBean");
+ if (nested == null)
+ result = "Nested control instantiated programmatically is NULL.";
+ else {
+ //Create an Event Listener
+ InnerControlEventListener listener = new InnerControlEventListener();
+ nested.addActivityListener(listener);
+ nested.addActionListener(listener);
+ nested.fireAllEvents();
+ try {
+ Thread.sleep(1000);
+ result = listener.getFinalResult();
+ }
+ catch (Exception e) {
+ result = "Thread sleep interrupted." + e.toString();
+ }
+
+
+ }
+ }
+ catch (Exception e) {
+ result = "Exception caught:" + e.toString();
+ }
+ return result;
+ }
+
+ /*Tests outer control receiving event from nested control using
+ * event listener. The nested control is instantiated decalratively
+ */
+ public String testEventListenerByDeclare() {
+
+ String result = "init";
+
+ if (innerControl == null)
+ result = "Nested control instantiated declaratively is NULL.";
+ else {
+ try {
+ //Create an Event Listener
+ InnerControlEventListener listener = new InnerControlEventListener();
+ innerControl.addActivityListener(listener);
+ innerControl.addActionListener(listener);
+ innerControl.fireAllEvents();
+
+ Thread.sleep(1000);
+ result = listener.getFinalResult();
+ }
+ catch (Exception e) {
+ result = "Thread sleep interrupted." + e.toString();
+ }
+
+
+ }
+ return result;
+
+ }
+
+ /*Tests outer control receiving event from nested control using
+ * inner class listener. The nested control is instantiated programmatically
+ */
+ public String testInnerClassListener() {
+
+ String result = "init";
+ try {
+ InnerControlBean nested = (InnerControlBean) java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.composition.InnerControlBean");
+ if (nested == null)
+ result = "Nested control instantiated programmatically is NULL.";
+ else {
+ nested.addActivityListener(
+ new InnerControl.Activity() {
+
+ public void wakeup() {
+ innerClassWakeUp = true;
+ }
+
+ public int readMessage(String message) {
+ innerClassReadMessage = true;
+ return 0;
+ }
+
+ public String report() {
+ innerClassReport = true;
+ return "event received.";
+ }
+ }
+ );
+ nested.addActionListener(
+ new InnerControl.Action() {
+
+ public Object[] shopping(double credit) {
+ innerClassShopping = true;
+ //return {"food","drinks","candies"};
+ return null;
+ }
+
+ public void doStuff(String value) {
+ innerClassDoStuff = true;
+ }
+ }
+ );
+ nested.fireAllEvents();
+ try {
+ Thread.sleep(1000);
+ }
+ catch (Exception e) {
+ /* ignore */
+ }
+
+ result = getInnerClassListenerResult();
+ }
+ }
+ catch (Exception e) {
+ result = "Exception caught:" + e.toString();
+ }
+ return result;
+ }
+
+ /*Tests outer control receiving event from nested control using
+ * inner class listener. The nested control is instantiated decalratively
+ */
+ public String testInnerClassListenerByDeclare() {
+
+ String result = "init";
+
+ if (innerControl == null)
+ result = "Nested control instantiated declaratively is NULL.";
+ else {
+ try {
+ innerControl.addActivityListener(
+ new InnerControl.Activity() {
+ public void wakeup() {
+ innerControlInnerClassWakeUp = true;
+ }
+
+ public int readMessage(String message) {
+ innerControlInnerClassReadMessage = true;
+ return 0;
+ }
+
+ public String report() {
+ innerControlInnerClassReport = true;
+ return "event received.";
+ }
+ }
+ );
+ innerControl.addActionListener(
+ new InnerControl.Action() {
+
+ public Object[] shopping(double credit) {
+ innerControlInnerClassShopping = true;
+ //return {"food","drinks","candies"};
+ return null;
+ }
+
+ public void doStuff(String value) {
+ innerControlInnerClassDoStuff = true;
+ }
+ }
+ );
+ innerControl.fireAllEvents();
+
+ Thread.currentThread().sleep(1000);
+ }
+ catch (Exception e) {
+ }
+
+ result = getInnerControlInnerClassListenerResult();
+ }
+ return result;
+
+ }
+
+ private String getInnerClassListenerResult() {
+
+ String result = "";
+
+ if (!innerClassWakeUp)
+ result = "WakeUp not received.";
+ if (!innerClassReadMessage)
+ result = result + "readMessage not received.";
+ if (!innerClassReport)
+ result = result + "report not received.";
+ if (!innerClassShopping)
+ result = result + "shopping not received.";
+ if (!innerClassDoStuff)
+ result = result + "dostuff not received.";
+
+ if (result.length() == 0)
+ result = "0";
+
+ return result;
+ }
+
+ private String getInnerControlInnerClassListenerResult() {
+
+ String result = "";
+
+ if (!innerControlInnerClassWakeUp)
+ result = "WakeUp not received.";
+ if (!innerControlInnerClassReadMessage)
+ result = result + "readMessage not received.";
+ if (!innerControlInnerClassReport)
+ result = result + "report not received.";
+ if (!innerControlInnerClassShopping)
+ result = result + "shopping not received.";
+ if (!innerControlInnerClassDoStuff)
+ result = result + "dostuff not received.";
+
+ if (result.length() == 0)
+ result = "0";
+
+ return result;
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/composition/OuterControlImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/context/ServiceGetter.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/context/ServiceGetter.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/context/ServiceGetter.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/context/ServiceGetter.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.context;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+
+/**
+ * A control interface to test control context service
+ */
+@ControlInterface
+public interface ServiceGetter {
+ public Object getService(Class theService, Object selector);
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/context/ServiceGetter.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/context/ServiceGetterImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/context/ServiceGetterImpl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/context/ServiceGetterImpl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/context/ServiceGetterImpl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.context;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.context.Context;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+
+/**
+ * A control implementation that retrieves specific service via controlContext
+ */
+@ControlImplementation(isTransient = true)
+public class ServiceGetterImpl implements ServiceGetter {
+
+ @Context
+ ControlBeanContext context;
+
+ public Object getService(Class theService, Object selector) {
+
+ return context.getService(theService, selector);
+ }
+
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/context/ServiceGetterImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/BeanContextRecorder.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/BeanContextRecorder.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/BeanContextRecorder.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/BeanContextRecorder.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.contextevent;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+
+/**
+ * A control interface to test control context events.
+ * There are two sources of control context events: ControlBeanContext and
+ * ResouceContext.
+ * The implementation of this interface only listens to context events from ControlBeanContext.
+ */
+@ControlInterface
+public interface BeanContextRecorder {
+ public String getRecord();
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/BeanContextRecorder.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/BeanContextRecorderImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/BeanContextRecorderImpl.java?rev=421695&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/BeanContextRecorderImpl.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/BeanContextRecorderImpl.java Thu Jul 13 12:53:37 2006
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.netui.test.controls.contextevent;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.context.Context;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.api.events.EventHandler;
+
+/**
+ * A control impl that listens to and records its lifecycle events
+ * This impl listens to context event by declaring EventHandler
+ * <p/>
+ * There are two sources of control context events: ControlBeanContext and
+ * ResouceContext.
+ * This class only listens to context events from ControlBeanContext.
+ */
+
+@ControlImplementation
+public class BeanContextRecorderImpl implements BeanContextRecorder, java.io.Serializable {
+
+ private String event_log = "init";
+
+ @Context
+ ControlBeanContext context;
+
+ /**
+ * A EventHandler that listens to onCreate event
+ */
+ @EventHandler(field = "context", eventSet = ControlBeanContext.LifeCycle.class, eventName = "onCreate")
+ public void onCreate() {
+ // System.out.println("++++++++++++++++++++++++++++++++++++++++++++++");
+ // System.out.println("onCreate invoked on BeanContextRecorderImpl");
+ // System.out.println("++++++++++++++++++++++++++++++++++++++++++++++");
+
+ event_log = event_log + "onCreate";
+ }
+
+
+ /**
+ * Returns the event log
+ */
+ public String getRecord() {
+ // System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++");
+ // System.out.println("getRecord on BeanContextRecorderImpl invoked");
+ // System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++");
+
+ return event_log;
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/org/apache/beehive/netui/test/controls/contextevent/BeanContextRecorderImpl.java
------------------------------------------------------------------------------
svn:eol-style = native