3.3 欄位屬性
在controller的context中,可將欄位屬性的calculated屬性設為true,則該在controller中可在該欄位的set/getter方法中寫代碼操作該欄位的值,在該代碼中修改該欄位的值後,在mapping過的view中可直接顯示該欄位的值
4 Message
3種類型:Standard, Warning, Error
在IMessage{Nc}中作為常量存在,如component為 StartComp,則該類名為 IMessageStartComp.
訪問方式:
IWDTextAccessor txtAccessor = wdComponentApi.getTextAccessor();
String msg = txtAccessor.getText(“{MessageKey}”);
IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
將Message與UI元素關聯:
拋出錯誤信息:
wdComponentAPI.getMessageManager().raisePendingException();
在NWDS中在deploy時,經常會提示服務不可用,但經查系統,發現服務端無任何問題,此時,在NWDS中將SAP AS JAVA中的服務重配即可。
在MESSAGE POOL中維護好message後,如下:
其中text中的{0}{1}即為需要傳遞的參數,從0開始數。
然後要在程序中拋出該消息,有兩種方法:
1. IWDMessageManager msgMgr = this.wdComponentAPI.getMessageManager();
IWDTextAccessor txtAcc = this.wdComponentAPI.getTextAccessor();
String msg = txtAcc.getText(“S10001”, new Object[] {“begindate”,“enddate”});
msgMgr.reportException(msg);
2. IWDMessageManager msgMgr = this.wdComponentAPI.getMessageManager();
msgMgr.reportMessage(IMessageStartComp.S10001, new Object[] {“begindate”,“enddate”});
上述示例代碼中加入的new Object[]數組即為需要傳遞到message中的變數值,與ABAP類似。
將消息與屏幕上的某個元素關聯:
5 動態設置value-help
SVS 設置selectedKey屬性
EVS 設置value屬性
OVS
動態設置參見下圖
6 動態編程,即動態設置context
1. 動態創建context
此處定義的attribute,如需在UI的元素中使用,則其類型必須為sap java directory,即上圖中的ddic:com.sap.dictionary.string等,具體可用類型在在context中定義時可看到;也可用java的類型,如java:java.lang.String,但此種類型不能用於UI元素。
以下文章點擊率最高
Loading…