Examples of BooleanCallback


Examples of com.smartgwt.client.util.BooleanCallback

        addTableAction(MSG.common_button_disable(), new AuthorizedTableAction(this, TableActionEnablement.ANY,
            Permission.MANAGE_SETTINGS) {
            public void executeAction(final ListGridRecord[] selections, Object actionValue) {
                ArrayList<String> selectedNames = getSelectedNames(selections);
                String message = MSG.view_admin_plugins_agentDisableConfirm(selectedNames.toString());
                SC.ask(message, new BooleanCallback() {
                    public void execute(Boolean confirmed) {
                        if (confirmed) {
                            int[] selectedIds = getSelectedIds(selections);
                            GWTServiceLookup.getPluginService().disableAgentPlugins(selectedIds,
                                new AsyncCallback<ArrayList<String>>() {
                                    @Override
                                    public void onSuccess(ArrayList<String> result) {
                                        Message msg = new Message(MSG.view_admin_plugins_disabledAgentPlugins(result
                                            .toString()), Severity.Info);
                                        CoreGUI.getMessageCenter().notify(msg);
                                        refresh();
                                    }

                                    @Override
                                    public void onFailure(Throwable caught) {
                                        CoreGUI.getErrorHandler().handleError(
                                            MSG.view_admin_plugins_disabledAgentPluginsFailure() + " "
                                                + caught.getMessage(), caught);
                                        refreshTableInfo();
                                    }
                                });
                        } else {
                            refreshTableInfo();
                        }
                    }
                });
            }
        });

        addTableAction(MSG.common_button_delete(), ButtonColor.RED, new AuthorizedTableAction(this, TableActionEnablement.ANY,
            Permission.MANAGE_SETTINGS) {
            public void executeAction(final ListGridRecord[] selections, Object actionValue) {
                ArrayList<String> selectedNames = getSelectedNames(selections);
                String message = MSG.view_admin_plugins_agentDeleteConfirm(selectedNames.toString());
                SC.ask(message, new BooleanCallback() {
                    public void execute(Boolean confirmed) {
                        if (confirmed) {
                            int[] selectedIds = getSelectedIds(selections);
                            GWTServiceLookup.getPluginService().deleteAgentPlugins(selectedIds,
                                new AsyncCallback<ArrayList<String>>() {
View Full Code Here

Examples of com.smartgwt.client.util.BooleanCallback

                boolean isPlatform = treeGrid.getTree().isRoot(parentNode);
                boolean isCheckboxMarked = treeGrid.isSelected(selectedNode);

                if (isPlatform) {
                    if (isCheckboxMarked) {
                        SC.ask(MSG.view_autoDiscoveryQ_confirmSelect(), new BooleanCallback() {
                            public void execute(Boolean confirmed) {
                                if (confirmed && !treeGrid.getTree().hasChildren(selectedNode)) {
                                    selectedNode.setAttribute("selectChildOnArrival", "true");
                                    treeGrid.getTree().loadChildren(selectedNode);
                                } else {
                                    if (confirmed) {
                                        selectAllPlatformChildren(selectedNode);
                                    }
                                    updateButtonEnablement(selectAllButton, deselectAllButton, importButton,
                                        ignoreButton, unignoreButton);
                                    selectionChangedHandlerDisabled = false;
                                }
                            }
                        });
                    } else {
                        selectedNode.setAttribute("autoSelectChildren", "false");
                        treeGrid.deselectRecords(treeGrid.getTree().getChildren(selectedNode));

                        // the immediate redraw below should not be necessary, but without it the deselected
                        // platform checkbox remained checked.
                        // treeGrid.redraw();
                        updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton,
                            unignoreButton);
                        selectionChangedHandlerDisabled = false;
                    }
                } else {
                    if (isCheckboxMarked) {
                        if (!treeGrid.isSelected(parentNode)) {
                            treeGrid.selectRecord(parentNode);
                        }
                    }
                    updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton,
                        unignoreButton);
                    selectionChangedHandlerDisabled = false;
                }
            }

        });

        treeGrid.addDataArrivedHandler(new DataArrivedHandler() {
            public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
                if (treeGrid != null) {
                    TreeNode parent = dataArrivedEvent.getParentNode();
                    if (!treeGrid.getTree().isRoot(parent)) {
                        // This flag can be set when we select a platform or as part of selectAll button handling. It
                        // means that we want to immediately select the child server nodes.
                        boolean selectChildOnArrival = Boolean.valueOf(parent.getAttribute("selectChildOnArrival"));
                        if (selectChildOnArrival) {
                            // data includes the platform, just get the descendant servers
                            treeGrid.selectRecords(treeGrid.getData().getDescendantLeaves());
                        }
                    }

                    // This logic is relevant to what we do in the selectAll button
                    boolean endDisable = true;
                    if (loadAllPlatforms) {
                        TreeNode rootNode = treeGrid.getTree().getRoot();
                        TreeNode[] platformNodes = treeGrid.getTree().getChildren(rootNode);

                        for (TreeNode platformNode : platformNodes) {
                            if (!treeGrid.getTree().isLoaded(platformNode)) {
                                endDisable = false;
                                break;
                            }
                        }
                    }
                    if (endDisable) {
                        updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton,
                            unignoreButton);
                        selectionChangedHandlerDisabled = false;
                    }

                    // NOTE: Due to a SmartGWT bug, the TreeGrid is not automatically redrawn upon data arrival, and
                    //       calling treeGrid.markForRedraw() doesn't redraw it either. The user can mouse over the grid
                    //       to cause it to redraw, but it is obviously not reasonable to expect that. So we must
                    //       explicitly call redraw() here.
                    treeGrid.redraw();
                }
            }
        });

        dataSource.addFailedFetchListener(new AsyncCallback() {

            // just in case we have a failure while fetching, try to make sure we don't lock up the view.
            public void onFailure(Throwable caught) {
                loadAllPlatforms = false;
                updateButtonEnablement(selectAllButton, deselectAllButton, importButton, ignoreButton, unignoreButton);
                selectionChangedHandlerDisabled = false;
            }

            public void onSuccess(Object result) {
                // never called
            }
        });

        selectAllButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                SC.ask(MSG.view_autoDiscoveryQ_confirmSelectAll(), new BooleanCallback() {
                    public void execute(Boolean selectChildServers) {

                        selectionChangedHandlerDisabled = true;
                        TreeNode rootNode = treeGrid.getTree().getRoot();
                        TreeNode[] platformNodes = treeGrid.getTree().getChildren(rootNode);
View Full Code Here

Examples of com.smartgwt.client.util.BooleanCallback

        addTableAction(MSG.common_button_disable(), new AuthorizedTableAction(this, TableActionEnablement.ANY,
            Permission.MANAGE_SETTINGS) {
            public void executeAction(final ListGridRecord[] selections, Object actionValue) {
                ArrayList<String> selectedNames = getSelectedNames(selections);
                String message = MSG.view_admin_plugins_serverDisableConfirm(selectedNames.toString());
                SC.ask(message, new BooleanCallback() {
                    public void execute(Boolean confirmed) {
                        if (confirmed) {
                            int[] selectedIds = getSelectedIds(selections);
                            GWTServiceLookup.getPluginService().disableServerPlugins(selectedIds,
                                new AsyncCallback<ArrayList<String>>() {
                                    @Override
                                    public void onSuccess(ArrayList<String> result) {
                                        Message msg = new Message(MSG.view_admin_plugins_disabledServerPlugins(result
                                            .toString()), Severity.Info);
                                        CoreGUI.getMessageCenter().notify(msg);
                                        refresh();
                                    }

                                    @Override
                                    public void onFailure(Throwable caught) {
                                        CoreGUI.getErrorHandler().handleError(
                                            MSG.view_admin_plugins_disabledServerPluginsFailure() + " "
                                                + caught.getMessage(), caught
                                        );
                                        refreshTableInfo();
                                    }
                                }
                            );
                        } else {
                            refreshTableInfo();
                        }
                    }
                });
            }
        });

        addTableAction(MSG.common_button_delete(), ButtonColor.RED, new AuthorizedTableAction(this, TableActionEnablement.ANY,
            Permission.MANAGE_SETTINGS) {
            public void executeAction(final ListGridRecord[] selections, Object actionValue) {
                ArrayList<String> selectedNames = getSelectedNames(selections);
                String message = MSG.view_admin_plugins_serverUndeployConfirm(selectedNames.toString());
                SC.ask(message, new BooleanCallback() {
                    public void execute(Boolean confirmed) {
                        if (confirmed) {
                            int[] selectedIds = getSelectedIds(selections);
                            GWTServiceLookup.getPluginService().deleteServerPlugins(selectedIds,
                                new AsyncCallback<ArrayList<String>>() {
View Full Code Here

Examples of com.smartgwt.client.util.BooleanCallback

        unregisterHandler();
        handlerRegistration = addVisibilityChangedHandler(new VisibilityChangedHandler() {
            public void onVisibilityChanged(VisibilityChangedEvent event) {
                if (!event.getIsVisible()) {
                    SC.ask(MSG.view_alert_definitions_leaveUnsaved(), new BooleanCallback() {
                        public void execute(Boolean value) {
                            if (value) {
                                save();
                            } else {
                                unregisterHandler();
View Full Code Here

Examples of com.smartgwt.client.util.BooleanCallback

        saveButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                if (clusterForm.validate() && deploymentForm.validate() && credentialsForm.validate()
                    && regularSnapshotsForm.validate()) {
                    SC.ask(MSG.view_adminTopology_storageNodes_clusterSettings_message_confirmation(),
                        new BooleanCallback() {
                            @Override
                            public void execute(Boolean value) {
                                if (value) {
                                    save();
                                }
View Full Code Here

Examples of com.smartgwt.client.util.BooleanCallback

                    public void onClick(ClickEvent clickEvent) {
                        disableAllFooterControls();
                        if (carouselAction.confirmMessage != null) {
                            String message = carouselAction.confirmMessage.replaceAll("\\#", "TODO:");

                            SC.ask(message, new BooleanCallback() {
                                public void execute(Boolean confirmed) {
                                    if (confirmed) {
                                        carouselAction.action.executeAction(null);
                                    } else {
                                        refreshCarouselInfo();
View Full Code Here

Examples of com.smartgwt.client.util.BooleanCallback

        IButton deleteButton = new EnhancedIButton(MSG.common_button_delete(), ButtonColor.RED);
        //deleteButton.setIcon(IconEnum.BUNDLE_DELETE.getIcon16x16Path());
        deleteButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {
                SC.ask(MSG.view_bundle_deleteConfirm(), new BooleanCallback() {
                    @Override
                    public void execute(Boolean confirmed) {
                        if (confirmed) {
                            doDeleteBundle();
                        }
View Full Code Here

Examples of com.smartgwt.client.util.BooleanCallback

                        agent.setAddress(agentHost);
                        agents[i++] = agent;
                    }

                    // ask if we want to uninstall it
                    SC.ask(MSG.view_adminTopology_agent_uninstallConfirm(), new BooleanCallback() {
                        public void execute(final Boolean uninstall) {
                            // if uninstall is true the user wants us to try to remove the agent installation files on the remote box
                            if (uninstall) {
                                GWTServiceLookup.getAgentService().getAgentInstallByAgentName(agents[0].getName(),
                                    new AsyncCallback<AgentInstall>() {
View Full Code Here

Examples of com.smartgwt.client.util.BooleanCallback

                    message = MSG.view_adminTopology_message_forceRepartition();
                    break;
                default:
                    throw new IllegalArgumentException("unknown table action type");
                }
                SC.ask(message, new BooleanCallback() {
                    public void execute(Boolean confirmed) {
                        if (confirmed) {
                            int[] selectedIds = getSelectedIds(selections);

                            AsyncCallback<Void> callback = new AsyncCallback<Void>() {
View Full Code Here

Examples of com.smartgwt.client.util.BooleanCallback

        setAgentStatusText(MSG.view_remoteAgentInstall_installingPleaseWait());

        createWaitingWindow(MSG.view_remoteAgentInstall_installingPleaseWait(), true);

        SC.ask(MSG.view_remoteAgentInstall_overwriteAgentTitle(), MSG.view_remoteAgentInstall_overwriteAgentQuestion(),
            new BooleanCallback() {
                @Override
                public void execute(Boolean overwriteExistingAgent) {
                    CustomAgentInstallData customData = new CustomAgentInstallData(getAgentInstallPath(),
                        overwriteExistingAgent.booleanValue(), agentConfigurationXml); //, rhqAgentEnvSh);
                    remoteInstallService.installAgent(getRemoteAccessInfo(), customData,
View Full Code Here
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.