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 void setStyleName(String style) 

Source Link

Document

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

Usage

From source file:edu.caltech.ipac.firefly.ui.TitlePanel.java

private void makeTitleLabel(Widget w) {
    w.setStyleName("title-bar");
    w.addStyleName("title-bg-color");
    w.addStyleName("title-color");
    w.addStyleName("title-font-family");
}

From source file:edu.purdue.pivot.skwiki.client.dnd.PaletteWidget.java

License:Apache License

public PaletteWidget cloneWidget() {
    Widget clone;

    // Clone our internal widget
    if (widget instanceof Label) {
        Label label = (Label) widget;
        clone = new Label(label.getText());
    } else if (widget instanceof RadioButton) {
        RadioButton radioButton = (RadioButton) widget;
        clone = new RadioButton(radioButton.getName(), radioButton.getHTML(), true);
    } else if (widget instanceof CheckBox) {
        CheckBox checkBox = (CheckBox) widget;
        clone = new CheckBox(checkBox.getHTML(), true);
    } else if (widget instanceof TextWindow) {
        TextWindow editWindow = (TextWindow) widget;
        clone = new TextWindow();
    } else if (widget instanceof CanvasWindow) {
        CanvasWindow editWindow = (CanvasWindow) widget;
        clone = new CanvasWindow();
    } else {//from w ww  .ja v  a 2s  .  c o  m
        throw new IllegalStateException("Unhandled Widget class " + widget.getClass().getName());
    }

    // Copy a few obvious common widget properties
    clone.setStyleName(widget.getStyleName());
    clone.setTitle(widget.getTitle());

    // Wrap the cloned widget in a new PaletteWidget instance
    return new PaletteWidget(clone);
}

From source file:edu.ucsb.eucalyptus.admin.client.extensions.store.ImageWidget.java

License:Open Source License

private void setProvider(String title, String uri) {
    String styleName = "istore-known-provider-title";

    if (title == null) {
        styleName = "istore-unknown-provider-title";
        title = "Unknown";
    }/*from  w ww  .ja  va2 s .c  o  m*/

    Widget providerTitleWidget;
    if (uri == null) {
        Label providerLabel = new Label();
        providerLabel.setText(title);
        providerTitleWidget = providerLabel;
    } else {
        Anchor providerAnchor = new Anchor();
        providerAnchor.setText(title);
        providerAnchor.setHref(uri);
        providerTitleWidget = providerAnchor;
    }

    providerTitlePanel.setWidget(providerTitleWidget);
    providerTitleWidget.setStyleName(styleName);
    providerTitleWidget.addStyleName("istore-provider-title");
}

From source file:edu.umn.msi.tropix.webgui.client.forms.FormWidgetFactoryImpl.java

License:Open Source License

public Widget apply(final JObject configurationObject) {
    final Widget widget = getChildWidget(configurationObject);
    widget.setStyleName("tropixForms");
    return widget;
}

From source file:eu.nextstreet.gwt.components.client.ui.widget.suggest.impl.table.SimpleTableRowItemRenderer.java

License:Apache License

@Override
public void setStyleName(String style) {
    this.styleName = style;
    for (Widget widget : this) {
        widget.setStyleName(styleName);
    }//from w w w  .  j av a 2 s  .  c  om

}

From source file:fi.tkk.media.xide.client.DnD.FlexTableRowDropController.java

License:Apache License

@Override
public void onEnter(DragContext context) {

    if (context.dragController instanceof FlexTableRowDragController) {
        // Adding
        Widget widget = ((FlexTableRowDragController) context.dragController).proxy;
        widget.setStyleName("demo-FlexTableRowExample-table-proxy-move");
    } else if (context.dragController instanceof DragControllerAdding) {
        Widget widget = ((DragControllerAdding) context.dragController).proxy;
        widget.setStyleName("demo-FlexTableRowExample-table-proxy-add");
    } else if (context.dragController instanceof DragControllerPLAdding) {
        Widget widget = ((DragControllerPLAdding) context.dragController).proxy;
        widget.setStyleName("demo-FlexTableRowExample-table-proxy-add");
    }/*from   ww  w.  ja v  a  2  s.co m*/

    //      context.dragEndCleanup();
    super.onEnter(context);
    positioner = newPositioner(context);
}

From source file:fi.tkk.media.xide.client.DnD.FlexTableRowDropController.java

License:Apache License

@Override
public void onLeave(DragContext context) {
    if (context.dragController instanceof FlexTableRowDragController) {
        // Adding
        Widget widget = ((FlexTableRowDragController) context.dragController).proxy;
        widget.setStyleName("demo-FlexTableRowExample-table-proxy");
    } else if (context.dragController instanceof DragControllerAdding) {
        Widget widget = ((DragControllerAdding) context.dragController).proxy;
        widget.setStyleName("demo-FlexTableRowExample-table-proxy");
    } else if (context.dragController instanceof DragControllerPLAdding) {
        Widget widget = ((DragControllerPLAdding) context.dragController).proxy;
        widget.setStyleName("demo-FlexTableRowExample-table-proxy");
    }/*  w w  w  .  j a v  a 2 s  .  co  m*/
    positioner.removeFromParent();
    positioner = null;
    super.onLeave(context);
}

From source file:fr.aliasource.webmail.client.View.java

License:GNU General Public License

/**
 * Pop a notification widget for the given time
 * //from  ww  w  .  j a  v a 2 s .  c  o  m
 * @param w
 *            the widget shown to the user as a notification
 * @param seconds
 *            how long the widget will remain visible
 */
public void notifyUser(final Widget w, int seconds) {
    Timer t = new Timer() {
        public void run() {
            statusPanel.remove(w);
        }
    };
    statusPanel.clear();
    w.setStyleName("notificationMessage");
    statusPanel.add(w);
    statusPanel.setCellHorizontalAlignment(w, VerticalPanel.ALIGN_CENTER);
    t.schedule(seconds * 1000);
}

From source file:ilarkesto.gwt.client.NavigatorWidget.java

License:Open Source License

private Widget createItemWidget(final MenuItem item) {
    final ImageAnchor a = new ImageAnchor(null, item.getLabel());
    String href = getHref(item);/*from   w  w  w.  j a  v a  2 s.co  m*/
    if (href != null) {
        a.setHref(href);
    } else {
        a.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                log.debug("Item clicked:", item.getLabel());
                event.stopPropagation();
                item.select();
                a.setFocus(false);
                update();
            }
        });
    }

    FlowPanel itemPanel = new FlowPanel();
    itemPanel.setStyleName("NavigatorWidget-item");
    SimplePanel itemLink = Gwt.createDiv("NavigatorWidget-item-link", a);
    itemPanel.add(itemLink);
    if (item.isSelected()) {
        if (item instanceof Submenu) {
            boolean animate = lastAnimatedItem != item;
            // log.debug("---------- animate:", animate);
            Widget submenuPanel = animate ? new AnimatingFlowPanel() : new FlowPanel();
            if (animate)
                lastAnimatedItem = item;
            submenuPanel.setStyleName("NavigatorWidget-submenu");
            itemPanel.add(submenuPanel);
            Submenu<MenuItem> submenu = (Submenu) item;
            for (MenuItem subItem : submenu.getMenu().getItems()) {
                ((HasWidgets) submenuPanel).add(createItemWidget(subItem));
            }
        } else {
            itemLink.addStyleDependentName("selected");
        }
    }

    return itemPanel;
}

From source file:info.piwai.rockslide.client.slides.Presentation.java

License:Apache License

public void updateSlides(String chapterName, Chapter chapter) {
    index = 0;//from   w ww  .j ava 2 s . c  om
    this.chapterName = chapterName;
    this.chapter = chapter;
    slidesPanel.clear();
    for (Presentable presentable : chapter) {
        Widget slideWidget = presentable.asWidget();
        slideWidget.setStyleName("slide");
        slidesPanel.add(slideWidget);
    }
}