Example usage for org.eclipse.jface.fieldassist TextContentAdapter TextContentAdapter

List of usage examples for org.eclipse.jface.fieldassist TextContentAdapter TextContentAdapter

Introduction

In this page you can find the example usage for org.eclipse.jface.fieldassist TextContentAdapter TextContentAdapter.

Prototype

TextContentAdapter

Source Link

Usage

From source file:at.medevit.elexis.gdt.ui.dialog.NeueUntersuchungAnfordernDialog.java

License:Open Source License

/**
 * Create contents of the dialog./* ww w  .j av  a 2 s . c o  m*/
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    setTitleImage(ResourceManager.getPluginImage("at.medevit.elexis.gdt", "rsc/icons/TitleIcon6302.png"));
    setMessage("GDT Satznachricht 6302");
    setTitle("Neue Untersuchung anfordern");
    Composite area = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(area, SWT.NONE);
    container.setLayout(new GridLayout(4, true));
    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Label lblZiel = new Label(container, SWT.NONE);
    lblZiel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblZiel.setText("Ziel");

    comboViewerTarget = new ComboViewer(container, SWT.NONE);
    Combo combo = comboViewerTarget.getCombo();
    combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
    comboViewerTarget.setContentProvider(ArrayContentProvider.getInstance());
    comboViewerTarget.setLabelProvider(new ComboViewerCommPartner());
    List<IGDTCommunicationPartner> commPartners = GDTCommPartnerCollector.getRegisteredCommPartners();
    comboViewerTarget.setInput(commPartners);
    comboViewerTarget.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) comboViewerTarget.getSelection();
            IGDTCommunicationPartner cp = (IGDTCommunicationPartner) selection.getFirstElement();
            commPartner = cp;
            txtIDReceiver.setText(cp.getIDReceiver());
            if (cp.getOutgoingDefaultCharset() >= 0)
                gdt6302.setValue(GDTConstants.FELDKENNUNG_VERWENDETER_ZEICHENSATZ,
                        cp.getOutgoingDefaultCharset() + "");

            supported8402values = cp.getSupported8402values();
            supported8402valuesDescription = cp.getSupported8402valuesDescription();
            if (supported8402values != null && supported8402valuesDescription != null) {
                contentProposalProvider8402.setProposals(supported8402values, supported8402valuesDescription,
                        cp.getSupported8402valuesDetailDescription());
            }
        }
    });

    Label lblGdtidEmpfnger = new Label(container, SWT.NONE);
    lblGdtidEmpfnger.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblGdtidEmpfnger.setText("ID Empfnger");

    txtIDReceiver = new Text(container, SWT.BORDER);
    txtIDReceiver.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    txtIDReceiver.setTextLimit(8);

    Label lblGdtidSender = new Label(container, SWT.NONE);
    lblGdtidSender.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblGdtidSender.setText("ID Sender");

    txtIDSender = new Text(container, SWT.BORDER);
    txtIDSender.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    txtIDSender.setTextLimit(8);

    Label lblNewLabel = new Label(container, SWT.NONE);
    GridData gd_lblNewLabel = new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1);
    gd_lblNewLabel.heightHint = 5;
    lblNewLabel.setLayoutData(gd_lblNewLabel);

    Group groupPatient = new Group(container, SWT.NONE);
    groupPatient.setText("Notwendige Patienten-Daten");
    groupPatient.setLayout(new GridLayout(5, false));
    groupPatient.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));

    Label lblPatientKennung = new Label(groupPatient, SWT.NONE);
    lblPatientKennung.setText("Nummer/Kennung");

    txtPatientenKennung = new Text(groupPatient, SWT.BORDER);
    txtPatientenKennung.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    txtPatientenKennung.setTextLimit(10);
    new Label(groupPatient, SWT.NONE);

    Label lblGeburtsdatum = new Label(groupPatient, SWT.NONE);
    lblGeburtsdatum.setText("Geburtsdatum");

    dateTimeBirthday = new DateTime(groupPatient, SWT.BORDER | SWT.DROP_DOWN);
    dateTimeBirthday.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblPatientNachname = new Label(groupPatient, SWT.NONE);
    lblPatientNachname.setText("Nachname");

    txtPatientNachname = new Text(groupPatient, SWT.BORDER);
    txtPatientNachname.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    txtPatientNachname.setTextLimit(28);
    new Label(groupPatient, SWT.NONE);

    Label lblPatientVorname = new Label(groupPatient, SWT.NONE);
    lblPatientVorname.setText("Vorname");

    txtPatientVorname = new Text(groupPatient, SWT.BORDER);
    txtPatientVorname.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    txtPatientVorname.setTextLimit(28);

    Group grpGeraeteSpezifisch = new Group(container, SWT.None);
    grpGeraeteSpezifisch.setLayout(new GridLayout(4, true));
    grpGeraeteSpezifisch.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1));
    grpGeraeteSpezifisch.setText("Testbezogene Daten");

    Label lblGuvk = new Label(grpGeraeteSpezifisch, SWT.NONE);
    lblGuvk.setToolTipText("Gerte und verfahrensspezifisches Kennfeld (8402)");
    lblGuvk.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1));
    lblGuvk.setText("GuvK");

    txtGuVK = new Text(grpGeraeteSpezifisch, SWT.BORDER);
    txtGuVK.setTextLimit(6);
    txtGuVK.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

    contentProposalProvider8402 = new Feld8402ContentProposalProvider(new String[] {}, new String[] {},
            new String[] {});
    guvkAdapter = new ContentProposalAdapter(txtGuVK, new TextContentAdapter(), contentProposalProvider8402,
            null, null);
    guvkAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);

    Label lblTestident = new Label(grpGeraeteSpezifisch, SWT.NONE);
    lblTestident.setToolTipText("Test-Identifizierung (8410)");
    lblTestident.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1));
    lblTestident.setText("Test-Ident");

    txtTestIdent = new Text(grpGeraeteSpezifisch, SWT.BORDER);
    txtTestIdent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    txtTestIdent.setTextLimit(20);

    Group grpOptionaleDaten = new Group(container, SWT.NONE);
    grpOptionaleDaten.setText("Optionale Patienten-Daten");
    grpOptionaleDaten.setLayout(new GridLayout(5, false));
    grpOptionaleDaten.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));

    Label lblTitel = new Label(grpOptionaleDaten, SWT.NONE);
    lblTitel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblTitel.setText("Titel");

    txtTitel = new Text(grpOptionaleDaten, SWT.BORDER);
    txtTitel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    new Label(grpOptionaleDaten, SWT.NONE);

    Label lblGeschlecht = new Label(grpOptionaleDaten, SWT.NONE);
    lblGeschlecht.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblGeschlecht.setText("Geschlecht");

    comboViewerGeschlecht = new ComboViewer(grpOptionaleDaten, SWT.NONE);
    Combo comboGeschlecht = comboViewerGeschlecht.getCombo();
    comboViewerGeschlecht.setContentProvider(ArrayContentProvider.getInstance());
    comboViewerGeschlecht.setInput(new String[] { GDTConstants.SEX_MALE + "", GDTConstants.SEX_FEMALE + "" });
    comboViewerGeschlecht.setLabelProvider(new ComboViewerGeschlechtLabelProvider());
    comboGeschlecht.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblVersichertennr = new Label(grpOptionaleDaten, SWT.NONE);
    lblVersichertennr.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblVersichertennr.setText("Versicherten-Nr.");

    txtVersichertenNr = new Text(grpOptionaleDaten, SWT.BORDER);
    txtVersichertenNr.setTextLimit(12);
    txtVersichertenNr.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(grpOptionaleDaten, SWT.NONE);

    Label lblVersichertenart = new Label(grpOptionaleDaten, SWT.NONE);
    lblVersichertenart.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblVersichertenart.setText("Versichertenart");

    comboViewerVersichertenart = new ComboViewer(grpOptionaleDaten, SWT.NONE);
    Combo comboVersichertenart = comboViewerVersichertenart.getCombo();
    comboVersichertenart.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    comboViewerVersichertenart.setContentProvider(ArrayContentProvider.getInstance());
    comboViewerVersichertenart.setInput(new String[] { GDTConstants.VERSICHERTENART_FAMILIENVERSICHERTER + "",
            GDTConstants.VERSICHERTENART_MITGLIED + "", GDTConstants.VERSICHERTENART_RENTNER + "" });
    comboViewerVersichertenart.setLabelProvider(new ComboViewerVersichertenartLabelProvider());

    Label lblStrasse = new Label(grpOptionaleDaten, SWT.NONE);
    lblStrasse.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblStrasse.setText("Strasse");

    txtStrasse = new Text(grpOptionaleDaten, SWT.BORDER);
    txtStrasse.setTextLimit(28);
    txtStrasse.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(grpOptionaleDaten, SWT.NONE);

    Label lblOrt = new Label(grpOptionaleDaten, SWT.NONE);
    lblOrt.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblOrt.setText("Ort");

    txtOrt = new Text(grpOptionaleDaten, SWT.BORDER);
    txtOrt.setTextLimit(30);
    txtOrt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblGroesse = new Label(grpOptionaleDaten, SWT.NONE);
    lblGroesse.setToolTipText("Gre in cm");
    lblGroesse.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblGroesse.setText("Gre");

    txtGroesse = new Text(grpOptionaleDaten, SWT.BORDER);
    txtGroesse.setTextLimit(10);
    txtGroesse.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(grpOptionaleDaten, SWT.NONE);

    Label lblGewicht = new Label(grpOptionaleDaten, SWT.NONE);
    lblGewicht.setToolTipText("Gewicht in kg");
    lblGewicht.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblGewicht.setText("Gewicht");

    txtGewicht = new Text(grpOptionaleDaten, SWT.BORDER);
    txtGewicht.setTextLimit(10);
    txtGewicht.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblMuttersprache = new Label(grpOptionaleDaten, SWT.NONE);
    lblMuttersprache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblMuttersprache.setText("Muttersprache");

    txtMuttersprache = new Text(grpOptionaleDaten, SWT.BORDER);
    txtMuttersprache.setTextLimit(60);
    txtMuttersprache.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(grpOptionaleDaten, SWT.NONE);
    new Label(grpOptionaleDaten, SWT.NONE);
    new Label(grpOptionaleDaten, SWT.NONE);

    initDataBindings();
    if (commPartners != null && commPartners.size() > 0) {
        comboViewerTarget.setSelection(new StructuredSelection(commPartners.get(0)));
        if (targetIdSelection != null) {
            int idx = 0;
            for (IGDTCommunicationPartner igdtCommunicationPartner : commPartners) {
                if (igdtCommunicationPartner instanceof IGDTCommunicationPartnerProvider) {
                    String id = ((IGDTCommunicationPartnerProvider) igdtCommunicationPartner).getId();
                    if (id.equals(targetIdSelection)) {
                        comboViewerTarget.setSelection(new StructuredSelection(commPartners.get(idx)));
                        break;
                    }
                }
                idx++;
            }
        }
    }

    return area;
}

From source file:at.medevit.elexis.impfplan.ui.dialogs.SupplementVaccinationDialog.java

License:Open Source License

/**
 * Create contents of the dialog.//ww w. j  a va  2 s.com
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    setTitle("Impfung nachtragen");
    setTitleImage(
            ResourceManager.getPluginImage("at.medevit.elexis.impfplan.ui", "rsc/icons/vaccination_logo.png"));

    Patient selectedPatient = ElexisEventDispatcher.getSelectedPatient();
    setMessage(pat.getLabel());

    Composite area = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(area, SWT.NONE);
    container.setLayout(new GridLayout(2, false));
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    Group mainGroup = new Group(container, SWT.NONE);
    mainGroup.setFont(SWTResourceManager.getFont("Noto Sans", 9, SWT.BOLD));
    mainGroup.setText("Pflicht Angaben");
    GridLayout gd_MainGroup = new GridLayout(2, false);
    mainGroup.setLayout(gd_MainGroup);
    mainGroup.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label lblVerabreichungsdatum = new Label(mainGroup, SWT.NONE);
    lblVerabreichungsdatum.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblVerabreichungsdatum.setText("Datum");

    dateOfAdministration = new DateTime(mainGroup, SWT.BORDER | SWT.DROP_DOWN);
    dateOfAdministration.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            selDate.set(dateOfAdministration.getYear(), dateOfAdministration.getMonth(),
                    dateOfAdministration.getDay());

            if (selDate.isBefore(patBDay)) {
                SWTHelper.showInfo("Patient noch nicht geboren",
                        "Das von Ihnen gewhlte Datum liegt vor der Geburt des Patienten.");
                dateOfAdministration.setYear(patBDay.get(TimeTool.YEAR));
                dateOfAdministration.setMonth(patBDay.get(TimeTool.MONTH));
                dateOfAdministration.setDay(patBDay.get(TimeTool.DAY_OF_MONTH));
            }
        }
    });

    { // article name
        Label lblArtikelname = new Label(mainGroup, SWT.NONE);
        lblArtikelname.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
        lblArtikelname.setText("Artikelname");

        txtArticleName = new Text(mainGroup, SWT.BORDER);
        txtArticleName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
        txtArticleName.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                articleString = txtArticleName.getText();
            }
        });

        PersistentObjectProposalProvider<ArtikelstammItem> aopp = new PersistentObjectProposalProvider<>(
                ArtikelstammItem.class, ArtikelstammItem.FLD_ATC, Query.LIKE, "J07%");
        ContentProposalAdapter articleProposalAdapter = new ContentProposalAdapter(txtArticleName,
                new TextContentAdapter(), aopp, null, null);
        articleProposalAdapter.addContentProposalListener(new IContentProposalListener() {

            @SuppressWarnings("unchecked")
            @Override
            public void proposalAccepted(IContentProposal proposal) {
                PersistentObjectContentProposal<ArtikelstammItem> prop = (PersistentObjectContentProposal<ArtikelstammItem>) proposal;
                txtArticleName.setText(prop.getLabel());
                articleString = prop.getPersistentObject().storeToString();

                /**
                 * could be useful to define vacc. against at some point, but not needed in the
                 * current version
                 */
                // txtArticleEAN.setText(prop.getPersistentObject().getEAN());
                // txtAtcCode.setText(prop.getPersistentObject().getATCCode());
            }
        });
    }
    new Label(container, SWT.NONE);

    Group optionalGroup = new Group(container, SWT.NONE);
    optionalGroup.setFont(SWTResourceManager.getFont("Noto Sans", 9, SWT.BOLD));
    optionalGroup.setText("Optionale Angaben");
    optionalGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    optionalGroup.setLayout(new GridLayout(2, false));

    { // administrating contact
        Label lblAdministratingContact = new Label(optionalGroup, SWT.NONE);
        lblAdministratingContact.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
        lblAdministratingContact.setText("Nachtrag von");

        txtAdministrator = new Text(optionalGroup, SWT.BORDER);
        administratorString = mandant.storeToString();
        txtAdministrator.setText(mandant.getMandantLabel());
        txtAdministrator.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                administratorString = txtAdministrator.getText();
            }
        });
        txtAdministrator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
        PersistentObjectProposalProvider<Mandant> mopp = new PersistentObjectProposalProvider<Mandant>(
                Mandant.class) {
            @Override
            public String getLabelForObject(Mandant a) {
                return a.getMandantLabel();
            }
        };

        ContentProposalAdapter mandatorProposalAdapter = new ContentProposalAdapter(txtAdministrator,
                new TextContentAdapter(), mopp, null, null);
        mandatorProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
        mandatorProposalAdapter.addContentProposalListener(new IContentProposalListener() {

            @Override
            public void proposalAccepted(IContentProposal proposal) {
                PersistentObjectContentProposal<Mandant> prop = (PersistentObjectContentProposal<Mandant>) proposal;
                administratorString = prop.getPersistentObject().storeToString();
            }
        });

        Label lblLotNo = new Label(optionalGroup, SWT.NONE);
        lblLotNo.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
        lblLotNo.setText("Lot-Nr");

        txtLotNo = new Text(optionalGroup, SWT.BORDER);
        txtLotNo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    }

    /**
     * could be useful to define vacc. against at some point, but not needed in the current
     * version
     */
    // Label lblArtikelEan = new Label(optionalGroup, SWT.NONE);
    // lblArtikelEan.setSize(60, 15);
    // lblArtikelEan.setText("Artikel EAN");
    //
    // txtArticleEAN = new Text(optionalGroup, SWT.BORDER);
    // txtArticleEAN.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    // txtArticleEAN.setSize(348, 21);
    //
    // Label lblAtccode = new Label(optionalGroup, SWT.NONE);
    // lblAtccode.setSize(56, 15);
    // lblAtccode.setText("ATC-Code");
    //
    // txtAtcCode = new Text(optionalGroup, SWT.BORDER);
    // txtAtcCode.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    // txtAtcCode.setSize(314, 21);

    Group expiredGroup = new Group(container, SWT.NONE);
    expiredGroup.setFont(SWTResourceManager.getFont("Noto Sans", 9, SWT.BOLD));
    expiredGroup.setText("Bei nicht mehr erhltlichen Impfstoffen");
    expiredGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    expiredGroup.setLayout(new GridLayout(2, false));
    {
        Label lblVaccAgainst = new Label(expiredGroup, SWT.NONE);
        lblVaccAgainst.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
        lblVaccAgainst.setText("Impfung gegen Krankheit(en)");

        vect = new VaccinationEffectCheckboxTreeViewer(container, SWT.BORDER, vaccAgainst);
    }
    return area;
}

From source file:at.rc.tacos.client.view.DialysisForm.java

License:Open Source License

/**
 * Create contents of the window/*from www  .j  av a2s  . c  o m*/
 */
protected void createContents() {
    // add the listener for address records
    ModelFactory.getInstance().getAddressManager().addPropertyChangeListener(this);
    // create the content of the form
    shell = new Shell(Display.getCurrent(), SWT.APPLICATION_MODAL | SWT.TITLE | SWT.BORDER | SWT.CLOSE);
    shell.addShellListener(new ShellAdapter() {

        public void shellClosed(final ShellEvent e) {
            LockManager.removeLock(DialysisPatient.ID, dia.getId());
            ModelFactory.getInstance().getAddressManager().removePropertyChangeListener(DialysisForm.this);
        }
    });
    shell.setLayout(new FormLayout());
    shell.setImage(ImageFactory.getInstance().getRegisteredImage("application.logo"));
    shell.setText("Dialysepatient");

    transportdatenGroup = new Group(shell, SWT.NONE);
    final FormData fd_transportdatenGroup = new FormData();
    fd_transportdatenGroup.bottom = new FormAttachment(0, 293);
    fd_transportdatenGroup.top = new FormAttachment(0, 111);
    fd_transportdatenGroup.right = new FormAttachment(0, 1066);
    fd_transportdatenGroup.left = new FormAttachment(0, 204);
    transportdatenGroup.setLayoutData(fd_transportdatenGroup);
    transportdatenGroup.setForeground(Util.getColor(128, 128, 128));
    transportdatenGroup.setText("Transportdaten");

    final Label vonLabel = new Label(transportdatenGroup, SWT.NONE);
    vonLabel.setForeground(Util.getColor(128, 128, 128));
    vonLabel.setText("von:");
    vonLabel.setBounds(10, 42, 25, 13);

    textToStreet = new Text(transportdatenGroup, SWT.WRAP | SWT.MULTI | SWT.BORDER);
    textToStreet.setBounds(41, 66, 230, 21);
    textToStreet.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            // no action when the enter key is pressed
            if (e.keyCode == 13) {
                e.doit = false;
                return;
            }
            // go to the next field when the tab is pressed
            if (e.keyCode == 9) {
                textToCity.setFocus();
                e.doit = false;
                return;
            }
            inputChanged(textToStreet.getText(), IFilterTypes.SEARCH_STRING_STREET);
        }
    });
    acToStreet = new AutoCompleteField(textToStreet, new TextContentAdapter(), new String[] {});

    textFromStreet = new Text(transportdatenGroup, SWT.WRAP | SWT.MULTI | SWT.BORDER);
    textFromStreet.setBounds(41, 39, 230, 21);
    textFromStreet.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            // no action when the enter key is pressed
            if (e.keyCode == 13) {
                e.doit = false;
                return;
            }
            // go to the next field when the tab is pressed
            if (e.keyCode == 9) {
                textFromCity.setFocus();
                e.doit = false;
                return;
            }
            inputChanged(textFromStreet.getText(), IFilterTypes.SEARCH_STRING_STREET);
        }
    });
    acFromStreet = new AutoCompleteField(textFromStreet, new TextContentAdapter(), new String[] {});

    final Label nachLabel = new Label(transportdatenGroup, SWT.NONE);
    nachLabel.setForeground(Util.getColor(128, 128, 128));
    nachLabel.setText("nach:");
    nachLabel.setBounds(10, 69, 25, 13);

    final Label label = new Label(transportdatenGroup, SWT.NONE);
    label.setForeground(Util.getColor(128, 128, 128));
    label.setText("Strae");
    label.setBounds(41, 20, 56, 13);

    textFromCity = new Text(transportdatenGroup, SWT.WRAP | SWT.MULTI | SWT.BORDER);
    textFromCity.setBounds(277, 39, 156, 21);
    textFromCity.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            // no action when the enter key is pressed
            if (e.keyCode == 13) {
                e.doit = false;
                return;
            }
            // go to the next field when the tab is pressed
            if (e.keyCode == 9) {
                textPatientLastName.setFocus();
                e.doit = false;
                return;
            }
            inputChanged(textFromCity.getText(), IFilterTypes.SEARCH_STRING_CITY);
        }
    });
    acFromCity = new AutoCompleteField(textFromCity, new TextContentAdapter(), new String[] {});

    textToCity = new Text(transportdatenGroup, SWT.WRAP | SWT.MULTI | SWT.BORDER);
    textToCity.setBounds(277, 66, 156, 21);
    textToCity.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            // no action when the enter key is pressed
            if (e.keyCode == 13) {
                e.doit = false;
                return;
            }
            // go to the next field when the tab is pressed
            if (e.keyCode == 9) {
                begleitpersonButton.setFocus();
                e.doit = false;
                return;
            }
            inputChanged(textToCity.getText(), IFilterTypes.SEARCH_STRING_CITY);
        }
    });
    acToCity = new AutoCompleteField(textToCity, new TextContentAdapter(), new String[] {});

    final Label ortLabel = new Label(transportdatenGroup, SWT.NONE);
    ortLabel.setForeground(Util.getColor(128, 128, 128));
    ortLabel.setText("Ort");
    ortLabel.setBounds(322, 20, 25, 13);

    textPatientLastName = new Text(transportdatenGroup, SWT.WRAP | SWT.MULTI | SWT.BORDER);
    textPatientLastName.setBounds(467, 39, 171, 21);
    textPatientLastName.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            // no action when the enter key is pressed
            if (e.keyCode == 13) {
                e.doit = false;
                return;
            }
            // go to the next field when the tab is pressed
            if (e.keyCode == 9) {
                textPatientFirstName.setFocus();
                e.doit = false;
                return;
            }
        }
    });

    final Label nachnameLabel = new Label(transportdatenGroup, SWT.NONE);
    nachnameLabel.setForeground(Util.getColor(128, 128, 128));
    nachnameLabel.setText("Nachname");
    nachnameLabel.setBounds(467, 20, 56, 13);

    textPatientFirstName = new Text(transportdatenGroup, SWT.WRAP | SWT.MULTI | SWT.BORDER);
    textPatientFirstName.setBounds(644, 39, 171, 21);
    textPatientFirstName.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            // no action when the enter key is pressed
            if (e.keyCode == 13) {
                e.doit = false;
                return;
            }
            // go to the next field when the tab is pressed
            if (e.keyCode == 9) {
                combokindOfTransport.setFocus();
                e.doit = false;
                return;
            }
        }
    });

    button = new Button(transportdatenGroup, SWT.NONE);
    button.setBounds(821, 37, 32, 23);
    button.setText("...");
    button.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            Shell parentShell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
            // open the selection dialog to choose a patient
            PatientSelectionDialog selectionDialog = new PatientSelectionDialog(textPatientLastName.getText(),
                    parentShell);
            selectionDialog.open();
            SickPerson selectedPerson = (SickPerson) selectionDialog.getResult()[0];

            // assert valid
            if (selectedPerson == null)
                return;

            if (selectedPerson.getFirstName() != null)
                textPatientFirstName.setText(selectedPerson.getFirstName());
            if (selectedPerson.getLastName() != null)
                textPatientLastName.setText(selectedPerson.getLastName());
            if (selectedPerson.getStreetname() != null)
                textFromStreet.setText(selectedPerson.getStreetname());
            if (selectedPerson.getCityname() != null)
                textFromCity.setText(selectedPerson.getCityname());
            if (selectedPerson.getKindOfTransport() != null)
                combokindOfTransport.setText(selectedPerson.getKindOfTransport());
        }
    });

    final Label nachnameLabel_1 = new Label(transportdatenGroup, SWT.NONE);
    nachnameLabel_1.setBounds(644, 20, 56, 13);
    nachnameLabel_1.setForeground(Util.getColor(128, 128, 128));
    nachnameLabel_1.setText("Vorname");

    final Label label_kind = new Label(transportdatenGroup, SWT.NONE);
    label_kind.setBounds(680, 72, 70, 13);
    label_kind.setForeground(Util.getColor(128, 128, 128));
    label_kind.setText("Transportart:");
    combokindOfTransport = new Combo(transportdatenGroup, SWT.READ_ONLY);
    // set possible priorities
    String[] kindsOfTransport = { TRANSPORT_KIND_GEHEND, TRANSPORT_KIND_TRAGSESSEL, TRANSPORT_KIND_KRANKENTRAGE,
            TRANSPORT_KIND_ROLLSTUHL };
    combokindOfTransport.setItems(kindsOfTransport);
    combokindOfTransport.setBounds(753, 69, 100, 23);
    combokindOfTransport.setForeground(Util.getColor(128, 128, 128));

    begleitpersonButton = new Button(transportdatenGroup, SWT.CHECK);
    begleitpersonButton.setText("Begleitperson");
    begleitpersonButton.setBounds(465, 113, 85, 16);

    final Label label_6 = new Label(transportdatenGroup, SWT.NONE);
    label_6.setForeground(Util.getColor(128, 128, 128));
    label_6.setText("Zustndige Ortsstelle:");
    label_6.setBounds(205, 118, 111, 13);

    Combo comboZustaendigeOrtsstelle = new Combo(transportdatenGroup, SWT.READ_ONLY);
    zustaendigeOrtsstelle = new ComboViewer(comboZustaendigeOrtsstelle);
    zustaendigeOrtsstelle.setContentProvider(new StationContentProvider());
    zustaendigeOrtsstelle.setLabelProvider(new StationLabelProvider());
    zustaendigeOrtsstelle.setInput(ModelFactory.getInstance().getLocationManager());
    comboZustaendigeOrtsstelle.setBounds(322, 113, 112, 21);

    button_stationary = new Button(transportdatenGroup, SWT.CHECK);
    button_stationary.setText("stationr");
    button_stationary.setBounds(41, 118, 85, 16);

    planungGroup = new Group(shell, SWT.NONE);
    final FormData fd_planungGroup = new FormData();
    fd_planungGroup.bottom = new FormAttachment(transportdatenGroup, 182, SWT.TOP);
    fd_planungGroup.top = new FormAttachment(transportdatenGroup, 0, SWT.TOP);
    fd_planungGroup.right = new FormAttachment(0, 100);
    fd_planungGroup.left = new FormAttachment(0, 10);
    planungGroup.setLayoutData(fd_planungGroup);
    planungGroup.setText("Zeiten");

    final Label abfLabel = new Label(planungGroup, SWT.NONE);
    abfLabel.setForeground(Util.getColor(128, 128, 128));
    abfLabel.setText("Abf:");
    abfLabel.setBounds(10, 37, 25, 13);

    final Label beiPatLabel = new Label(planungGroup, SWT.NONE);
    beiPatLabel.setForeground(Util.getColor(128, 128, 128));
    beiPatLabel.setText("Pat.:");
    beiPatLabel.setBounds(10, 64, 25, 13);

    final Label terminLabel = new Label(planungGroup, SWT.NONE);
    terminLabel.setForeground(Util.getColor(128, 128, 128));
    terminLabel.setText("Term.");
    terminLabel.setBounds(10, 91, 28, 13);

    textBeiPat = new Text(planungGroup, SWT.BORDER);
    textBeiPat.setBounds(41, 61, 41, 21);

    textTermin = new Text(planungGroup, SWT.BORDER);
    textTermin.setBounds(41, 88, 41, 21);

    textAbf = new Text(planungGroup, SWT.BORDER);
    textAbf.setBounds(41, 34, 41, 21);

    final Label terminLabel_1 = new Label(planungGroup, SWT.NONE);
    terminLabel_1.setBounds(10, 118, 28, 13);
    terminLabel_1.setForeground(Util.getColor(128, 128, 128));
    terminLabel_1.setText("Abf.:");

    textAbfRT = new Text(planungGroup, SWT.BORDER);
    textAbfRT.setBounds(41, 115, 41, 21);

    abfLabel_1 = new Label(planungGroup, SWT.NONE);
    abfLabel_1.setForeground(Util.getColor(128, 128, 128));
    abfLabel_1.setText("fertig");
    abfLabel_1.setBounds(10, 145, 25, 13);

    textFertig = new Text(planungGroup, SWT.BORDER);
    textFertig.setBounds(41, 142, 41, 21);
    planungGroup.setTabList(new Control[] { textAbf, textBeiPat, textTermin, textAbfRT, textFertig });

    patientenzustandGroup = new Group(shell, SWT.NONE);
    transportdatenGroup
            .setTabList(new Control[] { textFromStreet, textFromCity, textPatientLastName, textPatientFirstName,
                    combokindOfTransport, textToStreet, textToCity, begleitpersonButton, button_stationary });
    patientenzustandGroup.setLayout(new FormLayout());
    final FormData fd_patientenzustandGroup = new FormData();
    fd_patientenzustandGroup.right = new FormAttachment(transportdatenGroup, -5, SWT.LEFT);
    fd_patientenzustandGroup.left = new FormAttachment(0, 104);
    fd_patientenzustandGroup.bottom = new FormAttachment(planungGroup, 182, SWT.TOP);
    fd_patientenzustandGroup.top = new FormAttachment(planungGroup, 0, SWT.TOP);
    patientenzustandGroup.setLayoutData(fd_patientenzustandGroup);
    patientenzustandGroup.setText("Wochentage");

    montagButton = new Button(patientenzustandGroup, SWT.CHECK);
    final FormData fd_montagButton = new FormData();
    fd_montagButton.top = new FormAttachment(0, 5);
    fd_montagButton.left = new FormAttachment(0, 5);
    montagButton.setLayoutData(fd_montagButton);
    montagButton.setText("Montag");

    dienstagButton = new Button(patientenzustandGroup, SWT.CHECK);
    final FormData fd_dienstagButton = new FormData();
    fd_dienstagButton.top = new FormAttachment(montagButton, 5, SWT.BOTTOM);
    fd_dienstagButton.left = new FormAttachment(montagButton, 0, SWT.LEFT);
    dienstagButton.setLayoutData(fd_dienstagButton);
    dienstagButton.setText("Dienstag");

    mittwochButton = new Button(patientenzustandGroup, SWT.CHECK);
    final FormData fd_mittwochButton = new FormData();
    fd_mittwochButton.top = new FormAttachment(dienstagButton, 5, SWT.BOTTOM);
    fd_mittwochButton.left = new FormAttachment(dienstagButton, 0, SWT.LEFT);
    mittwochButton.setLayoutData(fd_mittwochButton);
    mittwochButton.setText("Mittwoch");

    donnerstagButton = new Button(patientenzustandGroup, SWT.CHECK);
    final FormData fd_donnerstagButton = new FormData();
    fd_donnerstagButton.top = new FormAttachment(mittwochButton, 5, SWT.BOTTOM);
    fd_donnerstagButton.left = new FormAttachment(0, 5);
    donnerstagButton.setLayoutData(fd_donnerstagButton);
    donnerstagButton.setText("Donnerstag");

    freitagButton = new Button(patientenzustandGroup, SWT.CHECK);
    final FormData fd_freitagButton = new FormData();
    fd_freitagButton.top = new FormAttachment(donnerstagButton, 5, SWT.BOTTOM);
    fd_freitagButton.left = new FormAttachment(donnerstagButton, 0, SWT.LEFT);
    freitagButton.setLayoutData(fd_freitagButton);
    freitagButton.setText("Freitag");

    samstagButton = new Button(patientenzustandGroup, SWT.CHECK);
    final FormData fd_samstagButton = new FormData();
    fd_samstagButton.top = new FormAttachment(freitagButton, 5, SWT.BOTTOM);
    fd_samstagButton.left = new FormAttachment(0, 5);
    samstagButton.setLayoutData(fd_samstagButton);
    samstagButton.setText("Samstag");

    sonntagButton = new Button(patientenzustandGroup, SWT.CHECK);
    final FormData fd_sonntagButton = new FormData();
    fd_sonntagButton.top = new FormAttachment(samstagButton, 5, SWT.BOTTOM);
    fd_sonntagButton.left = new FormAttachment(0, 5);
    sonntagButton.setLayoutData(fd_sonntagButton);
    sonntagButton.setText("Sonntag");
    patientenzustandGroup.setTabList(new Control[] { montagButton, dienstagButton, mittwochButton,
            donnerstagButton, freitagButton, samstagButton, sonntagButton });

    abbrechenButton = new Button(shell, SWT.NONE);
    final FormData fd_abbrechenButton = new FormData();
    fd_abbrechenButton.left = new FormAttachment(0, 967);
    fd_abbrechenButton.right = new FormAttachment(0, 1063);
    fd_abbrechenButton.bottom = new FormAttachment(0, 326);
    fd_abbrechenButton.top = new FormAttachment(0, 303);
    abbrechenButton.setLayoutData(fd_abbrechenButton);
    abbrechenButton.setText("Abbrechen");
    // listener
    exitListener = new Listener() {

        public void handleEvent(Event e) {
            MessageBox dialog = new MessageBox(shell, SWT.YES | SWT.NO | SWT.ICON_QUESTION);
            dialog.setText("Abbrechen");
            dialog.setMessage("Wollen Sie wirklich abbrechen?");
            if (e.type == SWT.Close)
                e.doit = false;
            if (dialog.open() != SWT.YES)
                return;
            LockManager.removeLock(DialysisPatient.ID, dia.getId());
            shell.dispose();
        }
    };
    abbrechenButton.addListener(SWT.Selection, exitListener);

    okButton = new Button(shell, SWT.NONE);
    final FormData fd_okButton = new FormData();
    fd_okButton.bottom = new FormAttachment(0, 326);
    fd_okButton.top = new FormAttachment(0, 303);
    fd_okButton.right = new FormAttachment(0, 961);
    fd_okButton.left = new FormAttachment(0, 865);
    okButton.setLayoutData(fd_okButton);
    okButton.setText("OK");
    okButton.addListener(SWT.Selection, new Listener() {

        String requiredFields;

        int hourStart;
        int hourAtPatient;
        int hourTerm;
        int hourAbfRT;
        int hourReady;

        int minutesStart;
        int minutesAtPatient;
        int minutesTerm;
        int minutesAbfRT;
        int minutesReady;

        String term;
        String atPatient;
        String start;
        String abfRT;
        String ready;

        long termLong;
        long atPatientLong;
        long startLong;
        long abfRTLong;
        long readyLong;

        boolean montag;
        boolean dienstag;
        boolean mittwoch;
        boolean donnerstag;
        boolean freitag;
        boolean samstag;
        boolean sonntag;

        boolean assistant;

        boolean stationary;

        String toCommunity;
        String toStreet;

        String firstName;
        String lastName;

        String fromCommunity;
        String fromStreet;

        String formatOfTime;

        public void handleEvent(Event event) {
            String kindOfTransport = "";

            requiredFields = "";

            hourStart = -1;
            hourAtPatient = -1;
            hourTerm = -1;
            hourAbfRT = -1;
            hourReady = -1;

            minutesStart = -1;
            minutesAtPatient = -1;
            minutesTerm = -1;
            minutesAbfRT = -1;
            minutesReady = -1;

            formatOfTime = "";

            this.getContentOfAllFields();

            if (textPatientFirstName.getText().length() > 30) {
                this.displayMessageBox(event, "Bitte geben Sie einen Vornamen, der krzer 30 Zeichen ist, ein",
                        firstName);
                return;
            }

            if (textPatientLastName.getText().length() > 30) {
                this.displayMessageBox(event, "Bitte geben Sie einen Nachname, der krzer 30 Zeichen ist, ein",
                        lastName);
                return;
            }

            if (textToCity.getText().length() > 50) {
                this.displayMessageBox(event,
                        "Bitte geben Sie einen Stadt (nach) ein, der krzer 50Zeichen ist, ein", toCommunity);
                return;
            }
            if (textToStreet.getText().length() > 100) {
                this.displayMessageBox(event,
                        "Bitte geben Sie eine Strae (zu), der krzer 100 Zeichen ist, ein", toStreet);
                return;
            }

            if (textFromCity.getText().length() > 50) {
                this.displayMessageBox(event,
                        "Bitte geben Sie einen Stadt (von) ein, der krzer 50 Zeichen ist, ein", fromCommunity);
                return;
            }
            if (textFromStreet.getText().length() > 100) {
                this.displayMessageBox(event,
                        "Bitte geben Sie eine Strae (von), der krzer 100 Zeichen ist, ein", fromStreet);
                return;
            }

            // check required fields
            if (!this.checkRequiredFields().equalsIgnoreCase("")) {
                this.displayMessageBox(event, requiredFields, "Bitte noch folgende Mussfelder ausfllen:");
                return;
            }

            // validating
            if (!this.checkFormatOfTimeFields().equalsIgnoreCase("")) {
                this.displayMessageBox(event, formatOfTime, "Format von Transportzeiten falsch: ");
                return;
            }

            this.transformToLong();

            // validate: start before atPatient
            if (atPatientLong < startLong && !start.equalsIgnoreCase("") && !atPatient.equalsIgnoreCase("")) {
                this.displayMessageBox(event,
                        "Ankunft bei Patient kann nicht vor Abfahrtszeit des Fahrzeuges liegen",
                        "Fehler (Zeit)");
                return;
            }

            // validate: atPatient before term
            if ((termLong < atPatientLong && !term.equalsIgnoreCase("") && !atPatient.equalsIgnoreCase(""))) {
                this.displayMessageBox(event, "Termin kann nicht vor Ankunft bei Patient sein",
                        "Fehler (Zeit)");
                return;
            }

            // validate: start before term
            if (termLong < startLong && !term.equalsIgnoreCase("") && !start.equalsIgnoreCase("")) {
                this.displayMessageBox(event, "Termin kann nicht vor Abfahrtszeit des Fahrzeuges liegen",
                        "Fehler (Zeit)");
                return;
            }

            // validate: abfRT before ready
            if (readyLong < abfRTLong && !abfRT.equalsIgnoreCase("") && !ready.equalsIgnoreCase("")) {
                this.displayMessageBox(event, "Abholzeit (fertig) kann nicht vor Abfahrtszeit liegen",
                        "Fehler (Zeit)");
                return;
            }

            // set the kind of transport
            // the kind of transport
            int index = combokindOfTransport.getSelectionIndex();
            if (index != -1)
                kindOfTransport = combokindOfTransport.getItem(index);

            if (createNew) {
                dia = new DialysisPatient();
                dia.setAppointmentTimeAtDialysis(termLong);

                Patient patient = new Patient();
                patient.setFirstname(firstName);
                patient.setLastname(lastName);
                dia.setPatient(patient);

                dia.setFromCity(fromCommunity);
                dia.setFromStreet(fromStreet);
                dia.setInsurance("Versicherung unbekannt");
                if (kindOfTransport != null)
                    dia.setKindOfTransport(kindOfTransport);

                index = zustaendigeOrtsstelle.getCombo().getSelectionIndex();
                dia.setLocation((Location) zustaendigeOrtsstelle.getElementAt(index));

                dia.setPlannedStartForBackTransport(abfRTLong);
                dia.setPlannedStartOfTransport(startLong);
                dia.setPlannedTimeAtPatient(atPatientLong);
                dia.setReadyTime(readyLong);
                dia.setStationary(stationary);
                dia.setToCity(toCommunity);
                dia.setToStreet(toStreet);

                dia.setMonday(montag);
                dia.setTuesday(dienstag);
                dia.setWednesday(mittwoch);
                dia.setThursday(donnerstag);
                dia.setFriday(freitag);
                dia.setSaturday(samstag);
                dia.setSunday(sonntag);

                dia.setAssistantPerson(assistant);
                NetWrapper.getDefault().sendAddMessage(DialysisPatient.ID, dia);
            } else {
                dia.setAppointmentTimeAtDialysis(termLong);

                Patient patient = new Patient();
                patient.setFirstname(firstName);
                patient.setLastname(lastName);
                dia.setPatient(patient);
                dia.setFromCity(fromCommunity);
                dia.setFromStreet(fromStreet);
                if (kindOfTransport != null)
                    dia.setKindOfTransport(kindOfTransport);
                dia.setPlannedStartForBackTransport(abfRTLong);
                dia.setPlannedStartOfTransport(startLong);
                dia.setPlannedTimeAtPatient(atPatientLong);
                dia.setReadyTime(readyLong);
                dia.setStationary(stationary);
                dia.setToCity(toCommunity);
                dia.setToStreet(toStreet);

                dia.setMonday(montag);
                dia.setTuesday(dienstag);
                dia.setWednesday(mittwoch);
                dia.setThursday(donnerstag);
                dia.setFriday(freitag);
                dia.setSaturday(samstag);
                dia.setSunday(sonntag);

                dia.setAssistantPerson(assistant);

                NetWrapper.getDefault().sendUpdateMessage(DialysisPatient.ID, dia);
            }
            LockManager.removeLock(DialysisPatient.ID, dia.getId());
            shell.close();
        }

        private void getContentOfAllFields() {
            montag = montagButton.getSelection();
            dienstag = dienstagButton.getSelection();
            mittwoch = mittwochButton.getSelection();
            donnerstag = donnerstagButton.getSelection();
            freitag = freitagButton.getSelection();
            samstag = samstagButton.getSelection();
            sonntag = sonntagButton.getSelection();

            assistant = begleitpersonButton.getSelection();

            stationary = button_stationary.getSelection();

            term = textTermin.getText();
            atPatient = textBeiPat.getText();
            start = textAbf.getText();
            abfRT = textAbfRT.getText();
            ready = textFertig.getText();

            toCommunity = textToCity.getText();
            toStreet = textToStreet.getText();
            firstName = textPatientFirstName.getText();
            lastName = textPatientLastName.getText();
            fromCommunity = textFromCity.getText();
            fromStreet = textFromStreet.getText();
        }

        private String checkRequiredFields() {
            if (fromStreet.equalsIgnoreCase(""))
                requiredFields = requiredFields + " " + "von Strae";
            if (fromCommunity.equalsIgnoreCase(""))
                requiredFields = requiredFields + " " + "von Ort";
            if (toStreet.equalsIgnoreCase(""))
                requiredFields = requiredFields + " " + "Zielort";
            // the planned location
            int index = zustaendigeOrtsstelle.getCombo().getSelectionIndex();
            if (index == -1)
                requiredFields = requiredFields + "zustndige Ortsstelle";

            if (start.equalsIgnoreCase(""))
                requiredFields = requiredFields + " " + "Abfahrtszeit";
            if (atPatient.equalsIgnoreCase(""))
                requiredFields = requiredFields + " " + "Zeit bei Patient";
            if (term.equalsIgnoreCase(""))
                requiredFields = requiredFields + " " + "Termin Dialyse";
            if (abfRT.equalsIgnoreCase(""))
                requiredFields = requiredFields + " " + "Abfahrt fr Rcktransport";
            if (ready.equalsIgnoreCase(""))
                requiredFields = requiredFields + " " + "Abholzeit (fertig)";
            return requiredFields;
        }

        private String checkFormatOfTimeFields() {
            Pattern p4 = Pattern.compile("(\\d{2})(\\d{2})");// if content
            // is e.g.
            // 1234
            Pattern p5 = Pattern.compile("(\\d{2}):(\\d{2})");// if content
            // is e.g.
            // 12:34

            // check in
            if (!start.equalsIgnoreCase("")) {
                Matcher m41 = p4.matcher(start);
                Matcher m51 = p5.matcher(start);
                if (m41.matches()) {
                    hourStart = Integer.parseInt(m41.group(1));
                    minutesStart = Integer.parseInt(m41.group(2));

                    if (hourStart >= 0 && hourStart <= 23 && minutesStart >= 0 && minutesStart <= 59) {
                        start = hourStart + ":" + minutesStart;// for the
                        // splitter
                    } else {
                        formatOfTime = " - Abfahrtszeit";
                    }
                } else if (m51.matches()) {
                    hourStart = Integer.parseInt(m51.group(1));
                    minutesStart = Integer.parseInt(m51.group(2));

                    if (!(hourStart >= 0 && hourStart <= 23 && minutesStart >= 0 && minutesStart <= 59)) {
                        formatOfTime = " - Abfahrtszeit";
                    }
                } else {
                    formatOfTime = " - Abfahrtszeit";
                }
            }

            // at patient
            if (!atPatient.equalsIgnoreCase("")) {
                Matcher m42 = p4.matcher(atPatient);
                Matcher m52 = p5.matcher(atPatient);
                if (m42.matches()) {
                    hourAtPatient = Integer.parseInt(m42.group(1));
                    minutesAtPatient = Integer.parseInt(m42.group(2));

                    if (hourAtPatient >= 0 && hourAtPatient <= 23 && minutesAtPatient >= 0
                            && minutesAtPatient <= 59) {
                        atPatient = hourAtPatient + ":" + minutesAtPatient;
                    } else {
                        formatOfTime = formatOfTime + "Ankunft bei Patient (Zeit)";
                    }
                } else if (m52.matches()) {
                    hourAtPatient = Integer.parseInt(m52.group(1));
                    minutesAtPatient = Integer.parseInt(m52.group(2));

                    if (!(hourAtPatient >= 0 && hourAtPatient <= 23 && minutesAtPatient >= 0
                            && minutesAtPatient <= 59)) {
                        formatOfTime = formatOfTime + "Ankunft bei Patient (Zeit)";
                    }
                } else {
                    formatOfTime = formatOfTime + "Ankunft bei Patient (Zeit)";
                }
            }

            // term
            if (!term.equalsIgnoreCase("")) {
                Matcher m42 = p4.matcher(term);
                Matcher m52 = p5.matcher(term);
                if (m42.matches()) {
                    hourTerm = Integer.parseInt(m42.group(1));
                    minutesTerm = Integer.parseInt(m42.group(2));

                    if (hourTerm >= 0 && hourTerm <= 23 && minutesTerm >= 0 && minutesTerm <= 59) {
                        term = hourTerm + ":" + minutesTerm;
                    } else {
                        formatOfTime = formatOfTime + "Terminzeit";
                    }
                } else if (m52.matches()) {
                    hourTerm = Integer.parseInt(m52.group(1));
                    minutesTerm = Integer.parseInt(m52.group(2));

                    if (!(hourTerm >= 0 && hourTerm <= 23 && minutesTerm >= 0 && minutesTerm <= 59)) {
                        formatOfTime = formatOfTime + "Terminzeit";
                    }
                } else {
                    formatOfTime = formatOfTime + "Terminzeit";
                }
            }

            // abf RT
            if (!abfRT.equalsIgnoreCase("")) {
                Matcher m42 = p4.matcher(abfRT);
                Matcher m52 = p5.matcher(abfRT);
                if (m42.matches()) {
                    hourAbfRT = Integer.parseInt(m42.group(1));
                    minutesAbfRT = Integer.parseInt(m42.group(2));

                    if (hourAbfRT >= 0 && hourAbfRT <= 23 && minutesAbfRT >= 0 && minutesAbfRT <= 59) {
                        abfRT = hourAbfRT + ":" + minutesAbfRT;
                    } else {
                        formatOfTime = formatOfTime + "Abfahrt Rcktransport";
                    }
                } else if (m52.matches()) {
                    hourAbfRT = Integer.parseInt(m52.group(1));
                    minutesAbfRT = Integer.parseInt(m52.group(2));

                    if (!(hourAbfRT >= 0 && hourAbfRT <= 23 && minutesAbfRT >= 0 && minutesAbfRT <= 59)) {
                        formatOfTime = formatOfTime + "Abfahrt Rcktransport";
                    }
                } else {
                    formatOfTime = formatOfTime + "Abfahrt Rcktransport";
                }
            }

            // fertig
            if (!ready.equalsIgnoreCase("")) {
                Matcher m42 = p4.matcher(ready);
                Matcher m52 = p5.matcher(ready);
                if (m42.matches()) {
                    hourReady = Integer.parseInt(m42.group(1));
                    minutesReady = Integer.parseInt(m42.group(2));

                    if (hourReady >= 0 && hourReady <= 23 && minutesReady >= 0 && minutesReady <= 59) {
                        ready = hourReady + ":" + minutesReady;
                    } else {
                        formatOfTime = formatOfTime + "Ankunft bei Patient (Zeit)";
                    }
                } else if (m52.matches()) {
                    hourReady = Integer.parseInt(m52.group(1));
                    minutesReady = Integer.parseInt(m52.group(2));

                    if (!(hourReady >= 0 && hourReady <= 23 && minutesReady >= 0 && minutesReady <= 59)) {
                        formatOfTime = formatOfTime + "Zeit fertig";
                    }
                } else {
                    formatOfTime = formatOfTime + "Zeit fertig";
                }
            }
            return formatOfTime;
        }

        private void transformToLong() {
            // get a new instance of the calendar
            GregorianCalendar cal = new GregorianCalendar();

            if (!term.equalsIgnoreCase("")) {
                String[] theTerm = term.split(":");

                int hoursTerm = Integer.valueOf(theTerm[0]).intValue();
                int minutesTerm = Integer.valueOf(theTerm[1]).intValue();

                cal.set(GregorianCalendar.HOUR_OF_DAY, hoursTerm);
                cal.set(GregorianCalendar.MINUTE, minutesTerm);

                termLong = cal.getTimeInMillis();
            }

            if (!atPatient.equalsIgnoreCase("")) {
                String[] theTimeAtPatient = atPatient.split(":");
                int hourstheTimeAtPatient = Integer.valueOf(theTimeAtPatient[0]).intValue();
                int minutestheTimeAtPatient = Integer.valueOf(theTimeAtPatient[1]).intValue();

                cal.set(GregorianCalendar.HOUR_OF_DAY, hourstheTimeAtPatient);
                cal.set(GregorianCalendar.MINUTE, minutestheTimeAtPatient);

                atPatientLong = cal.getTimeInMillis();
            }

            if (!start.equalsIgnoreCase("")) {
                String[] theStartTime = start.split(":");
                int hourstheStartTime = Integer.valueOf(theStartTime[0]).intValue();
                int minutestheStartTime = Integer.valueOf(theStartTime[1]).intValue();

                cal.set(GregorianCalendar.HOUR_OF_DAY, hourstheStartTime);
                cal.set(GregorianCalendar.MINUTE, minutestheStartTime);

                startLong = cal.getTimeInMillis();
            }

            if (!abfRT.equalsIgnoreCase("")) {
                String[] theAbfRTTime = abfRT.split(":");
                int hourstheAbfRTTime = Integer.valueOf(theAbfRTTime[0]).intValue();
                int minutestheAbfRTTime = Integer.valueOf(theAbfRTTime[1]).intValue();

                cal.set(GregorianCalendar.HOUR_OF_DAY, hourstheAbfRTTime);
                cal.set(GregorianCalendar.MINUTE, minutestheAbfRTTime);

                abfRTLong = cal.getTimeInMillis();
            }

            if (!ready.equalsIgnoreCase("")) {
                String[] theReadyTime = ready.split(":");
                int hourstheReadyTime = Integer.valueOf(theReadyTime[0]).intValue();
                int minutestheReadyTime = Integer.valueOf(theReadyTime[1]).intValue();

                cal.set(GregorianCalendar.HOUR_OF_DAY, hourstheReadyTime);
                cal.set(GregorianCalendar.MINUTE, minutestheReadyTime);

                readyLong = cal.getTimeInMillis();
            }

        }

        private void displayMessageBox(Event event, String fields, String message) {
            MessageBox mb = new MessageBox(shell, 0);
            mb.setText(message);
            mb.setMessage(fields);
            mb.open();
            if (event.type == SWT.Close)
                event.doit = false;
        }

    });

    dialysetransportLabel = new Label(shell, SWT.NONE);
    dialysetransportLabel.setBackground(SWTResourceManager.getColor(255, 255, 255));
    dialysetransportLabel.setFont(SWTResourceManager.getFont("", 10, SWT.BOLD));
    final FormData fd_dialysetransportLabel = new FormData();
    fd_dialysetransportLabel.bottom = new FormAttachment(0, 26);
    fd_dialysetransportLabel.right = new FormAttachment(0, 122);
    fd_dialysetransportLabel.top = new FormAttachment(0, 10);
    fd_dialysetransportLabel.left = new FormAttachment(0, 9);
    dialysetransportLabel.setLayoutData(fd_dialysetransportLabel);
    dialysetransportLabel.setText("Dialysepatient");

    dialysetransportBearbeitenLabel = new Label(shell, SWT.NONE);
    dialysetransportBearbeitenLabel.setBackground(SWTResourceManager.getColor(255, 255, 255));
    final FormData fd_dialysetransportBearbeitenLabel = new FormData();
    fd_dialysetransportBearbeitenLabel.right = new FormAttachment(0, 481);
    fd_dialysetransportBearbeitenLabel.bottom = new FormAttachment(0, 65);
    fd_dialysetransportBearbeitenLabel.top = new FormAttachment(0, 47);
    fd_dialysetransportBearbeitenLabel.left = new FormAttachment(0, 9);
    dialysetransportBearbeitenLabel.setLayoutData(fd_dialysetransportBearbeitenLabel);
    dialysetransportBearbeitenLabel.setText(
            "Hier knnen sie Dialysepatienten und die zugehrigen Transportdaten anlegen oder bearbeiten.");

    composite = new Composite(shell, SWT.NONE);
    composite.setBackground(SWTResourceManager.getColor(255, 255, 255));
    final FormData fd_composite = new FormData();
    fd_composite.right = new FormAttachment(0, 1076);
    fd_composite.bottom = new FormAttachment(0, 76);
    fd_composite.top = new FormAttachment(0, 0);
    fd_composite.left = new FormAttachment(0, 0);
    composite.setLayoutData(fd_composite);
    composite.setLayout(new FormLayout());

    final Label label_1 = new Label(composite, SWT.NONE);
    final FormData fd_label_1 = new FormData();
    fd_label_1.left = new FormAttachment(0, 986);
    fd_label_1.right = new FormAttachment(0, 1075);
    fd_label_1.bottom = new FormAttachment(0, 75);
    fd_label_1.top = new FormAttachment(0, 1);
    label_1.setLayoutData(fd_label_1);
    label_1.setBackgroundImage(ImageFactory.getInstance().getRegisteredImage("application.logo"));
    shell.setTabList(new Control[] { planungGroup, patientenzustandGroup, transportdatenGroup, okButton,
            abbrechenButton, dialysetransportLabel, dialysetransportBearbeitenLabel, composite });
}

From source file:at.rc.tacos.client.view.TransportForm.java

License:Open Source License

/**
 * Creates the planing section/*from   ww  w .  j a va  2  s. c o  m*/
 */
private void createTransportSection(Composite parent) {
    client = new Composite(parent, SWT.NONE);
    client.setLayout(new FormLayout());
    // calendar
    dateTime = new DateTime(client, SWT.CALENDAR);
    final FormData fd_dateTime = new FormData();
    fd_dateTime.bottom = new FormAttachment(0, 160);
    fd_dateTime.top = new FormAttachment(0, 10);
    fd_dateTime.right = new FormAttachment(0, 187);
    fd_dateTime.left = new FormAttachment(0, 10);
    dateTime.setLayoutData(fd_dateTime);

    // group 'Transportdaten'
    transportdatenGroup = new Group(client, SWT.NONE);
    transportdatenGroup.setLayout(new FormLayout());
    final FormData fd_transportdatenGroup = new FormData();
    fd_transportdatenGroup.bottom = new FormAttachment(0, 160);
    fd_transportdatenGroup.top = new FormAttachment(0, 10);
    fd_transportdatenGroup.right = new FormAttachment(0, 1056);
    fd_transportdatenGroup.left = new FormAttachment(0, 194);
    transportdatenGroup.setLayoutData(fd_transportdatenGroup);
    transportdatenGroup.setForeground(Util.getColor(128, 128, 128));
    transportdatenGroup.setText("Transportdaten");

    final Label vonLabel = new Label(transportdatenGroup, SWT.NONE);
    vonLabel.setFont(CustomColors.SUBHEADER_FONT);
    final FormData fd_vonLabel = new FormData();
    fd_vonLabel.bottom = new FormAttachment(0, 42);
    fd_vonLabel.top = new FormAttachment(0, 29);
    fd_vonLabel.right = new FormAttachment(0, 32);
    fd_vonLabel.left = new FormAttachment(0, 7);

    vonLabel.setLayoutData(fd_vonLabel);
    vonLabel.setForeground(Util.getColor(0, 0, 255));
    vonLabel.setText("von:");

    textToStreet = new Text(transportdatenGroup, SWT.WRAP | SWT.MULTI | SWT.BORDER);
    final FormData fd_comboNachStrasse = new FormData();
    fd_comboNachStrasse.right = new FormAttachment(0, 260);
    fd_comboNachStrasse.bottom = new FormAttachment(0, 74);
    fd_comboNachStrasse.top = new FormAttachment(0, 53);
    fd_comboNachStrasse.left = new FormAttachment(0, 38);
    textToStreet.setLayoutData(fd_comboNachStrasse);
    textToStreet.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            // no action when the enter key is pressed
            if (e.keyCode == 13) {
                e.doit = false;
                return;
            }
            // go to the next field when the tab is pressed
            if (e.keyCode == 9) {
                textToCity.setFocus();
                e.doit = false;
                return;
            }
            inputChanged(textToStreet.getText(), IFilterTypes.SEARCH_STRING_STREET);
        }
    });
    acToStreet = new AutoCompleteField(textToStreet, new TextContentAdapter(), new String[] {});

    final Button buttonAddressFrom = new Button(transportdatenGroup, SWT.NONE);
    final FormData fd_buttonAddressFrom = new FormData();
    fd_buttonAddressFrom.bottom = new FormAttachment(0, 47);
    fd_buttonAddressFrom.top = new FormAttachment(0, 26);
    fd_buttonAddressFrom.right = new FormAttachment(0, 452);
    fd_buttonAddressFrom.left = new FormAttachment(0, 422);
    buttonAddressFrom.setLayoutData(fd_buttonAddressFrom);
    buttonAddressFrom.setText("...");
    buttonAddressFrom.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            // setup and prepare the initial value
            String initStreetValue = textFromStreet.getText();
            String initCityValue = textFromCity.getText();

            // open the selection dialog to choose a address
            AddressSelectionDialog selectionDialog = new AddressSelectionDialog(initStreetValue, initCityValue,
                    getShell());
            selectionDialog.open();
            Address selectedAddress = (Address) selectionDialog.getResult()[0];

            // assert valid
            if (selectedAddress == null)
                return;

            // fill in the form fields
            if (selectedAddress.getStreet() != null)
                textFromStreet.setText(selectedAddress.getStreet());
            if (selectedAddress.getCity() != null)
                textFromCity.setText(selectedAddress.getCity());
        }
    });

    final Button buttonAddressTo = new Button(transportdatenGroup, SWT.NONE);
    final FormData fd_buttonAddressTo = new FormData();
    fd_buttonAddressTo.bottom = new FormAttachment(0, 74);
    fd_buttonAddressTo.top = new FormAttachment(0, 53);
    fd_buttonAddressTo.right = new FormAttachment(0, 452);
    fd_buttonAddressTo.left = new FormAttachment(0, 422);
    buttonAddressTo.setLayoutData(fd_buttonAddressTo);
    buttonAddressTo.setText("...");
    buttonAddressTo.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            // setup and prepare the initial value
            String initStreetValue = textToStreet.getText();
            String initCityValue = textToCity.getText();

            // open the selection dialog to choose a address
            AddressSelectionDialog selectionDialog = new AddressSelectionDialog(initStreetValue, initCityValue,
                    getShell());
            selectionDialog.open();
            Address selectedAddress = (Address) selectionDialog.getResult()[0];

            // assert valid
            if (selectedAddress == null)
                return;

            // fill in the form fields
            if (selectedAddress.getStreet() != null)
                textToStreet.setText(selectedAddress.getStreet());
            if (selectedAddress.getCity() != null)
                textToCity.setText(selectedAddress.getCity());
        }
    });

    textFromStreet = new Text(transportdatenGroup, SWT.WRAP | SWT.MULTI | SWT.BORDER);
    final FormData fd_comboVonStrasse = new FormData();
    fd_comboVonStrasse.right = new FormAttachment(0, 260);
    fd_comboVonStrasse.bottom = new FormAttachment(0, 47);
    fd_comboVonStrasse.top = new FormAttachment(0, 26);
    fd_comboVonStrasse.left = new FormAttachment(0, 38);
    textFromStreet.setLayoutData(fd_comboVonStrasse);
    textFromStreet.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            // no action when the enter key is pressed
            if (e.keyCode == 13) {
                e.doit = false;
                return;
            }
            // go to the next field when the tab is pressed
            if (e.keyCode == 9) {
                textFromCity.setFocus();
                e.doit = false;
                return;
            }
            inputChanged(textFromStreet.getText(), IFilterTypes.SEARCH_STRING_STREET);
        }
    });
    acFromStreet = new AutoCompleteField(textFromStreet, new TextContentAdapter(), new String[] {});

    final Label nachLabel = new Label(transportdatenGroup, SWT.NONE);
    final FormData fd_nachLabel = new FormData();
    fd_nachLabel.bottom = new FormAttachment(0, 69);
    fd_nachLabel.top = new FormAttachment(0, 56);
    fd_nachLabel.right = new FormAttachment(0, 32);
    fd_nachLabel.left = new FormAttachment(0, 7);
    nachLabel.setLayoutData(fd_nachLabel);
    nachLabel.setForeground(Util.getColor(128, 128, 128));
    nachLabel.setText("nach:");

    final Label label = new Label(transportdatenGroup, SWT.NONE);
    final FormData fd_label = new FormData();
    fd_label.bottom = new FormAttachment(0, 20);
    fd_label.top = new FormAttachment(0, 7);
    fd_label.right = new FormAttachment(0, 94);
    fd_label.left = new FormAttachment(0, 38);
    label.setLayoutData(fd_label);
    label.setForeground(Util.getColor(128, 128, 128));
    label.setText("Strae");

    textFromCity = new Text(transportdatenGroup, SWT.WRAP | SWT.MULTI | SWT.BORDER);
    final FormData fd_comboVonOrt = new FormData();
    fd_comboVonOrt.left = new FormAttachment(0, 264);
    fd_comboVonOrt.bottom = new FormAttachment(0, 47);
    fd_comboVonOrt.top = new FormAttachment(0, 26);
    fd_comboVonOrt.right = new FormAttachment(0, 420);
    textFromCity.setLayoutData(fd_comboVonOrt);
    textFromCity.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            // no action when the enter key is pressed
            if (e.keyCode == 13) {
                e.doit = false;
                return;
            }
            // go to the next field when the tab is pressed
            if (e.keyCode == 9) {
                patientLastName.setFocus();
                e.doit = false;
                return;
            }
            inputChanged(textFromCity.getText(), IFilterTypes.SEARCH_STRING_CITY);
        }
    });
    acFromCity = new AutoCompleteField(textFromCity, new TextContentAdapter(), new String[] {});

    textToCity = new Text(transportdatenGroup, SWT.WRAP | SWT.MULTI | SWT.BORDER);
    final FormData fd_comboNachOrt = new FormData();
    fd_comboNachOrt.left = new FormAttachment(0, 264);
    fd_comboNachOrt.bottom = new FormAttachment(0, 74);
    fd_comboNachOrt.top = new FormAttachment(0, 53);
    fd_comboNachOrt.right = new FormAttachment(0, 420);
    textToCity.setLayoutData(fd_comboNachOrt);
    textToCity.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            // no action when the enter key is pressed
            if (e.keyCode == 13) {
                e.doit = false;
                return;
            }
            // go to the next field when the tab is pressed
            if (e.keyCode == 9) {
                ruecktransportMoeglichButton.setFocus();
                e.doit = false;
                return;
            }
            inputChanged(textToCity.getText(), IFilterTypes.SEARCH_STRING_CITY);
        }
    });
    acToCity = new AutoCompleteField(textToCity, new TextContentAdapter(), new String[] {});

    final Label ortLabel = new Label(transportdatenGroup, SWT.NONE);
    final FormData fd_ortLabel = new FormData();
    fd_ortLabel.bottom = new FormAttachment(0, 20);
    fd_ortLabel.top = new FormAttachment(0, 7);
    fd_ortLabel.right = new FormAttachment(0, 344);
    fd_ortLabel.left = new FormAttachment(0, 319);
    ortLabel.setLayoutData(fd_ortLabel);
    ortLabel.setForeground(Util.getColor(128, 128, 128));
    ortLabel.setText("Ort");

    patientLastName = new Text(transportdatenGroup, SWT.WRAP | SWT.MULTI | SWT.BORDER);
    final FormData fd_comboNachname = new FormData();
    fd_comboNachname.bottom = new FormAttachment(0, 47);
    fd_comboNachname.top = new FormAttachment(0, 26);
    fd_comboNachname.right = new FormAttachment(0, 635);
    fd_comboNachname.left = new FormAttachment(0, 464);
    patientLastName.setLayoutData(fd_comboNachname);
    patientLastName.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            // no action when the enter key is pressed
            if (e.keyCode == 13) {
                e.doit = false;
                return;
            }
            // go to the next field when the tab is pressed
            if (e.keyCode == 9) {
                patientFirstName.setFocus();
                e.doit = false;
                return;
            }
        }
    });

    final Label nachnameLabel = new Label(transportdatenGroup, SWT.NONE);
    final FormData fd_nachnameLabel = new FormData();
    fd_nachnameLabel.bottom = new FormAttachment(0, 20);
    fd_nachnameLabel.top = new FormAttachment(0, 7);
    fd_nachnameLabel.right = new FormAttachment(0, 520);
    fd_nachnameLabel.left = new FormAttachment(0, 464);
    nachnameLabel.setLayoutData(fd_nachnameLabel);
    nachnameLabel.setForeground(Util.getColor(128, 128, 128));
    nachnameLabel.setText("Nachname");

    patientFirstName = new Text(transportdatenGroup, SWT.WRAP | SWT.MULTI | SWT.BORDER);
    final FormData fd_vornameVorname = new FormData();
    fd_vornameVorname.bottom = new FormAttachment(0, 47);
    fd_vornameVorname.top = new FormAttachment(0, 26);
    fd_vornameVorname.right = new FormAttachment(0, 812);
    fd_vornameVorname.left = new FormAttachment(0, 641);
    patientFirstName.setLayoutData(fd_vornameVorname);
    patientFirstName.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            // no action when the enter key is pressed
            if (e.keyCode == 13) {
                e.doit = false;
                return;
            }
            // go to the next field when the tab is pressed
            if (e.keyCode == 9) {
                combokindOfTransport.setFocus();
                e.doit = false;
                return;
            }
        }
    });

    final Button buttonPatientendatenPruefen = new Button(transportdatenGroup, SWT.NONE);
    final FormData fd_buttonPatientendatenPruefen = new FormData();
    fd_buttonPatientendatenPruefen.bottom = new FormAttachment(0, 47);
    fd_buttonPatientendatenPruefen.top = new FormAttachment(0, 24);
    fd_buttonPatientendatenPruefen.right = new FormAttachment(0, 850);
    fd_buttonPatientendatenPruefen.left = new FormAttachment(0, 818);
    buttonPatientendatenPruefen.setLayoutData(fd_buttonPatientendatenPruefen);
    buttonPatientendatenPruefen.setText("...");
    buttonPatientendatenPruefen.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            if (Login.AUTH_ADMIN.equalsIgnoreCase(authorization) && "journal".equalsIgnoreCase(editingType)) {
                if (patientLastName.getText() == null || patientLastName.getText().trim().isEmpty()) {
                    // getShell().getDisplay().beep();
                    setErrorMessage(
                            "Der Nachname kann beim Anlegen eines Patienten in der Patientendatenbank nicht leer gelassen werden.");
                    return;
                }

                // confirm the cancel
                boolean cancelConfirmed = MessageDialog.openQuestion(
                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Patient hinzufgen",
                        "Mchten Sie diesen Patienten zur Patientendatenbank hinzufgen?");
                if (!cancelConfirmed)
                    return;

                // TODO: add the patient data as new sick person, but check
                // before!!
                SickPerson person = new SickPerson();
                person.setLastName(patientLastName.getText());
                person.setFirstName(patientFirstName.getText());
                person.setCityname(textFromCity.getText());
                person.setStreetname(textFromStreet.getText());
                person.setKindOfTransport(combokindOfTransport.getText());

                NetWrapper.getDefault().sendAddMessage(SickPerson.ID, person);
            } else {
                // open the selection dialog to choose a patient
                PatientSelectionDialog selectionDialog = new PatientSelectionDialog(patientLastName.getText(),
                        getShell());
                selectionDialog.open();
                SickPerson selectedPerson = (SickPerson) selectionDialog.getResult()[0];

                // assert valid
                if (selectedPerson == null)
                    return;

                if (selectedPerson.getFirstName() != null)
                    patientFirstName.setText(selectedPerson.getFirstName());
                if (selectedPerson.getLastName() != null)
                    patientLastName.setText(selectedPerson.getLastName());
                if (selectedPerson.getStreetname() != null)
                    textFromStreet.setText(selectedPerson.getStreetname());
                if (selectedPerson.getCityname() != null)
                    textFromCity.setText(selectedPerson.getCityname());
                if (selectedPerson.getKindOfTransport() != null)
                    combokindOfTransport.setText(selectedPerson.getKindOfTransport());
                if (selectedPerson.getNotes() != null)
                    textAnmerkungen.setText(selectedPerson.getNotes());
            }
        }
    });

    // no sick person editing from the journal transport form if the user is
    // a normal user
    if ("journal".equalsIgnoreCase(editingType))
        buttonPatientendatenPruefen.setEnabled(false);

    if (Login.AUTH_ADMIN.equalsIgnoreCase(authorization) && "journal".equalsIgnoreCase(editingType)) {
        buttonPatientendatenPruefen.setImage(ImageFactory.getInstance().getRegisteredImage("admin.patientAdd"));
        buttonPatientendatenPruefen.setEnabled(true);
    }

    final Label nachnameLabel_1 = new Label(transportdatenGroup, SWT.NONE);
    final FormData fd_nachnameLabel_1 = new FormData();
    fd_nachnameLabel_1.bottom = new FormAttachment(0, 20);
    fd_nachnameLabel_1.top = new FormAttachment(0, 7);
    fd_nachnameLabel_1.right = new FormAttachment(0, 697);
    fd_nachnameLabel_1.left = new FormAttachment(0, 641);
    nachnameLabel_1.setLayoutData(fd_nachnameLabel_1);
    nachnameLabel_1.setForeground(Util.getColor(128, 128, 128));
    nachnameLabel_1.setText("Vorname");

    final Label label_kind = new Label(transportdatenGroup, SWT.NONE);
    final FormData fd_label_kind = new FormData();
    fd_label_kind.left = new FormAttachment(0, 680);
    fd_label_kind.bottom = new FormAttachment(0, 69);
    fd_label_kind.top = new FormAttachment(0, 56);
    fd_label_kind.right = new FormAttachment(0, 752);
    label_kind.setLayoutData(fd_label_kind);
    label_kind.setText("Transportart:");

    combokindOfTransport = new Combo(transportdatenGroup, SWT.READ_ONLY);
    // set possible priorities
    String[] kindsOfTransport = { TRANSPORT_KIND_GEHEND, TRANSPORT_KIND_TRAGSESSEL, TRANSPORT_KIND_KRANKENTRAGE,
            TRANSPORT_KIND_ROLLSTUHL };
    combokindOfTransport.setItems(kindsOfTransport);

    final FormData fd_comboTransportKind = new FormData();
    fd_comboTransportKind.bottom = new FormAttachment(0, 74);
    fd_comboTransportKind.top = new FormAttachment(0, 53);
    fd_comboTransportKind.right = new FormAttachment(0, 850);
    fd_comboTransportKind.left = new FormAttachment(0, 753);
    combokindOfTransport.setLayoutData(fd_comboTransportKind);

    begleitpersonButton = new Button(transportdatenGroup, SWT.CHECK);
    final FormData fd_begleitpersonButton = new FormData();
    fd_begleitpersonButton.bottom = new FormAttachment(0, 116);
    fd_begleitpersonButton.top = new FormAttachment(0, 100);
    fd_begleitpersonButton.right = new FormAttachment(0, 583);
    fd_begleitpersonButton.left = new FormAttachment(0, 462);
    begleitpersonButton.setLayoutData(fd_begleitpersonButton);
    begleitpersonButton.setToolTipText("Begleitperson");
    begleitpersonButton.setText("Begleitperson");

    ruecktransportMoeglichButton = new Button(transportdatenGroup, SWT.CHECK);
    final FormData fd_button_1 = new FormData();
    fd_button_1.bottom = new FormAttachment(0, 96);
    fd_button_1.top = new FormAttachment(0, 80);
    fd_button_1.right = new FormAttachment(0, 159);
    fd_button_1.left = new FormAttachment(0, 38);
    ruecktransportMoeglichButton.setLayoutData(fd_button_1);
    ruecktransportMoeglichButton.setText("Rcktransport mglich");

    final Label anruferLabel = new Label(transportdatenGroup, SWT.NONE);
    final FormData fd_anruferLabel = new FormData();
    fd_anruferLabel.bottom = new FormAttachment(0, 95);
    fd_anruferLabel.top = new FormAttachment(0, 82);
    fd_anruferLabel.right = new FormAttachment(0, 657);
    fd_anruferLabel.left = new FormAttachment(0, 610);
    anruferLabel.setLayoutData(fd_anruferLabel);
    anruferLabel.setForeground(Util.getColor(128, 128, 128));
    anruferLabel.setText("Anrufer:");

    textAnrufer = new Text(transportdatenGroup, SWT.BORDER);
    final FormData fd_textAnrufer = new FormData();
    fd_textAnrufer.bottom = new FormAttachment(0, 97);
    fd_textAnrufer.top = new FormAttachment(0, 76);
    fd_textAnrufer.right = new FormAttachment(0, 850);
    fd_textAnrufer.left = new FormAttachment(0, 663);
    textAnrufer.setLayoutData(fd_textAnrufer);

    final Label telefonLabel = new Label(transportdatenGroup, SWT.NONE);
    final FormData fd_telefonLabel = new FormData();
    fd_telefonLabel.bottom = new FormAttachment(0, 115);
    fd_telefonLabel.top = new FormAttachment(0, 102);
    fd_telefonLabel.right = new FormAttachment(0, 657);
    fd_telefonLabel.left = new FormAttachment(0, 610);
    telefonLabel.setLayoutData(fd_telefonLabel);
    telefonLabel.setForeground(Util.getColor(128, 128, 128));
    telefonLabel.setText("Telefon:");

    textTelefonAnrufer = new Text(transportdatenGroup, SWT.BORDER);
    final FormData fd_textTelefonAnrufer = new FormData();
    fd_textTelefonAnrufer.bottom = new FormAttachment(0, 120);
    fd_textTelefonAnrufer.top = new FormAttachment(0, 99);
    fd_textTelefonAnrufer.right = new FormAttachment(0, 850);
    fd_textTelefonAnrufer.left = new FormAttachment(0, 663);
    textTelefonAnrufer.setLayoutData(fd_textTelefonAnrufer);

    rufhilfepatientButton = new Button(transportdatenGroup, SWT.CHECK);
    final FormData fd_rufhilfepatientButton = new FormData();
    fd_rufhilfepatientButton.bottom = new FormAttachment(0, 96);
    fd_rufhilfepatientButton.top = new FormAttachment(0, 80);
    fd_rufhilfepatientButton.right = new FormAttachment(0, 547);
    fd_rufhilfepatientButton.left = new FormAttachment(0, 462);
    rufhilfepatientButton.setLayoutData(fd_rufhilfepatientButton);
    rufhilfepatientButton.setText("Rufhilfepatient");

    final Label label_6 = new Label(transportdatenGroup, SWT.NONE);
    label_6.setFont(CustomColors.SUBHEADER_FONT);
    final FormData fd_label_6 = new FormData();
    fd_label_6.bottom = new FormAttachment(0, 122);
    fd_label_6.top = new FormAttachment(0, 105);
    fd_label_6.right = new FormAttachment(0, 315);
    fd_label_6.left = new FormAttachment(0, 200);
    label_6.setLayoutData(fd_label_6);
    label_6.setForeground(Util.getColor(0, 0, 255));
    label_6.setText("Zustndige Ortsstelle:");

    Combo comboZustaendigeOrtsstelle = new Combo(transportdatenGroup, SWT.READ_ONLY);
    zustaendigeOrtsstelle = new ComboViewer(comboZustaendigeOrtsstelle);
    zustaendigeOrtsstelle.setContentProvider(new StationContentProvider());
    zustaendigeOrtsstelle.setLabelProvider(new StationLabelProvider());
    zustaendigeOrtsstelle.setInput(ModelFactory.getInstance().getLocationManager());

    final FormData fd_comboZustaendigeOrtsstelle = new FormData();
    fd_comboZustaendigeOrtsstelle.bottom = new FormAttachment(0, 121);
    fd_comboZustaendigeOrtsstelle.top = new FormAttachment(0, 100);
    fd_comboZustaendigeOrtsstelle.right = new FormAttachment(0, 431);
    fd_comboZustaendigeOrtsstelle.left = new FormAttachment(0, 319);
    comboZustaendigeOrtsstelle.setLayoutData(fd_comboZustaendigeOrtsstelle);

    transportdatenGroup.setTabList(new Control[] { textFromStreet, textFromCity, patientLastName,
            patientFirstName, combokindOfTransport, textToStreet, textToCity, ruecktransportMoeglichButton,
            rufhilfepatientButton, begleitpersonButton, textAnrufer, textTelefonAnrufer,
            comboZustaendigeOrtsstelle });

    planungGroup = new Group(client, SWT.NONE);
    planungGroup.setLayout(new FormLayout());
    final FormData fd_planungGroup = new FormData();
    fd_planungGroup.bottom = new FormAttachment(0, 348);
    fd_planungGroup.top = new FormAttachment(0, 166);
    fd_planungGroup.right = new FormAttachment(0, 187);
    fd_planungGroup.left = new FormAttachment(0, 10);
    planungGroup.setLayoutData(fd_planungGroup);
    planungGroup.setText("Zeiten/Richtung");

    // group 'Zeiten/Richtung'
    final Label abfLabel = new Label(planungGroup, SWT.NONE);
    abfLabel.setFont(CustomColors.SUBHEADER_FONT);
    final FormData fd_abfLabel = new FormData();
    fd_abfLabel.bottom = new FormAttachment(0, 37);
    fd_abfLabel.top = new FormAttachment(0, 24);
    fd_abfLabel.right = new FormAttachment(0, 32);
    fd_abfLabel.left = new FormAttachment(0, 7);
    abfLabel.setLayoutData(fd_abfLabel);
    abfLabel.setForeground(Util.getColor(0, 0, 255));
    abfLabel.setText("Abf:");

    final Label beiPatLabel = new Label(planungGroup, SWT.NONE);
    final FormData fd_beiPatLabel = new FormData();
    fd_beiPatLabel.bottom = new FormAttachment(0, 64);
    fd_beiPatLabel.top = new FormAttachment(0, 51);
    fd_beiPatLabel.right = new FormAttachment(0, 32);
    fd_beiPatLabel.left = new FormAttachment(0, 7);
    beiPatLabel.setLayoutData(fd_beiPatLabel);
    beiPatLabel.setForeground(Util.getColor(128, 128, 128));
    beiPatLabel.setText("Pat.:");

    final Label terminLabel = new Label(planungGroup, SWT.NONE);
    final FormData fd_terminLabel = new FormData();
    fd_terminLabel.bottom = new FormAttachment(0, 91);
    fd_terminLabel.top = new FormAttachment(0, 78);
    fd_terminLabel.right = new FormAttachment(0, 35);
    fd_terminLabel.left = new FormAttachment(0, 7);
    terminLabel.setLayoutData(fd_terminLabel);
    terminLabel.setForeground(Util.getColor(128, 128, 128));
    terminLabel.setText("Term.");

    textBeiPat = new Text(planungGroup, SWT.BORDER);
    final FormData fd_textBeiPat = new FormData();
    fd_textBeiPat.bottom = new FormAttachment(0, 69);
    fd_textBeiPat.top = new FormAttachment(0, 48);
    fd_textBeiPat.right = new FormAttachment(0, 79);
    fd_textBeiPat.left = new FormAttachment(0, 38);
    textBeiPat.setLayoutData(fd_textBeiPat);
    textBeiPat.setToolTipText("Geplante Ankunftszeit beim Patienten");

    textTermin = new Text(planungGroup, SWT.BORDER);
    final FormData fd_textTermin = new FormData();
    fd_textTermin.bottom = new FormAttachment(0, 96);
    fd_textTermin.top = new FormAttachment(0, 75);
    fd_textTermin.right = new FormAttachment(0, 79);
    fd_textTermin.left = new FormAttachment(0, 38);
    textTermin.setLayoutData(fd_textTermin);
    textTermin.setToolTipText("Termin am Zielort");

    textAbf = new Text(planungGroup, SWT.BORDER);
    final FormData fd_textAbf = new FormData();
    fd_textAbf.bottom = new FormAttachment(0, 42);
    fd_textAbf.top = new FormAttachment(0, 21);
    fd_textAbf.right = new FormAttachment(0, 78);
    fd_textAbf.left = new FormAttachment(0, 37);
    textAbf.setLayoutData(fd_textAbf);
    textAbf.setToolTipText("Abfahrt des Fahrzeuges von der Ortsstelle");

    // 'Richtung'
    mariazellButton = new Button(planungGroup, SWT.RADIO);
    final FormData fd_mariazellButton = new FormData();
    mariazellButton.setLayoutData(fd_mariazellButton);
    mariazellButton.setText("Mariazell");

    wienButton = new Button(planungGroup, SWT.RADIO);
    fd_mariazellButton.bottom = new FormAttachment(wienButton, 16, SWT.BOTTOM);
    fd_mariazellButton.top = new FormAttachment(wienButton, 0, SWT.BOTTOM);
    fd_mariazellButton.right = new FormAttachment(wienButton, 71, SWT.LEFT);
    fd_mariazellButton.left = new FormAttachment(wienButton, 0, SWT.LEFT);
    final FormData fd_wienButton = new FormData();
    wienButton.setLayoutData(fd_wienButton);
    wienButton.setText("Wien");

    leobenButton = new Button(planungGroup, SWT.RADIO);
    fd_wienButton.bottom = new FormAttachment(leobenButton, 16, SWT.BOTTOM);
    fd_wienButton.top = new FormAttachment(leobenButton, 0, SWT.BOTTOM);
    fd_wienButton.right = new FormAttachment(leobenButton, 71, SWT.LEFT);
    fd_wienButton.left = new FormAttachment(leobenButton, 0, SWT.LEFT);
    final FormData fd_leobenButton = new FormData();
    leobenButton.setLayoutData(fd_leobenButton);
    leobenButton.setText("Leoben");

    grazButton = new Button(planungGroup, SWT.RADIO);
    fd_leobenButton.bottom = new FormAttachment(grazButton, 16, SWT.BOTTOM);
    fd_leobenButton.top = new FormAttachment(grazButton, 0, SWT.BOTTOM);
    fd_leobenButton.right = new FormAttachment(grazButton, 71, SWT.LEFT);
    fd_leobenButton.left = new FormAttachment(grazButton, 0, SWT.LEFT);
    final FormData fd_grazButton = new FormData();
    grazButton.setLayoutData(fd_grazButton);
    grazButton.setText("Graz");

    bruckButton = new Button(planungGroup, SWT.RADIO);
    final FormData fd_bezirkButton = new FormData();
    fd_bezirkButton.bottom = new FormAttachment(bruckButton, 16, SWT.BOTTOM);
    fd_bezirkButton.top = new FormAttachment(bruckButton, 0, SWT.BOTTOM);
    fd_bezirkButton.right = new FormAttachment(bruckButton, 77, SWT.LEFT);
    fd_bezirkButton.left = new FormAttachment(bruckButton, 0, SWT.LEFT);
    final FormData fd_bruckButton = new FormData();
    bruckButton.setLayoutData(fd_bruckButton);
    bruckButton.setText("Bruck");

    kapfenbergButton = new Button(planungGroup, SWT.RADIO);
    fd_grazButton.bottom = new FormAttachment(kapfenbergButton, 16, SWT.BOTTOM);
    fd_grazButton.top = new FormAttachment(kapfenbergButton, 0, SWT.BOTTOM);
    fd_grazButton.right = new FormAttachment(kapfenbergButton, 71, SWT.LEFT);
    fd_grazButton.left = new FormAttachment(kapfenbergButton, 0, SWT.LEFT);
    final FormData fd_kapfenbergButton = new FormData();
    fd_kapfenbergButton.bottom = new FormAttachment(0, 25);
    fd_kapfenbergButton.top = new FormAttachment(0, 39);
    fd_kapfenbergButton.right = new FormAttachment(0, 166);
    fd_kapfenbergButton.left = new FormAttachment(0, 95);
    kapfenbergButton.setLayoutData(fd_bezirkButton);
    kapfenbergButton.setText("Kapfenberg");

    Label label_2;
    label_2 = new Label(planungGroup, SWT.SEPARATOR);
    fd_bruckButton.bottom = new FormAttachment(label_2, 16, SWT.TOP);
    fd_bruckButton.top = new FormAttachment(label_2, 0, SWT.TOP);
    fd_bruckButton.right = new FormAttachment(label_2, 49, SWT.RIGHT);
    fd_bruckButton.left = new FormAttachment(label_2, 0, SWT.RIGHT);
    final FormData fd_label_2 = new FormData();
    fd_label_2.bottom = new FormAttachment(0, 159);
    fd_label_2.top = new FormAttachment(0, 20);
    fd_label_2.right = new FormAttachment(0, 94);
    fd_label_2.left = new FormAttachment(0, 81);
    label_2.setLayoutData(fd_label_2);

    fernfahrtButton = new Button(planungGroup, SWT.CHECK);
    final FormData fd_fernfahrtButton = new FormData();
    fd_fernfahrtButton.bottom = new FormAttachment(0, 143);
    fd_fernfahrtButton.top = new FormAttachment(0, 127);
    fd_fernfahrtButton.right = new FormAttachment(0, 80);
    fd_fernfahrtButton.left = new FormAttachment(0, 7);
    fernfahrtButton.setLayoutData(fd_fernfahrtButton);
    fernfahrtButton.setText("Fernfahrt");
    fernfahrtButton.setToolTipText("Fernfahrten sind lt. RKT deklariert");
    planungGroup.setTabList(new Control[] { textAbf, textBeiPat, textTermin, fernfahrtButton, bruckButton,
            kapfenbergButton, grazButton, leobenButton, wienButton, mariazellButton });

    // group 'Patientenzustand'
    patientenzustandGroup = new Group(client, SWT.NONE);
    patientenzustandGroup.setLayout(new FormLayout());
    final FormData fd_patientenzustandGroup = new FormData();
    fd_patientenzustandGroup.bottom = new FormAttachment(0, 348);
    fd_patientenzustandGroup.top = new FormAttachment(0, 166);
    fd_patientenzustandGroup.right = new FormAttachment(0, 870);
    fd_patientenzustandGroup.left = new FormAttachment(0, 194);
    patientenzustandGroup.setLayoutData(fd_patientenzustandGroup);
    patientenzustandGroup.setText("Patientenzustand");

    comboErkrankungVerletzung = new Combo(patientenzustandGroup, SWT.READ_ONLY);
    final FormData fd_comboErkrankungVerletzung = new FormData();
    fd_comboErkrankungVerletzung.bottom = new FormAttachment(0, 50);
    fd_comboErkrankungVerletzung.top = new FormAttachment(0, 29);
    fd_comboErkrankungVerletzung.right = new FormAttachment(0, 289);
    fd_comboErkrankungVerletzung.left = new FormAttachment(0, 7);
    comboErkrankungVerletzung.setLayoutData(fd_comboErkrankungVerletzung);
    setErkrVerl = new ComboViewer(comboErkrankungVerletzung);
    setErkrVerl.setContentProvider(new DiseaseContentProvider());
    setErkrVerl.setLabelProvider(new DiseaseLabelProvider());
    setErkrVerl.setInput(ModelFactory.getInstance().getDialyseManager());

    textAnmerkungen = new Text(patientenzustandGroup, SWT.WRAP | SWT.MULTI | SWT.BORDER);
    final FormData fd_textAnmerkungen = new FormData();
    fd_textAnmerkungen.bottom = new FormAttachment(0, 159);
    fd_textAnmerkungen.top = new FormAttachment(0, 75);
    fd_textAnmerkungen.right = new FormAttachment(0, 289);
    fd_textAnmerkungen.left = new FormAttachment(0, 7);
    textAnmerkungen.setLayoutData(fd_textAnmerkungen);

    final Label erkrankungverletzungLabel = new Label(patientenzustandGroup, SWT.NONE);
    final FormData fd_erkrankungverletzungLabel = new FormData();
    fd_erkrankungverletzungLabel.bottom = new FormAttachment(0, 24);
    fd_erkrankungverletzungLabel.top = new FormAttachment(0, 11);
    fd_erkrankungverletzungLabel.right = new FormAttachment(0, 134);
    fd_erkrankungverletzungLabel.left = new FormAttachment(0, 7);
    erkrankungverletzungLabel.setLayoutData(fd_erkrankungverletzungLabel);
    erkrankungverletzungLabel.setForeground(Util.getColor(128, 128, 128));
    erkrankungverletzungLabel.setText("Erkrankung/Verletzung");

    final Label anmerkungenLabel = new Label(patientenzustandGroup, SWT.NONE);
    final FormData fd_anmerkungenLabel = new FormData();
    fd_anmerkungenLabel.bottom = new FormAttachment(0, 69);
    fd_anmerkungenLabel.top = new FormAttachment(0, 56);
    fd_anmerkungenLabel.right = new FormAttachment(0, 134);
    fd_anmerkungenLabel.left = new FormAttachment(0, 7);
    anmerkungenLabel.setLayoutData(fd_anmerkungenLabel);
    anmerkungenLabel.setForeground(Util.getColor(128, 128, 128));
    anmerkungenLabel.setText("Anmerkungen");

    textRueckmeldung = new Text(patientenzustandGroup, SWT.WRAP | SWT.MULTI | SWT.BORDER);
    final FormData fd_textRueckmeldung = new FormData();
    fd_textRueckmeldung.bottom = new FormAttachment(0, 159);
    fd_textRueckmeldung.top = new FormAttachment(0, 29);
    fd_textRueckmeldung.right = new FormAttachment(0, 666);
    fd_textRueckmeldung.left = new FormAttachment(0, 355);
    textRueckmeldung.setLayoutData(fd_textRueckmeldung);

    final Label label_3 = new Label(patientenzustandGroup, SWT.NONE);
    final FormData fd_label_3 = new FormData();
    fd_label_3.bottom = new FormAttachment(0, 24);
    fd_label_3.top = new FormAttachment(0, 11);
    fd_label_3.right = new FormAttachment(0, 518);
    fd_label_3.left = new FormAttachment(0, 355);
    label_3.setLayoutData(fd_label_3);
    label_3.setForeground(Util.getColor(128, 128, 128));
    label_3.setText("Rckmeldung");

    bd2Button = new Button(patientenzustandGroup, SWT.CHECK);
    final FormData fd_bd2Button = new FormData();
    fd_bd2Button.bottom = new FormAttachment(0, 25);
    fd_bd2Button.top = new FormAttachment(0, 9);
    fd_bd2Button.right = new FormAttachment(0, 666);
    fd_bd2Button.left = new FormAttachment(0, 623);
    bd2Button.setLayoutData(fd_bd2Button);
    bd2Button.setToolTipText("Sondersignal auf dem Weg zum Transportziel");
    bd2Button.setText("BD 2");

    bd1Button = new Button(patientenzustandGroup, SWT.CHECK);
    final FormData fd_bd1Button = new FormData();
    fd_bd1Button.bottom = new FormAttachment(0, 25);
    fd_bd1Button.top = new FormAttachment(0, 9);
    fd_bd1Button.right = new FormAttachment(0, 500);
    fd_bd1Button.left = new FormAttachment(0, 253);
    bd1Button.setLayoutData(fd_bd1Button);
    bd1Button.setToolTipText("Sondersignal auf dem Weg zum Einsatzort");
    bd1Button.setText("BD 1");

    comboPrioritaet = new Combo(patientenzustandGroup, SWT.READ_ONLY);
    comboPrioritaet.setToolTipText(
            "1 (NEF), 2 (Transport), 3 (Terminfahrt), 4 (Rcktransport), 5 (Heimtransport), 6 (Sonstiges), 7 (NEF extern)");

    // set possible priorities
    if (transportType.equalsIgnoreCase("prebooking"))
        comboPrioritaet.setItems(prebookingPriorities);
    if (transportType.equalsIgnoreCase("emergencyTransport") || transportType.equalsIgnoreCase("both"))
        comboPrioritaet.setItems(emergencyAndTransportPriorities);
    final FormData fd_comboPrioritaet = new FormData();
    fd_comboPrioritaet.bottom = new FormAttachment(0, 73);
    fd_comboPrioritaet.top = new FormAttachment(0, 52);
    fd_comboPrioritaet.right = new FormAttachment(0, 287);
    fd_comboPrioritaet.left = new FormAttachment(0, 193);
    comboPrioritaet.setLayoutData(fd_comboPrioritaet);

    comboPrioritaet.addSelectionListener(new SelectionAdapter() {

        int index;

        public void widgetSelected(final SelectionEvent e) {
            // set possible priorities
            index = comboPrioritaet.getSelectionIndex();
            if (index != -1)
                tmpPriority = comboPrioritaet.getItem(index);
            // automatically set bd1 and bd2 if the priority 1 NEF (A) is
            // choosen

            if (tmpPriority.equalsIgnoreCase("1 NEF")) {
                bd1Button.setSelection(true);
                bd2Button.setSelection(true);
            } else {
                bd1Button.setSelection(false);
                bd2Button.setSelection(false);
            }
        }
    });

    final Label label_4 = new Label(patientenzustandGroup, SWT.NONE);
    label_4.setFont(CustomColors.SUBHEADER_FONT);
    final FormData fd_label_4 = new FormData();
    fd_label_4.left = new FormAttachment(0, 135);
    fd_label_4.bottom = new FormAttachment(0, 69);
    fd_label_4.top = new FormAttachment(0, 56);
    fd_label_4.right = new FormAttachment(0, 255);
    label_4.setLayoutData(fd_label_4);
    label_4.setForeground(Util.getColor(0, 0, 255));
    label_4.setText("Prioritt:");
    patientenzustandGroup.setTabList(new Control[] { setErkrVerl.getControl(), bd1Button, comboPrioritaet,
            textAnmerkungen, textRueckmeldung, bd2Button });

    // group multi transport (only visible if the multi transport button was
    // pressed
    multiTransportGroup = new Group(client, SWT.NONE);
    multiTransportGroup.setLayout(new FormLayout());
    final FormData fd_multitransportGroup = new FormData();
    fd_multitransportGroup.right = new FormAttachment(0, 842);
    fd_multitransportGroup.bottom = new FormAttachment(0, 500);
    fd_multitransportGroup.top = new FormAttachment(0, 360);
    fd_multitransportGroup.left = new FormAttachment(0, 10);
    multiTransportGroup.setLayoutData(fd_multitransportGroup);
    multiTransportGroup.setText("Mehrfachtransport");
    multiTransportGroup.setVisible(false);
    createMultiTransportTable();

    // assign car group
    assignCarGroup = new Group(client, SWT.NONE);
    assignCarGroup.setLayout(new FormLayout());
    final FormData fd_assignCarGroup = new FormData();
    fd_assignCarGroup.right = new FormAttachment(0, 842);
    fd_assignCarGroup.bottom = new FormAttachment(0, 500);
    fd_assignCarGroup.top = new FormAttachment(0, 360);
    fd_assignCarGroup.left = new FormAttachment(0, 10);
    assignCarGroup.setLayoutData(fd_assignCarGroup);
    assignCarGroup.setText("Fahrzeug zuweisen");
    assignCarGroup.setVisible(false);
    createAssignCarTable();

    // group 'Alarmierung'
    planungGroup_1 = new Group(client, SWT.NONE);
    planungGroup_1.setLayout(new FormLayout());
    final FormData fd_planungGroup_1 = new FormData();
    fd_planungGroup_1.bottom = new FormAttachment(0, 348);
    fd_planungGroup_1.top = new FormAttachment(0, 166);
    fd_planungGroup_1.right = new FormAttachment(0, 1056);
    fd_planungGroup_1.left = new FormAttachment(0, 875);
    planungGroup_1.setLayoutData(fd_planungGroup_1);
    planungGroup_1.setText("Alarmierung");

    notarztButton = new Button(planungGroup_1, SWT.CHECK);
    final FormData fd_notarztButton = new FormData();
    fd_notarztButton.bottom = new FormAttachment(0, 19);
    fd_notarztButton.top = new FormAttachment(0, 3);
    fd_notarztButton.right = new FormAttachment(0, 88);
    fd_notarztButton.left = new FormAttachment(0, 5);
    notarztButton.setLayoutData(fd_notarztButton);
    notarztButton.setText("NA extern");
    notarztButton.setToolTipText("Externer! Notarzt fr diesen Transport alarmiert");
    notarztButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            SimpleDateFormat sdf_dateTime = new SimpleDateFormat("dd.MM.yy HH:mm");
            Calendar cal = Calendar.getInstance();
            if (notarztButton.getSelection())
                timestampNA.setText(sdf_dateTime.format(cal.getTime()));
            else
                timestampNA.setText("");
        }
    });

    rthButton = new Button(planungGroup_1, SWT.CHECK);
    final FormData fd_rthButton = new FormData();
    fd_rthButton.bottom = new FormAttachment(0, 40);
    fd_rthButton.top = new FormAttachment(0, 24);
    fd_rthButton.right = new FormAttachment(0, 88);
    fd_rthButton.left = new FormAttachment(0, 5);
    rthButton.setLayoutData(fd_rthButton);
    rthButton.setToolTipText("Hubschrauber");
    rthButton.setText("RTH");
    rthButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            SimpleDateFormat sdf_dateTime = new SimpleDateFormat("dd.MM.yy HH:mm");
            Calendar cal = Calendar.getInstance();
            if (rthButton.getSelection())
                timestampRTH.setText(sdf_dateTime.format(cal.getTime()));
            else
                timestampRTH.setText("");
        }
    });

    dfButton = new Button(planungGroup_1, SWT.CHECK);
    final FormData fd_dfButton = new FormData();
    fd_dfButton.bottom = new FormAttachment(0, 61);
    fd_dfButton.top = new FormAttachment(0, 45);
    fd_dfButton.right = new FormAttachment(0, 88);
    fd_dfButton.left = new FormAttachment(0, 5);
    dfButton.setLayoutData(fd_dfButton);
    dfButton.setText("DF/Inspektion");
    dfButton.setToolTipText("DF/Inspektionsdienst");
    dfButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            SimpleDateFormat sdf_dateTime = new SimpleDateFormat("dd.MM.yy HH:mm");
            Calendar cal = Calendar.getInstance();
            if (dfButton.getSelection())
                timestampDF.setText(sdf_dateTime.format(cal.getTime()));
            else
                timestampDF.setText("");
        }
    });

    brkdtButton = new Button(planungGroup_1, SWT.CHECK);
    final FormData fd_brkdtButton = new FormData();
    fd_brkdtButton.bottom = new FormAttachment(0, 82);
    fd_brkdtButton.top = new FormAttachment(0, 66);
    fd_brkdtButton.right = new FormAttachment(0, 88);
    fd_brkdtButton.left = new FormAttachment(0, 5);
    brkdtButton.setLayoutData(fd_brkdtButton);
    brkdtButton.setToolTipText("Bezirksrettungskommandant");
    brkdtButton.setText("BRKDT");
    brkdtButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            SimpleDateFormat sdf_dateTime = new SimpleDateFormat("dd.MM.yy HH:mm");
            Calendar cal = Calendar.getInstance();
            if (brkdtButton.getSelection())
                timestampBRKDT.setText(sdf_dateTime.format(cal.getTime()));
            else
                timestampBRKDT.setText("");
        }
    });

    feuerwehrButton = new Button(planungGroup_1, SWT.CHECK);
    final FormData fd_feuerwehrButton = new FormData();
    fd_feuerwehrButton.bottom = new FormAttachment(0, 103);
    fd_feuerwehrButton.top = new FormAttachment(0, 87);
    fd_feuerwehrButton.right = new FormAttachment(0, 88);
    fd_feuerwehrButton.left = new FormAttachment(0, 5);
    feuerwehrButton.setLayoutData(fd_feuerwehrButton);
    feuerwehrButton.setToolTipText("Feuerwehr");
    feuerwehrButton.setText("FW");
    feuerwehrButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            SimpleDateFormat sdf_dateTime = new SimpleDateFormat("dd.MM.yy HH:mm");
            Calendar cal = Calendar.getInstance();
            if (feuerwehrButton.getSelection())
                timestampFW.setText(sdf_dateTime.format(cal.getTime()));
            else
                timestampFW.setText("");
        }
    });

    polizeiButton = new Button(planungGroup_1, SWT.CHECK);
    final FormData fd_polizeiButton = new FormData();
    fd_polizeiButton.bottom = new FormAttachment(0, 124);
    fd_polizeiButton.top = new FormAttachment(0, 108);
    fd_polizeiButton.right = new FormAttachment(0, 88);
    fd_polizeiButton.left = new FormAttachment(0, 5);
    polizeiButton.setLayoutData(fd_polizeiButton);
    polizeiButton.setToolTipText("Polizei");
    polizeiButton.setText("Polizei");
    polizeiButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            SimpleDateFormat sdf_dateTime = new SimpleDateFormat("dd.MM.yy HH:mm");
            Calendar cal = Calendar.getInstance();
            if (polizeiButton.getSelection())
                timestampPolizei.setText(sdf_dateTime.format(cal.getTime()));
            else
                timestampPolizei.setText("");
        }
    });

    KITButton = new Button(planungGroup_1, SWT.CHECK);
    final FormData fd_KITButton = new FormData();
    fd_KITButton.bottom = new FormAttachment(0, 166);
    fd_KITButton.top = new FormAttachment(0, 150);
    fd_KITButton.right = new FormAttachment(0, 88);
    fd_KITButton.left = new FormAttachment(0, 5);
    KITButton.setLayoutData(fd_KITButton);
    KITButton.setToolTipText("Kriseninterventionsteam");
    KITButton.setText("KIT");
    KITButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            SimpleDateFormat sdf_dateTime = new SimpleDateFormat("dd.MM.yy HH:mm");
            Calendar cal = Calendar.getInstance();
            if (KITButton.getSelection())
                timestampKIT.setText(sdf_dateTime.format(cal.getTime()));
            else
                timestampKIT.setText("");
        }
    });

    bergrettungButton = new Button(planungGroup_1, SWT.CHECK);
    final FormData fd_bergrettungButton = new FormData();
    fd_bergrettungButton.bottom = new FormAttachment(0, 145);
    fd_bergrettungButton.top = new FormAttachment(0, 129);
    fd_bergrettungButton.right = new FormAttachment(0, 88);
    fd_bergrettungButton.left = new FormAttachment(0, 5);
    bergrettungButton.setLayoutData(fd_bergrettungButton);
    bergrettungButton.setText("Bergrettung");
    bergrettungButton.setToolTipText("Bergrettung");
    bergrettungButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            SimpleDateFormat sdf_dateTime = new SimpleDateFormat("dd.MM.yy HH:mm");
            Calendar cal = Calendar.getInstance();
            if (bergrettungButton.getSelection())
                timestampBergrettung.setText(sdf_dateTime.format(cal.getTime()));
            else
                timestampBergrettung.setText("");
        }
    });

    timestampNA = new Text(planungGroup_1, SWT.BORDER);
    final FormData fd_timestampNA = new FormData();
    fd_timestampNA.bottom = new FormAttachment(0, 19);
    fd_timestampNA.top = new FormAttachment(0, 3);
    fd_timestampNA.right = new FormAttachment(0, 175);
    fd_timestampNA.left = new FormAttachment(0, 89);
    timestampNA.setLayoutData(fd_timestampNA);
    timestampNA.setToolTipText("Zeitpunkt des letzten Anhakens des Notarzt-Hkchens");

    timestampRTH = new Text(planungGroup_1, SWT.BORDER);
    final FormData fd_timestampRTH = new FormData();
    fd_timestampRTH.bottom = new FormAttachment(0, 40);
    fd_timestampRTH.top = new FormAttachment(0, 24);
    fd_timestampRTH.right = new FormAttachment(0, 175);
    fd_timestampRTH.left = new FormAttachment(0, 89);
    timestampRTH.setLayoutData(fd_timestampRTH);
    timestampRTH.setToolTipText("Zeitpunkt des letzten Anhakens des Hubschrauber-Hkchens");

    timestampDF = new Text(planungGroup_1, SWT.BORDER);
    final FormData fd_timestampDF = new FormData();
    fd_timestampDF.bottom = new FormAttachment(0, 61);
    fd_timestampDF.top = new FormAttachment(0, 45);
    fd_timestampDF.right = new FormAttachment(0, 175);
    fd_timestampDF.left = new FormAttachment(0, 89);
    timestampDF.setLayoutData(fd_timestampDF);
    timestampDF.setToolTipText("Zeitpunkt des letzten Anhakens des Dienstfhrenden/Insp.-Hkchens");

    timestampBRKDT = new Text(planungGroup_1, SWT.BORDER);
    final FormData fd_timestampBRKDT = new FormData();
    fd_timestampBRKDT.bottom = new FormAttachment(0, 82);
    fd_timestampBRKDT.top = new FormAttachment(0, 66);
    fd_timestampBRKDT.right = new FormAttachment(0, 175);
    fd_timestampBRKDT.left = new FormAttachment(0, 89);
    timestampBRKDT.setLayoutData(fd_timestampBRKDT);
    timestampBRKDT.setToolTipText("Zeitpunkt des letzten Anhakens des Bezirksrettungskommandanten-Hkchens");

    timestampFW = new Text(planungGroup_1, SWT.BORDER);
    final FormData fd_timestampFW = new FormData();
    fd_timestampFW.bottom = new FormAttachment(0, 103);
    fd_timestampFW.top = new FormAttachment(0, 87);
    fd_timestampFW.right = new FormAttachment(0, 175);
    fd_timestampFW.left = new FormAttachment(0, 89);
    timestampFW.setLayoutData(fd_timestampFW);
    timestampFW.setToolTipText("Zeitpunkt des letzten Anhakens des Feuerwehr-Hkchens");

    timestampPolizei = new Text(planungGroup_1, SWT.BORDER);
    final FormData fd_timestampPolizei = new FormData();
    fd_timestampPolizei.bottom = new FormAttachment(0, 124);
    fd_timestampPolizei.top = new FormAttachment(0, 108);
    fd_timestampPolizei.right = new FormAttachment(0, 175);
    fd_timestampPolizei.left = new FormAttachment(0, 89);
    timestampPolizei.setLayoutData(fd_timestampPolizei);
    timestampPolizei.setToolTipText("Zeitpunkt des letzten Anhakens des Polizei-Hkchens");

    timestampBergrettung = new Text(planungGroup_1, SWT.BORDER);
    final FormData fd_timestampBergrettung = new FormData();
    fd_timestampBergrettung.bottom = new FormAttachment(0, 145);
    fd_timestampBergrettung.top = new FormAttachment(0, 129);
    fd_timestampBergrettung.right = new FormAttachment(0, 175);
    fd_timestampBergrettung.left = new FormAttachment(0, 89);
    timestampBergrettung.setLayoutData(fd_timestampBergrettung);
    timestampBergrettung.setToolTipText("Zeitpunkt des letzten Anhakens des Bergrettung-Hkchens");

    timestampKIT = new Text(planungGroup_1, SWT.BORDER);
    final FormData fd_timestampKIT = new FormData();
    fd_timestampKIT.bottom = new FormAttachment(0, 166);
    fd_timestampKIT.top = new FormAttachment(0, 150);
    fd_timestampKIT.right = new FormAttachment(0, 175);
    fd_timestampKIT.left = new FormAttachment(0, 89);
    timestampKIT.setLayoutData(fd_timestampKIT);
    timestampKIT.setToolTipText("Zeitpunkt des letzten Anhakens des KIT-Hkchens");

    timestampNA.setEditable(false);
    timestampRTH.setEditable(false);
    timestampDF.setEditable(false);
    timestampBRKDT.setEditable(false);
    timestampFW.setEditable(false);
    timestampPolizei.setEditable(false);
    timestampBergrettung.setEditable(false);
    timestampKIT.setEditable(false);

    planungGroup_1.setTabList(new Control[] { notarztButton, rthButton, dfButton, brkdtButton, feuerwehrButton,
            polizeiButton, bergrettungButton, KITButton });

    final Label label_5 = new Label(client, SWT.SEPARATOR | SWT.HORIZONTAL);
    final FormData fd_label_5 = new FormData();
    fd_label_5.bottom = new FormAttachment(0, 367);
    fd_label_5.top = new FormAttachment(0, 354);
    fd_label_5.right = new FormAttachment(0, 1056);
    fd_label_5.left = new FormAttachment(0, 10);
    label_5.setLayoutData(fd_label_5);

    // group 'Transportdetails'
    transportdetailsGroup = new Group(client, SWT.NONE);
    transportdetailsGroup.setLayout(new FormLayout());
    final FormData fd_transportdetailsGroup = new FormData();
    fd_transportdetailsGroup.bottom = new FormAttachment(0, 501);
    fd_transportdetailsGroup.top = new FormAttachment(0, 373);
    fd_transportdetailsGroup.right = new FormAttachment(0, 187);
    fd_transportdetailsGroup.left = new FormAttachment(0, 10);
    transportdetailsGroup.setLayoutData(fd_transportdetailsGroup);
    transportdetailsGroup.setText("Transportdetails");

    final Label transportnumemmerLabel = new Label(transportdetailsGroup, SWT.NONE);
    final FormData fd_transportnumemmerLabel = new FormData();
    fd_transportnumemmerLabel.bottom = new FormAttachment(0, 27);
    fd_transportnumemmerLabel.top = new FormAttachment(0, 14);
    fd_transportnumemmerLabel.right = new FormAttachment(0, 54);
    fd_transportnumemmerLabel.left = new FormAttachment(0, 7);
    transportnumemmerLabel.setLayoutData(fd_transportnumemmerLabel);
    transportnumemmerLabel.setForeground(Util.getColor(128, 128, 128));
    transportnumemmerLabel.setText("Trsp.Nr.:");

    textTransportNummer = new Text(transportdetailsGroup, SWT.BORDER);
    final FormData fd_textTransportNummer = new FormData();
    fd_textTransportNummer.bottom = new FormAttachment(0, 32);
    fd_textTransportNummer.top = new FormAttachment(0, 11);
    fd_textTransportNummer.right = new FormAttachment(0, 158);
    fd_textTransportNummer.left = new FormAttachment(0, 60);
    textTransportNummer.setLayoutData(fd_textTransportNummer);
    textTransportNummer.setEditable(false);

    final Label ortsstelleLabel = new Label(transportdetailsGroup, SWT.NONE);
    final FormData fd_ortsstelleLabel = new FormData();
    fd_ortsstelleLabel.bottom = new FormAttachment(0, 54);
    fd_ortsstelleLabel.top = new FormAttachment(0, 41);
    fd_ortsstelleLabel.right = new FormAttachment(0, 57);
    fd_ortsstelleLabel.left = new FormAttachment(0, 7);
    ortsstelleLabel.setLayoutData(fd_ortsstelleLabel);
    ortsstelleLabel.setForeground(Util.getColor(25, 25, 112));
    ortsstelleLabel.setText("Ortsstelle:");

    textOrtsstelle = new Text(transportdetailsGroup, SWT.BORDER);
    final FormData fd_textOrtsstelle = new FormData();
    fd_textOrtsstelle.bottom = new FormAttachment(0, 59);
    fd_textOrtsstelle.top = new FormAttachment(0, 38);
    fd_textOrtsstelle.right = new FormAttachment(0, 158);
    fd_textOrtsstelle.left = new FormAttachment(0, 60);
    textOrtsstelle.setLayoutData(fd_textOrtsstelle);
    textOrtsstelle.setEditable(false);

    textFahrzeug = new Text(transportdetailsGroup, SWT.BORDER);
    final FormData fd_textFahrzeug = new FormData();
    fd_textFahrzeug.bottom = new FormAttachment(0, 86);
    fd_textFahrzeug.top = new FormAttachment(0, 65);
    fd_textFahrzeug.right = new FormAttachment(0, 158);
    fd_textFahrzeug.left = new FormAttachment(0, 60);
    textFahrzeug.setLayoutData(fd_textFahrzeug);
    textFahrzeug.setEditable(false);

    final Label farzeugLabel = new Label(transportdetailsGroup, SWT.NONE);
    final FormData fd_farzeugLabel = new FormData();
    fd_farzeugLabel.bottom = new FormAttachment(0, 81);
    fd_farzeugLabel.top = new FormAttachment(0, 68);
    fd_farzeugLabel.right = new FormAttachment(0, 57);
    fd_farzeugLabel.left = new FormAttachment(0, 7);
    farzeugLabel.setLayoutData(fd_farzeugLabel);
    farzeugLabel.setForeground(Util.getColor(128, 128, 128));
    farzeugLabel.setText("Fahrzeug:");
    transportdetailsGroup.setTabList(new Control[] { textTransportNummer, textOrtsstelle, textFahrzeug });

    // group 'Personal am Fahrzeug'
    personalAmFahrzeugGroup = new Group(client, SWT.NONE);
    personalAmFahrzeugGroup.setLayout(new FormLayout());
    final FormData fd_personalAmFahrzeugGroup = new FormData();
    fd_personalAmFahrzeugGroup.bottom = new FormAttachment(0, 501);
    fd_personalAmFahrzeugGroup.top = new FormAttachment(0, 373);
    fd_personalAmFahrzeugGroup.right = new FormAttachment(0, 483);
    fd_personalAmFahrzeugGroup.left = new FormAttachment(0, 194);
    personalAmFahrzeugGroup.setLayoutData(fd_personalAmFahrzeugGroup);
    personalAmFahrzeugGroup.setText("Personal am Fahrzeug");

    Combo textFahrer = new Combo(personalAmFahrzeugGroup, SWT.BORDER);
    final FormData fd_textFahrer = new FormData();
    fd_textFahrer.bottom = new FormAttachment(0, 32);
    fd_textFahrer.top = new FormAttachment(0, 11);
    fd_textFahrer.right = new FormAttachment(0, 276);
    fd_textFahrer.left = new FormAttachment(0, 73);
    textFahrer.setLayoutData(fd_textFahrer);
    setTextFahrer = new ComboViewer(textFahrer);
    setTextFahrer.setContentProvider(new StaffMemberContentProvider());
    setTextFahrer.setLabelProvider(new StaffMemberLabelProvider());
    setTextFahrer.setInput(ModelFactory.getInstance().getStaffManager());

    Combo textSaniI = new Combo(personalAmFahrzeugGroup, SWT.BORDER);
    final FormData fd_textSnaniI = new FormData();
    fd_textSnaniI.bottom = new FormAttachment(0, 59);
    fd_textSnaniI.top = new FormAttachment(0, 38);
    fd_textSnaniI.right = new FormAttachment(0, 276);
    fd_textSnaniI.left = new FormAttachment(0, 73);
    textSaniI.setLayoutData(fd_textSnaniI);
    setTextSaniI = new ComboViewer(textSaniI);
    setTextSaniI.setContentProvider(new StaffMemberContentProvider());
    setTextSaniI.setLabelProvider(new StaffMemberLabelProvider());
    setTextSaniI.setInput(ModelFactory.getInstance().getStaffManager());

    Combo textSaniII = new Combo(personalAmFahrzeugGroup, SWT.BORDER);
    final FormData fd_textSaniII = new FormData();
    fd_textSaniII.bottom = new FormAttachment(0, 86);
    fd_textSaniII.top = new FormAttachment(0, 65);
    fd_textSaniII.right = new FormAttachment(0, 276);
    fd_textSaniII.left = new FormAttachment(0, 73);
    textSaniII.setLayoutData(fd_textSaniII);
    setTextSaniII = new ComboViewer(textSaniII);
    setTextSaniII.setContentProvider(new StaffMemberContentProvider());
    setTextSaniII.setLabelProvider(new StaffMemberLabelProvider());
    setTextSaniII.setInput(ModelFactory.getInstance().getServiceManager());

    final Label driverLabel = new Label(personalAmFahrzeugGroup, SWT.NONE);
    final FormData fd_driverLabel = new FormData();
    fd_driverLabel.bottom = new FormAttachment(0, 27);
    fd_driverLabel.top = new FormAttachment(0, 14);
    fd_driverLabel.right = new FormAttachment(0, 54);
    fd_driverLabel.left = new FormAttachment(0, 7);
    driverLabel.setLayoutData(fd_driverLabel);
    driverLabel.setForeground(Util.getColor(128, 128, 128));
    driverLabel.setText("Fahrer:");

    final Label paramedicILabel = new Label(personalAmFahrzeugGroup, SWT.NONE);
    final FormData fd_paramedicILabel = new FormData();
    fd_paramedicILabel.bottom = new FormAttachment(0, 54);
    fd_paramedicILabel.top = new FormAttachment(0, 41);
    fd_paramedicILabel.right = new FormAttachment(0, 68);
    fd_paramedicILabel.left = new FormAttachment(0, 7);
    paramedicILabel.setLayoutData(fd_paramedicILabel);
    paramedicILabel.setForeground(Util.getColor(128, 128, 128));
    paramedicILabel.setText("Sanitter I:");

    final Label paramedicIILabel = new Label(personalAmFahrzeugGroup, SWT.NONE);
    final FormData fd_paramedicIILabel = new FormData();
    fd_paramedicIILabel.bottom = new FormAttachment(0, 81);
    fd_paramedicIILabel.top = new FormAttachment(0, 68);
    fd_paramedicIILabel.right = new FormAttachment(0, 68);
    fd_paramedicIILabel.left = new FormAttachment(0, 7);
    paramedicIILabel.setLayoutData(fd_paramedicIILabel);
    paramedicIILabel.setForeground(Util.getColor(128, 128, 128));
    paramedicIILabel.setText("Sanitter II:");
    personalAmFahrzeugGroup.setTabList(new Control[] { textFahrer, textSaniI, textSaniII });

    // group 'Statusmeldungen'
    statusmeldungenGroup = new Group(client, SWT.NONE);
    statusmeldungenGroup.setLayout(new FormLayout());
    final FormData fd_statusmeldungenGroup = new FormData();
    fd_statusmeldungenGroup.bottom = new FormAttachment(0, 501);
    fd_statusmeldungenGroup.top = new FormAttachment(0, 373);
    fd_statusmeldungenGroup.right = new FormAttachment(0, 843);
    fd_statusmeldungenGroup.left = new FormAttachment(0, 489);
    statusmeldungenGroup.setLayoutData(fd_statusmeldungenGroup);
    statusmeldungenGroup.setText("Statusmeldungen");

    textAufgen = new Text(statusmeldungenGroup, SWT.BORDER);
    final FormData fd_textAufgen = new FormData();
    fd_textAufgen.bottom = new FormAttachment(0, 32);
    fd_textAufgen.top = new FormAttachment(0, 11);
    fd_textAufgen.right = new FormAttachment(0, 85);
    fd_textAufgen.left = new FormAttachment(0, 44);
    textAufgen.setLayoutData(fd_textAufgen);

    textAufgen.setEditable(false);

    final Label aufgLabel = new Label(statusmeldungenGroup, SWT.NONE);
    final FormData fd_aufgLabel = new FormData();
    fd_aufgLabel.bottom = new FormAttachment(0, 26);
    fd_aufgLabel.top = new FormAttachment(0, 13);
    fd_aufgLabel.right = new FormAttachment(0, 43);
    fd_aufgLabel.left = new FormAttachment(0, 12);
    aufgLabel.setLayoutData(fd_aufgLabel);
    aufgLabel.setForeground(Util.getColor(128, 128, 128));
    aufgLabel.setText("Aufg.:");

    textAE = new Text(statusmeldungenGroup, SWT.BORDER);
    final FormData fd_textAE = new FormData();
    fd_textAE.bottom = new FormAttachment(0, 59);
    fd_textAE.top = new FormAttachment(0, 38);
    fd_textAE.right = new FormAttachment(0, 85);
    fd_textAE.left = new FormAttachment(0, 44);
    textAE.setLayoutData(fd_textAE);

    final Label aeLabel = new Label(statusmeldungenGroup, SWT.NONE);
    final FormData fd_aeLabel = new FormData();
    fd_aeLabel.bottom = new FormAttachment(0, 58);
    fd_aeLabel.top = new FormAttachment(0, 45);
    fd_aeLabel.right = new FormAttachment(0, 43);
    fd_aeLabel.left = new FormAttachment(0, 12);
    aeLabel.setLayoutData(fd_aeLabel);
    aeLabel.setForeground(Util.getColor(128, 128, 128));
    aeLabel.setText("AE:");

    textS1 = new Text(statusmeldungenGroup, SWT.BORDER);
    final FormData fd_textS1 = new FormData();
    fd_textS1.bottom = new FormAttachment(0, 32);
    fd_textS1.top = new FormAttachment(0, 11);
    fd_textS1.right = new FormAttachment(0, 173);
    fd_textS1.left = new FormAttachment(0, 132);
    textS1.setLayoutData(fd_textS1);

    final Label ts1Label = new Label(statusmeldungenGroup, SWT.NONE);
    final FormData fd_ts1Label = new FormData();
    fd_ts1Label.bottom = new FormAttachment(0, 26);
    fd_ts1Label.top = new FormAttachment(0, 13);
    fd_ts1Label.right = new FormAttachment(0, 141);
    fd_ts1Label.left = new FormAttachment(0, 110);
    ts1Label.setLayoutData(fd_ts1Label);
    ts1Label.setForeground(Util.getColor(128, 128, 128));
    ts1Label.setText("S1:");

    textS2 = new Text(statusmeldungenGroup, SWT.BORDER);
    final FormData fd_textS2 = new FormData();
    fd_textS2.bottom = new FormAttachment(0, 59);
    fd_textS2.top = new FormAttachment(0, 38);
    fd_textS2.right = new FormAttachment(0, 173);
    fd_textS2.left = new FormAttachment(0, 132);
    textS2.setLayoutData(fd_textS2);

    final Label ts2Label = new Label(statusmeldungenGroup, SWT.NONE);
    final FormData fd_ts2Label = new FormData();
    fd_ts2Label.bottom = new FormAttachment(0, 59);
    fd_ts2Label.top = new FormAttachment(0, 46);
    fd_ts2Label.right = new FormAttachment(0, 141);
    fd_ts2Label.left = new FormAttachment(0, 110);
    ts2Label.setLayoutData(fd_ts2Label);
    ts2Label.setForeground(Util.getColor(128, 128, 128));
    ts2Label.setText("S2:");

    textS3 = new Text(statusmeldungenGroup, SWT.BORDER);
    final FormData fd_textS3 = new FormData();
    fd_textS3.bottom = new FormAttachment(0, 86);
    fd_textS3.top = new FormAttachment(0, 65);
    fd_textS3.right = new FormAttachment(0, 173);
    fd_textS3.left = new FormAttachment(0, 132);
    textS3.setLayoutData(fd_textS3);

    final Label ts3Label = new Label(statusmeldungenGroup, SWT.NONE);
    final FormData fd_ts3Label = new FormData();
    fd_ts3Label.bottom = new FormAttachment(0, 86);
    fd_ts3Label.top = new FormAttachment(0, 73);
    fd_ts3Label.right = new FormAttachment(0, 141);
    fd_ts3Label.left = new FormAttachment(0, 110);
    ts3Label.setLayoutData(fd_ts3Label);
    ts3Label.setForeground(Util.getColor(128, 128, 128));
    ts3Label.setText("S3:");

    textS4 = new Text(statusmeldungenGroup, SWT.BORDER);
    final FormData fd_textS4 = new FormData();
    fd_textS4.bottom = new FormAttachment(0, 32);
    fd_textS4.top = new FormAttachment(0, 11);
    fd_textS4.right = new FormAttachment(0, 255);
    fd_textS4.left = new FormAttachment(0, 214);
    textS4.setLayoutData(fd_textS4);

    final Label ts4Label = new Label(statusmeldungenGroup, SWT.NONE);
    final FormData fd_ts4Label = new FormData();
    fd_ts4Label.bottom = new FormAttachment(0, 27);
    fd_ts4Label.top = new FormAttachment(0, 14);
    fd_ts4Label.right = new FormAttachment(0, 213);
    fd_ts4Label.left = new FormAttachment(0, 195);
    ts4Label.setLayoutData(fd_ts4Label);
    ts4Label.setForeground(Util.getColor(128, 128, 128));
    ts4Label.setText("S4:");

    textS5 = new Text(statusmeldungenGroup, SWT.BORDER);
    final FormData fd_textS5 = new FormData();
    fd_textS5.bottom = new FormAttachment(0, 59);
    fd_textS5.top = new FormAttachment(0, 38);
    fd_textS5.right = new FormAttachment(0, 255);
    fd_textS5.left = new FormAttachment(0, 214);
    textS5.setLayoutData(fd_textS5);

    final Label ts5Label = new Label(statusmeldungenGroup, SWT.NONE);
    final FormData fd_ts5Label = new FormData();
    fd_ts5Label.bottom = new FormAttachment(0, 54);
    fd_ts5Label.top = new FormAttachment(0, 41);
    fd_ts5Label.right = new FormAttachment(0, 213);
    fd_ts5Label.left = new FormAttachment(0, 195);
    ts5Label.setLayoutData(fd_ts5Label);
    ts5Label.setForeground(Util.getColor(128, 128, 128));
    ts5Label.setText("S5:");

    textS6 = new Text(statusmeldungenGroup, SWT.BORDER);
    final FormData fd_textS6 = new FormData();
    fd_textS6.bottom = new FormAttachment(0, 86);
    fd_textS6.top = new FormAttachment(0, 65);
    fd_textS6.right = new FormAttachment(0, 255);
    fd_textS6.left = new FormAttachment(0, 214);
    textS6.setLayoutData(fd_textS6);

    final Label ts6Label = new Label(statusmeldungenGroup, SWT.NONE);
    final FormData fd_ts6Label = new FormData();
    fd_ts6Label.bottom = new FormAttachment(0, 81);
    fd_ts6Label.top = new FormAttachment(0, 68);
    fd_ts6Label.right = new FormAttachment(0, 213);
    fd_ts6Label.left = new FormAttachment(0, 195);
    ts6Label.setLayoutData(fd_ts6Label);
    ts6Label.setForeground(Util.getColor(128, 128, 128));
    ts6Label.setText("S6:");

    // set uninteresting groups invisible
    if ("prebooking".equalsIgnoreCase(transportType)) {
        transportdetailsGroup.setVisible(false);
        statusmeldungenGroup.setVisible(false);
        personalAmFahrzeugGroup.setVisible(false);
        planungGroup_1.setVisible(false);
    }

    if ("emergencyTransport".equalsIgnoreCase(transportType)) {
        transportdetailsGroup.setVisible(false);
        statusmeldungenGroup.setVisible(false);
        personalAmFahrzeugGroup.setVisible(false);
        planungGroup.setVisible(false);
        // set dateTime to default and disable editing
        GregorianCalendar gcal = new GregorianCalendar();
        dateTime.setDay(gcal.get(GregorianCalendar.DATE));
        dateTime.setMonth(gcal.get(GregorianCalendar.MONTH));
        dateTime.setYear(gcal.get(GregorianCalendar.YEAR));
        dateTime.setEnabled(false);
    }

    if ("journal".equalsIgnoreCase(editingType)) {
        transportdetailsGroup.setVisible(true);
        statusmeldungenGroup.setVisible(true);
        personalAmFahrzeugGroup.setVisible(true);
    } else if ("both".equalsIgnoreCase(transportType))// in the case of
    // editing a transport
    // from the following
    // views:
    // UnderwayTransportsView,
    // OutstandingTransportsView,
    // PrebookingView
    {
        transportdetailsGroup.setVisible(false);
        statusmeldungenGroup.setVisible(false);
        personalAmFahrzeugGroup.setVisible(false);

        planungGroup.setVisible(true);
        planungGroup_1.setVisible(true);
    } else {
        transportdetailsGroup.setVisible(false);
        statusmeldungenGroup.setVisible(false);
        personalAmFahrzeugGroup.setVisible(false);
    }

    // transport type selection buttons
    formGroup = new Group(client, SWT.NONE);
    formGroup.setLayout(new FormLayout());
    final FormData fd_group = new FormData();
    fd_group.bottom = new FormAttachment(0, 501);
    fd_group.top = new FormAttachment(0, 373);
    fd_group.right = new FormAttachment(0, 1056);
    fd_group.left = new FormAttachment(0, 846);
    formGroup.setLayoutData(fd_group);
    formGroup.setText("Formularansicht");

    buttonNotfall = new Button(formGroup, SWT.NONE);
    final FormData fd_buttonNotfall = new FormData();
    fd_buttonNotfall.bottom = new FormAttachment(0, 25);
    fd_buttonNotfall.top = new FormAttachment(0, 2);
    fd_buttonNotfall.right = new FormAttachment(0, 204);
    fd_buttonNotfall.left = new FormAttachment(0, 104);
    buttonNotfall.setLayoutData(fd_buttonNotfall);
    buttonNotfall.setToolTipText("Blendet alle fr einen Notfall nicht relevanten Felder aus");
    buttonNotfall.addSelectionListener(new SelectionAdapter() {

        int index;

        public void widgetSelected(final SelectionEvent e) {
            planungGroup.setVisible(false);
            planungGroup_1.setVisible(true);
            transportdetailsGroup.setVisible(false);
            statusmeldungenGroup.setVisible(false);
            personalAmFahrzeugGroup.setVisible(false);
            multiTransportGroup.setVisible(false);
            mehrfachtransport = false;
            buttonMehrfachtransport.setEnabled(false);
            buttonADDMehrfachtransport.setEnabled(false);
            buttonAssignCar.setEnabled(true);
            // set dateTime to default and disable editing
            GregorianCalendar gcal = new GregorianCalendar();
            dateTime.setDay(gcal.get(GregorianCalendar.DATE));
            dateTime.setMonth(gcal.get(GregorianCalendar.MONTH));
            dateTime.setYear(gcal.get(GregorianCalendar.YEAR));
            dateTime.setEnabled(false);

            transportType = "emergencyTransport";

            // set possible priorities
            index = comboPrioritaet.getSelectionIndex();
            if (index != -1)
                tmpPriority = comboPrioritaet.getItem(index);

            if (transportType.equalsIgnoreCase("prebooking")) {
                comboPrioritaet.setItems(prebookingPriorities);
                comboPrioritaet.setText(tmpPriority);
            }
            if (transportType.equalsIgnoreCase("emergencyTransport")) {
                comboPrioritaet.setItems(emergencyAndTransportPriorities);
                comboPrioritaet.setText(tmpPriority);
            }

            // remove all transports from the multi transport list
            multiTransportProvider.removeAllTransports();
            viewer.refresh();
        }
    });
    buttonNotfall.setText("Notfall");

    buttonVormerkung = new Button(formGroup, SWT.NONE);
    final FormData fd_buttonVormerkung = new FormData();
    fd_buttonVormerkung.bottom = new FormAttachment(0, 59);
    fd_buttonVormerkung.top = new FormAttachment(0, 36);
    fd_buttonVormerkung.right = new FormAttachment(0, 204);
    fd_buttonVormerkung.left = new FormAttachment(0, 104);
    buttonVormerkung.setLayoutData(fd_buttonVormerkung);
    buttonVormerkung.setToolTipText("Blendet alle fr eine Vormerkung nicht relevanten Felder aus");
    buttonVormerkung.setText("Transport");
    buttonVormerkung.addSelectionListener(new SelectionAdapter() {

        int index;

        public void widgetSelected(final SelectionEvent e) {
            planungGroup_1.setVisible(false);
            planungGroup.setVisible(true);
            transportdetailsGroup.setVisible(false);
            statusmeldungenGroup.setVisible(false);
            personalAmFahrzeugGroup.setVisible(false);
            dateTime.setEnabled(true);
            viewerAssign.getTable().setSelection(-1);// deselect
            assignCarGroup.setVisible(false);
            buttonMehrfachtransport.setEnabled(true);
            buttonADDMehrfachtransport.setEnabled(true);

            transportType = "prebooking";

            // set possible priorities
            index = comboPrioritaet.getSelectionIndex();
            if (index != -1)
                tmpPriority = comboPrioritaet.getItem(index);

            if (transportType.equalsIgnoreCase("prebooking")) {
                comboPrioritaet.setItems(prebookingPriorities);
                comboPrioritaet.setText(tmpPriority);
            }
            if (transportType.equalsIgnoreCase("emergencyTransport")) {
                comboPrioritaet.setItems(emergencyAndTransportPriorities);
                comboPrioritaet.setText(tmpPriority);
            }
        }
    });

    createdBy = new Text(formGroup, SWT.BORDER);
    final FormData fd_crreatedBy = new FormData();
    fd_crreatedBy.bottom = new FormAttachment(0, 108);
    fd_crreatedBy.top = new FormAttachment(0, 88);
    fd_crreatedBy.right = new FormAttachment(0, 102);
    fd_crreatedBy.left = new FormAttachment(0, 2);
    createdBy.setLayoutData(fd_crreatedBy);
    createdBy.setToolTipText("Aufgenommen von");
    createdBy.setEditable(false);

    disposedBy = new Text(formGroup, SWT.BORDER);
    final FormData fd_disposedBy = new FormData();
    fd_disposedBy.bottom = new FormAttachment(0, 108);
    fd_disposedBy.top = new FormAttachment(0, 88);
    fd_disposedBy.right = new FormAttachment(0, 204);
    fd_disposedBy.left = new FormAttachment(0, 104);
    disposedBy.setLayoutData(fd_disposedBy);
    disposedBy.setToolTipText("Disponiert von");
    disposedBy.setEditable(false);

    buttonDialyse = new Button(formGroup, SWT.NONE);
    final FormData fd_buttonDialye = new FormData();
    fd_buttonDialye.bottom = new FormAttachment(0, 25);
    fd_buttonDialye.top = new FormAttachment(0, 2);
    fd_buttonDialye.right = new FormAttachment(0, 102);
    fd_buttonDialye.left = new FormAttachment(0, 2);
    buttonDialyse.setLayoutData(fd_buttonDialye);
    buttonDialyse.setToolTipText("Erstellt einen Dialysetransport");
    buttonDialyse.setText("Dialyse");
    buttonDialyse.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            DialysisPatient dia = new DialysisPatient();
            if (!textFromStreet.getText().equalsIgnoreCase(""))
                dia.setFromStreet(textFromStreet.getText());
            else
                dia.setFromStreet("<bitte ausfllen>");

            if (!textFromCity.getText().equalsIgnoreCase(""))
                dia.setFromCity(textFromCity.getText());
            else
                dia.setFromCity("<bitte ausfllen>");

            dia.setToStreet(textToStreet.getText());

            dia.setToCity(textToCity.getText());
            int index = zustaendigeOrtsstelle.getCombo().getSelectionIndex();
            if (index != -1)
                dia.setLocation((Location) zustaendigeOrtsstelle.getElementAt(index));

            Calendar startTime = convertStringToDate(textAbf.getText());
            if (startTime != null) {
                startTime.set(Calendar.YEAR, dateTime.getYear());
                startTime.set(Calendar.MONTH, dateTime.getMonth());
                startTime.set(Calendar.DAY_OF_MONTH, dateTime.getDay());

                dia.setPlannedStartOfTransport(startTime.getTimeInMillis());
            } else
                dia.setPlannedStartOfTransport(0);

            Calendar patientTime = convertStringToDate(textBeiPat.getText());
            if (patientTime != null) {
                patientTime.set(Calendar.YEAR, dateTime.getYear());
                patientTime.set(Calendar.MONTH, dateTime.getMonth());
                patientTime.set(Calendar.DAY_OF_MONTH, dateTime.getDay());
                dia.setPlannedTimeAtPatient(patientTime.getTimeInMillis());
            } else
                dia.setPlannedTimeAtPatient(0);

            Calendar appointmentTime = convertStringToDate(textTermin.getText());
            if (appointmentTime != null) {
                appointmentTime.set(Calendar.YEAR, dateTime.getYear());
                appointmentTime.set(Calendar.MONTH, dateTime.getMonth());
                appointmentTime.set(Calendar.DAY_OF_MONTH, dateTime.getDay());
                dia.setAppointmentTimeAtDialysis(appointmentTime.getTimeInMillis());
            } else
                dia.setAppointmentTimeAtDialysis(0);

            // the kind of transport
            index = combokindOfTransport.getSelectionIndex();
            if (index != -1)
                dia.setKindOfTransport(combokindOfTransport.getItem(index));

            Patient patient = new Patient(patientFirstName.getText(), patientLastName.getText());
            dia.setPatient(patient);

            DialysisForm form = new DialysisForm(dia, true);
            form.open();

            getShell().close();
        }
    });

    buttonMehrfachtransport = new Button(formGroup, SWT.NONE);
    final FormData fd_buttonMehrfachtransport = new FormData();
    fd_buttonMehrfachtransport.bottom = new FormAttachment(0, 59);
    fd_buttonMehrfachtransport.top = new FormAttachment(0, 36);
    fd_buttonMehrfachtransport.right = new FormAttachment(0, 102);
    fd_buttonMehrfachtransport.left = new FormAttachment(0, 2);
    buttonMehrfachtransport.setLayoutData(fd_buttonMehrfachtransport);
    buttonMehrfachtransport.setToolTipText("Mehrfachtransportfenster ffnen");
    buttonMehrfachtransport.setText("Mehrfachtransport");
    buttonMehrfachtransport.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            hookContextMenu();
            mehrfachtransport = true;
            buttonMehrfachtransport.setEnabled(false);
            buttonADDMehrfachtransport.setEnabled(true);
            multiTransportGroup.setVisible(true);
            assignCarGroup.setVisible(false);
            buttonAssignCar.setEnabled(false);

            // remove all transports from the multi transport list
            multiTransportProvider.removeAllTransports();
            viewer.refresh();
        }
    });

    buttonADDMehrfachtransport = new Button(formGroup, SWT.NONE);
    final FormData fd_buttonADDMehrfachtransport = new FormData();
    fd_buttonADDMehrfachtransport.bottom = new FormAttachment(0, 83);
    fd_buttonADDMehrfachtransport.top = new FormAttachment(0, 60);
    fd_buttonADDMehrfachtransport.right = new FormAttachment(0, 102);
    fd_buttonADDMehrfachtransport.left = new FormAttachment(0, 2);
    buttonADDMehrfachtransport.setLayoutData(fd_buttonADDMehrfachtransport);
    buttonADDMehrfachtransport.setToolTipText("Mehrfachtransport hinzufgen");
    buttonADDMehrfachtransport.setText("hinzufgen");
    buttonADDMehrfachtransport.setEnabled(false);
    buttonADDMehrfachtransport.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            // make a difference between immediate and final transports
            finalMultiTransportKlick = false;
            // check the fields
            if (!handleOK())
                return;

            // copy the transport (don't use the same objects (transport,
            // patient, caller)!!
            Patient newPatient = new Patient();
            CallerDetail newCaller = new CallerDetail();
            if (transport.getPatient() != null) {
                newPatient.setLastname(transport.getPatient().getLastname());
                newPatient.setFirstname(transport.getPatient().getFirstname());
            }
            if (transport.getCallerDetail() != null) {
                newCaller.setCallerName(transport.getCallerDetail().getCallerName());
                newCaller.setCallerTelephoneNumber(transport.getCallerDetail().getCallerTelephoneNumber());
            }
            Transport newTransport = Util.copyTransport(transport);
            newTransport.setPatient(newPatient);
            newTransport.setCallerDetail(newCaller);
            // add the created transport to the table object list
            multiTransportProvider.addTransport(newTransport);

            // refresh the viewer
            viewer.refresh();
        }
    });

    buttonAssignCar = new Button(formGroup, SWT.NONE);
    final FormData fd_buttonAssignCar = new FormData();
    fd_buttonAssignCar.bottom = new FormAttachment(0, 83);
    fd_buttonAssignCar.top = new FormAttachment(0, 60);
    fd_buttonAssignCar.right = new FormAttachment(0, 204);
    fd_buttonAssignCar.left = new FormAttachment(0, 104);
    buttonAssignCar.setLayoutData(fd_buttonAssignCar);
    buttonAssignCar.setToolTipText("Fahrzeug zuweisen");
    buttonAssignCar.setText("Fahrzeug zuweisen");
    buttonAssignCar.setEnabled(false);
    buttonAssignCar.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            mehrfachtransport = false;
            buttonMehrfachtransport.setEnabled(false);
            buttonADDMehrfachtransport.setEnabled(false);
            multiTransportGroup.setVisible(false);

            // remove all transports from the multi transport list
            multiTransportProvider.removeAllTransports();
            viewer.refresh();

            viewerAssign.refresh();
            assignCarGroup.setVisible(true);
        }
    });
}

From source file:bndtools.editor.components.ComponentDetailsPage.java

License:Open Source License

void fillMainSection(FormToolkit toolkit, Section section) {
    FieldDecoration contentProposalDecoration = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
    ControlDecoration decor;/*from  w ww .j a va2 s. c  o  m*/

    Composite composite = toolkit.createComposite(section);
    section.setClient(composite);

    Hyperlink lnkName = toolkit.createHyperlink(composite, "Name:", SWT.NONE);
    txtName = toolkit.createText(composite, "", SWT.BORDER);
    decor = new ControlDecoration(txtName, SWT.LEFT | SWT.TOP, composite);
    decor.setImage(contentProposalDecoration.getImage());
    decor.setDescriptionText("Content assist available"); // TODO: keystrokes
    decor.setShowHover(true);
    decor.setShowOnlyOnFocus(true);

    KeyStroke assistKeyStroke = null;
    try {
        assistKeyStroke = KeyStroke.getInstance("Ctrl+Space");
    } catch (ParseException x) {
        // Ignore
    }
    ComponentNameProposalProvider proposalProvider = new ComponentNameProposalProvider(
            new FormPartJavaSearchContext(this));
    ContentProposalAdapter proposalAdapter = new ContentProposalAdapter(txtName, new TextContentAdapter(),
            proposalProvider, assistKeyStroke, UIConstants.autoActivationCharacters());
    proposalAdapter.addContentProposalListener(proposalProvider);
    proposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
    proposalAdapter.setAutoActivationDelay(1500);
    proposalAdapter.setLabelProvider(ComponentNameProposalProvider.createLabelProvider());

    toolkit.createLabel(composite, ""); // Spacer
    btnEnabled = toolkit.createButton(composite, "Enabled", SWT.CHECK);

    // Listeners
    lnkName.addHyperlinkListener(new HyperlinkAdapter() {
        @Override
        public void linkActivated(HyperlinkEvent e) {
            listPart.doOpenComponent(selected.getName());
        }
    });
    txtName.addListener(SWT.Modify, new Listener() {
        public void handleEvent(Event event) {
            if (refreshers.get() == 0) {
                String oldName = selected.getName();
                String newName = txtName.getText();
                selected.setName(newName);

                listPart.updateLabel(oldName, newName);
                markDirty(PROP_COMPONENT_NAME);
                updateVisibility();
            }
        }
    });
    btnEnabled.addListener(SWT.Modify, new MarkDirtyListener(ServiceComponent.COMPONENT_ENABLED));

    // Layout
    GridData gd;
    composite.setLayout(new GridLayout(2, false));

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalIndent = 5;
    txtName.setLayoutData(gd);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalIndent = 5;
    txtName.setLayoutData(gd);
}

From source file:bndtools.editor.components.ComponentSvcRefWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    setTitle("Edit Service Reference");

    KeyStroke assistKeyStroke = null;
    try {//from w  w  w . ja v a2  s . com
        assistKeyStroke = KeyStroke.getInstance("Ctrl+Space");
    } catch (ParseException x) {
        // Ignore
    }
    FieldDecoration assistDecor = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);

    Composite composite = new Composite(parent, SWT.NONE);

    new Label(composite, SWT.NONE).setText("Name:");
    txtName = new Text(composite, SWT.BORDER);

    new Label(composite, SWT.NONE).setText("Interface:");
    txtInterface = new Text(composite, SWT.BORDER);
    ControlDecoration decorInterface = new ControlDecoration(txtInterface, SWT.LEFT | SWT.TOP, composite);
    decorInterface.setImage(assistDecor.getImage());
    decorInterface.setDescriptionText("Content assist available");
    decorInterface.setShowHover(true);
    decorInterface.setShowOnlyOnFocus(true);

    // Add content proposal to svc interface field
    SvcInterfaceProposalProvider proposalProvider = new SvcInterfaceProposalProvider(searchContext);
    ContentProposalAdapter interfaceProposalAdapter = new ContentProposalAdapter(txtInterface,
            new TextContentAdapter(), proposalProvider, assistKeyStroke,
            UIConstants.autoActivationCharacters());
    interfaceProposalAdapter.addContentProposalListener(proposalProvider);
    interfaceProposalAdapter.setAutoActivationDelay(1500);
    interfaceProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
    interfaceProposalAdapter.setLabelProvider(new JavaContentProposalLabelProvider());

    new Label(composite, SWT.NONE).setText("Bind:");
    txtBind = new Text(composite, SWT.BORDER);
    ControlDecoration decorBind = new ControlDecoration(txtBind, SWT.LEFT | SWT.TOP, composite);
    decorBind.setImage(assistDecor.getImage());
    decorBind.setDescriptionText("Content assist available");
    decorBind.setShowHover(true);
    decorBind.setShowOnlyOnFocus(true);

    MethodProposalProvider bindProposalProvider = new MethodProposalProvider(searchContext);
    ContentProposalAdapter bindProposalAdapter = new ContentProposalAdapter(txtBind, new TextContentAdapter(),
            bindProposalProvider, assistKeyStroke, UIConstants.autoActivationCharacters());
    bindProposalAdapter.addContentProposalListener(bindProposalProvider);
    bindProposalAdapter.setAutoActivationDelay(1500);
    bindProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
    bindProposalAdapter.setLabelProvider(new MethodProposalLabelProvider());

    new Label(composite, SWT.NONE).setText("Unbind:");
    txtUnbind = new Text(composite, SWT.BORDER);
    ControlDecoration decorUnbind = new ControlDecoration(txtUnbind, SWT.LEFT | SWT.TOP, composite);
    decorUnbind.setImage(assistDecor.getImage());
    decorUnbind.setDescriptionText("Content assist available");
    decorUnbind.setShowHover(true);
    decorUnbind.setShowOnlyOnFocus(true);
    ContentProposalAdapter unbindProposalAdapter = new ContentProposalAdapter(txtUnbind,
            new TextContentAdapter(), bindProposalProvider, assistKeyStroke,
            UIConstants.autoActivationCharacters());
    unbindProposalAdapter.addContentProposalListener(bindProposalProvider);
    unbindProposalAdapter.setAutoActivationDelay(1500);
    unbindProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
    unbindProposalAdapter.setLabelProvider(new MethodProposalLabelProvider());

    new Label(composite, SWT.NONE); // Spacer
    Composite pnlButtons = new Composite(composite, SWT.NONE);
    btnOptional = new Button(pnlButtons, SWT.CHECK);
    btnOptional.setText("Optional");
    btnMultiple = new Button(pnlButtons, SWT.CHECK);
    btnMultiple.setText("Multiple");
    btnDynamic = new Button(pnlButtons, SWT.CHECK);
    btnDynamic.setText("Dynamic");

    new Label(composite, SWT.NONE).setText("Target Filter:");
    txtTargetFilter = new Text(composite, SWT.BORDER);

    // Initialise
    initialiseFields();
    validate();

    // Listeners
    ModifyListener nameAndInterfaceModifyListener = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            String name = emptyToNull(txtName.getText());
            String clazz = emptyToNull(txtInterface.getText());
            if (name == null)
                name = clazz;

            serviceReference.setName(name);
            serviceReference.setServiceClass(clazz);
            validate();
        }
    };
    txtName.addModifyListener(nameAndInterfaceModifyListener);
    txtInterface.addModifyListener(nameAndInterfaceModifyListener);
    txtBind.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            serviceReference.setBind(emptyToNull(txtBind.getText()));
            validate();
        }
    });
    txtUnbind.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            serviceReference.setUnbind(emptyToNull(txtUnbind.getText()));
            validate();
        }
    });
    btnOptional.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            serviceReference.setOptional(btnOptional.getSelection());
            validate();
        }
    });
    btnMultiple.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            serviceReference.setMultiple(btnMultiple.getSelection());
            validate();
        }
    });
    btnDynamic.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            serviceReference.setDynamic(btnDynamic.getSelection());
            validate();
        }
    });
    txtTargetFilter.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            serviceReference.setTargetFilter(emptyToNull(txtTargetFilter.getText()));
        }
    });

    // Layout
    GridLayout layout;

    layout = new GridLayout(4, false);
    composite.setLayout(layout);
    txtName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
    txtInterface.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
    txtBind.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    txtUnbind.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    txtTargetFilter.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));

    pnlButtons.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 3, 1));
    layout = new GridLayout(1, true);
    //      layout.horizontalSpacing = 0;
    //      layout.verticalSpacing = 0;
    //      layout.marginHeight = 0;
    //      layout.marginWidth = 0;
    pnlButtons.setLayout(layout);

    setControl(composite);
}

From source file:bndtools.editor.components.SvcInterfaceSelectionDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Control dialogArea = super.createDialogArea(parent);

    FieldDecoration proposalDecoration = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);

    KeyStroke assistKeyStroke = null;
    try {//from   w ww.j a va 2  s .c  o m
        assistKeyStroke = KeyStroke.getInstance("Ctrl+Space");
    } catch (ParseException x) {
        // Ignore
    }

    Text textField = getText();
    ControlDecoration decor = new ControlDecoration(textField, SWT.LEFT | SWT.TOP);
    decor.setImage(proposalDecoration.getImage());
    decor.setDescriptionText(MessageFormat.format(
            "Content Assist is available. Press {0} or start typing to activate", assistKeyStroke.format()));
    decor.setShowHover(true);
    decor.setShowOnlyOnFocus(true);

    SvcInterfaceProposalProvider proposalProvider = new SvcInterfaceProposalProvider(searchContext);
    ContentProposalAdapter proposalAdapter = new ContentProposalAdapter(textField, new TextContentAdapter(),
            proposalProvider, assistKeyStroke, UIConstants.autoActivationCharacters());
    proposalAdapter.addContentProposalListener(proposalProvider);
    proposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
    proposalAdapter.setLabelProvider(new JavaContentProposalLabelProvider());
    proposalAdapter.setAutoActivationDelay(1500);

    return dialogArea;
}

From source file:bndtools.editor.contents.GeneralInfoPart.java

License:Open Source License

private void createSection(Section section, FormToolkit toolkit) {
    section.setText("Basic Information");

    KeyStroke assistKeyStroke = null;
    try {/*ww  w  .  jav a2s  . c  o m*/
        assistKeyStroke = KeyStroke.getInstance("Ctrl+Space");
    } catch (ParseException x) {
        // Ignore
    }
    FieldDecoration contentAssistDecoration = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);

    Composite composite = toolkit.createComposite(section);
    section.setClient(composite);

    toolkit.createLabel(composite, "Version:");
    txtVersion = toolkit.createText(composite, "", SWT.BORDER);
    ToolTips.setupMessageAndToolTipFromSyntax(txtVersion, Constants.BUNDLE_VERSION);

    Hyperlink linkActivator = toolkit.createHyperlink(composite, "Activator:", SWT.NONE);
    txtActivator = toolkit.createText(composite, "", SWT.BORDER);
    ToolTips.setupMessageAndToolTipFromSyntax(txtActivator, Constants.BUNDLE_ACTIVATOR);

    toolkit.createLabel(composite, "Declarative Services:");
    cmbComponents = new Combo(composite, SWT.READ_ONLY);

    // Content Proposal for the Activator field
    ContentProposalAdapter activatorProposalAdapter = null;

    ActivatorClassProposalProvider proposalProvider = new ActivatorClassProposalProvider();
    activatorProposalAdapter = new ContentProposalAdapter(txtActivator, new TextContentAdapter(),
            proposalProvider, assistKeyStroke, UIConstants.autoActivationCharacters());
    activatorProposalAdapter.addContentProposalListener(proposalProvider);
    activatorProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
    activatorProposalAdapter.setLabelProvider(new JavaContentProposalLabelProvider());
    activatorProposalAdapter.setAutoActivationDelay(1000);

    // Decorator for the Activator field
    ControlDecoration decorActivator = new ControlDecoration(txtActivator, SWT.LEFT | SWT.CENTER, composite);
    decorActivator.setImage(contentAssistDecoration.getImage());
    decorActivator.setMarginWidth(3);
    if (assistKeyStroke == null) {
        decorActivator.setDescriptionText("Content Assist is available. Start typing to activate");
    } else {
        decorActivator.setDescriptionText(
                MessageFormat.format("Content Assist is available. Press {0} or start typing to activate",
                        assistKeyStroke.format()));
    }
    decorActivator.setShowOnlyOnFocus(true);
    decorActivator.setShowHover(true);

    // Decorator for the Components combo
    ControlDecoration decorComponents = new ControlDecoration(cmbComponents, SWT.LEFT | SWT.CENTER, composite);
    decorComponents.setImage(FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
    decorComponents.setMarginWidth(3);
    decorComponents.setDescriptionText("Use Java annotations to detect Declarative Service Components.");
    decorComponents.setShowOnlyOnFocus(false);
    decorComponents.setShowHover(true);

    // Listeners
    txtVersion.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            lock.ifNotModifying(new Runnable() {
                @Override
                public void run() {
                    addDirtyProperty(Constants.BUNDLE_VERSION);
                }
            });
        }
    });
    cmbComponents.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            lock.ifNotModifying(new Runnable() {
                @Override
                public void run() {
                    ComponentChoice old = componentChoice;

                    int index = cmbComponents.getSelectionIndex();
                    if (index >= 0 && index < ComponentChoice.values().length) {
                        componentChoice = ComponentChoice.values()[cmbComponents.getSelectionIndex()];
                        if (old != componentChoice) {
                            addDirtyProperty(aQute.bnd.osgi.Constants.SERVICE_COMPONENT);
                            addDirtyProperty(aQute.bnd.osgi.Constants.DSANNOTATIONS);
                            if (old == null) {
                                cmbComponents.remove(ComponentChoice.values().length);
                            }
                        }
                    }
                }
            });
        }
    });
    txtActivator.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent ev) {
            lock.ifNotModifying(new Runnable() {
                @Override
                public void run() {
                    addDirtyProperty(Constants.BUNDLE_ACTIVATOR);
                }
            });
        }
    });
    linkActivator.addHyperlinkListener(new HyperlinkAdapter() {
        @Override
        public void linkActivated(HyperlinkEvent ev) {
            String activatorClassName = txtActivator.getText();
            if (activatorClassName != null && activatorClassName.length() > 0) {
                try {
                    IJavaProject javaProject = getJavaProject();
                    if (javaProject == null)
                        return;

                    IType activatorType = javaProject.findType(activatorClassName);
                    if (activatorType != null) {
                        JavaUI.openInEditor(activatorType, true, true);
                    }
                } catch (PartInitException e) {
                    ErrorDialog.openError(getManagedForm().getForm().getShell(), "Error", null,
                            new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0,
                                    MessageFormat.format("Error opening an editor for activator class '{0}'.",
                                            activatorClassName),
                                    e));
                } catch (JavaModelException e) {
                    ErrorDialog.openError(getManagedForm().getForm().getShell(), "Error", null,
                            new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, MessageFormat.format(
                                    "Error searching for activator class '{0}'.", activatorClassName), e));
                }
            }
        }
    });
    activatorProposalAdapter.addContentProposalListener(new IContentProposalListener() {
        @Override
        public void proposalAccepted(IContentProposal proposal) {
            if (proposal instanceof JavaContentProposal) {
                String selectedPackageName = ((JavaContentProposal) proposal).getPackageName();
                if (!model.isIncludedPackage(selectedPackageName)) {
                    model.addPrivatePackage(selectedPackageName);
                }
            }
        }
    });

    // Layout
    GridLayout layout = new GridLayout(2, false);
    layout.horizontalSpacing = 15;

    composite.setLayout(layout);

    GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false);

    txtVersion.setLayoutData(gd);
    txtActivator.setLayoutData(gd);
    cmbComponents.setLayoutData(gd);
}

From source file:bndtools.editor.pkgpatterns.PkgPatternsDetailsPage.java

License:Open Source License

public void createContents(Composite parent) {
    FormToolkit toolkit = getManagedForm().getToolkit();

    FieldDecoration assistDecor = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
    KeyStroke assistKeyStroke = null;
    try {/*from  w  w  w  . j a  v a2 s . com*/
        assistKeyStroke = KeyStroke.getInstance("Ctrl+Space");
    } catch (ParseException x) {
        // Ignore
    }

    Section mainSection = toolkit.createSection(parent, Section.TITLE_BAR);
    mainSection.setText(title);

    mainComposite = toolkit.createComposite(mainSection);
    mainSection.setClient(mainComposite);

    toolkit.createLabel(mainComposite, "Pattern:");
    txtName = toolkit.createText(mainComposite, "", SWT.BORDER);
    ControlDecoration decPattern = new ControlDecoration(txtName, SWT.LEFT | SWT.TOP, mainComposite);
    decPattern.setImage(assistDecor.getImage());
    decPattern.setDescriptionText(MessageFormat.format(
            "Content assist is available. Press {0} or start typing to activate", assistKeyStroke.format()));
    decPattern.setShowHover(true);
    decPattern.setShowOnlyOnFocus(true);

    PkgPatternsProposalProvider proposalProvider = new PkgPatternsProposalProvider(
            new FormPartJavaSearchContext(this));
    ContentProposalAdapter patternProposalAdapter = new ContentProposalAdapter(txtName,
            new TextContentAdapter(), proposalProvider, assistKeyStroke,
            UIConstants.autoActivationCharacters());
    patternProposalAdapter.addContentProposalListener(proposalProvider);
    patternProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_IGNORE);
    patternProposalAdapter.setAutoActivationDelay(1000);
    patternProposalAdapter.setLabelProvider(new PkgPatternProposalLabelProvider());
    patternProposalAdapter.addContentProposalListener(new IContentProposalListener() {
        public void proposalAccepted(IContentProposal proposal) {
            PkgPatternProposal patternProposal = (PkgPatternProposal) proposal;
            String toInsert = patternProposal.getContent();
            int currentPos = txtName.getCaretPosition();
            txtName.setSelection(patternProposal.getReplaceFromPos(), currentPos);
            txtName.insert(toInsert);
            txtName.setSelection(patternProposal.getCursorPosition());
        }
    });

    toolkit.createLabel(mainComposite, "Version:");
    txtVersion = toolkit.createText(mainComposite, "", SWT.BORDER);

    /*
     * Section attribsSection = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE);
     * attribsSection.setText("Extra Attributes"); Composite attribsComposite =
     * toolkit.createComposite(attribsSection);
     */

    // Listeners
    txtName.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (!modifyLock.isUnderModification()) {
                if (selectedClauses.size() == 1) {
                    selectedClauses.get(0).setName(txtName.getText());
                    if (listPart != null) {
                        listPart.updateLabels(selectedClauses);
                        listPart.validate();
                    }
                    markDirty();
                }
            }
        }
    });
    txtVersion.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (!modifyLock.isUnderModification()) {
                String text = txtVersion.getText();
                if (text.length() == 0)
                    text = null;

                for (HeaderClause clause : selectedClauses) {
                    clause.getAttribs().put(Constants.VERSION_ATTRIBUTE, text);
                }
                if (listPart != null) {
                    listPart.updateLabels(selectedClauses);
                    listPart.validate();
                }
                markDirty();
            }
        }
    });

    // Layout
    GridData gd;

    parent.setLayout(new GridLayout());
    mainSection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    mainComposite.setLayout(new GridLayout(2, false));

    gd = new GridData(SWT.FILL, SWT.TOP, true, false);
    gd.horizontalIndent = 5;
    gd.widthHint = 100;
    txtName.setLayoutData(gd);

    gd = new GridData(SWT.FILL, SWT.TOP, true, false);
    gd.horizontalIndent = 5;
    gd.widthHint = 100;
    txtVersion.setLayoutData(gd);
}

From source file:ca.uvic.chisel.javasketch.persistence.ui.internal.FiltersComposite.java

License:Open Source License

/**
 * @param group//from   w  ww.  j a  v  a  2s  .c o  m
 * @return
 */
private TableViewer createTableArea(Group group) {
    group.setLayout(new GridLayout(3, false));
    final Text addText = new Text(group, SWT.SINGLE | SWT.BORDER);
    addText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
    final Button addButton = new Button(group, SWT.PUSH);
    addButton.setText("Add");
    addButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
    Button removeButton = new Button(group, SWT.PUSH);
    removeButton.setText("Remove");
    addButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
    TableViewer tableViewer = new TableViewer(group);
    tableViewer.getTable().setLinesVisible(true);
    GridData tableData = new GridData(GridData.FILL, GridData.FILL, true, true);
    tableData.horizontalSpan = 3;
    tableViewer.getTable().setLayoutData(tableData);
    //      TableLayout tl = new TableLayout();
    //      tableViewer.getTable().setLayout(tl);
    final TableViewerColumn labelColumn = new TableViewerColumn(tableViewer, SWT.NONE);
    labelColumn.setLabelProvider(new SimpleCellLabelProvider());
    tableViewer.setLabelProvider(new SimpleCellLabelProvider());
    tableViewer.setContentProvider(new ArrayContentProvider());
    tableViewer.setInput(new String[0]);
    addText.addModifyListener(
            new AddFilterAssistListener(addButton, new ControlDecoration(addText, SWT.TOP | SWT.LEFT)));
    AddFilterListener addInclusionListener = new AddFilterListener(addText, tableViewer);
    addButton.addSelectionListener(addInclusionListener);
    addButton.addKeyListener(addInclusionListener);
    addText.addFocusListener(new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent e) {
            getShell().setDefaultButton(addButton);
        }
    });
    removeButton.addSelectionListener(new RemoveItemListener(tableViewer));
    try {
        new ContentProposalAdapter(addText, new TextContentAdapter(), new SimpleJavaContentProposalProvider(),
                KeyStroke.getInstance("Ctrl+Space"), new char[] { '.' });
    } catch (ParseException e1) {
    }
    tableViewer.getTable().addControlListener(new ControlAdapter() {
        /* (non-Javadoc)
         * @see org.eclipse.swt.events.ControlAdapter#controlResized(org.eclipse.swt.events.ControlEvent)
         */
        @Override
        public void controlResized(ControlEvent e) {
            labelColumn.getColumn().setWidth(((Table) e.widget).getClientArea().width);
        }
    });
    return tableViewer;
}