List of usage examples for com.vaadin.server UserError UserError
public UserError(String textErrorMessage)
From source file:com.zklogtool.web.components.OpenSnapshotFileDialog.java
License:Apache License
public OpenSnapshotFileDialog(final TabSheet displayTabSheet, final Window windowHandle) { buildMainLayout();/*from w w w . j av a 2 s .co m*/ setCompositionRoot(mainLayout); openButton.addClickListener(new ClickListener() { DataState dataState; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { File snapshot = new File(snapshotFileLabel.getValue()); SnapshotFileReader snapReader = new SnapshotFileReader(snapshot, 0); SnapshotView snapshotView; if (!validateInputs()) { return; } try { dataState = snapReader.readFuzzySnapshot(); snapshotView = new SnapshotView(dataState); } catch (CRCValidationException e) { snapshotFileLabel .setComponentError(new UserError("CRC validation problem. File is probably corrupted")); return; } catch (IOException e) { snapshotFileLabel.setComponentError(new UserError("IO problem with file")); return; } HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setCaption(tabNameLabel.getValue()); horizontalLayout.addComponent(snapshotView); horizontalLayout.setWidth("100%"); horizontalLayout.setHeight("100%"); Tab snapshotTab = displayTabSheet.addTab(horizontalLayout); snapshotTab.setClosable(true); displayTabSheet.setSelectedTab(snapshotTab); windowHandle.close(); } }); }
From source file:com.zklogtool.web.components.OpenSnapshotFileDialog.java
License:Apache License
boolean validateInputs() { boolean isOk = true; if (snapshotFileLabel.getValue().isEmpty()) { snapshotFileLabel.setComponentError(new UserError("File path must be provided")); isOk = false;/*from ww w . j av a 2s.c o m*/ } else { snapshotFileLabel.setComponentError(null); } if (tabNameLabel.getValue().isEmpty()) { tabNameLabel.setComponentError(new UserError("Name must be provided")); isOk = false; } else { tabNameLabel.setComponentError(null); } return isOk; }
From source file:com.zklogtool.web.components.OpenTransactionLogFileDialog.java
License:Apache License
public OpenTransactionLogFileDialog(final TabSheet displayTabSheet, final Window windowHandle) { buildMainLayout();/*from w ww . j a v a2s . c o m*/ setCompositionRoot(mainLayout); openButton.addClickListener(new ClickListener() { @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { File transactionLogFile = new File(transactionLogFileLabel.getValue()); File snapshotDir = new File(snapshotDirectoryLabel.getValue()); if (!transactionLogFile.isFile() && !transactionLogFile.isDirectory()) { transactionLogFileLabel.setComponentError(new UserError("IO problem")); return; } if (snapshotDirectoryLabel.getValue() != null && !snapshotDirectoryLabel.getValue().isEmpty() && !snapshotDir.isDirectory()) { snapshotDirectoryLabel.setComponentError(new UserError("IO problem")); return; } TransactionLogView transactionLogView = new TransactionLogView(transactionLogFile, snapshotDir, followCheckbox.getValue(), startFromLastCheckbox.getValue(), displayTabSheet, nameLabel.getValue()); HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setCaption(nameLabel.getValue()); horizontalLayout.addComponent(transactionLogView); horizontalLayout.setWidth("100%"); horizontalLayout.setHeight("100%"); Tab transactionLogTab = displayTabSheet.addTab(horizontalLayout); transactionLogTab.setClosable(true); displayTabSheet.setSelectedTab(transactionLogTab); windowHandle.close(); } }); }
From source file:de.metas.procurement.webui.server.AbstractErrorHandler.java
License:Open Source License
private ErrorMessage createErrorMessage(final Throwable t) { final ErrorMessage errorMessage = AbstractErrorMessage.getErrorMessageForException(t); // In case we deal with an System Error, don't show it to user because it's confusing. // Instead show a generic friendly error message. if (errorMessage instanceof SystemError) { return new UserError(i18n.get("error.default")); }//from ww w.j a va2 s. co m return errorMessage; }
From source file:de.symeda.sormas.ui.caze.CaseDataForm.java
License:Open Source License
private void setEpidNumberError(TextField epidField, Button assignNewEpidNumberButton, String fieldValue) { if (FacadeProvider.getCaseFacade().doesEpidNumberExist(fieldValue, getValue().getUuid())) { epidField.setComponentError(//from ww w . j ava 2 s . co m new UserError(I18nProperties.getValidationError(Validations.duplicateEpidNumber))); assignNewEpidNumberButton.setVisible(true); } else { epidField.setComponentError(null); assignNewEpidNumberButton.setVisible( !CaseLogic.isEpidNumberPrefix(fieldValue) && !CaseLogic.isCompleteEpidNumber(fieldValue)); } }
From source file:de.symeda.sormas.ui.epidata.EpiDataForm.java
License:Open Source License
private void updateBurialsHint(OptionGroup burialAttendedField, EpiDataBurialsField burialsField) { YesNoUnknown value = (YesNoUnknown) burialAttendedField.getValue(); if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_EDIT) && value == YesNoUnknown.YES && (burialsField == null || burialsField.getValue() == null || burialsField.getValue().size() == 0)) { burialAttendedField.setComponentError( new UserError(I18nProperties.getValidationError(Validations.softAddEntryToList))); } else {//www. ja va 2 s .c o m burialAttendedField.setComponentError(null); } }
From source file:de.symeda.sormas.ui.epidata.EpiDataForm.java
License:Open Source License
private void updateGatheringsHint(OptionGroup gatheringAttendedField, EpiDataGatheringsField gatheringsField) { YesNoUnknown value = (YesNoUnknown) gatheringAttendedField.getValue(); if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_EDIT) && value == YesNoUnknown.YES && (gatheringsField == null || gatheringsField.getValue() == null || gatheringsField.getValue().size() == 0)) { gatheringAttendedField.setComponentError( new UserError(I18nProperties.getValidationError(Validations.softAddEntryToList))); } else {// w ww .ja v a 2 s .com gatheringAttendedField.setComponentError(null); } }
From source file:de.symeda.sormas.ui.epidata.EpiDataForm.java
License:Open Source License
private void updateTravelsHint(OptionGroup traveledField, EpiDataTravelsField travelsField) { YesNoUnknown value = (YesNoUnknown) traveledField.getValue(); if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_EDIT) && value == YesNoUnknown.YES && (travelsField == null || travelsField.getValue() == null || travelsField.getValue().size() == 0)) { traveledField.setComponentError( new UserError(I18nProperties.getValidationError(Validations.softAddEntryToList))); } else {/*from www . ja v a 2 s.co m*/ traveledField.setComponentError(null); } }
From source file:de.symeda.sormas.ui.hospitalization.HospitalizationForm.java
License:Open Source License
private void updatePrevHospHint(OptionGroup hospitalizedPreviouslyField, PreviousHospitalizationsField previousHospitalizationsField) { YesNoUnknown value = (YesNoUnknown) hospitalizedPreviouslyField.getValue(); Collection<PreviousHospitalizationDto> previousHospitalizations = previousHospitalizationsField.getValue(); if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_EDIT) && value == YesNoUnknown.YES && (previousHospitalizations == null || previousHospitalizations.size() == 0)) { hospitalizedPreviouslyField.setComponentError( new UserError(I18nProperties.getValidationError(Validations.softAddEntryToList))); } else {//from w ww . ja va2 s . c o m hospitalizedPreviouslyField.setComponentError(null); } }
From source file:edu.kit.dama.ui.admin.wizard.AccessPointCreation.java
License:Apache License
@Override public boolean validateSettings() { if (addWebDavAccessPoint.getValue()) { if (!UIUtils7.validate(getMainLayout())) { return false; }//from w w w. ja v a 2 s . co m if (createAdminLogin.getValue()) { if (adminPassword.getValue().equals(adminPasswordCheck.getValue())) { adminPasswordCheck.setComponentError(null); } else { adminPasswordCheck.setComponentError(new UserError("Passwords are different.")); return false; } } try { new URL(baseUrl.getValue()); baseUrl.setComponentError(null); } catch (MalformedURLException ex) { baseUrl.setComponentError(new UserError("Not a valid URL.")); return false; } File f = new File(basePath.getValue()); if (!f.exists()) { basePath.setComponentError(new UserError("Base path does not exist.")); return false; } if (!f.isDirectory()) { basePath.setComponentError(new UserError("Base path is not a directory.")); return false; } if (!f.canRead() || !f.canWrite()) { basePath.setComponentError(new UserError("Base path is not readable and/or writeable.")); return false; } File usersDir = new File(f, "USERS"); if (!usersDir.exists()) { basePath.setComponentError(new UserError( "Base path seems not be be the local web dav folder. No 'USERS' sub directory found.")); return false; } } return true; }