Package com.smartgwt.client.widgets.form.fields

Examples of com.smartgwt.client.widgets.form.fields.StaticTextItem


        actionItem.setColSpan(1);
        actionItem.setRowSpan(3);
        actionItem.setShowTitle(false);
        actionItem.setCanvas(getActionCanvas());

        StaticTextItem versionCountItem = new StaticTextItem("versionCount", MSG.view_bundle_list_versionsCount());
        versionCountItem.setValue(bundle.getBundleVersions() != null ? bundle.getBundleVersions().size() : 0);

        StaticTextItem destinationsCountItem = new StaticTextItem("destinationsCount",
            MSG.view_bundle_list_destinationsCount());
        destinationsCountItem.setValue(bundle.getDestinations() != null ? bundle.getDestinations().size() : 0);

        StaticTextItem descriptionItem = new StaticTextItem("description", MSG.common_title_description());
        descriptionItem.setValue(StringUtility.escapeHtml(bundle.getDescription()));

        form.setFields(versionCountItem, actionItem, destinationsCountItem, descriptionItem);

        return form;
    }
View Full Code Here


            }
        });

        // for SPECIFIC mode

        singleResourceTextItem = new StaticTextItem("singleResourceTextItem",
            MSG.view_alert_definition_notification_operation_editor_specific_resource());
        singleResourceTextItem.setStartRow(true);
        singleResourceTextItem.setEndRow(false);
        singleResourceTextItem.setValue("Pick a resource...");
        singleResourceTextItem.setShowIfCondition(new ShowIfModeFunction(ResourceSelectionMode.SPECIFIC));
View Full Code Here

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

                StaticTextItem versionItem = new StaticTextItem("agentVersion", MSG
                    .view_admin_downloads_agent_version());
                versionItem.setValue(version);
                versionItem.setWrapTitle(false);

                StaticTextItem buildItem = new StaticTextItem("agentBuild", MSG
                    .view_admin_downloads_agent_buildNumber());
                buildItem.setValue(build);
                buildItem.setWrapTitle(false);

                StaticTextItem md5Item = new StaticTextItem("agentMd5", MSG.view_admin_downloads_agent_md5());
                md5Item.setValue(md5);
                md5Item.setWrapTitle(false);

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

                SpacerItem spacerItem = new SpacerItem("agentSpacer");
                spacerItem.setHeight(10);

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

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

                agentSection.setItems(form);
                agentSection.setExpanded(true);
View Full Code Here

            bundleServer.getBundleDeploymentName(wizard.getDestination().getId(), wizard.getBundleVersion().getId(),
                -1, //
                new AsyncCallback<String>() {

                    public void onSuccess(String result) {
                        final StaticTextItem nameTextItem = new StaticTextItem("name", MSG
                            .view_bundle_deployWizard_getInfo_deploymentName());
                        nameTextItem.setWidth(300);
                        wizard.setSubtitle(result);
                        nameTextItem.setValue(result);

                        final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description", MSG
                            .view_bundle_deployWizard_getInfo_deploymentDesc());
                        descriptionTextAreaItem.setWidth(300);
                        descriptionTextAreaItem.addChangedHandler(new ChangedHandler() {
View Full Code Here

                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);
View Full Code Here

                // 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);
View Full Code Here

                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);
View Full Code Here

                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);
View Full Code Here

        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);

        final long ldapGroupSelectorRequestId = System.currentTimeMillis();

        //launch operations to populate/refresh LDAP Group Query contents.
        final Timer ldapPropertiesTimer = new Timer() {
            public void run() {
                //if system properties not set, launch request/update
                String ldapGroupQuery = groupSearch.getValueAsString();
                if ((ldapGroupQuery == null) || (ldapGroupQuery.trim().isEmpty())) {
                    GWTServiceLookup.getSystemService().getSystemSettings(new AsyncCallback<SystemSettings>() {
                        @Override
                        public void onFailure(Throwable caught) {
                            groupQueryStatus.setIcons(failIcon);
                            groupQueryStatus.setDefaultValue(MSG.view_adminRoles_failLdapGroupsSettings());
                            CoreGUI.getErrorHandler().handleError(MSG.view_adminRoles_failLdapGroupsSettings(), caught);
                            Log.debug(MSG.view_adminRoles_failLdapGroupsSettings());
                        }

                        @Override
                        public void onSuccess(SystemSettings settings) {
                            //retrieve relevant information once and update ui
                            String ldapGroupFilter = settings.get(SystemSetting.LDAP_GROUP_FILTER);
                            String ldapGroupMember = settings.get(SystemSetting.LDAP_GROUP_MEMBER);
                            String ldapGroupPagingEnabled = settings.get(SystemSetting.LDAP_GROUP_PAGING);
                            String ldapGroupPagingValue = settings.get(SystemSetting.LDAP_GROUP_QUERY_PAGE_SIZE);
                            String ldapGroupIsPosix = settings.get(SystemSetting.LDAP_GROUP_USE_POSIX);
                            groupSearch.setValue(ldapGroupFilter);
                            groupMember.setValue(ldapGroupMember);
                            groupQueryPagingItem.setValue(Boolean.valueOf(ldapGroupPagingEnabled));
                            groupQueryPagingCountItem.setValue(ldapGroupPagingValue);
                            groupUsePosixGroupsItem.setValue(Boolean.valueOf(ldapGroupIsPosix));
                            ldapGroupSettings.markForRedraw();
                        }
                    });
                }
            }
        };
        ldapPropertiesTimer.schedule(2000); // repeat interval in milliseconds, e.g. 30000 = 30seconds

        //launch operations to populate/refresh LDAP Group Query contents.
        final Timer availableGroupsTimer = new Timer() {
            public void run() {
                final String attention = MSG.common_status_attention();
                final String success = MSG.common_status_success();
                final String none = MSG.common_val_none();
                final String failed = MSG.common_status_failed();
                //make request to RHQ about state of latest LDAP GWT request
                GWTServiceLookup.getLdapService().findAvailableGroupsStatus(
                    new AsyncCallback<Set<Map<String, String>>>() {
                        @Override
                        public void onFailure(Throwable caught) {
                            groupQueryStatus.setIcons(failIcon);
                            groupQueryStatus.setDefaultValue(failed);
                            String adviceValue = MSG.view_adminRoles_failLdapAvailableGroups();
                            adviceItem.setValue(adviceValue);
                            adviceItem.setTooltip(adviceValue);
                            CoreGUI.getErrorHandler()
                                .handleError(MSG.view_adminRoles_failLdapAvailableGroups(), caught);
                            retryAttempt++;
                            if (retryAttempt > 3) {
                                cancel();//kill thread
                                Log.debug(MSG.view_adminRoles_failLdapRetry());
                                retryAttempt = 0;
                            }
                        }

                        @Override
                        public void onSuccess(Set<Map<String, String>> results) {
                            long start = -1, current = -1;
                            int pageCount = 0;
                            int resultCountValue = 0;
                            boolean queryCompleted = false;
                            for (Map<String, String> map : results) {
                                String key = map.keySet().toArray()[0] + "";
                                if (key.equals("query.results.parsed")) {
                                    String value = map.get(key);
                                    resultCountItem.setValue(value);
                                    resultCountValue = Integer.valueOf(value);
                                } else if (key.equals("query.complete")) {
                                    String value = map.get(key);
                                    queryCompleted = Boolean.valueOf(value);
                                } else if (key.equals("query.start.time")) {
                                    String value = map.get(key);
                                    start = Long.valueOf(value);
                                } else if (key.equals("query.current.time")) {
                                    String value = map.get(key);
                                    current = Long.valueOf(value);
                                } else if (key.equals("query.page.count")) {
                                    String value = map.get(key);
                                    pageCountItem.setValue(value);
                                    pageCount = Integer.valueOf(value);
                                }
                            }

                            if (resultCountValue == 0) {
                                noProgressAttempts++;
                            }
                            //Update status information
                            String warnTooManyResults = MSG.view_adminRoles_ldapWarnTooManyResults();
                            String warnQueryTakingLongResults = MSG.view_adminRoles_ldapWarnQueryTakingLongResults();
                            String warnParsingManyPagesResults = MSG.view_adminRoles_ldapWarnParsingManyPagesResults();

                            boolean resultCountWarning = false;
                            boolean pageCountWarning = false;
                            boolean timePassingWarning = false;
                            if ((resultCountWarning = (resultCountValue > 5000))
                                || (pageCountWarning = (pageCount > 5))
                                || (timePassingWarning = (current - start) > 5 * 1000)) {
                                adviceItem.setDisabled(false);
                                groupQueryStatus.setIcons(attentionIcon);
                                if (resultCountWarning) {
                                    adviceItem.setValue(warnTooManyResults);
                                    adviceItem.setTooltip(warnTooManyResults);
                                } else if (pageCountWarning) {
                                    adviceItem.setValue(warnParsingManyPagesResults);
                                    adviceItem.setTooltip(warnParsingManyPagesResults);
                                } else if (timePassingWarning) {
                                    adviceItem.setValue(warnQueryTakingLongResults);
                                    adviceItem.setTooltip(warnQueryTakingLongResults);
                                }
                            }

                            //act on status details to add extra perf suggestions. Kill threads older than 30 mins
                            long parseTime = System.currentTimeMillis() - ldapGroupSelectorRequestId;
                            if ((queryCompleted) || (parseTime) > 30 * 60 * 1000) {
                                String tooManyResults = MSG.view_adminRoles_ldapTooManyResults();
                                String queryTookLongResults = MSG.view_adminRoles_ldapTookLongResults(parseTime + "");
                                String queryTookManyPagesResults = MSG
                                    .view_adminRoles_ldapTookManyPagesResults(pageCount + "");

                                adviceItem.setDisabled(false);
                                groupQueryStatus.setIcons(attentionIcon);
                                groupQueryStatus.setDefaultValue(attention);
                                if (resultCountValue > 20000) {//results throttled
                                    adviceItem.setValue(tooManyResults);
                                    adviceItem.setTooltip(tooManyResults);
                                    Log.debug(tooManyResults);//log error to client.
                                } else if ((current - start) >= 10 * 1000) {// took longer than 10s
                                    adviceItem.setValue(queryTookLongResults);
                                    adviceItem.setTooltip(queryTookLongResults);
                                    Log.debug(queryTookLongResults);//log error to client.
                                } else if (pageCount >= 20) {// required more than 20 pages of results
                                    adviceItem.setValue(queryTookManyPagesResults);
                                    adviceItem.setTooltip(queryTookManyPagesResults);
                                    Log.debug(queryTookManyPagesResults);//log error to client.
                                } else {//simple success.
                                    groupQueryStatus.setDefaultValue(success);
                                    groupQueryStatus.setIcons(successIcon);
                                    adviceItem.setValue(none);
                                    adviceItem.setTooltip(none);
                                    adviceItem.setDisabled(true);
                                }
                                noProgressAttempts = 0;
                                //now cancel the timer
                                cancel();
                            } else if (noProgressAttempts >= 10) {//availGroups query stuck on server side
                                //cancel the timer.
                                cancel();
                                String clientSideQuitting = MSG.view_adminRoles_failLdapCancelling();//catch all
                                adviceItem.setDisabled(false);
                                groupQueryStatus.setIcons(attentionIcon);
                                adviceItem.setValue(clientSideQuitting);
                                adviceItem.setTooltip(clientSideQuitting);
                                noProgressAttempts = 0;
                                Log.debug(clientSideQuitting);//log error to client.
                            }
View Full Code Here

        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);
View Full Code Here

TOP

Related Classes of com.smartgwt.client.widgets.form.fields.StaticTextItem

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.