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