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

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


                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);
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_DELETED_ICON);
        typeValue += MSG.view_resource_inventory_childhistory_deletedChild();
        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 TIMED_OUT:
            status.setValue(MSG.common_status_timedOut());
            break;
        default:
            status.setValue("?");
        }

        StaticTextItem deletedResourceName = new StaticTextItem("deletedResourceName", MSG.common_title_resource_name());
        StaticTextItem deletedResourceType = new StaticTextItem("deletedResourceType", MSG.common_title_resource_type());

        if (history.getResource() != null) {
            deletedResourceName.setValue(history.getResource().getName());
            if (history.getResource().getResourceType() != null) {
                deletedResourceType.setValue(history.getResource().getResourceType().getName());
            } else {
                deletedResourceType.setValue(MSG.common_status_unknown());
            }
        } else {
            deletedResourceName.setValue(MSG.common_status_unknown());
            deletedResourceType.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

                                                            window.show();

                                                        }
                                                    });

                                                    StaticTextItem time = AbstractActivityView.newTextItem(GwtRelativeDurationConverter
                                                            .format(oob.getTimestamp()));

                                                    row.setItems(link, time);
                                                    column.addMember(row);
                                                }
View Full Code Here

    private MeasurementDefinition measurementDefinition;

    private int resourceId = -1;

    public MetricsChartWindow() {
        baselineText = new StaticTextItem();
        expectedRangeHighText = new StaticTextItem();
        expectedRangeLowText = new StaticTextItem();

        newBaselineMeanText = new FloatItem();
        newBaselineMeanText.setKeyPressFilter("[0-9.]");
        newExpectedRangeHighText = new FloatItem();
        newExpectedRangeHighText.setKeyPressFilter("[0-9.]");
View Full Code Here

                if (!result.isEmpty()) {
                    for (InstalledPackageHistory history : result) {
                        DynamicForm row = new DynamicForm();
                        row.setNumCols(3);

                        StaticTextItem iconItem = AbstractActivityView.newTextItemIcon(
                            "subsystems/content/Package_16.png", null);
                        String title = history.getPackageVersion().getFileName() + ":";
                        //String destination = "/portal/rhq/resource/content/audit-trail-item.xhtml?id=" + groupId
                        //   + "&selectedHistoryId=" + history.getId();
                        //spinder 4/27/11: disabling links as they point into portal.war content pages
                        //                        LinkItem link = AbstractActivityView.newLinkItem(title, destination);
                        StaticTextItem link = AbstractActivityView.newTextItem(title);
                        StaticTextItem time = AbstractActivityView.newTextItem(GwtRelativeDurationConverter
                            .format(history.getTimestamp()));

                        row.setItems(iconItem, link, time);
                        column.addMember(row);
                    }
View Full Code Here

                    link.disable();
                }

                //Value
                String convertedValue = AbstractActivityView.convertLastValueForDisplay(lastValue, md);
                StaticTextItem value = AbstractActivityView.newTextItem(convertedValue);
                value.setVAlign(VerticalAlignment.TOP);
                value.setAlign(Alignment.RIGHT);
                value.setWidth("100%");

                row.setItems(graphContainer, link, value);

                //if graph content returned
                if ((!md.getName().trim().contains("Trait.")) && (lastValue != -1)) {
View Full Code Here

                                                    window.addItem(graphView);
                                                    window.show();
                                                }
                                            });

                                            StaticTextItem time = AbstractActivityView.newTextItem(GwtRelativeDurationConverter
                                                    .format(oob.getTimestamp()));

                                            row.setItems(link, time);
                                            column.addMember(row);
                                        }
View Full Code Here

                    if (!result.isEmpty()) {
                        for (BundleDeployment deployment : result) {
                            DynamicForm row = new DynamicForm();
                            row.setNumCols(3);

                            StaticTextItem iconItem = AbstractActivityView.newTextItemIcon(
                                "subsystems/content/Content_16.png", null);
                            String title = deployment.getBundleVersion().getName() + "["
                                + deployment.getBundleVersion().getVersion() + "]:";
                            String destination = LinkManager.getBundleDestinationLink(deployment.getBundleVersion()
                                .getBundle().getId(), deployment.getDestination().getId());
                            LinkItem link = AbstractActivityView.newLinkItem(title, destination);
                            StaticTextItem time = AbstractActivityView.newTextItem(GwtRelativeDurationConverter
                                .format(deployment.getCtime()));

                            row.setItems(iconItem, link, time);
                            column.addMember(row);
                        }
View Full Code Here

                    if (!result.isEmpty()) {
                        for (BundleDeployment deployment : result) {
                            DynamicForm row = new DynamicForm();
                            row.setNumCols(3);

                            StaticTextItem iconItem = AbstractActivityView.newTextItemIcon(
                                "subsystems/content/Content_16.png", null);
                            String title = deployment.getBundleVersion().getName() + "["
                                + deployment.getBundleVersion().getVersion() + "]:";
                            String destination = LinkManager.getBundleDestinationLink(deployment.getBundleVersion()
                                .getBundle().getId(), deployment.getDestination().getId());
                            LinkItem link = AbstractActivityView.newLinkItem(title, destination);
                            StaticTextItem time = AbstractActivityView.newTextItem(GwtRelativeDurationConverter
                                .format(deployment.getCtime()));

                            row.setItems(iconItem, link, time);
                            column.addMember(row);
                        }
View Full Code Here

        form.setMargin(10);
        form.setWidth100();
        form.setWrapItemTitles(false);
        form.setNumCols(2);

        final StaticTextItem nameItem = new StaticTextItem(FIELD_ADDRESS.propertyName(), FIELD_ADDRESS.title());
        nameItem.setValue("<b>" + storageNode.getAddress() + "</b>");

        final StaticTextItem cqlPortItem = new StaticTextItem(FIELD_CQL_PORT.propertyName(), FIELD_CQL_PORT.title());
        cqlPortItem.setValue(storageNode.getCqlPort());

        jmxPortItem = new StaticTextItem("jmxPort", MSG.view_adminTopology_storageNodes_settings_jmxPortName());

        final StaticTextItem operationModeItem = new StaticTextItem(FIELD_OPERATION_MODE.propertyName(),
            FIELD_OPERATION_MODE.title());

        operationModeItem.setValue(storageNode.getOperationMode());
        final StaticTextItem clusterStatusItem = new StaticTextItem(FIELD_STATUS.propertyName(), FIELD_STATUS.title());
        clusterStatusItem.setValue(storageNode.getStatus().toString());

        final StaticTextItem availabilityItem = new StaticTextItem(FIELD_AVAILABILITY.propertyName(),
            FIELD_AVAILABILITY.title());

        // make clickable link to associated resource
        StaticTextItem resourceItem = new StaticTextItem("associatedResource",
            MSG.view_adminTopology_storageNodes_detail_associatedResource());
        String storageNodeItemText = "";
        String availabilityItemText = imgHTML(ImageManager.getAvailabilityIconFromAvailType(AvailabilityType.UNKNOWN));
        Resource storageNodeResource = storageNode.getResource();
        if (storageNodeResource != null && storageNodeResource.getName() != null) {
            String detailsUrl = LinkManager.getResourceLink(storageNodeResource.getId());
            String formattedValue = StringUtility.escapeHtml(storageNodeResource.getName());
            storageNodeItemText = LinkManager.getHref(detailsUrl, formattedValue);

            // set the availability
            ResourceAvailability availability = storageNodeResource.getCurrentAvailability();
            if (storageNodeResource.getCurrentAvailability() != null
                && storageNodeResource.getCurrentAvailability().getAvailabilityType() != null) {
                availabilityItemText = imgHTML(ImageManager.getAvailabilityIconFromAvailType(availability
                    .getAvailabilityType()));
            }
        } else {
            storageNodeItemText = MSG.common_label_none();
        }
        resourceItem.setValue(storageNodeItemText);
        availabilityItem.setValue(availabilityItemText);

        StaticTextItem installationDateItem = new StaticTextItem(FIELD_CTIME.propertyName(), FIELD_CTIME.title());
        installationDateItem.setValue(TimestampCellFormatter.format(Long.valueOf(storageNode.getCtime()),
            TimestampCellFormatter.DATE_TIME_FORMAT_LONG));

        StaticTextItem lastUpdateItem = new StaticTextItem(FIELD_MTIME.propertyName(), FIELD_MTIME.title());
        lastUpdateItem.setValue(TimestampCellFormatter.format(Long.valueOf(storageNode.getMtime()),
            TimestampCellFormatter.DATE_TIME_FORMAT_LONG));

        alertsItem = new StaticTextItem(FIELD_ALERTS.propertyName(), FIELD_ALERTS.title());
        alertsItem.setPrompt(MSG.view_adminTopology_storageNodes_detail_unackAlertsHover());
        if (unackAlerts != -1) {
            alertsItem.setValue(StorageNodeAdminView.getAlertsString(MSG.view_adminTopology_storageNodes_unackAlerts(),
                storageNodeId, unackAlerts));
        }

        StaticTextItem messageItem = new StaticTextItem("message", MSG.view_adminTopology_storageNodes_detail_note());
        StringBuffer message = new StringBuffer();
        boolean isOk = true;
        OperationMode operationMode = storageNode.getOperationMode();
        boolean joining = operationMode == OperationMode.ANNOUNCE || operationMode == OperationMode.BOOTSTRAP
            || operationMode == OperationMode.ADD_MAINTENANCE;
        boolean leaving = operationMode == OperationMode.DECOMMISSION || operationMode == OperationMode.UNANNOUNCE
            || operationMode == OperationMode.REMOVE_MAINTENANCE || operationMode == OperationMode.UNINSTALL;
        if (storageNode.getResource() == null) {
            message.append(MSG.view_adminTopology_storageNodes_detail_noResource() + "<br />");
            isOk = false;
        }
        if (storageNode.getErrorMessage() != null) {
            String noteTextPrefix = (joining ? MSG.view_adminTopology_storageNodes_detail_errorDeployment() + ": "
                : (leaving ? MSG.view_adminTopology_storageNodes_detail_errorUndeployment() + ": " : ""));
            message.append(noteTextPrefix);
            message.append(storageNode.getErrorMessage()).append("<br />");
            isOk = false;
        } else if (storageNode.getFailedOperation() != null) {
            message.append(MSG.view_adminTopology_storageNodes_detail_errorLastOperationFailed());
            isOk = false;
        }
        if (isOk) {
            message.append(MSG.view_adminTopology_storageNodes_detail_ok());
        }
        messageItem.setValue(message.toString());

        StaticTextItem lastOperation = null;
        StaticTextItem lastOperationAck = null;
        boolean isOperationFailed = storageNode.getFailedOperation() != null
            && storageNode.getFailedOperation().getResource() != null;
        if (isOperationFailed) {
            ResourceOperationHistory operationHistory = storageNode.getFailedOperation();
            String value = LinkManager.getSubsystemResourceOperationHistoryLink(operationHistory.getResource().getId(),
                operationHistory.getId());
            lastOperation = new StaticTextItem("lastOp", MSG.view_operationHistoryDetails_operation());
            String operationTextPrefix = (joining ? MSG.view_adminTopology_storageNodes_detail_errorFailedDeployOp()
                + ": " : (leaving ? MSG.view_adminTopology_storageNodes_detail_errorFailedUneployOp() + ": " : ""));
            lastOperation.setValue(operationTextPrefix
                + LinkManager.getHref(value, operationHistory.getOperationDefinition().getDisplayName()));
        }

        List<FormItem> formItems = new ArrayList<FormItem>(6);
        formItems.addAll(Arrays.asList(nameItem, resourceItem, availabilityItem, cqlPortItem, jmxPortItem));
        if (!CoreGUI.isDebugMode()) {
            formItems.add(operationModeItem); // debug mode fails if this item is added
        }
        formItems.addAll(Arrays
            .asList(clusterStatusItem, installationDateItem, lastUpdateItem, alertsItem, messageItem));
        if (isOperationFailed) {
            formItems.add(lastOperation);
        }
        if (null != storageNode.getErrorMessage() || null != storageNode.getFailedOperation()) {
            lastOperationAck = new StaticTextItem("lastOpAck", "");
            lastOperationAck.setValue("<span style='color: #0099D3;'>" + MSG.common_button_ack() + "</span>");
            lastOperationAck.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    ackFailedOperation(storageNode);
                }
            });
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.