Example usage for com.vaadin.client UIDL getDoubleAttribute

List of usage examples for com.vaadin.client UIDL getDoubleAttribute

Introduction

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

Prototype

public double getDoubleAttribute(String name) 

Source Link

Document

Gets the named attribute as a double.

Usage

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

License:Apache License

private void addStyleForEvent(UIDL event, int rowNumber, int col) {
    String id = event.getStringAttribute("id");

    // style given by the server component
    if (event.hasAttribute("style")) {
        String[] styles = event.getStringArrayAttribute("style");
        for (String s : styles) {
            formatter.addStyleName(rowNumber, col, s);
        }//from w w  w.  j  a va2  s  .com
    } else {
        formatter.addStyleName(rowNumber, col, "single_event");
    }

    // fill highlight map
    if (event.hasAttribute("highlight")) {
        highlighted.put(id, event.getStringArrayAttribute("highlight"));
    }

    if (event.hasAttribute("startTime")) {
        formatter.addStyleName(rowNumber, col, "speaker");
        startTimes.put(new Position(rowNumber, col), event.getDoubleAttribute("startTime"));
        if (event.hasAttribute("endTime")) {
            endTimes.put(new Position(rowNumber, col), event.getDoubleAttribute("endTime"));
        }
    }

    if (event.hasAttribute("openPDF")) {
        String number = event.getStringAttribute("openPDF");
        formatter.addStyleName(rowNumber, col, "pdf");
        pdfPageNumbers.put(new Position(rowNumber, col), number);
    }
}

From source file:org.vaadin.ui.client.numberfield.NumberFieldConnector.java

License:Apache License

private void processAttributesFromServer(UIDL uidl) {
    if (uidl.hasAttribute(Constants.ATTRIBUTE_ALLOW_NEGATIVES)) {
        getWidget().attributes//w  w  w  .  j av a2 s .  com
                .setNegativeAllowed(uidl.getBooleanAttribute(Constants.ATTRIBUTE_ALLOW_NEGATIVES));
    }

    if (uidl.hasAttribute(Constants.ATTRIBUTE_DECIMAL_PRECISION)) {
        getWidget().attributes.setDecimalPrecision(uidl.getIntAttribute(Constants.ATTRIBUTE_DECIMAL_PRECISION));
    }

    if (uidl.hasAttribute(Constants.ATTRIBUTE_MIN_VALUE)) {
        getWidget().attributes.setMinValue(uidl.getDoubleAttribute(Constants.ATTRIBUTE_MIN_VALUE));
    }

    if (uidl.hasAttribute(Constants.ATTRIBUTE_MAX_VALUE)) {
        getWidget().attributes.setMaxValue(uidl.getDoubleAttribute(Constants.ATTRIBUTE_MAX_VALUE));
    }

    if (uidl.hasAttribute(Constants.ATTRIBUTE_ALLOW_DECIMALS)) {
        getWidget().attributes.setDecimalAllowed(uidl.getBooleanAttribute(Constants.ATTRIBUTE_ALLOW_DECIMALS));
    }

    if (uidl.hasAttribute(Constants.ATTRIBUTE_DECIMAL_SEPARATOR)) {
        getWidget().attributes
                .setDecimalSeparator((char) uidl.getIntAttribute(Constants.ATTRIBUTE_DECIMAL_SEPARATOR));
    }

    if (uidl.hasAttribute(Constants.ATTRIBUTE_USE_GROUPING)) {
        getWidget().attributes.setGroupingUsed(uidl.getBooleanAttribute(Constants.ATTRIBUTE_USE_GROUPING));
    }

    if (uidl.hasAttribute(Constants.ATTRIBUTE_GROUPING_SEPARATOR)) {
        getWidget().attributes
                .setGroupingSeparator((char) uidl.getIntAttribute(Constants.ATTRIBUTE_GROUPING_SEPARATOR));
    }

    if (uidl.hasAttribute(Constants.ATTRIBUTE_SERVER_FORMATTED_VALUE)) {
        getWidget().setValue(uidl.getStringAttribute(Constants.ATTRIBUTE_SERVER_FORMATTED_VALUE));
    }
}