Example usage for com.google.gwt.dom.client Element setTitle

List of usage examples for com.google.gwt.dom.client Element setTitle

Introduction

In this page you can find the example usage for com.google.gwt.dom.client Element setTitle.

Prototype

@Override
    public void setTitle(String title) 

Source Link

Usage

From source file:annis.gui.widgets.gwt.client.ui.VAnnotationGrid.java

License:Apache License

private void addRow(UIDL row, int rowNumber) {

    String caption = row.getStringAttribute("caption");
    boolean showNamespace = row.getBooleanAttribute("show-namespace");
    String name;//w w w .j  a  v a  2 s. co m
    if (showNamespace) {
        name = caption;
    } else {
        String[] captionSplit = caption.split("::");
        name = captionSplit[captionSplit.length - 1];
    }

    boolean showCaption = row.getBooleanAttribute("show-caption");

    int startColumn = 0;

    if (showCaption) {
        table.setHTML(rowNumber, 0, Util.escapeHTML(name));
        formatter.addStyleName(rowNumber, 0, "header");
        startColumn = 1;
    }

    int colspanOffset = 0;

    UIDL events = row.getChildByTagName("events");
    for (int j = 0; j < events.getChildCount(); j++) {
        UIDL event = events.getChildUIDL(j);
        String id = event.getStringAttribute("id");
        int left = event.getIntAttribute("left");
        int right = event.getIntAttribute("right");
        String value = event.getStringAttribute("value");
        if (escapeHTML) {
            value = Util.escapeHTML(value);
        }

        // +1 because we also have a caption column, subtract columns we
        // jumped over by using colspan
        int col = left + startColumn - colspanOffset;

        table.setHTML(rowNumber, col, value);

        if (event.hasAttribute("tooltip")) {
            Element tdElement = table.getCellFormatter().getElement(rowNumber, col);
            tdElement.setTitle(event.getStringAttribute("tooltip"));
        }

        position2id.put(new Position(rowNumber, col), id);

        int colspan = right - left + 1;
        formatter.setColSpan(rowNumber, col, colspan);
        if (colspan > 1) {
            colspanOffset += (colspan - 1);
        }

        addStyleForEvent(event, rowNumber, col);

    }
}

From source file:com.alkacon.geranium.client.ui.TabbedPanel.java

License:Open Source License

/**
 * Disables the tab with the given index.<p>
 * /*  ww w .  j a  v  a2 s  .c  o  m*/
 * @param tabContent the content of the tab that should be disabled
 * @param reason the reason why the tab is disabled
 */
public void disableTab(E tabContent, String reason) {

    Integer index = new Integer(m_tabPanel.getWidgetIndex(tabContent));
    Element tab = getTabElement(index.intValue());
    if ((tab != null) && !m_disabledTabIndexes.containsKey(index)) {
        if (ClientStringUtil.isNotEmptyOrWhitespaceOnly(tab.getTitle())) {
            m_disabledTabIndexes.put(index, tab.getTitle());
        } else {
            m_disabledTabIndexes.put(index, "");
        }
        tab.addClassName(I_LayoutBundle.INSTANCE.tabbedPanelCss().tabDisabled());
        tab.setTitle(reason);
    }
}

From source file:com.alkacon.geranium.client.ui.TabbedPanel.java

License:Open Source License

/**
 * Enables the tab with the given index.<p>
 * /* www.jav a2 s.  c  om*/
 * @param tabContent the content of the tab that should be enabled
 */
public void enableTab(E tabContent) {

    Integer index = new Integer(m_tabPanel.getWidgetIndex(tabContent));
    Element tab = getTabElement(index.intValue());
    if ((tab != null) && m_disabledTabIndexes.containsKey(index)) {
        tab.removeClassName(I_LayoutBundle.INSTANCE.tabbedPanelCss().tabDisabled());
        tab.setTitle(m_disabledTabIndexes.get(index));
        m_disabledTabIndexes.remove(index);
    }
}

From source file:com.ephesoft.gxt.core.client.ui.widget.MultiSelectDragDropDualList.java

License:Open Source License

/**
 * Sets the tool tip./*  w w w  . j a  v a 2 s  . com*/
 * 
 * @param listView the list view
 */
public void setTitle(ListView<M, T> listView) {
    List<Element> listOfItems = listView.getElements();
    for (Element item : listOfItems) {
        item.setTitle(item.getInnerText());
    }
}

From source file:com.goodow.wave.client.wavepanel.blip.SetColor.java

License:Apache License

private void putColor(final NodeList<Node> childNodes) {
    Iterator<Entry<String, String>> iterator = colorMap.entrySet().iterator();
    int i = 1;/*from  w  w w  .j av  a 2  s  . co m*/
    while (iterator.hasNext()) {
        Entry<String, String> color = iterator.next();
        Element elm = Element.as(childNodes.getItem(i));
        elm.setTitle(color.getKey());
        elm.getStyle().setBackgroundColor(color.getValue());
        addEvent(elm);
        i = i + 2;
    }
}

From source file:com.sencha.gxt.widget.core.client.DatePicker.java

License:sencha.com license

protected void setCellStyle(Element cell, Date d, long sel, long min, long max) {
    long t = d.getTime();

    DateWrapper w = new DateWrapper(d);
    int year = w.getFullYear();
    int month = w.getMonth();
    int day = w.getDate();

    String dd = year + "," + month + "," + day;

    cell.getFirstChildElement().setPropertyString("dateValue", dd);

    appearance.onUpdateDateStyle(cell, DateState.TODAY, t == today);
    appearance.onUpdateDateStyle(cell, DateState.SELECTED, t == sel);
    appearance.onUpdateDateStyle(cell, DateState.DISABLED, t > max || t < min);

    if (t > max || t < min) {
        if (t > max) {
            cell.setTitle(messages.maxText());
        } else {//  ww  w.j ava  2s  . c o m
            cell.setTitle(messages.minText());
        }
    }
}

From source file:com.vaadin.client.debug.internal.LogSection.java

License:Apache License

/**
 * Resets the timer and inserts a log row indicating this.
 */// w  w w  . ja v a2  s  . com
private void resetTimer() {
    int sinceStart = VDebugWindow.getMillisSinceStart();
    int sinceReset = VDebugWindow.resetTimer();
    Element row = DOM.createDiv();
    row.addClassName(VDebugWindow.STYLENAME + "-reset");
    row.setInnerHTML(Icon.RESET_TIMER + " Timer reset");
    row.setTitle(VDebugWindow.getTimingTooltip(sinceStart, sinceReset));
    contentElement.appendChild(row);
    maybeScroll();
}

From source file:org.cruxframework.crux.smartfaces.client.breadcrumb.Breadcrumb.java

License:Apache License

/**
 * Create a new divider element. //from  w w  w  . j  av  a  2 s . c  o m
 * @return the element created
 */
protected Element createDivider() {
    Element el = null;
    if (dividerImage != null) {
        el = dividerImage.getElement().cloneNode(true).cast();
        if (!StringUtils.isEmpty(dividerText)) {
            el.setTitle(dividerText);
        }
    } else if (!StringUtils.isEmpty(dividerText)) {
        el = Document.get().createSpanElement();
        el.setInnerText(dividerText);
    }

    return el;
}

From source file:org.dashbuilder.client.navigation.widget.NavTreeWidgetView.java

License:Apache License

protected void addItem(String iconClass, String id, String name, String description, Command onClicked) {
    Element nameEl = onClicked != null ? Document.get().createAnchorElement()
            : Document.get().createSpanElement();
    nameEl.setInnerText(name);//from w  w w.j av  a  2s.  co m
    nameEl.setClassName(
            onClicked != null ? "uf-navtree-widget-non-clicked" : "uf-navtree-widget-non-clickable");
    if (description != null && !description.equals(name)) {
        nameEl.setTitle(description);
    }

    SpanElement iconSpan = Document.get().createSpanElement();
    iconSpan.setClassName("uf-navtree-widget-icon " + iconClass);

    DivElement div = Document.get().createDivElement();
    div.appendChild(iconSpan);
    div.appendChild(nameEl);

    navWidget.appendChild((Node) div);
    itemMap.put(id, nameEl);

    if (onClicked != null) {
        Event.sinkEvents(nameEl, Event.ONCLICK);
        Event.setEventListener(nameEl, event -> {
            if (Event.ONCLICK == event.getTypeInt()) {
                onClicked.execute();
            }
        });
    }
}

From source file:org.kie.workbench.common.screens.server.management.client.util.ContainerStatusUtil.java

License:Apache License

public static void setupStatus(final Element status, final ContainerStatus state) {
    status.removeAttribute("class");
    switch (state) {
    case STARTED:
        status.setTitle("Started");
        status.addClassName("icon-play-circle");
        status.addClassName(ContainerResources.INSTANCE.CSS().green());
        break;/*from w w  w  .  java 2  s.c o m*/
    case STOPPED:
        status.setTitle("Stopped");
        status.addClassName("icon-off");
        status.addClassName(ContainerResources.INSTANCE.CSS().orange());
        break;
    case LOADING:
        status.setTitle("Loading");
        status.addClassName("icon-spin");
        status.addClassName("icon-refresh");
        break;
    case ERROR:
        status.setTitle("Error");
        status.addClassName("icon-exclamation-sign");
        status.addClassName(ContainerResources.INSTANCE.CSS().red());
        break;
    default:
        status.setTitle("");
        break;
    }
}