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 2005/12/19 20:30:02 UTC

svn commit: r357763 - 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-example/tobago-example-demo/src/main/webapp/overview/

Author: bommel
Date: Mon Dec 19 11:29:52 2005
New Revision: 357763

URL: http://svn.apache.org/viewcvs?rev=357763&view=rev
Log:
added DateExtensionTag

Added:
    incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/DateExtensionTag.java
Modified:
    incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/DateTag.java
    incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/basicControls.jsp

Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/DateTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/DateTag.java?rev=357763&r1=357762&r2=357763&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/DateTag.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/DateTag.java Mon Dec 19 11:29:52 2005
@@ -53,13 +53,14 @@
     return RENDERER_TYPE_IN;
   }
 
+
   public int doEndTag() throws JspException {
 
     UIComponent component = getComponentInstance();
-    if (component.getFacet(FACET_LAYOUT) == null) {
+    /*if (component.getFacet(FACET_LAYOUT) == null) {
       UIComponent layout = ComponentUtil.createLabeledInputLayoutComponent();
       component.getFacets().put(FACET_LAYOUT, layout);
-    }
+    } */
 
     // TODO ensure date script move to RenderKit
 
@@ -75,6 +76,10 @@
   }
 
   protected void setProperties(UIComponent component) {
+    if (label != null) {
+      LOG.warn("the label attribute is deprecated in tc:date, " +
+          "please use tx:date instead.");
+    }
     super.setProperties(component);
 
 //    ValueHolder holder = (ValueHolder) component;

Added: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/DateExtensionTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/DateExtensionTag.java?rev=357763&view=auto
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/DateExtensionTag.java (added)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/DateExtensionTag.java Mon Dec 19 11:29:52 2005
@@ -0,0 +1,192 @@
+/*
+ * 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.decl.HasValue;
+import org.apache.myfaces.tobago.taglib.decl.HasValidator;
+import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
+import org.apache.myfaces.tobago.taglib.decl.HasConverter;
+import org.apache.myfaces.tobago.taglib.decl.IsReadonly;
+import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
+import org.apache.myfaces.tobago.taglib.decl.IsRequired;
+import org.apache.myfaces.tobago.taglib.decl.HasTip;
+import org.apache.myfaces.tobago.taglib.decl.HasLabel;
+import org.apache.myfaces.tobago.taglib.decl.IsFocus;
+import org.apache.myfaces.tobago.taglib.decl.IsInline;
+import org.apache.myfaces.tobago.taglib.component.DateTag;
+import org.apache.myfaces.tobago.apt.annotation.Tag;
+
+import javax.servlet.jsp.tagext.BodyTagSupport;
+import javax.servlet.jsp.JspException;
+
+/*
+ * Created by IntelliJ IDEA.
+ * User: bommel
+ * Date: 19.12.2005
+ * Time: 20:13:26
+ * To change this template use File | Settings | File Templates.
+ */
+/**
+ * Renders a date input field.
+ */
+@Tag(name="date")
+public class DateExtensionTag extends BodyTagSupport
+    implements HasValue, HasValidator, HasIdBindingAndRendered,
+    HasConverter, IsReadonly, IsDisabled,
+    IsRequired, HasTip, HasLabel,  IsFocus, IsInline {
+
+  private String binding;
+  private String converter;
+  private String validator;
+  private String disabled;
+  private String focus;
+  private String label;
+  private String readonly;
+  private String rendered;
+  private String required;
+  private String tip;
+  private String value;
+  private String inline;
+
+  private LabelExtensionTag labelTag;
+  private DateTag dateTag;
+
+  @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();
+
+    dateTag = new DateTag();
+    dateTag.setPageContext(pageContext);
+    if (value != null) {
+      dateTag.setValue(value);
+    }
+    if (binding != null) {
+      dateTag.setBinding(binding);
+    }
+    if (converter != null) {
+      dateTag.setConverter(converter);
+    }
+    if (validator != null) {
+      dateTag.setValidator(validator);
+    }
+    if (disabled != null) {
+      dateTag.setDisabled(disabled);
+    }
+    if (focus != null) {
+      dateTag.setFocus(focus);
+    }
+    if (id != null) {
+      dateTag.setId(id);
+    }
+    if (inline != null) {
+      dateTag.setInline(inline);
+    }
+    if (readonly != null) {
+      dateTag.setReadonly(readonly);
+    }
+    if (required != null) {
+      dateTag.setRequired(required);
+    }
+    dateTag.setParent(labelTag);
+    dateTag.doStartTag();
+
+    return super.doStartTag();
+  }
+
+  @Override
+  public int doEndTag() throws JspException {
+    dateTag.doEndTag();
+    labelTag.doEndTag();
+    return super.doEndTag();
+  }
+
+  @Override
+  public void release() {
+    super.release();
+    binding = null;
+    converter = null;
+    validator = null;
+    disabled = null;
+    focus = null;
+    label = null;
+    inline = null;
+    readonly = null;
+    rendered = null;
+    required = null;
+    tip = null;
+    value = null;
+  }
+
+  public void setValue(String value) {
+    this.value = value;
+  }
+
+  public void setLabel(String label) {
+    this.label = label;
+  }
+
+  public void setFocus(String focus) {
+    this.focus = focus;
+  }
+
+  public void setBinding(String binding) {
+    this.binding = binding;
+  }
+
+  public void setRendered(String rendered) {
+    this.rendered = rendered;
+  }
+
+  public void setConverter(String converter) {
+    this.converter = converter;
+  }
+
+  public void setValidator(String validator) {
+    this.validator = validator;
+  }
+  public void setInline(String inline) {
+    this.inline = inline;
+  }
+
+  public void setReadonly(String readonly) {
+    this.readonly = readonly;
+  }
+
+  public void setDisabled(String disabled) {
+    this.disabled = disabled;
+  }
+
+  public void setRequired(String required) {
+    this.required = required;
+  }
+
+  public void setTip(String tip) {
+    this.tip = tip;
+  }
+}

Modified: incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/basicControls.jsp
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/basicControls.jsp?rev=357763&r1=357762&r2=357763&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/basicControls.jsp (original)
+++ incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/basicControls.jsp Mon Dec 19 11:29:52 2005
@@ -43,10 +43,10 @@
             <tc:in value="#{overviewController.basicInput}"
               suggestMethod="#{overviewController.getInputSuggestItems}"/>
           </tx:label>
-          <tc:date value="#{overviewController.basicDate}"
+          <tx:date value="#{overviewController.basicDate}"
               label="#{overviewBundle.basic_dateLabel}">
             <f:convertDateTime pattern="dd.MM.yyyy" />
-          </tc:date>
+          </tx:date>
           <tx:time label="#{overviewBundle.basic_timeLabel}"
                   value="#{overviewController.basicTime}" />
         </tc:panel>