r1248 - in trunk/src: main/java/cc/kune/chat/client main/java/cc/kune/client main/java/cc/kune/common main/java/cc/kune/core/client main/java/cc/kune/core/client/ws main/java/cc/kune/core/client/ws/entheader main/java/cc/kune/core/public main/java/org/ourproject/kune/app/public/css main/java/org/ourproject/kune/blogs/client main/java/org/ourproject/kune/docs/client main/java/org/ourproject/kune/gallery/client main/java/org/ourproject/kune/wiki/client main/java/org/ourproject/kune/workspace/cl
Author: vjrj_ Date: 2011-02-12 00:06:04 +0100 (Sat, 12 Feb 2011) New Revision: 1248 Added: trunk/src/main/java/cc/kune/chat/client/AddAsBuddieHeaderButton.java trunk/src/main/java/cc/kune/core/client/ws/entheader/ trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeader.java trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeaderPanel.java trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeaderPresenter.java trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityTextLogo.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspacePresenter.java trunk/src/test/java/cc/kune/core/client/ws/ trunk/src/test/java/cc/kune/core/client/ws/entheader/ Removed: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeader.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderButton.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 trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/maxmin/ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspacePresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/other/AddAsBuddieHeaderButton.java trunk/src/test/java/org/ourproject/kune/workspace/client/entityheader/ Modified: trunk/src/main/java/cc/kune/chat/client/ChatGinModule.java trunk/src/main/java/cc/kune/client/KuneGinjector.java trunk/src/main/java/cc/kune/common/KuneCommon.gwt.xml trunk/src/main/java/cc/kune/core/client/CoreGinModule.java trunk/src/main/java/cc/kune/core/client/CoreParts.java trunk/src/main/java/cc/kune/core/public/ws.css trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 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/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/WorkspaceModule.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspace.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspacePanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspaceView.java trunk/src/main/java/org/ourproject/kune/workspace/client/nohomepage/NoHomePagePresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/GroupOptionsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/UserOptionsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/GroupOptionsLogoPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/UserOptionsLogoPresenter.java trunk/src/test/java/cc/kune/core/client/ws/entheader/EntityLogoPresenterTest.java trunk/src/test/java/testsuites/OthersTestSuite.java Log: Entity header updated Copied: trunk/src/main/java/cc/kune/chat/client/AddAsBuddieHeaderButton.java (from rev 1244, trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/other/AddAsBuddieHeaderButton.java) =================================================================== --- trunk/src/main/java/cc/kune/chat/client/AddAsBuddieHeaderButton.java (rev 0) +++ trunk/src/main/java/cc/kune/chat/client/AddAsBuddieHeaderButton.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -0,0 +1,117 @@ +/* + * + * Copyright (C) 2007-2011 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 cc.kune.chat.client; + +import cc.kune.common.client.actions.AbstractAction; +import cc.kune.common.client.actions.AbstractExtendedAction; +import cc.kune.common.client.actions.Action; +import cc.kune.common.client.actions.ActionEvent; +import cc.kune.common.client.actions.PropertyChangeEvent; +import cc.kune.common.client.actions.PropertyChangeListener; +import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor; +import cc.kune.common.client.noti.NotifyUser; +import cc.kune.core.client.resources.icons.IconConstants; +import cc.kune.core.client.resources.icons.IconResources; +import cc.kune.core.client.state.Session; +import cc.kune.core.client.state.StateChangedEvent; +import cc.kune.core.client.state.StateChangedEvent.StateChangedHandler; +import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeader; +import cc.kune.core.shared.dto.StateAbstractDTO; +import cc.kune.core.shared.i18n.I18nTranslationService; + +import com.calclab.emite.im.client.roster.XmppRoster; +import com.calclab.emite.im.client.roster.events.RosterGroupChangedEvent; +import com.calclab.emite.im.client.roster.events.RosterGroupChangedHandler; +import com.calclab.suco.client.Suco; +import com.google.inject.Inject; +import com.google.inject.Provider; + +public class AddAsBuddieHeaderButton { + + public static class AddAsBuddieAction extends AbstractExtendedAction { + private final Provider<ChatClientDefault> chatEngine; + private final Session session; + + @Inject + public AddAsBuddieAction(final Provider<ChatClientDefault> chatEngine, final Session session, + final StateManager stateManager, final I18nTranslationService i18n, final IconResources img) { + super(); + this.chatEngine = chatEngine; + this.session = session; + stateManager.onStateChanged(new StateChangedHandler() { + @Override + public void onStateChanged(final StateChangedEvent event) { + setState(event.getState()); + } + }); + Suco.get(XmppRoster.class).addRosterGroupChangedHandler(new RosterGroupChangedHandler() { + + @Override + public void onGroupChanged(final RosterGroupChangedEvent event) { + setState(session.getCurrentState()); + } + }); + putValue(Action.NAME, i18n.t("Add as a buddie")); + putValue(Action.SMALL_ICON, IconConstants.toPath(img.addGreen())); + } + + @Override + public void actionPerformed(final ActionEvent event) { + chatEngine.get().addNewBuddie(session.getCurrentState().getGroup().getShortName()); + NotifyUser.info("Added as buddie. Waiting buddie response"); + setEnabled(false); + } + + private boolean currentGroupsIsAsPerson(final StateAbstractDTO state) { + return state.getGroup().isPersonal(); + } + + private boolean isNotMe(final String groupName) { + return !session.getCurrentUser().getShortName().equals(groupName); + } + + private void setState(final StateAbstractDTO state) { + final String groupName = state.getGroup().getShortName(); + final boolean imLogged = session.isLogged(); + final boolean isNotBuddie = !chatEngine.get().isBuddie(groupName); + if (imLogged && currentGroupsIsAsPerson(state) && isNotBuddie && isNotMe(groupName)) { + setEnabled(true); + } else { + setEnabled(false); + } + } + } + + @Inject + public AddAsBuddieHeaderButton(final AddAsBuddieAction buddieAction, final EntityHeader entityHeader) { + final ButtonDescriptor button = new ButtonDescriptor(buddieAction); + button.setVisible(false); + buddieAction.addPropertyChangeListener(new PropertyChangeListener() { + @Override + public void propertyChange(final PropertyChangeEvent event) { + if (event.getPropertyName().equals(AbstractAction.ENABLED)) { + button.setVisible((Boolean) event.getNewValue()); + } + } + }); + entityHeader.addAction(button); + } +} \ No newline at end of file Property changes on: trunk/src/main/java/cc/kune/chat/client/AddAsBuddieHeaderButton.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: trunk/src/main/java/cc/kune/chat/client/ChatGinModule.java =================================================================== --- trunk/src/main/java/cc/kune/chat/client/ChatGinModule.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/cc/kune/chat/client/ChatGinModule.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -32,5 +32,6 @@ protected void configure() { bind(ChatClient.class).to(ChatClientDefault.class).in(Singleton.class); bind(ChatOptions.class).in(Singleton.class); + bind(AddAsBuddieHeaderButton.class).in(Singleton.class); } } \ No newline at end of file Modified: trunk/src/main/java/cc/kune/client/KuneGinjector.java =================================================================== --- trunk/src/main/java/cc/kune/client/KuneGinjector.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/cc/kune/client/KuneGinjector.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -44,6 +44,7 @@ import cc.kune.core.client.state.StateManager; import cc.kune.core.client.ui.footer.license.EntityLicensePresenter; import cc.kune.core.client.ws.CorePresenter; +import cc.kune.core.client.ws.entheader.EntityHeaderPresenter; import cc.kune.core.shared.i18n.I18nTranslationService; import cc.kune.pspace.client.PSpaceGinModule; import cc.kune.pspace.client.PSpacePresenter; @@ -71,6 +72,8 @@ Provider<CorePresenter> getCorePresenter(); + AsyncProvider<EntityHeaderPresenter> getEntityHeaderPresenter(); + AsyncProvider<EntityLicensePresenter> getEntityLicensePresenter(); ErrorHandler getErrorHandler(); Modified: trunk/src/main/java/cc/kune/common/KuneCommon.gwt.xml =================================================================== --- trunk/src/main/java/cc/kune/common/KuneCommon.gwt.xml 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/cc/kune/common/KuneCommon.gwt.xml 2011-02-11 23:06:04 UTC (rev 1248) @@ -10,9 +10,11 @@ <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> --> <!-- Other module inherits --> <!-- Specify the app entry point class. --> -<!-- <entry-point class='cc.kune.msgs.client.KuneMessagesSampleEntryPoint' />--> + <!-- <entry-point class='cc.kune.msgs.client.KuneMessagesSampleEntryPoint' + /> --> <!-- Specify the paths for translatable code --> - <source path='client' /> + <source path='client' + excludes="**/*Test.java,**/*Tests.java,**/*MockProvider.java" /> <public path="public" /> <inherits name='org.cobogw.gwt.user.User' /> <inherits name='com.google.gwt.inject.Inject' /> Modified: trunk/src/main/java/cc/kune/core/client/CoreGinModule.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -88,6 +88,9 @@ import cc.kune.core.client.ui.footer.license.EntityLicensePresenter; import cc.kune.core.client.ws.CorePresenter; import cc.kune.core.client.ws.CoreViewImpl; +import cc.kune.core.client.ws.entheader.EntityHeader; +import cc.kune.core.client.ws.entheader.EntityHeaderPanel; +import cc.kune.core.client.ws.entheader.EntityHeaderPresenter; import cc.kune.core.shared.i18n.I18nTranslationService; import cc.kune.gspace.client.WsArmor; import cc.kune.gspace.client.WsArmorImpl; @@ -139,6 +142,8 @@ GroupMembersPanel.class, GroupMembersPresenter.GroupMembersProxy.class); bindPresenter(EntityLicensePresenter.class, EntityLicensePresenter.EntityLicenseView.class, EntityLicensePanel.class, EntityLicensePresenter.EntityLicenseProxy.class); + bindPresenter(EntityHeaderPresenter.class, EntityHeaderPresenter.EntityHeaderView.class, + EntityHeaderPanel.class, EntityHeaderPresenter.EntityHeaderProxy.class); bind(UserPassAutocompleteManager.class).to(UserPassAutocompleteManagerImpl.class).in(Singleton.class); bindPresenter(SignInPresenter.class, SignInView.class, SignInPanel.class, SignInPresenter.SignInProxy.class); @@ -147,6 +152,7 @@ bind(SignIn.class).to(SignInPresenter.class).in(Singleton.class); bind(Register.class).to(RegisterPresenter.class).in(Singleton.class); bind(NewGroup.class).to(NewGroupPresenter.class).in(Singleton.class); + bind(EntityHeader.class).to(EntityHeaderPresenter.class).in(Singleton.class); bind(UserMessagesPresenter.class).in(Singleton.class); bind(UserMessagesPanel.class).in(Singleton.class); Modified: trunk/src/main/java/cc/kune/core/client/CoreParts.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/CoreParts.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/cc/kune/core/client/CoreParts.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -1,5 +1,6 @@ package cc.kune.core.client; +import cc.kune.chat.client.AddAsBuddieHeaderButton; import cc.kune.core.client.init.AppStartEvent; import cc.kune.core.client.init.AppStartEvent.AppStartHandler; import cc.kune.core.client.sitebar.SiteUserOptionsPresenter; @@ -14,13 +15,15 @@ @Inject public CoreParts(final Session session, final Provider<GroupMembersPresenter> grouMembersPresenter, - final Provider<SiteUserOptionsPresenter> userOptions, final Provider<EntityLicensePresenter> licenseFooter) { + final Provider<SiteUserOptionsPresenter> userOptions, final Provider<EntityLicensePresenter> licenseFooter, + final Provider<AddAsBuddieHeaderButton> buddieButton) { session.onInitDataReceived(new AppStartHandler() { @Override public void onAppStart(final AppStartEvent event) { grouMembersPresenter.get(); userOptions.get(); licenseFooter.get(); + buddieButton.get(); } }); } Copied: trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeader.java (from rev 1244, trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeader.java) =================================================================== --- trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeader.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeader.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -0,0 +1,42 @@ +/* + * + * Copyright (C) 2007-2011 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 cc.kune.core.client.ws.entheader; + +import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip; + +import com.google.gwt.user.client.ui.IsWidget; + +public interface EntityHeader { + + void addAction(GuiActionDescrip descriptor); + + void addWidget(IsWidget 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 Property changes on: trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeader.java ___________________________________________________________________ Name: svn:mergeinfo + Copied: trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeaderPanel.java (from rev 1244, trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java) =================================================================== --- trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeaderPanel.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeaderPanel.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -0,0 +1,152 @@ +/* + * + * Copyright (C) 2007-2011 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 cc.kune.core.client.ws.entheader; + +import java.util.Date; + +import cc.kune.common.client.actions.ui.ActionFlowPanel; +import cc.kune.common.client.actions.ui.bind.GuiProvider; +import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip; +import cc.kune.core.client.resources.CoreResources; +import cc.kune.core.client.services.FileConstants; +import cc.kune.core.client.services.FileDownloadUtils; +import cc.kune.core.client.ws.entheader.EntityHeaderPresenter.EntityHeaderView; +import cc.kune.core.shared.domain.utils.StateToken; +import cc.kune.core.shared.dto.GroupDTO; +import cc.kune.gspace.client.WsArmor; + +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.IsWidget; +import com.google.gwt.user.client.ui.VerticalPanel; +import com.google.gwt.user.client.ui.Widget; +import com.google.inject.Inject; +import com.google.inject.Provider; +import com.gwtplatform.mvp.client.ViewImpl; + +public class EntityHeaderPanel extends ViewImpl implements EntityHeaderView { + + private final Provider<FileDownloadUtils> downloadProvider; + private final EntityTextLogo entityTextLogo; + private final CoreResources images; + private final HorizontalPanel mainPanel; + private final ActionFlowPanel toolbar; + private final VerticalPanel vpanel; + + @Inject + public EntityHeaderPanel(final Provider<FileDownloadUtils> downloadProvider, final CoreResources images, + final GuiProvider bindings, final WsArmor armor) { + mainPanel = new HorizontalPanel(); + mainPanel.setWidth("100%"); + this.downloadProvider = downloadProvider; + this.images = images; + vpanel = new VerticalPanel(); + vpanel.setWidth("100%"); + vpanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT); + entityTextLogo = new EntityTextLogo(); + mainPanel.add(entityTextLogo); + toolbar = new ActionFlowPanel(bindings); + vpanel.add(toolbar); + mainPanel.add(vpanel); + armor.getEntityHeader().add(mainPanel); + } + + @Override + public void addAction(final GuiActionDescrip descriptor) { + toolbar.add(descriptor); + } + + @Override + public void addWidget(final IsWidget view) { + final Widget widget = (Widget) view; + vpanel.add(widget); + } + + @Override + public Widget asWidget() { + return mainPanel; + } + + @Override + public void reloadImage(final GroupDTO group) { + entityTextLogo.setLogoImage(downloadProvider.get().getLogoImageUrl(group.getStateToken()) + "&nocache=" + + new Date().getTime()); + } + + @Deprecated + public void setFullLogo(final StateToken stateToken, final boolean clipped) { + mainPanel.clear(); + final String imageUrl = downloadProvider.get().getImageUrl(stateToken); + Image logo; + if (clipped) { + logo = new Image(imageUrl, 0, 0, FileConstants.LOGO_DEF_WIDTH, FileConstants.LOGO_DEF_HEIGHT); + } else { + logo = new Image(imageUrl); + logo.setWidth(String.valueOf(FileConstants.LOGO_DEF_WIDTH)); + logo.setHeight(String.valueOf(FileConstants.LOGO_DEF_HEIGHT)); + } + mainPanel.add(logo); + } + + @Override + public void setLargeFont() { + entityTextLogo.setLargeFont(); + } + + @Override + public void setLogoImage(final StateToken stateToken) { + entityTextLogo.setLogoImage(downloadProvider.get().getLogoImageUrl(stateToken)); + } + + @Override + public void setLogoImageVisible(final boolean visible) { + entityTextLogo.setLogoVisible(visible); + } + + @Override + public void setLogoText(final String groupName) { + entityTextLogo.setLogoText(groupName); + } + + @Override + public void setMediumFont() { + entityTextLogo.setMediumFont(); + } + + // + // @Override + // public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) { + // if (oldTheme != null) { + // entityTextLogo.removeStyleDependentName(oldTheme.toString()); + // } + // entityTextLogo.addStyleDependentName(newTheme.toString()); + // } + + @Override + public void setSmallFont() { + entityTextLogo.setSmallFont(); + } + + @Override + public void showDefUserLogo() { + entityTextLogo.setLogoImage(AbstractImagePrototype.create(images.personAvatarDef())); + } +} Property changes on: trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeaderPanel.java ___________________________________________________________________ Name: svn:mergeinfo + Copied: trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeaderPresenter.java (from rev 1244, trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java) =================================================================== --- trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeaderPresenter.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeaderPresenter.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -0,0 +1,146 @@ +/* + * + * Copyright (C) 2007-2011 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 cc.kune.core.client.ws.entheader; + +import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip; +import cc.kune.core.client.state.GroupChangedEvent; +import cc.kune.core.client.state.GroupChangedEvent.GroupChangedHandler; +import cc.kune.core.client.state.Session; +import cc.kune.core.client.state.StateManager; +import cc.kune.core.shared.domain.utils.StateToken; +import cc.kune.core.shared.dto.GroupDTO; + +import com.google.gwt.event.shared.EventBus; +import com.google.gwt.user.client.ui.IsWidget; +import com.google.inject.Inject; +import com.gwtplatform.mvp.client.Presenter; +import com.gwtplatform.mvp.client.View; +import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit; +import com.gwtplatform.mvp.client.proxy.Proxy; +import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent; + +public class EntityHeaderPresenter extends + Presenter<EntityHeaderPresenter.EntityHeaderView, EntityHeaderPresenter.EntityHeaderProxy> implements + EntityHeader { + + @ProxyCodeSplit + public interface EntityHeaderProxy extends Proxy<EntityHeaderPresenter> { + } + public interface EntityHeaderView extends View { + void addAction(GuiActionDescrip descriptor); + + void addWidget(IsWidget widget); + + void reloadImage(GroupDTO group); + + 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(); + } + + private static final int LARGE_NAME_LIMIT = 20; + + private static final int MEDIUM_NAME_LIMIT = 90; + private final Session session; + + @Inject + public EntityHeaderPresenter(final EventBus eventBus, final EntityHeaderView view, final EntityHeaderProxy proxy, + final StateManager stateManager, final Session session) { + super(eventBus, view, proxy); + this.session = session; + stateManager.onGroupChanged(new GroupChangedHandler() { + @Override + public void onGroupChanged(final GroupChangedEvent event) { + setGroupLogo(session.getCurrentState().getGroup()); + } + }); + // theme.addOnThemeChanged(new Listener2<WsTheme, WsTheme>() { + // @Override + // public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) { + // // getView().setTheme(oldTheme, newTheme); + // } + // }); + } + + @Override + public void addAction(final GuiActionDescrip descriptor) { + getView().addAction(descriptor); + } + + @Override + public void addWidget(final IsWidget widget) { + getView().addWidget(widget); + } + + @Override + public void refreshGroupLogo() { + setGroupLogo(session.getCurrentState().getGroup()); + } + + @Override + public void reloadGroupLogoImage() { + getView().reloadImage(session.getCurrentState().getGroup()); + } + + @Override + protected void revealInParent() { + RevealRootContentEvent.fire(this, this); + } + + void setGroupLogo(final GroupDTO group) { + if (group.hasLogo()) { + setLogoText(group.getLongName()); + getView().setLogoImage(group.getStateToken()); + getView().setLogoImageVisible(true); + } else { + setLogoText(group.getLongName()); + if (group.isPersonal()) { + getView().showDefUserLogo(); + getView().setLogoImageVisible(true); + } else { + getView().setLogoImageVisible(false); + } + } + } + + void setLogoText(final String name) { + final int length = name.length(); + if (length <= LARGE_NAME_LIMIT) { + getView().setLargeFont(); + } else if (length <= MEDIUM_NAME_LIMIT) { + getView().setMediumFont(); + } else { + getView().setSmallFont(); + } + getView().setLogoText(name); + } +} Property changes on: trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeaderPresenter.java ___________________________________________________________________ Name: svn:mergeinfo + Copied: trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityTextLogo.java (from rev 1244, trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java) =================================================================== --- trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityTextLogo.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityTextLogo.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -0,0 +1,117 @@ +/* + * + * Copyright (C) 2007-2011 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 cc.kune.core.client.ws.entheader; + +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(); + final HorizontalPanel generalHP = new HorizontalPanel(); + final 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); + setLogoTextImpl(""); + } + + public void setLargeFont() { + resetFontSize(); + logoLabel.addStyleName(LOGO_LARGE_FONT_STYLE); + } + + public void setLogoImage(final AbstractImagePrototype imageProto) { + imageProto.applyTo(logoImage); + } + + public void setLogoImage(final String url) { + Image.prefetch(url); + logoImage.setUrl(url); + } + + public void setLogoText(final String text) { + setLogoTextImpl(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); + } + + private void setLogoTextImpl(final String text) { + logoLabel.setText(text); + } +} \ No newline at end of file Modified: trunk/src/main/java/cc/kune/core/public/ws.css =================================================================== --- trunk/src/main/java/cc/kune/core/public/ws.css 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/cc/kune/core/public/ws.css 2011-02-11 23:06:04 UTC (rev 1248) @@ -923,6 +923,7 @@ font-size: 16px; color: #784421; } + .k-footer-license-label-title { margin-right: 5px; color: #280b0b; @@ -932,4 +933,79 @@ float: right; margin: 10px 15px 0px 5px; cursor: pointer; -} \ No newline at end of file +} + + +.k-entitytextlogo-border { + border: 2px solid #F2F2F2; +} + +.k-entitytextlogo-no-border { + border: none; +} + +.k-entitytextlogo { + height: 60px; + margin: 5px; + overflow: hidden; + width: 468px; +} + +.k-entitytextlogo table { + vertical-align: middle; +} + +.k-elogo-l-l { + font-size: 46px; +} + +.k-elogo-l-m { + font-size: 167%; +} + +.k-elogo-l-s { + font-size: 108%; +} + +.k-entitytextlogo .gwt-Label { + font-weight: 700; + margin: 5px; + height: 27px; +} + +.k-entitytextlogo-default .gwt-Label { + color: #69312F; +} + +.k-entitytextlogo-green .gwt-Label { + color: #250; +} + +.k-entitytextlogo-blue .gwt-Label { + color: #000080; +} + +.k-entitytextlogo-grey .gwt-Label { + color: #1A1A1A; +} + +.k-entitytextlogo-purple .gwt-Label { + color: #440055; +} + +.k-entitytextlogo-red .gwt-Label { + color: #800000; +} + +.k-elogo-plink { + color: #CCC; + font-size: 85%; + margin: 5px; + text-decoration: underline; + white-space: nowrap; + background-color: #FFF; +} + +.k-elogop-expand { + background-color: transparent; +} Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css =================================================================== --- trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2011-02-11 23:06:04 UTC (rev 1248) @@ -69,80 +69,6 @@ border-bottom-width: 5px; } -.k-entitytextlogo-border { - border: 2px solid #F2F2F2; -} - -.k-entitytextlogo-no-border { - border: none; -} - -.k-entitytextlogo { - height: 60px; - margin: 0 0 4px 0; - overflow: hidden; - width: 468px; -} - -.k-entitytextlogo table { - vertical-align: middle; -} - -.k-elogo-l-l { - font-size: 272%; -} - -.k-elogo-l-m { - font-size: 167%; -} - -.k-elogo-l-s { - font-size: 108%; -} - -.k-entitytextlogo .gwt-Label { - font-weight: 700; - margin: 5px; - height: 27px; -} - -.k-entitytextlogo-default .gwt-Label { - color: #69312F; -} - -.k-entitytextlogo-green .gwt-Label { - color: #250; -} - -.k-entitytextlogo-blue .gwt-Label { - color: #000080; -} - -.k-entitytextlogo-grey .gwt-Label { - color: #1A1A1A; -} - -.k-entitytextlogo-purple .gwt-Label { - color: #440055; -} - -.k-entitytextlogo-red .gwt-Label { - color: #800000; -} - -.k-elogo-plink { - color: #CCC; - font-size: 85%; - margin: 5px; - text-decoration: underline; - white-space: nowrap; - background-color: #FFF; -} - -.k-elogop-expand { - background-color: transparent; -} - .k-entity-default .x-layout-split,.k-entity-default .x-layout-collapsed { background: #DD8A3D none repeat scroll 0% 50%; Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -31,7 +31,6 @@ import org.ourproject.kune.workspace.client.cxt.ContextActionRegistry; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.ContentEditor; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.sitebar.sitepublic.SitePublicSpaceLink; import org.ourproject.kune.workspace.client.themes.WsBackManager; import org.ourproject.kune.workspace.client.upload.FileUploader; @@ -44,6 +43,7 @@ import cc.kune.core.client.services.FileDownloadUtils; import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeader; 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 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientModule.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -39,7 +39,6 @@ import org.ourproject.kune.workspace.client.cxt.ContextActionRegistry; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.ContentEditor; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.sitebar.sitepublic.SitePublicSpaceLink; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsBackManager; @@ -55,6 +54,7 @@ import cc.kune.core.client.services.FileDownloadUtils; import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeader; import cc.kune.core.shared.i18n.I18nTranslationService; import com.calclab.suco.client.ioc.decorator.Singleton; Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -31,7 +31,6 @@ import org.ourproject.kune.workspace.client.cxt.ContextActionRegistry; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.ContentEditor; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.sitebar.sitepublic.SitePublicSpaceLink; import org.ourproject.kune.workspace.client.themes.WsBackManager; import org.ourproject.kune.workspace.client.upload.FileUploader; @@ -44,6 +43,7 @@ import cc.kune.core.client.services.FileDownloadUtils; import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeader; 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 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -39,7 +39,6 @@ import org.ourproject.kune.workspace.client.cxt.ContextActionRegistry; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.ContentEditor; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.sitebar.sitepublic.SitePublicSpaceLink; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsBackManager; @@ -55,6 +54,7 @@ import cc.kune.core.client.services.FileDownloadUtils; import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeader; import cc.kune.core.shared.i18n.I18nTranslationService; import com.calclab.suco.client.ioc.decorator.Singleton; Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -30,7 +30,6 @@ import org.ourproject.kune.workspace.client.cxt.ContextActionRegistry; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.ContentEditor; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.sitebar.sitepublic.SitePublicSpaceLink; import org.ourproject.kune.workspace.client.themes.WsBackManager; import org.ourproject.kune.workspace.client.upload.FileUploader; @@ -43,6 +42,7 @@ import cc.kune.core.client.services.FileDownloadUtils; import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeader; 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 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -39,7 +39,6 @@ import org.ourproject.kune.workspace.client.cxt.ContextActionRegistry; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.ContentEditor; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.sitebar.sitepublic.SitePublicSpaceLink; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsBackManager; @@ -55,6 +54,7 @@ import cc.kune.core.client.services.FileDownloadUtils; import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeader; import cc.kune.core.shared.i18n.I18nTranslationService; import com.calclab.suco.client.ioc.decorator.Singleton; Modified: trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientActions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientActions.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientActions.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -31,7 +31,6 @@ import org.ourproject.kune.workspace.client.cxt.ContextActionRegistry; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.ContentEditor; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.sitebar.sitepublic.SitePublicSpaceLink; import org.ourproject.kune.workspace.client.themes.WsBackManager; import org.ourproject.kune.workspace.client.upload.FileUploader; @@ -44,6 +43,7 @@ import cc.kune.core.client.services.FileDownloadUtils; import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeader; 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 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientModule.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -39,7 +39,6 @@ import org.ourproject.kune.workspace.client.cxt.ContextActionRegistry; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.ContentEditor; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.sitebar.sitepublic.SitePublicSpaceLink; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsBackManager; @@ -55,6 +54,7 @@ import cc.kune.core.client.services.FileDownloadUtils; import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeader; import cc.kune.core.shared.i18n.I18nTranslationService; import com.calclab.suco.client.ioc.decorator.Singleton; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -38,7 +38,6 @@ import org.ourproject.kune.workspace.client.cxt.ContextActionRegistry; import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.ContentEditor; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.sitebar.sitepublic.SitePublicSpaceLink; import org.ourproject.kune.workspace.client.themes.WsBackManager; import org.ourproject.kune.workspace.client.upload.FileUploader; @@ -53,6 +52,7 @@ import cc.kune.core.client.services.FileDownloadUtils; import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeader; import cc.kune.core.shared.domain.ContentStatus; import cc.kune.core.shared.domain.utils.StateToken; import cc.kune.core.shared.dto.AccessRolDTO; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -71,9 +71,6 @@ import org.ourproject.kune.workspace.client.editor.insertlocalmedia.InsertMediaLocal; import org.ourproject.kune.workspace.client.editor.insertlocalmedia.InsertMediaLocalPanel; import org.ourproject.kune.workspace.client.editor.insertlocalmedia.InsertMediaLocalPresenter; -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.I18nTranslatorPanel; import org.ourproject.kune.workspace.client.i18n.I18nTranslatorPresenter; @@ -97,7 +94,6 @@ import org.ourproject.kune.workspace.client.nohomepage.NoHomePage; import org.ourproject.kune.workspace.client.nohomepage.NoHomePagePanel; import org.ourproject.kune.workspace.client.nohomepage.NoHomePagePresenter; -import org.ourproject.kune.workspace.client.oldsn.other.AddAsBuddieHeaderButton; import org.ourproject.kune.workspace.client.oldsn.toolbar.ActionBuddiesSummaryToolbar; import org.ourproject.kune.workspace.client.oldsn.toolbar.ActionBuddiesSummaryToolbarPresenter; import org.ourproject.kune.workspace.client.oldsn.toolbar.ActionGroupSummaryToolbar; @@ -212,6 +208,7 @@ import cc.kune.core.client.state.Session; import cc.kune.core.client.state.SiteCommonTokens; import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeader; import cc.kune.core.shared.domain.utils.StateToken; import cc.kune.core.shared.dto.StateTokenUtils; import cc.kune.core.shared.dto.UserSimpleDTO; @@ -384,17 +381,21 @@ } }); - register(ApplicationComponentGroup.class, new Factory<EntityHeader>(EntityHeader.class) { - @Override - public EntityHeader create() { - final EntityHeaderPresenter presenter = new EntityHeaderPresenter(i(StateManager.class), - i(WsThemeManager.class), i(Session.class)); - final EntityHeaderPanel panel = new EntityHeaderPanel(i(WorkspaceSkeleton.class), - p(FileDownloadUtils.class), i(Images.class), i(GuiBindingsRegister.class)); - presenter.init(panel); - return presenter; - } - }); + // register(ApplicationComponentGroup.class, new + // Factory<EntityHeader>(EntityHeader.class) { + // @Override + // public EntityHeader create() { + // final EntityHeaderPresenter presenter = new + // EntityHeaderPresenter(i(StateManager.class), + // i(WsThemeManager.class), i(Session.class)); + // final EntityHeaderPanel panel = new + // EntityHeaderPanel(i(WorkspaceSkeleton.class), + // p(FileDownloadUtils.class), i(Images.class), + // i(GuiBindingsRegister.class)); + // presenter.init(panel); + // return presenter; + // } + // }); register(Singleton.class, new Factory<WsBackManager>(WsBackManager.class) { @Override @@ -540,13 +541,16 @@ // } // }); - register(ApplicationComponentGroup.class, new Factory<AddAsBuddieHeaderButton>(AddAsBuddieHeaderButton.class) { - @Override - public AddAsBuddieHeaderButton create() { - return new AddAsBuddieHeaderButton(p(ChatEngine.class), i(Session.class), i(StateManager.class), - i(I18nTranslationService.class), i(IconResources.class), i(EntityHeader.class)); - } - }); + // register(ApplicationComponentGroup.class, new + // Factory<AddAsBuddieHeaderButton>(AddAsBuddieHeaderButton.class) { + // @Override + // public AddAsBuddieHeaderButton create() { + // return new AddAsBuddieHeaderButton(p(ChatEngine.class), + // i(Session.class), i(StateManager.class), + // i(I18nTranslationService.class), i(IconResources.class), + // i(EntityHeader.class)); + // } + // }); // register(ApplicationComponentGroup.class, new // Factory<BuddiesSummary>(BuddiesSummary.class) { Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeader.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeader.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeader.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -1,41 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions.ui.OldGuiActionDescrip; - -public interface EntityHeader { - - void addAction(OldGuiActionDescrip descriptor); - - 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 Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderButton.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderButton.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderButton.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -1,44 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.ui.IconLabel; - -import com.google.gwt.user.client.ui.AbstractImagePrototype; - -public class EntityHeaderButton extends IconLabel implements View { - public EntityHeaderButton(final AbstractImagePrototype icon, final String text) { - super(icon, text, false); - setDefStyle(); - } - - public EntityHeaderButton(final String text, final AbstractImagePrototype icon) { - super(text, icon, false); - setDefStyle(); - } - - private void setDefStyle() { - addStyleName("kune-Margin-Medium-t"); - addStyleName("kune-pointer"); - addStyleName("kune-floatright"); - } - -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -1,132 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions.ui.ComplexToolbar; -import org.ourproject.kune.platf.client.actions.ui.OldGuiActionDescrip; -import org.ourproject.kune.platf.client.actions.ui.GuiBindingsRegister; -import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; -import org.ourproject.kune.workspace.client.themes.WsTheme; - -import cc.kune.core.client.services.FileConstants; -import cc.kune.core.client.services.FileDownloadUtils; -import cc.kune.core.shared.domain.utils.StateToken; -import cc.kune.core.shared.dto.GroupDTO; - -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 vpanel; - private final ComplexToolbar toolbar; - - public EntityHeaderPanel(final WorkspaceSkeleton wskel, final Provider<FileDownloadUtils> downloadProvider, - final Images images, final GuiBindingsRegister bindings) { - super(); - super.setWidth("100%"); - this.downloadProvider = downloadProvider; - this.images = images; - vpanel = new VerticalPanel(); - vpanel.setWidth("100%"); - vpanel.setHorizontalAlignment(ALIGN_RIGHT); - entityTextLogo = new EntityTextLogo(); - add(entityTextLogo); - toolbar = new ComplexToolbar(bindings); - toolbar.setTranspStyle(); - vpanel.add(toolbar); - add(vpanel); - wskel.addToEntityMainHeader(this); - } - - public void addAction(final OldGuiActionDescrip descriptor) { - toolbar.add(descriptor); - } - - public void addWidget(final View view) { - final Widget widget = (Widget) view; - vpanel.add(widget); - } - - public void reloadImage(final GroupDTO group) { - entityTextLogo.setLogoImage(downloadProvider.get().getLogoImageUrl(group.getStateToken()) + "&nocache=" - + new Date().getTime()); - } - - @Deprecated - 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, FileConstants.LOGO_DEF_WIDTH, FileConstants.LOGO_DEF_HEIGHT); - } else { - logo = new Image(imageUrl); - logo.setWidth(String.valueOf(FileConstants.LOGO_DEF_WIDTH)); - logo.setHeight(String.valueOf(FileConstants.LOGO_DEF_HEIGHT)); - } - add(logo); - } - - public void setLargeFont() { - entityTextLogo.setLargeFont(); - } - - public void setLogoImage(final StateToken stateToken) { - entityTextLogo.setLogoImage(downloadProvider.get().getLogoImageUrl(stateToken)); - } - - public void setLogoImageVisible(final 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()); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -1,102 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions.ui.OldGuiActionDescrip; -import org.ourproject.kune.workspace.client.themes.WsTheme; -import org.ourproject.kune.workspace.client.themes.WsThemeManager; - -import cc.kune.core.client.state.Session; -import cc.kune.core.client.state.StateManager; -import cc.kune.core.shared.dto.GroupDTO; - -import com.calclab.suco.client.events.Listener2; - -public class EntityHeaderPresenter implements EntityHeader { - private static final int MEDIUM_NAME_LIMIT = 90; - private static final int LARGE_NAME_LIMIT = 20; - - private EntityHeaderView view; - private final Session session; - - public EntityHeaderPresenter(final StateManager stateManager, final WsThemeManager 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.addOnThemeChanged(new Listener2<WsTheme, WsTheme>() { - public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) { - view.setTheme(oldTheme, newTheme); - } - }); - } - - public void addAction(final OldGuiActionDescrip descriptor) { - view.addAction(descriptor); - } - - public void addWidget(final 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) { - if (group.hasLogo()) { - setLogoText(group.getLongName()); - view.setLogoImage(group.getStateToken()); - view.setLogoImageVisible(true); - } else { - setLogoText(group.getLongName()); - if (group.isPersonal()) { - view.showDefUserLogo(); - view.setLogoImageVisible(true); - } else { - view.setLogoImageVisible(false); - } - } - } - - void setLogoText(final String name) { - final int length = name.length(); - if (length <= LARGE_NAME_LIMIT) { - view.setLargeFont(); - } else if (length <= MEDIUM_NAME_LIMIT) { - view.setMediumFont(); - } else { - view.setSmallFont(); - } - view.setLogoText(name); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderView.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderView.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -1,52 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions.ui.OldGuiActionDescrip; -import org.ourproject.kune.workspace.client.themes.WsTheme; - -import cc.kune.core.shared.domain.utils.StateToken; -import cc.kune.core.shared.dto.GroupDTO; - -public interface EntityHeaderView { - - void addAction(OldGuiActionDescrip descriptor); - - void addWidget(View view); - - void reloadImage(GroupDTO group); - - 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/EntityTextLogo.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -1,117 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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 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(); - final HorizontalPanel generalHP = new HorizontalPanel(); - final 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); - setLogoTextImpl(""); - } - - public void setLargeFont() { - resetFontSize(); - logoLabel.addStyleName(LOGO_LARGE_FONT_STYLE); - } - - public void setLogoImage(final AbstractImagePrototype imageProto) { - imageProto.applyTo(logoImage); - } - - public void setLogoImage(final String url) { - Image.prefetch(url); - logoImage.setUrl(url); - } - - public void setLogoText(final String text) { - setLogoTextImpl(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); - } - - private void setLogoTextImpl(final String text) { - logoLabel.setText(text); - } -} \ No newline at end of file Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin (from rev 1244, trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/maxmin) Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspace.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/maxmin/MaxMinWorkspace.java 2011-02-10 18:28:58 UTC (rev 1244) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspace.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.workspace.client.entityheader.maxmin; +package org.ourproject.kune.workspace.client.entityheadermaxmin; public interface MaxMinWorkspace { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspacePanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/maxmin/MaxMinWorkspacePanel.java 2011-02-10 18:28:58 UTC (rev 1244) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspacePanel.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.workspace.client.entityheader.maxmin; +package org.ourproject.kune.workspace.client.entityheadermaxmin; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspacePresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/maxmin/MaxMinWorkspacePresenter.java 2011-02-10 18:28:58 UTC (rev 1244) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspacePresenter.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -1,137 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.maxmin; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.actions.AbstractExtendedAction; -import org.ourproject.kune.platf.client.actions.Action; -import org.ourproject.kune.platf.client.actions.ActionEvent; -import org.ourproject.kune.platf.client.actions.KeyStroke; -import org.ourproject.kune.platf.client.actions.Shortcut; -import org.ourproject.kune.platf.client.actions.ui.OldMenuItemDescriptor; -import org.ourproject.kune.platf.client.shortcuts.GlobalShortcutRegister; -import org.ourproject.kune.workspace.client.sitebar.siteoptions.SiteOptions; - -import cc.kune.core.client.resources.icons.IconResources; -import cc.kune.core.shared.i18n.I18nTranslationService; - -import com.google.gwt.resources.client.ImageResource; - -public class MaxMinWorkspacePresenter implements MaxMinWorkspace { - public class MaximizeAction extends AbstractExtendedAction { - public MaximizeAction(final String name, final ImageResource img) { - super(); - putValue(Action.NAME, name); - putValue(Action.SMALL_ICON, img); - } - - public void actionPerformed(final ActionEvent event) { - showMaximized(true); - } - } - public class MinimizeAction extends AbstractExtendedAction { - public MinimizeAction(final String name, final ImageResource img) { - super(); - putValue(Action.NAME, name); - putValue(Action.SMALL_ICON, img); - } - - public void actionPerformed(final ActionEvent event) { - showMaximized(false); - } - } - - public static final String MIN_ICON = "mmwp-min_bt"; - public static final String MAX_ICON = "mmwp-max_bt"; - private MaxMinWorkspaceView view; - - private boolean maximized; - - private final IconResources images; - - private final I18nTranslationService i18n; - - private final GlobalShortcutRegister shortcutReg; - - private OldMenuItemDescriptor maximizeButton; - - private OldMenuItemDescriptor minimizeButton; - private final SiteOptions siteOptions; - - public MaxMinWorkspacePresenter(final GlobalShortcutRegister shortcutReg, final IconResources images, - final I18nTranslationService i18n, final SiteOptions siteOptions) { - this.shortcutReg = shortcutReg; - this.images = images; - this.i18n = i18n; - this.siteOptions = siteOptions; - maximized = false; - - } - - public View getView() { - return view; - } - - public void init(final MaxMinWorkspaceView view) { - this.view = view; - createActions(); - } - - public void maximize() { - showMaximized(true); - } - - public void minimize() { - showMaximized(false); - } - - private void createActions() { - final KeyStroke shortcut = Shortcut.getShortcut(true, true, false, false, Character.valueOf('F')); - - final MaximizeAction maximizeAction = new MaximizeAction(i18n.t("Maximize the workspace"), images.maximize()); - maximizeAction.setShortcut(shortcut); - maximizeButton = new OldMenuItemDescriptor(maximizeAction); - maximizeButton.setPosition(0); - maximizeButton.setId(MAX_ICON); - - final MinimizeAction minimizeAction = new MinimizeAction(i18n.t("Minimize the workspace"), images.minimize()); - minimizeAction.setShortcut(shortcut); - minimizeButton = new OldMenuItemDescriptor(minimizeAction); - minimizeButton.setPosition(1); - minimizeButton.setVisible(false); - minimizeButton.setId(MIN_ICON); - - shortcutReg.put(shortcut, new AbstractExtendedAction() { - public void actionPerformed(final ActionEvent event) { - showMaximized(!maximized); - } - }); - - siteOptions.addAction(maximizeButton); - siteOptions.addAction(minimizeButton); - } - - private void showMaximized(final boolean maximized) { - maximizeButton.setVisible(!maximized); - minimizeButton.setVisible(maximized); - this.maximized = maximized; - view.setMaximized(maximized); - } -} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspacePresenter.java (from rev 1245, trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/maxmin/MaxMinWorkspacePresenter.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspacePresenter.java (rev 0) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspacePresenter.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -0,0 +1,141 @@ +/* + * + * Copyright (C) 2007-2011 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.entityheadermaxmin; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.actions.AbstractExtendedAction; +import org.ourproject.kune.platf.client.actions.Action; +import org.ourproject.kune.platf.client.actions.ActionEvent; +import org.ourproject.kune.platf.client.actions.KeyStroke; +import org.ourproject.kune.platf.client.actions.Shortcut; +import org.ourproject.kune.platf.client.actions.ui.OldMenuItemDescriptor; +import org.ourproject.kune.platf.client.shortcuts.GlobalShortcutRegister; + +import cc.kune.core.client.resources.icons.IconResources; +import cc.kune.core.shared.i18n.I18nTranslationService; + +import com.google.gwt.resources.client.ImageResource; + +public class MaxMinWorkspacePresenter implements MaxMinWorkspace { + public class MaximizeAction extends AbstractExtendedAction { + public MaximizeAction(final String name, final ImageResource img) { + super(); + putValue(Action.NAME, name); + putValue(Action.SMALL_ICON, img); + } + + @Override + public void actionPerformed(final ActionEvent event) { + showMaximized(true); + } + } + public class MinimizeAction extends AbstractExtendedAction { + public MinimizeAction(final String name, final ImageResource img) { + super(); + putValue(Action.NAME, name); + putValue(Action.SMALL_ICON, img); + } + + @Override + public void actionPerformed(final ActionEvent event) { + showMaximized(false); + } + } + + public static final String MAX_ICON = "mmwp-max_bt"; + public static final String MIN_ICON = "mmwp-min_bt"; + private final I18nTranslationService i18n; + + private final IconResources images; + + private OldMenuItemDescriptor maximizeButton; + + private boolean maximized; + + private OldMenuItemDescriptor minimizeButton; + // private final SiteOptions siteOptions; + + private final GlobalShortcutRegister shortcutReg; + + private MaxMinWorkspaceView view; + + public MaxMinWorkspacePresenter(final GlobalShortcutRegister shortcutReg, final IconResources images, + final I18nTranslationService i18n) { + this.shortcutReg = shortcutReg; + this.images = images; + this.i18n = i18n; + // this.siteOptions = siteOptions; + maximized = false; + + } + + private void createActions() { + final KeyStroke shortcut = Shortcut.getShortcut(true, true, false, false, Character.valueOf('F')); + + final MaximizeAction maximizeAction = new MaximizeAction(i18n.t("Maximize the workspace"), images.maximize()); + maximizeAction.setShortcut(shortcut); + maximizeButton = new OldMenuItemDescriptor(maximizeAction); + maximizeButton.setPosition(0); + maximizeButton.setId(MAX_ICON); + + final MinimizeAction minimizeAction = new MinimizeAction(i18n.t("Minimize the workspace"), images.minimize()); + minimizeAction.setShortcut(shortcut); + minimizeButton = new OldMenuItemDescriptor(minimizeAction); + minimizeButton.setPosition(1); + minimizeButton.setVisible(false); + minimizeButton.setId(MIN_ICON); + + shortcutReg.put(shortcut, new AbstractExtendedAction() { + @Override + public void actionPerformed(final ActionEvent event) { + showMaximized(!maximized); + } + }); + + // siteOptions.addAction(maximizeButton); + // siteOptions.addAction(minimizeButton); + } + + public View getView() { + return view; + } + + public void init(final MaxMinWorkspaceView view) { + this.view = view; + createActions(); + } + + @Override + public void maximize() { + showMaximized(true); + } + + @Override + public void minimize() { + showMaximized(false); + } + + private void showMaximized(final boolean maximized) { + maximizeButton.setVisible(!maximized); + minimizeButton.setVisible(maximized); + this.maximized = maximized; + view.setMaximized(maximized); + } +} Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspaceView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/maxmin/MaxMinWorkspaceView.java 2011-02-10 18:28:58 UTC (rev 1244) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheadermaxmin/MaxMinWorkspaceView.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.workspace.client.entityheader.maxmin; +package org.ourproject.kune.workspace.client.entityheadermaxmin; import org.ourproject.kune.platf.client.View; 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 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/nohomepage/NoHomePagePresenter.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -20,9 +20,9 @@ package org.ourproject.kune.workspace.client.nohomepage; import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeader; import cc.kune.core.shared.dto.StateAbstractDTO; import cc.kune.core.shared.dto.StateNoContentDTO; Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/other/AddAsBuddieHeaderButton.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/other/AddAsBuddieHeaderButton.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/other/AddAsBuddieHeaderButton.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -1,103 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.oldsn.other; - -import org.ourproject.kune.chat.client.ChatEngine; -import org.ourproject.kune.platf.client.actions.OldAbstractAction; -import org.ourproject.kune.platf.client.actions.AbstractExtendedAction; -import org.ourproject.kune.platf.client.actions.Action; -import org.ourproject.kune.platf.client.actions.ActionEvent; -import org.ourproject.kune.platf.client.actions.PropertyChangeEvent; -import org.ourproject.kune.platf.client.actions.PropertyChangeListener; -import org.ourproject.kune.platf.client.actions.ui.ButtonDescriptor; -import org.ourproject.kune.platf.client.ui.noti.NotifyUser; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; - -import cc.kune.core.client.resources.icons.IconConstants; -import cc.kune.core.client.resources.icons.IconResources; -import cc.kune.core.client.state.Session; -import cc.kune.core.client.state.StateManager; -import cc.kune.core.shared.dto.StateAbstractDTO; -import cc.kune.core.shared.i18n.I18nTranslationService; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; -import com.calclab.suco.client.ioc.Provider; - -public class AddAsBuddieHeaderButton { - - public static class AddAsBuddieAction extends AbstractExtendedAction { - private final Provider<ChatEngine> chatEngine; - private final Session session; - - public AddAsBuddieAction(final Provider<ChatEngine> chatEngine, final Session session, - final StateManager stateManager, final I18nTranslationService i18n, final IconResources img) { - super(); - this.chatEngine = chatEngine; - this.session = session; - stateManager.onStateChanged(new Listener<StateAbstractDTO>() { - public void onEvent(final StateAbstractDTO state) { - setState(state); - } - }); - chatEngine.get().addOnRosterChanged(new Listener0() { - public void onEvent() { - setState(session.getCurrentState()); - } - }); - putValue(Action.NAME, i18n.t("Add as a buddie")); - putValue(Action.SMALL_ICON, IconConstants.toPath(img.addGreen())); - } - - public void actionPerformed(final ActionEvent event) { - chatEngine.get().addNewBuddie(session.getCurrentState().getGroup().getShortName()); - NotifyUser.info("Added as buddie. Waiting buddie response"); - setEnabled(false); - } - - private void setState(final StateAbstractDTO state) { - final String groupName = state.getGroup().getShortName(); - final boolean isPersonal = state.getGroup().isPersonal(); - final boolean isLogged = session.isLogged(); - if (isLogged && isPersonal && (!chatEngine.get().isBuddie(groupName)) - && (!session.getCurrentUser().getShortName().equals(groupName))) { - setEnabled(true); - } else { - setEnabled(false); - } - } - } - - public AddAsBuddieHeaderButton(final Provider<ChatEngine> chatEngine, final Session session, - final StateManager stateManager, final I18nTranslationService i18n, final IconResources img, - final EntityHeader entityHeader) { - final AddAsBuddieAction buddieAction = new AddAsBuddieAction(chatEngine, session, stateManager, i18n, img); - final ButtonDescriptor button = new ButtonDescriptor(buddieAction); - button.setVisible(false); - buddieAction.addPropertyChangeListener(new PropertyChangeListener() { - public void propertyChange(final PropertyChangeEvent event) { - if (event.getPropertyName().equals(OldAbstractAction.ENABLED)) { - button.setVisible((Boolean) event.getNewValue()); - } - } - }); - entityHeader.addAction(button); - } -} \ No newline at end of file Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/GroupOptionsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/GroupOptionsPanel.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/GroupOptionsPanel.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -22,10 +22,10 @@ import org.ourproject.kune.platf.client.actions.ui.OldGuiActionDescrip; import org.ourproject.kune.platf.client.app.GroupOptionsCollection; import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogPanel; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import cc.kune.common.client.noti.NotifyLevelImages; import cc.kune.core.client.resources.CoreMessages; +import cc.kune.core.client.ws.entheader.EntityHeader; import cc.kune.core.shared.i18n.I18nTranslationService; public class GroupOptionsPanel extends AbstractTabbedDialogPanel implements GroupOptionsView { @@ -48,7 +48,7 @@ @Override public void addAction(final OldGuiActionDescrip descriptor) { - entityHeader.addAction(descriptor); + // entityHeader.addAction(descriptor); } @Override Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/UserOptionsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/UserOptionsPanel.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/UserOptionsPanel.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -21,10 +21,10 @@ import org.ourproject.kune.platf.client.app.UserOptionsCollection; import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogPanel; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import cc.kune.common.client.noti.NotifyLevelImages; import cc.kune.core.client.resources.CoreMessages; +import cc.kune.core.client.ws.entheader.EntityHeader; import cc.kune.core.shared.i18n.I18nTranslationService; public class UserOptionsPanel extends AbstractTabbedDialogPanel implements UserOptionsView { 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 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPresenter.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -22,11 +22,11 @@ import org.ourproject.kune.chat.client.ChatEngine; import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.ui.noti.NotifyUser; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.options.EntityOptions; import cc.kune.core.client.rpcservices.UserServiceAsync; import cc.kune.core.client.state.Session; +import cc.kune.core.client.ws.entheader.EntityHeader; import com.calclab.suco.client.ioc.Provider; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/GroupOptionsLogoPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/GroupOptionsLogoPresenter.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/GroupOptionsLogoPresenter.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -20,12 +20,12 @@ package org.ourproject.kune.workspace.client.options.logo; import org.ourproject.kune.chat.client.ChatEngine; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.options.EntityOptions; import cc.kune.core.client.rpcservices.UserServiceAsync; import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeader; import com.calclab.suco.client.events.Listener2; import com.calclab.suco.client.ioc.Provider; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/UserOptionsLogoPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/UserOptionsLogoPresenter.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/UserOptionsLogoPresenter.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -20,13 +20,13 @@ package org.ourproject.kune.workspace.client.options.logo; import org.ourproject.kune.chat.client.ChatEngine; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.options.EntityOptions; import cc.kune.core.client.rpcservices.AsyncCallbackSimple; import cc.kune.core.client.rpcservices.UserServiceAsync; import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeader; import cc.kune.core.shared.dto.GroupDTO; import cc.kune.core.shared.dto.UserInfoDTO; Copied: trunk/src/test/java/cc/kune/core/client/ws/entheader (from rev 1244, trunk/src/test/java/org/ourproject/kune/workspace/client/entityheader) Modified: trunk/src/test/java/cc/kune/core/client/ws/entheader/EntityLogoPresenterTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/workspace/client/entityheader/EntityLogoPresenterTest.java 2011-02-10 18:28:58 UTC (rev 1244) +++ trunk/src/test/java/cc/kune/core/client/ws/entheader/EntityLogoPresenterTest.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.workspace.client.entityheader; +package cc.kune.core.client.ws.entheader; import org.junit.Before; import org.junit.Test; @@ -26,30 +26,32 @@ import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateManager; +import cc.kune.core.client.ws.entheader.EntityHeaderPresenter.EntityHeaderView; import cc.kune.core.shared.domain.utils.StateToken; import cc.kune.core.shared.dto.GroupDTO; import cc.kune.core.shared.dto.GroupType; public class EntityLogoPresenterTest { + private EntityHeaderPresenter entityLogoPresenter; + private Session session; private StateManager stateManager; - private Session session; - private EntityHeaderPresenter entityLogoPresenter; private EntityHeaderView view; @Before public void before() { stateManager = Mockito.mock(StateManager.class); session = Mockito.mock(Session.class); - WsThemeManager theme = Mockito.mock(WsThemeManager.class); - entityLogoPresenter = new EntityHeaderPresenter(stateManager, theme, session); + final WsThemeManager theme = Mockito.mock(WsThemeManager.class); + // entityLogoPresenter = new EntityHeaderPresenter(stateManager, theme, + // session); view = Mockito.mock(EntityHeaderView.class); - entityLogoPresenter.init(view); + // entityLogoPresenter.init(view); } @Test public void testCommProjectNoLogo() { - GroupDTO group = new GroupDTO("shortname", "longname", GroupType.COMMUNITY); + final GroupDTO group = new GroupDTO("shortname", "longname", GroupType.COMMUNITY); group.setHasLogo(false); entityLogoPresenter.setGroupLogo(group); Mockito.verify(view, Mockito.never()).setLogoImageVisible(true); @@ -63,6 +65,16 @@ testGroupWIthLogo(GroupType.COMMUNITY); } + private void testGroupWIthLogo(final GroupType groupType) { + final GroupDTO group = new GroupDTO("shortname", "longname", groupType); + group.setHasLogo(true); + entityLogoPresenter.setGroupLogo(group); + Mockito.verify(view, Mockito.times(1)).setLogoImageVisible(true); + Mockito.verify(view, Mockito.never()).setLogoImageVisible(false); + Mockito.verify(view, Mockito.never()).showDefUserLogo(); + Mockito.verify(view, Mockito.times(1)).setLogoImage((StateToken) Mockito.anyObject()); + } + @Test public void testOrgWithLogo() { testGroupWIthLogo(GroupType.ORGANIZATION); @@ -80,7 +92,7 @@ @Test public void testPersonalProjectNoLogo() { - GroupDTO group = new GroupDTO("shortname", "longname", GroupType.PERSONAL); + final GroupDTO group = new GroupDTO("shortname", "longname", GroupType.PERSONAL); group.setHasLogo(false); entityLogoPresenter.setGroupLogo(group); Mockito.verify(view, Mockito.times(1)).setLogoImageVisible(true); @@ -94,14 +106,4 @@ testGroupWIthLogo(GroupType.PROJECT); } - private void testGroupWIthLogo(GroupType groupType) { - GroupDTO group = new GroupDTO("shortname", "longname", groupType); - group.setHasLogo(true); - entityLogoPresenter.setGroupLogo(group); - Mockito.verify(view, Mockito.times(1)).setLogoImageVisible(true); - Mockito.verify(view, Mockito.never()).setLogoImageVisible(false); - Mockito.verify(view, Mockito.never()).showDefUserLogo(); - Mockito.verify(view, Mockito.times(1)).setLogoImage((StateToken) Mockito.anyObject()); - } - } Modified: trunk/src/test/java/testsuites/OthersTestSuite.java =================================================================== --- trunk/src/test/java/testsuites/OthersTestSuite.java 2011-02-11 18:17:57 UTC (rev 1247) +++ trunk/src/test/java/testsuites/OthersTestSuite.java 2011-02-11 23:06:04 UTC (rev 1248) @@ -31,13 +31,14 @@ import org.ourproject.kune.rack.filters.rest.TestRESTMethodFinder; import org.ourproject.kune.rack.filters.rest.TestRESTServiceDefinition; import org.ourproject.kune.wiki.server.WikiServerToolTest; -import org.ourproject.kune.workspace.client.entityheader.EntityLogoPresenterTest; import org.ourproject.kune.workspace.client.licensewizard.LicenseWizardPresenterTest; import org.ourproject.kune.workspace.client.socialnet.RolActionTest; import org.ourproject.kune.workspace.client.socialnet.RolComparatorTest; import org.ourproject.kune.workspace.client.tags.TagsSummaryPresenterTest; import org.ourproject.kune.workspace.client.tool.ToolSelectorPresenterTest; +import cc.kune.core.client.ws.entheader.EntityLogoPresenterTest; + /** * Rescan with : *
participants (1)
-
Vicente J. Ruiz Jurado