|
|
||
Manfred Riem's BlogTemperature SPOT - Part 5Posted by mriem on August 27, 2007 at 08:00 PM | Comments (0)Getting the JSP part working requires a taglibrary. And its implementation. The code below describes that implementation.
package com.manorrock.jsf.sunspot.temperature;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import javax.faces.webapp.UIComponentTag;
/**
* A temperature tag for the SunSPOT.
*
* @author Manfred Riem (mriem@manorrock.org)
*/
public class TemperatureTag extends UIComponentTag {
/**
* Stores the component type.
*/
private static String COMPONENT_TYPE = "com.manorrock.jsf.sunspot.temperature.TemperatureComponent";
/**
* Stores the renderer type.
*/
private static String RENDERER_TYPE = "com.manorrock.jsf.sunspot.temperature.TemperatureRenderer";
/**
* Stores the SunSPOT id.
*/
private String sunspotId;
/**
* Get the component type.
*/
public String getComponentType() {
return COMPONENT_TYPE;
}
/**
* Get the renderer type.
*/
public String getRendererType() {
return RENDERER_TYPE;
}
/**
* Set the SunSPOT id.
*/
public void setSunspotId(String sunspotId) {
this.sunspotId = sunspotId;
}
/**
* Set the properties.
*
* @param component the component.
*/
protected void setProperties(UIComponent component) {
super.setProperties(component);
if (sunspotId != null) {
if (isValueReference(sunspotId)) {
ValueBinding vb = FacesContext.getCurrentInstance().
getApplication().createValueBinding(sunspotId);
component.setValueBinding("sunspotId", vb);
} else {
component.getAttributes().put("sunspotId", sunspotId);
}
}
}
}
Bookmark blog post: CommentsComments are listed in date ascending order (oldest first) | Post Comment | ||
|
|