You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2008/06/25 12:42:04 UTC
svn commit: r671501 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java
core/src/main/java/org/apache/myfaces/tobago/layout/Box.java
example/demo/src/main/webapp/reference/popup.jsp
Author: lofwyr
Date: Wed Jun 25 03:42:04 2008
New Revision: 671501
URL: http://svn.apache.org/viewvc?rev=671501&view=rev
Log:
TOBAGO-487:
+ add convenience object TobagoContext
+ add convenience method getRight and getBottom
+ redesign popup.jsp
Added:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java
myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java?rev=671501&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java Wed Jun 25 03:42:04 2008
@@ -0,0 +1,37 @@
+package org.apache.myfaces.tobago.context;
+
+import org.apache.myfaces.tobago.component.AbstractUIPage;
+import org.apache.myfaces.tobago.layout.Box;
+import org.apache.myfaces.tobago.util.ComponentUtil;
+
+import javax.faces.context.FacesContext;
+
+/*
+ * 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.
+ */
+
+/**
+ * User: lofwyr
+ * Date: 11.06.2008 16:17:03
+ */
+public class TobagoContext {
+
+ public Box getActionPosition() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ AbstractUIPage page = ComponentUtil.findPage(facesContext);
+ return page.getActionPosition();
+ }
+}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java?rev=671501&r1=671500&r2=671501&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java Wed Jun 25 03:42:04 2008
@@ -45,6 +45,20 @@
throw new IllegalArgumentException("Can't parse to a box: '" + string + "'");
}
+ /**
+ * Convenience method to get left + width.
+ */
+ public Measure getRight() {
+ return position.getLeft().add(dimension.getWidth());
+ }
+
+ /**
+ * Convenience method to get top + height.
+ */
+ public Measure getBottom() {
+ return position.getTop().add(dimension.getHeight());
+ }
+
public Measure getLeft() {
return position.getLeft();
}
Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp?rev=671501&r1=671500&r2=671501&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp Wed Jun 25 03:42:04 2008
@@ -21,115 +21,149 @@
<%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
<layout:overview>
- <jsp:body>
- <tc:box label="Popups">
- <f:facet name="layout">
- <tc:gridLayout columns="130px;*" rows="fixed;fixed;fixed;fixed;*;fixed;*"/>
- </f:facet>
-
- <tc:button label="Open">
- <tc:attribute name="renderedPartially" value="popup"/>
- <f:facet name="popup">
- <tc:popup width="300" height="270" id="popup">
- <tc:box label="Text input">
- <f:facet name="layout">
- <tc:gridLayout rows="fixed;fixed;fixed;*;fixed"/>
- </f:facet>
-
- <tc:selectBooleanCheckbox value="#{reference.bool}"/>
- <tc:in value="#{reference.text}" required="true"/>
- <tx:date>
- <f:convertDateTime pattern="dd/MM/yyyy"/>
- </tx:date>
- <tc:cell/>
- <tc:panel>
- <f:facet name="layout">
- <tc:gridLayout columns="1*;1*;1*" margin="10"/>
- </f:facet>
- <tc:button label="Cancel">
- <tc:attribute name="popupClose" value="immediate"/>
- </tc:button>
- <tc:button label="Redisplay">
- <tc:attribute name="renderedPartially" value="popup"/>
- </tc:button>
- <tc:button label="Ok">
- <tc:attribute name="popupClose" value="afterSubmit"/>
- <tc:attribute name="renderedPartially" value=":page:values"/>
- </tc:button>
- </tc:panel>
-
- </tc:box>
- </tc:popup>
- </f:facet>
- </tc:button>
-
- <tc:menuBar>
- <tc:menu label="Menu">
- <tc:menuItem label="Open Popup">
- <tc:popupReference for=":page:popup"/>
- </tc:menuItem>
- </tc:menu>
- </tc:menuBar>
-
- <tc:button label="Open modeless">
- <f:facet name="popup">
- <tc:popup width="300" height="270" id="popup2" modal="false">
- <tc:box label="Text input">
- <f:facet name="layout">
- <tc:gridLayout rows="fixed;*;fixed"/>
- </f:facet>
-
- <tx:in label="Field" required="true"/>
- <tc:cell/>
- <tc:panel>
- <f:facet name="layout">
- <tc:gridLayout columns="*;fixed;fixed"/>
- </f:facet>
- <tc:cell/>
- <tc:button label="Cancel">
- <tc:attribute name="popupClose" value="immediate"/>
- </tc:button>
- <tc:button label="Ok">
- <tc:attribute name="popupClose" value="afterSubmit"/>
- </tc:button>
- </tc:panel>
-
- </tc:box>
- </tc:popup>
- </f:facet>
- </tc:button>
-
-
- <tc:out value="here is the boolean >>#{reference.bool}<<"/>
-
- <tc:button label="Open here">
- <f:facet name="popup">
- <tc:popup width="150" height="110" left="#{view.children[0].actionPosition.left.pixel + view.children[0].actionPosition.width.pixel + 5}" top="#{view.children[0].actionPosition.top.pixel}">
- <tc:box label="Text input">
- <f:facet name="layout">
- <tc:gridLayout rows="*;fixed"/>
- </f:facet>
-
- <tc:textarea value="This popup should opened right beside the button."/>
- <tc:button label="Ok">
- <tc:attribute name="popupClose" value="afterSubmit"/>
- </tc:button>
-
- </tc:box>
- </tc:popup>
- </f:facet>
- </tc:button>
- <tc:cell/>
-
- <tc:cell/>
- <tc:cell/>
+<jsp:body>
+<tc:box label="Popups">
+<f:facet name="layout">
+ <tc:gridLayout rows="fixed;fixed;fixed;fixed;fixed;fixed;fixed;fixed;*"/>
+</f:facet>
+
+<tc:menuBar>
+ <tc:menu label="Menu">
+ <tc:menuItem label="Open Popup">
+ <tc:popupReference for=":page:popup"/>
+ </tc:menuItem>
+ </tc:menu>
+</tc:menuBar>
+
+<tc:messages/>
+
+<tc:panel>
+ <f:facet name="layout">
+ <tc:gridLayout columns="fixed;fixed;fixed;fixed;*"/>
+ </f:facet>
+
+ <tc:label value="Full Reload"/>
+
+ <tc:button label="Open">
+ <f:facet name="popup">
+ <tc:popup width="300" height="270" id="modal_popup">
+ <tc:box label="Modal text input">
+ <f:facet name="layout">
+ <tc:gridLayout rows="fixed;fixed;fixed;*;fixed"/>
+ </f:facet>
+
+ <tc:selectBooleanCheckbox value="#{reference.bool}"/>
+ <tc:in value="#{reference.text}" required="true"/>
+ <tx:date>
+ <f:convertDateTime pattern="dd/MM/yyyy"/>
+ </tx:date>
+ <tc:cell/>
+ <tc:panel>
+ <f:facet name="layout">
+ <tc:gridLayout columns="1*;1*;1*" margin="10"/>
+ </f:facet>
+ <tc:button label="Cancel">
+ <tc:attribute name="popupClose" value="immediate"/>
+ </tc:button>
+ <tc:button label="Redisplay">
+ <tc:attribute name="renderedPartially" value="popup"/>
+ </tc:button>
+ <tc:button label="Ok">
+ <tc:attribute name="popupClose" value="afterSubmit"/>
+ </tc:button>
+ </tc:panel>
+
+ </tc:box>
+ </tc:popup>
+ </f:facet>
+ </tc:button>
+
+ <tc:button label="Open modeless">
+ <f:facet name="popup">
+ <tc:popup width="300" height="270" id="non_modal_popup" modal="false">
+ <tc:box label="Non modal text input">
+ <f:facet name="layout">
+ <tc:gridLayout rows="fixed;*;fixed"/>
+ </f:facet>
+
+ <tx:in label="Field" required="true"/>
+ <tc:cell/>
+ <tc:panel>
+ <f:facet name="layout">
+ <tc:gridLayout columns="*;fixed;fixed"/>
+ </f:facet>
+ <tc:cell/>
+ <tc:button label="Cancel">
+ <tc:attribute name="popupClose" value="immediate"/>
+ </tc:button>
+ <tc:button label="Ok">
+ <tc:attribute name="popupClose" value="afterSubmit"/>
+ </tc:button>
+ </tc:panel>
+
+ </tc:box>
+ </tc:popup>
+ </f:facet>
+ </tc:button>
+
+ <tc:button label="Open here">
+ <f:facet name="popup">
+ <tc:popup width="180" height="110" id="positioned_popup"
+ left="#{tobago.actionPosition.right.pixel + 5}" top="#{tobago.actionPosition.top.pixel}">
+ <tc:box label="Info">
+ <f:facet name="layout">
+ <tc:gridLayout rows="*;fixed"/>
+ </f:facet>
+
+ <tc:textarea value="This popup should opened right beside the button." readonly="true"/>
+ <tc:button label="Ok">
+ <tc:attribute name="popupClose" value="immediate"/>
+ </tc:button>
+
+ </tc:box>
+ </tc:popup>
+ </f:facet>
+ </tc:button>
+
+ <tc:cell />
+
+</tc:panel>
+<tc:panel>
+ <f:facet name="layout">
+ <tc:gridLayout columns="fixed;fixed;fixed;fixed;*"/>
+ </f:facet>
+
+ <tc:label value="Partial Reload"/>
+
+ <tc:button label="Open">
+ <tc:attribute name="renderedPartially" value="modal_popup"/>
+ <tc:popupReference for="modal_popup"/>
+ </tc:button>
+
+ <tc:button label="Open modeless">
+ <tc:attribute name="renderedPartially" value="non_modal_popup"/>
+ <tc:popupReference for="non_modal_popup"/>
+ </tc:button>
+
+ <tc:button label="Open here">
+ <tc:attribute name="renderedPartially" value="positioned_popup"/>
+ <tc:popupReference for="positioned_popup"/>
+ </tc:button>
+
+ <tc:cell />
+
+</tc:panel>
+
+<tx:in readonly="true" label="The Boolean" value="#{reference.bool}"/>
+
+<tx:in readonly="true" label="The Text" value="#{reference.text}"/>
- <tc:cell/>
- <tx:selectOneChoice label="Select"/>
+<tx:in required="true" label="Required"/>
- <tc:cell/>
- <tc:cell/>
+<tx:selectOneChoice label="Select"/>
- </tc:box>
- </jsp:body>
+<tc:cell/>
+
+</tc:box>
+</jsp:body>
</layout:overview>