Now have 3 dummy taxa editor views (2 existing, 1 new).
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor.designproposal1 / src / eu / etaxonomy / taxeditor / designproposal1 / view / LastNameView.java
1 package eu.etaxonomy.taxeditor.designproposal1.view;
2
3 import java.beans.PropertyChangeEvent;
4 import java.beans.PropertyChangeListener;
5
6 import org.eclipse.jface.action.IMenuManager;
7 import org.eclipse.jface.action.IToolBarManager;
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.Label;
13 import org.eclipse.ui.part.ViewPart;
14
15 import eu.etaxonomy.cdm.model.name.TaxonName;
16 import eu.etaxonomy.taxeditor.designproposal1.Activator;
17
18 public class LastNameView extends ViewPart implements PropertyChangeListener {
19
20 public static final String ID = "eu.etaxonomy.taxeditor.designproposal1.view.LastNameView"; //$NON-NLS-1$
21 private Label lblName;
22 /**
23 * Create contents of the view part
24 * @param parent
25 */
26 @Override
27 public void createPartControl(Composite parent) {
28 Composite container = new Composite(parent, SWT.NONE);
29 final GridLayout gridLayout = new GridLayout();
30 gridLayout.numColumns = 2;
31 container.setLayout(gridLayout);
32
33 final Label theLastNameLabel = new Label(container, SWT.NONE);
34 theLastNameLabel.setText("The last name created was: ");
35
36 lblName = new Label(container, SWT.NONE);
37 lblName.setText("none yet");
38 lblName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
39
40
41 new Label(container, SWT.NONE);
42 //
43 createActions();
44 initializeToolBar();
45 initializeMenu();
46
47 Activator.getDefault().getObjectList().addPropertyChangeListener(this);
48
49 }
50
51 /**
52 * Create the actions
53 */
54 private void createActions() {
55 // Create the actions
56 }
57
58 /**
59 * Initialize the toolbar
60 */
61 private void initializeToolBar() {
62 IToolBarManager toolbarManager = getViewSite().getActionBars()
63 .getToolBarManager();
64 }
65
66 /**
67 * Initialize the menu
68 */
69 private void initializeMenu() {
70 IMenuManager menuManager = getViewSite().getActionBars()
71 .getMenuManager();
72 }
73
74 @Override
75 public void setFocus() {
76 // Set the focus
77 }
78
79 public void propertyChange(PropertyChangeEvent evt) {
80 if (evt.getPropertyName().equalsIgnoreCase("ITEM_ADD")){
81 TaxonName tn = (TaxonName)evt.getNewValue();
82 lblName.setText( tn.getName());
83 }
84 }
85
86 }