Example usage for com.vaadin.client TooltipInfo TooltipInfo

List of usage examples for com.vaadin.client TooltipInfo TooltipInfo

Introduction

In this page you can find the example usage for com.vaadin.client TooltipInfo TooltipInfo.

Prototype

public TooltipInfo(String tooltip) 

Source Link

Document

Constructs a new tooltip info instance.

Usage

From source file:com.eternach.client.RichOptionGroupWidget.java

License:Apache License

public TooltipInfo getTooltipInfo(final Element element) {
    Element lookupElement = element;
    while (lookupElement != getWidget().getElement()) {
        if (elementsToDescription.containsKey(lookupElement)) {
            return new TooltipInfo(elementsToDescription.get(lookupElement));
        }/* w w w  . java2  s  .  c  om*/
        lookupElement = lookupElement.getParentElement();
        VConsole.error(element.toString());
    }
    return null;
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.table.CubaScrollTableConnector.java

License:Apache License

@Override
public TooltipInfo getTooltipInfo(Element element) {
    if (getState().columnDescriptions != null) {
        Element targetHeaderElement = findCurrentOrParentTd(element);
        if (targetHeaderElement != null && targetHeaderElement.hasClassName("v-table-header-cell")) {
            // if column has description
            int childIndex = DOM.getChildIndex(targetHeaderElement.getParentElement(), targetHeaderElement);

            String columnKey = getWidget().tHead.getHeaderCell(childIndex).getColKey();

            if (columnKey != null) {
                String columnDescription = getState().columnDescriptions.get(columnKey);
                if (columnDescription != null && !columnDescription.isEmpty()) {
                    return new TooltipInfo(columnDescription);
                }/*  w  ww . j a v a  2  s . co  m*/
            }
        }
    }

    if (getState().aggregationDescriptions != null) {
        Element targetAggregatedElement = findCurrentOrParentTd(element);
        if (targetAggregatedElement != null && (targetAggregatedElement.hasClassName("v-table-aggregation-cell")
                || targetAggregatedElement.getFirstChildElement().hasClassName("v-table-footer-container"))) {
            int childIndex = DOM.getChildIndex(targetAggregatedElement.getParentElement(),
                    targetAggregatedElement);

            String columnKey = getWidget().tHead.getHeaderCell(childIndex).getColKey();
            if (columnKey != null) {
                String columnTooltip = getState().aggregationDescriptions.get(columnKey);
                if (columnTooltip != null && !columnTooltip.isEmpty()) {
                    return new TooltipInfo(columnTooltip);
                }
            }
        }
    }

    if (element != getWidget().getElement()) {
        Object node = WidgetUtil.findWidget(element,
                CubaScrollTableWidget.CubaScrollTableBody.CubaScrollTableRow.class);

        if (node != null) {
            CubaScrollTableWidget.CubaScrollTableBody.CubaScrollTableRow row = (CubaScrollTableWidget.CubaScrollTableBody.CubaScrollTableRow) node;
            return row.getTooltip(element);
        }
    }

    return super.getTooltipInfo(element);
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.treetable.CubaTreeTableConnector.java

License:Apache License

@Override
public TooltipInfo getTooltipInfo(Element element) {
    if (getState().columnDescriptions != null) {
        Element targetHeaderElement = findCurrentOrParentTd(element);
        if (targetHeaderElement != null) {
            // if column has description
            int childIndex = DOM.getChildIndex(targetHeaderElement.getParentElement(), targetHeaderElement);

            String columnKey = getWidget().tHead.getHeaderCell(childIndex).getColKey();

            if (columnKey != null) {
                String columnDescription = getState().columnDescriptions.get(columnKey);
                if (columnDescription != null && !columnDescription.isEmpty()) {
                    return new TooltipInfo(columnDescription);
                }/*  w  w  w  .  j a  v  a2 s . com*/
            }
        }
    }

    if (getState().aggregationDescriptions != null) {
        Element targetAggregatedElement = findCurrentOrParentTd(element);
        if (targetAggregatedElement != null && (targetAggregatedElement.hasClassName("v-table-aggregation-cell")
                || targetAggregatedElement.hasClassName("v-table-footer-container"))) {
            int childIndex = DOM.getChildIndex(targetAggregatedElement.getParentElement(),
                    targetAggregatedElement);

            String columnKey = getWidget().tHead.getHeaderCell(childIndex).getColKey();
            if (columnKey != null) {
                String columnTooltip = getState().aggregationDescriptions.get(columnKey);
                if (columnTooltip != null && !columnTooltip.isEmpty()) {
                    return new TooltipInfo(columnTooltip);
                }
            }
        }
    }

    if (element != getWidget().getElement()) {
        Object node = WidgetUtil.findWidget(element,
                CubaTreeTableWidget.CubaTreeTableBody.CubaTreeTableRow.class);

        if (node != null) {
            CubaTreeTableWidget.CubaTreeTableBody.CubaTreeTableRow row = (CubaTreeTableWidget.CubaTreeTableBody.CubaTreeTableRow) node;
            return row.getTooltip(element);
        }
    }

    return super.getTooltipInfo(element);
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.verticalmenu.CubaSideMenuConnector.java

License:Apache License

@Override
public TooltipInfo getTooltipInfo(Element element) {
    String tooltip = getWidget().getTooltip(element);
    if (tooltip != null) {
        return new TooltipInfo(tooltip);
    }/*from w w  w  .  ja  v a 2s.  co  m*/

    return super.getTooltipInfo(element);
}

From source file:org.opennms.features.topology.app.internal.gwt.client.TopologyComponentConnector.java

License:Open Source License

@Override
public TooltipInfo getTooltipInfo(Element element) {
    TooltipInfo tooltipInfo = null;//from  ww  w  .j  a v  a  2 s .  c o  m

    String className = getElementClassName(element);
    if (className == null) {
        // Don't try and find a tooltip
    } else if (className.equals("svgIconOverlay")) {
        GWTVertex vertex = getVertexForSelection(D3.d3().select(element));
        tooltipInfo = new TooltipInfo(vertex.getTooltipText());
    } else if (className.contains("edge")) {
        GWTEdge edge = getEdgeForSelection(D3.d3().select(element));
        tooltipInfo = new TooltipInfo(edge.getTooltipText());
    }

    return tooltipInfo;
}