]> source.dussan.org Git - vaadin-framework.git/commitdiff
Link now behaves more like regular html links, fixes #2190
authorMarc Englund <marc.englund@itmill.com>
Tue, 4 Nov 2008 10:48:13 +0000 (10:48 +0000)
committerMarc Englund <marc.englund@itmill.com>
Tue, 4 Nov 2008 10:48:13 +0000 (10:48 +0000)
svn changeset:5806/svn branch:trunk

WebContent/ITMILL/themes/default/common/common.css
src/com/itmill/toolkit/terminal/gwt/client/ui/ILink.java

index 6fd194dea1a28aa2f1a60de84212f089b4b4c9bc..8b46b96d94e18b3e072041d788511b6627bfd956 100644 (file)
@@ -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;
 }
 
 /**
index 3617504d744d3e1dfbed149fe61b13a8ffdebbd4..d8cee6e466b1afaa3269f0f101b436179d5d5a4e 100644 (file)
@@ -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();
+                }
+            }
         }
     }