Skip to content

Package: ECPCellEditorComparator

ECPCellEditorComparator

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Johannes Faltermeier - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.edit.spi.swt.table;
15:
16: /**
17: * A {@link ECPCellEditor} may optionally implement the ECPCellEditorComparator interface. Implementing the comparator
18: * interface will indicate to the users of the EPCCellEditor that the sorting algorithm shall use the compare method of
19: * the editor for the given column.
20: *
21: * @author Johannes Faltermeier
22: * @since 1.8
23: *
24: */
25: public interface ECPCellEditorComparator {
26:
27:         /**
28:          * This method is called in order to compare the two given objects. The results are used to show the elements in the
29:          * resulting order in the table.
30:          *
31:          * @param e1 the first object of the comparison
32:          * @param e2 the second object of the comparison
33:          * @param direction {@link org.eclipse.swt.SWT#NONE SWT.NONE}, {@link org.eclipse.swt.SWT#UP SWT.UP} or
34:          * {@link org.eclipse.swt.SWT#DOWN SWT.DOWN} according to the indication displayed at
35:          * the table column.
36:          * @return a negative number if the first element is to be shown before the
37:          * second element; the value <code>0</code> if the first element is
38:          * equal to the second element; and a positive number if the first
39:          * element is to be shown after the second element.
40:          * <p>
41:          * <b>NOTE</b> Keep in mind to take the given direction into account
42:          * </p>
43:          */
44:         int compare(Object e1, Object e2, int direction);
45:
46: }