List of usage examples for com.google.gwt.safecss.shared SafeStyles SafeStyles
SafeStyles
From source file:com.mgwt.imustlearn.client.ui.CellListWithButtons.java
License:Apache License
/** * Construct a celllist with a given cell and css * * @param cell the cell to use//w w w . j a v a 2 s.co m * @param css the css to use */ public CellListWithButtons(JCell<T> cell, ListCss css, final CellButton... widgets) { //TODO change MGWTStyle.getTheme().getMGWTClientBundle().getButtonBarButtonCss().ensureInjected(); hasWidgets = cell.hasWidgets(); widgetsBuilder = new SafeHtmlBuilder(); hasWidgets = (hasWidgets && (widgets.length > 0)); if (hasWidgets) { buttons = widgets; for (int j = 0; j < widgets.length; j++) { final int finalJ = j; SafeStyles styles = new SafeStyles() { @Override public String asString() { return "background-image:url(" + widgets[finalJ].getImageResource().getSafeUri().asString() + ");float:right;"; } }; widgetsBuilder.append(WIDGET_TEMPLATE.div(j, MGWTStyle.getTheme().getMGWTClientBundle().getButtonBarButtonCss().barButton(), styles, "")); } } css.ensureInjected(); this.cell = cell; this.css = css; main = new UlTouchWidget(); initWidget(main); internalTouchHandler = new InternalTouchHandler(); setStylePrimaryName(css.listCss()); }