You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (Resolved) (JIRA)" <ji...@apache.org> on 2012/04/10 15:25:19 UTC
[jira] [Resolved] (WICKET-4491) isVisible() and
determineVisibility() don't work as expected on component in
BorderBodyContainer
[ https://issues.apache.org/jira/browse/WICKET-4491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Grigorov resolved WICKET-4491.
-------------------------------------
Resolution: Not A Problem
Re-counting the braces I see now that you override Label's #onEvent() and its isVisible() is not the same as bodyContainer's #isVisible().
You may either check Label#isVisibleInHierarchy() or check "inforBorder.getBodyContainer().isVisible()"
> isVisible() and determineVisibility() don't work as expected on component in BorderBodyContainer
> ------------------------------------------------------------------------------------------------
>
> Key: WICKET-4491
> URL: https://issues.apache.org/jira/browse/WICKET-4491
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 6.0.0-beta1
> Environment: Ubuntu 12.04, java7
> Reporter: Rob Audenaerde
> Priority: Minor
>
> I have an application that has a foldable left bar (somewhat like jQuery's accordeon). The menu-panels are implemented as Borders; see the next fragment. The problem I have is that components that are placed in this border do not correctly reflect the visibily of the bodycontainer -> if the bodycontainer is invisible, I expect the component inside that container to be invisible as well.
> I need this, as the component in the container acts as EventSink. I use events to notify the component to dynamically update itself by ajax. But when the event is passed and the component is invisible, there is no outputMarkupId and I get an Wicket Ajax Error (this is correct behaviour).
> public class AjaxToggleLinkBorder extends Border
> {
> private static final long serialVersionUID = -5801550490420643837L;
> protected boolean bodyVisible = false;
> final public boolean isBodyVisible()
> {
> return bodyVisible;
> }
> final public void setBodyVisible( final boolean isBodyVisible )
> {
> this.bodyVisible = isBodyVisible;
> getBodyContainer().setVisible( isBodyVisible() );
> }
> public AjaxToggleLinkBorder( final String id, final IModel linkText )
> {
> super( id );
> setBodyVisible( isBodyVisible() );
> setOutputMarkupId( true );
> final AjaxFallbackLink<Void> link = new AjaxFallbackLink<Void>( "link" )
> {
> private static final long serialVersionUID = 3540373588573135540L;
> @Override
> public void onClick( final AjaxRequestTarget target )
> {
> setBodyVisible( !isBodyVisible() );
> target.add( AjaxToggleLinkBorder.this );
> }
> };
> link.add( new Label( "label", linkText ) );
> addToBorder( link );
> }
> }
> I add components line this:
> final Border infoBorder = new AjaxToggleLinkBorder( "infoBorder", new Model<String>( "Info" ) );
> infoBorder.getBodyContainer().add( new AmountLabel( "total", tp.newTotalModel() ) );
> infoBorder.getBodyContainer().add( new Label( "numberOfTransactions", tp.newSizeModel() )
> {
> @Override
> public void onEvent( final IEvent<?> event )
> {
> super.onEvent( event );
> // check if this is a counter update event and if so repaint self
> if ( event.getPayload() instanceof CategoryUpdate )
> {
> final CategoryUpdate update = (CategoryUpdate) event.getPayload();
> final boolean isVisible = this.determineVisibility();
> if ( update.getTarget() != null && isVisible )
> {
> update.getTarget().add( this );
> }
> }
> }
> } );
> The boolean isVisible is true, while the bodycontainer is not.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira