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