You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2011/01/03 22:29:18 UTC
svn commit: r1054762 - in
/pivot/trunk/examples/src/org/apache/pivot/examples/builder: ./
BuilderExample.java builder_example.bxml
Author: gbrown
Date: Mon Jan 3 21:29:18 2011
New Revision: 1054762
URL: http://svn.apache.org/viewvc?rev=1054762&view=rev
Log:
Add builder example/comparison.
Added:
pivot/trunk/examples/src/org/apache/pivot/examples/builder/
pivot/trunk/examples/src/org/apache/pivot/examples/builder/BuilderExample.java
pivot/trunk/examples/src/org/apache/pivot/examples/builder/builder_example.bxml
Added: pivot/trunk/examples/src/org/apache/pivot/examples/builder/BuilderExample.java
URL: http://svn.apache.org/viewvc/pivot/trunk/examples/src/org/apache/pivot/examples/builder/BuilderExample.java?rev=1054762&view=auto
==============================================================================
--- pivot/trunk/examples/src/org/apache/pivot/examples/builder/BuilderExample.java (added)
+++ pivot/trunk/examples/src/org/apache/pivot/examples/builder/BuilderExample.java Mon Jan 3 21:29:18 2011
@@ -0,0 +1,87 @@
+/*
+ * 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.examples.builder;
+
+import java.io.IOException;
+
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.serialization.SerializationException;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.Label;
+import org.apache.pivot.wtk.TabPane;
+import org.apache.pivot.wtk.Window;
+
+public class BuilderExample implements Application {
+ private Window window = null;
+
+ @Override
+ public void startup(Display display, Map<String, String> properties)
+ throws Exception {
+ window = buildWindow();
+ window.open(display);
+ }
+
+ @Override
+ public boolean shutdown(boolean optional) {
+ if (window != null) {
+ window.close();
+ }
+
+ return false;
+ }
+
+ @Override
+ public void suspend() {
+ }
+
+ @Override
+ public void resume() {
+ }
+
+ private Window buildWindow()
+ throws SerializationException, IOException {
+ return new Window() {
+ { setContent(new TabPane() {
+ { getTabs().add(new Label() {
+ { setText("Label 1");
+ TabPane.setTabData(this, "Label 1");
+ }
+ });
+
+ getTabs().add(new Label() {
+ { setText("Label 2");
+ TabPane.setTabData(this, "Label 2");
+ }
+ });
+
+ getTabs().add(new Label() {
+ { setText("Label 3");
+ TabPane.setTabData(this, "Label 3");
+ }
+ });
+
+ setSelectedIndex(2);
+ }
+ });
+
+ setTitle("Builder Example");
+ setMaximized(true);
+ }
+ };
+ }
+}
Added: pivot/trunk/examples/src/org/apache/pivot/examples/builder/builder_example.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/examples/src/org/apache/pivot/examples/builder/builder_example.bxml?rev=1054762&view=auto
==============================================================================
--- pivot/trunk/examples/src/org/apache/pivot/examples/builder/builder_example.bxml (added)
+++ pivot/trunk/examples/src/org/apache/pivot/examples/builder/builder_example.bxml Mon Jan 3 21:29:18 2011
@@ -0,0 +1,28 @@
+<?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.
+-->
+
+<Window title="Builder Example" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns="org.apache.pivot.wtk">
+ <TabPane selectedIndex="2">
+ <Label text="Label 1" TabPane.tabData="Label 1"/>
+ <Label text="Label 2" TabPane.tabData="Label 2"/>
+ <Label text="Label 3" TabPane.tabData="Label 3"/>
+ </TabPane>
+</Window>
+