1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.browsing.ui.content;
14 import org.simantics.browsing.ui.NodeContext;
15 import org.simantics.browsing.ui.NodeQueryManager;
18 * This interface can be used to determine a sorting order for the children of a
19 * certain node. A single ComparableContextFactory is always used for the
20 * children of a single parent node, i.e. a single sorting algorithm will always
21 * be used to sort the children.
23 * @author Antti Villberg
25 public interface ComparableContextFactory {
28 * Constructs {@link ComparableContext} instances from an array of
29 * {@link NodeContext}s. The input array will be in the order in which the
30 * viewpoint contributions happened to produce the {@link NodeContext}s in.
32 * @param manager manager for performing the necessary queries to resolve
34 * @param parent the parent node of the children. May be used to carry
35 * constant data to guide the sorting process or just simply ignored.
36 * @param children the set of child nodes to make into
37 * {@link ComparableContext} instances
38 * @return the specified {@link NodeContext}s wrapped into
39 * {@link ComparableContext}s or <code>null</code> if no sorting is
40 * to be performed. The result array should be of the same size as
43 ComparableContext[] create(NodeQueryManager manager, NodeContext parent, NodeContext[] children);