From: Marc Englund Date: Tue, 4 Nov 2008 10:48:13 +0000 (+0000) Subject: Link now behaves more like regular html links, fixes #2190 X-Git-Tag: 6.7.0.beta1~3879 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=212acb2e4c4002f92a1374fd345b49ba021b3d89;p=vaadin-framework.git Link now behaves more like regular html links, fixes #2190 svn changeset:5806/svn branch:trunk --- diff --git a/WebContent/ITMILL/themes/default/common/common.css b/WebContent/ITMILL/themes/default/common/common.css index 6fd194dea1..8b46b96d94 100644 --- a/WebContent/ITMILL/themes/default/common/common.css +++ b/WebContent/ITMILL/themes/default/common/common.css @@ -219,10 +219,10 @@ input.i-modified, * Link component styles * (useless to move into a separate file) */ - -.i-link span { - text-decoration: underline; - cursor:pointer; +.i-link a { + font-size: 13px; + line-height: 18px; + color: #464f52; } /** diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/ILink.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/ILink.java index 3617504d74..d8cee6e466 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/ILink.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/ILink.java @@ -40,7 +40,7 @@ public class ILink extends HTML implements Paintable, ClickListener { private Element errorIndicatorElement; - private final Element captionElement = DOM.createSpan(); + private final Element captionElement = DOM.createAnchor(); private Icon icon; @@ -69,9 +69,11 @@ public class ILink extends HTML implements Paintable, ClickListener { if (uidl.hasAttribute("name")) { target = uidl.getStringAttribute("name"); + captionElement.setAttribute("target", target); } if (uidl.hasAttribute("src")) { src = client.translateToolkitUri(uidl.getStringAttribute("src")); + captionElement.setAttribute("href", src); } if (uidl.hasAttribute("border")) { @@ -142,7 +144,16 @@ public class ILink extends HTML implements Paintable, ClickListener { + targetHeight; } - Window.open(src, target, features); + if (features.length() > 0) { + // if 'special features' are set, use window.open(), unless + // a modifier key is held (ctrl to open in new tab etc) + Event e = DOM.eventGetCurrentEvent(); + if (!e.getCtrlKey() && !e.getAltKey() && !e.getShiftKey() + && !e.getMetaKey()) { + Window.open(src, target, features); + e.preventDefault(); + } + } } }