1 6 7 package org.exoplatform.portlets.weather.component; 8 9 import javax.faces.context.FacesContext; 10 import org.exoplatform.container.SessionContainer; 11 import org.exoplatform.container.client.http.HttpClientInfo; 12 import org.exoplatform.faces.core.component.UIGrid; 13 import org.exoplatform.faces.core.component.model.LabelCell; 14 import org.exoplatform.faces.core.component.model.Row; 15 16 17 public class UIWeatherTitle extends UIGrid 18 { 19 private String title_; 20 21 public UIWeatherTitle() { 22 super(); 23 setId("UIWeatherTitle"); 24 HttpClientInfo client = 25 (HttpClientInfo)SessionContainer.getInstance().getMonitor().getClientInfo() ; 26 String type = client.getClientType() ; 27 if (type.equals(HttpClientInfo.MOBILE_BROWSER_TYPE)) { 28 setRendererType("GridRenderer"); 29 } else { 30 setRendererType("GridRenderer"); 31 } 32 33 updateTree(); 34 } 35 36 public void setTitle(String pTitle) { 37 title_ = pTitle; 38 updateTree(); 39 } 40 41 public void decode(FacesContext context) { 42 } 43 44 private void updateTree() { 45 clear(); 46 add(new Row().add(new LabelCell(title_))); 47 } 48 } 49 | Popular Tags |