]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/ScrolledComposite.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.browsing.ui.swt / src / org / simantics / browsing / ui / swt / widgets / ScrolledComposite.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;\r
13 \r
14 import java.util.concurrent.atomic.AtomicBoolean;\r
15 \r
16 import org.eclipse.swt.widgets.Control;\r
17 import org.eclipse.swt.widgets.Layout;\r
18 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
19 import org.simantics.db.management.ISessionContext;\r
20 \r
21 public class ScrolledComposite extends WidgetImpl {\r
22 \r
23     final private org.eclipse.swt.custom.ScrolledComposite composite;\r
24 \r
25     public ScrolledComposite(org.eclipse.swt.widgets.Composite parent, WidgetSupport support, int style) {\r
26         super(support);\r
27         composite = new org.eclipse.swt.custom.ScrolledComposite(parent, style);\r
28         support.register(this);\r
29     }\r
30 \r
31     public org.eclipse.swt.custom.ScrolledComposite getWidget() {\r
32         return composite;\r
33     }\r
34 \r
35     @Override\r
36     public Control getControl() {\r
37         return composite;\r
38     }\r
39 \r
40     private AtomicBoolean inputDisposed;\r
41 \r
42     @Override\r
43     public void setInput(ISessionContext context, Object input) {\r
44 \r
45         if (this.inputDisposed != null)\r
46             this.inputDisposed.set(true);\r
47         \r
48     }\r
49 \r
50         public void setLayout(Layout layout) {\r
51                 composite.setLayout(layout);\r
52         }\r
53     \r
54 }\r