1 5 6 package org.exoplatform.faces.core.renderer.html; 7 8 import java.io.IOException ; 9 import java.util.Collection ; 10 import java.util.Iterator ; 11 import java.util.ResourceBundle ; 12 13 import javax.faces.component.UIComponent; 14 import javax.faces.context.FacesContext; 15 import javax.faces.context.ResponseWriter; 16 import org.exoplatform.faces.core.component.UIToolbar; 17 import org.exoplatform.faces.core.component.model.Button; 18 19 20 24 public class ToolbarRenderer extends HtmlBasicRenderer { 25 public void encodeBegin(FacesContext context, UIComponent component) throws IOException { 26 UIToolbar toolbar = (UIToolbar) component ; 27 ResourceBundle res = getApplicationResourceBundle(context.getExternalContext()) ; 28 ResponseWriter w = context.getResponseWriter(); 29 30 Collection leftButtons = toolbar.getLeftButtons(); 31 Collection rightButtons = toolbar.getRightButtons(); 32 33 w.write("<div class='UIToolbar'>"); 34 w. write("<div class='toolbar-left'>"); 35 for (Iterator iter = leftButtons.iterator(); iter.hasNext();) { 36 Button button = (Button) iter.next(); 37 button.render(w, res, toolbar, null); 38 } 39 w. write("</div>"); 40 w. write("<div class='toolbar-right'>"); 41 for (Iterator iter = rightButtons.iterator(); iter.hasNext();) { 42 Button button = (Button) iter.next(); 43 button.render(w, res, toolbar, null); 44 } 45 w. write("</div>"); 46 w.write("</div>"); 47 } 48 49 } 50 | Popular Tags |