List of usage examples for com.google.gwt.user.client.ui UIObject removeStyleName
public void removeStyleName(String style)
From source file:com.alkacon.geranium.client.util.StyleVariable.java
License:Open Source License
/** * Removes the previous value of the style variable from all associated ui objects * and adds the new value as a style name to all of them.<p> * //w w w .j ava2 s . c om * @param newStyle the new style name */ public void setValue(String newStyle) { for (UIObject ui : m_uis) { if (m_style != null) { ui.removeStyleName(m_style); } if (newStyle != null) { ui.addStyleName(newStyle); } } m_style = newStyle; }
From source file:com.dianaui.universal.core.client.ui.base.helper.StyleHelper.java
License:Apache License
/** * Removes all CSS style names specified by an enum that implements {@link Style.HasCssName} from an UIObject. * * @param uiObject Object to remove CSS class names from * @param enumClass Enum representing CSS class names * @param <E> enum type implementing {@link Style.HasCssName} *///from w ww . ja v a 2 s . c om public static <E extends Enum<? extends Style.HasCssName>> void removeEnumStyleNames(final UIObject uiObject, final Class<E> enumClass) { for (final Enum<? extends Style.HasCssName> constant : enumClass.getEnumConstants()) { final String cssClass = ((Style.HasCssName) constant).getCssName(); if (cssClass != null && !cssClass.isEmpty()) { uiObject.removeStyleName(cssClass); } } }
From source file:com.dianaui.universal.core.client.ui.base.helper.StyleHelper.java
License:Apache License
/** * Removes enum value style name from UIObject unless style is {@code null}. * * @param uiObject Object to remove style from * @param style Style name//from w ww .j a va2 s . c o m * @param <E> enum type implementing {@link Style.HasCssName} */ public static <E extends Style.HasCssName> void removeEnumStyleName(final UIObject uiObject, final E style) { if (style != null && style.getCssName() != null && !style.getCssName().isEmpty()) { uiObject.removeStyleName(style.getCssName()); } }
From source file:com.dianaui.universal.core.client.ui.base.helper.StyleHelper.java
License:Apache License
public static boolean removeStyleNameStartsWith(final UIObject uiObject, final String prefix) { if (uiObject.getStyleName() == null || prefix == null) { return false; }/*from www.j a va2 s.co m*/ final String[] styles = uiObject.getStyleName().split("\\s"); boolean result = false; for (final String s : styles) { if (s.startsWith(prefix)) { uiObject.removeStyleName(s); result = true; } } return result; }
From source file:com.dianaui.universal.core.client.ui.base.helper.StyleHelper.java
License:Apache License
/** * Toggles a style name on a ui object/*from w w w .ja va2 s .c o m*/ * * @param uiObject Object to toggle style on * @param toggleStyle whether or not to toggle the style name on the object * @param styleName Style name */ public static void toggleStyleName(final UIObject uiObject, final boolean toggleStyle, final String styleName) { if (toggleStyle) { uiObject.addStyleName(styleName); } else { uiObject.removeStyleName(styleName); } }
From source file:com.dianaui.universal.core.client.ui.base.mixin.ActiveMixin.java
License:Apache License
public static void setActive(final UIObject uiObject, final boolean active) { if (active) { uiObject.addStyleName(Styles.ACTIVE); } else {/* ww w .ja va 2s . c om*/ uiObject.removeStyleName(Styles.ACTIVE); } }
From source file:com.dianaui.universal.core.client.ui.base.mixin.EnabledMixin.java
License:Apache License
public static void setEnabled(final UIObject uiObject, final boolean enabled) { if (enabled) { uiObject.removeStyleName(Styles.DISABLED); uiObject.getElement().removeAttribute(DISABLED); } else {/*from w w w . j a va2 s. co m*/ uiObject.addStyleName(Styles.DISABLED); uiObject.getElement().setAttribute(DISABLED, ""); } }
From source file:com.facebook.tsdb.tsdash.client.ui.CssHelper.java
License:Apache License
public static void toggleClass(UIObject el, String cssClass) { if (el == null) { return;/*from ww w. j a v a 2 s . com*/ } if (el.getStyleName().contains(cssClass)) { el.removeStyleName(cssClass); } else { el.addStyleName(cssClass); } }
From source file:com.facebook.tsdb.tsdash.client.ui.CssHelper.java
License:Apache License
public static void replaceClass(UIObject el, String cssClass, String replacement) { if (el == null) { return;/* w ww .j a va 2s .c o m*/ } if (el.getStyleName().contains(cssClass)) { el.removeStyleName(cssClass); } // add the replacement anyway el.addStyleName(replacement); }
From source file:com.facebook.tsdb.tsdash.client.ui.MetricWidget.java
License:Apache License
@Override public void pressToggleButton(Object toggleButton, boolean pressed) { if (toggleButton != rightAxis && toggleButton != rate) { return;/*from www. j a v a 2 s. com*/ } UIObject button = (UIObject) toggleButton; if (pressed && !button.getStyleName().contains(style.pressedToggleButton())) { button.addStyleName(style.pressedToggleButton()); } else if (!pressed && button.getStyleName().contains(style.pressedToggleButton())) { button.removeStyleName(style.pressedToggleButton()); } }