本文整理匯總了Java中com.vaadin.ui.Notification.Type類的典型用法代碼示例。如果您正苦於以下問題:Java Type類的具體用法?Java Type怎麽用?Java Type使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Type類屬於com.vaadin.ui.Notification包,在下文中一共展示了Type類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deleteCursusPostBac
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
/**Supprime un cursus
* @param candidat
* @param cursus
* @param listener
*/
public void deleteCursusPostBac(Candidat candidat, CandidatCursusPostBac cursus, CandidatCursusExterneListener listener) {
Assert.notNull(cursus, applicationContext.getMessage("assert.notNull", null, UI.getCurrent().getLocale()));
/* Verrou --> normalement le lock est géré en amont mais on vérifie qd même*/
String lockError = candidatController.getLockError(candidat.getCompteMinima(), ConstanteUtils.LOCK_CURSUS_EXTERNE);
if (lockError!=null) {
Notification.show(lockError, Type.ERROR_MESSAGE);
return;
}
ConfirmWindow confirmWindow = new ConfirmWindow(applicationContext.getMessage("cursusexterne.confirmDelete", null, UI.getCurrent().getLocale()), applicationContext.getMessage("cursusexterne.confirmDeleteTitle", null, UI.getCurrent().getLocale()));
confirmWindow.addBtnOuiListener(e -> {
candidatCursusPostBacRepository.delete(cursus);
candidat.getCandidatCursusPostBacs().remove(cursus);
listener.cursusModified(candidat.getCandidatCursusPostBacs());
});
UI.getCurrent().addWindow(confirmWindow);
}
示例2: submitForm
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
@Override
public void submitForm() {
try {
if (validateForm()) {
BaseRequest<EmailSettingsDto> request = new BaseRequest<EmailSettingsDto>();
request.setDto(getDto());
this.setEmailSettingsService.dispatch(request);
this.emailLayout.populateEmailtable();
close();
}
} catch (Exception e) {
log.error("Failed to update the email settings", e);
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
}
}
示例3: validateSettings
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
@Override
public void validateSettings() {
try {
if (validateForm()) {
// Validate Email settings by sending an Email From and To the same email ID provided
EmailSettingsDto dto = getDto();
this.setEmailSettingsService.validateEmailSettings(new BaseRequest<>(dto));
// If every things is correct attempt to send an email..
this.setEmailSettingsService.sentTestEmail(dto.getMailServer(), dto.getPort(), dto.getEmailId(), dto.getPassword(),
dto.getEmailId());
ViewUtil.iscNotification("Info: ",
"Email validation successful. You will be receiving an email shortly.", Type.HUMANIZED_MESSAGE);
}
} catch (Exception ex) {
ViewUtil.iscNotification(
"Email settings are incorrect. Please re-try again with correct information " + ex.getMessage(),
Type.ERROR_MESSAGE);
log.error("Failed to send email to the interested user(s): ", ex);
}
}
示例4: validationStatusChange
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
@Override
public void validationStatusChange(ValidationStatusEvent<?> statusChangeEvent) {
if (statusChangeEvent.isInvalid()) {
String error = showAllErrors
? statusChangeEvent.getErrorMessages().stream().collect(Collectors.joining("<br/>"))
: statusChangeEvent.getErrorMessage();
if (error == null || error.trim().equals("")) {
error = "Validation error";
}
if (notification != null) {
notification.setCaption(error);
notification.show(Page.getCurrent());
} else {
Notification.show(error, Type.ERROR_MESSAGE);
}
}
}
示例5: save
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
public void save(Button.ClickEvent event) {
try {
// Commit the fields from UI to DAO
formFieldBindings.commit();
// Save DAO to backend with direct synchronous service API
getUI().userClient.createUser(contact);
String msg = String.format("Saved '%s %s'.",
contact.getFirstName(),
contact.getLastName());
Notification.show(msg, Type.TRAY_NOTIFICATION);
getUI().refreshContacts();
} catch (FieldGroup.CommitException e) {
// Validation exceptions could be shown here
}
}
示例6: getFrozen
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
/**
* @param maxColumn
* @return le nombre de colonne gelees
*/
private Integer getFrozen(Integer maxColumn){
if (tfFrozen.getValue()==null || tfFrozen.getValue().equals("")){
Notification.show(applicationContext.getMessage("preference.col.frozen.error", new Object[]{0,maxColumn}, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
return null;
}
try{
Integer frozen = Integer.valueOf(tfFrozen.getValue());
if (frozen<0 || frozen>maxColumn){
Notification.show(applicationContext.getMessage("preference.col.frozen.error", new Object[]{0,maxColumn}, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
}
return frozen;
}catch (Exception ex){
Notification.show(applicationContext.getMessage("preference.col.frozen.error", new Object[]{0,maxColumn}, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
return null;
}
}
示例7: confirmRemoveLock
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
/** Supprime un verrou
* @param lockItem le verrou a supprimer
*/
public void confirmRemoveLock(SessionPresentation lockItem) {
Item item = uisContainer.getItem(lockItem);
String textLock = lockItem.getId();
if (item!=null && lockItem.getInfo()!=null){
textLock = lockItem.getInfo();
}
ConfirmWindow confirmWindow = new ConfirmWindow(applicationContext.getMessage("admin.uiList.confirmRemoveLock", new Object[]{textLock}, UI.getCurrent().getLocale()));
confirmWindow.addBtnOuiListener(e -> {
Object lock = lockController.getLockBySessionItem(lockItem);
if (lock != null){
lockController.removeLock(lock);
}else{
Notification.show(applicationContext.getMessage("admin.uiList.confirmKillUI.error", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
}
majContainer();
});
UI.getCurrent().addWindow(confirmWindow);
}
示例8: confirmKillSession
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
/**
* Confirme la fermeture d'une session
* @param session la session a kill
*/
public void confirmKillSession(SessionPresentation session) {
SessionPresentation user = (SessionPresentation) uisContainer.getParent(session);
String userName = applicationContext.getMessage("user.notconnected", null, UI.getCurrent().getLocale());
if (user != null){
userName = user.getId();
}
ConfirmWindow confirmWindow = new ConfirmWindow(applicationContext.getMessage("admin.uiList.confirmKillSession", new Object[]{session.getId(), userName}, UI.getCurrent().getLocale()));
confirmWindow.addBtnOuiListener(e -> {
VaadinSession vaadinSession = uiController.getSession(session);
Collection<SessionPresentation> listeUI = null;
if (uisContainer.getChildren(session) != null){
listeUI = (Collection<SessionPresentation>) uisContainer.getChildren(session);
}
if (vaadinSession != null){
uiController.killSession(vaadinSession, listeUI);
}else{
Notification.show(applicationContext.getMessage("admin.uiList.confirmKillSession.error", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
}
removeElement(session);
});
UI.getCurrent().addWindow(confirmWindow);
}
示例9: runImmediatly
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
/**
* Lancement immediat du batch
*
* @param batch
*/
public void runImmediatly(Batch batch) {
ConfirmWindow win = new ConfirmWindow(applicationContext.getMessage("batch.immediat.ok",
new Object[] { batch.getCodBatch() }, UI.getCurrent().getLocale()));
win.addBtnOuiListener(e -> {
BatchHisto histo = batchHistoRepository.findByBatchCodBatchAndStateBatchHisto(batch.getCodBatch(),
ConstanteUtils.BATCH_RUNNING);
if (histo == null) {
batch.setTemIsLaunchImediaBatch(true);
batchRepository.saveAndFlush(batch);
Notification.show(
applicationContext.getMessage("batch.immediat.launch", null, UI.getCurrent().getLocale()),
Type.WARNING_MESSAGE);
} else {
Notification.show(
applicationContext.getMessage("batch.immediat.nok", null, UI.getCurrent().getLocale()),
Type.WARNING_MESSAGE);
}
});
UI.getCurrent().addWindow(win);
}
示例10: cancelRunImmediatly
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
/**
* Lancement immediat du batch
*
* @param batch
*/
public void cancelRunImmediatly(Batch batch) {
ConfirmWindow win = new ConfirmWindow(applicationContext.getMessage("batch.immediat.cancel",
new Object[] { batch.getCodBatch() }, UI.getCurrent().getLocale()));
win.addBtnOuiListener(e -> {
BatchHisto histo = batchHistoRepository.findByBatchCodBatchAndStateBatchHisto(batch.getCodBatch(),
ConstanteUtils.BATCH_RUNNING);
if (histo == null) {
batch.setTemIsLaunchImediaBatch(false);
batchRepository.saveAndFlush(batch);
Notification.show(
applicationContext.getMessage("batch.immediat.cancel.ok", null, UI.getCurrent().getLocale()),
Type.WARNING_MESSAGE);
} else {
Notification.show(
applicationContext.getMessage("batch.immediat.cancel.nok", null, UI.getCurrent().getLocale()),
Type.WARNING_MESSAGE);
}
});
UI.getCurrent().addWindow(win);
}
示例11: addFileToSignataire
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
/**
* AJoute un fichier à la commission
*
* @param commission
*/
public void addFileToSignataire(final Commission commission) {
/* Verrou */
if (!lockController.getLockOrNotify(commission, null)) {
return;
}
String user = userController.getCurrentUserLogin();
String cod = ConstanteUtils.TYPE_FICHIER_SIGN_COMM + "_" + commission.getIdComm();
UploadWindow uw = new UploadWindow(cod, ConstanteUtils.TYPE_FICHIER_GESTIONNAIRE, null, false, true);
uw.addUploadWindowListener(file -> {
if (file == null) {
return;
}
Fichier fichier = fileController.createFile(file, user, ConstanteUtils.TYPE_FICHIER_GESTIONNAIRE);
commission.setFichier(fichier);
commissionRepository.save(commission);
Notification.show(applicationContext.getMessage("window.upload.success", new Object[] {file.getFileName()},
UI.getCurrent().getLocale()), Type.TRAY_NOTIFICATION);
uw.close();
});
uw.addCloseListener(e -> lockController.releaseLock(commission));
UI.getCurrent().addWindow(uw);
}
示例12: deleteFileToSignataire
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
/**
* Supprime un fichier d'une commission
*
* @param commission
*/
public void deleteFileToSignataire(final Commission commission) {
/* Verrou */
if (!lockController.getLockOrNotify(commission, null)) {
return;
}
if (!fileController.isModeFileStockageOk(commission.getFichier(), true)) {
return;
}
Fichier fichier = commission.getFichier();
if (fichier == null) {
Notification.show(applicationContext.getMessage("file.error", null, UI.getCurrent().getLocale()),
Type.WARNING_MESSAGE);
lockController.releaseLock(commission);
return;
}
ConfirmWindow confirmWindow = new ConfirmWindow(
applicationContext.getMessage("file.window.confirmDelete", new Object[] {fichier.getNomFichier()},
UI.getCurrent().getLocale()),
applicationContext.getMessage("file.window.confirmDeleteTitle", null, UI.getCurrent().getLocale()));
confirmWindow.addBtnOuiListener(file -> {
removeFileToCommission(commission, fichier);
});
confirmWindow.addCloseListener(e -> lockController.releaseLock(commission));
UI.getCurrent().addWindow(confirmWindow);
}
示例13: isOkToTransmettreCandidatureStatutPiece
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
/**
* @param listePj
* @param notification
* @return true si les pieces de la candidatures permettent de transmettre le
* dossier
*/
public Boolean isOkToTransmettreCandidatureStatutPiece(List<PjPresentation> listePj, Boolean notification) {
for (PjPresentation pj : listePj) {
if (pj.getCodStatut() == null) {
if (notification) {
Notification.show(applicationContext.getMessage("candidature.validPJ.erreur.pj",
new Object[] { pj.getLibPj() }, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
}
return false;
} else if (pj.getCodStatut().equals(NomenclatureUtils.TYP_STATUT_PIECE_ATTENTE)) {
if (notification) {
Notification.show(applicationContext.getMessage("candidature.validPJ.erreur.pj.attente",
new Object[] { pj.getLibPj() }, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
}
return false;
} else if (pj.getCodStatut().equals(NomenclatureUtils.TYP_STATUT_PIECE_REFUSE)) {
if (notification) {
Notification.show(applicationContext.getMessage("candidature.validPJ.erreur.pj.refus",
new Object[] { pj.getLibPj() }, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
}
return false;
}
}
return true;
}
示例14: deleteAllLock
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
/** Supprime tous les locks
* @param listeLock
* @param listener
*/
public void deleteAllLock(List<LockCandidat> listeLock, LockCandidatListener listener){
ConfirmWindow confirmWindow = new ConfirmWindow(applicationContext.getMessage("lock.candidat.all.window.confirmDelete", null, UI.getCurrent().getLocale()), applicationContext.getMessage("lock.candidat.window.confirmDeleteTitle", null, UI.getCurrent().getLocale()));
confirmWindow.addBtnOuiListener(e -> {
Boolean allLockDeleted = true;
for (LockCandidat lock : listeLock){
if (!lockCandidatRepository.exists(lock.getId())){
/* Contrôle que le lock existe encore */
allLockDeleted = false;
}else{
lockCandidatRepository.delete(lock.getId());
}
}
if (!allLockDeleted){
Notification.show(applicationContext.getMessage("lock.candidat.all.error.delete", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
}else{
Notification.show(applicationContext.getMessage("lock.candidat.all.delete.ok", null, UI.getCurrent().getLocale()), Type.TRAY_NOTIFICATION);
}
listener.lockCandidatAllDeleted();
});
UI.getCurrent().addWindow(confirmWindow);
}
示例15: switchToUser
import com.vaadin.ui.Notification.Type; //導入依賴的package包/類
/**
* Change le rôle de l'utilisateur courant
*
* @param username
* le nom de l'utilisateur a prendre
*/
public void switchToUser(String username) {
Assert.hasText(username, applicationContext.getMessage("assert.hasText", null, UI.getCurrent().getLocale()));
/* Vérifie que l'utilisateur existe */
try {
UserDetails details = userDetailsService.loadUserByUsername(username);
if (details == null || details.getAuthorities() == null || details.getAuthorities().size() == 0) {
Notification.show(applicationContext.getMessage("admin.switchUser.usernameNotFound",
new Object[] { username }, UI.getCurrent().getLocale()), Notification.Type.WARNING_MESSAGE);
return;
}
} catch (UsernameNotFoundException unfe) {
Notification.show(applicationContext.getMessage("admin.switchUser.usernameNotFound",
new Object[] { username }, UI.getCurrent().getLocale()), Notification.Type.WARNING_MESSAGE);
return;
}
String switchToUserUrl = MethodUtils.formatSecurityPath(loadBalancingController.getApplicationPath(false),
ConstanteUtils.SECURITY_SWITCH_PATH) + "?" + SwitchUserFilter.SPRING_SECURITY_SWITCH_USERNAME_KEY + "="
+ username;
Page.getCurrent().open(switchToUserUrl, null);
}