don't draw clipped tabs on the bottom when vertical layout is used

This commit is contained in:
Dmitry Jemerov
2012-02-24 12:52:56 +01:00
parent c29ed4c656
commit 469c8c8b27
2 changed files with 17 additions and 1 deletions
@@ -104,7 +104,8 @@ public class ScrollableSingleRowLayout extends SingleRowLayout {
length = getStrategy().getLengthIncrement(label.getPreferredSize());
final int moreRectSize = getStrategy().getMoreRectAxisSize();
if (data.position + length > data.toFitLength - moreRectSize) {
super.applyTabLayout(data, label, data.toFitLength - data.position - moreRectSize - 4, deltaToFit);
final int clippedLength = getStrategy().drawPartialOverflowTabs() ? data.toFitLength - data.position - moreRectSize - 4 : 0;
super.applyTabLayout(data, label, clippedLength, deltaToFit);
label.setAlignmentToCenter(false);
label.setActionPanelVisible(false);
return false;
@@ -73,6 +73,13 @@ public abstract class SingleRowLayoutStrategy {
public abstract boolean isDragOut(TabLabel tabLabel, int deltaX, int deltaY);
/**
* Whether a tab that didn't fit completely on the right/bottom side in scrollable layout should be clipped or hidden altogether.
*
* @return true if the tab should be clipped, false if hidden.
*/
public abstract boolean drawPartialOverflowTabs();
abstract static class Horizontal extends SingleRowLayoutStrategy {
protected Horizontal(final SingleRowLayout layout) {
super(layout);
@@ -129,6 +136,10 @@ public abstract class SingleRowLayoutStrategy {
return data.insets.left;
}
@Override
public boolean drawPartialOverflowTabs() {
return true;
}
}
static class Top extends Horizontal {
@@ -287,6 +298,10 @@ public abstract class SingleRowLayoutStrategy {
return myTabs.myHeaderFitSize.width;
}
@Override
public boolean drawPartialOverflowTabs() {
return false;
}
}
static class Left extends Vertical {