unused state

This commit is contained in:
Maxim Shafirov
2012-05-15 19:24:49 +04:00
parent 5bcfdf9699
commit 72f42620c1
3 changed files with 64 additions and 74 deletions
@@ -238,7 +238,7 @@ class DragHelper extends MouseDragHelper {
if (!willDragOutStart) {
myTabs.fireTabsMoved();
}
myTabs.relayout(true, false);
myTabs.relayout(false);
myTabs.revalidate();
}
@@ -111,8 +111,6 @@ public class JBTabsImpl extends JComponent
private LayoutPassInfo myLastLayoutPass;
private TabInfo myLastPaintedSelection;
public boolean myForcedRelayout;
private UiDecorator myUiDecorator;
static final UiDecorator ourDefaultDecorator = new DefaultDecorator();
@@ -387,7 +385,7 @@ public class JBTabsImpl extends JComponent
}
if (needsUpdate) {
relayout(true, false);
relayout(false);
}
}
@@ -675,7 +673,7 @@ public class JBTabsImpl extends JComponent
adjust(info);
updateAll(false, false);
updateAll(false);
if (info.isHidden()) {
updateHiding();
@@ -728,9 +726,9 @@ public class JBTabsImpl extends JComponent
return this;
}
private void updateAll(final boolean forcedRelayout, final boolean now) {
private void updateAll(final boolean now) {
mySelectedInfo = getSelectedInfo();
updateContainer(forcedRelayout, now);
updateContainer(now);
removeDeferred();
updateListeners();
updateTabActions(false);
@@ -801,7 +799,7 @@ public class JBTabsImpl extends JComponent
fireBeforeSelectionChanged(oldInfo, newInfo);
updateContainer(false, true);
updateContainer(true);
fireSelectionChanged(oldInfo, newInfo);
@@ -944,10 +942,10 @@ public class JBTabsImpl extends JComponent
final TabInfo tabInfo = (TabInfo)evt.getSource();
if (TabInfo.ACTION_GROUP.equals(evt.getPropertyName())) {
updateSideComponent(tabInfo);
relayout(false, false);
relayout(false);
}
else if (TabInfo.COMPONENT.equals(evt.getPropertyName())) {
relayout(true, false);
relayout(false);
}
else if (TabInfo.TEXT.equals(evt.getPropertyName())) {
updateText(tabInfo);
@@ -964,11 +962,11 @@ public class JBTabsImpl extends JComponent
}
else if (TabInfo.TAB_ACTION_GROUP.equals(evt.getPropertyName())) {
updateTabActions(tabInfo);
relayout(false, false);
relayout(false);
}
else if (TabInfo.HIDDEN.equals(evt.getPropertyName())) {
updateHiding();
relayout(false, false);
relayout(false);
}
else if (TabInfo.ENABLED.equals(evt.getPropertyName())) {
updateEnabling();
@@ -1021,7 +1019,7 @@ public class JBTabsImpl extends JComponent
if (mySelectedInfo != null && myHiddenInfos.containsKey(mySelectedInfo)) {
mySelectedInfo = getToSelectOnRemoveOf(mySelectedInfo);
}
updateAll(true, false);
updateAll(false);
}
}
@@ -1345,51 +1343,46 @@ public class JBTabsImpl extends JComponent
public void doLayout() {
try {
myHeaderFitSize = computeHeaderFitSize();
myHeaderFitSize = computeHeaderFitSize();
final Collection<TabLabel> labels = myInfo2Label.values();
for (TabLabel each : labels) {
each.setTabActionsAutoHide(myTabLabelActionsAutoHide);
}
List<TabInfo> visible = new ArrayList<TabInfo>();
visible.addAll(myVisibleInfos);
if (myDropInfo != null && !visible.contains(myDropInfo) && myShowDropLocation) {
if (getDropInfoIndex() >= 0 && getDropInfoIndex() < visible.size()) {
visible.add(getDropInfoIndex(), myDropInfo);
} else {
visible.add(myDropInfo);
}
}
if (isSingleRow()) {
myLastLayoutPass = mySingleRowLayout.layoutSingleRow(visible);
myTableLayout.myLastTableLayout = null;
}
else {
myLastLayoutPass = myTableLayout.layoutTable(visible);
mySingleRowLayout.myLastSingRowLayout = null;
}
if (isStealthModeEffective() && !isHideTabs()) {
final TabLabel label = getSelectedLabel();
final Rectangle bounds = label.getBounds();
final Insets insets = getLayoutInsets();
layout(label, insets.left, bounds.y, getWidth() - insets.right - insets.left, bounds.height);
}
moveDraggedTabLabel();
myTabActionsAutoHideListener.processMouseOver();
final Collection<TabLabel> labels = myInfo2Label.values();
for (TabLabel each : labels) {
each.setTabActionsAutoHide(myTabLabelActionsAutoHide);
}
finally {
myForcedRelayout = false;
List<TabInfo> visible = new ArrayList<TabInfo>();
visible.addAll(myVisibleInfos);
if (myDropInfo != null && !visible.contains(myDropInfo) && myShowDropLocation) {
if (getDropInfoIndex() >= 0 && getDropInfoIndex() < visible.size()) {
visible.add(getDropInfoIndex(), myDropInfo);
} else {
visible.add(myDropInfo);
}
}
if (isSingleRow()) {
myLastLayoutPass = mySingleRowLayout.layoutSingleRow(visible);
myTableLayout.myLastTableLayout = null;
}
else {
myLastLayoutPass = myTableLayout.layoutTable(visible);
mySingleRowLayout.myLastSingRowLayout = null;
}
if (isStealthModeEffective() && !isHideTabs()) {
final TabLabel label = getSelectedLabel();
final Rectangle bounds = label.getBounds();
final Insets insets = getLayoutInsets();
layout(label, insets.left, bounds.y, getWidth() - insets.right - insets.left, bounds.height);
}
moveDraggedTabLabel();
myTabActionsAutoHideListener.processMouseOver();
applyResetComponents();
}
@@ -2377,7 +2370,7 @@ public class JBTabsImpl extends JComponent
myInfo2Toolbar.remove(info);
resetTabsCache();
updateAll(false, false);
updateAll(false);
// avoid leaks
myLastPaintedSelection = null;
@@ -2442,7 +2435,7 @@ public class JBTabsImpl extends JComponent
final Dimension myToolbar = new Dimension();
}
private void updateContainer(boolean forced, final boolean layoutNow) {
private void updateContainer(final boolean layoutNow) {
for (TabInfo each : myVisibleInfos) {
final JComponent eachComponent = each.getComponent();
if (getSelectedInfo() == each && getSelectedInfo() != null) {
@@ -2469,7 +2462,7 @@ public class JBTabsImpl extends JComponent
}
mySingleRowLayout.scrollSelectionInView();
relayout(forced, layoutNow);
relayout(layoutNow);
}
protected void addImpl(final Component comp, final Object constraints, final int index) {
@@ -2487,10 +2480,7 @@ public class JBTabsImpl extends JComponent
return c.getRootPane() != null;
}
void relayout(boolean forced, final boolean layoutNow) {
if (!myForcedRelayout) {
myForcedRelayout = forced;
}
void relayout(final boolean layoutNow) {
revalidateAndRepaint(layoutNow);
}
@@ -2588,7 +2578,7 @@ public class JBTabsImpl extends JComponent
myHideTabs = hideTabs;
relayout(true, false);
relayout(false);
}
public JBTabsPresentation setPaintBorder(int top, int left, int right, int bottom) {
@@ -2755,7 +2745,7 @@ public class JBTabsImpl extends JComponent
public JBTabsPresentation setStealthTabMode(final boolean stealthTabMode) {
myStealthTabMode = stealthTabMode;
relayout(true, false);
relayout(false);
return this;
}
@@ -2772,7 +2762,7 @@ public class JBTabsImpl extends JComponent
}
relayout(true, false);
relayout(false);
return this;
}
@@ -2781,7 +2771,7 @@ public class JBTabsImpl extends JComponent
public JBTabsPresentation setSideComponentOnTabs(boolean onTabs) {
mySideComponentOnTabs = onTabs;
relayout(true, false);
relayout(false);
return this;
}
@@ -2789,7 +2779,7 @@ public class JBTabsImpl extends JComponent
public JBTabsPresentation setSingleRow(boolean singleRow) {
myLayout = singleRow ? mySingleRowLayout : myTableLayout;
relayout(true, false);
relayout(false);
return this;
}
@@ -2797,7 +2787,7 @@ public class JBTabsImpl extends JComponent
public JBTabsPresentation setGhostsAlwaysVisible(final boolean visible) {
myGhostsAlwaysVisible = visible;
relayout(true, false);
relayout(false);
return this;
}
@@ -2858,7 +2848,7 @@ public class JBTabsImpl extends JComponent
adjust(each);
}
relayout(true, false);
relayout(false);
}
private void adjust(final TabInfo each) {
@@ -2870,7 +2860,7 @@ public class JBTabsImpl extends JComponent
public void sortTabs(Comparator<TabInfo> comparator) {
Collections.sort(myVisibleInfos, comparator);
relayout(true, false);
relayout(false);
}
private boolean isRequestFocusOnLastFocusedComponent() {
@@ -2992,7 +2982,7 @@ public class JBTabsImpl extends JComponent
@NotNull
public JBTabsPresentation setTabsPosition(final JBTabsPosition position) {
myPosition = position;
relayout(true, false);
relayout(false);
return this;
}
@@ -3027,7 +3017,7 @@ public class JBTabsImpl extends JComponent
myVisibleInfos.add(targetIndex, source);
invalidate();
relayout(true, true);
relayout(true);
}
boolean isHorizontalTabs() {
@@ -3147,7 +3137,7 @@ public class JBTabsImpl extends JComponent
label.paintOffscreen(g);
g.dispose();
relayout(true, false);
relayout(false);
return img;
}
@@ -3157,7 +3147,7 @@ public class JBTabsImpl extends JComponent
int index = myLayout.getDropIndexFor(point.getPoint(this));
if (index != getDropInfoIndex()) {
setDropInfoIndex(index);
relayout(true, false);
relayout(false);
}
}
@@ -47,7 +47,7 @@ public class TabsBorder {
myEffectiveBorder = null;
myTabs.relayout(true, false);
myTabs.relayout(false);
return myTabs;
}