Announcement

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

    Bug in TileLayout when adding to specific position

    SmartClient Version: v10.0p_2015-04-03/LGPL Development Only (built 2015-04-03)
    Browsers: at least IE11 and FF36

    When adding a Tile to a TileLayout using .addTile(tile, index), the added Tile is drawn over the Tile, which is currently on the wanted index.

    Please try it by the following example.
    Behavior: TileLayout contains 2 fixed Tiles (first,last), which cannot be removed. "Add Tile" button adds new Tile as the last but one. "Remove Tile" removes the removeable tiles from the last one.
    Note: when the Tile is removed, the Last is shown...
    Code:
    	//------------------------------------
    	TileLayout tileLayout; //to be accessible from click handlers
    	int tileCounter = 2; //there are 2 fixed tiles, which cannot be removed
    	
    	//Initializes the main layout with TileLayout and buttons to add/remove tiles.
    	private void initTileLayoutTest() {
    		Layout mainLayout = new VLayout();
    		mainLayout.setWidth100();
    		mainLayout.setHeight100();
    		mainLayout.setMembersMargin(5);
    		
    		mainLayout.addMember(tileLayout = createTileLayout());
    		mainLayout.addMember(new IButton("Add tile", new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				//add tile just before the last fixed tile
    				int index = tileCounter - 1;
    				tileLayout.addTile(createTile(("[" + index + "] removeable"), false), index);
    				tileCounter++;
    			}
    		}));
    		mainLayout.addMember(new IButton("Remove tile", new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				//remove the last removeable tile
    				int index = tileCounter - 2;
    				if (index <= 0) return;
    				tileLayout.removeTile(index);
    				tileCounter--;
    			}
    		}));
    		mainLayout.show();
    	}
    	
    	//Creates tile layout containing two fixed (not removeable) tiles
    	private TileLayout createTileLayout() {
    		TileLayout tileLayout = new TileLayout();
    		tileLayout.setWidth(500);
    		tileLayout.setAutoHeight();
    		//when set to false, even the fixed tiles are displayed one over another after init.
    		//tileLayout.setAnimateTileChange(false);
    		tileLayout.setOverflow(Overflow.VISIBLE);
    		tileLayout.setLayoutPolicy(TileLayoutPolicy.FLOW);
    		
    		tileLayout.addTile(createTile("FIRST fixed", true));
    		tileLayout.addTile(createTile("LAST fixed", true));
    		return tileLayout;
    	}
    	
    
    	//Tile represented by a Layout containing Label component
    	private Layout createTile(final String aContent, final boolean isFixed) {
    		return new HLayout() {{
    			setAutoWidth();
    			setDefaultHeight(20);
    			setPadding(2);
    			setBackgroundColor(isFixed ? "#20fb00" : "orange");
    			addMember(new Label(aContent) {{
    				setAutoWidth();
    				setHeight(20);
    				setWrap(false);
    			}});
    		}};
    	}
    	//------------------------------------
    And one hint - when you set the TileLayout property: setAnimateTileChange(false), even the two first fixed Tiles are drawn one over another...

    I'd be glad for any hint.
    Happy Easter :)

    #2
    Really no one interested in this issue?

    For now I was not able to find a workaround and it really makes me nervous :)

    Please could someone check the example in SGWT above? It is quite simple and should be reproduced easily...

    Comment


      #3
      Thanks for pointing this out. We see the problem as well.

      A fix has been applied to SGWT 5.0p/SC 10.p and newer that will be in the nightly builds available tomorrow (4-9-2015).

      Comment


        #4
        Great! Thanks a lot for the fix.

        Comment

        Working...
        X