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

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


        SpacerItem spacer = new SpacerItem();

        //StaticTextItem id = new StaticTextItem("id", MSG.common_title_id());
        //id.setValue(driftDetails.getDrift().getId());

        StaticTextItem path = new StaticTextItem("path", MSG.common_title_path());
        path.setValue(driftDetails.getDrift().getPath());

        StaticTextItem file = new StaticTextItem("File", MSG.view_tabs_common_content());
        FormItem fileLink = null;

        if (driftDetails.isBinaryFile()) {
            file.setValue(driftDetails.getDrift().getNewDriftFile().getHashId());
            fileLink = spacer;
            driftForm.setItems(path, spacer, file, fileLink);

        } else {
            file.setValue(driftDetails.getDrift().getNewDriftFile().getHashId());
            fileLink = createViewFileLink(driftDetails.getDrift().getNewDriftFile().getHashId(), driftDetails
                .getDrift().getPath(), driftDetails.getChangeSet().getVersion(), driftDetails.getNewFileStatus());
            driftForm.setItems(path, spacer, file, fileLink);
        }
View Full Code Here


        unitsMenu.setValueMap(unitsChoices);
        unitsMenu.setDefaultValue(MeasurementUnits.BYTES.name());

        final TextItem textItem = new TextItem("valueItem", "Value");

        final StaticTextItem resultsValueItem = new StaticTextItem("resultsValue", "Results Value");
        final StaticTextItem resultsUnitItem = new StaticTextItem("resultsUnits", "Results Units");

        ButtonItem button = new ButtonItem("convertItem", "Convert");
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                MeasurementUnits units = MeasurementUnits.valueOf(unitsMenu.getValueAsString());
                String value = textItem.getValueAsString();
                MeasurementNumericValueAndUnits vu = MeasurementParser.parse(value, units);
                resultsValueItem.setValue(vu.getValue().toString());
                resultsUnitItem.setValue(vu.getUnits().name());
            }
        });

        DynamicForm form = new DynamicForm();
        form.setItems(unitsMenu, textItem, button, resultsValueItem, resultsUnitItem);
View Full Code Here

    public static DynamicForm createEmptyDisplayRow(String emptyMessage) {
        DynamicForm row = null;
        row = new DynamicForm();

        row.setNumCols(3);
        StaticTextItem none = new StaticTextItem();
        none.setShowTitle(false);
        none.setDefaultValue(emptyMessage);
        none.setWrap(false);
        row.setItems(none);
        return row;
    }
View Full Code Here

        row.setItems(none);
        return row;
    }

    public static StaticTextItem newTextItemIcon(String imageSrc, String mouseOver) {
        StaticTextItem iconItem = new StaticTextItem();
        FormItemIcon img = new FormItemIcon();
        img.setSrc(imageSrc);
        img.setWidth(16);
        img.setHeight(16);
        if (mouseOver != null) {
            img.setPrompt(mouseOver);
        }
        iconItem.setIcons(img);
        iconItem.setShowTitle(false);
        return iconItem;
    }
View Full Code Here

        link.setShowTitle(false);
        return link;
    }

    public static StaticTextItem newTextItem(String contents) {
        StaticTextItem item = new StaticTextItem();
        item.setDefaultValue(contents);
        item.setShowTitle(false);
        item.setShowPickerIcon(false);
        item.setWrap(false);
        return item;
    }
View Full Code Here

    protected List<FormItem> createFields(final T operationHistory) {
        List<FormItem> items = new ArrayList<FormItem>();

        OperationRequestStatus status = operationHistory.getStatus();

        StaticTextItem idItem = new StaticTextItem(AbstractOperationHistoryDataSource.Field.ID, "Execution ID");
        idItem.setValue(operationHistory.getId());
        items.add(idItem);

        StaticTextItem operationItem = new StaticTextItem(AbstractOperationHistoryDataSource.Field.OPERATION_NAME,
            MSG.view_operationHistoryDetails_operation());
        OperationDefinition operationDefinition = operationHistory.getOperationDefinition();
        operationItem.setValue(operationDefinition.getDisplayName());
        items.add(operationItem);

        StaticTextItem submittedItem = new StaticTextItem(AbstractOperationHistoryDataSource.Field.STARTED_TIME,
            MSG.view_operationHistoryDetails_dateSubmitted());
        if (operationHistory.getStartedTime() == 0) {
            // must have executed serially, halt-on-error was true and a previous resource op failed, thus this never even got submitted to the agent for invocation
            submittedItem.setValue(MSG.common_val_never());
        } else {
            submittedItem.setValue(TimestampCellFormatter.format(operationHistory.getStartedTime()));
        }
        items.add(submittedItem);

        StaticTextItem completedItem = new StaticTextItem("completed", MSG.view_operationHistoryDetails_dateCompleted());
        if (status == OperationRequestStatus.INPROGRESS) {
            completedItem.setValue(MSG.common_val_na());
        } else if (status == OperationRequestStatus.CANCELED) {
            completedItem.setValue(MSG.common_val_never());
        } else {
            completedItem.setValue(TimestampCellFormatter.format(new Date(operationHistory.getStartedTime()
                + operationHistory.getDuration())));
        }
        items.add(completedItem);

        StaticTextItem requesterItem = new StaticTextItem(AbstractOperationHistoryDataSource.Field.SUBJECT,
            MSG.view_operationHistoryDetails_requestor());

        requesterItem.setEscapeHTML(true);
        requesterItem.setValue(operationHistory.getSubjectName());
        items.add(requesterItem);

        StaticTextItem statusItem = new StaticTextItem(AbstractOperationHistoryDataSource.Field.STATUS,
            MSG.view_operationHistoryDetails_status());
        String icon = ImageManager.getFullImagePath(ImageManager.getOperationResultsIcon(status));
        statusItem.setValue("<img src='" + icon + "'/>");
        items.add(statusItem);
        switch (status) {
        case SUCCESS:
            statusItem.setTooltip(MSG.common_status_success());
            break;
        case CANCELED:
        case FAILURE:
            if (status == OperationRequestStatus.CANCELED) {
                statusItem.setTooltip(MSG.common_status_canceled());
            } else {
                statusItem.setTooltip(MSG.common_status_failed());
            }
            StaticTextItem errorLinkItem = new StaticTextItem("errorLink");
            errorLinkItem.setTextAlign(Alignment.LEFT);
            errorLinkItem.setAlign(Alignment.LEFT);
            errorLinkItem.setVAlign(VerticalAlignment.BOTTOM);
            errorLinkItem.setErrorOrientation(FormErrorOrientation.LEFT);
            errorLinkItem.setTitle(MSG.common_severity_error());
            errorLinkItem.setValue("<span style=\"text-decoration:underline;\">"
                + getShortErrorMessage(operationHistory) + "<span>");
            errorLinkItem.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    final Window winModal = new Window();
                    winModal.setTitle(MSG.common_title_details());
                    winModal.setOverflow(Overflow.VISIBLE);
View Full Code Here

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

            StaticTextItem descriptionItem = new StaticTextItem("Description", MSG.common_title_description());
            descriptionItem.setTitleOrientation(TitleOrientation.TOP);
            descriptionItem.setAlign(Alignment.LEFT);
            descriptionItem.setWidth(300);
            formItems.add(descriptionItem);

            SpacerItem spacerItem = new SpacerItem("Spacer");
            formItems.add(spacerItem);
View Full Code Here

    private static Canvas buildAboutCanvas(ProductInfo productInfo) {

        DynamicForm form = new DynamicForm();
        form.setPadding(10);

        StaticTextItem logoItem = new StaticTextItem("logo");
        logoItem.setValue("<img src=\"" + ImageManager.getFullImagePath("header/rhq_logo_28px.png") + "\"/>");
        logoItem.setHeight(28);
        logoItem.setShowTitle(false);
        logoItem.setColSpan(2);
        logoItem.setWrap(false);
        logoItem.setWrapTitle(false);
        logoItem.setAlign(Alignment.CENTER);

        LinkItem productUrl = new LinkItem("url");
        productUrl.setValue(productInfo.getUrl());
        productUrl.setLinkTitle(MSG.common_label_link());
        productUrl.setTitle(productInfo.getFullName());
        productUrl.setTarget("_blank");
        productUrl.setWrap(false);
        productUrl.setWrapTitle(false);

        //Conditionally check for and apply update/patch version details
        String updatePortion = CoreGUI.getUpdateVersion();
        if (updatePortion == null) {
            updatePortion = "";
        }

        StaticTextItem version = new StaticTextItem("version", MSG.view_aboutBox_version());
        version.setValue(productInfo.getVersion() + (updatePortion.trim().length() == 0 ? "" : " " + updatePortion));
        version.setWrap(false);
        version.setWrapTitle(false);

        StaticTextItem buildNumber = new StaticTextItem("buildnumber", MSG.view_aboutBox_buildNumber());
        buildNumber.setValue(productInfo.getBuildNumber()
            + (CoreGUI.isRHQ() ? " (<a target='_blank' href='https://github.com/rhq-project/rhq/commit/"
                + productInfo.getBuildNumber() + "'>GitHub</a>)" : ""));
        buildNumber.setWrap(false);
        buildNumber.setWrapTitle(false);

        StaticTextItem gwtVersion = new StaticTextItem("gwtversion", "GWT " + MSG.common_title_version());
        gwtVersion.setValue(MSG.common_buildInfo_gwtVersion());
        gwtVersion.setWrap(false);
        gwtVersion.setWrapTitle(false);

        StaticTextItem smartGwtVersion = new StaticTextItem("smartgwtversion", "SmartGWT " + MSG.common_title_version());
        smartGwtVersion.setValue(Version.getVersion());
        smartGwtVersion.setWrap(false);
        smartGwtVersion.setWrapTitle(false);

        StaticTextItem allRightsReserved = new StaticTextItem();
        allRightsReserved.setValue(MSG.view_aboutBox_allRightsReserved());
        allRightsReserved.setShowTitle(false);
        allRightsReserved.setColSpan(2);
        allRightsReserved.setWrap(false);
        allRightsReserved.setWrapTitle(false);
        allRightsReserved.setAlign(Alignment.CENTER);

        form.setItems(logoItem, productUrl, version, buildNumber, gwtVersion, smartGwtVersion, allRightsReserved);
        return form;
    }
View Full Code Here

            // Make the radio item title a separate item in the form in order to add contextual help
            // to the right of the title text.  We could also add it to the radio item but then it floats to
            // the right of the last radio button option (I'll leave that commented below if for some reason
            // we want to switch to that approach.
            StaticTextItem radioTitleItem = new StaticTextItem("RadioTitle");
            radioTitleItem.setShowTitle(false);
            radioTitleItem.setTitleOrientation(TitleOrientation.TOP);
            radioTitleItem.setAlign(Alignment.LEFT);
            // The css style "formTitle" is what should work here, but for some reason I wasn't getting the
            // proper color. So instead I grabbed the color from the smartgwt css and declared it explicitly.
            //radioTitleItem.setCellStyle("formTitle");
            radioTitleItem.setValue("<span style=\"font-weight: bold; color: #003168\">"
                + MSG.view_drift_wizard_pinTemplate_infoStepRadioTitle() + " :</span>");
            FormUtility.addContextualHelp(radioTitleItem, MSG.view_drift_wizard_pinTemplate_infoStepRadioHelp());
            formItems.add(radioTitleItem);

            LinkedHashMap<String, String> radioGroupValues = new LinkedHashMap<String, String>();
            radioGroupValues.put(CREATE_TEMPLATE, MSG.view_drift_wizard_pinTemplate_infoStepNewTemplate());
            radioGroupValues.put(SELECT_TEMPLATE, MSG.view_drift_wizard_pinTemplate_infoStepExistingTemplate());

            RadioGroupItem radioGroupItem;
            radioGroupItem = new RadioGroupItem("RadioOptions");
            // The title is mocked as a separate item above
            radioGroupItem.setShowTitle(false);
            //uncomment if we decide to show the title for some reason
            //radioGroupItem.setTitleOrientation(TitleOrientation.TOP);
            radioGroupItem.setWrap(false);
            radioGroupItem.setRequired(true);
            radioGroupItem.setAlign(Alignment.LEFT);
            radioGroupItem.setValueMap(radioGroupValues);
            radioGroupItem.setValue(CREATE_TEMPLATE);
            wizard.setCreateTemplate(true);

            radioGroupItem.addChangedHandler(new ChangedHandler() {
                public void onChanged(ChangedEvent event) {
                    if (SELECT_TEMPLATE.equals(event.getValue()) && null == selectTemplateItem.getValue()) {
                        SC.say(MSG.view_drift_wizard_pinTemplate_infoStepSelectBlocked());
                        event.getItem().setValue(CREATE_TEMPLATE);
                        return;
                    }

                    wizard.setCreateTemplate(CREATE_TEMPLATE.equals(event.getValue()));

                    if (wizard.isCreateTemplate()) {
                        selectTemplateForm.hide();
                        wizard.getView().getNextButton().setTitle(MSG.common_button_next());

                    } else {
                        selectTemplateForm.show();
                        wizard.getView().getNextButton().setTitle(MSG.common_button_finish());
                    }
                    radioForm.markForRedraw();
                }
            });
            formItems.add(radioGroupItem);

            formItems.add(new SpacerItem());

            radioForm.setItems(formItems.toArray(new FormItem[formItems.size()]));
            canvas.addMember(radioForm);

            selectTemplateForm = new DynamicForm();
            selectTemplateForm.setNumCols(1);
            selectTemplateForm.setIsGroup(true);
            selectTemplateForm.setGroupTitle(MSG.view_drift_wizard_pinTemplate_infoStepSelectTitle());
            selectTemplateForm.setPadding(10);
            selectTemplateForm.hide();

            formItems.clear();

            StaticTextItem selectTemplateDescriptionItem = new StaticTextItem("Description",
                MSG.common_title_description());
            selectTemplateDescriptionItem.setTitleOrientation(TitleOrientation.TOP);
            selectTemplateDescriptionItem.setAlign(Alignment.LEFT);
            selectTemplateDescriptionItem.setWidth(300);
            formItems.add(selectTemplateDescriptionItem);

            SpacerItem spacerItem = new SpacerItem();
            spacerItem.setHeight(10);
            formItems.add(spacerItem);
View Full Code Here

        driftForm.setWrapItemTitles(false);
        driftForm.setNumCols(4);

        SpacerItem spacer = new SpacerItem();

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

        StaticTextItem path = new StaticTextItem("path", MSG.common_title_path());
        path.setValue(driftDetails.getDrift().getPath());

        StaticTextItem timestamp = new StaticTextItem("timestamp", MSG.common_title_timestamp());
        timestamp.setValue(TimestampCellFormatter.format(driftDetails.getDrift().getCtime(), DATE_TIME_FORMAT_FULL));

        StaticTextItem category = new StaticTextItem("category", MSG.common_title_category());

        LinkedHashMap<String, String> catIconsMap = new LinkedHashMap<String, String>(3);
        catIconsMap.put(DriftDataSource.CATEGORY_ICON_ADD, DriftDataSource.CATEGORY_ICON_ADD);
        catIconsMap.put(DriftDataSource.CATEGORY_ICON_CHANGE, DriftDataSource.CATEGORY_ICON_CHANGE);
        catIconsMap.put(DriftDataSource.CATEGORY_ICON_REMOVE, DriftDataSource.CATEGORY_ICON_REMOVE);
        LinkedHashMap<String, String> catValueMap = new LinkedHashMap<String, String>(3);
        catValueMap.put(DriftDataSource.CATEGORY_ICON_ADD, MSG.view_drift_category_fileAdded());
        catValueMap.put(DriftDataSource.CATEGORY_ICON_CHANGE, MSG.view_drift_category_fileChanged());
        catValueMap.put(DriftDataSource.CATEGORY_ICON_REMOVE, MSG.view_drift_category_fileRemoved());
        category.setValueMap(catValueMap);
        category.setValueIcons(catIconsMap);
        category.setShowIcons(true);

        StaticTextItem oldFile = new StaticTextItem("oldFile", MSG.view_drift_table_oldFile());
        FormItem oldFileLink = null;

        StaticTextItem newFile = new StaticTextItem("newFile", MSG.view_drift_table_newFile());
        FormItem newFileLink = null;

        if (driftDetails.isBinaryFile()) {
            switch (driftDetails.getDrift().getCategory()) {
            case FILE_ADDED:
                category.setValue(DriftDataSource.CATEGORY_ICON_ADD);
                oldFile.setValue(MSG.common_label_none());
                oldFileLink = spacer;
                newFile.setValue(driftDetails.getDrift().getNewDriftFile().getHashId());
                newFileLink = spacer;
                break;
            case FILE_CHANGED:
                category.setValue(DriftDataSource.CATEGORY_ICON_CHANGE);
                oldFile.setValue(driftDetails.getDrift().getOldDriftFile().getHashId());
                oldFileLink = spacer;
                newFile.setValue(driftDetails.getDrift().getNewDriftFile().getHashId());
                newFileLink = spacer;
                break;
            case FILE_REMOVED:
                category.setValue(DriftDataSource.CATEGORY_ICON_REMOVE);
                oldFile.setValue(driftDetails.getDrift().getOldDriftFile().getHashId());
                oldFileLink = spacer;
                newFile.setValue(MSG.common_label_none());
                newFileLink = spacer;
                break;
            }
            driftForm.setItems(id, spacer, path, spacer, category, spacer, timestamp, spacer, oldFile, oldFileLink,
                newFile, newFileLink);
        } else {
            FormItem viewDiffLink = spacer;
            switch (driftDetails.getDrift().getCategory()) {
            case FILE_ADDED:
                category.setValue(DriftDataSource.CATEGORY_ICON_ADD);
                oldFile.setValue(MSG.common_label_none());
                oldFileLink = spacer;
                newFile.setValue(driftDetails.getDrift().getNewDriftFile().getHashId());
                newFileLink = createViewFileLink(driftDetails.getDrift().getNewDriftFile().getHashId(), driftDetails
                    .getDrift().getPath(), driftDetails.getChangeSet().getVersion(), driftDetails.getNewFileStatus());
                break;
            case FILE_CHANGED:
                category.setValue(DriftDataSource.CATEGORY_ICON_CHANGE);
                oldFile.setValue(driftDetails.getDrift().getOldDriftFile().getHashId());
                oldFileLink = createViewFileLink(driftDetails.getDrift().getOldDriftFile().getHashId(), driftDetails
                    .getDrift().getPath(), driftDetails.getPreviousChangeSet().getVersion(),
                    driftDetails.getOldFileStatus());
                newFile.setValue(driftDetails.getDrift().getNewDriftFile().getHashId());
                newFileLink = createViewFileLink(driftDetails.getDrift().getNewDriftFile().getHashId(), driftDetails
                    .getDrift().getPath(), driftDetails.getChangeSet().getVersion(), driftDetails.getNewFileStatus());
                if (driftDetails.getNewFileStatus() == LOADED && driftDetails.getOldFileStatus() == LOADED) {
                    viewDiffLink = createViewDiffLink(driftDetails.getDrift(), driftDetails.getPreviousChangeSet()
                        .getVersion());
                }
                break;
            case FILE_REMOVED:
                category.setValue(DriftDataSource.CATEGORY_ICON_REMOVE);
                oldFile.setValue(driftDetails.getDrift().getOldDriftFile().getHashId());
                oldFileLink = createViewFileLink(driftDetails.getDrift().getOldDriftFile().getHashId(), driftDetails
                    .getDrift().getPath(), driftDetails.getChangeSet().getVersion(), driftDetails.getOldFileStatus());
                newFile.setValue(MSG.common_label_none());
                newFileLink = spacer;
                break;
            }
            driftForm.setItems(id, spacer, path, spacer, category, spacer, timestamp, spacer, oldFile, oldFileLink,
                newFile, newFileLink, spacer, spacer, spacer, viewDiffLink);
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.