Example usage for com.vaadin.shared.communication UidlValue getValue

List of usage examples for com.vaadin.shared.communication UidlValue getValue

Introduction

In this page you can find the example usage for com.vaadin.shared.communication UidlValue getValue.

Prototype

public Object getValue() 

Source Link

Usage

From source file:org.semanticsoft.vaaclipse.app.servlet.VaaclipseServerRpcHandler.java

License:Open Source License

private LegacyChangeVariablesInvocation parseLegacyChangeVariablesInvocation(String connectorId,
        String interfaceName, String methodName, LegacyChangeVariablesInvocation previousInvocation,
        JSONArray parametersJson, ConnectorTracker connectorTracker) throws JSONException {
    if (parametersJson.length() != 2) {
        throw new JSONException("Invalid parameters in legacy change variables call. Expected 2, was "
                + parametersJson.length());
    }//w  ww .ja va 2s.c o  m
    String variableName = parametersJson.getString(0);
    UidlValue uidlValue = (UidlValue) JsonCodec.decodeInternalType(UidlValue.class, true, parametersJson.get(1),
            connectorTracker);

    Object value = uidlValue.getValue();

    if (previousInvocation != null && previousInvocation.getConnectorId().equals(connectorId)) {
        previousInvocation.setVariableChange(variableName, value);
        return null;
    } else {
        return new LegacyChangeVariablesInvocation(connectorId, variableName, value);
    }
}

From source file:org.vaadin.alump.offlinebuilder.client.offline.JsonEncoder.java

License:Open Source License

private static JSONValue encodeVariableChange(UidlValue uidlValue, ApplicationConnection connection) {
    Object value = uidlValue.getValue();

    JSONArray jsonArray = new JSONArray();
    String transportType = getTransportType(value);
    if (transportType == null) {
        /*/*from ww  w . j  a  v  a 2 s  . c  o m*/
         * This should not happen unless you try to send an unsupported type
         * in a legacy variable change from the client to the server.
         */
        String valueType = null;
        if (value != null) {
            valueType = value.getClass().getName();
        }
        throw new IllegalArgumentException("Cannot encode object of type " + valueType);
    }
    jsonArray.set(0, new JSONString(transportType));
    jsonArray.set(1, encode(value, null, connection));

    return jsonArray;
}