List of usage examples for org.eclipse.jface.viewers StructuredSelection StructuredSelection
public StructuredSelection(List elements)
List
. From source file:at.rc.tacos.client.editors.LocationEditor.java
License:Open Source License
/** * Loads the data and shows them in the view *//* www. j av a 2s. co m*/ private void loadData() { // init the editor if (isNew) { form.setText("Neue Dienststelle anlegen"); return; } // load the data form.setText("Details des Ortsstelle " + location.getLocationName()); locationName.setText(location.getLocationName()); street.setText(location.getStreet()); streetNumber.setText(location.getStreetNumber()); zipCode.setText(String.valueOf(location.getZipcode())); city.setText(location.getCity()); notesViewer.getTextWidget().setText(location.getNotes()); phoneViewer.setSelection(new StructuredSelection(location.getPhone())); }
From source file:at.rc.tacos.client.editors.SickPersonEditor.java
License:Open Source License
/** * Loads the data and shows them in the view *//*from w w w. j a v a 2s.com*/ private void loadData() { // init the editor if (isNew) { form.setText("Neuen Patienten anlegen"); removeHyperlink.setVisible(false); return; } // enable the remove link removeHyperlink.setVisible(true); // load the data form.setText("Details des Patienten " + person.getLastName()); lastname.setText(person.getLastName()); if (person.getFirstName() != null) firstname.setText(person.getFirstName()); if (person.getStreetname() != null) street.setText(person.getStreetname()); if (person.getCityname() != null) city.setText(person.getCityname()); if (person.getSVNR() != null) svnr.setText(person.getSVNR()); if (person.getKindOfTransport() != null) kindOfTransportComboViewer.setSelection(new StructuredSelection(person.getKindOfTransport())); if (person.getNotes() != null) notesViewer.getTextWidget().setText(person.getNotes()); if (person.isMale()) sexComboViewer.setSelection(new StructuredSelection(SickPerson.SICKPERSON_MALE)); else sexComboViewer.setSelection(new StructuredSelection(SickPerson.SICKPERSON_FEMALE)); }
From source file:at.rc.tacos.client.editors.StaffMemberEditor.java
License:Open Source License
/** * Loads the data and shows them in the view *//*from ww w . ja v a 2 s . c o m*/ private void loadData() { // init the editor if (isNew) { form.setText("Neuen Mitarbeiter anlegen"); return; } // set the data of the staff member form.setText("Details des Mitarbeiters " + staffMember.getFirstName() + " " + staffMember.getLastName()); staffId.setText(String.valueOf(staffMember.getStaffMemberId())); fName.setText(staffMember.getFirstName()); lName.setText(staffMember.getLastName()); if (staffMember.getPhone1() != null) phone1.setText(staffMember.getPhone1()); if (staffMember.getPhone2() != null) phone2.setText(staffMember.getPhone2()); if (staffMember.getBirthday() != null) dateOfBirth.setText(staffMember.getBirthday()); if (staffMember.isMale()) sexComboViewer.setSelection(new StructuredSelection(StaffMember.STAFF_MALE)); else sexComboViewer.setSelection(new StructuredSelection(StaffMember.STAFF_FEMALE)); primaryLocationComboViewer.setSelection(new StructuredSelection(staffMember.getPrimaryLocation())); // update the login uName.setText(loginInfo.getUsername()); locked.setSelection(loginInfo.isIslocked()); authorisationComboViewer.setSelection(new StructuredSelection(loginInfo.getAuthorization())); // update the competence view compList.clear(); compList.addAll(staffMember.getCompetenceList()); competenceViewer.refresh(true); // personal numer is not changeable staffId.setEditable(false); staffId.setBackground(CustomColors.GREY_COLOR); // username is not editable uName.setEditable(false); uName.setBackground(CustomColors.GREY_COLOR); uName.setToolTipText("Der Benutzername kann nicht verndert werden"); // validate inputChanged(); }
From source file:at.rc.tacos.client.editors.VehicleDetailEditor.java
License:Open Source License
/** * Loads the data and shows them in the view *///from w w w. j av a 2 s. co m private void loadData() { // init the editor if (isNew) { removeHyperlink.setVisible(false); form.setText("Neues Fahrzeug anlegen"); return; } // enable the remove link removeHyperlink.setVisible(true); // load all the data form.setText("Details des Fahrzeugs: " + detail.getVehicleType() + " " + detail.getVehicleName()); vehicleName.setText(detail.getVehicleName()); vehicleType.setText(detail.getVehicleType()); if (detail.getBasicStation() != null) basicLocationViewer.setSelection(new StructuredSelection(detail.getBasicStation())); if (detail.getMobilePhone() != null) phoneViewer.setSelection(new StructuredSelection(detail.getMobilePhone())); if (detail.getCurrentStation() != null) currentLocationViewer.setSelection(new StructuredSelection(detail.getCurrentStation())); }
From source file:at.rc.tacos.client.ui.custom.DatePickerPanel.java
License:Open Source License
/** * This method initializes the month combo *///www . j av a 2 s .c o m private void createTimeList(Composite composite) { DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.SHORT); Calendar tempCalendar = Calendar.getInstance(); tempCalendar.set(Calendar.MINUTE, 0); tempCalendar.set(Calendar.SECOND, 0); String[] times = new String[48]; int pos = 0; for (int x = 0; x < 24; x++) { // hour tempCalendar.set(Calendar.MINUTE, 0); tempCalendar.set(Calendar.HOUR_OF_DAY, x); times[pos] = dateFormat.format(tempCalendar.getTime()); // count up the position for the minute pos++; // minute tempCalendar.set(Calendar.MINUTE, 30); times[pos] = dateFormat.format(tempCalendar.getTime()); // count up the position for the hour pos++; } ListViewer listViewer = new ListViewer(composite); listViewer.setContentProvider(new ArrayContentProvider()); listViewer.setInput(times); timeList = listViewer.getList(); listViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { // even index -> just hour if (timeList.getSelectionIndex() % 2 == 0) { date.set(Calendar.HOUR_OF_DAY, timeList.getSelectionIndex() / 2); date.set(Calendar.MINUTE, 0); } else { date.set(Calendar.HOUR_OF_DAY, timeList.getSelectionIndex() / 2); date.set(Calendar.MINUTE, 30); } setSelection(new DateSelection(date)); notifyListeners(new SelectionChangedEvent(DatePickerPanel.this, getSelection())); } }); GridDataFactory.fillDefaults().hint(SWT.DEFAULT, 150).grab(false, true).applyTo(timeList); if (date != null) { // if we have a minute -> select it if (date.get(Calendar.MINUTE) > 0) listViewer.setSelection(new StructuredSelection(times[date.get(Calendar.HOUR_OF_DAY) + 1]), true); else listViewer.setSelection(new StructuredSelection(times[date.get(Calendar.HOUR_OF_DAY)]), true); } else { listViewer.setSelection(new StructuredSelection(times[8]), true); } timeList.addKeyListener(this); }
From source file:at.rc.tacos.client.ui.dialog.AddressSelectionDialog.java
License:Open Source License
@Override public void dataChanged(Message<Address> message, MessageIoSession messageIoSession) { viewer.refresh(true);/*from w w w.ja va 2 s . co m*/ final Object first = viewer.getElementAt(0); if (first == null) { updateStatus(new Status(IStatus.ERROR, UiWrapper.PLUGIN_ID, "Bitte whlen Sie eine Adresse aus.")); return; } // show the new address objects AddressSelectionDialog.this.viewer.setSelection(new StructuredSelection(first)); updateStatus(new Status(IStatus.INFO, UiWrapper.PLUGIN_ID, ((Address) first).toString() + " ausgewhlt")); }
From source file:at.rc.tacos.client.ui.dialog.PatientSelectionDialog.java
License:Open Source License
@Override public void dataChanged(Message<SickPerson> message, MessageIoSession messageIoSession) { // update the viewer viewer.refresh();// w w w . j av a2s .c o m final Object first = viewer.getElementAt(0); if (first != null) { PatientSelectionDialog.this.viewer.setSelection(new StructuredSelection(first)); updateStatus(new Status(IStatus.INFO, UiWrapper.PLUGIN_ID, ((SickPerson) first).getLastName() + " ausgewhlt")); } else updateStatus(new Status(IStatus.ERROR, UiWrapper.PLUGIN_ID, "Bitte whlen Sie einen Patienten aus")); }
From source file:at.rc.tacos.client.view.AddressSelectionDialog.java
License:Open Source License
/** * This listener will be informed when the server sends new address recoreds * based on the entered text/*from w w w. j a v a 2s .co m*/ */ @Override public void propertyChange(PropertyChangeEvent evt) { String event = evt.getPropertyName(); if ("ADDRESS_ADD".equalsIgnoreCase(event) || "ADDRESS_REMOVE".equalsIgnoreCase(event) || "ADDRESS_UPDATE".equalsIgnoreCase(event) || "ADDRESS_CLEARED".equalsIgnoreCase(event) || "ADDRESS_ADD_ALL".equalsIgnoreCase(event)) { viewer.refresh(true); final Object first = viewer.getElementAt(0); if (first != null) { AddressSelectionDialog.this.viewer.setSelection(new StructuredSelection(first)); updateStatus(new Status(IStatus.INFO, Activator.PLUGIN_ID, ((Address) first).toString() + " ausgewhlt")); } else updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Bitte whlen Sie eine Adresse aus.")); } }
From source file:at.rc.tacos.client.view.DialysisForm.java
License:Open Source License
/** * used to edit an dialysis entry/*from w w w .ja v a 2 s. co m*/ * * @param dialysisPatient * the dialysisPatient to edit */ public DialysisForm(DialysisPatient patient, boolean createNew) { this.createNew = createNew; this.dia = patient; createContents(); GregorianCalendar gcal = new GregorianCalendar(); // planned start of transport if (dia.getPlannedStartOfTransport() != 0) { gcal.setTimeInMillis(dia.getPlannedStartOfTransport()); String abfahrtTime = (gcal.get(GregorianCalendar.HOUR_OF_DAY) <= 9 ? "0" : "") + gcal.get(GregorianCalendar.HOUR_OF_DAY) + ":" + ((gcal.get(GregorianCalendar.MINUTE) <= 9 ? "0" : "") + gcal.get(GregorianCalendar.MINUTE)); this.textAbf.setText(abfahrtTime); } // time at patient if (dia.getPlannedTimeAtPatient() != 0) { gcal.setTimeInMillis(dia.getPlannedTimeAtPatient()); String beiPatientTime = (gcal.get(GregorianCalendar.HOUR_OF_DAY) <= 9 ? "0" : "") + gcal.get(GregorianCalendar.HOUR_OF_DAY) + ":" + ((gcal.get(GregorianCalendar.MINUTE) <= 9 ? "0" : "") + gcal.get(GregorianCalendar.MINUTE)); this.textBeiPat.setText(beiPatientTime); } // time at destination if (dia.getAppointmentTimeAtDialysis() != 0) { gcal.setTimeInMillis(dia.getAppointmentTimeAtDialysis()); String terminTime = (gcal.get(GregorianCalendar.HOUR_OF_DAY) <= 9 ? "0" : "") + gcal.get(GregorianCalendar.HOUR_OF_DAY) + ":" + ((gcal.get(GregorianCalendar.MINUTE) <= 9 ? "0" : "") + gcal.get(GregorianCalendar.MINUTE)); this.textTermin.setText(terminTime); } // time abfRT if (dia.getPlannedStartForBackTransport() != 0) { gcal.setTimeInMillis(dia.getPlannedStartForBackTransport()); String abfRTTime = (gcal.get(GregorianCalendar.HOUR_OF_DAY) <= 9 ? "0" : "") + gcal.get(GregorianCalendar.HOUR_OF_DAY) + ":" + ((gcal.get(GregorianCalendar.MINUTE) <= 9 ? "0" : "") + gcal.get(GregorianCalendar.MINUTE)); this.textAbfRT.setText(abfRTTime); } // time ready if (dia.getReadyTime() != 0) { gcal.setTimeInMillis(dia.getReadyTime()); String readyTime = (gcal.get(GregorianCalendar.HOUR_OF_DAY) <= 9 ? "0" : "") + gcal.get(GregorianCalendar.HOUR_OF_DAY) + ":" + ((gcal.get(GregorianCalendar.MINUTE) <= 9 ? "0" : "") + gcal.get(GregorianCalendar.MINUTE)); this.textFertig.setText(readyTime); } textFromStreet.setText(dia.getFromStreet()); if (dia.getFromCity() != null) textFromCity.setText(dia.getFromCity()); if (dia.getToCity() != null) textToCity.setText(dia.getToCity()); if (dia.getToStreet() != null) textToStreet.setText(dia.getToStreet()); if (dia.getPatient().getLastname() != null) textPatientLastName.setText(dia.getPatient().getLastname()); if (dia.getPatient().getFirstname() != null) textPatientFirstName.setText(dia.getPatient().getFirstname()); this.begleitpersonButton.setSelection(dia.isAssistantPerson()); if (dia.getLocation() != null) this.zustaendigeOrtsstelle.setSelection(new StructuredSelection(dia.getLocation()));// mandatory!! // default: // Bezirk this.montagButton.setSelection(dia.isMonday()); this.dienstagButton.setSelection(dia.isTuesday()); this.mittwochButton.setSelection(dia.isWednesday()); this.donnerstagButton.setSelection(dia.isThursday()); this.freitagButton.setSelection(dia.isFriday()); this.samstagButton.setSelection(dia.isSaturday()); this.sonntagButton.setSelection(dia.isSunday()); this.button_stationary.setSelection(dia.isStationary()); // kind of transport if (dia.getKindOfTransport() != null) combokindOfTransport.setText(dia.getKindOfTransport()); }
From source file:at.rc.tacos.client.view.PatientSelectionDialog.java
License:Open Source License
/** * This listener will be informed when the server sends new patients based * on the entered text/*from w w w . ja va2 s . c o m*/ */ @Override public void propertyChange(PropertyChangeEvent pce) { // listen to listing responses if ("SICKPERSON_ADD".equalsIgnoreCase((pce.getPropertyName())) || "SICKPERSON_UPDATE".equalsIgnoreCase((pce.getPropertyName()))) { viewer.refresh(true); final Object first = viewer.getElementAt(0); if (first != null) { PatientSelectionDialog.this.viewer.setSelection(new StructuredSelection(first)); updateStatus(new Status(IStatus.INFO, Activator.PLUGIN_ID, ((SickPerson) first).getLastName() + " ausgewhlt")); } else updateStatus( new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Bitte whlen Sie einen Patienten aus")); } }