1. #1
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Colorado Springs, CO
    Posts
    365
    Vote Rating
    5
    DavidHoffer is on a distinguished road

      0  

    Question How to add scrollbars to AbsolutePanel?

    How to add scrollbars to AbsolutePanel?


    In the following sample I need to add scroll bars to the AbsolutePanel (or find a different way to do this). See buildGridPanel's comments below for an explanation of what I'm trying to do, but in summary I need to have an internal panel that holds any number of conversation panels each of which can be resized and moved via DnD, that panel must have scroll bars because often not all contained conversation panels will be visible at once.

    Note I've removed other BorderLayoutContainer panels for clarity.

    Code:
    public class Sample implements EntryPoint {
    
        private Resources resources;
    
        public void onModuleLoad() {
    
            resources = GWT.create(Resources.class);
    
            Viewport viewport = new Viewport();
            viewport.add(buildMainPanel(), new MarginData(10));
            RootPanel.get().add(viewport);
        }
    
        private Widget buildMainPanel() {
            final BorderLayoutContainer con = new BorderLayoutContainer();
            con.setBorders(true);
    
            con.setCenterWidget(buildGridAndBroadcastPanel(), new MarginData());
    
            con.hide(Style.LayoutRegion.WEST);
            con.hide(Style.LayoutRegion.NORTH);
            con.hide(Style.LayoutRegion.EAST);
            con.hide(Style.LayoutRegion.SOUTH);
    
            SimpleContainer simple = new SimpleContainer();
            simple.add(con, new MarginData());
    
            return simple;
        }
    
        private Widget buildGridPanel() {
    
            final BorderLayoutContainer gridContainer = new BorderLayoutContainer();
    
            AbsolutePanel con = buildAbsoluteConversationPanel();
            // This will be of varying size, but this is an example, this panel will hold any number of conversation panels
            // in a grid format.  If it is larger then the space allocated by the parent container and it most often will be
            // then it needs to have scroll bars.  Vertical scroll bars will be more common than Horizontal scroll bars.  Each
            // conversation panel contained by this panel may be of varying size but for each will be a multiple of the grid
            // size in both the vertical and horizontal direction, i.e. if the grid is configured to hold 200px x 200px conversation
            // panels, each contained conversation panel will be a multiple of 200px in size.
            con.setPixelSize(800, 1600);
    
            gridContainer.setCenterWidget(con, new MarginData(0));
    
            gridContainer.hide(Style.LayoutRegion.SOUTH);
            gridContainer.hide(Style.LayoutRegion.NORTH);
            gridContainer.hide(Style.LayoutRegion.EAST);
            gridContainer.hide(Style.LayoutRegion.WEST);
    
            return gridContainer;
        }
    
        private AbsolutePanel buildAbsoluteConversationPanel() {
            AbsolutePanel con = new AbsolutePanel();
    
            con.add(buildConversationPanel("#private", 200, 200, false), 5, 5);
            con.add(buildConversationPanel("bob", 200, 200, true), 210, 5);
            con.add(buildConversationPanel("#tom", 200, 400, true), 415, 5);
            con.add(buildConversationPanel("randy", 400, 400, true), 5, 205);
            return con;
        }
    
        private ContentPanel buildConversationPanel(String title, int width, int height, boolean dragable) {
            // Need Window else not resizable...not sure why...method is still there.
            final Window window = new Window();
            window.setPixelSize(width, height);
            window.setCollapsible(false);
            window.getHeader().setIcon(resources.webtasavailable_24());
            window.setBodyStyleName("pad-text");
            window.setHeadingText(title);
            window.setResize(true);
    //        applyHeaderTools(window);
    
            final ListStore<String> listStore = new ListStore<String>(new ModelKeyProvider<String>() {
                @Override
                public String getKey(String s) {
                    return null;
                }
            });
            final ListView<String, String> list = new ListView<String, String>(listStore, new ValueProvider<String, String>() {
                @Override
                public String getValue(String s) {
                    return null;
                }
    
                @Override
                public void setValue(String s, String s1) {
                }
    
                @Override
                public String getPath() {
                    return null;
                }
            });
            list.setSelectionModel(null);
    
            VerticalLayoutContainer verticalLayoutContainer = new VerticalLayoutContainer();
    
            verticalLayoutContainer.insert(list, 0, new VerticalLayoutContainer.VerticalLayoutData(1, height - 60));
    
            final HBoxLayoutContainer sendLayoutContainer = new HBoxLayoutContainer();
    
            sendLayoutContainer.setPadding(new Padding(0));
            BoxLayoutContainer.BoxLayoutData flex = new BoxLayoutContainer.BoxLayoutData(new Margins(2));
            flex.setFlex(5);
            sendLayoutContainer.add(new TextField(), flex);
            BoxLayoutContainer.BoxLayoutData flex2 = new BoxLayoutContainer.BoxLayoutData(new Margins(2));
            flex2.setFlex(1);
            sendLayoutContainer.add(new TextButton("Send"), flex2);
            verticalLayoutContainer.insert(sendLayoutContainer, 1, new VerticalLayoutContainer.VerticalLayoutData(1, 60));
    
            window.add(verticalLayoutContainer, new MarginData(0));
    
            if (dragable) {
                Draggable d = new Draggable(window);
            }
            return window;
        }
    }

  2. #2
    Sencha User
    Join Date
    Jul 2011
    Posts
    45
    Vote Rating
    0
    raivis is on a distinguished road

      0  

    Default


    Check out my thread:

    http://www.sencha.com/forum/showthread.php?163071-GXT-3.0-Scrollbars-for-containers-(panels)

    I had the same question and found out how to do it.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi