[kune-commits] r982 - in trunk/src/main/java/org/ourproject/kune:
app/public/css gallery/client gallery/client/cnt
platf/client/dto platf/client/services platf/client/state
platf/client/ui platf/server platf/server/rpc
platf/server/state workspace/client/cnt workspace/client/socialnet
vjrj
vjrj at ourproject.org
Fri Dec 5 02:14:19 CET 2008
Author: vjrj
Date: 2008-12-05 02:14:07 +0100 (Fri, 05 Dec 2008)
New Revision: 982
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/ui/BasicThumb.java
Modified:
trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java
trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPanel.java
trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPresenter.java
trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentView.java
trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/BasicMimeTypeDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/InitDataDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateContainerDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/InitData.java
trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java
trunk/src/main/java/org/ourproject/kune/platf/server/state/StateContainer.java
trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
Log:
Complete - task Gallery thumbs
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-12-05 01:14:07 UTC (rev 982)
@@ -41,4 +41,4 @@
padding: 1px 0px 1px 1px;
text-decoration:none;
}
-*/.k-textlinethrough{text-decoration:line-through;color:red;}.k-textnormal{text-decoration:inherit;color:green;}.k-textunderline{text-decoration:underline;color:gray;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}.k-bsp-buddie{background:#FAFAFA none repeat scroll 0 50%;border:1px solid #EBEBEB;padding:3px;margin:3px;}.k-bsp-buddie td{padding:2px 3px;}.k-text-gray{color:gray;}.k-elp-limg{margin-top:4px;margin-left:5px;cursor:pointer;}.k-tsp-tag{float:right;margin-right:5px;cursor:pointer;color:#00F;}.k-tsp-cloud{vertical-align:bottom;}.k-options-icon{background-image:url(img/emblem-system.gif)!important;}.x-toolbar-body table{width:100%;}
\ No newline at end of file
+*/.k-textlinethrough{text-decoration:line-through;color:red;}.k-textnormal{text-decoration:inherit;color:green;}.k-textunderline{text-decoration:underline;color:gray;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}.k-basic-thumb{background:#FAFAFA none repeat scroll 0 50%;border:1px solid #EBEBEB;padding:3px;margin:3px;}.k-basic-thumb td{padding:2px 3px;border:none;}.k-text-gray{color:gray;}.k-elp-limg{margin-top:4px;margin-left:5px;cursor:pointer;}.k-tsp-tag{float:right;margin-right:5px;cursor:pointer;color:#00F;}.k-tsp-cloud{vertical-align:bottom;}.k-options-icon{background-image:url(img/emblem-system.gif)!important;}.x-toolbar-body table{width:100%;}
\ No newline at end of file
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 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-12-05 01:14:07 UTC (rev 982)
@@ -778,15 +778,16 @@
margin-left: 6px;
}
-.k-bsp-buddie {
+.k-basic-thumb {
background: #FAFAFA none repeat scroll 0% 50%;
border: 1px solid #EBEBEB;
padding: 3px;
margin: 3px;
}
-.k-bsp-buddie td {
+.k-basic-thumb td {
padding: 2px 3px 2px 3px;
+ border: none;
}
.k-text-gray {
Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -108,9 +108,9 @@
public GalleryFolderContent create() {
final GalleryFolderContentPresenter presenter = new GalleryFolderContentPresenter(
$(StateManager.class), $(Session.class), $(ActionContentToolbar.class),
- $(ContentActionRegistry.class), $(I18nTranslationService.class));
+ $(ContentActionRegistry.class), $(I18nTranslationService.class), $$(FileDownloadUtils.class));
final GalleryFolderContentView view = new GalleryFolderContentPanel($(WorkspaceSkeleton.class),
- $(I18nTranslationService.class));
+ $(I18nTranslationService.class), $(StateManager.class));
presenter.init(view);
return presenter;
}
Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPanel.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPanel.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -19,15 +19,54 @@
*/
package org.ourproject.kune.gallery.client.cnt;
+import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.ui.BasicThumb;
import org.ourproject.kune.workspace.client.cnt.FoldableContentPanel;
-import org.ourproject.kune.workspace.client.site.Site;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DeferredCommand;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.Widget;
+
public class GalleryFolderContentPanel extends FoldableContentPanel implements GalleryFolderContentView {
- public GalleryFolderContentPanel(WorkspaceSkeleton ws, I18nTranslationService i18n) {
+ private static final int TEXT_MAX_LENGHT = 15;
+ private FlowPanel flowPanel;
+ private final StateManager stateManager;
+
+ public GalleryFolderContentPanel(WorkspaceSkeleton ws, I18nTranslationService i18n, StateManager stateManager) {
super(ws, i18n);
- super.setLabel("Folder properties, translations ..." + Site.IN_DEVELOPMENT);
+ this.stateManager = stateManager;
}
+
+ public void addThumb(final StateToken token, final String title, final String imgUrl) {
+ DeferredCommand.addCommand(new Command() {
+ public void execute() {
+ BasicThumb thumb = new BasicThumb(imgUrl, 85, title, TEXT_MAX_LENGHT, true, new ClickListener() {
+ public void onClick(Widget sender) {
+ stateManager.gotoToken(token);
+ }
+ });
+ thumb.setHeight("100");
+ thumb.setWidth("100");
+ if (title.length() > TEXT_MAX_LENGHT) {
+ thumb.setTooltip(title);
+ }
+ flowPanel.add(thumb);
+ }
+ });
+ }
+
+ public void setThumbPanel() {
+ if (flowPanel == null) {
+ flowPanel = new FlowPanel();
+ } else {
+ flowPanel.clear();
+ }
+ super.setContent(flowPanel);
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPresenter.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPresenter.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -23,22 +23,30 @@
import org.ourproject.kune.platf.client.actions.ActionRegistry;
import org.ourproject.kune.platf.client.actions.toolbar.ActionContentToolbar;
import org.ourproject.kune.platf.client.dto.ContainerDTO;
+import org.ourproject.kune.platf.client.dto.ContentSimpleDTO;
import org.ourproject.kune.platf.client.dto.StateContainerDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
+import org.ourproject.kune.platf.client.ui.download.ImageSize;
import org.ourproject.kune.workspace.client.cnt.FoldableContentPresenter;
+import com.calclab.suco.client.ioc.Provider;
+
public class GalleryFolderContentPresenter extends FoldableContentPresenter implements GalleryFolderContent {
private GalleryFolderContentView view;
private final I18nTranslationService i18n;
+ private final Provider<FileDownloadUtils> downloadUtils;
public GalleryFolderContentPresenter(StateManager stateManager, Session session, ActionContentToolbar toolbar,
- final ActionRegistry<StateToken> actionRegistry, I18nTranslationService i18n) {
+ final ActionRegistry<StateToken> actionRegistry, I18nTranslationService i18n,
+ Provider<FileDownloadUtils> downloadUtils) {
super(GalleryClientTool.NAME, stateManager, session, toolbar, actionRegistry);
this.i18n = i18n;
+ this.downloadUtils = downloadUtils;
}
public void init(final GalleryFolderContentView view) {
@@ -55,6 +63,15 @@
} else {
view.setInfo("");
}
+ } else if (state.isType(GalleryClientTool.TYPE_ALBUM) && (state.getContainer().getContents().size() > 0)) {
+ view.setThumbPanel();
+ for (ContentSimpleDTO content : state.getContainer().getContents()) {
+ if (content.getMimeType().isImage()) {
+ StateToken token = content.getStateToken();
+ String imgUrl = downloadUtils.get().getImageResizedUrl(token, ImageSize.thumb);
+ view.addThumb(token, content.getTitle(), imgUrl);
+ }
+ }
} else {
view.setInfo("");
}
Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentView.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentView.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -19,7 +19,12 @@
*/
package org.ourproject.kune.gallery.client.cnt;
+import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.workspace.client.cnt.AbstractContentView;
public interface GalleryFolderContentView extends AbstractContentView {
+
+ void addThumb(StateToken token, String title, String imgUrl);
+
+ void setThumbPanel();
}
Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPanel.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPanel.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -24,6 +24,7 @@
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
public class GalleryViewerPanel extends FoldableContentPanel implements GalleryViewerView {
+
public GalleryViewerPanel(final WorkspaceSkeleton ws, I18nTranslationService i18n) {
super(ws, i18n);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/BasicMimeTypeDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/BasicMimeTypeDTO.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/BasicMimeTypeDTO.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -52,6 +52,10 @@
return type;
}
+ public boolean isImage() {
+ return getType().equals("image");
+ }
+
public void setSubtype(final String subtype) {
this.subtype = subtype;
}
@@ -60,6 +64,7 @@
this.type = type;
}
+ @Override
public String toString() {
return subtype == null ? type : type + "/" + subtype;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/InitDataDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/InitDataDTO.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/InitDataDTO.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -38,6 +38,10 @@
private String siteLogoUrl;
private String galleryPermittedExtensions;
private String maxFileSizeInMb;
+ private int imgResizewidth;
+ private int imgThumbsize;
+ private int imgCropsize;
+ private int imgIconsize;
private ArrayList<ToolSimpleDTO> userTools;
private ArrayList<ToolSimpleDTO> groupTools;
@@ -69,6 +73,22 @@
return groupTools;
}
+ public int getImgCropsize() {
+ return imgCropsize;
+ }
+
+ public int getImgIconsize() {
+ return imgIconsize;
+ }
+
+ public int getImgResizewidth() {
+ return imgResizewidth;
+ }
+
+ public int getImgThumbsize() {
+ return imgThumbsize;
+ }
+
public ArrayList<I18nLanguageSimpleDTO> getLanguages() {
return languages;
}
@@ -137,6 +157,22 @@
this.groupTools = groupTools;
}
+ public void setImgCropsize(int imgCropsize) {
+ this.imgCropsize = imgCropsize;
+ }
+
+ public void setImgIconsize(int imgIconsize) {
+ this.imgIconsize = imgIconsize;
+ }
+
+ public void setImgResizewidth(int imgResizewidth) {
+ this.imgResizewidth = imgResizewidth;
+ }
+
+ public void setImgThumbsize(int imgThumbsize) {
+ this.imgThumbsize = imgThumbsize;
+ }
+
public void setLanguages(final ArrayList<I18nLanguageSimpleDTO> languages) {
this.languages = languages;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateContainerDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateContainerDTO.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateContainerDTO.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -72,6 +72,10 @@
return typeId;
}
+ public boolean isType(String type) {
+ return getTypeId().equals(type);
+ }
+
public void setAccessLists(AccessListsDTO accessLists) {
this.accessLists = accessLists;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -373,7 +373,8 @@
final BuddiesSummaryPresenter presenter = new BuddiesSummaryPresenter($(StateManager.class),
$(Session.class), $$(UserServiceAsync.class), $(UserActionRegistry.class),
$(I18nTranslationService.class), $$(ChatEngine.class), $(ActionBuddiesSummaryToolbar.class),
- $$(FileDownloadUtils.class));
+ $$(FileDownloadUtils.class), $(ImageUtils.class), $$(SocialNetworkServiceAsync.class),
+ $(GroupActionRegistry.class));
final BuddiesSummaryPanel panel = new BuddiesSummaryPanel(presenter, $(WorkspaceSkeleton.class),
$(I18nTranslationService.class), $(ActionManager.class),
$(ActionBuddiesSummaryToolbar.class).getView());
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -64,6 +64,14 @@
*/
int SESSION_DURATION = 1000 * 60 * 60 * 24 * 14;
+ public int getImgCropsize();
+
+ public int getImgIconsize();
+
+ public int getImgResizewidth();
+
+ public int getImgThumbsize();
+
void check(AsyncCallbackSimple<?> callback);
StateContainerDTO getContainerState();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -46,7 +46,7 @@
public class SessionDefault implements Session {
private String userHash;
- private InitDataDTO initData;
+ InitDataDTO initData;
private UserInfoDTO currentUserInfo;
private Object[][] languagesArray;
private Object[][] countriesArray;
@@ -119,6 +119,22 @@
return initData.getGroupTools();
}
+ public int getImgCropsize() {
+ return initData.getImgCropsize();
+ }
+
+ public int getImgIconsize() {
+ return initData.getImgIconsize();
+ }
+
+ public int getImgResizewidth() {
+ return initData.getImgResizewidth();
+ }
+
+ public int getImgThumbsize() {
+ return initData.getImgThumbsize();
+ }
+
public List<I18nLanguageSimpleDTO> getLanguages() {
return initData.getLanguages();
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/BasicThumb.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/BasicThumb.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/BasicThumb.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -0,0 +1,69 @@
+package org.ourproject.kune.platf.client.ui;
+
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.gwtext.client.util.Format;
+
+// http://en.wikipedia.org/wiki/Thumbnail
+
+public class BasicThumb extends Composite {
+ private static final int NOSIZE = -1;
+ private final Image thumbImg;
+ private final Label thumbLabel;
+
+ public BasicThumb(String imageUrl, int imgSize, String text, int textMaxLenght, boolean crop,
+ ClickListener clickListener) {
+ VerticalPanel vp = new VerticalPanel();
+ if (imgSize != NOSIZE) {
+ if (crop) {
+ thumbImg = new Image(imageUrl, 0, 0, imgSize, imgSize);
+ } else {
+ thumbImg = new Image(imageUrl);
+ thumbImg.setPixelSize(imgSize, imgSize);
+ }
+ } else {
+ thumbImg = new Image(imageUrl);
+ }
+ String title = textMaxLenght == NOSIZE ? text : Format.ellipsis(text, textMaxLenght);
+ thumbLabel = new Label(title);
+ vp.add(thumbImg);
+ vp.add(thumbLabel);
+ vp.addStyleName("k-basic-thumb");
+ vp.addStyleName("kune-Margin-Small-trbl");
+ vp.addStyleName("kune-pointer");
+ vp.addStyleName("kune-floatleft");
+ thumbLabel.addClickListener(clickListener);
+ vp.setCellHorizontalAlignment(thumbLabel, VerticalPanel.ALIGN_CENTER);
+ thumbImg.addClickListener(clickListener);
+ initWidget(vp);
+ }
+
+ public BasicThumb(String imageUrl, String thumText, ClickListener clickListener) {
+ this(imageUrl, NOSIZE, thumText, NOSIZE, false, clickListener);
+ }
+
+ public BasicThumb(String imageUrl, String text, int textMaxLenght, ClickListener clickListener) {
+ this(imageUrl, NOSIZE, text, textMaxLenght, false, clickListener);
+ }
+
+ public void setText(String text) {
+ thumbLabel.setText(text);
+ }
+
+ public void setThumbUrl(String url) {
+ thumbImg.setUrl(url);
+ }
+
+ public void setTooltip(String tip) {
+ KuneUiUtils.setQuickTip(thumbImg, tip);
+ KuneUiUtils.setQuickTip(thumbLabel, tip);
+ }
+
+ public void setTooltip(String tipTitle, String tip) {
+ KuneUiUtils.setQuickTip(thumbImg, tip, tipTitle);
+ KuneUiUtils.setQuickTip(thumbLabel, tip, tipTitle);
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/InitData.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/InitData.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/InitData.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -43,6 +43,10 @@
private String siteLogoUrl;
private String galleryPermittedExtensions;
private String maxFileSizeInMb;
+ private int imgResizewidth;
+ private int imgThumbsize;
+ private int imgCropsize;
+ private int imgIconsize;
private ArrayList<ToolSimple> userTools;
private ArrayList<ToolSimple> groupTools;
@@ -74,6 +78,22 @@
return groupTools;
}
+ public int getImgCropsize() {
+ return imgCropsize;
+ }
+
+ public int getImgIconsize() {
+ return imgIconsize;
+ }
+
+ public int getImgResizewidth() {
+ return imgResizewidth;
+ }
+
+ public int getImgThumbsize() {
+ return imgThumbsize;
+ }
+
public List<I18nLanguage> getLanguages() {
return languages;
}
@@ -138,6 +158,22 @@
this.groupTools = groupTools;
}
+ public void setImgCropsize(int imgCropsize) {
+ this.imgCropsize = imgCropsize;
+ }
+
+ public void setImgIconsize(int imgIconsize) {
+ this.imgIconsize = imgIconsize;
+ }
+
+ public void setImgResizewidth(int imgResizewidth) {
+ this.imgResizewidth = imgResizewidth;
+ }
+
+ public void setImgThumbsize(int imgThumbsize) {
+ this.imgThumbsize = imgThumbsize;
+ }
+
public void setLanguages(final List<I18nLanguage> languages) {
this.languages = languages;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -96,6 +96,10 @@
data.setMaxFileSizeInMb(kuneProperties.get(KuneProperties.UPLOAD_MAX_FILE_SIZE));
data.setUserTools(serverToolRegistry.getToolsForUsers());
data.setGroupTools(serverToolRegistry.getToolsForGroups());
+ data.setImgResizewidth(new Integer(kuneProperties.get(KuneProperties.IMAGES_RESIZEWIDTH)));
+ data.setImgThumbsize(new Integer(kuneProperties.get(KuneProperties.IMAGES_THUMBSIZE)));
+ data.setImgCropsize(new Integer(kuneProperties.get(KuneProperties.IMAGES_CROPSIZE)));
+ data.setImgIconsize(new Integer(kuneProperties.get(KuneProperties.IMAGES_ICONSIZE)));
return mapper.map(data, InitDataDTO.class);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/state/StateContainer.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/StateContainer.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/StateContainer.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -77,6 +77,10 @@
return typeId;
}
+ public boolean isType(String type) {
+ return getTypeId().equals(type);
+ }
+
public void setAccessLists(AccessLists accessLists) {
this.accessLists = accessLists;
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPanel.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -21,8 +21,12 @@
public void setContent(final String content) {
final HTML html = new HTML(content);
- setDefStyle(html);
- setWidget(html);
+ setContent(html);
+ }
+
+ public void setContent(final Widget widget) {
+ setDefStyle(widget);
+ setWidget(widget);
attach();
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPanel.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPanel.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -28,15 +28,14 @@
import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbarView;
import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.ui.BasicThumb;
import org.ourproject.kune.workspace.client.skel.SimpleToolbar;
import org.ourproject.kune.workspace.client.skel.SummaryPanel;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
import com.calclab.suco.client.listener.Listener;
import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
@@ -44,43 +43,6 @@
public class BuddiesSummaryPanel extends SummaryPanel implements BuddiesSummaryView {
- public class BuddieWidget extends Composite {
- private final Image avatar;
- private final Label nick;
-
- public BuddieWidget(String nickName, String avatarUrl, ClickListener clickListener) {
- // For Drag& drop, see gwt-ext-ux image:
- // http://www.gwt-ext.com:8080/demo-ux/#imageDDSample
- VerticalPanel vp = new VerticalPanel();
- avatar = new Image();
- if (avatarUrl.equals(NOAVATAR)) {
- // Images.App.getInstance().personAvatarDef().applyTo(avatar);
- avatar.setUrl("images/persons/person2-32.png");
- } else {
- avatar.setUrl(avatarUrl);
- }
- avatar.setPixelSize(AVATARSIZE, AVATARSIZE);
- nick = new Label(nickName);
- vp.add(avatar);
- vp.add(nick);
- vp.addStyleName("k-bsp-buddie");
- vp.addStyleName("kune-Margin-Small-trbl");
- vp.addStyleName("kune-pointer");
- vp.addStyleName("kune-floatleft");
- nick.addClickListener(clickListener);
- vp.setCellHorizontalAlignment(nick, VerticalPanel.ALIGN_CENTER);
- avatar.addClickListener(clickListener);
- initWidget(vp);
- }
-
- public void setAvatarUrl(String url) {
- avatar.setUrl(url);
- }
-
- public void setNick(String nickName) {
- nick.setText(nickName);
- }
- }
private final MenuItemsContainer<UserSimpleDTO> menuItemsContainer;
private final FlowPanel flowPanel;
private final Label otherBuddiesLabel;
@@ -112,7 +74,7 @@
}
public void addBuddie(final UserSimpleDTO user, ActionItemCollection<UserSimpleDTO> actionCollection,
- String avatarUrl) {
+ String avatarUrl, String tooltipTitle, String tooltip) {
ClickListener listener = new ClickListener() {
public void onClick(Widget sender) {
Menu menu = menuItemsContainer.get(user.getShortName());
@@ -128,7 +90,10 @@
}
});
- flowPanel.add(new BuddieWidget(user.getShortName(), avatarUrl, listener));
+ BasicThumb thumb = new BasicThumb(avatarUrl.equals(NOAVATAR) ? "images/persons/person2-32.png" : avatarUrl,
+ AVATARSIZE, user.getShortName(), AVATARLABELMAXSIZE, false, listener);
+ thumb.setTooltip(tooltipTitle, tooltip);
+ flowPanel.add(thumb);
}
@Override
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -28,6 +28,7 @@
import org.ourproject.kune.platf.client.actions.ActionToolbarButtonAndItemDescriptor;
import org.ourproject.kune.platf.client.actions.ActionToolbarMenuDescriptor;
import org.ourproject.kune.platf.client.actions.ActionToolbarPosition;
+import org.ourproject.kune.platf.client.actions.GroupActionRegistry;
import org.ourproject.kune.platf.client.actions.UserActionRegistry;
import org.ourproject.kune.platf.client.actions.toolbar.ActionBuddiesSummaryToolbar;
import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
@@ -37,7 +38,9 @@
import org.ourproject.kune.platf.client.dto.UserBuddiesVisibilityDTO;
import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
+import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.services.ImageUtils;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
@@ -47,7 +50,7 @@
import com.calclab.suco.client.ioc.Provider;
import com.calclab.suco.client.listener.Listener;
-public class BuddiesSummaryPresenter implements BuddiesSummary {
+public class BuddiesSummaryPresenter extends SocialNetworkPresenter implements BuddiesSummary {
private BuddiesSummaryView view;
private final StateManager stateManager;
@@ -62,7 +65,10 @@
public BuddiesSummaryPresenter(StateManager stateManager, final Session session,
Provider<UserServiceAsync> userServiceAsync, UserActionRegistry actionRegistry,
I18nTranslationService i18n, final Provider<ChatEngine> chatEngineProvider,
- final ActionBuddiesSummaryToolbar toolbar, Provider<FileDownloadUtils> fileDownUtilsProvider) {
+ final ActionBuddiesSummaryToolbar toolbar, Provider<FileDownloadUtils> fileDownUtilsProvider,
+ ImageUtils imageUtils, Provider<SocialNetworkServiceAsync> snServiceAsync,
+ GroupActionRegistry groupActionRegistry) {
+ super(i18n, stateManager, imageUtils, session, snServiceAsync, groupActionRegistry, fileDownUtilsProvider);
this.stateManager = stateManager;
this.session = session;
this.userServiceAsync = userServiceAsync;
@@ -101,8 +107,10 @@
for (UserSimpleDTO user : buddies) {
String avatarUrl = user.hasLogo() ? fileDownUtilsProvider.get().getLogoImageUrl(
user.getStateToken()) : BuddiesSummaryView.NOAVATAR;
+ String tooltip = super.createTooltipWithLogo(user.getShortName(), user.getStateToken(),
+ user.hasLogo(), true);
view.addBuddie(user, actionRegistry.getCurrentActions(user, session.isLogged(),
- new AccessRightsDTO(true, true, true), false), avatarUrl);
+ new AccessRightsDTO(true, true, true), false), avatarUrl, user.getName(), tooltip);
}
boolean hasLocalBuddies = buddies.size() > 0;
int numExtBuddies = userBuddies.getOtherExternalBuddies();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryView.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryView.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -26,8 +26,10 @@
String NOAVATAR = "";
int AVATARSIZE = 32;
+ int AVATARLABELMAXSIZE = 15;
- void addBuddie(UserSimpleDTO user, ActionItemCollection<UserSimpleDTO> actionCollection, String avatarUrl);
+ void addBuddie(UserSimpleDTO user, ActionItemCollection<UserSimpleDTO> actionCollection, String avatarUrl,
+ String tooltipTitle, String tooltip);
void clear();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-12-04 14:34:33 UTC (rev 981)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-12-05 01:14:07 UTC (rev 982)
@@ -31,6 +31,7 @@
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
import org.ourproject.kune.platf.client.services.ImageDescriptor;
import org.ourproject.kune.platf.client.services.ImageUtils;
import org.ourproject.kune.platf.client.state.Session;
@@ -41,7 +42,7 @@
import org.ourproject.kune.platf.client.ui.gridmenu.CustomMenu;
import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup;
import org.ourproject.kune.platf.client.ui.gridmenu.GridItem;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.entityheader.EntityHeaderView;
import org.ourproject.kune.workspace.client.site.Site;
import com.calclab.suco.client.ioc.Provider;
@@ -49,8 +50,6 @@
public class SocialNetworkPresenter {
- private static final int ICOSIZE = 16;
- private static final int THUMBSIZE = 50;
protected MenuItem<GroupDTO> changeToCollabMenuItem;
protected MenuItem<GroupDTO> removeMemberMenuItem;
protected MenuItem<GroupDTO> changeToAdminMenuItem;
@@ -59,7 +58,7 @@
protected MenuItem<GroupDTO> gotoMemberMenuItem;
protected MenuItem<GroupDTO> gotoGroupMenuItem;
protected MenuItem<GroupDTO> unJoinMenuItem;
- private final I18nUITranslationService i18n;
+ private final I18nTranslationService i18n;
private final StateManager stateManager;
private final Provider<SocialNetworkServiceAsync> snServiceProvider;
private final Session session;
@@ -73,7 +72,7 @@
protected ActionToolbarButtonDescriptor<StateToken> participate;
private final Provider<FileDownloadUtils> downloadProvider;
- public SocialNetworkPresenter(final I18nUITranslationService i18n, final StateManager stateManager,
+ public SocialNetworkPresenter(final I18nTranslationService i18n, final StateManager stateManager,
final ImageUtils imageUtils, final Session session,
final Provider<SocialNetworkServiceAsync> snServiceProvider, GroupActionRegistry groupActionRegistry,
final Provider<FileDownloadUtils> downloadProvider) {
@@ -131,6 +130,13 @@
return gridItem;
}
+ protected String createTooltipWithLogo(String shortName, StateToken token, boolean hasLogo, boolean isPersonal) {
+ return "<table><tr><td>"
+ + (hasLogo ? createLogoAvatar(token, hasLogo, isPersonal, EntityHeaderView.LOGO_ICON_DEFAULT_HEIGHT, 3)
+ : "") + "</td><td>"
+ + i18n.t(isPersonal ? "Nickname: [%s]" : "Group short name: [%s]", shortName) + "</td></tr></table>";
+ }
+
protected boolean isMember(AccessRightsDTO rights) {
boolean userIsAdmin = rights.isAdministrable();
final boolean userIsCollab = !userIsAdmin && rights.isEditable();
@@ -192,8 +198,10 @@
final CustomMenu<GroupDTO> menu = new CustomMenu<GroupDTO>(group);
final String longName = group.getLongName();
boolean hasLogo = group.hasLogo();
- final String toolTip = createTooltipWithLogo(group, hasLogo);
- final String imageHtml = createLogoAvatar(group.getStateToken(), hasLogo, group.isPersonal(), ICOSIZE, 0);
+ final String toolTip = createTooltipWithLogo(group.getShortName(), group.getStateToken(), hasLogo,
+ group.isPersonal());
+ final String imageHtml = createLogoAvatar(group.getStateToken(), hasLogo, group.isPersonal(),
+ session.getImgIconsize(), 0);
final GridItem<GroupDTO> gridItem = new GridItem<GroupDTO>(group, gridGroup, group.getShortName(), imageHtml,
longName, longName, " ", longName, toolTip, menu);
if (!group.isPersonal()) {
@@ -212,14 +220,6 @@
return gridItem;
}
- private String createTooltipWithLogo(final GroupDTO group, boolean hasLogo) {
- return "<table><tr><td>"
- + (hasLogo ? createLogoAvatar(group.getStateToken(), hasLogo, group.isPersonal(), THUMBSIZE, 3) : "")
- + "</td><td>"
- + i18n.t(group.isPersonal() ? "Nickname: [%s]" : "Group short name: [%s]", group.getShortName())
- + "</td></tr></table>";
- }
-
private String createLogoAvatar(StateToken groupToken, boolean groupHasLogo, boolean isPersonal, int size,
int hvspace) {
if (groupHasLogo) {
More information about the kune-commits
mailing list