r945 - in trunk/src/main/java/org/ourproject/kune: chat/client docs/client platf/client/actions platf/client/services platf/client/tool platf/client/ui workspace/client/title
Author: vjrj Date: 2008-11-10 22:32:52 +0100 (Mon, 10 Nov 2008) New Revision: 945 Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractContentRegistry.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/RenamableContentRegistry.java Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java Log: Complete - task Renamable/non-renamables content types support (rooms are not renamable) Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2008-11-10 20:44:20 UTC (rev 944) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2008-11-10 21:32:52 UTC (rev 945) @@ -30,6 +30,7 @@ import org.ourproject.kune.platf.client.actions.ContentIconsRegistry; import org.ourproject.kune.platf.client.actions.ContextActionRegistry; import org.ourproject.kune.platf.client.actions.DragDropContentRegistry; +import org.ourproject.kune.platf.client.actions.RenamableContentRegistry; import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar; import org.ourproject.kune.platf.client.app.Application; import org.ourproject.kune.platf.client.app.ToolGroup; @@ -57,7 +58,8 @@ @Override public ChatClientActions create() { return new ChatClientActions($(I18nUITranslationService.class), $(Session.class), - $(ContentActionRegistry.class), $(ContextActionRegistry.class), $$(ChatEngine.class), $$(AddRoom.class)); + $(ContentActionRegistry.class), $(ContextActionRegistry.class), $$(ChatEngine.class), + $$(AddRoom.class)); } }); @@ -66,7 +68,7 @@ public ChatClientTool create() { return new ChatClientTool($(I18nUITranslationService.class), $(WorkspaceSkeleton.class), $(ToolSelector.class), $(WsThemePresenter.class), $(ContentIconsRegistry.class), - $(DragDropContentRegistry.class)); + $(DragDropContentRegistry.class), $(RenamableContentRegistry.class)); } }); Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-11-10 20:44:20 UTC (rev 944) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-11-10 21:32:52 UTC (rev 945) @@ -21,6 +21,7 @@ import org.ourproject.kune.platf.client.actions.ContentIconsRegistry; import org.ourproject.kune.platf.client.actions.DragDropContentRegistry; +import org.ourproject.kune.platf.client.actions.RenamableContentRegistry; import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.tool.FoldableAbstractClientTool; import org.ourproject.kune.platf.client.tool.ToolSelector; @@ -35,9 +36,10 @@ public ChatClientTool(final I18nTranslationService i18n, final WorkspaceSkeleton ws, final ToolSelector toolSelector, final WsThemePresenter wsThemePresenter, - final ContentIconsRegistry contentIconsRegistry, final DragDropContentRegistry dragDropContentRegistry) { + final ContentIconsRegistry contentIconsRegistry, final DragDropContentRegistry dragDropContentRegistry, + RenamableContentRegistry renamablesContentRegistry) { super(NAME, i18n.t("chat rooms"), toolSelector, wsThemePresenter, ws, contentIconsRegistry, - dragDropContentRegistry); + dragDropContentRegistry, renamablesContentRegistry); } public String getName() { @@ -48,4 +50,5 @@ protected void registerIcons() { contentIconsRegistry.registerContentTypeIcon(TYPE_ROOM, "images/emite-room.png"); } + } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-11-10 20:44:20 UTC (rev 944) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-11-10 21:32:52 UTC (rev 945) @@ -36,6 +36,7 @@ import org.ourproject.kune.platf.client.actions.ContentIconsRegistry; import org.ourproject.kune.platf.client.actions.ContextActionRegistry; import org.ourproject.kune.platf.client.actions.DragDropContentRegistry; +import org.ourproject.kune.platf.client.actions.RenamableContentRegistry; import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar; import org.ourproject.kune.platf.client.app.ToolGroup; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; @@ -72,7 +73,7 @@ $(DocumentClientActions.class); return new DocumentClientTool($(I18nUITranslationService.class), $(ToolSelector.class), $(WsThemePresenter.class), $(WorkspaceSkeleton.class), $(DragDropContentRegistry.class), - $(ContentIconsRegistry.class)); + $(ContentIconsRegistry.class), $(RenamableContentRegistry.class)); } }); Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2008-11-10 20:44:20 UTC (rev 944) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2008-11-10 21:32:52 UTC (rev 945) @@ -21,6 +21,7 @@ import org.ourproject.kune.platf.client.actions.ContentIconsRegistry; import org.ourproject.kune.platf.client.actions.DragDropContentRegistry; +import org.ourproject.kune.platf.client.actions.RenamableContentRegistry; import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO; import org.ourproject.kune.platf.client.tool.FoldableAbstractClientTool; import org.ourproject.kune.platf.client.tool.ToolSelector; @@ -42,9 +43,10 @@ public DocumentClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector, final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws, - final DragDropContentRegistry dragDropContentRegistry, final ContentIconsRegistry contentIconsRegistry) { + final DragDropContentRegistry dragDropContentRegistry, final ContentIconsRegistry contentIconsRegistry, + RenamableContentRegistry renamableContentRegistry) { super(NAME, i18n.t("documents"), toolSelector, wsThemePresenter, ws, contentIconsRegistry, - dragDropContentRegistry); + dragDropContentRegistry, renamableContentRegistry); } public String getName() { @@ -91,4 +93,10 @@ "mspowerpoint"), "images/nav/page_pps.png"); contentIconsRegistry.registerContentTypeIcon(TYPE_UPLOADEDFILE, "images/nav/page.png"); } + + @Override + protected void registerRenamableTypes() { + renamableContentRegistry.register(TYPE_DOCUMENT, TYPE_FOLDER, TYPE_BLOG, TYPE_GALLERY, TYPE_POST, + TYPE_UPLOADEDFILE, TYPE_WIKI, TYPE_WIKIPAGE); + } } Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractContentRegistry.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractContentRegistry.java 2008-11-10 20:44:20 UTC (rev 944) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractContentRegistry.java 2008-11-10 21:32:52 UTC (rev 945) @@ -0,0 +1,31 @@ +package org.ourproject.kune.platf.client.actions; + +import java.util.ArrayList; + +import com.allen_sauer.gwt.log.client.Log; + +public abstract class AbstractContentRegistry { + private final ArrayList<String> registry; + + public AbstractContentRegistry() { + registry = new ArrayList<String>(); + } + + public boolean contains(String typeId) { + Log.debug("Renables: " + registry + " checking: " + typeId); + return registry.contains(typeId); + } + + public void register(String... typeIds) { + for (String typeId : typeIds) { + registry.add(typeId); + } + } + + public void unregister(String... typeIds) { + for (String typeId : typeIds) { + registry.remove(typeId); + } + } + +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/RenamableContentRegistry.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/RenamableContentRegistry.java 2008-11-10 20:44:20 UTC (rev 944) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/RenamableContentRegistry.java 2008-11-10 21:32:52 UTC (rev 945) @@ -0,0 +1,4 @@ +package org.ourproject.kune.platf.client.actions; + +public class RenamableContentRegistry extends AbstractContentRegistry { +} Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-11-10 20:44:20 UTC (rev 944) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-11-10 21:32:52 UTC (rev 945) @@ -24,6 +24,7 @@ import org.ourproject.kune.platf.client.actions.ContextActionRegistry; import org.ourproject.kune.platf.client.actions.DragDropContentRegistry; import org.ourproject.kune.platf.client.actions.GroupActionRegistry; +import org.ourproject.kune.platf.client.actions.RenamableContentRegistry; import org.ourproject.kune.platf.client.actions.UserActionRegistry; import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar; import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbarPresenter; @@ -414,6 +415,13 @@ } }); + register(Singleton.class, new Factory<RenamableContentRegistry>(RenamableContentRegistry.class) { + @Override + public RenamableContentRegistry create() { + return new RenamableContentRegistry(); + } + }); + register(Singleton.class, new Factory<ContentIconsRegistry>(ContentIconsRegistry.class) { @Override public ContentIconsRegistry create() { Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-11-10 20:44:20 UTC (rev 944) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-11-10 21:32:52 UTC (rev 945) @@ -21,6 +21,7 @@ import org.ourproject.kune.chat.client.ChatEngine; import org.ourproject.kune.platf.client.actions.ActionManager; import org.ourproject.kune.platf.client.actions.ContentIconsRegistry; +import org.ourproject.kune.platf.client.actions.RenamableContentRegistry; import org.ourproject.kune.platf.client.actions.UserActionRegistry; import org.ourproject.kune.platf.client.app.ApplicationComponentGroup; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; @@ -277,7 +278,8 @@ public EntityTitle create() { final EntityTitlePresenter presenter = new EntityTitlePresenter($(I18nUITranslationService.class), $(KuneErrorHandler.class), $(StateManager.class), $(Session.class), - $$(ContentServiceAsync.class), $$(ContextNavigator.class), $(ContentIconsRegistry.class)); + $$(ContentServiceAsync.class), $$(ContextNavigator.class), $(ContentIconsRegistry.class), + $(RenamableContentRegistry.class)); final EntityTitlePanel panel = new EntityTitlePanel($(WorkspaceSkeleton.class), presenter); presenter.init(panel); return presenter; Modified: trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java 2008-11-10 20:44:20 UTC (rev 944) +++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java 2008-11-10 21:32:52 UTC (rev 945) @@ -2,21 +2,25 @@ import org.ourproject.kune.platf.client.actions.ContentIconsRegistry; import org.ourproject.kune.platf.client.actions.DragDropContentRegistry; +import org.ourproject.kune.platf.client.actions.RenamableContentRegistry; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; public abstract class FoldableAbstractClientTool extends AbstractClientTool { protected final DragDropContentRegistry dragDropContentRegistry; protected final ContentIconsRegistry contentIconsRegistry; + protected final RenamableContentRegistry renamableContentRegistry; public FoldableAbstractClientTool(String shortName, String longName, ToolSelector toolSelector, WsThemePresenter wsThemePresenter, WorkspaceSkeleton ws, final ContentIconsRegistry contentIconsRegistry, - final DragDropContentRegistry dragDropContentRegistry) { + final DragDropContentRegistry dragDropContentRegistry, RenamableContentRegistry renamableContentRegistry) { super(shortName, longName, toolSelector, wsThemePresenter, ws); this.dragDropContentRegistry = dragDropContentRegistry; this.contentIconsRegistry = contentIconsRegistry; + this.renamableContentRegistry = renamableContentRegistry; registerDragDropTypes(); registerIcons(); + registerRenamableTypes(); } protected void registerDragDropTypes() { @@ -24,4 +28,7 @@ protected void registerIcons() { } + + protected void registerRenamableTypes() { + } } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java 2008-11-10 20:44:20 UTC (rev 944) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java 2008-11-10 21:32:52 UTC (rev 945) @@ -107,7 +107,7 @@ // label.addDoubleClickListener(listener); label.addMouseListener(mouseOverListener); } else { - label.setTitle(""); + label.setTitle(null); label.addStyleDependentName("noneditable"); } } @@ -146,10 +146,12 @@ } }; mouseOverListener = new MouseListenerAdapter() { + @Override public void onMouseEnter(final Widget sender) { label.addStyleDependentName("high"); } + @Override public void onMouseLeave(final Widget sender) { label.removeStyleDependentName("high"); } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java 2008-11-10 20:44:20 UTC (rev 944) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java 2008-11-10 21:32:52 UTC (rev 945) @@ -83,10 +83,22 @@ doubleClickListeners.add(listener); } + public void addMouseListener(final MouseListener listener) { + if (mouseListeners == null) { + mouseListeners = new MouseListenerCollection(); + } + mouseListeners.add(listener); + } + public String getTargetHistoryToken() { return targetHistoryToken; } + public String getText() { + return DOM.getInnerText(link); + } + + @Override public void onBrowserEvent(final Event event) { switch (DOM.eventGetType(event)) { case Event.ONDBLCLICK: @@ -126,52 +138,40 @@ } } - public void setLabelHTML(final String html) { - DOM.setInnerHTML(link, html); + public void removeMouseListener(final MouseListener listener) { + if (mouseListeners != null) { + mouseListeners.remove(listener); + } } - public void setTargetHistoryToken(final String targetHistoryToken) { - this.targetHistoryToken = targetHistoryToken; - DOM.setElementProperty(anchorElem, "href", "#" + targetHistoryToken); + public void setColor(final String color) { + DOM.setStyleAttribute(link, "color", color); } - public void setLabelText(final String text) { - DOM.setInnerText(link, text); - } - public void setImage(final AbstractImagePrototype image) { DOM.setInnerHTML(icon, image.getHTML()); } - public void setTitle(final String title) { - // DOM.setElementAttribute(anchorElem, "ext:qtip", title); - KuneUiUtils.setQuickTip(icon, title); - KuneUiUtils.setQuickTip(anchorElem, title); - // KuneUiUtils.setQuickTip(getElement(), title); + public void setLabelHTML(final String html) { + DOM.setInnerHTML(link, html); } - public void addMouseListener(final MouseListener listener) { - if (mouseListeners == null) { - mouseListeners = new MouseListenerCollection(); - } - mouseListeners.add(listener); + public void setLabelText(final String text) { + DOM.setInnerText(link, text); } - public String getText() { - return DOM.getInnerText(link); + public void setTargetHistoryToken(final String targetHistoryToken) { + this.targetHistoryToken = targetHistoryToken; + DOM.setElementProperty(anchorElem, "href", "#" + targetHistoryToken); } - public void removeMouseListener(final MouseListener listener) { - if (mouseListeners != null) { - mouseListeners.remove(listener); - } + public void setText(final String text) { + setLabelText(text); } - public void setColor(final String color) { - DOM.setStyleAttribute(link, "color", color); + @Override + public void setTitle(final String title) { + KuneUiUtils.setQuickTip(icon, title); + KuneUiUtils.setQuickTip(anchorElem, title); } - - public void setText(final String text) { - setLabelText(text); - } } \ No newline at end of file Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java 2008-11-10 20:44:20 UTC (rev 944) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java 2008-11-10 21:32:52 UTC (rev 945) @@ -23,6 +23,7 @@ import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.actions.ContentIconsRegistry; +import org.ourproject.kune.platf.client.actions.RenamableContentRegistry; import org.ourproject.kune.platf.client.dto.StateAbstractDTO; import org.ourproject.kune.platf.client.dto.StateContainerDTO; import org.ourproject.kune.platf.client.dto.StateContentDTO; @@ -49,23 +50,26 @@ private final Session session; private final Provider<ContextNavigator> contextNavigatorProvider; private final ContentIconsRegistry iconsRegistry; + private final RenamableContentRegistry renamableContentRegistry; public EntityTitlePresenter(final I18nTranslationService i18n, final KuneErrorHandler errorHandler, final StateManager stateManager, final Session session, final Provider<ContentServiceAsync> contentServiceProvider, - final Provider<ContextNavigator> contextNavigatorProvider, final ContentIconsRegistry iconsRegistry) { + final Provider<ContextNavigator> contextNavigatorProvider, final ContentIconsRegistry iconsRegistry, + RenamableContentRegistry renamableContentRegistry) { this.i18n = i18n; this.errorHandler = errorHandler; this.session = session; this.contentServiceProvider = contentServiceProvider; this.contextNavigatorProvider = contextNavigatorProvider; this.iconsRegistry = iconsRegistry; + this.renamableContentRegistry = renamableContentRegistry; stateManager.onStateChanged(new Listener<StateAbstractDTO>() { public void onEvent(final StateAbstractDTO state) { - if (state instanceof StateContainerDTO) { + if (state instanceof StateContentDTO) { + setState((StateContentDTO) state); + } else if (state instanceof StateContainerDTO) { setState((StateContainerDTO) state); - } else if (state instanceof StateContentDTO) { - setState((StateContentDTO) state); } else { view.setContentIconVisible(false); view.setContentTitleVisible(false); @@ -96,12 +100,6 @@ view.setContentTitleVisible(true); } - public void setContentTitle(final String title, final boolean editable) { - setContentTitle(title); - view.setContentTitleEditable(editable); - view.setContentTitleVisible(true); - } - protected void onTitleRename(final String newName) { Site.showProgressSaving(); final StateToken stateToken = session.getCurrentState().getStateToken(); @@ -129,6 +127,12 @@ view.setDateVisible(visible); } + private void setContentTitle(final String title, final boolean editable) { + setContentTitle(title); + view.setContentTitleEditable(editable); + view.setContentTitleVisible(true); + } + private void setIcon(final String contentTypeIcon) { if (contentTypeIcon.length() > 0) { view.setContentIcon(contentTypeIcon); @@ -139,13 +143,8 @@ } private void setState(final StateContainerDTO state) { - if (state.getContainer().getParentFolderId() == null) { - // We translate root folder names (documents, chat room, - // etcetera) - setContentTitle(i18n.t(state.getTitle()), false); - } else { - setContentTitle(state.getTitle(), state.getContainerRights().isEditable()); - } + setContentTitle(state.getTitle(), state.getContainerRights().isEditable() + && renamableContentRegistry.contains(state.getContainer().getTypeId())); setContentDateVisible(false); final String contentTypeIcon = iconsRegistry.getContentTypeIcon(state.getTypeId(), null); setIcon(contentTypeIcon); @@ -153,7 +152,8 @@ } private void setState(final StateContentDTO state) { - setContentTitle(state.getTitle(), state.getContentRights().isEditable()); + setContentTitle(state.getTitle(), state.getContentRights().isEditable() + && renamableContentRegistry.contains(state.getTypeId())); Date publishedOn = state.getPublishedOn(); if (publishedOn != null) { setContentDateVisible(true);
participants (1)
-
vjrj