4 package eu
.etaxonomy
.taxeditor
.forms
;
6 import java
.util
.HashSet
;
9 import org
.eclipse
.jface
.util
.IPropertyChangeListener
;
10 import org
.eclipse
.jface
.util
.PropertyChangeEvent
;
11 import org
.eclipse
.swt
.SWT
;
12 import org
.eclipse
.swt
.layout
.GridData
;
13 import org
.eclipse
.swt
.layout
.GridLayout
;
14 import org
.eclipse
.swt
.widgets
.Composite
;
15 import org
.eclipse
.ui
.forms
.events
.ExpansionEvent
;
16 import org
.eclipse
.ui
.forms
.events
.IExpansionListener
;
17 import org
.eclipse
.ui
.forms
.widgets
.Section
;
18 import org
.eclipse
.ui
.forms
.widgets
.ToggleHyperlink
;
24 public abstract class AbstractEditorFormSection
extends Section
implements IExpansionListener
, IPropertyChangeEmitter
, IPropertyChangeListener
{
27 protected EditorFormToolkit toolkit
;
28 private Composite client
;
30 private Set
<IPropertyChangeListener
> propertyChangeListeners
= new HashSet
<IPropertyChangeListener
>();
36 protected AbstractEditorFormSection(Composite parent
, IPropertyChangeListener listener
, int style
) {
39 toolkit
= new EditorFormToolkit(parent
.getDisplay());
43 this.setLayoutData(new GridData(SWT
.FILL
, SWT
.TOP
, true, false));
45 client
= toolkit
.createComposite(this, SWT
.WRAP
);
46 client
.setLayout(new GridLayout());
48 this.setClient(client
);
49 this.addExpansionListener(this);
51 this.addPropertyChangeListener(listener
);
56 * @see org.eclipse.swt.widgets.Widget#dispose()
59 public void dispose() {
64 public ToggleHyperlink
getToggle(){
68 public Composite
getClient(){
72 public AbstractEditorFormSection
getSection(){
77 * @see org.eclipse.ui.forms.events.IExpansionListener#expansionStateChanged(org.eclipse.ui.forms.events.ExpansionEvent)
79 public void expansionStateChanged(ExpansionEvent e
) {
80 // TODO Auto-generated method stub
85 * @see org.eclipse.ui.forms.events.IExpansionListener#expansionStateChanging(org.eclipse.ui.forms.events.ExpansionEvent)
87 public void expansionStateChanging(ExpansionEvent e
) {
88 // TODO Auto-generated method stub
93 * @see eu.etaxonomy.taxeditor.forms.IPropertyChangeEmitter#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
95 public void addPropertyChangeListener(IPropertyChangeListener listener
) {
96 propertyChangeListeners
.add(listener
);
100 * @see eu.etaxonomy.taxeditor.forms.IPropertyChangeEmitter#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
102 public void removePropertyChangeListener(IPropertyChangeListener listener
) {
103 propertyChangeListeners
.remove(listener
);
107 * @see eu.etaxonomy.taxeditor.forms.IPropertyChangeEmitter#firePropertyChangeEvent()
109 public void firePropertyChangeEvent(PropertyChangeEvent event
) {
110 for(IPropertyChangeListener listener
: propertyChangeListeners
){
111 listener
.propertyChange(event
);
116 * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
118 public void propertyChange(PropertyChangeEvent event
) {
119 firePropertyChangeEvent(event
);