List of usage examples for org.eclipse.jface.fieldassist AutoCompleteField AutoCompleteField
public AutoCompleteField(Control control, IControlContentAdapter controlContentAdapter, String... proposals)
From source file:at.rc.tacos.client.view.DialysisForm.java
License:Open Source License
/** * Create contents of the window/* w w w .j a v a 2 s. 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. ja va2 s. com*/ */ 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:ca.mcgill.cs.swevo.qualyzer.dialogs.CodeChooserDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { GridLayout layout = new GridLayout(2, false); Composite body = new Composite(parent, SWT.NULL); body.setLayout(layout);/*from w w w. j av a 2 s .com*/ body.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Label label = new Label(body, SWT.NULL); label.setText(Messages.getString("dialogs.CodeChooserDialog.code")); //$NON-NLS-1$ fCodeName = new Combo(body, SWT.BORDER | SWT.DROP_DOWN); fCodeName.setText(""); //$NON-NLS-1$ fCodeName.setLayoutData(new GridData(SWT.FILL, SWT.NULL, true, false)); label = new Label(body, SWT.NULL); label.setText(Messages.getString("dialogs.CodeChooserDialog.description")); //$NON-NLS-1$ fDescription = new StyledText(body, SWT.WRAP | SWT.BORDER); fDescription.setText(""); //$NON-NLS-1$ fDescription.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); fProposals = buildProposals(); for (String prop : fProposals) { fCodeName.add(prop); } @SuppressWarnings("unused") AutoCompleteField field = new AutoCompleteField(fCodeName, new ComboContentAdapter(), fProposals); fCodeName.addModifyListener(createModifyListener()); return parent; }
From source file:ch.unibe.iam.scg.archie.ui.views.SidebarView.java
License:Open Source License
/** * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) *///w ww. java2 s.co m @Override public void createPartControl(final Composite parent) { // create a new container for sidebar controls Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); container.setLayout(layout); // Create a simple field for auto complete. Group availableStatistics = new Group(container, SWT.NONE); availableStatistics.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); availableStatistics.setLayout(layout); availableStatistics.setText(Messages.STATISTICS_LIST_TITLE); // Create an auto-complete field TreeMap<String, AbstractDataProvider> providers = ArchieActivator.getInstance().getProviderTable(); String[] availableTitles = providers.keySet().toArray(new String[providers.size()]); this.list = new Combo(availableStatistics, SWT.BORDER | SWT.DROP_DOWN); this.list.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.autoComplete = new AutoCompleteField(this.list, new ComboContentAdapter(), availableTitles); this.list.setItems(availableTitles); // NOTE: Currently does not work on GTK, any maybe not even on OS X // TODO: Add value in Archie preference pane. this.list.setVisibleItemCount(5); // add listeners this.list.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String title = SidebarView.this.list.getText(); if (SidebarView.this.isValidProviderTitle(title)) { AbstractDataProvider provider = ArchieActivator.getInstance().getProviderTable().get(title); ProviderManager.getInstance().setProvider(provider); } else { SidebarView.this.details.reset(); } } }); // Add parameters group. Group statisticParameters = new Group(container, SWT.NONE); statisticParameters.setLayoutData(new GridData(GridData.FILL_BOTH)); statisticParameters.setLayout(layout); statisticParameters.setText(Messages.STATISTIC_PARAMETERS_TITLE); // Add details panel containing details and parameters. this.details = new DetailsPanel(statisticParameters, SWT.NONE); this.details.addPropertyChangeListener(this); // Disable by default if user has no access rights. this.setEnabled(ArchieACL.userHasAccess()); // Register this view for UserChanged events. ElexisEventDispatcher.getInstance().addListeners(eeli_user); }
From source file:ch.unibe.iam.scg.archie.ui.views.StatisticsSidebarView.java
License:Open Source License
/** * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */// w w w.j a v a2 s . c om @Override public void createPartControl(final Composite parent) { // fill statistics table this.initializeAvailableStatistics(); // create a new container for sidebar controls Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); container.setLayout(layout); // Create a simple field for auto complete. Group availableStatistics = new Group(container, SWT.NONE); availableStatistics.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); availableStatistics.setLayout(layout); availableStatistics.setText(Messages.STATISTICS_LIST_TITLE); // Create an auto-complete field String[] availableTitles = this.providers.keySet().toArray(new String[this.providers.size()]); this.list = new Combo(availableStatistics, SWT.BORDER | SWT.DROP_DOWN); this.list.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.autoComplete = new AutoCompleteField(this.list, new ComboContentAdapter(), availableTitles); this.list.setItems(availableTitles); // add listeners this.list.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String title = StatisticsSidebarView.this.list.getText(); if (StatisticsSidebarView.this.isValidProviderTitle(title)) { AbstractDataProvider provider = StatisticsSidebarView.this.providers.get(title); ProviderManager.getInstance().setProvider(provider); } else { StatisticsSidebarView.this.details.reset(); } } }); // Add parameters group. Group statisticParameters = new Group(container, SWT.NONE); statisticParameters.setLayoutData(new GridData(GridData.FILL_BOTH)); statisticParameters.setLayout(layout); statisticParameters.setText(Messages.STATISTIC_PARAMETERS_TITLE); // Add details panel containing details and parameters. this.details = new DetailsPanel(statisticParameters, SWT.NONE); this.details.addPropertyChangeListener(this); // Disable by default if user has no access rights. this.setEnabled(ArchieACL.userHasAccess()); // Register this view for UserChanged events. GlobalEvents.getInstance().addUserListener(this); }
From source file:cn.ieclipse.adt.ext.wizards.EditComponentWizardPage.java
License:Apache License
private void createAttrFiled(Composite parent, int nColumns, ComponentAttribute attr, ComponentElement ce, Element e) {/* w w w . java 2 s . c o m*/ Control control = null; int type = attr.getType(); if (ComponentAttribute.TYPE_LIST == type) { ComboDialogField field = new ComboDialogField(SWT.BORDER); field.setDialogFieldListener( new TextDialogFieldAdapter(attr, parent.getShell(), project, e, treeViewer)); field.setLabelText(attr.getShortName()); String initText = attr.getValue(); if (attr.getFormats() != null) { field.setItems(attr.getFormats()); } if (initText != null && !"".equals(initText)) { field.selectItem(initText); } field.doFillIntoGrid(parent, nColumns); control = field.getComboControl(parent); } else if (ComponentAttribute.TYPE_MLIST == type || ComponentAttribute.TYPE_DRAWABLE == type || ComponentAttribute.TYPE_STYPE == type || ComponentAttribute.TYPE_STRING_REF == type) { StringButtonAdapter adapter = new StringButtonAdapter(attr, parent.getShell(), project, e, treeViewer); StringButtonDialogField field = new StringButtonDialogField(adapter); field.setLabelText(attr.getShortName()); field.setButtonLabel(JFaceResources.getString("openBrowse")); field.setDialogFieldListener(adapter); field.doFillIntoGrid(parent, nColumns); int w = Dialog.convertWidthInCharsToPixels(fontMetrics, 50); LayoutUtil.setWidthHint(field.getTextControl(null), w); if (attr.getValue() != null) { field.setText(attr.getValue()); } control = field.getTextControl(parent); } else if (ComponentAttribute.TYPE_STRING == type) { StringDialogField field = new StringDialogField(); field.setLabelText(attr.getShortName()); field.setDialogFieldListener(new StringButtonAdapter(attr, parent.getShell(), project, e, treeViewer)); field.doFillIntoGrid(parent, nColumns); int w = Dialog.convertWidthInCharsToPixels(fontMetrics, 50); LayoutUtil.setWidthHint(field.getTextControl(null), w); control = field.getTextControl(parent); if (attr.getValue() != null) { field.setText(attr.getValue()); } if (intentHelper != null) { if ("name".equals(attr.getShortName())) { if (ce.getName().equals("action")) { AutoCompleteField acf = new AutoCompleteField(control, new TextContentAdapter(), intentHelper.getActions().toArray(new String[] {})); } else if (ce.getName().equals("category")) { AutoCompleteField acf = new AutoCompleteField(control, new TextContentAdapter(), intentHelper.getCategories().toArray(new String[] {})); } } else if (attr.getShortName().toLowerCase().contains("permission")) { AutoCompleteField acf = new AutoCompleteField(control, new TextContentAdapter(), intentHelper.getPermissions().toArray(new String[] {})); } } } if (control != null) { TipShell.enableFor(control, attr); TipShell.setNodeName(selectedNode.getNodeName()); } }
From source file:com.aptana.git.ui.dialogs.CreateBranchDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { // Add an advanced section so users can specify a start point ref (so they can create a branch that // tracks a remote branch!) Composite composite = (Composite) super.createDialogArea(parent); // TODO Add a minimize/maximize button for the advanced section Group group = new Group(composite, SWT.DEFAULT); group.setText(Messages.CreateBranchDialog_AdvancedOptions_label); group.setLayout(new GridLayout(1, false)); group.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); Label label = new Label(group, SWT.NONE); label.setText(Messages.CreateBranchDialog_StartPoint_label); startPointText = new Text(group, getInputTextStyle()); startPointText.setText(repo.headRef().simpleRef().shortName()); startPointText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); startPointText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { startPoint = startPointText.getText(); // TODO Validate the start point. Must be branch name, commit id or tag ref if (startPoint.indexOf('/') != -1 && autoTrack) { // If name is a remote branch, turn on track by default? for (String remoteName : repo.remotes()) { if (startPoint.startsWith(remoteName + '/')) { trackButton.setSelection(true); track = true;/* w w w .j a va2s . c o m*/ break; } } } } }); Set<String> simpleRefs = repo.allSimpleRefs(); String[] proposals = simpleRefs.toArray(new String[simpleRefs.size()]); new AutoCompleteField(startPointText, new TextContentAdapter(), proposals); // Have CTRL+SPACE also trigger content assist SimpleContentProposalProvider proposalProvider = new SimpleContentProposalProvider(proposals); proposalProvider.setFiltering(true); ContentProposalAdapter adapter = new ContentProposalAdapter(startPointText, new TextContentAdapter(), proposalProvider, KeyStroke.getInstance(SWT.CONTROL, ' '), null); adapter.setPropagateKeys(true); adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); ControlDecoration decoration = new ControlDecoration(startPointText, SWT.LEFT); decoration.setImage(FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage()); trackButton = new Button(group, SWT.CHECK); trackButton.setText(Messages.CreateBranchDialog_Track_label); trackButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { track = trackButton.getSelection(); autoTrack = false; // don't change the value since user modified it here. } }); return composite; }
From source file:com.dubture.composer.ui.editor.composer.GeneralSection.java
private void createTypeEntry(Composite client, FormToolkit toolkit) { typeEntry = new FormEntry(client, toolkit, "Type", null, false); typeEntry.setValue(composerPackage.getType(), true); ControlDecoration decoration = new ControlDecoration(typeEntry.getText(), SWT.TOP | SWT.LEFT); FieldDecoration indicator = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); decoration.setImage(indicator.getImage()); decoration.setDescriptionText(indicator.getDescription() + "(Ctrl+Space)"); decoration.setShowOnlyOnFocus(true); new AutoCompleteField(typeEntry.getText(), new TextContentAdapter(), ComposerConstants.TYPES); typeEntry.addFormEntryListener(new FormEntryAdapter() { public void textValueChanged(FormEntry entry) { composerPackage.set("type", entry.getValue()); }// w w w . java2 s . c o m }); composerPackage.addPropertyChangeListener("type", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { typeEntry.setValue(composerPackage.getType(), true); } }); }
From source file:com.dubture.composer.ui.editor.composer.GeneralSection.java
private void createLicenseEntry(Composite client, FormToolkit toolkit) { licenseEntry = new FormEntry(client, toolkit, "License", null, false); ControlDecoration decoration = new ControlDecoration(licenseEntry.getText(), SWT.TOP | SWT.LEFT); FieldDecoration indicator = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); decoration.setImage(indicator.getImage()); decoration.setDescriptionText(indicator.getDescription() + "(Ctrl+Space)"); decoration.setShowOnlyOnFocus(true); new AutoCompleteField(licenseEntry.getText(), new LicenseContentAdapter(), ComposerConstants.LICENSES); final License2StringConverter converter = new License2StringConverter(); licenseEntry.setValue(converter.convert(composerPackage.getLicense()), true); licenseEntry.addFormEntryListener(new FormEntryAdapter() { String2LicenseConverter converter; public void focusGained(FormEntry entry) { converter = new String2LicenseConverter(composerPackage); }/*from ww w . j a v a2 s. c om*/ public void focusLost(FormEntry entry) { converter.convert(entry.getValue()); } }); composerPackage.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().startsWith("license")) { licenseEntry.setValue(converter.convert(composerPackage.getLicense()), true); } } }); }
From source file:com.dubture.composer.ui.wizard.project.BasicSettingsGroup.java
public void createControl(Composite composite, Shell shell) { this.shell = shell; nameComposite = new Composite(composite, SWT.NONE); nameComposite.setFont(composite.getFont()); nameComposite.setLayout(new GridLayout(2, false)); nameComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // text field for project vendor name vendorField = new StringDialogField(); vendorField.setLabelText("Vendor name"); vendorField.setDialogFieldListener(this); vendorField.doFillIntoGrid(nameComposite, 2); LayoutUtil.setHorizontalGrabbing(vendorField.getTextControl(null)); // text field for project type typeField = new StringDialogField(); typeField.setLabelText("Type"); typeField.setDialogFieldListener(this); typeField.doFillIntoGrid(nameComposite, 2); LayoutUtil.setHorizontalGrabbing(typeField.getTextControl(null)); ControlDecoration decoration = new ControlDecoration(typeField.getTextControl(), SWT.TOP | SWT.LEFT); FieldDecoration indicator = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); decoration.setImage(indicator.getImage()); decoration.setDescriptionText(indicator.getDescription() + "(Ctrl+Space)"); decoration.setShowOnlyOnFocus(true); new AutoCompleteField(typeField.getTextControl(), new TextContentAdapter(), ComposerConstants.TYPES); // text field for project description descriptionField = new StringDialogField(); descriptionField.setLabelText("Description"); descriptionField.setDialogFieldListener(this); descriptionField.doFillIntoGrid(nameComposite, 2); LayoutUtil.setHorizontalGrabbing(descriptionField.getTextControl(null)); // text field for project description keywordField = new StringDialogField(); keywordField.setLabelText("Keywords"); keywordField.setDialogFieldListener(this); keywordField.doFillIntoGrid(nameComposite, 2); LayoutUtil.setHorizontalGrabbing(keywordField.getTextControl(null)); // text field for project description licenseField = new StringDialogField(); licenseField.setLabelText("License"); licenseField.setDialogFieldListener(this); licenseField.doFillIntoGrid(nameComposite, 2); LayoutUtil.setHorizontalGrabbing(licenseField.getTextControl(null)); ControlDecoration licenseDecoration = new ControlDecoration(licenseField.getTextControl(), SWT.TOP | SWT.LEFT);/*from ww w . j a v a 2 s .com*/ licenseDecoration.setImage(indicator.getImage()); licenseDecoration.setDescriptionText(indicator.getDescription() + "(Ctrl+Space)"); licenseDecoration.setShowOnlyOnFocus(true); new AutoCompleteField(licenseField.getTextControl(), new LicenseContentAdapter(), ComposerConstants.LICENSES); }