r979 - in trunk/src/main/java/org/ourproject/kune: app/client blogs/client docs/client gallery/client platf/client/services platf/server/manager/file wiki/client workspace/client workspace/client/cnt workspace/client/entityheader workspace/client/nohomepage workspace/client/options workspace/client/options/logo
Author: vjrj Date: 2008-12-03 12:17:42 +0100 (Wed, 03 Dec 2008) New Revision: 979 Added: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeader.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderView.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java Removed: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogo.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoSelector.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoSelectorPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoSelectorPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoSelectorView.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoView.java trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/ Modified: trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientModule.java trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientActions.java trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientModule.java trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/nohomepage/NoHomePagePresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPresenter.java Log: Complete - task NewGroup -> Close --> don't restore state Complete - task Gallery action order problem EntityLogo renamed to EntityHeader Modified: trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java 2008-12-03 11:17:42 UTC (rev 979) @@ -58,6 +58,6 @@ public void onModuleLoadCont() { Suco.install(new KuneCoreModule(), new KuneRegistryModule(), new KunePlatformModule(), new KuneWorkspaceModule(), new EmiteUIModule(), new DocumentClientModule(), new BlogClientModule(), - new WikiClientModule(), new ChatClientModule(), new GalleryClientModule(), new KuneModule()); + new WikiClientModule(), new GalleryClientModule(), new ChatClientModule(), new KuneModule()); } } Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java 2008-12-03 11:17:42 UTC (rev 979) @@ -38,7 +38,7 @@ import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.TextEditor; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeader; +import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import com.calclab.suco.client.ioc.Provider; Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientModule.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientModule.java 2008-12-03 11:17:42 UTC (rev 979) @@ -46,7 +46,7 @@ import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.TextEditor; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeader; +import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2008-12-03 11:17:42 UTC (rev 979) @@ -38,7 +38,7 @@ import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.TextEditor; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeader; +import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import com.calclab.suco.client.ioc.Provider; Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-12-03 11:17:42 UTC (rev 979) @@ -46,7 +46,7 @@ import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.TextEditor; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeader; +import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java 2008-12-03 11:17:42 UTC (rev 979) @@ -37,7 +37,7 @@ import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.TextEditor; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeader; +import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import com.calclab.suco.client.ioc.Provider; Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java 2008-12-03 11:17:42 UTC (rev 979) @@ -46,7 +46,7 @@ import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.TextEditor; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeader; +import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-12-03 11:17:42 UTC (rev 979) @@ -43,9 +43,9 @@ import org.ourproject.kune.platf.client.ui.rate.RatePanel; import org.ourproject.kune.platf.client.ui.rate.RatePresenter; import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeader; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeaderPanel; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeaderPresenter; +import org.ourproject.kune.workspace.client.entityheader.EntityHeader; +import org.ourproject.kune.workspace.client.entityheader.EntityHeaderPanel; +import org.ourproject.kune.workspace.client.entityheader.EntityHeaderPresenter; import org.ourproject.kune.workspace.client.i18n.I18nTranslator; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import org.ourproject.kune.workspace.client.licensefoot.EntityLicensePanel; Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java 2008-12-03 11:17:42 UTC (rev 979) @@ -37,7 +37,7 @@ import org.ourproject.kune.platf.server.domain.BasicMimeType; import org.ourproject.kune.platf.server.domain.Group; import org.ourproject.kune.platf.server.manager.GroupManager; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeaderView; +import org.ourproject.kune.workspace.client.entityheader.EntityHeaderView; import com.google.inject.Inject; import com.wideplay.warp.persist.TransactionType; Modified: trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientActions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientActions.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientActions.java 2008-12-03 11:17:42 UTC (rev 979) @@ -38,7 +38,7 @@ import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.TextEditor; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeader; +import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import com.calclab.suco.client.ioc.Provider; Modified: trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientModule.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientModule.java 2008-12-03 11:17:42 UTC (rev 979) @@ -46,7 +46,7 @@ import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.TextEditor; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeader; +import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2008-12-03 11:17:42 UTC (rev 979) @@ -33,7 +33,7 @@ import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.TextEditor; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeader; +import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import org.ourproject.kune.workspace.client.site.Site; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java 2008-12-03 11:17:42 UTC (rev 979) @@ -61,6 +61,7 @@ }); setWidget(imgResized); attach(); + Image.prefetch(imageUrl); } private void setDefStyle(final Widget widget) { Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader (from rev 973, trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo) Property changes on: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader ___________________________________________________________________ Name: svn:mergeinfo + Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeader.java (from rev 978, trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityHeader.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityHeader.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeader.java 2008-12-03 11:17:42 UTC (rev 979) @@ -0,0 +1,37 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */package org.ourproject.kune.workspace.client.entityheader; + +import org.ourproject.kune.platf.client.View; + +public interface EntityHeader { + + void addWidget(View widget); + + /** + * Refresh the logo from the group info in the client session + */ + void refreshGroupLogo(); + + /** + * Reload the logo from the group reloaded from the server + */ + void reloadGroupLogoImage(); + +} \ No newline at end of file Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java (from rev 978, trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityHeaderPanel.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityHeaderPanel.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java 2008-12-03 11:17:42 UTC (rev 979) @@ -0,0 +1,117 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.ourproject.kune.workspace.client.entityheader; + +import java.util.Date; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.dto.GroupDTO; +import org.ourproject.kune.platf.client.dto.StateToken; +import org.ourproject.kune.platf.client.services.Images; +import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; +import org.ourproject.kune.workspace.client.themes.WsTheme; + +import com.calclab.suco.client.ioc.Provider; +import com.google.gwt.user.client.ui.HorizontalPanel; +import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.VerticalPanel; +import com.google.gwt.user.client.ui.Widget; + +public class EntityHeaderPanel extends HorizontalPanel implements EntityHeaderView { + + private final Provider<FileDownloadUtils> downloadProvider; + private final EntityTextLogo entityTextLogo; + private final Images images; + private final VerticalPanel vp; + + public EntityHeaderPanel(final WorkspaceSkeleton ws, final Provider<FileDownloadUtils> dowloadProvider, Images images) { + this.downloadProvider = dowloadProvider; + this.images = images; + vp = new VerticalPanel(); + vp.setWidth("100%"); + super.setWidth("100%"); + vp.setHorizontalAlignment(ALIGN_RIGHT); + entityTextLogo = new EntityTextLogo(); + add(entityTextLogo); + add(vp); + ws.addToEntityMainHeader(this); + } + + public void addWidget(View view) { + Widget widget = (Widget) view; + vp.add(widget); + vp.setCellWidth(widget, "100%"); + } + + public void reloadImage(GroupDTO group) { + entityTextLogo.setLogoImage(downloadProvider.get().getLogoImageUrl(group.getStateToken()) + "&nocache=" + + new Date().getTime()); + } + + public void setFullLogo(final StateToken stateToken, final boolean clipped) { + clear(); + final String imageUrl = downloadProvider.get().getImageUrl(stateToken); + Image logo; + if (clipped) { + logo = new Image(imageUrl, 0, 0, LOGO_ICON_DEFAULT_WIDTH, LOGO_ICON_DEFAULT_HEIGHT); + } else { + logo = new Image(imageUrl); + logo.setWidth("" + LOGO_ICON_DEFAULT_WIDTH); + logo.setHeight("" + LOGO_ICON_DEFAULT_HEIGHT); + } + add(logo); + } + + public void setLargeFont() { + entityTextLogo.setLargeFont(); + } + + public void setLogoImage(StateToken stateToken) { + entityTextLogo.setLogoImage(downloadProvider.get().getLogoImageUrl(stateToken)); + } + + public void setLogoImageVisible(boolean visible) { + entityTextLogo.setLogoVisible(visible); + } + + public void setLogoText(final String groupName) { + entityTextLogo.setLogoText(groupName); + } + + public void setMediumFont() { + entityTextLogo.setMediumFont(); + } + + public void setSmallFont() { + entityTextLogo.setSmallFont(); + } + + public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) { + if (oldTheme != null) { + entityTextLogo.removeStyleDependentName(oldTheme.toString()); + } + entityTextLogo.addStyleDependentName(newTheme.toString()); + } + + public void showDefUserLogo() { + entityTextLogo.setLogoImage(images.personAvatarDef()); + } +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java (from rev 978, trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityHeaderPresenter.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityHeaderPresenter.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java 2008-12-03 11:17:42 UTC (rev 979) @@ -0,0 +1,100 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */package org.ourproject.kune.workspace.client.entityheader; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.dto.ContentSimpleDTO; +import org.ourproject.kune.platf.client.dto.GroupDTO; +import org.ourproject.kune.platf.client.dto.GroupType; +import org.ourproject.kune.platf.client.state.Session; +import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.workspace.client.themes.WsTheme; +import org.ourproject.kune.workspace.client.themes.WsThemePresenter; + +import com.calclab.suco.client.listener.Listener2; + +public class EntityHeaderPresenter implements EntityHeader { + int GROUP_MEDIUM_NAME_LIMIT_SIZE = 90; + int GROUP_LARGE_NAME_LIMIT_SIZE = 20; + + private EntityHeaderView view; + private final Session session; + + public EntityHeaderPresenter(final StateManager stateManager, final WsThemePresenter theme, final Session session) { + this.session = session; + + stateManager.onGroupChanged(new Listener2<String, String>() { + public void onEvent(final String oldGroup, final String newGroup) { + setGroupLogo(session.getCurrentState().getGroup()); + } + }); + theme.onThemeChanged(new Listener2<WsTheme, WsTheme>() { + public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) { + view.setTheme(oldTheme, newTheme); + } + }); + } + + public void addWidget(View widget) { + view.addWidget(widget); + } + + public void init(final EntityHeaderView view) { + this.view = view; + } + + public void refreshGroupLogo() { + setGroupLogo(session.getCurrentState().getGroup()); + } + + public void reloadGroupLogoImage() { + view.reloadImage(session.getCurrentState().getGroup()); + } + + void setGroupLogo(final GroupDTO group) { + final ContentSimpleDTO groupFullLogo = group.getGroupFullLogo(); + if (groupFullLogo != null) { + view.setFullLogo(groupFullLogo.getStateToken(), true); + } else if (group.hasLogo()) { + setLogoText(group.getLongName()); + view.setLogoImage(group.getStateToken()); + view.setLogoImageVisible(true); + } else { + setLogoText(group.getLongName()); + if (group.getGroupType().equals(GroupType.PERSONAL)) { + view.showDefUserLogo(); + view.setLogoImageVisible(true); + } else { + view.setLogoImageVisible(false); + } + } + } + + void setLogoText(String name) { + int length = name.length(); + if (length <= GROUP_LARGE_NAME_LIMIT_SIZE) { + view.setLargeFont(); + } else if (length <= GROUP_MEDIUM_NAME_LIMIT_SIZE) { + view.setMediumFont(); + } else { + view.setSmallFont(); + } + view.setLogoText(name); + } +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderView.java (from rev 978, trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityHeaderView.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityHeaderView.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderView.java 2008-12-03 11:17:42 UTC (rev 979) @@ -0,0 +1,57 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */package org.ourproject.kune.workspace.client.entityheader; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.dto.GroupDTO; +import org.ourproject.kune.platf.client.dto.StateToken; +import org.ourproject.kune.workspace.client.themes.WsTheme; + +public interface EntityHeaderView { + + int LOGO_ICON_DEFAULT_HEIGHT = 60; + int LOGO_ICON_DEFAULT_WIDTH = 468; + + int LOGO_ICON_MIN_HEIGHT = 28; + int LOGO_ICON_MIN_WIDTH = 468; + + String LOGO_FORM_FIELD = "k-elogov-ff"; + + void addWidget(View view); + + void reloadImage(GroupDTO group); + + void setFullLogo(StateToken stateToken, boolean clipped); + + void setLargeFont(); + + void setLogoImage(StateToken stateToken); + + void setLogoImageVisible(boolean visible); + + void setLogoText(final String groupName); + + void setMediumFont(); + + void setSmallFont(); + + void setTheme(final WsTheme oldTheme, WsTheme newTheme); + + void showDefUserLogo(); +} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogo.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogo.java 2008-11-30 23:11:28 UTC (rev 973) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogo.java 2008-12-03 11:17:42 UTC (rev 979) @@ -1,33 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */package org.ourproject.kune.workspace.client.entitylogo; - -public interface EntityLogo { - - /** - * Refresh the logo from the group info in the client session - */ - void refreshGroupLogo(); - - /** - * Reload the logo from the group reloaded from the server - */ - void reloadGroupLogoImage(); - -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPanel.java 2008-11-30 23:11:28 UTC (rev 973) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoPanel.java 2008-12-03 11:17:42 UTC (rev 979) @@ -1,268 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.entitylogo; - -import java.util.Date; - -import org.ourproject.kune.platf.client.dto.GroupDTO; -import org.ourproject.kune.platf.client.dto.StateToken; -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils; -import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; -import org.ourproject.kune.workspace.client.themes.WsTheme; - -import com.calclab.suco.client.ioc.Provider; -import com.google.gwt.user.client.ui.AbstractImagePrototype; -import com.google.gwt.user.client.ui.ClickListener; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.SimplePanel; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; - -public class EntityLogoPanel extends SimplePanel implements EntityLogoView { - class EntityTextLogo extends VerticalPanel { - - private static final String _100 = "100%"; - private static final String LOGO_MEDIUM_FONT_STYLE = "k-elogo-l-m"; - private static final String LOGO_SMALL_FONT_STYLE = "k-elogo-l-s"; - private static final String LOGO_LARGE_FONT_STYLE = "k-elogo-l-l"; - private final Label logoLabel; - private final Label putYourLogoHL; - private final HorizontalPanel putYourLogoHP; - private final Image logoImage; - - public EntityTextLogo(final Provider<EntityLogoSelector> entityLogoSelectorProvider) { - // Initialize - super(); - HorizontalPanel generalHP = new HorizontalPanel(); - VerticalPanel logoTextVP = new VerticalPanel(); - logoImage = new Image(); - logoLabel = new Label(); - final Label expandCell = new Label(""); - putYourLogoHP = new HorizontalPanel(); - putYourLogoHL = new Label(); - - logoImage.ensureDebugId(LOGO_IMAGE); - logoLabel.ensureDebugId(LOGO_NAME); - putYourLogoHL.ensureDebugId(PUT_YOUR_LOGO_LINK); - - // Layout - add(generalHP); - generalHP.add(logoImage); - generalHP.add(logoTextVP); - logoTextVP.add(logoLabel); - logoTextVP.add(putYourLogoHP); - putYourLogoHP.add(expandCell); - putYourLogoHP.add(putYourLogoHL); - - // Set properties - - setPutYourLogo(); - expandCell.setStyleName("k-elogop-expand"); - putYourLogoHL.setStyleName("k-elogo-plink"); - putYourLogoHL.addStyleName("kune-pointer"); - putYourLogoHL.addClickListener(new ClickListener() { - public void onClick(final Widget sender) { - entityLogoSelectorProvider.get().show(); - } - }); - generalHP.setWidth(_100); - generalHP.setHeight(_100); - generalHP.setCellWidth(logoTextVP, _100); - generalHP.setCellHeight(logoTextVP, _100); - logoTextVP.setWidth(_100); - logoTextVP.setCellWidth(logoLabel, _100); - super.setVerticalAlignment(ALIGN_MIDDLE); - logoTextVP.setVerticalAlignment(ALIGN_MIDDLE); - generalHP.setVerticalAlignment(ALIGN_MIDDLE); - logoTextVP.setCellWidth(putYourLogoHP, _100); - logoTextVP.setHeight(_100); - expandCell.setWidth(_100); - putYourLogoHP.setCellWidth(expandCell, _100); - setStylePrimaryName("k-entitytextlogo"); - addStyleName("k-entitytextlogo-no-border"); - logoImage.setVisible(false); - setLogoText(""); - } - - public void setChangeYourAvatarText() { - putYourLogoHL.setText(i18n.t("Change Your Avatar")); - } - - public void setChangeYourLogo() { - putYourLogoHL.setText(i18n.t("Change Your Logo")); - } - - public void setLargeFont() { - resetFontSize(); - logoLabel.addStyleName(LOGO_LARGE_FONT_STYLE); - } - - public void setLogoImage(AbstractImagePrototype imageProto) { - imageProto.applyTo(logoImage); - } - - public void setLogoImage(final String url) { - Image.prefetch(url); - logoImage.setUrl(url); - } - - public void setLogoText(final String text) { - logoLabel.setText(text); - } - - public void setLogoVisible(final boolean visible) { - logoImage.setVisible(visible); - } - - public void setMediumFont() { - resetFontSize(); - logoLabel.addStyleName(LOGO_MEDIUM_FONT_STYLE); - } - - public void setPutYourAvatarText() { - putYourLogoHL.setText(i18n.t("Put Your Avatar Here")); - } - - public void setPutYourLogo() { - putYourLogoHL.setText(i18n.t("Put Your Logo Here")); - } - - public void setPutYourLogoVisible(final boolean visible) { - putYourLogoHP.setVisible(visible); - } - - public void setSmallFont() { - resetFontSize(); - logoLabel.addStyleName(LOGO_SMALL_FONT_STYLE); - } - - private void resetFontSize() { - logoLabel.removeStyleName(LOGO_LARGE_FONT_STYLE); - logoLabel.removeStyleName(LOGO_SMALL_FONT_STYLE); - logoLabel.removeStyleName(LOGO_MEDIUM_FONT_STYLE); - } - } - public static final String LOGO_NAME = "k-elogop-ln"; - public static final String LOGO_IMAGE = "k-elogop-image"; - public static final String PUT_YOUR_LOGO_LINK = "k-elogop-pyll"; - - private final Provider<FileDownloadUtils> downloadProvider; - private final Provider<EntityLogoSelector> entityLogoSelectorProvider; - private EntityTextLogo entityTextLogo; - private final I18nTranslationService i18n; - private final Images images; - - public EntityLogoPanel(final I18nTranslationService i18n, final WorkspaceSkeleton ws, - final Provider<FileDownloadUtils> dowloadProvider, - final Provider<EntityLogoSelector> entityLogoSelectorProvider, Images images) { - this.i18n = i18n; - this.downloadProvider = dowloadProvider; - this.entityLogoSelectorProvider = entityLogoSelectorProvider; - this.images = images; - ws.addToEntityMainHeader(this); - } - - public void reloadImage(GroupDTO group) { - getEntityTextLogo().setLogoImage( - downloadProvider.get().getLogoImageUrl(group.getStateToken()) + "&nocache=" + new Date().getTime()); - } - - public void setChangeYourAvatarText() { - getEntityTextLogo().setChangeYourAvatarText(); - } - - public void setChangeYourLogoText() { - getEntityTextLogo().setChangeYourLogo(); - } - - public void setFullLogo(final StateToken stateToken, final boolean clipped) { - clear(); - final String imageUrl = downloadProvider.get().getImageUrl(stateToken); - Image logo; - if (clipped) { - logo = new Image(imageUrl, 0, 0, LOGO_ICON_DEFAULT_WIDTH, LOGO_ICON_DEFAULT_HEIGHT); - } else { - logo = new Image(imageUrl); - logo.setWidth("" + LOGO_ICON_DEFAULT_WIDTH); - logo.setHeight("" + LOGO_ICON_DEFAULT_HEIGHT); - } - add(logo); - } - - public void setLargeFont() { - getEntityTextLogo().setLargeFont(); - } - - public void setLogoImage(StateToken stateToken) { - entityTextLogo.setLogoImage(downloadProvider.get().getLogoImageUrl(stateToken)); - } - - public void setLogoImageVisible(boolean visible) { - entityTextLogo.setLogoVisible(visible); - } - - public void setLogoText(final String groupName) { - clear(); - add(getEntityTextLogo()); - entityTextLogo.setLogoText(groupName); - } - - public void setMediumFont() { - getEntityTextLogo().setMediumFont(); - } - - public void setPutYourAvatarText() { - getEntityTextLogo().setPutYourAvatarText(); - } - - public void setPutYourLogoText() { - getEntityTextLogo().setPutYourLogo(); - } - - public void setSetYourLogoVisible(final boolean visible) { - getEntityTextLogo().setPutYourLogoVisible(visible); - } - - public void setSmallFont() { - getEntityTextLogo().setSmallFont(); - } - - public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) { - if (oldTheme != null) { - getEntityTextLogo().removeStyleDependentName(oldTheme.toString()); - } - getEntityTextLogo().addStyleDependentName(newTheme.toString()); - } - - public void showDefUserLogo() { - getEntityTextLogo().setLogoImage(images.personAvatarDef()); - } - - private EntityTextLogo getEntityTextLogo() { - if (entityTextLogo == null) { - this.entityTextLogo = new EntityTextLogo(entityLogoSelectorProvider); - } - return entityTextLogo; - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java 2008-11-30 23:11:28 UTC (rev 973) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoPresenter.java 2008-12-03 11:17:42 UTC (rev 979) @@ -1,123 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */package org.ourproject.kune.workspace.client.entitylogo; - -import org.ourproject.kune.platf.client.dto.ContentSimpleDTO; -import org.ourproject.kune.platf.client.dto.GroupDTO; -import org.ourproject.kune.platf.client.dto.GroupType; -import org.ourproject.kune.platf.client.dto.StateAbstractDTO; -import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.themes.WsTheme; -import org.ourproject.kune.workspace.client.themes.WsThemePresenter; - -import com.calclab.suco.client.listener.Listener; -import com.calclab.suco.client.listener.Listener2; - -public class EntityLogoPresenter implements EntityLogo { - int GROUP_MEDIUM_NAME_LIMIT_SIZE = 90; - int GROUP_LARGE_NAME_LIMIT_SIZE = 20; - - private EntityLogoView view; - private final Session session; - - public EntityLogoPresenter(final StateManager stateManager, final WsThemePresenter theme, final Session session) { - this.session = session; - - stateManager.onGroupChanged(new Listener2<String, String>() { - public void onEvent(final String oldGroup, final String newGroup) { - setGroupLogo(session.getCurrentState().getGroup()); - } - }); - stateManager.onStateChanged(new Listener<StateAbstractDTO>() { - public void onEvent(final StateAbstractDTO state) { - setEntityLogoLink(state); - } - }); - theme.onThemeChanged(new Listener2<WsTheme, WsTheme>() { - public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) { - view.setTheme(oldTheme, newTheme); - } - }); - } - - public void init(final EntityLogoView view) { - this.view = view; - } - - public void refreshGroupLogo() { - setGroupLogo(session.getCurrentState().getGroup()); - } - - public void reloadGroupLogoImage() { - view.reloadImage(session.getCurrentState().getGroup()); - } - - void setEntityLogoLink(final StateAbstractDTO state) { - final boolean isAdmin = state.getGroupRights().isAdministrable(); - switch (state.getGroup().getGroupType()) { - case PERSONAL: - if (state.getGroup().hasLogo()) { - view.setChangeYourAvatarText(); - } else { - view.setPutYourAvatarText(); - } - break; - default: - if (state.getGroup().hasLogo()) { - view.setChangeYourLogoText(); - } else { - view.setPutYourLogoText(); - } - break; - } - view.setSetYourLogoVisible(isAdmin); - } - - void setGroupLogo(final GroupDTO group) { - final ContentSimpleDTO groupFullLogo = group.getGroupFullLogo(); - if (groupFullLogo != null) { - view.setFullLogo(groupFullLogo.getStateToken(), true); - } else if (group.hasLogo()) { - setLogoText(group.getLongName()); - view.setLogoImage(group.getStateToken()); - view.setLogoImageVisible(true); - } else { - setLogoText(group.getLongName()); - if (group.getGroupType().equals(GroupType.PERSONAL)) { - view.showDefUserLogo(); - view.setLogoImageVisible(true); - } else { - view.setLogoImageVisible(false); - } - } - } - - void setLogoText(String name) { - int length = name.length(); - if (length <= GROUP_LARGE_NAME_LIMIT_SIZE) { - view.setLargeFont(); - } else if (length <= GROUP_MEDIUM_NAME_LIMIT_SIZE) { - view.setMediumFont(); - } else { - view.setSmallFont(); - } - view.setLogoText(name); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoSelector.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelector.java 2008-11-30 23:11:28 UTC (rev 973) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoSelector.java 2008-12-03 11:17:42 UTC (rev 979) @@ -1,23 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */package org.ourproject.kune.workspace.client.entitylogo; - -public interface EntityLogoSelector { - void show(); -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoSelectorPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPanel.java 2008-11-30 23:11:28 UTC (rev 973) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoSelectorPanel.java 2008-12-03 11:17:42 UTC (rev 979) @@ -1,176 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */package org.ourproject.kune.workspace.client.entitylogo; - -import org.ourproject.kune.platf.client.PlatfMessages; -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.ui.dialogs.BasicDialogExtended; -import org.ourproject.kune.platf.client.ui.download.FileParams; -import org.ourproject.kune.workspace.client.site.Site; -import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; - -import com.calclab.suco.client.listener.Listener0; -import com.gwtext.client.core.Connection; -import com.gwtext.client.core.EventCallback; -import com.gwtext.client.core.EventObject; -import com.gwtext.client.widgets.form.Field; -import com.gwtext.client.widgets.form.Form; -import com.gwtext.client.widgets.form.FormPanel; -import com.gwtext.client.widgets.form.Hidden; -import com.gwtext.client.widgets.form.Label; -import com.gwtext.client.widgets.form.TextField; -import com.gwtext.client.widgets.form.event.FieldListenerAdapter; -import com.gwtext.client.widgets.form.event.FormListener; - -public class EntityLogoSelectorPanel implements EntityLogoSelectorView { - - public static final String ICON_UPLOAD_SERVLET = "/kune/servlets/EntityLogoUploadManager"; - public static final String SUBID = "k-elogoselp-subb"; - public static final String CANCELID = "k-elogoselp-canb"; - public static final String DIALOG_ID = "k-elogoselp"; - private final BasicDialogExtended dialog; - private final FormPanel formPanel; - private final Hidden userhashField; - private final Hidden tokenField; - private final TextField file; - private final Label dialogInfoLabel; - private final I18nTranslationService i18n; - - public EntityLogoSelectorPanel(final EntityLogoSelectorPresenter presenter, final WorkspaceSkeleton ws, - I18nTranslationService i18n) { - this.i18n = i18n; - dialog = new BasicDialogExtended(i18n.t(PlatfMessages.ENT_LOGO_SELECTOR_NORMAL_TITLE), true, true, 400, 200, - "", i18n.t("Select"), SUBID, i18n.tWithNT("Cancel", "used in button"), CANCELID, new Listener0() { - public void onEvent() { - String filename = file.getValueAsString(); - if (filename != null && filename.length() > 0) { - formPanel.getForm().submit(); - } - } - }, new Listener0() { - public void onEvent() { - presenter.onCancel(); - } - }, 2); - dialog.setId(DIALOG_ID); - dialog.setCollapsible(false); - dialog.setBorder(false); - // dialog.getFirstButton().disable(); - - formPanel = new FormPanel(); - formPanel.setFrame(true); - formPanel.setAutoScroll(false); - formPanel.setBorder(false); - formPanel.setFileUpload(true); - formPanel.setWidth(400); - formPanel.setMethod(Connection.POST); - formPanel.setUrl(ICON_UPLOAD_SERVLET); - formPanel.setWaitMsgTarget(true); - formPanel.setHideLabels(true); - formPanel.setPaddings(10); - formPanel.addFormListener(new FormListener() { - public boolean doBeforeAction(Form form) { - return true; - } - - public void onActionComplete(Form form, int httpStatus, String responseText) { - presenter.onSubmitComplete(httpStatus, responseText); - } - - public void onActionFailed(Form form, int httpStatus, String responseText) { - Site.important(responseText); - presenter.onSubmitFailed(httpStatus, responseText); - } - }); - dialogInfoLabel = new Label(); - formPanel.add(dialogInfoLabel); - file = new TextField("File", EntityLogoView.LOGO_FORM_FIELD); - EventCallback keyListener = new EventCallback() { - public void execute(EventObject e) { - // setEnableFileField(); - } - }; - file.addKeyPressListener(keyListener); - file.setId(EntityLogoView.LOGO_FORM_FIELD); - file.setInputType("file"); - userhashField = new Hidden(FileParams.HASH, FileParams.HASH); - tokenField = new Hidden(FileParams.TOKEN, FileParams.TOKEN); - formPanel.add(userhashField); - formPanel.add(tokenField); - formPanel.add(file); - FieldListenerAdapter changeListener = new FieldListenerAdapter() { - @Override - public void onChange(Field field, Object newVal, Object oldVal) { - Site.info("change"); - // setEnableFileField(); - } - }; - // Don't works: - file.addListener(changeListener); - dialog.add(formPanel); - } - - // BrowseButton browseButton = new BrowseButton("SelectIcon"); - // browseButton.addListener(new BrowseButtonListenerAdapter() { - // @Override - // public void onInputFileChange(BrowseButton browseButton, String filename) - // { - // // TODO Auto-generated method stub - // } - // }); - - public void hide() { - dialog.hide(); - formPanel.getForm().reset(); - } - - public void setNormalGroupsLabels() { - dialogInfoLabel.setHtml(i18n.t("Select an image in your computer as the logo for this group. " - + "For best results use a [%d]x[%d] pixel image. We will automatically resize bigger images.", - EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT, EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT) - + "<br/><br/>"); - dialog.setTitle(PlatfMessages.ENT_LOGO_SELECTOR_NORMAL_TITLE); - } - - public void setPersonalGroupsLabels() { - dialogInfoLabel.setHtml(i18n.t("Select an image in your computer as your avatar. " - + "For best results use a [%d]x[%d] pixel image. We will automatically resize bigger images.", - EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT, EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT) - + "<br/><br/>"); - dialog.setTitle(PlatfMessages.ENT_LOGO_SELECTOR_PERSON_TITLE); - } - - public void setUploadParams(String userHash, String token) { - userhashField.setValue(userHash); - tokenField.setValue(token); - } - - public void show() { - dialog.show(); - } - - @SuppressWarnings("unused") - private void setEnableFileField() { - if (file.getValueAsString().length() > 0) { - dialog.getFirstButton().enable(); - } else { - dialog.getFirstButton().disable(); - } - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoSelectorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPresenter.java 2008-11-30 23:11:28 UTC (rev 973) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoSelectorPresenter.java 2008-12-03 11:17:42 UTC (rev 979) @@ -1,71 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */package org.ourproject.kune.workspace.client.entitylogo; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; -import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.workspace.client.site.Site; - -public class EntityLogoSelectorPresenter implements EntityLogoSelector { - - private EntityLogoSelectorView view; - private final Session session; - private final EntityLogo entityLogo; - - public EntityLogoSelectorPresenter(Session session, EntityLogo entityLogo) { - this.session = session; - this.entityLogo = entityLogo; - } - - public View getView() { - return view; - } - - public void init(EntityLogoSelectorView view) { - this.view = view; - } - - public void onCancel() { - view.hide(); - } - - public void onSubmitComplete(int httpStatus, String responseText) { - view.hide(); - entityLogo.reloadGroupLogoImage(); - } - - public void onSubmitFailed(int httpStatus, String responseText) { - Site.error("Error setting the group logo"); - } - - public void show() { - session.check(new AsyncCallbackSimple<Object>() { - public void onSuccess(Object result) { - view.setUploadParams(session.getUserHash(), session.getCurrentStateToken().toString()); - if (session.getCurrentState().getGroup().isPersonalGroup()) { - view.setPersonalGroupsLabels(); - } else { - view.setNormalGroupsLabels(); - } - view.show(); - } - }); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoSelectorView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorView.java 2008-11-30 23:11:28 UTC (rev 973) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoSelectorView.java 2008-12-03 11:17:42 UTC (rev 979) @@ -1,33 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */package org.ourproject.kune.workspace.client.entitylogo; - -import org.ourproject.kune.platf.client.View; - -public interface EntityLogoSelectorView extends View { - void hide(); - - void setNormalGroupsLabels(); - - void setPersonalGroupsLabels(); - - void setUploadParams(String userHash, String token); - - void show(); -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoView.java 2008-11-30 23:11:28 UTC (rev 973) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoView.java 2008-12-03 11:17:42 UTC (rev 979) @@ -1,64 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */package org.ourproject.kune.workspace.client.entitylogo; - -import org.ourproject.kune.platf.client.dto.GroupDTO; -import org.ourproject.kune.platf.client.dto.StateToken; -import org.ourproject.kune.workspace.client.themes.WsTheme; - -public interface EntityLogoView { - - int LOGO_ICON_DEFAULT_HEIGHT = 60; - int LOGO_ICON_DEFAULT_WIDTH = 468; - - int LOGO_ICON_MIN_HEIGHT = 28; - int LOGO_ICON_MIN_WIDTH = 468; - - String LOGO_FORM_FIELD = "k-elogov-ff"; - - void reloadImage(GroupDTO group); - - void setChangeYourAvatarText(); - - void setChangeYourLogoText(); - - void setFullLogo(StateToken stateToken, boolean clipped); - - void setLargeFont(); - - void setLogoImage(StateToken stateToken); - - void setLogoImageVisible(boolean visible); - - void setLogoText(final String groupName); - - void setMediumFont(); - - void setPutYourAvatarText(); - - void setPutYourLogoText(); - - void setSetYourLogoVisible(final boolean visible); - - void setSmallFont(); - - void setTheme(final WsTheme oldTheme, WsTheme newTheme); - - void showDefUserLogo(); -} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java (from rev 977, trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityTextLogo.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityTextLogo.java 2008-12-02 17:08:38 UTC (rev 977) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java 2008-12-03 11:17:42 UTC (rev 979) @@ -0,0 +1,94 @@ +package org.ourproject.kune.workspace.client.entityheader; + +import com.google.gwt.user.client.ui.AbstractImagePrototype; +import com.google.gwt.user.client.ui.HorizontalPanel; +import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.VerticalPanel; + +public class EntityTextLogo extends VerticalPanel { + + public static final String LOGO_NAME = "k-elogop-ln"; + public static final String LOGO_IMAGE = "k-elogop-image"; + + private static final String _100 = "100%"; + private static final String LOGO_MEDIUM_FONT_STYLE = "k-elogo-l-m"; + private static final String LOGO_SMALL_FONT_STYLE = "k-elogo-l-s"; + private static final String LOGO_LARGE_FONT_STYLE = "k-elogo-l-l"; + private final Label logoLabel; + private final Image logoImage; + + public EntityTextLogo() { + // Initialize + super(); + HorizontalPanel generalHP = new HorizontalPanel(); + VerticalPanel logoTextVP = new VerticalPanel(); + logoImage = new Image(); + logoLabel = new Label(); + final Label expandCell = new Label(""); + + logoImage.ensureDebugId(LOGO_IMAGE); + logoLabel.ensureDebugId(LOGO_NAME); + + // Layout + add(generalHP); + generalHP.add(logoImage); + generalHP.add(logoTextVP); + logoTextVP.add(logoLabel); + + // Set properties + + expandCell.setStyleName("k-elogop-expand"); + generalHP.setWidth(_100); + generalHP.setHeight(_100); + generalHP.setCellWidth(logoTextVP, _100); + generalHP.setCellHeight(logoTextVP, _100); + logoTextVP.setWidth(_100); + logoTextVP.setCellWidth(logoLabel, _100); + super.setVerticalAlignment(ALIGN_MIDDLE); + logoTextVP.setVerticalAlignment(ALIGN_MIDDLE); + generalHP.setVerticalAlignment(ALIGN_MIDDLE); + setStylePrimaryName("k-entitytextlogo"); + addStyleName("k-entitytextlogo-no-border"); + logoImage.setVisible(false); + setLogoText(""); + } + + public void setLargeFont() { + resetFontSize(); + logoLabel.addStyleName(LOGO_LARGE_FONT_STYLE); + } + + public void setLogoImage(AbstractImagePrototype imageProto) { + imageProto.applyTo(logoImage); + } + + public void setLogoImage(final String url) { + Image.prefetch(url); + logoImage.setUrl(url); + } + + public void setLogoText(final String text) { + logoLabel.setText(text); + } + + public void setLogoVisible(final boolean visible) { + logoImage.setVisible(visible); + } + + public void setMediumFont() { + resetFontSize(); + logoLabel.addStyleName(LOGO_MEDIUM_FONT_STYLE); + } + + public void setSmallFont() { + resetFontSize(); + logoLabel.addStyleName(LOGO_SMALL_FONT_STYLE); + } + + private void resetFontSize() { + logoLabel.removeStyleName(LOGO_LARGE_FONT_STYLE); + logoLabel.removeStyleName(LOGO_SMALL_FONT_STYLE); + logoLabel.removeStyleName(LOGO_MEDIUM_FONT_STYLE); + } +} \ No newline at end of file Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/nohomepage/NoHomePagePresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/nohomepage/NoHomePagePresenter.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/nohomepage/NoHomePagePresenter.java 2008-12-03 11:17:42 UTC (rev 979) @@ -22,7 +22,7 @@ import org.ourproject.kune.platf.client.dto.StateAbstractDTO; import org.ourproject.kune.platf.client.dto.StateNoContentDTO; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeader; +import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import com.calclab.suco.client.ioc.Provider; import com.calclab.suco.client.listener.Listener; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java 2008-12-03 11:17:42 UTC (rev 979) @@ -7,7 +7,7 @@ import org.ourproject.kune.platf.client.services.Images; import org.ourproject.kune.platf.client.ui.IconLabel; import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeader; +import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.user.client.ui.AbstractImagePrototype; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPanel.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPanel.java 2008-12-03 11:17:42 UTC (rev 979) @@ -21,7 +21,7 @@ import org.ourproject.kune.platf.client.PlatfMessages; import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.download.FileParams; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeaderView; +import org.ourproject.kune.workspace.client.entityheader.EntityHeaderView; import org.ourproject.kune.workspace.client.site.Site; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPresenter.java 2008-12-02 17:42:31 UTC (rev 978) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPresenter.java 2008-12-03 11:17:42 UTC (rev 979) @@ -21,7 +21,7 @@ import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.entitylogo.EntityHeader; +import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.options.EntityOptions; import org.ourproject.kune.workspace.client.site.Site;
participants (1)
-
vjrj