本文整理汇总了Java中com.vaadin.ui.Notification类的典型用法代码示例。如果您正苦于以下问题:Java Notification类的具体用法?Java Notification怎么用?Java Notification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Notification类属于com.vaadin.ui包,在下文中一共展示了Notification类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FileExample
import com.vaadin.ui.Notification; //导入依赖的package包/类
public FileExample() {
setCaption("Interactive SVG");
addComponent(new MLabel(
"A simple example from an svg file using Embedded component. Unlike with Image component, the SVGs JS etc are active. The example also demonstrates how to provide a trivial server side integration API for the SVG."));
Embedded svg = new Embedded();
svg.setWidth("400px");
svg.setHeight("400px");
svg.setSource(new ClassResource("/pull.svg"));
// Expose a JS hook that pull.svg file calls when clicked
JavaScript.getCurrent().addFunction("callMyVaadinFunction", (JsonArray arguments) -> {
Notification.show("Message from SVG:" + arguments.getString(0));
});
addComponent(svg);
}
示例2: selectable1
import com.vaadin.ui.Notification; //导入依赖的package包/类
public void selectable1() {
// tag::selectable1[]
SingleSelect<TestData> singleSelect = Components.input.singleSelect(TestData.class).caption("Single select")
.build(); // <1>
singleSelect.setValue(new TestData(1)); // <2>
singleSelect.select(new TestData(1)); // <3>
singleSelect.clear(); // <4>
singleSelect.deselectAll(); // <5>
boolean selected = singleSelect.isSelected(new TestData(1)); // <6>
singleSelect.addSelectionListener(
s -> s.getFirstSelectedItem().ifPresent(i -> Notification.show("Selected: " + i.getId()))); // <7>
// end::selectable1[]
}
示例3: conformDeploymentSpec
import com.vaadin.ui.Notification; //导入依赖的package包/类
private void conformDeploymentSpec(long dsId) {
log.info("Syncing DS " + dsId);
DeploymentSpecDto requestDto = new DeploymentSpecDto();
requestDto.setId(dsId);
BaseRequest<DeploymentSpecDto> req = new BaseRequest<DeploymentSpecDto>();
req.setDto(requestDto);
try {
BaseJobResponse response = this.syncDeploymentSpecService.dispatch(req);
ViewUtil.showJobNotification(response.getJobId(), this.server);
} catch (Exception e) {
log.error("Error!", e);
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
}
}
示例4: submitForm
import com.vaadin.ui.Notification; //导入依赖的package包/类
@Override
public void submitForm() {
try {
if (validateForm()) {
SetNetworkSettingsRequest req = new SetNetworkSettingsRequest();
req.setDhcp(false);
req.setHostIpAddress(this.ipAddress.getValue().trim());
req.setHostDefaultGateway(this.defaultGateway.getValue().trim());
req.setHostSubnetMask(this.subnetMask.getValue().trim());
req.setHostDnsServer1(this.dnsServer1.getValue().trim());
req.setHostDnsServer2(this.dnsServer2.getValue().trim());
this.setNetworkSettingsService.dispatch(req);
this.networkLayout.populateNetworkTable();
}
close();
} catch (Exception e) {
log.error("Failed to update the network settings", e);
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
}
}
示例5: submitForm
import com.vaadin.ui.Notification; //导入依赖的package包/类
@Override
public void submitForm() {
BaseIdRequest delRequest = new BaseIdRequest();
// Delete MC service has no response so not needed.
try {
delRequest.setId(this.mcView.getParentItemId());
log.info("deleting Manager Connector - "
+ this.mcView.getParentContainer().getItem(this.mcView.getParentItemId()).getItemProperty("name")
.getValue().toString());
BaseJobResponse response = this.deleteApplianceManagerConnectorService.dispatch(delRequest);
ViewUtil.showJobNotification(response.getJobId(), this.server);
} catch (Exception e) {
log.info(e.getMessage());
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
}
close();
}
示例6: populateParentTable
import com.vaadin.ui.Notification; //导入依赖的package包/类
@Override
public void populateParentTable() {
ListResponse<DistributedApplianceDto> res;
try {
res = this.listDistributedApplianceService.dispatch(new BaseRequest<>());
List<DistributedApplianceDto> listResponse = res.getList();
this.parentContainer.removeAllItems();
// creating table with list of vendors
for (DistributedApplianceDto da : listResponse) {
this.parentContainer.addItem(da.getId(), da);
}
} catch (Exception e) {
log.error("Fail to populate Distributed Appliance table", e);
ViewUtil.iscNotification("Fail to populate Distributed Appliance table (" + e.getMessage() + ")",
Notification.Type.ERROR_MESSAGE);
}
}
示例7: submitForm
import com.vaadin.ui.Notification; //导入依赖的package包/类
@Override
public void submitForm() {
try {
if (validateForm()) {
// creating add request with user entered data
BaseRequest<AlarmDto> request = createRequest();
// calling add service
BaseResponse addResponse = this.addAlarmService.dispatch(request);
log.info("adding new alarm - " + this.alarmName.getValue());
// adding returned ID to the request DTO object
request.getDto().setId(addResponse.getId());
// adding new object to the parent table
this.alarmView.getParentContainer().addItemAt(0, request.getDto().getId(), request.getDto());
this.alarmView.parentTableClicked(request.getDto().getId());
close();
}
} catch (Exception e) {
log.info(e.getMessage());
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
}
}
示例8: populateParentTable
import com.vaadin.ui.Notification; //导入依赖的package包/类
@Override
public void populateParentTable() {
ListJobRequest listRequest = null;
ListResponse<JobRecordDto> res;
try {
res = this.listJobService.dispatch(listRequest);
List<JobRecordDto> listResponse = res.getList();
this.parentContainer.removeAllItems();
// creating table with list of jobs
for (JobRecordDto j : listResponse) {
this.parentContainer.addItem(j.getId(), j);
}
} catch (Exception e) {
log.error("Fail to populate Jobs table", e);
ViewUtil.iscNotification("Fail to populate Job table (" + e.getMessage() + ")",
Notification.Type.ERROR_MESSAGE);
}
}
示例9: submitForm
import com.vaadin.ui.Notification; //导入依赖的package包/类
@Override
public void submitForm() {
if (validateForm()) {
try {
//override all default values with user provided ones...
this.baseVCWindow.providerAttributes.clear();
this.baseVCWindow.providerAttributes.put(ATTRIBUTE_KEY_HTTPS, this.providerHttps.getValue().toString());
this.baseVCWindow.providerAttributes.put(ATTRIBUTE_KEY_RABBITMQ_IP,
this.rabbitMQIp.getValue().toString());
this.baseVCWindow.providerAttributes.put(ATTRIBUTE_KEY_RABBITMQ_USER,
this.rabbitMQUserName.getValue().toString());
this.baseVCWindow.providerAttributes.put(ATTRIBUTE_KEY_RABBITMQ_USER_PASSWORD,
this.rabbitMQUserPassword.getValue().toString());
this.baseVCWindow.providerAttributes.put(ATTRIBUTE_KEY_RABBITMQ_PORT,
this.rabbitMQPort.getValue().toString());
close();
} catch (Exception e) {
String msg = "Failed to encrypt rabbit MQ user password";
LOG.error(msg, e);
ViewUtil.iscNotification(msg, Notification.Type.ERROR_MESSAGE);
}
}
}
示例10: getNetworks
import com.vaadin.ui.Notification; //导入依赖的package包/类
private List<OsNetworkDto> getNetworks() {
try {
OsProjectDto selectedProject = (OsProjectDto) this.project.getValue();
if (selectedProject != null && this.region.getValue() != null) {
// Calling List Network Service
BaseOpenStackRequest req = new BaseOpenStackRequest();
req.setId(this.vsId);
req.setRegion((String) this.region.getValue());
req.setProjectName(selectedProject.getName());
req.setProjectId(selectedProject.getId());
List<OsNetworkDto> res = this.listNetworkService.dispatch(req).getList();
return res;
}
} catch (Exception e) {
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
log.error("Error getting Network List", e);
}
return null;
}
示例11: populateFloatingPool
import com.vaadin.ui.Notification; //导入依赖的package包/类
private void populateFloatingPool() {
this.floatingIpPool.removeAllItems();
try {
OsProjectDto selectedProject = (OsProjectDto) this.project.getValue();
if (selectedProject != null && this.region.getValue() != null) {
BaseOpenStackRequest req = new BaseOpenStackRequest();
req.setId(this.vsId);
req.setProjectName(selectedProject.getName());
req.setProjectId(selectedProject.getId());
req.setRegion((String) this.region.getValue());
List<String> floatingIpPoolList = this.listFloatingIpPoolsService.dispatch(req).getList();
if (floatingIpPoolList.size() > 0) {
this.floatingIpPool.addItems(floatingIpPoolList);
}
}
} catch (ExtensionNotPresentException notPresentException) {
ViewUtil.iscNotification(notPresentException.getMessage(), Notification.Type.WARNING_MESSAGE);
log.warn("Failed to get IP Pool", notPresentException);
} catch (Exception e) {
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
log.error("Failed to get IP Pool", e);
}
}
示例12: populateParentTable
import com.vaadin.ui.Notification; //导入依赖的package包/类
@Override
public void populateParentTable() {
BaseRequest<BaseDto> listRequest = null;
ListResponse<ApplianceDto> res;
try {
res = this.listApplianceService.dispatch(listRequest);
List<ApplianceDto> listResponse = res.getList();
this.parentContainer.removeAllItems();
// creating table with list of vendors
for (ApplianceDto appliance : listResponse) {
this.parentContainer.addItem(appliance.getId(), appliance);
}
} catch (Exception e) {
log.error("Fail to populate Appliance table", e);
ViewUtil.iscNotification("Fail to populate Appliance table (" + e.getMessage() + ")",
Notification.Type.ERROR_MESSAGE);
}
}
示例13: cancelRunImmediatly
import com.vaadin.ui.Notification; //导入依赖的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);
}
示例14: testDemat
import com.vaadin.ui.Notification; //导入依赖的package包/类
/**
* Teste la démat
*/
public Boolean testDemat(Boolean showNotifIfOk){
if (fileManager!=null){
if (!fileManager.testSession()){
Notification.show(applicationContext.getMessage("parametre.demat.check.ko", null, UI.getCurrent().getLocale()));
return false;
}else{
if (showNotifIfOk){
Notification.show(applicationContext.getMessage("parametre.demat.check.ok", null, UI.getCurrent().getLocale()));
}
return true;
}
}else{
Notification.show(applicationContext.getMessage("parametre.demat.check.disable", null, UI.getCurrent().getLocale()));
return false;
}
}
示例15: addFileToSignataire
import com.vaadin.ui.Notification; //导入依赖的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);
}