@Override public final SafeHtml getValue(LunModel object) { // TODO this should use a cell to render, not return HTML itself ScrollableTextCell.CellTemplate template = GWT.create(ScrollableTextCell.CellTemplate.class); SafeStylesBuilder builder = new SafeStylesBuilder(); if (object != null) { boolean isLunUnExtendable = object.getIsIncluded() && object.getAdditionalAvailableSize() == 0; if (object.isRemoveLunSelected()) { builder.trustedColor("black"); //$NON-NLS-1$ builder.textDecoration(TextDecoration.LINE_THROUGH); } else if (object.getIsLunRemovable()) { builder.trustedColor("black"); //$NON-NLS-1$ } else if ((!object.getIsIncluded() && object.getIsGrayedOut()) || isLunUnExtendable) { builder.trustedColor("gray"); //$NON-NLS-1$ } else if (!object.getIsAccessible() && !object.getIsGrayedOut()) { builder.trustedColor("orange"); //$NON-NLS-1$ } else if (object.getIsSelected() || object.isAdditionalAvailableSizeSelected()) { builder.trustedColor("black"); //$NON-NLS-1$ builder.fontWeight(FontWeight.BOLD); } else { builder.trustedColor("black"); //$NON-NLS-1$ } } // TODO use a proper ID return template.input(getRawValue(object), builder.toSafeStyles(), DOM.createUniqueId()); //$NON-NLS-1$ }
protected SafeHtml getRenderedImage(IconType value, String color) { SafeStyles styles = new SafeStylesBuilder().trustedColor(color).toSafeStyles(); return TEMPLATE.icon(value.getCssName(), styles); }
protected static SafeHtml getRenderedImage(IconType value, String color) { SafeStylesBuilder builder = new SafeStylesBuilder(); builder.trustedColor(color); builder.textAlign(TextAlign.CENTER); builder.verticalAlign(VerticalAlign.MIDDLE); SafeStyles styles = builder.toSafeStyles(); return TEMPLATE.icon(value.getCssName(), styles); } }