I have a block level element, a container that should be hidden when all of its Wicket children (buttons) are hidden. In other words, if any child button is visible, the container should be visible.
Previously, one of the buttons was always visible if there were any buttons, so I used this button to control the visibility <wicket:enclosure>, processing all this exclusively on the HTML side.
Now the specifications have changed so that the buttons can be hidden / visible independently, so a simple application will no longer work (I think).
I worked on this:
HTML:
<wicket:container wicket:id="downloadButtons">
<wicket:message key="download.foo.bar"/>:
<input type="button" wicket:id="excelDownloadButton" wicket:message="value:download.excel"/>
<input type="button" wicket:id="textDownloadButton" wicket:message="value:download.text"/>
</wicket:container>
Java:
WebMarkupContainer container = new WebMarkupContainer("downloadButtons");
boolean showContainer = false;
Iterator<? extends Component> it = container.iterator();
while (it.hasNext()) {
if (it.next().isVisible()) {
showContainer = true;
break;
}
}
addOrReplace(container.setVisible(showContainer));
Java , , , , . ? - "" ( ), ?
( 1.4, .)