Example usage for com.google.gwt.user.client.ui Label Label

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

Introduction

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

Prototype

protected Label(Element element) 

Source Link

Document

This constructor may be used by subclasses to explicitly use an existing element.

Usage

From source file:cc.alcina.framework.gwt.client.widget.FlowTabBar.java

License:Apache License

/**
 * Inserts a new tab at the specified index.
 * //from ww  w.j  ava 2  s.  com
 * @param text
 *            the new tab's text
 * @param asHTML
 *            <code>true</code> to treat the specified text as HTML
 * @param beforeIndex
 *            the index before which this tab will be inserted
 */
public void insertTab(String text, boolean asHTML, int beforeIndex) {
    checkInsertBeforeTabIndex(beforeIndex);
    Label item;
    if (asHTML) {
        item = new HTML(text);
    } else {
        item = new Label(text);
    }
    item.setWordWrap(false);
    insertTabWidget(item, beforeIndex);
}

From source file:cc.alcina.framework.gwt.client.widget.FlowTabBar.java

License:Apache License

/**
 * Sets a tab's text contents./*w  w w  . ja va 2  s  .  c  om*/
 * 
 * @param index
 *            the index of the tab whose text is to be set
 * @param text
 *            the object's new text
 */
public void setTabText(int index, String text) {
    assert (index >= 0) && (index < getTabCount()) : "Tab index out of bounds";
    ClickDelegatePanel delPanel = tabs.get(index);
    SimplePanel focusablePanel = delPanel.getFocusablePanel();
    // It is not safe to check if the current widget is an instanceof Label
    // and
    // reuse it here because HTML is an instanceof Label. Leaving an HTML
    // would
    // throw off the results of getTabHTML(int).
    focusablePanel.setWidget(new Label(text));
}

From source file:cc.alcina.framework.gwt.client.widget.RelativePopupValidationFeedback.java

License:Apache License

@SuppressWarnings("unchecked")
protected Widget renderExceptionWidget(ValidationException exception) {
    return asHtml ? new HTML(this.getMessage(exception)) : new Label(this.getMessage(exception));
}

From source file:cc.alcina.framework.gwt.client.widget.SelectWithSearch.java

License:Apache License

protected void updateItems() {
    boolean recreateItemHolder = isRecreateItemHolderOnRefresh() && itemHolder.getParent() != null;
    if (recreateItemHolder) {
        itemHolder.removeFromParent();//  w  w w .j  a v  a2 s  .co m
        createItemHolder();
    }
    HasWidgets itemHolder = itemHolderAsHasWidgets();
    itemHolder.clear();
    if (isUseCellList()) {
        updateItemsCellList("", itemHolder);
        return;
    }
    emptyItems = true;
    if (hintLabel != null) {
        itemHolder.add(hintLabel);
        emptyItems = false;
    }
    for (G c : keys) {
        if (!itemMap.containsKey(c)) {
            continue;
        }
        Label l = new Label(c.toString().toUpperCase());
        l.setStyleName("group-heading");
        groupCaptions.add(l);
        addGroupHeading(itemHolder, l);
        if (c.toString().trim().isEmpty()) {
            l.getElement().getStyle().setVisibility(Visibility.HIDDEN);
        } else {
            emptyItems = false;
        }
        int ctr = itemMap.get(c).size();
        for (T item : itemMap.get(c)) {
            emptyItems = false;
            String sep = (--ctr != 0 && separatorText.length() != 1) ? separatorText : "";
            HasClickHandlers hch = createItem(item, false, charWidth, itemsHaveLinefeeds, l, sep);
            hch.addClickHandler(clickHandler);
            if (popdown) {
                hch.addClickHandler(popdownHider);
            }
            itemHolder.add((Widget) hch);
            if (ctr != 0 && sep.length() == 0) {
                addDefaultSeparator(itemHolder);
            }
        }
    }
    if (!itemHolder.iterator().hasNext() && emptyItemsText != null) {
        Label empty = new Label(emptyItemsText);
        empty.setStyleName("empty-items");
        itemHolder.add(empty);
    }
    if (recreateItemHolder) {
        scroller.setWidget(this.itemHolder);
    }
    afterUpdateItems(emptyItems);
}

From source file:cc.alcina.framework.gwt.client.widget.UsefulWidgetFactory.java

License:Apache License

public static Label formatLabel(String template, Object... params) {
    return new Label(CommonUtils.formatJ(template, params));
}

From source file:cc.alcina.framework.gwt.client.widget.UsefulWidgetFactory.java

License:Apache License

public static Label styledLabel(String text, String cssClassName) {
    Label label = new Label(text);
    label.setStyleName(cssClassName);//from w  w  w.j a va2s.  co m
    return label;
}

From source file:cc.kune.bootstrap.client.ui.ComplexNavbarNav.java

License:GNU Affero Public License

/**
 * Adds the fill.//from  ww w.  j a  v a2  s .c  o m
 *
 * @return the widget
 */
public Widget addFill() {
    currentPull = Pull.RIGHT; // From now, all widgets to the right
    return new Label(""); // return an empty widget;
}

From source file:cc.kune.bootstrap.client.ui.ComplexNavbarNav.java

License:GNU Affero Public License

/**
 * Adds the separator.//from   ww  w  . ja  va 2  s .  c om
 *
 * @return the widget
 */
public Widget addSeparator() {
    final Label separator = new Label("");
    setPull(separator);
    this.add(separator);
    return separator;
}

From source file:cc.kune.bootstrap.client.ui.ComplexNavbarNav.java

License:GNU Affero Public License

/**
 * Adds the spacer.//  w  w  w  . j av a 2 s.  co m
 *
 * @return the widget
 */
public Widget addSpacer() {
    final Label separator = new Label(" ");
    setPull(separator);
    this.add(separator);
    return separator;
}

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

License:GNU Affero Public License

@Override
public AbstractGuiItem create(final GuiActionDescrip descriptor) {
    super.descriptor = descriptor;
    label = new Label("");
    descriptor.putValue(ParentWidget.PARENT_UI, this);
    final String id = descriptor.getId();
    if (id != null) {
        label.ensureDebugId(id);/*  w  w  w . j  a v a 2s. c o m*/
    }
    initWidget(label);
    label.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            final AbstractAction action = descriptor.getAction();
            if (action != null) {
                action.actionPerformed(new ActionEvent(label, getTargetObjectOfAction(descriptor),
                        Event.as(event.getNativeEvent())));
            }
        }
    });
    configureItemFromProperties();
    return this;
}