aboutsummaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2015-07-15 12:59:35 +0300
committerJohannes Dahlström <johannesd@vaadin.com>2015-07-15 12:59:35 +0300
commit20f6053dc199d5dd7dde071dfdd9b37ea8f85e36 (patch)
treecef44905e38c849057f102cd26cd6b89251bc7e2 /client/src
parent80058d9429940c376c63c086b1cf79848fe1a699 (diff)
parent9734bc5dfa5d919e3214dc17581d3da3ad1a3ebd (diff)
downloadvaadin-framework-20f6053dc199d5dd7dde071dfdd9b37ea8f85e36.tar.gz
vaadin-framework-20f6053dc199d5dd7dde071dfdd9b37ea8f85e36.zip
Merge branch 'master' into grid-unbuffered-editor7.6.0.alpha3
Conflicts: uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java Change-Id: I5ed68bc73d38be4e1f6816108a5246d0c98a258f
Diffstat (limited to 'client/src')
-rw-r--r--client/src/com/vaadin/client/SuperDevMode.java6
-rw-r--r--client/src/com/vaadin/client/VTooltip.java3
-rw-r--r--client/src/com/vaadin/client/debug/internal/VDebugWindow.java38
-rw-r--r--client/src/com/vaadin/client/widgets/Escalator.java99
-rw-r--r--client/src/com/vaadin/client/widgets/Grid.java44
5 files changed, 124 insertions, 66 deletions
diff --git a/client/src/com/vaadin/client/SuperDevMode.java b/client/src/com/vaadin/client/SuperDevMode.java
index c72cd73939..f664244715 100644
--- a/client/src/com/vaadin/client/SuperDevMode.java
+++ b/client/src/com/vaadin/client/SuperDevMode.java
@@ -189,7 +189,11 @@ public class SuperDevMode {
if (serverUrl == null || "".equals(serverUrl)) {
serverUrl = "http://localhost:9876/";
} else {
- serverUrl = "http://" + serverUrl + "/";
+ if (serverUrl.contains(":")) {
+ serverUrl = "http://" + serverUrl + "/";
+ } else {
+ serverUrl = "http://" + serverUrl + ":9876/";
+ }
}
if (hasSession(SKIP_RECOMPILE)) {
diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java
index 4e59040298..f3d65cd20a 100644
--- a/client/src/com/vaadin/client/VTooltip.java
+++ b/client/src/com/vaadin/client/VTooltip.java
@@ -89,6 +89,9 @@ public class VTooltip extends VOverlay {
LiveValue.ASSERTIVE);
Roles.getTooltipRole().setAriaRelevantProperty(getElement(),
RelevantValue.ADDITIONS);
+
+ // Tooltip needs to be on top of other VOverlay elements.
+ setZIndex(VOverlay.Z_INDEX + 1);
}
/**
diff --git a/client/src/com/vaadin/client/debug/internal/VDebugWindow.java b/client/src/com/vaadin/client/debug/internal/VDebugWindow.java
index b543c23e4d..fbc838f861 100644
--- a/client/src/com/vaadin/client/debug/internal/VDebugWindow.java
+++ b/client/src/com/vaadin/client/debug/internal/VDebugWindow.java
@@ -19,6 +19,8 @@ import java.util.ArrayList;
import java.util.Date;
import com.google.gwt.core.client.Duration;
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
@@ -698,22 +700,32 @@ public final class VDebugWindow extends VOverlay {
public void init() {
show();
- readStoredState();
- Window.addResizeHandler(new com.google.gwt.event.logical.shared.ResizeHandler() {
+ /*
+ * Finalize initialization when all entry points have had the chance to
+ * e.g. register new sections.
+ */
+ Scheduler.get().scheduleFinally(new ScheduledCommand() {
+ @Override
+ public void execute() {
+ readStoredState();
- Timer t = new Timer() {
- @Override
- public void run() {
- applyPositionAndSize();
- }
- };
+ Window.addResizeHandler(new com.google.gwt.event.logical.shared.ResizeHandler() {
- @Override
- public void onResize(ResizeEvent event) {
- t.cancel();
- // TODO less
- t.schedule(1000);
+ Timer t = new Timer() {
+ @Override
+ public void run() {
+ applyPositionAndSize();
+ }
+ };
+
+ @Override
+ public void onResize(ResizeEvent event) {
+ t.cancel();
+ // TODO less
+ t.schedule(1000);
+ }
+ });
}
});
}
diff --git a/client/src/com/vaadin/client/widgets/Escalator.java b/client/src/com/vaadin/client/widgets/Escalator.java
index 436b512294..a6247aee12 100644
--- a/client/src/com/vaadin/client/widgets/Escalator.java
+++ b/client/src/com/vaadin/client/widgets/Escalator.java
@@ -6022,10 +6022,14 @@ public class Escalator extends Widget implements RequiresResize,
public void scrollToRow(final int rowIndex,
final ScrollDestination destination, final int padding)
throws IndexOutOfBoundsException, IllegalArgumentException {
- validateScrollDestination(destination, padding);
- verifyValidRowIndex(rowIndex);
-
- scroller.scrollToRow(rowIndex, destination, padding);
+ Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ @Override
+ public void execute() {
+ validateScrollDestination(destination, padding);
+ verifyValidRowIndex(rowIndex);
+ scroller.scrollToRow(rowIndex, destination, padding);
+ }
+ });
}
private void verifyValidRowIndex(final int rowIndex) {
@@ -6086,55 +6090,62 @@ public class Escalator extends Widget implements RequiresResize,
* {@code destination == null}; or if {@code rowIndex == -1} and
* there is no spacer open at that index.
*/
- public void scrollToRowAndSpacer(int rowIndex,
- ScrollDestination destination, int padding)
+ public void scrollToRowAndSpacer(final int rowIndex,
+ final ScrollDestination destination, final int padding)
throws IllegalArgumentException {
- validateScrollDestination(destination, padding);
- if (rowIndex != -1) {
- verifyValidRowIndex(rowIndex);
- }
+ Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ @Override
+ public void execute() {
+ validateScrollDestination(destination, padding);
+ if (rowIndex != -1) {
+ verifyValidRowIndex(rowIndex);
+ }
- // row range
- final Range rowRange;
- if (rowIndex != -1) {
- int rowTop = (int) Math.floor(body.getRowTop(rowIndex));
- int rowHeight = (int) Math.ceil(body.getDefaultRowHeight());
- rowRange = Range.withLength(rowTop, rowHeight);
- } else {
- rowRange = Range.withLength(0, 0);
- }
+ // row range
+ final Range rowRange;
+ if (rowIndex != -1) {
+ int rowTop = (int) Math.floor(body.getRowTop(rowIndex));
+ int rowHeight = (int) Math.ceil(body.getDefaultRowHeight());
+ rowRange = Range.withLength(rowTop, rowHeight);
+ } else {
+ rowRange = Range.withLength(0, 0);
+ }
- // get spacer
- final SpacerContainer.SpacerImpl spacer = body.spacerContainer
- .getSpacer(rowIndex);
+ // get spacer
+ final SpacerContainer.SpacerImpl spacer = body.spacerContainer
+ .getSpacer(rowIndex);
- if (rowIndex == -1 && spacer == null) {
- throw new IllegalArgumentException("Cannot scroll to row index "
- + "-1, as there is no spacer open at that index.");
- }
+ if (rowIndex == -1 && spacer == null) {
+ throw new IllegalArgumentException(
+ "Cannot scroll to row index "
+ + "-1, as there is no spacer open at that index.");
+ }
- // make into target range
- final Range targetRange;
- if (spacer != null) {
- final int spacerTop = (int) Math.floor(spacer.getTop());
- final int spacerHeight = (int) Math.ceil(spacer.getHeight());
- Range spacerRange = Range.withLength(spacerTop, spacerHeight);
+ // make into target range
+ final Range targetRange;
+ if (spacer != null) {
+ final int spacerTop = (int) Math.floor(spacer.getTop());
+ final int spacerHeight = (int) Math.ceil(spacer.getHeight());
+ Range spacerRange = Range.withLength(spacerTop,
+ spacerHeight);
- targetRange = rowRange.combineWith(spacerRange);
- } else {
- targetRange = rowRange;
- }
+ targetRange = rowRange.combineWith(spacerRange);
+ } else {
+ targetRange = rowRange;
+ }
- // get params
- int targetStart = targetRange.getStart();
- int targetEnd = targetRange.getEnd();
- double viewportStart = getScrollTop();
- double viewportEnd = viewportStart + body.getHeightOfSection();
+ // get params
+ int targetStart = targetRange.getStart();
+ int targetEnd = targetRange.getEnd();
+ double viewportStart = getScrollTop();
+ double viewportEnd = viewportStart + body.getHeightOfSection();
- double scrollPos = getScrollPos(destination, targetStart, targetEnd,
- viewportStart, viewportEnd, padding);
+ double scrollPos = getScrollPos(destination, targetStart,
+ targetEnd, viewportStart, viewportEnd, padding);
- setScrollTop(scrollPos);
+ setScrollTop(scrollPos);
+ }
+ });
}
private static void validateScrollDestination(
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java
index cf05e7e53a..18407dccc9 100644
--- a/client/src/com/vaadin/client/widgets/Grid.java
+++ b/client/src/com/vaadin/client/widgets/Grid.java
@@ -1141,6 +1141,8 @@ public class Grid<T> extends ResizeComposite implements
private DivElement editorOverlay = DivElement.as(DOM.createDiv());
private DivElement cellWrapper = DivElement.as(DOM.createDiv());
+ private DivElement frozenCellWrapper = DivElement.as(DOM.createDiv());
+
private DivElement messageAndButtonsWrapper = DivElement.as(DOM
.createDiv());
@@ -1581,15 +1583,31 @@ public class Grid<T> extends ResizeComposite implements
});
gridElement.appendChild(editorOverlay);
+ editorOverlay.appendChild(frozenCellWrapper);
editorOverlay.appendChild(cellWrapper);
editorOverlay.appendChild(messageAndButtonsWrapper);
+ int frozenColumns = grid.getVisibleFrozenColumnCount();
+ double frozenColumnsWidth = 0;
+ double cellHeight = 0;
+
for (int i = 0; i < tr.getCells().getLength(); i++) {
Element cell = createCell(tr.getCells().getItem(i));
-
- cellWrapper.appendChild(cell);
+ cellHeight = Math.max(cellHeight, WidgetUtil
+ .getRequiredHeightBoundingClientRectDouble(tr
+ .getCells().getItem(i)));
Column<?, T> column = grid.getVisibleColumn(i);
+
+ if (i < frozenColumns) {
+ frozenCellWrapper.appendChild(cell);
+ frozenColumnsWidth += WidgetUtil
+ .getRequiredWidthBoundingClientRectDouble(tr
+ .getCells().getItem(i));
+ } else {
+ cellWrapper.appendChild(cell);
+ }
+
if (column.isEditable()) {
Widget editor = getHandler().getWidget(column);
@@ -1611,6 +1629,10 @@ public class Grid<T> extends ResizeComposite implements
}
}
+ setBounds(frozenCellWrapper, 0, 0, frozenColumnsWidth, 0);
+ setBounds(cellWrapper, frozenColumnsWidth, 0, tr.getOffsetWidth()
+ - frozenColumnsWidth, cellHeight);
+
// Only add these elements once
if (!messageAndButtonsWrapper.isOrHasChild(messageWrapper)) {
messageAndButtonsWrapper.appendChild(messageWrapper);
@@ -1685,6 +1707,7 @@ public class Grid<T> extends ResizeComposite implements
editorOverlay.removeAllChildren();
cellWrapper.removeAllChildren();
+ frozenCellWrapper.removeAllChildren();
editorOverlay.removeFromParent();
scrollHandler.removeHandler();
@@ -1697,6 +1720,7 @@ public class Grid<T> extends ResizeComposite implements
editorOverlay.removeClassName(styleName);
cellWrapper.removeClassName(styleName + "-cells");
+ frozenCellWrapper.removeClassName(styleName + "-cells");
messageAndButtonsWrapper.removeClassName(styleName + "-footer");
messageWrapper.removeClassName(styleName + "-message");
@@ -1709,6 +1733,7 @@ public class Grid<T> extends ResizeComposite implements
editorOverlay.setClassName(styleName);
cellWrapper.setClassName(styleName + "-cells");
+ frozenCellWrapper.setClassName(styleName + "-cells frozen");
messageAndButtonsWrapper.setClassName(styleName + "-footer");
messageWrapper.setClassName(styleName + "-message");
@@ -1759,7 +1784,8 @@ public class Grid<T> extends ResizeComposite implements
private void updateHorizontalScrollPosition() {
double scrollLeft = grid.getScrollLeft();
- cellWrapper.getStyle().setLeft(-scrollLeft, Unit.PX);
+ cellWrapper.getStyle().setLeft(
+ frozenCellWrapper.getOffsetWidth() - scrollLeft, Unit.PX);
}
/**
@@ -3329,7 +3355,6 @@ public class Grid<T> extends ResizeComposite implements
clickOutsideToCloseHandlerRegistration = Event
.addNativePreviewHandler(clickOutsideToCloseHandler);
}
- openCloseButton.setHeight("");
}
/**
@@ -6171,7 +6196,12 @@ public class Grid<T> extends ResizeComposite implements
}
private void updateFrozenColumns() {
- int numberOfColumns = frozenColumnCount;
+ escalator.getColumnConfiguration().setFrozenColumnCount(
+ getVisibleFrozenColumnCount());
+ }
+
+ private int getVisibleFrozenColumnCount() {
+ int numberOfColumns = getFrozenColumnCount();
// for the escalator the hidden columns are not in the frozen column
// count, but for grid they are. thus need to convert the index
@@ -6186,9 +6216,7 @@ public class Grid<T> extends ResizeComposite implements
} else if (selectionColumn != null) {
numberOfColumns++;
}
-
- escalator.getColumnConfiguration()
- .setFrozenColumnCount(numberOfColumns);
+ return numberOfColumns;
}
/**