Package com.ponysdk.ui.terminal.instruction

Examples of com.ponysdk.ui.terminal.instruction.PTInstruction


        final String scriptToEval = update.getString(PROPERTY.EVAL);
        try {
            final Object result = eval(scriptToEval);

            if (update.containsKey(PROPERTY.CALLBACK)) {
                final PTInstruction eventInstruction = new PTInstruction();
                eventInstruction.setObjectID(update.getObjectID());
                eventInstruction.put(TYPE.KEY, TYPE.KEY_.EVENT);
                eventInstruction.put(PROPERTY.ID, update.getLong(PROPERTY.ID));
                eventInstruction.put(PROPERTY.RESULT, result == null ? "" : result.toString());
                uiService.sendDataToServer(eventInstruction);
            }
        } catch (final Throwable e) {
            if (update.containsKey(PROPERTY.CALLBACK)) {
                final PTInstruction eventInstruction = new PTInstruction();
                eventInstruction.setObjectID(update.getObjectID());
                eventInstruction.put(TYPE.KEY, TYPE.KEY_.EVENT);
                eventInstruction.put(PROPERTY.ID, update.getLong(PROPERTY.ID));
                eventInstruction.put(PROPERTY.ERROR_MSG, e.getMessage());
                uiService.sendDataToServer(eventInstruction);
            }
        }
    }
View Full Code Here


        if (addHandler.getString(HANDLER.KEY).equals(HANDLER.KEY_.CHANGE_HANDLER)) {
            uiObject.addChangeHandler(new ChangeHandler() {

                @Override
                public void onChange(final ChangeEvent event) {
                    final PTInstruction eventInstruction = new PTInstruction();
                    eventInstruction.setObjectID(addHandler.getObjectID());
                    eventInstruction.put(HANDLER.KEY, HANDLER.KEY_.CHANGE_HANDLER);
                    uiService.sendDataToServer(eventInstruction);
                }
            });
        } else {
            super.addHandler(addHandler, uiService);
View Full Code Here

        @Override
        public boolean execute() {

            if (cancelled) return false;

            final PTInstruction instruction = new PTInstruction();
            instruction.setObjectID(schedulerID);
            instruction.put(TYPE.KEY, TYPE.KEY_.EVENT);
            instruction.put(HANDLER.KEY, HANDLER.KEY_.SCHEDULER);
            instruction.put(PROPERTY.ID, commandID);
            instruction.put(PROPERTY.FIXRATE, delay);

            uiService.sendDataToServer(instruction);

            return !hasCommunicationError;
        }
View Full Code Here

        @Override
        public boolean execute() {

            if (cancelled) return false;

            final PTInstruction instruction = new PTInstruction();
            instruction.setObjectID(schedulerID);
            instruction.put(TYPE.KEY, TYPE.KEY_.EVENT);
            instruction.put(HANDLER.KEY, HANDLER.KEY_.SCHEDULER);
            instruction.put(PROPERTY.ID, commandID);
            instruction.put(PROPERTY.FIXDELAY, delay);

            uiService.sendDataToServer(instruction);

            return false;
        }
View Full Code Here

    private void addHandlers(final PTInstruction create, final UIService uiService) {
        uiObject.addCloseHandler(new CloseHandler<DisclosurePanel>() {

            @Override
            public void onClose(final CloseEvent<DisclosurePanel> event) {
                final PTInstruction instruction = new PTInstruction();
                instruction.setObjectID(create.getObjectID());
                instruction.put(TYPE.KEY, TYPE.KEY_.EVENT);
                instruction.put(HANDLER.KEY, HANDLER.KEY_.CLOSE_HANDLER);

                uiService.sendDataToServer(instruction);
            }
        });

        uiObject.addOpenHandler(new OpenHandler<DisclosurePanel>() {

            @Override
            public void onOpen(final OpenEvent<DisclosurePanel> event) {
                final PTInstruction instruction = new PTInstruction();
                instruction.setObjectID(create.getObjectID());
                instruction.put(TYPE.KEY, TYPE.KEY_.EVENT);
                instruction.put(HANDLER.KEY, HANDLER.KEY_.OPEN_HANDLER);

                uiService.sendDataToServer(instruction);
            }
        });
    }
View Full Code Here

        wrappedFormPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {

            @Override
            public void onSubmitComplete(final SubmitCompleteEvent event) {
                final PTInstruction eventInstruction = new PTInstruction();
                eventInstruction.setObjectID(create.getObjectID());
                eventInstruction.put(TYPE.KEY, TYPE.KEY_.EVENT);
                eventInstruction.put(HANDLER.KEY, HANDLER.KEY_.SUBMIT_COMPLETE_HANDLER);
                uiService.sendDataToServer(eventInstruction);
            }
        });
    }
View Full Code Here

        if (HANDLER.KEY_.CHANGE_HANDLER.equals(handler)) {
            fileUpload.addChangeHandler(new ChangeHandler() {

                @Override
                public void onChange(final ChangeEvent event) {
                    final PTInstruction eventInstruction = new PTInstruction();
                    eventInstruction.setObjectID(addHandler.getObjectID());
                    eventInstruction.put(TYPE.KEY, TYPE.KEY_.EVENT);
                    eventInstruction.put(HANDLER.KEY, HANDLER.KEY_.CHANGE_HANDLER);
                    eventInstruction.put(PROPERTY.FILE_NAME, fileUpload.getFilename());
                    uiService.sendDataToServer(eventInstruction);
                }
            });
        } else if (HANDLER.KEY_.STREAM_REQUEST_HANDLER.equals(handler)) {
            final String action = GWT.getHostPageBaseURL() + "stream?" + "ponySessionID=" + UIBuilder.sessionID + "&" + PROPERTY.STREAM_REQUEST_ID + "=" + addHandler.getLong(PROPERTY.STREAM_REQUEST_ID);
View Full Code Here

        if (HANDLER.KEY_.SELECTION_HANDLER.equals(handler)) {
            uiObject.addSelectionHandler(new SelectionHandler<Integer>() {

                @Override
                public void onSelection(final SelectionEvent<Integer> event) {
                    final PTInstruction eventInstruction = new PTInstruction();
                    eventInstruction.setObjectID(addHandler.getObjectID());
                    eventInstruction.put(TYPE.KEY, TYPE.KEY_.EVENT);
                    eventInstruction.put(HANDLER.KEY, HANDLER.KEY_.SELECTION_HANDLER);
                    eventInstruction.put(PROPERTY.INDEX, event.getSelectedItem());
                    uiService.sendDataToServer(eventInstruction);
                }
            });
        } else if (HANDLER.KEY_.BEFORE_SELECTION_HANDLER.equals(handler)) {
            uiObject.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {

                @Override
                public void onBeforeSelection(final BeforeSelectionEvent<Integer> event) {
                    final PTInstruction eventInstruction = new PTInstruction();
                    eventInstruction.setObjectID(addHandler.getObjectID());
                    eventInstruction.put(TYPE.KEY, TYPE.KEY_.EVENT);
                    eventInstruction.put(HANDLER.KEY, HANDLER.KEY_.BEFORE_SELECTION_HANDLER);
                    eventInstruction.put(PROPERTY.INDEX, event.getItem());
                    uiService.sendDataToServer(eventInstruction);
                }
            });
        } else {
            super.addHandler(addHandler, uiService);
View Full Code Here

            }
        }, 2000);
    }

    public void onClose() {
        final PTInstruction instruction = new PTInstruction();
        instruction.setObjectID(id);
        instruction.put(TYPE.KEY, TYPE.KEY_.EVENT);
        instruction.put(HANDLER.KEY, HANDLER.KEY_.CLOSE_HANDLER);
        uiService.sendDataToServer(instruction);
    }
View Full Code Here

                @Override
                public void onSelection(final SelectionEvent<TreeItem> event) {
                    final PTObject ptObject = uiService.getPTObject(event.getSelectedItem());

                    final PTInstruction eventInstruction = new PTInstruction();
                    eventInstruction.setObjectID(addHandler.getObjectID());
                    eventInstruction.put(TYPE.KEY_.EVENT, TYPE.KEY_.EVENT);
                    eventInstruction.put(HANDLER.KEY, HANDLER.KEY_.SELECTION_HANDLER);
                    eventInstruction.put(PROPERTY.WIDGET, ptObject.getObjectID());
                    uiService.sendDataToServer(eventInstruction);
                }
            });
        } else {
            super.addHandler(addHandler, uiService);
View Full Code Here

TOP

Related Classes of com.ponysdk.ui.terminal.instruction.PTInstruction

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.