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

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

Introduction

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

Prototype

public void addStyleName(String style) 

Source Link

Document

Adds a secondary or dependent style name to this object.

Usage

From source file:scrum.client.calendar.ADateSelectorWidget.java

License:Open Source License

@Override
protected final Widget onInitialization() {

    TableBuilder tb = ScrumGwt.createFieldTable();
    tb.add(new HyperlinkWidget(getAction()));

    List<SimpleEvent> events = getEvents();

    int eventCount = events.size();

    tb.nextRow();/*from w w  w . j  a  va2s  .  c o m*/
    Label eventLabel;
    if (eventCount > 0) {
        eventLabel = new Label("" + events.size());
    } else {
        eventLabel = new Label(" ");
    }

    eventLabel.setStyleName("DateSelectorWidget-events");
    tb.add(eventLabel);

    Widget panel = tb.createTable();

    if (isSelected()) {
        panel.setStyleName("DateSelectorWidget-selected");
    } else if (isVisibleInList()) {
        panel.setStyleName("DateSelectorWidget-visible");
    } else {
        panel.setStyleName("DateSelectorWidget");
    }

    if (isToday()) {
        panel.addStyleName("DateSelectorWidget-today");
    }
    return panel;
}

From source file:stroom.query.client.OperatorEditor.java

License:Apache License

private void fixStyle(final Widget widget, final int width) {
    widget.addStyleName(resources.style().item());
    widget.getElement().getStyle().setWidth(width, Unit.PX);
}

From source file:stroom.widget.tab.client.view.LayerContainerImpl.java

License:Apache License

@Override
public void add(final IsWidget isWidget) {
    final Widget widget = isWidget.asWidget();

    widget.addStyleName(resources.style().layer());
    panel.add(widget);// w w w . j a  v a  2 s .  co m
}

From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.widget.EditorTabBar.java

License:Apache License

public void setSelectedStyle(Widget widget, boolean selected) {
    if (selected) {
        widget.addStyleName("selected");
    } else {//from   ww w  .j  a v  a 2  s  . c o  m
        widget.removeStyleName("selected");
    }
}

From source file:uk.ac.ebi.fg.annotare2.web.gwt.user.client.view.LeftMenuViewImpl.java

License:Apache License

private void selectItem(Widget item) {
    final String styleName = "selectedItem";
    if (selected != null) {
        selected.removeStyleName(styleName);
        selected = null;/*from   www  .j  a  v a  2 s  . co  m*/
    }
    item.addStyleName(styleName);
    selected = item;
}

From source file:us.asciiroth.client.ui.InventoryPalette.java

License:Apache License

public void onInventoryChanged(final PlayerBag bag) {
    inventory.clear();//from  w  w w  . ja  v  a2  s.com
    // Resetting this widget fixes a rendering bug in FF3
    // where the rounded border on the bottom of the div 
    // is not updated when you add items.
    setBodyWidget(focuser);

    // It seems like this should be simpler.
    int selIndex = bag.getIndex(bag.getSelected());
    int total = bag.size();
    int start = selIndex - (INV_LENGTH / 2);
    int end = start + INV_LENGTH;

    if (end > total) {
        start -= (end - total);
        end = total;
    }
    if (start < 0) {
        end += Math.abs(start);
        start = 0;
    }
    end = (end > total) ? total : end;

    List<Bag.Entry<Item>> entries = bag.asEntryList();
    for (int i = start; i < end; i++) {
        final int j = i;
        Bag.Entry<Item> entry = entries.get(i);

        HTML html = new HTML(Util.renderSymbolAndLabel2(false, entry));
        html.setStyleName(bag.isSelected(entry) ? "selectedItem" : "notSelectedItem");
        html.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                if (!DialogManager.get().isPaused()) {
                    if (bag.getSelected() == bag.get(j)) {
                        Events.get().fireClearCurrentCell();
                        Game.get().useSelectedItem();
                        Events.get().fireHandleInventoryMessaging();
                    } else {
                        bag.select(j);
                    }
                }
            }
        });
        html.addMouseOverHandler(new MouseOverHandler() {
            public void onMouseOver(MouseOverEvent event) {
                if (!DialogManager.get().isPaused()) {
                    // WARN
                    Widget w = (Widget) event.getSource();
                    w.addStyleName("hover");
                }
            }
        });
        html.addMouseOutHandler(new MouseOutHandler() {
            public void onMouseOut(MouseOutEvent event) {
                if (!DialogManager.get().isPaused()) {
                    // WARN
                    Widget w = (Widget) event.getSource();
                    w.removeStyleName("hover");
                }
            }
        });
        inventory.add(html);
    }
}