/** * Sets the column key for the sort with toggling options. * * @param key the column key * @param toggleDirection if true toggle the direction if the new column key matches the current * column key * @param defaultToggleDirection the direction to use when toggling if the new column key does not * match the current column key */ public void setColumnKey(String key, boolean toggleDirection, String defaultToggleDirection) { key = Val.chkStr(key); if (!toggleDirection) { _columnKey = key; } else { if (key.equalsIgnoreCase(_columnKey)) { if (getDirection().equals(SortDirection.asc)) { setDirection(SortDirection.desc); } else { setDirection(SortDirection.asc); } } else { setDirection(SortDirection.checkValue(defaultToggleDirection)); } _columnKey = key; } }
/** * Sets the sort direction. * * @param direction the sort direction */ public void setDirection(String direction) { _direction = SortDirection.checkValue(direction); }