Example usage for com.google.gwt.user.client.ui Widget setStyleName

List of usage examples for com.google.gwt.user.client.ui Widget setStyleName

Introduction

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

Prototype

public static void setStyleName(Element elem, String styleName) 

Source Link

Document

Clears all of the element's style names and sets it to the given style.

Usage

From source file:com.rhizospherejs.gwt.client.renderer.RenderingOutputImpl.java

License:Open Source License

@Override
public void emitWidget(Widget widget) {
    if (rendering != null) {
        throw new RhizosphereException("emitWidget() called more than once within a Rhizosphere rendering.");
    }// w w w.j  a  v a  2 s . com
    // Setting the rhizo-stop-propagation class on the emitted widget ensures
    // that certain events (such as clicks) do not bubble up into the
    // Rhizosphere rendering model, where they could be mis-handled (for
    // example triggering model selection).
    widget.setStyleName("rhizo-stop-propagation", true);
    rendering = widgetBridge.processRendering(widget);
}

From source file:com.rhizospherejs.gwt.client.renderer.RenderingOutputImpl.java

License:Open Source License

@Override
public void addDragHandler(Widget dragHandler) {
    dragHandler.setStyleName("rhizo-drag-handle", true);
}

From source file:com.vaadin.client.ui.AbstractComponentConnector.java

License:Apache License

/**
 * Updates the component size, invoking the {@link LayoutManager layout
 * manager} if necessary.//from w  w  w .j a v a  2 s .c o  m
 * 
 * @param newWidth
 *            The new width as a CSS string. Cannot be null.
 * @param newHeight
 *            The new height as a CSS string. Cannot be null.
 */
protected void updateComponentSize(String newWidth, String newHeight) {
    Profiler.enter("AbstractComponentConnector.updateComponentSize");

    // Parent should be updated if either dimension changed between relative
    // and non-relative
    if (newWidth.endsWith("%") != lastKnownWidth.endsWith("%")) {
        Connector parent = getParent();
        if (parent instanceof ManagedLayout) {
            getLayoutManager().setNeedsHorizontalLayout((ManagedLayout) parent);
        }
    }

    if (newHeight.endsWith("%") != lastKnownHeight.endsWith("%")) {
        Connector parent = getParent();
        if (parent instanceof ManagedLayout) {
            getLayoutManager().setNeedsVerticalLayout((ManagedLayout) parent);
        }
    }

    lastKnownWidth = newWidth;
    lastKnownHeight = newHeight;

    // Set defined sizes
    Widget widget = getWidget();

    Profiler.enter("AbstractComponentConnector.updateComponentSize update styleNames");
    widget.setStyleName("v-has-width", !isUndefinedWidth());
    widget.setStyleName("v-has-height", !isUndefinedHeight());
    Profiler.leave("AbstractComponentConnector.updateComponentSize update styleNames");

    Profiler.enter("AbstractComponentConnector.updateComponentSize update DOM");
    updateWidgetSize(newWidth, newHeight);
    Profiler.leave("AbstractComponentConnector.updateComponentSize update DOM");

    Profiler.leave("AbstractComponentConnector.updateComponentSize");
}