Package autotest.common

Examples of autotest.common.SimpleCallback


        headerFields.populateFromList("all_fields");
        notifyOnFieldsChanged();

        parameterizedFieldPresenter.bindDisplay(parameterizedFieldDisplay);
        parameterizedFieldPresenter.setListener(new SimpleCallback() {
            @Override
            public void doCallback(Object source) {
                notifyOnFieldsChanged();
            }
        });
View Full Code Here


        if (event.getSource() == cancelButton) {
            return;
        }

        if (submitButton.getText().equals(ADD_TEXT)) {
            SimpleCallback doAdd = new SimpleCallback() {
                public void doCallback(Object source) {
                    addOrRemoveLabel((String) source, true);
                }
            };

            if (stack.getSelectedIndex() == STACK_CREATE) {
                addLabel(newLabelName.getText(), doAdd);
            } else {
                doAdd.doCallback(getSelectedLabel());
            }
        } else {
            assert (submitButton.getText().equals(REMOVE_TEXT));
            addOrRemoveLabel(getSelectedLabel(), false);
        }
View Full Code Here

        reverifyButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                JSONObject params = new JSONObject();

                params.put("id", currentHostObject.get("id"));
                AfeUtils.callReverify(params, new SimpleCallback() {
                    public void doCallback(Object source) {
                       refresh();
                    }
                }, "Host " + hostname);
            }
        });
        buttons.add(reverifyButton);

        reinstallButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                Set<JSONObject> set = new JSONObjectSet<JSONObject>();
                set.add(currentHostObject);
                AfeUtils.scheduleReinstall(set, hostname, jobCreateListener);
            }
        });
        buttons.add(reinstallButton);

        reserveButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                JSONArray hostIds = new JSONArray();
                hostIds.set(0, currentHostObject.get("id"));
                AfeUtils.handleHostsReservations(hostIds, true, "Host reserved", new SimpleCallback() {
                    public void doCallback(Object source) {
                        refresh();
                    }
                });
            }
        });
        buttons.add(reserveButton);

        releaseButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                JSONArray hostIds = new JSONArray();
                hostIds.set(0, currentHostObject.get("id"));
                AfeUtils.handleHostsReservations(hostIds, false, "Host released", new SimpleCallback() {
                    public void doCallback(Object source) {
                        refresh();
                    }
                });
            }
View Full Code Here

        });
        return menu;
    }

    private void abortSelectedQueueEntries() {
        AfeUtils.abortHostQueueEntries(selectionManager.getSelectedObjects(), new SimpleCallback() {
            public void doCallback(Object source) {
                refresh();
            }
        });
    }
View Full Code Here

    private void changeLock(final boolean lock) {
        JSONArray hostIds = new JSONArray();
        hostIds.set(0, currentHostObject.get("id"));

        AfeUtils.changeHostLocks(hostIds, lock, "Host " + hostname, new SimpleCallback() {
            public void doCallback(Object source) {
                refresh();
            }
        });
    }
View Full Code Here

     * Attach a new paginator to this table.
     */
    public void attachPaginator(Paginator paginator) {
        assert rowsPerPage != null;
        paginators.add(paginator);
        paginator.addCallback(new SimpleCallback() {
            public void doCallback(Object source) {
                setPaginatorStart(((Paginator) source).getStart());
                fetchPage();
            }
        });
View Full Code Here

    // FILTERING

    public void addFilter(Filter filter) {
        filters.add(filter);
        filter.addCallback(new SimpleCallback() {
            public void doCallback(Object source) {
                setPaginatorStart(0);
                refresh();
            }
        });
View Full Code Here

                DOM.eventCancelBubble(DOM.eventGetCurrentEvent(), true);

                if (display.getEditControlButton().getText().equals(EDIT_CONTROL_STRING)) {
                    disableInputs();
                    display.getEditControlButton().setEnabled(false);
                    SimpleCallback onGotControlFile = new SimpleCallback() {
                        public void doCallback(Object source) {
                            openControlFileEditor();
                        }
                    };
                    SimpleCallback onControlFileError = new SimpleCallback() {
                        public void doCallback(Object source) {
                            setInputsEnabled();
                            display.getEditControlButton().setEnabled(true);
                        }
                    };
View Full Code Here

        }

        // disallow accidentally clicking submit twice
        display.getSubmitJobButton().setEnabled(false);

        final SimpleCallback doSubmit = new SimpleCallback() {
            public void doCallback(Object source) {
                JSONObject args = new JSONObject();
                args.put("name", new JSONString(display.getJobName().getText()));
                String priority = display.getPriorityList().getSelectedName();
                args.put("priority", new JSONString(priority));
                args.put("control_file", new JSONString(display.getControlFile().getText()));
                args.put("control_type",
                         new JSONString(controlTypeSelect.getControlType()));
                args.put("synch_count", synchCount);
                args.put("timeout", new JSONNumber(timeoutValue));
                args.put("max_runtime_hrs", new JSONNumber(maxRuntimeValue));
                args.put("email_list", new JSONString(display.getEmailList().getText()));
                args.put("run_verify", JSONBoolean.getInstance(
                        !display.getSkipVerify().getValue()));
                args.put("is_template", JSONBoolean.getInstance(isTemplate));
                args.put("dependencies", getSelectedDependencies());
                args.put("reboot_before", new JSONString(rebootBefore.getSelectedChoice()));
                args.put("reboot_after", new JSONString(rebootAfter.getSelectedChoice()));
                args.put("parse_failed_repair",
                         JSONBoolean.getInstance(display.getParseFailedRepair().getValue()));
                args.put("hostless", JSONBoolean.getInstance(display.getHostless().getValue()));
                args.put("reserve_hosts", JSONBoolean.getInstance(display.getReserveHosts().getValue()));

                if (staticData.getData("drone_sets_enabled").isBoolean().booleanValue()) {
                    args.put("drone_set", new JSONString(display.getDroneSet().getSelectedName()));
                }

                HostSelector.HostSelection hosts = hostSelector.getSelectedHosts();
                args.put("hosts", Utils.stringsToJSON(hosts.hosts));
                args.put("profiles", Utils.stringsToJSON(hosts.profiles));
                args.put("meta_hosts", Utils.stringsToJSON(hosts.metaHosts));
                args.put("meta_host_profiles", Utils.stringsToJSON(hosts.metaHostProfiles));
                args.put("one_time_hosts",
                    Utils.stringsToJSON(hosts.oneTimeHosts));

                rpcProxy.rpcCall("create_job", args, new JsonRpcCallback() {
                    @Override
                    public void onSuccess(JSONValue result) {
                        int id = (int) result.isNumber().doubleValue();
                        NotifyManager.getInstance().showMessage(
                                    "Job " + Integer.toString(id) + " created");
                        reset();
                        if (listener != null) {
                            listener.onJobCreated(id);
                        }
                        display.getSubmitJobButton().setEnabled(true);
                    }

                    @Override
                    public void onError(JSONObject errorObject) {
                        super.onError(errorObject);
                        display.getSubmitJobButton().setEnabled(true);
                    }
                });
            }
        };

        // ensure control file is ready for submission
        if (!controlReadyForSubmit) {
            generateControlFile(true, doSubmit, new SimpleCallback() {
                public void doCallback(Object source) {
                    display.getSubmitJobButton().setEnabled(true);
                }
            });
        } else {
            doSubmit.doCallback(this);
        }
    }
View Full Code Here

            } else {
                asynchronousEntryIds.set(asynchronousEntryIds.size(), entry.get("id"));
            }
        }

        SimpleCallback abortAsynchronousEntries = new SimpleCallback() {
            public void doCallback(Object source) {
                JSONObject params = new JSONObject();
                params.put("id__in", asynchronousEntryIds);
                AfeUtils.callAbort(params, onSuccess);
            }
        };

        if (synchronousEntries.size() == 0) {
            abortAsynchronousEntries.doCallback(null);
        } else {
            AbortSynchronousDialog dialog = new AbortSynchronousDialog(
                abortAsynchronousEntries, synchronousEntries, asynchronousEntryIds.size() != 0);
            dialog.center();
        }
View Full Code Here

TOP

Related Classes of autotest.common.SimpleCallback

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.