001/*
002 * (C) Copyright 2006 Nuxeo SAS <http://nuxeo.com> and others
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse  License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Nuxeo - initial API and implementation
011 *
012 * $Id: SortableDataModel.java 11041 2007-01-31 15:43:30Z atchertchian $
013 */
014
015package org.nuxeo.ecm.platform.ui.web.model;
016
017import java.io.Serializable;
018
019/**
020 * Provides support for sorting table models. Inspired from Tomahawk examples. Abstract method design pattern.
021 *
022 * @author <a href="mailto:rcaraghin@nuxeo.com">Razvan Caraghin</a>
023 */
024public interface SortableDataModel extends Serializable {
025
026    /**
027     * Sort the list. Should be implemented by the children to customize the sort (what comparators should be used, what
028     * other condition must be met).
029     */
030    void sort(String column, boolean ascending);
031
032    /**
033     * Is the default sort direction for the given column "ascending" ?
034     */
035    boolean isDefaultAscending(String sortColumn);
036
037    void sort(String sortColumn);
038
039    String getSort();
040
041    void setSort(String sort);
042
043    boolean isAscending();
044
045    void setAscending(boolean ascending);
046
047}