Package org.rhq.coregui.client.components.table

Examples of org.rhq.coregui.client.components.table.AuthorizedTableAction


        setListGridFields(idField, categoryField, nameField, descriptionField, typeNameField, pluginNameField,
            availabilityChildrenField, availabilityDescendantsField);

        if (this.showDeleteButton) {
            addTableAction(MSG.common_button_delete(), MSG.common_msg_areYouSure(), ButtonColor.RED, new AuthorizedTableAction(this,
                TableActionEnablement.ANY, Permission.MANAGE_INVENTORY) {
                public void executeAction(ListGridRecord[] selections, Object actionValue) {
                    int[] groupIds = new int[selections.length];
                    int index = 0;
                    for (ListGridRecord selection : selections) {
                        groupIds[index++] = selection.getAttributeAsInt("id");
                    }
                    ResourceGroupGWTServiceAsync resourceGroupManager = GWTServiceLookup.getResourceGroupService();

                    resourceGroupManager.deleteResourceGroups(groupIds, new AsyncCallback<Void>() {
                        public void onFailure(Throwable caught) {
                            CoreGUI.getErrorHandler().handleError(MSG.view_inventory_groups_deleteFailed(), caught);
                            refreshTableInfo();
                        }

                        public void onSuccess(Void result) {
                            CoreGUI.getMessageCenter().notify(
                                new Message(MSG.view_inventory_groups_deleteSuccessful(), Severity.Info));
                            refresh(true);
                        }
                    });
                }
            });
        }

        if (this.showNewButton) {
            addTableAction(MSG.common_button_new(), ButtonColor.BLUE, new AuthorizedTableAction(this, Permission.MANAGE_INVENTORY) {
                public void executeAction(ListGridRecord[] selection, Object actionValue) {
                    GroupCategory category = null;
                    String categoryString = getInitialCriteria() == null ? null : getInitialCriteria().getAttribute(
                        ResourceGroupDataSourceField.CATEGORY.propertyName());
                    if (categoryString != null) {
View Full Code Here


        List<ListGridField> fields = getDataSource().getListGridFields();
        ListGrid listGrid = getListGrid();
        listGrid.setFields(fields.toArray(new ListGridField[fields.size()]));
        listGrid.sort(FIELD_NAME, SortDirection.ASCENDING);

        addTableAction(MSG.common_button_enable(), MSG.common_msg_areYouSure(), ButtonColor.BLUE, new AuthorizedTableAction(this,
            TableActionEnablement.ANY, Permission.MANAGE_SETTINGS) {
            public void executeAction(ListGridRecord[] selections, Object actionValue) {
                int[] selectedIds = getSelectedIds(selections);
                GWTServiceLookup.getPluginService().enableAgentPlugins(selectedIds,
                    new AsyncCallback<ArrayList<String>>() {
                        @Override
                        public void onSuccess(ArrayList<String> result) {
                            Message msg = new Message(MSG.view_admin_plugins_enabledAgentPlugins(result.toString()),
                                Severity.Info);
                            CoreGUI.getMessageCenter().notify(msg);
                            refresh();
                        }

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

        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() {
View Full Code Here

        ListGrid listGrid = getListGrid();
        listGrid.setFields(fields.toArray(new ListGridField[fields.size()]));
        listGrid.sort(FIELD_NAME, SortDirection.ASCENDING);

        addTableAction(MSG.common_button_enable(), MSG.common_msg_areYouSure(), ButtonColor.BLUE,
            new AuthorizedTableAction(this, TableActionEnablement.ANY, Permission.MANAGE_SETTINGS) {
            public void executeAction(ListGridRecord[] selections, Object actionValue) {
                int[] selectedIds = getSelectedIds(selections);
                GWTServiceLookup.getPluginService().enableServerPlugins(selectedIds,
                    new AsyncCallback<ArrayList<String>>() {
                        @Override
                        public void onSuccess(ArrayList<String> result) {
                            Message msg = new Message(MSG.view_admin_plugins_enabledServerPlugins(result.toString()),
                                Severity.Info);
                            CoreGUI.getMessageCenter().notify(msg);
                            refresh();
                        }

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

        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() {
View Full Code Here

            showUpdateMembersAction();
        }
    }

    private void setupNewButton() {
        addTableAction(MSG.common_button_new(), null, ButtonColor.BLUE, new AuthorizedTableAction(this,
            TableActionEnablement.ALWAYS, Permission.MANAGE_INVENTORY) {
            public void executeAction(final ListGridRecord[] selections, Object actionValue) {
                newDetails();
            }
        });
View Full Code Here

        remoteAgentView.markForDestroy();
        popupWindow.markForDestroy();
    }

    private void setupStartButton() {
        addTableAction(MSG.common_button_start(), null, ButtonColor.GRAY, new AuthorizedTableAction(this,
            TableActionEnablement.SINGLE, Permission.MANAGE_INVENTORY) {
            public void executeAction(final ListGridRecord[] selections, Object actionValue) {
                if (selections == null || selections.length == 0) {
                    return; // do nothing since nothing is selected (we really shouldn't get here)
                }
View Full Code Here

            }
        });
    }

    private void setupStopButton() {
        addTableAction(MSG.common_button_stop(), null, ButtonColor.GRAY, new AuthorizedTableAction(this,
            TableActionEnablement.SINGLE, Permission.MANAGE_INVENTORY) {
            public void executeAction(final ListGridRecord[] selections, Object actionValue) {
                if (selections == null || selections.length == 0) {
                    return; // do nothing since nothing is selected (we really shouldn't get here)
                }
View Full Code Here

        });
    }

    private void setupDeleteButton() {
        addTableAction(MSG.common_button_delete(), MSG.view_adminTopology_agent_delete_confirm(), ButtonColor.RED,
            new AuthorizedTableAction(this, TableActionEnablement.SINGLE, Permission.MANAGE_INVENTORY) {
                public void executeAction(final ListGridRecord[] selections, Object actionValue) {
                    if (selections == null || selections.length == 0) {
                        refresh();
                        return; // do nothing since nothing is selected (we really shouldn't get here)
                    }
View Full Code Here

                }
            });
    }

    private void showUpdateMembersAction() {
        addTableAction(MSG.view_groupInventoryMembers_button_updateMembership(), ButtonColor.BLUE, new AuthorizedTableAction(this,
            TableActionEnablement.ALWAYS, Permission.MANAGE_SETTINGS) {
            public void executeAction(final ListGridRecord[] selections, Object actionValue) {
                AffinityGroupAgentsSelector.show(id, AgentTableView.this);
            }
        });
View Full Code Here

        addTableAction(TableAction.PURGE_ALL);
        addTableAction(TableAction.FORCE_REPARTITION);
    }

    private void addTableAction(final TableAction action) {
        addTableAction(action.title, null, action.buttonColor, new AuthorizedTableAction(this, action.enablement,
            Permission.MANAGE_SETTINGS) {
            public void executeAction(final ListGridRecord[] selections, Object actionValue) {
                String eventTypes = getSelectedEventTypes(selections).toString();
                String message = null;
                switch (action) {
View Full Code Here

    private void showCommonActions() {
        addChangeOperationModeAction(OperationMode.NORMAL, MSG.view_adminTopology_server_setNormal());
        addChangeOperationModeAction(OperationMode.MAINTENANCE, MSG.view_adminTopology_server_setMaintenance());

        addTableAction(MSG.view_adminTopology_server_removeSelected(), null, ButtonColor.RED,
            new AuthorizedTableAction(this, TableActionEnablement.ANY, Permission.MANAGE_SETTINGS) {
                public void executeAction(final ListGridRecord[] selections, Object actionValue) {
                    List<String> selectedNames = getSelectedNames(selections);
                    String message = MSG.view_adminTopology_message_removeServerConfirm(selectedNames.toString());
                    SC.ask(message, new BooleanCallback() {
                        public void execute(Boolean confirmed) {
View Full Code Here

TOP

Related Classes of org.rhq.coregui.client.components.table.AuthorizedTableAction

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.