Example usage for org.eclipse.jface.resource JFaceResources getDialogFont

List of usage examples for org.eclipse.jface.resource JFaceResources getDialogFont

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getDialogFont.

Prototype

public static Font getDialogFont() 

Source Link

Document

Returns the JFace's dialog font.

Usage

From source file:org.bbaw.pdr.ae.config.editor.view.ConfigEditor.java

License:Open Source License

/**
 * create save button.//  w w  w  .j  av  a  2  s .  c o m
 * @param parent parent composite
 * @param id button id
 * @param label button label
 * @param b boolean is default button
 * @return button
 */
protected final Button createSaveButton(final Composite parent, final int id, final String label,
        final boolean b) {
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            if (isValidInput()) {
                okPressed();
            }
        }
    });
    if (b) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    setButtonLayoutData(button);
    return button;

}

From source file:org.bbaw.pdr.ae.debug.DebugWindowPdrObjects.java

License:Open Source License

protected Button createOkButton(Composite parent, int id, String label, boolean defaultButton) {
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);/*from w ww .  ja  v a2  s .c  o  m*/
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            if (isValidInput()) {
                okPressed();
            }
        }

        private boolean isValidInput() {
            return true;
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    button.addListener(SWT.ABORT, new Listener() {
        public void handleEvent(Event e) {
            close();
        }
    });
    setButtonLayoutData(button);
    return button;
}

From source file:org.bbaw.pdr.ae.errorreport.view.MailSettingsDialog.java

License:Open Source License

/**
 * creates OKButton.//from w ww.  j a v  a  2 s . c o m
 * @param parent parent composite
 * @param id button id
 * @param label button label
 * @param defaultButton is default
 * @return button
 */
protected final Button createOkButton(final Composite parent, final int id, final String label,
        final boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            if (isValidInput()) {
                okPressed();
                saveInput();
                close();

            }
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    setButtonLayoutData(button);
    return button;
}

From source file:org.bbaw.pdr.ae.errorreport.view.ReportErrorDialog.java

License:Open Source License

/**
 * Creates the ok button.//from w  w w  .  j a v  a2s.  c  o  m
 * @param parent the parent
 * @param id the id
 * @param label the label
 * @param defaultButton the default button
 * @return the button
 */
protected final Button createOkButton(final Composite parent, final int id, final String label,
        boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            if (isValidInput()) {
                okPressed();
            }
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }

    }

    setButtonLayoutData(button);
    return button;
}

From source file:org.bbaw.pdr.ae.rap2.internal.LoginDialogRAP.java

License:Open Source License

/**
 * creates OKButton.//from w  w  w .j  av a 2s . c om
 * @param parent parent composite
 * @param id id
 * @param label label of button
 * @param defaultButton is default
 * @return okButton
 */
protected final Button createOkButton(final Composite parent, final int id, final String label,
        final boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            if (isValidInput()) {
                okPressed();
                saveInput();
                setReturnCode(OK);
                close();

            }
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    setButtonLayoutData(button);
    return button;
}

From source file:org.bbaw.pdr.ae.repositoryconnection.view.RepositoryLogin.java

License:Open Source License

/**
 * creates OKButton.//  w  ww .jav  a2 s.c o m
 * @param parent parent composite
 * @param id id
 * @param label label of button
 * @param defaultButton is default
 * @return button button
 */
protected final Button createOkButton(final Composite parent, final int id, final String label,
        final boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            if (isValidInput()) // XXX does nothing
                okPressed();
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    setButtonLayoutData(button);
    return button;
}

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

License:Open Source License

/**
 * creates OKButton.//  w w  w.j  ava 2  s.  c  o m
 * @param parent parent composite
 * @param id id
 * @param label label of button
 * @param defaultButton is default
 * @return okButton
 */
protected final Button createOkButton(final Composite parent, final int id, final String label,
        final boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            if (isValidInput()) {
                okPressed();

            }
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    setButtonLayoutData(button);
    return button;
}

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

License:Open Source License

/**
 * Builds the person search.//from   w ww  .  j  av  a2  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

/**
 * meth creates the TabItem for selecting an aspect.
 * @param mainTabFolder main tabFolder/*from   w w w.j  a  va2s . c o  m*/
 */
private void createAspectTabItem(final TabFolder mainTabFolder) {
    _aspectTabItem = new TabItem(mainTabFolder, SWT.NONE);
    _aspectTabItem.setText(NLMessages.getString("Dialog_aspects")); //$NON-NLS-1$
    _aspectTabItem.setImage(_imageReg.get(IconsInternal.ASPECTS));
    _aspectComposite = new Composite(mainTabFolder, SWT.NONE);
    _aspectComposite.setLayout(new GridLayout());
    _aspectComposite.setLayoutData(new GridData());
    ((GridData) _aspectComposite.getLayoutData()).verticalAlignment = SWT.FILL;

    _aspectTabItem.setControl(_aspectComposite);

    _aspectMainSForm = new SashForm(_aspectComposite, SWT.HORIZONTAL);
    _aspectMainSForm.setLayoutData(new GridData(GridData.FILL_BOTH));
    ((GridData) _aspectMainSForm.getLayoutData()).minimumHeight = 500;
    ((GridData) _aspectMainSForm.getLayoutData()).minimumWidth = 700;

    _aspectSearchSForm = new SashForm(_aspectMainSForm, SWT.VERTICAL);
    _aspectSearchSForm.setLayoutData(new GridData(GridData.FILL_BOTH));
    _aspectSearchGroup = new Group(_aspectSearchSForm, SWT.SHADOW_IN);
    _aspectSearchGroup.setText(NLMessages.getString("Dialog_aspectSearch")); //$NON-NLS-1$
    _aspectSearchGroup.setLayoutData(new GridData());
    ((GridData) _aspectSearchGroup.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _aspectSearchGroup.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) _aspectSearchGroup.getLayoutData()).minimumHeight = 60;
    ((GridData) _aspectSearchGroup.getLayoutData()).grabExcessHorizontalSpace = true;
    _aspectSearchGroup.setLayout(_gridLayout2);
    buildAspectSearch();
    _searchA = new Button(_aspectSearchGroup, SWT.PUSH);
    _searchA.setText(NLMessages.getString("Dialog_search")); //$NON-NLS-1$
    _searchA.setImage(_imageReg.get(IconsInternal.SEARCH));
    _searchA.setFont(JFaceResources.getDialogFont());
    _searchA.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            searchAspects();

        }

    });
    // aspectSearchGroup
    _aspectSearchGroup.pack();
    Group aspectResultGroup = new Group(_aspectSearchSForm, SWT.SHADOW_IN);
    aspectResultGroup.setText(NLMessages.getString("Dialog_result")); //$NON-NLS-1$
    aspectResultGroup.setLayoutData(new GridData());
    ((GridData) aspectResultGroup.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) aspectResultGroup.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) aspectResultGroup.getLayoutData()).minimumHeight = 100;
    ((GridData) aspectResultGroup.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) aspectResultGroup.getLayoutData()).grabExcessVerticalSpace = true;
    aspectResultGroup.setLayout(_gridLayout2);
    _aspectTableViewer = new TableViewer(aspectResultGroup, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    String[] titles = { NLMessages.getString("Dialog_displayName"), NLMessages.getString("Dialog_semantic"),
            NLMessages.getString("Dialog_id") };
    int[] bounds = { 300, 180, 180 };
    for (int i = 0; i < titles.length; i++) {
        TableViewerColumn column = new TableViewerColumn(_aspectTableViewer, SWT.NONE);
        column.getColumn().setText(titles[i]);
        column.getColumn().setWidth(bounds[i]);
        column.getColumn().setResizable(true);
        column.getColumn().setMoveable(true);
        column.getColumn().addSelectionListener(getSelectionAdapter(_aspectTableViewer, column.getColumn(), i));

    }
    Table table = _aspectTableViewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    table.setLayoutData(new GridData());
    ((GridData) table.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) table.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) table.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) table.getLayoutData()).grabExcessVerticalSpace = true;
    _aspectTableViewer.addDoubleClickListener(new IDoubleClickListener() {
        @Override
        public void doubleClick(final DoubleClickEvent event) {
            ISelection selection = _aspectTableViewer.getSelection();
            Object obj = ((IStructuredSelection) selection).getFirstElement();
            _selectedA = (Aspect) obj;
            _selectedAspectText.setText(_selectedA.getNotification());
        }
    });
    Label selectLabel = new Label(aspectResultGroup, SWT.None);
    selectLabel.setText(NLMessages.getString("Dialog_selection"));
    _selectedAspectText = new Text(aspectResultGroup, SWT.SHADOW_IN | SWT.WRAP | SWT.READ_ONLY);
    _selectedAspectText.setLayoutData(new GridData());
    ((GridData) _selectedAspectText.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _selectedAspectText.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) _selectedAspectText.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) _selectedAspectText.getLayoutData()).minimumHeight = 30;
    _selectedAspectText.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    _aspectSearchSForm.setWeights(new int[] { 2, 2 });
    Group lastAspectsGroup = new Group(_aspectMainSForm, SWT.SHADOW_IN);
    lastAspectsGroup.setText(NLMessages.getString("Dialog_lastAspects")); //$NON-NLS-1$
    lastAspectsGroup.setLayoutData(new GridData());
    ((GridData) lastAspectsGroup.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) lastAspectsGroup.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) lastAspectsGroup.getLayoutData()).minimumHeight = 120;
    ((GridData) lastAspectsGroup.getLayoutData()).grabExcessHorizontalSpace = true;
    lastAspectsGroup.setLayout(_gridLayout2);
    _lastAspectList = new List(lastAspectsGroup, SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    _lastAspectList.setLayoutData(new GridData());
    ((GridData) _lastAspectList.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _lastAspectList.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) _lastAspectList.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) _lastAspectList.getLayoutData()).grabExcessVerticalSpace = true;
    final Vector<Aspect> lastAspects = _facade.getLastAspects();
    if (_facade.getLastAspects() != null && !_facade.getLastAspects().isEmpty()) {
        for (int i = lastAspects.size() - 1; i > -1; i--) {
            _lastAspectList.add(lastAspects.get(i).getDisplayNameWithID());
        }
    }
    _lastAspectList.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetDefaultSelected(final SelectionEvent event) {
            // int[] selectedItems =
            // lastAspectList.getSelectionIndices();
            //                    String outString = ""; //$NON-NLS-1$
            // for (int loopIndex = 0; loopIndex <
            // selectedItems.length; loopIndex++)
            // {
            //                     outString += selectedItems[loopIndex] + " "; //$NON-NLS-1$
            // }
            //                    System.out.println("Selected Items: " + outString); //$NON-NLS-1$
        }

        @Override
        public void widgetSelected(final SelectionEvent event) {
            int si = lastAspects.size() - _lastAspectList.getSelectionIndex() - 1;
            String selected = NLMessages.getString("Dialog_aspect") //$NON-NLS-1$
                    + lastAspects.get(si).getSemanticDim().getSemanticStms().get(0).getLabel()
                    + NLMessages.getString("Dialog_ID") //$NON-NLS-1$
                    + lastAspects.get(si).getPdrId().toString();
            // System.out.println(selected);
            //                  System.out.println("index " + si); //$NON-NLS-1$
            setMessage(selected);
            _selectedA = lastAspects.get(si);
            _selectedAspectText.setText(_selectedA.getNotification());

            // delete possible person selection
            _lastPersonList.deselectAll();
            _lastReferenceList.deselectAll();

        }
    });
    _aspectMainSForm.setWeights(new int[] { 3, 1 });
}

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

License:Open Source License

/**
 * meth creates the OK button./*from ww w.ja  v a 2s.  c  om*/
 * @param parent parent composite
 * @param id id
 * @param label label of button
 * @param defaultButton is default
 * @return okButton
 */
protected final Button createOkButton(final Composite parent, final int id, final String label,
        final boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    _okButton = new Button(parent, SWT.PUSH);
    _okButton.setText(label);
    _okButton.setFont(JFaceResources.getDialogFont());
    _okButton.setData(new Integer(id));
    _okButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            //            System.out.println("OK pressed"); //$NON-NLS-1$
            if (isValidInput()) {
                okPressed();
            }
        }
    });

    setButtonLayoutData(_okButton);
    return _okButton;
}