Vaadin 学习记录
窗口类:
Window
?
它主要用来显示。
每一个Application可以设置一个主窗口比如:
Window mainWindow = new Window(messageSource.getMessage("main.window",null,Locale.CHINESE));//message为国际化,如果直接输入中文则会乱码。setMainWindow(mainWindow);
还可以向主窗口添加多个子窗口如:
可以设置这个窗口的icon
是当前窗口显示后,背后的窗口变为不可使用。
window.setModal(true);设置是否可以拖拉窗口大小
??<property name="useCodeAsDefaultMessage" value="true"></property>?
package com.xq.util;
import javax.servlet.ServletContext;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.vaadin.Application;
import com.vaadin.terminal.gwt.server.WebApplicationContext;
public class SpringContext {
???? private ApplicationContext context;
???? public void SpringContextHelper(Application application) {
???????? ServletContext servletContext = ((WebApplicationContext) application.getContext()).getHttpSession().getServletContext();
???????? context = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
???? }
???? public Object getBean(final String beanRef) {
???????? return context.getBean(beanRef);
???? }???
???? public Object getBean(final Class class1){
???? ?return context.getBean(class1);
???? }
?}
?
?
package com.xq.util;
import javax.servlet.ServletContext;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.vaadin.Application;
import com.vaadin.terminal.gwt.server.WebApplicationContext;
public class SpringContext {
???? private ApplicationContext context;
???? public void SpringContextHelper(Application application) {
???????? ServletContext servletContext = ((WebApplicationContext) application.getContext()).getHttpSession().getServletContext();
???????? context = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
???? }
???? public Object getBean(final String beanRef) {
???????? return context.getBean(beanRef);
???? }???
???? public Object getBean(final Class class1){
???? ?return context.getBean(class1);
???? }
?}