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 2005/12/15 00:35:30 UTC
svn commit: r356934 - in /incubator/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/
tobago-tool/gendoc/src/main/webapp/screenshot/
Author: lofwyr
Date: Wed Dec 14 15:35:19 2005
New Revision: 356934
URL: http://svn.apache.org/viewcvs?rev=356934&view=rev
Log:
new tag tx:file,
use tx:file when you need tc:file with a label, the label of tc:file will no longer supported
see http://issues.apache.org/jira/browse/MYFACES-947
Added:
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/FileExtensionTag.java
Modified:
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTag.java
incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTagDeclaration.java
incubator/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/file.jsp
Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTag.java?rev=356934&r1=356933&r2=356934&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTag.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTag.java Wed Dec 14 15:35:19 2005
@@ -20,39 +20,33 @@
package org.apache.myfaces.tobago.taglib.component;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ENCTYPE;
-import static org.apache.myfaces.tobago.TobagoConstants.FACET_LAYOUT;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.component.UIInput;
import org.apache.myfaces.tobago.component.UIPage;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
-import javax.faces.component.UIComponent;
import javax.servlet.jsp.JspException;
public class FileTag extends InputTag implements FileTagDeclaration {
+ private static final Log LOG = LogFactory.getLog(FileTag.class);
+
public int doStartTag() throws JspException {
int result = super.doStartTag();
UIPage form = ComponentUtil.findPage(getComponentInstance());
form.getAttributes().put(ATTR_ENCTYPE, "multipart/form-data");
- return result;
- }
- public int doEndTag() throws JspException {
- UIComponent component = getComponentInstance();
- if (component.getFacet(FACET_LAYOUT) == null) {
- UIComponent layout = ComponentUtil.createLabeledInputLayoutComponent();
- component.getFacets().put(FACET_LAYOUT, layout);
+ if (label != null) {
+ LOG.warn("the label attribute is deprecated in t:in, " +
+ "please use tx:in instead.");
}
- return super.doEndTag();
+
+ return result;
}
public String getComponentType() {
return UIInput.COMPONENT_TYPE;
}
-
- public void setValue(String value) {
- super.setValue(value);
- }
}
-
Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTagDeclaration.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTagDeclaration.java?rev=356934&r1=356933&r2=356934&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTagDeclaration.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTagDeclaration.java Wed Dec 14 15:35:19 2005
@@ -32,7 +32,9 @@
*/
@Tag(name="file")
@UIComponentTag(UIComponent="org.apache.myfaces.tobago.component.UIInput")
-public interface FileTagDeclaration extends InputTagDeclaration, HasIdBindingAndRendered, IsDisabled, HasLabelAndAccessKey, HasOnchangeListener, HasTip {
+public interface FileTagDeclaration
+ extends InputTagDeclaration, HasIdBindingAndRendered, IsDisabled,
+ HasLabelAndAccessKey, HasOnchangeListener, HasTip {
/**
* Value binding expression pointing to a
Added: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/FileExtensionTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/FileExtensionTag.java?rev=356934&view=auto
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/FileExtensionTag.java (added)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/FileExtensionTag.java Wed Dec 14 15:35:19 2005
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2002-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.myfaces.tobago.taglib.extension;
+
+import org.apache.myfaces.tobago.taglib.component.FileTag;
+import org.apache.myfaces.tobago.taglib.component.InputTagDeclaration;
+import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
+import org.apache.myfaces.tobago.taglib.decl.HasTip;
+import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
+import org.apache.myfaces.tobago.taglib.decl.HasLabel;
+import org.apache.myfaces.tobago.apt.annotation.Tag;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.BodyTagSupport;
+@Tag(name="file")
+public class FileExtensionTag extends BodyTagSupport
+ implements InputTagDeclaration, HasIdBindingAndRendered, IsDisabled,
+ HasTip, HasLabel {
+
+ private String binding;
+ private String label;
+ private String validator;
+ private String disabled;
+ private String rendered;
+ private String tip;
+
+ private LabelExtensionTag labelTag;
+ private FileTag fileTag;
+
+ @Override
+ public int doStartTag() throws JspException {
+
+ labelTag = new LabelExtensionTag();
+ labelTag.setPageContext(pageContext);
+ if (label != null) {
+ labelTag.setValue(label);
+ }
+ if (tip != null) {
+ labelTag.setTip(tip);
+ }
+ if (rendered != null) {
+ labelTag.setRendered(rendered);
+ }
+ labelTag.setParent(getParent());
+ labelTag.doStartTag();
+
+ fileTag = new FileTag();
+ fileTag.setPageContext(pageContext);
+ if (binding != null) {
+ fileTag.setBinding(binding);
+ }
+ if (validator != null) {
+ fileTag.setValidator(validator);
+ }
+ if (disabled != null) {
+ fileTag.setDisabled(disabled);
+ }
+ if (id != null) {
+ fileTag.setId(id);
+ }
+ fileTag.setParent(labelTag);
+ fileTag.doStartTag();
+
+ return super.doStartTag();
+ }
+
+ @Override
+ public int doEndTag() throws JspException {
+ fileTag.doEndTag();
+ labelTag.doEndTag();
+ return super.doEndTag();
+ }
+
+ @Override
+ public void release() {
+ super.release();
+ binding = null;
+ validator = null;
+ disabled = null;
+ tip = null;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public void setBinding(String binding) {
+ this.binding = binding;
+ }
+
+ public void setRendered(String rendered) {
+ this.rendered = rendered;
+ }
+
+ public void setValidator(String validator) {
+ this.validator = validator;
+ }
+
+ public void setDisabled(String disabled) {
+ this.disabled = disabled;
+ }
+
+ public void setTip(String tip) {
+ this.tip = tip;
+ }
+}
Modified: incubator/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/file.jsp
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/file.jsp?rev=356934&r1=356933&r2=356934&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/file.jsp (original)
+++ incubator/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/file.jsp Wed Dec 14 15:35:19 2005
@@ -14,6 +14,7 @@
* 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" %>
<%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
@@ -21,10 +22,10 @@
<jsp:body>
<tc:panel>
<f:facet name="layout">
- <tc:gridLayout columns="300px;1*" rows="fixed;1*" />
+ <tc:gridLayout columns="400px;1*" rows="fixed;1*" />
</f:facet>
<%-- code-sniplet-start id="file" --%>
- <tc:file label="Upload file:" />
+ <tx:file label="Upload file:" />
<%-- code-sniplet-end id="file" --%>
<tc:cell/>