| 1 33 34 package com.icesoft.icefaces.samples.showcase.util; 35 36 import com.icesoft.icefaces.samples.showcase.navigation.TreeNavigation; 37 38 import javax.faces.model.SelectItem; 39 import java.util.ArrayList ; 40 import java.util.List ; 41 42 53 public class StyleBean { 54 55 private final String XP = "xp"; 57 private final String ROYALE = "royale"; 58 59 private String currentStyle = XP; 61 private String tempStyle = XP; 62 63 private ArrayList styleList; 65 66 private String imageDirectory = "/xmlhttp/css/xp/css-images/"; 68 69 TreeNavigation treeNav; 71 72 public static final String XP_BRANCH_EXPANDED_ICON = 74 "xmlhttp/css/xp/css-images/tree_folder_open.gif"; 75 public static final String XP_BRANCH_CONTRACTED_ICON = 76 "xmlhttp/css/xp/css-images/tree_folder_close.gif"; 77 public static final String ROYALE_BRANCH_EXPANDED_ICON = 78 "xmlhttp/css/royale/css-images/tree_folder_open.gif"; 79 public static final String ROYALE_BRANCH_CONTRACTED_ICON = 80 "xmlhttp/css/royale/css-images/tree_folder_close.gif"; 81 82 85 public StyleBean() { 86 styleList = new ArrayList (); 88 styleList.add(new SelectItem(XP, XP)); 89 styleList.add(new SelectItem(ROYALE, ROYALE)); 90 } 91 92 97 public String getCurrentStyle() { 98 return currentStyle; 99 } 100 101 107 public void setCurrentStyle(String currentStyle) { 108 this.tempStyle = currentStyle; 109 } 110 111 116 public String getStyle() { 117 return "<link rel=\"stylesheet\" type=\"text/css\" HREF=\"xmlhttp/css/" + 118 currentStyle + "/" + currentStyle + ".css" + "\"></link>"; 119 } 120 121 127 public String getImageDirectory() { 128 return imageDirectory; 129 } 130 131 140 public String changeStyle() { 141 currentStyle = tempStyle; 142 imageDirectory = "./xmlhttp/css/" + currentStyle + "/css-images/"; 143 144 treeNav.refreshIcons(currentStyle); 146 147 return "reload"; 148 } 149 150 155 public List getStyleList() { 156 return styleList; 157 } 158 159 166 public void registerTree(TreeNavigation treeNav) { 167 168 this.treeNav = treeNav; 169 } 170 } | Popular Tags |