@Override public int compareTableRows(ITableRow r1, ITableRow r2) { String s1 = getValue(r1); String s2 = getValue(r2); return StringUtility.compareIgnoreCase(s1, s2); }
@SuppressWarnings("unchecked") @Override public int compareTableRows(ITableRow r1, ITableRow r2) { int c; Object o1 = getValue(r1); Object o2 = getValue(r2); if (o1 == null && o2 == null) { c = 0; } else if (o1 == null) { c = -1; } else if (o2 == null) { c = 1; } else if ((o1 instanceof Comparable) && (o2 instanceof Comparable) && o1.getClass().isAssignableFrom(o2.getClass())) { c = ((Comparable) o1).compareTo(o2); } else { c = StringUtility.compareIgnoreCase(o1.toString(), o2.toString()); } return c; }
/** * sorting of rows based on this column<br> * default: compare objects by Comparable interface or use value */ @Override @SuppressWarnings("unchecked") public int compareTableRows(ITableRow r1, ITableRow r2) { int c; VALUE o1 = getValue(r1); VALUE o2 = getValue(r2); if (o1 == null && o2 == null) { c = 0; } else if (o1 == null) { c = -1; } else if (o2 == null) { c = 1; } else if ((o1 instanceof Comparable) && (o2 instanceof Comparable)) { c = ((Comparable) o1).compareTo(o2); } else { c = StringUtility.compareIgnoreCase(o1.toString(), o2.toString()); } return c; }
@SuppressWarnings("unchecked") @Override public int compareTo(CalendarComponent o) { if (m_item instanceof Comparable) { return ((Comparable) m_item).compareTo(o.getItem()); } else { int i = this.getFromDate().compareTo(o.getFromDate()); if (i == 0) { String label1 = m_item.getSubject(); String label2 = o.getItem().getSubject(); i = StringUtility.compareIgnoreCase(label1, label2); if (i == 0) { i = Integer.compare(this.hashCode(), o.hashCode()); } } return i; } }
@Override public int compareTableRows(ITableRow r1, ITableRow r2) { ICodeType<?, LOOKUP_TYPE> codeType = getCodeTypeClass() != null ? BEANS.opt(getCodeTypeClass()) : null; ILookupCall<LOOKUP_TYPE> call = getLookupCall() != null ? getLookupCall() : null; if (codeType != null) { String s1 = getDisplayText(r1); String s2 = getDisplayText(r2); return StringUtility.compareIgnoreCase(s1, s2); } else if (call != null) { String s1 = getDisplayText(r1); String s2 = getDisplayText(r2); return StringUtility.compareIgnoreCase(s1, s2); } else { return super.compareTableRows(r1, r2); } }
folderList.sort((f1, f2) -> StringUtility.compareIgnoreCase(f1.getTitle(), f2.getTitle())); bmFolder.getFolders().addAll(folderList); for (ITreeNode n : node.getChildNodes()) {
@Override public int compareTableRows(ITableRow r1, ITableRow r2) { ICodeType<?, VALUE> codeType = getCodeTypeClass() != null ? BEANS.opt(getCodeTypeClass()) : null; ILookupCall<VALUE> call = getLookupCall() != null ? getLookupCall() : null; if (codeType != null) { if (isSortCodesByDisplayText()) { String s1 = getDisplayText(r1); String s2 = getDisplayText(r2); return StringUtility.compareIgnoreCase(s1, s2); } else { VALUE t1 = getValue(r1); VALUE t2 = getValue(r2); Integer sort1 = (t1 != null ? codeType.getCodeIndex(t1) : -1); Integer sort2 = (t2 != null ? codeType.getCodeIndex(t2) : -1); int c = sort1.compareTo(sort2); return c; } } else if (call != null) { String s1 = getDisplayText(r1); String s2 = getDisplayText(r2); return StringUtility.compareIgnoreCase(s1, s2); } else { return super.compareTableRows(r1, r2); } }