3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.newWizards
;
14 import java
.util
.UUID
;
16 import org
.apache
.log4j
.Logger
;
17 import org
.eclipse
.jface
.wizard
.WizardPage
;
18 import org
.eclipse
.swt
.SWT
;
19 import org
.eclipse
.swt
.custom
.CLabel
;
20 import org
.eclipse
.swt
.events
.ModifyEvent
;
21 import org
.eclipse
.swt
.events
.ModifyListener
;
22 import org
.eclipse
.swt
.events
.MouseEvent
;
23 import org
.eclipse
.swt
.events
.SelectionAdapter
;
24 import org
.eclipse
.swt
.events
.SelectionEvent
;
25 import org
.eclipse
.swt
.layout
.GridData
;
26 import org
.eclipse
.swt
.layout
.GridLayout
;
27 import org
.eclipse
.swt
.widgets
.Button
;
28 import org
.eclipse
.swt
.widgets
.Composite
;
29 import org
.eclipse
.swt
.widgets
.Text
;
31 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceBase
;
32 import eu
.etaxonomy
.taxeditor
.dialogs
.filteredSelection
.FilteredReferenceSelectionDialog
;
33 import eu
.etaxonomy
.taxeditor
.navigation
.NavigationUtil
;
40 public class NewTaxonomicTreeWizardPage
extends WizardPage
implements ModifyListener
{
41 private static final Logger logger
= Logger
42 .getLogger(NewTaxonomicTreeWizardPage
.class);
44 private Text text_treeLabel
;
46 private Text text_reference
;
48 private Button button_browseReference
;
50 private UUID referenceUuid
;
52 private Text text_microReference
;
57 protected NewTaxonomicTreeWizardPage(String pageName
) {
59 this.setTitle("Taxonomic Tree");
61 this.setDescription("Create a new Taxonomic Tree.");
65 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
67 public void createControl(Composite parent
) {
69 setPageComplete(false);
71 Composite composite
= new Composite(parent
, SWT
.NONE
);
72 GridLayout gridLayout
= new GridLayout();
73 gridLayout
.numColumns
= 3;
74 composite
.setLayout(gridLayout
);
76 CLabel label_treeLabel
= new CLabel(composite
, SWT
.NULL
);
77 label_treeLabel
.setText("Label:");
79 text_treeLabel
= new Text(composite
, SWT
.BORDER
);
80 text_treeLabel
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 2, 1));
81 text_treeLabel
.addModifyListener(this);
83 // FIXME this is a rudimentary implementation. Add missing fields.
85 CLabel label_reference
= new CLabel(composite
, SWT
.NULL
);
86 label_reference
.setText("Reference:");
88 text_reference
= new Text(composite
, SWT
.BORDER
);
89 text_reference
.setEnabled(false);
90 text_reference
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
92 button_browseReference
= new Button(composite
, SWT
.PUSH
);
93 button_browseReference
.setText("Browse...");
94 button_browseReference
.addSelectionListener(new SelectionAdapter(){
96 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
99 public void widgetSelected(SelectionEvent e
) {
100 logger
.warn("Open reference search dialog");
102 ReferenceBase reference
= FilteredReferenceSelectionDialog
.selectReference(NavigationUtil
.getShell(), null);
104 if (reference
== null) {
108 referenceUuid
= reference
.getUuid();
110 text_reference
.setText(reference
.getTitleCache());
114 CLabel label_microReference
= new CLabel(composite
, SWT
.NULL
);
115 label_microReference
.setText("Reference Detail");
117 text_microReference
= new Text(composite
, SWT
.BORDER
);
118 text_microReference
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 2, 1));
120 setControl(composite
);
124 * @return the text_treeLabel
126 public String
getTreeLabel() {
127 return text_treeLabel
.getText();
133 public String
getMicroReference() {
134 return text_microReference
.getText();
138 * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
140 public void modifyText(ModifyEvent e
) {
141 if(getTreeLabel().trim().length() > 0){
142 setPageComplete(true);
149 public UUID
getReferenceUuid() {
150 return referenceUuid
;