You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2011/11/08 02:31:13 UTC
svn commit: r1199045 - in /pivot/trunk/tests/src/org/apache/pivot/tests:
CustomPanel.java custom_panel.bxml
Author: smartini
Date: Tue Nov 8 01:31:12 2011
New Revision: 1199045
URL: http://svn.apache.org/viewvc?rev=1199045&view=rev
Log:
PIVOT-813, test class and bxml
Added:
pivot/trunk/tests/src/org/apache/pivot/tests/CustomPanel.java
pivot/trunk/tests/src/org/apache/pivot/tests/custom_panel.bxml
Added: pivot/trunk/tests/src/org/apache/pivot/tests/CustomPanel.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/CustomPanel.java?rev=1199045&view=auto
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/CustomPanel.java (added)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/CustomPanel.java Tue Nov 8 01:31:12 2011
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.
+ */
+package org.apache.pivot.tests;
+
+import java.net.URL;
+
+import org.apache.pivot.beans.BXML;
+import org.apache.pivot.beans.Bindable;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.util.Resources;
+import org.apache.pivot.wtk.TextInput;
+import org.apache.pivot.wtk.Window;
+
+/**
+ * Test Component to ensure that BXMLSerializer will use public setter methods
+ * instead of setting private fields directly (possible in trusted code
+ * when run in a sandboxed environment, like in not trusted applets).
+ */
+public class CustomPanel extends Window implements Bindable {
+
+ @BXML private String field;
+ @BXML private TextInput textInput = null;
+
+
+ public CustomPanel() {
+ }
+
+ public void setField(String field) {
+ this.field = field;
+ }
+
+ public String getField() {
+ return field;
+ }
+
+ public void setTextInput(TextInput textInput) {
+ this.textInput = textInput;
+ }
+
+ public TextInput getTextInput() {
+ return textInput;
+ }
+
+ @Override
+ public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+ System.out.println("field = \"" + getField() + "\"");
+ System.out.println("textInput.text = \"" + getTextInput().getText() + "\"");
+ }
+
+}
Added: pivot/trunk/tests/src/org/apache/pivot/tests/custom_panel.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/custom_panel.bxml?rev=1199045&view=auto
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/custom_panel.bxml (added)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/custom_panel.bxml Tue Nov 8 01:31:12 2011
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you 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.
+-->
+
+<tests:CustomPanel title="Custom Panel Title" maximized="true" field="Field in Custom Panel"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns:tests="org.apache.pivot.tests"
+ xmlns="org.apache.pivot.wtk">
+ <BoxPane styles="{padding:4, horizontalAlignment:'center', verticalAlignment:'center'}">
+ <Label text="Custom panel: Label"/>
+ <TextInput bxml:id="textInput" text="Custom panel: TextInput" editable="false"/>
+ </BoxPane>
+</tests:CustomPanel>