Hi,
Currently, thefor the PageTreeNode, the "selected" property does not accept hard coded or computed values.
I looked at the code and it looks for selection (a regexp) ... but does not use the computed expression if we put one in selected.
I suspect it can be true for other properties too, no checked yet.
Here is the modified method to correct this :(have to add a selected private variable, and save/restore it in state management part too).
@Override
public boolean isSelected() {
// Added by Michael : check for a value or a value binding first
if (null != this.selected) {
return this.selected;
}
ValueBinding _vb = getValueBinding("selected"); //$NON-NLS-1$
if (_vb != null) {
Boolean val = (java.lang.Boolean) _vb.getValue(FacesContext.getCurrentInstance());
if(val!=null) {
return val;
}
}
// end : Added by Michael
// Look if there is a selection string and if it matches the navigation path
String selection = getSelection();
if(StringUtil.isNotEmpty(selection)) {
FacesContext ctx = FacesContext.getCurrentInstance();
ConversationState cs = ConversationState.get(ctx, false);
if(cs!=null) {
String navPath = cs.getNavigationPath();
if(StringUtil.isNotEmpty(navPath)) {
return navPath.matches(selection);
}
}
return false;
}
// Else if it points to a page, then see if the page matches
String page = ExtLibUtil.getPageXspUrl(getPage());
if(StringUtil.isNotEmpty(page)) {
FacesContext ctx = FacesContext.getCurrentInstance();
String currentPage = ((UIViewRootEx)ctx.getViewRoot()).getPageName();
return StringUtil.equals(page, currentPage);
}
return super.isSelected();
}