GWT—《 文件导出、下载》

来源:互联网 发布:期货跟单软件 编辑:程序博客网 时间:2024/05/07 00:28

已经3年没接触smartgwt这么技术了 变化还是挺大的,以前很少写博客,用到的很多实用东西时间一长都忘记了,所以,尽量抽时间写写博客,和大家一起探讨学习。。。

很多项目基本都会有文件导出、下载的功能,那么GWT也不例外,少废话,入正题:


1,Window方式

Window.open(newURL, "_blank", null);

就是null参数控制新窗口为模态的,改为下面的样子就没有问题了

Window.open(newURL, "_blank", "");   

 参考一下open方法的文档:

void com.google.gwt.user.client.Window.open(String url, String name, String features)

Opens a new browser window. The “name” and “features” arguments are specified here.

Parameters:
url the URL that the new window will display
name the name of the window (e.g. “_blank”)
features the features to be enabled/disabled on this window

 

window.open ('page.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no')

 

 window.open 弹出新窗口的命令;

'page.html' 弹出窗口的文件名;

'newwindow' 弹出窗口的名字(不是文件名),非必须,可用空''代替;

height=100 窗口高度;

width=400 窗口宽度;

top=0 窗口距离屏幕上方的象素值;

left=0 窗口距离屏幕左侧的象素值;

toolbar=no 是否显示工具栏,yes为显示;

menubar,scrollbars 表示菜单栏和滚动栏。

resizable=no 是否允许改变窗口大小,yes为允许;

location=no 是否显示地址栏,yes为允许;

status=no 是否显示状态栏内的信息,yes为允许;


2,linkHTML

 一般在web页面也是可以通过a标签进行,其实linkHTML就与之类似 代码如:

@Override
public String linkHTML(String href) {
// TODO Auto-generated method stub
return super.linkHTML(href);
}

当然linkHTML 方法中还有很多参数,就不一一说明啦!


另外,还有其他方法实现相同功能,这里就不加介绍了生气


0 0
原创粉丝点击