You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2008/06/24 05:37:21 UTC
svn commit: r671007 - in
/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div:
AbstractDiv.java Div.java DivRenderer.java
Author: lu4242
Date: Mon Jun 23 20:37:21 2008
New Revision: 671007
URL: http://svn.apache.org/viewvc?rev=671007&view=rev
Log:
TOMAHAWK-1288 Add Event and Universal properties to t:div
Added:
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/AbstractDiv.java (with props)
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/DivRenderer.java (with props)
Removed:
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/Div.java
Added: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/AbstractDiv.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/AbstractDiv.java?rev=671007&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/AbstractDiv.java (added)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/AbstractDiv.java Mon Jun 23 20:37:21 2008
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.custom.div;
+
+import org.apache.myfaces.component.EventAware;
+import org.apache.myfaces.component.UniversalProperties;
+import org.apache.myfaces.custom.htmlTag.HtmlTag;
+
+/**
+ * Places a div around its children. Unless otherwise specified,
+ * all attributes accept static values or EL expressions.
+ *
+ * @JSFComponent
+ * name = "t:div"
+ * class = "org.apache.myfaces.custom.div.Div"
+ * tagClass = "org.apache.myfaces.custom.div.DivTag"
+ *
+ * @author bdudney (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public abstract class AbstractDiv extends HtmlTag implements EventAware, UniversalProperties
+{
+
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.Div";
+ private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.DivRenderer";
+
+ /**
+ * @JSFProperty
+ * tagExcluded = "true"
+ */
+ public Object getValue()
+ {
+ return "div";
+ }
+}
\ No newline at end of file
Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/AbstractDiv.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/AbstractDiv.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/DivRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/DivRenderer.java?rev=671007&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/DivRenderer.java (added)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/DivRenderer.java Mon Jun 23 20:37:21 2008
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.custom.div;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils;
+
+import org.apache.myfaces.custom.htmlTag.HtmlTagRenderer;
+
+/**
+ * @JSFRenderer
+ * renderKitId = "HTML_BASIC"
+ * family = "javax.faces.Output"
+ * type = "org.apache.myfaces.DivRenderer"
+ *
+ * @author bdudney (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class DivRenderer extends HtmlTagRenderer
+{
+ public static final String RENDERER_TYPE = "org.apache.myfaces.HtmlTagRenderer";
+
+ public void encodeBegin(FacesContext context, UIComponent component)
+ throws IOException
+ {
+ if ((context == null) || (component == null))
+ {
+ throw new NullPointerException();
+ }
+
+ super.encodeBegin(context, component);
+
+ Div div = (Div) component;
+
+ if (div.isRendered())
+ {
+ ResponseWriter writer = context.getResponseWriter();
+ //Previously, style and styleClass was rendered,
+ //so on div renderer we need to add event and universal
+ //attributes only
+ HtmlRendererUtils.renderHTMLAttributes(writer, div,
+ HTML.COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_STYLE);
+ }
+ }
+
+}
\ No newline at end of file
Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/DivRenderer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/div/DivRenderer.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL