Package com.smartgwt.client.widgets.form

Examples of com.smartgwt.client.widgets.form.DynamicForm


    }

    public Canvas getCanvas() {
        if (form == null) {

            form = new DynamicForm();
            form.setNumCols(1);
            List<FormItem> formItems = new ArrayList<FormItem>(2);

            if (null != namePrompt) {
                TextItem nameItem = new TextItem("resourceName", namePrompt);
View Full Code Here


            public void onSuccess(HashMap<String, String> result) {
                String version = result.get("rhq-server.version");
                String build = result.get("rhq-server.build-number");
                String md5 = result.get("rhq-client.md5");

                DynamicForm form = new DynamicForm();
                form.setMargin(10);
                form.setWidth100();

                StaticTextItem versionItem = new StaticTextItem("cliVersion", MSG.view_admin_downloads_cli_version());
                versionItem.setValue(version);
                versionItem.setWrapTitle(false);

                StaticTextItem buildItem = new StaticTextItem("cliBuild", MSG.view_admin_downloads_cli_buildNumber());
                buildItem.setValue(build);
                buildItem.setWrapTitle(false);

                StaticTextItem md5Item = new StaticTextItem("cliMd5", MSG.view_admin_downloads_cli_md5());
                md5Item.setValue(md5);
                md5Item.setWrapTitle(false);

                StaticTextItem linkItem = new StaticTextItem("cliLink");
                linkItem.setTitle(MSG.common_label_link());
                linkItem.setValue("<a href=\"/client/download\">"
                    + MSG.view_admin_downloads_cli_link_value(version, build) + "</a>");

                SpacerItem spacerItem = new SpacerItem("clientSpacer");
                spacerItem.setHeight(1);

                StaticTextItem helpItem = new StaticTextItem("clientHelp");
                helpItem.setColSpan(2);
                helpItem.setShowTitle(false);
                helpItem.setValue(MSG.view_admin_downloads_cli_help(productInfo.getShortName()));

                form.setItems(versionItem, buildItem, md5Item, linkItem, spacerItem, helpItem);

                cliSection.setItems(form);
                cliSection.setExpanded(true);
                sectionStack.markForRedraw();
            }
View Full Code Here

    private void prepareBundleSection() {
        systemManager.getBundleDeployerDownload(new AsyncCallback<HashMap<String, String>>() {
            @Override
            public void onSuccess(HashMap<String, String> result) {
                DynamicForm form = new DynamicForm();
                form.setMargin(10);
                form.setWidth100();

                // there is only one item in the returned map - key=name, value=url
                String name = result.keySet().iterator().next();
                String url = result.values().iterator().next();

                StaticTextItem linkItem = new StaticTextItem("bundleLink");
                linkItem.setTitle(MSG.common_label_link());
                linkItem.setValue("<a href=\"" + url + "\">" + MSG.view_admin_downloads_bundle_link_value(name)
                    + "</a>");

                SpacerItem spacerItem = new SpacerItem("bundleSpacer");
                spacerItem.setHeight(1);

                StaticTextItem helpItem = new StaticTextItem("bundleHelp");
                helpItem.setColSpan(2);
                helpItem.setShowTitle(false);
                helpItem.setValue(MSG.view_admin_downloads_bundle_help(productInfo.getShortName()));

                form.setItems(linkItem, spacerItem, helpItem);

                bundleSection.setItems(form);
                bundleSection.setExpanded(true);
                sectionStack.markForRedraw();
            }
View Full Code Here

    private void prepareConnectorsSection() {
        systemManager.getConnectorDownloads(new AsyncCallback<HashMap<String, String>>() {
            @Override
            public void onSuccess(HashMap<String, String> result) {
                DynamicForm form = new DynamicForm();
                form.setMargin(10);
                form.setWidth100();

                if (result != null && !result.isEmpty()) {
                    int i = 0;
                    FormItem[] items = new FormItem[result.size() + 2];

                    for (Map.Entry<String, String> entry : result.entrySet()) {
                        StaticTextItem linkItem = new StaticTextItem("link" + i);
                        linkItem.setTitle(MSG.common_label_link());
                        linkItem.setValue("<a href=\"" + entry.getValue() + "\">" + entry.getKey() + "</a>");
                        items[i++] = linkItem;
                    }

                    SpacerItem spacerItem = new SpacerItem("spacer");
                    spacerItem.setHeight(5);
                    items[i++] = spacerItem;

                    StaticTextItem helpText = new StaticTextItem("connectorHelp");
                    helpText.setColSpan(2);
                    helpText.setShowTitle(false);
                    helpText.setValue(MSG.view_admin_downloads_connectors_help(productInfo.getShortName()));
                    items[i++] = helpText;

                    form.setItems(items);
                } else {
                    StaticTextItem item = new StaticTextItem("noConnectors");
                    item.setColSpan(2);
                    item.setShowTitle(false);
                    item.setValue(MSG.view_admin_downloads_connectors_none());
                    form.setItems(item);
                }

                connectorsSection.setItems(form);
                connectorsSection.setExpanded(true);
                sectionStack.markForRedraw();
View Full Code Here

    private void prepareCliAlertScriptsSection() {
        systemManager.getCliAlertScriptDownloads(new AsyncCallback<HashMap<String, String>>() {

            @Override
            public void onSuccess(HashMap<String, String> result) {
                DynamicForm form = new DynamicForm();
                form.setMargin(10);
                form.setWidth100();

                if (result != null && !result.isEmpty()) {
                    int i = 0;
                    FormItem[] items = new FormItem[result.size() + 2];

                    for (Map.Entry<String, String> entry : result.entrySet()) {
                        StaticTextItem linkItem = new StaticTextItem("link" + i);
                        linkItem.setTitle(MSG.common_label_link());
                        linkItem.setValue("<a href=\"" + entry.getValue() + "\">" + entry.getKey() + "</a>");
                        items[i++] = linkItem;
                    }

                    SpacerItem spacerItem = new SpacerItem("spacer");
                    spacerItem.setHeight(5);
                    items[i++] = spacerItem;

                    StaticTextItem helpText = new StaticTextItem("cliAlertScriptsHelp");
                    helpText.setColSpan(2);
                    helpText.setShowTitle(false);
                    helpText.setValue(MSG.view_admin_downloads_cliAlertScripts_help());
                    items[i++] = helpText;

                    form.setItems(items);
                } else {
                    StaticTextItem item = new StaticTextItem("noCliAlertScripts");
                    item.setColSpan(2);
                    item.setShowTitle(false);
                    item.setValue(MSG.view_admin_downloads_cliAlertScripts_none());
                    form.setItems(item);
                }

                cliAlertScriptsSection.setItems(form);
                cliAlertScriptsSection.setExpanded(true);
                sectionStack.markForRedraw();
View Full Code Here

    private void prepareScriptModulesSection() {
        systemManager.getScriptModulesDownloads(new AsyncCallback<HashMap<String, String>>() {

            @Override
            public void onSuccess(HashMap<String, String> result) {
                DynamicForm form = new DynamicForm();
                form.setMargin(10);
                form.setWidth100();

                if (result != null && !result.isEmpty()) {
                    int i = 0;
                    FormItem[] items = new FormItem[result.size() + 2];

                    for (Map.Entry<String, String> entry : result.entrySet()) {
                        StaticTextItem linkItem = new StaticTextItem("link" + i);
                        linkItem.setTitle(MSG.common_label_link());
                        linkItem.setValue("<a href=\"" + entry.getValue() + "\">" + entry.getKey() + "</a>");
                        items[i++] = linkItem;
                    }

                    SpacerItem spacerItem = new SpacerItem("spacer");
                    spacerItem.setHeight(5);
                    items[i++] = spacerItem;

                    StaticTextItem helpText = new StaticTextItem("scriptModulesHelp");
                    helpText.setColSpan(2);
                    helpText.setShowTitle(false);
                    helpText.setValue(MSG.view_admin_downloads_scriptModules_help());
                    items[i++] = helpText;

                    form.setItems(items);
                } else {
                    StaticTextItem item = new StaticTextItem("noScriptModules");
                    item.setColSpan(2);
                    item.setShowTitle(false);
                    item.setValue(MSG.view_admin_downloads_scriptModules_none());
                    form.setItems(item);
                }

                scriptModulesSection.setItems(form);
                scriptModulesSection.setExpanded(true);
                sectionStack.markForRedraw();
View Full Code Here

        return MSG.view_bundle_deployWizard_getInfoStep();
    }

    public Canvas getCanvas() {
        if (form == null) {
            form = new DynamicForm();
            form.setWidth100();
            form.setNumCols(2);
            form.setColWidths("50%", "*");

            bundleServer.getBundleDeploymentName(wizard.getDestination().getId(), wizard.getBundleVersion().getId(),
View Full Code Here

    /** Define search for case insensitive filtering on ldap name.
     */
    @Override
    protected DynamicForm getAvailableFilterForm() {
        DynamicForm availableFilterForm = new DynamicForm();
        {
            availableFilterForm.setWidth100();
            availableFilterForm.setNumCols(2);
        }
        int groupPanelWidth = 375;
        int groupPanelHeight = 150;

        // Structure the display area into two separate display regions
        // Available Groups region
        final DynamicForm availableGroupDetails = new DynamicForm();
        {
            availableGroupDetails.setWidth(groupPanelWidth);
            availableGroupDetails.setHeight(groupPanelHeight);
            availableGroupDetails.setGroupTitle(MSG.common_title_ldapGroupsAvailable());
            availableGroupDetails.setIsGroup(true);
            availableGroupDetails.setWrapItemTitles(false);
            //add itemChanged handler to listen for changes to SearchItem
            availableGroupDetails.addItemChangedHandler(new ItemChangedHandler() {
                public void onItemChanged(ItemChangedEvent itemChangedEvent) {

                    latestCriteria = getLatestCriteria(null);

                    Timer timer = new Timer() {
                        @Override
                        public void run() {
                            if (latestCriteria != null) {
                                Criteria criteria = latestCriteria;
                                latestCriteria = null;
                                populateAvailableGrid(criteria);
                            }
                        }
                    };
                    timer.schedule(500);
                }
            });
        }
        final TextItem resultCountItem = new TextItem("resultCount", MSG.common_title_groupsFound());
        {
            resultCountItem.setCanEdit(false);
            resultCountItem.setWidth("100%");
        }
        final TextItem pageCountItem = new TextItem("pageCount", MSG.common_title_queryPagesParsed());
        {
            pageCountItem.setCanEdit(false);
            pageCountItem.setWidth("100%");
        }
        final TextAreaItem adviceItem = new TextAreaItem("advice", MSG.common_title_suggest());
        {
            adviceItem.setWidth("100%");
            adviceItem.setHeight(20);
            String feedback = MSG.common_val_none();
            adviceItem.setValue(feedback);
            adviceItem.setTooltip(feedback);
            adviceItem.setDisabled(true);
            adviceItem.addChangeHandler(new ChangeHandler() {
                @Override
                public void onChange(ChangeEvent event) {
                    event.cancel();
                    cursorPosition = adviceItem.getSelectionRange()[0];
                }
            });
            adviceItem.addChangedHandler(new ChangedHandler() {

                @Override
                public void onChanged(ChangedEvent event) {
                    adviceItem.setSelectionRange(cursorPosition, cursorPosition);
                }
            });
        }
        //Customize Search component
        {
            searchTextItem.setName(MSG.common_title_search());
            searchTextItem.setTitle(MSG.view_admin_roles_filterResultsBelow());
            searchTextItem.setWidth("100%");
            searchTextItem.setTooltip(MSG.common_msg_typeToFilterResults());
        }
        final FormItemIcon loadingIcon = new FormItemIcon();
        final FormItemIcon successIcon = new FormItemIcon();
        final FormItemIcon failIcon = new FormItemIcon();
        final FormItemIcon attentionIcon = new FormItemIcon();
        String successIconPath = "[SKIN]/actions/ok.png";
        String failedIconPath = "[SKIN]/actions/exclamation.png";
        String loadingIconPath = "[SKIN]/loading.gif";
        String attentionIconPath = "[SKIN]/Dialog/warn.png";
        loadingIcon.setSrc(loadingIconPath);
        successIcon.setSrc(successIconPath);
        failIcon.setSrc(failedIconPath);
        attentionIcon.setSrc(attentionIconPath);

        final StaticTextItem groupQueryStatus = new StaticTextItem();
        {
            groupQueryStatus.setName("groupQueryStatus");
            groupQueryStatus.setTitle(MSG.common_title_queryProgress());
            groupQueryStatus.setDefaultValue(MSG.common_msg_loading());
            groupQueryStatus.setIcons(loadingIcon);
        }
        availableGroupDetails.setItems(resultCountItem, pageCountItem, groupQueryStatus, adviceItem, searchTextItem);

        // Ldap Group Settings region
        final DynamicForm ldapGroupSettings = new DynamicForm();
        {
            ldapGroupSettings.setWidth(groupPanelWidth);
            ldapGroupSettings.setHeight(groupPanelHeight);
            ldapGroupSettings.setGroupTitle(MSG.view_adminRoles_ldapGroupsSettingsReadOnly());
            ldapGroupSettings.setIsGroup(true);
            ldapGroupSettings.setWrapItemTitles(false);
        }
        final TextItem groupSearch = new TextItem("groupSearch", MSG.view_admin_systemSettings_LDAPFilter_name());
        {
            groupSearch.setCanEdit(false);
            groupSearch.setWidth("100%");
        }
        final TextItem groupMember = new TextItem("groupMember", MSG.view_admin_systemSettings_LDAPGroupMember_name());
        {
            groupMember.setCanEdit(false);
            groupMember.setWidth("100%");
        }
        final CheckboxItem groupQueryPagingItem = new CheckboxItem("groupQueryEnable",
            MSG.view_admin_systemSettings_LDAPGroupUsePaging_name());
        {
            groupQueryPagingItem.setCanEdit(false);
            groupQueryPagingItem.setValue(false);
            groupQueryPagingItem.setShowLabel(false);
            groupQueryPagingItem.setShowTitle(true);
            groupQueryPagingItem.setTitleOrientation(TitleOrientation.LEFT);
            //You have to set this attribute
            groupQueryPagingItem.setAttribute("labelAsTitle", true);
        }
        final TextItem groupQueryPagingCountItem = new TextItem("groupQueryCount",
            MSG.view_adminRoles_ldapQueryPageSize());
        {
            groupQueryPagingCountItem.setCanEdit(false);
            groupQueryPagingCountItem.setWidth("100%");
        }
        final CheckboxItem groupUsePosixGroupsItem = new CheckboxItem("groupUsePosixGroups",
            MSG.view_admin_systemSettings_LDAPGroupUsePosixGroup_name());
        {
            groupUsePosixGroupsItem.setCanEdit(false);
            groupUsePosixGroupsItem.setValue(false);
            groupUsePosixGroupsItem.setShowLabel(false);
            groupUsePosixGroupsItem.setShowTitle(true);
            groupUsePosixGroupsItem.setTitleOrientation(TitleOrientation.LEFT);
            //You have to set this attribute
            groupUsePosixGroupsItem.setAttribute("labelAsTitle", true);
        }
        ldapGroupSettings.setItems(groupSearch, groupMember, groupQueryPagingItem, groupQueryPagingCountItem,
            groupUsePosixGroupsItem);

        // orient both panels next to each other
        HLayout panel = new HLayout();
        {
            panel.addMember(availableGroupDetails);
            DynamicForm spacerWrapper = new DynamicForm();
            spacerWrapper.setItems(new SpacerItem());
            panel.addMember(spacerWrapper);
            panel.addMember(ldapGroupSettings);
        }
        availableFilterForm.addChild(panel);

View Full Code Here

    }

    @Override
    protected void onDraw() {
        super.onDraw();
        DynamicForm form = null;
        if (createHistory != null) {
            form = buildForCreate(createHistory);
        } else if (deleteHistory != null) {
            form = buildForDelete(deleteHistory);
        }
View Full Code Here

        }
        addMember(form);
    }

    private DynamicForm buildForCreate(CreateResourceHistory history) {
        DynamicForm form = new DynamicForm();
        form.setWidth100();
        form.setHeight100();
        form.setWrapItemTitles(false);

        StaticTextItem id = new StaticTextItem("id", MSG.common_title_id());
        id.setValue(history.getId());

        StaticTextItem type = new StaticTextItem("type", MSG.common_title_type());
        String typeValue = Canvas.imgHTML(ChildHistoryView.CHILD_CREATED_ICON);
        typeValue += MSG.view_resource_inventory_childhistory_createdChild();
        type.setValue(typeValue);

        StaticTextItem createdTimestamp = new StaticTextItem("created", MSG.common_title_dateCreated());
        createdTimestamp.setValue(TimestampCellFormatter.format(history.getCreatedDate(),
            TimestampCellFormatter.DATE_TIME_FORMAT_FULL));

        StaticTextItem modifiedTimestamp = new StaticTextItem("created", MSG.common_title_lastUpdated());
        modifiedTimestamp.setValue(TimestampCellFormatter.format(history.getLastModifiedDate(),
            TimestampCellFormatter.DATE_TIME_FORMAT_FULL));

        StaticTextItem subject = new StaticTextItem("subject", MSG.common_title_user());
        subject.setValue(history.getSubjectName());

        StaticTextItem status = new StaticTextItem("status", MSG.common_title_status());
        switch (history.getStatus()) {
        case SUCCESS:
            status.setValue(MSG.common_status_success());
            break;
        case FAILURE:
            status.setValue(MSG.common_status_failed());
            break;
        case IN_PROGRESS:
            status.setValue(MSG.common_status_inprogress());
            break;
        case INVALID_ARTIFACT:
            status.setValue(MSG.view_resource_inventory_childhistory_status_invalidArtifact());
            break;
        case INVALID_CONFIGURATION:
            status.setValue(MSG.view_resource_inventory_childhistory_status_invalidConfig());
            break;
        case TIMED_OUT:
            status.setValue(MSG.common_status_timedOut());
            break;
        default:
            status.setValue("?");
        }

        StaticTextItem createdResourceName = new StaticTextItem("createdResourceName", MSG.common_title_resource_name());
        createdResourceName.setValue(history.getCreatedResourceName());

        StaticTextItem createdResourceKey = new StaticTextItem("createdResourceKey", MSG.common_title_resource_key());
        createdResourceKey.setValue(history.getNewResourceKey());

        StaticTextItem createdResourceType = new StaticTextItem("createdResourceType", MSG.common_title_resource_type());
        if (history.getResourceType() != null) {
            createdResourceType.setValue(history.getResourceType().getName());
        } else {
            createdResourceType.setValue(MSG.common_status_unknown());
        }

        TextAreaItem errorMessage = new TextAreaItem("errorMessage", MSG.common_severity_error());
        errorMessage.setValue(history.getErrorMessage());
        errorMessage.setTitleOrientation(TitleOrientation.TOP);
        errorMessage.setColSpan(2);
        errorMessage.setWidth("100%");
        errorMessage.setHeight("100%");

        if (history.getErrorMessage() != null && history.getErrorMessage().length() > 0) {
            form.setItems(id, type, createdTimestamp, modifiedTimestamp, subject, createdResourceName,
                createdResourceKey, createdResourceType, status, errorMessage);
        } else {
            form.setItems(id, type, createdTimestamp, modifiedTimestamp, subject, createdResourceName,
                createdResourceKey, createdResourceType, status);
        }

        return form;
    }
View Full Code Here

TOP

Related Classes of com.smartgwt.client.widgets.form.DynamicForm

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.