当前位置: 首页>>代码示例>>Java>>正文


Java Notification类代码示例

本文整理汇总了Java中com.vaadin.ui.Window.Notification的典型用法代码示例。如果您正苦于以下问题:Java Notification类的具体用法?Java Notification怎么用?Java Notification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Notification类属于com.vaadin.ui.Window包,在下文中一共展示了Notification类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buttonClick

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
/**
 * ClickListner Methode fuer die Reaktion auf Buttonclicks. Hier wird
 * entsprechend auf die Button-Clicks fuer das Erzeugen weiterer Projekte
 * reagiert, wie auch auf jene die Projekte loeschen. In der ersten
 * If-Abfrage werden die vom Hauptfenster ausgeloeten Clicks zum Hinzufuegen
 * eines neuen Objektes behandelt, in der zweiten If-Abfrage wird die im
 * Dialogfenster ausgeloesten Clickst behandelt (Hierbei wird noch geprueft
 * ob das auf "required" gesetzte Textfeld auch ausgefuellt wurde - falls
 * nicht wird eine Fehlermeldung angezeigt) und in der Else-Verzweigung dann
 * die Loesch-Clicks fuer das jeweilige Projekt behandelt. Hierbei wird
 * zunächst durch das Event in der Loesch-Buttonliste der Index
 * identifiziert, also welches Projekt zu loeschen ist. Die jeweils folgende
 * Logid ist in der je aufgerufen Methode des Presenters zu finden.
 * 
 * @author Christian Scherer, Mirko Göpfrich
 * @param event
 *            Klick-event des Buttons
 */
@Override
public void buttonClick(ClickEvent event) {
	
	if (event.getButton() == addProjectBtn) {
		logger.debug("Projekt-hinzufügen Button aus dem Hauptfenster aufgerufen");
		presenter.addProjectDialog();

	} else if (event.getButton() == dialogAddBtn) {
		logger.debug("Projekt-hinzufügen Button aus dem Dialogfenster aufgerufen");

		if (tfName.isValid()) {
			presenter.addProject((String) tfName.getValue(), (String) taDescription.getValue());
			//TODO: Fenster nur schließen, wenn das Hinzufügen erfolgreich war (s. Projekt Bearbeiten).
			getWindow().removeWindow(addDialog);
			logger.debug("Projekt-hinzufügen Dialog geschlossen");
		} else {
			getWindow()
					.showNotification(
							"",
							"Projektname ist ein Pflichtfeld. Bitte geben Sie einen Projektnamen an",
							Notification.TYPE_ERROR_MESSAGE);
		}	
	}
}
 
开发者ID:DHBW-Karlsruhe,项目名称:businesshorizon2,代码行数:43,代码来源:ProjectListViewImpl.java

示例2: handleError

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
@Override
public void handleError(IUnoVaadinApplication application, ErrorEvent errorEvent) {
	final Throwable t = errorEvent.getThrowable();

	// Copyed from Application.handleError()
	if (t instanceof SocketException) {
		// Most likely client browser closed socket
		LOG.info("SocketException in CommunicationManager." + " Most likely client (browser) closed socket.");
		return;
	}

	// Shows the error in AbstractComponent
	// TODO Check ErrorMessage class to show error to the user
	String message = throwableToMessageService.resolveMessage(t);
	application.getMainWindow().showNotification("An unexpected error has occured", message, Notification.TYPE_ERROR_MESSAGE);

	LOG.error("An unexpected error has occured in vaadin", t);
}
 
开发者ID:frincon,项目名称:openeos,代码行数:19,代码来源:DefaultErrorHandler.java

示例3: showEdit

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
@Override
protected void showEdit() {
	if (getActiveObject() == null) {
		List<UIBean> selectedObjects = getSelectedObjects();
		if (selectedObjects.size() > 0) {
			this.setActiveObject(selectedObjects.get(0));
		} else {
			//TODO i18n
			getMainContainer().getWindow().showNotification("Select an intem", "Please select an item to edit",
					Notification.TYPE_HUMANIZED_MESSAGE);
			showView(View.LIST);
			return;
		}
	}
	getMainContainer().addComponent(form);

}
 
开发者ID:frincon,项目名称:openeos,代码行数:18,代码来源:VaadinTabImpl.java

示例4: periodicRefresh

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
private void periodicRefresh() {
	//Logout if requested
	if (mKicker != null) {
   		String kickMessage = KickoutMessageText + mKicker.getData().getName();            		
   		mKicker = null;
   		logoutCore();
   		getMainWindow().showNotification(KickoutMessageTitle, kickMessage, Notification.TYPE_WARNING_MESSAGE);
   	}
	
	//Refresh logged in users
	refreshLoggedInUsers();
	
	//Refresh GPIO pin states
	refreshGPIOPinStates();
	
	//Refresh animation status
	refreshAnimationStatus();
}
 
开发者ID:iscalik,项目名称:GPIO_Vaadin_Project,代码行数:19,代码来源:Rpi_gpio_controllerApplication.java

示例5: createLoginUI

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
private void createLoginUI(final AbstractOrderedLayout parentLayout) {
	final Rpi_gpio_controllerApplication application = this;
	
	LoginForm loginForm = new LoginForm();
	loginForm.addListener(new LoginForm.LoginListener() {
		Rpi_gpio_controllerApplication mApplication = application;
		
           public void onLogin(LoginEvent event) {
           	String loginErrorMessage = new User(new UserData (event.getLoginParameter("username"), event.getLoginParameter("password")), mApplication).login();
           	if (loginErrorMessage != null) {            		            		
               	Notification notification = new Notification(LoginErrorMessage, loginErrorMessage, Notification.TYPE_ERROR_MESSAGE);
               	notification.setDelayMsec(1000);
               	getMainWindow().showNotification(notification);
               }
           }
       });
	
	Panel loginPanel = new Panel("Log in");
	loginPanel.setWidth("200px");
	loginPanel.setHeight("250px");
	loginPanel.addComponent(loginForm);
	
       parentLayout.addComponent(loginPanel);
       parentLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);
}
 
开发者ID:iscalik,项目名称:GPIO_Vaadin_Project,代码行数:26,代码来源:Rpi_gpio_controllerApplication.java

示例6: showEventsWindow

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
/**
 * Shows the events window.
 *
 * @param logger the logger
 * @param fileName the file name
 * @param ueiBase the UEI base
 */
private void showEventsWindow(final Logger logger, final String fileName, final String ueiBase) {
    final Events events =  mibParser.getEvents(ueiBase);
    if (events == null) {
        getApplication().getMainWindow().showNotification("The MIB couldn't be processed for events because: " + mibParser.getFormattedErrors(), Notification.TYPE_ERROR_MESSAGE);                
    } else {
        if (events.getEventCount() > 0) {
            try {
                logger.info("Found " + events.getEventCount() + " events.");
                final String eventsFileName = fileName.replaceFirst("\\..*$", ".events.xml");
                final File configDir = new File(ConfigFileConstants.getHome(), "etc/events/");
                final File eventFile = new File(configDir, eventsFileName);
                final EventWindow w = new EventWindow(eventsDao, eventsProxy, eventFile, events, logger);
                getApplication().getMainWindow().addWindow(w);
            } catch (Throwable t) {
                getApplication().getMainWindow().showNotification(t.getMessage(), Notification.TYPE_ERROR_MESSAGE);
            }
        } else {
            getApplication().getMainWindow().showNotification("The MIB doesn't contain any notification/trap", Notification.TYPE_WARNING_MESSAGE);
        }
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:29,代码来源:MibCompilerPanel.java

示例7: generateDataCollection

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
/**
 * Generate data collection.
 *
 * @param logger the logger
 * @param fileName the file name
 */
private void generateDataCollection(final Logger logger, final String fileName) {
    if (parseMib(logger, new File(MIBS_COMPILED_DIR, fileName))) {
        final DatacollectionGroup dcGroup = mibParser.getDataCollection();
        if (dcGroup == null) {
            getApplication().getMainWindow().showNotification("The MIB couldn't be processed for data collection because: " + mibParser.getFormattedErrors(), Notification.TYPE_ERROR_MESSAGE);
        } else {
            if (dcGroup.getGroupCount() > 0) {
                try {
                    final String dataFileName = fileName.replaceFirst("\\..*$", ".xml");
                    final DataCollectionWindow w = new DataCollectionWindow(mibParser, dataCollectionDao, dataFileName, dcGroup, logger);
                    getApplication().getMainWindow().addWindow(w);
                } catch (Throwable t) {
                    getApplication().getMainWindow().showNotification(t.getMessage(), Notification.TYPE_ERROR_MESSAGE);
                }
            } else {
                getApplication().getMainWindow().showNotification("The MIB doesn't contain any metric for data collection.", Notification.TYPE_WARNING_MESSAGE);
            }
        }
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:27,代码来源:MibCompilerPanel.java

示例8: addDataCollectionGroupPanel

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
/**
 * Adds a data collection group panel.
 *
 * @param dataCollectionDao the OpenNMS data collection configuration DAO
 * @param file data collection group file name
 * @param dcGroup the data collection group object
 */
private void addDataCollectionGroupPanel(final DataCollectionConfigDao dataCollectionDao, final File file, final DatacollectionGroup dcGroup) {
    DataCollectionGroupPanel panel = new DataCollectionGroupPanel(dataCollectionDao, dcGroup, new SimpleLogger()) {
        @Override
        public void cancel() {
            this.setVisible(false);
        }
        @Override
        public void success() {
            getApplication().getMainWindow().showNotification("Data collection group file " + file.getName() + " has been successfuly saved.");
            this.setVisible(false);
        }
        @Override
        public void failure() {
            getApplication().getMainWindow().showNotification("Data collection group file " + file.getName() + " cannot be saved.", Notification.TYPE_ERROR_MESSAGE);
        }
    };
    panel.setCaption("Data Collection from " + file.getName());
    removeDataCollectionGroupPanel();
    addComponent(panel);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:28,代码来源:DataCollectionGroupAdminPanel.java

示例9: addEventPanel

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
/**
 * Adds a new Events Panel.
 *
 * @param layout the layout
 * @param file the Events File Name
 * @param events the Events Object
 * @return a new Events Panel Object
 */
private void addEventPanel(final VerticalLayout layout, final File file, final Events events) {
    EventPanel eventPanel = new EventPanel(eventConfDao, eventProxy, file, events, new SimpleLogger()) {
        @Override
        public void cancel() {
            this.setVisible(false);
        }
        @Override
        public void success() {
            getMainWindow().showNotification("Event file " + file + " has been successfuly saved.");
            this.setVisible(false);
        }
        @Override
        public void failure() {
            getMainWindow().showNotification("Event file " + file + " cannot be saved.", Notification.TYPE_ERROR_MESSAGE);
        }
    };
    eventPanel.setCaption("Events from " + file);
    removeEventPanel(layout);
    layout.addComponent(eventPanel);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:29,代码来源:EventAdminApplication.java

示例10: recoverProtocolButtonClick

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
@Override
public void recoverProtocolButtonClick(ClickNavigationEvent event) {
	Protocol editingProtocol = (Protocol) event.getRegister();

	if (editingProtocol == null)
		return;
	
	File boxRecover = new File(boxImport);
	
	try {
		FileUtils.copyFileToDirectory(editingProtocol.getFile(), boxRecover);
		
		getApplication().getMainWindow().showNotification("Recuperación correcta", "", Notification.TYPE_HUMANIZED_MESSAGE);
	} catch (IOException e) {
		throw new RuntimeException(
				"¡No se pudo recuperar el protocolo!", e);
	}
	
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:20,代码来源:IntegrationView.java

示例11: fillDataSource

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
private void fillDataSource() {
   	try {
       	bcOrganization.removeAllItems();        	
       	bcOrganization.addAll(user.getOrganizations());
       	
   		// set language selected
       	languageField.addItem("Español");
       	languageField.addItem("English");
       	languageField.addItem("Française");
       	//languageField.addItem("简体中文");
   		    		
	} catch (Exception e) {
		getWindow().showNotification(
				"¡Error refrescando organizaciones!",
                   "",
                   Notification.TYPE_WARNING_MESSAGE);
	}
    
  	if (user.getDefaultOrganization() != null)
  		organizationField.setValue(user.getDefaultOrganization());
    	
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:23,代码来源:ProfileSettingsViewForm.java

示例12: getConfig

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
@Override
public Object getConfig() {
    try {
        PoolPartyApiConfig apiConfig = apiPanel.getApiConfig();
        URL url = PPTApi.getServiceUrl(apiConfig.getServer(), "PoolParty/sparql/" + apiConfig.getUriSupplement()+ "?query=" + URLEncoder.encode("ASK {?x a <http://www.w3.org/2004/02/skos/core#Concept> }", "UTF-8"));
        logger.info(url);
        Authentication authentication = apiConfig.getAuthentication();
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        authentication.visit(con);
        if (con.getResponseCode() != 200) {
            getWindow().showNotification("Unable to query SPARQL endpoint of project", "", Notification.TYPE_ERROR_MESSAGE);
            throw new RuntimeException("Response code: "+con.getResponseCode());
        }
        config.setApiConfig(apiConfig);
        config.setLinkProperty(((LinkingProperty) linkProperty.getValue()).getUri());
    } catch (Exception ex) {
        logger.error("Unable to query SPARQL endpoint of project", ex);
    }
    return config;
}
 
开发者ID:lodms,项目名称:lodms-plugins,代码行数:21,代码来源:ThesaurusLinkDialog.java

示例13: buttonClick

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
public void buttonClick(ClickEvent event) {
	textArea.setComponentError(null);
	
	if(event.getButton().equals(sendButton)) {
		if(textArea.getValue() == null || textArea.getValue().toString().isEmpty()) {
			textArea.setComponentError(new UserError(CisConstants.uiRequiredField));
		} else {
			try {
				MailSender.send(CisConstants.emailSuggestionBoxEmail, CisConstants.uiSuggestionBox, textArea.getValue().toString());
				LoggerFactory.getLogger(SuggestionComponent.class).info(CisConstants.uiSuggestionBox + ": " + textArea.getValue().toString());
				getApplication().getMainWindow().showNotification(CisConstants.uiSuggestionSent);
				
			} catch (MessagingException e) {
				LoggerFactory.getLogger(SuggestionComponent.class).error("Error sending email", e);
				getApplication().getMainWindow().showNotification(CisConstants.uiSuggestionNotSent, Notification.TYPE_ERROR_MESSAGE);
			}
		}
	}
	
	textArea.setValue("");
}
 
开发者ID:alejandro-du,项目名称:cis,代码行数:22,代码来源:SuggestionComponent.java

示例14: showWarningNotification

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
public void showWarningNotification(String captionKey, String descriptionKey) {
  Notification notification = new Notification(i18nManager.getMessage(captionKey), 
          i18nManager.getMessage(descriptionKey), 
          Notification.TYPE_WARNING_MESSAGE);
  notification.setDelayMsec(-1); // click to hide
  mainWindow.showNotification(notification);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:8,代码来源:NotificationManager.java

示例15: showEdit

import com.vaadin.ui.Window.Notification; //导入依赖的package包/类
@Override
protected void showEdit() {
	if (getActiveObject() == null) {
		List<UIBean> selectedObjects = getSelectedObjectsInList();
		if (selectedObjects.size() > 0) {
			this.setActiveObject(selectedObjects.get(0));
		} else {
			//TODO i18n
			getMainContainer().getWindow().showNotification("Select an intem", "Please select an item to edit",
					Notification.TYPE_HUMANIZED_MESSAGE);
			showView(View.LIST);
			return;
		}
	}
	Panel panel = new Panel();
	panel.setSizeFull();
	panel.setStyleName("background-default");
	getMainContainer().addComponent(panel);
	if (getActiveObject().isNew()) {
		newForm.setValue(getActiveObject());
		panel.addComponent(newForm.getImplementation());
	} else {
		editForm.setValue(getActiveObject());
		editForm.getBindingContext().updateFields();
		panel.addComponent(editForm.getImplementation());
	}
	modified = false;
}
 
开发者ID:frincon,项目名称:openeos,代码行数:29,代码来源:AbstractFormVaadinTabImpl.java


注:本文中的com.vaadin.ui.Window.Notification类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。