You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2006/11/09 10:40:10 UTC

svn commit: r472830 - in /myfaces/tobago/trunk/example/addressbook/src/main: java/org/apache/myfaces/tobago/example/addressbook/Layout.java webapp/WEB-INF/faces-config.xml webapp/editor.jsp webapp/index.jsp webapp/list.jsp webapp/start.jsp

Author: bommel
Date: Thu Nov  9 01:40:09 2006
New Revision: 472830

URL: http://svn.apache.org/viewvc?view=rev&rev=472830
Log:
adding example for page width and height

Added:
    myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Layout.java
    myfaces/tobago/trunk/example/addressbook/src/main/webapp/start.jsp
Modified:
    myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/tobago/trunk/example/addressbook/src/main/webapp/editor.jsp
    myfaces/tobago/trunk/example/addressbook/src/main/webapp/index.jsp
    myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp

Added: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Layout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Layout.java?view=auto&rev=472830
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Layout.java (added)
+++ myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Layout.java Thu Nov  9 01:40:09 2006
@@ -0,0 +1,103 @@
+package org.apache.myfaces.tobago.example.addressbook;
+
+/*
+ * 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.
+ */
+
+import org.apache.myfaces.tobago.model.PageStateImpl;
+
+/*
+ * Created by IntelliJ IDEA.
+ * User: bommel
+ * Date: Nov 9, 2006
+ * Time: 10:12:22 AM
+ */
+public class Layout extends PageStateImpl {
+
+  private int width;
+  private int height;
+  private int minimumWidth;
+  private int minimumHeight;
+  private int maximumWidth;
+  private int maximumHeight;
+
+  public int getWidth() {
+    int clientWidth = getClientWidth();
+    if (clientWidth != 0) {
+      if (clientWidth < minimumWidth) {
+        return minimumWidth;
+      } else if (clientWidth > maximumWidth) {
+        return maximumWidth;
+      }
+      return clientWidth;
+    }
+    return width;
+  }
+
+  public void setWidth(int width) {
+    this.width = width;
+  }
+
+  public int getHeight() {
+    int clientHeight = getClientHeight();
+    if (clientHeight != 0) {
+      if (clientHeight < minimumHeight) {
+        return minimumHeight;
+      } else if (clientHeight > maximumHeight) {
+        return maximumHeight;
+      }
+      return clientHeight;
+    }
+    return height;
+  }
+
+  public void setHeight(int height) {
+    this.height = height;
+  }
+
+  public int getMinimumWidth() {
+    return minimumWidth;
+  }
+
+  public void setMinimumWidth(int minimumWidth) {
+    this.minimumWidth = minimumWidth;
+  }
+
+  public int getMinimumHeight() {
+    return minimumHeight;
+  }
+
+  public void setMinimumHeight(int minimumHeight) {
+    this.minimumHeight = minimumHeight;
+  }
+
+  public int getMaximumWidth() {
+    return maximumWidth;
+  }
+
+  public void setMaximumWidth(int maximumWidth) {
+    this.maximumWidth = maximumWidth;
+  }
+
+  public int getMaximumHeight() {
+    return maximumHeight;
+  }
+
+  public void setMaximumHeight(int maximumHeight) {
+    this.maximumHeight = maximumHeight;
+  }
+}
+

Modified: myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml?view=diff&rev=472830&r1=472829&r2=472830
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml Thu Nov  9 01:40:09 2006
@@ -51,6 +51,43 @@
     <managed-bean-scope>application</managed-bean-scope>
   </managed-bean>
 
+  <managed-bean>
+    <managed-bean-name>layout</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.tobago.example.addressbook.Layout</managed-bean-class>
+    <managed-bean-scope>session</managed-bean-scope>
+    <managed-property>
+      <property-name>width</property-name>
+      <property-class>int</property-class>
+      <value>400</value>
+    </managed-property>
+    <managed-property>
+      <property-name>height</property-name>
+      <property-class>int</property-class>
+      <value>480</value>
+    </managed-property>
+    <managed-property>
+      <property-name>minimumWidth</property-name>
+      <property-class>int</property-class>
+      <value>600</value>
+    </managed-property>
+    <managed-property>
+      <property-name>minimumHeight</property-name>
+      <property-class>int</property-class>
+      <value>480</value>
+    </managed-property>
+     <managed-property>
+      <property-name>maximumWidth</property-name>
+      <property-class>int</property-class>
+      <value>1000</value>
+    </managed-property>
+    <managed-property>
+      <property-name>maximumHeight</property-name>
+      <property-class>int</property-class>
+      <value>480</value>
+    </managed-property>
+
+  </managed-bean>
+
   <converter>
     <converter-for-class>org.apache.myfaces.tobago.example.addressbook.EmailAddress</converter-for-class>
     <converter-class>org.apache.myfaces.tobago.example.addressbook.AddressConverter</converter-class>

Modified: myfaces/tobago/trunk/example/addressbook/src/main/webapp/editor.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/webapp/editor.jsp?view=diff&rev=472830&r1=472829&r2=472830
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/webapp/editor.jsp (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/webapp/editor.jsp Thu Nov  9 01:40:09 2006
@@ -21,7 +21,7 @@
 <f:view>
   <tc:loadBundle basename="addressbook" var="bundle" />
 
-  <tc:page label="#{bundle.editorTitle}" width="640px" height="480px">
+  <tc:page label="#{bundle.editorTitle}"  state="#{layout}" width="#{layout.width}" height="#{layout.height}" >
 
     <tc:panel>
       <f:facet name="layout">

Modified: myfaces/tobago/trunk/example/addressbook/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/webapp/index.jsp?view=diff&rev=472830&r1=472829&r2=472830
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/webapp/index.jsp (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/webapp/index.jsp Thu Nov  9 01:40:09 2006
@@ -14,4 +14,4 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 --%>
-<jsp:forward page="faces/list.jsp"/>
\ No newline at end of file
+<jsp:forward page="faces/start.jsp"/>
\ No newline at end of file

Modified: myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp?view=diff&rev=472830&r1=472829&r2=472830
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp Thu Nov  9 01:40:09 2006
@@ -19,7 +19,7 @@
 <f:view>
   <tc:loadBundle basename="addressbook" var="bundle"/>
 
-  <tc:page label="#{bundle.listPageTitle}" width="640px" height="480px">
+  <tc:page label="#{bundle.listPageTitle}" state="#{layout}" width="#{layout.width}" height="#{layout.height}" >
 
     <tc:panel>
       <f:facet name="layout">

Added: myfaces/tobago/trunk/example/addressbook/src/main/webapp/start.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/webapp/start.jsp?view=auto&rev=472830
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/webapp/start.jsp (added)
+++ myfaces/tobago/trunk/example/addressbook/src/main/webapp/start.jsp Thu Nov  9 01:40:09 2006
@@ -0,0 +1,37 @@
+<%--
+ * 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.
+--%>
+<%@ taglib uri="http://myfaces.apache.org/tobago/component" prefix="tc" %>
+<%@ taglib uri="http://myfaces.apache.org/tobago/extension" prefix="tx" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+
+<f:view>
+  <tc:loadBundle basename="addressbook" var="bundle" />
+
+  <tc:page label="#{bundle.editorTitle}"  state="#{layout}" width="#{layout.width}" height="#{layout.height}" >
+
+    <tc:panel>
+      <f:facet name="layout">
+        <tc:gridLayout margin="10px"/>
+      </f:facet>
+
+        <tc:messages />
+        <tc:link label="Enter Addressbook Demo " action="list" />
+
+
+    </tc:panel>
+  </tc:page>
+</f:view>