Example usage for org.eclipse.jface.viewers ComboViewer setLabelProvider

List of usage examples for org.eclipse.jface.viewers ComboViewer setLabelProvider

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers ComboViewer setLabelProvider.

Prototype

@Override
public void setLabelProvider(IBaseLabelProvider labelProvider) 

Source Link

Document

The list viewer implementation of this Viewer framework method ensures that the given label provider is an instance of ILabelProvider.

Usage

From source file:org.apache.directory.studio.openldap.config.acl.widgets.composites.WhatClauseDnComposite.java

License:Apache License

public Composite createComposite(Composite parent) {
    Composite composite = BaseWidgetUtils.createColumnContainer(parent, 3, 1);

    // DN/*w  w  w  .  j  a  v a  2 s. com*/
    BaseWidgetUtils.createLabel(composite, "DN:", 1);
    entryWidget = new EntryWidget();
    entryWidget.createWidget(composite);
    entryWidget.addWidgetModifyListener(modifyListener);

    // Type
    BaseWidgetUtils.createLabel(composite, "Type:", 1);
    ComboViewer whatClauseDnTypeComboViewer = new ComboViewer(
            BaseWidgetUtils.createReadonlyCombo(composite, new String[0], -1, 1));
    whatClauseDnTypeComboViewer.getCombo().setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false, 2, 1));
    whatClauseDnTypeComboViewer.setContentProvider(new ArrayContentProvider());

    whatClauseDnTypeComboViewer.setLabelProvider(new LabelProvider() {
        public String getText(Object element) {
            if (element instanceof AclWhatClauseDnTypeEnum) {
                return ((AclWhatClauseDnTypeEnum) element).getName();
            }

            return super.getText(element);
        }
    });

    whatClauseDnTypeComboViewer.setInput(AclWhatClauseDnTypeEnum.values());

    return composite;
}

From source file:org.apache.directory.studio.openldap.config.acl.widgets.composites.WhoClauseDnComposite.java

License:Apache License

public Composite createComposite(Composite parent) {
    Composite composite = BaseWidgetUtils.createColumnContainer(parent, 3, 1);

    // DN/*from w  w  w. j  a va 2s .co m*/
    BaseWidgetUtils.createLabel(composite, "DN:", 1);
    entryWidget = new EntryWidget();
    entryWidget.createWidget(composite);
    entryWidget.addWidgetModifyListener(modifyListener);

    // Type
    BaseWidgetUtils.createLabel(composite, "Type:", 1);
    ComboViewer whatClauseDnTypeComboViewer = new ComboViewer(
            BaseWidgetUtils.createReadonlyCombo(composite, new String[0], -1, 1));
    whatClauseDnTypeComboViewer.getCombo().setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false, 2, 1));
    whatClauseDnTypeComboViewer.setContentProvider(new ArrayContentProvider());
    whatClauseDnTypeComboViewer.setLabelProvider(new LabelProvider() {
        public String getText(Object element) {
            if (element instanceof AclWhatClauseDnTypeEnum) {
                AclWhatClauseDnTypeEnum value = (AclWhatClauseDnTypeEnum) element;
                switch (value) {
                case BASE:
                    return "Base";
                case EXACT:
                    return "Exact";
                case ONE:
                    return "One";
                case SUBTREE:
                    return "Subtree";
                case CHILDREN:
                    return "Children";
                case REGEX:
                    return "Regex";
                }
            }

            return super.getText(element);
        }
    });
    whatClauseDnTypeComboViewer.setInput(aclWhoClauseDnTypes);

    return composite;
}

From source file:org.apache.directory.studio.openldap.config.acl.widgets.composites.WhoClauseGroupComposite.java

License:Apache License

public Composite createComposite(Composite parent) {
    Composite composite = BaseWidgetUtils.createColumnContainer(parent, 3, 1);

    // Group DN/*from w w w.  j av a  2s. c  o  m*/
    BaseWidgetUtils.createLabel(composite, "Group DN:", 1);
    EntryWidget entryWidget = new EntryWidget();
    entryWidget.createWidget(composite);

    ExpandableComposite optionsExpandableComposite = new ExpandableComposite(composite, SWT.NONE,
            ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
    optionsExpandableComposite.setLayout(new GridLayout());
    optionsExpandableComposite.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 3, 1));
    optionsExpandableComposite.setText("Options");
    Composite clientComposite = BaseWidgetUtils.createColumnContainer(optionsExpandableComposite, 1, 1);
    ((GridLayout) clientComposite.getLayout()).marginRight = 15;
    optionsExpandableComposite.setClient(clientComposite);
    optionsExpandableComposite.addExpansionListener(expansionListener);

    Group optionsGroup = BaseWidgetUtils.createGroup(clientComposite, "", 1);
    optionsGroup.setLayout(new GridLayout(2, false));
    optionsGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 3, 1));

    // Group Object Class
    BaseWidgetUtils.createLabel(optionsGroup, "Group Object Class", 1);
    ComboViewer groupObjectClassComboViewer = new ComboViewer(
            BaseWidgetUtils.createCombo(optionsGroup, new String[0], -1, 1));
    groupObjectClassComboViewer.setContentProvider(new ArrayContentProvider());
    groupObjectClassComboViewer.setLabelProvider(new LabelProvider() {
        public String getText(Object element) {
            if (element instanceof ObjectClass) {
                // TODO
            }

            return super.getText(element);
        }
    });
    //        groupObjectClassComboViewer.setInput( dqsdq ); // TODO
    groupObjectClassComboViewer.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));

    // Group Attribute Class
    BaseWidgetUtils.createLabel(optionsGroup, "Group Attribute Type", 1);
    ComboViewer groupAttributeTypeComboViewer = new ComboViewer(
            BaseWidgetUtils.createCombo(optionsGroup, new String[0], -1, 1));
    groupAttributeTypeComboViewer.setContentProvider(new ArrayContentProvider());
    groupAttributeTypeComboViewer.setLabelProvider(new LabelProvider() {
        public String getText(Object element) {
            if (element instanceof ObjectClass) {
                // TODO
            }

            return super.getText(element);
        }
    });
    //        groupObjectClassComboViewer.setInput( dqsdq ); // TODO
    groupAttributeTypeComboViewer.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));

    return composite;
}

From source file:org.bbaw.pdr.ae.view.control.customSWTWidges.RelationEditorLine.java

License:Open Source License

private void createEditor() {
    this.setLayout(new GridLayout(1, false));
    ((GridLayout) this.getLayout()).marginHeight = 0;
    ((GridLayout) this.getLayout()).verticalSpacing = 0;

    _composite = new Composite(this, SWT.NONE);
    _composite.setLayoutData(new GridData());
    ((GridData) _composite.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _composite.getLayoutData()).grabExcessHorizontalSpace = true;
    _composite.setLayout(new GridLayout(11, false));
    ((GridLayout) _composite.getLayout()).marginHeight = 0;
    ((GridLayout) _composite.getLayout()).verticalSpacing = 0;

    if (_showLabel) {
        ((GridLayout) _composite.getLayout()).numColumns = 12;
        _labelType = new Label(_composite, SWT.NONE);
        _labelType.setText(NLMessages.getString("Dialog_relation"));
        _labelType.setLayoutData(new GridData());
        ((GridData) _labelType.getLayoutData()).horizontalSpan = 1;
        ((GridData) _labelType.getLayoutData()).horizontalAlignment = SWT.RIGHT;
    }//  w w w . jav  a 2  s.c  om

    _relationContextCombo = new Combo(_composite, SWT.READ_ONLY);
    _relationContextCombo.setBackground(WHITE_COLOR);
    _relationContextCombo.setLayoutData(new GridData());
    ((GridData) _relationContextCombo.getLayoutData()).horizontalSpan = 2;
    ((GridData) _relationContextCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _relationContextCombo.getLayoutData()).grabExcessHorizontalSpace = true;
    final ComboViewer relationContextComboViewer = new ComboViewer(_relationContextCombo);
    relationContextComboViewer.setContentProvider(new MarkupContentProvider());
    relationContextComboViewer.setLabelProvider(new MarkupLabelProvider());
    if (_relation != null && _relation.getProvider() != null
            && _facade.getConfigs().get(_relation.getProvider()) != null) {
        relationContextComboViewer.setInput(_facade.getConfigs().get(_relation.getProvider()).getChildren()
                .get("aodl:relation").getChildren());
    }

    final ControlDecoration relContextDeco = new ControlDecoration(_relationContextCombo, SWT.RIGHT | SWT.TOP);

    _relationClassCombo = new Combo(_composite, SWT.READ_ONLY);
    _relationClassCombo.setBackground(WHITE_COLOR);
    _relationClassCombo.setLayoutData(new GridData());
    ((GridData) _relationClassCombo.getLayoutData()).horizontalSpan = 1;
    ((GridData) _relationClassCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _relationClassCombo.getLayoutData()).grabExcessHorizontalSpace = true;
    final ComboViewer relationClassComboViewer = new ComboViewer(_relationClassCombo);
    relationClassComboViewer.setContentProvider(new MarkupContentProvider());
    relationClassComboViewer.setLabelProvider(new MarkupLabelProvider());
    final ControlDecoration relClassDeco = new ControlDecoration(_relationClassCombo, SWT.RIGHT | SWT.TOP);

    _relValueCombo = new Combo(_composite, SWT.BORDER | SWT.READ_ONLY);
    _relValueCombo.setBackground(WHITE_COLOR);
    _relValueCombo.setLayoutData(new GridData());
    ((GridData) _relValueCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _relValueCombo.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) _relValueCombo.getLayoutData()).horizontalSpan = 1;
    final ComboViewer relValueComboViewer = new ComboViewer(_relValueCombo);
    relValueComboViewer.setContentProvider(new MarkupContentProvider());
    relValueComboViewer.setLabelProvider(new MarkupLabelProvider());
    final ControlDecoration relValueDeco = new ControlDecoration(_relValueCombo, SWT.RIGHT | SWT.TOP);

    if (_relation != null && _facade.getConfigs().get(_relation.getProvider()) != null) {
        relationContextComboViewer.setInput(_facade.getConfigs().get(_relation.getProvider()).getChildren()
                .get("aodl:relation").getChildren());
    }

    // control for relationClassCombo
    // ArrayList<String> list = cListPro
    //                  .getList("types", "type", "relation"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    // for (int n = 0; n < list.size(); n++)
    // {
    // relationClassCombo.add(list.get(n));
    // }
    if (_relation != null && _relation.getContext() != null) {
        setComboViewerByString(relationContextComboViewer, _relation.getContext());
    }

    relationContextComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            ISelection iSelection = event.getSelection();
            Object obj = ((IStructuredSelection) iSelection).getFirstElement();
            ConfigData cd = (ConfigData) obj;
            _relation.setContext(cd.getValue());
            _relationClassCombo.removeAll();
            _relValueCombo.removeAll();
            relContextDeco.setDescriptionText(PDRConfigProvider.readDocu(_relation.getProvider(), "relation",
                    "context", _relation.getContext(), null, null, null));
            if (relContextDeco.getDescriptionText() != null) {
                relContextDeco.setImage(FieldDecorationRegistry.getDefault()
                        .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
            } else {
                relContextDeco.setImage(null);
            }
            relationClassComboViewer.setInput(_facade.getConfigs().get(_relation.getProvider()).getChildren()
                    .get("aodl:relation").getChildren().get(_relation.getContext()).getChildren());
            contentChanged();
        }

    });
    _relationContextCombo.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(final FocusEvent e) {
            Event ee = new Event();
            ee.widget = RelationEditorLine.this;
            SelectionEvent se = new SelectionEvent(ee);
            for (SelectionListener s : _selectionListener) {
                s.widgetSelected(se);
            }
        }

        @Override
        public void focusLost(FocusEvent e) {
            // TODO Auto-generated method stub

        }
    });
    _relationContextCombo.layout();

    // control for relationContextCombo
    if (_relation != null && _relation.getRClass() != null) {
        if (_relation.getContext() != null && _facade.getConfigs().get(_relation.getProvider()) != null
                && _facade.getConfigs().get(_relation.getProvider()).getChildren().get("aodl:relation") != null
                && _facade.getConfigs().get(_relation.getProvider()).getChildren().get("aodl:relation")
                        .getChildren().get(_relation.getContext()) != null) {
            relationClassComboViewer.setInput(_facade.getConfigs().get(_relation.getProvider()).getChildren()
                    .get("aodl:relation").getChildren().get(_relation.getContext()).getChildren());
        }
        setComboViewerByString(relationClassComboViewer, _relation.getRClass());
    } else {
        relationClassComboViewer.setInput(null);
        relationClassComboViewer.refresh();
    }
    relationClassComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            ISelection iSelection = event.getSelection();
            Object obj = ((IStructuredSelection) iSelection).getFirstElement();
            ConfigData cd = (ConfigData) obj;
            _relation.setRClass(cd.getValue());
            relValueComboViewer.setInput(_facade.getConfigs().get(_relation.getProvider()).getChildren()
                    .get("aodl:relation").getChildren().get(_relation.getContext()).getChildren()
                    .get(_relation.getRClass()).getChildren());
            relClassDeco.setDescriptionText(PDRConfigProvider.readDocu(_relation.getProvider(), "relation",
                    "class", _relation.getContext(), _relation.getRClass(), null, null));
            if (relClassDeco.getDescriptionText() != null) {
                relClassDeco.setImage(FieldDecorationRegistry.getDefault()
                        .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
            } else {
                relClassDeco.setImage(null);
            }
            contentChanged();
        }
    });
    _relationClassCombo.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(final FocusEvent e) {
            Event ee = new Event();
            ee.widget = RelationEditorLine.this;
            SelectionEvent se = new SelectionEvent(ee);
            for (SelectionListener s : _selectionListener) {
                s.widgetSelected(se);
            }
        }

        @Override
        public void focusLost(FocusEvent e) {
            // TODO Auto-generated method stub

        }
    });
    _relationClassCombo.layout();
    if (_relation != null && _relation.getRelation() != null) {
        if (_relation.getRClass() != null && _facade.getConfigs().get(_relation.getProvider()) != null
                && _facade.getConfigs().get(_relation.getProvider()).getChildren().get("aodl:relation") != null
                && _facade.getConfigs().get(_relation.getProvider()).getChildren().get("aodl:relation")
                        .getChildren().get(_relation.getContext()) != null
                && _facade.getConfigs().get(_relation.getProvider()).getChildren().get("aodl:relation")
                        .getChildren().get(_relation.getContext()).getChildren()
                        .get(_relation.getRClass()) != null) {
            relValueComboViewer.setInput(_facade.getConfigs().get(_relation.getProvider()).getChildren()
                    .get("aodl:relation").getChildren().get(_relation.getContext()).getChildren()
                    .get(_relation.getRClass()).getChildren());
        }
        setComboViewerByString(relValueComboViewer, _relation.getRelation());
    } else {
        relValueComboViewer.setInput(null);
        relValueComboViewer.refresh();
    }
    relValueComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            ISelection iSelection = event.getSelection();
            Object obj = ((IStructuredSelection) iSelection).getFirstElement();
            ConfigData cd = (ConfigData) obj;
            _relation.setRelation(cd.getValue());
            relValueDeco.setDescriptionText(PDRConfigProvider.readDocu(_relation.getProvider(), "relation",
                    "value", _relation.getContext(), _relation.getRClass(), _relation.getRelation(), null));
            if (relValueDeco.getDescriptionText() != null) {
                relValueDeco.setImage(FieldDecorationRegistry.getDefault()
                        .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
            } else {
                relValueDeco.setImage(null);
            }
            contentChanged();
        }
    });
    _relValueCombo.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(final FocusEvent e) {
            Event ee = new Event();
            ee.widget = RelationEditorLine.this;
            SelectionEvent se = new SelectionEvent(ee);
            for (SelectionListener s : _selectionListener) {
                s.widgetSelected(se);
            }
        }

        @Override
        public void focusLost(FocusEvent e) {
            // TODO Auto-generated method stub

        }
    });

    _labelRelation = new Label(_composite, SWT.NONE);
    _labelRelation.setText(NLMessages.getString("Editor_space_withPerson"));
    _labelRelation.setLayoutData(new GridData());
    ((GridData) _labelRelation.getLayoutData()).horizontalSpan = 1;
    ((GridData) _labelRelation.getLayoutData()).horizontalAlignment = SWT.RIGHT;

    _personText = new Text(_composite, SWT.BORDER);
    _personText.setBackground(WHITE_COLOR);
    _personText.setLayoutData(new GridData());
    ((GridData) _personText.getLayoutData()).horizontalSpan = 4;
    ((GridData) _personText.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _personText.getLayoutData()).grabExcessHorizontalSpace = true;

    _decoPersonId = new ControlDecoration(_personText, SWT.LEFT | SWT.TOP);

    _personText.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(final FocusEvent e) {

            Event ee = new Event();
            ee.widget = RelationEditorLine.this;
            SelectionEvent se = new SelectionEvent(ee);
            for (SelectionListener s : _selectionListener) {
                s.widgetSelected(se);
            }

            ContentProposalAdapter adapter = new ContentProposalAdapter(_personText, new TextContentAdapter(),
                    new FacetContentProposalProvider(_facade.getAllPersonsFacets()), null, null);
            adapter.setLabelProvider(new AutoCompleteNameLabelProvider());
            adapter.addContentProposalListener(new IContentProposalListener() {
                @Override
                public void proposalAccepted(final IContentProposal proposal) {
                    _personText.setText(proposal.getContent());
                    if (((Facet) proposal).getKey() != null) {
                        _relation.setObject(new PdrId(((Facet) proposal).getKey()));
                        _decoPersonId.setImage(null);
                        contentChanged();
                    }
                }
            });

        }

        @Override
        public void focusLost(final FocusEvent e) {
            if (_relation != null && _relation.getObject() == null) {
                if (_personText.getText() != null
                        && _facade.getPdrObject(new PdrId(_personText.getText())) != null) {
                    _relation.setObject(new PdrId(_personText.getText()));
                    _decoPersonId.setDescriptionText("");
                    _decoPersonId.setImage(null);
                } else {
                    _relation.setObject(null);
                    _decoPersonId.setImage(FieldDecorationRegistry.getDefault()
                            .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage());
                    _decoPersonId.setDescriptionText(NLMessages.getString("Editor_missing_object_no_relation"));
                }
            } else if (_personText.getText().trim().length() == 0) {
                _relation.setObject(null);
                _decoPersonId.setImage(FieldDecorationRegistry.getDefault()
                        .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage());
            }
            contentChanged();

        }
    });

    _personText.addKeyListener(new KeyListener() {

        @Override
        public void keyPressed(final KeyEvent e) {
        }

        @Override
        public void keyReleased(final KeyEvent e) {
            if (_personText.getText().length() == 23) {
                PdrObject o = _facade.getPdrObject(new PdrId(_personText.getText()));
                if (o != null) {
                    _decoPersonId.setImage(null);
                    _relation.setObject(new PdrId(_personText.getText()));
                    _personText.setText(o.getDisplayNameWithID());
                }
            } else if (_personText.getText().trim().length() == 0) {
                _relation.setObject(null);
                _decoPersonId.setImage(FieldDecorationRegistry.getDefault()
                        .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage());
            }
            contentChanged();
        }
    });

    _searchButton = new Button(_composite, SWT.NONE);
    _searchButton.setToolTipText(NLMessages.getString("Editor_open_selObjDialog_object_tip"));
    _searchButton.setImage(_imageReg.get(IconsInternal.SEARCH));
    _searchButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            IWorkbench workbench = PlatformUI.getWorkbench();
            Display display = workbench.getDisplay();
            Shell shell = new Shell(display);
            SelectObjectDialog dialog = new SelectObjectDialog(shell, 1);
            dialog.open();
            if (_facade.getRequestedId() != null) {
                _relation.setObject(_facade.getRequestedId());
                PdrObject o = _facade.getPdrObject(_relation.getObject());
                if (o != null) {
                    _personText.setText(o.getDisplayNameWithID());
                } else {
                    _personText.setText(_facade.getRequestedId().toString());
                }
                if (_relation.getObject().isValid()) {
                    _decoPersonId.setImage(null);
                }
            } else {
                if (!_relation.getObject().isValid()) {
                    _decoPersonId.setImage(FieldDecorationRegistry.getDefault()
                            .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage());
                }
            }
            contentChanged();

        }
    });
    _deleteRelation = new Button(_composite, SWT.PUSH);
    _deleteRelation.setImage(_imageReg.get(IconsInternal.RELATION_REMOVE));
    _deleteRelation.setLayoutData(new GridData());
    ((GridData) _deleteRelation.getLayoutData()).horizontalSpan = 1;
    ((GridData) _deleteRelation.getLayoutData()).horizontalAlignment = SWT.RIGHT;

    _deleteRelation.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            Event ee = new Event();
            ee.widget = RelationEditorLine.this;
            ee.data = _relation;
            ee.text = "del";
            for (Listener s : _deleteListener) {
                s.handleEvent(ee);
            }
            contentChanged();
        }

    });
    // _composite.layout();
    // _composite.pack();
}

From source file:org.bbaw.pdr.ae.view.control.dialogs.SelectObjectDialog.java

License:Open Source License

/**
 * Builds the aspect search.//from   w  w  w.  j  a  va 2s  . co m
 */
private void buildAspectSearch() {
    DataType dtAll = new DataType();
    dtAll.setValue("ALL");
    dtAll.setLabel("ALL");
    _aspectQuery = new PdrQuery();
    _aspectQuery.setType(0);
    _criteria = new Criteria();
    _criteria.setType("tagging"); //$NON-NLS-1$
    _aspectQuery.getCriterias().add(_criteria);
    final Criteria c = _aspectQuery.getCriterias().firstElement();

    _searchATagComp = new Composite(_aspectSearchGroup, SWT.NONE);
    _searchATagComp.setLayout(new GridLayout());
    ((GridLayout) _searchATagComp.getLayout()).makeColumnsEqualWidth = true;
    ((GridLayout) _searchATagComp.getLayout()).numColumns = 15;
    _searchATagComp.setLayoutData(new GridData());
    ((GridData) _searchATagComp.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _searchATagComp.getLayoutData()).grabExcessHorizontalSpace = true;
    // ((GridData) searchPTagComp.getLayoutData()).heightHint = 200;
    ((GridData) _searchATagComp.getLayoutData()).grabExcessVerticalSpace = false;
    ((GridData) _searchATagComp.getLayoutData()).horizontalSpan = 1;

    Label sem = new Label(_searchATagComp, SWT.NONE);
    sem.setText(NLMessages.getString("Dialog_semantic"));
    sem.setLayoutData(new GridData());
    ((GridData) sem.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) sem.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) sem.getLayoutData()).horizontalSpan = 2;

    Label tagName = new Label(_searchATagComp, SWT.NONE);
    tagName.setText(NLMessages.getString("Dialog_Markup"));
    tagName.setLayoutData(new GridData());
    ((GridData) tagName.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) tagName.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) tagName.getLayoutData()).horizontalSpan = 2;

    Label tagType = new Label(_searchATagComp, SWT.NONE);
    tagType.setText(NLMessages.getString("Dialog_type"));
    tagType.setLayoutData(new GridData());
    ((GridData) tagType.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) tagType.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) tagType.getLayoutData()).horizontalSpan = 2;

    Label tagSubtype = new Label(_searchATagComp, SWT.NONE);
    tagSubtype.setText(NLMessages.getString("Dialog_subtype"));
    tagSubtype.setLayoutData(new GridData());
    ((GridData) tagSubtype.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) tagSubtype.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) tagSubtype.getLayoutData()).horizontalSpan = 2;

    Label searchTextLabel = new Label(_searchATagComp, SWT.NONE);
    searchTextLabel.setText(NLMessages.getString("Dialog_searchText"));
    searchTextLabel.setLayoutData(new GridData());
    ((GridData) searchTextLabel.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) searchTextLabel.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) searchTextLabel.getLayoutData()).horizontalSpan = 5;

    Label fuzzy = new Label(_searchATagComp, SWT.NONE);
    fuzzy.setText(NLMessages.getString("Dialog_fuzzy"));
    fuzzy.setLayoutData(new GridData());
    ((GridData) fuzzy.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) fuzzy.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) fuzzy.getLayoutData()).horizontalSpan = 1;

    final Combo semCombo = new Combo(_searchATagComp, SWT.READ_ONLY);
    semCombo.setLayoutData(new GridData());
    ComboViewer comboSemanticViewer = new ComboViewer(semCombo);
    comboSemanticViewer.setContentProvider(new AEConfigPresentableContentProvider());
    comboSemanticViewer.setLabelProvider(new AEConfigPresentableLabelProvider());
    ((AEConfigPresentableContentProvider) comboSemanticViewer.getContentProvider()).setAddALL(true);

    if (_facade.getAllSemantics() != null && !_facade.getAllSemantics().isEmpty()) {
        comboSemanticViewer.setInput(_facade.getAllSemantics());
        if (c.getCrit0() != null) {
            setComboViewerByString(comboSemanticViewer, c.getCrit0());
        } else {
            semCombo.select(0);
            c.setCrit0(semCombo.getItem(0));
        }
    }
    semCombo.setLayoutData(new GridData());
    ((GridData) semCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) semCombo.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) semCombo.getLayoutData()).horizontalSpan = 2;

    comboSemanticViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            ISelection iSelection = event.getSelection();
            Object obj = ((IStructuredSelection) iSelection).getFirstElement();
            IAEPresentable cp = (IAEPresentable) obj;
            if (cp != null) {
                c.setCrit0(cp.getValue());
            }
        }
    });
    semCombo.pack();
    final Combo tagCombo = new Combo(_searchATagComp, SWT.READ_ONLY);
    tagCombo.setLayoutData(new GridData());
    tagCombo.setLayoutData(new GridData());
    ((GridData) tagCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) tagCombo.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) tagCombo.getLayoutData()).horizontalSpan = 2;
    final ComboViewer tagComboViewer = new ComboViewer(tagCombo);
    tagComboViewer.setContentProvider(new MarkupContentProvider(true));
    tagComboViewer.setLabelProvider(new MarkupLabelProvider());
    tagComboViewer.setComparator(new ConfigDataComparator());
    if (_facade.getConfigs().containsKey(_markupProvider)) {
        HashMap<String, ConfigData> input = _facade.getConfigs().get(_markupProvider).getChildren();
        tagComboViewer.setInput(input);
    }
    if (c.getCrit1() != null) {
        setComboViewerByString(tagComboViewer, c.getCrit1());
    } else {
        Object obj = tagComboViewer.getElementAt(0);
        if (obj != null) {
            tagComboViewer.setSelection(new StructuredSelection(obj));
            ConfigData cd = (ConfigData) tagComboViewer.getElementAt(0);
            if (cd.getValue().startsWith("aodl:")) //$NON-NLS-1$
            {
                c.setCrit1(cd.getValue().substring(5));
            } else {
                c.setCrit1(cd.getValue());
            }
        }
    }
    final Combo typeCombo = new Combo(_searchATagComp, SWT.READ_ONLY);
    typeCombo.setLayoutData(new GridData());
    typeCombo.setLayoutData(new GridData());
    ((GridData) typeCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) typeCombo.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) typeCombo.getLayoutData()).horizontalSpan = 2;
    final ComboViewer typeComboViewer = new ComboViewer(typeCombo);
    typeComboViewer.setContentProvider(new MarkupContentProvider(false));
    typeComboViewer.setLabelProvider(new MarkupLabelProvider());
    typeComboViewer.setComparator(new ConfigDataComparator());

    tagComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            ISelection iSelection = event.getSelection();
            Object obj = ((IStructuredSelection) iSelection).getFirstElement();
            ConfigData cd = (ConfigData) obj;
            String selection;
            if (cd.getValue().startsWith("aodl:")) {
                selection = cd.getValue().substring(5);
            } else {
                selection = cd.getValue();
            }
            c.setCrit1(selection);
            setComboViewerInput(typeComboViewer, "tagging_values", c.getCrit1(), null, null);
        }
    });

    if (c.getCrit2() != null) {
        setComboViewerByString(typeComboViewer, c.getCrit2());
    }

    final Combo subtypeCombo = new Combo(_searchATagComp, SWT.READ_ONLY);
    final ComboViewer subtypeComboViewer = new ComboViewer(subtypeCombo);
    subtypeComboViewer.setContentProvider(new MarkupContentProvider(false));
    subtypeComboViewer.setLabelProvider(new MarkupLabelProvider());
    subtypeComboViewer.setComparator(new ConfigDataComparator());

    typeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            ISelection iSelection = event.getSelection();
            Object obj = ((IStructuredSelection) iSelection).getFirstElement();
            ConfigData cd = (ConfigData) obj;
            subtypeComboViewer.setInput(null);
            if (cd != null) {
                c.setCrit2(cd.getValue());
            }
            setComboViewerInput(subtypeComboViewer, "tagging_values", c.getCrit1(), c.getCrit2(), null);
        }
    });

    subtypeCombo.setLayoutData(new GridData());
    subtypeCombo.setLayoutData(new GridData());
    ((GridData) subtypeCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) subtypeCombo.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) subtypeCombo.getLayoutData()).horizontalSpan = 2;
    if (c.getCrit3() != null) {
        setComboViewerByString(subtypeComboViewer, c.getCrit3());
    }

    subtypeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            ISelection iSelection = event.getSelection();
            Object obj = ((IStructuredSelection) iSelection).getFirstElement();
            ConfigData cd = (ConfigData) obj;
            if (cd != null) {
                c.setCrit3(cd.getValue());
            }
        }
    });

    final Text searchText = new Text(_searchATagComp, SWT.BORDER);
    searchText.setLayoutData(new GridData());
    searchText.setLayoutData(new GridData());
    ((GridData) searchText.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) searchText.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) searchText.getLayoutData()).horizontalSpan = 5;
    if (c.getSearchText() != null) {
        searchText.setText(c.getSearchText());
    }
    searchText.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(final FocusEvent e) {
            String[] vals = new String[] {};
            try {
                vals = _mainSearcher.getFacets("tagging", c.getCrit1(), c.getCrit2(), null, null);
            } catch (Exception e1) {

                e1.printStackTrace();
            }
            new AutoCompleteField(searchText, new TextContentAdapter(), vals);

        }

        @Override
        public void focusLost(final FocusEvent e) {
            c.setSearchText(searchText.getText());
        }
    });
    searchText.addKeyListener(new KeyListener() {
        @Override
        public void keyPressed(final KeyEvent e) {
            if (e.keyCode == SWT.CR) {
                c.setSearchText(searchText.getText());
                searchAspects();
            }
        }

        @Override
        public void keyReleased(final KeyEvent e) {
        }
    });
    final Button fuzzyB = new Button(_searchATagComp, SWT.CHECK);
    fuzzyB.setLayoutData(new GridData());
    fuzzyB.setSelection(c.isFuzzy());
    fuzzyB.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            c.setFuzzy(!c.isFuzzy());
        }
    });

    _searchADateComp = new Composite(_aspectSearchGroup, SWT.NONE);
    _searchADateComp.setLayout(new GridLayout());
    ((GridLayout) _searchADateComp.getLayout()).makeColumnsEqualWidth = true;
    ((GridLayout) _searchADateComp.getLayout()).numColumns = 13;
    _searchADateComp.setLayoutData(new GridData());
    ((GridData) _searchADateComp.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _searchADateComp.getLayoutData()).grabExcessHorizontalSpace = true;
    // ((GridData) searchADateComp.getLayoutData()).heightHint = 200;
    ((GridData) _searchADateComp.getLayoutData()).grabExcessVerticalSpace = false;
    ((GridData) _searchADateComp.getLayoutData()).horizontalSpan = 1;

    Label typeDate = new Label(_searchADateComp, SWT.NONE);
    typeDate.setText(NLMessages.getString("Dialog_type"));
    typeDate.setLayoutData(new GridData());
    ((GridData) typeDate.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) typeDate.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) typeDate.getLayoutData()).horizontalSpan = 2;

    Label bl = new Label(_searchADateComp, SWT.NONE);
    bl.setText(""); //$NON-NLS-1$
    Label notBefore = new Label(_searchADateComp, SWT.NONE);
    notBefore.setText(NLMessages.getString("Dialog_day"));
    notBefore.setLayoutData(new GridData());
    ((GridData) notBefore.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) notBefore.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) notBefore.getLayoutData()).horizontalSpan = 1;

    Label month = new Label(_searchADateComp, SWT.NONE);
    month.setText(NLMessages.getString("Dialog_month"));
    month.setLayoutData(new GridData());
    ((GridData) month.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) month.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) month.getLayoutData()).horizontalSpan = 1;

    Label year = new Label(_searchADateComp, SWT.NONE);
    year.setText(NLMessages.getString("Dialog_year"));
    year.setLayoutData(new GridData());
    ((GridData) year.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) year.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) year.getLayoutData()).horizontalSpan = 2;

    Label bl2 = new Label(_searchADateComp, SWT.NONE);
    bl2.setText(""); //$NON-NLS-1$

    Label notAfter = new Label(_searchADateComp, SWT.NONE);
    notAfter.setText(NLMessages.getString("Dialog_day"));
    notAfter.setLayoutData(new GridData());
    ((GridData) notAfter.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) notAfter.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) notAfter.getLayoutData()).horizontalSpan = 1;

    Label month2 = new Label(_searchADateComp, SWT.NONE);
    month2.setText(NLMessages.getString("Dialog_month"));
    month2.setLayoutData(new GridData());
    ((GridData) month2.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) month2.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) month2.getLayoutData()).horizontalSpan = 1;

    Label year2 = new Label(_searchADateComp, SWT.NONE);
    year2.setText(NLMessages.getString("Dialog_year"));
    year2.setLayoutData(new GridData());
    ((GridData) year2.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) year2.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) year2.getLayoutData()).horizontalSpan = 2;

    final Combo typeDCombo = new Combo(_searchADateComp, SWT.READ_ONLY);
    typeDCombo.setLayoutData(new GridData());
    ComboViewer timeTypeComboViewer = new ComboViewer(typeDCombo);
    timeTypeComboViewer.setContentProvider(ArrayContentProvider.getInstance());
    timeTypeComboViewer.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(final Object element) {
            String str = (String) element;
            if (NLMessages.getString("Editor_time_" + str) != null) {
                return NLMessages.getString("Editor_time_" + str);
            }
            return str;
        }

    });
    timeTypeComboViewer.setInput(AEConstants.TIME_TYPES);
    timeTypeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            Object obj = ((IStructuredSelection) selection).getFirstElement();
            String s = (String) obj;
            c.setDateType(s);
        }

    });
    if (c.getDateType() != null) {
        StructuredSelection selection = new StructuredSelection(c.getDateType());
        timeTypeComboViewer.setSelection(selection);
    } else {
        StructuredSelection selection = new StructuredSelection(AEConstants.TIME_TYPES[0]);
        timeTypeComboViewer.setSelection(selection);
        c.setDateType(AEConstants.TIME_TYPES[0]);
    }
    typeDCombo.pack();
    typeDCombo.setLayoutData(new GridData());
    ((GridData) typeDCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) typeDCombo.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) typeDCombo.getLayoutData()).horizontalSpan = 2;

    Label from = new Label(_searchADateComp, SWT.NONE);
    from.setText(NLMessages.getString("Dialog_from"));
    from.setLayoutData(new GridData());
    ((GridData) from.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) from.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) from.getLayoutData()).horizontalSpan = 1;

    final Combo day1Combo = new Combo(_searchADateComp, SWT.READ_ONLY);
    day1Combo.setLayoutData(new GridData());
    day1Combo.setItems(AEConstants.DAYS);
    day1Combo.setLayoutData(new GridData());
    ((GridData) day1Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) day1Combo.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) day1Combo.getLayoutData()).horizontalSpan = 1;

    if (c.getDateFrom() == null) {
        PdrDate dateFrom = new PdrDate("0000-00-00"); //$NON-NLS-1$
        // dateFrom.setDay(0);
        // dateFrom.setMonth(0);
        // dateFrom.setYear(0);
        c.setDateFrom(dateFrom);
        day1Combo.select(c.getDateFrom().getDay());
    }
    //         System.out.println("test: dateFrom " + c.getDateFrom().toString()); //$NON-NLS-1$
    // else
    // {
    //
    // day1Combo.select(0);
    // c.getDateFrom().setDay(0);
    //
    // }

    day1Combo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent se) {
            c.getDateFrom().setDay(day1Combo.getSelectionIndex());
        }
    });

    final Combo month1Combo = new Combo(_searchADateComp, SWT.READ_ONLY);
    month1Combo.setLayoutData(new GridData());
    month1Combo.setItems(AEConstants.MONTHS);
    month1Combo.setLayoutData(new GridData());
    ((GridData) month1Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) month1Combo.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) month1Combo.getLayoutData()).horizontalSpan = 1;
    if (c.getDateFrom() != null) {
        month1Combo.select(c.getDateFrom().getMonth());
    } else {

        month1Combo.select(0);
        c.getDateFrom().setMonth(0);

    }

    month1Combo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent se) {
            c.getDateFrom().setMonth(month1Combo.getSelectionIndex());
        }
    });

    final YearSpinner year1Spinner = new YearSpinner(_searchADateComp, SWT.NULL);
    // year1Spinner.setLayoutData(new GridData());
    // year1Spinner.setLayoutData(new GridData());
    // ((GridData) year1Spinner.getLayoutData()).horizontalAlignment =
    // SWT.FILL;
    // ((GridData) year1Spinner.getLayoutData()).grabExcessHorizontalSpace =
    // true;
    // ((GridData) year1Spinner.getLayoutData()).horizontalSpan = 2;
    // year1Spinner.setMinimum(0);
    // year1Spinner.setMaximum(9999);
    if (c.getDateFrom() != null) {
        year1Spinner.setSelection(c.getDateFrom().getYear());
    } else {

        year1Spinner.setSelection(_preselection);
        c.getDateFrom().setYear(_preselection);

    }
    year1Spinner.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(final SelectionEvent e) {
            c.getDateFrom().setYear(year1Spinner.getSelection());

        }

        @Override
        public void widgetSelected(final SelectionEvent e) {
            c.getDateFrom().setYear(year1Spinner.getSelection());
        }

    });

    Label to = new Label(_searchADateComp, SWT.NONE);
    to.setText(NLMessages.getString("Dialog_to"));
    to.setLayoutData(new GridData());
    ((GridData) to.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) to.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) to.getLayoutData()).horizontalSpan = 1;

    final Combo day2Combo = new Combo(_searchADateComp, SWT.READ_ONLY);
    day2Combo.setLayoutData(new GridData());
    day2Combo.setItems(AEConstants.DAYS);
    day2Combo.setLayoutData(new GridData());
    ((GridData) day2Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) day2Combo.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) day2Combo.getLayoutData()).horizontalSpan = 1;
    if (c.getDateTo() == null) {
        PdrDate dateTo = new PdrDate("0000-00-00"); //$NON-NLS-1$
        c.setDateTo(dateTo);
        day2Combo.select(c.getDateTo().getDay());
    }

    day2Combo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent se) {
            c.getDateTo().setDay(day2Combo.getSelectionIndex());
        }
    });

    final Combo month2Combo = new Combo(_searchADateComp, SWT.READ_ONLY);
    month2Combo.setLayoutData(new GridData());
    month2Combo.setItems(AEConstants.MONTHS);
    month2Combo.setLayoutData(new GridData());
    ((GridData) month2Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) month2Combo.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) month2Combo.getLayoutData()).horizontalSpan = 1;
    if (c.getDateTo() != null) {
        month2Combo.select(c.getDateTo().getMonth());
    } else {

        month2Combo.select(0);
        c.getDateTo().setMonth(0);

    }

    month2Combo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent se) {
            c.getDateTo().setMonth(month2Combo.getSelectionIndex());
        }
    });

    final YearSpinner year2Spinner = new YearSpinner(_searchADateComp, SWT.NULL);
    // year2Spinner.setLayoutData(new GridData());
    // year2Spinner.setLayoutData(new GridData());
    // ((GridData) year2Spinner.getLayoutData()).horizontalAlignment =
    // SWT.FILL;
    // ((GridData) year2Spinner.getLayoutData()).grabExcessHorizontalSpace =
    // true;
    // ((GridData) year2Spinner.getLayoutData()).horizontalSpan = 2;
    // year2Spinner.setMinimum(0);
    // year2Spinner.setMaximum(9999);
    if (c.getDateTo() != null) {
        year2Spinner.setSelection(c.getDateTo().getYear());
    } else {

        year2Spinner.setSelection(_preselection);
        c.getDateTo().setYear(_preselection);

    }

    year2Spinner.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(final SelectionEvent e) {
            c.getDateTo().setYear(year2Spinner.getSelection());

        }

        @Override
        public void widgetSelected(final SelectionEvent e) {
            c.getDateTo().setYear(year2Spinner.getSelection());
        }

    });

    final Button includeB = new Button(_searchADateComp, SWT.CHECK);
    includeB.setLayoutData(new GridData());
    includeB.setSelection(c.isIncludeConcurrences());
    includeB.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            c.setIncludeConcurrences(!c.isIncludeConcurrences());
        }
    });

}

From source file:org.bbaw.pdr.ae.view.control.dialogs.SelectObjectDialog.java

License:Open Source License

/**
 * Builds the person search./*from ww w  .j  a  v a  2  s  . c o m*/
 */
private void buildPersonSearch() {
    DataType dtAll = new DataType();
    dtAll.setValue("ALL");
    dtAll.setLabel("ALL");
    _personQuery = new PdrQuery();
    _personQuery.setType(1);
    _criteria = new Criteria();
    _criteria.setType("tagging"); //$NON-NLS-1$
    _personQuery.getCriterias().add(_criteria);
    _criteria = new Criteria();
    _criteria.setType("tagging"); //$NON-NLS-1$
    _personQuery.getCriterias().add(_criteria);

    _criteria = new Criteria();
    _personQuery.getCriterias().add(_criteria);
    _criteria.setType("relation"); //$NON-NLS-1$

    _criteria = new Criteria();
    _personQuery.getCriterias().add(_criteria);
    _criteria.setType("date"); //$NON-NLS-1$

    boolean tag1 = true;
    boolean rel1 = true;
    boolean date1 = true;
    for (int i = 0; i < _personQuery.getCriterias().size(); i++) {
        //         System.out.println("for i = " + i); //$NON-NLS-1$
        final Criteria c = _personQuery.getCriterias().get(i);

        if (c.getType().equals("tagging")) //$NON-NLS-1$
        {
            if (tag1) {
                tag1 = false;
                _searchPTagComp = new Composite(_personSearchGroup, SWT.NONE);
                _searchPTagComp.setLayout(new GridLayout());
                ((GridLayout) _searchPTagComp.getLayout()).makeColumnsEqualWidth = true;
                ((GridLayout) _searchPTagComp.getLayout()).numColumns = 15;
                _searchPTagComp.setLayoutData(new GridData());
                ((GridData) _searchPTagComp.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) _searchPTagComp.getLayoutData()).grabExcessHorizontalSpace = true;
                // ((GridData) searchPTagComp.getLayoutData()).heightHint =
                // 200;
                ((GridData) _searchPTagComp.getLayoutData()).grabExcessVerticalSpace = false;
                ((GridData) _searchPTagComp.getLayoutData()).horizontalSpan = 1;

                Label op = new Label(_searchPTagComp, SWT.NONE);
                op.setText(NLMessages.getString("Dialog_operand"));
                op.setLayoutData(new GridData());
                ((GridData) op.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) op.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) op.getLayoutData()).horizontalSpan = 2;

                Label sem = new Label(_searchPTagComp, SWT.NONE);
                sem.setText(NLMessages.getString("Dialog_semantic"));
                sem.setLayoutData(new GridData());
                ((GridData) sem.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) sem.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) sem.getLayoutData()).horizontalSpan = 2;

                Label tagName = new Label(_searchPTagComp, SWT.NONE);
                tagName.setText(NLMessages.getString("Dialog_markup"));
                tagName.setLayoutData(new GridData());
                ((GridData) tagName.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) tagName.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) tagName.getLayoutData()).horizontalSpan = 2;

                Label tagType = new Label(_searchPTagComp, SWT.NONE);
                tagType.setText(NLMessages.getString("Dialog_type"));
                tagType.setLayoutData(new GridData());
                ((GridData) tagType.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) tagType.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) tagType.getLayoutData()).horizontalSpan = 2;

                Label tagSubtype = new Label(_searchPTagComp, SWT.NONE);
                tagSubtype.setText(NLMessages.getString("Dialog_subtype"));
                tagSubtype.setLayoutData(new GridData());
                ((GridData) tagSubtype.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) tagSubtype.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) tagSubtype.getLayoutData()).horizontalSpan = 2;

                Label searchTextLabel = new Label(_searchPTagComp, SWT.NONE);
                searchTextLabel.setText(NLMessages.getString("Dialog_searchText"));
                searchTextLabel.setLayoutData(new GridData());
                ((GridData) searchTextLabel.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) searchTextLabel.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) searchTextLabel.getLayoutData()).horizontalSpan = 3;

                Label fuzzy = new Label(_searchPTagComp, SWT.NONE);
                fuzzy.setText(NLMessages.getString("Dialog_fuzzy"));
                fuzzy.setLayoutData(new GridData());
                ((GridData) fuzzy.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) fuzzy.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) fuzzy.getLayoutData()).horizontalSpan = 1;

                Label include = new Label(_searchPTagComp, SWT.NONE);
                include.setText(NLMessages.getString("Dialog_include"));
                include.setToolTipText(NLMessages.getString("Dialog_includeConcurrences"));
                include.setLayoutData(new GridData());
                ((GridData) include.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) include.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) include.getLayoutData()).horizontalSpan = 1;

            }

            if (i == 0) {
                Label l = new Label(_searchPTagComp, SWT.NONE);
                l.setText(NLMessages.getString("Dialog_Markup"));
                l.setLayoutData(new GridData());
                ((GridData) l.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) l.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) l.getLayoutData()).horizontalSpan = 2;
            } else {
                final Combo opCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
                opCombo.setLayoutData(new GridData());
                opCombo.add(Operator.AND.toString());
                opCombo.add(Operator.OR.toString());
                opCombo.add(Operator.NOT.toString());
                opCombo.setLayoutData(new GridData());
                ((GridData) opCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) opCombo.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) opCombo.getLayoutData()).horizontalSpan = 2;
                if (c.getOperator() != null) {
                    opCombo.setText(c.getOperator());
                } else {
                    opCombo.select(0);
                    c.setOperator(opCombo.getItem(0));

                }
                opCombo.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent se) {
                        c.setOperator(opCombo.getItem(opCombo.getSelectionIndex()));
                    }
                });
            }

            final Combo semCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
            semCombo.setLayoutData(new GridData());
            ComboViewer comboSemanticViewer = new ComboViewer(semCombo);
            comboSemanticViewer.setContentProvider(new AEConfigPresentableContentProvider());
            comboSemanticViewer.setLabelProvider(new AEConfigPresentableLabelProvider());
            ((AEConfigPresentableContentProvider) comboSemanticViewer.getContentProvider()).setAddALL(true);

            if (_facade.getAllSemantics() != null && !_facade.getAllSemantics().isEmpty()) {
                comboSemanticViewer.setInput(_facade.getAllSemantics());
                if (c.getCrit0() != null) {
                    setComboViewerByString(comboSemanticViewer, c.getCrit0());
                } else {
                    semCombo.select(0);
                    c.setCrit0(semCombo.getItem(0));
                }
            }
            semCombo.setLayoutData(new GridData());
            ((GridData) semCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) semCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) semCombo.getLayoutData()).horizontalSpan = 2;

            comboSemanticViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    IAEPresentable cp = (IAEPresentable) obj;
                    if (cp != null) {
                        c.setCrit0(cp.getValue());
                    }
                }
            });
            semCombo.pack();
            final Combo tagCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
            tagCombo.setLayoutData(new GridData());
            tagCombo.setLayoutData(new GridData());
            ((GridData) tagCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) tagCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) tagCombo.getLayoutData()).horizontalSpan = 2;
            final ComboViewer tagComboViewer = new ComboViewer(tagCombo);
            tagComboViewer.setContentProvider(new MarkupContentProvider(true));
            tagComboViewer.setLabelProvider(new MarkupLabelProvider());
            tagComboViewer.setComparator(new ConfigDataComparator());
            if (_facade.getConfigs().containsKey(_markupProvider)) {
                HashMap<String, ConfigData> input = _facade.getConfigs().get(_markupProvider).getChildren();
                tagComboViewer.setInput(input);
            }
            if (c.getCrit1() != null) {
                setComboViewerByString(tagComboViewer, c.getCrit1());
            } else {
                Object obj = tagComboViewer.getElementAt(0);
                if (obj != null) {
                    tagComboViewer.setSelection(new StructuredSelection(obj));
                    ConfigData cd = (ConfigData) tagComboViewer.getElementAt(0);
                    if (cd.getValue().startsWith("aodl:")) //$NON-NLS-1$
                    {
                        c.setCrit1(cd.getValue().substring(5));
                    } else {
                        c.setCrit1(cd.getValue());
                    }
                }

            }
            final Combo typeCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
            typeCombo.setLayoutData(new GridData());
            typeCombo.setLayoutData(new GridData());
            ((GridData) typeCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) typeCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) typeCombo.getLayoutData()).horizontalSpan = 2;
            final ComboViewer typeComboViewer = new ComboViewer(typeCombo);
            typeComboViewer.setContentProvider(new MarkupContentProvider(false));
            typeComboViewer.setLabelProvider(new MarkupLabelProvider());
            typeComboViewer.setComparator(new ConfigDataComparator());

            tagComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    String selection;
                    if (cd.getValue().startsWith("aodl:")) {
                        selection = cd.getValue().substring(5);
                    } else {
                        selection = cd.getValue();
                    }
                    c.setCrit1(selection);
                    setComboViewerInput(typeComboViewer, "tagging_values", c.getCrit1(), null, null);
                }
            });

            if (c.getCrit2() != null) {
                setComboViewerByString(typeComboViewer, c.getCrit2());
            }

            final Combo subtypeCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
            final ComboViewer subtypeComboViewer = new ComboViewer(subtypeCombo);
            subtypeComboViewer.setContentProvider(new MarkupContentProvider(false));
            subtypeComboViewer.setLabelProvider(new MarkupLabelProvider());
            subtypeComboViewer.setComparator(new ConfigDataComparator());

            typeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    subtypeComboViewer.setInput(null);
                    if (cd != null) {
                        c.setCrit2(cd.getValue());
                    }
                    setComboViewerInput(subtypeComboViewer, "tagging_values", c.getCrit1(), c.getCrit2(), null);
                }
            });

            subtypeCombo.setLayoutData(new GridData());
            subtypeCombo.setLayoutData(new GridData());
            ((GridData) subtypeCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) subtypeCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) subtypeCombo.getLayoutData()).horizontalSpan = 2;
            if (c.getCrit3() != null) {
                setComboViewerByString(subtypeComboViewer, c.getCrit3());
            }

            subtypeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    if (cd != null) {
                        c.setCrit3(cd.getValue());
                    }
                }
            });

            final Text searchText = new Text(_searchPTagComp, SWT.BORDER);
            searchText.setLayoutData(new GridData());
            searchText.setLayoutData(new GridData());
            ((GridData) searchText.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) searchText.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) searchText.getLayoutData()).horizontalSpan = 3;

            if (c.getSearchText() != null) {
                searchText.setText(c.getSearchText());
            }
            searchText.addFocusListener(new FocusListener() {
                @Override
                public void focusGained(final FocusEvent e) {
                    String[] vals = new String[] {};
                    try {
                        vals = _mainSearcher.getFacets("tagging", c.getCrit1(), c.getCrit2(), null, null);
                    } catch (Exception e1) {

                        e1.printStackTrace();
                    }
                    new AutoCompleteField(searchText, new TextContentAdapter(), vals);

                }

                @Override
                public void focusLost(final FocusEvent e) {
                    c.setSearchText(searchText.getText());
                }
            });
            searchText.addKeyListener(new KeyListener() {
                @Override
                public void keyPressed(final KeyEvent e) {
                    if (e.keyCode == SWT.CR) {
                        c.setSearchText(searchText.getText());
                        searchPersons();
                    }
                }

                @Override
                public void keyReleased(final KeyEvent e) {
                }
            });

            final Button fuzzyB = new Button(_searchPTagComp, SWT.CHECK);
            fuzzyB.setLayoutData(new GridData());
            fuzzyB.setSelection(c.isFuzzy());
            fuzzyB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setFuzzy(!c.isFuzzy());
                }
            });

            final Button includeB = new Button(_searchPTagComp, SWT.CHECK);
            includeB.setLayoutData(new GridData());
            includeB.setSelection(c.isIncludeConcurrences());
            includeB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setIncludeConcurrences(!c.isIncludeConcurrences());
                }
            });

        } // if tagging

        if (c.getType().equals("relation")) //$NON-NLS-1$
        {
            if (rel1) {
                rel1 = false;
                _searchPRelComp = new Composite(_personSearchGroup, SWT.NONE);
                _searchPRelComp.setLayout(new GridLayout());
                ((GridLayout) _searchPRelComp.getLayout()).makeColumnsEqualWidth = true;
                ((GridLayout) _searchPRelComp.getLayout()).numColumns = 15;
                _searchPRelComp.setLayoutData(new GridData());
                ((GridData) _searchPRelComp.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) _searchPRelComp.getLayoutData()).grabExcessHorizontalSpace = true;
                // ((GridData) searchPRelComp.getLayoutData()).heightHint =
                // 200;
                ((GridData) _searchPRelComp.getLayoutData()).grabExcessVerticalSpace = false;
                ((GridData) _searchPRelComp.getLayoutData()).horizontalSpan = 1;

                Label l = new Label(_searchPRelComp, SWT.NONE);
                l.setText(NLMessages.getString("Dialog_relation"));
                l.setLayoutData(new GridData());
                ((GridData) l.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) l.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) l.getLayoutData()).horizontalSpan = 2;

                Label context = new Label(_searchPRelComp, SWT.NONE);
                context.setText(NLMessages.getString("Dialog_context"));
                context.setLayoutData(new GridData());
                ((GridData) context.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) context.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) context.getLayoutData()).horizontalSpan = 2;

                Label classL = new Label(_searchPRelComp, SWT.NONE);
                classL.setText(NLMessages.getString("Dialog_class"));
                classL.setLayoutData(new GridData());
                ((GridData) classL.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) classL.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) classL.getLayoutData()).horizontalSpan = 2;

                Label relObj = new Label(_searchPRelComp, SWT.NONE);
                relObj.setText(NLMessages.getString("Dialog_relObject"));
                relObj.setLayoutData(new GridData());
                ((GridData) relObj.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) relObj.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) relObj.getLayoutData()).horizontalSpan = 4;

                Label searchTextLabel = new Label(_searchPRelComp, SWT.NONE);
                searchTextLabel.setText(NLMessages.getString("Dialog_searchText"));
                searchTextLabel.setLayoutData(new GridData());
                ((GridData) searchTextLabel.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) searchTextLabel.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) searchTextLabel.getLayoutData()).horizontalSpan = 3;

                Label fuzzy = new Label(_searchPRelComp, SWT.NONE);
                fuzzy.setText(""); //$NON-NLS-1$
                fuzzy.setLayoutData(new GridData());
                ((GridData) fuzzy.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) fuzzy.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) fuzzy.getLayoutData()).horizontalSpan = 1;

                Label include = new Label(_searchPRelComp, SWT.NONE);
                include.setText(""); //$NON-NLS-1$
                include.setToolTipText(NLMessages.getString("Dialog_includeConcurrences"));
                include.setLayoutData(new GridData());
                ((GridData) include.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) include.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) include.getLayoutData()).horizontalSpan = 1;

            }

            if (i == 0) {
                Label l = new Label(_searchPRelComp, SWT.NONE);
                l.setLayoutData(new GridData());
                l.setLayoutData(new GridData());
                ((GridData) l.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) l.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) l.getLayoutData()).horizontalSpan = 2;
            } else {
                final Combo opCombo = new Combo(_searchPRelComp, SWT.READ_ONLY);
                opCombo.setLayoutData(new GridData());
                opCombo.add(Operator.AND.toString());
                opCombo.add(Operator.OR.toString());
                opCombo.add(Operator.NOT.toString());
                opCombo.setLayoutData(new GridData());
                ((GridData) opCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) opCombo.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) opCombo.getLayoutData()).horizontalSpan = 2;
                if (c.getOperator() != null) {
                    opCombo.setText(c.getOperator());
                } else {
                    opCombo.select(0);
                    c.setOperator(opCombo.getItem(0));

                }
                opCombo.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent se) {
                        c.setOperator(opCombo.getItem(opCombo.getSelectionIndex()));
                    }
                });
            }
            // final Combo contextCombo = new Combo(searchPRelComp,
            // SWT.READ_ONLY);
            // contextCombo.setLayoutData(new GridData());
            // contextCombo.setLayoutData(new GridData());
            // ((GridData) contextCombo.getLayoutData()).horizontalAlignment
            // = SWT.FILL;
            // ((GridData)
            // contextCombo.getLayoutData()).grabExcessHorizontalSpace =
            // true ;
            // ((GridData) contextCombo.getLayoutData()).horizontalSpan = 2;
            //
            //
            // final Combo classCombo = new Combo(searchPRelComp,
            // SWT.READ_ONLY);
            // classCombo.setLayoutData(new GridData());
            // classCombo.setLayoutData(new GridData());
            // ((GridData) classCombo.getLayoutData()).horizontalAlignment =
            // SWT.FILL;
            // ((GridData)
            // classCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            // ((GridData) classCombo.getLayoutData()).horizontalSpan = 2;
            //
            //
            // if (c.getRelationContext() != null)
            // {
            // contextCombo.select(contextCombo.indexOf(c.getRelationContext()));
            // }
            // else
            // {
            // try {
            // contextCombo.setItems(_mainSearcher.getFacets
            //            ("relation", null, null, null, null)); //$NON-NLS-1$ //$NON-NLS-2$
            // } catch (Exception e1) {
            // e1.printStackTrace();
            // }
            //               contextCombo.add("ALL", 0); //$NON-NLS-1$
            // contextCombo.select(0);
            // c.setRelationContext(contextCombo.getItem(0));
            //
            // }
            // contextCombo.addSelectionListener(new SelectionAdapter(){
            // public void widgetSelected(SelectionEvent se){
            // String selection =
            // contextCombo.getItem(contextCombo.getSelectionIndex());
            // c.setRelationContext(selection);
            // try {
            // classCombo.setItems(_mainSearcher
            //            .getFacets("relation", null, selection, null, null)); //$NON-NLS-1$ //$NON-NLS-2$
            // } catch (Exception e1) {
            // e1.printStackTrace();
            // }
            //                  classCombo.add("ALL", 0); //$NON-NLS-1$
            // classCombo.select(0);
            // c.setRelationContext(classCombo.getItem(0));
            //
            // }
            // });
            //
            // if (c.getRelationClass() != null)
            // {
            // classCombo.setText(c.getRelationClass());
            // }
            // else
            // {
            //
            //               classCombo.add("ALL", 0); //$NON-NLS-1$
            // classCombo.select(0);
            // c.setRelationClass(classCombo.getItem(0));
            // }
            //
            //
            // classCombo.addSelectionListener(new SelectionAdapter(){
            // public void widgetSelected(SelectionEvent se){
            // String selection =
            // classCombo.getItem(classCombo.getSelectionIndex());
            // c.setRelationContext(selection);
            //
            // }
            // });
            final Combo contextCombo = new Combo(_searchPRelComp, SWT.READ_ONLY);
            contextCombo.setLayoutData(new GridData());
            contextCombo.setLayoutData(new GridData());
            ((GridData) contextCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) contextCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) contextCombo.getLayoutData()).horizontalSpan = 2;
            final ComboViewer contextComboViewer = new ComboViewer(contextCombo);
            contextComboViewer.setContentProvider(new MarkupContentProvider(false));
            contextComboViewer.setLabelProvider(new MarkupLabelProvider());
            contextComboViewer.setComparator(new ConfigDataComparator());

            final Combo classCombo = new Combo(_searchPRelComp, SWT.READ_ONLY);
            classCombo.setLayoutData(new GridData());
            classCombo.setLayoutData(new GridData());
            ((GridData) classCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) classCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) classCombo.getLayoutData()).horizontalSpan = 2;
            final ComboViewer classComboViewer = new ComboViewer(classCombo);
            classComboViewer.setContentProvider(new MarkupContentProvider(false));
            classComboViewer.setLabelProvider(new MarkupLabelProvider());
            classComboViewer.setComparator(new ConfigDataComparator());
            setComboViewerInput(contextComboViewer, "relation", null, null, null);
            if (c.getRelationContext() != null) {
                setComboViewerByString(contextComboViewer, c.getRelationContext());
                setComboViewerInput(classComboViewer, "relation", c.getRelationContext(), null, null);

            } else {
                contextComboViewer.setSelection(new StructuredSelection(contextComboViewer.getElementAt(0)));
                ConfigData cd = (ConfigData) contextComboViewer.getElementAt(0);
                c.setRelationContext(cd.getValue());

            }
            contextComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    c.setRelationContext(cd.getValue());
                    setComboViewerInput(classComboViewer, "relation", c.getRelationContext(), null, null);
                }
            });

            if (c.getRelationClass() != null) {
                setComboViewerByString(classComboViewer, c.getRelationClass());
            }

            classComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    c.setRelationClass(cd.getValue());
                }
            });

            final Text relObjText = new Text(_searchPRelComp, SWT.BORDER);
            relObjText.setLayoutData(new GridData());
            relObjText.setLayoutData(new GridData());
            ((GridData) relObjText.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) relObjText.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) relObjText.getLayoutData()).horizontalSpan = 3;
            if (c.getRelatedId() != null) {
                relObjText.setText(c.getRelatedId().toString());
            }
            relObjText.setEnabled(false);
            relObjText.addFocusListener(new FocusListener() {

                @Override
                public void focusGained(final FocusEvent e) {
                }

                @Override
                public void focusLost(final FocusEvent e) {

                }

            });

            final Button setObj = new Button(_searchPRelComp, SWT.PUSH);
            setObj.setText(NLMessages.getString("Dialog_set_key"));
            setObj.setEnabled(false);
            setObj.setFont(JFaceResources.getDialogFont());
            setObj.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    //                  System.out.println("setObj"); //$NON-NLS-1$

                }
            });

            final Text searchText = new Text(_searchPRelComp, SWT.BORDER);
            searchText.setLayoutData(new GridData());
            searchText.setLayoutData(new GridData());
            ((GridData) searchText.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) searchText.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) searchText.getLayoutData()).horizontalSpan = 3;
            if (c.getSearchText() != null) {
                searchText.setText(c.getSearchText());
            }
            searchText.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(final FocusEvent e) {
                    c.setSearchText(searchText.getText());
                }
            });
            searchText.addKeyListener(new KeyListener() {
                @Override
                public void keyPressed(final KeyEvent e) {
                    if (e.keyCode == SWT.CR) {
                        c.setSearchText(searchText.getText());
                        searchPersons();
                    }
                }

                @Override
                public void keyReleased(final KeyEvent e) {
                }
            });
            final Button fuzzyB = new Button(_searchPRelComp, SWT.CHECK);
            fuzzyB.setLayoutData(new GridData());
            fuzzyB.setSelection(c.isFuzzy());
            fuzzyB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setFuzzy(!c.isFuzzy());
                }
            });

            final Button includeB = new Button(_searchPRelComp, SWT.CHECK);
            includeB.setLayoutData(new GridData());
            includeB.setSelection(c.isIncludeConcurrences());
            includeB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setIncludeConcurrences(!c.isIncludeConcurrences());
                }
            });

        } // if relation
        if (c.getType().equals("date")) //$NON-NLS-1$
        {
            if (date1) {
                date1 = false;
                _searchPDateComp = new Composite(_personSearchGroup, SWT.NONE);
                _searchPDateComp.setLayout(new GridLayout());
                ((GridLayout) _searchPDateComp.getLayout()).makeColumnsEqualWidth = true;
                ((GridLayout) _searchPDateComp.getLayout()).numColumns = 15;
                _searchPDateComp.setLayoutData(new GridData());
                ((GridData) _searchPDateComp.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) _searchPDateComp.getLayoutData()).grabExcessHorizontalSpace = true;
                // ((GridData) searchPDateComp.getLayoutData()).heightHint =
                // 200;
                ((GridData) _searchPDateComp.getLayoutData()).grabExcessVerticalSpace = false;
                ((GridData) _searchPDateComp.getLayoutData()).horizontalSpan = 1;

                Label l2 = new Label(_searchPDateComp, SWT.NONE);
                l2.setText(NLMessages.getString("Dialog_date"));
                l2.setLayoutData(new GridData());
                ((GridData) l2.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) l2.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) l2.getLayoutData()).horizontalSpan = 2;

                Label typeDate = new Label(_searchPDateComp, SWT.NONE);
                typeDate.setText(NLMessages.getString("Dialog_type"));
                typeDate.setLayoutData(new GridData());
                ((GridData) typeDate.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) typeDate.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) typeDate.getLayoutData()).horizontalSpan = 2;

                Label bl = new Label(_searchPDateComp, SWT.NONE);
                bl.setText(""); //$NON-NLS-1$
                Label notBefore = new Label(_searchPDateComp, SWT.NONE);
                notBefore.setText(NLMessages.getString("Dialog_day"));
                notBefore.setLayoutData(new GridData());
                ((GridData) notBefore.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) notBefore.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) notBefore.getLayoutData()).horizontalSpan = 1;

                Label month = new Label(_searchPDateComp, SWT.NONE);
                month.setText(NLMessages.getString("Dialog_month"));
                month.setLayoutData(new GridData());
                ((GridData) month.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) month.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) month.getLayoutData()).horizontalSpan = 1;

                Label year = new Label(_searchPDateComp, SWT.NONE);
                year.setText(NLMessages.getString("Dialog_year"));
                year.setLayoutData(new GridData());
                ((GridData) year.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) year.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) year.getLayoutData()).horizontalSpan = 2;

                Label bl2 = new Label(_searchPDateComp, SWT.NONE);
                bl2.setText(""); //$NON-NLS-1$

                Label notAfter = new Label(_searchPDateComp, SWT.NONE);
                notAfter.setText(NLMessages.getString("Dialog_day"));
                notAfter.setLayoutData(new GridData());
                ((GridData) notAfter.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) notAfter.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) notAfter.getLayoutData()).horizontalSpan = 1;

                Label month2 = new Label(_searchPDateComp, SWT.NONE);
                month2.setText(NLMessages.getString("Dialog_month"));
                month2.setLayoutData(new GridData());
                ((GridData) month2.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) month2.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) month2.getLayoutData()).horizontalSpan = 1;

                Label year2 = new Label(_searchPDateComp, SWT.NONE);
                year2.setText(NLMessages.getString("Dialog_year"));
                year2.setLayoutData(new GridData());
                ((GridData) year2.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) year2.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) year2.getLayoutData()).horizontalSpan = 2;

                Label include = new Label(_searchPDateComp, SWT.NONE);
                include.setText(""); //$NON-NLS-1$
                include.setToolTipText(NLMessages.getString("Dialog_includeConcurrences"));
                include.setLayoutData(new GridData());
                ((GridData) include.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) include.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) include.getLayoutData()).horizontalSpan = 1;

            }

            if (i == 0) {
                Label l = new Label(_searchPDateComp, SWT.NONE);
                l.setLayoutData(new GridData());
                ((GridData) l.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) l.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) l.getLayoutData()).horizontalSpan = 2;
            } else {
                final Combo opCombo = new Combo(_searchPDateComp, SWT.READ_ONLY);
                opCombo.setLayoutData(new GridData());
                opCombo.add(Operator.AND.toString());
                opCombo.add(Operator.OR.toString());
                opCombo.add(Operator.NOT.toString());
                opCombo.setLayoutData(new GridData());
                ((GridData) opCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) opCombo.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) opCombo.getLayoutData()).horizontalSpan = 2;
                if (c.getOperator() != null) {
                    opCombo.setText(c.getOperator());
                } else {
                    opCombo.select(0);
                    c.setOperator(opCombo.getItem(0));

                }
                opCombo.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent se) {
                        c.setOperator(opCombo.getItem(opCombo.getSelectionIndex()));
                    }
                });
            }

            final Combo typeDCombo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            typeDCombo.setLayoutData(new GridData());
            ComboViewer timeTypeComboViewer = new ComboViewer(typeDCombo);
            timeTypeComboViewer.setContentProvider(ArrayContentProvider.getInstance());
            timeTypeComboViewer.setLabelProvider(new LabelProvider() {

                @Override
                public String getText(final Object element) {
                    String str = (String) element;
                    if (NLMessages.getString("Editor_time_" + str) != null) {
                        return NLMessages.getString("Editor_time_" + str);
                    }
                    return str;
                }

            });
            timeTypeComboViewer.setInput(AEConstants.TIME_TYPES);
            timeTypeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection selection = event.getSelection();
                    Object obj = ((IStructuredSelection) selection).getFirstElement();
                    String s = (String) obj;
                    c.setDateType(s);
                }

            });
            if (c.getDateType() != null) {
                StructuredSelection selection = new StructuredSelection(c.getDateType());
                timeTypeComboViewer.setSelection(selection);
            } else {
                StructuredSelection selection = new StructuredSelection(AEConstants.TIME_TYPES[0]);
                timeTypeComboViewer.setSelection(selection);
                c.setDateType(AEConstants.TIME_TYPES[0]);
            }
            typeDCombo.pack();
            typeDCombo.setLayoutData(new GridData());
            ((GridData) typeDCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) typeDCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) typeDCombo.getLayoutData()).horizontalSpan = 2;

            Label from = new Label(_searchPDateComp, SWT.NONE);
            from.setText(NLMessages.getString("Dialog_from"));
            from.setLayoutData(new GridData());
            ((GridData) from.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) from.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) from.getLayoutData()).horizontalSpan = 1;

            final Combo day1Combo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            day1Combo.setLayoutData(new GridData());
            day1Combo.setItems(AEConstants.DAYS);
            day1Combo.setLayoutData(new GridData());
            ((GridData) day1Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) day1Combo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) day1Combo.getLayoutData()).horizontalSpan = 1;

            if (c.getDateFrom() == null) {
                PdrDate dateFrom = new PdrDate("0000-00-00"); //$NON-NLS-1$
                // dateFrom.setDay(0);
                // dateFrom.setMonth(0);
                // dateFrom.setYear(0);
                c.setDateFrom(dateFrom);
                day1Combo.select(c.getDateFrom().getDay());
            }
            //            System.out.println("test: dateFrom " + c.getDateFrom().toString()); //$NON-NLS-1$
            // else
            // {
            //
            // day1Combo.select(0);
            // c.getDateFrom().setDay(0);
            //
            // }

            day1Combo.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent se) {
                    c.getDateFrom().setDay(day1Combo.getSelectionIndex());
                }
            });

            final Combo month1Combo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            month1Combo.setLayoutData(new GridData());
            month1Combo.setItems(AEConstants.MONTHS);
            month1Combo.setLayoutData(new GridData());
            ((GridData) month1Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) month1Combo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) month1Combo.getLayoutData()).horizontalSpan = 1;
            if (c.getDateFrom() != null) {
                month1Combo.select(c.getDateFrom().getMonth());
            } else {

                month1Combo.select(0);
                c.getDateFrom().setMonth(0);

            }

            month1Combo.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent se) {
                    c.getDateFrom().setMonth(month1Combo.getSelectionIndex());
                }
            });

            final YearSpinner year1Spinner = new YearSpinner(_searchPDateComp, SWT.NULL);
            // year1Spinner.setLayoutData(new GridData());
            // year1Spinner.setLayoutData(new GridData());
            // ((GridData) year1Spinner.getLayoutData()).horizontalAlignment
            // = SWT.FILL;
            // ((GridData)
            // year1Spinner.getLayoutData()).grabExcessHorizontalSpace =
            // true;
            // ((GridData) year1Spinner.getLayoutData()).horizontalSpan = 2;
            // year1Spinner.setMinimum(0);
            // year1Spinner.setMaximum(9999);
            if (c.getDateFrom() != null) {
                year1Spinner.setSelection(c.getDateFrom().getYear());
            } else {

                year1Spinner.setSelection(_preselection);
                c.getDateFrom().setYear(_preselection);

            }
            year1Spinner.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetDefaultSelected(final SelectionEvent e) {
                    c.getDateFrom().setYear(year1Spinner.getSelection());

                }

                @Override
                public void widgetSelected(final SelectionEvent e) {
                    c.getDateFrom().setYear(year1Spinner.getSelection());
                }

            });

            Label to = new Label(_searchPDateComp, SWT.NONE);
            to.setText(NLMessages.getString("Dialog_to"));
            to.setLayoutData(new GridData());
            ((GridData) to.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) to.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) to.getLayoutData()).horizontalSpan = 1;

            final Combo day2Combo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            day2Combo.setLayoutData(new GridData());
            day2Combo.setItems(AEConstants.DAYS);
            day2Combo.setLayoutData(new GridData());
            ((GridData) day2Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) day2Combo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) day2Combo.getLayoutData()).horizontalSpan = 1;
            if (c.getDateTo() == null) {
                PdrDate dateTo = new PdrDate("0000-00-00"); //$NON-NLS-1$
                c.setDateTo(dateTo);
                day2Combo.select(c.getDateTo().getDay());
            }

            day2Combo.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent se) {
                    c.getDateTo().setDay(day2Combo.getSelectionIndex());
                }
            });

            final Combo month2Combo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            month2Combo.setLayoutData(new GridData());
            month2Combo.setItems(AEConstants.MONTHS);
            month2Combo.setLayoutData(new GridData());
            ((GridData) month2Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) month2Combo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) month2Combo.getLayoutData()).horizontalSpan = 1;
            if (c.getDateTo() != null) {
                month2Combo.select(c.getDateTo().getMonth());
            } else {

                month2Combo.select(0);
                c.getDateTo().setMonth(0);

            }

            month2Combo.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent se) {
                    c.getDateTo().setMonth(month2Combo.getSelectionIndex());
                }
            });

            final YearSpinner year2Spinner = new YearSpinner(_searchPDateComp, SWT.NONE);
            year2Spinner.setLayoutData(new GridData());
            year2Spinner.setLayoutData(new GridData());
            ((GridData) year2Spinner.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) year2Spinner.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) year2Spinner.getLayoutData()).horizontalSpan = 1;
            year2Spinner.setMinimum(0);
            year2Spinner.setMaximum(9999);
            if (c.getDateTo() != null) {
                year2Spinner.setSelection(c.getDateTo().getYear());
            } else {

                year2Spinner.setSelection(_preselection);
                c.getDateTo().setYear(_preselection);

            }
            year2Spinner.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetDefaultSelected(final SelectionEvent e) {
                    c.getDateTo().setYear(year2Spinner.getSelection());

                }

                @Override
                public void widgetSelected(final SelectionEvent e) {
                    c.getDateTo().setYear(year2Spinner.getSelection());

                }

            });

            final Button includeB = new Button(_searchPDateComp, SWT.CHECK);
            includeB.setLayoutData(new GridData());
            includeB.setSelection(c.isIncludeConcurrences());
            includeB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setIncludeConcurrences(!c.isIncludeConcurrences());
                }
            });

        } // if date
    }
}

From source file:org.bbaw.pdr.ae.view.control.dialogs.SelectObjectDialog.java

License:Open Source License

/**
 * Builds the reference search./*  w  w  w.  ja  v  a2  s. c  o  m*/
 */
private void buildReferenceSearch() {
    _referenceQuery = new PdrQuery();
    _referenceQuery.setType(2);
    _criteria = new Criteria();
    _criteria.setType("reference"); //$NON-NLS-1$
    _referenceQuery.getCriterias().add(_criteria);

    final Criteria c = _referenceQuery.getCriterias().firstElement();
    Composite searchRefComp = new Composite(_refSearchGroup, SWT.NONE);
    searchRefComp.setLayout(new GridLayout());
    ((GridLayout) searchRefComp.getLayout()).makeColumnsEqualWidth = true;
    ((GridLayout) searchRefComp.getLayout()).numColumns = 10;
    searchRefComp.setLayoutData(new GridData());
    ((GridData) searchRefComp.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) searchRefComp.getLayoutData()).grabExcessHorizontalSpace = true;
    // ((GridData) searchRefComp.getLayoutData()).heightHint = 200;
    ((GridData) searchRefComp.getLayoutData()).grabExcessVerticalSpace = false;
    ((GridData) searchRefComp.getLayoutData()).horizontalSpan = 1;

    Label op = new Label(searchRefComp, SWT.NONE);
    op.setText(NLMessages.getString("Dialog_genre"));
    op.setLayoutData(new GridData());
    ((GridData) op.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) op.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) op.getLayoutData()).horizontalSpan = 2;

    Label tagName = new Label(searchRefComp, SWT.NONE);
    tagName.setText(NLMessages.getString("Dialog_role"));
    tagName.setLayoutData(new GridData());
    ((GridData) tagName.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) tagName.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) tagName.getLayoutData()).horizontalSpan = 2;

    Label tagType = new Label(searchRefComp, SWT.NONE);
    tagType.setText(NLMessages.getString("Dialog_name"));
    tagType.setLayoutData(new GridData());
    ((GridData) tagType.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) tagType.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) tagType.getLayoutData()).horizontalSpan = 5;

    Label fuzzy = new Label(searchRefComp, SWT.NONE);
    fuzzy.setText(NLMessages.getString("Dialog_fuzzy"));
    fuzzy.setLayoutData(new GridData());
    ((GridData) fuzzy.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) fuzzy.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) fuzzy.getLayoutData()).horizontalSpan = 1;

    final Combo genreCombo = new Combo(searchRefComp, SWT.READ_ONLY);
    genreCombo.setLayoutData(new GridData());
    ComboViewer genreComboViewer = new ComboViewer(genreCombo);
    genreComboViewer.setContentProvider(new RefTemplateContentProvider(false));
    genreComboViewer.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(final Object element) {
            ReferenceModsTemplate template = (ReferenceModsTemplate) element;
            return template.getLabel();
        }

    });

    genreComboViewer.setInput(_facade.getAllGenres());
    genreComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            Object obj = ((IStructuredSelection) selection).getFirstElement();
            ReferenceModsTemplate template = (ReferenceModsTemplate) obj;
            if (template != null) {
                c.setCrit0(template.getValue());
            }
        }

    });
    genreCombo.add("ALL", 0); //$NON-NLS-1$

    genreCombo.setLayoutData(new GridData());
    ((GridData) genreCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) genreCombo.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) genreCombo.getLayoutData()).horizontalSpan = 2;
    if (c.getCrit0() != null) {
        StructuredSelection selection = new StructuredSelection(c.getCrit0());
        genreComboViewer.setSelection(selection);
    } else {
        genreCombo.select(0);
        c.setCrit0(genreCombo.getItem(0));

    }

    final Combo roleCombo = new Combo(searchRefComp, SWT.READ_ONLY);
    roleCombo.setLayoutData(new GridData());
    roleCombo.setLayoutData(new GridData());
    ((GridData) roleCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) roleCombo.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) roleCombo.getLayoutData()).horizontalSpan = 2;
    ComboViewer comboViewer = new ComboViewer(roleCombo);
    comboViewer.setContentProvider(ArrayContentProvider.getInstance());
    comboViewer.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(final Object element) {
            String str = (String) element;
            if (str.equals("ALL")) {
                return str;
            }
            return NLMessages.getString("Editor_role_" + str);
        }
    });

    String[] input = new String[AEConstants.REF_ROLETERM_CODE.length + 1];
    System.arraycopy(new String[] { "ALL" }, 0, input, 0, 1);
    System.arraycopy(AEConstants.REF_ROLETERM_CODE, 0, input, 1, AEConstants.REF_ROLETERM_CODE.length);
    comboViewer.setInput(input);
    comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            Object obj = ((IStructuredSelection) selection).getFirstElement();
            String s = (String) obj;
            c.setCrit1(s);
        }

    });

    //      roleCombo.add("ALL", 0); //$NON-NLS-1$

    // if (c.getCrit1() != null)
    // {
    // roleCombo.setText(c.getCrit1());
    // }
    // else
    // {
    // roleCombo.select(0);
    // c.setCrit1(roleCombo.getItem(0));
    //
    //
    // }
    // roleCombo.addSelectionListener(new SelectionAdapter(){
    // public void widgetSelected(SelectionEvent se)
    // {
    // // if (!(semCombo.getSelectionIndex() > semCombo.getItems().length))
    // // {
    // c.setCrit1(roleCombo.getItem(roleCombo.getSelectionIndex()));
    // // }
    // }
    // });

    final Text nameText = new Text(searchRefComp, SWT.BORDER);
    nameText.setLayoutData(new GridData());
    nameText.setLayoutData(new GridData());
    ((GridData) nameText.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) nameText.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) nameText.getLayoutData()).horizontalSpan = 5;
    if (c.getCrit3() != null) {
        nameText.setText(c.getCrit3());
    }
    nameText.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(final FocusEvent e) {
            String[] vals = new String[] {};
            try {
                vals = _mainSearcher.getFacets("reference", "namePart", null, null, null);
            } catch (Exception e1) {
                e1.printStackTrace();
            }
            new AutoCompleteField(nameText, new TextContentAdapter(), vals);

        }

        @Override
        public void focusLost(final FocusEvent e) {
            c.setCrit3(nameText.getText());
        }
    });
    nameText.addKeyListener(new KeyListener() {
        @Override
        public void keyPressed(final KeyEvent e) {
            if (e.keyCode == SWT.CR) {
                c.setCrit3(nameText.getText());
                searchReferences();
            }
        }

        @Override
        public void keyReleased(final KeyEvent e) {
        }
    });
    final Button fuzzyB = new Button(searchRefComp, SWT.CHECK);
    fuzzyB.setLayoutData(new GridData());
    fuzzyB.setSelection(c.isFuzzy());
    fuzzyB.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            c.setFuzzy(!c.isFuzzy());
        }
    });

    Label title = new Label(searchRefComp, SWT.NONE);
    title.setText(NLMessages.getString("Dialog_refTitle"));
    title.setLayoutData(new GridData());
    ((GridData) title.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) title.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) title.getLayoutData()).horizontalSpan = 2;

    final Text searchText2 = new Text(searchRefComp, SWT.BORDER);
    searchText2.setLayoutData(new GridData());
    searchText2.setLayoutData(new GridData());
    ((GridData) searchText2.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) searchText2.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) searchText2.getLayoutData()).horizontalSpan = 8;
    if (c.getCrit4() != null) {
        searchText2.setText(c.getCrit4());
    }
    searchText2.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(final FocusEvent e) {
            String[] vals = new String[] {};
            try {
                vals = _mainSearcher.getFacets("reference", "title", null, null, null);
            } catch (Exception e1) {
                e1.printStackTrace();
            }
            new AutoCompleteField(searchText2, new TextContentAdapter(), vals);

        }

        @Override
        public void focusLost(final FocusEvent e) {
            c.setCrit4(searchText2.getText());
        }
    });
    searchText2.addKeyListener(new KeyListener() {
        @Override
        public void keyPressed(final KeyEvent e) {
            if (e.keyCode == SWT.CR) {
                c.setCrit4(searchText2.getText());
                searchReferences();
            }
        }

        @Override
        public void keyReleased(final KeyEvent e) {
        }
    });
    Label searchText = new Label(searchRefComp, SWT.NONE);
    searchText.setText(NLMessages.getString("Dialog_freeSearch"));
    searchText.setLayoutData(new GridData());
    ((GridData) searchText.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) searchText.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) searchText.getLayoutData()).horizontalSpan = 2;

    final Text searchText3 = new Text(searchRefComp, SWT.BORDER);
    searchText3.setLayoutData(new GridData());
    searchText3.setLayoutData(new GridData());
    ((GridData) searchText3.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) searchText3.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) searchText3.getLayoutData()).horizontalSpan = 8;
    if (c.getSearchText() != null) {
        searchText3.setText(c.getSearchText());
    }
    searchText3.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(final FocusEvent e) {
            c.setSearchText(searchText3.getText());
        }
    });
    searchText3.addKeyListener(new KeyListener() {
        @Override
        public void keyPressed(final KeyEvent e) {
            if (e.keyCode == SWT.CR) {
                c.setSearchText(searchText3.getText());
                searchReferences();
            }
        }

        @Override
        public void keyReleased(final KeyEvent e) {
        }
    });

}

From source file:org.bbaw.pdr.ae.view.control.templates.aspectsemantic.controller.config.MarkupTemplateConfigEditor.java

License:Open Source License

private Composite createComplexSemanticTemplateEditor(Composite composite,
        final ComplexSemanticTemplate complexTemplate) {
    composite.setLayoutData(new GridData());
    ((GridData) composite.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) composite.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) composite.getLayoutData()).grabExcessVerticalSpace = true;
    ((GridData) composite.getLayoutData()).verticalAlignment = SWT.FILL;
    composite.setLayout(new GridLayout());
    ((GridLayout) composite.getLayout()).numColumns = 4;
    ((GridLayout) composite.getLayout()).makeColumnsEqualWidth = false;

    Label title = new Label(composite, SWT.NONE);
    title.setText(NLMessages.getString("Config_Complex_Semantic_Template_Editor"));
    title.setLayoutData(new GridData());
    ((GridData) title.getLayoutData()).horizontalSpan = 4;
    ((GridData) title.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) title.getLayoutData()).horizontalAlignment = SWT.FILL;

    Label label = new Label(composite, SWT.NONE);
    label.setText(NLMessages.getString("Config_label"));
    label.setLayoutData(new GridData());
    ((GridData) label.getLayoutData()).horizontalSpan = 1;
    ((GridData) label.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) label.getLayoutData()).horizontalAlignment = SWT.FILL;

    _labelText = new Text(composite, SWT.BORDER);
    _labelText.setEditable(_userRichtsChecker.mayEditConfig());
    _labelText.setLayoutData(new GridData());
    ((GridData) _labelText.getLayoutData()).horizontalSpan = 3;
    ((GridData) _labelText.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) _labelText.getLayoutData()).horizontalAlignment = SWT.FILL;
    if (complexTemplate.getLabel() != null) {
        _labelText.setText(complexTemplate.getLabel());
    } else {//www  . j  a  v  a  2s.  c o  m
        _labelText.setText(complexTemplate.getValue());
    }
    _labelText.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(final FocusEvent e) {
            complexTemplate.setLabel(_labelText.getText().trim());
            // if (c instanceof ConfigItem)
            // {
            // ((ConfigItem) c).setLabel(labelText.getText().trim());
            // }
        }
    });
    _labelText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            IStructuredSelection selection = (IStructuredSelection) _treeViewer.getSelection();
            Object obj = selection.getFirstElement();
            ConfigTreeNode tn = (ConfigTreeNode) obj;
            complexTemplate.setLabel(_labelText.getText().trim());
            tn.setLabel(complexTemplate.getLabel());
            _treeViewer.update(tn, null);

        }
    });

    Label ignoreLabel = new Label(composite, SWT.NONE);
    ignoreLabel.setText(NLMessages.getString("Config_ignore"));
    ignoreLabel.setLayoutData(new GridData());
    ((GridData) ignoreLabel.getLayoutData()).horizontalSpan = 2;
    ((GridData) ignoreLabel.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) ignoreLabel.getLayoutData()).horizontalAlignment = SWT.FILL;
    ignoreLabel.pack();

    final Button ignoreButton = new Button(composite, SWT.CHECK);
    ignoreButton.setLayoutData(new GridData());
    ignoreButton.setEnabled(_userRichtsChecker.maySetConfigIgnored());
    ((GridData) ignoreButton.getLayoutData()).horizontalSpan = 2;
    ignoreButton.setSelection(complexTemplate.isIgnore());

    ignoreButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent se) {
            complexTemplate.setIgnore(ignoreButton.getSelection());
            Object[] objects = _treeViewer.getExpandedElements();
            Object input = _treeViewer.getInput();
            _treeViewer.setInput(input);
            for (Object o : objects) {
                _treeViewer.setExpandedState(o, true);
            }

        }
    }); // SelectionListener
    Label base = new Label(composite, SWT.NONE);
    base.setText(NLMessages.getString("Config_priority"));
    base.setLayoutData(new GridData());
    ((GridData) base.getLayoutData()).horizontalSpan = 2;
    ((GridData) base.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) base.getLayoutData()).horizontalAlignment = SWT.FILL;
    base.pack();

    _baseSpinner = new Spinner(composite, SWT.NONE);
    _baseSpinner.setLayoutData(new GridData());
    _baseSpinner.setEnabled(_userRichtsChecker.mayEditConfig());
    ((GridData) _baseSpinner.getLayoutData()).horizontalSpan = 2;
    ((GridData) _baseSpinner.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) _baseSpinner.getLayoutData()).horizontalAlignment = SWT.FILL;

    _baseSpinner.setMinimum(0);
    _baseSpinner.setMaximum(999);

    _baseSpinner.setSelection(complexTemplate.getPriority());
    _baseSpinner.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent se) {

            complexTemplate.setPriority(_baseSpinner.getSelection());

        }
    }); // SelectionListener
    Label l = new Label(composite, SWT.NONE);
    l.setText(NLMessages.getString("Config_new_Semantic_Template"));
    l.setLayoutData(new GridData());

    Combo semanticTemplatCombo = new Combo(composite, SWT.READ_ONLY);
    semanticTemplatCombo.setEnabled(_userRichtsChecker.mayEditConfig());
    semanticTemplatCombo.setLayoutData(new GridData());
    ((GridData) semanticTemplatCombo.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) semanticTemplatCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) semanticTemplatCombo.getLayoutData()).horizontalSpan = 2;

    final ComboViewer semanticTemplatComboViewer = new ComboViewer(semanticTemplatCombo);
    semanticTemplatComboViewer.setContentProvider(new MarkupContentProvider());
    semanticTemplatComboViewer.setLabelProvider(new MarkupLabelProvider());

    semanticTemplatComboViewer
            .setInput(_facade.getConfigs().get(_provider).getChildren().get("aodl:semanticStm").getChildren());
    semanticTemplatComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            ISelection iSelection = event.getSelection();
            Object obj = ((IStructuredSelection) iSelection).getFirstElement();
            IAEPresentable cp = (IAEPresentable) obj;
            if (cp != null) {
                String name = cp.getValue().trim();
                if (name.length() > 0) {
                    if (complexTemplate.getChildren() != null
                            && complexTemplate.getChildren().containsKey(name)) {
                        _addMarkupTemplate.setEnabled(false);
                        // setMessage("Warning. A Markup Element with the same name exists already!");
                    } else {
                        _addMarkupTemplate.setEnabled(_userRichtsChecker.mayEditConfig());
                    }
                } else {
                    _addMarkupTemplate.setEnabled(false);
                }
            }

        }

    });

    _addMarkupTemplate = new Button(composite, SWT.PUSH | SWT.END);
    _addMarkupTemplate.setEnabled(false);
    _addMarkupTemplate.setText(NLMessages.getString("Config_add"));
    _addMarkupTemplate.setLayoutData(new GridData());
    ((GridData) _addMarkupTemplate.getLayoutData()).verticalAlignment = SWT.FILL;
    _addMarkupTemplate.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            ISelection iSelection = semanticTemplatComboViewer.getSelection();
            Object obj = ((IStructuredSelection) iSelection).getFirstElement();
            IAEPresentable cp = (IAEPresentable) obj;
            if (cp != null) {
                String value = cp.getValue().trim();

                SemanticTemplate semanticTemplate = new SemanticTemplate(value);
                semanticTemplate.setLabel(cp.getLabel());
                semanticTemplate.setParent(complexTemplate);

                String val = NLMessages.getString("Dialog_reference");
                AspectConfigTemplate configTemplate = new AspectConfigTemplate(val);
                configTemplate.setParent(semanticTemplate);
                configTemplate.setPriority(25);
                configTemplate.setHorizontalSpan(4);
                configTemplate.setRequired(true);
                configTemplate.setWidgetType(7);
                semanticTemplate.getChildren().put(val, configTemplate);

                complexTemplate.getChildren().put(value, semanticTemplate);
                semanticTemplate.setPriority(complexTemplate.getChildren().size());
                Object[] objects = _treeViewer.getExpandedElements();
                Object input = _treeViewer.getInput();

                ISelection iSel = _treeViewer.getSelection();
                Object selObj = ((IStructuredSelection) iSel).getFirstElement();
                _treeViewer.setInput(input);
                for (Object o : objects) {
                    _treeViewer.setExpandedState(o, true);
                }
                _treeViewer.setExpandedState(selObj, true);
            }
        }
    });
    Label langLabel = new Label(composite, SWT.NONE);
    langLabel.setText(NLMessages.getString("Config_language"));
    langLabel.setLayoutData(new GridData());
    ((GridData) langLabel.getLayoutData()).horizontalSpan = 1;

    final Combo langCombo = new Combo(composite, SWT.NONE | SWT.READ_ONLY);
    langCombo.setLayoutData(new GridData());
    ((GridData) langCombo.getLayoutData()).horizontalSpan = 1;
    ((GridData) langCombo.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) langCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
    langCombo.setItems(_langs);

    Label docu = new Label(composite, SWT.NONE);
    docu.setText(NLMessages.getString("Config_documentation"));
    docu.setLayoutData(new GridData());
    ((GridData) docu.getLayoutData()).horizontalSpan = 2;

    final Text docuText = new Text(composite, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    docuText.setLayoutData(new GridData());
    docuText.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    ((GridData) docuText.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) docuText.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) docuText.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) docuText.getLayoutData()).grabExcessVerticalSpace = true;

    if (complexTemplate.getDocumentation() != null
            && complexTemplate.getDocumentation().containsKey(_systemLang)) {
        _lang = _systemLang;
        langCombo.select(langCombo.indexOf((_systemLang)));
        docuText.setText(complexTemplate.getDocumentation().get((_systemLang)));

    } else if (complexTemplate.getDocumentation() != null
            && complexTemplate.getDocumentation().get("de") != null) //$NON-NLS-1$
    {
        _lang = "de"; //$NON-NLS-1$
        langCombo.select(langCombo.indexOf((_lang)));
        docuText.setText(complexTemplate.getDocumentation().get((_lang)));

    } else if (complexTemplate.getDocumentation() != null
            && complexTemplate.getDocumentation().get("en") != null) //$NON-NLS-1$
    {
        _lang = "en"; //$NON-NLS-1$

        langCombo.select(langCombo.indexOf((_lang)));
        docuText.setText(complexTemplate.getDocumentation().get((_lang)));

    } else if (complexTemplate.getDocumentation() != null
            && complexTemplate.getDocumentation().get("it") != null) //$NON-NLS-1$
    {
        _lang = "it"; //$NON-NLS-1$

        langCombo.select(langCombo.indexOf((_lang)));
        docuText.setText(complexTemplate.getDocumentation().get((_lang)));

    } else if (complexTemplate.getDocumentation() != null
            && complexTemplate.getDocumentation().get("fr") != null) //$NON-NLS-1$
    {
        _lang = "fr"; //$NON-NLS-1$

        langCombo.select(langCombo.indexOf((_lang)));
        docuText.setText(complexTemplate.getDocumentation().get((_lang)));

    } else {
        langCombo.select(langCombo.indexOf((_systemLang)));
        _lang = _systemLang;
    }

    langCombo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent se) {

            _lang = langCombo.getItem(langCombo.getSelectionIndex());
            if (complexTemplate.getDocumentation() != null
                    && complexTemplate.getDocumentation().containsKey(_lang)) {
                docuText.setText(complexTemplate.getDocumentation().get((_lang)));
            } else {
                docuText.setText(""); //$NON-NLS-1$
            }

        }
    }); // SelectionListener
    if (complexTemplate.getDocumentation() != null && complexTemplate.getDocumentation().containsKey("de")) //$NON-NLS-1$
    {
        docuText.setText(complexTemplate.getDocumentation().get(("de"))); //$NON-NLS-1$
    } else {
        docuText.setText(""); //$NON-NLS-1$
    }
    docuText.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(final FocusEvent e) {
            complexTemplate.getDocumentation().put(_lang, docuText.getText());
        }
    });
    ((GridData) docuText.getLayoutData()).horizontalSpan = 4;
    ((GridData) docuText.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) docuText.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) docuText.getLayoutData()).minimumHeight = 60;

    final Button previewButton = new Button(composite, SWT.PUSH);
    previewButton.setText(NLMessages.getString("Config_Preview"));
    previewButton.setLayoutData(new GridData());
    ((GridData) previewButton.getLayoutData()).horizontalSpan = 2;
    ((GridData) previewButton.getLayoutData()).verticalAlignment = SWT.FILL;

    previewButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent se) {
            IWorkbench workbench = PlatformUI.getWorkbench();
            Display display = workbench.getDisplay();
            Shell shell = new Shell(display);
            AspectTemplatePreviewDialog dialog = new AspectTemplatePreviewDialog(shell, complexTemplate);
            dialog.open();

        }
    }); // SelectionListener

    _deleteFromList = new Button(composite, SWT.PUSH | SWT.END);
    _deleteFromList.setText(NLMessages.getString("Config_delete_entry"));
    _deleteFromList.setToolTipText(NLMessages.getString("Config_delete_entry_tooltip"));
    _deleteFromList.setLayoutData(new GridData());
    // deleteFromList.setEnabled(false);

    if (_userRichtsChecker.mayEditConfig()) {
        _deleteFromList.setEnabled(true);
    } else {
        _deleteFromList.setEnabled(false);
    }

    // ((GridData) editListGroup.getLayoutData()).END ;
    // ((GridData) loadRelationList.getLayoutData()).verticalAlignment =
    // SWT.FILL;
    _deleteFromList.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            delete(complexTemplate);
        }

    });
    composite.layout();
    return composite;
}

From source file:org.bbaw.pdr.ae.view.control.templates.aspectsemantic.controller.config.MarkupTemplateConfigEditor.java

License:Open Source License

private void loadIndividualSettings(final AspectConfigTemplate aspectConfigTemplate, Composite composite) {
    _prevWidget = null;// www  .  j ava  2s.  c o m
    for (Control c : composite.getChildren()) {
        c.dispose();
    }
    boolean pathB = false;
    boolean combo = false;
    boolean date = false;
    boolean levelSpanB = false;
    boolean relation = false;
    boolean preSuffix = false;
    boolean horizontalSpan = false;

    switch (aspectConfigTemplate.getWidgetType()) {
    case 0: //text
        pathB = true;
        combo = false;
        date = false;
        levelSpanB = false;
        relation = false;
        preSuffix = true;
        horizontalSpan = true;
        break;
    case 1: //combo
        pathB = false;
        combo = true;
        date = false;
        levelSpanB = true;
        relation = false;
        preSuffix = true;
        horizontalSpan = true;
        break;
    case 2: //date
        pathB = true;
        combo = false;
        date = true;
        levelSpanB = false;
        relation = false;
        preSuffix = true;
        horizontalSpan = false;
        break;
    case 3: // date_combo
        pathB = false;
        combo = true;
        date = true;
        levelSpanB = true;
        relation = false;
        preSuffix = true;
        horizontalSpan = false;
        break;
    case 4: // relation
        pathB = false;
        combo = false;
        date = false;
        levelSpanB = false;
        relation = false;
        preSuffix = false;
        horizontalSpan = false;
        break;
    case 5: // relation_defined
        pathB = false;
        combo = false;
        date = false;
        levelSpanB = false;
        relation = true;
        preSuffix = false;
        horizontalSpan = true;
        break;
    case 6: // timeStm
        pathB = false;
        combo = false;
        date = true;
        levelSpanB = false;
        relation = false;
        preSuffix = false;
        horizontalSpan = false;
        break;
    case 7: // reference
        pathB = false;
        combo = false;
        date = false;
        levelSpanB = false;
        relation = false;
        preSuffix = false;
        horizontalSpan = false;
        break;
    default:
        break;
    }
    final boolean pathCombo = combo;

    // path
    SelectionListener aspectFacetListener = new SelectionAdapter() {
        @Override
        public void widgetDefaultSelected(final SelectionEvent e) {
        }

        @Override
        public void widgetSelected(final SelectionEvent e) {
            final String type = (String) ((Button) e.getSource()).getData();
            aspectConfigTemplate.setPos(type);
            //                 System.out.println("aspectFacetQuery key set to " + type); //$NON-NLS-1$
            if (type.equals("type")) //$NON-NLS-1$
            {
                aspectConfigTemplate.setType(null);
            } else if (type.equals("subtype")) //$NON-NLS-1$
            {
                aspectConfigTemplate.setSubtype(null);
                aspectConfigTemplate.setRole(null);
            } else if (type.equals("role")) //$NON-NLS-1$
            {
                aspectConfigTemplate.setRole(null);

            }

        }
    };
    if (pathB || pathCombo) {
        Label path = new Label(composite, SWT.RIGHT);
        path.setText(NLMessages.getString("Config_Path"));
        path.setLayoutData(new GridData());
        ((GridData) path.getLayoutData()).horizontalSpan = 4;

        Label taggingElement = new Label(composite, SWT.NONE);
        taggingElement.setText(NLMessages.getString("Editor_markup_element") + "*");
        taggingElement.setLayoutData(new GridData());

        Combo comboTaggingElement = new Combo(composite, SWT.READ_ONLY | SWT.RIGHT);
        comboTaggingElement.setBackground(WHITE_COLOR);
        comboTaggingElement.setLayoutData(new GridData());
        ((GridData) comboTaggingElement.getLayoutData()).horizontalSpan = 3;
        ((GridData) comboTaggingElement.getLayoutData()).horizontalAlignment = SWT.FILL;
        ((GridData) comboTaggingElement.getLayoutData()).grabExcessHorizontalSpace = true;

        ComboViewer comboTaggingElementViewer = new ComboViewer(comboTaggingElement);
        comboTaggingElementViewer.setContentProvider(new MarkupContentProvider());
        comboTaggingElementViewer.setLabelProvider(new MarkupLabelProvider());
        if (_facade.getConfigs().containsKey(_provider)) {
            // TODO comboTaggingElementViewer
            //         comboTaggingElementViewer.setInput(
            //                     _facade.getConfigs().get(_provider).getChildren());
            comboTaggingElementViewer.setInput(getMarkupsOnLevel(aspectConfigTemplate, 0));
        }

        final ControlDecoration elementDeco = new ControlDecoration(comboTaggingElement, SWT.RIGHT | SWT.TOP);
        elementDeco.setDescriptionText(PDRConfigProvider.readDocu(_provider, "markup", "element",
                aspectConfigTemplate.getElement(), null, null, null));
        if (elementDeco.getDescriptionText() != null) {
            elementDeco.setImage(FieldDecorationRegistry.getDefault()
                    .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
        } else {
            elementDeco.setImage(null);
        }

        Label taggingType = new Label(composite, SWT.NONE);
        taggingType.setText(NLMessages.getString("Editor_type") + "*");
        taggingType.setLayoutData(new GridData());

        final Combo comboTaggingType = new Combo(composite, SWT.READ_ONLY | SWT.RIGHT);
        comboTaggingType.setBackground(WHITE_COLOR);
        comboTaggingType.setLayoutData(new GridData());
        ((GridData) comboTaggingType.getLayoutData()).horizontalAlignment = GridData.FILL;
        ((GridData) comboTaggingType.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) comboTaggingType.getLayoutData()).horizontalSpan = 3;

        final ComboViewer comboTaggingTypeViewer = new ComboViewer(comboTaggingType);
        comboTaggingTypeViewer.setContentProvider(new MarkupContentProvider());
        comboTaggingTypeViewer.setLabelProvider(new MarkupLabelProvider());
        // comboTaggingType.setItems(readConfigs(_markupProvider, "markup",
        // "type", eListName, null, null));
        final ControlDecoration typeDeco = new ControlDecoration(comboTaggingType, SWT.RIGHT | SWT.TOP);

        if (aspectConfigTemplate.getElement() != null) {
            if (aspectConfigTemplate.getElement().startsWith("aodl:")) {
                aspectConfigTemplate.setElement(aspectConfigTemplate.getElement().substring(5));
            }
            if (_facade.getConfigs().get(_provider).getChildren()
                    .containsKey(aspectConfigTemplate.getElement())) {
                if (pathCombo) {
                    //                  comboTaggingTypeViewer.setInput(
                    //                              
                    //                              _facade.getConfigs().get(_provider).getChildren()
                    //                                 .get("aodl:" + aspectConfigTemplate.getElement()).getChildren());
                    // TODO comboTaggingTypeViewer
                    comboTaggingTypeViewer.setInput(getMarkupsOnLevel(aspectConfigTemplate, 1));
                    ConfigItem ci = new ConfigItem();
                    ci.setLabel("COMBO Selection");
                    ci.setValue("COMBO Selection");
                    ViewHelper.comboViewerInsertElement(comboTaggingTypeViewer, ci, 0);
                } else {
                    //                  comboTaggingTypeViewer.setInput(_facade.getConfigs().get(_provider).getChildren()
                    //                        .get("aodl:" + aspectConfigTemplate.getElement()).getChildren());
                    // TODO: comboTaggingTypeViewer
                    comboTaggingTypeViewer.setInput(getMarkupsOnLevel(aspectConfigTemplate, 1));
                }
            }
        }

        Label taggingSubtype = new Label(composite, SWT.NONE);
        taggingSubtype.setText(NLMessages.getString("Editor_subtype"));
        taggingSubtype.setLayoutData(new GridData());

        final Combo comboTaggingSubtype = new Combo(composite, SWT.READ_ONLY | SWT.RIGHT);
        comboTaggingSubtype.setBackground(WHITE_COLOR);
        comboTaggingSubtype.setLayoutData(new GridData());
        ((GridData) comboTaggingSubtype.getLayoutData()).horizontalAlignment = GridData.FILL;
        ((GridData) comboTaggingSubtype.getLayoutData()).grabExcessHorizontalSpace = true;
        comboTaggingSubtype.setEnabled(false);
        final ComboViewer comboTaggingSubtypeViewer = new ComboViewer(comboTaggingSubtype);
        comboTaggingSubtypeViewer.setContentProvider(new MarkupContentProvider());
        comboTaggingSubtypeViewer.setLabelProvider(new MarkupLabelProvider());
        final ControlDecoration subtypeDeco = new ControlDecoration(comboTaggingSubtype, SWT.RIGHT | SWT.TOP);

        ((GridData) comboTaggingSubtype.getLayoutData()).horizontalSpan = 3;

        Label taggingRole = new Label(composite, SWT.NONE);
        taggingRole.setText(NLMessages.getString("Editor_role"));
        taggingRole.setLayoutData(new GridData());

        final Combo comboTaggingRole = new Combo(composite, SWT.READ_ONLY | SWT.RIGHT);
        comboTaggingRole.setBackground(WHITE_COLOR);
        comboTaggingRole.setLayoutData(new GridData());
        ((GridData) comboTaggingRole.getLayoutData()).horizontalAlignment = GridData.FILL;
        ((GridData) comboTaggingRole.getLayoutData()).grabExcessHorizontalSpace = true;
        final ComboViewer comboTaggingRoleViewer = new ComboViewer(comboTaggingRole);
        comboTaggingRoleViewer.setContentProvider(new MarkupContentProvider());
        comboTaggingRoleViewer.setLabelProvider(new MarkupLabelProvider());
        comboTaggingRole.setEnabled(false);
        final ControlDecoration roleDeco = new ControlDecoration(comboTaggingRole, SWT.RIGHT | SWT.TOP);

        ((GridData) comboTaggingRole.getLayoutData()).horizontalSpan = 3;

        _loading = true;

        comboTaggingElementViewer.addSelectionChangedListener(new ISelectionChangedListener() {

            @Override
            public void selectionChanged(final SelectionChangedEvent event) {
                ISelection iSelection = event.getSelection();
                Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                ConfigData cd = (ConfigData) obj;
                if (cd.getValue().startsWith("aodl:")) {
                    aspectConfigTemplate.setElement(cd.getValue().substring(5));
                } else {
                    aspectConfigTemplate.setElement(cd.getValue());
                }
                comboTaggingSubtype.removeAll();
                comboTaggingSubtype.setEnabled(false);
                if (!_loading) {
                    comboTaggingType.removeAll();
                    aspectConfigTemplate.setType(""); //$NON-NLS-1$
                    aspectConfigTemplate.setSubtype(""); //$NON-NLS-1$
                    aspectConfigTemplate.setRole(""); //$NON-NLS-1$
                }
                comboTaggingRole.removeAll();
                comboTaggingRole.setEnabled(false);

                elementDeco.setDescriptionText(PDRConfigProvider.readDocu(_provider, "markup", "element",
                        aspectConfigTemplate.getElement(), null, null, null));
                if (elementDeco.getDescriptionText() != null
                        && elementDeco.getDescriptionText().trim().length() > 0) {
                    elementDeco.setImage(FieldDecorationRegistry.getDefault()
                            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
                } else {
                    elementDeco.setImage(null);
                }
                typeDeco.setImage(null);
                typeDeco.setDescriptionText(null);
                subtypeDeco.setImage(null);
                subtypeDeco.setDescriptionText(null);
                roleDeco.setImage(null);
                roleDeco.setDescriptionText(null);
                if (_facade.getConfigs().containsKey(_provider)) {
                    //               HashMap<String,ConfigData> children = 
                    //                  _facade.getConfigs().get(_provider).getChildren()
                    //                        .get("aodl:" + aspectConfigTemplate.getElement()).getChildren();

                    // TODO: comboTaggingTypeViewer
                    comboTaggingTypeViewer.setInput(getMarkupsOnLevel(aspectConfigTemplate, 1));
                    if (pathCombo) {
                        ConfigItem ci = new ConfigItem();
                        ci.setLabel("COMBO Selection");
                        ci.setValue("COMBO Selection");
                        ViewHelper.comboViewerInsertElement(comboTaggingTypeViewer, ci, 0);
                        if (!_loading) {
                            comboTaggingTypeViewer.setSelection(new StructuredSelection(ci));
                            aspectConfigTemplate.setPos("type");
                        }
                    } else if (!_loading) {
                        comboTaggingTypeViewer
                                .setSelection(new StructuredSelection(comboTaggingTypeViewer.getElementAt(0)));
                    }
                }
                comboTaggingTypeViewer.refresh();
                // comboTaggingType.setItems(readConfigs(_markupProvider,
                // "markup", "type", eListName, null, null));
            }

        });

        comboTaggingTypeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

            @Override
            public void selectionChanged(final SelectionChangedEvent event) {
                ISelection iSelection = event.getSelection();
                Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                ConfigData cd = (ConfigData) obj;
                comboTaggingSubtype.removeAll();
                comboTaggingRole.removeAll();
                comboTaggingRole.setEnabled(false);
                if (!_loading) {
                    aspectConfigTemplate.setSubtype(""); //$NON-NLS-1$
                    aspectConfigTemplate.setRole(""); //$NON-NLS-1$
                }
                if (cd != null) {
                    if (cd.getValue().equals("COMBO Selection")) {
                        comboTaggingRole.setEnabled(false);
                        comboTaggingSubtype.setEnabled(false);
                        aspectConfigTemplate.setType(null);
                        aspectConfigTemplate.setSubtype(null);
                        aspectConfigTemplate.setRole(null);
                        aspectConfigTemplate.setPos("type");
                    } else {
                        aspectConfigTemplate.setType(cd.getValue());
                        //                  ConfigData input = null;
                        //                  if (_facade.getConfigs().containsKey(_provider))
                        //                  {
                        //                     input = _facade.getConfigs().get(_provider).getChildren()
                        //                           .get("aodl:" + aspectConfigTemplate.getElement()).getChildren()
                        //                           .get(aspectConfigTemplate.getType());
                        //                  }
                        //                  if (input != null)
                        if (ifMarkupsOnLevel(aspectConfigTemplate, 1)) {
                            //HashMap<String, ConfigData> children = input.getChildren();
                            // TODO comboTaggingSubtypeViewer
                            HashMap<String, ConfigData> children = getMarkupsOnLevel(aspectConfigTemplate, 2);
                            comboTaggingSubtypeViewer.setInput(children);

                            if (pathCombo && !_loading) {
                                ConfigItem ci = new ConfigItem();
                                ci.setLabel("COMBO Selection");
                                ci.setValue("COMBO Selection");
                                ViewHelper.comboViewerInsertElement(comboTaggingSubtypeViewer, ci, 0);
                                if (!_loading) {
                                    comboTaggingSubtypeViewer.setSelection(new StructuredSelection(ci));
                                    aspectConfigTemplate.setPos("subtype");
                                }
                            }
                            comboTaggingSubtype.setEnabled(true);
                        }
                        typeDeco.setDescriptionText(PDRConfigProvider.readDocu(_provider, "markup", "type",
                                aspectConfigTemplate.getElement(), aspectConfigTemplate.getType(), null, null));
                        if (typeDeco.getDescriptionText() != null
                                && typeDeco.getDescriptionText().trim().length() > 0) {
                            typeDeco.setImage(FieldDecorationRegistry.getDefault()
                                    .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
                        } else {
                            typeDeco.setImage(null);
                        }
                    }

                }

                subtypeDeco.setImage(null);
                subtypeDeco.setDescriptionText(null);
                roleDeco.setImage(null);
                roleDeco.setDescriptionText(null);
                processMarkupComboSettings(aspectConfigTemplate);
                updatePreviewWidget(aspectConfigTemplate);
            }

        });

        // Label blancType = new Label(tagging1Coposite, SWT.NONE);
        // blancType.setText("");
        // blancType.setLayoutData(new GridData());

        comboTaggingSubtypeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

            @Override
            public void selectionChanged(final SelectionChangedEvent event) {
                ISelection iSelection = event.getSelection();
                Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                ConfigData cd = (ConfigData) obj;
                if (cd != null) {
                    aspectConfigTemplate.setSubtype(cd.getValue());
                    comboTaggingRole.removeAll();
                    if (!_loading) {
                        aspectConfigTemplate.setRole(""); //$NON-NLS-1$
                    }
                    comboTaggingSubtype.layout();
                    if (cd.getValue().equals("COMBO Selection") && !_loading) {
                        comboTaggingRole.setEnabled(false);
                        aspectConfigTemplate.setSubtype(null);
                        aspectConfigTemplate.setRole(null);
                        aspectConfigTemplate.setPos("subtype");
                    } else {
                        //                  ConfigData input = _facade.getConfigs().get(_provider);
                        //                  if (input != null)
                        //                  {
                        //                     input = input.getChildren().get("aodl:" + aspectConfigTemplate.getElement());
                        //                  }
                        //                  if (input != null)
                        //                  {
                        //                     input = input.getChildren().get(aspectConfigTemplate.getType());
                        //                  }
                        //                  if (input != null)
                        //                  {
                        //                     input = input.getChildren().get(aspectConfigTemplate.getSubtype());
                        //                  }
                        //                  if (input != null)
                        if (ifMarkupsOnLevel(aspectConfigTemplate, 2)) {
                            // TODO comboTaggingRoleViewer
                            HashMap<String, ConfigData> children = getMarkupsOnLevel(aspectConfigTemplate, 3);
                            comboTaggingRoleViewer.setInput(children);
                            if (pathCombo) {
                                ConfigItem ci = new ConfigItem();
                                ci.setLabel("COMBO Selection");
                                ci.setValue("COMBO Selection");
                                ViewHelper.comboViewerInsertElement(comboTaggingRoleViewer, ci, 0);
                                comboTaggingRoleViewer.setSelection(new StructuredSelection(ci));
                                aspectConfigTemplate.setPos("role");
                            }
                            comboTaggingRole.setEnabled(true);

                        }
                        subtypeDeco.setDescriptionText(PDRConfigProvider.readDocu(_provider, "markup",
                                "subtype", aspectConfigTemplate.getElement(), aspectConfigTemplate.getType(),
                                aspectConfigTemplate.getSubtype(), null));
                        if (subtypeDeco.getDescriptionText() != null
                                && subtypeDeco.getDescriptionText().trim().length() > 0) {
                            subtypeDeco.setImage(FieldDecorationRegistry.getDefault()
                                    .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
                        } else {
                            subtypeDeco.setImage(null);
                        }
                    }
                    roleDeco.setImage(null);
                    roleDeco.setDescriptionText(null);
                    processMarkupComboSettings(aspectConfigTemplate);
                    updatePreviewWidget(aspectConfigTemplate);

                }
            }

        });
        // Label blancSubtype = new Label(tagging1Coposite, SWT.NONE);
        // blancSubtype.setText("");
        // blancSubtype.setLayoutData(new GridData());
        // end subtype

        comboTaggingRoleViewer.addSelectionChangedListener(new ISelectionChangedListener() {

            @Override
            public void selectionChanged(final SelectionChangedEvent event) {
                ISelection iSelection = event.getSelection();
                Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                ConfigData cd = (ConfigData) obj;
                if (cd != null) {
                    if (cd.getValue().equals("COMBO Selection")) {
                        aspectConfigTemplate.setRole(null);
                        aspectConfigTemplate.setPos("role");
                    } else {
                        aspectConfigTemplate.setRole(cd.getValue());
                        roleDeco.setDescriptionText(PDRConfigProvider.readDocu(_provider, "markup", "role",
                                aspectConfigTemplate.getElement(), aspectConfigTemplate.getType(),
                                aspectConfigTemplate.getSubtype(), aspectConfigTemplate.getRole()));
                        if (roleDeco.getDescriptionText() != null
                                && roleDeco.getDescriptionText().trim().length() > 0) {
                            roleDeco.setImage(FieldDecorationRegistry.getDefault()
                                    .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
                        } else {
                            roleDeco.setImage(null);
                        }
                    }
                    processMarkupComboSettings(aspectConfigTemplate);
                    updatePreviewWidget(aspectConfigTemplate);

                } else {
                    roleDeco.setImage(null);
                }

            }
        });

        // set combos
        if (date && comboTaggingElementViewer != null) {
            aspectConfigTemplate.setElement("date");
            if (_facade.getConfigs().get(_provider) != null
                    && _facade.getConfigs().get(_provider).getChildren().containsKey("aodl:date")) {
                comboTaggingElementViewer.setSelection(new StructuredSelection(
                        _facade.getConfigs().get(_provider).getChildren().get("aodl:date")));
                comboTaggingElement.setEnabled(false);
                comboTaggingType.setEnabled(true);
                comboTaggingTypeViewer.refresh();
            }
        }
        if (aspectConfigTemplate.getElement() != null) {
            if (!aspectConfigTemplate.getElement().startsWith("aodl:")) {
                setComboViewerByString(comboTaggingElementViewer, "aodl:" + aspectConfigTemplate.getElement());
            } else {
                setComboViewerByString(comboTaggingElementViewer, aspectConfigTemplate.getElement());
            }

            if (aspectConfigTemplate.getType() != null) {
                //               if (_facade.getConfigs().get(_provider) != null
                //                     && _facade.getConfigs().get(_provider).getChildren()
                //                           .get("aodl:" + aspectConfigTemplate.getElement()) != null)
                if (ifMarkupsOnLevel(aspectConfigTemplate, 0)) {
                    //                  comboTaggingTypeViewer.setInput(_facade.getConfigs().get(_provider).getChildren()
                    //                        .get("aodl:" + aspectConfigTemplate.getElement()).getChildren());
                    //TODO comboTaggingTypeViewer
                    comboTaggingTypeViewer.setInput(getMarkupsOnLevel(aspectConfigTemplate, 1));

                    if (pathCombo && aspectConfigTemplate.getPos() != null
                            && aspectConfigTemplate.getPos().equals("type")) {
                        ConfigItem ci = new ConfigItem();
                        ci.setLabel("COMBO Selection");
                        ci.setValue("COMBO Selection");
                        ViewHelper.comboViewerInsertElement(comboTaggingTypeViewer, ci, 0);
                        setComboViewerByString(comboTaggingTypeViewer, "COMBO Selection");
                    } else {
                        setComboViewerByString(comboTaggingTypeViewer, aspectConfigTemplate.getType());
                    }
                    //                  if (aspectConfigTemplate.getType() != null
                    //                        && _facade.getConfigs().get(_provider).getChildren()
                    //                              .get("aodl:" + aspectConfigTemplate.getElement()).getChildren()
                    //                              .get(aspectConfigTemplate.getType()) != null)
                    if (ifMarkupsOnLevel(aspectConfigTemplate, 1))

                    {
                        //                     comboTaggingSubtypeViewer.setInput(_facade.getConfigs().get(_provider).getChildren()
                        //                           .get("aodl:" + aspectConfigTemplate.getElement()).getChildren()
                        //                           .get(aspectConfigTemplate.getType()).getChildren());
                        // TODO: comboTaggingSubtypeViewer
                        comboTaggingSubtypeViewer.setInput(getMarkupsOnLevel(aspectConfigTemplate, 2));
                        if (pathCombo && aspectConfigTemplate.getPos() != null
                                && aspectConfigTemplate.getPos().equals("subtype")) {
                            ConfigData ci = new ConfigData();
                            ci.setLabel("COMBO Selection");
                            ci.setValue("COMBO Selection");
                            ViewHelper.comboViewerInsertElement(comboTaggingSubtypeViewer, ci, 0);
                            setComboViewerByString(comboTaggingSubtypeViewer, "COMBO Selection");
                        } else {
                            setComboViewerByString(comboTaggingSubtypeViewer,
                                    aspectConfigTemplate.getSubtype());

                        }

                        //                     if (aspectConfigTemplate.getSubtype() != null
                        //                           && _facade.getConfigs().get(_provider).getChildren()
                        //                           .get("aodl:" + aspectConfigTemplate.getElement()).getChildren()
                        //                              .get(aspectConfigTemplate.getType()).getChildren()
                        //                                 .get(aspectConfigTemplate.getSubtype()) != null)
                        if (ifMarkupsOnLevel(aspectConfigTemplate, 2)) {
                            // TODO comboTaggingRoleViewer
                            comboTaggingRoleViewer.setInput(getMarkupsOnLevel(aspectConfigTemplate, 3));

                            if (pathCombo && aspectConfigTemplate.getPos() != null
                                    && aspectConfigTemplate.getPos().equals("role")) {
                                ConfigItem ci = new ConfigItem();
                                ci.setLabel("COMBO Selection");
                                ci.setValue("COMBO Selection");
                                ViewHelper.comboViewerInsertElement(comboTaggingRoleViewer, ci, 0);
                                setComboViewerByString(comboTaggingRoleViewer, "COMBO Selection");
                            } else {
                                setComboViewerByString(comboTaggingRoleViewer, aspectConfigTemplate.getRole());

                            }
                        }
                    }
                }

            }
            _loading = false;
        } else {
            comboTaggingElementViewer.setSelection(new StructuredSelection(
                    _facade.getConfigs().get(_provider).getChildren().get("aodl:persName")));
            comboTaggingElement.setEnabled(true);
            if (_facade.getConfigs().containsKey(_provider)) {
                comboTaggingTypeViewer.setInput(
                        _facade.getConfigs().get(_provider).getChildren().get("aodl:persName").getChildren());
            }
            comboTaggingTypeViewer.refresh();
        }
    }
    if (levelSpanB) {
        // levelSpan
        Label levelSpan = new Label(composite, SWT.NONE);
        levelSpan.setText(NLMessages.getString("Config_level_span"));
        levelSpan.setLayoutData(new GridData());
        ((GridData) levelSpan.getLayoutData()).horizontalSpan = 1;
        ((GridData) levelSpan.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) levelSpan.getLayoutData()).horizontalAlignment = SWT.FILL;
        levelSpan.pack();

        final Spinner levelSpanSpinner = new Spinner(composite, SWT.NONE | SWT.READ_ONLY);
        levelSpanSpinner.setLayoutData(new GridData());
        ((GridData) levelSpanSpinner.getLayoutData()).horizontalSpan = 1;
        ((GridData) levelSpanSpinner.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) levelSpanSpinner.getLayoutData()).horizontalAlignment = SWT.FILL;
        levelSpanSpinner.setSelection(aspectConfigTemplate.getLevelSpan());

        levelSpanSpinner.setMaximum(3);
        levelSpanSpinner.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent se) {
                aspectConfigTemplate.setLevelSpan(levelSpanSpinner.getSelection());
                updatePreviewWidget(aspectConfigTemplate);

            }
        }); // SelectionListener
    }
    if (combo) {
        Label levelSpan = new Label(composite, SWT.NONE);
        levelSpan.setText(NLMessages.getString("Config_Preview"));
        levelSpan.setLayoutData(new GridData());
        ((GridData) levelSpan.getLayoutData()).horizontalSpan = 1;
        ((GridData) levelSpan.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) levelSpan.getLayoutData()).horizontalAlignment = SWT.FILL;
        levelSpan.pack();

        Composite c = new Composite(composite, SWT.BORDER);
        c.setLayoutData(new GridData());
        c.setLayout(new GridLayout(1, false));
        ((GridLayout) c.getLayout()).marginHeight = 0;
        ((GridLayout) c.getLayout()).verticalSpacing = 0;
        ((GridLayout) c.getLayout()).marginWidth = 0;
        ((GridData) c.getLayoutData()).heightHint = 20;
        ((GridData) c.getLayoutData()).horizontalSpan = 1;
        ((GridData) c.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) c.getLayoutData()).horizontalAlignment = SWT.FILL;
        _prevWidget = new AEAspectWidgetCustomizable(c, aspectConfigTemplate, SWT.NONE);
        updatePreviewWidget(aspectConfigTemplate);
        c.layout();
        c.pack();
    }

    if (date) {
        Label date1 = new Label(composite, SWT.RIGHT);
        date1.setText(NLMessages.getString("Editor_add_dates") + "1");
        date1.setLayoutData(new GridData());

        final Combo date1Combo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
        date1Combo.setBackground(WHITE_COLOR);
        date1Combo.setLayoutData(new GridData());
        ((GridData) date1Combo.getLayoutData()).horizontalSpan = 1;
        ((GridData) date1Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
        ((GridData) date1Combo.getLayoutData()).grabExcessHorizontalSpace = true;
        ComboViewer date1ComboViewer = new ComboViewer(date1Combo);
        date1ComboViewer.setContentProvider(ArrayContentProvider.getInstance());
        date1ComboViewer.setLabelProvider(new LabelProvider() {

            @Override
            public String getText(final Object element) {
                String str = (String) element;
                if (NLMessages.getString("Editor_time_" + str) != null) {
                    return NLMessages.getString("Editor_time_" + str);
                }
                return str;
            }

        });

        date1ComboViewer.setInput(AEConstants.TIME_TYPES);
        date1ComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

            @Override
            public void selectionChanged(final SelectionChangedEvent event) {
                ISelection selection = event.getSelection();
                Object obj = ((IStructuredSelection) selection).getFirstElement();
                String s = (String) obj;
                aspectConfigTemplate.setDate1(s);
            }

        });
        if (aspectConfigTemplate.getDate1() != null) {
            StructuredSelection selection = new StructuredSelection(aspectConfigTemplate.getDate1());
            date1ComboViewer.setSelection(selection);
        } else {
            date1Combo.select(0);
            ISelection selection = date1ComboViewer.getSelection();
            Object obj = ((IStructuredSelection) selection).getFirstElement();
            String s = (String) obj;
            aspectConfigTemplate.setDate1(s);
        }

        Label date2 = new Label(composite, SWT.RIGHT);
        date2.setText(NLMessages.getString("Editor_add_dates") + "2");
        date2.setLayoutData(new GridData());

        final Combo date2Combo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
        date2Combo.setBackground(WHITE_COLOR);
        date2Combo.setLayoutData(new GridData());
        ((GridData) date2Combo.getLayoutData()).horizontalSpan = 1;
        ((GridData) date2Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
        ((GridData) date2Combo.getLayoutData()).grabExcessHorizontalSpace = true;
        ComboViewer date2ComboViewer = new ComboViewer(date2Combo);
        date2ComboViewer.setContentProvider(ArrayContentProvider.getInstance());
        date2ComboViewer.setLabelProvider(new LabelProvider() {

            @Override
            public String getText(final Object element) {
                String str = (String) element;
                if (str.trim().length() > 0) {
                    String label = NLMessages.getString("Editor_time_" + str);
                    if (label != null && !label.startsWith("!")) {
                        return label;
                    }
                }
                return str;
            }

        });

        String[] _afters = new String[] { "", "to", "notAfter" }; //$NON-NLS-1$
        date2ComboViewer.setInput(_afters);
        date2ComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

            @Override
            public void selectionChanged(final SelectionChangedEvent event) {
                ISelection selection = event.getSelection();
                Object obj = ((IStructuredSelection) selection).getFirstElement();
                String s = (String) obj;
                aspectConfigTemplate.setDate2(s);
            }

        });
        if (aspectConfigTemplate.getDate2() != null) {
            StructuredSelection selection = new StructuredSelection(aspectConfigTemplate.getDate2());
            date2ComboViewer.setSelection(selection);
        } else {
            date2Combo.select(0);
            ISelection selection = date2ComboViewer.getSelection();
            Object obj = ((IStructuredSelection) selection).getFirstElement();
            String s = (String) obj;
            aspectConfigTemplate.setDate2(s);
        }
    }

    if (relation) {
        Label relationContextLabel = new Label(composite, SWT.NONE);
        relationContextLabel.setText(NLMessages.getString("Editor_context"));
        relationContextLabel.setLayoutData(new GridData());
        ((GridData) relationContextLabel.getLayoutData()).horizontalSpan = 1;

        Combo relationContextCombo = new Combo(composite, SWT.READ_ONLY);
        relationContextCombo.setBackground(WHITE_COLOR);
        relationContextCombo.setLayoutData(new GridData());
        ((GridData) relationContextCombo.getLayoutData()).horizontalSpan = 3;
        ((GridData) relationContextCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
        ((GridData) relationContextCombo.getLayoutData()).grabExcessHorizontalSpace = true;
        final ComboViewer relationContextComboViewer = new ComboViewer(relationContextCombo);
        relationContextComboViewer.setContentProvider(new MarkupContentProvider());
        relationContextComboViewer.setLabelProvider(new MarkupLabelProvider());

        final ControlDecoration relContextDeco = new ControlDecoration(relationContextCombo,
                SWT.RIGHT | SWT.TOP);

        Label relationTypeLabel = new Label(composite, SWT.NONE);
        relationTypeLabel.setText(NLMessages.getString("Editor_class"));
        relationTypeLabel.setLayoutData(new GridData());
        ((GridData) relationTypeLabel.getLayoutData()).horizontalSpan = 1;

        final Combo relationClassCombo = new Combo(composite, SWT.READ_ONLY);
        relationClassCombo.setBackground(WHITE_COLOR);
        relationClassCombo.setLayoutData(new GridData());
        ((GridData) relationClassCombo.getLayoutData()).horizontalSpan = 3;
        ((GridData) relationClassCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
        ((GridData) relationClassCombo.getLayoutData()).grabExcessHorizontalSpace = true;
        final ComboViewer relationClassComboViewer = new ComboViewer(relationClassCombo);
        relationClassComboViewer.setContentProvider(new MarkupContentProvider());
        relationClassComboViewer.setLabelProvider(new MarkupLabelProvider());
        final ControlDecoration relClassDeco = new ControlDecoration(relationClassCombo, SWT.RIGHT | SWT.TOP);

        Label relCitationLabel = new Label(composite, SWT.NONE);
        relCitationLabel.setText(NLMessages.getString("Config_value"));
        relCitationLabel.setLayoutData(new GridData());

        final Combo relValueCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
        relValueCombo.setBackground(WHITE_COLOR);
        relValueCombo.setLayoutData(new GridData());
        ((GridData) relValueCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
        ((GridData) relValueCombo.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) relValueCombo.getLayoutData()).horizontalSpan = 3;
        final ComboViewer relValueComboViewer = new ComboViewer(relValueCombo);
        relValueComboViewer.setContentProvider(new MarkupContentProvider());
        relValueComboViewer.setLabelProvider(new MarkupLabelProvider());
        final ControlDecoration relValueDeco = new ControlDecoration(relValueCombo, SWT.RIGHT | SWT.TOP);

        if (_facade.getConfigs().get(_provider) != null) {
            relationContextComboViewer.setInput(
                    _facade.getConfigs().get(_provider).getChildren().get("aodl:relation").getChildren());
        }

        // control for relationClassCombo
        // ArrayList<String> list = cListPro
        //                  .getList("types", "type", "relation"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        // for (int n = 0; n < list.size(); n++)
        // {
        // relationClassCombo.add(list.get(n));
        // }
        if (aspectConfigTemplate.getElement() != null) {
            setComboViewerByString(relationContextComboViewer, aspectConfigTemplate.getElement());
        }

        relationContextComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
            @Override
            public void selectionChanged(final SelectionChangedEvent event) {
                ISelection iSelection = event.getSelection();
                Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                ConfigData cd = (ConfigData) obj;
                aspectConfigTemplate.setElement(cd.getValue());
                relationClassCombo.removeAll();
                relValueCombo.removeAll();
                relContextDeco.setDescriptionText(PDRConfigProvider.readDocu(_provider, "relation", "context",
                        aspectConfigTemplate.getElement(), null, null, null));
                if (relContextDeco.getDescriptionText() != null) {
                    relContextDeco.setImage(FieldDecorationRegistry.getDefault()
                            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
                } else {
                    relContextDeco.setImage(null);
                }
                relationClassComboViewer
                        .setInput(_facade.getConfigs().get(_provider).getChildren().get("aodl:relation")
                                .getChildren().get(aspectConfigTemplate.getElement()).getChildren());
            }

        });

        relationContextCombo.layout();

        // control for relationContextCombo
        if (aspectConfigTemplate.getType() != null) {
            if (aspectConfigTemplate.getElement() != null && _facade.getConfigs().get(_provider) != null
                    && _facade.getConfigs().get(_provider).getChildren().get("aodl:relation") != null
                    && _facade.getConfigs().get(_provider).getChildren().get("aodl:relation").getChildren()
                            .get(aspectConfigTemplate.getElement()) != null) {
                relationClassComboViewer
                        .setInput(_facade.getConfigs().get(_provider).getChildren().get("aodl:relation")
                                .getChildren().get(aspectConfigTemplate.getElement()).getChildren());
            }
            setComboViewerByString(relationClassComboViewer, aspectConfigTemplate.getType());
        } else {
            relationClassComboViewer.setInput(null);
            relationClassComboViewer.refresh();
        }
        relationClassComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
            @Override
            public void selectionChanged(final SelectionChangedEvent event) {
                ISelection iSelection = event.getSelection();
                Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                ConfigData cd = (ConfigData) obj;
                aspectConfigTemplate.setType(cd.getValue());
                relValueComboViewer.setInput(_facade.getConfigs().get(_provider).getChildren()
                        .get("aodl:relation").getChildren().get(aspectConfigTemplate.getElement()).getChildren()
                        .get(aspectConfigTemplate.getType()).getChildren());
                relValueComboViewer.refresh();
                relClassDeco.setDescriptionText(PDRConfigProvider.readDocu(_provider, "relation", "class",
                        aspectConfigTemplate.getElement(), aspectConfigTemplate.getType(), null, null));
                if (relClassDeco.getDescriptionText() != null) {
                    relClassDeco.setImage(FieldDecorationRegistry.getDefault()
                            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
                } else {
                    relClassDeco.setImage(null);
                }
            }
        });

        relationClassCombo.layout();
        if (aspectConfigTemplate.getSubtype() != null) {
            if (aspectConfigTemplate.getType() != null && _facade.getConfigs().get(_provider) != null
                    && _facade.getConfigs().get(_provider).getChildren().get("aodl:relation") != null
                    && _facade.getConfigs().get(_provider).getChildren().get("aodl:relation").getChildren()
                            .get(aspectConfigTemplate.getElement()) != null
                    && _facade.getConfigs().get(_provider).getChildren().get("aodl:relation").getChildren()
                            .get(aspectConfigTemplate.getElement()).getChildren()
                            .get(aspectConfigTemplate.getType()) != null) {
                relValueComboViewer.setInput(_facade.getConfigs().get(_provider).getChildren()
                        .get("aodl:relation").getChildren().get(aspectConfigTemplate.getElement()).getChildren()
                        .get(aspectConfigTemplate.getType()).getChildren());
            }
            setComboViewerByString(relValueComboViewer, aspectConfigTemplate.getSubtype());
        } else {
            relValueComboViewer.setInput(null);
            relValueComboViewer.refresh();
        }
        relValueComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
            @Override
            public void selectionChanged(final SelectionChangedEvent event) {
                ISelection iSelection = event.getSelection();
                Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                ConfigData cd = (ConfigData) obj;
                aspectConfigTemplate.setSubtype(cd.getValue());
                relValueDeco.setDescriptionText(PDRConfigProvider.readDocu(_provider, "relation", "value",
                        aspectConfigTemplate.getElement(), aspectConfigTemplate.getType(),
                        aspectConfigTemplate.getSubtype(), null));
                if (relValueDeco.getDescriptionText() != null) {
                    relValueDeco.setImage(FieldDecorationRegistry.getDefault()
                            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
                } else {
                    relValueDeco.setImage(null);
                }
            }
        });

    }
    if (preSuffix) {
        Label prefix = new Label(composite, SWT.NONE);
        prefix.setText(NLMessages.getString("Config_Prefix"));
        prefix.setLayoutData(new GridData());

        final Text prefixText = new Text(composite, SWT.BORDER);
        prefixText.setLayoutData(new GridData());
        ((GridData) prefixText.getLayoutData()).horizontalSpan = 1;
        ((GridData) prefixText.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) prefixText.getLayoutData()).horizontalAlignment = SWT.FILL;
        if (aspectConfigTemplate.getPrefix() != null) {
            prefixText.setText(aspectConfigTemplate.getPrefix());
        } else {
            prefixText.setText("");
        }
        prefixText.addFocusListener(new FocusAdapter() {
            @Override
            public void focusLost(final FocusEvent e) {
                aspectConfigTemplate.setPrefix(prefixText.getText().trim());
                // if (c instanceof ConfigItem)
                // {
                // ((ConfigItem) c).setLabel(labelText.getText().trim());
                // }
            }
        });

        Label suffix = new Label(composite, SWT.NONE);
        suffix.setText(NLMessages.getString("Config_suffix"));
        suffix.setLayoutData(new GridData());

        final Text suffixText = new Text(composite, SWT.BORDER);
        suffixText.setLayoutData(new GridData());
        ((GridData) suffixText.getLayoutData()).horizontalSpan = 1;
        ((GridData) suffixText.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) suffixText.getLayoutData()).horizontalAlignment = SWT.FILL;
        if (aspectConfigTemplate.getSuffix() != null) {
            suffixText.setText(aspectConfigTemplate.getSuffix());
        } else {
            suffixText.setText("");
        }
        suffixText.addFocusListener(new FocusAdapter() {
            @Override
            public void focusLost(final FocusEvent e) {
                aspectConfigTemplate.setSuffix(suffixText.getText().trim());
                // if (c instanceof ConfigItem)
                // {
                // ((ConfigItem) c).setLabel(labelText.getText().trim());
                // }
            }
        });
    }

    // levelSpan
    if (horizontalSpan) {
        Label horizontalSpanL = new Label(composite, SWT.NONE);
        horizontalSpanL.setText(NLMessages.getString("Config_horizontal_span"));
        horizontalSpanL.setLayoutData(new GridData());
        ((GridData) horizontalSpanL.getLayoutData()).horizontalSpan = 1;
        ((GridData) horizontalSpanL.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) horizontalSpanL.getLayoutData()).horizontalAlignment = SWT.FILL;
        horizontalSpanL.pack();

        final Combo horizontalSpanCombo = new Combo(composite, SWT.NONE | SWT.READ_ONLY);
        horizontalSpanCombo.setLayoutData(new GridData());
        ((GridData) horizontalSpanCombo.getLayoutData()).horizontalSpan = 1;
        ((GridData) horizontalSpanCombo.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) horizontalSpanCombo.getLayoutData()).horizontalAlignment = SWT.FILL;

        if (relation) {
            horizontalSpanCombo.setItems(new String[] { "50%", "75%", "100%" });
        } else {
            horizontalSpanCombo.setItems(new String[] { "25%", "50%", "75%", "100%" });
        }
        horizontalSpanCombo.select(aspectConfigTemplate.getHorizontalSpan() - 1);

        horizontalSpanCombo.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent se) {
                String selection = horizontalSpanCombo.getItem(horizontalSpanCombo.getSelectionIndex());
                if (selection.startsWith("25")) {
                    aspectConfigTemplate.setHorizontalSpan(1);
                } else if (selection.startsWith("50")) {
                    aspectConfigTemplate.setHorizontalSpan(2);
                } else if (selection.startsWith("75")) {
                    aspectConfigTemplate.setHorizontalSpan(3);
                } else if (selection.startsWith("100")) {
                    aspectConfigTemplate.setHorizontalSpan(4);
                }
            }
        }); // SelectionListener
    } else {
        aspectConfigTemplate.setHorizontalSpan(4);
    }
    composite.layout();
}

From source file:org.bbaw.pdr.ae.view.editorlite.view.PersonAspectEditor.java

License:Open Source License

/**
 * Load identifiers.// www.  j  a v  a 2  s . c o m
 * @param add the add
 * @param del the del
 */
private void loadIdentifiers(final boolean add, final Integer del) {
    if (_scrollCompIdentifier != null) {
        _scrollCompIdentifier.dispose();
    }
    _scrollCompIdentifier = new ScrolledComposite((Composite) _identifierTabItem.getControl(),
            SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    _identifierTabItem.setData("sc", _scrollCompIdentifier);

    _scrollCompIdentifier.setExpandHorizontal(true);
    _scrollCompIdentifier.setExpandVertical(true);
    _scrollCompIdentifier.setMinSize(SWT.DEFAULT, SWT.DEFAULT);
    _scrollCompIdentifier.setLayoutData(new GridData());
    ((GridData) _scrollCompIdentifier.getLayoutData()).heightHint = 380;
    ((GridData) _scrollCompIdentifier.getLayoutData()).widthHint = 630;

    ((GridData) _scrollCompIdentifier.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _scrollCompIdentifier.getLayoutData()).grabExcessHorizontalSpace = true;
    _scrollCompIdentifier.setMinHeight(1);
    _scrollCompIdentifier.setMinWidth(1);

    _scrollCompIdentifier.setLayout(new GridLayout());

    Composite contentCompIdentifier = new Composite(_scrollCompIdentifier, SWT.NONE);
    contentCompIdentifier.setLayout(new GridLayout());
    _scrollCompIdentifier.setContent(contentCompIdentifier);

    if (add && _currentPerson.getIdentifiers() == null) {
        _currentPerson.setIdentifiers(new Identifiers());
        _currentPerson.getIdentifiers().setIdentifiers(new Vector<Identifier>());
        _currentPerson.getIdentifiers().getIdentifiers().add(new Identifier());
    } else if (add) {
        _currentPerson.getIdentifiers().getIdentifiers().add(new Identifier());

    }
    if (del != null) {
        //         System.out.println("old size " + _currentPerson.getIdentifiers().getIdentifiers().size()); //$NON-NLS-1$
        _currentPerson.getIdentifiers().remove(del);
    }

    for (int i = 0; i < _currentPerson.getIdentifiers().getIdentifiers().size(); i++) {
        int m = i + 1;
        final Identifier identifier = _currentPerson.getIdentifiers().getIdentifiers().get(i);
        final Group idGroup = new Group(contentCompIdentifier, SWT.SHADOW_IN);
        idGroup.setText(NLMessages.getString("Editor_externalIdentifiers") + m); //$NON-NLS-1$
        idGroup.setLayoutData(new GridData());
        idGroup.setLayout(new GridLayout());
        idGroup.setData("num", i); //$NON-NLS-1$
        ((GridData) idGroup.getLayoutData()).horizontalAlignment = SWT.FILL;
        ((GridData) idGroup.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridLayout) idGroup.getLayout()).numColumns = 5;
        ((GridLayout) idGroup.getLayout()).makeColumnsEqualWidth = false;

        final Combo idProviderCombo = new Combo(idGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
        idProviderCombo.setEnabled(_mayWritePerson);
        idProviderCombo.setBackground(WHITE_COLOR);
        final ComboViewer idProviderComboViewer = new ComboViewer(idProviderCombo);
        idProviderComboViewer.setContentProvider(new MarkupContentProvider());
        idProviderComboViewer.setLabelProvider(new MarkupLabelProvider());

        idProviderCombo.setLayoutData(new GridData());
        ((GridData) idProviderCombo.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) idProviderCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
        ((GridData) idProviderCombo.getLayoutData()).horizontalIndent = 6;
        if (_facade.getConfigs().get(_configProvider) != null
                && _facade.getConfigs().get(_configProvider).getUsage() != null && !_facade.getConfigs()
                        .get(_configProvider).getUsage().getIdentifiers().getChildren().isEmpty()) {
            ConfigData cd = _facade.getConfigs().get(_configProvider).getUsage().getIdentifiers();
            idProviderComboViewer.setInput(cd.getChildren());

        }
        idProviderComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
            @Override
            public void selectionChanged(final SelectionChangedEvent event) {
                ISelection iSelection = event.getSelection();
                Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                IAEPresentable cp = (IAEPresentable) obj;
                if (cp != null) {
                    identifier.setProvider(cp.getValue());
                    validate();
                }

            }

        });

        if (identifier.getProvider() != null) {
            ViewHelper.setComboViewerByString(idProviderComboViewer, identifier.getProvider(), true);
        } else if (idProviderCombo.getItemCount() > 0) {
            idProviderComboViewer.setSelection(new StructuredSelection(idProviderComboViewer.getElementAt(0)));
        }

        final Text idText = new Text(idGroup, SWT.BORDER);
        idText.setLayoutData(new GridData());
        idText.setEditable(_mayWritePerson);
        idText.setBackground(WHITE_COLOR);
        ((GridData) idText.getLayoutData()).horizontalSpan = 3;
        ((GridData) idText.getLayoutData()).horizontalAlignment = SWT.FILL;
        ((GridData) idText.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) idText.getLayoutData()).horizontalIndent = 8;

        final ControlDecoration decoIdent = new ControlDecoration(idText, SWT.LEFT | SWT.TOP);
        if (identifier.getIdentifier() != null) {
            idText.setText(identifier.getIdentifier()); //$NON-NLS-1$
        } else {
            idText.setText(""); //$NON-NLS-1$
            decoIdent.setImage(FieldDecorationRegistry.getDefault()
                    .getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED).getImage());
        }

        idText.addFocusListener(new FocusAdapter() {
            @Override
            public void focusLost(final FocusEvent e) {
                identifier.setIdentifier(idText.getText()); //$NON-NLS-1$
                if (identifier.isValidId()) {
                    decoIdent.setImage(null);
                } else {
                    decoIdent.setImage(FieldDecorationRegistry.getDefault()
                            .getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED).getImage());
                }
                validate();
            }
        });
        idText.addKeyListener(new KeyListener() {

            @Override
            public void keyPressed(final KeyEvent e) {
            }

            @Override
            public void keyReleased(final KeyEvent e) {
                //               System.out.println("key released"); //$NON-NLS-1$
                identifier.setIdentifier(idText.getText()); //$NON-NLS-1$
                if (identifier.isValidId()) {
                    decoIdent.setImage(null);
                } else {
                    decoIdent.setImage(FieldDecorationRegistry.getDefault()
                            .getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED).getImage());
                }
                validate();
            }
        });

        final Button showData = new Button(idGroup, SWT.PUSH);
        showData.setText(NLMessages.getString("Editor_showData")); //$NON-NLS-1$
        showData.setToolTipText(NLMessages.getString("Editor_showData_tooltip"));
        showData.setImage(_imageReg.get(IconsInternal.BROWSER));
        showData.setLayoutData(new GridData());
        showData.setData("num", i); //$NON-NLS-1$
        showData.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent event) {

                IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench()
                        .getService(IHandlerService.class);
                _facade.setRequestedIdentifierType(identifier.getProvider()); //$NON-NLS-1$
                _facade.setRequestedIdentifier(identifier.getIdentifier()); //$NON-NLS-1$
                try {
                    handlerService.executeCommand("org.bbaw.pdr.ae.view.identifiers.commands" + //$NON-NLS-1$
                    ".OpenBrowserDialog", null); //$NON-NLS-1$
                } catch (ExecutionException e) {
                    e.printStackTrace();
                } catch (NotDefinedException e) {
                    e.printStackTrace();
                } catch (NotEnabledException e) {
                    e.printStackTrace();
                } catch (NotHandledException e) {
                    e.printStackTrace();
                }
            }
        });

        Label qualityLabel = new Label(idGroup, SWT.NONE);
        qualityLabel.setText(""); //$NON-NLS-1$
        qualityLabel.setLayoutData(new GridData());
        final ControlDecoration decoIdentQual = new ControlDecoration(qualityLabel, SWT.LEFT | SWT.TOP);
        // final String qual = "";
        SelectionListener idListener = new SelectionAdapter() {
            @Override
            public void widgetDefaultSelected(final SelectionEvent e) {

                validate();

            }

            @Override
            public void widgetSelected(final SelectionEvent e) {
                final String qual = (String) ((Button) e.getSource()).getData("text");
                //                 System.out.println("pnd qual: " + pndQual); //$NON-NLS-1$
                identifier.setQuality(qual); //$NON-NLS-1$
                if (identifier.isValidQuality()) {
                    decoIdentQual.setImage(null);
                } else {
                    decoIdentQual.setImage(FieldDecorationRegistry.getDefault()
                            .getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED).getImage());
                }
                validate();
            }
        };

        final Button[] radios = new Button[_ratings.length];

        for (int j = 0; j < _ratings.length; j++) {
            radios[j] = new Button(idGroup, SWT.RADIO);
            radios[j].setText(NLMessages.getString("Editor_" + _ratings[j]));
            radios[j].setData("text", _ratings[j]);
            radios[j].setEnabled(_mayWritePerson);
            radios[j].setLayoutData(new GridData());
            radios[j].addSelectionListener(idListener);
        }

        if (identifier.getQuality() != null) {
            ViewHelper.setRadioByString(radios, identifier.getQuality());
        } else {
            decoIdentQual.setImage(FieldDecorationRegistry.getDefault()
                    .getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED).getImage());

        }
        Label b = new Label(idGroup, SWT.NONE);
        b.setText(""); //$NON-NLS-1$
        b.setLayoutData(new GridData());
        Label idAuthorityLabel = new Label(idGroup, SWT.NONE);
        idAuthorityLabel.setText(NLMessages.getString("Editor_createdBy")); //$NON-NLS-1$
        idAuthorityLabel.setLayoutData(new GridData());

        final Text idAuthorityText = new Text(idGroup, SWT.BORDER | SWT.READ_ONLY);
        idAuthorityText.setData("num", i); //$NON-NLS-1$

        if (identifier.getAuthority() != null) {
            User u = null;
            try {
                u = _facade.getUserManager().getUserById(identifier.getAuthority().toString());
            } catch (Exception e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
            if (u != null) {
                idAuthorityText.setText(u.getDisplayName());
            } else {
                idAuthorityText.setText(identifier.getAuthority().toString());
            }
        } else {
            idAuthorityText.setText(_facade.getCurrentUser().getPdrId().toString());
            identifier.setAuthority(_facade.getCurrentUser().getPdrId());
        }

        idAuthorityText.setLayoutData(new GridData());
        ((GridData) idAuthorityText.getLayoutData()).horizontalSpan = 3;
        ((GridData) idAuthorityText.getLayoutData()).horizontalAlignment = SWT.FILL;
        ((GridData) idAuthorityText.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) idAuthorityText.getLayoutData()).horizontalIndent = 8;
        final Button delIdentifier = new Button(idGroup, SWT.PUSH);
        delIdentifier.setText(NLMessages.getString("Editor_delete")); //$NON-NLS-1$
        delIdentifier.setToolTipText(NLMessages.getString("Editor_remove_identifier_tooltip"));
        delIdentifier.setImage(_imageReg.get(IconsInternal.IDENTIFIER_REMOVE));
        delIdentifier.setLayoutData(new GridData());
        delIdentifier.setData("num", i); //$NON-NLS-1$
        delIdentifier.setEnabled(_mayWritePerson);

        delIdentifier.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent event) {
                //               System.out.println("del identifier " + (Integer) delIdentifier.getData("num")); //$NON-NLS-1$ //$NON-NLS-2$
                loadIdentifiers(false, (Integer) delIdentifier.getData("num")); //$NON-NLS-1$
                validate();

            }
        });
        idGroup.layout();
        idGroup.pack();
    } // idGroup
    contentCompIdentifier.redraw();
    contentCompIdentifier.layout();

    _scrollCompIdentifier.setContent(contentCompIdentifier);
    Point point = contentCompIdentifier.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    Point mp = _tabFolder.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    if (point.x > mp.x - 20) {
        point.x = mp.x - 20;
    }
    if (point.y > mp.y - 20) {
        point.y = mp.y - 20;
    }
    _scrollCompIdentifier.setMinSize(point);
    _scrollCompIdentifier.layout();
    _identifierTabItem.getControl().redraw();
    ((Composite) _identifierTabItem.getControl()).layout();
    _identifierTabItem.getControl().update();
}