Examples of TableAction


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

            public void executeAction(ListGridRecord[] selection, Object actionValue) {
                acknowledge(selection);
            }
        });
        if (canSupportDeleteAndAcknowledgeAll()) {
            addTableAction(MSG.common_button_ack_all(), MSG.view_alerts_ack_confirm_all(), new TableAction() {
                public boolean isEnabled(ListGridRecord[] selection) {
                    ListGrid grid = getListGrid();
                    ResultSet resultSet = (null != grid) ? grid.getResultSet() : null;
                    return (hasWriteAccess && grid != null && resultSet != null && !resultSet.isEmpty());
                }

                public void executeAction(ListGridRecord[] selection, Object actionValue) {
                    acknowledgeAll();
                }
            });
        }

        addTableAction(MSG.common_button_delete(), MSG.view_alerts_delete_confirm(), ButtonColor.RED,
            new ResourceAuthorizedTableAction(AlertHistoryView.this, TableActionEnablement.ANY, (hasWriteAccess ? null
                : Permission.MANAGE_ALERTS), new RecordExtractor<Integer>() {
                public Collection<Integer> extract(Record[] records) {
                    List<Integer> result = new ArrayList<Integer>(records.length);
                    for (Record record : records) {
                        result.add(record.getAttributeAsInt("resourceId"));
                    }
                    return result;
                }
            }) {

            public void executeAction(ListGridRecord[] selection, Object actionValue) {
                delete(selection);
            }
        });
        if (canSupportDeleteAndAcknowledgeAll()) {
            addTableAction(MSG.common_button_delete_all(), MSG.view_alerts_delete_confirm_all(), ButtonColor.RED,
                new TableAction() {
                public boolean isEnabled(ListGridRecord[] selection) {
                    ListGrid grid = getListGrid();
                    ResultSet resultSet = (null != grid) ? grid.getResultSet() : null;
                    return (hasWriteAccess && grid != null && resultSet != null && !resultSet.isEmpty());
                }

                public void executeAction(ListGridRecord[] selection, Object actionValue) {
                    deleteAll();
                }
            });
        }
        if (!context.isSubsystemView() && showNewDefinitionButton) {
            addTableAction(MSG.common_button_new() + " " + MSG.common_title_definition(), ButtonColor.BLUE,
                new TableAction() {
                public boolean isEnabled(ListGridRecord[] selection) {
                    // todo: this.permissions.isAlert()
                    return hasWriteAccess;
                }
View Full Code Here

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

        TableActionEnablement deleteEnablement = hasWriteAccess ? TableActionEnablement.ANY
            : TableActionEnablement.NEVER;
        TableActionEnablement detectNowEnablement = hasWriteAccess ? TableActionEnablement.SINGLE
            : TableActionEnablement.NEVER;

        addTableAction(MSG.common_button_new(), null, ButtonColor.BLUE, new TableAction() {
            public boolean isEnabled(ListGridRecord[] selection) {
                return hasWriteAccess;
            }

            public void executeAction(ListGridRecord[] selection, Object actionValue) {
                add();
            }
        });

        addTableAction(MSG.common_button_delete(), MSG.view_drift_confirm_deleteDefs(), ButtonColor.RED,
            new AbstractTableAction(deleteEnablement) {
            public void executeAction(ListGridRecord[] selection, Object actionValue) {
                delete(selection);
            }
        });

        addTableAction(MSG.common_button_delete_all(), MSG.view_drift_confirm_deleteAllDefs(), ButtonColor.RED,
            new TableAction() {
            public boolean isEnabled(ListGridRecord[] selection) {
                ListGrid grid = getListGrid();
                ResultSet resultSet = (null != grid) ? grid.getResultSet() : null;
                return (hasWriteAccess && grid != null && resultSet != null && !resultSet.isEmpty());
            }
View Full Code Here

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

        // explicitly sort on started time so the user can see the last operation at the top and is sorted descendingly
        SortSpecifier sortSpec = new SortSpecifier(AbstractOperationHistoryDataSource.Field.STARTED_TIME,
            SortDirection.DESCENDING);
        getListGrid().setSort(new SortSpecifier[] { sortSpec });

        addTableAction(MSG.common_button_delete(), getDeleteConfirmMessage(), ButtonColor.RED, new TableAction() {
            public boolean isEnabled(ListGridRecord[] selection) {
                int count = selection.length;
                return (count >= 1 && hasControlPermission());
            }

            public void executeAction(ListGridRecord[] selection, Object actionValue) {
                deleteSelectedRecords();
            }
        });

        addTableAction(MSG.view_operationHistoryList_button_forceDelete(), getDeleteConfirmMessage(), ButtonColor.RED,
            new TableAction() {
                public boolean isEnabled(ListGridRecord[] selection) {
                    int count = selection.length;
                    return (count >= 1 && hasControlPermission());
                }

                public void executeAction(ListGridRecord[] selection, Object actionValue) {
                    DSRequest requestProperties = new DSRequest();
                    requestProperties.setAttribute("force", true);
                    deleteSelectedRecords(requestProperties);
                }
            });
       
        // the below addTableAction and the enclosing TableAction anon class code is taken from
        // OperationHistoryView. I don't know why we have an abstract operation history list hierarchy separate
        // from OperationHistoryView. Perhaps independently developed and the developer of one didn't know the other
        // existed. In any case, this code is almost identical as the table action in OperationHistoryView with the
        // exception that this code uses AbstractOperationHistoryDataSource.Field constants.
        addTableAction(MSG.common_button_cancel(), MSG.view_operationHistoryList_cancelConfirm(), new TableAction() {
            public boolean isEnabled(ListGridRecord[] selection) {
                int count = selection.length;
                for (ListGridRecord item : selection) {
                    if (!OperationRequestStatus.INPROGRESS.name().equals(
                        item.getAttribute(AbstractOperationHistoryDataSource.Field.STATUS))) {
View Full Code Here

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

                }
            });
    }

    private void addExportAction() {
        addTableAction("Export", MSG.common_button_reports_export(), new TableAction() {
            @Override
            public boolean isEnabled(ListGridRecord[] selection) {
                return true;
            }
View Full Code Here

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

        super.configureTable();
    }

    protected void setupTableInteractions(final boolean hasWriteAccess) {

        addTableAction(MSG.common_button_enable(), null, ButtonColor.BLUE, new TableAction() {
            public boolean isEnabled(ListGridRecord[] selection) {
                return ((selection.length >= 1) && hasWriteAccess);
            }

            public void executeAction(ListGridRecord[] selection, Object actionValue) {
                enableSchedules();
            }
        });
        addTableAction(MSG.common_button_disable(), null, ButtonColor.GRAY, new TableAction() {
            public boolean isEnabled(ListGridRecord[] selection) {
                return ((selection.length >= 1) && hasWriteAccess);
            }

            public void executeAction(ListGridRecord[] selection, Object actionValue) {
View Full Code Here

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

        ListGridField descriptionField = new ListGridField(AbstractOperationScheduleDataSource.Field.DESCRIPTION);
        descriptionField.setCellFormatter(new EscapedHtmlCellFormatter());

        setListGridFields(true, idField, operationField, subjectField, nextFireTimeField, descriptionField);

        addTableAction(MSG.common_button_new(), ButtonColor.BLUE, new TableAction() {
            public boolean isEnabled(ListGridRecord[] selection) {
                return hasControlPermission();
            }

            public void executeAction(ListGridRecord[] selection, Object actionValue) {
                newDetails();
            }
        });

        addTableAction(MSG.common_button_delete(), getDeleteConfirmMessage(), ButtonColor.RED, new TableAction() {
            public boolean isEnabled(ListGridRecord[] selection) {
                int count = selection.length;
                return ((count >= 1) && hasControlPermission());
            }
View Full Code Here

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

    protected void configureTable() {
        List<ListGridField> fields = createFields();
        //add extra list grid field for alerts
        setListGridFields(fields.toArray(new ListGridField[fields.size()]));

        addTableAction(MSG.common_title_compareMetrics(), ButtonColor.BLUE, new TableAction() {
            @Override
            public boolean isEnabled(ListGridRecord[] selection) {
                return selection != null && selection.length > 1;
            }
View Full Code Here

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

        return criteria;
    }

    @Override
    protected TableAction getLiveValueAction() {
        return new TableAction() {
            @Override
            public boolean isEnabled(ListGridRecord[] selection) {
                return selection != null && selection.length > 0;
            }
View Full Code Here

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

        return fields;
    }

    private TableAction createNewAction() {
        return new TableAction() {
            public boolean isEnabled(ListGridRecord[] selection) {
                return hasManageSecurity;
            }

            public void executeAction(ListGridRecord[] selection, Object actionValue) {
View Full Code Here

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

            }
        };
    }

    private TableAction createDeleteAction() {
        return new TableAction() {
            public boolean isEnabled(ListGridRecord[] selection) {
                if (!hasManageSecurity) {
                    return false;
                }
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.