[kune-commits] r896 - in trunk/src:
main/java/org/ourproject/kune/chat/client
main/java/org/ourproject/kune/docs/client
main/java/org/ourproject/kune/docs/client/actions
main/java/org/ourproject/kune/platf/client/actions
main/java/org/ourproject/kune/platf/client/actions/toolbar
test/java/org/ourproject/kune/platf/client/actions
vjrj
vjrj at ourproject.org
Mon Sep 29 13:59:06 CEST 2008
Author: vjrj
Date: 2008-09-29 13:58:55 +0200 (Mon, 29 Sep 2008)
New Revision: 896
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonSeparator.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPosition.java
Removed:
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditInProgressAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentPublishAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentRejectAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSetStatusAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSubmitForPublishAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTranslationAction.java
trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTrashAction.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonSeparator.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollectionSet.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionPosition.java
Modified:
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java
trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java
Log:
Complete - task 75: ActionDescription cleanup
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,9 +1,9 @@
package org.ourproject.kune.chat.client;
import org.ourproject.kune.docs.client.DocumentClientTool;
-import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionButtonSeparator;
-import org.ourproject.kune.platf.client.actions.ActionPosition;
+import org.ourproject.kune.platf.client.actions.ActionToolbarButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionToolbarButtonSeparator;
+import org.ourproject.kune.platf.client.actions.ActionToolbarPosition;
import org.ourproject.kune.platf.client.actions.ContentActionRegistry;
import org.ourproject.kune.platf.client.actions.ContextActionRegistry;
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
@@ -30,8 +30,8 @@
}
private void createActions() {
- final ActionButtonDescriptor<StateToken> chatAbout = new ActionButtonDescriptor<StateToken>(
- AccessRolDTO.Viewer, ActionPosition.topbar, new Listener<StateToken>() {
+ final ActionToolbarButtonDescriptor<StateToken> chatAbout = new ActionToolbarButtonDescriptor<StateToken>(
+ AccessRolDTO.Viewer, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken token) {
chatClientToolProvider.get().getChat().joinRoom(token.toString().replaceAll("\\.", "-"),
session.getCurrentUserInfo().getShortName());
@@ -41,7 +41,7 @@
// chatAbout.setTextDescription(i18n.t("Chat about"));
chatAbout.setIconUrl("images/emite-room.png");
chatAbout.setToolTip("Chat and comment this");
- chatAbout.setLeftSeparator(ActionButtonSeparator.fill);
+ chatAbout.setLeftSeparator(ActionToolbarButtonSeparator.fill);
contentActionRegistry.addAction(chatAbout, DocumentClientTool.TYPE_DOCUMENT);
contentActionRegistry.addAction(chatAbout, DocumentClientTool.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-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -10,11 +10,13 @@
import static org.ourproject.kune.docs.client.DocumentClientTool.TYPE_WIKI;
import static org.ourproject.kune.docs.client.DocumentClientTool.TYPE_WIKIPAGE;
-import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionDescriptor;
import org.ourproject.kune.platf.client.actions.ActionEnableCondition;
-import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionPosition;
+import org.ourproject.kune.platf.client.actions.ActionMenuItemDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionToolbarButtonAndItemDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionToolbarButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionToolbarMenuAndItemDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionToolbarMenuDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionToolbarPosition;
import org.ourproject.kune.platf.client.actions.ContentActionRegistry;
import org.ourproject.kune.platf.client.actions.ContextActionRegistry;
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
@@ -75,16 +77,17 @@
}
private void createActions() {
- final ActionMenuDescriptor<StateToken> addFolder = createFolderAction(TYPE_FOLDER, "images/nav/folder_add.png",
- i18n.t("New folder"), i18n.t("Folder"), i18n.t("New"), i18n.t("New folder"));
- final ActionMenuDescriptor<StateToken> addGallery = createFolderAction(TYPE_GALLERY,
+ final ActionToolbarMenuAndItemDescriptor<StateToken> addFolder = createFolderAction(TYPE_FOLDER,
+ "images/nav/folder_add.png", i18n.t("New folder"), i18n.t("Folder"), i18n.t("New"), i18n
+ .t("New folder"));
+ final ActionToolbarMenuAndItemDescriptor<StateToken> addGallery = createFolderAction(TYPE_GALLERY,
"images/nav/gallery_add.png", i18n.t("New gallery"), i18n.t("Folder"), i18n.t("New"), i18n
.t("New gallery"));
- final ActionMenuDescriptor<StateToken> addWiki = createFolderAction(TYPE_WIKI, "images/nav/wiki_add.png", i18n
- .t("New wiki"), i18n.t("Folder"), i18n.t("New"), i18n.t("wiki"));
+ final ActionToolbarMenuAndItemDescriptor<StateToken> addWiki = createFolderAction(TYPE_WIKI,
+ "images/nav/wiki_add.png", i18n.t("New wiki"), i18n.t("Folder"), i18n.t("New"), i18n.t("wiki"));
- final ActionMenuDescriptor<StateToken> addDoc = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Editor,
- ActionPosition.topbarAndItemMenu, new Listener<StateToken>() {
+ final ActionToolbarMenuAndItemDescriptor<StateToken> addDoc = new ActionToolbarMenuAndItemDescriptor<StateToken>(
+ AccessRolDTO.Editor, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken token) {
Site.showProgressProcessing();
contentServiceProvider.get().addContent(session.getUserHash(),
@@ -102,8 +105,8 @@
addDoc.setParentSubMenuTitle(i18n.t("New"));
addDoc.setIconUrl("images/nav/page_add.png");
- final ActionMenuDescriptor<StateToken> delContainer = new ActionMenuDescriptor<StateToken>(
- AccessRolDTO.Administrator, ActionPosition.topbarAndItemMenu, new Listener<StateToken>() {
+ final ActionToolbarMenuAndItemDescriptor<StateToken> delContainer = new ActionToolbarMenuAndItemDescriptor<StateToken>(
+ AccessRolDTO.Administrator, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken token) {
Site.info("Sorry, in development");
}
@@ -114,8 +117,8 @@
delContainer.setConfirmationTitle(i18n.t("Please confirm"));
delContainer.setConfirmationText(i18n.t("You will delete it and also all its contents. Are you sure?"));
- final ActionMenuDescriptor<StateToken> delContent = new ActionMenuDescriptor<StateToken>(
- AccessRolDTO.Administrator, ActionPosition.topbarAndItemMenu, new Listener<StateToken>() {
+ final ActionToolbarMenuAndItemDescriptor<StateToken> delContent = new ActionToolbarMenuAndItemDescriptor<StateToken>(
+ AccessRolDTO.Administrator, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken token) {
contentServiceProvider.get().delContent(session.getUserHash(), token,
new AsyncCallbackSimple<String>() {
@@ -131,9 +134,16 @@
delContent.setMustBeConfirmed(true);
delContent.setConfirmationTitle(i18n.t("Please confirm"));
delContent.setConfirmationText(i18n.t("Are you sure?"));
+ delContent.setEnableCondition(new ActionEnableCondition<StateToken>() {
+ public boolean mustBeEnabled(final StateToken currentStateToken) {
+ final StateToken defContentToken = session.getCurrentState().getGroup().getDefaultContent()
+ .getStateToken();
+ return !currentStateToken.equals(defContentToken);
+ }
+ });
- final ActionDescriptor<StateToken> go = new ActionDescriptor<StateToken>(AccessRolDTO.Viewer,
- ActionPosition.itemMenu, new Listener<StateToken>() {
+ final ActionMenuItemDescriptor<StateToken> go = new ActionMenuItemDescriptor<StateToken>(AccessRolDTO.Viewer,
+ new Listener<StateToken>() {
public void onEvent(final StateToken token) {
stateManager.gotoToken(token);
}
@@ -146,8 +156,8 @@
}
});
- final ActionMenuDescriptor<StateToken> renameCtn = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Editor,
- ActionPosition.topbarAndItemMenu, new Listener<StateToken>() {
+ final ActionToolbarMenuAndItemDescriptor<StateToken> renameCtn = new ActionToolbarMenuAndItemDescriptor<StateToken>(
+ AccessRolDTO.Editor, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken stateToken) {
contextNavigator.editItem(stateToken);
}
@@ -155,8 +165,8 @@
renameCtn.setTextDescription(i18n.t("Rename"));
renameCtn.setParentMenuTitle(i18n.t("File"));
- final ActionMenuDescriptor<StateToken> renameCtx = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Editor,
- ActionPosition.topbarAndItemMenu, new Listener<StateToken>() {
+ final ActionToolbarMenuAndItemDescriptor<StateToken> renameCtx = new ActionToolbarMenuAndItemDescriptor<StateToken>(
+ AccessRolDTO.Editor, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken stateToken) {
contextNavigator.editItem(stateToken);
}
@@ -164,8 +174,8 @@
renameCtx.setTextDescription(i18n.t("Rename"));
renameCtx.setParentMenuTitle(i18n.t("Folder"));
- final ActionButtonDescriptor<StateToken> goGroupHome = new ActionButtonDescriptor<StateToken>(
- AccessRolDTO.Viewer, ActionPosition.topbar, new Listener<StateToken>() {
+ final ActionToolbarButtonDescriptor<StateToken> goGroupHome = new ActionToolbarButtonDescriptor<StateToken>(
+ AccessRolDTO.Viewer, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken token) {
stateManager.gotoToken(token.getGroup());
}
@@ -179,32 +189,16 @@
}
});
- final ActionMenuDescriptor<StateToken> setAsDefGroupContent = new ActionMenuDescriptor<StateToken>(
- AccessRolDTO.Administrator, ActionPosition.itemMenu, new Listener<StateToken>() {
- public void onEvent(final StateToken token) {
- Site.showProgressProcessing();
- contentServiceProvider.get().setAsDefaultContent(session.getUserHash(), token,
- new AsyncCallbackSimple<ContentSimpleDTO>() {
- public void onSuccess(final ContentSimpleDTO defContent) {
- session.getCurrentState().getGroup().setDefaultContent(defContent);
- Site.hideProgress();
- Site.info(i18n.t("Document selected as the group homepage"));
- }
- });
- }
- });
- setAsDefGroupContent.setTextDescription(i18n.t("Set this as the group default page"));
- setAsDefGroupContent.setIconUrl("images/group-home.png");
- setAsDefGroupContent.setEnableCondition(new ActionEnableCondition<StateToken>() {
- public boolean mustBeEnabled(final StateToken currentStateToken) {
- final StateToken defContentToken = session.getCurrentState().getGroup().getDefaultContent()
- .getStateToken();
- return !contextNavigator.isSelected(defContentToken);
- }
- });
+ final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupCnt;
+ setAsDefGroupCnt = createSetAsDefContent();
+ setAsDefGroupCnt.setParentMenuTitle(i18n.t("File"));
- final ActionMenuDescriptor<StateToken> refreshCtx = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Viewer,
- ActionPosition.topbar, new Listener<StateToken>() {
+ final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupCxt;
+ setAsDefGroupCxt = createSetAsDefContent();
+ setAsDefGroupCxt.setParentMenuTitle(i18n.t("Folder"));
+
+ final ActionToolbarMenuDescriptor<StateToken> refreshCtx = new ActionToolbarMenuDescriptor<StateToken>(
+ AccessRolDTO.Viewer, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken stateToken) {
stateManager.reload();
contextNavigator.selectItem(stateToken);
@@ -214,8 +208,8 @@
refreshCtx.setTextDescription(i18n.t("Refresh"));
refreshCtx.setIconUrl("images/nav/refresh.png");
- final ActionMenuDescriptor<StateToken> refreshCnt = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Viewer,
- ActionPosition.topbar, new Listener<StateToken>() {
+ final ActionToolbarMenuDescriptor<StateToken> refreshCnt = new ActionToolbarMenuDescriptor<StateToken>(
+ AccessRolDTO.Viewer, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken stateToken) {
stateManager.reload();
contextNavigator.selectItem(stateToken);
@@ -225,20 +219,20 @@
refreshCnt.setTextDescription(i18n.t("Refresh"));
refreshCnt.setIconUrl("images/nav/refresh.png");
- final ActionDescriptor<StateToken> uploadFile = createUploadAction(i18n.t("Upload file"),
+ final ActionToolbarButtonAndItemDescriptor<StateToken> uploadFile = createUploadAction(i18n.t("Upload file"),
"images/nav/upload.png", i18n.t("Upload some files (images, PDFs, ...)"), null);
session.onInitDataReceived(new Listener<InitDataDTO>() {
public void onEvent(final InitDataDTO parameter) {
- final ActionDescriptor<StateToken> uploadMedia = createUploadAction(i18n.t("Upload media"),
- "images/nav/upload.png", i18n.t("Upload some media (images, videos)"), session
- .getGalleryPermittedExtensions());
+ final ActionToolbarButtonAndItemDescriptor<StateToken> uploadMedia = createUploadAction(i18n
+ .t("Upload media"), "images/nav/upload.png", i18n.t("Upload some media (images, videos)"),
+ session.getGalleryPermittedExtensions());
contextActionRegistry.addAction(uploadMedia, TYPE_GALLERY);
}
});
- final ActionButtonDescriptor<StateToken> download = new ActionButtonDescriptor<StateToken>(AccessRolDTO.Viewer,
- ActionPosition.topbar, new Listener<StateToken>() {
+ final ActionToolbarButtonDescriptor<StateToken> download = new ActionToolbarButtonDescriptor<StateToken>(
+ AccessRolDTO.Viewer, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken token) {
downloadContent(token);
}
@@ -247,8 +241,8 @@
download.setToolTip(i18n.t("Download this file"));
download.setIconUrl("images/nav/download.png");
- final ActionDescriptor<StateToken> downloadCtx = new ActionDescriptor<StateToken>(AccessRolDTO.Viewer,
- ActionPosition.itemMenu, new Listener<StateToken>() {
+ final ActionMenuItemDescriptor<StateToken> downloadCtx = new ActionMenuItemDescriptor<StateToken>(
+ AccessRolDTO.Viewer, new Listener<StateToken>() {
public void onEvent(final StateToken token) {
downloadContent(token);
}
@@ -256,8 +250,8 @@
downloadCtx.setTextDescription(i18n.t("Download"));
downloadCtx.setIconUrl("images/nav/download.png");
- final ActionMenuDescriptor<StateToken> setGroupLogo = new ActionMenuDescriptor<StateToken>(
- AccessRolDTO.Administrator, ActionPosition.topbarAndItemMenu, new Listener<StateToken>() {
+ final ActionToolbarMenuAndItemDescriptor<StateToken> setGroupLogo = new ActionToolbarMenuAndItemDescriptor<StateToken>(
+ AccessRolDTO.Administrator, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken token) {
groupServiceProvider.get().setGroupLogo(session.getUserHash(), token,
new AsyncCallbackSimple<GroupDTO>() {
@@ -282,19 +276,19 @@
}
});
- final ActionMenuDescriptor<StateToken> setPublishStatus = createSetStatusAction(AccessRolDTO.Administrator,
- i18n.t("Published online"), ContentStatusDTO.publishedOnline);
- final ActionMenuDescriptor<StateToken> setEditionInProgressStatus = createSetStatusAction(
+ final ActionToolbarMenuDescriptor<StateToken> setPublishStatus = createSetStatusAction(
+ AccessRolDTO.Administrator, i18n.t("Published online"), ContentStatusDTO.publishedOnline);
+ final ActionToolbarMenuDescriptor<StateToken> setEditionInProgressStatus = createSetStatusAction(
AccessRolDTO.Administrator, i18n.t("Editing in progress"), ContentStatusDTO.editingInProgress);
- final ActionMenuDescriptor<StateToken> setRejectStatus = createSetStatusAction(AccessRolDTO.Administrator, i18n
- .t("Rejected"), ContentStatusDTO.rejected);
- final ActionMenuDescriptor<StateToken> setSubmittedForPublishStatus = createSetStatusAction(
+ final ActionToolbarMenuDescriptor<StateToken> setRejectStatus = createSetStatusAction(
+ AccessRolDTO.Administrator, i18n.t("Rejected"), ContentStatusDTO.rejected);
+ final ActionToolbarMenuDescriptor<StateToken> setSubmittedForPublishStatus = createSetStatusAction(
AccessRolDTO.Administrator, i18n.t("Submitted for publish"), ContentStatusDTO.publishedOnline);
- final ActionMenuDescriptor<StateToken> setInTheDustBinStatus = createSetStatusAction(
+ final ActionToolbarMenuDescriptor<StateToken> setInTheDustBinStatus = createSetStatusAction(
AccessRolDTO.Administrator, i18n.t("In the dustbin"), ContentStatusDTO.inTheDustbin);
- final ActionButtonDescriptor<StateToken> translateContent = new ActionButtonDescriptor<StateToken>(
- AccessRolDTO.Editor, ActionPosition.topbar, new Listener<StateToken>() {
+ final 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"));
}
@@ -303,8 +297,8 @@
translateContent.setToolTip(i18n.t("Translate this document to other languages"));
translateContent.setIconUrl("images/language.gif");
- final ActionButtonDescriptor<StateToken> editContent = new ActionButtonDescriptor<StateToken>(
- AccessRolDTO.Editor, ActionPosition.topbar, new Listener<StateToken>() {
+ final ActionToolbarButtonDescriptor<StateToken> editContent = new ActionToolbarButtonDescriptor<StateToken>(
+ AccessRolDTO.Editor, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken stateToken) {
}
});
@@ -336,7 +330,8 @@
contentActionRegistry.addAction(refreshCnt, contents);
contentActionRegistry.addAction(delContent, contents);
contextActionRegistry.addAction(delContainer, containersNoRoot);
- contextActionRegistry.addAction(setAsDefGroupContent, TYPE_BLOG, TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
+ contentActionRegistry.addAction(setAsDefGroupCnt, TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
+ contentActionRegistry.addAction(setAsDefGroupCxt, TYPE_BLOG);
contextActionRegistry.addAction(goGroupHome, containers);
contentActionRegistry.addAction(setGroupLogo, TYPE_UPLOADEDFILE);
contextActionRegistry.addAction(downloadCtx, TYPE_UPLOADEDFILE);
@@ -345,12 +340,12 @@
TYPE_WIKI, TYPE_WIKIPAGE);
}
- private ActionMenuDescriptor<StateToken> createFolderAction(final String contentTypeId, final String iconUrl,
- final String textDescription, final String parentMenuTitle, final String parentMenuSubtitle,
- final String defaultName) {
- final ActionMenuDescriptor<StateToken> addFolder;
- addFolder = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Editor, ActionPosition.topbarAndItemMenu,
- new Listener<StateToken>() {
+ private ActionToolbarMenuAndItemDescriptor<StateToken> createFolderAction(final String contentTypeId,
+ final String iconUrl, final String textDescription, final String parentMenuTitle,
+ final String parentMenuSubtitle, final String defaultName) {
+ final ActionToolbarMenuAndItemDescriptor<StateToken> addFolder;
+ addFolder = new ActionToolbarMenuAndItemDescriptor<StateToken>(AccessRolDTO.Editor,
+ ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken stateToken) {
Site.showProgressProcessing();
contentServiceProvider.get().addFolder(session.getUserHash(), stateToken, defaultName,
@@ -369,10 +364,38 @@
return addFolder;
}
- private ActionMenuDescriptor<StateToken> createSetStatusAction(final AccessRolDTO rol,
+ private ActionToolbarMenuDescriptor<StateToken> createSetAsDefContent() {
+ final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupContent;
+ setAsDefGroupContent = new ActionToolbarMenuDescriptor<StateToken>(AccessRolDTO.Administrator,
+ ActionToolbarPosition.topbar, new Listener<StateToken>() {
+ public void onEvent(final StateToken token) {
+ Site.showProgressProcessing();
+ contentServiceProvider.get().setAsDefaultContent(session.getUserHash(), token,
+ new AsyncCallbackSimple<ContentSimpleDTO>() {
+ public void onSuccess(final ContentSimpleDTO defContent) {
+ session.getCurrentState().getGroup().setDefaultContent(defContent);
+ Site.hideProgress();
+ Site.info(i18n.t("Document selected as the group homepage"));
+ }
+ });
+ }
+ });
+ setAsDefGroupContent.setTextDescription(i18n.t("Set this as the group default page"));
+ setAsDefGroupContent.setIconUrl("images/group-home.png");
+ setAsDefGroupContent.setEnableCondition(new ActionEnableCondition<StateToken>() {
+ public boolean mustBeEnabled(final StateToken currentStateToken) {
+ final StateToken defContentToken = session.getCurrentState().getGroup().getDefaultContent()
+ .getStateToken();
+ return !currentStateToken.equals(defContentToken);
+ }
+ });
+ return setAsDefGroupContent;
+ }
+
+ private ActionToolbarMenuAndItemDescriptor<StateToken> createSetStatusAction(final AccessRolDTO rol,
final String textDescription, final ContentStatusDTO status) {
- final ActionMenuDescriptor<StateToken> action = new ActionMenuDescriptor<StateToken>(rol,
- ActionPosition.topbarAndItemMenu, new Listener<StateToken>() {
+ final ActionToolbarMenuAndItemDescriptor<StateToken> action = new ActionToolbarMenuAndItemDescriptor<StateToken>(
+ rol, ActionToolbarPosition.topbar, new Listener<StateToken>() {
public void onEvent(final StateToken stateToken) {
final AsyncCallbackSimple<Object> callback = new AsyncCallbackSimple<Object>() {
public void onSuccess(final Object result) {
@@ -393,15 +416,17 @@
return action;
}
- private ActionButtonDescriptor<StateToken> createUploadAction(final String textDescription, final String iconUrl,
- final String toolTip, final String permitedExtensions) {
- final ActionButtonDescriptor<StateToken> uploadFile;
- uploadFile = new ActionButtonDescriptor<StateToken>(AccessRolDTO.Editor, ActionPosition.bootombarAndItemMenu,
- new Listener<StateToken>() {
+ private ActionToolbarButtonAndItemDescriptor<StateToken> createUploadAction(final String textDescription,
+ final String iconUrl, final String toolTip, final String permitedExtensions) {
+ final ActionToolbarButtonAndItemDescriptor<StateToken> uploadFile;
+ uploadFile = new ActionToolbarButtonAndItemDescriptor<StateToken>(AccessRolDTO.Editor,
+ ActionToolbarPosition.bottombar, new Listener<StateToken>() {
public void onEvent(final StateToken token) {
if (permitedExtensions != null) {
+ // FIXME: can't be reset ...
// fileUploaderProvider.get().setPermittedExtensions(permitedExtensions);
} else {
+ // FIXME: can't be reset ...
// fileUploaderProvider.get().resetPermittedExtensions();
}
fileUploaderProvider.get().show();
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditAction.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditAction.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,21 +0,0 @@
-package org.ourproject.kune.docs.client.actions;
-
-import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionPosition;
-import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-
-import com.calclab.suco.client.listener.Listener;
-
-public class ContentEditAction extends ActionButtonDescriptor<StateToken> {
-
- public ContentEditAction(final I18nUITranslationService i18n) {
- super(AccessRolDTO.Editor, ActionPosition.topbar, new Listener<StateToken>() {
- public void onEvent(final StateToken stateToken) {
- }
- });
- this.setTextDescription(i18n.tWithNT("Edit", "used in button"));
- // this.setIconUrl("images/");
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditInProgressAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditInProgressAction.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentEditInProgressAction.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,20 +0,0 @@
-/**
- *
- */
-package org.ourproject.kune.docs.client.actions;
-
-import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-
-import com.calclab.suco.client.ioc.Provider;
-
-public class ContentEditInProgressAction extends ContentSetStatusAction {
- public ContentEditInProgressAction(final Session session, final Provider<ContentServiceAsync> provider,
- final I18nUITranslationService i18n) {
- super(session, provider, i18n, AccessRolDTO.Administrator, i18n.t("Editing in progress"),
- ContentStatusDTO.editingInProgress);
- }
-}
\ No newline at end of file
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentPublishAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentPublishAction.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentPublishAction.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,20 +0,0 @@
-/**
- *
- */
-package org.ourproject.kune.docs.client.actions;
-
-import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-
-import com.calclab.suco.client.ioc.Provider;
-
-public class ContentPublishAction extends ContentSetStatusAction {
- public ContentPublishAction(final Session session, final Provider<ContentServiceAsync> provider,
- final I18nUITranslationService i18n) {
- super(session, provider, i18n, AccessRolDTO.Administrator, i18n.t("Published online"),
- ContentStatusDTO.publishedOnline);
- }
-}
\ No newline at end of file
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentRejectAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentRejectAction.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentRejectAction.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,19 +0,0 @@
-/**
- *
- */
-package org.ourproject.kune.docs.client.actions;
-
-import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-
-import com.calclab.suco.client.ioc.Provider;
-
-public class ContentRejectAction extends ContentSetStatusAction {
- public ContentRejectAction(final Session session, final Provider<ContentServiceAsync> provider,
- final I18nUITranslationService i18n) {
- super(session, provider, i18n, AccessRolDTO.Administrator, i18n.t("Rejected"), ContentStatusDTO.rejected);
- }
-}
\ No newline at end of file
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSetStatusAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSetStatusAction.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSetStatusAction.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,39 +0,0 @@
-package org.ourproject.kune.docs.client.actions;
-
-import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionPosition;
-import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-
-import com.calclab.suco.client.ioc.Provider;
-import com.calclab.suco.client.listener.Listener;
-
-public abstract class ContentSetStatusAction extends ActionMenuDescriptor<StateToken> {
-
- public ContentSetStatusAction(final Session session, final Provider<ContentServiceAsync> contentServiceProvider,
- final I18nUITranslationService i18n, final AccessRolDTO rol, final String textDescription,
- final ContentStatusDTO status) {
- super(rol, ActionPosition.topbarAndItemMenu, new Listener<StateToken>() {
- public void onEvent(final StateToken stateToken) {
- final AsyncCallbackSimple<Object> callback = new AsyncCallbackSimple<Object>() {
- public void onSuccess(final Object result) {
- session.getCurrentState().setStatus(status);
- }
- };
- if (status.equals(ContentStatusDTO.publishedOnline) || status.equals(ContentStatusDTO.rejected)) {
- contentServiceProvider.get().setStatusAsAdmin(session.getUserHash(), stateToken, status, callback);
- } else {
- contentServiceProvider.get().setStatus(session.getUserHash(), stateToken, status, callback);
- }
- }
- });
- this.setTextDescription(textDescription);
- this.setParentMenuTitle(i18n.t("File"));
- this.setParentSubMenuTitle(i18n.t("Change the status"));
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSubmitForPublishAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSubmitForPublishAction.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentSubmitForPublishAction.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,20 +0,0 @@
-/**
- *
- */
-package org.ourproject.kune.docs.client.actions;
-
-import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-
-import com.calclab.suco.client.ioc.Provider;
-
-public class ContentSubmitForPublishAction extends ContentSetStatusAction {
- public ContentSubmitForPublishAction(final Session session, final Provider<ContentServiceAsync> provider,
- final I18nUITranslationService i18n) {
- super(session, provider, i18n, AccessRolDTO.Administrator, i18n.t("Submitted for publish"),
- ContentStatusDTO.publishedOnline);
- }
-}
\ No newline at end of file
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTranslationAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTranslationAction.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTranslationAction.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,24 +0,0 @@
-package org.ourproject.kune.docs.client.actions;
-
-import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionPosition;
-import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-import org.ourproject.kune.workspace.client.site.Site;
-
-import com.calclab.suco.client.listener.Listener;
-
-public class ContentTranslationAction extends ActionButtonDescriptor<StateToken> {
-
- public ContentTranslationAction(final I18nUITranslationService i18n) {
- super(AccessRolDTO.Editor, ActionPosition.topbar, new Listener<StateToken>() {
- public void onEvent(final StateToken stateToken) {
- Site.important(i18n.t("Sorry, this functionality is currently in development"));
- }
- });
- this.setTextDescription(i18n.tWithNT("Translate", "used in button"));
- this.setToolTip(i18n.t("Translate this document to other languages"));
- // this.setIconUrl("images/");
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTrashAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTrashAction.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/ContentTrashAction.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,20 +0,0 @@
-/**
- *
- */
-package org.ourproject.kune.docs.client.actions;
-
-import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import org.ourproject.kune.platf.client.dto.ContentStatusDTO;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-
-import com.calclab.suco.client.ioc.Provider;
-
-public class ContentTrashAction extends ContentSetStatusAction {
- public ContentTrashAction(final Session session, final Provider<ContentServiceAsync> provider,
- final I18nUITranslationService i18n) {
- super(session, provider, i18n, AccessRolDTO.Administrator, i18n.t("In the dustbin"),
- ContentStatusDTO.inTheDustbin);
- }
-}
\ No newline at end of file
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonDescriptor.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonDescriptor.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,40 +0,0 @@
-package org.ourproject.kune.platf.client.actions;
-
-import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-
-import com.calclab.suco.client.listener.Listener;
-
-public class ActionButtonDescriptor<T> extends ActionDescriptor<T> {
-
- private ActionButtonSeparator leftSeparator;
- private ActionButtonSeparator rightSeparator;
-
- public ActionButtonDescriptor(final AccessRolDTO accessRolDTO, final ActionPosition actionPosition,
- final Listener<T> onPerformCall) {
- super(accessRolDTO, actionPosition, onPerformCall);
- }
-
- public ActionButtonSeparator getLeftSeparator() {
- return leftSeparator;
- }
-
- public ActionButtonSeparator getRightSeparator() {
- return rightSeparator;
- }
-
- public boolean hasLeftSeparator() {
- return leftSeparator != null;
- }
-
- public boolean hasRightSeparator() {
- return rightSeparator != null;
- }
-
- public void setLeftSeparator(final ActionButtonSeparator leftSeparator) {
- this.leftSeparator = leftSeparator;
- }
-
- public void setRightSeparator(final ActionButtonSeparator rightSeparator) {
- this.rightSeparator = rightSeparator;
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonSeparator.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonSeparator.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonSeparator.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,5 +0,0 @@
-package org.ourproject.kune.platf.client.actions;
-
-public enum ActionButtonSeparator {
- spacer, separator, fill
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollectionSet.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollectionSet.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollectionSet.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,21 +0,0 @@
-package org.ourproject.kune.platf.client.actions;
-
-
-public class ActionCollectionSet<T> {
-
- private final ActionCollection<T> toolbarActions;
- private final ActionCollection<T> itemActions;
-
- public ActionCollectionSet() {
- toolbarActions = new ActionCollection<T>();
- itemActions = new ActionCollection<T>();
- }
-
- public ActionCollection<T> getItemActions() {
- return itemActions;
- }
-
- public ActionCollection<T> getToolbarActions() {
- return toolbarActions;
- }
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -5,7 +5,7 @@
import com.calclab.suco.client.listener.Listener;
-public class ActionDescriptor<T> {
+public abstract class ActionDescriptor<T> {
private String iconUrl;
private ImageDescriptor iconDescriptor;
@@ -21,25 +21,21 @@
private AccessRolDTO accessRol;
- private ActionPosition actionPosition;
-
private ActionEnableCondition<T> enableCondition;
- public ActionDescriptor(final AccessRolDTO accessRolDTO, final ActionPosition actionPosition,
- final Listener<T> onPerformCall) {
+ public ActionDescriptor(final AccessRolDTO accessRolDTO, final Listener<T> onPerformCall,
+ final ActionEnableCondition<T> enableCondition) {
+ this(accessRolDTO, onPerformCall);
+ this.enableCondition = enableCondition;
+ }
+
+ public ActionDescriptor(final AccessRolDTO accessRolDTO, final Listener<T> onPerformCall) {
accessRol = accessRolDTO;
- this.actionPosition = actionPosition;
this.onPerformCall = onPerformCall;
mustBeConfirmed = false;
onNotConfirmed = null;
}
- public ActionDescriptor(final AccessRolDTO accessRolDTO, final ActionPosition actionPosition,
- final Listener<T> onPerformCall, final ActionEnableCondition<T> enableCondition) {
- this(accessRolDTO, actionPosition, onPerformCall);
- this.enableCondition = enableCondition;
- }
-
@SuppressWarnings("unchecked")
public void fireOnNotConfirmed(final Object parameter) {
if (onNotConfirmed != null) {
@@ -56,10 +52,6 @@
return accessRol;
}
- public ActionPosition getActionPosition() {
- return actionPosition;
- }
-
public String getConfirmationText() {
return confirmationText;
}
@@ -96,10 +88,6 @@
this.accessRol = accessRol;
}
- public void setActionPosition(final ActionPosition actionPosition) {
- this.actionPosition = actionPosition;
- }
-
public void setConfirmationText(final String confirmationText) {
this.confirmationText = confirmationText;
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuDescriptor.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuDescriptor.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,45 +0,0 @@
-package org.ourproject.kune.platf.client.actions;
-
-import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-
-import com.allen_sauer.gwt.log.client.Log;
-import com.calclab.suco.client.listener.Listener;
-
-public class ActionMenuDescriptor<T> extends ActionDescriptor<T> {
-
- private String parentMenuTitle;
- private String parentMenuIconUrl;
- private String parentSubMenuTitle;
-
- public ActionMenuDescriptor(final AccessRolDTO accessRolDTO, final ActionPosition actionPosition,
- final Listener<T> onPerformCall) {
- super(accessRolDTO, actionPosition, onPerformCall);
- }
-
- public String getParentMenuIconUrl() {
- return parentMenuIconUrl;
- }
-
- public String getParentMenuTitle() {
- return parentMenuTitle;
- }
-
- public String getParentSubMenuTitle() {
- return parentSubMenuTitle;
- }
-
- public void setParentMenuIconUrl(final String parentMenuIconUrl) {
- this.parentMenuIconUrl = parentMenuIconUrl;
- }
-
- public void setParentMenuTitle(final String parentMenuTitle) {
- this.parentMenuTitle = parentMenuTitle;
- }
-
- public void setParentSubMenuTitle(final String parentSubMenuTitle) {
- if (parentMenuTitle == null) {
- Log.warn("Please set parentMenuTitle before");
- }
- this.parentSubMenuTitle = parentSubMenuTitle;
- }
-}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -0,0 +1,18 @@
+package org.ourproject.kune.platf.client.actions;
+
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+
+import com.calclab.suco.client.listener.Listener;
+
+public class ActionMenuItemDescriptor<T> extends ActionDescriptor<T> {
+
+ public ActionMenuItemDescriptor(final AccessRolDTO accessRolDTO, final Listener<T> onPerformCall) {
+ super(accessRolDTO, onPerformCall);
+ }
+
+ public ActionMenuItemDescriptor(final AccessRolDTO accessRolDTO, final Listener<T> onPerformCall,
+ final ActionEnableCondition<T> enableCondition) {
+ super(accessRolDTO, onPerformCall, enableCondition);
+ }
+
+}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionPosition.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionPosition.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionPosition.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,5 +0,0 @@
-package org.ourproject.kune.platf.client.actions;
-
-public enum ActionPosition {
- topbar, bottombar, itemMenu, topbarAndItemMenu, bootombarAndItemMenu
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -31,21 +31,13 @@
for (final ActionDescriptor<T> action : getActions(contentTypeId)) {
if (mustAdd(rights, action)) {
if (toolbarItems) {
- switch (action.getActionPosition()) {
- case topbarAndItemMenu:
- case topbar:
- case bootombarAndItemMenu:
- case bottombar:
+ if (action instanceof ActionToolbarButtonDescriptor<?> || action instanceof ActionToolbarMenuDescriptor<?>) {
collection.add(new ActionItem<T>(action, item));
- break;
}
} else {
- switch (action.getActionPosition()) {
- case itemMenu:
- case topbarAndItemMenu:
- case bootombarAndItemMenu:
+ if (action instanceof ActionMenuItemDescriptor<?> || action instanceof ActionToolbarMenuAndItemDescriptor<?>
+ || action instanceof ActionToolbarButtonAndItemDescriptor<?>) {
collection.add(new ActionItem<T>(action, item));
- break;
}
}
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -0,0 +1,19 @@
+package org.ourproject.kune.platf.client.actions;
+
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+
+import com.calclab.suco.client.listener.Listener;
+
+public class ActionToolbarButtonAndItemDescriptor<T> extends ActionToolbarButtonDescriptor<T> {
+
+ public ActionToolbarButtonAndItemDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition,
+ final Listener<T> onPerformCall) {
+ super(accessRolDTO, actionToolbarPosition, onPerformCall);
+ }
+
+ public ActionToolbarButtonAndItemDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition,
+ final Listener<T> onPerformCall, final ActionEnableCondition<T> enableCondition) {
+ super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
+ }
+
+}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java (from rev 890, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonDescriptor.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonDescriptor.java 2008-09-27 20:03:56 UTC (rev 890)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -0,0 +1,45 @@
+package org.ourproject.kune.platf.client.actions;
+
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+
+import com.calclab.suco.client.listener.Listener;
+
+public class ActionToolbarButtonDescriptor<T> extends ActionToolbarDescriptor<T> {
+
+ private ActionToolbarButtonSeparator leftSeparator;
+ private ActionToolbarButtonSeparator rightSeparator;
+
+ public ActionToolbarButtonDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition,
+ final Listener<T> onPerformCall) {
+ super(accessRolDTO, actionToolbarPosition, onPerformCall);
+ }
+
+ public ActionToolbarButtonDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition,
+ final Listener<T> onPerformCall, final ActionEnableCondition<T> enableCondition) {
+ super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
+ }
+
+ public ActionToolbarButtonSeparator getLeftSeparator() {
+ return leftSeparator;
+ }
+
+ public ActionToolbarButtonSeparator getRightSeparator() {
+ return rightSeparator;
+ }
+
+ public boolean hasLeftSeparator() {
+ return leftSeparator != null;
+ }
+
+ public boolean hasRightSeparator() {
+ return rightSeparator != null;
+ }
+
+ public void setLeftSeparator(final ActionToolbarButtonSeparator leftSeparator) {
+ this.leftSeparator = leftSeparator;
+ }
+
+ public void setRightSeparator(final ActionToolbarButtonSeparator rightSeparator) {
+ this.rightSeparator = rightSeparator;
+ }
+}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonSeparator.java (from rev 890, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonSeparator.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionButtonSeparator.java 2008-09-27 20:03:56 UTC (rev 890)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonSeparator.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -0,0 +1,5 @@
+package org.ourproject.kune.platf.client.actions;
+
+public enum ActionToolbarButtonSeparator {
+ spacer, separator, fill
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -0,0 +1,31 @@
+package org.ourproject.kune.platf.client.actions;
+
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+
+import com.calclab.suco.client.listener.Listener;
+
+public abstract class ActionToolbarDescriptor<T> extends ActionDescriptor<T> {
+
+ private ActionToolbarPosition actionToolbarPosition;
+
+ public ActionToolbarDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition,
+ final Listener<T> onPerformCall) {
+ super(accessRolDTO, onPerformCall);
+ this.actionToolbarPosition = actionToolbarPosition;
+ }
+
+ public ActionToolbarDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition,
+ final Listener<T> onPerformCall, final ActionEnableCondition<T> enableCondition) {
+ super(accessRolDTO, onPerformCall, enableCondition);
+ this.actionToolbarPosition = actionToolbarPosition;
+ }
+
+ public ActionToolbarPosition getActionPosition() {
+ return actionToolbarPosition;
+ }
+
+ public void setActionPosition(final ActionToolbarPosition actionToolbarPosition) {
+ this.actionToolbarPosition = actionToolbarPosition;
+ }
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -0,0 +1,19 @@
+package org.ourproject.kune.platf.client.actions;
+
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+
+import com.calclab.suco.client.listener.Listener;
+
+public class ActionToolbarMenuAndItemDescriptor<T> extends ActionToolbarMenuDescriptor<T> {
+
+ public ActionToolbarMenuAndItemDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition,
+ final Listener<T> onPerformCall) {
+ super(accessRolDTO, actionToolbarPosition, onPerformCall);
+ }
+
+ public ActionToolbarMenuAndItemDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition,
+ final Listener<T> onPerformCall, final ActionEnableCondition<T> enableCondition) {
+ super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
+ }
+
+}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java (from rev 890, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuDescriptor.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuDescriptor.java 2008-09-27 20:03:56 UTC (rev 890)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -0,0 +1,50 @@
+package org.ourproject.kune.platf.client.actions;
+
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.calclab.suco.client.listener.Listener;
+
+public class ActionToolbarMenuDescriptor<T> extends ActionToolbarDescriptor<T> {
+
+ private String parentMenuTitle;
+ private String parentMenuIconUrl;
+ private String parentSubMenuTitle;
+
+ public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition,
+ final Listener<T> onPerformCall) {
+ super(accessRolDTO, actionToolbarPosition, onPerformCall);
+ }
+
+ public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition,
+ final Listener<T> onPerformCall, final ActionEnableCondition<T> enableCondition) {
+ super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
+ }
+
+ public String getParentMenuIconUrl() {
+ return parentMenuIconUrl;
+ }
+
+ public String getParentMenuTitle() {
+ return parentMenuTitle;
+ }
+
+ public String getParentSubMenuTitle() {
+ return parentSubMenuTitle;
+ }
+
+ public void setParentMenuIconUrl(final String parentMenuIconUrl) {
+ this.parentMenuIconUrl = parentMenuIconUrl;
+ }
+
+ public void setParentMenuTitle(final String parentMenuTitle) {
+ this.parentMenuTitle = parentMenuTitle;
+ }
+
+ public void setParentSubMenuTitle(final String parentSubMenuTitle) {
+ if (parentMenuTitle == null) {
+ Log.warn("Please set parentMenuTitle before");
+ }
+ this.parentSubMenuTitle = parentSubMenuTitle;
+ }
+}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPosition.java (from rev 890, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionPosition.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionPosition.java 2008-09-27 20:03:56 UTC (rev 890)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPosition.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -0,0 +1,5 @@
+package org.ourproject.kune.platf.client.actions;
+
+public enum ActionToolbarPosition {
+ topbar, bottombar
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -3,12 +3,12 @@
import java.util.ArrayList;
import java.util.HashMap;
-import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionButtonSeparator;
+import org.ourproject.kune.platf.client.actions.ActionToolbarButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionToolbarButtonSeparator;
import org.ourproject.kune.platf.client.actions.ActionItem;
import org.ourproject.kune.platf.client.actions.ActionManager;
-import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionPosition;
+import org.ourproject.kune.platf.client.actions.ActionToolbarMenuDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionToolbarPosition;
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.workspace.client.skel.SimpleToolbar;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
@@ -54,8 +54,8 @@
}
public void addButtonAction(final ActionItem<StateToken> actionItem) {
- final ActionButtonDescriptor<StateToken> action = (ActionButtonDescriptor<StateToken>) actionItem.getAction();
- final ActionPosition pos = action.getActionPosition();
+ final ActionToolbarButtonDescriptor<StateToken> action = (ActionToolbarButtonDescriptor<StateToken>) actionItem.getAction();
+ final ActionToolbarPosition pos = action.getActionPosition();
final ToolbarButton button = new ToolbarButton();
final String text = action.getText();
final String iconUrl = action.getIconUrl();
@@ -85,10 +85,10 @@
}
public void addMenuAction(final ActionItem<StateToken> actionItem, final boolean enable) {
- final ActionMenuDescriptor<StateToken> action = (ActionMenuDescriptor<StateToken>) actionItem.getAction();
+ final ActionToolbarMenuDescriptor<StateToken> action = (ActionToolbarMenuDescriptor<StateToken>) actionItem.getAction();
final String menuTitle = action.getParentMenuTitle();
final String menuSubTitle = action.getParentSubMenuTitle();
- final ActionPosition pos = action.getActionPosition();
+ final ActionToolbarPosition pos = action.getActionPosition();
final String itemKey = genMenuKey(pos, menuTitle, menuSubTitle, action.getText());
Item item = menuItems.get(itemKey);
if (item == null) {
@@ -123,8 +123,8 @@
removableToolbarItems.clear();
topbar.removeAll();
bottombar.removeAll();
- getToolbar(ActionPosition.topbar).removeAll();
- getToolbar(ActionPosition.bottombar).removeAll();
+ getToolbar(ActionToolbarPosition.topbar).removeAll();
+ getToolbar(ActionToolbarPosition.bottombar).removeAll();
}
public void clearRemovableActions() {
@@ -155,11 +155,11 @@
}
}
- private void add(final ActionPosition toolbar, final Widget widget) {
+ private void add(final ActionToolbarPosition toolbar, final Widget widget) {
getToolbar(toolbar).add(widget);
}
- private Widget add(final SimpleToolbar toolbar, final ActionButtonSeparator separator) {
+ private Widget add(final SimpleToolbar toolbar, final ActionToolbarButtonSeparator separator) {
switch (separator) {
case fill:
return toolbar.addFill();
@@ -171,9 +171,9 @@
}
}
- private Item createToolbarMenu(final ActionPosition toolBarPos, final String menuTitle, final String menuSubTitle,
+ private Item createToolbarMenu(final ActionToolbarPosition toolBarPos, final String menuTitle, final String menuSubTitle,
final ActionItem<StateToken> actionItem) {
- final ActionMenuDescriptor<StateToken> action = (ActionMenuDescriptor<StateToken>) actionItem.getAction();
+ final ActionToolbarMenuDescriptor<StateToken> action = (ActionToolbarMenuDescriptor<StateToken>) actionItem.getAction();
final Item item = new Item(action.getText(), new BaseItemListenerAdapter() {
@Override
public void onClick(BaseItem item, EventObject e) {
@@ -208,7 +208,7 @@
return item;
}
- private Menu createToolbarMenu(final ActionPosition barPosition, final String iconUrl, final String menuTitle,
+ private Menu createToolbarMenu(final ActionToolbarPosition barPosition, final String iconUrl, final String menuTitle,
final String menuKey) {
final Menu menu = new Menu();
final ToolbarButton toolbarMenu = new ToolbarButton(menuTitle);
@@ -221,7 +221,7 @@
return menu;
}
- private String genMenuKey(final ActionPosition pos, final String menuTitle, final String menuSubTitle,
+ private String genMenuKey(final ActionToolbarPosition pos, final String menuTitle, final String menuSubTitle,
final String actionText) {
final String basePart = "km-ctx-" + pos.toString().substring(0, 2) + "-" + menuTitle;
@@ -230,13 +230,11 @@
return basePart + subMenuPart + itemPart;
}
- private SimpleToolbar getToolbar(final ActionPosition pos) {
+ private SimpleToolbar getToolbar(final ActionToolbarPosition pos) {
switch (pos) {
- case bootombarAndItemMenu:
case bottombar:
return bottombar;
case topbar:
- case topbarAndItemMenu:
default:
return topbar;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -1,11 +1,13 @@
package org.ourproject.kune.platf.client.actions.toolbar;
-import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
import org.ourproject.kune.platf.client.actions.ActionDescriptor;
import org.ourproject.kune.platf.client.actions.ActionItem;
import org.ourproject.kune.platf.client.actions.ActionItemCollection;
-import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
import org.ourproject.kune.platf.client.actions.ActionRegistry;
+import org.ourproject.kune.platf.client.actions.ActionToolbarButtonAndItemDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionToolbarButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionToolbarMenuAndItemDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionToolbarMenuDescriptor;
import org.ourproject.kune.platf.client.dto.StateToken;
import com.allen_sauer.gwt.log.client.Log;
@@ -41,17 +43,17 @@
public void showActions(final ActionItemCollection<StateToken> actions, final boolean isItemSelected) {
for (final ActionItem<StateToken> actionItem : actions) {
final ActionDescriptor<StateToken> action = actionItem.getAction();
- if (action instanceof ActionMenuDescriptor) {
+ if (action instanceof ActionToolbarMenuDescriptor || action instanceof ActionToolbarMenuAndItemDescriptor) {
toolbar.addMenuAction(actionItem, isItemSelected
&& actionRegistry.checkEnabling(action, actionItem.getItem()));
} else {
- if (action instanceof ActionButtonDescriptor) {
+ if (action instanceof ActionToolbarButtonDescriptor
+ || action instanceof ActionToolbarButtonAndItemDescriptor) {
if (isItemSelected && actionRegistry.checkEnabling(action, actionItem.getItem())) {
toolbar.addButtonAction(actionItem);
}
} else {
- // Code smell
- Log.error("Not an ActionMenuDescriptor or ActionButtonDescriptor: " + action.getText());
+ Log.error("Code error: Not an ActionMenuDescriptor or ActionButtonDescriptor: " + action.getText());
}
}
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java 2008-09-29 08:55:01 UTC (rev 895)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java 2008-09-29 11:58:55 UTC (rev 896)
@@ -15,9 +15,9 @@
private static final String DEF_CONTENT_TYPE_ID = "test";
private ActionRegistry<StateToken> registry;
- private ActionDescriptor<StateToken> adminAction;
- private ActionDescriptor<StateToken> editorAction;
- private ActionDescriptor<StateToken> viewerAction;
+ private ActionToolbarMenuAndItemDescriptor<StateToken> adminAction;
+ private ActionToolbarMenuAndItemDescriptor<StateToken> editorAction;
+ private ActionToolbarMenuAndItemDescriptor<StateToken> viewerAction;
@Test
public void actionsEmptyButNeverNull() {
@@ -32,18 +32,18 @@
@Before
public void before() {
registry = new ActionRegistry<StateToken>();
- adminAction = new ActionDescriptor<StateToken>(AccessRolDTO.Administrator, ActionPosition.topbarAndItemMenu,
+ adminAction = new ActionToolbarMenuAndItemDescriptor<StateToken>(AccessRolDTO.Administrator, ActionToolbarPosition.topbar,
new Listener<StateToken>() {
public void onEvent(final StateToken parameter) {
}
});
- editorAction = new ActionDescriptor<StateToken>(AccessRolDTO.Editor, ActionPosition.topbarAndItemMenu,
+ editorAction = new ActionToolbarMenuAndItemDescriptor<StateToken>(AccessRolDTO.Editor, ActionToolbarPosition.topbar,
new Listener<StateToken>() {
public void onEvent(final StateToken parameter) {
}
});
- viewerAction = new ActionDescriptor<StateToken>(AccessRolDTO.Viewer, ActionPosition.topbarAndItemMenu,
+ viewerAction = new ActionToolbarMenuAndItemDescriptor<StateToken>(AccessRolDTO.Viewer, ActionToolbarPosition.topbar,
new Listener<StateToken>() {
public void onEvent(final StateToken parameter) {
}
More information about the kune-commits
mailing list