[kune-commits] r1091 - in trunk: . src/main/java/org/ourproject/kune/platf/client/ui/rte/basic

vjrj vjrj at ourproject.org
Mon Apr 6 12:00:10 CEST 2009


Author: vjrj
Date: 2009-04-06 12:00:04 +0200 (Mon, 06 Apr 2009)
New Revision: 1091

Modified:
   trunk/CREDITS
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTELinkPopup.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java
Log:
Complete - task RTE: Edit/erase link contextual menu 


Modified: trunk/CREDITS
===================================================================
--- trunk/CREDITS	2009-04-03 02:22:07 UTC (rev 1090)
+++ trunk/CREDITS	2009-04-06 10:00:04 UTC (rev 1091)
@@ -15,7 +15,8 @@
 Freire staff.
 * Daniel Jiménez for the initial help and coordination
 * Javier de la Cueva and Leovigildo García-Bobadilla for the legal support
+* Jonathan Araña Cruz, Roxu and all the xsto staff for help with the infraestructure
 * Thanks to David Trigo and http://www.esperanto-es.net/ for suggest the name of 
 'kune' for our initiative:
   http://ourproject.org/forum/forum.php?thread_id=500&forum_id=469
-* and ourproject.org and xsto.info for sharing with us their resources
+* and ourproject.org and again xsto.info for sharing with us their resources

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTELinkPopup.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTELinkPopup.java	2009-04-03 02:22:07 UTC (rev 1090)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTELinkPopup.java	2009-04-06 10:00:04 UTC (rev 1091)
@@ -36,6 +36,14 @@
         }
     }
 
+    public boolean isVisible() {
+        if (popupPalette != null && popupPalette.isVisible()) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
     public void show(final int left, final int top) {
         popupPalette = new PopupPanel(false, false);
         popupPalette.addStyleName("k-rte-changelink-popup");

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java	2009-04-03 02:22:07 UTC (rev 1090)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java	2009-04-06 10:00:04 UTC (rev 1091)
@@ -46,6 +46,7 @@
         }
 
         public void onLostFocus(final Widget sender) {
+            presenter.onLostFocus();
         }
     }
     private final I18nUITranslationService i18n;
@@ -155,6 +156,7 @@
 
     public void hideLinkCtxMenu() {
         linkCtxMenu.hide();
+
     }
 
     public void insertBlockquote() {
@@ -215,12 +217,16 @@
         return getFstRange().isCollapsed();
     }
 
+    public boolean isCtxMenuVisible() {
+        return linkCtxMenu.isVisible();
+    }
+
     public boolean isItalic() {
         return basic.isItalic();
     }
 
     public boolean isLink() {
-        if (LinkExecutableUtils.getSelectedAnchor(this) != null) {
+        if (isAttached() && LinkExecutableUtils.getSelectedAnchor(this) != null) {
             return true;
         } else {
             return false;
@@ -265,6 +271,7 @@
         switch (DOM.eventGetType(event)) {
         case Event.ONCLICK:
             updateStatus();
+            updateLinkInfo();
             super.onBrowserEvent(event);
             break;
         case Event.ONKEYDOWN:
@@ -333,8 +340,10 @@
         DeferredCommand.addCommand(new Command() {
             public void execute() {
                 org.xwiki.gwt.dom.client.Element selectedAnchor = LinkExecutableUtils.getSelectedAnchor(RTEditorPanel.this);
-                linkCtxMenu.show(RTEditorPanel.this.getAbsoluteLeft() + selectedAnchor.getAbsoluteLeft(),
-                        RTEditorPanel.this.getAbsoluteTop() + selectedAnchor.getAbsoluteTop() + 20);
+                if (selectedAnchor != null) {
+                    linkCtxMenu.show(RTEditorPanel.this.getAbsoluteLeft() + selectedAnchor.getAbsoluteLeft(),
+                            RTEditorPanel.this.getAbsoluteTop() + selectedAnchor.getAbsoluteTop() + 20);
+                }
             }
         });
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java	2009-04-03 02:22:07 UTC (rev 1090)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java	2009-04-06 10:00:04 UTC (rev 1091)
@@ -191,6 +191,10 @@
         palette.get().hide();
     }
 
+    public void onLostFocus() {
+        hideLinkCtxMenu();
+    }
+
     public void setExtended(final boolean extended) {
         this.extended = extended;
     }
@@ -210,11 +214,15 @@
     }
 
     public void updateLinkInfo() {
-        if (isExtended() && view.isLink()) {
-            view.showLinkCtxMenu();
-        } else {
-            view.hideLinkCtxMenu();
-        }
+        deferred.addCommand(new Listener0() {
+            public void onEvent() {
+                if (isExtended() && view.isLink()) {
+                    view.showLinkCtxMenu();
+                } else {
+                    hideLinkCtxMenu();
+                }
+            }
+        });
     }
 
     public void updateStatus() {
@@ -946,6 +954,12 @@
         return RTEImgResources.SUFFIX + imageResource.getName();
     }
 
+    private void hideLinkCtxMenu() {
+        if (view.isCtxMenuVisible()) {
+            view.hideLinkCtxMenu();
+        }
+    }
+
     private boolean isExtended() {
         return extended && view.canBeExtended();
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java	2009-04-03 02:22:07 UTC (rev 1090)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java	2009-04-06 10:00:04 UTC (rev 1091)
@@ -64,6 +64,8 @@
 
     boolean isBold();
 
+    boolean isCtxMenuVisible();
+
     boolean isItalic();
 
     boolean isLink();




More information about the kune-commits mailing list