@Override public void okPressed() { // Eingaben pruefen Date d = datum.getDate(); if (d == null || d.compareTo(new Date()) > 0) { setMessage("Es muss ein Datum ausgewählt werden. Darf nicht in " + "der Zukunft liegen."); return; } TimeTool tt; try { String sZeit = zeit.getText(); validateTime(sZeit); tt = new TimeTool(sZeit); } catch (TimeFormatException tfe) { setMessage("Es muss eine gültige Startzeit (hh:mm) eingegeben " + "werden."); return; } // Neue kons anlegen falls noetig if (kons == null) { kons = fall.neueKonsultation(); data = new KonsData(kons); ElexisEventDispatcher.fireSelectionEvent(kons); } // Eingaben speichern data.setKonsBeginn(tt.getTimeInMillis()); kons.setDatum(new TimeTool(d.getTime()).toString(TimeTool.DATE_GER), false); data.setKonsTyp(typenI[typ.getSelectionIndex()]); close(); }
@Override protected Control createDialogArea(Composite parent) { Composite comp = new Composite(parent, 0); comp.setLayout(new GridLayout(2, false)); new Label(comp, SWT.NONE).setText("Patient"); new Label(comp, SWT.NONE).setText(fall.getPatient().getLabel()); new Label(comp, SWT.NONE).setText("Fall"); new Label(comp, SWT.NONE).setText(fall.getLabel()); new Label(comp, SWT.NONE).setText("Datum"); datum = new DatePickerCombo(comp, SWT.NONE); new Label(comp, SWT.NONE).setText("Zeit"); zeit = SWTHelper.createText(comp, 1, SWT.BORDER); new Label(comp, SWT.NONE).setText("Typ"); typ = new Combo(comp, SWT.DROP_DOWN); for (String s : typenS) { typ.add(s); } // Datum- und Zeitfelder initialisieren if (kons == null) { setTitle("Neue Konsultation erstellen"); datum.setDate(new Date()); zeit.setText(new TimeTool().toString(TimeTool.TIME_SMALL)); } else { setTitle("Konsultation modifizieren"); TimeTool tt = new TimeTool(kons.getDatum()); datum.setDate(tt.getTime()); zeit.setText(data.getKonsBeginn()); neuTyp = data.getKonsTyp(); } for (int i = 0; i < typenI.length; i++) { if (neuTyp == typenI[i]) { typ.select(i); break; } } return comp; }