Package org.rhq.coregui.client.util.enhanced

Examples of org.rhq.coregui.client.util.enhanced.EnhancedIButton


        tabSet = new NamedTabSet();

        tabSet.setWidth100();
        tabSet.setHeight100();
        tabSet.setStyleName("dashboardTabs");
        editButton = new EnhancedIButton(editMode ? MSG.common_title_view_mode() : MSG.common_title_edit_mode());
        editButton.setAutoFit(true);
        editButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                editMode = !editMode;
                editButton.setTitle(editMode ? MSG.common_title_view_mode() : MSG.common_title_edit_mode());
                if (selectedDashboardView.isMaximized()) {
                    selectedDashboardView.restorePortlet();
                }
                selectedDashboardView.setEditMode(editMode);
            }
        });

        final IButton newDashboardButton = new EnhancedIButton(MSG.common_title_new_dashboard());
        newDashboardButton.setAutoFit(true);
        newDashboardButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                newDashboardButton.disable();
                addNewDashboard(newDashboardButton);
            }
        });

        HLayout buttons = new HLayout(5);
View Full Code Here


        layout.addMember(form);
        VLayout spacer = new VLayout();
        spacer.setHeight(10);
        layout.addMember(spacer);

        IButton cancel = new EnhancedIButton(MSG.common_button_cancel());
        cancel.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                modalWindow.destroy();
                AffinityGroupTableView.this.refreshTableInfo();
            }
        });
        final IButton create = new EnhancedIButton(MSG.view_adminTopology_affinityGroups_createNew(), ButtonColor.BLUE);
        create.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                createNewGroup(modalWindow, form);
            }
        });
View Full Code Here

        toolStrip.setWidth100();
        toolStrip.setExtraSpace(10);
        toolStrip.setMembersMargin(5);
        toolStrip.setLayoutMargin(5);

        this.saveButton = new EnhancedIButton(MSG.common_button_save(), ButtonColor.BLUE);
        this.saveButton.setTooltip(MSG.view_group_pluginConfig_edit_saveTooltip());
        this.saveButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                save();
            }
View Full Code Here

                    buttons.setWidth100();
                    buttons.setExtraSpace(10);
                    buttons.setMembersMargin(5);
                    buttons.setLayoutMargin(5);

                    final IButton saveButtonPC = new EnhancedIButton(MSG.common_button_save(), ButtonColor.BLUE);

                    final IButton resetButtonPC = new EnhancedIButton(MSG.common_button_reset(), ButtonColor.RED);

                    Configuration config = plugin.getPluginConfiguration();
                    final ConfigurationEditor editorPC = new ConfigurationEditor(def, config);
                    editorPC.setOverflow(Overflow.AUTO);
                    editorPC.addPropertyValueChangeListener(new PropertyValueChangeListener() {
                        public void propertyValueChanged(PropertyValueChangeEvent event) {
                            if (event.isInvalidPropertySetChanged()) {
                                Map<String, String> invalidPropertyNames = event.getInvalidPropertyNames();
                                if (invalidPropertyNames.isEmpty()) {
                                    saveButtonPC.enable();
                                } else {
                                    saveButtonPC.disable();
                                }
                            }
                        }
                    });

                    resetButtonPC.addClickHandler(new ClickHandler() {
                        public void onClick(ClickEvent event) {
                            editorPC.reset();
                        }
                    });
View Full Code Here

                    buttons.setWidth100();
                    buttons.setExtraSpace(10);
                    buttons.setMembersMargin(5);
                    buttons.setLayoutMargin(5);

                    final IButton saveButtonSJ = new EnhancedIButton(MSG.common_button_save(), ButtonColor.BLUE);
                    buttons.addMember(saveButtonSJ);

                    final IButton resetButtonSJ = new EnhancedIButton(MSG.common_button_reset(), ButtonColor.RED);
                    buttons.addMember(resetButtonSJ);

                    Configuration config = plugin.getScheduledJobsConfiguration();
                    final ConfigurationEditor editorSJ = new ConfigurationEditor(def, config);
                    editorSJ.setOverflow(Overflow.AUTO);
                    editorSJ.addPropertyValueChangeListener(new PropertyValueChangeListener() {
                        public void propertyValueChanged(PropertyValueChangeEvent event) {
                            if (event.isInvalidPropertySetChanged()) {
                                Map<String, String> invalidPropertyNames = event.getInvalidPropertyNames();
                                if (invalidPropertyNames.isEmpty()) {
                                    saveButtonSJ.enable();
                                } else {
                                    saveButtonSJ.disable();
                                }
                            }
                        }
                    });

                    resetButtonSJ.addClickHandler(new ClickHandler() {
                        public void onClick(ClickEvent event) {
                            editorSJ.reset();
                        }
                    });
View Full Code Here

        // in addition, we provide a purge button if you are viewing the live deployment, so
        // they can be shown an option to purge the platform content (since only the "live"
        // deployment represents content on the remote machines, showing purge only for live
        // deployments makes sense).
        if (deployment.isLive()) {
            IButton revertButton = new EnhancedIButton(MSG.view_bundle_revert(), ButtonColor.RED);
            //revertButton.setIcon("subsystems/bundle/BundleAction_Revert_16.png");
            revertButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
                @Override
                public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
                    new BundleRevertWizard(deployment.getDestination()).startWizard();
                }
            });
            actionLayout.addMember(revertButton);

            IButton purgeButton = new EnhancedIButton(MSG.view_bundle_purge(), ButtonColor.RED);
            //purgeButton.setIcon("subsystems/bundle/BundleDestinationAction_Purge_16.png");
            purgeButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
                @Override
                public void onClick(com.smartgwt.client.widgets.events.ClickEvent clickEvent) {
                    SC.ask(MSG.view_bundle_dest_purgeConfirm(), new BooleanCallback() {
                        @Override
                        public void execute(Boolean aBoolean) {
                            if (aBoolean) {
                                final int destinationId = deployment.getDestination().getId();
                                final String destinationName = deployment.getDestination().getName();
                                BundleGWTServiceAsync bundleService = GWTServiceLookup.getBundleService(600000); // 10m should be enough right?
                                bundleService.purgeBundleDestination(destinationId, new AsyncCallback<Void>() {
                                    @Override
                                    public void onFailure(Throwable caught) {
                                        getErrorHandler().handleError(
                                            MSG.view_bundle_dest_purgeFailure(destinationName), caught);
                                    }

                                    @Override
                                    public void onSuccess(Void result) {
                                        getMessageCenter().notify(
                                            new Message(MSG.view_bundle_dest_purgeSuccessful(destinationName),
                                                Message.Severity.Info));
                                        // Bundle destination is purged, go back to bundle deployment view - it is not live anymore
                                        goToView(
                                            LinkManager.getBundleDeploymentLink(bundle.getId(), deployment.getId()),
                                            true);
                                    }
                                });
                            }
                        }
                    });
                }
            });
            actionLayout.addMember(purgeButton);

            if (!canDeploy) {
                revertButton.setDisabled(true);
                purgeButton.setDisabled(true);
            }
        }

        IButton deleteButton = new EnhancedIButton(MSG.common_button_delete(), ButtonColor.RED);
        //deleteButton.setIcon("subsystems/bundle/BundleDeploymentAction_Delete_16.png");
        deleteButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
            @Override
            public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
                SC.ask(MSG.view_bundle_deploy_deleteConfirm(), new BooleanCallback() {
                    @Override
                    public void execute(Boolean confirmed) {
                        if (confirmed) {
                            doDeleteBundleDeployment();
                        }
                    }
                });
            }
        });
        actionLayout.addMember(deleteButton);

        if (!canDelete) {
            deleteButton.setDisabled(true);
        }

        return actionLayout;
    }
View Full Code Here

        footerStrip.setPadding(5);
        footerStrip.setMembersMargin(10);
        layout.addMember(footerStrip);

        // footer OK button
        final IButton okButton = new EnhancedIButton(MSG.common_button_ok(), ButtonColor.BLUE);
        if (!propertyIsReadOnly) {
            // if its read-only, allow the ok button to be enabled to just let the user close the window
            // otherwise, disable it now and we will enable it after we know things are ready to be saved
            okButton.setDisabled(true);
        }
        okButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                if (!propertyIsReadOnly) {
                    boolean valuesHomogeneous = true;
                    boolean isValid = true;

                    String firstValue = data[0].getAttribute(FIELD_VALUE);
                    int i = 0;
                    for (ListGridRecord valueItem : data) {
                        String value = valueItem.getAttribute(FIELD_VALUE);
                        if (valuesHomogeneous) {
                            if ((value != null && !value.equals(firstValue)) || (value == null && firstValue != null)) {
                                valuesHomogeneous = false;
                            }
                        }
                        isValid = isValid && memberValuesGrid.validateRow(i);
                        Configuration config = (Configuration) valueItem.getAttributeAsObject(ATTR_CONFIG_OBJ);

                        PropertySimple memberPropertySimple = (PropertySimple) getProperty(config,
                            aggregatePropertySimple, index);
                        memberPropertySimple.setValue(value);
                        memberPropertySimple.setErrorMessage(null);
                    }

                    String aggregateStaticItemName = aggregateValueItem.getAttribute(RHQ_STATIC_ITEM_NAME_ATTRIBUTE);
                    FormItem aggregateStaticItem = aggregateValueItem.getForm().getField(aggregateStaticItemName);

                    String aggregateUnsetItemName = aggregateValueItem.getAttribute(RHQ_UNSET_ITEM_NAME_ATTRIBUTE);
                    FormItem aggregateUnsetItem = aggregateValueItem.getForm().getField(aggregateUnsetItemName);
                    aggregateUnsetItem.setDisabled(!valuesHomogeneous);

                    if (valuesHomogeneous) {
                        // Update the value of the aggregate property and set its override flag to true.
                        aggregatePropertySimple.setValue(firstValue);
                        aggregatePropertySimple.setOverride(true);

                        boolean isUnset = (firstValue == null);
                        aggregateUnsetItem.setValue(isUnset);

                        // Set the aggregate value item's value to the homogeneous value, unhide it, and enable it
                        // unless it's unset.
                        setValue(aggregateValueItem, firstValue);
                        aggregateValueItem.show();
                        aggregateValueItem.setDisabled(isUnset);

                        aggregateStaticItem.hide();
                    } else {
                        aggregatePropertySimple.setValue(null);
                        aggregatePropertySimple.setOverride(false);

                        aggregateValueItem.hide();

                        aggregateStaticItem.show();
                    }

                    CoreGUI.getMessageCenter().notify(
                        new Message(MSG.view_groupConfigEdit_saveReminder(), Severity.Info));

                    // this has the potential to send another message to the message center
                    firePropertyChangedEvent(aggregatePropertySimple, propertyDefinitionSimple, isValid);
                }

                popup.destroy();
            }
        });
        footerStrip.addMember(okButton);

        // track errors in grid - enable/disable OK button accordingly
        // I tried many ways to get this to work right - this is what I came up with
        memberValuesGrid.addRowEditorExitHandler(new RowEditorExitHandler() {
            public void onRowEditorExit(RowEditorExitEvent event) {
                memberValuesGrid.validateRow(event.getRowNum());
                if (memberValuesGrid.hasErrors()) {
                    okButton.disable();
                } else {
                    okButton.enable();
                }
            }
        });

        // if the data can be changed, add some additional widgets; if not, make the value grid read only
        if (propertyIsReadOnly) {
            memberValuesGrid.setCanEdit(false);
        } else {
            // put a cancel button in the footer strip to allow the user to exit without saving changes
            final IButton cancelButton = new EnhancedIButton(MSG.common_button_cancel());
            cancelButton.focus();
            cancelButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
                public void onClick(ClickEvent clickEvent) {
                    popup.destroy();
                }
            });
            footerStrip.addMember(cancelButton);
View Full Code Here

TOP

Related Classes of org.rhq.coregui.client.util.enhanced.EnhancedIButton

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.