1、gxt用boeder布局时,看不见界面时,可能是要用子控件要用fitlayout布局。
2、grid列自动缩放:
grid.setStripeRows (true); grid.setAutoExpandColumn ("info");
grid.setAutoExpandMin (80);
grid.getView ().setForceFit (true);
3、对于tab页面,要想grid列宽度自适应的话还要加一下条件:
messagePanel.setLayoutData (new FitLayout());
loggerTab = new TabItem ("系统日志");
loggerTab.setLayoutData (new FitLayout());
loggerTab.setLayoutOnChange (true);
loggerTab.add (getLoggerPanel ());
messagePanel.add (loggerTab);
而且不能设置为自动宽度。
4、布局不起作用,可能是setLayout写成了setLayoutData;
5、gxt里面尽量用boederlayout布局,那样自适应较强;
6、所有远程对象继承下面类,可以和spring集成;
1public abstract class BaseAction extends RemoteServiceServlet implements
2 Controller, ServletContextAware, ServletConfigAware, BeanNameAware {
3 private ServletContext servletContext;
4 private String controllerName;
5
6 /** *//** * Gets ServletContext. */
7 @Override
8 public ServletContext getServletContext() {
9 return servletContext;
10 }
11
12 /**//*
13 * * (non-Javadoc) * * @see *
14 * org.springframework.beans.factory.BeanNameAware#setBeanName (java.lang *
15 * .String)
16 */
17 @Override
18 public void setBeanName(String controllerName) {
19 this.controllerName = controllerName;
20 }
21
22 /** *//** * Implementation of ServletContextAware. */
23 public void setServletContext(ServletContext servletContext) {
24 this.servletContext = servletContext;
25 }
26
27 public String getServletName() {
28 return "DispatcherServlet name is "
29 + this.servletConfig.getServletName()
30 + ", GwtController name is:" + controllerName;
31 }
32
33 private ServletConfig servletConfig;
34
35 @Override
36 public void setServletConfig(ServletConfig servletConfig) {
37 this.servletConfig = servletConfig;
38 }
39
40 /** *//**
41 * * Handles request and delegates to GWT's *
42 * RemoteServiceServlet.doPost(request, response).
43 * */
44 public ModelAndView handleRequest(HttpServletRequest request,
45 HttpServletResponse response) throws Exception {
46 try {
47 doPost(request, response);
48 return null;
49 } catch (Exception e) {
50 return null;
51 }
52 }
53
54} 7、servlet里面推数据至gxt前台:
后台:
1RemoteEventServiceServlet ress = new RemoteEventServiceServlet () { };
2UploadEvent event = new UploadEvent (source);
3 ress.addEvent (UploadEvent.FILEREADING_SERVER_DOMAIN_MESSAGE, event);
4 RemoteEventServiceServlet ress = new RemoteEventServiceServlet () { }; UploadEvent event = new UploadEvent (source); ress.addEvent (UploadEvent.FILEREADING_SERVER_DOMAIN_MESSAGE, event);
前台:
// 启动监听器
1RemoteEventService theRemoteEventService = RemoteEventServiceFactory.getInstance ().getRemoteEventService ();
2 theRemoteEventService.addListener (UploadEvent.UPLOAD_SERVER_DOMAIN_INBOUND,
3 new RemoteEventListener ()
4 {
5 public void apply (de.novanic.eventservice.client.event.Event anEvent)
6 {
7 if (anEvent instanceof UploadEvent)
8 {
9 UploadEvent te = (UploadEvent) anEvent;
10 sourceTemplate = te.getSource ();
11 fileText.setValue (te.getResultMessage ());
12 }
13 }
14 });