wicket:enclosure should work as you are saying with "hideEucaris() and hideMctcnc()" in Home since the visible state is also propageted with the nesting parents for each property. So when Mctcnc is hidden in home, every component of Mctcnc.xyz is hidden too. The problem with wicket:enclosure was that the GridColumn fix I made previously was causing this error. So with that problem away your wicket:enclosure should work properly with "hideEucaris() and hideMctcnc()".
Also I guess you used wicket:enclosure to hide the legend and labels of the properties. The wicket:enclosure is optional now because I have made some improvements in nowicket that make the labels and legends hide properly when the component they are made for is hidden. The only benefit that wicket:enclosure now brings is that the fieldset tag is hidden too when that is being used. Thus the small vertical gap it introduces is removed by that. See commit:
https://github.com/subes/invesdwin-nowicket/commit/a071a68154eb4cd1e38a43339105c27eb2f634baAlso I have seen the error regarding the risultati update (in the wicket debug panel in the
website you gave me access to). When looking at the source code in the browser it seems risultati is not shown, this might be because you added a wicket:enclosure around it (though I don't see this in the repo because you might now have pushed your changes from this morning). If you want to use wicket:enclosure for risultati, you have to define a div with a wicket id around the enclosure and bind it via an interceptor to WebMarkupContainer. Then in the ajax timer you update that web markup container instead of the risultati_gridcolumn because the wicket:enclosure prevents the placeholder tag to be rendered for this.
Though you could also just remove the wicket:enclosure for risultati, add a wicket:id to the fieldset, bind it via the interceptor to WebMarkupContainer and override its isVisible() method to copy the visible state of the risultati component (which you retrieve from the component registry).
Or make it even simpler and remove the wicket:enclosure for risultati and modify your ajax timer as noted previously(what I currently see in your repo the fix has not been applied, so the risultati gets updated which is invisible because the gridcolumn workaround was removed because it did not work well with wicket:enclosure, so now we have to update the gridcolumn because that is the only component that has a placeholder tag now) from:
---------------------------
@Override
protected void onTimer(final AjaxRequestTarget target) {
final List<QueryReplyModel> risultati = ((Home) HtmlContext.getModel(HomePage.this).getObject())
.getRisultati();
int size;
if (risultati != null) {
size = risultati.size();
} else {
size = 0;
}
if (size > actualSize) {
logger.debug("++++++++++++++++rinfresco pagina");
// GuiService.get().processRequestFinally(getComponent());
//
// } else {
final Component c = HtmlContext.get(HomePage.this).getComponentRegistry().getComponent(
HomeConstants.risultati);
target.add(c);
}
actualSize = size;
}
---------------------------
To:
---------------------------
@Override
protected void onTimer(final AjaxRequestTarget target) {
final List<QueryReplyModel> risultati = ((Home) HtmlContext.getModel(HomePage.this).getObject())
.getRisultati();
int size;
if (risultati != null) {
size = risultati.size();
} else {
size = 0;
}
if (size > actualSize) {
logger.debug("++++++++++++++++rinfresco pagina");
// GuiService.get().processRequestFinally(getComponent());
//
// } else {
final Component risultati = HtmlContext.get(HomePage.this).getComponentRegistry().getComponent(
HomeConstants.risultati + GridColumnHtmlElement.GRID_COLUMN_WICKET_ID_SUFFIX);
target.add(c);
}
actualSize = size;
}
---------------------------
Regarding the other question about the odd behavior of risultati sometimes appearing and sometimes not. This is because when an eager event is fired (for your combo boxes or when a button is invoked) the whole form gets updated because GuiService.processRequestFinally() gets called for it inside NoWicket. When that update happens when the risultati are non-empty, the tag will be properly rendered in the browser because the parent tag (the form) included it. After that has happened, the ajax timer will continue working properly until the risultati once become invisible again without a replacement tag being rendered. Since risultati is empty in the beginning and the ajax timer uses the missing wicket id to update the risultati (it is hidden because of a wicket:enclosure most probably), it fails and the error is displayed in the wicket debug panel in the website in the browser. Then again some action has to happen which updates the form via GuiService.processReuquestFinall() (again an eager event form combo box or button) to make it visible again.
You can get out of this odd behavior by simply applying the fix above to make sure the placeholder tag for the risultat_gridcolumn is always there (by removing any wicket:enclosure around it) to be updated and using the ajax timer code above to update that component. Or using one of the other approaches above involving WebMarkupContainer and update that component instead in the ajax timer behavior.
Hope this explains everything.