Package org.rhq.coregui.client.util.message

Examples of org.rhq.coregui.client.util.message.Message


        }

        GWTServiceLookup.getAlertService().acknowledgeAlerts(alertIds, new AsyncCallback<Integer>() {
            public void onSuccess(Integer resultCount) {
                CoreGUI.getMessageCenter().notify(
                    new Message(MSG.view_alerts_ack_success(String.valueOf(resultCount)), Message.Severity.Info));
                refresh();
            }

            public void onFailure(Throwable caught) {
                CoreGUI.getErrorHandler().handleError(MSG.view_alerts_ack_failure(Arrays.toString(alertIds)), caught);
View Full Code Here


    protected void acknowledgeAll() {
        int rpcTimeout = 10000 + getListGrid().getTotalRows();
        GWTServiceLookup.getAlertService(rpcTimeout).acknowledgeAlertsByContext(context, new AsyncCallback<Integer>() {
            public void onSuccess(Integer resultCount) {
                CoreGUI.getMessageCenter().notify(
                    new Message(MSG.view_alerts_ack_success(String.valueOf(resultCount)), Message.Severity.Info));
                refresh();
            }

            public void onFailure(Throwable caught) {
                CoreGUI.getErrorHandler().handleError(MSG.view_alerts_ack_failure_all(), caught);
View Full Code Here

    private void deleteDriftDefinitionsByName(final String[] driftDefNames) {
        GWTServiceLookup.getDriftService().deleteDriftDefinitionsByContext(context, driftDefNames,
            new AsyncCallback<Integer>() {
                public void onSuccess(Integer resultCount) {
                    CoreGUI.getMessageCenter().notify(
                        new Message(MSG.view_drift_success_deleteDefs(String.valueOf(resultCount)),
                            Message.Severity.Info));
                    refresh();
                }

                public void onFailure(Throwable caught) {
View Full Code Here

        DriftDefinition driftDef = (DriftDefinition) records[0]
            .getAttributeAsObject(DriftDefinitionDataSource.ATTR_ENTITY);
        GWTServiceLookup.getDriftService().detectDrift(context, driftDef, new AsyncCallback<Void>() {
            public void onSuccess(Void result) {
                CoreGUI.getMessageCenter().notify(
                    new Message(MSG.view_drift_success_detectNow(), Message.Severity.Info));
                refresh();
            }

            public void onFailure(Throwable caught) {
                CoreGUI.getErrorHandler().handleError(MSG.view_drift_failure_detectNow(), caught);
View Full Code Here

     */
    public void saveDateRange(double startTime, double endTime, boolean allowPreferenceUpdateRefresh) {
        persisted = false;
        prefs.explicitBeginEnd = true; // default to advanced
        if (null != prefs.begin && null != prefs.end && prefs.begin > prefs.end) {
            CoreGUI.getMessageCenter().notify(new Message(MSG.view_measureTable_startBeforeEnd()));
        } else {
            cachedBegin = prefs.begin = (long) startTime;
            cachedEnd = prefs.end = (long) endTime;
            cachedTimeRange = prefs.end - prefs.begin;
            Command callback = new Command() {
View Full Code Here

                        toBeCanceled.getAttribute(AbstractOperationHistoryDataSource.Field.STATUS))) {
                        numCancelRequestsSubmitted++;
                        final int historyId = toBeCanceled.getAttributeAsInt(OperationHistoryDataSource.Field.ID);
                        opService.cancelOperationHistory(historyId, false, new AsyncCallback<Void>() {
                            public void onSuccess(Void result) {
                                Message msg = new Message(MSG.view_operationHistoryList_cancelSuccess(String
                                    .valueOf(historyId)), Severity.Info, EnumSet.of(Option.BackgroundJobResult));
                                CoreGUI.getMessageCenter().notify(msg);
                            };

                            public void onFailure(Throwable caught) {
                                Message msg = new Message(MSG.view_operationHistoryList_cancelFailure(String
                                    .valueOf(historyId)), caught, Severity.Error, EnumSet
                                    .of(Option.BackgroundJobResult));
                                CoreGUI.getMessageCenter().notify(msg);
                            };
                        });
                    }
                }
                CoreGUI.getMessageCenter().notify(
                    new Message(MSG.view_operationHistoryList_cancelSubmitted(String
                        .valueOf(numCancelRequestsSubmitted)), Severity.Info));
                refreshTableInfo();
            }
        });
View Full Code Here

        }
        GWTServiceLookup.getOperationService().deleteOperationHistories(idsToBeDeleted, force,
            new AsyncCallback<Void>() {
                public void onSuccess(Void result) {
                    CoreGUI.getMessageCenter().notify(
                        new Message(MSG.view_operationHistoryList_deleteSuccess(String
                            .valueOf(numberOfRecordsToBeDeleted))));
                    refresh();
                    refreshTableInfo(); // enable proper buttons
                }
View Full Code Here

                            refreshTableInfo();
                        }

                        public void onSuccess(List<Integer> result) {
                            CoreGUI.getMessageCenter().notify(
                                new Message(MSG.view_inventory_resources_uninventorySuccessful(), Severity.Info));
                            onActionSuccess();
                        }
                    });
                }

                private boolean containsStorageNodeOrItsResource(ListGridRecord[] selection) {
                    for (ListGridRecord record : selection) {
                        if (record.getAttribute(AncestryUtil.RESOURCE_ANCESTRY) == null
                            || "RHQStorage".equals(record.getAttribute(PLUGIN.propertyName()))) {
                         // is a platform, storage node or child resource of storage node
                            return true;
                        }
                    }
                    return false;
                }
            });

        addTableAction(MSG.common_button_disable(), MSG.view_inventory_resources_disableConfirm(),
            new AvailabilityTypeResourceAuthorizedTableAction(ResourceSearchView.this, TableActionEnablement.ANY,
                EnumSet.complementOf(EnumSet.of(AvailabilityType.DISABLED)), Permission.DELETE_RESOURCE,
                new RecordExtractor<AvailabilityType>() {

                    public Collection<AvailabilityType> extract(Record[] records) {
                        List<AvailabilityType> result = new ArrayList<AvailabilityType>(records.length);
                        for (Record record : records) {
                            result.add(((Resource) record.getAttributeAsObject("resource")).getCurrentAvailability()
                                .getAvailabilityType());
                        }

                        return result;
                    }
                }, //
                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("id"));
                        }

                        return result;
                    }
                }) {

                @Override
                public boolean isEnabled(ListGridRecord[] records) {
                    boolean result = super.isEnabled(records);

                    if (result) {
                        for (Record record : records) {
                            if (record.getAttribute(ResourceDataSourceField.CATEGORY.propertyName()).equals(
                                ResourceCategory.PLATFORM.name())) {
                                result = false;
                                break;
                            }
                        }
                    }

                    return result;
                }

                public void executeAction(ListGridRecord[] selection, Object actionValue) {
                    int[] resourceIds = TableUtility.getIds(selection);
                    ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();

                    resourceManager.disableResources(resourceIds, new AsyncCallback<List<Integer>>() {
                        public void onFailure(Throwable caught) {
                            CoreGUI.getErrorHandler().handleError(MSG.view_inventory_resources_disableFailed(), caught);
                            refreshTableInfo();
                        }

                        public void onSuccess(List<Integer> result) {
                            CoreGUI.getMessageCenter().notify(
                                new Message(
                                    MSG.view_inventory_resources_disableSuccessful(String.valueOf(result.size())),
                                    Severity.Info));
                            onActionSuccess();
                        }
                    });
                }
            });

        addTableAction(MSG.common_button_enable(), MSG.view_inventory_resources_enableConfirm(), ButtonColor.BLUE,
            new AvailabilityTypeResourceAuthorizedTableAction(ResourceSearchView.this, TableActionEnablement.ANY,
                EnumSet.of(AvailabilityType.DISABLED), Permission.DELETE_RESOURCE,
                new RecordExtractor<AvailabilityType>() {

                    public Collection<AvailabilityType> extract(Record[] records) {
                        List<AvailabilityType> result = new ArrayList<AvailabilityType>(records.length);
                        for (Record record : records) {
                            result.add(((Resource) record.getAttributeAsObject("resource")).getCurrentAvailability()
                                .getAvailabilityType());
                        }

                        return result;
                    }
                }, //
                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("id"));
                        }

                        return result;
                    }
                }) {

                @Override
                public boolean isEnabled(ListGridRecord[] records) {
                    boolean result = super.isEnabled(records);

                    if (result) {
                        for (Record record : records) {
                            if (record.getAttribute(ResourceDataSourceField.CATEGORY.propertyName()).equals(
                                ResourceCategory.PLATFORM.name())) {
                                result = false;
                                break;
                            }
                        }
                    }

                    return result;
                }

                public void executeAction(ListGridRecord[] selection, Object actionValue) {
                    int[] resourceIds = TableUtility.getIds(selection);
                    ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();

                    resourceManager.enableResources(resourceIds, new AsyncCallback<List<Integer>>() {
                        public void onFailure(Throwable caught) {
                            CoreGUI.getErrorHandler().handleError(MSG.view_inventory_resources_enableFailed(), caught);
                            refreshTableInfo();
                        }

                        public void onSuccess(List<Integer> result) {
                            CoreGUI.getMessageCenter().notify(
                                new Message(
                                    MSG.view_inventory_resources_enableSuccessful(String.valueOf(result.size())),
                                    Severity.Info));
                            onActionSuccess();
                        }
                    });
View Full Code Here

     * @param ok status
     */
    public void retrievalStatus(boolean ok) {
        if (uploadButton != null) {
            String iconSrc;
            Message msg;

            if (ok) {
                iconSrc = ImageManager.getAvailabilityIcon(Boolean.TRUE);
                msg = new Message(MSG.view_upload_success(), Severity.Info);
            } else {
                iconSrc = ImageManager.getAvailabilityIcon(Boolean.FALSE);
                msg = new Message(MSG.view_upload_error_file(), Severity.Error);
            }

            FormItemIcon loadedIcon = new FormItemIcon();
            loadedIcon.setSrc(iconSrc);
            loadedIcon.setWidth(16);
View Full Code Here

                        }
                    }

                    if (resourceIdsList.isEmpty()) {
                        CoreGUI.getMessageCenter().notify(
                            new Message(MSG.view_inventory_resources_ignoreSkipAllPlatforms(), Severity.Warning));
                        return;
                    } else if (numberOfPlatformsSelected[0] > 0) {
                        String n = Integer.toString(numberOfPlatformsSelected[0]);
                        CoreGUI.getMessageCenter().notify(
                            new Message(MSG.view_inventory_resources_ignoreSkipSomePlatforms(n), Severity.Warning));
                    }

                    // the remote API requires int[]
                    int[] resourceIds = new int[resourceIdsList.size()];
                    int i = 0;
                    for (Integer id : resourceIdsList) {
                        resourceIds[i++] = id;
                    }

                    // ask the server to ignore the selected non-platform resources
                    ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();
                    resourceManager.ignoreResources(resourceIds, new AsyncCallback<Void>() {
                        public void onFailure(Throwable caught) {
                            CoreGUI.getErrorHandler().handleError(MSG.view_inventory_resources_ignoreFailed(), caught);
                            refreshTableInfo();
                        }

                        public void onSuccess(Void result) {
                            String msg;
                            if (numberOfPlatformsSelected[0] > 0) {
                                String n = Integer.toString(numberOfPlatformsSelected[0]);
                                msg = MSG.view_inventory_resources_ignoreSuccessfulSkipPlatforms(n);
                            } else {
                                msg = MSG.view_inventory_resources_ignoreSuccessful();
                            }
                            CoreGUI.getMessageCenter().notify(new Message(msg, Severity.Info));
                            onActionSuccess(); // do the same thing as if we uninventoried the resource
                        }
                    });

                    return;
View Full Code Here

TOP

Related Classes of org.rhq.coregui.client.util.message.Message

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.