r1125 - in trunk/src: main/java/org/ourproject/kune/blogs/client main/java/org/ourproject/kune/chat/client main/java/org/ourproject/kune/docs/client main/java/org/ourproject/kune/gallery/client main/java/org/ourproject/kune/platf/client/actions main/java/org/ourproject/kune/platf/client/actions/ui main/java/org/ourproject/kune/platf/client/services main/java/org/ourproject/kune/platf/client/ui/rte/basic main/java/org/ourproject/kune/platf/client/ui/rte/saving main/java/org/ourproject/kune/wik
Author: vjrj Date: 2009-06-11 20:28:19 +0200 (Thu, 11 Jun 2009) New Revision: 1125 Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractExtendedAction.java trunk/src/main/java/org/ourproject/kune/platf/client/services/AbstractExtendedModule.java Removed: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/AbstractRTEAction.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientModule.java trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuGui.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenterNew.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientModule.java trunk/src/main/java/org/ourproject/kune/workspace/client/RegistryModule.java trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java trunk/src/test/java/org/ourproject/kune/platf/client/actions/KeyStrokeTest.java trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenterTest.java Log: Incomplete - task New Action class (adapted from Swing) to replace ActionDescription Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientModule.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientModule.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -35,6 +35,7 @@ import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; import org.ourproject.kune.platf.client.rpc.GroupServiceAsync; +import org.ourproject.kune.platf.client.services.AbstractExtendedModule; import org.ourproject.kune.platf.client.services.ErrorHandler; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; @@ -55,10 +56,9 @@ import org.ourproject.kune.workspace.client.upload.FileUploader; import com.calclab.suco.client.ioc.decorator.Singleton; -import com.calclab.suco.client.ioc.module.AbstractModule; import com.calclab.suco.client.ioc.module.Factory; -public class BlogClientModule extends AbstractModule { +public class BlogClientModule extends AbstractExtendedModule { @Override public void onInstall() { @@ -66,29 +66,29 @@ register(ToolGroup.class, new Factory<BlogClientTool>(BlogClientTool.class) { @Override public BlogClientTool create() { - $(BlogClientActions.class); - return new BlogClientTool($(I18nUITranslationService.class), $(ToolSelector.class), - $(WsThemePresenter.class), $(WorkspaceSkeleton.class), $(ContentCapabilitiesRegistry.class)); + i(BlogClientActions.class); + return new BlogClientTool(i(I18nUITranslationService.class), i(ToolSelector.class), + i(WsThemePresenter.class), i(WorkspaceSkeleton.class), i(ContentCapabilitiesRegistry.class)); } }); register(ToolGroup.class, new Factory<BlogClientActions>(BlogClientActions.class) { @Override public BlogClientActions create() { - return new BlogClientActions($(I18nUITranslationService.class), $(ContextNavigator.class), - $(Session.class), $(StateManager.class), $(DeferredCommandWrapper.class), - $$(ContentServiceAsync.class), $$(GroupServiceAsync.class), $$(FileUploader.class), - $(ContentActionRegistry.class), $(ContextActionRegistry.class), $$(FileDownloadUtils.class), - $(EntityHeader.class), $$(ContentEditor.class), $(ErrorHandler.class), $(BlogViewer.class), - $$(ContextPropEditor.class), $(SitePublicSpaceLink.class)); + return new BlogClientActions(i(I18nUITranslationService.class), i(ContextNavigator.class), + i(Session.class), i(StateManager.class), i(DeferredCommandWrapper.class), + p(ContentServiceAsync.class), p(GroupServiceAsync.class), p(FileUploader.class), + i(ContentActionRegistry.class), i(ContextActionRegistry.class), p(FileDownloadUtils.class), + i(EntityHeader.class), p(ContentEditor.class), i(ErrorHandler.class), i(BlogViewer.class), + p(ContextPropEditor.class), i(SitePublicSpaceLink.class)); } }); register(ToolGroup.class, new Factory<BlogContext>(BlogContext.class) { @Override public BlogContext create() { - final BlogContextPresenter presenter = new BlogContextPresenter($(StateManager.class), - $$(ContextNavigator.class), $$(ContextPropEditor.class)); + final BlogContextPresenter presenter = new BlogContextPresenter(i(StateManager.class), + p(ContextNavigator.class), p(ContextPropEditor.class)); return presenter; } }); @@ -96,11 +96,11 @@ register(Singleton.class, new Factory<BlogViewer>(BlogViewer.class) { @Override public BlogViewer create() { - final BlogViewerPresenter presenter = new BlogViewerPresenter($(StateManager.class), $(Session.class), - $(I18nUITranslationService.class), $(ActionContentToolbar.class), - $(ContentActionRegistry.class), $$(FileDownloadUtils.class), $$(MediaUtils.class)); - final BlogViewerView view = new BlogViewerPanel($(WorkspaceSkeleton.class), - $(I18nTranslationService.class)); + final BlogViewerPresenter presenter = new BlogViewerPresenter(i(StateManager.class), i(Session.class), + i(I18nUITranslationService.class), i(ActionContentToolbar.class), + i(ContentActionRegistry.class), p(FileDownloadUtils.class), p(MediaUtils.class)); + final BlogViewerView view = new BlogViewerPanel(i(WorkspaceSkeleton.class), + i(I18nTranslationService.class)); presenter.init(view); return presenter; } @@ -109,11 +109,11 @@ register(ToolGroup.class, new Factory<BlogFolderContent>(BlogFolderContent.class) { @Override public BlogFolderContent create() { - final BlogFolderContentPresenter presenter = new BlogFolderContentPresenter($(StateManager.class), - $(Session.class), $(ActionContentToolbar.class), $(ContentActionRegistry.class), - $(I18nTranslationService.class), $$(FileDownloadUtils.class), $$(MediaUtils.class)); - final BlogFolderContentView view = new BlogFolderContentPanel($(WorkspaceSkeleton.class), - $(I18nTranslationService.class)); + final BlogFolderContentPresenter presenter = new BlogFolderContentPresenter(i(StateManager.class), + i(Session.class), i(ActionContentToolbar.class), i(ContentActionRegistry.class), + i(I18nTranslationService.class), p(FileDownloadUtils.class), p(MediaUtils.class)); + final BlogFolderContentView view = new BlogFolderContentPanel(i(WorkspaceSkeleton.class), + i(I18nTranslationService.class)); presenter.init(view); return presenter; } Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -33,6 +33,7 @@ import org.ourproject.kune.platf.client.i18n.I18nUITranslationService; import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; +import org.ourproject.kune.platf.client.services.AbstractExtendedModule; import org.ourproject.kune.platf.client.shortcuts.GlobalShortcutRegister; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; @@ -49,10 +50,9 @@ import com.calclab.emiteuimodule.client.EmiteUIDialog; import com.calclab.suco.client.ioc.decorator.Singleton; -import com.calclab.suco.client.ioc.module.AbstractModule; import com.calclab.suco.client.ioc.module.Factory; -public class ChatClientModule extends AbstractModule { +public class ChatClientModule extends AbstractExtendedModule { @Override public void onInstall() { @@ -60,25 +60,25 @@ register(ToolGroup.class, new Factory<ChatClientActions>(ChatClientActions.class) { @Override public ChatClientActions create() { - return new ChatClientActions($(I18nUITranslationService.class), $(Session.class), - $(ContentActionRegistry.class), $(ContextActionRegistry.class), $$(ChatEngine.class), - $$(AddRoom.class), $$(DeferredCommandWrapper.class)); + return new ChatClientActions(i(I18nUITranslationService.class), i(Session.class), + i(ContentActionRegistry.class), i(ContextActionRegistry.class), p(ChatEngine.class), + p(AddRoom.class), p(DeferredCommandWrapper.class)); } }); register(ToolGroup.class, new Factory<ChatClientTool>(ChatClientTool.class) { @Override public ChatClientTool create() { - return new ChatClientTool($(I18nUITranslationService.class), $(WorkspaceSkeleton.class), - $(ToolSelector.class), $(WsThemePresenter.class), $(ContentCapabilitiesRegistry.class)); + return new ChatClientTool(i(I18nUITranslationService.class), i(WorkspaceSkeleton.class), + i(ToolSelector.class), i(WsThemePresenter.class), i(ContentCapabilitiesRegistry.class)); } }); register(ToolGroup.class, new Factory<ChatContext>(ChatContext.class) { @Override public ChatContext create() { - final ChatContextPresenter presenter = new ChatContextPresenter($(StateManager.class), - $$(ContextNavigator.class)); + final ChatContextPresenter presenter = new ChatContextPresenter(i(StateManager.class), + p(ContextNavigator.class)); return presenter; } }); @@ -86,9 +86,9 @@ register(ToolGroup.class, new Factory<ChatEngine>(ChatEngine.class) { @Override public ChatEngine create() { - final ChatEngineDefault chatEngineDefault = new ChatEngineDefault($(I18nUITranslationService.class), - $(WorkspaceSkeleton.class), $(Application.class), $(Session.class), $$(EmiteUIDialog.class), - $$(FileDownloadUtils.class), $(GlobalShortcutRegister.class)); + final ChatEngineDefault chatEngineDefault = new ChatEngineDefault(i(I18nUITranslationService.class), + i(WorkspaceSkeleton.class), i(Application.class), i(Session.class), p(EmiteUIDialog.class), + p(FileDownloadUtils.class), i(GlobalShortcutRegister.class)); return chatEngineDefault; } }); @@ -96,11 +96,11 @@ register(ToolGroup.class, new Factory<ChatRoom>(ChatRoom.class) { @Override public ChatRoom create() { - final ChatRoomPresenter presenter = new ChatRoomPresenter($(StateManager.class), $(Session.class), - $(I18nUITranslationService.class), $(ActionContentToolbar.class), - $(ContentActionRegistry.class), $$(FileDownloadUtils.class), $$(MediaUtils.class)); - final ChatRoomPanel panel = new ChatRoomPanel($(WorkspaceSkeleton.class), - $(I18nTranslationService.class)); + final ChatRoomPresenter presenter = new ChatRoomPresenter(i(StateManager.class), i(Session.class), + i(I18nUITranslationService.class), i(ActionContentToolbar.class), + i(ContentActionRegistry.class), p(FileDownloadUtils.class), p(MediaUtils.class)); + final ChatRoomPanel panel = new ChatRoomPanel(i(WorkspaceSkeleton.class), + i(I18nTranslationService.class)); presenter.init(panel); return presenter; } @@ -109,9 +109,9 @@ register(Singleton.class, new Factory<AddRoom>(AddRoom.class) { @Override public AddRoom create() { - final AddRoomPresenter presenter = new AddRoomPresenter($(Session.class), - $$(ContentServiceAsync.class), $(StateManager.class)); - final AddRoomPanel panel = new AddRoomPanel(presenter, $(I18nTranslationService.class)); + final AddRoomPresenter presenter = new AddRoomPresenter(i(Session.class), p(ContentServiceAsync.class), + i(StateManager.class)); + final AddRoomPanel panel = new AddRoomPanel(presenter, i(I18nTranslationService.class)); presenter.init(panel); return presenter; } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -35,6 +35,7 @@ import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; import org.ourproject.kune.platf.client.rpc.GroupServiceAsync; +import org.ourproject.kune.platf.client.services.AbstractExtendedModule; import org.ourproject.kune.platf.client.services.ErrorHandler; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; @@ -55,10 +56,9 @@ import org.ourproject.kune.workspace.client.upload.FileUploader; import com.calclab.suco.client.ioc.decorator.Singleton; -import com.calclab.suco.client.ioc.module.AbstractModule; import com.calclab.suco.client.ioc.module.Factory; -public class DocumentClientModule extends AbstractModule { +public class DocumentClientModule extends AbstractExtendedModule { @Override public void onInstall() { @@ -66,29 +66,29 @@ register(ToolGroup.class, new Factory<DocumentClientTool>(DocumentClientTool.class) { @Override public DocumentClientTool create() { - $(DocumentClientActions.class); - return new DocumentClientTool($(I18nUITranslationService.class), $(ToolSelector.class), - $(WsThemePresenter.class), $(WorkspaceSkeleton.class), $(ContentCapabilitiesRegistry.class)); + i(DocumentClientActions.class); + return new DocumentClientTool(i(I18nUITranslationService.class), i(ToolSelector.class), + i(WsThemePresenter.class), i(WorkspaceSkeleton.class), i(ContentCapabilitiesRegistry.class)); } }); register(ToolGroup.class, new Factory<DocumentClientActions>(DocumentClientActions.class) { @Override public DocumentClientActions create() { - return new DocumentClientActions($(I18nUITranslationService.class), $(ContextNavigator.class), - $(Session.class), $(StateManager.class), $(DeferredCommandWrapper.class), - $$(ContentServiceAsync.class), $$(GroupServiceAsync.class), $$(FileUploader.class), - $(ContentActionRegistry.class), $(ContextActionRegistry.class), $$(FileDownloadUtils.class), - $(EntityHeader.class), $$(ContentEditor.class), $(ErrorHandler.class), $(DocumentViewer.class), - $$(ContextPropEditor.class), $(SitePublicSpaceLink.class)); + return new DocumentClientActions(i(I18nUITranslationService.class), i(ContextNavigator.class), + i(Session.class), i(StateManager.class), i(DeferredCommandWrapper.class), + p(ContentServiceAsync.class), p(GroupServiceAsync.class), p(FileUploader.class), + i(ContentActionRegistry.class), i(ContextActionRegistry.class), p(FileDownloadUtils.class), + i(EntityHeader.class), p(ContentEditor.class), i(ErrorHandler.class), i(DocumentViewer.class), + p(ContextPropEditor.class), i(SitePublicSpaceLink.class)); } }); register(ToolGroup.class, new Factory<DocumentContext>(DocumentContext.class) { @Override public DocumentContext create() { - final DocumentContextPresenter presenter = new DocumentContextPresenter($(StateManager.class), - $$(ContextNavigator.class), $$(ContextPropEditor.class)); + final DocumentContextPresenter presenter = new DocumentContextPresenter(i(StateManager.class), + p(ContextNavigator.class), p(ContextPropEditor.class)); return presenter; } }); @@ -96,11 +96,11 @@ register(Singleton.class, new Factory<DocumentViewer>(DocumentViewer.class) { @Override public DocumentViewer create() { - final DocumentViewerPresenter presenter = new DocumentViewerPresenter($(StateManager.class), - $(Session.class), $(I18nUITranslationService.class), $(ActionContentToolbar.class), - $(ContentActionRegistry.class), $$(FileDownloadUtils.class), $$(MediaUtils.class)); - final DocumentViewerView view = new DocumentViewerPanel($(WorkspaceSkeleton.class), - $(I18nTranslationService.class)); + final DocumentViewerPresenter presenter = new DocumentViewerPresenter(i(StateManager.class), + i(Session.class), i(I18nUITranslationService.class), i(ActionContentToolbar.class), + i(ContentActionRegistry.class), p(FileDownloadUtils.class), p(MediaUtils.class)); + final DocumentViewerView view = new DocumentViewerPanel(i(WorkspaceSkeleton.class), + i(I18nTranslationService.class)); presenter.init(view); return presenter; } @@ -109,11 +109,11 @@ register(ToolGroup.class, new Factory<DocFolderContent>(DocFolderContent.class) { @Override public DocFolderContent create() { - final DocFolderContentPresenter presenter = new DocFolderContentPresenter($(StateManager.class), - $(Session.class), $(ActionContentToolbar.class), $(ContentActionRegistry.class), - $$(FileDownloadUtils.class), $(I18nTranslationService.class), $$(MediaUtils.class)); - final DocFolderContentView view = new DocFolderContentPanel($(WorkspaceSkeleton.class), - $(I18nTranslationService.class)); + final DocFolderContentPresenter presenter = new DocFolderContentPresenter(i(StateManager.class), + i(Session.class), i(ActionContentToolbar.class), i(ContentActionRegistry.class), + p(FileDownloadUtils.class), i(I18nTranslationService.class), p(MediaUtils.class)); + final DocFolderContentView view = new DocFolderContentPanel(i(WorkspaceSkeleton.class), + i(I18nTranslationService.class)); presenter.init(view); return presenter; } Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -35,6 +35,7 @@ import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; import org.ourproject.kune.platf.client.rpc.GroupServiceAsync; +import org.ourproject.kune.platf.client.services.AbstractExtendedModule; import org.ourproject.kune.platf.client.services.ErrorHandler; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; @@ -55,10 +56,9 @@ import org.ourproject.kune.workspace.client.upload.FileUploader; import com.calclab.suco.client.ioc.decorator.Singleton; -import com.calclab.suco.client.ioc.module.AbstractModule; import com.calclab.suco.client.ioc.module.Factory; -public class GalleryClientModule extends AbstractModule { +public class GalleryClientModule extends AbstractExtendedModule { @Override public void onInstall() { @@ -66,29 +66,29 @@ register(ToolGroup.class, new Factory<GalleryClientTool>(GalleryClientTool.class) { @Override public GalleryClientTool create() { - $(GalleryClientActions.class); - return new GalleryClientTool($(I18nUITranslationService.class), $(ToolSelector.class), - $(WsThemePresenter.class), $(WorkspaceSkeleton.class), $(ContentCapabilitiesRegistry.class)); + i(GalleryClientActions.class); + return new GalleryClientTool(i(I18nUITranslationService.class), i(ToolSelector.class), + i(WsThemePresenter.class), i(WorkspaceSkeleton.class), i(ContentCapabilitiesRegistry.class)); } }); register(ToolGroup.class, new Factory<GalleryClientActions>(GalleryClientActions.class) { @Override public GalleryClientActions create() { - return new GalleryClientActions($(I18nUITranslationService.class), $(ContextNavigator.class), - $(Session.class), $(StateManager.class), $(DeferredCommandWrapper.class), - $$(ContentServiceAsync.class), $$(GroupServiceAsync.class), $$(FileUploader.class), - $(ContentActionRegistry.class), $(ContextActionRegistry.class), $$(FileDownloadUtils.class), - $(EntityHeader.class), $$(ContentEditor.class), $(ErrorHandler.class), $(GalleryViewer.class), - $$(ContextPropEditor.class), $(SitePublicSpaceLink.class)); + return new GalleryClientActions(i(I18nUITranslationService.class), i(ContextNavigator.class), + i(Session.class), i(StateManager.class), i(DeferredCommandWrapper.class), + p(ContentServiceAsync.class), p(GroupServiceAsync.class), p(FileUploader.class), + i(ContentActionRegistry.class), i(ContextActionRegistry.class), p(FileDownloadUtils.class), + i(EntityHeader.class), p(ContentEditor.class), i(ErrorHandler.class), i(GalleryViewer.class), + p(ContextPropEditor.class), i(SitePublicSpaceLink.class)); } }); register(ToolGroup.class, new Factory<GalleryContext>(GalleryContext.class) { @Override public GalleryContext create() { - final GalleryContextPresenter presenter = new GalleryContextPresenter($(StateManager.class), - $$(ContextNavigator.class), $$(ContextPropEditor.class)); + final GalleryContextPresenter presenter = new GalleryContextPresenter(i(StateManager.class), + p(ContextNavigator.class), p(ContextPropEditor.class)); return presenter; } }); @@ -96,11 +96,11 @@ register(Singleton.class, new Factory<GalleryViewer>(GalleryViewer.class) { @Override public GalleryViewer create() { - final GalleryViewerPresenter presenter = new GalleryViewerPresenter($(StateManager.class), - $(Session.class), $(I18nUITranslationService.class), $(ActionContentToolbar.class), - $(ContentActionRegistry.class), $$(FileDownloadUtils.class), $$(MediaUtils.class)); - final GalleryViewerView view = new GalleryViewerPanel($(WorkspaceSkeleton.class), - $(I18nTranslationService.class)); + final GalleryViewerPresenter presenter = new GalleryViewerPresenter(i(StateManager.class), + i(Session.class), i(I18nUITranslationService.class), i(ActionContentToolbar.class), + i(ContentActionRegistry.class), p(FileDownloadUtils.class), p(MediaUtils.class)); + final GalleryViewerView view = new GalleryViewerPanel(i(WorkspaceSkeleton.class), + i(I18nTranslationService.class)); presenter.init(view); return presenter; } @@ -110,11 +110,11 @@ @Override public GalleryFolderContent create() { final GalleryFolderContentPresenter presenter = new GalleryFolderContentPresenter( - $(StateManager.class), $(Session.class), $(ActionContentToolbar.class), - $(ContentActionRegistry.class), $(I18nTranslationService.class), $$(FileDownloadUtils.class), - $$(FileDownloadUtils.class), $$(MediaUtils.class)); - final GalleryFolderContentView view = new GalleryFolderContentPanel($(WorkspaceSkeleton.class), - $(I18nTranslationService.class), $(StateManager.class), $(Session.class)); + i(StateManager.class), i(Session.class), i(ActionContentToolbar.class), + i(ContentActionRegistry.class), i(I18nTranslationService.class), p(FileDownloadUtils.class), + p(FileDownloadUtils.class), p(MediaUtils.class)); + final GalleryFolderContentView view = new GalleryFolderContentPanel(i(WorkspaceSkeleton.class), + i(I18nTranslationService.class), i(StateManager.class), i(Session.class)); presenter.init(view); return presenter; } Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractExtendedAction.java (from rev 1123, trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/AbstractRTEAction.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/AbstractRTEAction.java 2009-06-09 18:56:54 UTC (rev 1123) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractExtendedAction.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -0,0 +1,28 @@ +package org.ourproject.kune.platf.client.actions; + + +import com.google.gwt.libideas.resources.client.ImageResource; + +public abstract class AbstractExtendedAction extends AbstractAction { + public static final String NO_TEXT = null; + public static final ImageResource NO_ICON = null; + + public AbstractExtendedAction() { + super(); + } + + public AbstractExtendedAction(final String text) { + this(text, null, null); + } + + public AbstractExtendedAction(final String text, final ImageResource icon) { + this(text, null, icon); + } + + public AbstractExtendedAction(final String text, final String tooltip, final ImageResource icon) { + super(); + super.putValue(Action.NAME, text); + super.putValue(Action.SHORT_DESCRIPTION, tooltip); + super.putValue(Action.SMALL_ICON, icon); + } +} \ No newline at end of file Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -38,6 +38,7 @@ package org.ourproject.kune.platf.client.actions; import java.util.HashMap; +import java.util.Map; import org.ourproject.kune.platf.client.i18n.Resources; import org.ourproject.kune.platf.client.shortcuts.Keyboard; @@ -74,7 +75,7 @@ * under the assumption that garbage collection of a new keystroke is easy * when we find the old one that it matches in the cache. */ - private static final HashMap<KeyStroke, KeyStroke> CACHE = new HashMap<KeyStroke, KeyStroke>(); + private static final Map<KeyStroke, KeyStroke> CACHE = new HashMap<KeyStroke, KeyStroke>(); /** The most recently generated keystroke, or null. */ private static KeyStroke recent; @@ -85,7 +86,7 @@ * * @see #getKeyStroke(String) */ - static final HashMap<String, Object> VKTABLE = new HashMap<String, Object>(); + static final Map<String, Object> VKTABLE = new HashMap<String, Object>(); private static final int VK_UNDEFINED = 0; private static final char CHAR_UNDEFINED = '\uffff'; @@ -303,18 +304,18 @@ /** * Tests two keystrokes for equality. * - * @param o + * @param obj * the object to test * @return true if it is equal */ @Override - public final boolean equals(final Object o) { - if (!(o instanceof KeyStroke)) { + public final boolean equals(final Object obj) { + if (!(obj instanceof KeyStroke)) { return false; } - final KeyStroke s = (KeyStroke) o; - return this == o - || (keyChar == s.keyChar && keyCode == s.keyCode && modifiers == s.modifiers && onKeyRelease == s.onKeyRelease); + final KeyStroke stroke = (KeyStroke) obj; + return this == obj + || (keyChar == stroke.keyChar && keyCode == stroke.keyCode && modifiers == stroke.modifiers && onKeyRelease == stroke.onKeyRelease); } /** @@ -437,14 +438,17 @@ case Keyboard.KEY_OPEN_BRACKET: case Keyboard.KEY_BACK_SLASH: case Keyboard.KEY_CLOSE_BRACKET: - return ("" + (char) keyCode).toUpperCase(); - + return String.valueOf(keyCode).toUpperCase(); default: final String charS = String.valueOf(keyChar); if (charS == null) { return "Unknown keyCode: 0x" + (keyCode < 0 ? "-" : "") + Integer.toHexString(Math.abs(keyCode)); } else { - return charS; + if (" ".equals(charS)) { + return translateKey("Space"); + } else { + return charS; + } } } } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -16,6 +16,7 @@ public MenuDescriptor(final GuiActionDescrip parent, final AbstractAction action) { super(action); setParent(parent); + action.putValue(MENU_HIDE, false); } public MenuDescriptor(final String text) { @@ -36,7 +37,7 @@ } public void hide() { - action.putValue(MENU_HIDE, true); + action.putValue(MENU_HIDE, !((Boolean) action.getValue(MENU_HIDE))); } public void setText(final String text) { Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuGui.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuGui.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuGui.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -6,8 +6,6 @@ import com.google.gwt.libideas.resources.client.ImageResource; import com.gwtext.client.widgets.ToolbarButton; -import com.gwtext.client.widgets.menu.Menu; -import com.gwtext.client.widgets.menu.event.MenuListenerAdapter; public class MenuGui extends AbstractMenuGui { @@ -21,17 +19,11 @@ initWidget(button); descriptor.action.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(final PropertyChangeEvent event) { - if (event.getPropertyName().equals(MenuDescriptor.MENU_HIDE) && event.getNewValue().equals(true)) { + if (event.getPropertyName().equals(MenuDescriptor.MENU_HIDE)) { menu.hide(true); } } }); - menu.addListener(new MenuListenerAdapter() { - @Override - public void onShow(final Menu menu) { - descriptor.action.putValue(MenuDescriptor.MENU_HIDE, false); - } - }); } public void add(final SubMenuGui submenu) { Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -1,33 +1,21 @@ package org.ourproject.kune.platf.client.actions.ui; import org.ourproject.kune.platf.client.actions.AbstractAction; +import org.ourproject.kune.platf.client.actions.Action; import org.ourproject.kune.platf.client.actions.ActionEvent; import org.ourproject.kune.platf.client.ui.img.ImgResources; import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; -import com.google.gwt.libideas.resources.client.ImageResource; import com.google.gwt.user.client.Timer; public class TestButton { - static class Action extends AbstractAction { - public Action(final ImageResource icon) { - super(); - super.putValue(Action.NAME, "FIXME"); - super.putValue(Action.SHORT_DESCRIPTION, "FIXME"); - super.putValue(Action.SMALL_ICON, icon); - } - public void actionPerformed(final ActionEvent actionEvent) { - // FIXME - } - } - - static class NotiAction extends AbstractAction { - public NotiAction(final ImgResources img) { + static class HelloWorldAction extends AbstractAction { + public HelloWorldAction(final ImgResources img) { super(); - super.putValue(Action.NAME, "test"); - super.putValue(Action.SHORT_DESCRIPTION, "test button"); + super.putValue(Action.NAME, "helloword"); + super.putValue(Action.SHORT_DESCRIPTION, "helloworld item"); super.putValue(Action.SMALL_ICON, img.info()); } @@ -40,7 +28,7 @@ } public TestButton(final WorkspaceSkeleton wksp, final GuiBindingsRegister bindings, final ImgResources img) { - final NotiAction noti = new NotiAction(img); + final HelloWorldAction noti = new HelloWorldAction(img); final PushButtonDescriptor btn = new PushButtonDescriptor(noti); Added: trunk/src/main/java/org/ourproject/kune/platf/client/services/AbstractExtendedModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/AbstractExtendedModule.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/AbstractExtendedModule.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -0,0 +1,37 @@ +package org.ourproject.kune.platf.client.services; + +import com.calclab.suco.client.ioc.Provider; +import com.calclab.suco.client.ioc.module.AbstractModule; + +public abstract class AbstractExtendedModule extends AbstractModule { + + /** + * Get a instance of the specified component key + * + * @param <T> + * The component key + * @param componentType + * The component key + * @return The component instance + */ + protected <T> T i(final Class<T> componentType) { // NOPMD by vjrj on + // 11/06/09 18:34 + return $(componentType); + } + + /** + * Get a provider of the specified component key + * + * @param <T> + * The component key + * @param componentType + * The component key + * @return The provider of that component key + */ + protected <T> Provider<T> p(final Class<T> componentType) {// NOPMD by vjrj + // on 11/06/09 + // 18:34 + return $$(componentType); + } + +} Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -124,7 +124,6 @@ import com.calclab.suco.client.events.Listener0; import com.calclab.suco.client.ioc.decorator.NoDecoration; import com.calclab.suco.client.ioc.decorator.Singleton; -import com.calclab.suco.client.ioc.module.AbstractModule; import com.calclab.suco.client.ioc.module.Factory; import com.google.gwt.core.client.GWT; import com.google.gwt.libideas.client.StyleInjector; @@ -132,7 +131,7 @@ import com.google.gwt.user.client.History; import com.google.gwt.user.client.rpc.ServiceDefTarget; -public class PlatformModule extends AbstractModule { +public class PlatformModule extends AbstractExtendedModule { @Override protected void onInstall() { @@ -140,7 +139,7 @@ register(Singleton.class, new Factory<Session>(Session.class) { @Override public Session create() { - return new SessionDefault(Cookies.getCookie(Session.USERHASH), $$(UserServiceAsync.class)); + return new SessionDefault(Cookies.getCookie(Session.USERHASH), p(UserServiceAsync.class)); } }, new Factory<I18nServiceAsync>(I18nServiceAsync.class) { @Override @@ -166,13 +165,13 @@ }, new Factory<ContentProvider>(ContentProvider.class) { @Override public ContentProvider create() { - return new ContentProviderDefault($(ContentServiceAsync.class)); + return new ContentProviderDefault(i(ContentServiceAsync.class)); } }, new Factory<StateManager>(StateManager.class) { @Override public StateManager create() { - final StateManagerDefault stateManager = new StateManagerDefault($(ContentProvider.class), - $(Session.class), $(HistoryWrapper.class)); + final StateManagerDefault stateManager = new StateManagerDefault(i(ContentProvider.class), + i(Session.class), i(HistoryWrapper.class)); History.addValueChangeHandler(stateManager); return stateManager; } @@ -182,7 +181,7 @@ @Override public I18nUITranslationService create() { final I18nUITranslationService i18n = new I18nUITranslationService(); - i18n.init($(I18nServiceAsync.class), $(Session.class), new Listener0() { + i18n.init(i(I18nServiceAsync.class), i(Session.class), new Listener0() { public void onEvent() { onI18nReady(); } @@ -194,7 +193,7 @@ register(Singleton.class, new Factory<FileDownloadUtils>(FileDownloadUtils.class) { @Override public FileDownloadUtils create() { - return new FileDownloadUtils($(Session.class), $(ImageUtils.class)); + return new FileDownloadUtils(i(Session.class), i(ImageUtils.class)); } }); @@ -207,13 +206,13 @@ }); } - $(I18nUITranslationService.class); - $(QuickTipsHelper.class); + i(I18nUITranslationService.class); + i(QuickTipsHelper.class); } private void onI18nReady() { - final I18nUITranslationService i18n = $(I18nUITranslationService.class); + final I18nUITranslationService i18n = i(I18nUITranslationService.class); if (container.hasProvider(I18nTranslationService.class)) { container.removeProvider(I18nTranslationService.class); @@ -226,7 +225,7 @@ } }); - $(Resources.class); + i(Resources.class); register(Singleton.class, new Factory<I18nTranslationService>(I18nTranslationService.class) { @Override @@ -238,7 +237,7 @@ register(Singleton.class, new Factory<ErrorHandler>(ErrorHandler.class) { @Override public ErrorHandler create() { - return new ErrorHandler($(Session.class), i18n, $$(StateManager.class)); + return new ErrorHandler(i(Session.class), i18n, p(StateManager.class)); } }); @@ -250,16 +249,16 @@ }, new Factory<ImageUtils>(ImageUtils.class) { @Override public ImageUtils create() { - return new ImageUtils($(Images.class)); + return new ImageUtils(i(Images.class)); } }); - AsyncCallbackSimple.init($(ErrorHandler.class)); + AsyncCallbackSimple.init(i(ErrorHandler.class)); register(Singleton.class, new Factory<Application>(Application.class) { @Override public Application create() { - return new ApplicationDefault($(Session.class)); + return new ApplicationDefault(i(Session.class)); } }); @@ -293,14 +292,14 @@ register(NoDecoration.class, new Factory<RTEActionTopToolbar>(RTEActionTopToolbar.class) { @Override public RTEActionTopToolbar create() { - final ActionToolbarPanel<Object> panel = new ActionToolbarPanel<Object>($$(ActionManager.class)); + final ActionToolbarPanel<Object> panel = new ActionToolbarPanel<Object>(p(ActionManager.class)); final RTEActionTopToolbar toolbar = new RTEActionTopToolbar(panel); return toolbar; } }, new Factory<RTEActionSndToolbar>(RTEActionSndToolbar.class) { @Override public RTEActionSndToolbar create() { - final ActionToolbarPanel<Object> panel = new ActionToolbarPanel<Object>($$(ActionManager.class), true); + final ActionToolbarPanel<Object> panel = new ActionToolbarPanel<Object>(p(ActionManager.class), true); final RTEActionSndToolbar toolbar = new RTEActionSndToolbar(panel); return toolbar; } @@ -316,8 +315,8 @@ register(InsertLinkGroup.class, new Factory<InsertLinkExt>(InsertLinkExt.class) { @Override public InsertLinkExt create() { - final InsertLinkExtPresenter presenter = new InsertLinkExtPresenter($(InsertLinkDialog.class)); - final InsertLinkExtView panel = new InsertLinkExtPanel(presenter, $(I18nTranslationService.class)); + final InsertLinkExtPresenter presenter = new InsertLinkExtPresenter(i(InsertLinkDialog.class)); + final InsertLinkExtView panel = new InsertLinkExtPanel(presenter, i(I18nTranslationService.class)); presenter.init(panel); return presenter; } @@ -327,8 +326,8 @@ @Override public InsertLinkEmail create() { - final InsertLinkEmailPresenter presenter = new InsertLinkEmailPresenter($(InsertLinkDialog.class)); - final InsertLinkEmailPanel panel = new InsertLinkEmailPanel(presenter, $(I18nTranslationService.class)); + final InsertLinkEmailPresenter presenter = new InsertLinkEmailPresenter(i(InsertLinkDialog.class)); + final InsertLinkEmailPanel panel = new InsertLinkEmailPanel(presenter, i(I18nTranslationService.class)); presenter.init(panel); return presenter; } @@ -337,21 +336,21 @@ register(NoDecoration.class,new Factory<RTEditorNew>(RTEditorNew.class) { @Override public RTEditorNew create() { - final RTEditorPresenterNew presenter = new RTEditorPresenterNew($(I18nTranslationService.class), - $(Session.class), $(RTEImgResources.class), $$(InsertLinkDialog.class), - $$(ColorWebSafePalette.class), $$(EditHtmlDialog.class), $$(InsertImageDialog.class), - $$(InsertMediaDialog.class), $$(InsertTableDialog.class), $$(InsertSpecialCharDialog.class), $(DeferredCommandWrapper.class)); - final RTEditorPanelNew panel = new RTEditorPanelNew(presenter, $(I18nUITranslationService.class), - $(GlobalShortcutRegister.class), $(GuiBindingsRegister.class)); + final RTEditorPresenterNew presenter = new RTEditorPresenterNew(i(I18nTranslationService.class), + i(Session.class), i(RTEImgResources.class), p(InsertLinkDialog.class), + p(ColorWebSafePalette.class), p(EditHtmlDialog.class), p(InsertImageDialog.class), + p(InsertMediaDialog.class), p(InsertTableDialog.class), p(InsertSpecialCharDialog.class), i(DeferredCommandWrapper.class)); + final RTEditorPanelNew panel = new RTEditorPanelNew(presenter, i(I18nUITranslationService.class), + i(GlobalShortcutRegister.class), i(GuiBindingsRegister.class)); presenter.init(panel); return presenter; } }, new Factory<RTESavingEditor>(RTESavingEditor.class) { @Override public RTESavingEditor create() { - final RTESavingEditorPresenter presenter = new RTESavingEditorPresenter($(RTEditorNew.class), true, - $(I18nTranslationService.class), $(StateManager.class), $(DeferredCommandWrapper.class), - $(RTEImgResources.class), $(TimerWrapper.class)); + final RTESavingEditorPresenter presenter = new RTESavingEditorPresenter(i(RTEditorNew.class), true, + i(I18nTranslationService.class), i(StateManager.class), i(DeferredCommandWrapper.class), + i(RTEImgResources.class), i(TimerWrapper.class)); final RTESavingEditorPanel panel = new RTESavingEditorPanel(); presenter.init(panel); return presenter; @@ -361,14 +360,14 @@ register(NoDecoration.class, new Factory<TestRTEDialog>(TestRTEDialog.class) { @Override public TestRTEDialog create() { - return new TestRTEDialog($(RTESavingEditor.class)); + return new TestRTEDialog(i(RTESavingEditor.class)); } }); register(ApplicationComponentGroup.class, new Factory<NotifyUser>(NotifyUser.class) { @Override public NotifyUser create() { - return new NotifyUser($(I18nTranslationService.class), $(Images.class)); + return new NotifyUser(i(I18nTranslationService.class), i(Images.class)); } }); @@ -396,8 +395,8 @@ @Override public EditHtmlDialog create() { final EditHtmlDialogPresenter presenter = new EditHtmlDialogPresenter(); - final EditHtmlDialogPanel panel = new EditHtmlDialogPanel(presenter, $(I18nTranslationService.class), - $(RTEImgResources.class), $(Images.class), $(EditHtmlGroup.class)); + final EditHtmlDialogPanel panel = new EditHtmlDialogPanel(presenter, i(I18nTranslationService.class), + i(RTEImgResources.class), i(Images.class), i(EditHtmlGroup.class)); presenter.init(panel); return presenter; } @@ -406,7 +405,7 @@ register(EditHtmlGroup.class, new Factory<EditHtmlEditor>(EditHtmlEditor.class) { @Override public EditHtmlEditor create() { - final EditHtmlEditorPresenter presenter = new EditHtmlEditorPresenter($(EditHtmlDialog.class)); + final EditHtmlEditorPresenter presenter = new EditHtmlEditorPresenter(i(EditHtmlDialog.class)); final EditHtmlEditorPanel panel = new EditHtmlEditorPanel(i18n, presenter); presenter.init(panel); return presenter; @@ -414,7 +413,7 @@ }, new Factory<EditHtmlPreview>(EditHtmlPreview.class) { @Override public EditHtmlPreview create() { - final EditHtmlPreviewPresenter presenter = new EditHtmlPreviewPresenter($(EditHtmlDialog.class)); + final EditHtmlPreviewPresenter presenter = new EditHtmlPreviewPresenter(i(EditHtmlDialog.class)); final EditHtmlPreviewPanel panel = new EditHtmlPreviewPanel(i18n, presenter); presenter.init(panel); return presenter; @@ -426,7 +425,7 @@ public InsertImageDialog create() { final InsertImageDialogPresenter presenter = new InsertImageDialogPresenter(); final InsertImageDialogPanel panel = new InsertImageDialogPanel(presenter, - $(I18nTranslationService.class), $(Images.class), $(InsertImageGroup.class)); + i(I18nTranslationService.class), i(Images.class), i(InsertImageGroup.class)); presenter.init(panel); return presenter; } @@ -435,7 +434,7 @@ register(InsertImageGroup.class, new Factory<InsertImageExt>(InsertImageExt.class) { @Override public InsertImageExt create() { - final InsertImageExtPresenter presenter = new InsertImageExtPresenter($(InsertImageDialog.class)); + final InsertImageExtPresenter presenter = new InsertImageExtPresenter(i(InsertImageDialog.class)); final InsertImageExtPanel panel = new InsertImageExtPanel(presenter, i18n); presenter.init(panel); return presenter; @@ -446,8 +445,8 @@ @Override public InsertLinkDialog create() { final InsertLinkDialogPresenter presenter = new InsertLinkDialogPresenter(); - final InsertLinkDialogPanel panel = new InsertLinkDialogPanel(presenter, $(Images.class), - $(I18nTranslationService.class), $(InsertLinkGroup.class)); + final InsertLinkDialogPanel panel = new InsertLinkDialogPanel(presenter, i(Images.class), + i(I18nTranslationService.class), i(InsertLinkGroup.class)); presenter.init(panel); return presenter; } @@ -458,7 +457,7 @@ public InsertTableDialog create() { final InsertTableDialogPresenter presenter = new InsertTableDialogPresenter(); final InsertTableDialogPanel panel = new InsertTableDialogPanel(presenter, i18n, - $$(SimplePalette.class), $(RTEImgResources.class)); + p(SimplePalette.class), i(RTEImgResources.class)); presenter.init(panel); return presenter; } @@ -468,8 +467,8 @@ @Override public InsertSpecialCharDialog create() { final InsertSpecialCharDialogPresenter presenter = new InsertSpecialCharDialogPresenter(); - final InsertSpecialCharDialogPanel panel = new InsertSpecialCharDialogPanel(presenter, $(Images.class), - $(I18nTranslationService.class), $(InsertSpecialCharGroup.class), $(RTEImgResources.class)); + final InsertSpecialCharDialogPanel panel = new InsertSpecialCharDialogPanel(presenter, i(Images.class), + i(I18nTranslationService.class), i(InsertSpecialCharGroup.class), i(RTEImgResources.class)); presenter.init(panel); return presenter; } @@ -477,7 +476,7 @@ @Override public InsertSpecialOccChar create() { final InsertSpecialOccCharPresenter presenter = new InsertSpecialOccCharPresenter(); - final InsertSpecialOccCharPanel panel = new InsertSpecialOccCharPanel($(InsertSpecialCharDialog.class), + final InsertSpecialOccCharPanel panel = new InsertSpecialOccCharPanel(i(InsertSpecialCharDialog.class), i18n); presenter.init(panel); return presenter; @@ -487,14 +486,14 @@ public InsertSpecialAsianChar create() { final InsertSpecialAsianCharPresenter presenter = new InsertSpecialAsianCharPresenter(); final InsertSpecialAsianCharPanel panel = new InsertSpecialAsianCharPanel( - $(InsertSpecialCharDialog.class), i18n); + i(InsertSpecialCharDialog.class), i18n); presenter.init(panel); return presenter; } }, new Factory<InsertSpecialUTF8CharPanel>(InsertSpecialUTF8CharPanel.class) { @Override public InsertSpecialUTF8CharPanel create() { - return new InsertSpecialUTF8CharPanel(i18n, $(InsertSpecialCharDialog.class)); + return new InsertSpecialUTF8CharPanel(i18n, i(InsertSpecialCharDialog.class)); } }); @@ -502,14 +501,14 @@ register(MediaUtils.class, new Factory<MediaUtils>(MediaUtils.class) { @Override public MediaUtils create() { - return new MediaUtils($(Session.class), $(FileDownloadUtils.class)); + return new MediaUtils(i(Session.class), i(FileDownloadUtils.class)); }}); register(InsertMediaGroup.class, new Factory<InsertMediaExt>(InsertMediaExt.class) { @Override public InsertMediaExt create() { - final InsertMediaExtPresenter presenter = new InsertMediaExtPresenter($(InsertMediaDialog.class), $(ExternalMediaRegistry.class)); - final InsertMediaExtPanel panel = new InsertMediaExtPanel(presenter, i18n, $(ExternalMediaRegistry.class)); + final InsertMediaExtPresenter presenter = new InsertMediaExtPresenter(i(InsertMediaDialog.class), i(ExternalMediaRegistry.class)); + final InsertMediaExtPanel panel = new InsertMediaExtPanel(presenter, i18n, i(ExternalMediaRegistry.class)); presenter.init(panel); return presenter; } @@ -519,7 +518,7 @@ @Override public InsertMediaDialog create() { final InsertMediaDialogPresenter presenter = new InsertMediaDialogPresenter(); - final InsertMediaDialogPanel panel = new InsertMediaDialogPanel(presenter, i18n, $(Images.class), $(InsertMediaGroup.class)); + final InsertMediaDialogPanel panel = new InsertMediaDialogPanel(presenter, i18n, i(Images.class), i(InsertMediaGroup.class)); presenter.init(panel); return presenter; } @@ -528,13 +527,13 @@ register(Singleton.class, new Factory<ExternalMediaRegistry>(ExternalMediaRegistry.class) { @Override public ExternalMediaRegistry create() { - return new ExternalMediaRegistry($(Session.class).getInitData().getExtMediaDescrips()); + return new ExternalMediaRegistry(i(Session.class).getInitData().getExtMediaDescrips()); }}); register(Singleton.class, new Factory<BasicGuiBinding>(BasicGuiBinding.class) { @Override public BasicGuiBinding create() { - return new BasicGuiBinding($(GuiBindingsRegister.class)); + return new BasicGuiBinding(i(GuiBindingsRegister.class)); } }); @@ -545,25 +544,25 @@ } @Override public void onAfterCreated(final GuiBindingsRegister instance) { - $(BasicGuiBinding.class); + i(BasicGuiBinding.class); } }); register(Singleton.class, new Factory<TestButton>(TestButton.class) { @Override public TestButton create() { - final TestButton btn = new TestButton($(WorkspaceSkeleton.class), $(GuiBindingsRegister.class), $(ImgResources.class)); + final TestButton btn = new TestButton(i(WorkspaceSkeleton.class), i(GuiBindingsRegister.class), i(ImgResources.class)); return btn; } }); - // $(TestButton.class); + // i(TestButton.class); - $(ApplicationComponentGroup.class).createAll(); - $(ToolGroup.class).createAll(); - $(Application.class).start(); - //$(HelloWorld.class); + i(ApplicationComponentGroup.class).createAll(); + i(ToolGroup.class).createAll(); + i(Application.class).start(); + //i(HelloWorld.class); } } \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/AbstractRTEAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/AbstractRTEAction.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/AbstractRTEAction.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -1,30 +0,0 @@ -package org.ourproject.kune.platf.client.ui.rte.basic; - -import org.ourproject.kune.platf.client.actions.AbstractAction; -import org.ourproject.kune.platf.client.actions.Action; - -import com.google.gwt.libideas.resources.client.ImageResource; - -public abstract class AbstractRTEAction extends AbstractAction { - public static final String NO_TEXT = null; - public static final ImageResource NO_ICON = null; - - public AbstractRTEAction() { - super(); - } - - public AbstractRTEAction(final String text) { - this(text, null, null); - } - - public AbstractRTEAction(final String text, final ImageResource icon) { - this(text, null, icon); - } - - public AbstractRTEAction(final String text, final String tooltip, final ImageResource icon) { - super(); - super.putValue(Action.NAME, text); - super.putValue(Action.SHORT_DESCRIPTION, tooltip); - super.putValue(Action.SMALL_ICON, icon); - } -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -1,51 +0,0 @@ -package org.ourproject.kune.platf.client.ui.rte.basic; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.actions.ActionAddCondition; -import org.ourproject.kune.platf.client.actions.ActionCollection; -import org.ourproject.kune.platf.client.actions.ActionDescriptor; -import org.ourproject.kune.platf.client.actions.ActionToolbarPosition; -import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar; - -import com.calclab.suco.client.events.Listener0; - -public interface RTEditor { - - ActionToolbarPosition TOPBAR = new ActionToolbarPosition("rte-topbar"); - ActionToolbarPosition SNDBAR = new ActionToolbarPosition("rte-sndbar");; - ActionToolbarPosition LINKCTX = new ActionToolbarPosition("rte-linkctx");; - - void addAction(ActionDescriptor<Object> action); - - void addActions(ActionCollection<Object> actions); - - void addOnEditListener(Listener0 listener); - - void attach(); - - ActionAddCondition<Object> canBeBasic(); - - ActionAddCondition<Object> canBeExtended(); - - void detach(); - - View getEditorArea(); - - String getHtml(); - - ActionToolbar<Object> getSndBar(); - - String getText(); - - ActionToolbar<Object> getTopBar(); - - void reset(); - - void setExtended(boolean extended); - - void setFocus(boolean focus); - - void setHtml(String html); - - void setText(String text); -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -1,443 +0,0 @@ -package org.ourproject.kune.platf.client.ui.rte.basic; - -import java.util.Date; - -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.ActionManager; -import org.ourproject.kune.platf.client.i18n.I18nUITranslationService; -import org.ourproject.kune.platf.client.shortcuts.GlobalShortcutRegister; -import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor; -import org.ourproject.kune.platf.client.shortcuts.ShortcutRegister; -import org.ourproject.kune.platf.client.ui.noti.NotifyUser; -import org.ourproject.kune.platf.client.ui.rte.RichTextArea; -import org.ourproject.kune.platf.client.ui.rte.insertlink.LinkExecutableUtils; -import org.ourproject.kune.platf.client.ui.rte.insertlink.LinkInfo; -import org.xwiki.gwt.dom.client.DocumentFragment; -import org.xwiki.gwt.dom.client.Range; -import org.xwiki.gwt.dom.client.Selection; - -import com.allen_sauer.gwt.log.client.Log; -import com.calclab.suco.client.events.Listener0; -import com.google.gwt.dom.client.Element; -import com.google.gwt.event.dom.client.KeyCodes; -import com.google.gwt.user.client.Command; -import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.DeferredCommand; -import com.google.gwt.user.client.Event; -import com.google.gwt.user.client.ui.FocusListener; -import com.google.gwt.user.client.ui.Widget; - -@SuppressWarnings("deprecation") -public class RTEditorPanel extends RichTextArea implements RTEditorView { - - private class EventListener implements FocusListener { - - public void onFocus(final Widget sender) { - presenter.onEditorFocus(); - } - - public void onLostFocus(final Widget sender) { - presenter.onLostFocus(); - } - } - private final I18nUITranslationService i18n; - private final BasicFormatter basic; - private final ExtendedFormatter extended; - private final RTEditorPresenter presenter; - private final ActionManager actionManager; - private final ShortcutRegister shortcutRegister; - private final GlobalShortcutRegister globalShortcutReg; - private final RTELinkPopup linkCtxMenu; - - public RTEditorPanel(final RTEditorPresenter presenter, final I18nUITranslationService i18n, - final ActionManager actionManager, final GlobalShortcutRegister globalShortcutReg) { - this.presenter = presenter; - this.i18n = i18n; - this.actionManager = actionManager; - this.globalShortcutReg = globalShortcutReg; - basic = getBasicFormatter(); - extended = getExtendedFormatter(); - shortcutRegister = new ShortcutRegister(); - final EventListener listener = new EventListener(); - addFocusListener(listener); - setWidth("96%"); - setHeight("100%"); - linkCtxMenu = new RTELinkPopup(); - } - - public void addActions(final ActionItemCollection<Object> actionItems) { - for (final ActionItem<Object> actionItem : actionItems) { - final ActionDescriptor<Object> action = actionItem.getAction(); - if (action.hasShortcut() && action.mustBeAdded(null)) { - final ShortcutDescriptor shortcut = action.getShortcut(); - shortcutRegister.put(shortcut, actionItem); - } - } - } - - public void addCtxAction(final ActionItem<Object> actionItem) { - linkCtxMenu.addAction(actionItem, new Listener0() { - public void onEvent() { - DeferredCommand.addCommand(new Command() { - public void execute() { - actionManager.doAction(actionItem); - } - }); - } - }); - } - - public void adjustSize(final int height) { - setHeight("" + height); - } - - public boolean canBeBasic() { - return basic != null; - } - - public boolean canBeExtended() { - return extended != null; - } - - public void copy() { - extended.copy(); - } - - public void createLink(final String url) { - extended.createLink(url); - } - - public void cut() { - extended.cut(); - } - - public void delete() { - extended.delete(); - } - - public void focus() { - setFocus(true); - } - - public LinkInfo getLinkInfoIfHref() { - LinkInfo linkinfo = null; - final org.xwiki.gwt.dom.client.Element selectedAnchor = selectAndGetLink(); - if (selectedAnchor != null) { - linkinfo = LinkInfo.parse(selectedAnchor); - } else { - linkinfo = new LinkInfo(getSelectionText()); - } - Log.debug("Link info: " + linkinfo); - return linkinfo; - } - - public void getRangeInfo() { - // Selection selection = getSelection(); - // String info = "range count: " + selection.getRangeCount() + - // "<br/>focus offset: " + selection.getFocusOffset() - // + "<br/>anchor offset:" + selection.getAnchorOffset() + - // "<br/>range 0 as html: " - // + selection.getRangeAt(0).toHTML(); - // NotifyUser.info(info); - final String info = "range count: " + getFstRange().getCommonAncestorContainer().getFirstChild().getNodeName(); - NotifyUser.info(info); - } - - public String getSelectionText() { - return getFstRange().cloneContents().getInnerText(); - } - - public void hideLinkCtxMenu() { - linkCtxMenu.hide(); - } - - public void insertBlockquote() { - final DocumentFragment extracted = getFstRange().cloneContents(); - // delete(); - insertHtml("<blockquote>" + extracted.getInnerHTML() + "</blockquote>"); - focus(); - } - - public void insertComment(final String author) { - final String comment = null; - createCommentAndSelectIt(author, comment); - } - - public void insertCommentNotUsingSelection(final String author) { - getFstRange().collapse(false); - createCommentAndSelectIt(author, null); - focus(); - } - - public void insertCommentUsingSelection(final String author) { - final DocumentFragment extracted = getFstRange().cloneContents(); - extended.delete(); - final String comment = extracted.getInnerText(); - createCommentAndSelectIt(author, comment); - focus(); - } - - public void insertHorizontalRule() { - extended.insertHorizontalRule(); - } - - public void insertHtml(final String html) { - extended.insertHtml(html); - } - - public void insertImage(final String url) { - extended.insertImage(url); - } - - public void insertOrderedList() { - extended.insertOrderedList(); - } - - public void insertUnorderedList() { - extended.insertUnorderedList(); - } - - public boolean isAnythingSelected() { - return !getDocument().getSelection().isCollapsed(); - } - - public boolean isBold() { - return basic.isBold(); - } - - public boolean isCollapsed() { - return getFstRange().isCollapsed(); - } - - public boolean isCtxMenuVisible() { - return linkCtxMenu.isVisible(); - } - - public boolean isItalic() { - return basic.isItalic(); - } - - public boolean isLink() { - if (isAttached() && LinkExecutableUtils.getSelectedAnchor(this) != null) { - return true; - } else { - return false; - } - } - - public boolean isStrikethrough() { - return extended.isStrikethrough(); - } - - public boolean isSubscript() { - return basic.isSubscript(); - } - - public boolean isSuperscript() { - return basic.isSuperscript(); - } - - public boolean isUnderlined() { - return basic.isUnderlined(); - } - - public void justifyCenter() { - basic.setJustification(Justification.CENTER); - } - - public void justifyLeft() { - basic.setJustification(Justification.LEFT); - } - - public void justifyRight() { - basic.setJustification(Justification.RIGHT); - } - - public void leftIndent() { - extended.leftIndent(); - } - - @SuppressWarnings("unchecked") - @Override - public void onBrowserEvent(final Event event) { - switch (DOM.eventGetType(event)) { - case Event.ONCLICK: - updateStatus(); - updateLinkInfo(); - super.onBrowserEvent(event); - break; - case Event.ONKEYDOWN: - final ActionItem rtaActionItem = shortcutRegister.get(event); - final ActionItem actionItem = rtaActionItem != null ? rtaActionItem : globalShortcutReg.get(event); - if (actionItem != null) { - updateStatus(); - fireEdit(); - event.cancelBubble(true); - event.preventDefault(); - actionManager.doAction(actionItem); - updateStatus(); - } else { - super.onBrowserEvent(event); - updateStatus(); - updateLinkInfo(); - if (isAnEditionKey(event.getKeyCode())) { - fireEdit(); - } - } - break; - default: - // Rest of events - super.onBrowserEvent(event); - updateStatus(); - } - } - - public void paste() { - extended.paste(); - } - - public void redo() { - extended.redo(); - } - - public void removeFormat() { - extended.removeFormat(); - } - - public void rightIndent() { - extended.rightIndent(); - } - - public void selectAll() { - basic.selectAll(); - } - - public void selectLink() { - selectAndGetLink(); - } - - public void setBackColor(final String color) { - basic.setBackColor(color); - } - - public void setFontName(final String name) { - basic.setFontName(name); - } - - public void setFontSize(final FontSize size) { - basic.setFontSize(size); - } - - public void setForeColor(final String color) { - basic.setForeColor(color); - } - - public void showLinkCtxMenu() { - DeferredCommand.addCommand(new Command() { - public void execute() { - final org.xwiki.gwt.dom.client.Element selectedAnchor = LinkExecutableUtils.getSelectedAnchor(RTEditorPanel.this); - if (selectedAnchor != null) { - linkCtxMenu.show(RTEditorPanel.this.getAbsoluteLeft() + selectedAnchor.getAbsoluteLeft(), - RTEditorPanel.this.getAbsoluteTop() + selectedAnchor.getAbsoluteTop() + 20); - } - } - }); - - } - - public void toggleBold() { - basic.toggleBold(); - } - - public void toggleItalic() { - basic.toggleItalic(); - } - - public void toggleStrikethrough() { - extended.toggleStrikethrough(); - } - - public void toggleSubscript() { - basic.toggleSubscript(); - } - - public void toggleSuperscript() { - basic.toggleSuperscript(); - } - - public void toggleUnderline() { - basic.toggleUnderline(); - } - - public void undo() { - extended.undo(); - } - - public void unlink() { - extended.removeLink(); - } - - protected void fireEdit() { - presenter.fireOnEdit(); - } - - private void createCommentAndSelectIt(final String author, final String comment) { - final Element commentEl = createCommentElement(author, comment); - final Range innerCommentRange = getDocument().createRange(); - getFstRange().insertNode(commentEl); - innerCommentRange.selectNodeContents(commentEl.getFirstChild()); - getSelection().addRange(innerCommentRange); - fireEdit(); - } - - private Element createCommentElement(final String userName, final String insertComment) { - final String time = i18n.formatDateWithLocale(new Date(), true); - final Element span = getDocument().createSpanElement(); - final String comment = insertComment != null ? insertComment : i18n.t("type your comment here"); - span.setInnerHTML("<em>" + comment + "</em> -" + userName + " " + time); - DOM.setElementProperty(span.<com.google.gwt.user.client.Element> cast(), "className", "k-rte-comment"); - // insertHtml(" " + span.getString() + " "); - return span; - } - - private Range getFstRange() { - return getSelection().getRangeAt(0); - } - - private Selection getSelection() { - return getDocument().getSelection(); - } - - private boolean isAnEditionKey(final int keyCode) { - if (keyCode != KeyCodes.KEY_HOME && keyCode != KeyCodes.KEY_END && keyCode != KeyCodes.KEY_UP - && keyCode != KeyCodes.KEY_DOWN && keyCode != KeyCodes.KEY_LEFT && keyCode != KeyCodes.KEY_RIGHT - && keyCode != KeyCodes.KEY_PAGEDOWN && keyCode != KeyCodes.KEY_PAGEUP && keyCode != KeyCodes.KEY_ESCAPE) { - return true; - } else { - return false; - } - } - - private org.xwiki.gwt.dom.client.Element selectAndGetLink() { - final org.xwiki.gwt.dom.client.Element selectedAnchor = LinkExecutableUtils.getSelectedAnchor(this); - if (selectedAnchor != null) { - final Range range = getDocument().createRange(); - range.selectNode(selectedAnchor); - getSelection().addRange(range); - } - return selectedAnchor; - } - - private void updateLinkInfo() { - presenter.updateLinkInfo(); - } - - /** - * Updates the status of all the stateful buttons. - */ - private void updateStatus() { - presenter.updateStatus(); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -1,1051 +0,0 @@ -package org.ourproject.kune.platf.client.ui.rte.basic; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.actions.ActionAddCondition; -import org.ourproject.kune.platf.client.actions.ActionCollection; -import org.ourproject.kune.platf.client.actions.ActionDescriptor; -import org.ourproject.kune.platf.client.actions.ActionEnableCondition; -import org.ourproject.kune.platf.client.actions.ActionItem; -import org.ourproject.kune.platf.client.actions.ActionItemCollection; -import org.ourproject.kune.platf.client.actions.ActionToolbarButtonDescriptor; -import org.ourproject.kune.platf.client.actions.ActionToolbarButtonSeparator; -import org.ourproject.kune.platf.client.actions.ActionToolbarMenuDescriptor; -import org.ourproject.kune.platf.client.actions.ActionToolbarPushButtonDescriptor; -import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar; -import org.ourproject.kune.platf.client.dto.AccessRolDTO; -import org.ourproject.kune.platf.client.i18n.I18nTranslationService; -import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor; -import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.platf.client.ui.img.ImgConstants; -import org.ourproject.kune.platf.client.ui.noti.NotifyUser; -import org.ourproject.kune.platf.client.ui.palette.ColorWebSafePalette; -import org.ourproject.kune.platf.client.ui.rte.RichTextArea; -import org.ourproject.kune.platf.client.ui.rte.edithtml.EditHtmlDialog; -import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources; -import org.ourproject.kune.platf.client.ui.rte.insertimg.ImageInfo; -import org.ourproject.kune.platf.client.ui.rte.insertimg.InsertImageDialog; -import org.ourproject.kune.platf.client.ui.rte.insertlink.InsertLinkDialog; -import org.ourproject.kune.platf.client.ui.rte.insertlink.LinkInfo; -import org.ourproject.kune.platf.client.ui.rte.insertmedia.InsertMediaDialog; -import org.ourproject.kune.platf.client.ui.rte.insertspecialchar.InsertSpecialCharDialog; -import org.ourproject.kune.platf.client.ui.rte.inserttable.InsertTableDialog; -import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper; - -import com.allen_sauer.gwt.log.client.Log; -import com.calclab.suco.client.events.Event0; -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; -import com.calclab.suco.client.ioc.Provider; -import com.google.gwt.libideas.resources.client.ImageResource; - -public class RTEditorPresenter implements RTEditor { - - private final String fontNames[] = { "Times New Roman", "Arial", "Courier New", "Georgia", "Trebuchet", "Verdana" }; - private final String fontSizes[] = { "Extra small", "Very small (normal)", "Small", "Medium", "Large", - "Very large", "Extra large" }; - private static final RichTextArea.FontSize[] FONT_SIZES = new RichTextArea.FontSize[] { - RichTextArea.FontSize.XX_SMALL, RichTextArea.FontSize.X_SMALL, RichTextArea.FontSize.SMALL, - RichTextArea.FontSize.MEDIUM, RichTextArea.FontSize.LARGE, RichTextArea.FontSize.X_LARGE, - RichTextArea.FontSize.XX_LARGE }; - - private static final String EDIT_MENU = "Edit"; - private static final String INSERT_MENU = "Insert"; - private static final String FORMAT_MENU = "Format"; - private RTEditorView view; - private boolean extended; - private final AccessRolDTO accessRol; - private final I18nTranslationService i18n; - private final Session session; - private final ActionItemCollection<Object> actions; - private final RTEImgResources imgResources; - private final RTEActionTopToolbar topBar; - private final RTEActionSndToolbar sndBar; - private ActionToolbarPushButtonDescriptor<Object> bold; - private ActionToolbarPushButtonDescriptor<Object> italic; - private ActionToolbarPushButtonDescriptor<Object> underline; - private ActionToolbarPushButtonDescriptor<Object> strikethrough; - private final Event0 onEdit; - private final DeferredCommandWrapper deferred; - private final ActionAddCondition<Object> canBeBasic; - private final ActionAddCondition<Object> canBeExtended; - private final Provider<ColorWebSafePalette> paletteProvider; - private final Provider<InsertLinkDialog> insertLinkDialog; - private final Provider<EditHtmlDialog> editHtmlDialog; - private final Provider<InsertImageDialog> insertImageDialog; - private final Provider<InsertTableDialog> insertTableDialog; - private Listener<String> insertTableListener; - private Listener<LinkInfo> insertLinkListener; - private Listener<ImageInfo> insertImageListener; - private Listener<String> insertMediaListener; - private Listener<String> updateHtmlListener; - private ActionToolbarButtonDescriptor<Object> insertTableBtn; - private final Provider<InsertSpecialCharDialog> insertSpecialCharDialog; - protected Listener<String> insertSpecialCharListener; - private final Provider<InsertMediaDialog> insertMediaDialog; - protected ColorWebSafePalette palette; - - public RTEditorPresenter(final I18nTranslationService i18n, final Session session, - final RTEActionTopToolbar topBar, final RTEActionSndToolbar sndBar, final RTEImgResources imgResources, - final Provider<InsertLinkDialog> textEditorInsertElement, final Provider<ColorWebSafePalette> palette, - final Provider<EditHtmlDialog> editHtmlDialog, final Provider<InsertImageDialog> insertImageDialog, - final Provider<InsertMediaDialog> insertMediaDialog, final Provider<InsertTableDialog> insertTableDialog, - final Provider<InsertSpecialCharDialog> insertSpecialCharDialog, final DeferredCommandWrapper deferred) { - this.i18n = i18n; - this.session = session; - this.topBar = topBar; - this.sndBar = sndBar; - this.insertLinkDialog = textEditorInsertElement; - this.paletteProvider = palette; - this.editHtmlDialog = editHtmlDialog; - this.insertImageDialog = insertImageDialog; - this.insertMediaDialog = insertMediaDialog; - this.insertTableDialog = insertTableDialog; - this.insertSpecialCharDialog = insertSpecialCharDialog; - this.deferred = deferred; - styleToolbar(sndBar); - sndBar.attach(); - this.imgResources = imgResources; - extended = true; - accessRol = AccessRolDTO.Editor; - actions = new ActionItemCollection<Object>(); - this.onEdit = new Event0("onRTEEdit"); - canBeBasic = new ActionAddCondition<Object>() { - public boolean mustBeAdded(final Object param) { - return view.canBeBasic(); - } - }; - canBeExtended = new ActionAddCondition<Object>() { - public boolean mustBeAdded(final Object param) { - return isExtended(); - } - }; - } - - public void addAction(final ActionDescriptor<Object> action) { - actions.add(withNoItem(action)); - } - - public void addActions(final ActionCollection<Object> actioncollection) { - actions.addAll(withNoItem(actioncollection)); - } - - public void addOnEditListener(final Listener0 listener) { - onEdit.add(listener); - } - - public void adjustSize(final int height) { - view.adjustSize(height); - } - - public void attach() { - topBar.clear(); - sndBar.clear(); - topBar.addActions(actions, TOPBAR); - sndBar.addActions(actions, SNDBAR); - view.addActions(actions); - } - - public ActionAddCondition<Object> canBeBasic() { - return new ActionAddCondition<Object>() { - public boolean mustBeAdded(final Object param) { - return view.canBeBasic(); - } - }; - - } - - public ActionAddCondition<Object> canBeExtended() { - return new ActionAddCondition<Object>() { - public boolean mustBeAdded(final Object param) { - return view.canBeExtended(); - } - }; - } - - public void detach() { - topBar.clear(); - sndBar.clear(); - } - - public void fireOnEdit() { - onEdit.fire(); - } - - public View getEditorArea() { - return view; - } - - public String getHtml() { - return view.getHTML(); - } - - public ActionToolbar<Object> getSndBar() { - return sndBar; - } - - public String getText() { - return view.getText(); - } - - public ActionToolbar<Object> getTopBar() { - return topBar; - } - - public void init(final RTEditorView view) { - this.view = view; - createBasicActions(); - } - - public void onEditorFocus() { - hideMenus(); - } - - public void onLostFocus() { - } - - public void reset() { - hideMenus(); - hideLinkCtxMenu(); - } - - public void setExtended(final boolean extended) { - this.extended = extended; - } - - public void setFocus(final boolean focus) { - view.setFocus(focus); - } - - public void setHtml(final String html) { - view.setHTML(html); - view.focus(); - } - - public void setText(final String text) { - view.setText(text); - view.focus(); - } - - public void updateLinkInfo() { - deferred.addCommand(new Listener0() { - public void onEvent() { - if (isExtended() && view.isLink()) { - view.showLinkCtxMenu(); - } else { - hideLinkCtxMenu(); - } - } - }); - } - - public void updateStatus() { - if (view.canBeBasic()) { - sndBar.setPushButtonPressed(bold, view.isBold()); - sndBar.setPushButtonPressed(italic, view.isItalic()); - sndBar.setPushButtonPressed(underline, view.isUnderlined()); - } - if (isExtended()) { - sndBar.setPushButtonPressed(strikethrough, view.isStrikethrough()); - } - } - - private void createBasicActions() { - ActionToolbarMenuDescriptor<Object> selectAll = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR, - new Listener0() { - public void onEvent() { - view.selectAll(); - } - }); - selectAll.setIconCls(getCssName(imgResources.selectall())); - selectAll.setShortcut(new ShortcutDescriptor(true, 'A')); - selectAll.setTextDescription(i18n.t("Select all")); - selectAll.setParentMenuTitle(i18n.t(EDIT_MENU)); - selectAll.setAddCondition(canBeBasic); - selectAll.setTopSeparator(true); - selectAll.setBottomSeparator(true); - - bold = new ActionToolbarPushButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() { - public void onEvent() { - view.toggleBold(); - fireOnEdit(); - } - }); - bold.setIconCls(getCssName(imgResources.bold())); - bold.setToolTip(i18n.t("Bold")); - bold.setShortcut(new ShortcutDescriptor(true, 'B')); - bold.setAddCondition(canBeBasic); - - italic = new ActionToolbarPushButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() { - public void onEvent() { - view.toggleItalic(); - fireOnEdit(); - } - }); - italic.setIconCls(getCssName(imgResources.italic())); - italic.setToolTip(i18n.t("Italic")); - italic.setShortcut(new ShortcutDescriptor(true, 'I')); - italic.setAddCondition(canBeBasic); - italic.setAddCondition(canBeBasic); - - underline = new ActionToolbarPushButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() { - public void onEvent() { - view.toggleUnderline(); - fireOnEdit(); - } - }); - underline.setIconCls(getCssName(imgResources.underline())); - underline.setToolTip(i18n.t("Underline")); - underline.setShortcut(new ShortcutDescriptor(true, 'U')); - underline.setAddCondition(canBeBasic); - - ActionToolbarMenuDescriptor<Object> subscript = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR, - new Listener0() { - public void onEvent() { - view.toggleSubscript(); - fireOnEdit(); - } - }); - subscript.setParentMenuTitle(i18n.t(FORMAT_MENU)); - subscript.setTextDescription(i18n.t("Subscript")); - subscript.setIconCls(getCssName(imgResources.subscript())); - subscript.setShortcut(new ShortcutDescriptor(true, 188, ",")); - subscript.setAddCondition(canBeBasic); - - ActionToolbarMenuDescriptor<Object> superscript = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR, - new Listener0() { - public void onEvent() { - view.toggleSuperscript(); - fireOnEdit(); - } - }); - superscript.setParentMenuTitle(i18n.t(FORMAT_MENU)); - superscript.setTextDescription(i18n.t("Superscript")); - superscript.setIconCls(getCssName(imgResources.superscript())); - superscript.setShortcut(new ShortcutDescriptor(true, 190, ".")); - superscript.setAddCondition(canBeBasic); - - ActionToolbarButtonDescriptor<Object> justifyLeft = new ActionToolbarButtonDescriptor<Object>(accessRol, - SNDBAR, new Listener0() { - public void onEvent() { - view.justifyLeft(); - fireOnEdit(); - } - }); - justifyLeft.setIconCls(getCssName(imgResources.alignleft())); - justifyLeft.setToolTip(i18n.t("Left Justify")); - justifyLeft.setShortcut(new ShortcutDescriptor(true, 'L')); - justifyLeft.setAddCondition(canBeBasic); - - ActionToolbarButtonDescriptor<Object> justifyCentre = new ActionToolbarButtonDescriptor<Object>(accessRol, - SNDBAR, new Listener0() { - public void onEvent() { - view.justifyCenter(); - fireOnEdit(); - } - }); - justifyCentre.setIconCls(getCssName(imgResources.centerpara())); - justifyCentre.setToolTip(i18n.t("Centre Justify")); - justifyCentre.setShortcut(new ShortcutDescriptor(true, 'E')); - justifyCentre.setAddCondition(canBeBasic); - - ActionToolbarButtonDescriptor<Object> justifyRight = new ActionToolbarButtonDescriptor<Object>(accessRol, - SNDBAR, new Listener0() { - public void onEvent() { - view.justifyRight(); - fireOnEdit(); - } - }); - justifyRight.setIconCls(getCssName(imgResources.alignright())); - justifyRight.setToolTip(i18n.t("Right Justify")); - justifyRight.setShortcut(new ShortcutDescriptor(true, 'R')); - justifyRight.setAddCondition(canBeBasic); - - ActionToolbarMenuDescriptor<Object> undo = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR, - new Listener0() { - public void onEvent() { - view.undo(); - fireOnEdit(); - } - }); - undo.setShortcut(new ShortcutDescriptor(true, 'Z')); - undo.setTextDescription(i18n.t("Undo")); - undo.setParentMenuTitle(i18n.t(EDIT_MENU)); - undo.setAddCondition(canBeExtended); - undo.setIconCls(getCssName(imgResources.undo())); - - ActionToolbarMenuDescriptor<Object> redo = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR, - new Listener0() { - public void onEvent() { - view.redo(); - fireOnEdit(); - } - }); - redo.setShortcut(new ShortcutDescriptor(true, 'Y')); - redo.setTextDescription(i18n.t("Redo")); - redo.setParentMenuTitle(i18n.t(EDIT_MENU)); - redo.setAddCondition(canBeExtended); - redo.setBottomSeparator(true); - redo.setIconCls(getCssName(imgResources.redo())); - - ActionToolbarButtonDescriptor<Object> undoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR, - new Listener0() { - public void onEvent() { - view.undo(); - fireOnEdit(); - } - }); - undoBtn.setToolTip(i18n.t("Undo")); - undoBtn.setAddCondition(canBeExtended); - undoBtn.setIconCls(getCssName(imgResources.undo())); - undoBtn.setPosition(0); - - ActionToolbarButtonDescriptor<Object> redoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR, - new Listener0() { - public void onEvent() { - view.redo(); - fireOnEdit(); - } - }); - redoBtn.setToolTip(i18n.t("Redo")); - redoBtn.setAddCondition(canBeExtended); - redoBtn.setIconCls(getCssName(imgResources.redo())); - redoBtn.setPosition(1); - redoBtn.setRightSeparator(ActionToolbarButtonSeparator.separator); - - ActionToolbarMenuDescriptor<Object> copy = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR, - new Listener0() { - public void onEvent() { - view.copy(); - } - }); - copy.setShortcut(new ShortcutDescriptor(true, 'C')); - copy.setTextDescription(i18n.t("Copy")); - copy.setParentMenuTitle(i18n.t(EDIT_MENU)); - copy.setAddCondition(canBeExtended); - copy.setIconCls(getCssName(imgResources.copy())); - - ActionToolbarMenuDescriptor<Object> cut = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR, - new Listener0() { - public void onEvent() { - view.cut(); - fireOnEdit(); - } - }); - cut.setShortcut(new ShortcutDescriptor(true, 'X')); - cut.setTextDescription(i18n.t("Cut")); - cut.setParentMenuTitle(i18n.t(EDIT_MENU)); - cut.setAddCondition(canBeExtended); - cut.setIconCls(getCssName(imgResources.cut())); - - ActionToolbarMenuDescriptor<Object> paste = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR, - new Listener0() { - public void onEvent() { - view.paste(); - fireOnEdit(); - } - }); - paste.setShortcut(new ShortcutDescriptor(true, 'V')); - paste.setTextDescription(i18n.t("Paste")); - paste.setParentMenuTitle(i18n.t(EDIT_MENU)); - paste.setAddCondition(canBeExtended); - paste.setIconCls(getCssName(imgResources.paste())); - - ActionToolbarMenuDescriptor<Object> editHtml = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR, - new Listener0() { - - public void onEvent() { - if (updateHtmlListener == null) { - updateHtmlListener = new Listener<String>() { - public void onEvent(final String html) { - view.setHTML(html); - fireOnEdit(); - } - }; - } - EditHtmlDialog dialog = editHtmlDialog.get(); - dialog.setUpdateListener(updateHtmlListener); - dialog.show(); - hideLinkCtxMenu(); - dialog.setHtml(view.getHTML()); - } - }); - editHtml.setIconCls(getCssName(imgResources.edithtml())); - editHtml.setTextDescription(i18n.t("Edit HTML")); - editHtml.setParentMenuTitle(i18n.t(EDIT_MENU)); - editHtml.setAddCondition(canBeExtended); - - ActionToolbarMenuDescriptor<Object> comment = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR, - new Listener0() { - public void onEvent() { - deferred.addCommand(new Listener0() { - public void onEvent() { - view.focus(); - final String author = session.isLogged() ? session.getCurrentUser().getShortName() - : i18n.t("anonymous user"); - if (view.isAnythingSelected()) { - NotifyUser.askConfirmation(i18n.t("Insert a comment"), - i18n.t("Include the selected text in the comment?"), new Listener0() { - public void onEvent() { - // include selection in - // comment - view.insertCommentUsingSelection(author); - } - }, new Listener0() { - public void onEvent() { - // not include selection in - // comment; - view.insertCommentNotUsingSelection(author); - } - }); - } else { - // Nothing selected > create comment in - // insertion point - view.insertComment(author); - } - } - }); - } - }); - comment.setEnableCondition(new ActionEnableCondition<Object>() { - public boolean mustBeEnabled(final Object param) { - return session.isLogged(); - } - }); - comment.setShortcut(new ShortcutDescriptor(true, 'M')); - comment.setTextDescription(i18n.t("Comment")); - comment.setParentMenuTitle(i18n.t(INSERT_MENU)); - comment.setEnableCondition(isInsertHtmlSupported()); - comment.setAddCondition(canBeExtended); - - ActionToolbarMenuDescriptor<Object> hr = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR, - new Listener0() { - public void onEvent() { - view.focus(); - view.insertHorizontalRule(); - fireOnEdit(); - } - }); - hr.setTextDescription(i18n.t("Horizontal line")); - hr.setShortcut(new ShortcutDescriptor(true, true, ' ', "Space")); - hr.setIconCls(getCssName(imgResources.hfixedline())); - hr.setParentMenuTitle(i18n.t(INSERT_MENU)); - hr.setAddCondition(canBeExtended); - - ActionToolbarMenuDescriptor<Object> blockquote = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR, - new Listener0() { - public void onEvent() { - view.focus(); - view.insertBlockquote(); - fireOnEdit(); - } - }); - blockquote.setTextDescription(i18n.t("Block Quotation")); - blockquote.setParentMenuTitle(i18n.t(FORMAT_MENU)); - blockquote.setAddCondition(canBeExtended); - - ActionToolbarButtonDescriptor<Object> hrButton = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR, - new Listener0() { - public void onEvent() { - view.focus(); - view.insertHorizontalRule(); - fireOnEdit(); - } - }); - hrButton.setIconCls(getCssName(imgResources.hfixedline())); - hrButton.setToolTip(i18n.t("Horizontal line")); - hrButton.setAddCondition(canBeExtended); - - strikethrough = new ActionToolbarPushButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() { - public void onEvent() { - view.toggleStrikethrough(); - fireOnEdit(); - } - }); - strikethrough.setIconCls(getCssName(imgResources.strikeout())); - strikethrough.setToolTip(i18n.t("Strikethrough")); - strikethrough.setRightSeparator(ActionToolbarButtonSeparator.separator); - strikethrough.setAddCondition(canBeExtended); - - ActionToolbarButtonDescriptor<Object> decreaseIndent = new ActionToolbarButtonDescriptor<Object>(accessRol, - SNDBAR, new Listener0() { - public void onEvent() { - view.leftIndent(); - fireOnEdit(); - } - }); - decreaseIndent.setIconCls(getCssName(imgResources.decrementindent())); - decreaseIndent.setToolTip(i18n.t("Decrease Indent")); - decreaseIndent.setAddCondition(canBeExtended); - - ActionToolbarButtonDescriptor<Object> increaseIndent = new ActionToolbarButtonDescriptor<Object>(accessRol, - SNDBAR, new Listener0() { - public void onEvent() { - view.rightIndent(); - fireOnEdit(); - } - }); - increaseIndent.setIconCls(getCssName(imgResources.incrementindent())); - increaseIndent.setToolTip(i18n.t("Increase Indent")); - increaseIndent.setAddCondition(canBeExtended); - - ActionToolbarButtonDescriptor<Object> ol = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR, - new Listener0() { - public void onEvent() { - view.insertOrderedList(); - fireOnEdit(); - } - }); - ol.setIconCls(getCssName(imgResources.defaultnumbering())); - ol.setToolTip(i18n.t("Numbered List")); - ol.setShortcut(new ShortcutDescriptor(true, '7')); - ol.setAddCondition(canBeExtended); - - ActionToolbarButtonDescriptor<Object> ul = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR, - new Listener0() { - public void onEvent() { - view.insertUnorderedList(); - fireOnEdit(); - } - }); - ul.setIconCls(getCssName(imgResources.defaultbullet())); - ul.setToolTip(i18n.t("Bullet List")); - ul.setShortcut(new ShortcutDescriptor(true, '8')); - ul.setRightSeparator(ActionToolbarButtonSeparator.separator); - ul.setAddCondition(canBeExtended); - - ActionToolbarButtonDescriptor<Object> imgBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR, - new Listener0() { - public void onEvent() { - deferred.addCommand(new Listener0() { - public void onEvent() { - if (insertImageListener == null) { - insertImageListener = new Listener<ImageInfo>() { - public void onEvent(final ImageInfo imageInfo) { - String img = imageInfo.toString(); - Log.debug("Image: " + imageInfo); - view.focus(); - view.insertHtml(img); - fireOnEdit(); - } - }; - } - InsertImageDialog dialog = insertImageDialog.get(); - dialog.reset(); - dialog.setOnCreateImage(insertImageListener); - dialog.show(); - hideLinkCtxMenu(); - } - }); - } - }); - imgBtn.setIconCls(getCssName(imgResources.images())); - imgBtn.setToolTip(i18n.t("Insert Image")); - imgBtn.setAddCondition(canBeExtended); - - ActionToolbarMenuDescriptor<Object> imgMenu = new ActionToolbarMenuDescriptor<Object>(imgBtn); - imgMenu.setTextDescription(i18n.t("Image...")); - imgMenu.setToolTip(null); - imgMenu.setParentMenuTitle(i18n.t(INSERT_MENU)); - imgMenu.setActionPosition(TOPBAR); - - final ActionToolbarMenuDescriptor<Object> insertMedia = new ActionToolbarMenuDescriptor<Object>(accessRol, - TOPBAR, new Listener0() { - public void onEvent() { - deferred.addCommand(new Listener0() { - public void onEvent() { - if (insertMediaListener == null) { - insertMediaListener = new Listener<String>() { - public void onEvent(final String html) { - Log.debug("Media: " + html); - view.focus(); - view.insertHtml(html); - fireOnEdit(); - } - }; - } - InsertMediaDialog dialog = insertMediaDialog.get(); - dialog.setOnCreate(insertMediaListener); - dialog.show(); - hideLinkCtxMenu(); - } - }); - } - }); - insertMedia.setIconCls(getCssName(imgResources.film())); - insertMedia.setTextDescription(i18n.t("Audio/Video...")); - insertMedia.setAddCondition(canBeExtended); - insertMedia.setParentMenuTitle(i18n.t(INSERT_MENU)); - ActionToolbarButtonDescriptor<Object> createOrEditLinkBtn = new ActionToolbarButtonDescriptor<Object>( - accessRol, SNDBAR, new Listener0() { - public void onEvent() { - deferred.addCommand(new Listener0() { - public void onEvent() { - if (insertLinkListener == null) { - insertLinkListener = new Listener<LinkInfo>() { - public void onEvent(final LinkInfo linkInfo) { - String link = linkInfo.toString(); - Log.debug("Link: " + link); - view.focus(); - view.insertHtml(link); - fireOnEdit(); - } - }; - } - LinkInfo linkInfo = view.getLinkInfoIfHref(); - InsertLinkDialog dialog = insertLinkDialog.get(); - dialog.setLinkInfo(linkInfo); - dialog.setOnCreateLink(insertLinkListener); - dialog.show(); - hideLinkCtxMenu(); - String href = linkInfo.getHref(); - if (href.length() > 0) { - if (href.startsWith("mailto")) { - dialog.activateTab(2); - } else { - dialog.activateTab(1); - } - } - } - }); - } - }); - createOrEditLinkBtn.setIconCls(getCssName(imgResources.link())); - createOrEditLinkBtn.setToolTip(i18n.t("Create or Edit Link")); - createOrEditLinkBtn.setShortcut(new ShortcutDescriptor(true, 'K')); - createOrEditLinkBtn.setAddCondition(canBeExtended); - - ActionToolbarMenuDescriptor<Object> createOrEditLink = new ActionToolbarMenuDescriptor<Object>( - createOrEditLinkBtn); - createOrEditLink.setTextDescription(i18n.t("Link...") + createOrEditLinkBtn.getShortcutToS()); - createOrEditLink.setToolTip(null); - createOrEditLink.setShortcut(null); - createOrEditLink.setActionPosition(TOPBAR); - createOrEditLink.setParentMenuTitle(i18n.t(INSERT_MENU)); - - ActionToolbarMenuDescriptor<Object> editLinkCtx = new ActionToolbarMenuDescriptor<Object>(createOrEditLink); - editLinkCtx.setTextDescription(i18n.t("Change")); - editLinkCtx.setToolTip(null); - editLinkCtx.setShortcut(null); - editLinkCtx.setActionPosition(LINKCTX); - - ActionToolbarButtonDescriptor<Object> removeLink = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR, - new Listener0() { - public void onEvent() { - if (view.isAnythingSelected()) { - // we try to unlink the selection - } else { - // we try to select the complete link - view.selectLink(); - } - deferred.addCommand(new Listener0() { - public void onEvent() { - view.unlink(); - hideLinkCtxMenu(); - fireOnEdit(); - } - }); - } - }); - removeLink.setIconCls(getCssName(imgResources.linkbreak())); - removeLink.setToolTip(i18n.t("Remove Link")); - removeLink.setShortcut(new ShortcutDescriptor(true, true, 'K')); - removeLink.setAddCondition(canBeExtended); - - ActionToolbarMenuDescriptor<Object> removeLinkCtx = new ActionToolbarMenuDescriptor<Object>(removeLink); - removeLinkCtx.setTextDescription(i18n.t("Remove")); - removeLinkCtx.setToolTip(null); - removeLinkCtx.setShortcut(null); - removeLinkCtx.setActionPosition(LINKCTX); - - final ActionToolbarMenuDescriptor<Object> removeFormat = new ActionToolbarMenuDescriptor<Object>(accessRol, - TOPBAR, new Listener0() { - public void onEvent() { - view.removeFormat(); - fireOnEdit(); - } - }); - removeFormat.setIconCls(getCssName(imgResources.removeFormat())); - ShortcutDescriptor ctrl_space = new ShortcutDescriptor(true, ' ', "Space"); - removeFormat.setTextDescription(i18n.t("Clear Formatting") + (ctrl_space.toString())); - removeFormat.setAddCondition(canBeExtended); - removeFormat.setParentMenuTitle(i18n.t(FORMAT_MENU)); - removeFormat.setBottomSeparator(true); - - final ActionToolbarButtonDescriptor<Object> removeFormatBtn = new ActionToolbarButtonDescriptor<Object>( - accessRol, SNDBAR, new Listener0() { - public void onEvent() { - view.removeFormat(); - fireOnEdit(); - } - }); - removeFormatBtn.setIconCls(getCssName(imgResources.removeFormat())); - removeFormatBtn.setToolTip(i18n.t("Clear Formatting")); - removeFormatBtn.setShortcut(ctrl_space); - removeFormatBtn.setAddCondition(canBeExtended); - removeFormatBtn.setRightSeparator(ActionToolbarButtonSeparator.separator); - - final ActionToolbarMenuDescriptor<Object> insertSpecialChar = new ActionToolbarMenuDescriptor<Object>( - accessRol, TOPBAR, new Listener0() { - public void onEvent() { - NotifyUser.showProgressLoading(); - if (insertSpecialCharListener == null) { - insertSpecialCharListener = new Listener<String>() { - public void onEvent(final String character) { - view.insertHtml(character); - } - }; - } - insertSpecialCharDialog.get().setOnInsertSpecialChar(insertSpecialCharListener); - insertSpecialCharDialog.get().show(); - hideLinkCtxMenu(); - NotifyUser.hideProgress(); - } - }); - insertSpecialChar.setIconCls(getCssName(imgResources.specialchars())); - insertSpecialChar.setTextDescription(i18n.t("Special characters...")); - insertSpecialChar.setAddCondition(canBeExtended); - insertSpecialChar.setParentMenuTitle(i18n.t(INSERT_MENU)); - insertSpecialChar.setTopSeparator(true); - - final ActionToolbarMenuDescriptor<Object> insertTable = new ActionToolbarMenuDescriptor<Object>(accessRol, - TOPBAR, new Listener0() { - public void onEvent() { - onInsertTablePressed(); - } - }); - insertTable.setIconCls(getCssName(imgResources.inserttable())); - insertTable.setTextDescription(i18n.t("Table ...")); - insertTable.setAddCondition(canBeExtended); - insertTable.setParentMenuTitle(i18n.t(INSERT_MENU)); - - insertTableBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() { - public void onEvent() { - onInsertTablePressed(); - } - }); - insertTableBtn.setIconCls(getCssName(imgResources.inserttable())); - insertTableBtn.setToolTip(i18n.t("Insert Table")); - insertTableBtn.setAddCondition(canBeExtended); - insertTableBtn.setRightSeparator(ActionToolbarButtonSeparator.separator); - - final ActionToolbarButtonDescriptor<Object> fontColor = new ActionToolbarButtonDescriptor<Object>(accessRol, - SNDBAR, new Listener0() { - public void onEvent() { - getPalette(); - palette.show(getActionLeftPosition(sndBar, insertTableBtn), getActionTopPosition(sndBar, - removeFormatBtn), new Listener<String>() { - public void onEvent(final String color) { - palette.hide(); - view.setForeColor(color); - fireOnEdit(); - } - }); - hideLinkCtxMenu(); - } - }); - fontColor.setIconCls(getCssName(imgResources.fontcolor())); - fontColor.setToolTip(i18n.t("Text Colour")); - fontColor.setAddCondition(canBeBasic); - - ActionToolbarButtonDescriptor<Object> backgroundColor = new ActionToolbarButtonDescriptor<Object>(accessRol, - SNDBAR, new Listener0() { - public void onEvent() { - getPalette(); - palette.show(getActionLeftPosition(sndBar, fontColor), getActionTopPosition(sndBar, fontColor), - new Listener<String>() { - public void onEvent(final String color) { - palette.hide(); - view.setBackColor(color); - fireOnEdit(); - } - }); - hideLinkCtxMenu(); - } - }); - backgroundColor.setIconCls(getCssName(imgResources.backcolor())); - backgroundColor.setToolTip(i18n.t("Text Background Colour")); - backgroundColor.setAddCondition(canBeBasic); - - final ActionToolbarMenuDescriptor<Object> devInfo = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR, - new Listener0() { - public void onEvent() { - deferred.addCommand(new Listener0() { - public void onEvent() { - view.getRangeInfo(); - } - }); - } - }); - devInfo.setTextDescription(i18n.t("Developers info")); - devInfo.setAddCondition(canBeExtended); - devInfo.setParentMenuTitle(i18n.t(FORMAT_MENU)); - devInfo.setShortcut(new ShortcutDescriptor(false, true, false, 'I')); - - actions.add(withNoItem(bold)); - actions.add(withNoItem(italic)); - actions.add(withNoItem(underline)); - actions.add(withNoItem(strikethrough)); - - actions.add(withNoItem(justifyLeft)); - actions.add(withNoItem(justifyCentre)); - actions.add(withNoItem(justifyRight)); - - actions.add(withNoItem(undo)); - actions.add(withNoItem(redo)); - actions.add(withNoItem(copy)); - actions.add(withNoItem(cut)); - actions.add(withNoItem(paste)); - actions.add(withNoItem(selectAll)); - actions.add(withNoItem(editHtml)); - actions.add(withNoItem(removeFormat)); - actions.add(withNoItem(subscript)); - actions.add(withNoItem(superscript)); - actions.add(withNoItem(blockquote)); - actions.add(withNoItem(decreaseIndent)); - actions.add(withNoItem(increaseIndent)); - actions.add(withNoItem(ol)); - actions.add(withNoItem(ul)); - actions.add(withNoItem(removeFormatBtn)); - actions.add(withNoItem(hrButton)); - actions.add(withNoItem(imgBtn)); - actions.add(withNoItem(createOrEditLinkBtn)); - actions.add(withNoItem(removeLink)); - actions.add(withNoItem(insertTableBtn)); - actions.add(withNoItem(createOrEditLink)); - actions.add(withNoItem(imgMenu)); - actions.add(withNoItem(insertTable)); - actions.add(withNoItem(insertMedia)); - actions.add(withNoItem(insertSpecialChar)); - actions.add(withNoItem(comment)); - actions.add(withNoItem(hr)); - actions.add(withNoItem(undoBtn)); - actions.add(withNoItem(redoBtn)); - // actions.add(withNoItem(devInfo)); - - for (String fontName : this.fontNames) { - ActionToolbarMenuDescriptor<Object> fontNameAction = createFontNameAction(canBeBasic, fontName); - actions.add(withNoItem(fontNameAction)); - } - for (int fontSize = 0; fontSize < fontSizes.length; fontSize++) { - ActionToolbarMenuDescriptor<Object> fontSizeAction = createFontSizeAction(canBeBasic, fontSize, - fontSizes[fontSize]); - actions.add(withNoItem(fontSizeAction)); - } - actions.add(withNoItem(fontColor)); - actions.add(withNoItem(backgroundColor)); - - view.addCtxAction(withNoItem(removeLinkCtx)); - view.addCtxAction(withNoItem(editLinkCtx)); - } - - private ActionToolbarMenuDescriptor<Object> createFontNameAction(final ActionAddCondition<Object> canBeBasic, - final String fontName) { - final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol, SNDBAR, - new Listener0() { - public void onEvent() { - view.setFontName(fontName); - fireOnEdit(); - } - }); - font.setTextDescription("<span style=\"font-family: " + fontName + "\">" + fontName + "</span>"); - font.setParentMenuTooltip(i18n.t("Font")); - font.setParentMenuIconCls(getCssName(imgResources.charfontname())); - font.setAddCondition(canBeBasic); - return font; - } - - private ActionToolbarMenuDescriptor<Object> createFontSizeAction(final ActionAddCondition<Object> canBeBasic, - final int fontSize, final String fontSizeName) { - final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol, SNDBAR, - new Listener0() { - public void onEvent() { - view.setFontSize(FONT_SIZES[fontSize]); - fireOnEdit(); - } - }); - font.setTextDescription("<font size=\"" + (fontSize + 1) + "\">" + i18n.t(fontSizeName) + "</font>"); - font.setParentMenuTooltip(i18n.t("Font size")); - font.setParentMenuIconCls(getCssName(imgResources.fontheight())); - font.setAddCondition(canBeBasic); - font.setShortcut(new ShortcutDescriptor(true, 48 + fontSize)); - return font; - } - - private int getActionLeftPosition(final ActionToolbar<Object> bar, - final ActionToolbarButtonDescriptor<Object> action) { - return bar.getLeftPosition(action); - } - - private int getActionTopPosition(final ActionToolbar<Object> bar, final ActionToolbarButtonDescriptor<Object> action) { - return bar.getTopPosition(action); - } - - private String getCssName(final ImageResource imageResource) { - return ImgConstants.CSS_SUFFIX + imageResource.getName(); - } - - private void getPalette() { - if (palette == null) { - palette = paletteProvider.get(); - } - } - - private void hideLinkCtxMenu() { - if (view.isCtxMenuVisible()) { - view.hideLinkCtxMenu(); - } - } - - private void hideMenus() { - topBar.hideAllMenus(); - sndBar.hideAllMenus(); - if (palette != null) { - palette.hide(); - } - } - - private boolean isExtended() { - return extended && view.canBeExtended(); - } - - private ActionEnableCondition<Object> isInsertHtmlSupported() { - return new ActionEnableCondition<Object>() { - public boolean mustBeEnabled(final Object param) { - return true; - } - }; - } - - private void onInsertTablePressed() { - if (insertTableListener == null) { - insertTableListener = new Listener<String>() { - public void onEvent(final String table) { - if (view.isAnythingSelected()) { - // move to end of selection? - } - view.insertHtml(table); - fireOnEdit(); - } - }; - } - insertTableDialog.get().setOnInsertTable(insertTableListener); - insertTableDialog.get().show(); - } - - private void styleToolbar(final ActionToolbar<Object> bar) { - bar.setNormalStyle(); - } - - private ActionItemCollection<Object> withNoItem(final ActionCollection<Object> actions) { - ActionItemCollection<Object> collection = new ActionItemCollection<Object>(); - for (ActionDescriptor<Object> action : actions) { - // this action don't have a associated item - collection.add(withNoItem(action)); - } - return collection; - } - - private ActionItem<Object> withNoItem(final ActionDescriptor<Object> action) { - return new ActionItem<Object>(action, null); - } -} Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenterNew.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenterNew.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenterNew.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -1,7 +1,7 @@ package org.ourproject.kune.platf.client.ui.rte.basic; -import static org.ourproject.kune.platf.client.ui.rte.basic.AbstractRTEAction.NO_ICON; -import static org.ourproject.kune.platf.client.ui.rte.basic.AbstractRTEAction.NO_TEXT; +import static org.ourproject.kune.platf.client.actions.AbstractExtendedAction.NO_ICON; +import static org.ourproject.kune.platf.client.actions.AbstractExtendedAction.NO_TEXT; import java.util.ArrayList; import java.util.HashMap; @@ -10,6 +10,7 @@ import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.actions.AbstractAction; +import org.ourproject.kune.platf.client.actions.AbstractExtendedAction; import org.ourproject.kune.platf.client.actions.Action; import org.ourproject.kune.platf.client.actions.ActionEvent; import org.ourproject.kune.platf.client.actions.InputMap; @@ -53,7 +54,7 @@ public class RTEditorPresenterNew implements RTEditorNew { - public class BackgroundColorAction extends AbstractRTEAction { + public class BackgroundColorAction extends AbstractExtendedAction { public BackgroundColorAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); @@ -72,7 +73,7 @@ } } - public class BlockquoteAction extends AbstractRTEAction { + public class BlockquoteAction extends AbstractExtendedAction { public BlockquoteAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -84,7 +85,7 @@ } } - public class BoldAction extends AbstractRTEAction { + public class BoldAction extends AbstractExtendedAction { public BoldAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -95,7 +96,7 @@ } } - public class CommentAction extends AbstractRTEAction { + public class CommentAction extends AbstractExtendedAction { public CommentAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -136,7 +137,7 @@ } } - public class CopyAction extends AbstractRTEAction { + public class CopyAction extends AbstractExtendedAction { public CopyAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -146,7 +147,7 @@ } } - public class CreateOrEditLinkAction extends AbstractRTEAction { + public class CreateOrEditLinkAction extends AbstractExtendedAction { public CreateOrEditLinkAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -189,7 +190,7 @@ } } - public class CutAction extends AbstractRTEAction { + public class CutAction extends AbstractExtendedAction { public CutAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -200,7 +201,7 @@ } } - public class DecreaseIndentAction extends AbstractRTEAction { + public class DecreaseIndentAction extends AbstractExtendedAction { public DecreaseIndentAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -211,7 +212,7 @@ } } - public class DevInfoAction extends AbstractRTEAction { + public class DevInfoAction extends AbstractExtendedAction { public DevInfoAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -225,7 +226,7 @@ } } - public class EditHtmlAction extends AbstractRTEAction { + public class EditHtmlAction extends AbstractExtendedAction { private EditHtmlDialog editHtmlDialog; public EditHtmlAction(final String text, final String tooltip, final ImageResource icon) { @@ -251,7 +252,7 @@ } } - public class FontAction extends AbstractRTEAction { + public class FontAction extends AbstractExtendedAction { public static final String FONT_NAME = "fontname"; public FontAction(final String fontName, final String tooltip, final ImageResource icon) { @@ -271,7 +272,7 @@ } } - public class FontColorAction extends AbstractRTEAction { + public class FontColorAction extends AbstractExtendedAction { public FontColorAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -290,7 +291,7 @@ } } - public class FontSizeAction extends AbstractRTEAction { + public class FontSizeAction extends AbstractExtendedAction { private final int fontSize; public FontSizeAction(final String fontSizeName, final int fontSize, final String tooltip, @@ -306,7 +307,7 @@ } } - public class HrAction extends AbstractRTEAction { + public class HrAction extends AbstractExtendedAction { public HrAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -318,7 +319,7 @@ } } - public class ImgAction extends AbstractRTEAction { + public class ImgAction extends AbstractExtendedAction { public ImgAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -350,7 +351,7 @@ } } - public class IncreaseIndentAction extends AbstractRTEAction { + public class IncreaseIndentAction extends AbstractExtendedAction { public IncreaseIndentAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -361,7 +362,7 @@ } } - public class InsertMediaAction extends AbstractRTEAction { + public class InsertMediaAction extends AbstractExtendedAction { public InsertMediaAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -392,7 +393,7 @@ } } - public class InsertSpecialCharAction extends AbstractRTEAction { + public class InsertSpecialCharAction extends AbstractExtendedAction { private InsertSpecialCharDialog insCharDialog; public InsertSpecialCharAction(final String text, final String tooltip, final ImageResource icon) { @@ -418,7 +419,7 @@ } } - public class InsertTableAction extends AbstractRTEAction { + public class InsertTableAction extends AbstractExtendedAction { private InsertTableDialog insTableDialog; public InsertTableAction(final String text, final String tooltip, final ImageResource icon) { @@ -442,7 +443,7 @@ } } - public class ItalicAction extends AbstractRTEAction { + public class ItalicAction extends AbstractExtendedAction { public ItalicAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -453,7 +454,7 @@ } } - public class JustifyCentreAction extends AbstractRTEAction { + public class JustifyCentreAction extends AbstractExtendedAction { public JustifyCentreAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -464,7 +465,7 @@ } } - public class JustifyLeftAction extends AbstractRTEAction { + public class JustifyLeftAction extends AbstractExtendedAction { public JustifyLeftAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -475,7 +476,7 @@ } } - public class JustifyRightAction extends AbstractRTEAction { + public class JustifyRightAction extends AbstractExtendedAction { public JustifyRightAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -486,7 +487,7 @@ } } - public class OlAction extends AbstractRTEAction { + public class OlAction extends AbstractExtendedAction { public OlAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -497,7 +498,7 @@ } } - public class PasteAction extends AbstractRTEAction { + public class PasteAction extends AbstractExtendedAction { public PasteAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -508,7 +509,7 @@ } } - public class RedoAction extends AbstractRTEAction { + public class RedoAction extends AbstractExtendedAction { public RedoAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -519,7 +520,7 @@ } } - public class RemoveFormatAction extends AbstractRTEAction { + public class RemoveFormatAction extends AbstractExtendedAction { public RemoveFormatAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -530,7 +531,7 @@ } } - public class RemoveLinkAction extends AbstractRTEAction { + public class RemoveLinkAction extends AbstractExtendedAction { public RemoveLinkAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -546,7 +547,7 @@ } } - public class SelectAllAction extends AbstractRTEAction { + public class SelectAllAction extends AbstractExtendedAction { public SelectAllAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -556,7 +557,7 @@ } } - public class StrikethroughAction extends AbstractRTEAction { + public class StrikethroughAction extends AbstractExtendedAction { public StrikethroughAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -567,7 +568,7 @@ } } - public class SubscriptAction extends AbstractRTEAction { + public class SubscriptAction extends AbstractExtendedAction { public SubscriptAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -578,7 +579,7 @@ } } - public class SuperscriptAction extends AbstractRTEAction { + public class SuperscriptAction extends AbstractExtendedAction { public SuperscriptAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -589,7 +590,7 @@ } } - public class UlAction extends AbstractRTEAction { + public class UlAction extends AbstractExtendedAction { public UlAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -600,7 +601,7 @@ } } - public class UnderlineAction extends AbstractRTEAction { + public class UnderlineAction extends AbstractExtendedAction { public UnderlineAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -611,7 +612,7 @@ } } - public class UndoAction extends AbstractRTEAction { + public class UndoAction extends AbstractExtendedAction { public UndoAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -889,7 +890,7 @@ final ToolbarSeparatorDescriptor sndbarSepExt = new ToolbarSeparatorDescriptor(Type.separator, getSndBar()); sndbarSepExt.setAddCondition(extendedAddCond); - final SelectAllAction selectAllAction = new SelectAllAction(i18n.t("Select all"), AbstractRTEAction.NO_TEXT, + final SelectAllAction selectAllAction = new SelectAllAction(i18n.t("Select all"), AbstractExtendedAction.NO_TEXT, imgResources.selectall()); final MenuItemDescriptor select = new MenuItemDescriptor(editMenu, selectAllAction); setActionShortcut(KeyStroke.getKeyStroke(Character.valueOf('A'), Keyboard.MODIFIER_CTRL), selectAllAction); @@ -910,12 +911,12 @@ final SubscriptAction subscriptAction = new SubscriptAction(i18n.t("Subscript"), NO_TEXT, imgResources.subscript()); final MenuItemDescriptor subscript = new MenuItemDescriptor(formatMenu, subscriptAction); - setActionShortcut(KeyStroke.getKeyStroke(Keyboard.KEY_COMMA, Keyboard.MODIFIER_CTRL), subscriptAction); + setActionShortcut(KeyStroke.getKeyStroke(Character.valueOf(','), Keyboard.MODIFIER_CTRL), subscriptAction); final SuperscriptAction superscriptAction = new SuperscriptAction(i18n.t("Superscript"), NO_TEXT, imgResources.superscript()); final MenuItemDescriptor superscript = new MenuItemDescriptor(formatMenu, superscriptAction); - setActionShortcut(KeyStroke.getKeyStroke(Keyboard.KEY_PERIOD, Keyboard.MODIFIER_CTRL), superscriptAction); + setActionShortcut(KeyStroke.getKeyStroke(Character.valueOf('.'), Keyboard.MODIFIER_CTRL), superscriptAction); final JustifyLeftAction jfyLeftAction = new JustifyLeftAction(NO_TEXT, i18n.t("Left Justify"), imgResources.alignleft()); @@ -973,7 +974,8 @@ final ButtonDescriptor hlineBtn = new ButtonDescriptor(hlineBtnAction); hline.setAddCondition(extendedAddCond); hlineBtn.setAddCondition(extendedAddCond); - setActionShortcut(KeyStroke.getKeyStroke(' ', Keyboard.MODIFIER_CTRL + Keyboard.MODIFIER_SHIFT), hlineAction); + setActionShortcut(KeyStroke.getKeyStroke(Character.valueOf(' '), Keyboard.MODIFIER_CTRL + + Keyboard.MODIFIER_SHIFT), hlineAction); final BlockquoteAction blockquoteAction = new BlockquoteAction(i18n.t("Block Quotation"), NO_TEXT, NO_ICON); final MenuItemDescriptor blockquote = new MenuItemDescriptor(formatMenu, blockquoteAction); @@ -1128,8 +1130,9 @@ final MenuRadioItemDescriptor fontSizeItem = new MenuRadioItemDescriptor(fontSizeMenu, fontSizeAction, FONT_SIZEGROUP); fontSizeItem.setAddCondition(basicAddCond); - setActionShortcut(KeyStroke.getKeyStroke(Character.valueOf(((char) (48 + fontSize))), Keyboard.MODIFIER_CTRL), - fontSizeAction); + // setActionShortcut(KeyStroke.getKeyStroke(Character.valueOf(((char) + // (48 + fontSize))), Keyboard.MODIFIER_CTRL), + // fontSizeAction); fontSizeItem.setLocation(SNDBAR); actions.add(fontSizeItem); } Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -1,133 +0,0 @@ -package org.ourproject.kune.platf.client.ui.rte.basic; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.actions.ActionItem; -import org.ourproject.kune.platf.client.actions.ActionItemCollection; -import org.ourproject.kune.platf.client.ui.rte.RichTextArea.FontSize; -import org.ourproject.kune.platf.client.ui.rte.insertlink.LinkInfo; - -public interface RTEditorView extends View { - - void addActions(ActionItemCollection<Object> actions); - - void addCtxAction(ActionItem<Object> actionItem); - - void adjustSize(int height); - - boolean canBeBasic(); - - boolean canBeExtended(); - - void copy(); - - void createLink(String url); - - void cut(); - - void delete(); - - void focus(); - - String getHTML(); - - LinkInfo getLinkInfoIfHref(); - - void getRangeInfo(); - - String getSelectionText(); - - String getText(); - - void hideLinkCtxMenu(); - - void insertBlockquote(); - - void insertComment(String author); - - void insertCommentNotUsingSelection(String author); - - void insertCommentUsingSelection(String author); - - void insertHorizontalRule(); - - void insertHtml(String html); - - void insertImage(String url); - - void insertOrderedList(); - - void insertUnorderedList(); - - boolean isAnythingSelected(); - - boolean isAttached(); - - boolean isBold(); - - boolean isCtxMenuVisible(); - - boolean isItalic(); - - boolean isLink(); - - boolean isStrikethrough(); - - boolean isSubscript(); - - boolean isSuperscript(); - - boolean isUnderlined(); - - void justifyCenter(); - - void justifyLeft(); - - void justifyRight(); - - void leftIndent(); - - void paste(); - - void redo(); - - void removeFormat(); - - void rightIndent(); - - void selectAll(); - - void selectLink(); - - void setBackColor(String color); - - void setFocus(boolean focus); - - void setFontName(String name); - - void setFontSize(FontSize fontSize); - - void setForeColor(String color); - - void setHTML(String html); - - void setText(String text); - - void showLinkCtxMenu(); - - void toggleBold(); - - void toggleItalic(); - - void toggleStrikethrough(); - - void toggleSubscript(); - - void toggleSuperscript(); - - void toggleUnderline(); - - void undo(); - - void unlink(); - -} Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -1,7 +1,9 @@ package org.ourproject.kune.platf.client.ui.rte.saving; -import static org.ourproject.kune.platf.client.ui.rte.basic.AbstractRTEAction.NO_ICON; -import static org.ourproject.kune.platf.client.ui.rte.basic.AbstractRTEAction.NO_TEXT; +import static org.ourproject.kune.platf.client.actions.AbstractExtendedAction.NO_ICON; +import static org.ourproject.kune.platf.client.actions.AbstractExtendedAction.NO_TEXT; + +import org.ourproject.kune.platf.client.actions.AbstractExtendedAction; import org.ourproject.kune.platf.client.actions.ActionEvent; import org.ourproject.kune.platf.client.actions.BeforeActionListener; import org.ourproject.kune.platf.client.actions.KeyStroke; @@ -11,7 +13,6 @@ import org.ourproject.kune.platf.client.i18n.I18nTranslationService; import org.ourproject.kune.platf.client.shortcuts.Keyboard; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.platf.client.ui.rte.basic.AbstractRTEAction; import org.ourproject.kune.platf.client.ui.rte.basic.RTEditorNew; import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources; import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper; @@ -23,31 +24,32 @@ public class RTESavingEditorPresenter implements RTESavingEditor { - public class AutoSaveAction extends AbstractRTEAction { - public AutoSaveAction(final String text, final String tooltip, final ImageResource icon) { - super(text, tooltip, icon); - } + public class AutoSaveAction extends AbstractExtendedAction { + public AutoSaveAction(final String text, final String tooltip, final ImageResource icon) { + super(text, tooltip, icon); + } - public void actionPerformed(final ActionEvent actionEvent) { - autoSave = !autoSave; - if (autoSave) { - timer.schedule(AUTOSAVE_IN_MILLISECONDS); - } else { - timer.cancel(); - } + public void actionPerformed(final ActionEvent actionEvent) { + // bitwise, similar to: autoSave = !autoSave; but fast + autoSave ^= true; + if (autoSave) { + timer.schedule(AUTOSAVE_IN_MILLIS); + } else { + timer.cancel(); } - } - - public class CloseAction extends AbstractRTEAction { - public CloseAction(final String text, final String tooltip, final ImageResource icon) { - super(text, tooltip, icon); + } } - public void actionPerformed(final ActionEvent actionEvent) { - onCancelImpl(); + public class CloseAction extends AbstractExtendedAction { + public CloseAction(final String text, final String tooltip, final ImageResource icon) { + super(text, tooltip, icon); + } + + public void actionPerformed(final ActionEvent actionEvent) { + onCancelImpl(); + } } - } - public class SaveAction extends AbstractRTEAction { + public class SaveAction extends AbstractExtendedAction { public SaveAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } @@ -55,41 +57,37 @@ public void actionPerformed(final ActionEvent actionEvent) { onDoSaveImpl(); } - } + } - - - public class SaveCloseAction extends AbstractRTEAction { - public SaveCloseAction(final String text, final String tooltip, final ImageResource icon) { + public class SaveCloseAction extends AbstractExtendedAction { + public SaveCloseAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); - } + } - public void actionPerformed(final ActionEvent actionEvent) { - if (savePending) { - timer.cancel(); - onDoSaveAndCloseImpl(); - } else { - onCancelConfirmedImpl(); - } - } - } + public void actionPerformed(final ActionEvent actionEvent) { + if (savePending) { + timer.cancel(); + onDoSaveAndCloseImpl(); + } else { + onCancelConfirmedImpl(); + } + } + } - public static final String FILE_DEF_MENU_OPTION = "File"; - - public static final int AUTOSAVE_AFTER_FAILS_IN_MILLISECONS = 20000; - public static final int AUTOSAVE_IN_MILLISECONDS = 10000; + public static final int AUTOSAVE_AFTER_FAIL_MILLS = 20000; + public static final int AUTOSAVE_IN_MILLIS = 10000; private final RTEditorNew editor; private boolean autoSave; private boolean savePending; - private boolean saveAndCloseConfirmed; + private boolean saveCloseConfirmed; private Listener<String> onSave; private Listener0 onEditCancelled; private final RTEImgResources imgResources; private final TimerWrapper timer; - private final DeferredCommandWrapper deferredCommandWrapper; + private final DeferredCommandWrapper deferred; private final I18nTranslationService i18n; private final StateManager stateManager; - private final BeforeActionListener beforeStateChangeListener; + private final BeforeActionListener beforeStateChg; private RTESavingEditorView view; SaveAction saveAction; @@ -102,24 +100,25 @@ this.autoSave = autoSave; this.i18n = i18n; this.stateManager = stateManager; - this.deferredCommandWrapper = deferredCommandWrapper; + this.deferred = deferredCommandWrapper; this.imgResources = imgResources; this.savePending = false; - this.saveAndCloseConfirmed = false; + this.saveCloseConfirmed = false; createActions(); this.timer = timer; timer.configure(new Listener0() {; - public void onEvent() { - onAutoSave(); - } + public void onEvent() { + onAutoSave(); + } }); + editor.addOnEditListener(new Listener0() { public void onEvent() { onEdit(); } }); - beforeStateChangeListener = new BeforeActionListener() { + beforeStateChg = new BeforeActionListener() { public boolean beforeAction() { return beforeTokenChange(); } @@ -131,7 +130,7 @@ this.onEditCancelled = onEditCancelled; editor.setHtml(html); editor.attach(); - stateManager.addBeforeStateChangeListener(beforeStateChangeListener); + stateManager.addBeforeStateChangeListener(beforeStateChg); enableSaveBtn(false); } @@ -140,7 +139,7 @@ } public BeforeActionListener getBeforeSavingListener() { - return beforeStateChangeListener; + return beforeStateChg; } public void init(final RTESavingEditorView view) { @@ -156,7 +155,7 @@ } public void onSavedSuccessful() { - if (saveAndCloseConfirmed) { + if (saveCloseConfirmed) { onCancelConfirmed(); } else { reset(); @@ -164,9 +163,9 @@ } public void onSaveFailed() { - timer.schedule(AUTOSAVE_AFTER_FAILS_IN_MILLISECONS); - if (saveAndCloseConfirmed) { - saveAndCloseConfirmed = false; + timer.schedule(AUTOSAVE_AFTER_FAIL_MILLS); + if (saveCloseConfirmed) { + saveCloseConfirmed = false; } } @@ -183,17 +182,18 @@ } boolean beforeTokenChange() { + boolean result = false; if (savePending) { onCancelImpl(); - return false; } else { - deferredCommandWrapper.addCommand(new Listener0() { + deferred.addCommand(new Listener0() { public void onEvent() { onCancelConfirmed(); } }); - return true; + result = true; } + return result; } void onDoSave() { @@ -204,14 +204,13 @@ if (!savePending) { savePending = true; if (autoSave) { - timer.schedule(AUTOSAVE_IN_MILLISECONDS); + timer.schedule(AUTOSAVE_IN_MILLIS); } enableSaveBtn(true); } } private void createActions() { - saveAction = new SaveAction(NO_TEXT, i18n.t("Save"),imgResources.save()); final ButtonDescriptor saveBtn = new ButtonDescriptor(saveAction); @@ -228,7 +227,7 @@ final AutoSaveAction autoSaveAction = new AutoSaveAction(i18n.t("Autosave"), NO_TEXT, NO_ICON); final MenuCheckItemDescriptor autoSaveItem = new MenuCheckItemDescriptor(editor.getFileMenu(), autoSaveAction) { @Override - public boolean isChecked() { + public boolean isChecked() { //autoSaveItem.setChecked(autoSave); return autoSave; }}; @@ -249,7 +248,6 @@ editor.addAction(autoSaveItem); editor.addAction(saveClose); editor.addAction(saveCloseBtn); - //FIXME editor.addAction(new ToolbarSeparatorDescriptor(Type.fill)); editor.addAction(closeItem); } @@ -259,7 +257,7 @@ } private void onCancelConfirmedImpl() { - stateManager.removeBeforeStateChangeListener(beforeStateChangeListener); + stateManager.removeBeforeStateChangeListener(beforeStateChg); stateManager.resumeTokenChange(); reset(); editor.detach(); @@ -291,18 +289,19 @@ } private void onDoSaveAndCloseImpl() { - saveAndCloseConfirmed = true; + saveCloseConfirmed = true; onDoSaveImpl(); } private void onDoSaveImpl() { - onSave.onEvent(editor.getHtml()); + final String html = editor.getHtml(); + onSave.onEvent(html); } private void reset() { timer.cancel(); savePending = false; - saveAndCloseConfirmed = false; + saveCloseConfirmed = false; enableSaveBtn(false); editor.reset(); } Modified: trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientModule.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientModule.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -25,6 +25,7 @@ import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; import org.ourproject.kune.platf.client.rpc.GroupServiceAsync; +import org.ourproject.kune.platf.client.services.AbstractExtendedModule; import org.ourproject.kune.platf.client.services.ErrorHandler; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; @@ -55,10 +56,9 @@ import org.ourproject.kune.workspace.client.upload.FileUploader; import com.calclab.suco.client.ioc.decorator.Singleton; -import com.calclab.suco.client.ioc.module.AbstractModule; import com.calclab.suco.client.ioc.module.Factory; -public class WikiClientModule extends AbstractModule { +public class WikiClientModule extends AbstractExtendedModule { @Override public void onInstall() { @@ -66,29 +66,29 @@ register(ToolGroup.class, new Factory<WikiClientTool>(WikiClientTool.class) { @Override public WikiClientTool create() { - $(WikiClientActions.class); - return new WikiClientTool($(I18nUITranslationService.class), $(ToolSelector.class), - $(WsThemePresenter.class), $(WorkspaceSkeleton.class), $(ContentCapabilitiesRegistry.class)); + i(WikiClientActions.class); + return new WikiClientTool(i(I18nUITranslationService.class), i(ToolSelector.class), + i(WsThemePresenter.class), i(WorkspaceSkeleton.class), i(ContentCapabilitiesRegistry.class)); } }); register(ToolGroup.class, new Factory<WikiClientActions>(WikiClientActions.class) { @Override public WikiClientActions create() { - return new WikiClientActions($(I18nUITranslationService.class), $(ContextNavigator.class), - $(Session.class), $(StateManager.class), $(DeferredCommandWrapper.class), - $$(ContentServiceAsync.class), $$(GroupServiceAsync.class), $$(FileUploader.class), - $(ContentActionRegistry.class), $(ContextActionRegistry.class), $$(FileDownloadUtils.class), - $(EntityHeader.class), $$(ContentEditor.class), $(ErrorHandler.class), $(WikiViewer.class), - $$(ContextPropEditor.class), $(SitePublicSpaceLink.class)); + return new WikiClientActions(i(I18nUITranslationService.class), i(ContextNavigator.class), + i(Session.class), i(StateManager.class), i(DeferredCommandWrapper.class), + p(ContentServiceAsync.class), p(GroupServiceAsync.class), p(FileUploader.class), + i(ContentActionRegistry.class), i(ContextActionRegistry.class), p(FileDownloadUtils.class), + i(EntityHeader.class), p(ContentEditor.class), i(ErrorHandler.class), i(WikiViewer.class), + p(ContextPropEditor.class), i(SitePublicSpaceLink.class)); } }); register(ToolGroup.class, new Factory<WikiContext>(WikiContext.class) { @Override public WikiContext create() { - final WikiContextPresenter presenter = new WikiContextPresenter($(StateManager.class), - $$(ContextNavigator.class), $$(ContextPropEditor.class)); + final WikiContextPresenter presenter = new WikiContextPresenter(i(StateManager.class), + p(ContextNavigator.class), p(ContextPropEditor.class)); return presenter; } }); @@ -96,11 +96,11 @@ register(Singleton.class, new Factory<WikiViewer>(WikiViewer.class) { @Override public WikiViewer create() { - final WikiViewerPresenter presenter = new WikiViewerPresenter($(StateManager.class), $(Session.class), - $(I18nUITranslationService.class), $(ActionContentToolbar.class), - $(ContentActionRegistry.class), $$(FileDownloadUtils.class), $$(MediaUtils.class)); - final WikiViewerView view = new WikiViewerPanel($(WorkspaceSkeleton.class), - $(I18nTranslationService.class)); + final WikiViewerPresenter presenter = new WikiViewerPresenter(i(StateManager.class), i(Session.class), + i(I18nUITranslationService.class), i(ActionContentToolbar.class), + i(ContentActionRegistry.class), p(FileDownloadUtils.class), p(MediaUtils.class)); + final WikiViewerView view = new WikiViewerPanel(i(WorkspaceSkeleton.class), + i(I18nTranslationService.class)); presenter.init(view); return presenter; } @@ -109,11 +109,11 @@ register(ToolGroup.class, new Factory<WikiFolderContent>(WikiFolderContent.class) { @Override public WikiFolderContent create() { - final WikiFolderContentPresenter presenter = new WikiFolderContentPresenter($(StateManager.class), - $(Session.class), $(ActionContentToolbar.class), $(ContentActionRegistry.class), - $(I18nTranslationService.class), $$(FileDownloadUtils.class), $$(MediaUtils.class)); - final WikiFolderContentView view = new WikiFolderContentPanel($(WorkspaceSkeleton.class), - $(I18nTranslationService.class)); + final WikiFolderContentPresenter presenter = new WikiFolderContentPresenter(i(StateManager.class), + i(Session.class), i(ActionContentToolbar.class), i(ContentActionRegistry.class), + i(I18nTranslationService.class), p(FileDownloadUtils.class), p(MediaUtils.class)); + final WikiFolderContentView view = new WikiFolderContentPanel(i(WorkspaceSkeleton.class), + i(I18nTranslationService.class)); presenter.init(view); return presenter; } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/RegistryModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/RegistryModule.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/RegistryModule.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -36,6 +36,7 @@ import org.ourproject.kune.platf.client.registry.VersionableRegistry; import org.ourproject.kune.platf.client.registry.XmppComentableRegistry; import org.ourproject.kune.platf.client.registry.XmppNotifyCapableRegistry; +import org.ourproject.kune.platf.client.services.AbstractExtendedModule; import org.ourproject.kune.workspace.client.cnt.ContentActionRegistry; import org.ourproject.kune.workspace.client.cnt.ContentIconsRegistry; import org.ourproject.kune.workspace.client.cxt.ContextActionRegistry; @@ -43,10 +44,9 @@ import org.ourproject.kune.workspace.client.socialnet.UserActionRegistry; import com.calclab.suco.client.ioc.decorator.Singleton; -import com.calclab.suco.client.ioc.module.AbstractModule; import com.calclab.suco.client.ioc.module.Factory; -public class RegistryModule extends AbstractModule { +public class RegistryModule extends AbstractExtendedModule { @Override protected void onInstall() { @@ -171,13 +171,13 @@ register(Singleton.class, new Factory<ContentCapabilitiesRegistry>(ContentCapabilitiesRegistry.class) { @Override public ContentCapabilitiesRegistry create() { - return new ContentCapabilitiesRegistry($(AuthorableRegistry.class), $(AclEditableRegistry.class), - $(ContentIconsRegistry.class), $(CanBeHomepageRegistry.class), $(ComentableRegistry.class), - $(DragableRegistry.class), $(DropableRegistry.class), $(EmailSubscribeAbleRegistry.class), - $(LicensableRegistry.class), $(PublishModerableRegistry.class), $(RateableRegistry.class), - $(TageableRegistry.class), $(RenamableRegistry.class), $(TranslatableRegistry.class), - $(VersionableRegistry.class), $(XmppComentableRegistry.class), - $(XmppNotifyCapableRegistry.class)); + return new ContentCapabilitiesRegistry(i(AuthorableRegistry.class), i(AclEditableRegistry.class), + i(ContentIconsRegistry.class), i(CanBeHomepageRegistry.class), i(ComentableRegistry.class), + i(DragableRegistry.class), i(DropableRegistry.class), i(EmailSubscribeAbleRegistry.class), + i(LicensableRegistry.class), i(PublishModerableRegistry.class), i(RateableRegistry.class), + i(TageableRegistry.class), i(RenamableRegistry.class), i(TranslatableRegistry.class), + i(VersionableRegistry.class), i(XmppComentableRegistry.class), + i(XmppNotifyCapableRegistry.class)); } }); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -40,6 +40,7 @@ import org.ourproject.kune.platf.client.rpc.SocialNetworkService; import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync; import org.ourproject.kune.platf.client.rpc.UserServiceAsync; +import org.ourproject.kune.platf.client.services.AbstractExtendedModule; import org.ourproject.kune.platf.client.services.ErrorHandler; import org.ourproject.kune.platf.client.services.ImageUtils; import org.ourproject.kune.platf.client.services.Images; @@ -234,12 +235,11 @@ import com.calclab.suco.client.events.Listener0; import com.calclab.suco.client.ioc.decorator.NoDecoration; import com.calclab.suco.client.ioc.decorator.Singleton; -import com.calclab.suco.client.ioc.module.AbstractModule; import com.calclab.suco.client.ioc.module.Factory; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.ServiceDefTarget; -public class WorkspaceModule extends AbstractModule { +public class WorkspaceModule extends AbstractExtendedModule { @Override protected void onInstall() { @@ -278,7 +278,7 @@ @Override public SiteProgress create() { final SiteProgressPresenter presenter = new SiteProgressPresenter(); - final SiteProgressPanel panel = new SiteProgressPanel(presenter, $$(SitePublicSpaceLink.class)); + final SiteProgressPanel panel = new SiteProgressPanel(presenter, p(SitePublicSpaceLink.class)); presenter.init(panel); return presenter; } @@ -287,18 +287,18 @@ register(ApplicationComponentGroup.class, new Factory<WorkspaceNotifyUser>(WorkspaceNotifyUser.class) { @Override public WorkspaceNotifyUser create() { - return new WorkspaceNotifyUser($(NotifyUser.class), $(I18nUITranslationService.class), - $(SiteProgress.class), $$(ToastMessage.class), $$(WorkspaceSkeleton.class)); + return new WorkspaceNotifyUser(i(NotifyUser.class), i(I18nUITranslationService.class), + i(SiteProgress.class), p(ToastMessage.class), p(WorkspaceSkeleton.class)); } }); register(ApplicationComponentGroup.class, new Factory<SitePublicSpaceLink>(SitePublicSpaceLink.class) { @Override public SitePublicSpaceLink create() { - final SitePublicSpaceLinkPresenter presenter = new SitePublicSpaceLinkPresenter($(StateManager.class), - $(StateTokenUtils.class)); + final SitePublicSpaceLinkPresenter presenter = new SitePublicSpaceLinkPresenter(i(StateManager.class), + i(StateTokenUtils.class)); final SitePublicSpaceLinkPanel panel = new SitePublicSpaceLinkPanel(presenter, - $(WorkspaceSkeleton.class), $(I18nUITranslationService.class), $(Images.class)); + i(WorkspaceSkeleton.class), i(I18nUITranslationService.class), i(Images.class)); presenter.init(panel); return presenter; } @@ -307,7 +307,7 @@ register(Singleton.class, new Factory<StateTokenUtils>(StateTokenUtils.class) { @Override public StateTokenUtils create() { - return new StateTokenUtils($(Session.class)); + return new StateTokenUtils(i(Session.class)); } }); @@ -324,10 +324,10 @@ register(ApplicationComponentGroup.class, new Factory<SiteUserMenu>(SiteUserMenu.class) { @Override public SiteUserMenu create() { - final SiteUserMenuPresenter presenter = new SiteUserMenuPresenter($(Session.class), - $(StateManager.class), $$(EntityOptions.class), $$(FileDownloadUtils.class)); - final SiteUserMenuPanel panel = new SiteUserMenuPanel(presenter, $(WorkspaceSkeleton.class), - $(I18nUITranslationService.class)); + final SiteUserMenuPresenter presenter = new SiteUserMenuPresenter(i(Session.class), + i(StateManager.class), p(EntityOptions.class), p(FileDownloadUtils.class)); + final SiteUserMenuPanel panel = new SiteUserMenuPanel(presenter, i(WorkspaceSkeleton.class), + i(I18nUITranslationService.class)); presenter.init(panel); return presenter; } @@ -336,9 +336,9 @@ register(ApplicationComponentGroup.class, new Factory<SiteSignInLink>(SiteSignInLink.class) { @Override public SiteSignInLink create() { - final SiteSignInLinkPresenter presenter = new SiteSignInLinkPresenter($(Session.class)); - final SiteSignInLinkPanel panel = new SiteSignInLinkPanel(presenter, $(I18nUITranslationService.class), - $(WorkspaceSkeleton.class)); + final SiteSignInLinkPresenter presenter = new SiteSignInLinkPresenter(i(Session.class)); + final SiteSignInLinkPanel panel = new SiteSignInLinkPanel(presenter, i(I18nUITranslationService.class), + i(WorkspaceSkeleton.class)); presenter.init(panel); return presenter; } @@ -347,10 +347,10 @@ register(ApplicationComponentGroup.class, new Factory<SiteSignOutLink>(SiteSignOutLink.class) { @Override public SiteSignOutLink create() { - final SiteSignOutLinkPresenter presenter = new SiteSignOutLinkPresenter($(Session.class), - $$(UserServiceAsync.class), $$(ErrorHandler.class)); + final SiteSignOutLinkPresenter presenter = new SiteSignOutLinkPresenter(i(Session.class), + p(UserServiceAsync.class), p(ErrorHandler.class)); final SiteSignOutLinkPanel panel = new SiteSignOutLinkPanel(presenter, - $(I18nUITranslationService.class), $(WorkspaceSkeleton.class)); + i(I18nUITranslationService.class), i(WorkspaceSkeleton.class)); presenter.init(panel); return presenter; } @@ -360,8 +360,8 @@ @Override public SiteNewGroupLink create() { final SiteNewGroupLinkPresenter presenter = new SiteNewGroupLinkPresenter(); - final SiteNewGroupLinkPanel panel = new SiteNewGroupLinkPanel(presenter, $(WorkspaceSkeleton.class), - $(I18nUITranslationService.class)); + final SiteNewGroupLinkPanel panel = new SiteNewGroupLinkPanel(presenter, i(WorkspaceSkeleton.class), + i(I18nUITranslationService.class)); presenter.init(panel); return presenter; } @@ -371,8 +371,8 @@ @Override public SiteOptions create() { final SiteOptionsPresenter presenter = new SiteOptionsPresenter(); - final SiteOptionsPanel panel = new SiteOptionsPanel(presenter, $(WorkspaceSkeleton.class), - $(I18nUITranslationService.class), $$(I18nTranslator.class), $$(TestRTEDialog.class)); + final SiteOptionsPanel panel = new SiteOptionsPanel(presenter, i(WorkspaceSkeleton.class), + i(I18nUITranslationService.class), p(I18nTranslator.class), p(TestRTEDialog.class)); presenter.init(panel); return presenter; } @@ -381,10 +381,10 @@ register(ApplicationComponentGroup.class, new Factory<SiteSearch>(SiteSearch.class) { @Override public SiteSearch create() { - final SiteSearchPresenter presenter = new SiteSearchPresenter($$(SiteSearcher.class), - $(I18nTranslationService.class)); - final SiteSearchPanel panel = new SiteSearchPanel(presenter, $(WorkspaceSkeleton.class), - $(Images.class)); + final SiteSearchPresenter presenter = new SiteSearchPresenter(p(SiteSearcher.class), + i(I18nTranslationService.class)); + final SiteSearchPanel panel = new SiteSearchPanel(presenter, i(WorkspaceSkeleton.class), + i(Images.class)); presenter.init(panel); return presenter; } @@ -393,8 +393,8 @@ register(ApplicationComponentGroup.class, new Factory<SiteLogo>(SiteLogo.class) { @Override public SiteLogo create() { - final SiteLogoPresenter presenter = new SiteLogoPresenter($(Session.class)); - final SiteLogoPanel panel = new SiteLogoPanel(presenter, $(WorkspaceSkeleton.class)); + final SiteLogoPresenter presenter = new SiteLogoPresenter(i(Session.class)); + final SiteLogoPanel panel = new SiteLogoPanel(presenter, i(WorkspaceSkeleton.class)); presenter.init(panel); return presenter; } @@ -403,10 +403,10 @@ register(ApplicationComponentGroup.class, new Factory<EntityHeader>(EntityHeader.class) { @Override public EntityHeader create() { - final EntityHeaderPresenter presenter = new EntityHeaderPresenter($(StateManager.class), - $(WsThemePresenter.class), $(Session.class)); - final EntityHeaderPanel panel = new EntityHeaderPanel($(WorkspaceSkeleton.class), - $$(FileDownloadUtils.class), $(Images.class)); + final EntityHeaderPresenter presenter = new EntityHeaderPresenter(i(StateManager.class), + i(WsThemePresenter.class), i(Session.class)); + final EntityHeaderPanel panel = new EntityHeaderPanel(i(WorkspaceSkeleton.class), + p(FileDownloadUtils.class), i(Images.class)); presenter.init(panel); return presenter; } @@ -415,10 +415,10 @@ register(ApplicationComponentGroup.class, new Factory<WsThemePresenter>(WsThemePresenter.class) { @Override public WsThemePresenter create() { - final WsThemePresenter presenter = new WsThemePresenter($(Session.class), $$(GroupServiceAsync.class), - $(StateManager.class)); - final WsThemePanel panel = new WsThemePanel($(WorkspaceSkeleton.class), presenter, - $(I18nUITranslationService.class)); + final WsThemePresenter presenter = new WsThemePresenter(i(Session.class), p(GroupServiceAsync.class), + i(StateManager.class)); + final WsThemePanel panel = new WsThemePanel(i(WorkspaceSkeleton.class), presenter, + i(I18nUITranslationService.class)); presenter.init(panel); return presenter; } @@ -427,10 +427,10 @@ register(ApplicationComponentGroup.class, new Factory<EntityTitle>(EntityTitle.class) { @Override public EntityTitle create() { - final EntityTitlePresenter presenter = new EntityTitlePresenter($(StateManager.class), - $(Session.class), $(ContentIconsRegistry.class), $(RenamableRegistry.class), - $(RenameAction.class)); - final EntityTitlePanel panel = new EntityTitlePanel($(WorkspaceSkeleton.class), presenter); + final EntityTitlePresenter presenter = new EntityTitlePresenter(i(StateManager.class), + i(Session.class), i(ContentIconsRegistry.class), i(RenamableRegistry.class), + i(RenameAction.class)); + final EntityTitlePanel panel = new EntityTitlePanel(i(WorkspaceSkeleton.class), presenter); presenter.init(panel); return presenter; } @@ -440,8 +440,8 @@ @Override public EntitySubTitle create() { final EntitySubTitlePresenter presenter = new EntitySubTitlePresenter( - $(I18nUITranslationService.class), $(StateManager.class), false, $(AuthorableRegistry.class)); - final EntitySubTitlePanel panel = new EntitySubTitlePanel(presenter, $(WorkspaceSkeleton.class)); + i(I18nUITranslationService.class), i(StateManager.class), false, i(AuthorableRegistry.class)); + final EntitySubTitlePanel panel = new EntitySubTitlePanel(presenter, i(WorkspaceSkeleton.class)); presenter.init(panel); return presenter; } @@ -450,9 +450,9 @@ register(ApplicationComponentGroup.class, new Factory<EntityLicensePresenter>(EntityLicensePresenter.class) { @Override public EntityLicensePresenter create() { - final EntityLicensePresenter presenter = new EntityLicensePresenter($(StateManager.class)); - final EntityLicensePanel panel = new EntityLicensePanel(presenter, $(I18nUITranslationService.class), - $(WorkspaceSkeleton.class)); + final EntityLicensePresenter presenter = new EntityLicensePresenter(i(StateManager.class)); + final EntityLicensePanel panel = new EntityLicensePanel(presenter, i(I18nUITranslationService.class), + i(WorkspaceSkeleton.class)); presenter.init(panel); return presenter; } @@ -461,11 +461,11 @@ register(ApplicationComponentGroup.class, new Factory<RateIt>(RateIt.class) { @Override public RateIt create() { - final RateItPresenter presenter = new RateItPresenter($(I18nUITranslationService.class), - $(Session.class), $$(ContentServiceAsync.class), $(StateManager.class), - $$(RatePresenter.class), $(ContentCapabilitiesRegistry.class)); - final RateItPanel panel = new RateItPanel(presenter, $(I18nUITranslationService.class), - $(WorkspaceSkeleton.class), $(Images.class)); + final RateItPresenter presenter = new RateItPresenter(i(I18nUITranslationService.class), + i(Session.class), p(ContentServiceAsync.class), i(StateManager.class), p(RatePresenter.class), + i(ContentCapabilitiesRegistry.class)); + final RateItPanel panel = new RateItPanel(presenter, i(I18nUITranslationService.class), + i(WorkspaceSkeleton.class), i(Images.class)); presenter.init(panel); return presenter; } @@ -474,10 +474,10 @@ register(ApplicationComponentGroup.class, new Factory<RatePresenter>(RatePresenter.class) { @Override public RatePresenter create() { - final RatePresenter presenter = new RatePresenter($(StateManager.class), - $(ContentCapabilitiesRegistry.class)); - final RatePanel panel = new RatePanel(null, null, $(I18nUITranslationService.class), - $(WorkspaceSkeleton.class)); + final RatePresenter presenter = new RatePresenter(i(StateManager.class), + i(ContentCapabilitiesRegistry.class)); + final RatePanel panel = new RatePanel(null, null, i(I18nUITranslationService.class), + i(WorkspaceSkeleton.class)); presenter.init(panel); return presenter; } @@ -493,14 +493,14 @@ register(Singleton.class, new Factory<ActionGroupSummaryToolbar>(ActionGroupSummaryToolbar.class) { @Override public ActionGroupSummaryToolbar create() { - final ActionToolbarPanel<StateToken> panel = new ActionToolbarPanel<StateToken>($$(ActionManager.class)); + final ActionToolbarPanel<StateToken> panel = new ActionToolbarPanel<StateToken>(p(ActionManager.class)); final ActionGroupSummaryToolbarPresenter toolbar = new ActionGroupSummaryToolbarPresenter(panel); return toolbar; } }, new Factory<ActionParticipationToolbar>(ActionParticipationToolbar.class) { @Override public ActionParticipationToolbar create() { - final ActionToolbarPanel<StateToken> panel = new ActionToolbarPanel<StateToken>($$(ActionManager.class)); + final ActionToolbarPanel<StateToken> panel = new ActionToolbarPanel<StateToken>(p(ActionManager.class)); final ActionParticipationSummaryToolbarPresenter toolbar = new ActionParticipationSummaryToolbarPresenter( panel); return toolbar; @@ -509,7 +509,7 @@ @Override public ActionBuddiesSummaryToolbar create() { final ActionToolbarPanel<UserSimpleDTO> panel = new ActionToolbarPanel<UserSimpleDTO>( - $$(ActionManager.class)); + p(ActionManager.class)); final ActionBuddiesSummaryToolbarPresenter toolbar = new ActionBuddiesSummaryToolbarPresenter(panel); return toolbar; } @@ -519,12 +519,12 @@ @Override public GroupMembersSummary create() { final GroupMembersSummaryPresenter presenter = new GroupMembersSummaryPresenter( - $(I18nUITranslationService.class), $(StateManager.class), $(ImageUtils.class), - $(Session.class), $$(SocialNetworkServiceAsync.class), $$(GroupServiceAsync.class), - $$(GroupLiveSearcher.class), $(WsThemePresenter.class), $$(ChatEngine.class), - $(GroupActionRegistry.class), $(ActionGroupSummaryToolbar.class), $$(FileDownloadUtils.class)); + i(I18nUITranslationService.class), i(StateManager.class), i(ImageUtils.class), + i(Session.class), p(SocialNetworkServiceAsync.class), p(GroupServiceAsync.class), + p(GroupLiveSearcher.class), i(WsThemePresenter.class), p(ChatEngine.class), + i(GroupActionRegistry.class), i(ActionGroupSummaryToolbar.class), p(FileDownloadUtils.class)); final GroupMembersSummaryView view = new GroupMembersSummaryPanel(presenter, - $(I18nUITranslationService.class), $(WorkspaceSkeleton.class), $( + i(I18nUITranslationService.class), i(WorkspaceSkeleton.class), i( ActionGroupSummaryToolbar.class).getView()); presenter.init(view); return presenter; @@ -534,10 +534,10 @@ register(ApplicationComponentGroup.class, new Factory<AddAsBuddie>(AddAsBuddie.class) { @Override public AddAsBuddie create() { - final AddAsBuddiePresenter presenter = new AddAsBuddiePresenter($$(ChatEngine.class), - $(StateManager.class), $(Session.class)); - final AddAsBuddiePanel panel = new AddAsBuddiePanel(presenter, $(EntityHeader.class), $(Images.class), - $(I18nTranslationService.class)); + final AddAsBuddiePresenter presenter = new AddAsBuddiePresenter(p(ChatEngine.class), + i(StateManager.class), i(Session.class)); + final AddAsBuddiePanel panel = new AddAsBuddiePanel(presenter, i(EntityHeader.class), i(Images.class), + i(I18nTranslationService.class)); presenter.init(panel); return presenter; } @@ -546,14 +546,14 @@ register(ApplicationComponentGroup.class, new Factory<BuddiesSummary>(BuddiesSummary.class) { @Override public BuddiesSummary create() { - final BuddiesSummaryPresenter presenter = new BuddiesSummaryPresenter($(StateManager.class), - $(Session.class), $$(UserServiceAsync.class), $(UserActionRegistry.class), - $(I18nTranslationService.class), $$(ChatEngine.class), $(ActionBuddiesSummaryToolbar.class), - $$(FileDownloadUtils.class), $(ImageUtils.class), $$(SocialNetworkServiceAsync.class), - $(GroupActionRegistry.class)); - final BuddiesSummaryPanel panel = new BuddiesSummaryPanel(presenter, $(WorkspaceSkeleton.class), - $(I18nTranslationService.class), $(ActionManager.class), - $(ActionBuddiesSummaryToolbar.class).getView()); + final BuddiesSummaryPresenter presenter = new BuddiesSummaryPresenter(i(StateManager.class), + i(Session.class), p(UserServiceAsync.class), i(UserActionRegistry.class), + i(I18nTranslationService.class), p(ChatEngine.class), i(ActionBuddiesSummaryToolbar.class), + p(FileDownloadUtils.class), i(ImageUtils.class), p(SocialNetworkServiceAsync.class), + i(GroupActionRegistry.class)); + final BuddiesSummaryPanel panel = new BuddiesSummaryPanel(presenter, i(WorkspaceSkeleton.class), + i(I18nTranslationService.class), i(ActionManager.class), + i(ActionBuddiesSummaryToolbar.class).getView()); presenter.init(panel); return presenter; } @@ -563,12 +563,12 @@ @Override public ParticipationSummary create() { final ParticipationSummaryPresenter presenter = new ParticipationSummaryPresenter( - $(I18nUITranslationService.class), $(StateManager.class), $(ImageUtils.class), - $(Session.class), $$(SocialNetworkServiceAsync.class), $(WsThemePresenter.class), - $(GroupActionRegistry.class), $(ActionParticipationToolbar.class), $$(FileDownloadUtils.class)); + i(I18nUITranslationService.class), i(StateManager.class), i(ImageUtils.class), + i(Session.class), p(SocialNetworkServiceAsync.class), i(WsThemePresenter.class), + i(GroupActionRegistry.class), i(ActionParticipationToolbar.class), p(FileDownloadUtils.class)); final ParticipationSummaryView view = new ParticipationSummaryPanel(presenter, - $(I18nUITranslationService.class), $(WorkspaceSkeleton.class), - ($(ActionParticipationToolbar.class).getView())); + i(I18nUITranslationService.class), i(WorkspaceSkeleton.class), + (i(ActionParticipationToolbar.class).getView())); presenter.init(view); return presenter; } @@ -577,10 +577,10 @@ register(ApplicationComponentGroup.class, new Factory<TagsSummary>(TagsSummary.class) { @Override public TagsSummary create() { - final TagsSummaryPresenter presenter = new TagsSummaryPresenter($(Session.class), - $$(SiteSearcher.class), $(StateManager.class), $(WsThemePresenter.class)); - final TagsSummaryPanel panel = new TagsSummaryPanel(presenter, $(I18nUITranslationService.class), - $(WorkspaceSkeleton.class)); + final TagsSummaryPresenter presenter = new TagsSummaryPresenter(i(Session.class), + p(SiteSearcher.class), i(StateManager.class), i(WsThemePresenter.class)); + final TagsSummaryPanel panel = new TagsSummaryPanel(presenter, i(I18nUITranslationService.class), + i(WorkspaceSkeleton.class)); presenter.init(panel); return presenter; } @@ -589,10 +589,10 @@ register(ApplicationComponentGroup.class, new Factory<NoHomePage>(NoHomePage.class) { @Override public NoHomePage create() { - final NoHomePagePresenter presenter = new NoHomePagePresenter($(StateManager.class), - $$(EntityHeader.class)); - final NoHomePagePanel panel = new NoHomePagePanel(presenter, $(WorkspaceSkeleton.class), - $(I18nTranslationService.class)); + final NoHomePagePresenter presenter = new NoHomePagePresenter(i(StateManager.class), + p(EntityHeader.class)); + final NoHomePagePanel panel = new NoHomePagePanel(presenter, i(WorkspaceSkeleton.class), + i(I18nTranslationService.class)); presenter.init(panel); return presenter; } @@ -601,9 +601,9 @@ register(ApplicationComponentGroup.class, new Factory<EntityOptions>(EntityOptions.class) { @Override public EntityOptions create() { - final EntityOptionsPresenter presenter = new EntityOptionsPresenter($(StateManager.class)); - final EntityOptionsPanel panel = new EntityOptionsPanel(presenter, $(EntityHeader.class), - $(I18nTranslationService.class), $(Images.class), $(EntityOptionsGroup.class)); + final EntityOptionsPresenter presenter = new EntityOptionsPresenter(i(StateManager.class)); + final EntityOptionsPanel panel = new EntityOptionsPanel(presenter, i(EntityHeader.class), + i(I18nTranslationService.class), i(Images.class), i(EntityOptionsGroup.class)); presenter.init(panel); return presenter; } @@ -613,10 +613,10 @@ @Override public EntityOptionsToolsConf create() { final EntityOptionsToolsConfPresenter presenter = new EntityOptionsToolsConfPresenter( - $(StateManager.class), $(Session.class), $(I18nTranslationService.class), - $(EntityOptions.class), $$(GroupServiceAsync.class)); + i(StateManager.class), i(Session.class), i(I18nTranslationService.class), + i(EntityOptions.class), p(GroupServiceAsync.class)); final EntityOptionsToolsConfPanel panel = new EntityOptionsToolsConfPanel(presenter, - $(WorkspaceSkeleton.class), $(I18nTranslationService.class)); + i(WorkspaceSkeleton.class), i(I18nTranslationService.class)); presenter.init(panel); return presenter; } @@ -625,11 +625,11 @@ register(EntityOptionsGroup.class, new Factory<EntityOptionsLogo>(EntityOptionsLogo.class) { @Override public EntityOptionsLogo create() { - final EntityOptionsLogoPresenter presenter = new EntityOptionsLogoPresenter($(Session.class), - $(EntityHeader.class), $(EntityOptions.class), $(StateManager.class), - $$(UserServiceAsync.class), $$(ChatEngine.class)); - final EntityOptionsLogoPanel panel = new EntityOptionsLogoPanel(presenter, $(WorkspaceSkeleton.class), - $(I18nTranslationService.class)); + final EntityOptionsLogoPresenter presenter = new EntityOptionsLogoPresenter(i(Session.class), + i(EntityHeader.class), i(EntityOptions.class), i(StateManager.class), + p(UserServiceAsync.class), p(ChatEngine.class)); + final EntityOptionsLogoPanel panel = new EntityOptionsLogoPanel(presenter, i(WorkspaceSkeleton.class), + i(I18nTranslationService.class)); presenter.init(panel); return presenter; } @@ -639,10 +639,10 @@ @Override public EntityOptionsDefLicense create() { final EntityOptionsDefLicensePresenter presenter = new EntityOptionsDefLicensePresenter( - $(EntityOptions.class), $(StateManager.class), $(Session.class), $$(LicenseWizard.class), - $$(LicenseChangeAction.class)); + i(EntityOptions.class), i(StateManager.class), i(Session.class), p(LicenseWizard.class), + p(LicenseChangeAction.class)); final EntityOptionsDefLicensePanel panel = new EntityOptionsDefLicensePanel(presenter, - $(WorkspaceSkeleton.class), $(I18nTranslationService.class)); + i(WorkspaceSkeleton.class), i(I18nTranslationService.class)); presenter.init(panel); return presenter; } @@ -653,10 +653,10 @@ @Override public EntityOptionsPublicSpaceConf create() { final EntityOptionsPublicSpaceConfPresenter presenter = new EntityOptionsPublicSpaceConfPresenter( - $(EntityOptions.class)); + i(EntityOptions.class)); final EntityOptionsPublicSpaceConfPanel panel = new EntityOptionsPublicSpaceConfPanel( - presenter, $(WorkspaceSkeleton.class), $(I18nTranslationService.class), - $(WsThemePresenter.class)); + presenter, i(WorkspaceSkeleton.class), i(I18nTranslationService.class), + i(WsThemePresenter.class)); presenter.init(panel); return presenter; } @@ -665,16 +665,15 @@ register(Singleton.class, new Factory<LicenseChangeAction>(LicenseChangeAction.class) { @Override public LicenseChangeAction create() { - return new LicenseChangeAction($$(GroupServiceAsync.class), $(Session.class), - $(I18nTranslationService.class), $(StateManager.class)); + return new LicenseChangeAction(p(GroupServiceAsync.class), i(Session.class), + i(I18nTranslationService.class), i(StateManager.class)); } }); register(Singleton.class, new Factory<RenameAction>(RenameAction.class) { @Override public RenameAction create() { - return new RenameAction($(I18nTranslationService.class), $(Session.class), - $$(ContentServiceAsync.class)); + return new RenameAction(i(I18nTranslationService.class), i(Session.class), p(ContentServiceAsync.class)); } }); @@ -682,10 +681,10 @@ @Override public LicenseWizard create() { final LicenseWizardPresenter presenter = new LicenseWizardPresenter( - $(LicenseWizardFirstFormView.class), $(LicenseWizardSndFormView.class), - $(LicenseWizardTrdFormView.class), $(LicenseWizardFrdFormView.class), $(Session.class)); - final LicenseWizardPanel panel = new LicenseWizardPanel(presenter, $(WorkspaceSkeleton.class), - $(I18nTranslationService.class)); + i(LicenseWizardFirstFormView.class), i(LicenseWizardSndFormView.class), + i(LicenseWizardTrdFormView.class), i(LicenseWizardFrdFormView.class), i(Session.class)); + final LicenseWizardPanel panel = new LicenseWizardPanel(presenter, i(WorkspaceSkeleton.class), + i(I18nTranslationService.class)); presenter.init(panel); return presenter; } @@ -694,53 +693,53 @@ register(Singleton.class, new Factory<LicenseWizardFirstFormView>(LicenseWizardFirstFormView.class) { @Override public LicenseWizardFirstFormView create() { - return new LicenseWizardFirstForm($(I18nTranslationService.class)); + return new LicenseWizardFirstForm(i(I18nTranslationService.class)); } }); register(Singleton.class, new Factory<LicenseWizardSndFormView>(LicenseWizardSndFormView.class) { @Override public LicenseWizardSndFormView create() { - return new LicenseWizardSndForm($(I18nTranslationService.class)); + return new LicenseWizardSndForm(i(I18nTranslationService.class)); } }); register(Singleton.class, new Factory<LicenseWizardTrdFormView>(LicenseWizardTrdFormView.class) { @Override public LicenseWizardTrdFormView create() { - return new LicenseWizardTrdForm($(Images.class), $(I18nTranslationService.class)); + return new LicenseWizardTrdForm(i(Images.class), i(I18nTranslationService.class)); } }); register(Singleton.class, new Factory<LicenseWizardFrdFormView>(LicenseWizardFrdFormView.class) { @Override public LicenseWizardFrdFormView create() { - return new LicenseWizardFrdForm($(I18nTranslationService.class), $(Session.class)); + return new LicenseWizardFrdForm(i(I18nTranslationService.class), i(Session.class)); } }); register(Singleton.class, new Factory<FileUploader>(FileUploader.class) { @Override public FileUploader create() { - final FileUploaderPresenter presenter = new FileUploaderPresenter($(Session.class)); - final FileUploaderDialog panel = new FileUploaderDialog(presenter, $(I18nUITranslationService.class), - $(WorkspaceSkeleton.class)); + final FileUploaderPresenter presenter = new FileUploaderPresenter(i(Session.class)); + final FileUploaderDialog panel = new FileUploaderDialog(presenter, i(I18nUITranslationService.class), + i(WorkspaceSkeleton.class)); presenter.init(panel); return presenter; } @Override public void onAfterCreated(final FileUploader uploader) { - $(ContextNavigator.class).addFileUploaderListener(uploader); + i(ContextNavigator.class).addFileUploaderListener(uploader); } }); register(Singleton.class, new Factory<SiteSearcher>(SiteSearcher.class) { @Override public SiteSearcher create() { - final SiteSearcherPresenter presenter = new SiteSearcherPresenter($$(StateManager.class)); - final SiteSearcherView view = new SiteSearcherPanel(presenter, $(I18nTranslationService.class), - $(WorkspaceSkeleton.class)); + final SiteSearcherPresenter presenter = new SiteSearcherPresenter(p(StateManager.class)); + final SiteSearcherView view = new SiteSearcherPanel(presenter, i(I18nTranslationService.class), + i(WorkspaceSkeleton.class)); presenter.init(view); return presenter; } @@ -749,10 +748,10 @@ register(Singleton.class, new Factory<I18nTranslator>(I18nTranslator.class) { @Override public I18nTranslator create() { - final I18nTranslatorPresenter presenter = new I18nTranslatorPresenter($(Session.class), - $(I18nServiceAsync.class), $(I18nUITranslationService.class)); - final I18nTranslatorView view = new I18nTranslatorPanel(presenter, $(I18nTranslationService.class), - $(LanguageSelector.class), $(WorkspaceSkeleton.class), $(Images.class)); + final I18nTranslatorPresenter presenter = new I18nTranslatorPresenter(i(Session.class), + i(I18nServiceAsync.class), i(I18nUITranslationService.class)); + final I18nTranslatorView view = new I18nTranslatorPanel(presenter, i(I18nTranslationService.class), + i(LanguageSelector.class), i(WorkspaceSkeleton.class), i(Images.class)); presenter.init(view); return presenter; } @@ -761,10 +760,10 @@ register(Singleton.class, new Factory<SignIn>(SignIn.class) { @Override public SignIn create() { - final SignInPresenter presenter = new SignInPresenter($(Session.class), $(StateManager.class), - $(I18nUITranslationService.class), $$(UserServiceAsync.class), $$(Register.class)); - final SignInView panel = new SignInPanel(presenter, $(I18nTranslationService.class), - $(WorkspaceSkeleton.class), $(Images.class)); + final SignInPresenter presenter = new SignInPresenter(i(Session.class), i(StateManager.class), + i(I18nUITranslationService.class), p(UserServiceAsync.class), p(Register.class)); + final SignInView panel = new SignInPanel(presenter, i(I18nTranslationService.class), + i(WorkspaceSkeleton.class), i(Images.class)); presenter.init(panel); return presenter; } @@ -773,10 +772,10 @@ register(Singleton.class, new Factory<Register>(Register.class) { @Override public Register create() { - final RegisterPresenter presenter = new RegisterPresenter($(Session.class), $(StateManager.class), - $(I18nUITranslationService.class), $$(UserServiceAsync.class), $$(SignIn.class)); - final RegisterView panel = new RegisterPanel(presenter, $(I18nTranslationService.class), - $(WorkspaceSkeleton.class), $(Session.class), $(Images.class)); + final RegisterPresenter presenter = new RegisterPresenter(i(Session.class), i(StateManager.class), + i(I18nUITranslationService.class), p(UserServiceAsync.class), p(SignIn.class)); + final RegisterView panel = new RegisterPanel(presenter, i(I18nTranslationService.class), + i(WorkspaceSkeleton.class), i(Session.class), i(Images.class)); presenter.init(panel); return presenter; } @@ -785,10 +784,10 @@ register(Singleton.class, new Factory<NewGroup>(NewGroup.class) { @Override public NewGroup create() { - final NewGroupPresenter presenter = new NewGroupPresenter($(I18nTranslationService.class), - $(Session.class), $(StateManager.class), $$(GroupServiceAsync.class)); - final NewGroupPanel view = new NewGroupPanel(presenter, $(I18nTranslationService.class), - $$(LicenseWizard.class), $(Images.class)); + final NewGroupPresenter presenter = new NewGroupPresenter(i(I18nTranslationService.class), + i(Session.class), i(StateManager.class), p(GroupServiceAsync.class)); + final NewGroupPanel view = new NewGroupPanel(presenter, i(I18nTranslationService.class), + p(LicenseWizard.class), i(Images.class)); presenter.init(view); return presenter; } @@ -799,7 +798,7 @@ public UserLiveSearcher create() { final UserLiveSearcherPresenter presenter = new UserLiveSearcherPresenter(); final EntityLiveSearcherView view = new UserLiveSearcherPanel(presenter, - $(I18nTranslationService.class), $(FileDownloadUtils.class)); + i(I18nTranslationService.class), i(FileDownloadUtils.class)); presenter.init(view); return presenter; } @@ -810,7 +809,7 @@ public GroupLiveSearcher create() { final GroupLiveSearcherPresenter presenter = new GroupLiveSearcherPresenter(); final EntityLiveSearcherView view = new GroupLiveSearchPanel(presenter, - $(I18nTranslationService.class), $(FileDownloadUtils.class)); + i(I18nTranslationService.class), i(FileDownloadUtils.class)); presenter.init(view); return presenter; } @@ -819,8 +818,8 @@ register(Singleton.class, new Factory<ToolSelector>(ToolSelector.class) { @Override public ToolSelector create() { - final ToolSelectorPresenter presenter = new ToolSelectorPresenter($(StateManager.class), - $(WsThemePresenter.class)); + final ToolSelectorPresenter presenter = new ToolSelectorPresenter(i(StateManager.class), + i(WsThemePresenter.class)); return presenter; } }); @@ -828,35 +827,35 @@ register(Singleton.class, new Factory<LanguageSelector>(LanguageSelector.class) { @Override public LanguageSelector create() { - final LanguageSelectorPresenter presenter = new LanguageSelectorPresenter($(Session.class)); - final LanguageSelectorView view = new LanguageSelectorPanel(presenter, $(I18nTranslationService.class)); + final LanguageSelectorPresenter presenter = new LanguageSelectorPresenter(i(Session.class)); + final LanguageSelectorView view = new LanguageSelectorPanel(presenter, i(I18nTranslationService.class)); presenter.init(view); return presenter; } }); // Register of tokens like "signin", "newgroup", "translate" etcetera - $(StateManager.class).addSiteToken(SiteToken.signin.toString(), new Listener0() { + i(StateManager.class).addSiteToken(SiteToken.signin.toString(), new Listener0() { public void onEvent() { - $(SignIn.class).doSignIn(); + i(SignIn.class).doSignIn(); } }); - $(StateManager.class).addSiteToken(SiteToken.register.toString(), new Listener0() { + i(StateManager.class).addSiteToken(SiteToken.register.toString(), new Listener0() { public void onEvent() { - $(Register.class).doRegister(); + i(Register.class).doRegister(); } }); - $(StateManager.class).addSiteToken(SiteToken.newgroup.toString(), new Listener0() { + i(StateManager.class).addSiteToken(SiteToken.newgroup.toString(), new Listener0() { public void onEvent() { - $(NewGroup.class).doNewGroup(); + i(NewGroup.class).doNewGroup(); } }); - $(StateManager.class).addSiteToken(SiteToken.translate.toString(), new Listener0() { + i(StateManager.class).addSiteToken(SiteToken.translate.toString(), new Listener0() { public void onEvent() { - $(I18nTranslator.class).doShowTranslator(); + i(I18nTranslator.class).doShowTranslator(); } }); @@ -864,8 +863,8 @@ @Override public ActionContentToolbar create() { final ActionCntCtxToolbarPanel<StateToken> tbar = new ActionCntCtxToolbarPanel<StateToken>( - AbstractFoldableContentActions.CONTENT_TOPBAR, $$(ActionManager.class), - $(WorkspaceSkeleton.class)); + AbstractFoldableContentActions.CONTENT_TOPBAR, p(ActionManager.class), + i(WorkspaceSkeleton.class)); final ActionContentToolbar toolbar = new ActionContentToolbarPresenter(tbar); return toolbar; } @@ -874,18 +873,18 @@ register(Singleton.class, new Factory<ContentEditor>(ContentEditor.class) { @Override public ContentEditor create() { - return new ContentEditor($(RTEditorNew.class), true, $(I18nTranslationService.class), - $(StateManager.class), $(SiteSignOutLink.class), $(DeferredCommandWrapper.class), - $(RTEImgResources.class), $(WorkspaceSkeleton.class), $(TimerWrapper.class), - new RTESavingEditorPanel(), $(EntityTitle.class)); + return new ContentEditor(i(RTEditorNew.class), true, i(I18nTranslationService.class), + i(StateManager.class), i(SiteSignOutLink.class), i(DeferredCommandWrapper.class), + i(RTEImgResources.class), i(WorkspaceSkeleton.class), i(TimerWrapper.class), + new RTESavingEditorPanel(), i(EntityTitle.class)); } }); register(NoDecoration.class, new Factory<ActionContextTopToolbar>(ActionContextTopToolbar.class) { @Override public ActionContextTopToolbar create() { final ActionCntCtxToolbarPanel<StateToken> panel = new ActionCntCtxToolbarPanel<StateToken>( - AbstractFoldableContentActions.CONTEXT_TOPBAR, $$(ActionManager.class), - $(WorkspaceSkeleton.class)); + AbstractFoldableContentActions.CONTEXT_TOPBAR, p(ActionManager.class), + i(WorkspaceSkeleton.class)); final ActionContextTopToolbar toolbar = new ActionContextTopToolbar(panel); return toolbar; } @@ -895,8 +894,8 @@ @Override public ActionContextBottomToolbar create() { final ActionCntCtxToolbarPanel<StateToken> panel = new ActionCntCtxToolbarPanel<StateToken>( - AbstractFoldableContentActions.CONTEXT_BOTTOMBAR, $$(ActionManager.class), - $(WorkspaceSkeleton.class)); + AbstractFoldableContentActions.CONTEXT_BOTTOMBAR, p(ActionManager.class), + i(WorkspaceSkeleton.class)); final ActionContextBottomToolbar toolbar = new ActionContextBottomToolbar(panel); return toolbar; } @@ -905,13 +904,13 @@ register(Singleton.class, new Factory<ContextNavigator>(ContextNavigator.class) { @Override public ContextNavigator create() { - final ContextNavigatorPresenter presenter = new ContextNavigatorPresenter($(StateManager.class), - $(Session.class), $(I18nTranslationService.class), $(ContentIconsRegistry.class), - $(ContentCapabilitiesRegistry.class), $(ActionContextTopToolbar.class), - $(ActionContextBottomToolbar.class), $(ContextActionRegistry.class), - $$(FileDownloadUtils.class), true, $(RenameAction.class)); + final ContextNavigatorPresenter presenter = new ContextNavigatorPresenter(i(StateManager.class), + i(Session.class), i(I18nTranslationService.class), i(ContentIconsRegistry.class), + i(ContentCapabilitiesRegistry.class), i(ActionContextTopToolbar.class), + i(ActionContextBottomToolbar.class), i(ContextActionRegistry.class), + p(FileDownloadUtils.class), true, i(RenameAction.class)); final ContextNavigatorPanel panel = new ContextNavigatorPanel(presenter, - $(I18nTranslationService.class), $(WorkspaceSkeleton.class), $(ActionManager.class)); + i(I18nTranslationService.class), i(WorkspaceSkeleton.class), i(ActionManager.class)); presenter.init(panel); return presenter; } @@ -920,12 +919,12 @@ register(Singleton.class, new Factory<ContextPropEditor>(ContextPropEditor.class) { @Override public ContextPropEditor create() { - final ContextPropEditorPresenter presenter = new ContextPropEditorPresenter($(Session.class), - $(StateManager.class), $(ContentCapabilitiesRegistry.class), $$(TagsSummary.class), - $$(ContentServiceAsync.class), $(EntitySubTitle.class)); + final ContextPropEditorPresenter presenter = new ContextPropEditorPresenter(i(Session.class), + i(StateManager.class), i(ContentCapabilitiesRegistry.class), p(TagsSummary.class), + p(ContentServiceAsync.class), i(EntitySubTitle.class)); final ContextPropEditorView view = new ContextPropEditorPanel(presenter, - $(I18nUITranslationService.class), $(WorkspaceSkeleton.class), $$(LanguageSelector.class), - $(Images.class)); + i(I18nUITranslationService.class), i(WorkspaceSkeleton.class), p(LanguageSelector.class), + i(Images.class)); presenter.init(view); return presenter; } @@ -934,10 +933,10 @@ register(InsertImageGroup.class, new Factory<InsertImageLocal>(InsertImageLocal.class) { @Override public InsertImageLocal create() { - final InsertImageLocalPresenter presenter = new InsertImageLocalPresenter($(InsertImageDialog.class), - $(Session.class)); + final InsertImageLocalPresenter presenter = new InsertImageLocalPresenter(i(InsertImageDialog.class), + i(Session.class)); final InsertImageLocalPanel panel = new InsertImageLocalPanel(presenter, - $(I18nTranslationService.class), $(FileDownloadUtils.class), $(Session.class)); + i(I18nTranslationService.class), i(FileDownloadUtils.class), i(Session.class)); presenter.init(panel); return presenter; } @@ -947,8 +946,8 @@ @Override public MaxMinWorkspace create() { final MaxMinWorkspacePresenter presenter = new MaxMinWorkspacePresenter(); - final MaxMinWorkspacePanel panel = new MaxMinWorkspacePanel(presenter, $(WorkspaceSkeleton.class), - $(Images.class), $(EntityHeader.class), $(I18nTranslationService.class)); + final MaxMinWorkspacePanel panel = new MaxMinWorkspacePanel(presenter, i(WorkspaceSkeleton.class), + i(Images.class), i(EntityHeader.class), i(I18nTranslationService.class)); presenter.init(panel); return presenter; } @@ -957,16 +956,16 @@ register(ApplicationComponentGroup.class, new Factory<GlobalShortcutRegister>(GlobalShortcutRegister.class) { @Override public GlobalShortcutRegister create() { - return new GlobalShortcutRegister($(ActionManager.class)); + return new GlobalShortcutRegister(i(ActionManager.class)); } }); register(InsertLinkGroup.class, new Factory<InsertLinkLocal>(InsertLinkLocal.class) { @Override public InsertLinkLocal create() { - final InsertLinkLocalPresenter presenter = new InsertLinkLocalPresenter($(InsertLinkDialog.class)); - final InsertLinkLocalPanel panel = new InsertLinkLocalPanel(presenter, $(WorkspaceSkeleton.class), - $(I18nTranslationService.class), $(FileDownloadUtils.class), $(StateTokenUtils.class)); + final InsertLinkLocalPresenter presenter = new InsertLinkLocalPresenter(i(InsertLinkDialog.class)); + final InsertLinkLocalPanel panel = new InsertLinkLocalPanel(presenter, i(WorkspaceSkeleton.class), + i(I18nTranslationService.class), i(FileDownloadUtils.class), i(StateTokenUtils.class)); presenter.init(panel); return presenter; } @@ -975,15 +974,15 @@ register(InsertMediaGroup.class, new Factory<InsertMediaLocal>(InsertMediaLocal.class) { @Override public InsertMediaLocal create() { - final InsertMediaLocalPresenter presenter = new InsertMediaLocalPresenter($(InsertMediaDialog.class), - $(Session.class), $$(MediaUtils.class)); + final InsertMediaLocalPresenter presenter = new InsertMediaLocalPresenter(i(InsertMediaDialog.class), + i(Session.class), p(MediaUtils.class)); final InsertMediaLocalPanel panel = new InsertMediaLocalPanel(presenter, - $(I18nTranslationService.class), $(FileDownloadUtils.class)); + i(I18nTranslationService.class), i(FileDownloadUtils.class)); presenter.init(panel); return presenter; } }); - $(GlobalShortcutRegister.class).enable(); + i(GlobalShortcutRegister.class).enable(); } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -75,7 +75,7 @@ public void addItem(final ContextNavigatorItem item) { final String nodeId = item.getId(); - TreeNode node = treePanel.getNodeById(nodeId); + final TreeNode node = treePanel.getNodeById(nodeId); if (node == null) { // Log.info("Adding tree node " + nodeId); @@ -101,7 +101,7 @@ } menuItemsContainer.createItemMenu(nodeId, item.getActionCollection(), new Listener<ActionItem<StateToken>>() { - public void onEvent(ActionItem<StateToken> actionItem) { + public void onEvent(final ActionItem<StateToken> actionItem) { doAction(actionItem); } }); @@ -115,7 +115,7 @@ } } }); - boolean isContainer = !item.getStateToken().hasAll(); + final boolean isContainer = !item.getStateToken().hasAll(); if (isContainer) { child.setExpandable(true); child.setSingleClickExpand(true); @@ -134,7 +134,7 @@ } child.addListener(new TreeNodeListenerAdapter() { @Override - public void onClick(Node node, EventObject e) { + public void onClick(final Node node, final EventObject e) { presenter.gotoToken(getToken(node)); } }); @@ -164,6 +164,10 @@ treeEditor.startEdit(getNode(id)); } + public boolean isAttached() { + return treePanel != null; + } + public boolean isSelected(final String id) { final TreeNode item = getNode(id); if (item != null) { @@ -195,7 +199,7 @@ this.isEditable = editable; } - public void setItemStatus(final String id, ContentStatusDTO status) { + public void setItemStatus(final String id, final ContentStatusDTO status) { setNodeStatus(getNode(id), status); } @@ -311,7 +315,7 @@ this.mustFireOnTextChange = fireOnTextChange; } - private void setNodeStatus(final TreeNode node, ContentStatusDTO status) { + private void setNodeStatus(final TreeNode node, final ContentStatusDTO status) { switch (status) { case publishedOnline: node.setCls("k-ctn-status-normal"); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -74,9 +74,10 @@ public ContextNavigatorPresenter(final StateManager stateManager, final Session session, final I18nTranslationService i18n, final ContentIconsRegistry contentIconsRegistry, - ContentCapabilitiesRegistry capabilitiesRegistry, final ActionToolbar<StateToken> toolbar, - ActionContextBottomToolbar bottomToolbar, final ActionRegistry<StateToken> actionRegistry, - Provider<FileDownloadUtils> downloadUtilsProvider, boolean useGenericImageIcon, RenameAction renameAction) { + final ContentCapabilitiesRegistry capabilitiesRegistry, final ActionToolbar<StateToken> toolbar, + final ActionContextBottomToolbar bottomToolbar, final ActionRegistry<StateToken> actionRegistry, + final Provider<FileDownloadUtils> downloadUtilsProvider, final boolean useGenericImageIcon, + final RenameAction renameAction) { this.stateManager = stateManager; this.session = session; this.i18n = i18n; @@ -93,9 +94,9 @@ addRenameListener(); } - public void addFileUploaderListener(FileUploader uploader) { + public void addFileUploaderListener(final FileUploader uploader) { uploader.addOnUploadCompleteListener(new Listener<StateToken>() { - public void onEvent(StateToken currentUploadStateToken) { + public void onEvent(final StateToken currentUploadStateToken) { if (currentUploadStateToken.hasSameContainer(session.getCurrentStateToken())) { stateManager.reload(); } @@ -138,7 +139,7 @@ } public void refreshState() { - StateAbstractDTO currentState = session.getCurrentState(); + final StateAbstractDTO currentState = session.getCurrentState(); if (currentState instanceof StateContainerDTO) { setState((StateContainerDTO) currentState, true); } @@ -148,7 +149,7 @@ view.selectItem(genId(stateToken)); topToolbar.disableMenusAndClearButtons(); bottomToolbar.disableMenusAndClearButtons(); - ActionItemCollection<StateToken> itemCollection = actionsByItem.get(stateToken); + final ActionItemCollection<StateToken> itemCollection = actionsByItem.get(stateToken); topToolbar.addActions(itemCollection, AbstractFoldableContentActions.CONTEXT_TOPBAR); bottomToolbar.addActions(itemCollection, AbstractFoldableContentActions.CONTEXT_BOTTOMBAR); } @@ -157,7 +158,7 @@ editOnNextStateChange = edit; } - public void setItemStatus(final StateToken stateToken, ContentStatusDTO status) { + public void setItemStatus(final StateToken stateToken, final ContentStatusDTO status) { clear(); refreshState(); } @@ -209,13 +210,13 @@ } private void addRenameListener() { - Listener2<StateToken, String> onSuccess = new Listener2<StateToken, String>() { - public void onEvent(StateToken token, String newName) { + final Listener2<StateToken, String> onSuccess = new Listener2<StateToken, String>() { + public void onEvent(final StateToken token, final String newName) { setItemText(token, newName); } }; - Listener2<StateToken, String> onFail = new Listener2<StateToken, String>() { - public void onEvent(StateToken token, String oldName) { + final Listener2<StateToken, String> onFail = new Listener2<StateToken, String>() { + public void onEvent(final StateToken token, final String oldName) { setItemText(token, oldName); } }; @@ -264,7 +265,7 @@ } } - private String getTooltip(StateToken token, BasicMimeTypeDTO mimeType) { + private String getTooltip(final StateToken token, final BasicMimeTypeDTO mimeType) { if (mimeType != null && (mimeType.isImage() || mimeType.isPdf())) { return KuneUiUtils.genQuickTipWithImage(downloadUtilsProvider.get().getImageResizedUrl(token, ImageSize.thumb), session.getImgCropsize()); @@ -288,12 +289,14 @@ } private void setItemText(final StateToken stateToken, final String name) { - view.setItemText(genId(stateToken), name); + if (view.isAttached()) { + view.setItemText(genId(stateToken), name); + } } private void setStateContainer(final StateContainerDTO state, final boolean select) { final StateToken stateToken = state.getStateToken(); - boolean isContent = (state instanceof StateContentDTO); + final boolean isContent = (state instanceof StateContentDTO); StateContentDTO stateContent = null; final ContainerDTO container = state.getContainer(); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -33,6 +33,8 @@ void editItem(String id); + boolean isAttached(); + boolean isSelected(String id); void selectItem(String id); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -1,8 +1,9 @@ package org.ourproject.kune.workspace.client.editor; -import static org.ourproject.kune.platf.client.ui.rte.basic.AbstractRTEAction.NO_ICON; -import static org.ourproject.kune.platf.client.ui.rte.basic.AbstractRTEAction.NO_TEXT; +import static org.ourproject.kune.platf.client.actions.AbstractExtendedAction.NO_ICON; +import static org.ourproject.kune.platf.client.actions.AbstractExtendedAction.NO_TEXT; +import org.ourproject.kune.platf.client.actions.AbstractExtendedAction; import org.ourproject.kune.platf.client.actions.Action; import org.ourproject.kune.platf.client.actions.ActionEvent; import org.ourproject.kune.platf.client.actions.KeyStroke; @@ -11,7 +12,6 @@ import org.ourproject.kune.platf.client.i18n.I18nTranslationService; import org.ourproject.kune.platf.client.shortcuts.Keyboard; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.platf.client.ui.rte.basic.AbstractRTEAction; import org.ourproject.kune.platf.client.ui.rte.basic.RTEditorNew; import org.ourproject.kune.platf.client.ui.rte.basic.RTEditorPanelNew; import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources; @@ -36,7 +36,7 @@ public class ContentEditor extends RTESavingEditorPresenter { - public class RenameAction extends AbstractRTEAction { + public class RenameAction extends AbstractExtendedAction { public RenameAction(final String text, final String tooltip, final ImageResource icon) { super(text, tooltip, icon); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -25,6 +25,7 @@ import org.ourproject.kune.platf.client.dto.UserSimpleDTO; import org.ourproject.kune.platf.client.i18n.I18nTranslationService; import org.ourproject.kune.platf.client.i18n.I18nTranslationServiceMocked; +import org.ourproject.kune.platf.client.services.AbstractExtendedModule; import org.ourproject.kune.platf.client.shortcuts.GlobalShortcutRegister; import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor; import org.ourproject.kune.platf.client.ui.noti.NotifyUser; @@ -37,7 +38,6 @@ import com.calclab.suco.client.events.Listener0; import com.calclab.suco.client.ioc.Provider; import com.calclab.suco.client.ioc.decorator.Singleton; -import com.calclab.suco.client.ioc.module.AbstractModule; import com.calclab.suco.client.ioc.module.Factory; import com.google.gwt.user.client.ui.Label; @@ -45,7 +45,7 @@ * This module is installed via Suco.install(new HelloWorldModule()). In kune we * do this normally in KuneEntryPoint.onModuleLoadCont() */ -public class HelloWorldModule extends AbstractModule { +public class HelloWorldModule extends AbstractExtendedModule { /** * @@ -110,7 +110,7 @@ * Summary) **/ private void createActions() { - ActionToolbarMenuDescriptor<UserSimpleDTO> helloWorldBuddiesAction = new ActionToolbarMenuDescriptor<UserSimpleDTO>( + final ActionToolbarMenuDescriptor<UserSimpleDTO> helloWorldBuddiesAction = new ActionToolbarMenuDescriptor<UserSimpleDTO>( AccessRolDTO.Viewer, AbstractFoldableContentActions.CONTENT_TOPBAR, new Listener<UserSimpleDTO>() { public void onEvent(final UserSimpleDTO parameter) { // We clicked: @@ -158,8 +158,8 @@ * can use then from other objects. * * If we want to use HelloWorld from other modules we can use: - * $(HelloWorld.class) to get a instance or $$(HelloWorld.class) to get - * a provider of the instance. This is useful when we want to do lazy + * i(HelloWorld.class) to get a instance or p(HelloWorld.class) to get a + * provider of the instance. This is useful when we want to do lazy * creation of objects: http://en.wikipedia.org/wiki/Lazy_initialization * **/ @@ -174,14 +174,14 @@ */ @Override public HelloWorld create() { - final HelloWorldPresenter presenter = new HelloWorldPresenter($(I18nTranslationServiceMocked.class), - $$(UserActionRegistry.class)); - final HelloWorldPanel panel = new HelloWorldPanel(presenter, $(WorkspaceSkeleton.class), - $(I18nTranslationServiceMocked.class)); + final HelloWorldPresenter presenter = new HelloWorldPresenter(i(I18nTranslationServiceMocked.class), + p(UserActionRegistry.class)); + final HelloWorldPanel panel = new HelloWorldPanel(presenter, i(WorkspaceSkeleton.class), + i(I18nTranslationServiceMocked.class)); presenter.init(panel); return presenter; // now Suco knows how to create HelloWorld instance when we use - // $(HelloWorld.class) or $$(HelloWorld.class in a module. + // i(HelloWorld.class) or p(HelloWorld.class in a module. } /** @@ -208,7 +208,7 @@ /** * Global shortcut sample definition */ - $(GlobalShortcutRegister.class).put(new ShortcutDescriptor(false, true, false, 'S'), new Listener0() { + i(GlobalShortcutRegister.class).put(new ShortcutDescriptor(false, true, false, 'S'), new Listener0() { public void onEvent() { NotifyUser.info("Global Ctrl+S pressed"); } @@ -217,6 +217,6 @@ // And because nobody use this module, we get the class (to force the // creation of the // Helloworld instance): - // $(HelloWorld.class); + // i(HelloWorld.class); } } \ No newline at end of file Modified: trunk/src/test/java/org/ourproject/kune/platf/client/actions/KeyStrokeTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/client/actions/KeyStrokeTest.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/test/java/org/ourproject/kune/platf/client/actions/KeyStrokeTest.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -60,10 +60,14 @@ @Test public void equalsTest() { - final KeyStroke key1 = KeyStroke.getKeyStroke(new Character('B'), Keyboard.MODIFIER_ALT); - final KeyStroke key2 = KeyStroke.getKeyStroke(new Character('B'), Keyboard.MODIFIER_ALT); - final KeyStroke key3 = KeyStroke.getKeyStroke(new Character('b'), Keyboard.MODIFIER_ALT); + final KeyStroke key1 = KeyStroke.getKeyStroke(Character.valueOf('B'), Keyboard.MODIFIER_ALT); + final KeyStroke key2 = KeyStroke.getKeyStroke(Character.valueOf('B'), Keyboard.MODIFIER_ALT); assertEquals(key1, key2); - assertEquals(key1, key3); } + + @Test + public void space() { + final KeyStroke key = KeyStroke.getKeyStroke(Character.valueOf(' '), Keyboard.MODIFIER_ALT); + assertEquals(" (Alt+Space)", key.toString()); + } } \ No newline at end of file Modified: trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenterTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenterTest.java 2009-06-10 14:37:53 UTC (rev 1124) +++ trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenterTest.java 2009-06-11 18:28:19 UTC (rev 1125) @@ -7,7 +7,6 @@ import org.junit.Test; import org.mockito.Mockito; import org.mockito.internal.verification.api.VerificationMode; -import org.ourproject.kune.platf.client.actions.ui.ComplexToolbar; import org.ourproject.kune.platf.client.i18n.I18nTranslationService; import org.ourproject.kune.platf.client.i18n.I18nTranslationServiceMocked; import org.ourproject.kune.platf.client.i18n.Resources; @@ -31,7 +30,7 @@ private DeferredCommandWrapper deferredCommandWrapper; private RTEditorNew rteEditor; private TimerWrapper timer; - private ComplexToolbar sndbar; + // private ComplexToolbar sndbar; private RTESavingEditorView view; @Before @@ -45,8 +44,8 @@ final ImageResource imageResource = Mockito.mock(ImageResource.class); Mockito.when(imageResource.getName()).thenReturn("save"); Mockito.when(imgResources.save()).thenReturn(imageResource); - sndbar = Mockito.mock(ComplexToolbar.class); - Mockito.when(rteEditor.getSndBar()).thenReturn(sndbar); + // sndbar = Mockito.mock(ComplexToolbar.class); + // Mockito.when(rteEditor.getSndBar()).thenReturn(sndbar); timer = Mockito.mock(TimerWrapper.class); view = Mockito.mock(RTESavingEditorView.class); presenter = new RTESavingEditorPresenter(rteEditor, true, i18n, stateManager, deferredCommandWrapper, @@ -83,6 +82,13 @@ } @Test + public void initialEdit() { + presenter.edit("Text to edit", saveListener, cancelListener); + checkSaveBtnDisabled(); + assertTrue(cancelListener.isNotCalled()); + } + + @Test public void initialEditWithCancel() { presenter.edit("Text to edit", saveListener, cancelListener); presenter.onCancel(); @@ -97,21 +103,13 @@ Mockito.when(rteEditor.getHtml()).thenReturn(textModified); presenter.onEdit(); presenter.onDoSave(); + presenter.onSavedSuccessful(); checkSaveBtnDisabled(); assertTrue(saveListener.isCalledWithEquals(textModified)); assertTrue(cancelListener.isNotCalled()); } @Test - public void initialEditWithSave() { - presenter.edit("Text to edit", saveListener, cancelListener); - presenter.onDoSave(); - checkSaveBtnDisabled(); - assertTrue(saveListener.isCalledOnce()); - assertTrue(cancelListener.isNotCalled()); - } - - @Test public void testSavePendingAndCancel() { presenter.edit("Text to edit", saveListener, cancelListener); final String textModified = "Text modified"; @@ -132,13 +130,13 @@ presenter.onDoSave(); presenter.onSaveFailed(); presenter.onDoSave(); - Mockito.verify(timer, Mockito.times(1)).schedule(RTESavingEditorPresenter.AUTOSAVE_IN_MILLISECONDS); - Mockito.verify(timer, Mockito.times(1)).schedule(RTESavingEditorPresenter.AUTOSAVE_AFTER_FAILS_IN_MILLISECONS); + Mockito.verify(timer, Mockito.times(1)).schedule(RTESavingEditorPresenter.AUTOSAVE_IN_MILLIS); + Mockito.verify(timer, Mockito.times(1)).schedule(RTESavingEditorPresenter.AUTOSAVE_AFTER_FAIL_MILLS); assertTrue(saveListener.isCalled(2)); } private void checkSaveBtnDisabled() { - Mockito.verify(presenter.saveAction, Mockito.times(1)).setEnabled(false); + assertFalse(presenter.saveAction.isEnabled()); } private String editAndChangeHistoryToken() {
participants (1)
-
vjrj