4 package eu
.etaxonomy
.taxeditor
.forms
;
6 import org
.eclipse
.jface
.action
.IAction
;
7 import org
.eclipse
.jface
.action
.ToolBarManager
;
8 import org
.eclipse
.swt
.SWT
;
9 import org
.eclipse
.swt
.layout
.GridData
;
10 import org
.eclipse
.swt
.layout
.GridLayout
;
11 import org
.eclipse
.swt
.widgets
.Composite
;
12 import org
.eclipse
.swt
.widgets
.Control
;
14 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
20 public abstract class AbstractEntitySetSection
<T
extends VersionableEntity
> extends AbstractEditorFormSection
{
23 protected Composite container
;
29 protected AbstractEntitySetSection(Composite parent
, T entity
, int style
) {
32 setTextClient(createToolbar());
36 private Control
createToolbar() {
37 ToolBarManager toolBarManager
= new ToolBarManager(SWT
.FLAT
);
38 // IMenuService menuService = (IMenuService) EditorUtil.getService(IMenuService.class);
39 // menuService.populateContributionManager(toolBarManager, "toolbar:de.md.contributions.sectionToolbar");
42 toolBarManager
.add(getAddAction());
44 return toolBarManager
.createControl(this);
50 protected abstract IAction
getAddAction();
52 private void createContainer(){
55 container
= toolkit
.createContainer(getClient(), SWT
.NULL
);
57 container
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
58 container
.setLayout(new GridLayout());
62 * Call this method after dynamically changing the client area.
63 * If the options changed is set to true, will also fire a state changed
64 * event to inform the user of unsaved changes.
68 protected void internalUpdateSection(boolean changed
){
70 createDynamicContents();
73 firePropertyChangeEvent(null);
79 protected abstract void createDynamicContents();
82 * Sets this composites entity
84 * Call this method when the page gets loaded
85 * or otherwise updated from outside
87 * @param entity the entity to set
89 public void setEntity(T entity
) {
91 internalUpdateSection(false);
97 public T
getEntity() {