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/14 22:06:21 UTC

svn commit: r356870 - in /incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib: component/SelectOneChoiceTagDeclaration.java extension/SelectOneChoiceExtensionTag.java

Author: lofwyr
Date: Wed Dec 14 13:06:14 2005
New Revision: 356870

URL: http://svn.apache.org/viewcvs?rev=356870&view=rev
Log:
introduce tx:selectOneChoice

Added:
    incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectOneChoiceExtensionTag.java
Modified:
    incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectOneChoiceTagDeclaration.java

Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectOneChoiceTagDeclaration.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectOneChoiceTagDeclaration.java?rev=356870&r1=356869&r2=356870&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectOneChoiceTagDeclaration.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectOneChoiceTagDeclaration.java Wed Dec 14 13:06:14 2005
@@ -32,7 +32,10 @@
  */
 @Tag(name="selectOneChoice")
 @BodyContentDescription(anyTagOf="(<f:selectItems>|<f:selectItem>|<tc:selectItem>)+ <f:facet>* " )
-public interface SelectOneChoiceTagDeclaration extends SelectOneTagDeclaration, HasId, HasValue, IsDisabled, IsReadonly, HasOnchangeListener, IsInline, HasLabelAndAccessKey, IsRendered, HasBinding, HasTip {
+public interface SelectOneChoiceTagDeclaration
+    extends SelectOneTagDeclaration, HasId, HasValue, IsDisabled,
+    IsReadonly, HasOnchangeListener, IsInline, HasLabelAndAccessKey,
+    IsRendered, HasBinding, HasTip {
 
   /**
    * Flag indicating that selecting an Item representing a Value is Required.

Added: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectOneChoiceExtensionTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectOneChoiceExtensionTag.java?rev=356870&view=auto
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectOneChoiceExtensionTag.java (added)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectOneChoiceExtensionTag.java Wed Dec 14 13:06:14 2005
@@ -0,0 +1,169 @@
+/*
+ * 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.
+ */
+/*
+ * Created: Aug 13, 2002 3:04:03 PM
+ * $Id: SelectOneChoiceTag.java 347824 2005-11-01 21:03:54Z bommel $
+ */
+package org.apache.myfaces.tobago.taglib.extension;
+
+import org.apache.myfaces.tobago.taglib.component.SelectOneChoiceTag;
+import org.apache.myfaces.tobago.taglib.decl.HasBinding;
+import org.apache.myfaces.tobago.taglib.decl.HasId;
+import org.apache.myfaces.tobago.taglib.decl.HasLabel;
+import org.apache.myfaces.tobago.taglib.decl.HasOnchangeListener;
+import org.apache.myfaces.tobago.taglib.decl.HasTip;
+import org.apache.myfaces.tobago.taglib.decl.HasValue;
+import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
+import org.apache.myfaces.tobago.taglib.decl.IsInline;
+import org.apache.myfaces.tobago.taglib.decl.IsReadonly;
+import org.apache.myfaces.tobago.taglib.decl.IsRendered;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.BodyTagSupport;
+
+@org.apache.myfaces.tobago.apt.annotation.Tag(name="selectOneChoice")
+public class SelectOneChoiceExtensionTag
+    extends BodyTagSupport
+    implements HasId, HasValue, IsDisabled,
+    IsReadonly, HasOnchangeListener, IsInline, HasLabel,
+    IsRendered, HasBinding, HasTip {
+
+  private String required;
+  private String value;
+  private String disabled;
+  private String readonly;
+  private String onchange;
+  private String inline;
+  private String label;
+  private String rendered;
+  private String binding;
+  private String tip;
+
+  private LabelExtensionTag labelTag;
+  private SelectOneChoiceTag selectOneChoiceTag;
+
+  @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();
+
+    selectOneChoiceTag = new SelectOneChoiceTag();
+    selectOneChoiceTag.setPageContext(pageContext);
+    if (value != null) {
+      selectOneChoiceTag.setValue(value);
+    }
+    if (binding != null) {
+      selectOneChoiceTag.setBinding(binding);
+    }
+    if (onchange != null) {
+      selectOneChoiceTag.setConverter(onchange);
+    }
+    if (disabled != null) {
+      selectOneChoiceTag.setDisabled(disabled);
+    }
+    if (inline != null) {
+      selectOneChoiceTag.setFocus(inline);
+    }
+    if (id != null) {
+      selectOneChoiceTag.setId(id);
+    }
+    if (readonly != null) {
+      selectOneChoiceTag.setReadonly(readonly);
+    }
+    if (required != null) {
+      selectOneChoiceTag.setRequired(required);
+    }
+    selectOneChoiceTag.setParent(labelTag);
+    selectOneChoiceTag.doStartTag();
+
+    return super.doStartTag();
+  }
+
+  @Override
+  public int doEndTag() throws JspException {
+    selectOneChoiceTag.doEndTag();
+    labelTag.doEndTag();
+    return super.doEndTag();
+  }
+
+  @Override
+  public void release() {
+    super.release();
+    binding = null;
+    onchange = null;
+    disabled = null;
+    inline = null;
+    label = null;
+    readonly = null;
+    rendered = null;
+    required = null;
+    tip = null;
+    value = null;
+  }
+
+  public void setRequired(String required) {
+    this.required = required;
+  }
+
+  public void setValue(String value) {
+    this.value = value;
+  }
+
+  public void setDisabled(String disabled) {
+    this.disabled = disabled;
+  }
+
+  public void setReadonly(String readonly) {
+    this.readonly = readonly;
+  }
+
+  public void setOnchange(String onchange) {
+    this.onchange = onchange;
+  }
+
+  public void setInline(String inline) {
+    this.inline = inline;
+  }
+
+  public void setLabel(String label) {
+    this.label = label;
+  }
+
+  public void setRendered(String rendered) {
+    this.rendered = rendered;
+  }
+
+  public void setBinding(String binding) {
+    this.binding = binding;
+  }
+
+  public void setTip(String tip) {
+    this.tip = tip;
+  }
+
+}