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

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

Introduction

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

Prototype

@Override
    public void setTitle(String title) 

Source Link

Usage

From source file:ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.MultilineHTML.java

License:Apache License

public static String wrapUpInDivWithTooltip(String text, String tooltip) {
    final Element div = DOM.createDiv();
    div.setInnerHTML(text);//from w  w w.ja v  a 2  s  .c  o  m
    div.setTitle(tooltip);
    return DOM.toString(div);
}

From source file:com.alkacon.forms.client.ComplexTypeRenderer.java

License:Open Source License

/**
 * @see com.alkacon.forms.client.I_EntityRenderer#render(com.alkacon.vie.shared.I_Entity, com.google.gwt.user.client.Element)
 *///from w  w w  .  ja va 2  s. c  o m
public void render(I_Entity entity, Element context) {

    Element result = DOM.createDiv();
    result.addClassName(ENTITY_CLASS);
    result.setAttribute("typeof", Vie.removePointyBrackets(entity.getTypeName()));
    result.setAttribute("about", Vie.removePointyBrackets(entity.getId()));
    I_Type entityType = m_vie.getType(entity.getTypeName());
    List<String> attributeNames = entityType.getAttributeNames();
    for (String attributeName : attributeNames) {
        I_Type attributeType = entityType.getAttributeType(attributeName);
        I_EntityRenderer renderer = m_widgetService.getRendererForAttribute(attributeName, attributeType);
        Element label = DOM.createDiv();
        label.setInnerText(m_widgetService.getAttributeLabel(attributeName));
        label.addClassName(LABEL_CLASS);
        label.setTitle(m_widgetService.getAttributeHelp(attributeName));
        result.appendChild(label);
        renderer.render(entity, attributeName, result, entityType.getAttributeMinOccurrence(attributeName),
                entityType.getAttributeMaxOccurrence(attributeName));
    }
    context.appendChild(result);
}

From source file:com.extjs.gxt.ui.client.widget.DatePicker.java

License:sencha.com license

private 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);

    if (t == today) {
        fly(cell).addStyleName("x-date-today");
        if (GXT.isAriaEnabled()) {
            cell.setAttribute("title", "Today");
        }/*  w  ww  .  j  av  a2  s .  c  o m*/
    }
    if (t == sel) {
        fly(cell).addStyleName("x-date-selected");
        if (GXT.isAriaEnabled()) {
            cell.getFirstChildElement().setAttribute("aria-selected", "true");
            if (isAttached()) {
                El.fly(cell.getFirstChildElement()).focus();
            }
        }
    } else {
        fly(cell).removeStyleName("x-date-selected");
        if (GXT.isAriaEnabled()) {
            cell.getFirstChildElement().setAttribute("aria-selected", "false");
        }
    }
    if (t > max || t < min) {
        fly(cell).addStyleName("x-date-disabled");
        if (t > max)
            cell.setTitle(messages.getMaxText());
        else
            cell.setTitle(messages.getMinText());
    }
}

From source file:org.bonitasoft.web.toolkit.client.ui.component.form.entry.FieldsetCheckbox.java

License:Open Source License

@Override
protected Element makeLabel() {
    final Element legend = DOM.createElement("legend");
    legend.setTitle(this.tooltip);

    final String uid = Document.get().createUniqueId();

    this.inputElement = createInput();
    this.inputElement.setId(uid);
    this.inputElement.setAttribute("value", this.value);

    if (this.checked) {
        this.inputElement.setAttribute("checked", "checked");
    }/*from ww w.j  a  v  a 2 s  .c  o  m*/

    final Element label = DOM.createLabel();
    label.setInnerText(this.label);
    label.setAttribute("for", uid);

    legend.appendChild(this.inputElement);
    legend.appendChild(label);

    return legend;
}

From source file:org.bonitasoft.web.toolkit.client.ui.component.form.entry.FormEntry.java

License:Open Source License

@Override
protected Element makeElement() {
    Boolean isMandatory = false;// w w  w.  j  a v a 2 s  .  c  o  m
    final Element entry = DOM.createDiv();
    entry.addClassName("formentry");
    entry.addClassName(getJsId().toString("formentry").toLowerCase());

    this.labelElement = DOM.createDiv();
    this.labelElement.addClassName("label");

    for (final Validator validator : getValidators()) {
        if (validator instanceof MandatoryValidator) {
            isMandatory = true;
            entry.addClassName("mandatory");
            break;
        }
    }

    final Element label = DOM.createLabel();
    label.setInnerText(this.label);
    label.setTitle(this.tooltip);
    label.setAttribute("for", this.uid.toLowerCase());

    if (isMandatory) {
        final Element mandatorySpan = DOM.createSpan();
        mandatorySpan.addClassName("mandatoryflag");
        mandatorySpan.setInnerText("*");
        label.appendChild(mandatorySpan);
    }

    this.labelElement.appendChild(label);

    if (this.description != null) {
        final Element description = DOM.createDiv();
        description.addClassName("description");
        description.setInnerText(this.description);
        this.labelElement.appendChild(description);
    }

    entry.appendChild(this.labelElement);

    final Element body = DOM.createDiv();
    body.addClassName("input");

    final Element input = makeInput(this.uid);

    if (this.inputElement == null) {
        this.inputElement = input;
    }

    body.appendChild(input);

    if (this.example != null) {
        final Element example = DOM.createDiv();
        example.addClassName("example");
        example.setInnerText(this.example);
        body.appendChild(example);
    }

    entry.appendChild(body);

    return entry;
}

From source file:org.kuali.student.common.ui.client.widgets.field.layout.element.AbbrPanel.java

License:Educational Community License

public AbbrPanel(String title, String className, String text) {
    Element abbr = DOM.createElement("abbr");
    abbr.setTitle(title);
    abbr.setClassName(className);/*from w  w w  . ja  v a  2s  .co m*/
    abbr.setInnerText(text);
    this.setElement(abbr);

}

From source file:org.kuali.student.common.ui.client.widgets.field.layout.element.AbbrPanel.java

License:Educational Community License

public AbbrPanel(String title, String className) {
    Element abbr = DOM.createElement("abbr");
    abbr.setTitle(title);
    abbr.setClassName(className);//from  w ww . ja  v a2 s . c om
    this.setElement(abbr);

}

From source file:org.pentaho.gwt.widgets.client.table.BaseTable.java

License:Open Source License

/**
 * Populates the data grid with data then sets the column widths.
 */// ww  w  .  ja  va2 s .  c  om
protected void populateDataGrid(int[] columnWidths, Object[][] rowAndColumnValues) {
    while (dataGrid.getRowCount() > 0) {
        dataGrid.removeRow(0);
    }
    // Set table values
    //
    dataGrid.resizeRows(rowAndColumnValues.length);
    for (int i = 0; i < rowAndColumnValues.length; i++) {
        // For even rows, add background highlighting
        if (i % 2 != 0) {
            dataGrid.getRowFormatter().setStyleName(i, "cellTableOddRow");
        }
        for (int j = 0; j < rowAndColumnValues[i].length; j++) {
            Object value = rowAndColumnValues[i][j];

            if (value != null) {
                if (value instanceof String) {
                    dataGrid.setHTML(i, j, value.toString());
                } else if (value instanceof Widget) {
                    dataGrid.setWidget(i, j, (Widget) value);
                } else {
                    System.err.print(MSGS.invalidDataGridTypeSet());
                    Window.alert(MSGS.invalidDataGridTypeSet());
                    return;
                }
            }
        }
    }

    // Set column widths
    if (columnWidths != null) {
        for (int i = 0; i < columnWidths.length; i++) {
            if (columnWidths[i] >= 0) {
                dataGrid.setColumnWidth(i, columnWidths[i]);
                scrollTable.setColumnWidth(i, columnWidths[i]);
            }
        }
    }

    // Set cell styles/tooltip for data grid cells
    final HTMLTable.CellFormatter cellFormatter = dataGrid.getCellFormatter();
    objectElementMap = new HashMap<Element, Object>();
    Object[] objectArray = null;
    if (objects != null) {
        objectArray = objects.toArray();
    }

    for (int i = 0; i < rowAndColumnValues.length; i++) {
        Object object = null;
        if (objectArray != null) {
            object = objectArray[i];
        }
        for (int j = 0; j < rowAndColumnValues[i].length; j++) {
            Object value = rowAndColumnValues[i][j];
            Element element = null;
            try {
                element = cellFormatter.getElement(i, j);
            } catch (Exception e) {
                //ignore
            }

            if (element != null) {

                if (value != null && value instanceof String && !value.equals("&nbsp;")) { //$NON-NLS-1$
                    element.setTitle(value.toString());
                }
            }
            if (object != null) {
                objectElementMap.put(element, object);
            }
        }
    }
    baseTableColumnSorter.setObjectMap(objectElementMap);
    scrollTable.redraw();
}

From source file:org.spiffyui.spsample.client.WidgetsPanel.java

License:Apache License

/**
 * Create the refresh anchor and add it to the sliding grid
 *//*from  w  w w . j  a v a  2 s . c  o m*/
private void addRefreshAnchor() {
    /*
     * Add a refresh anchor to our page
     */
    m_refresh = new RefreshAnchor("Widgets_refreshAnchor");
    HTMLPanel p = addToSlidingGrid(m_refresh, "WidgetsRefreshAnchor", Index.getStrings().refreshAnchor(),
            STRINGS.RefreshAnchor_html(), TALL);
    Element h3 = p.getElementById("WID_WidgetsRefreshAnchor");
    //Set the title so that the TOC's list item for this isn't too long
    h3.setTitle(Index.getStrings().refreshAnchorConfirmDialog_toc());

    m_refresh.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            m_refresh.setLoading(true);
            m_dlg.center();
            m_dlg.show();
            event.preventDefault();
        }

    });
}