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