Search in sources :

Example 1 with StatusChangeListener

use of com.vaadin.flow.data.binder.StatusChangeListener in project karnak by OsiriX-Foundation.

the class DicomWorkListView method bindFields.

@SuppressWarnings("serial")
private void bindFields() {
    binderForWorkListQuery.forField(callingAetFld).asRequired("Ce champ est obligatoire").bind(WorkListQueryData::getCallingAet, WorkListQueryData::setCallingAet);
    binderForWorkListQuery.forField(workListAetFld).asRequired("Ce champ est obligatoire").bind(WorkListQueryData::getWorkListAet, WorkListQueryData::setWorkListAet);
    binderForWorkListQuery.forField(workListHostnameFld).asRequired("Ce champ est obligatoire").bind(WorkListQueryData::getWorkListHostname, WorkListQueryData::setWorkListHostname);
    binderForWorkListQuery.forField(workListPortFld).asRequired("Ce champ est obligatoire").withValidator(new IntegerRangeValidator("Le port est invalide", 1, 65535)).bind(WorkListQueryData::getWorkListPort, WorkListQueryData::setWorkListPort);
    binderForWorkListQuery.bind(scheduledStationAetFld, WorkListQueryData::getScheduledStationAet, WorkListQueryData::setScheduledStationAet);
    binderForWorkListQuery.bind(scheduledModalitySelector, WorkListQueryData::getScheduledModality, WorkListQueryData::setScheduledModality);
    binderForWorkListQuery.bind(patientIdfld, WorkListQueryData::getPatientId, WorkListQueryData::setPatientId);
    binderForWorkListQuery.bind(admissionIdFld, WorkListQueryData::getAdmissionId, WorkListQueryData::setAdmissionId);
    binderForWorkListQuery.bind(scheduledFromFld, WorkListQueryData::getScheduledFrom, WorkListQueryData::setScheduledFrom);
    binderForWorkListQuery.bind(scheduledToFld, WorkListQueryData::getScheduledTo, WorkListQueryData::setScheduledTo);
    binderForWorkListQuery.bind(patientNameFld, WorkListQueryData::getPatientName, WorkListQueryData::setPatientName);
    binderForWorkListQuery.bind(accessionNumberFld, WorkListQueryData::getAccessionNumber, WorkListQueryData::setAccessionNumber);
    binderForWorkListQuery.readBean(workListQueryData);
    binderForWorkListQuery.addStatusChangeListener(new StatusChangeListener() {

        @Override
        public void statusChange(StatusChangeEvent event) {
            if (callingAetFld.isEmpty() || workListAetFld.isEmpty() || workListHostnameFld.isEmpty() || workListPortFld.isEmpty()) {
                queryBtn.setEnabled(false);
            } else {
                queryBtn.setEnabled(!event.hasValidationErrors());
            }
            attributes.clear();
            dataProviderForAttributes.refreshAll();
            queryResultLayout.setVisible(false);
        }
    });
}
Also used : IntegerRangeValidator(com.vaadin.flow.data.validator.IntegerRangeValidator) WorkListQueryData(org.karnak.backend.model.dicom.WorkListQueryData) StatusChangeListener(com.vaadin.flow.data.binder.StatusChangeListener) StatusChangeEvent(com.vaadin.flow.data.binder.StatusChangeEvent)

Aggregations

StatusChangeEvent (com.vaadin.flow.data.binder.StatusChangeEvent)1 StatusChangeListener (com.vaadin.flow.data.binder.StatusChangeListener)1 IntegerRangeValidator (com.vaadin.flow.data.validator.IntegerRangeValidator)1 WorkListQueryData (org.karnak.backend.model.dicom.WorkListQueryData)1