1
|
/**
|
2
|
* Copyright (C) 2015 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.ui.dialog.configurator;
|
10
|
|
11
|
import org.eclipse.swt.SWT;
|
12
|
import org.eclipse.swt.events.DisposeEvent;
|
13
|
import org.eclipse.swt.events.DisposeListener;
|
14
|
import org.eclipse.swt.layout.FillLayout;
|
15
|
import org.eclipse.swt.widgets.Composite;
|
16
|
import org.eclipse.swt.widgets.Display;
|
17
|
import org.eclipse.ui.forms.events.ExpansionEvent;
|
18
|
import org.eclipse.ui.forms.events.IExpansionListener;
|
19
|
import org.eclipse.ui.forms.widgets.FormToolkit;
|
20
|
import org.eclipse.ui.forms.widgets.Section;
|
21
|
|
22
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
23
|
|
24
|
/**
|
25
|
* @author pplitzner
|
26
|
* @date Feb 16, 2015
|
27
|
*
|
28
|
*/
|
29
|
public class ConfiguratorComposite extends Composite implements IExpansionListener{
|
30
|
|
31
|
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
|
32
|
private final Section sctnConfigure;
|
33
|
/**
|
34
|
* Create the composite.
|
35
|
* @param parent
|
36
|
* @param style
|
37
|
*/
|
38
|
public ConfiguratorComposite(final Composite parent, int style) {
|
39
|
super(parent, SWT.NONE);
|
40
|
|
41
|
addDisposeListener(new DisposeListener() {
|
42
|
@Override
|
43
|
public void widgetDisposed(DisposeEvent e) {
|
44
|
toolkit.dispose();
|
45
|
}
|
46
|
});
|
47
|
toolkit.paintBordersFor(this);
|
48
|
setLayout(new FillLayout(SWT.HORIZONTAL));
|
49
|
|
50
|
sctnConfigure = toolkit.createSection(this, Section.CLIENT_INDENT | Section.TWISTIE);
|
51
|
sctnConfigure.addExpansionListener(this);
|
52
|
sctnConfigure.setBackground(getBackground());
|
53
|
toolkit.paintBordersFor(sctnConfigure);
|
54
|
sctnConfigure.setText(Messages.ConfiguratorComposite_CONFIGURE);
|
55
|
|
56
|
|
57
|
}
|
58
|
|
59
|
|
60
|
public void addConfiguratorComposite(Composite configuratorComposite){
|
61
|
toolkit.paintBordersFor(configuratorComposite);
|
62
|
sctnConfigure.setClient(configuratorComposite);
|
63
|
}
|
64
|
|
65
|
@Override
|
66
|
public void expansionStateChanged(ExpansionEvent e) {
|
67
|
getShell().setSize(getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
68
|
}
|
69
|
@Override
|
70
|
public void expansionStateChanging(ExpansionEvent e) {
|
71
|
}
|
72
|
public Section getSectionConfigure() {
|
73
|
return sctnConfigure;
|
74
|
}
|
75
|
}
|