1. #1
    Ext User
    Join Date
    Oct 2010
    Posts
    18
    Vote Rating
    0
    ikovaltaras is on a distinguished road

      0  

    Exclamation VBoxLayout resize problem.

    VBoxLayout resize problem.


    I have following code:

    Code:
    package com.sap.cmps.myview.client.ui;
    
    import com.extjs.gxt.ui.client.Style;
    import com.extjs.gxt.ui.client.Style.Orientation;
    import com.extjs.gxt.ui.client.util.Margins;
    import com.extjs.gxt.ui.client.widget.LayoutContainer;
    import com.extjs.gxt.ui.client.widget.Viewport;
    import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
    import com.extjs.gxt.ui.client.widget.layout.RowData;
    import com.extjs.gxt.ui.client.widget.layout.RowLayout;
    import com.extjs.gxt.ui.client.widget.layout.VBoxLayout;
    import com.extjs.gxt.ui.client.widget.layout.VBoxLayoutData;
    import com.extjs.gxt.ui.client.widget.layout.VBoxLayout.VBoxLayoutAlign;
    import com.google.gwt.user.client.ui.Widget;
    import com.google.inject.Inject;
    import com.google.inject.Singleton;
    import com.sap.cmps.myview.client.GlobalConstants;
    import com.sap.cmps.myview.client.GlobalMessages;
    import com.sap.cmps.myview.client.GlobalResources;
    import com.sap.cmps.myview.client.presenter.AppPresenter;
    import com.sap.cmps.myview.client.util.LabelValueComboBox;
    
    @Singleton
    public class AppView extends Viewport implements AppPresenter.Display {
    
        private GlobalConstants globalConstants;
        private GlobalMessages globalMessages;
        private GlobalResources globalResources;
    
        private LayoutContainer showPanelComboBoxLayoutContainer;
        private LabelValueComboBox<String> showPanelComboBox;
    
        private LayoutContainer panelsLayoutContainer;
        private VBoxLayout panelsLayout;
        private VBoxLayoutData panelsLayoutData;
    
        @Inject
        public AppView(GlobalConstants globalConstants,
                GlobalMessages globalMessages, GlobalResources globalResources) {
            super();
            this.globalConstants = globalConstants;
            this.globalMessages = globalMessages;
            this.globalResources = globalResources;
    
            this.panelsLayoutData = new VBoxLayoutData(new Margins(5));
            this.panelsLayoutData.setFlex(1);
    
            this.panelsLayout = new VBoxLayout();
            this.panelsLayout.setVBoxLayoutAlign(VBoxLayoutAlign.STRETCH);
    
            this.panelsLayoutContainer = new LayoutContainer();
            this.panelsLayoutContainer.setLayout(this.panelsLayout);
    
            this.showPanelComboBoxLayoutContainer = new LayoutContainer();
            this.showPanelComboBox = new LabelValueComboBox<String>();
            this.showPanelComboBox.setEmptyText(this.globalMessages.showPanelComboBoxPleaseSelectOption());
            this.showPanelComboBox.setEditable(false);
            this.showPanelComboBox.setForceSelection(true);
            this.showPanelComboBox.setTriggerAction(TriggerAction.ALL);
            this.showPanelComboBoxLayoutContainer.add(this.showPanelComboBox);
    
            this.setLayout(new RowLayout(Orientation.VERTICAL));
            this.add(this.showPanelComboBoxLayoutContainer, new RowData(Style.DEFAULT, Style.DEFAULT, new Margins(5, 0, 0, 5)));
            this.add(this.panelsLayoutContainer, new RowData(1, 1));
        }
    
        public LabelValueComboBox<String> getShowPanelComboBox() {
            return this.showPanelComboBox;
        }
    
        public void addWidget(Widget widget) {
            this.panelsLayoutContainer.add(widget, this.panelsLayoutData);
            this.layout(true);
        }
    
        public void removeWidget(Widget widget) {
            this.panelsLayoutContainer.remove(widget);
            this.layout(true);
        }
    
        public void showWidget(Widget widget) {
            addWidget(widget);
        }
    
        public Widget asWidget() {
            return this;
        }
    
    }

    So as you see I am using VBoxLayout with STRETCH and FLEX. To that container I added three ContentPanels. (See attachement 1.png). Then as you see when I remowing some panels all Conteiner is refreshed by calling layout() method after removeWidget(). (See 2.png). But now problem is when I adding new widget to LayoutContainer, and after calling layout() method height of that three panel not refreshed and not equal. (See 3.png)

    What to do that after adding widget to VBoxLayout all other widget resized to same height?
    Attached Images

Similar Threads

  1. [DUPE-770]VBoxLayout collapsed items
    By julian_calaby in forum Ext 3.x: Bugs
    Replies: 3
    Last Post: 9 Jun 2010, 10:20 PM
  2. [FIXED][3.x] VBoxLayout bug with align:'center'
    By Animal in forum Ext 3.x: Bugs
    Replies: 2
    Last Post: 8 Dec 2009, 10:45 AM
  3. [FIXED-162][3.0] VBoxLayout scrollOffset
    By Condor in forum Ext 3.x: Bugs
    Replies: 1
    Last Post: 23 Aug 2009, 6:09 PM
  4. [FIXED]Measurement in VBoxLayout typo
    By KampfCaspar in forum Ext 3.x: Bugs
    Replies: 4
    Last Post: 22 Apr 2009, 9:49 AM

Tags for this Thread