Package com.ponysdk.sample.client.page.addon

Source Code of com.ponysdk.sample.client.page.addon.BasicAddOn

package com.ponysdk.sample.client.page.addon;

import org.json.JSONException;
import org.json.JSONObject;

import com.ponysdk.ui.server.addon.DefaultAddOn;
import com.ponysdk.ui.server.addon.JSONBuilder;

public class BasicAddOn extends DefaultAddOn {

    public BasicAddOn() {}

    public void send(final String m) {
        update("message", "i received #" + m);
    }

    @Override
    protected void restate(final JSONObject jsonObject) throws JSONException {
        final String msg = jsonObject.getString("message");

        System.out.println("Received message: " + msg);

        final JSONBuilder jso = new JSONBuilder();
        jso.put("message", "i received #" + msg);
        jso.put("option", "an option");
        jso.addChild("child1").put("submsg1", "here").put("submsg2", "there");

        update(jso.build());
    }

}
TOP

Related Classes of com.ponysdk.sample.client.page.addon.BasicAddOn

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.