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/14 22:22:28 UTC
svn commit: r422018 [2/6] - in /beehive/trunk/netui/test: conf/
webapps/controls/ webapps/controls/src/ webapps/controls/src/controls/
webapps/controls/src/controls/binding/
webapps/controls/src/controls/composition/
webapps/controls/src/controls/conte...
Added: beehive/trunk/netui/test/webapps/controls/src/controls/extension/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/controls/extension/Controller.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/controls/extension/Controller.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/controls/extension/Controller.java Fri Jul 14 13:22:22 2006
@@ -0,0 +1,435 @@
+/*
+ * 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.extension;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.events.EventHandler;
+import org.apache.beehive.netui.test.controls.extension.ExtensibleControl;
+import org.apache.beehive.netui.test.controls.extension.SubControl;
+import org.apache.beehive.netui.test.controls.extension.SubControlBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ * Test control inheritance by invoking methods on a sub control instance
+ */
+@Jpf.Controller(forwards = {@Jpf.Forward(name = "result", path = "result.jsp")})
+public class Controller extends PageFlowController {
+
+ private boolean superClassEventReceived = false;
+ private boolean subClassEventReceived = false;
+
+ @Control
+ public SubControlBean _subcontrol;
+
+ /**
+ * EventHandler that receives SuperClassEvent from _subcontrol
+ */
+ @EventHandler(field = "_subcontrol", eventSet = SubControl.SuperClassEvent.class, eventName = "method1")
+ public void subcontrolMessageHandler() {
+ superClassEventReceived = true;
+ }
+
+ /**
+ * EventHandler that receives SubClassEvent from _subcontrol
+ */
+ @EventHandler(field = "_subcontrol", eventSet = SubControl.SubClassEvent.class, eventName = "method1")
+ public void subcontrolMessageHandler2() {
+ subClassEventReceived = true;
+ }
+
+ @Jpf.Action
+ protected Forward begin() {
+ return new Forward("result");
+ }
+
+ /**
+ * Invokes an inherited method on a _subcontrol instantiated declaratively
+ */
+ @Jpf.Action()
+ protected Forward testInheritedMethod() {
+ String s = _subcontrol.hello();
+ if (!s.equals("Hello from super control")) {
+ return new Forward("result", "message", "testInheritedMethod.do: ERROR: " + s);
+ }
+ return new Forward("result", "message", "testInheritedMethod: PASSED");
+ }
+
+ /**
+ * Invokes an inherited method on a _subcontrol instantiated programmatically
+ */
+ @Jpf.Action()
+ protected Forward testInheritedMethodP() {
+
+ try {
+ SubControlBean subbean = (SubControlBean) java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.extension.SubControlBean");
+
+ String s = subbean.hello();
+ if (!s.equals("Hello from super control")) {
+ return new Forward("result", "message", "testInheritedMethodP.do: ERROR: " + s);
+ }
+ }
+ catch (Exception e) {
+ return new Forward("result", "message", "testInheritedMethodP: Exception: " + e.getMessage());
+ }
+ return new Forward("result", "message", "testInheritedMethodP: PASSED");
+ }
+
+ /**
+ * Invokes an extended method on a _subcontrol instantiated declaratively
+ */
+ @Jpf.Action()
+ protected Forward testExtendedMethod() {
+ String s = _subcontrol.hello2();
+ if (s == null || !s.equals("Hello from _subcontrol")) {
+ return new Forward("result", "message", "testExtendedMethod.do: ERROR: " + s);
+ }
+ return new Forward("result", "message", "testExtendedMethod: PASSED");
+ }
+
+ /**
+ * Invokes an extended method on a _subcontrol instantiated programmatically
+ */
+ @Jpf.Action()
+ protected Forward testExtendedMethodP() {
+
+ try {
+ SubControlBean subbean = (SubControlBean) java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.extension.SubControlBean");
+
+ String s = subbean.hello2();
+ if (s == null || !s.equals("Hello from _subcontrol")) {
+ return new Forward("result", "message", "testExtendedMethodP.do: ERROR: " + s);
+ }
+ }
+ catch (Exception e) {
+ return new Forward("result", "message", "testExtendedMethodP: Exception: " + e.getMessage());
+ }
+ return new Forward("result", "message", "testExtendedMethodP: PASSED");
+ }
+
+
+ @Jpf.Action()
+ protected Forward testGetInheritedPropertyByContext() {
+ String s = _subcontrol.accessInheritedProperty();
+ if (s == null || !s.equals("In_ExtensibleControl_Interface")) {
+ return new Forward("result", "message", "testGetInheritedPropertyByContext.do: ERROR: " + s);
+ }
+ return new Forward("result", "message", "testGetInheritedPropertyByContext.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testGetInheritedPropertyByContextP() {
+
+ try {
+ SubControlBean subbean = (SubControlBean) java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.extension.SubControlBean");
+
+ String s = subbean.accessInheritedProperty();
+ if (s == null || !s.equals("In_ExtensibleControl_Interface")) {
+ return new Forward("result", "message", "testGetInheritedPropertyByContextP.do: ERROR: " + s);
+ }
+ }
+ catch (Exception e) {
+ return new Forward("result", "message", "testGetInheritedPropertyByContext.do: Exception: " + e.getMessage());
+ }
+ return new Forward("result", "message", "testGetInheritedPropertyByContext.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testGetInheritedPropertyByGetter() {
+
+ String position = _subcontrol.getPosition();
+ if (position == null || !position.equals(ExtensibleControl.CURRENT_POSITION)) {
+ return new Forward("result", "message", "testGetInheritedPropertyByGetter.do: ERROR: The property from getter:Position=" + position);
+ }
+ return new Forward("result", "message", "testGetInheritedPropertyByGetter.do: PASSED");
+ }
+
+
+ @Jpf.Action()
+ protected Forward testGetInheritedPropertyByGetterP() {
+
+ try {
+ SubControlBean subbean = (SubControlBean) java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.extension.SubControlBean");
+ String position = subbean.getPosition();
+ if (position == null || !position.equals(ExtensibleControl.CURRENT_POSITION)) {
+ return new Forward("result", "message", "testGetInheritedPropertyByGetterP.do: ERROR: The property from getter:Position=" + position);
+ }
+ }
+ catch (Exception e) {
+ return new Forward("result", "message", "testGetInheritedPropertyByGetter.do: Exception: " + e.getMessage());
+ }
+ return new Forward("result", "message", "testGetInheritedPropertyByGetter.do: PASSED");
+ }
+
+
+ @Jpf.Action()
+ protected Forward testSetInheritedPropertyBySetter() {
+ _subcontrol.setPosition("A_NEW_POSITION");
+ _subcontrol.setLayer("A_NEW_LAYER");
+
+ String position = _subcontrol.accessInheritedProperty();
+ if (position == null || !position.equals("A_NEW_POSITION")) {
+ return new Forward("result", "message", "testSetInheritedPropertyBySetter.do: ERROR: The property from setter:Position=" + position);
+ }
+ return new Forward("result", "message", "testSetInheritedPropertyBySetter.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testSetInheritedPropertyBySetterP() {
+
+ try {
+ SubControlBean subbean = (SubControlBean) java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.extension.SubControlBean");
+
+ subbean.setPosition("A_NEW_POSITION");
+ subbean.setLayer("A_NEW_LAYER");
+ String position = subbean.accessInheritedProperty();
+ if (position == null || !position.equals("A_NEW_POSITION")) {
+ return new Forward("result", "message", "testSetInheritedPropertyBySetterP.do: ERROR: The property from setter:Position=" + position);
+ }
+ }
+ catch (Exception e) {
+ return new Forward("result", "message", "testSetInheritedPropertyBySetterP.do: Exception: " + e.getMessage());
+ }
+ return new Forward("result", "message", "testSetInheritedPropertyBySetterP.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testGetExtendedPropertyByContext() {
+
+ String new_property_value = _subcontrol.getExtendedPropertyByContext();
+ if (new_property_value == null || !new_property_value.equals("New Property Declared by Sub Control")) {
+ return new Forward("result", "message", "testGetExtendedPropertyByContext.do: ERROR: Extended property retrieved from context:" + new_property_value);
+ }
+ return new Forward("result", "message", "testGetExtendedPropertyByContext.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testGetExtendedPropertyByContextP() {
+
+ try {
+ SubControlBean subbean = (SubControlBean) java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.extension.SubControlBean");
+
+ String new_property_value = subbean.getExtendedPropertyByContext();
+ if (new_property_value == null || !new_property_value.equals("New Property Declared by Sub Control")) {
+ return new Forward("result", "message", "testGetExtendedPropertyByContextP.do: ERROR: Extended property retrieved from context:" + new_property_value);
+ }
+ }
+ catch (Exception e) {
+ return new Forward("result", "message", "testGetExtendedPropertyByContextP.do: Exception: " + e.getMessage());
+ }
+ return new Forward("result", "message", "testGetExtendedPropertyByContextP.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testGetExtendedPropertyByGetter() {
+ String s = _subcontrol.getMessage();
+ if (s == null || !s.equals(SubControl.A_MESSAGE)) {
+ return new Forward("result", "message", "testGetExtendedPropertyByGetter.do: ERROR: " + s);
+ }
+ return new Forward("result", "message", "testGetExtendedPropertyByGetter.do: PASSED");
+ }
+
+
+ @Jpf.Action()
+ protected Forward testGetExtendedPropertyByGetterP() {
+
+ try {
+ SubControlBean subbean = (SubControlBean) java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.extension.SubControlBean");
+ String s = subbean.getMessage();
+ if (s == null || !s.equals(SubControl.A_MESSAGE)) {
+ return new Forward("result", "message", "testGetExtendedPropertyByGetterP.do: ERROR: " + s);
+ }
+ }
+ catch (Exception e) {
+ return new Forward("result", "message", "testGetExtendedPropertyByGetterP.do: Exception: " + e.getMessage());
+ }
+ return new Forward("result", "message", "testGetExtendedPropertyByGetter.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testSetExtendedPropertyBySetter() {
+ _subcontrol.setMessage("NEW_VALUE_FOR_EXTENDED_PROPERTY");
+ String the_new_value = _subcontrol.getExtendedPropertyByContext();
+ if (!the_new_value.equals("NEW_VALUE_FOR_EXTENDED_PROPERTY")) {
+ return new Forward("result", "message", "testSetExtendedPropertyBySetter.do: ERROR: The result value: " + the_new_value);
+ }
+ return new Forward("result", "message", "testSetExtendedPropertyBySetter.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testSetExtendedPropertyBySetterP() {
+
+ try {
+ SubControlBean subbean = (SubControlBean) java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.extension.SubControlBean");
+
+ subbean.setMessage("NEW_VALUE_FOR_EXTENDED_PROPERTY");
+ String the_new_value = subbean.getExtendedPropertyByContext();
+ if (!the_new_value.equals("NEW_VALUE_FOR_EXTENDED_PROPERTY")) {
+ return new Forward("result", "message", "testSetExtendedPropertyBySetter.do: ERROR: The result value: " + the_new_value);
+ }
+ }
+ catch (Exception e) {
+ return new Forward("result", "message", "testSetExtendedPropertyBySetterP.do: Exception: " + e.getMessage());
+ }
+ return new Forward("result", "message", "testSetExtendedPropertyBySetterP.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testGetReconfiguredPropertyByContext() {
+ _subcontrol.setMessage("NEW_VALUE_FOR_EXTENDED_PROPERTY");
+ String the_new_value = _subcontrol.getExtendedPropertyByContext();
+ if (!the_new_value.equals("NEW_VALUE_FOR_EXTENDED_PROPERTY")) {
+ return new Forward("result", "message", "testGetReconfiguredPropertyByContext.do: ERROR: The result value: " + the_new_value);
+ }
+ return new Forward("result", "message", "testGetReconfiguredPropertyByContext.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testGetReconfiguredPropertyByContextP() {
+
+ try {
+ SubControlBean subbean = (SubControlBean) java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.extension.SubControlBean");
+
+ subbean.setMessage("NEW_VALUE_FOR_EXTENDED_PROPERTY");
+ String the_new_value = subbean.getExtendedPropertyByContext();
+ if (!the_new_value.equals("NEW_VALUE_FOR_EXTENDED_PROPERTY")) {
+ return new Forward("result", "message", "testGetReconfiguredPropertyByContextP.do: ERROR: The result value: " + the_new_value);
+ }
+ }
+ catch (Exception e) {
+ return new Forward("result", "message", "testGetReconfiguredPropertyByContextP.do: Exception: " + e.getMessage());
+ }
+ return new Forward("result", "message", "testGetReconfiguredPropertyByContext.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testGetReconfiguredPropertyByGetter() {
+ String layer = _subcontrol.getLayer();
+ if (!layer.equals("On_SubControl_Interface_Layer")) {
+ return new Forward("result", "message", "testGetReconfiguredPropertyByGetter.do: ERROR: The property from getter:layer=" + layer);
+ }
+ return new Forward("result", "message", "testGetReconfiguredPropertyByGetter.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testGetReconfiguredPropertyByGetterP() {
+
+ try {
+ SubControlBean subbean = (SubControlBean) java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.extension.SubControlBean");
+ String layer = subbean.getLayer();
+ if (!layer.equals("On_SubControl_Interface_Layer")) {
+ return new Forward("result", "message", "testGetReconfiguredPropertyByGetterP.do: ERROR: The property from getter:layer=" + layer);
+ }
+ }
+ catch (Exception e) {
+ return new Forward("result", "message", "testGetReconfiguredPropertyByGetterP.do: Exception: " + e.getMessage());
+ }
+ return new Forward("result", "message", "testGetReconfiguredPropertyByGetterP.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testSetReconfiguredPropertyBySetter() {
+ _subcontrol.setLayer("NEW_VALUE_FOR_LAYER");
+ try {
+ String the_layer = _subcontrol.getLayerByContext();
+ if (!the_layer.equals("NEW_VALUE_FOR_LAYER")) {
+ return new Forward("result", "message", "testSetReconfiguredPropertyBySetter.do: ERROR: " + the_layer);
+ }
+ }
+ catch (Exception e) {
+ return new Forward("result", "message", "testSetReconfiguredPropertyBySetter.do: Exception: " + e.getMessage());
+ }
+ return new Forward("result", "message", "testSetReconfiguredPropertyBySetter.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testSetReconfiguredPropertyBySetterP() {
+
+ try {
+ SubControlBean subbean = (SubControlBean) java.beans.Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.extension.SubControlBean");
+ subbean.setLayer("NEW_VALUE_FOR_LAYER");
+
+ String the_layer = _subcontrol.getLayerByContext();
+ if (!the_layer.equals("NEW_VALUE_FOR_LAYER")) {
+ return new Forward("result", "message", "testSetReconfiguredPropertyBySetterP.do: ERROR: " + the_layer);
+ }
+ }
+ catch (Exception e) {
+ return new Forward("result", "message", "testSetReconfiguredPropertyBySetterP.do: Exception: " + e.getMessage());
+ }
+ return new Forward("result", "message", "testSetReconfiguredPropertyBySetter.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testInvokeExtendedEvent() {
+
+ int result = _subcontrol.invokeExtendedEventFromSubControl();
+ try {
+ Thread.sleep(500);
+ }
+ catch (InterruptedException e) {
+ // noop
+ }
+
+ if (result != 0) {
+ return new Forward("result", "message", "testInvokeExtendedEvent.do: ERROR: The event on subcontrol was not triggered.");
+ }
+ if (!subClassEventReceived) {
+ return new Forward("result", "message", "testInvokeExtendedEvent.do: ERROR: The extended event is NOT received.");
+ }
+ return new Forward("result", "message", "testInvokeExtendedEvent.do: PASSED");
+ }
+
+ @Jpf.Action()
+ protected Forward testInvokeInheritedEvent() {
+
+ int result = _subcontrol.invokeInheritedEventFromSubControl();
+ if (result != 0) {
+ return new Forward("result", "message", "testInvokeInheritedEvent.do: ERROR: The event on subcontrol was not triggered.");
+ }
+ if (!superClassEventReceived) {
+ return new Forward("result", "message", "testInvokeExtendedEvent.do: ERROR: The inherited event is NOT received.");
+ }
+ return new Forward("result", "message", "testInvokeInheritedEvent.do: PASSED");
+ }
+
+}
Propchange: beehive/trunk/netui/test/webapps/controls/src/controls/extension/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/controls/instantiate/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/controls/instantiate/Controller.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/controls/instantiate/Controller.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/controls/instantiate/Controller.java Fri Jul 14 13:22:22 2006
@@ -0,0 +1,74 @@
+/*
+ * 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.instantiate;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.bean.Controls;
+import org.apache.beehive.controls.api.properties.BeanPropertyMap;
+import org.apache.beehive.netui.test.controls.instantiate.SingleProperty;
+import org.apache.beehive.netui.test.controls.instantiate.SinglePropertyBean;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ * Instantiate a custom control declaratively with property
+ */
+@Jpf.Controller(forwards = {@Jpf.Forward(name = "index", path = "index.jsp")})
+public class Controller extends PageFlowController {
+
+ private static String EXPECTED_GREETING = "Good evening!";
+
+ @Control
+ @SingleProperty.Greeting(GreetWord = "Good evening!")
+ public SinglePropertyBean myPropertyBean;
+
+ @Jpf.Action
+ protected Forward begin() {
+ return new Forward("index");
+ }
+
+ @Jpf.Action
+ protected Forward instantiate() {
+ if (myPropertyBean == null || !myPropertyBean.sayHello().equals(EXPECTED_GREETING)) {
+ return new Forward("index", "message", "instantiate: ERROR: control was null or invalid message.");
+ }
+ return new Forward("index", "message", "instantiate: PASSED");
+ }
+
+ @Jpf.Action
+ protected Forward instantiateP() {
+ try {
+ BeanPropertyMap greetAttr = new BeanPropertyMap(SingleProperty.Greeting.class);
+ greetAttr.setProperty(SinglePropertyBean.GreetWordKey, "Good afternoon!");
+ SinglePropertyBean spbean = (SinglePropertyBean) Controls.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.instantiate.SinglePropertyBean", greetAttr);
+
+ if (!"Good afternoon!".equals(spbean.sayHello())) {
+ return new Forward("index", "message", "instantiateP: ERROR: invalid message: " + spbean.sayHello());
+ }
+ }
+ catch (Exception e) {
+ return new Forward("index", "message", "instantiateP: ERROR: " + e.getMessage());
+ }
+ return new Forward("index", "message", "instantiateP: PASSED");
+ }
+
+}
Propchange: beehive/trunk/netui/test/webapps/controls/src/controls/instantiate/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/controls/property/client_access/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/controls/property/client_access/Controller.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/controls/property/client_access/Controller.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/controls/property/client_access/Controller.java Fri Jul 14 13:22:22 2006
@@ -0,0 +1,77 @@
+/*
+ * 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_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 client getting control property via getter/setter on control bean
+ * The control bean is instantiated declaratively
+ */
+@Jpf.Controller(forwards = {@Jpf.Forward(name = "index", path = "../index.jsp")})
+public class Controller extends PageFlowController {
+
+ @Control
+ private PropertyControlBean _myControl;
+
+ @Jpf.Action
+ protected Forward begin() {
+ return new Forward("index");
+ }
+
+ @Jpf.Action
+ protected Forward clientAccess() {
+ String attribute1 = _myControl.getAttribute1();
+ String attribute3 = _myControl.getPropertyTwoAttribute3();
+
+ if (!attribute1.equals(PropertyControl.DEFAULT_ATTRIBUTE_VALUE1)
+ || !attribute3.equals(PropertyControl.DEFAULT_ATTRIBUTE_VALUE3)) {
+ return new Forward("index", "message", "clientAccess.do: ERROR: Attribute1:" + attribute1 + ". Attribute3" + attribute3);
+ }
+ return new Forward("index", "message", "clientAccess.do: PASSED");
+ }
+
+ @Jpf.Action
+ protected Forward clientAccessP() {
+ try {
+ PropertyControlBean thebean = (PropertyControlBean) Beans.instantiate(
+ Thread.currentThread().getContextClassLoader(),
+ "org.apache.beehive.netui.test.controls.property.PropertyControlBean");
+
+ String attribute1 = thebean.getAttribute1();
+ String attribute3 = thebean.getPropertyTwoAttribute3();
+
+ if (!attribute1.equals(PropertyControl.DEFAULT_ATTRIBUTE_VALUE1)
+ || !attribute3.equals(PropertyControl.DEFAULT_ATTRIBUTE_VALUE3)) {
+ return new Forward("index", "message", "clientAccessP.do: ERROR: Attribute1:" + attribute1 + ". Attribute3" + attribute3);
+ }
+ }
+ catch (Exception e) {
+ return new Forward("index", "message", "clientAccessP.do: ERROR: " + e.getMessage());
+ }
+ return new Forward("index", "message", "clientAccessP.do: PASSED");
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/controls/src/controls/property/client_access/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/controls/property/client_impl/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/controls/property/client_impl/Controller.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/controls/property/client_impl/Controller.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/controls/property/client_impl/Controller.java Fri Jul 14 13:22:22 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/controls/src/controls/property/client_impl/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/controls/property/impl_access/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/controls/property/impl_access/Controller.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/controls/property/impl_access/Controller.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/controls/property/impl_access/Controller.java Fri Jul 14 13:22:22 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/controls/src/controls/property/impl_access/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/controls/property/property_constraints/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/controls/property/property_constraints/Controller.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/controls/property/property_constraints/Controller.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/controls/property/property_constraints/Controller.java Fri Jul 14 13:22:22 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/controls/src/controls/property/property_constraints/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/controls/property/veto/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/controls/property/veto/Controller.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/controls/property/veto/Controller.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/controls/property/veto/Controller.java Fri Jul 14 13:22:22 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/controls/src/controls/property/veto/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControl.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControl.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControl.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlImpl.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlImpl.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlImpl.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlOverrideImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlOverrideImpl.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlOverrideImpl.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlOverrideImpl.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/binding/BindingTestControlOverrideImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControl.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControl.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControl.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControlImpl.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControlImpl.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControlImpl.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestControlImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestOverrideControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestOverrideControlImpl.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestOverrideControlImpl.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestOverrideControlImpl.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/binding/DefaultBindingTestOverrideControlImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControl.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControl.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControl.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControlImpl.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControlImpl.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControlImpl.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestControlImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestOverrideControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestOverrideControlImpl.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestOverrideControlImpl.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestOverrideControlImpl.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/binding/ExternalBindingTestOverrideControlImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControl.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControl.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControl.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControlEventListener.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControlEventListener.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControlEventListener.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControlEventListener.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControlEventListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControlImpl.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControlImpl.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControlImpl.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/composition/InnerControlImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/Nested.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/Nested.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/Nested.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/Nested.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/composition/Nested.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/NestedAssembler.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/NestedAssembler.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/NestedAssembler.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/NestedAssembler.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/composition/NestedAssembler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/NestedImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/NestedImpl.java?rev=422018&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/NestedImpl.java (added)
+++ beehive/trunk/netui/test/webapps/controls/src/org/apache/beehive/netui/test/controls/composition/NestedImpl.java Fri Jul 14 13:22:22 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/controls/src/org/apache/beehive/netui/test/controls/composition/NestedImpl.java
------------------------------------------------------------------------------
svn:eol-style = native