Note that there are some explanatory texts on larger screens.

plurals
  1. POForce ContentPanel to relayout its components
    primarykey
    data
    text
    <p>I implemented a Horizontal splittable panel with a BorderLayoutContainer and 2 ContentPanel:</p> <pre><code>-------------------------------------------------- | ContentPanel 1 | ContentPanel2 | | | | | component 1 - component 2 | | | &lt;-|-&gt; | | | | | | | -------------------------------------------------- </code></pre> <p>With this code :</p> <pre><code>public class WestCenter extends BorderLayoutContainer { private ContentPanel westPanel; private ContentPanel centerPanel; public WestCenter(){ westPanel = new ContentPanel(); centerPanel = new ContentPanel(); BorderLayoutData westData=new BorderLayoutData(800); westData.setSplit(true); westData.setCollapsible(true); westData.setMinSize(300); westData.setMaxSize(2000); westData.setMargins(new Margins(0,5,0,0)); BorderLayoutData centerData=new BorderLayoutData(); setWestWidget(westPanel, westData); setCenterWidget(centerPanel,centerData); } ... //Getters, Setters etc... </code></pre> <p>}</p> <p><strong>Problem :</strong> </p> <p>When the user drags the bar so that "component 1" and "component 2" cannot fit in the same line anymore, there is some problems in the height calculation, resulting in a bad display.</p> <pre><code>-------------------------------------------------- | ContentPanel 1 | ContentPanel2 | | | | | component 1 | | | component 2 &lt;-|-&gt; | | | | | *bad display for | | | compos here* | | -------------------------------------------------- </code></pre> <p><strong>But</strong></p> <p>If I manually redrag by 1px, the display is good again (even with "component 1" and "component 2" on 2 lines).</p> <p><strong>Question</strong></p> <p>How can I force the ContentPanel to redisplay its content?</p> <p>Up to now, the only way I found is (very) ugly: add a resize handler on the contentPanel to set the width to width-1. </p> <p>The problem is that this handler generates another resize event, resulting in an infinite loop. But with the help of a Timer, I validated that the display problem was solved by this change of width :</p> <pre><code>westPanel.addResizeHandler(new ResizeHandler() { @Override public void onResize(final ResizeEvent event) { Timer t=new Timer(){ @Override public void run() { westPanel.setWidth(westPanel.getOffsetWidth()-1); } }; t.schedule(2000); } }); </code></pre> <p>Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload