.
[taxeditor.git] / taxeditor-editor / src / main / java / eu / etaxonomy / taxeditor / propertysheet / tabbed / AuthorSection.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 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
11 package eu.etaxonomy.taxeditor.propertysheet.tabbed;
12
13 import org.apache.log4j.Logger;
14 import org.eclipse.jface.viewers.ISelection;
15 import org.eclipse.swt.SWT;
16 import org.eclipse.swt.layout.GridData;
17 import org.eclipse.swt.layout.GridLayout;
18 import org.eclipse.swt.widgets.Composite;
19 import org.eclipse.ui.IWorkbenchPart;
20 import org.eclipse.ui.forms.widgets.ExpandableComposite;
21 import org.eclipse.ui.forms.widgets.Section;
22 import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
23
24 import eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor;
25
26 /**
27 * @author n.hoffmann
28 * @created 05.06.2009
29 * @version 1.0
30 */
31 public class AuthorSection extends AbstractNamePropertySection {
32 private static final Logger logger = Logger.getLogger(AuthorSection.class);
33
34 private Section authorship;
35 private Composite authorshipComposite;
36
37 private Section exAuthorship;
38
39 private Section basionymAuthorship;
40
41 private Section exBasionymAuthorship;
42
43 private INomenclaturalAuthor combinationAuthorTeam;
44
45 private INomenclaturalAuthor basionymAuthorTeam;
46
47 private INomenclaturalAuthor exCombinationAuthorTeam;
48
49 private INomenclaturalAuthor exBasionymAuthorTeam;
50
51 private Composite exAuthorshipComposite;
52
53 private Composite basionymAuthorshipComposite;
54
55 private Composite exBasionymAuthorshipComposite;
56
57 private Object sectionLayoutData;
58
59
60
61 /**
62 *
63 */
64 public AuthorSection() {}
65
66 /* (non-Javadoc)
67 * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
68 */
69 @Override
70 public void createControls(Composite parent,
71 TabbedPropertySheetPage tabbedPropertySheetPage) {
72 super.createControls(parent, tabbedPropertySheetPage);
73
74 sectionLayoutData = new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1);
75
76 authorship = getWidgetFactory().createSection(composite, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
77 authorshipComposite = getWidgetFactory().createComposite(authorship);
78 authorship.setClient(authorshipComposite);
79 authorship.setLayoutData(sectionLayoutData);
80
81 exAuthorship = getWidgetFactory().createSection(composite, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
82 exAuthorshipComposite = getWidgetFactory().createComposite(exAuthorship);
83 exAuthorship.setClient(exAuthorshipComposite);
84 exAuthorship.setLayoutData(sectionLayoutData);
85
86 basionymAuthorship = getWidgetFactory().createSection(composite, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
87 basionymAuthorshipComposite = getWidgetFactory().createComposite(basionymAuthorship);
88 basionymAuthorship.setClient(basionymAuthorshipComposite);
89 basionymAuthorship.setLayoutData(sectionLayoutData);
90
91 exBasionymAuthorship = getWidgetFactory().createSection(composite, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
92 exBasionymAuthorshipComposite = getWidgetFactory().createComposite(exBasionymAuthorship);
93 exBasionymAuthorship.setClient(exBasionymAuthorshipComposite);
94 exBasionymAuthorship.setLayoutData(sectionLayoutData);
95 }
96
97
98 /* (non-Javadoc)
99 * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
100 */
101 @Override
102 public void refresh() {
103 super.refresh();
104
105 section.setText("Author");
106
107 cacheText.setText(name.getAuthorshipCache());
108 editCacheButton.setSelection(name.isProtectedAuthorshipCache());
109
110 authorship.setText("Authorship");
111 exAuthorship.setText("Ex-Authorship");
112 basionymAuthorship.setText("Basionym Authorship");
113 exBasionymAuthorship.setText("Ex-Basionym Authorship");
114 }
115
116 /* (non-Javadoc)
117 * @see eu.etaxonomy.taxeditor.propertysheet.tabbed.AbstractNamePropertySection#setInput(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
118 */
119 @Override
120 public void setInput(IWorkbenchPart part, ISelection selection) {
121 super.setInput(part, selection);
122
123 combinationAuthorTeam = name.getCombinationAuthorTeam();
124 exCombinationAuthorTeam = name.getExCombinationAuthorTeam();
125 basionymAuthorTeam = name.getBasionymAuthorTeam();
126 exBasionymAuthorTeam = name.getExBasionymAuthorTeam();
127 }
128
129
130
131 }