Package com.ponysdk.ui.terminal.ui

Examples of com.ponysdk.ui.terminal.ui.PTObject


                }
            };

            Scheduler.get().scheduleDeferred(command);
        } else if (TYPE.KEY_.CREATE.equals(type)) {
            PTObject ptObject;
            final boolean isAddon = instruction.containsKey("addOnSignature");
            if (isAddon) {
                final String addOnSignature = instruction.getString("addOnSignature");
                final AddonFactory addonFactory = addonByKey.get(addOnSignature);
                if (addonFactory == null) { throw new Exception("UIBuilder: AddOn factory not found for signature: " + addOnSignature + ", available: " + addonByKey.keySet()); }

                ptObject = addonFactory.newAddon();
                if (ptObject == null) { throw new Exception("UIBuilder: Failed to instanciate an Addon of type: " + addOnSignature); }
                ptObject.create(instruction, this);
            } else {
                ptObject = uiFactory.newUIObject(this, instruction);
                ptObject.create(instruction, this);
            }

            objectByID.put(instruction.getObjectID(), ptObject);

        } else if (TYPE.KEY_.ADD.equals(type)) {
            final PTObject uiObject = objectByID.get(instruction.getParentID());
            if (uiObject == null) {
                log.info("Cannot add object to an garbaged parent object #" + instruction.getObjectID());
                return;
            }
            uiObject.add(instruction, this);

        } else if (TYPE.KEY_.ADD_HANDLER.equals(type)) {
            final String handler = instruction.getString(HANDLER.KEY);
            if (HANDLER.KEY_.STREAM_REQUEST_HANDLER.equals(handler)) {
                new PTStreamResource().addHandler(instruction, this);
            } else {
                final PTObject uiObject = objectByID.get(instruction.getObjectID());
                uiObject.addHandler(instruction, this);
            }
        } else if (TYPE.KEY_.REMOVE_HANDLER.equals(type)) {
            final PTObject uiObject = objectByID.get(instruction.getObjectID());
            uiObject.removeHandler(instruction, this);

        } else if (TYPE.KEY_.REMOVE.equals(type)) {
            PTObject ptObject;
            if (instruction.getParentID() == -1) ptObject = objectByID.get(instruction.getObjectID());
            else {
                ptObject = objectByID.get(instruction.getParentID());
            }
            if (ptObject == null) {
                log.info("Cannot remove an garbaged object #" + instruction.getObjectID());
                return;
            }
            ptObject.remove(instruction, this);
        } else if (TYPE.KEY_.GC.equals(type)) {
            final PTObject unRegisterObject = unRegisterObject(instruction.getObjectID());
            if (unRegisterObject == null) {
                log.info("Cannot GC an garbaged object #" + instruction.getObjectID());
                return;
            }
            unRegisterObject.gc(this);
        } else if (TYPE.KEY_.UPDATE.equals(type)) {
            final PTObject ptObject = objectByID.get(instruction.getObjectID());
            if (ptObject == null) {
                log.info("Cannot update an garbaged object #" + instruction.getObjectID());
                return;
            }
            ptObject.update(instruction, this);
        } else if (TYPE.KEY_.HISTORY.equals(type)) {
            final String oldToken = History.getToken();

            String token = null;
View Full Code Here


        lastReceived = receivedSeqNum;
    }

    @Override
    public PTObject unRegisterObject(final Long objectId) {
        final PTObject ptObject = objectByID.remove(objectId);
        final UIObject uiObject = widgetIDByObjectID.remove(objectId);
        if (uiObject != null) {
            objectIDByWidget.remove(uiObject);
        }
        return ptObject;
View Full Code Here

TOP

Related Classes of com.ponysdk.ui.terminal.ui.PTObject

Copyright © 2018 www.massapicom. 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.