Example usage for com.google.gwt.user.client.ui UIObject addStyleName

List of usage examples for com.google.gwt.user.client.ui UIObject addStyleName

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui UIObject addStyleName.

Prototype

public void addStyleName(String style) 

Source Link

Document

Adds a secondary or dependent style name to this object.

Usage

From source file:cc.kune.common.client.actions.gwtui.GwtComplexToolbar.java

License:GNU Affero Public License

/**
 * Adds the./*from w  w  w . j ava  2 s .  co  m*/
 *
 * @param uiObject the ui object
 */
public void add(final UIObject uiObject) {
    uiObject.addStyleName(getFlow());
    toolbar.add((Widget) uiObject);
}

From source file:cc.kune.common.client.actions.gwtui.GwtComplexToolbar.java

License:GNU Affero Public License

/**
 * Insert./*w  w  w.ja v a 2  s . c o m*/
 *
 * @param uiObject the ui object
 * @param position the position
 */
public void insert(final UIObject uiObject, final int position) {
    uiObject.addStyleName(getFlow());
    toolbar.insert((Widget) uiObject, position);
}

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>
 * /*  ww  w.j a v a 2s. 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

/**
 * Adds enum value style name to UIObject unless style is {@code null}.
 *
 * @param uiObject Object to add style to
 * @param style    Style name/*w  ww .  ja  v  a2  s. c  om*/
 * @param <E>      enum type implementing {@link Style.HasCssName}
 */
public static <E extends Style.HasCssName> void addEnumStyleName(final UIObject uiObject, final E style) {

    if (style != null && style.getCssName() != null && !style.getCssName().isEmpty()) {
        uiObject.addStyleName(style.getCssName());
    }
}

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.  j av  a 2 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 {/*from   w  w  w  . j  a va  2  s.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 {/*  w w  w . j av a2s  .c o  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 . c  o  m
    }
    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 v a2s .com
    }
    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 w w w  . j av a 2  s  .co m
    }
    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());
    }
}