Examples of EnhancedToolStrip


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

        EntityContext context = EntityContext.forGroup(groupComposite.getResourceGroup().getId(), isAutoCluster,
            isAutoGroup);
        dashboardView = new DashboardView(this, dashboard, context, groupComposite);
        addMember(dashboardView);

        footer = new EnhancedToolStrip();
        footer.setPadding(5);
        footer.setWidth100();
        footer.setMembersMargin(15);

        editButton = new EnhancedIButton(editMode ? MSG.common_title_view_mode() : MSG.common_title_edit_mode());
View Full Code Here

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

                        // nuke the settings window now that its form field values have been processed
                        PortletSettingsWindow.this.destroy();
                    }
                }
            });
            toolStrip = new EnhancedToolStrip();
            toolStrip.setPadding(5);
            toolStrip.setWidth100();
            toolStrip.setMembersMargin(15);
            toolStrip.addMember(cancel);
            toolStrip.addMember(save);
            toolStrip.setLayoutAlign(Alignment.CENTER);
        } else if (view instanceof ConfigurablePortlet) {
            ConfigurationDefinition definition = ((ConfigurablePortlet) view).getConfigurationDefinition();
            Configuration configuration = storedPortlet.getConfiguration();

            final ConfigurationEditor editor = new ConfigurationEditor(definition, configuration);
            editor.setWidth(400);
            editor.setHeight(400);
            layout.addMember(editor);

            IButton cancel = new EnhancedIButton(MSG.common_button_cancel());
            cancel.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent clickEvent) {
                    PortletSettingsWindow.this.destroy();
                }
            });
            IButton save = new EnhancedIButton(MSG.common_button_save(), ButtonColor.BLUE);
            save.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent clickEvent) {
                    if (editor.validate()) {
                        // set the portlet config to the new config
                        Configuration configuration = editor.getConfiguration();
                        storedPortlet.setConfiguration(configuration);

                        // nuke the settings window now that its config data is stored
                        PortletSettingsWindow.this.destroy();

                        // configure the actual portlet and redraw
                        view.configure(parentWindow, storedPortlet);
                        parentWindow.markForRedraw();

                        // persist the updated config
                        parentWindow.save();
                    }
                }
            });
           
            toolStrip = new EnhancedToolStrip();
            toolStrip.setPadding(5);
            toolStrip.setWidth100();
            toolStrip.setMembersMargin(15);
            toolStrip.addMember(cancel);
            toolStrip.addMember(save);
View Full Code Here

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

            // Footer

            // A second toolstrip that optionally appears before the main footer - it will contain extra widgets.
            // This is hidden from view unless extra widgets are actually added to the carousel above the main footer.
            this.footerExtraWidgets = new EnhancedToolStrip();
            footerExtraWidgets.setPadding(5);
            footerExtraWidgets.setWidth100();
            footerExtraWidgets.setMembersMargin(15);
            footerExtraWidgets.hide();
            contents.addMember(footerExtraWidgets);

            this.footer = new EnhancedToolStrip();
            footer.setPadding(5);
            footer.setWidth100();
            footer.setMembersMargin(15);
            contents.addMember(footer);
View Full Code Here

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

    @Override
    protected void onDraw() {
        super.onDraw();
       
        EnhancedToolStrip toolStrip = new EnhancedToolStrip();
        toolStrip.setBackgroundImage(null);
        toolStrip.setWidth100();
        toolStrip.setMembersMargin(3);
        toolStrip.setPadding(3);

        this.saveButton = new EnhancedIButton(MSG.common_button_save(), ButtonColor.BLUE);
        this.saveButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                save();
            }
        });
        this.saveButton.disable();
        toolStrip.addMember(this.saveButton);

        addMember(toolStrip);

        if (!this.resourcePermission.isInventory()) {
            Message message = new Message(MSG.view_connectionSettingsDetails_noPermission(), Message.Severity.Info,
View Full Code Here

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

        layout.setHeight100();
        layout.setWidth100();
        layout.setMargin(11);

        // create the header strip - will contain "set all values to" form
        EnhancedToolStrip headerStrip = null;
        if (!propertyIsReadOnly) {
            headerStrip = new EnhancedToolStrip();
            headerStrip.setWidth100();
            headerStrip.setPadding(5);
            headerStrip.setMembersMargin(10);
            layout.addMember(headerStrip);
        }

        // create the list grid that contains all the member resource names and values
        final ListGridRecord[] data = getMemberValuesGridData(this.memberConfigurations, propertyDefinitionSimple,
            aggregatePropertySimple, index);
        final ListGrid memberValuesGrid = new ListGrid();
        memberValuesGrid.setHeight100();
        memberValuesGrid.setWidth100();
        memberValuesGrid.setData(data);
        memberValuesGrid.setEditEvent(ListGridEditEvent.CLICK);
        memberValuesGrid.setEditByCell(false); // selecting any cell allows the user to edit the entire row

        ListGridField idField = new ListGridField(FIELD_ID, MSG.common_title_id());
        idField.setHidden(true);
        idField.setCanEdit(false);

        ListGridField memberField = new ListGridField(FIELD_MEMBER, MSG.view_groupConfigEdit_member());
        memberField.setCanEdit(false);

        final ListGridField valueField = new ListGridField(FIELD_VALUE, MSG.common_title_value());
        valueField.setRequired(propertyDefinitionSimple.isRequired());
        valueField.setCanEdit(true);
        final FormItem editorItem = buildEditorFormItem(valueField, propertyDefinitionSimple);
        valueField.setEditorType(editorItem);
        valueField.setCellFormatter(new CellFormatter() {
            public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
                if (value == null) {
                    return "";
                }
                List<PropertyDefinitionEnumeration> enumeratedValues = propertyDefinitionSimple.getEnumeratedValues();
                if (enumeratedValues != null && !enumeratedValues.isEmpty()) {
                    for (PropertyDefinitionEnumeration option : enumeratedValues) {
                        if (option.getValue().equals(value.toString())) {
                            return option.getName();
                        }
                    }
                    return value.toString();
                } else {
                    switch (propertyDefinitionSimple.getType()) {
                    case BOOLEAN: {
                        return BOOLEAN_PROPERTY_ITEM_VALUE_MAP.get(value.toString());
                    }
                    case PASSWORD: {
                        return "******";
                    }
                    default:
                        return value.toString();
                    }
                }
            }
        });

        ListGridField unsetField = new ListGridField(FIELD_UNSET, MSG.view_groupConfigEdit_unset());
        unsetField.setType(ListGridFieldType.BOOLEAN);
        if (propertyDefinitionSimple.isRequired()) {
            unsetField.setHidden(true);
            unsetField.setCanEdit(false);
        } else {
            unsetField.setHidden(false);
            unsetField.setCanEdit(true);
            unsetField.setCanToggle(false); // otherwise, our handler won't get the form

            // add handler to handle when the user flips the unset bit
            unsetField.addChangedHandler(new com.smartgwt.client.widgets.grid.events.ChangedHandler() {
                public void onChanged(com.smartgwt.client.widgets.grid.events.ChangedEvent event) {
                    Boolean isUnset = (Boolean) event.getValue();
                    FormItem valueItem = event.getForm().getField(FIELD_VALUE);
                    if (isUnset) {
                        int rowNum = event.getRowNum();
                        memberValuesGrid.setEditValue(rowNum, FIELD_VALUE, (String) null);
                    } else {
                        valueItem.focusInItem();
                    }
                    valueItem.redraw();
                }
            });

            // add handler when user clears the value field - this should turn on the "unset" button
            valueField.addChangeHandler(new com.smartgwt.client.widgets.grid.events.ChangeHandler() {
                public void onChange(com.smartgwt.client.widgets.grid.events.ChangeEvent event) {
                    int rowNum = event.getRowNum();
                    if (event.getValue() == null || event.getValue().toString().length() == 0) {
                        memberValuesGrid.setEditValue(rowNum, FIELD_UNSET, true);
                    } else {
                        memberValuesGrid.setEditValue(rowNum, FIELD_UNSET, false);
                    }
                }
            });
        }

        idField.setWidth("75");
        memberField.setWidth("*");
        unsetField.setWidth("50");
        valueField.setWidth("45%");
        memberValuesGrid.setFields(idField, memberField, unsetField, valueField);
        layout.addMember(memberValuesGrid);

        // create the footer strip - will contain ok and cancel buttons
        EnhancedToolStrip footerStrip = new EnhancedToolStrip();
        footerStrip.setWidth100();
        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);

            // create a small form in the header strip to allow the user to apply a value to ALL rows
            final DynamicForm setAllForm = new DynamicForm();
            setAllForm.setNumCols(3);
            setAllForm.setCellPadding(5);
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.