You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sc...@apache.org on 2005/06/29 17:56:04 UTC

svn commit: r202395 - /myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/div/DivRenderer.java

Author: schof
Date: Wed Jun 29 08:56:04 2005
New Revision: 202395

URL: http://svn.apache.org/viewcvs?rev=202395&view=rev
Log:
Restored DivRenderer file which somehow went missing (missing even before svn reorg)

Added:
    myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/div/DivRenderer.java

Added: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/div/DivRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/div/DivRenderer.java?rev=202395&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/div/DivRenderer.java (added)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/div/DivRenderer.java Wed Jun 29 08:56:04 2005
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2004 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.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.renderkit.html.HTML;
+import org.apache.myfaces.renderkit.html.HtmlRenderer;
+import org.apache.myfaces.renderkit.html.HtmlRendererUtils;
+/**
+ * @author bdudney (latest modification by $Author: grantsmith $)
+ * @version $Revision: 169649 $ $Date: 2005-05-11 15:47:12Z $
+ */
+public class DivRenderer extends HtmlRenderer {
+  public static final String RENDERER_TYPE = "org.apache.myfaces.DivRenderer";
+
+  public void encodeBegin(FacesContext context, UIComponent component)
+      throws IOException {
+    if ((context == null) || (component == null)) {
+      throw new NullPointerException();
+    }
+    Div div = (Div) component;
+    ResponseWriter writer = context.getResponseWriter();
+
+    writer.startElement(HTML.DIV_ELEM, component);
+    HtmlRendererUtils.writeIdIfNecessary(writer, component, context);
+
+    String styleClass = div.getStyleClass();
+    String style = div.getStyle();
+
+    if(null != styleClass) {
+        writer.writeAttribute(HTML.CLASS_ATTR, styleClass, null);
+    }
+    if(null != style) {
+        writer.writeAttribute(HTML.STYLE_ATTR, style, null);
+    }
+  }
+
+  public void encodeEnd(FacesContext context, UIComponent component)
+      throws IOException {
+    if ((context == null) || (component == null)) {
+      throw new NullPointerException();
+    }
+    ResponseWriter writer = context.getResponseWriter();
+    writer.endElement(HTML.DIV_ELEM);
+  }
+}