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


Java DetailField.DIRECTION_DESCENDING属性代码示例

本文整理汇总了Java中org.commcare.suite.model.DetailField.DIRECTION_DESCENDING属性的典型用法代码示例。如果您正苦于以下问题:Java DetailField.DIRECTION_DESCENDING属性的具体用法?Java DetailField.DIRECTION_DESCENDING怎么用?Java DetailField.DIRECTION_DESCENDING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.commcare.suite.model.DetailField的用法示例。


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

示例1: compare

@Override
public int compare(Entity<TreeReference> object1, Entity<TreeReference> object2) {
    for (int fieldIndex : fieldIndicesToSortBy) {
        boolean reverse = (detailFields[fieldIndex].getSortDirection() == DetailField.DIRECTION_DESCENDING) ^ reverseSort;
        int cmp = getCmp(object1, object2, fieldIndex, reverse);
        if (cmp != 0) {
            return cmp;
        }
    }
    return 0;
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:11,代码来源:EntitySorter.java

示例2: getSortOptionsList

private DialogChoiceItem[] getSortOptionsList() {
    DetailField[] fields = session.getDetail(selectDatum.getShortDetail()).getFields();
    List<String> namesList = new ArrayList<>();

    final int[] keyArray = new int[fields.length];
    int[] sorts = adapter.getCurrentSort();
    int currentSort = sorts.length == 1 ? sorts[0] : -1;
    boolean reversed = adapter.isCurrentSortReversed();

    int added = 0;
    for (int i = 0; i < fields.length; ++i) {
        String result = fields[i].getHeader().evaluate();
        if (!"".equals(result)) {
            String prepend = "";
            if (currentSort == -1) {
                for (int j = 0; j < sorts.length; ++j) {
                    if (sorts[j] == i) {
                        prepend = (j + 1) + " " + (fields[i].getSortDirection() == DetailField.DIRECTION_DESCENDING ? "(v) " : "(^) ");
                    }
                }
            } else if (currentSort == i) {
                prepend = reversed ^ fields[i].getSortDirection() == DetailField.DIRECTION_DESCENDING ? "(v) " : "(^) ";
            }
            namesList.add(prepend + result);
            keyArray[added] = i;
            added++;
        }
    }

    DialogChoiceItem[] choiceItems = new DialogChoiceItem[namesList.size()];
    for (int i = 0; i < namesList.size(); i++) {
        final int index = i;
        View.OnClickListener listener = new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                adapter.sortEntities(new int[]{keyArray[index]});
                adapter.filterByString(entitySelectSearchUI.getSearchText().toString());
                dismissAlertDialog();
            }
        };
        DialogChoiceItem item = new DialogChoiceItem(namesList.get(i), -1, listener);
        choiceItems[i] = item;
    }
    return choiceItems;
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:45,代码来源:EntitySelectActivity.java

示例3: isSortAscending

/**
 * Returns the orientation that the specified field should be sorted in
 *
 * @param fieldKey The key to be sorted
 * @return true if the field should be sorted in ascending order. False otherwise
 */
public boolean isSortAscending(int index) {
    return !(shortDetail.getFields()[index].getSortDirection() == DetailField.DIRECTION_DESCENDING);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:9,代码来源:CommCareEntity.java


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