diff options
Diffstat (limited to 'client')
4 files changed, 53 insertions, 25 deletions
diff --git a/client/src/com/vaadin/client/extensions/FileDownloaderConnector.java b/client/src/com/vaadin/client/extensions/FileDownloaderConnector.java index 66fc30575b..bed6622a6c 100644 --- a/client/src/com/vaadin/client/extensions/FileDownloaderConnector.java +++ b/client/src/com/vaadin/client/extensions/FileDownloaderConnector.java @@ -23,11 +23,14 @@ import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.dom.client.Style.Visibility; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; +import com.vaadin.client.BrowserInfo; import com.vaadin.client.ComponentConnector; import com.vaadin.client.ServerConnector; import com.vaadin.server.FileDownloader; +import com.vaadin.shared.VBrowserDetails; import com.vaadin.shared.ui.Connect; @Connect(FileDownloader.class) @@ -47,22 +50,27 @@ public class FileDownloaderConnector extends AbstractExtensionConnector public void onClick(ClickEvent event) { final String url = getResourceUrl("dl"); if (url != null && !url.isEmpty()) { - if (iframe != null) { - // make sure it is not on dom tree already, might start - // multiple downloads at once - iframe.removeFromParent(); - } - iframe = Document.get().createIFrameElement(); + BrowserInfo browser = BrowserInfo.get(); + if (browser.isIOS()) { + Window.open(url, "_blank", ""); + } else { + if (iframe != null) { + // make sure it is not on dom tree already, might start + // multiple downloads at once + iframe.removeFromParent(); + } + iframe = Document.get().createIFrameElement(); - Style style = iframe.getStyle(); - style.setVisibility(Visibility.HIDDEN); - style.setHeight(0, Unit.PX); - style.setWidth(0, Unit.PX); + Style style = iframe.getStyle(); + style.setVisibility(Visibility.HIDDEN); + style.setHeight(0, Unit.PX); + style.setWidth(0, Unit.PX); - iframe.setFrameBorder(0); - iframe.setTabIndex(-1); - iframe.setSrc(url); - RootPanel.getBodyElement().appendChild(iframe); + iframe.setFrameBorder(0); + iframe.setTabIndex(-1); + iframe.setSrc(url); + RootPanel.getBodyElement().appendChild(iframe); + } } } diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index 4c6fc8874c..927e2c31db 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -1056,6 +1056,11 @@ public class VScrollTable extends FlowPanel implements HasWidgets, sendSelectedRows(immediate); } + private void updateFirstVisibleAndSendSelectedRows() { + updateFirstVisibleRow(); + sendSelectedRows(immediate); + } + /** * Sends the selection to the server if it has been changed since the last * update/visit. @@ -7238,6 +7243,20 @@ public class VScrollTable extends FlowPanel implements HasWidgets, return s; } + // Updates first visible row for the case we cannot wait + // for onScroll + private void updateFirstVisibleRow() { + scrollTop = scrollBodyPanel.getScrollPosition(); + firstRowInViewPort = calcFirstRowInViewPort(); + int maxFirstRow = totalRows - pageLength; + if (firstRowInViewPort > maxFirstRow && maxFirstRow >= 0) { + firstRowInViewPort = maxFirstRow; + } + lastRequestedFirstvisible = firstRowInViewPort; + client.updateVariable(paintableId, "firstvisible", firstRowInViewPort, + false); + } + /** * This method has logic which rows needs to be requested from server when * user scrolls @@ -7706,7 +7725,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // focus and select the last visible row setRowFocus(lastVisibleRowInViewPort); selectFocusedRow(ctrl, shift); - sendSelectedRows(); + updateFirstVisibleAndSendSelectedRows(); } else { int indexOfToBeFocused = focusedRow.getIndex() + getFullyVisibleRowCount(); @@ -7723,7 +7742,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, setRowFocus(toBeFocusedRow); selectFocusedRow(ctrl, shift); // TODO needs scrollintoview ? - sendSelectedRows(); + updateFirstVisibleAndSendSelectedRows(); } else { // scroll down by pixels and return, to wait for // new rows, then select the last item in the @@ -7759,7 +7778,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // focus and select the first visible row setRowFocus(firstVisibleRowInViewPort); selectFocusedRow(ctrl, shift); - sendSelectedRows(); + updateFirstVisibleAndSendSelectedRows(); } else { int indexOfToBeFocused = focusedRow.getIndex() - getFullyVisibleRowCount(); @@ -7774,7 +7793,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, setRowFocus(toBeFocusedRow); selectFocusedRow(ctrl, shift); // TODO needs scrollintoview ? - sendSelectedRows(); + updateFirstVisibleAndSendSelectedRows(); } else { // unless waiting for the next rowset already // scroll down by pixels and return, to wait for @@ -7806,7 +7825,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (rowByRowIndex.getIndex() == 0) { setRowFocus(rowByRowIndex); selectFocusedRow(ctrl, shift); - sendSelectedRows(); + updateFirstVisibleAndSendSelectedRows(); } else { // first row of table will come in next row fetch if (ctrl) { @@ -7832,7 +7851,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (focusedRow != rowByRowIndex) { setRowFocus(rowByRowIndex); selectFocusedRow(ctrl, shift); - sendSelectedRows(); + updateFirstVisibleAndSendSelectedRows(); } } else { if (ctrl) { diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java index 82407c981d..6977cf9e7f 100644 --- a/client/src/com/vaadin/client/ui/VWindow.java +++ b/client/src/com/vaadin/client/ui/VWindow.java @@ -881,11 +881,12 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } public void setCaption(String c, String iconURL, boolean asHtml) { - String html = c; - if (!asHtml) { - c = WidgetUtil.escapeHTML(c); + String html; + if (asHtml) { + html = c == null ? "" : c; + } else { + html = WidgetUtil.escapeHTML(c); } - // Provide information to assistive device users that a sub window was // opened String prefix = "<span class='" diff --git a/client/src/com/vaadin/client/ui/window/WindowConnector.java b/client/src/com/vaadin/client/ui/window/WindowConnector.java index 5580793506..5214c33eec 100644 --- a/client/src/com/vaadin/client/ui/window/WindowConnector.java +++ b/client/src/com/vaadin/client/ui/window/WindowConnector.java @@ -378,7 +378,7 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector window.setAssistivePrefix(state.assistivePrefix); window.setAssistivePostfix(state.assistivePostfix); - window.setCaption(state.caption, iconURL); + window.setCaption(state.caption, iconURL, getState().captionAsHtml); window.setWaiAriaRole(getState().role); window.setAssistiveDescription(state.contentDescription); |