javagwtuibindergwt-platformdocklayoutpanel

Can we remove a Block (West, East, North or South block) out of a DockLayoutPanel?


I like DockLayoutPanel cos it's quite solid. However, there's a big problem.

That is how to remove a Block (West, East, North or South block) out of a DockLayoutPanel?

Let say, i got this code

   <g:DockLayoutPanel ui:field="centralDockLayoutPanel">
         <g:center>
               <g:LayoutPanel ui:field="mainPanel"/>  
         </g:center>
         <g:east size="200">
                <g:HTMLPanel ui:field="happyHTMLPanel"  width="100%" height="100%"> 
                 Some more widgets here
               </g:HTMLPanel> 
         </g:east>
   </g:DockLayoutPanel>  

I want to remove the East block out of the centralDockLayoutPanel. So i tried

getView().getCentralDockLayoutPanel().remove(getView().getHappyHTMLPanel());

But that doesn't work

getView().getHappyHTMLPanel().setVisible(false);

also doesn't work

Can we remove a Block (West, East, North or South block) out of a DockLayoutPanel?


Solution

  • You could try to do :

    getView().getCentralDockLayoutPanel().remove(getView().getHappyHTMLPanel());
    getView().getCentralDockLayoutPanel().forceLayout();
    

    Or you can hide your panel:

    getView().getCentralDockLayoutPanel().setWidgetHidden(getView().getHappyHTMLPanel(), true);
    getView().getCentralDockLayoutPanel().forceLayout();