Examples of CellFormatter


Examples of com.smartgwt.client.widgets.grid.CellFormatter

            BundleDestinationDataSource.FIELD_LATEST_DEPLOY_STATUS, MSG.view_bundle_dest_lastDeploymentStatus());

        latestDeploymentDateField.setType(ListGridFieldType.DATE);
        TimestampCellFormatter.prepareDateField(latestDeploymentDateField);

        nameField.setCellFormatter(new CellFormatter() {
            public String format(Object value, ListGridRecord listGridRecord, int i, int i1) {
                Integer bundleId = listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_BUNDLE_ID);
                Integer bundleDestId = listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_ID);
                return "<a href=\"" + LinkManager.getBundleDestinationLink(bundleId, bundleDestId) + "\">"
                    + StringUtility.escapeHtml(value.toString()) + "</a>";
            }
        });

        groupNameField.setCellFormatter(new CellFormatter() {
            public String format(Object value, ListGridRecord listGridRecord, int i, int i1) {
                Integer groupId = listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_GROUP_ID);
                return "<a href=\"" + LinkManager.getResourceGroupLink(groupId) + "\">"
                    + StringUtility.escapeHtml(value.toString()) + "</a>";
            }
        });

        bundleNameField.setCellFormatter(new CellFormatter() {
            public String format(Object value, ListGridRecord listGridRecord, int i, int i1) {
                Integer bid = listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_BUNDLE_ID);
                return "<a href=\"" + LinkManager.getBundleLink(bid) + "\">"
                    + StringUtility.escapeHtml(value.toString()) + "</a>";
            }
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.CellFormatter

        idField.setType(ListGridFieldType.INTEGER);
        idField.setWidth("50");

        ListGridField nameField = new ListGridField(BundleGroupsDataSource.FIELD_NAME, MSG.common_title_name());
        nameField.setWidth("33%");
        nameField.setCellFormatter(new CellFormatter() {
            public String format(Object value, ListGridRecord record, int i, int i1) {
                return "<a href=\"" + record.getAttribute(BundleGroupsDataSource.FIELD_NAMELINK) + "\">"
                    + StringUtility.escapeHtml(String.valueOf(value)) + "</a>";
            }
        });

        ListGridField descField = new ListGridField(BundleGroupsDataSource.FIELD_DESCRIPTION,
            MSG.common_title_description());
        descField.setWidth("*");
        descField.setCellFormatter(new CellFormatter() {
            public String format(Object value, ListGridRecord record, int i, int i1) {
                return StringUtility.escapeHtml(String.valueOf(value));
            }
        });

View Full Code Here

Examples of com.smartgwt.client.widgets.grid.CellFormatter

        }

        @Override
        protected void configureTable() {
            ListGridField fieldResource = new ListGridField(AncestryUtil.RESOURCE_NAME, MSG.common_title_resource());
            fieldResource.setCellFormatter(new CellFormatter() {
                public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
                    String url = LinkManager.getResourceLink(listGridRecord.getAttributeAsInt(AncestryUtil.RESOURCE_ID));
                    return LinkManager.getHref(url, o.toString());
                }
            });
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.CellFormatter

        TimestampCellFormatter.prepareDateField(deployTimeField);
        deployTimeField.setType(ListGridFieldType.DATE);

        // only users that are authorized can see deployments
        if (canDeploy) {
            nameField.setCellFormatter(new CellFormatter() {
                public String format(Object value, ListGridRecord record, int i, int i1) {
                    return "<a href=\""
                        + LinkManager.getBundleDeploymentLink(
                            record.getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_ID),
                            record.getAttributeAsInt(BundleDeploymentDataSource.FIELD_ID)) + "\">"
                        + StringUtility.escapeHtml(String.valueOf(value)) + "</a>";
                }
            });
        } else {
            nameField.setCellFormatter(new EscapedHtmlCellFormatter());
        }

        descriptionField.setCellFormatter(new EscapedHtmlCellFormatter());

        bundleVersionField.setCellFormatter(new CellFormatter() {
            public String format(Object o, ListGridRecord record, int i, int i1) {
                return "<a href=\""
                    + LinkManager.getBundleVersionLink(
                        record.getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_ID),
                        record.getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_VERSION_ID)) + "\">"
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.CellFormatter

        ListGridField pathField = new ListGridField(ATTR_PATH, MSG.common_title_path());
        fields.add(pathField);

        if (this.entityContext.type != EntityContext.Type.Resource) {
            ListGridField resourceNameField = new ListGridField(AncestryUtil.RESOURCE_NAME, MSG.common_title_resource());
            resourceNameField.setCellFormatter(new CellFormatter() {
                public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
                    String url = LinkManager
                        .getResourceLink(listGridRecord.getAttributeAsInt(AncestryUtil.RESOURCE_ID));
                    return LinkManager.getHref(url, o.toString());
                }
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.CellFormatter

    /**
     * Override if you don't want the detailsLinkColumn to have the default link wrapper.
     * @return the desired CellFormatter.
     */
    protected CellFormatter getDetailsLinkColumnCellFormatter() {
        return new CellFormatter() {
            public String format(Object value, ListGridRecord record, int i, int i1) {
                if (value == null) {
                    return "";
                }
                ID recordId = getId(record);
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.CellFormatter

    protected String getDetailsLinkColumnName() {
        return "timestamp";
    }

    protected CellFormatter getDetailsLinkColumnCellFormatter() {
        return new CellFormatter() {
            public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
                Integer recordId = getId(record);
                String detailsUrl = "#" + getBasePath() + "/" + recordId;
                return LinkManager.getHref(detailsUrl, TimestampCellFormatter.format(value));
            }
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.CellFormatter

     */
    public ArrayList<ListGridField> getListGridFields() {
        ArrayList<ListGridField> fields = new ArrayList<ListGridField>(7);

        ListGridField sparklineField = new ListGridField(SPARKLINE.getValue(), MSG.chart_metrics_sparkline_header());
        sparklineField.setCellFormatter(new CellFormatter() {
            @Override
            public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
                if (value == null) {
                    return "";
                }
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.CellFormatter

        TimestampCellFormatter.prepareDateField(timestampField);
        fields.add(timestampField);

        ListGridField severityField = new ListGridField("severity", MSG.view_inventory_eventHistory_severity());
        severityField.setAlign(Alignment.CENTER);
        severityField.setCellFormatter(new CellFormatter() {
            public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
                String icon = ImageManager.getEventSeverityBadge(EventSeverity.valueOf(o.toString()));
                return Canvas.imgHTML(icon, 24, 24);
            }
        });
        severityField.setShowHover(true);
        severityField.setHoverCustomizer(new HoverCustomizer() {
            public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
                String sevEnumName = record.getAttribute("severity");
                if (sevEnumName == null) {
                    return null;
                }
                EventSeverity severity = EventSeverity.valueOf(sevEnumName);
                switch (severity) {
                case DEBUG:
                    return MSG.common_severity_debug();
                case INFO:
                    return MSG.common_severity_info();
                case WARN:
                    return MSG.common_severity_warn();
                case ERROR:
                    return MSG.common_severity_error();
                case FATAL:
                    return MSG.common_severity_fatal();
                default:
                    return null;
                }
            }
        });
        fields.add(severityField);

        ListGridField detailField = new ListGridField("detail", MSG.view_inventory_eventHistory_details());
        detailField.setCellFormatter(new CellFormatter() {
            @Override
            public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
                if (null == value) {
                    return "";
                } else if (((String) value).length() <= 200) {
                    return (String) value;
                } else {
                    return ((String) value).substring(0, 200); // first 200 chars
                }
            }
        });
        fields.add(detailField);

        ListGridField sourceField = new ListGridField("source", MSG.view_inventory_eventHistory_sourceLocation());
        sourceField.setCellFormatter(new CellFormatter() {
            public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
                String sourceLocation = listGridRecord.getAttribute("source");
                int length = sourceLocation.length();
                if (length > 40) {
                    return "..." + sourceLocation.substring(length - 40); // the last 40 chars
                }
                return sourceLocation;
            }
        });
        sourceField.setShowHover(true);
        sourceField.setHoverCustomizer(new HoverCustomizer() {
            public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
                if (value == null) {
                    return null;
                }
                String sourceLocation = (String) value;
                return (sourceLocation.length() > 40) ? sourceLocation : null;
            }
        });
        fields.add(sourceField);

        if (this.entityContext.type != EntityContext.Type.Resource) {
            ListGridField resourceNameField = new ListGridField(AncestryUtil.RESOURCE_NAME, MSG.common_title_resource());
            resourceNameField.setCellFormatter(new CellFormatter() {
                public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
                    String url = LinkManager.getResourceLink(listGridRecord.getAttributeAsInt(AncestryUtil.RESOURCE_ID));
                    return LinkManager.getHref(url, o.toString());
                }
            });
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.CellFormatter

            }
        });
    }

    public static void setupAncestryListGridFieldCellFormatter(ListGridField ancestryField) {
        ancestryField.setCellFormatter(new CellFormatter() {
            public String format(Object o, ListGridRecord listGridRecord, int rowNum, int colNum) {
                return listGridRecord.getAttributeAsString(AncestryUtil.RESOURCE_ANCESTRY_VALUE);
            }
        });
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.