当前位置: 首页>>代码示例>>Java>>正文


Java MessageField.addDataAttribute方法代码示例

本文整理汇总了Java中org.kuali.rice.krad.uif.field.MessageField.addDataAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java MessageField.addDataAttribute方法的具体用法?Java MessageField.addDataAttribute怎么用?Java MessageField.addDataAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.krad.uif.field.MessageField的用法示例。


在下文中一共展示了MessageField.addDataAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addGroupingColumn

import org.kuali.rice.krad.uif.field.MessageField; //导入方法依赖的package包/类
/**
 * Adds the grouping column to the given column collector.
 *
 * <p>The grouping column is used when table grouping is on to render a header for the group. The data
 * tables plugin will pull the value from this column and render the header row.</p>
 *
 * @param columnCollector object collecting the columns for the row
 */
protected void addGroupingColumn(ColumnCollector columnCollector) {
    // no grouping on add line, so just add blank field
    if (lineBuilderContext.isAddLine()) {
        SpaceField spaceField = ComponentFactory.getSpaceField();
        columnCollector.addColumn(spaceField);

        return;
    }

    MessageField groupingMessageField = ComponentFactory.getColGroupingField();

    StringBuilder groupingTitle = new StringBuilder();
    if (StringUtils.isNotBlank(tableLayoutManager.getGroupingTitle())) {
        groupingTitle.append(tableLayoutManager.getGroupingTitle());
    } else if (tableLayoutManager.getGroupingPropertyNames() != null) {
        for (String propertyName : tableLayoutManager.getGroupingPropertyNames()) {
            Object propertyValue = ObjectPropertyUtils.getPropertyValue(lineBuilderContext.getCurrentLine(),
                    propertyName);

            if (propertyValue == null) {
                propertyValue = "Null";
            }

            if (groupingTitle.length() != 0) {
                groupingTitle.append(", ");
            }

            groupingTitle.append(propertyValue);
        }

    }

    groupingMessageField.setMessageText(groupingTitle.toString());
    groupingMessageField.addDataAttribute(UifConstants.DataAttributes.ROLE, UifConstants.RoleTypes.ROW_GROUPING);

    columnCollector.addColumn(groupingMessageField);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:46,代码来源:TableRowBuilder.java

示例2: setupGrouping

import org.kuali.rice.krad.uif.field.MessageField; //导入方法依赖的package包/类
/**
 * Sets up the grouping MessageField to be used in the first column of the table layout for
 * grouping collection content into groups based on values of the line's fields.
 *
 * @param model The model for the active lifecycle
 * @param collectionGroup collection group for this layout
 */
protected void setupGrouping(Object model, CollectionGroup collectionGroup) {
    String groupingTitleExpression = "";

    if (StringUtils.isNotBlank(this.getPropertyExpression(UifPropertyPaths.GROUPING_TITLE))) {
        groupingTitleExpression = this.getPropertyExpression(UifPropertyPaths.GROUPING_TITLE);

        this.setGroupingTitle(this.getPropertyExpression(UifPropertyPaths.GROUPING_TITLE));
    } else if (this.getGroupingPropertyNames() != null) {
        for (String propertyName : this.getGroupingPropertyNames()) {
            groupingTitleExpression = groupingTitleExpression + ", " + propertyName;
        }

        groupingTitleExpression = groupingTitleExpression.replaceFirst(", ",
                "@{" + UifConstants.LINE_PATH_BIND_ADJUST_PREFIX);
        groupingTitleExpression = groupingTitleExpression.replace(", ",
                "}, @{" + UifConstants.LINE_PATH_BIND_ADJUST_PREFIX);
        groupingTitleExpression = groupingTitleExpression.trim() + "}";
    }

    if (StringUtils.isNotBlank(groupingTitleExpression)) {
        MessageField groupingMessageField = ComponentFactory.getColGroupingField();

        groupingMessageField.getMessage().getPropertyExpressions().put(UifPropertyPaths.MESSAGE_TEXT,
                groupingTitleExpression);

        groupingMessageField.addDataAttribute(UifConstants.DataAttributes.ROLE,
                UifConstants.RoleTypes.ROW_GROUPING);

        List<Component> theItems = new ArrayList<Component>();
        theItems.add(groupingMessageField);
        theItems.addAll(collectionGroup.getItems());
        collectionGroup.setItems(theItems);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:42,代码来源:TableLayoutManagerBase.java


注:本文中的org.kuali.rice.krad.uif.field.MessageField.addDataAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。