KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > faces > core > renderer > html > ToolbarRenderer


1  /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5
6 package org.exoplatform.faces.core.renderer.html;
7
8 import java.io.IOException JavaDoc;
9 import java.util.Collection JavaDoc;
10 import java.util.Iterator JavaDoc;
11 import java.util.ResourceBundle JavaDoc;
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 /**
21  * @author Benjamin Mestrallet
22  * benjamin.mestrallet@exoplatform.com
23  */

24 public class ToolbarRenderer extends HtmlBasicRenderer {
25   public void encodeBegin(FacesContext context, UIComponent component) throws IOException JavaDoc {
26     UIToolbar toolbar = (UIToolbar) component ;
27     ResourceBundle JavaDoc res = getApplicationResourceBundle(context.getExternalContext()) ;
28     ResponseWriter w = context.getResponseWriter();
29     
30     Collection JavaDoc leftButtons = toolbar.getLeftButtons();
31     Collection JavaDoc rightButtons = toolbar.getRightButtons();
32     
33     w.write("<div class='UIToolbar'>");
34     w. write("<div class='toolbar-left'>");
35     for (Iterator JavaDoc 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 JavaDoc 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