KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > javaee > blueprints > components > ui > example > CompATag


1 /*
2 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. You may not modify, use, reproduce, or distribute this software except in compliance with the terms of the License at:
3 * http://developer.sun.com/berkeley_license.html
4 * $Id: CompATag.java,v 1.2 2006/06/23 17:05:41 basler Exp $
5 */

6 /*
7  * CompATag.java
8  *
9  * Created on April 28, 2006, 7:48 AM
10  *
11  * To change this template, choose Tools | Template Manager
12  * and open the template in the editor.
13  */

14
15 package com.sun.javaee.blueprints.components.ui.example;
16
17 import javax.servlet.jsp.tagext.*;
18 import javax.servlet.jsp.JspWriter JavaDoc;
19 import javax.servlet.jsp.JspException JavaDoc;
20
21 import javax.faces.component.UIComponent;
22 import javax.faces.component.UIOutput;
23 import javax.faces.webapp.UIComponentELTag;
24 import javax.faces.application.Application;
25 import javax.faces.application.ApplicationFactory;
26 import javax.faces.FactoryFinder;
27 import javax.el.ValueExpression;
28 import javax.faces.component.html.HtmlInputTextarea;
29
30 /**
31  * This tag is the glue between the JSF tag and the renderer and JSF Component
32  *
33  * @author basler
34  */

35
36 public class CompATag extends UIComponentELTag {
37     
38     private ValueExpression style=null, styleClass=null, url=null;
39     private String JavaDoc id=null;
40     
41     public String JavaDoc getComponentType() {
42         return ("javax.faces.Output");
43     }
44     
45     public String JavaDoc getRendererType() {
46         return ("CompA");
47     }
48
49     public void setStyle(ValueExpression style) {
50         this.style=style;
51     }
52     public ValueExpression getStyle() {
53         return this.style;
54     }
55
56     public void setStyleClass(ValueExpression styleClass) {
57         this.styleClass=styleClass;
58     }
59     public ValueExpression getStyleClass() {
60         return this.styleClass;
61     }
62
63     public void setUrl(ValueExpression url) {
64         this.url=url;
65     }
66     public ValueExpression getUrl() {
67         return this.url;
68     }
69     
70     
71
72     /**
73      * This method takes the properties from the JSP and populates the UIOutput components properties
74      * for use in the RichTextEditorRenderer
75      */

76     protected void setProperties(UIComponent component) {
77         super.setProperties(component);
78
79         UIOutput outComp = (UIOutput)component;
80         
81         // pull out style attribute
82
if (style != null) {
83             if (!style.isLiteralText()) {
84                 outComp.setValueExpression("style", style);
85             } else {
86                 outComp.getAttributes().put("style", style.getExpressionString());
87             }
88         }
89         
90         // pull out styleClass attribute
91
if (styleClass != null) {
92             if (!styleClass.isLiteralText()) {
93                 outComp.setValueExpression("styleClass", styleClass);
94             } else {
95                 outComp.getAttributes().put("styleClass", styleClass.getExpressionString());
96             }
97         }
98         
99         // pull out url attribute
100
if (url != null) {
101             if (!url.isLiteralText()) {
102                 outComp.setValueExpression("url", url);
103             } else {
104                 outComp.getAttributes().put("url", url.getExpressionString());
105             }
106         }
107         
108     }
109 }
110
111
112
113
114
Popular Tags