aboutsummaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorPekka Hyvönen <pekka@vaadin.com>2015-04-17 09:42:07 +0300
committerPekka Hyvönen <pekka@vaadin.com>2015-04-17 09:42:52 +0300
commit33c61533ad8a3ed8a38ea606aa9e3d5f4da4dae8 (patch)
tree3d4edf6b9676e0967b7a08e11642c66cf1abfe0c /client/src
parent6ed28680346c648a6b4e974568a56f6d4d0e000b (diff)
parent0636e2d177a933dae13e50eb1b1f4609855f735e (diff)
downloadvaadin-framework-33c61533ad8a3ed8a38ea606aa9e3d5f4da4dae8.tar.gz
vaadin-framework-33c61533ad8a3ed8a38ea606aa9e3d5f4da4dae8.zip
Merge branch 'master' into grid-7.5
Change-Id: I6175398df4c3a07656a2682843615a0d7bd32a45
Diffstat (limited to 'client/src')
-rw-r--r--client/src/com/vaadin/client/ui/VMenuBar.java12
-rw-r--r--client/src/com/vaadin/client/ui/VTabsheet.java67
-rw-r--r--client/src/com/vaadin/client/widgets/Grid.java9
3 files changed, 73 insertions, 15 deletions
diff --git a/client/src/com/vaadin/client/ui/VMenuBar.java b/client/src/com/vaadin/client/ui/VMenuBar.java
index 08f70f4dde..823861534d 100644
--- a/client/src/com/vaadin/client/ui/VMenuBar.java
+++ b/client/src/com/vaadin/client/ui/VMenuBar.java
@@ -912,12 +912,24 @@ public class VMenuBar extends SimpleFocusablePanel implements
SUBMENU_CLASSNAME_PREFIX, "");
}
+ String currentStyles = super.getStyleName();
+ List<String> customStyles = new ArrayList<String>();
+ for(String style : currentStyles.split(" ")) {
+ if(!style.isEmpty() && !style.startsWith(primaryStyleName)) {
+ customStyles.add(style);
+ }
+ }
+
if (isSeparator) {
super.setStyleName(primaryStyleName + "-separator");
} else {
super.setStyleName(primaryStyleName + "-menuitem");
}
+ for (String customStyle : customStyles) {
+ super.addStyleName(customStyle);
+ }
+
if (styleName != null) {
addStyleDependentName(styleName);
}
diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java
index c8984ece51..a02679a0fc 100644
--- a/client/src/com/vaadin/client/ui/VTabsheet.java
+++ b/client/src/com/vaadin/client/ui/VTabsheet.java
@@ -628,9 +628,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware
}
/**
- * Returns the index of the first visible tab
- *
- * @return
+ * Returns the index of the first visible tab on the server
*/
private int getFirstVisibleTab() {
return getNextVisibleTab(-1);
@@ -656,6 +654,23 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware
}
/**
+ * Returns the index of the first visible tab in browser.
+ */
+ private int getFirstVisibleTabClient() {
+ int tabs = getTabCount();
+ int i = 0;
+ while (i < tabs && !getTab(i).isVisible()) {
+ i++;
+ }
+
+ if (i == tabs) {
+ return -1;
+ } else {
+ return i;
+ }
+ }
+
+ /**
* Find the previous visible tab. Returns -1 if none is found.
*
* @param i
@@ -1086,8 +1101,13 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware
PREV_SCROLLER_DISABLED_CLASSNAME);
}
+ private boolean isScrollerHidden() {
+ return scroller.getStyle().getDisplay().equals(Display.NONE.getCssName());
+ }
+
private boolean isIndexSkippingHiddenTabs() {
- return isAllTabsBeforeIndexInvisible() && isScrollerPrevDisabled();
+ return isAllTabsBeforeIndexInvisible()
+ && (isScrollerPrevDisabled() || isScrollerHidden());
}
@Override
@@ -1105,12 +1125,21 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware
// Should not set tabs visible if they are scrolled out of view
tab.setVisible(false);
} else {
- // reset the scroller index back to zero if tab is visible
- // again and tab is in view
- if (isIndexSkippingHiddenTabs() && tabState.visible) {
- scrollerIndex = 0;
+ //When the tab was hidden and then turned visible again
+ //and there is space for it, it should be in view (#17096) (#17333)
+ if (isTabSetVisibleBeforeScroller(tabState, index, tab)) {
+ scrollerIndex = index;
+ tab.setVisible(true);
+ tab.setStyleNames(false, true);
+
+ //scroll to the currently selected tab if it got clipped
+ //after making another tab visible
+ if(isClippedTabs()) {
+ scrollIntoView(getActiveTab());
+ }
+ } else {
+ tab.setVisible(tabState.visible);
}
- tab.setVisible(tabState.visible);
}
/*
@@ -1121,6 +1150,26 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware
}
/**
+ * Checks whether the tab has been set to visible and the scroller is at the first visible tab.
+ * That means that the scroller has to be adjusted so that the tab is visible again.
+ */
+ private boolean isTabSetVisibleBeforeScroller(TabState tabState, int index, Tab tab) {
+ return isIndexSkippingHiddenTabs() && isScrollerAtFirstVisibleTab()
+ && hasTabChangedVisibility(tabState, tab) && scrolledOutOfView(index);
+ }
+
+ /**
+ * Checks whether the tab is visible on server but is not visible on client yet.
+ */
+ private boolean hasTabChangedVisibility(TabState tabState, Tab tab) {
+ return !tab.isVisible() && tabState.visible;
+ }
+
+ private boolean isScrollerAtFirstVisibleTab() {
+ return tb.getFirstVisibleTabClient() == scrollerIndex;
+ }
+
+ /**
* @deprecated as of 7.1, VTabsheet only keeps the active tab in the DOM
* without any place holders.
*/
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java
index 220e83257b..6717f0c17d 100644
--- a/client/src/com/vaadin/client/widgets/Grid.java
+++ b/client/src/com/vaadin/client/widgets/Grid.java
@@ -1526,10 +1526,8 @@ public class Grid<T> extends ResizeComposite implements
}
// Do not render over the vertical scrollbar
- int nativeScrollbarSize = WidgetUtil.getNativeScrollbarSize();
- if (nativeScrollbarSize > 0) {
- editorOverlay.getStyle().setRight(nativeScrollbarSize, Unit.PX);
- }
+ editorOverlay.getStyle().setWidth(grid.escalator.getInnerWidth(),
+ Unit.PX);
}
private boolean buttonsShouldBeRenderedBelow(TableRowElement tr) {
@@ -2268,8 +2266,7 @@ public class Grid<T> extends ResizeComposite implements
// If selection cell already contains a widget do not
// create a new CheckBox
HeaderCell selectionCell = header.getDefaultRow().getCell(this);
- if (selectionCell.getType()
- .equals(GridStaticCellType.WIDGET)
+ if (selectionCell.getType().equals(GridStaticCellType.WIDGET)
&& selectionCell.getWidget() instanceof CheckBox) {
return;
}