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

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


        final PopupWindow popup = new PopupWindow(null);
        popup.setTitle(MSG.view_groupConfigEdit_valsDiffForProp(propertyDefinitionSimple.getName()));
        popup.setWidth(800);
        popup.setHeight(600);

        EnhancedVLayout layout = buildMemberEditor(propertyDefinitionSimple, aggregatePropertySimple, index,
            aggregateValueItem, popup);

        popup.addItem(layout);
        popup.show();
    }
View Full Code Here


        final PropertySimple aggregatePropertySimple, final Integer index, final FormItem aggregateValueItem,
        final PopupWindow popup) {

        final boolean propertyIsReadOnly = isReadOnly(propertyDefinitionSimple, aggregatePropertySimple);

        EnhancedVLayout layout = new EnhancedVLayout();
        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
View Full Code Here

        return sections;
    }

    protected VLayout defaultView() {
        EnhancedVLayout vLayout = new EnhancedVLayout();
        vLayout.setWidth100();

        // TODO: Admin icon.
        TitleBar titleBar = new TitleBar(MSG.view_admin_administration(), IconEnum.ADMIN.getIcon24x24Path());
        vLayout.addMember(titleBar);

        ProductInfo productInfo = CoreGUI.get().getProductInfo();

        Label label = new Label(MSG.view_admin_landing(productInfo.getShortName()));
        label.setPadding(10);
        vLayout.addMember(label);

        return vLayout;
    }
View Full Code Here

        }.run(); // fire the timer immediately
    }

    private Layout getCanvas() {
        if (null == this.canvas) {
            EnhancedVLayout layout = new EnhancedVLayout();
            layout.setHeight100();
            layout.setWidth100();
            layout.setMargin(5);
            this.canvas = layout;
        }

        return this.canvas;
    }
View Full Code Here

TOP

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

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.