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
.SelectionAdapter
;
23 import org
.eclipse
.swt
.events
.SelectionEvent
;
24 import org
.eclipse
.swt
.layout
.GridData
;
25 import org
.eclipse
.swt
.layout
.GridLayout
;
26 import org
.eclipse
.swt
.widgets
.Button
;
27 import org
.eclipse
.swt
.widgets
.Composite
;
28 import org
.eclipse
.swt
.widgets
.Text
;
30 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceBase
;
31 import eu
.etaxonomy
.taxeditor
.dialogs
.filteredSelection
.FilteredReferenceSelectionDialog
;
32 import eu
.etaxonomy
.taxeditor
.navigation
.NavigationUtil
;
39 public class NewClassificationWizardPage
extends WizardPage
implements ModifyListener
{
40 private static final Logger logger
= Logger
41 .getLogger(NewClassificationWizardPage
.class);
43 private Text text_treeLabel
;
45 private Text text_reference
;
47 private Button button_browseReference
;
49 private UUID referenceUuid
;
51 private Text text_microReference
;
56 protected NewClassificationWizardPage(String pageName
) {
58 this.setTitle("Classification");
60 this.setDescription("Create a new Classification.");
64 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
66 public void createControl(Composite parent
) {
68 setPageComplete(false);
70 Composite composite
= new Composite(parent
, SWT
.NONE
);
71 GridLayout gridLayout
= new GridLayout();
72 gridLayout
.numColumns
= 3;
73 composite
.setLayout(gridLayout
);
75 CLabel label_treeLabel
= new CLabel(composite
, SWT
.NULL
);
76 label_treeLabel
.setText("Label:");
78 text_treeLabel
= new Text(composite
, SWT
.BORDER
);
79 text_treeLabel
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 2, 1));
80 text_treeLabel
.addModifyListener(this);
82 // FIXME this is a rudimentary implementation. Add missing fields.
84 CLabel label_reference
= new CLabel(composite
, SWT
.NULL
);
85 label_reference
.setText("Reference:");
87 text_reference
= new Text(composite
, SWT
.BORDER
);
88 text_reference
.setEnabled(false);
89 text_reference
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
91 button_browseReference
= new Button(composite
, SWT
.PUSH
);
92 button_browseReference
.setText("Browse...");
93 button_browseReference
.addSelectionListener(new SelectionAdapter(){
95 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
98 public void widgetSelected(SelectionEvent e
) {
99 logger
.warn("Open reference search dialog");
101 ReferenceBase reference
= FilteredReferenceSelectionDialog
.selectReference(NavigationUtil
.getShell(), null);
103 if (reference
== null) {
107 referenceUuid
= reference
.getUuid();
109 text_reference
.setText(reference
.getTitleCache());
113 CLabel label_microReference
= new CLabel(composite
, SWT
.NULL
);
114 label_microReference
.setText("Reference Detail");
116 text_microReference
= new Text(composite
, SWT
.BORDER
);
117 text_microReference
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 2, 1));
119 setControl(composite
);
123 * @return the text_treeLabel
125 public String
getTreeLabel() {
126 return text_treeLabel
.getText();
132 public String
getMicroReference() {
133 return text_microReference
.getText();
137 * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
139 public void modifyText(ModifyEvent e
) {
140 if(getTreeLabel().trim().length() > 0){
141 setPageComplete(true);
148 public UUID
getReferenceUuid() {
149 return referenceUuid
;