[kune-commits] r1391 - in trunk/src/main/java/cc/kune: common/client/ui core/client/init domain gspace/client/actions gspace/client/viewers

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Sun May 15 17:11:06 CEST 2011


Author: vjrj_
Date: 2011-05-15 17:11:05 +0200 (Sun, 15 May 2011)
New Revision: 1391

Modified:
   trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java
   trunk/src/main/java/cc/kune/core/client/init/AppStarterDefault.java
   trunk/src/main/java/cc/kune/domain/Container.java
   trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java
   trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/ContentTitleWidget.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
Log:
New contents notifications. Fetching issues...

Modified: trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java	2011-05-15 10:58:22 UTC (rev 1390)
+++ trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java	2011-05-15 15:11:05 UTC (rev 1391)
@@ -21,6 +21,7 @@
 
 import cc.kune.common.client.tooltip.Tooltip;
 import cc.kune.common.client.ui.EditEvent.EditHandler;
+import cc.kune.common.client.utils.SimpleCallback;
 
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.event.dom.client.BlurEvent;
@@ -32,6 +33,7 @@
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
 import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.user.client.Timer;
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.InlineLabel;
 import com.google.gwt.user.client.ui.TextBox;
@@ -42,6 +44,8 @@
   interface EditableLabelUiBinder extends UiBinder<Widget, EditableLabel> {
   }
 
+  private static final int BLINK_TIME = 400;
+
   private static EditableLabelUiBinder uiBinder = GWT.create(EditableLabelUiBinder.class);
 
   private boolean editable;
@@ -63,6 +67,46 @@
     return addHandler(handler, EditEvent.getType());
   }
 
+  public void blink() {
+    if (editable) {
+      blinkTimer(true, new SimpleCallback() {
+        @Override
+        public void onCallback() {
+          blinkTimer(false, new SimpleCallback() {
+            @Override
+            public void onCallback() {
+              blinkTimer(true, new SimpleCallback() {
+                @Override
+                public void onCallback() {
+                  blinkTimer(false, new SimpleCallback() {
+                    @Override
+                    public void onCallback() {
+                      // nothing
+                    }
+                  });
+                }
+              });
+            }
+          });
+        }
+      });
+    }
+  }
+
+  private void blinkTimer(final boolean add, final SimpleCallback callback) {
+    new Timer() {
+      @Override
+      public void run() {
+        if (add) {
+          label.addStyleDependentName("high");
+        } else {
+          label.removeStyleDependentName("high");
+        }
+        callback.onCallback();
+      }
+    }.schedule(BLINK_TIME);
+  }
+
   public void edit() {
     if (editable) {
       label.setVisible(false);

Modified: trunk/src/main/java/cc/kune/core/client/init/AppStarterDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/init/AppStarterDefault.java	2011-05-15 10:58:22 UTC (rev 1390)
+++ trunk/src/main/java/cc/kune/core/client/init/AppStarterDefault.java	2011-05-15 15:11:05 UTC (rev 1391)
@@ -66,7 +66,8 @@
   }
 
   private void checkNavigatorCompatibility(final NavigatorSupport navSupport) {
-    if (Navigator.getUserAgent().toLowerCase().contains("msie")) {
+    if (Navigator.getUserAgent().toLowerCase().contains("msie")
+        || Navigator.getUserAgent().toLowerCase().contains("opera")) {
       navSupport.onNotSupported();
     } else {
       navSupport.onSupported();

Modified: trunk/src/main/java/cc/kune/domain/Container.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/Container.java	2011-05-15 10:58:22 UTC (rev 1390)
+++ trunk/src/main/java/cc/kune/domain/Container.java	2011-05-15 15:11:05 UTC (rev 1391)
@@ -110,7 +110,8 @@
   // Parent/Child pattern:
   // http://www.hibernate.org/hib_docs/reference/en/html/example-parentchild.html
   // http://www.researchkitchen.co.uk/blog/archives/57
-  @ManyToOne(fetch = FetchType.LAZY)
+  @LazyCollection(LazyCollectionOption.FALSE)
+  @ManyToOne(fetch = FetchType.EAGER)
   @JoinColumn
   private Container parent;
 

Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java	2011-05-15 10:58:22 UTC (rev 1390)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java	2011-05-15 15:11:05 UTC (rev 1391)
@@ -75,7 +75,7 @@
               stateManager.setRetrievedStateAndGo(state);
               NotifyUser.hideProgress();
               NotifyUser.info(i18n.tWithNT("[%s] created", "New folder created, for instance", newName));
-              // folderViewer.editTitle();
+              folderViewer.blinkTitle();
             }
           });
       cache.removeContent(session.getCurrentStateToken());

Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java	2011-05-15 10:58:22 UTC (rev 1390)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java	2011-05-15 15:11:05 UTC (rev 1391)
@@ -35,6 +35,7 @@
 import cc.kune.core.shared.dto.HasContent;
 import cc.kune.core.shared.dto.StateContentDTO;
 import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.viewers.ContentViewerPresenter;
 
 import com.google.gwt.resources.client.ImageResource;
 import com.google.inject.Inject;
@@ -46,17 +47,21 @@
 
     private final ContentCache cache;
     private final Provider<ContentServiceAsync> contentService;
+    private final ContentViewerPresenter contentViewer;
+    private final I18nTranslationService i18n;
     private final Session session;
     private final StateManager stateManager;
 
     @Inject
     public NewContentAction(final Session session, final StateManager stateManager,
         final I18nTranslationService i18n, final Provider<ContentServiceAsync> contentService,
-        final ContentCache cache) {
+        final ContentViewerPresenter contentViewerPresenter, final ContentCache cache) {
       super(AccessRolDTO.Editor, true);
       this.session = session;
       this.stateManager = stateManager;
+      this.i18n = i18n;
       this.contentService = contentService;
+      this.contentViewer = contentViewerPresenter;
       this.cache = cache;
     }
 
@@ -64,15 +69,17 @@
     public void actionPerformed(final ActionEvent event) {
       NotifyUser.showProgressProcessing();
       stateManager.gotoStateToken(((HasContent) session.getCurrentState()).getContainer().getStateToken());
-      contentService.get().addContent(session.getUserHash(), session.getCurrentStateToken(),
-          (String) getValue(NEW_NAME), (String) getValue(ID),
-          new AsyncCallbackSimple<StateContentDTO>() {
+      final String newName = (String) getValue(NEW_NAME);
+      contentService.get().addContent(session.getUserHash(), session.getCurrentStateToken(), newName,
+          (String) getValue(ID), new AsyncCallbackSimple<StateContentDTO>() {
             @Override
             public void onSuccess(final StateContentDTO state) {
               stateManager.setRetrievedStateAndGo(state);
               NotifyUser.hideProgress();
               // stateManager.refreshCurrentGroupState();
               // contextNavigator.setEditOnNextStateChange(true);
+              NotifyUser.info(i18n.tWithNT("[%s] created", "New content created, for instance", newName));
+              contentViewer.blinkTitle();
             }
           });
       cache.removeContent(session.getCurrentStateToken());

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java	2011-05-15 10:58:22 UTC (rev 1390)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java	2011-05-15 15:11:05 UTC (rev 1391)
@@ -68,6 +68,11 @@
   }
 
   @Override
+  public void blinkTitle() {
+    contentTitle.blink();
+  }
+
+  @Override
   public void clear() {
     gsArmor.getSubheaderToolbar().clear();
     UiUtils.clear(gsArmor.getDocContainer());

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentTitleWidget.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentTitleWidget.java	2011-05-15 10:58:22 UTC (rev 1390)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentTitleWidget.java	2011-05-15 15:11:05 UTC (rev 1391)
@@ -53,6 +53,10 @@
     initWidget(flow);
   }
 
+  public void blink() {
+    editableTitle.blink();
+  }
+
   public void edit() {
     editableTitle.edit();
   }

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java	2011-05-15 10:58:22 UTC (rev 1390)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java	2011-05-15 15:11:05 UTC (rev 1391)
@@ -124,6 +124,11 @@
   }
 
   @Override
+  public void blinkTitle() {
+    contentTitle.blink();
+  }
+
+  @Override
   public void clear() {
     onlyViewPanel.setHTML("");
     gsArmor.getSubheaderToolbar().clear();

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java	2011-05-15 10:58:22 UTC (rev 1390)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java	2011-05-15 15:11:05 UTC (rev 1391)
@@ -66,6 +66,8 @@
 
     void attach();
 
+    void blinkTitle();
+
     void clear();
 
     void detach();
@@ -122,6 +124,10 @@
     }
   }
 
+  public void blinkTitle() {
+    getView().blinkTitle();
+  }
+
   private void createEditHandler() {
     editHandler = getView().getEditTitle().addEditHandler(new EditHandler() {
       @Override

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java	2011-05-15 10:58:22 UTC (rev 1390)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java	2011-05-15 15:11:05 UTC (rev 1391)
@@ -80,6 +80,8 @@
 
     void attach();
 
+    void blinkTitle();
+
     void clear();
 
     void detach();
@@ -170,6 +172,10 @@
     }
   }
 
+  public void blinkTitle() {
+    getView().blinkTitle();
+  }
+
   String calculateStyle(final int pos, final int length) {
     if (length == 1) {
       return CSSBTN;




More information about the kune-commits mailing list