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...
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 :)
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);
}});
}};
}
//------------------------------------
I'd be glad for any hint.
Happy Easter :)
Comment