Author: andrei_exadel
Date: 2009-03-19 13:35:33 -0400 (Thu, 19 Mar 2009)
New Revision: 13033
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tags/
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tags/RealworldCommandButtonRenderer.java
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/realWorld-taglib.xml
trunk/test-applications/realworld2/web/src/main/webapp/includes/albumEdit.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/search.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/shelfEdit.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/tag.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css
Log:
Add renderer for Realworld-style Ajax button. Move styles to css
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tags/RealworldCommandButtonRenderer.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tags/RealworldCommandButtonRenderer.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tags/RealworldCommandButtonRenderer.java 2009-03-19
17:35:33 UTC (rev 13033)
@@ -0,0 +1,66 @@
+/**
+ *
+ */
+package org.richfaces.realworld.tags;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
+
+import org.ajax4jsf.renderkit.AjaxCommandRendererBase;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+
+
+/**
+ * @author Andrey Markavtsov
+ *
+ */
+public class RealworldCommandButtonRenderer extends AjaxCommandRendererBase {
+
+ @Override
+ public void encodeBegin(FacesContext context, UIComponent component)
+ throws IOException {
+ Object id = component.getClientId(context);
+ Object style = component.getAttributes().get("style");
+ Object value = component.getAttributes().get("value");
+
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement(HTML.DIV_ELEM, component);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, id, null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "realworldButton", null);
+ writer.writeAttribute(HTML.style_ATTRIBUTE, style, null);
+ writer.writeAttribute(HTML.onclick_ATTRIBUTE, getOnClick(context, component), null);
+
+ writer.startElement(HTML.IMG_ELEMENT, component);
+ writer.writeAttribute(HTML.src_ATTRIBUTE, "img/shell/button.png", null);
+ writer.writeAttribute(HTML.width_ATTRIBUTE, "103", null);
+ writer.writeAttribute(HTML.height_ATTRIBUTE, "28", null);
+ writer.writeAttribute(HTML.alt_ATTRIBUTE, "", null);
+ writer.writeAttribute(HTML.border_ATTRIBUTE, "0", null);
+ writer.endElement(HTML.IMG_ELEMENT);
+
+ writer.startElement(HTML.DIV_ELEM, component);
+ writer.writeText(value, null);
+ writer.endElement(HTML.DIV_ELEM);
+
+ writer.startElement(HTML.IMG_ELEMENT, component);
+ writer.writeAttribute(HTML.src_ATTRIBUTE, "img/shell/spacer.gif", null);
+ writer.writeAttribute(HTML.width_ATTRIBUTE, "103", null);
+ writer.writeAttribute(HTML.height_ATTRIBUTE, "28", null);
+ writer.writeAttribute(HTML.alt_ATTRIBUTE, "", null);
+ writer.writeAttribute(HTML.border_ATTRIBUTE, "0", null);
+ writer.endElement(HTML.IMG_ELEMENT);
+
+ writer.endElement(HTML.DIV_ELEM);
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return org.ajax4jsf.component.UIAjaxCommandButton.class;
+ }
+
+}
Modified: trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/faces-config.xml 2009-03-19
17:14:59 UTC (rev 13032)
+++
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/faces-config.xml 2009-03-19
17:35:33 UTC (rev 13033)
@@ -12,4 +12,18 @@
</locale-config>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
+
+
+ <render-kit>
+ <render-kit-id>HTML_BASIC</render-kit-id>
+ <renderer>
+ <component-family>javax.faces.Command</component-family>
+ <renderer-type>
+ org.ajax4jsf.components.RealworldAjaxCommandButtonRenderer
+ </renderer-type>
+ <renderer-class>
+ org.richfaces.realworld.tags.RealworldCommandButtonRenderer
+ </renderer-class>
+ </renderer>
+ </render-kit>
</faces-config>
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/realWorld-taglib.xml
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/realWorld-taglib.xml 2009-03-19
17:14:59 UTC (rev 13032)
+++
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/realWorld-taglib.xml 2009-03-19
17:35:33 UTC (rev 13033)
@@ -16,6 +16,13 @@
<tag-name>confirm</tag-name>
<source>templates/confirmation.xhtml</source>
</tag>
+ <tag>
+ <tag-name>commandButton</tag-name>
+ <component>
+ <component-type>org.ajax4jsf.CommandButton</component-type>
+
<renderer-type>org.ajax4jsf.components.RealworldAjaxCommandButtonRenderer</renderer-type>
+ </component>
+ </tag>
<function>
<function-name>rectangle</function-name>
<function-class>org.richfaces.realworld.util.Functions</function-class>
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/albumEdit.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/search.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/shelfEdit.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/tag.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css 2009-03-19
17:14:59 UTC (rev 13032)
+++
trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css 2009-03-19
17:35:33 UTC (rev 13033)
@@ -722,3 +722,89 @@
color:black;
text-decoration:none;
}
+
+.realworldButton {
+ margin : 0px 0px 0px 0px;
+ position : relative;
+ width : 103px;
+ height : 28px;
+ cursor: pointer;
+}
+
+.realworldButton div {
+ position : absolute;
+ color : #ffffff;
+ top : 7px;
+ left : 11px;
+ font-weight : bold;
+}
+
+.realworldButton img {
+ position : absolute;
+ top : 0px;
+ left : 0px;
+}
+
+.album-edit-field {
+ padding-top : 8px
+}
+
+.album-edit-calendar {
+ border : 1px solid #999999;
+ width : 80px
+}
+
+.album-edit-input {
+ border : 1px solid #999999;
+ width : 350px
+}
+
+.album-edit-area {
+ border : 1px solid #999999;
+ width : 350px;
+ height : 150px
+}
+
+.search-criteria {
+ color: #666666
+}
+
+.shelf-edit {
+ margin : 10px 0px 30px 30px;
+ width : 504px;
+ background : #f1f1f1
+}
+
+.shelf-edit-calendar {
+ border : 1px solid #999999;
+ width : 80px
+}
+
+.shelf-edit-input {
+ border : 1px solid #999999;
+ width : 350px
+}
+
+.shelf-edit-area {
+ border : 1px solid #999999;
+ width : 350px;
+ height : 150px
+}
+
+.tag-panel {
+ border: 0px;
+ background: none;
+ overflow: auto;
+}
+
+.tag-table {
+ float: left;
+ margin: 0px 10px 10px 0px;
+}
+
+.tag-table-td {
+ text-align: center;
+ vertical-align: middle;
+ background: white;
+ border: 1px solid #909090
+}
\ No newline at end of file