*/
package eu.etaxonomy.taxeditor.editor.workingSet;
-import java.util.List;
-
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
-import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.description.FeatureTree;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.name.Rank;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditorComposite;
-import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.combo.TermUuidComboViewer;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
import eu.etaxonomy.taxeditor.util.TaxonTreeNodeContentProvider;
import eu.etaxonomy.taxeditor.util.TaxonTreeNodeLabelProvider;
*
*/
public class WorkingSetComposite extends Composite {
- private Text txtWorkingSetLabel;
+ private Text txtWorkingSet;
private TermUuidComboViewer comboRankMin;
private TermUuidComboViewer comboRankMax;
private FeatureTreeEditorComposite featureTreeEditorComposite;
private TreeViewer taxonNodeTree;
private NamedArea area;
- private Label lblAreaLabel;
+ private Text textAreaText;
public WorkingSetComposite(Composite parent, int style) {
super(parent, style);
- setLayout(new GridLayout(4, false));
+
+ setLayout(new GridLayout(3, false));
Label lblNewLabel = new Label(this, SWT.NONE);
- lblNewLabel.setText("Working set label");
+ lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblNewLabel.setText("Label");
- txtWorkingSetLabel = new Text(this, SWT.BORDER);
- txtWorkingSetLabel.setEditable(false);
- txtWorkingSetLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
+ txtWorkingSet = new Text(this, SWT.BORDER);
+ txtWorkingSet.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
Label lblNewLabel_1 = new Label(this, SWT.NONE);
lblNewLabel_1.setText("Taxon filter");
- featureTreeEditorComposite = new FeatureTreeEditorComposite(this, SWT.NONE);
- featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4));
- featureTreeEditorComposite.init(null, null, null, null);
-
Label lblNewLabel_2 = new Label(this, SWT.NONE);
lblNewLabel_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblNewLabel_2.setText("Rank min");
comboRankMin = new TermUuidComboViewer(this, SWT.NONE);
comboRankMin.setInput(TermType.Rank);
comboRankMin.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
-
- Composite composite = new Composite(this, SWT.NONE);
- composite.setLayout(new FillLayout(SWT.HORIZONTAL));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3));
-
- taxonNodeTree = new TreeViewer(new Tree(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
+ Tree tree = new Tree(this, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
+ tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4));
+ taxonNodeTree = new TreeViewer(tree);
taxonNodeTree.setContentProvider(new TaxonTreeNodeContentProvider());
taxonNodeTree.setLabelProvider(new TaxonTreeNodeLabelProvider());
- List<Classification> list = CdmStore.getService(IClassificationService.class).list(Classification.class, null, null, null, null);
- taxonNodeTree.setInput(list);
Label lblNewLabel_3 = new Label(this, SWT.NONE);
lblNewLabel_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
comboRankMax.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
Label lblNewLabel_4 = new Label(this, SWT.NONE);
- lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
+ lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblNewLabel_4.setText("Area");
- Composite composite_1 = new Composite(this, SWT.NONE);
- composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
- composite_1.setLayout(new GridLayout(2, false));
-
- lblAreaLabel = new Label(composite_1, SWT.NONE);
- lblAreaLabel.setText("New Label");
+ textAreaText = new Text(this, SWT.BORDER);
+ textAreaText.setEditable(false);
+ textAreaText.setText("Choose...");
+ textAreaText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ featureTreeEditorComposite = new FeatureTreeEditorComposite(this, SWT.NONE);
+ featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
+ featureTreeEditorComposite.init(null, null, null, null);
- Button btnNewButton = new Button(composite_1, SWT.NONE);
- btnNewButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
- btnNewButton.setText("Choose");
- btnNewButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- NamedArea area = NamedAreaSelectionDialog.select(parent.getShell(), null, null);
- setArea(area);
- }
- });
}
// Disable the check that prevents subclassing of SWT components
}
public Text getTxt_label() {
- return txtWorkingSetLabel;
+ return txtWorkingSet;
}
public TermUuidComboViewer getRankMin() {
featureTreeEditorComposite.setSelectedTree(characters, null);
}
- public TaxonNode getTaxonNode(){
- ITreeSelection selection = (ITreeSelection) taxonNodeTree.getSelection();
- if(selection!=null && selection.getFirstElement() instanceof TaxonNode){
- return (TaxonNode) selection.getFirstElement();
- }
- return null;
- }
- public void setTaxonNode(TaxonNode taxonNode){
- taxonNodeTree.setSelection(new StructuredSelection(taxonNode), true);
+ public TreeViewer getTaxonNodeTree() {
+ return taxonNodeTree;
}
public NamedArea getArea(){
}
public void setArea(NamedArea area) {
this.area = area;
- lblAreaLabel.setText(area.getLabel());
+ textAreaText.setText(area.getLabel());
+ }
+ public Text getTextAreaText() {
+ return textAreaText;
}
}