001 package edu.nrao.sss.webapp.faces.tag; 002 003 import javax.faces.application.Application; 004 import javax.faces.webapp.UIComponentTag; 005 import javax.faces.component.UIComponent; 006 import javax.faces.el.ValueBinding; 007 import javax.faces.context.FacesContext; 008 //import org.apache.log4j.Logger; 009 010 public class TabTag extends UIComponentTag 011 { 012 //private static final Logger log = Logger.getLogger(TabTag.class); 013 private String orientation = null; 014 private String value = null; 015 016 //XXX need to add action and actionListener...may get that for free by extending uicommand. 017 018 public String getComponentType() { return "edu.nrao.sss.Tab"; } 019 public String getRendererType() { return null; } 020 021 022 @SuppressWarnings("unchecked") 023 protected void setProperties(UIComponent component) 024 { 025 super.setProperties(component); 026 027 // set orientation 028 if (orientation != null) 029 { 030 if (isValueReference(orientation)) 031 { 032 FacesContext context = FacesContext.getCurrentInstance(); 033 Application app = context.getApplication(); 034 ValueBinding vb = app.createValueBinding(orientation); 035 036 component.setValueBinding("orientation", vb); 037 } 038 else 039 { 040 component.getAttributes().put("orientation", orientation); 041 } 042 } 043 044 // set value 045 if (value != null) 046 { 047 if (isValueReference(value)) 048 { 049 FacesContext context = FacesContext.getCurrentInstance(); 050 Application app = context.getApplication(); 051 ValueBinding vb = app.createValueBinding(value); 052 053 component.setValueBinding("value", vb); 054 } 055 else 056 { 057 component.getAttributes().put("value", value); 058 } 059 } 060 } 061 062 /** 063 * clear up any resources we've used. 064 */ 065 public void release() 066 { 067 super.release(); 068 orientation = null; 069 value = null; 070 } 071 072 /** 073 * Bean method for our orientation attribute. 074 */ 075 public void setOrientation(String orientation) 076 { 077 this.orientation = orientation; 078 } 079 080 /** 081 * Bean method for our value attribute. 082 */ 083 public void setValue(String value) 084 { 085 this.value = value; 086 } 087 }