]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/impl/WidgetSupport.java
d08f05879b8187c0230d7fab1c744657586cc8dc
[simantics/platform.git] / bundles / org.simantics.browsing.ui.swt / src / org / simantics / browsing / ui / swt / widgets / impl / WidgetSupport.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2012 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.swt.widgets.impl;\r
13 \r
14 import org.eclipse.jface.resource.ResourceManager;\r
15 import org.simantics.db.ReadGraph;\r
16 import org.simantics.db.exception.DatabaseException;\r
17 \r
18 public interface WidgetSupport {\r
19 \r
20         /**\r
21          * The key for {@link #setParameter(String, Object)} used to associate a\r
22          * {@link ResourceManager} instance with this widget support context.\r
23          * Widgets that need to load resources (fonts, colors or images) need this.\r
24          */\r
25         public static final String RESOURCE_MANAGER = "resourceManager";\r
26 \r
27         public static final Object NO_INPUT = new Object();\r
28         \r
29         /*\r
30          * The widget is set to receive input updates from this support\r
31          */\r
32         void register(Widget widget);\r
33         /*\r
34          * Updates will start only after this call\r
35          */\r
36         void finish();\r
37         /*\r
38          * Force update of widget\r
39          */\r
40         void update(Widget widget);\r
41         /*\r
42          * Force update of all widgets\r
43          */\r
44         void update();\r
45         /*\r
46          * Query current input\r
47          */\r
48         <T> T getInput();\r
49         \r
50         <T> T getParameter(String key);\r
51         void setParameter(String key, Object value);\r
52         \r
53         <T> T getInput(ReadGraph graph) throws DatabaseException;\r
54         \r
55 }\r