diff options
author | Artur Signell <artur.signell@itmill.com> | 2010-01-15 18:39:11 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2010-01-15 18:39:11 +0000 |
commit | 38d932279fd73eaa6e1dde33136709faaae2155f (patch) | |
tree | c946c4077f0807dee782849ec1fda2dd5dd7434b /src | |
parent | 2342d517d8d53a51ef47db82b3558d2b850b027e (diff) | |
download | vaadin-framework-38d932279fd73eaa6e1dde33136709faaae2155f.tar.gz vaadin-framework-38d932279fd73eaa6e1dde33136709faaae2155f.zip |
Merged 6.2.2 fixes from /versions/6.2
svn changeset:10761/svn branch:6.3
Diffstat (limited to 'src')
6 files changed, 74 insertions, 15 deletions
diff --git a/src/com/vaadin/data/util/DefaultItemSorter.java b/src/com/vaadin/data/util/DefaultItemSorter.java index 5cec2dc461..aefdbf1cc9 100644 --- a/src/com/vaadin/data/util/DefaultItemSorter.java +++ b/src/com/vaadin/data/util/DefaultItemSorter.java @@ -62,6 +62,20 @@ public class DefaultItemSorter implements ItemSorter { Item item1 = container.getItem(o1); Item item2 = container.getItem(o2); + /* + * Items can be null if the container is filtered. Null is considered + * "less" than not-null. + */ + if (item1 == null) { + if (item2 == null) { + return 0; + } else { + return 1; + } + } else if (item2 == null) { + return -1; + } + for (int i = 0; i < sortPropertyIds.length; i++) { int result = compareProperty(sortPropertyIds[i], sortDirections[i], diff --git a/src/com/vaadin/terminal/gwt/client/BrowserInfo.java b/src/com/vaadin/terminal/gwt/client/BrowserInfo.java index 2872ca360e..fe5c6958ed 100644 --- a/src/com/vaadin/terminal/gwt/client/BrowserInfo.java +++ b/src/com/vaadin/terminal/gwt/client/BrowserInfo.java @@ -176,6 +176,10 @@ public class BrowserInfo { return isGecko; } + public boolean isWebkit() { + return isAppleWebKit; + } + public boolean isFF2() { return isGecko && version == 1.8; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java index 4e17dcb879..0a28fd6b41 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java @@ -57,6 +57,8 @@ public class VMenuBar extends Widget implements Paintable, private Timer layoutTimer; + private boolean enabled = true; + public VMenuBar() { // Create an empty horizontal menubar this(false); @@ -107,6 +109,7 @@ public class VMenuBar extends Widget implements Paintable, if (client.updateComponent(this, uidl, true)) { return; } + this.enabled = !uidl.getBooleanAttribute("disabled"); // For future connections this.client = client; @@ -371,13 +374,13 @@ public class VMenuBar extends Widget implements Paintable, switch (DOM.eventGetType(e)) { case Event.ONCLICK: - if (targetItem.isEnabled()) { + if (isEnabled() && targetItem.isEnabled()) { itemClick(targetItem); } break; case Event.ONMOUSEOVER: - if (targetItem.isEnabled()) { + if (isEnabled() && targetItem.isEnabled()) { itemOver(targetItem); } break; @@ -389,6 +392,10 @@ public class VMenuBar extends Widget implements Paintable, } } + private boolean isEnabled() { + return enabled; + } + private void requestLayout() { if (layoutTimer == null) { layoutTimer = new Timer() { diff --git a/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java index ffada53252..27fdf9506f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java @@ -40,12 +40,29 @@ public class VSplitPanel extends ComplexPanel implements Container, @Override protected <H extends EventHandler> HandlerRegistration registerHandler( H handler, Type<H> type) { - return addDomHandler(handler, type); + if ((Event.getEventsSunk(splitter) & Event.getTypeInt(type + .getName())) != 0) { + // If we are already sinking the event for the splitter we do + // not want to additionally sink it for the root element + return addHandler(handler, type); + } else { + return addDomHandler(handler, type); + } } @Override + public void onContextMenu( + com.google.gwt.event.dom.client.ContextMenuEvent event) { + Element target = event.getNativeEvent().getEventTarget().cast(); + if (splitter.isOrHasChild(target)) { + super.onContextMenu(event); + } + }; + + @Override protected void fireClick(NativeEvent event) { - if (splitter.isOrHasChild((Element) event.getEventTarget().cast())) { + Element target = event.getEventTarget().cast(); + if (splitter.isOrHasChild(target)) { super.fireClick(event); } } @@ -127,7 +144,6 @@ public class VSplitPanel extends ComplexPanel implements Container, setHeight(MIN_SIZE + "px"); constructDom(); setOrientation(orientation); - DOM.sinkEvents(splitter, (Event.MOUSEEVENTS)); DOM.sinkEvents(getElement(), (Event.MOUSEEVENTS)); } @@ -183,7 +199,6 @@ public class VSplitPanel extends ComplexPanel implements Container, } clickEventHandler.handleEventHandlerRegistration(client); - if (uidl.hasAttribute("style")) { componentStyleNames = uidl.getStringAttribute("style").split(" "); } else { @@ -371,6 +386,14 @@ public class VSplitPanel extends ComplexPanel implements Container, case Event.ONMOUSEDOWN: onMouseDown(event); break; + case Event.ONMOUSEOUT: + // Dragging curtain interferes with click events if added in + // mousedown so we add it only when needed i.e., if the mouse moves + // outside the splitter. + if (resizing) { + showDraggingCurtain(); + } + break; case Event.ONMOUSEUP: if (resizing) { onMouseUp(event); @@ -383,6 +406,10 @@ public class VSplitPanel extends ComplexPanel implements Container, // Only fire click event listeners if the splitter isn't moved if (!resized) { super.onBrowserEvent(event); + } else if (DOM.eventGetType(event) == Event.ONMOUSEUP) { + // Reset the resized flag after a mouseup has occured so the next + // mousedown/mouseup can be interpreted as a click. + resized = false; } } @@ -393,10 +420,6 @@ public class VSplitPanel extends ComplexPanel implements Container, final Element trg = DOM.eventGetTarget(event); if (trg == splitter || trg == DOM.getChild(splitter, 0)) { resizing = true; - resized = false; - if (BrowserInfo.get().isGecko()) { - showDraggingCurtain(); - } DOM.setCapture(getElement()); origX = DOM.getElementPropertyInt(splitter, "offsetLeft"); origY = DOM.getElementPropertyInt(splitter, "offsetTop"); @@ -456,9 +479,7 @@ public class VSplitPanel extends ComplexPanel implements Container, public void onMouseUp(Event event) { DOM.releaseCapture(getElement()); - if (BrowserInfo.get().isGecko()) { - hideDraggingCurtain(); - } + hideDraggingCurtain(); resizing = false; onMouseMove(event); updateSplitPositionToServer(); @@ -469,6 +490,9 @@ public class VSplitPanel extends ComplexPanel implements Container, * iframe. */ private void showDraggingCurtain() { + if (!isDraggingCurtainRequired()) { + return; + } if (draggingCurtain == null) { draggingCurtain = DOM.createDiv(); DOM.setStyleAttribute(draggingCurtain, "position", "absolute"); @@ -478,11 +502,21 @@ public class VSplitPanel extends ComplexPanel implements Container, DOM.setStyleAttribute(draggingCurtain, "height", "100%"); DOM.setStyleAttribute(draggingCurtain, "zIndex", "" + VOverlay.Z_INDEX); + DOM.appendChild(RootPanel.getBodyElement(), draggingCurtain); } } /** + * A dragging curtain is required in Gecko and Webkit. + * + * @return true if the browser requires a dragging curtain + */ + private boolean isDraggingCurtainRequired() { + return (BrowserInfo.get().isGecko() || BrowserInfo.get().isWebkit()); + } + + /** * Hides dragging curtain */ private void hideDraggingCurtain() { diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index fc7f174a62..72c383b0c1 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -383,7 +383,8 @@ public abstract class AbstractCommunicationManager implements if (item.isFormField()) { // ignored, upload requests contains only files } else { - final String pid = name.split("_")[0]; + int separatorPos = name.lastIndexOf("_"); + final String pid = name.substring(0, separatorPos); final Upload uploadComponent = (Upload) idPaintableMap .get(pid); if (uploadComponent == null) { diff --git a/src/com/vaadin/terminal/gwt/server/PortletApplicationContext.java b/src/com/vaadin/terminal/gwt/server/PortletApplicationContext.java index af9ed1b9a6..bbfecb5d65 100644 --- a/src/com/vaadin/terminal/gwt/server/PortletApplicationContext.java +++ b/src/com/vaadin/terminal/gwt/server/PortletApplicationContext.java @@ -24,7 +24,6 @@ import com.vaadin.Application; * @author marc
*/
@SuppressWarnings( { "serial", "unchecked" })
-@Deprecated
public class PortletApplicationContext extends WebApplicationContext implements
Serializable {
|