文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Showing WDK Popup from TBO(从TBO中返回错误信息到弹出窗口中)

Showing WDK Popup from TBO(从TBO中返回错误信息到弹出窗口中)

时间:2010-09-12  来源:毁于随

http://www.mydocumentum.net/knowledge-base/46-programming/173-showing-wdk-popup-from-tbo

 

It is possible to trigger WDK popup from TBO, here is the example how to do it.



 

First you need to write a TBO, for example, we'll check a attribute maturity_date which is a custom attribute, the rule is simple, the value that assigned to this attribute cannot be less than today. Here is the sample code how we can achieve to show error popup once the user input "wrong value" for this attribute

Create a global variable maturityDateError

1
2
    private boolean maturityDateError= false;

Override setString method in the TBO

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
    @Override
public void setString( String attributeName, String value ) throws DfException {
if (attributeName.equalsIgnoreCase( "maturity_date" ))
{
SimpleDateFormat dateFormat = new SimpleDateFormat( "MM/dd/yyyy HH:mm:ss aa" );
try
{
Date date = dateFormat.parse( value );
maturityDateError = date.before( new Date() );
}
catch (Exception ex)
{
ex.printStackTrace();
}
} else
super.setString( attributeName, value );
}

Override doSave method

1
2
3
4
5
6
7
8
9
    @Override
protected void doSave(boolean keepLock, String versionLabels, Object[] extendedArgs) throws DfException {
DfLogger.debug(this, "doSave", null, null);

if (maturityDateError)
throw new DfException("Maturity date cannot be less than today.");

super.doSave(keepLock, versionLabels, extendedArgs);
}

Compile your TBO and install it to your repository.

Once it installed on your repository, try to change it using Properties component, the popup error should be like this:

 

 

以为是什么高级东西呢吧,其实就是抛个异常出来~~~~

相关阅读 更多 +
排行榜 更多 +
翌日波奇狗的历险记手机版下载

翌日波奇狗的历险记手机版下载

休闲益智 下载
怪兽远征安卓版下载

怪兽远征安卓版下载

角色扮演 下载
谷歌卫星地图免费版下载

谷歌卫星地图免费版下载

生活实用 下载