myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r555517 - in /myfaces/tobago/trunk: example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/ example/demo/src/main/webapp/reference/ theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standar...
Date Thu, 12 Jul 2007 07:51:37 GMT
Author: lofwyr
Date: Thu Jul 12 00:51:36 2007
New Revision: 555517

URL: http://svn.apache.org/viewvc?view=rev&rev=555517
Log:
TOBAGO-444: Layout: Calculate fixed height for sheet according to displayed number of lines

Modified:
    myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/SimpleBean.java
    myfaces/tobago/trunk/example/demo/src/main/webapp/reference/sheet.jsp
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
    myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties

Modified: myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/SimpleBean.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/SimpleBean.java?view=diff&rev=555517&r1=555516&r2=555517
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/SimpleBean.java
(original)
+++ myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/reference/SimpleBean.java
Thu Jul 12 00:51:36 2007
@@ -20,9 +20,11 @@
 public class SimpleBean {
 
   private String name;
+  private String value;
 
-  public SimpleBean(String name) {
+  public SimpleBean(String name, String value) {
     this.name = name;
+    this.value = value;
   }
 
   public String getName() {
@@ -31,5 +33,13 @@
 
   public void setName(String name) {
     this.name = name;
+  }
+
+  public String getValue() {
+    return value;
+  }
+
+  public void setValue(String value) {
+    this.value = value;
   }
 }

Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/reference/sheet.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/reference/sheet.jsp?view=diff&rev=555517&r1=555516&r2=555517
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/reference/sheet.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/reference/sheet.jsp Thu Jul 12 00:51:36
2007
@@ -21,10 +21,10 @@
   System.out.println("1" + session.getAttribute("simpleList"));
   if (simpleList == null) {
     simpleList = new SimpleBean[]{
-        new SimpleBean("One"),
-        new SimpleBean("Two"),
-        new SimpleBean("Three"),
-        new SimpleBean("Four")};
+        new SimpleBean("1", "One"),
+        new SimpleBean("2", "Two"),
+        new SimpleBean("3", "Three"),
+        new SimpleBean("4", "Four")};
   }
   session.setAttribute("simpleList", simpleList);
   System.out.println("2" + session.getAttribute("simpleList"));
@@ -38,19 +38,40 @@
     <jsp:body>
       <tc:box label="Sheet">
         <f:facet name="layout">
-          <tc:gridLayout rows="fixed;*;fixed"/>
+          <tc:gridLayout rows="fixed;*;fixed;fixed;fixed"/>
         </f:facet>
 
         <tc:messages/>
 
-        <tc:sheet value="#{simpleList}" columns="*;*" var="bean">
+        <tc:sheet value="#{simpleList}" columns="fixed;*" var="bean">
           <tc:columnSelector />
           <tc:column label="Number">
-            <tc:in value="#{bean.name}" required="true"/>
+            <tc:in value="#{bean.value}" required="true"/>
           </tc:column>
         </tc:sheet>
 
-        <tc:button label="submit"/>
+        <tc:separator >
+          <f:facet name="label">
+            <tc:label value="Layout: Sheet with 'fixed' height"/>
+          </f:facet>
+        </tc:separator>
+
+        <tc:sheet value="#{simpleList}" columns="*;*" var="bean" rows="5">
+          <tc:column label="Cipher">
+            <tc:out value="#{bean.name}"/>
+          </tc:column>
+          <tc:column label="Name">
+            <tc:out value="#{bean.value}"/>
+          </tc:column>
+        </tc:sheet>
+
+        <tc:panel>
+          <f:facet name="layout">
+            <tc:gridLayout columns="*;fixed"   />
+          </f:facet>
+          <tc:cell/>
+          <tc:button action="submit" label="Submit" />
+        </tc:panel>
 
       </tc:box>
 

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?view=diff&rev=555517&r1=555516&r2=555517
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
(original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
Thu Jul 12 00:51:36 2007
@@ -102,19 +102,14 @@
 import java.util.Locale;
 import java.util.Map;
 
-public class SheetRenderer extends LayoutableRendererBase
-    implements SheetRendererWorkaround, AjaxRenderer {
+public class SheetRenderer extends LayoutableRendererBase implements SheetRendererWorkaround,
AjaxRenderer {
 
   private static final Log LOG = LogFactory.getLog(SheetRenderer.class);
 
-  public static final String WIDTHS_POSTFIX
-      = SUBCOMPONENT_SEP + "widths";
+  public static final String WIDTHS_POSTFIX = SUBCOMPONENT_SEP + "widths";
+  public static final String SCROLL_POSTFIX = SUBCOMPONENT_SEP + "scrollPosition";
+  public static final String SELECTED_POSTFIX = SUBCOMPONENT_SEP + "selected";
 
-  public static final String SCROLL_POSTFIX
-      = SUBCOMPONENT_SEP + "scrollPosition";
-
-  public static final String SELECTED_POSTFIX
-      = SUBCOMPONENT_SEP + "selected";
   private static final Integer HEIGHT_0 = 0;
 
   public void encodeEnd(FacesContext facesContext,
@@ -140,16 +135,12 @@
 
     writer.endElement(HtmlConstants.DIV);
 
-    ResourceManager resourceManager
-        = ResourceManagerFactory.getResourceManager(facesContext);
+    ResourceManager resourceManager = ResourceManagerFactory.getResourceManager(facesContext);
     UIViewRoot viewRoot = facesContext.getViewRoot();
-    String contextPath
-        = facesContext.getExternalContext().getRequestContextPath();
+    String contextPath = facesContext.getExternalContext().getRequestContextPath();
 
-    String unchecked = contextPath
-        + resourceManager.getImage(viewRoot, "image/sheetUnchecked.gif");
-    String checked = contextPath
-        + resourceManager.getImage(viewRoot, "image/sheetChecked.gif");
+    String unchecked = contextPath + resourceManager.getImage(viewRoot, "image/sheetUnchecked.gif");
+    String checked = contextPath + resourceManager.getImage(viewRoot, "image/sheetChecked.gif");
     boolean ajaxEnabled = TobagoConfig.getInstance(facesContext).isAjaxEnabled();
 
     final String[] styles = new String[]{"style/tobago-sheet.css"};
@@ -183,16 +174,11 @@
     String contextPath = facesContext.getExternalContext().getRequestContextPath();
     String sheetId = data.getClientId(facesContext);
 
-    String image1x1 = contextPath + resourceManager
-        .getImage(viewRoot, "image/1x1.gif");
-    String ascending = contextPath + resourceManager
-        .getImage(viewRoot, "image/ascending.gif");
-    String descending = contextPath + resourceManager
-        .getImage(viewRoot, "image/descending.gif");
-    String selectorDisabled = contextPath + resourceManager
-        .getImage(viewRoot, "image/sheetUncheckedDisabled.gif");
-    String unchecked = contextPath + resourceManager
-        .getImage(viewRoot, "image/sheetUnchecked.gif");
+    String image1x1 = contextPath + resourceManager.getImage(viewRoot, "image/1x1.gif");
+    String ascending = contextPath + resourceManager.getImage(viewRoot, "image/ascending.gif");
+    String descending = contextPath + resourceManager.getImage(viewRoot, "image/descending.gif");
+    String selectorDisabled = contextPath + resourceManager.getImage(viewRoot, "image/sheetUncheckedDisabled.gif");
+    String unchecked = contextPath + resourceManager.getImage(viewRoot, "image/sheetUnchecked.gif");
 
     Map attributes = data.getAttributes();
     HtmlStyleMap sheetStyle = (HtmlStyleMap) attributes.get(ATTR_STYLE);
@@ -1095,5 +1081,27 @@
     }
   }
 
-}
+  @Override
+  public int getFixedHeight(FacesContext facesContext, UIComponent component) {
+
+    // todo: why this will be called?
+    if (component == null) {
+      return 0;
+    }
+
+    UIData data = (UIData) component;
 
+//    int headerHeight = getConfiguredValue(facesContext, component, "headerHeight");
+//    int footerHeight = getConfiguredValue(facesContext, component, "footerHeight");
+    int headerHeight = getHeaderHeight(facesContext, component);
+    int footerHeight = getFooterHeight(facesContext, component);
+
+    int rowHeight = getConfiguredValue(facesContext, component, "rowHeight");
+
+    int rows = data.getRows();
+
+    LOG.info(headerHeight + " " + footerHeight + " " + rowHeight + " " + rows);
+
+    return headerHeight + rows * rowHeight + footerHeight + 2; // XXX hotfix: + 1
+  }
+}

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties?view=diff&rev=555517&r1=555516&r2=555517
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
(original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
Thu Jul 12 00:51:36 2007
@@ -83,7 +83,7 @@
 Sheet.ascendingMarkerWidth=10
 Sheet.headerHeight=20
 Sheet.footerHeight=20
-#Sheet.rowHeight=18
+Sheet.rowHeight=18
 Sheet.rowPadding=5
 Sheet.selectorMenuWidth=20
 Sheet.cellPaddingWidth=4

Modified: myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties?view=diff&rev=555517&r1=555516&r2=555517
==============================================================================
--- myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
(original)
+++ myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
Thu Jul 12 00:51:36 2007
@@ -46,7 +46,6 @@
 Sheet.ascendingMarkerWidth=15
 Sheet.headerHeight=20
 Sheet.footerHeight=15
-#Sheet.rowHeight=19
 Sheet.rowPadding=3
 Sheet.contentBorder=2
 Sheet.selectorMenuWidth=16



Mime
View raw message