开发者

Retrieving mode (Basic|Advanced) of ADF query component

I want to capture query component mode(Basic | Advanced) in processQuery event listener method for QueryEvent as below:

public void processQuery(QueryEvent queryEvent)
{
// Add event code here...
QueryDescriptor qdesc = queryEvent.getDescriptor();
String searchName = qdesc.getName();
String queryMode =?

I tried to get this value from开发者_如何学C getUIHints() map using UIHINT_MODE key. but getUIHints() returns empty map.


Try this :

ViewCriteria vc = null;
try
{
  Method m =
    pQueryDescriptor.getClass().getDeclaredMethod("getViewCriteria",
                                                  null);
  m.setAccessible(true);
  vc = (ViewCriteria) m.invoke(pQueryDescriptor, null);
}
catch (Exception ite)
{
  _logger.logp(Level.SEVERE, CLAZZ_NAME, methodName,
               "Exception getting ViewCriteria from QueryDescriptor.",
               ite);
} 
 String searchType =
      (String) vc .getProperty(ViewCriteriaHints.CRITERIA_MODE);

The idea is to get the ViewCriteria from the QueryDescriptor and to get the mode from the VC. This is becasue the mode is set on the criteria object itself, the VC knows how to display and what to display in each mode, and so it makes the MODE an inherent property of the VC and not just a UI thing....


QueryDescriptor qdesc = queryEvent.getDescriptor();
QueryDescriptor.QueryMode mode = (QueryDescriptor.QueryMode) qdesc.getUIHints().get(qdesc.UIHINT_MODE);

if("BASIC".equals(mode.toString())){

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜