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 2009/09/29 09:50:03 UTC
svn commit: r819850 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/taglib/component/
example/test/src/main/java/org/apache/myfaces/tobago/example/test/
example/test/src/m...
Author: lofwyr
Date: Tue Sep 29 07:50:02 2009
New Revision: 819850
URL: http://svn.apache.org/viewvc?rev=819850&view=rev
Log:
TOBAGO-606: Layout-Manager
- adding a layout manager for <tc:sheet>
- fixing file upload
- sample for immediate
Added:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java
- copied, changed from r814834, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetLayoutTagDeclaration.java
- copied, changed from r814834, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupLayoutTagDeclaration.java
myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Immediate.java
myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Upload.java
myfaces/tobago/trunk/example/test/src/main/webapp/immediate.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/file/
myfaces/tobago/trunk/example/test/src/main/webapp/tc/file/file.xhtml
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/wml/
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIData.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIFileInput.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java
myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java
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
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIData.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIData.java?rev=819850&r1=819849&r2=819850&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIData.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIData.java Tue Sep 29 07:50:02 2009
@@ -19,6 +19,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.OnComponentCreated;
import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
import org.apache.myfaces.tobago.compat.FacesUtils;
@@ -30,7 +31,11 @@
import org.apache.myfaces.tobago.event.SheetStateChangeSource;
import org.apache.myfaces.tobago.event.SortActionEvent;
import org.apache.myfaces.tobago.event.SortActionSource;
+import org.apache.myfaces.tobago.layout.LayoutComponent;
+import org.apache.myfaces.tobago.layout.LayoutContainer;
+import org.apache.myfaces.tobago.layout.LayoutManager;
import org.apache.myfaces.tobago.layout.LayoutTokens;
+import org.apache.myfaces.tobago.layout.LayoutUtils;
import org.apache.myfaces.tobago.model.SheetState;
import org.apache.myfaces.tobago.util.ComponentUtil;
@@ -51,7 +56,8 @@
import java.util.Map;
public abstract class AbstractUIData extends javax.faces.component.UIData
- implements SheetStateChangeSource, SortActionSource, AjaxComponent, InvokeOnComponent {
+ implements SheetStateChangeSource, SortActionSource, AjaxComponent, InvokeOnComponent, OnComponentCreated,
+ LayoutContainer, LayoutComponent {
private static final Log LOG = LogFactory.getLog(AbstractUIData.class);
@@ -518,4 +524,26 @@
// sheet.queueEvent(new SheetStateChangeEvent(sheet));
}
+ // LAYOUT Begin
+ public List<LayoutComponent> getComponents() {
+ return LayoutUtils.findLayoutChildren(this);
+ }
+
+ public LayoutManager getLayoutManager() {
+ return (LayoutManager) getFacet(Facets.LAYOUT);
+ }
+
+ public void onComponentCreated(FacesContext context, UIComponent component) {
+ // if there is no layout manager set, create one
+ if (getLayoutManager() == null) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ LayoutManager layoutManager = (LayoutManager) CreateComponentUtils.createComponent(
+ facesContext, "org.apache.myfaces.tobago.SheetLayout", RendererTypes.SHEET_LAYOUT);
+ ((OnComponentCreated) layoutManager).onComponentCreated(facesContext, (UILayout) layoutManager);
+ getFacets().put(Facets.LAYOUT, (UILayout) layoutManager);
+ }
+ }
+
+// LAYOUT End
+
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIFileInput.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIFileInput.java?rev=819850&r1=819849&r2=819850&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIFileInput.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIFileInput.java Tue Sep 29 07:50:02 2009
@@ -18,6 +18,7 @@
*/
import org.apache.commons.fileupload.FileItem;
+import org.apache.myfaces.tobago.layout.LayoutComponent;
import org.apache.myfaces.tobago.util.MessageFactory;
import javax.faces.application.FacesMessage;
@@ -27,7 +28,8 @@
* Date: 10.02.2006
* Time: 19:02:13
*/
-public abstract class AbstractUIFileInput extends javax.faces.component.UIInput {
+public abstract class AbstractUIFileInput
+ extends javax.faces.component.UIInput implements LayoutComponent {
public void validate(FacesContext facesContext) {
if (isRequired()) {
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java (from r814834, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java&r1=814834&r2=819850&rev=819850&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java Tue Sep 29 07:50:02 2009
@@ -33,7 +33,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-public abstract class AbstractUITabGroupLayout extends UILayout implements LayoutManager, OnComponentCreated {
+public abstract class AbstractUISheetLayout extends UILayout implements LayoutManager, OnComponentCreated {
private static final Log LOG = LogFactory.getLog(AbstractUIGridLayout.class);
@@ -158,4 +158,4 @@
public boolean getRendersChildren() {
return false;
}
-}
+}
\ No newline at end of file
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java?rev=819850&r1=819849&r2=819850&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java Tue Sep 29 07:50:02 2009
@@ -60,6 +60,7 @@
public static final String SELECT_REFERENCE = "SelectReference";
public static final String SEPARATOR = "Separator";
public static final String SHEET_PAGE_COMMAND = "SheetPageCommand";
+ public static final String SHEET_LAYOUT = "SheetLayout";
public static final String STYLE = "Style";
public static final String TEXT_AREA = "TextArea";
public static final String TAB = "Tab";
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTagDeclaration.java?rev=819850&r1=819849&r2=819850&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTagDeclaration.java Tue Sep 29 07:50:02 2009
@@ -34,6 +34,7 @@
import org.apache.myfaces.tobago.taglib.decl.HasValidatorMessage;
import org.apache.myfaces.tobago.taglib.decl.HasValueChangeListener;
import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
+import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponent;
import org.apache.myfaces.tobago.taglib.decl.IsReadonly;
import org.apache.myfaces.tobago.taglib.decl.IsRequired;
@@ -58,7 +59,7 @@
public interface FileTagDeclaration
extends HasValidator, HasValidatorMessage, HasRequiredMessage, HasConverterMessage, HasOnchange,
HasValueChangeListener, HasIdBindingAndRendered, IsDisabled,
- HasLabelAndAccessKey, HasTip, IsReadonly, IsRequired, HasTabIndex {
+ HasLabelAndAccessKey, HasTip, IsReadonly, IsRequired, HasTabIndex, IsGridLayoutComponent {
/**
* Value binding expression pointing to a
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetLayoutTagDeclaration.java (from r814834, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupLayoutTagDeclaration.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetLayoutTagDeclaration.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetLayoutTagDeclaration.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupLayoutTagDeclaration.java&r1=814834&r2=819850&rev=819850&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupLayoutTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetLayoutTagDeclaration.java Tue Sep 29 07:50:02 2009
@@ -24,15 +24,15 @@
import org.apache.myfaces.tobago.taglib.decl.HasId;
/**
- * Creates a TabGroupLayout, which is a internal layout manager of a tabGroup.
+ * Creates a SheetLayout, which is a internal layout manager of a sheet.
*/
-@Tag(name = "tabGroupLayout", bodyContent = BodyContent.EMPTY)
+@Tag(name = "sheetLayout", bodyContent = BodyContent.EMPTY)
@UIComponentTag(
- uiComponent = "org.apache.myfaces.tobago.component.UITabGroupLayout",
- uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUITabGroupLayout",
- rendererType = RendererTypes.TAB_GROUP_LAYOUT,
- componentFamily = "org.apache.myfaces.tobago.TabGroupLayout",
+ uiComponent = "org.apache.myfaces.tobago.component.UISheetLayout",
+ uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUISheetLayout",
+ rendererType = RendererTypes.SHEET_LAYOUT,
+ componentFamily = "org.apache.myfaces.tobago.SheetLayout",
allowedChildComponenents = "NONE",
isLayout = true)
-public interface TabGroupLayoutTagDeclaration extends HasId {
+public interface SheetLayoutTagDeclaration extends HasId {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java?rev=819850&r1=819849&r2=819850&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java Tue Sep 29 07:50:02 2009
@@ -27,6 +27,7 @@
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
+import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponent;
/**
* Render a sheet element.
@@ -44,8 +45,7 @@
"org.apache.myfaces.tobago.ColumnSelector"},
facets = {@Facet(name = Facets.RELOAD, description = "Contains an instance of UIReload",
allowedChildComponenents = "org.apache.myfaces.tobago.Reload")})
-
-public interface SheetTagDeclaration extends HasIdBindingAndRendered {
+public interface SheetTagDeclaration extends HasIdBindingAndRendered, IsGridLayoutComponent {
/**
* LayoutConstraints for column layout.
* Semicolon separated list of layout tokens ('<x>*', '<x>px' or '<x>%').
Added: myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Immediate.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Immediate.java?rev=819850&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Immediate.java (added)
+++ myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Immediate.java Tue Sep 29 07:50:02 2009
@@ -0,0 +1,77 @@
+package org.apache.myfaces.tobago.example.test;
+
+/*
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+
+public class Immediate {
+
+ private String in;
+ private int selectOne;
+ private Integer[] selectMany;
+
+ private SelectItem[] selectItems = new SelectItem[] {
+ new SelectItem(0, "Zero"),
+ new SelectItem(1, "One"),
+ new SelectItem(2, "Two"),
+ new SelectItem(3, "Tree"),
+ new SelectItem(4, "Four"),
+ };
+
+ private static final Log LOG = LogFactory.getLog(Immediate.class);
+
+ public String test() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+// LOG.warn("user: " + facesContext.getExternalContext().getRemoteUser().hashCode());
+ LOG.warn("requ: " + facesContext.getExternalContext().getRequest().hashCode());
+ LOG.warn("sess: " + facesContext.getExternalContext().getSessionMap().hashCode());
+ return null;
+ }
+
+ public String getIn() {
+ return in;
+ }
+
+ public void setIn(String in) {
+ this.in = in;
+ }
+
+ public int getSelectOne() {
+ return selectOne;
+ }
+
+ public void setSelectOne(int selectOne) {
+ this.selectOne = selectOne;
+ }
+
+ public SelectItem[] getSelectItems() {
+ return selectItems;
+ }
+
+ public void setSelectMany(Integer[] selectMany) {
+ this.selectMany = selectMany;
+ }
+
+ public Integer[] getSelectMany() {
+ return selectMany;
+ }
+}
Added: myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Upload.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Upload.java?rev=819850&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Upload.java (added)
+++ myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Upload.java Tue Sep 29 07:50:02 2009
@@ -0,0 +1,27 @@
+package org.apache.myfaces.tobago.example.test;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class Upload {
+
+ private static final Log LOG = LogFactory.getLog(Upload.class);
+
+ private FileItem file;
+
+ public String upload() {
+ LOG.info("type=" + file.getContentType());
+ LOG.info("file=" + file.get().length);
+ LOG.info("name=" + file.getName());
+ return "/tc/file/file.xhtml";
+ }
+
+ public FileItem getFile() {
+ return file;
+ }
+
+ public void setFile(FileItem file) {
+ this.file = file;
+ }
+}
Modified: myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml?rev=819850&r1=819849&r2=819850&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml Tue Sep 29 07:50:02 2009
@@ -47,11 +47,27 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>immediate</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.tobago.example.test.Immediate</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>upload</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.tobago.example.test.Upload</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
<navigation-rule>
<navigation-case>
<from-outcome>navigation</from-outcome>
<to-view-id>/navigation.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>/tc/file/file.xhtml</from-outcome>
+ <to-view-id>/tc/file/file.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
<lifecycle>
Added: myfaces/tobago/trunk/example/test/src/main/webapp/immediate.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/immediate.xhtml?rev=819850&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/immediate.xhtml (added)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/immediate.xhtml Tue Sep 29 07:50:02 2009
@@ -0,0 +1,50 @@
+<?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.
+-->
+
+<f:view
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:tx="http://myfaces.apache.org/tobago/extension"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core">
+ <tc:page id="page" width="300px" height="300px">
+ <f:facet name="layout">
+ <tc:gridLayout rows="fixed;*;fixed"/>
+ </f:facet>
+
+ <tc:in value="#{immediate.in}" required="true"/>
+ <tc:selectOneListbox value="#{immediate.selectOne}">
+ <tc:selectItems value="#{immediate.selectItems}"/>
+ </tc:selectOneListbox>
+ <!--
+ <tc:selectManyListbox value="#{immediate.selectMany}">
+ <tc:selectItems value="#{immediate.selectItems}"/>
+ </tc:selectManyListbox>
+ -->
+
+ <tc:panel>
+ <f:facet name="layout">
+ <tc:gridLayout columns="*;*"/>
+ </f:facet>
+
+ <tc:button label="immediate" immediate="true" action="#{immediate.test}"/>
+ <tc:button label="normal" action="#{immediate.test}"/>
+ </tc:panel>
+
+ </tc:page>
+</f:view>
Added: myfaces/tobago/trunk/example/test/src/main/webapp/tc/file/file.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/file/file.xhtml?rev=819850&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/file/file.xhtml (added)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/file/file.xhtml Tue Sep 29 07:50:02 2009
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:view
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:tx="http://myfaces.apache.org/tobago/extension"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+ <tc:page>
+ <f:facet name="layout">
+ <tc:gridLayout rows="fixed;fixed"/>
+ </f:facet>
+ <tc:gridLayoutConstraint width="600px" height="300px"/>
+
+ <tc:file value="#{upload.file}" required="true"/>
+ <tc:button label="OK" action="#{upload.upload}"/>
+
+ <f:
+
+ </tc:page>
+</f:view>
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java?rev=819850&r1=819849&r2=819850&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java Tue Sep 29 07:50:02 2009
@@ -27,7 +27,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.UIFileInput;
-import org.apache.myfaces.tobago.context.ClientProperties;
import org.apache.myfaces.tobago.context.TobagoFacesContext;
import org.apache.myfaces.tobago.renderkit.InputRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
@@ -115,9 +114,9 @@
writer.startElement(HtmlConstants.INPUT, input);
writer.writeAttribute(HtmlAttributes.TYPE, "file", false);
writer.writeClassAttribute();
- if (!ClientProperties.getInstance(facesContext).getUserAgent().isMozilla()) {
+// if (!ClientProperties.getInstance(facesContext).getUserAgent().isMozilla()) {
writer.writeStyleAttribute();
- }
+// }
writer.writeNameAttribute(clientId);
writer.writeIdAttribute(clientId);
writer.writeAttribute(HtmlAttributes.READONLY, ComponentUtil.getBooleanAttribute(input, Attributes.DISABLED));
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?rev=819850&r1=819849&r2=819850&view=diff
==============================================================================
--- 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 Tue Sep 29 07:50:02 2009
@@ -96,24 +96,24 @@
}
}
- public void encodeEnd(FacesContext facesContext,
- UIComponent uiComponent) throws IOException {
+ public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {
storeFooterHeight(facesContext, uiComponent);
UIData data = (UIData) uiComponent;
+ ensureColumnWidthList(facesContext, data);
+
HtmlRendererUtil.createHeaderAndBodyStyles(facesContext, data);
final String sheetId = data.getClientId(facesContext);
- HtmlStyleMap sheetStyle = (HtmlStyleMap) data.getAttributes().get(Attributes.STYLE);
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
- // Outher sheet div
- writer.startElement(HtmlConstants.DIV, null);
+ // Outer sheet div
+ writer.startElement(HtmlConstants.DIV, data);
writer.writeIdAttribute(sheetId + "_outer_div");
writer.writeClassAttribute("tobago-sheet-outer-div");
- writer.writeStyleAttribute(sheetStyle);
+ writer.writeStyleAttribute();
UICommand clickAction = null;
UICommand dblClickAction = null;
int columnSelectorIndex = -1;
@@ -278,8 +278,11 @@
}
// BEGIN RENDER BODY CONTENT
- HtmlStyleMap bodyStyle = (HtmlStyleMap) attributes.get(Attributes.STYLE_BODY);
- HtmlRendererUtil.replaceStyleAttribute(data, Attributes.STYLE_BODY, "height", (sheetHeight - footerHeight));
+ HtmlStyleMap bodyStyle = new HtmlStyleMap();
+ bodyStyle.put("position", "relative");
+ bodyStyle.put("width", data.getWidth());
+ bodyStyle.put("height", sheetHeight - footerHeight);
+
writer.startElement(HtmlConstants.DIV, null);
writer.writeIdAttribute(sheetId + "_data_div");
writer.writeClassAttribute("tobago-sheet-body-div ");
@@ -583,13 +586,11 @@
String key = component.getClientId(facesContext) + WIDTHS_POSTFIX;
- Map requestParameterMap = facesContext.getExternalContext()
- .getRequestParameterMap();
+ Map requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
if (requestParameterMap.containsKey(key)) {
String widths = (String) requestParameterMap.get(key);
if (widths.trim().length() > 0) {
- component.getAttributes().put(Attributes.WIDTH_LIST_STRING,
- widths);
+ component.getAttributes().put(Attributes.WIDTH_LIST_STRING, widths);
}
}
@@ -607,8 +608,7 @@
selectedRows = Collections.emptyList();
}
- component.getAttributes().put(
- Attributes.SELECTED_LIST_STRING, selectedRows);
+ component.getAttributes().put(Attributes.SELECTED_LIST_STRING, selectedRows);
}
key = component.getClientId(facesContext) + SCROLL_POSTFIX;
@@ -764,7 +764,7 @@
String sheetId = component.getClientId(facesContext);
Application application = facesContext.getApplication();
- List columnWidths = (List) component.getWidthList();
+ List<Integer> columnWidths = component.getWidthList();
String divWidth = "width: " + columnWidths.get(columnIndex) + "px;";
writer.startElement(HtmlConstants.DIV, null);
@@ -939,8 +939,7 @@
TobagoResponseWriter writer, UIColumn column,
int sortMarkerWidth, String align,
String image1x1) throws IOException {
- String label
- = (String) column.getAttributes().get(Attributes.LABEL);
+ String label = (String) column.getAttributes().get(Attributes.LABEL);
if (label != null) {
writer.writeText(label, null);
if (ComponentUtil.getBooleanAttribute(column, Attributes.SORTABLE) && "right".equals(align)) {
@@ -1086,13 +1085,15 @@
return ThemeConfig.getValue(facesContext, data, "contentBorder");
}
- public void encodeAjax(FacesContext facesContext, UIComponent component)
- throws IOException {
- AjaxUtils.checkParamValidity(facesContext, component, UIData.class);
+ public void encodeAjax(FacesContext facesContext, UIComponent component) throws IOException {
+
+ UIData data = (UIData) component;
+
+ AjaxUtils.checkParamValidity(facesContext, data, UIData.class);
// TODO find a better way
UICommand clickAction = null;
UICommand dblClickAction = null;
- for (UIComponent child : (List<UIComponent>) component.getChildren()) {
+ for (UIComponent child : (List<UIComponent>) data.getChildren()) {
if (child instanceof UIColumnEvent) {
UIColumnEvent columnEvent = (UIColumnEvent) child;
if (columnEvent.isRendered()) {
@@ -1109,12 +1110,12 @@
}
}
}
- renderSheet(facesContext, (UIData) component, (clickAction != null || dblClickAction != null));
+ ensureColumnWidthList(facesContext, data);
+
+ renderSheet(facesContext, data, (clickAction != null || dblClickAction != null));
}
- public void encodeChildren(FacesContext context,
- UIComponent component)
- throws IOException {
+ public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
// DO Nothing
}
@@ -1139,36 +1140,31 @@
currentWidthList = null;
}
-
if (currentWidthList == null) {
LayoutTokens tokens = data.getColumnLayout();
List<UIColumn> allColumns = data.getAllColumns();
LayoutTokens newTokens = new LayoutTokens();
- if (allColumns.size() > 0) {
- for (int i = 0; i < allColumns.size(); i++) {
- UIColumn column = allColumns.get(i);
- if (column.isRendered()) {
- if (tokens == null) {
- if (column instanceof org.apache.myfaces.tobago.component.UIColumn) {
- newTokens.addToken(
- LayoutTokens.parseToken(((org.apache.myfaces.tobago.component.UIColumn) column).getWidth()));
- } else {
- newTokens.addToken(RelativeLayoutToken.DEFAULT_INSTANCE);
- }
+ for (int i = 0; i < allColumns.size(); i++) {
+ UIColumn column = allColumns.get(i);
+ if (column.isRendered()) {
+ if (tokens == null) {
+ if (column instanceof org.apache.myfaces.tobago.component.UIColumn) {
+ newTokens.addToken(
+ LayoutTokens.parseToken(((org.apache.myfaces.tobago.component.UIColumn) column).getWidth()));
} else {
- if (i < tokens.getSize()) {
- newTokens.addToken(tokens.get(i));
- } else {
- newTokens.addToken(RelativeLayoutToken.DEFAULT_INSTANCE);
- }
+ newTokens.addToken(RelativeLayoutToken.DEFAULT_INSTANCE);
+ }
+ } else {
+ if (i < tokens.getSize()) {
+ newTokens.addToken(tokens.get(i));
+ } else {
+ newTokens.addToken(RelativeLayoutToken.DEFAULT_INSTANCE);
}
}
}
}
-
- int space = 100; // FIXME: make dynamic (was removed by changing the layouting
- LOG.error("100; // FIXME: make dynamic (was removed by changing the layouting");
+ int space = data.getWidth().getPixel();
space -= getContentBorder(facesContext, data);
if (needVerticalScrollbar(facesContext, data)) {
space -= getScrollbarWidth(facesContext, data);
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?rev=819850&r1=819849&r2=819850&view=diff
==============================================================================
--- 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 Tue Sep 29 07:50:02 2009
@@ -69,6 +69,10 @@
Date.css.padding-right=2
Date.css.padding-bottom=2
+File.minimumHeight=20
+File.preferredHeight=20
+File.maximumHeight=20
+
#deprecated
GridLayout.cellSpacing=5