文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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:

 

 

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

相关阅读 更多 +
排行榜 更多 +
PvZ戴夫的时空冒险重置

PvZ戴夫的时空冒险重置

策略塔防 下载
PVZTV雪版阳光加50

PVZTV雪版阳光加50

策略塔防 下载
双刃战士雪姐

双刃战士雪姐

冒险解谜 下载