[kune-commits] r968 - in trunk/src/main/java/org/ourproject/kune: app/public/css blogs/client docs/client workspace/client workspace/client/licensefoot

vjrj vjrj at ourproject.org
Tue Nov 25 14:33:22 CET 2008


Author: vjrj
Date: 2008-11-25 14:33:20 +0100 (Tue, 25 Nov 2008)
New Revision: 968

Modified:
   trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
   trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
   trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java
   trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/EntityLicensePanel.java
Log:
Incomplete - task UI tools & workspace refactorization 


Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/all.css	2008-11-25 00:51:20 UTC (rev 967)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css	2008-11-25 13:33:20 UTC (rev 968)
@@ -41,4 +41,4 @@
     padding: 1px 0px 1px 1px;
     text-decoration:none;
 }
-*/.k-textlinethrough{text-decoration:line-through;color:red;}.k-textnormal{text-decoration:inherit;color:green;}.k-textunderline{text-decoration:underline;color:gray;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}.k-bsp-buddie{background:#FAFAFA none repeat scroll 0 50%;border:1px solid #EBEBEB;padding:3px;margin:3px;}.k-bsp-buddie td{padding:2px 3px;}.k-text-gray{color:gray;}.k-elp-limg{margin-top:4px;}
\ No newline at end of file
+*/.k-textlinethrough{text-decoration:line-through;color:red;}.k-textnormal{text-decoration:inherit;color:green;}.k-textunderline{text-decoration:underline;color:gray;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}.k-bsp-buddie{background:#FAFAFA none repeat scroll 0 50%;border:1px solid #EBEBEB;padding:3px;margin:3px;}.k-bsp-buddie td{padding:2px 3px;}.k-text-gray{color:gray;}.k-elp-limg{margin-top:4px;margin-left:5px;}
\ No newline at end of file

Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css	2008-11-25 00:51:20 UTC (rev 967)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css	2008-11-25 13:33:20 UTC (rev 968)
@@ -801,4 +801,5 @@
 
 .k-elp-limg {
   margin-top: 4px;
+  margin-left: 5px;
 }

Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java	2008-11-25 00:51:20 UTC (rev 967)
+++ trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java	2008-11-25 13:33:20 UTC (rev 968)
@@ -24,12 +24,8 @@
 import static org.ourproject.kune.blogs.client.BlogClientTool.TYPE_UPLOADEDFILE;
 
 import org.ourproject.kune.blogs.client.cnt.BlogViewer;
-import org.ourproject.kune.platf.client.actions.ActionToolbarButtonAndItemDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionToolbarMenuAndItemDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionToolbarMenuDescriptor;
 import org.ourproject.kune.platf.client.actions.ContentActionRegistry;
 import org.ourproject.kune.platf.client.actions.ContextActionRegistry;
-import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
 import org.ourproject.kune.platf.client.rpc.GroupServiceAsync;
 import org.ourproject.kune.platf.client.services.KuneErrorHandler;
@@ -65,6 +61,12 @@
 
     @Override
     protected void createActions() {
+        final String[] all = { TYPE_ROOT, TYPE_BLOG, TYPE_POST, TYPE_UPLOADEDFILE };
+        final String[] contentsModerated = { TYPE_POST, TYPE_UPLOADEDFILE };
+        final String[] containers = { TYPE_ROOT, TYPE_BLOG };
+        final String[] containersNoRoot = { TYPE_BLOG };
+        final String[] contents = { TYPE_POST, TYPE_UPLOADEDFILE };
+
         String parentMenuTitle = i18n.t("Post");
         String parentMenuTitleCtx = i18n.t("Blog");
 
@@ -73,56 +75,30 @@
         createNewContentAction(TYPE_POST, "images/nav/post_add.png", i18n.t("New post"), parentMenuTitleCtx,
                 Position.ctx, TYPE_BLOG);
 
-        final ActionToolbarMenuAndItemDescriptor<StateToken> delContainer = createDelContainerAction("Delete blog",
-                parentMenuTitleCtx);
+        createContentModeratedActions(parentMenuTitle, contentsModerated);
 
-        final ActionToolbarMenuAndItemDescriptor<StateToken> delContent = createDelContentAction(parentMenuTitle,
-                i18n.t("Delete"));
+        createContentRenameAction(parentMenuTitle, i18n.t("Rename"), contents);
+        createRenameContentInCtxAction(parentMenuTitleCtx, i18n.t("Rename"), containersNoRoot);
 
-        final ActionToolbarMenuAndItemDescriptor<StateToken> renameCtn = createContentRenameAction(parentMenuTitle,
-                i18n.t("Rename"));
-
-        final ActionToolbarMenuAndItemDescriptor<StateToken> renameCtx = createRenameContentInCtxAction(
-                parentMenuTitleCtx, i18n.t("Rename"));
-
-        final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupCnt = createSetAsDefContent(parentMenuTitle);
-
         // final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupCxt =
         // createSetAsDefContent(parentMenuTitleCtx);
 
-        final ActionToolbarMenuDescriptor<StateToken> refreshCnt = createRefreshCntAction(parentMenuTitle);
+        createRefreshCntAction(parentMenuTitle, contents);
+        createRefreshCxtAction(parentMenuTitleCtx, containers);
 
-        final ActionToolbarMenuDescriptor<StateToken> refreshCtx = createRefreshCxtAction(parentMenuTitleCtx);
-        final ActionToolbarButtonAndItemDescriptor<StateToken> uploadFile = createUploadAction(i18n.t("Upload file"),
-                "images/nav/upload.png", i18n.t("Upload some files (images, PDFs, ...)"), null);
+        createUploadAction(i18n.t("Upload file"), "images/nav/upload.png",
+                i18n.t("Upload some files (images, PDFs, ...)"), null, containersNoRoot);
 
-        final String[] all = { TYPE_ROOT, TYPE_BLOG, TYPE_POST, TYPE_UPLOADEDFILE };
-        final String[] contentsModerated = { TYPE_POST, TYPE_UPLOADEDFILE };
-        final String[] containersNoRoot = { TYPE_BLOG };
-        final String[] containers = { TYPE_ROOT, TYPE_BLOG };
-        final String[] contents = { TYPE_POST, TYPE_UPLOADEDFILE };
+        createSetAsDefContent(parentMenuTitle, contents);
 
-        createContentModeratedActions(parentMenuTitle, contentsModerated);
+        createGoAction(all);
+        createGoHomeAction(containers);
+        createEditAction(TYPE_POST);
 
-        contextActionRegistry.addAction(go, all);
-        contentActionRegistry.addAction(renameCtn, contents);
-        contextActionRegistry.addAction(renameCtx, containersNoRoot);
-        contextActionRegistry.addAction(refreshCtx, containers);
-        contentActionRegistry.addAction(refreshCnt, contents);
-        contextActionRegistry.addAction(uploadFile, TYPE_BLOG);
-        contentActionRegistry.addAction(delContent, contents);
-        contextActionRegistry.addAction(delContainer, containersNoRoot);
-        contentActionRegistry.addAction(setAsDefGroupCnt, TYPE_POST, TYPE_UPLOADEDFILE);
         // ContentRPC Authorized must permit folders
         // contentActionRegistry.addAction(setAsDefGroupCxt, TYPE_BLOG);
 
-        contextActionRegistry.addAction(goGroupHome, containers);
-        contentActionRegistry.addAction(editContent, TYPE_POST);
-        // contentActionRegistry.addAction(translateContent, );
+        createDelContainerAction("Delete blog", parentMenuTitleCtx, containersNoRoot);
+        createDelContentAction(parentMenuTitle, i18n.t("Delete"), contents);
     }
-
-    @Override
-    protected void createPostSessionInitActions() {
-        // contextActionRegistry.addAction(uploadMedia, TYPE_GALLERY);
-    }
 }

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java	2008-11-25 00:51:20 UTC (rev 967)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java	2008-11-25 13:33:20 UTC (rev 968)
@@ -27,12 +27,8 @@
 import static org.ourproject.kune.docs.client.DocumentClientTool.TYPE_WIKIPAGE;
 
 import org.ourproject.kune.docs.client.cnt.DocumentViewer;
-import org.ourproject.kune.platf.client.actions.ActionToolbarButtonAndItemDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionToolbarMenuAndItemDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionToolbarMenuDescriptor;
 import org.ourproject.kune.platf.client.actions.ContentActionRegistry;
 import org.ourproject.kune.platf.client.actions.ContextActionRegistry;
-import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
 import org.ourproject.kune.platf.client.rpc.GroupServiceAsync;
 import org.ourproject.kune.platf.client.services.KuneErrorHandler;
@@ -68,11 +64,18 @@
 
     @Override
     protected void createActions() {
+        final String[] all = { TYPE_ROOT, TYPE_FOLDER, TYPE_DOCUMENT, TYPE_GALLERY, TYPE_WIKI, TYPE_WIKIPAGE,
+                TYPE_UPLOADEDFILE };
+        final String[] containers = { TYPE_ROOT, TYPE_FOLDER, TYPE_GALLERY, TYPE_WIKI };
+        final String[] contentsModerated = { TYPE_DOCUMENT, TYPE_UPLOADEDFILE };
+        final String[] containersNoRoot = { TYPE_FOLDER, TYPE_GALLERY, TYPE_WIKI };
+        final String[] contents = { TYPE_DOCUMENT, TYPE_WIKIPAGE, TYPE_UPLOADEDFILE };
+
         String parentMenuTitle = i18n.t("File");
         String parentMenuTitleCtx = i18n.t("Folder");
 
         createNewContainerAction(TYPE_FOLDER, "images/nav/folder_add.png", i18n.t("New folder"), parentMenuTitleCtx,
-                i18n.t("New"), i18n.t("New folder"), Position.ctx, TYPE_FOLDER);
+                i18n.t("New"), i18n.t("New folder"), Position.ctx, TYPE_ROOT, TYPE_FOLDER);
         createNewContainerAction(TYPE_GALLERY, "images/nav/gallery_add.png", i18n.t("New gallery"), parentMenuTitleCtx,
                 i18n.t("New"), i18n.t("New gallery"), Position.ctx, TYPE_ROOT);
         createNewContainerAction(TYPE_WIKI, "images/nav/wiki_add.png", i18n.t("New wiki"), parentMenuTitleCtx,
@@ -83,58 +86,35 @@
         createNewContentAction(TYPE_WIKIPAGE, "images/nav/wikipage_add.png", parentMenuTitleCtx,
                 i18n.t("New wikipage"), Position.ctx, TYPE_WIKI);
 
-        final ActionToolbarMenuAndItemDescriptor<StateToken> delContainer = createDelContainerAction("Delete folder",
-                parentMenuTitleCtx);
+        createContentModeratedActions(parentMenuTitle, contentsModerated);
 
-        final ActionToolbarMenuAndItemDescriptor<StateToken> delContent = createDelContentAction(parentMenuTitle,
-                i18n.t("Delete"));
+        createContentRenameAction(parentMenuTitle, i18n.t("Rename"), contents);
+        createRenameContentInCtxAction(parentMenuTitleCtx, i18n.t("Rename"), containersNoRoot);
 
-        final ActionToolbarMenuAndItemDescriptor<StateToken> renameCtn = createContentRenameAction(parentMenuTitle,
-                i18n.t("Rename"));
-
-        final ActionToolbarMenuAndItemDescriptor<StateToken> renameCtx = createRenameContentInCtxAction(
-                parentMenuTitleCtx, i18n.t("Rename"));
-
-        final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupCnt = createSetAsDefContent(parentMenuTitle);
-
         // final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupCxt =
         // createSetAsDefContent(parentMenuTitleCtx);
 
-        final ActionToolbarMenuDescriptor<StateToken> refreshCnt = createRefreshCntAction(parentMenuTitle);
+        createRefreshCntAction(parentMenuTitle, contents);
+        createRefreshCxtAction(parentMenuTitleCtx, containers);
 
-        final ActionToolbarMenuDescriptor<StateToken> refreshCtx = createRefreshCxtAction(parentMenuTitleCtx);
+        createSetAsDefContent(parentMenuTitle, contents);
 
-        final ActionToolbarButtonAndItemDescriptor<StateToken> uploadFile = createUploadAction(i18n.t("Upload file"),
-                "images/nav/upload.png", i18n.t("Upload some files (images, PDFs, ...)"), null);
+        createUploadAction(i18n.t("Upload file"), "images/nav/upload.png",
+                i18n.t("Upload some files (images, PDFs, ...)"), null, containers);
 
-        final String[] all = { TYPE_ROOT, TYPE_FOLDER, TYPE_DOCUMENT, TYPE_GALLERY, TYPE_WIKI, TYPE_WIKIPAGE,
-                TYPE_UPLOADEDFILE };
-        final String[] containersNoRoot = { TYPE_FOLDER, TYPE_GALLERY, TYPE_WIKI };
-        final String[] containers = { TYPE_ROOT, TYPE_FOLDER, TYPE_GALLERY, TYPE_WIKI };
-        final String[] contents = { TYPE_DOCUMENT, TYPE_WIKIPAGE, TYPE_UPLOADEDFILE };
-        final String[] contentsModerated = { TYPE_DOCUMENT, TYPE_UPLOADEDFILE };
-
-        createContentModeratedActions(parentMenuTitle, contentsModerated);
         createDownloadActions(TYPE_UPLOADEDFILE);
 
-        contextActionRegistry.addAction(go, all);
-        contentActionRegistry.addAction(renameCtn, contents);
-        contextActionRegistry.addAction(renameCtx, containersNoRoot);
-        contextActionRegistry.addAction(refreshCtx, containers);
-        contentActionRegistry.addAction(refreshCnt, contents);
-        contextActionRegistry.addAction(uploadFile, TYPE_ROOT, TYPE_FOLDER);
-        contentActionRegistry.addAction(delContent, contents);
-        contextActionRegistry.addAction(delContainer, containersNoRoot);
-        contentActionRegistry.addAction(setAsDefGroupCnt, TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
-        // contentActionRegistry.addAction(setAsDefGroupCxt,);
-        contextActionRegistry.addAction(goGroupHome, containers);
-        contentActionRegistry.addAction(editContent, TYPE_DOCUMENT, TYPE_WIKIPAGE);
-        contentActionRegistry.addAction(translateContent, TYPE_DOCUMENT, TYPE_FOLDER, TYPE_GALLERY, TYPE_UPLOADEDFILE,
-                TYPE_WIKI, TYPE_WIKIPAGE);
+        createGoAction(all);
+        createGoHomeAction(containers);
+        createEditAction(TYPE_DOCUMENT, TYPE_WIKIPAGE);
+        createTranslateAction(TYPE_DOCUMENT, TYPE_FOLDER, TYPE_GALLERY, TYPE_UPLOADEDFILE, TYPE_WIKI, TYPE_WIKIPAGE);
+
+        createDelContainerAction("Delete folder", parentMenuTitleCtx, containersNoRoot);
+        createDelContentAction(parentMenuTitle, i18n.t("Delete"), contents);
     }
 
     @Override
     protected void createPostSessionInitActions() {
-        contextActionRegistry.addAction(uploadMedia, TYPE_GALLERY);
+        super.createUploadMediaAction(TYPE_GALLERY);
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java	2008-11-25 00:51:20 UTC (rev 967)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java	2008-11-25 13:33:20 UTC (rev 968)
@@ -66,11 +66,6 @@
     protected final FoldableContent foldableContent;
     protected final DeferredCommandWrapper deferredCommandWrapper;
     protected final EntityLogo entityLogo;
-    protected ActionMenuItemDescriptor<StateToken> go;
-    protected ActionToolbarButtonDescriptor<StateToken> goGroupHome;
-    protected ActionToolbarButtonAndItemDescriptor<StateToken> uploadMedia;
-    protected ActionToolbarButtonDescriptor<StateToken> translateContent;
-    protected ActionToolbarButtonDescriptor<StateToken> editContent;
 
     public AbstractFoldableContentActions(Session session, StateManager stateManager, I18nUITranslationService i18n,
             KuneErrorHandler errorHandler, DeferredCommandWrapper deferredCommandWrapper,
@@ -96,11 +91,9 @@
         this.contextPropEditorProvider = contextPropEditorProvider;
         this.foldableContent = foldableContent;
         this.entityLogo = entityLogo;
-        createCommonActions();
         createActions();
         session.onInitDataReceived(new Listener<InitDataDTO>() {
             public void onEvent(InitDataDTO parameter) {
-                createCommonPostSessionInitActions();
                 createPostSessionInitActions();
             }
         });
@@ -130,8 +123,7 @@
         contentActionRegistry.addAction(setInTheDustBinStatus, contentsModerated);
     }
 
-    protected ActionToolbarMenuAndItemDescriptor<StateToken> createContentRenameAction(String parentMenuTitle,
-            String textDescription) {
+    protected void createContentRenameAction(String parentMenuTitle, String textDescription, String... registerInTypes) {
         final ActionToolbarMenuAndItemDescriptor<StateToken> renameCtn = new ActionToolbarMenuAndItemDescriptor<StateToken>(
                 AccessRolDTO.Editor, ActionToolbarPosition.topbar, new Listener<StateToken>() {
                     public void onEvent(final StateToken stateToken) {
@@ -140,11 +132,10 @@
                 });
         renameCtn.setTextDescription(textDescription);
         renameCtn.setParentMenuTitle(parentMenuTitle);
-        return renameCtn;
+        contentActionRegistry.addAction(renameCtn, registerInTypes);
     }
 
-    protected ActionToolbarMenuAndItemDescriptor<StateToken> createDelContainerAction(String text,
-            String parentMenuTitle) {
+    protected void createDelContainerAction(String text, String parentMenuTitle, String... registerInTypes) {
         final ActionToolbarMenuAndItemDescriptor<StateToken> delContainer = new ActionToolbarMenuAndItemDescriptor<StateToken>(
                 AccessRolDTO.Administrator, ActionToolbarPosition.topbar, new Listener<StateToken>() {
                     public void onEvent(final StateToken token) {
@@ -156,11 +147,10 @@
         delContainer.setMustBeConfirmed(true);
         delContainer.setConfirmationTitle(i18n.t("Please confirm"));
         delContainer.setConfirmationText(i18n.t("You will delete it and also all its contents. Are you sure?"));
-        return delContainer;
+        contextActionRegistry.addAction(delContainer, registerInTypes);
     }
 
-    protected ActionToolbarMenuAndItemDescriptor<StateToken> createDelContentAction(String parentMenuTitle,
-            String textDescription) {
+    protected void createDelContentAction(String parentMenuTitle, String textDescription, String... registerInTypes) {
         final ActionToolbarMenuAndItemDescriptor<StateToken> delContent = new ActionToolbarMenuAndItemDescriptor<StateToken>(
                 AccessRolDTO.Administrator, ActionToolbarPosition.topbar, new Listener<StateToken>() {
                     public void onEvent(final StateToken token) {
@@ -184,7 +174,7 @@
                 return !itemToken.equals(defContentToken);
             }
         });
-        return delContent;
+        contentActionRegistry.addAction(delContent, registerInTypes);
     }
 
     protected void createDownloadActions(String typeUploadedfile) {
@@ -213,6 +203,106 @@
         contextActionRegistry.addAction(downloadCtx, TYPE_UPLOADEDFILE);
     }
 
+    protected ActionToolbarButtonDescriptor<StateToken> createEditAction(String... registerInTypes) {
+        ActionToolbarButtonDescriptor<StateToken> editContent = new ActionToolbarButtonDescriptor<StateToken>(
+                AccessRolDTO.Editor, ActionToolbarPosition.topbar, new Listener<StateToken>() {
+                    public void onEvent(final StateToken stateToken) {
+                        session.check(new AsyncCallbackSimple<Object>() {
+                            public void onSuccess(final Object result) {
+                                final TextEditor editor = textEditorProvider.get();
+                                foldableContent.detach();
+                                contextNavigator.detach();
+                                contextPropEditorProvider.get().attach();
+                                editor.editContent(session.getContentState().getContent(), new Listener<String>() {
+                                    public void onEvent(final String html) {
+                                        Site.showProgressSaving();
+                                        contentServiceProvider.get().save(session.getUserHash(), stateToken, html,
+                                                new AsyncCallback<Object>() {
+                                                    public void onFailure(final Throwable caught) {
+                                                        Site.hideProgress();
+                                                        try {
+                                                            throw caught;
+                                                        } catch (final SessionExpiredException e) {
+                                                            errorHandler.doSessionExpired();
+                                                        } catch (final Throwable e) {
+                                                            Site.error(i18n.t("Error saving document. Retrying..."));
+                                                            errorHandler.process(caught);
+                                                            editor.onSaveFailed();
+                                                        }
+                                                    }
+
+                                                    public void onSuccess(Object param) {
+                                                        Site.hideProgress();
+                                                        session.getContentState().setContent(html);
+                                                        editor.onSaved();
+                                                    }
+                                                });
+                                    }
+                                }, new Listener0() {
+                                    public void onEvent() {
+                                        // onClose
+                                        deferredCommandWrapper.addCommand(new Listener0() {
+                                            public void onEvent() {
+                                                foldableContent.attach();
+                                                contextPropEditorProvider.get().detach();
+                                                contextNavigator.attach();
+                                                if (session.getCurrentStateToken().equals(stateToken)) {
+                                                    foldableContent.refreshState();
+                                                }
+                                            }
+                                        });
+                                    }
+                                });
+                            }
+                        });
+                    }
+                });
+        editContent.setTextDescription(i18n.tWithNT("Edit", "used in button"));
+        editContent.setIconUrl("images/content_edit.png");
+        editContent.setLeftSeparator(ActionToolbarButtonSeparator.spacer);
+        contentActionRegistry.addAction(editContent, registerInTypes);
+        return editContent;
+    }
+
+    protected ActionMenuItemDescriptor<StateToken> createGoAction(String... registerInTypes) {
+        ActionMenuItemDescriptor<StateToken> go = new ActionMenuItemDescriptor<StateToken>(AccessRolDTO.Viewer,
+                new Listener<StateToken>() {
+                    public void onEvent(final StateToken token) {
+                        stateManager.gotoToken(token);
+                    }
+                });
+        go.setMustBeAuthenticated(false);
+        go.setTextDescription(i18n.t("Open"));
+        go.setIconUrl("images/nav/go.png");
+        go.setEnableCondition(new ActionEnableCondition<StateToken>() {
+            public boolean mustBeEnabled(final StateToken itemToken) {
+                return !contextNavigator.isSelected(itemToken);
+            }
+        });
+        contextActionRegistry.addAction(go, registerInTypes);
+        return go;
+    }
+
+    protected ActionToolbarButtonDescriptor<StateToken> createGoHomeAction(String... registerInTypes) {
+        ActionToolbarButtonDescriptor<StateToken> goGroupHome = new ActionToolbarButtonDescriptor<StateToken>(
+                AccessRolDTO.Viewer, ActionToolbarPosition.topbar, new Listener<StateToken>() {
+                    public void onEvent(final StateToken token) {
+                        stateManager.gotoToken(token.getGroup());
+                    }
+                });
+        goGroupHome.setMustBeAuthenticated(false);
+        goGroupHome.setIconUrl("images/group-home.png");
+        goGroupHome.setEnableCondition(new ActionEnableCondition<StateToken>() {
+            public boolean mustBeEnabled(final StateToken itemToken) {
+                final StateToken defContentToken = session.getCurrentState().getGroup().getDefaultContent().getStateToken();
+                return !itemToken.equals(defContentToken);
+            }
+        });
+        goGroupHome.setLeftSeparator(ActionToolbarButtonSeparator.fill);
+        contextActionRegistry.addAction(goGroupHome, registerInTypes);
+        return goGroupHome;
+    }
+
     protected void createNewContainerAction(final String contentTypeId, final String iconUrl,
             final String textDescription, final String parentMenuTitle, final String parentMenuSubtitle,
             final String defaultName, Position position, String... registerInTypes) {
@@ -263,7 +353,8 @@
     protected void createPostSessionInitActions() {
     }
 
-    protected ActionToolbarMenuDescriptor<StateToken> createRefreshCntAction(String parentMenuTitle) {
+    protected ActionToolbarMenuDescriptor<StateToken> createRefreshCntAction(String parentMenuTitle,
+            String... registerInTypes) {
         final ActionToolbarMenuDescriptor<StateToken> refreshCnt = new ActionToolbarMenuDescriptor<StateToken>(
                 AccessRolDTO.Viewer, ActionToolbarPosition.topbar, new Listener<StateToken>() {
                     public void onEvent(final StateToken stateToken) {
@@ -275,10 +366,12 @@
         refreshCnt.setParentMenuTitle(parentMenuTitle);
         refreshCnt.setTextDescription(i18n.t("Refresh"));
         refreshCnt.setIconUrl("images/nav/refresh.png");
+        contentActionRegistry.addAction(refreshCnt, registerInTypes);
         return refreshCnt;
     }
 
-    protected ActionToolbarMenuDescriptor<StateToken> createRefreshCxtAction(String parentMenuTitleCtx) {
+    protected ActionToolbarMenuDescriptor<StateToken> createRefreshCxtAction(String parentMenuTitleCtx,
+            String... registerInTypes) {
         final ActionToolbarMenuDescriptor<StateToken> refreshCtx = new ActionToolbarMenuDescriptor<StateToken>(
                 AccessRolDTO.Viewer, ActionToolbarPosition.topbar, new Listener<StateToken>() {
                     public void onEvent(final StateToken stateToken) {
@@ -290,11 +383,12 @@
         refreshCtx.setParentMenuTitle(parentMenuTitleCtx);
         refreshCtx.setTextDescription(i18n.t("Refresh"));
         refreshCtx.setIconUrl("images/nav/refresh.png");
+        contextActionRegistry.addAction(refreshCtx, registerInTypes);
         return refreshCtx;
     }
 
     protected ActionToolbarMenuAndItemDescriptor<StateToken> createRenameContentInCtxAction(String parentMenuTitleCtx,
-            String textDescription) {
+            String textDescription, String... registerInTypes) {
         final ActionToolbarMenuAndItemDescriptor<StateToken> renameCtx = new ActionToolbarMenuAndItemDescriptor<StateToken>(
                 AccessRolDTO.Editor, ActionToolbarPosition.topbar, new Listener<StateToken>() {
                     public void onEvent(final StateToken stateToken) {
@@ -303,10 +397,12 @@
                 });
         renameCtx.setTextDescription(textDescription);
         renameCtx.setParentMenuTitle(parentMenuTitleCtx);
+        contextActionRegistry.addAction(renameCtx, registerInTypes);
         return renameCtx;
     }
 
-    protected ActionToolbarMenuDescriptor<StateToken> createSetAsDefContent(String parentMenuTitle) {
+    protected ActionToolbarMenuDescriptor<StateToken> createSetAsDefContent(String parentMenuTitle,
+            String... registerInTypes) {
         final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupContent;
         setAsDefGroupContent = new ActionToolbarMenuDescriptor<StateToken>(AccessRolDTO.Administrator,
                 ActionToolbarPosition.topbar, new Listener<StateToken>() {
@@ -331,6 +427,7 @@
             }
         });
         setAsDefGroupContent.setParentMenuTitle(parentMenuTitle);
+        contentActionRegistry.addAction(setAsDefGroupContent, registerInTypes);
         return setAsDefGroupContent;
     }
 
@@ -359,8 +456,23 @@
         return action;
     }
 
+    protected ActionToolbarButtonDescriptor<StateToken> createTranslateAction(String... registerInTypes) {
+        ActionToolbarButtonDescriptor<StateToken> translateContent = new ActionToolbarButtonDescriptor<StateToken>(
+                AccessRolDTO.Editor, ActionToolbarPosition.topbar, new Listener<StateToken>() {
+                    public void onEvent(final StateToken stateToken) {
+                        Site.important(i18n.t("Sorry, this functionality is currently in development"));
+                    }
+                });
+        translateContent.setTextDescription(i18n.tWithNT("Translate", "used in button"));
+        translateContent.setToolTip(i18n.t("Translate this document to other languages"));
+        translateContent.setIconUrl("images/language.gif");
+        translateContent.setLeftSeparator(ActionToolbarButtonSeparator.spacer);
+        contentActionRegistry.addAction(translateContent, registerInTypes);
+        return translateContent;
+    }
+
     protected ActionToolbarButtonAndItemDescriptor<StateToken> createUploadAction(final String textDescription,
-            final String iconUrl, final String toolTip, final String permitedExtensions) {
+            final String iconUrl, final String toolTip, final String permitedExtensions, String... registerInTypes) {
         final ActionToolbarButtonAndItemDescriptor<StateToken> uploadFile;
         uploadFile = new ActionToolbarButtonAndItemDescriptor<StateToken>(AccessRolDTO.Editor,
                 ActionToolbarPosition.bottombar, new Listener<StateToken>() {
@@ -378,119 +490,22 @@
         uploadFile.setTextDescription(textDescription);
         uploadFile.setIconUrl(iconUrl);
         uploadFile.setToolTip(toolTip);
+        contextActionRegistry.addAction(uploadFile, registerInTypes);
         return uploadFile;
     }
 
+    protected ActionToolbarButtonAndItemDescriptor<StateToken> createUploadMediaAction(String... registerInTypes) {
+        ActionToolbarButtonAndItemDescriptor<StateToken> uploadMedia = createUploadAction(i18n.t("Upload media"),
+                "images/nav/upload.png", i18n.t("Upload some media (images, videos)"),
+                session.getGalleryPermittedExtensions());
+        contextActionRegistry.addAction(uploadMedia, registerInTypes);
+        return uploadMedia;
+    }
+
     protected void downloadContent(final StateToken token) {
         fileDownloadProvider.get().downloadFile(token);
     }
 
-    private void createCommonActions() {
-        go = new ActionMenuItemDescriptor<StateToken>(AccessRolDTO.Viewer, new Listener<StateToken>() {
-            public void onEvent(final StateToken token) {
-                stateManager.gotoToken(token);
-            }
-        });
-        go.setMustBeAuthenticated(false);
-        go.setTextDescription(i18n.t("Open"));
-        go.setIconUrl("images/nav/go.png");
-        go.setEnableCondition(new ActionEnableCondition<StateToken>() {
-            public boolean mustBeEnabled(final StateToken itemToken) {
-                return !contextNavigator.isSelected(itemToken);
-            }
-        });
-
-        goGroupHome = new ActionToolbarButtonDescriptor<StateToken>(AccessRolDTO.Viewer, ActionToolbarPosition.topbar,
-                new Listener<StateToken>() {
-                    public void onEvent(final StateToken token) {
-                        stateManager.gotoToken(token.getGroup());
-                    }
-                });
-        goGroupHome.setMustBeAuthenticated(false);
-        goGroupHome.setIconUrl("images/group-home.png");
-        goGroupHome.setEnableCondition(new ActionEnableCondition<StateToken>() {
-            public boolean mustBeEnabled(final StateToken itemToken) {
-                final StateToken defContentToken = session.getCurrentState().getGroup().getDefaultContent().getStateToken();
-                return !itemToken.equals(defContentToken);
-            }
-        });
-        goGroupHome.setLeftSeparator(ActionToolbarButtonSeparator.fill);
-
-        translateContent = new ActionToolbarButtonDescriptor<StateToken>(AccessRolDTO.Editor,
-                ActionToolbarPosition.topbar, new Listener<StateToken>() {
-                    public void onEvent(final StateToken stateToken) {
-                        Site.important(i18n.t("Sorry, this functionality is currently in development"));
-                    }
-                });
-        translateContent.setTextDescription(i18n.tWithNT("Translate", "used in button"));
-        translateContent.setToolTip(i18n.t("Translate this document to other languages"));
-        translateContent.setIconUrl("images/language.gif");
-        translateContent.setLeftSeparator(ActionToolbarButtonSeparator.spacer);
-
-        editContent = new ActionToolbarButtonDescriptor<StateToken>(AccessRolDTO.Editor, ActionToolbarPosition.topbar,
-                new Listener<StateToken>() {
-                    public void onEvent(final StateToken stateToken) {
-                        session.check(new AsyncCallbackSimple<Object>() {
-                            public void onSuccess(final Object result) {
-                                final TextEditor editor = textEditorProvider.get();
-                                foldableContent.detach();
-                                contextNavigator.detach();
-                                contextPropEditorProvider.get().attach();
-                                editor.editContent(session.getContentState().getContent(), new Listener<String>() {
-                                    public void onEvent(final String html) {
-                                        Site.showProgressSaving();
-                                        contentServiceProvider.get().save(session.getUserHash(), stateToken, html,
-                                                new AsyncCallback<Object>() {
-                                                    public void onFailure(final Throwable caught) {
-                                                        Site.hideProgress();
-                                                        try {
-                                                            throw caught;
-                                                        } catch (final SessionExpiredException e) {
-                                                            errorHandler.doSessionExpired();
-                                                        } catch (final Throwable e) {
-                                                            Site.error(i18n.t("Error saving document. Retrying..."));
-                                                            errorHandler.process(caught);
-                                                            editor.onSaveFailed();
-                                                        }
-                                                    }
-
-                                                    public void onSuccess(Object param) {
-                                                        Site.hideProgress();
-                                                        session.getContentState().setContent(html);
-                                                        editor.onSaved();
-                                                    }
-                                                });
-                                    }
-                                }, new Listener0() {
-                                    public void onEvent() {
-                                        // onClose
-                                        deferredCommandWrapper.addCommand(new Listener0() {
-                                            public void onEvent() {
-                                                foldableContent.attach();
-                                                contextPropEditorProvider.get().detach();
-                                                contextNavigator.attach();
-                                                if (session.getCurrentStateToken().equals(stateToken)) {
-                                                    foldableContent.refreshState();
-                                                }
-                                            }
-                                        });
-                                    }
-                                });
-                            }
-                        });
-                    }
-                });
-        editContent.setTextDescription(i18n.tWithNT("Edit", "used in button"));
-        editContent.setIconUrl("images/content_edit.png");
-        editContent.setLeftSeparator(ActionToolbarButtonSeparator.spacer);
-
-    }
-
-    private void createCommonPostSessionInitActions() {
-        uploadMedia = createUploadAction(i18n.t("Upload media"), "images/nav/upload.png",
-                i18n.t("Upload some media (images, videos)"), session.getGalleryPermittedExtensions());
-    }
-
     /**
      * For future use contentActionRegistry.addAction(setGroupLogo,
      * TYPE_UPLOADEDFILE);
@@ -529,11 +544,12 @@
             String... registerInTypes) {
         switch (position) {
         case ctx:
-            contentActionRegistry.addAction(action, registerInTypes);
+            contextActionRegistry.addAction(action, registerInTypes);
             break;
         case cnt:
-            contextActionRegistry.addAction(action, registerInTypes);
+            contentActionRegistry.addAction(action, registerInTypes);
             break;
         }
     }
+
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/EntityLicensePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/EntityLicensePanel.java	2008-11-25 00:51:20 UTC (rev 967)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/EntityLicensePanel.java	2008-11-25 13:33:20 UTC (rev 968)
@@ -30,6 +30,9 @@
 import com.google.gwt.user.client.ui.Label;
 import com.google.gwt.user.client.ui.MouseListenerAdapter;
 import com.google.gwt.user.client.ui.Widget;
+import com.gwtext.client.core.Ext;
+import com.gwtext.client.core.Function;
+import com.gwtext.client.core.FxConfig;
 
 public class EntityLicensePanel implements EntityLicenseView {
     private final Label copyright;
@@ -48,11 +51,10 @@
         licenseLabel = new Label();
 
         licenseBar = new SimpleToolbar();
+        licenseBar.addSpacer();
+        licenseBar.add(licenseImage);
         licenseBar.add(copyright);
         licenseBar.add(licenseLabel);
-        licenseBar.addSpacer();
-        licenseBar.addSpacer();
-        licenseBar.add(licenseImage);
 
         final ClickListener clickListener = new ClickListener() {
             public void onClick(Widget arg0) {
@@ -68,15 +70,18 @@
         MouseListenerAdapter mouseListenerAdapter = new MouseListenerAdapter() {
             @Override
             public void onMouseEnter(Widget sender) {
-                copyright.setVisible(true);
-                licenseLabel.setVisible(true);
+                fade(true);
             }
 
             @Override
             public void onMouseLeave(Widget sender) {
+                fade(false);
             }
         };
+
         licenseImage.addMouseListener(mouseListenerAdapter);
+        copyright.addMouseListener(mouseListenerAdapter);
+        licenseLabel.addMouseListener(mouseListenerAdapter);
 
         copyright.addStyleName("kune-Margin-Large-l");
         licenseLabel.setStyleName("k-entitylicensepanel-licensetext");
@@ -102,8 +107,31 @@
     public void showLicense(final String groupName, final LicenseDTO licenseDTO) {
         copyright.setText(i18n.t("© [%s], under license: ", groupName));
         licenseLabel.setText(licenseDTO.getLongName());
-        copyright.setVisible(false);
-        licenseLabel.setVisible(false);
         licenseImage.setUrl(licenseDTO.getImageUrl());
+        fade(false);
     }
+
+    private void fade(final boolean in) {
+        if (copyright.isVisible() != in) {
+            FxConfig fxConfig = new FxConfig(2);
+            FxConfig fxConfigVisible = new FxConfig(2);
+            fxConfigVisible.setAfterStyle(new Function() {
+                public void execute() {
+                    setVisible(in);
+                }
+            });
+            if (in) {
+                Ext.get(copyright.getElement()).fadeIn(fxConfig);
+                Ext.get(licenseLabel.getElement()).fadeIn(fxConfigVisible);
+            } else {
+                Ext.get(copyright.getElement()).fadeOut(fxConfig);
+                Ext.get(licenseLabel.getElement()).fadeOut(fxConfigVisible);
+            }
+        }
+    }
+
+    private void setVisible(boolean visible) {
+        copyright.setVisible(visible);
+        licenseLabel.setVisible(visible);
+    }
 }




More information about the kune-commits mailing list