r912 - in trunk/src/main: java/org/ourproject/kune/platf/client/services java/org/ourproject/kune/platf/client/ui java/org/ourproject/kune/platf/server/manager/impl java/org/ourproject/kune/workspace/client/ctxnav resources
Author: vjrj Date: 2008-10-15 19:33:40 +0200 (Wed, 15 Oct 2008) New Revision: 912 Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/FileDownloadManager.java trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorItem.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/resources/kune.properties Log: Complete - task Image thumbs/icons in client Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-10-15 14:12:54 UTC (rev 911) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-10-15 17:33:40 UTC (rev 912) @@ -92,294 +92,326 @@ @Override public void onLoad() { - register(Singleton.class, new Factory<Session>(Session.class) { - public Session create() { - return new SessionDefault(Cookies.getCookie(Site.USERHASH), $$(UserServiceAsync.class)); - } - }, new Factory<I18nServiceAsync>(I18nServiceAsync.class) { - public I18nServiceAsync create() { - final I18nServiceAsync service = (I18nServiceAsync) GWT.create(I18nService.class); - ((ServiceDefTarget) service).setServiceEntryPoint(GWT.getModuleBaseURL() + "I18nService"); - return service; - } - }, new Factory<UserServiceAsync>(UserServiceAsync.class) { - public UserServiceAsync create() { - final UserServiceAsync service = (UserServiceAsync) GWT.create(UserService.class); - ((ServiceDefTarget) service).setServiceEntryPoint(GWT.getModuleBaseURL() + "UserService"); - return service; - } - }, new Factory<SocialNetworkServiceAsync>(SocialNetworkServiceAsync.class) { - public SocialNetworkServiceAsync create() { - final SocialNetworkServiceAsync snServiceAsync = (SocialNetworkServiceAsync) GWT - .create(SocialNetworkService.class); - ((ServiceDefTarget) snServiceAsync).setServiceEntryPoint(GWT.getModuleBaseURL() - + "SocialNetworkService"); - return snServiceAsync; - } - }, new Factory<GroupServiceAsync>(GroupServiceAsync.class) { - public GroupServiceAsync create() { - final GroupServiceAsync groupServiceAsync = (GroupServiceAsync) GWT.create(GroupService.class); - ((ServiceDefTarget) groupServiceAsync).setServiceEntryPoint(GWT.getModuleBaseURL() + "GroupService"); - return groupServiceAsync; - } - }, new Factory<ContentServiceAsync>(ContentServiceAsync.class) { - public ContentServiceAsync create() { - final ContentServiceAsync contentServiceAsync = (ContentServiceAsync) GWT.create(ContentService.class); - ((ServiceDefTarget) contentServiceAsync) - .setServiceEntryPoint(GWT.getModuleBaseURL() + "ContentService"); - return contentServiceAsync; - } - }); + register(Singleton.class, new Factory<Session>(Session.class) { + @Override + public Session create() { + return new SessionDefault(Cookies.getCookie(Site.USERHASH), $$(UserServiceAsync.class)); + } + }, new Factory<I18nServiceAsync>(I18nServiceAsync.class) { + @Override + public I18nServiceAsync create() { + final I18nServiceAsync service = (I18nServiceAsync) GWT.create(I18nService.class); + ((ServiceDefTarget) service).setServiceEntryPoint(GWT.getModuleBaseURL() + "I18nService"); + return service; + } + }, new Factory<UserServiceAsync>(UserServiceAsync.class) { + @Override + public UserServiceAsync create() { + final UserServiceAsync service = (UserServiceAsync) GWT.create(UserService.class); + ((ServiceDefTarget) service).setServiceEntryPoint(GWT.getModuleBaseURL() + "UserService"); + return service; + } + }, new Factory<SocialNetworkServiceAsync>(SocialNetworkServiceAsync.class) { + @Override + public SocialNetworkServiceAsync create() { + final SocialNetworkServiceAsync snServiceAsync = (SocialNetworkServiceAsync) GWT + .create(SocialNetworkService.class); + ((ServiceDefTarget) snServiceAsync).setServiceEntryPoint(GWT.getModuleBaseURL() + + "SocialNetworkService"); + return snServiceAsync; + } + }, new Factory<GroupServiceAsync>(GroupServiceAsync.class) { + @Override + public GroupServiceAsync create() { + final GroupServiceAsync groupServiceAsync = (GroupServiceAsync) GWT.create(GroupService.class); + ((ServiceDefTarget) groupServiceAsync).setServiceEntryPoint(GWT.getModuleBaseURL() + "GroupService"); + return groupServiceAsync; + } + }, new Factory<ContentServiceAsync>(ContentServiceAsync.class) { + @Override + public ContentServiceAsync create() { + final ContentServiceAsync contentServiceAsync = (ContentServiceAsync) GWT.create(ContentService.class); + ((ServiceDefTarget) contentServiceAsync) + .setServiceEntryPoint(GWT.getModuleBaseURL() + "ContentService"); + return contentServiceAsync; + } + }); - register(Singleton.class, new Factory<I18nUITranslationService>(I18nUITranslationService.class) { - public I18nUITranslationService create() { - final I18nUITranslationService i18n = new I18nUITranslationService(); - i18n.init($(I18nServiceAsync.class), $(Session.class), new Listener0() { - public void onEvent() { - onI18nReady(); - } - }); - return i18n; - } - }); + register(Singleton.class, new Factory<I18nUITranslationService>(I18nUITranslationService.class) { + @Override + public I18nUITranslationService create() { + final I18nUITranslationService i18n = new I18nUITranslationService(); + i18n.init($(I18nServiceAsync.class), $(Session.class), new Listener0() { + public void onEvent() { + onI18nReady(); + } + }); + return i18n; + } + }); - $(I18nUITranslationService.class); + $(I18nUITranslationService.class); } private void onI18nReady() { - final I18nUITranslationService i18n = $(I18nUITranslationService.class); + final I18nUITranslationService i18n = $(I18nUITranslationService.class); - if (container.hasProvider(I18nTranslationService.class)) { - container.removeProvider(I18nTranslationService.class); - } + if (container.hasProvider(I18nTranslationService.class)) { + container.removeProvider(I18nTranslationService.class); + } - register(Singleton.class, new Factory<I18nTranslationService>(I18nTranslationService.class) { - public I18nTranslationService create() { - return i18n; - } - }); + register(Singleton.class, new Factory<I18nTranslationService>(I18nTranslationService.class) { + @Override + public I18nTranslationService create() { + return i18n; + } + }); - register(Singleton.class, new Factory<HistoryWrapper>(HistoryWrapper.class) { - public HistoryWrapper create() { - return new HistoryWrapperDefault(); - } - }, new Factory<ContentProvider>(ContentProvider.class) { - public ContentProvider create() { - return new ContentProviderDefault($(ContentServiceAsync.class)); - } - }, new Factory<StateManager>(StateManager.class) { - public StateManager create() { - final StateManagerDefault stateManager = new StateManagerDefault($(ContentProvider.class), - $(Session.class), $(HistoryWrapper.class)); - History.addHistoryListener(stateManager); - return stateManager; - } - }); + register(Singleton.class, new Factory<HistoryWrapper>(HistoryWrapper.class) { + @Override + public HistoryWrapper create() { + return new HistoryWrapperDefault(); + } + }, new Factory<ContentProvider>(ContentProvider.class) { + @Override + public ContentProvider create() { + return new ContentProviderDefault($(ContentServiceAsync.class)); + } + }, new Factory<StateManager>(StateManager.class) { + @Override + public StateManager create() { + final StateManagerDefault stateManager = new StateManagerDefault($(ContentProvider.class), + $(Session.class), $(HistoryWrapper.class)); + History.addHistoryListener(stateManager); + return stateManager; + } + }); - register(Singleton.class, new Factory<KuneErrorHandler>(KuneErrorHandler.class) { - public KuneErrorHandler create() { - return new KuneErrorHandler($(Session.class), i18n, $$(WorkspaceSkeleton.class), $$(StateManager.class)); - } - }); + register(Singleton.class, new Factory<KuneErrorHandler>(KuneErrorHandler.class) { + @Override + public KuneErrorHandler create() { + return new KuneErrorHandler($(Session.class), i18n, $$(WorkspaceSkeleton.class), $$(StateManager.class)); + } + }); - register(Singleton.class, new Factory<Images>(Images.class) { - public Images create() { - return Images.App.getInstance(); - } - }, new Factory<ImageUtils>(ImageUtils.class) { - public ImageUtils create() { - return new ImageUtils(); - } - }); + register(Singleton.class, new Factory<Images>(Images.class) { + @Override + public Images create() { + return Images.App.getInstance(); + } + }, new Factory<ImageUtils>(ImageUtils.class) { + @Override + public ImageUtils create() { + return new ImageUtils(); + } + }); - AsyncCallbackSimple.init($(KuneErrorHandler.class)); + AsyncCallbackSimple.init($(KuneErrorHandler.class)); - register(Singleton.class, new Factory<Application>(Application.class) { - public Application create() { - return new ApplicationDefault($(Session.class)); - } + register(Singleton.class, new Factory<Application>(Application.class) { + @Override + public Application create() { + return new ApplicationDefault($(Session.class)); + } - @Override - public void onAfterCreated(final Application instance) { - } - }); + @Override + public void onAfterCreated(final Application instance) { + } + }); - register(Singleton.class, new Factory<SiteSearcher>(SiteSearcher.class) { - public SiteSearcher create() { - final SiteSearcherPresenter presenter = new SiteSearcherPresenter($$(StateManager.class)); - final SiteSearcherView view = new SiteSearcherPanel(presenter, i18n, $(WorkspaceSkeleton.class)); - presenter.init(view); - return presenter; - } - }); + 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, i18n, $(WorkspaceSkeleton.class)); + presenter.init(view); + return presenter; + } + }); - register(Singleton.class, new Factory<I18nTranslator>(I18nTranslator.class) { - public I18nTranslator create() { - final I18nTranslatorPresenter presenter = new I18nTranslatorPresenter($(Session.class), - $(I18nServiceAsync.class), i18n); - final I18nTranslatorView view = new I18nTranslatorPanel(presenter, i18n, $(LanguageSelector.class), - $(WorkspaceSkeleton.class)); - presenter.init(view); - return presenter; - } - }); + register(Singleton.class, new Factory<I18nTranslator>(I18nTranslator.class) { + @Override + public I18nTranslator create() { + final I18nTranslatorPresenter presenter = new I18nTranslatorPresenter($(Session.class), + $(I18nServiceAsync.class), i18n); + final I18nTranslatorView view = new I18nTranslatorPanel(presenter, i18n, $(LanguageSelector.class), + $(WorkspaceSkeleton.class)); + presenter.init(view); + return presenter; + } + }); - register(Singleton.class, new Factory<SignIn>(SignIn.class) { - public SignIn create() { - final SignInPresenter presenter = new SignInPresenter($(Session.class), $(StateManager.class), i18n, - $(UserServiceAsync.class)); - final SignInPanel view = new SignInPanel(presenter, i18n, $(WorkspaceSkeleton.class)); - presenter.init(view); - return presenter; - } - }); + register(Singleton.class, new Factory<SignIn>(SignIn.class) { + @Override + public SignIn create() { + final SignInPresenter presenter = new SignInPresenter($(Session.class), $(StateManager.class), i18n, + $(UserServiceAsync.class)); + final SignInPanel view = new SignInPanel(presenter, i18n, $(WorkspaceSkeleton.class)); + presenter.init(view); + return presenter; + } + }); - register(Singleton.class, new Factory<LicenseChoose>(LicenseChoose.class) { - public LicenseChoose create() { - final LicenseChoosePresenter presenter = new LicenseChoosePresenter($(Session.class)); - final LicenseChoosePanel view = new LicenseChoosePanel(presenter, i18n); - presenter.init(view); - return presenter; - } - }); + register(Singleton.class, new Factory<LicenseChoose>(LicenseChoose.class) { + @Override + public LicenseChoose create() { + final LicenseChoosePresenter presenter = new LicenseChoosePresenter($(Session.class)); + final LicenseChoosePanel view = new LicenseChoosePanel(presenter, i18n); + presenter.init(view); + return presenter; + } + }); - register(Singleton.class, new Factory<NewGroup>(NewGroup.class) { - public NewGroup create() { - final NewGroupPresenter presenter = new NewGroupPresenter(i18n, $(Session.class), - $(StateManager.class), $$(GroupServiceAsync.class)); - final NewGroupPanel view = new NewGroupPanel(presenter, i18n, $$(LicenseChoose.class)); - presenter.init(view); - return presenter; - } - }); + register(Singleton.class, new Factory<NewGroup>(NewGroup.class) { + @Override + public NewGroup create() { + final NewGroupPresenter presenter = new NewGroupPresenter(i18n, $(Session.class), + $(StateManager.class), $$(GroupServiceAsync.class)); + final NewGroupPanel view = new NewGroupPanel(presenter, i18n, $$(LicenseChoose.class)); + presenter.init(view); + return presenter; + } + }); - register(Singleton.class, new Factory<UserLiveSearcher>(UserLiveSearcher.class) { - public UserLiveSearcher create() { - final UserLiveSearcherPresenter presenter = new UserLiveSearcherPresenter(); - final EntityLiveSearcherView view = new UserLiveSearcherPanel(presenter, i18n); - presenter.init(view); - return presenter; - } - }); + register(Singleton.class, new Factory<UserLiveSearcher>(UserLiveSearcher.class) { + @Override + public UserLiveSearcher create() { + final UserLiveSearcherPresenter presenter = new UserLiveSearcherPresenter(); + final EntityLiveSearcherView view = new UserLiveSearcherPanel(presenter, i18n); + presenter.init(view); + return presenter; + } + }); - register(Singleton.class, new Factory<GroupLiveSearcher>(GroupLiveSearcher.class) { - public GroupLiveSearcher create() { - final GroupLiveSearcherPresenter presenter = new GroupLiveSearcherPresenter(); - final EntityLiveSearcherView view = new GroupLiveSearchPanel(presenter, i18n); - presenter.init(view); - return presenter; - } - }); + register(Singleton.class, new Factory<GroupLiveSearcher>(GroupLiveSearcher.class) { + @Override + public GroupLiveSearcher create() { + final GroupLiveSearcherPresenter presenter = new GroupLiveSearcherPresenter(); + final EntityLiveSearcherView view = new GroupLiveSearchPanel(presenter, i18n); + presenter.init(view); + return presenter; + } + }); - register(Singleton.class, new Factory<ToolSelector>(ToolSelector.class) { - public ToolSelector create() { - final ToolSelectorPresenter presenter = new ToolSelectorPresenter($(StateManager.class), - $(WsThemePresenter.class)); - return presenter; - } - }); + register(Singleton.class, new Factory<ToolSelector>(ToolSelector.class) { + @Override + public ToolSelector create() { + final ToolSelectorPresenter presenter = new ToolSelectorPresenter($(StateManager.class), + $(WsThemePresenter.class)); + return presenter; + } + }); - register(Singleton.class, new Factory<TextEditor>(TextEditor.class) { - public TextEditor create() { - final ActionToolbarPanel<StateToken> contentNavigatorToolbar = new ActionToolbarPanel<StateToken>( - ActionToolbarPanel.Position.content, $$(ActionManager.class), $(WorkspaceSkeleton.class)); - final ActionToolbar<StateToken> toolbar = new ActionToolbarPresenter<StateToken>( - contentNavigatorToolbar); + register(Singleton.class, new Factory<TextEditor>(TextEditor.class) { + @Override + public TextEditor create() { + final ActionToolbarPanel<StateToken> contentNavigatorToolbar = new ActionToolbarPanel<StateToken>( + ActionToolbarPanel.Position.content, $$(ActionManager.class), $(WorkspaceSkeleton.class)); + final ActionToolbar<StateToken> toolbar = new ActionToolbarPresenter<StateToken>( + contentNavigatorToolbar); - final TextEditorPresenter presenter = new TextEditorPresenter(true, toolbar, - $(I18nUITranslationService.class)); - final TextEditorPanel panel = new TextEditorPanel(presenter, $(I18nTranslationService.class), - $(WorkspaceSkeleton.class), $(ColorWebSafePalette.class)); - presenter.init(panel); - return presenter; - } - }); + final TextEditorPresenter presenter = new TextEditorPresenter(true, toolbar, + $(I18nUITranslationService.class)); + final TextEditorPanel panel = new TextEditorPanel(presenter, $(I18nTranslationService.class), + $(WorkspaceSkeleton.class), $(ColorWebSafePalette.class)); + presenter.init(panel); + return presenter; + } + }); - register(Singleton.class, new Factory<LanguageSelector>(LanguageSelector.class) { - public LanguageSelector create() { - final LanguageSelectorPresenter presenter = new LanguageSelectorPresenter($(Session.class)); - final LanguageSelectorView view = new LanguageSelectorPanel(presenter, i18n); - presenter.init(view); - return presenter; - } - }); + 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, i18n); + presenter.init(view); + return presenter; + } + }); - register(Singleton.class, new Factory<ActionManager>(ActionManager.class) { - public ActionManager create() { - return new ActionManager($(WorkspaceSkeleton.class)); - } - }); + register(Singleton.class, new Factory<ActionManager>(ActionManager.class) { + @Override + public ActionManager create() { + return new ActionManager($(WorkspaceSkeleton.class)); + } + }); - register(Singleton.class, new Factory<ContextActionRegistry>(ContextActionRegistry.class) { - public ContextActionRegistry create() { - return new ContextActionRegistry(); - } - }); + register(Singleton.class, new Factory<ContextActionRegistry>(ContextActionRegistry.class) { + @Override + public ContextActionRegistry create() { + return new ContextActionRegistry(); + } + }); - register(Singleton.class, new Factory<ContentActionRegistry>(ContentActionRegistry.class) { - public ContentActionRegistry create() { - return new ContentActionRegistry(); - } - }); + register(Singleton.class, new Factory<ContentActionRegistry>(ContentActionRegistry.class) { + @Override + public ContentActionRegistry create() { + return new ContentActionRegistry(); + } + }); - register(Singleton.class, new Factory<DragDropContentRegistry>(DragDropContentRegistry.class) { - public DragDropContentRegistry create() { - return new DragDropContentRegistry(); - } - }); + register(Singleton.class, new Factory<DragDropContentRegistry>(DragDropContentRegistry.class) { + @Override + public DragDropContentRegistry create() { + return new DragDropContentRegistry(); + } + }); - register(Singleton.class, new Factory<ContentIconsRegistry>(ContentIconsRegistry.class) { - public ContentIconsRegistry create() { - return new ContentIconsRegistry(); - } - }); + register(Singleton.class, new Factory<ContentIconsRegistry>(ContentIconsRegistry.class) { + @Override + public ContentIconsRegistry create() { + return new ContentIconsRegistry(); + } + }); - register(Singleton.class, new Factory<ContextNavigator>(ContextNavigator.class) { - public ContextNavigator create() { - final ActionToolbarPanel<StateToken> contextNavigatorToolbar = new ActionToolbarPanel<StateToken>( - ActionToolbarPanel.Position.context, $$(ActionManager.class), $(WorkspaceSkeleton.class)); - final ActionToolbar<StateToken> toolbar = new ActionToolbarPresenter<StateToken>( - contextNavigatorToolbar); + register(Singleton.class, new Factory<ContextNavigator>(ContextNavigator.class) { + @Override + public ContextNavigator create() { + final ActionToolbarPanel<StateToken> contextNavigatorToolbar = new ActionToolbarPanel<StateToken>( + ActionToolbarPanel.Position.context, $$(ActionManager.class), $(WorkspaceSkeleton.class)); + final ActionToolbar<StateToken> toolbar = new ActionToolbarPresenter<StateToken>( + contextNavigatorToolbar); - final ContextNavigatorPresenter presenter = new ContextNavigatorPresenter($(StateManager.class), - $(Session.class), $$(ContentServiceAsync.class), i18n, $(EntityTitle.class), - $(ContentIconsRegistry.class), $(DragDropContentRegistry.class), toolbar, - $(ContextActionRegistry.class)); - final ContextNavigatorPanel panel = new ContextNavigatorPanel(presenter, i18n, - $(WorkspaceSkeleton.class), $(ActionManager.class)); - presenter.init(panel); - return presenter; - } - }); + final ContextNavigatorPresenter presenter = new ContextNavigatorPresenter($(StateManager.class), + $(Session.class), $$(ContentServiceAsync.class), i18n, $(EntityTitle.class), + $(ContentIconsRegistry.class), $(DragDropContentRegistry.class), toolbar, + $(ContextActionRegistry.class), $$(FileDownloadUtils.class), true); + final ContextNavigatorPanel panel = new ContextNavigatorPanel(presenter, i18n, + $(WorkspaceSkeleton.class), $(ActionManager.class)); + presenter.init(panel); + return presenter; + } + }); - register(Singleton.class, new Factory<FileDownloadUtils>(FileDownloadUtils.class) { - public FileDownloadUtils create() { - return new FileDownloadUtils($(Session.class)); - } - }); + register(Singleton.class, new Factory<FileDownloadUtils>(FileDownloadUtils.class) { + @Override + public FileDownloadUtils create() { + return new FileDownloadUtils($(Session.class)); + } + }); - // Register of tokens like "signin", "newgroup", "translate" etcetera - $(StateManager.class).addSiteToken(SiteToken.signin.toString(), new Listener<StateToken>() { - public void onEvent(final StateToken previousStateToken) { - $(SignIn.class).doSignIn(previousStateToken); - } - }); + // Register of tokens like "signin", "newgroup", "translate" etcetera + $(StateManager.class).addSiteToken(SiteToken.signin.toString(), new Listener<StateToken>() { + public void onEvent(final StateToken previousStateToken) { + $(SignIn.class).doSignIn(previousStateToken); + } + }); - $(StateManager.class).addSiteToken(SiteToken.newgroup.toString(), new Listener<StateToken>() { - public void onEvent(final StateToken previousStateToken) { - $(NewGroup.class).doNewGroup(previousStateToken); - } - }); + $(StateManager.class).addSiteToken(SiteToken.newgroup.toString(), new Listener<StateToken>() { + public void onEvent(final StateToken previousStateToken) { + $(NewGroup.class).doNewGroup(previousStateToken); + } + }); - $(StateManager.class).addSiteToken(SiteToken.translate.toString(), new Listener<StateToken>() { - public void onEvent(final StateToken previousStateToken) { - $(I18nTranslator.class).doShowTranslator(); - } - }); + $(StateManager.class).addSiteToken(SiteToken.translate.toString(), new Listener<StateToken>() { + public void onEvent(final StateToken previousStateToken) { + $(I18nTranslator.class).doShowTranslator(); + } + }); - $(ApplicationComponentGroup.class).createAll(); - $(ToolGroup.class).createAll(); - $(Application.class).start(); + $(ApplicationComponentGroup.class).createAll(); + $(ToolGroup.class).createAll(); + $(Application.class).start(); } } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java 2008-10-15 14:12:54 UTC (rev 911) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java 2008-10-15 17:33:40 UTC (rev 912) @@ -28,12 +28,26 @@ public class KuneUiUtils { - public static void setQuickTip(final Widget widget, final String tip) { - setQuickTip(widget.getElement(), tip); + public static String genQuickTipLabel(final String labelText, final String tipTitle, final String tipText, + final AbstractImagePrototype icon) { + // FIXME: get this from emite + String tipHtml = "<span style=\"vertical-align: middle;\" ext:qtip=\"" + tipText + "\""; + if (tipTitle != null && tipTitle.length() > 0) { + tipHtml += " ext:qtitle=\"" + tipTitle + "\""; + } + tipHtml += ">"; + tipHtml += labelText; + tipHtml += " "; + Image iconImg = new Image(); + icon.applyTo(iconImg); + setQuickTip(iconImg, tipText, tipTitle); + tipHtml += iconImg.toString(); + tipHtml += "</span>"; + return tipHtml; } - public static void setQuickTip(final Widget widget, final String tip, final String tipTitle) { - setQuickTip(widget.getElement(), tip, tipTitle); + public static String genQuickTipWithImage(String imageResizedUrl) { + return new Image(imageResizedUrl).toString(); } /** @@ -68,22 +82,12 @@ } } - public static String genQuickTipLabel(final String labelText, final String tipTitle, final String tipText, - final AbstractImagePrototype icon) { - // FIXME: get this from emite - String tipHtml = "<span style=\"vertical-align: middle;\" ext:qtip=\"" + tipText + "\""; - if (tipTitle != null && tipTitle.length() > 0) { - tipHtml += " ext:qtitle=\"" + tipTitle + "\""; - } - tipHtml += ">"; - tipHtml += labelText; - tipHtml += " "; - Image iconImg = new Image(); - icon.applyTo(iconImg); - setQuickTip(iconImg, tipText, tipTitle); - tipHtml += iconImg.toString(); - tipHtml += "</span>"; - return tipHtml; + public static void setQuickTip(final Widget widget, final String tip) { + setQuickTip(widget.getElement(), tip); } + public static void setQuickTip(final Widget widget, final String tip, final String tipTitle) { + setQuickTip(widget.getElement(), tip, tipTitle); + } + } Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/FileDownloadManager.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/FileDownloadManager.java 2008-10-15 14:12:54 UTC (rev 911) +++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/FileDownloadManager.java 2008-10-15 17:33:40 UTC (rev 912) @@ -80,7 +80,11 @@ if (mimeType.getType().equals("image")) { String imgsizePrefix = imgsize == null ? "" : "." + imgsize; String filenameWithoutExtension = FileUtils.getFileNameWithoutExtension(filename, extension); - filename = filenameWithoutExtension + imgsizePrefix + extension; + String filenameResized = filenameWithoutExtension + imgsizePrefix + extension; + if (new File(absDir + filenameResized).exists()) { + // thumb can fail + filename = filenameResized; + } } final String absFilename = absDir + filename; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorItem.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorItem.java 2008-10-15 14:12:54 UTC (rev 911) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorItem.java 2008-10-15 17:33:40 UTC (rev 912) @@ -9,6 +9,7 @@ private final String parentId; private final String iconUrl; private final String text; + private final String tooltip; private final ContentStatusDTO contentStatusDTO; private final StateToken token; private final ActionItemCollection<StateToken> actionCollection; @@ -16,53 +17,58 @@ private final boolean allowDrop; public ContextNavigatorItem(final String id, final String parentId, final String iconUrl, final String text, - final ContentStatusDTO contentStatusDTO, final StateToken token, final boolean allowDrag, - final boolean allowDrop, final ActionItemCollection<StateToken> actionCollection) { - this.id = id; - this.parentId = parentId; - this.iconUrl = iconUrl; - this.text = text; - this.contentStatusDTO = contentStatusDTO; - this.token = token; - this.allowDrag = allowDrag; - this.allowDrop = allowDrop; - this.actionCollection = actionCollection; + final String tooltip, final ContentStatusDTO contentStatusDTO, final StateToken token, + final boolean allowDrag, final boolean allowDrop, final ActionItemCollection<StateToken> actionCollection) { + this.id = id; + this.parentId = parentId; + this.iconUrl = iconUrl; + this.text = text; + this.tooltip = tooltip; + this.contentStatusDTO = contentStatusDTO; + this.token = token; + this.allowDrag = allowDrag; + this.allowDrop = allowDrop; + this.actionCollection = actionCollection; } public ActionItemCollection<StateToken> getActionCollection() { - return actionCollection; + return actionCollection; } public ContentStatusDTO getContentStatus() { - return contentStatusDTO; + return contentStatusDTO; } public String getIconUrl() { - return iconUrl; + return iconUrl; } public String getId() { - return id; + return id; } public String getParentId() { - return parentId; + return parentId; } public StateToken getStateToken() { - return token; + return token; } public String getText() { - return text; + return text; } + public String getTooltip() { + return tooltip; + } + public boolean isDraggable() { - return allowDrag; + return allowDrag; } public boolean isDroppable() { - return allowDrop; + return allowDrop; } } 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 2008-10-15 14:12:54 UTC (rev 911) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java 2008-10-15 17:33:40 UTC (rev 912) @@ -90,6 +90,10 @@ child.setHref("#" + item.getStateToken().toString()); child.setAllowDrag(item.isDraggable()); child.setAllowDrop(item.isDroppable()); + final String tooltip = item.getTooltip(); + if (tooltip != null) { + child.setTooltip(tooltip); + } createItemMenu(nodeId, item.getActionCollection()); final TreeNode parent = treePanel.getNodeById(item.getParentId()); if (parent != null) { 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 2008-10-15 14:12:54 UTC (rev 911) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java 2008-10-15 17:33:40 UTC (rev 912) @@ -43,6 +43,9 @@ import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.platf.client.ui.KuneUiUtils; +import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils; +import org.ourproject.kune.platf.client.ui.download.ImageSize; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import org.ourproject.kune.workspace.client.site.Site; import org.ourproject.kune.workspace.client.title.EntityTitle; @@ -66,230 +69,253 @@ private final DragDropContentRegistry dragDropContentRegistry; private final ActionRegistry<StateToken> actionRegistry; private final ActionToolbar<StateToken> toolbar; + private final Provider<FileDownloadUtils> downloadUtilsProvider; + private final boolean useGenericImageIcon; public ContextNavigatorPresenter(final StateManager stateManager, final Session session, - final Provider<ContentServiceAsync> contentServiceProvider, final I18nUITranslationService i18n, - final EntityTitle entityTitle, final ContentIconsRegistry contentIconsRegistry, - final DragDropContentRegistry dragDropContentRegistry, final ActionToolbar<StateToken> toolbar, - final ActionRegistry<StateToken> actionRegistry) { - this.stateManager = stateManager; - this.session = session; - this.contentServiceProvider = contentServiceProvider; - this.i18n = i18n; - this.entityTitle = entityTitle; - this.contentIconsRegistry = contentIconsRegistry; - this.dragDropContentRegistry = dragDropContentRegistry; - this.actionRegistry = actionRegistry; - this.toolbar = toolbar; - actionsByItem = new HashMap<StateToken, ActionItemCollection<StateToken>>(); - editOnNextStateChange = false; + final Provider<ContentServiceAsync> contentServiceProvider, final I18nUITranslationService i18n, + final EntityTitle entityTitle, final ContentIconsRegistry contentIconsRegistry, + final DragDropContentRegistry dragDropContentRegistry, final ActionToolbar<StateToken> toolbar, + final ActionRegistry<StateToken> actionRegistry, Provider<FileDownloadUtils> downloadUtilsProvider, + boolean useGenericImageIcon) { + this.stateManager = stateManager; + this.session = session; + this.contentServiceProvider = contentServiceProvider; + this.i18n = i18n; + this.entityTitle = entityTitle; + this.contentIconsRegistry = contentIconsRegistry; + this.dragDropContentRegistry = dragDropContentRegistry; + this.actionRegistry = actionRegistry; + this.toolbar = toolbar; + this.downloadUtilsProvider = downloadUtilsProvider; + this.useGenericImageIcon = useGenericImageIcon; + actionsByItem = new HashMap<StateToken, ActionItemCollection<StateToken>>(); + editOnNextStateChange = false; } public void editItem(final StateToken stateToken) { - view.editItem(genId(stateToken)); + view.editItem(genId(stateToken)); } public StateToken getCurrentStateToken() { - return session.getCurrentState().getStateToken(); + return session.getCurrentState().getStateToken(); } public View getView() { - return view; + return view; } public void gotoToken(final String token) { - stateManager.gotoToken(token); + stateManager.gotoToken(token); } public void init(final ContextNavigatorView view) { - this.view = view; - session.onUserSignIn(new Listener<UserInfoDTO>() { - public void onEvent(final UserInfoDTO parameter) { - clear(); - } - }); - session.onUserSignOut(new Listener0() { - public void onEvent() { - clear(); - } - }); + this.view = view; + session.onUserSignIn(new Listener<UserInfoDTO>() { + public void onEvent(final UserInfoDTO parameter) { + clear(); + } + }); + session.onUserSignOut(new Listener0() { + public void onEvent() { + clear(); + } + }); } public boolean isSelected(final StateToken stateToken) { - return view.isSelected(genId(stateToken)); + return view.isSelected(genId(stateToken)); } public boolean mustEditOnNextStateChange() { - return editOnNextStateChange; + return editOnNextStateChange; } public void onItemRename(final String token, final String newName, final String oldName) { - if (!newName.equals(oldName)) { - Site.showProgress(i18n.t("Renaming")); - final StateToken stateToken = new StateToken(token); - final AsyncCallback<String> asyncCallback = new AsyncCallback<String>() { - public void onFailure(final Throwable caught) { - view.setFireOnTextChange(false); - setItemText(stateToken, oldName); - view.setFireOnTextChange(true); - Site.error(i18n.t("Error renaming")); - Site.hideProgress(); - } + if (!newName.equals(oldName)) { + Site.showProgress(i18n.t("Renaming")); + final StateToken stateToken = new StateToken(token); + final AsyncCallback<String> asyncCallback = new AsyncCallback<String>() { + public void onFailure(final Throwable caught) { + view.setFireOnTextChange(false); + setItemText(stateToken, oldName); + view.setFireOnTextChange(true); + Site.error(i18n.t("Error renaming")); + Site.hideProgress(); + } - public void onSuccess(final String result) { - Site.hideProgress(); - if (session.getCurrentState().getStateToken().getEncoded().equals(token)) { - // I have to update EntityTitle - entityTitle.setContentTitle(newName); - } - } - }; - if (stateToken.isComplete()) { - contentServiceProvider.get().renameContent(session.getUserHash(), stateToken, newName, asyncCallback); - } else { - contentServiceProvider.get().renameContainer(session.getUserHash(), stateToken, newName, asyncCallback); - } - } + public void onSuccess(final String result) { + Site.hideProgress(); + if (session.getCurrentState().getStateToken().getEncoded().equals(token)) { + // I have to update EntityTitle + entityTitle.setContentTitle(newName); + } + } + }; + if (stateToken.isComplete()) { + contentServiceProvider.get().renameContent(session.getUserHash(), stateToken, newName, asyncCallback); + } else { + contentServiceProvider.get().renameContainer(session.getUserHash(), stateToken, newName, asyncCallback); + } + } } public void refresh(final StateToken stateToken) { - contentServiceProvider.get().getContent(session.getUserHash(), stateToken, new AsyncCallbackSimple<StateDTO>() { - public void onSuccess(final StateDTO result) { - setState(result, false); - } - }); + contentServiceProvider.get().getContent(session.getUserHash(), stateToken, new AsyncCallbackSimple<StateDTO>() { + public void onSuccess(final StateDTO result) { + setState(result, false); + } + }); } public void selectItem(final StateToken stateToken) { - view.selectItem(genId(stateToken)); - toolbar.disableMenusAndClearButtons(); - toolbar.setActions(actionsByItem.get(stateToken)); + view.selectItem(genId(stateToken)); + toolbar.disableMenusAndClearButtons(); + toolbar.setActions(actionsByItem.get(stateToken)); } public void setEditOnNextStateChange(final boolean edit) { - editOnNextStateChange = edit; + editOnNextStateChange = edit; } public void setItemText(final StateToken stateToken, final String name) { - view.setItemText(genId(stateToken), name); + view.setItemText(genId(stateToken), name); } public void setState(final StateDTO state, final boolean select) { - final ContainerDTO container = state.getContainer(); - final StateToken stateToken = state.getStateToken(); - final AccessRightsDTO containerRights = state.getContainerRights(); - AccessRightsDTO rights; + final ContainerDTO container = state.getContainer(); + final StateToken stateToken = state.getStateToken(); + final AccessRightsDTO containerRights = state.getContainerRights(); + AccessRightsDTO rights; - if (stateToken.hasAll()) { - rights = state.getContentRights(); - } else { - rights = containerRights; - } - view.setEditable(rights.isEditable()); + if (stateToken.hasAll()) { + rights = state.getContentRights(); + } else { + rights = containerRights; + } + view.setEditable(rights.isEditable()); - // If root sended (container is not a root folder) process root (add - // childs to view) - final ContainerDTO root = state.getRootContainer(); - if (root != null) { - view.setRootItem(genId(root.getStateToken()), i18n.t(root.getName()), root.getStateToken()); - createChildItems(root, containerRights); - } + // If root sended (container is not a root folder) process root (add + // childs to view) + final ContainerDTO root = state.getRootContainer(); + if (root != null) { + view.setRootItem(genId(root.getStateToken()), i18n.t(root.getName()), root.getStateToken()); + createChildItems(root, containerRights); + } - // Do the path to our current content - createTreePath(stateToken, container.getAbsolutePath(), containerRights); + // Do the path to our current content + createTreePath(stateToken, container.getAbsolutePath(), containerRights); - // Process our current content/container - final ActionItemCollection<StateToken> actionItems = new ActionItemCollection<StateToken>(); - if (state.hasDocument()) { - rights = state.getContentRights(); - final ActionItemCollection<StateToken> contentActions = addItem(state.getTitle(), state.getTypeId(), state - .getMimeType(), state.getStatus(), stateToken, container.getStateToken(), rights, false); - final ActionItemCollection<StateToken> containerActions = actionRegistry.getCurrentActions(container - .getStateToken(), container.getTypeId(), session.isLogged(), containerRights, true); - actionItems.addAll(containerActions); - actionItems.addAll(contentActions); + // Process our current content/container + final ActionItemCollection<StateToken> actionItems = new ActionItemCollection<StateToken>(); + if (state.hasDocument()) { + rights = state.getContentRights(); + final ActionItemCollection<StateToken> contentActions = addItem(state.getTitle(), state.getTypeId(), state + .getMimeType(), state.getStatus(), stateToken, container.getStateToken(), rights, false); + final ActionItemCollection<StateToken> containerActions = actionRegistry.getCurrentActions(container + .getStateToken(), container.getTypeId(), session.isLogged(), containerRights, true); + actionItems.addAll(containerActions); + actionItems.addAll(contentActions); - } else { - rights = containerRights; - final ActionItemCollection<StateToken> containerActions = addItem(container.getName(), container - .getTypeId(), null, ContentStatusDTO.publishedOnline, container.getStateToken(), container - .getStateToken().clone().setFolder(container.getParentFolderId()), containerRights, false); - actionItems.addAll(containerActions); - } + } else { + rights = containerRights; + final ActionItemCollection<StateToken> containerActions = addItem(container.getName(), container + .getTypeId(), null, ContentStatusDTO.publishedOnline, container.getStateToken(), container + .getStateToken().clone().setFolder(container.getParentFolderId()), containerRights, false); + actionItems.addAll(containerActions); + } - actionsByItem.put(stateToken, actionItems); - // Process container childs - createChildItems(container, containerRights); + actionsByItem.put(stateToken, actionItems); + // Process container childs + createChildItems(container, containerRights); - // Finaly - if (mustEditOnNextStateChange()) { - // Code smell - selectItem(stateToken); - editItem(stateToken); - setEditOnNextStateChange(false); - } else { - if (select) { - selectItem(stateToken); - } - } - toolbar.attach(); + // Finaly + if (mustEditOnNextStateChange()) { + // Code smell + selectItem(stateToken); + editItem(stateToken); + setEditOnNextStateChange(false); + } else { + if (select) { + selectItem(stateToken); + } + } + toolbar.attach(); } protected void clear() { - toolbar.clear(); - view.clear(); - actionsByItem.clear(); + toolbar.clear(); + view.clear(); + actionsByItem.clear(); } private ActionItemCollection<StateToken> addItem(final String title, final String contentTypeId, - final BasicMimeTypeDTO mimeType, final ContentStatusDTO status, final StateToken stateToken, - final StateToken parentStateToken, final AccessRightsDTO rights, final boolean isNodeSelected) { + final BasicMimeTypeDTO mimeType, final ContentStatusDTO status, final StateToken stateToken, + final StateToken parentStateToken, final AccessRightsDTO rights, final boolean isNodeSelected) { - final ActionItemCollection<StateToken> toolbarActions = actionRegistry.getCurrentActions(stateToken, - contentTypeId, session.isLogged(), rights, true); + final ActionItemCollection<StateToken> toolbarActions = actionRegistry.getCurrentActions(stateToken, + contentTypeId, session.isLogged(), rights, true); - final String contentTypeIcon = contentTypeId.equals(TYPE_FOLDER) ? null : contentIconsRegistry - .getContentTypeIcon(contentTypeId, mimeType); - final ContextNavigatorItem item = new ContextNavigatorItem(genId(stateToken), genId(parentStateToken), - contentTypeIcon, title, status, stateToken, dragDropContentRegistry.isDraggable(contentTypeId, rights - .isAdministrable()), dragDropContentRegistry.isDroppable(contentTypeId, rights - .isAdministrable()), actionRegistry.getCurrentActions(stateToken, contentTypeId, session - .isLogged(), rights, false)); - view.addItem(item); - return toolbarActions; + final String contentTypeIcon = getIcon(stateToken, contentTypeId, mimeType); + final String tooltip = getTooltip(stateToken, mimeType); + final ContextNavigatorItem item = new ContextNavigatorItem(genId(stateToken), genId(parentStateToken), + contentTypeIcon, title, tooltip, status, stateToken, dragDropContentRegistry.isDraggable(contentTypeId, + rights.isAdministrable()), dragDropContentRegistry.isDroppable(contentTypeId, rights + .isAdministrable()), actionRegistry.getCurrentActions(stateToken, contentTypeId, session + .isLogged(), rights, false)); + view.addItem(item); + return toolbarActions; } private void createChildItems(final ContainerDTO container, final AccessRightsDTO containerRights) { - for (final ContentSimpleDTO content : container.getContents()) { - addItem(content.getTitle(), content.getTypeId(), content.getMimeType(), content.getStatus(), content - .getStateToken(), content.getStateToken().clone().clearDocument(), content.getRights(), false); - } + for (final ContentSimpleDTO content : container.getContents()) { + addItem(content.getTitle(), content.getTypeId(), content.getMimeType(), content.getStatus(), content + .getStateToken(), content.getStateToken().clone().clearDocument(), content.getRights(), false); + } - for (final ContainerSimpleDTO siblingFolder : container.getChilds()) { - addItem(siblingFolder.getName(), siblingFolder.getTypeId(), null, ContentStatusDTO.publishedOnline, - siblingFolder.getStateToken(), siblingFolder.getStateToken().clone().setFolder( - siblingFolder.getParentFolderId()), containerRights, false); - } + for (final ContainerSimpleDTO siblingFolder : container.getChilds()) { + addItem(siblingFolder.getName(), siblingFolder.getTypeId(), null, ContentStatusDTO.publishedOnline, + siblingFolder.getStateToken(), siblingFolder.getStateToken().clone().setFolder( + siblingFolder.getParentFolderId()), containerRights, false); + } } private void createTreePath(final StateToken state, final ContainerSimpleDTO[] absolutePath, - final AccessRightsDTO rights) { - for (int i = 0; i < absolutePath.length; i++) { - final ContainerSimpleDTO folder = absolutePath[i]; - final StateToken folderStateToken = folder.getStateToken(); - final StateToken parentStateToken = state.clone().clearDocument().setFolder(folder.getParentFolderId()); + final AccessRightsDTO rights) { + for (final ContainerSimpleDTO folder : absolutePath) { + final StateToken folderStateToken = folder.getStateToken(); + final StateToken parentStateToken = state.clone().clearDocument().setFolder(folder.getParentFolderId()); - if (folder.getParentFolderId() != null) { - addItem(folder.getName(), folder.getTypeId(), null, ContentStatusDTO.publishedOnline, folderStateToken, - parentStateToken, rights, false); - } else { - // Root must be already created - } - } + if (folder.getParentFolderId() != null) { + addItem(folder.getName(), folder.getTypeId(), null, ContentStatusDTO.publishedOnline, folderStateToken, + parentStateToken, rights, false); + } else { + // Root must be already created + } + } } private String genId(final StateToken token) { - return "k-" + token.toString().replace(StateToken.SEPARATOR, "-"); + return "k-" + token.toString().replace(StateToken.SEPARATOR, "-"); } + private String getIcon(final StateToken token, final String contentTypeId, final BasicMimeTypeDTO mimeType) { + if (contentTypeId.equals(TYPE_FOLDER)) { + return null; + } else if (!useGenericImageIcon && mimeType != null && mimeType.getType().equals("image")) { + return downloadUtilsProvider.get().getImageResizedUrl(token, ImageSize.ico); + } else { + return contentIconsRegistry.getContentTypeIcon(contentTypeId, mimeType); + } + } + + private String getTooltip(StateToken token, BasicMimeTypeDTO mimeType) { + if (mimeType != null && mimeType.getType().equals("image")) { + return KuneUiUtils.genQuickTipWithImage(downloadUtilsProvider.get().getImageResizedUrl(token, + ImageSize.thumb)); + } else { + return null; + } + } + } Modified: trunk/src/main/resources/kune.properties =================================================================== --- trunk/src/main/resources/kune.properties 2008-10-15 14:12:54 UTC (rev 911) +++ trunk/src/main/resources/kune.properties 2008-10-15 17:33:40 UTC (rev 912) @@ -33,5 +33,4 @@ kune.images.resizewidth = 400 kune.images.thumbsize = 100 kune.images.cropsize = 85 - kune.images.iconsize = 16
participants (1)
-
vjrj