Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Navigationpane disappears in a nested SplitPane

    Hello, please consider the isolated test case below (smartgwt pro 13d)


    If you select the first node in the root tree, the split pane child will show as expected. However, if you then select the second root node, and then back to the first node, the navigationpane of the child splitpane disappears!

    Is this a bug, or am i doing something wrong?

    Cheers /Mathias

    (funnily enough, i don't have this issue in my "real" application, where i instead have fullscreen issues with my nested splitpane for some reason, will i thought i'd post in a separate thread)



    Code:
    package com.test;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.types.SelectionStyle;
    import com.smartgwt.client.widgets.layout.SplitPane;
    import com.smartgwt.client.widgets.layout.VLayout;
    import com.smartgwt.client.widgets.tree.Tree;
    import com.smartgwt.client.widgets.tree.TreeGrid;
    import com.smartgwt.client.widgets.tree.TreeGridField;
    import com.smartgwt.client.widgets.tree.TreeNode;
    
    public class TheTest implements EntryPoint {
    
        public void onModuleLoad() {
    
            SplitPane split = createMainSplitPane();
            split.setWidth100().setHeight100();
    
            split.draw();
        }
    
        private SplitPane createMainSplitPane(){
    
            TreeNode first = new TreeNode("First");
            TreeNode second = new TreeNode("Second");
            TreeNode[] nodes = new TreeNode[]{first, second};
    
            SplitPane child1 = createChildSplitPane();
            TestLayout child2 = new TestLayout("green", "brown");
    
            DefaultTreeGrid grid = new DefaultTreeGrid("groot", nodes);
            DefaultSplitPane main = new DefaultSplitPane("rootSplit", grid);
            main.setNavigationPane(grid);
    
            grid.addRecordClickHandler(recordClickEvent -> {
                main.setDetailPane(recordClickEvent.getRecord().getAttribute("name").equals("First") ? child1 : child2);
            });
    
            return main;
        }
    
        private SplitPane createChildSplitPane() {
            TreeNode third = new TreeNode("Third");
            TreeNode fourth = new TreeNode("Fourth");
            TreeNode[] nodes = new TreeNode[]{third, fourth};
    
            TestLayout child1 = new TestLayout("purple", "white");
            TestLayout child2 = new TestLayout("black", "white");
    
            DefaultTreeGrid childGrid = new DefaultTreeGrid("gr2", nodes);
            childGrid.setBodyBackgroundColor("cyan");
    
            DefaultSplitPane child = new DefaultSplitPane("childsplit", childGrid);
            childGrid.addRecordClickHandler(recordClickEvent ->
            {
                child.setDetailPane(recordClickEvent.getRecord().getAttribute("name").equals("Third") ? child1 : child2);
            });
    
            return child;
        }
    
        //util classes
    
        public class DefaultSplitPane extends SplitPane {
    
            public DefaultSplitPane(String id, DefaultTreeGrid grid){
                setID(id);
                setShowDetailToolStrip(false);
                setNavigationPane(grid);
            }
        }
    
        public class DefaultTreeGrid extends TreeGrid {
    
            public DefaultTreeGrid(String id, TreeNode[] nodes) {
                setID(id);
                Tree tree = new Tree();
                tree.setData(nodes);
                setSelectionType(SelectionStyle.SINGLE);
                setAlwaysShowScrollbars(true);
                TreeGridField nameField = new TreeGridField("name");
                nameField.setWidth("100%");
                setHeight100();
                setWidth100();
                setLeaveScrollbarGap(false);
                setData(tree);
                setFields(nameField);
                setShowSelectedIcons(true);
                setCanSort(false);
                setShowHeaderContextMenu(false);
                setShowHeader(false);
            }
        }
    
        class TestLayout extends VLayout{
    
            public TestLayout(String col, String border) {
                setBackgroundColor(col);
                if (border != null) {
                    setBorder("5px solid " + border);
                }
            }
        }
    }
Working...
X