Example usage for com.google.gwt.core.client.impl StringBuilderImpl toString

List of usage examples for com.google.gwt.core.client.impl StringBuilderImpl toString

Introduction

In this page you can find the example usage for com.google.gwt.core.client.impl StringBuilderImpl toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:org.geomajas.widget.featureinfo.client.action.toolbar.TooltipOnMouseoverListener.java

License:Open Source License

private void setTooltipData(Coordinate coordUsedForRetrieval, Map<String, List<Feature>> featureMap) {
    if (coordUsedForRetrieval.equals(worldPosition) && tooltip != null) {
        StringBuilderImpl sb = new StringBuilderImpl.ImplStringAppend();
        sb.append(CSS);//www.j  ava2s  .c o  m
        widest = 10;
        count = 0;

        for (Layer<?> layer : mapWidget.getMapModel().getLayers()) {
            if (featureMap.containsKey(layer.getId()) && useLayer(layer.getId())) {
                List<Feature> features = featureMap.get(layer.getId());
                if (features.size() > 0) {
                    if (useFeatureDetail) {
                        setTooltipDetailData(sb, layer, features);
                    } else {
                        setTooltipDefaultData(sb, layer, features);
                    }
                }
            }
        }

        int left = tooltip.getLeft();
        int top = tooltip.getTop();
        destroyTooltip();

        if (count > maxLabelCount) {
            writeTooMany(sb, count - maxLabelCount);
        } else if (count == 0 && showEmptyResults) {
            writeNone(sb);
        } else if (count == 0) {
            return;
        }

        Canvas content = new Canvas();
        content.setContents(sb.toString());
        int width = (int) (widest * 4.8) + 40;
        if (width < 150) {
            width = 150;
        }
        content.setWidth(width);
        content.setAutoHeight();
        content.setMargin(5);
        createTooltip(left, top, content);
    } // else - mouse moved between request and data retrieval
}