[kune-commits] r818 - in trunk/src:
main/java/org/ourproject/kune/docs/client
main/java/org/ourproject/kune/docs/client/cnt
main/java/org/ourproject/kune/docs/client/ui
main/java/org/ourproject/kune/platf/client/services
main/java/org/ourproject/kune/platf/client/ui/gridmenu
main/java/org/ourproject/kune/platf/client/ui/rate
main/java/org/ourproject/kune/workspace/client
main/java/org/ourproject/kune/workspace/client/actions
main/java/org/ourproject/kune/workspace/client/ui/newtmp
main/java/org/ourproject/kune/workspace/client/workspace
main/java/org/ourproject/kune/workspace/client/workspace/ui
test/java/org/ourproject/kune/platf/server
vjrj
vjrj at ourproject.org
Sat Jul 26 22:07:35 CEST 2008
Author: vjrj
Date: 2008-07-26 22:07:21 +0200 (Sat, 26 Jul 2008)
New Revision: 818
Removed:
trunk/src/main/java/org/ourproject/kune/workspace/client/actions/DisableRateItAction.java
trunk/src/main/java/org/ourproject/kune/workspace/client/actions/EnableRateItAction.java
trunk/src/main/java/org/ourproject/kune/workspace/client/actions/RateContentAction.java
Modified:
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java
trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
trunk/src/main/java/org/ourproject/kune/docs/client/ui/DocumentFactory.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItView.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceClientModule.java
trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceEvents.java
trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceFactory.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/Workspace.java
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/WorkspacePresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/WorkspaceUIComponents.java
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/ContentBottomToolBarPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/WorkspacePanel.java
trunk/src/test/java/org/ourproject/kune/platf/server/PersistenceTest.java
Log:
Rate widgets refactorization
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -5,6 +5,7 @@
import org.ourproject.kune.platf.client.app.Application;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.ui.rate.RateIt;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
import org.ourproject.kune.workspace.client.workspace.TagsSummary;
@@ -29,7 +30,7 @@
public DocumentFactory get() {
return new DocumentFactory(builder.getInstance(I18nUITranslationService.class), builder
.getInstance(Session.class), builder.getProvider(TagsSummary.class), builder
- .getInstance(WorkspaceSkeleton.class));
+ .getInstance(WorkspaceSkeleton.class), builder.getInstance(RateIt.class));
}
}, SingletonScope.class);
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -36,6 +36,7 @@
import org.ourproject.kune.platf.client.extend.ExtensibleWidgetId;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.ui.rate.RateIt;
import org.ourproject.kune.workspace.client.WorkspaceEvents;
import org.ourproject.kune.workspace.client.component.WorkspaceDeckView;
import org.ourproject.kune.workspace.client.editor.TextEditor;
@@ -49,12 +50,14 @@
private final DocumentReader reader;
private final DocumentReaderControl readerControl;
private final Session session;
+ private final RateIt rateIt;
public DocumentContentPresenter(final DocumentFactory documentFactory, final DocumentContentListener listener,
- final WorkspaceDeckView view, final Session session) {
+ final WorkspaceDeckView view, final Session session, final RateIt rateIt) {
this.listener = listener;
this.view = view;
this.session = session;
+ this.rateIt = rateIt;
this.components = new DocumentContentComponents(documentFactory, this);
reader = components.getDocumentReader();
readerControl = components.getDocumentReaderControl();
@@ -74,7 +77,7 @@
showContent();
listener.onCancel();
// Re-enable rateIt widget
- DefaultDispatcher.getInstance().fire(WorkspaceEvents.ENABLE_RATEIT, null);
+ rateIt.setVisible(true);
}
public void onDelete() {
@@ -86,7 +89,7 @@
public void onSuccess(final Object result) {
if (content.hasDocument()) {
// Don't permit rate content while your are editing
- DefaultDispatcher.getInstance().fire(WorkspaceEvents.DISABLE_RATEIT, null);
+ rateIt.setVisible(false);
final TextEditor editor = components.getDocumentEditor();
editor.setContent(content.getContent());
view.show(editor.getView());
@@ -109,7 +112,7 @@
content.setContent(text);
DefaultDispatcher.getInstance().fire(DocsEvents.SAVE_DOCUMENT, new SaveDocumentActionParams(content, this));
// Re-enable rateIt widget
- DefaultDispatcher.getInstance().fire(WorkspaceEvents.ENABLE_RATEIT, null);
+ rateIt.setVisible(true);
DefaultDispatcher.getInstance().fire(WorkspaceEvents.RECALCULATE_WORKSPACE_SIZE, null);
}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/ui/DocumentFactory.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ui/DocumentFactory.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ui/DocumentFactory.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -49,6 +49,7 @@
import org.ourproject.kune.docs.client.ctx.folder.FolderContextPresenter;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.ui.rate.RateIt;
import org.ourproject.kune.workspace.client.WorkspaceFactory;
import org.ourproject.kune.workspace.client.component.WorkspaceDeckPanel;
import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems;
@@ -63,13 +64,15 @@
private final Session session;
private final Provider<TagsSummary> tagsSummaryProvider;
private final WorkspaceSkeleton ws;
+ private final RateIt rateIt;
public DocumentFactory(final I18nTranslationService i18n, final Session session,
- final Provider<TagsSummary> tagsSummaryProvider, final WorkspaceSkeleton ws) {
+ final Provider<TagsSummary> tagsSummaryProvider, final WorkspaceSkeleton ws, final RateIt rateIt) {
this.i18n = i18n;
this.session = session;
this.tagsSummaryProvider = tagsSummaryProvider;
this.ws = ws;
+ this.rateIt = rateIt;
}
public AdminContext createAdminContext() {
@@ -81,7 +84,7 @@
public DocumentContent createDocumentContent(final DocumentContentListener listener) {
final WorkspaceDeckPanel panel = new WorkspaceDeckPanel();
- final DocumentContentPresenter presenter = new DocumentContentPresenter(this, listener, panel, session);
+ final DocumentContentPresenter presenter = new DocumentContentPresenter(this, listener, panel, session, rateIt);
return presenter;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -11,6 +11,7 @@
import org.ourproject.kune.platf.client.extend.ExtensibleWidgetsManager;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
import org.ourproject.kune.platf.client.rpc.ContentService;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
import org.ourproject.kune.platf.client.rpc.GroupService;
import org.ourproject.kune.platf.client.rpc.GroupServiceAsync;
import org.ourproject.kune.platf.client.rpc.SocialNetworkService;
@@ -20,6 +21,11 @@
import org.ourproject.kune.platf.client.state.SessionImpl;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.state.StateManagerDefault;
+import org.ourproject.kune.platf.client.ui.rate.RateIt;
+import org.ourproject.kune.platf.client.ui.rate.RateItPanel;
+import org.ourproject.kune.platf.client.ui.rate.RateItPresenter;
+import org.ourproject.kune.platf.client.ui.rate.RatePanel;
+import org.ourproject.kune.platf.client.ui.rate.RatePresenter;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.licensechoose.LicenseChoose;
import org.ourproject.kune.workspace.client.licensechoose.LicenseChoosePanel;
@@ -169,6 +175,12 @@
}
}, SingletonScope.class);
+ builder.registerProvider(ContentServiceAsync.class, new Provider<ContentServiceAsync>() {
+ public ContentServiceAsync get() {
+ return ContentService.App.getInstance();
+ }
+ }, SingletonScope.class);
+
builder.registerProvider(Session.class, new Provider<Session>() {
public Session get() {
return new SessionImpl(Cookies.getCookie(Site.USERHASH), initialLang, p(UserServiceAsync.class));
@@ -405,12 +417,32 @@
}
}, SingletonScope.class);
+ builder.registerProvider(RatePresenter.class, new Provider<RatePresenter>() {
+ public RatePresenter get() {
+ final RatePresenter presenter = new RatePresenter();
+ final RatePanel panel = new RatePanel(null, null, i18n, ws);
+ presenter.init(panel);
+ return presenter;
+ }
+ }, SingletonScope.class);
+
+ builder.registerProvider(RateIt.class, new Provider<RateIt>() {
+ public RateIt get() {
+ final RateItPresenter presenter = new RateItPresenter(i18n, i(Session.class),
+ p(ContentServiceAsync.class), p(StateManager.class));
+ final RateItPanel panel = new RateItPanel(presenter, i18n, ws);
+ presenter.init(panel);
+ return presenter;
+ }
+ }, SingletonScope.class);
+
builder.registerProvider(WorkspaceManager.class, new Provider<WorkspaceManager>() {
public WorkspaceManager get() {
final WorkspaceManager presenter = new WorkspaceManager(i(SitePublicSpaceLink.class),
i(EntityLogo.class), i(EntityTitlePresenter.class), i(EntitySubTitlePresenter.class),
i(WsThemePresenter.class), i(EntityLicensePresenter.class), p(GroupMembersSummary.class),
- p(ParticipationSummary.class), p(TagsSummary.class), p(GroupSummary.class));
+ p(ParticipationSummary.class), p(TagsSummary.class), p(GroupSummary.class), i(RateIt.class),
+ i(RatePresenter.class));
return presenter;
}
}, SingletonScope.class);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -371,6 +371,8 @@
});
grid.stripeRows(true);
grid.setHideColumnHeader(true);
+ // Not sure if when doLayoutIfNeeded there are problems with size and
+ // column header
grid.setBorder(false);
grid.setAutoScroll(true);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -21,6 +21,7 @@
import org.ourproject.kune.platf.client.services.I18nTranslationService;
import org.ourproject.kune.platf.client.services.Images;
+import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
@@ -39,90 +40,91 @@
private Label rateItLabel;
private final I18nTranslationService i18n;
- public RateItPanel(final RateItPresenter presenter, final I18nTranslationService i18n) {
- this.presenter = presenter;
- this.i18n = i18n;
- initialize();
- layout();
- setProperties();
+ public RateItPanel(final RateItPresenter presenter, final I18nTranslationService i18n, final WorkspaceSkeleton ws) {
+ this.presenter = presenter;
+ this.i18n = i18n;
+ initialize();
+ layout();
+ setProperties();
+ ws.getEntityWorkspace().getContentBottomBar().add(this);
}
public void clearRate() {
- for (int i = 0; i < 5; i++) {
- img.starGrey().applyTo(starImg[i]);
- }
+ for (int i = 0; i < 5; i++) {
+ img.starGrey().applyTo(starImg[i]);
+ }
}
public void onClick(final Widget sender) {
- for (int i = 0; i < 5; i++) {
- if (sender == starImg[i]) {
- presenter.starClicked(i);
- }
- }
+ for (int i = 0; i < 5; i++) {
+ if (sender == starImg[i]) {
+ presenter.starClicked(i);
+ }
+ }
}
public void setDesc(final String desc) {
- rateDesc.setText(desc);
+ rateDesc.setText(desc);
}
public void setRate(final Star stars[]) {
- for (int i = 0; i < 5; i++) {
- stars[i].getImage().applyTo(starImg[i]);
- }
+ for (int i = 0; i < 5; i++) {
+ stars[i].getImage().applyTo(starImg[i]);
+ }
}
public void setStars(final Double rate) {
- setRate(Star.genStars(rate.doubleValue()));
+ setRate(Star.genStars(rate.doubleValue()));
}
private void initialize() {
- rateItLabel = new Label(i18n.t("Rate it:"));
- rateGrid = new Grid(1, 7);
- starImg = new Image[5];
- rateDesc = new Label();
- for (int i = 0; i < 5; i++) {
- starImg[i] = new Image();
- img.starGrey().applyTo(starImg[i]);
- starImg[i].addStyleName("rateit-star");
- starImg[i].setStyleName("rateit-star");
- starImg[i].setTitle(i18n.t("Click to rate this"));
- starImg[i].addClickListener(this);
- starImg[i].addMouseListener(new MouseListenerAdapter() {
- public void onMouseEnter(final Widget sender) {
- for (int j = 0; j < 5; j++) {
- if (sender == starImg[j]) {
- presenter.starOver(j);
- }
- }
+ rateItLabel = new Label(i18n.t("Rate it:"));
+ rateGrid = new Grid(1, 7);
+ starImg = new Image[5];
+ rateDesc = new Label();
+ for (int i = 0; i < 5; i++) {
+ starImg[i] = new Image();
+ img.starGrey().applyTo(starImg[i]);
+ starImg[i].addStyleName("rateit-star");
+ starImg[i].setStyleName("rateit-star");
+ starImg[i].setTitle(i18n.t("Click to rate this"));
+ starImg[i].addClickListener(this);
+ starImg[i].addMouseListener(new MouseListenerAdapter() {
+ public void onMouseEnter(final Widget sender) {
+ for (int j = 0; j < 5; j++) {
+ if (sender == starImg[j]) {
+ presenter.starOver(j);
+ }
+ }
- }
+ }
- public void onMouseLeave(final Widget sender) {
- presenter.revertCurrentRate();
- }
- });
- }
+ public void onMouseLeave(final Widget sender) {
+ presenter.revertCurrentRate();
+ }
+ });
+ }
}
private void layout() {
- initWidget(rateGrid);
- rateGrid.setWidget(0, 0, rateItLabel);
- for (int i = 0; i < 5; i++) {
- rateGrid.setWidget(0, i + 1, starImg[i]);
- }
- rateGrid.setWidget(0, 6, rateDesc);
+ initWidget(rateGrid);
+ rateGrid.setWidget(0, 0, rateItLabel);
+ for (int i = 0; i < 5; i++) {
+ rateGrid.setWidget(0, i + 1, starImg[i]);
+ }
+ rateGrid.setWidget(0, 6, rateDesc);
}
private void setProperties() {
- rateGrid.setCellPadding(0);
- rateGrid.setCellSpacing(0);
- rateGrid.setBorderWidth(0);
- rateItLabel.addStyleName("kune-Margin-Medium-r");
- rateItLabel.addStyleName("kune-Margin-Medium-l");
- rateItLabel.addStyleName("kune-RatePanel-Label");
- rateGrid.addStyleName("kune-RatePanel-Stars");
- rateGrid.addStyleName("kune-RatePanel-Stars-RateIt");
- rateDesc.addStyleName("kune-RatePanel-Label");
- rateDesc.addStyleName("kune-Margin-Medium-l");
+ rateGrid.setCellPadding(0);
+ rateGrid.setCellSpacing(0);
+ rateGrid.setBorderWidth(0);
+ rateItLabel.addStyleName("kune-Margin-Medium-r");
+ rateItLabel.addStyleName("kune-Margin-Medium-l");
+ rateItLabel.addStyleName("kune-RatePanel-Label");
+ rateGrid.addStyleName("kune-RatePanel-Stars");
+ rateGrid.addStyleName("kune-RatePanel-Stars-RateIt");
+ rateDesc.addStyleName("kune-RatePanel-Label");
+ rateDesc.addStyleName("kune-Margin-Medium-l");
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -19,93 +19,125 @@
*/
package org.ourproject.kune.platf.client.ui.rate;
-import org.ourproject.kune.platf.client.dispatch.DefaultDispatcher;
+import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.workspace.client.WorkspaceEvents;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.sitebar.Site;
-public class RateItPresenter {
+import com.calclab.suco.client.container.Provider;
+public class RateItPresenter implements RateIt {
+
private static final Double NOT_RATED = new Double(-1);
-
private RateItView view;
-
private Double currentRate;
-
private boolean isRating;
-
private final I18nTranslationService i18n;
+ private final Provider<ContentServiceAsync> contentServiceProvider;
+ private final Session session;
+ private final Provider<StateManager> stateManagerProvider;
- public RateItPresenter(final I18nTranslationService i18n) {
- this.i18n = i18n;
+ public RateItPresenter(final I18nTranslationService i18n, final Session session,
+ final Provider<ContentServiceAsync> contentServiceProvider,
+ final Provider<StateManager> stateManagerProvider) {
+ this.i18n = i18n;
+ this.session = session;
+ this.contentServiceProvider = contentServiceProvider;
+ this.stateManagerProvider = stateManagerProvider;
}
public void init(final RateItView view) {
- this.view = view;
- currentRate = NOT_RATED;
- isRating = false;
+ this.view = view;
+ currentRate = NOT_RATED;
+ isRating = false;
}
public void setRate(final Double value) {
- currentRate = value;
- if (currentRate == null) {
- currentRate = NOT_RATED;
- }
- isRating = false;
- setRatePanel(currentRate);
+ currentRate = value;
+ if (currentRate == null) {
+ currentRate = NOT_RATED;
+ }
+ isRating = false;
+ setRatePanel(currentRate);
}
+ public void setState(final StateDTO state) {
+ if (state.isRateable()) {
+ if (session.isLogged()) {
+ setRate(state.getCurrentUserRate());
+ view.setVisible(true);
+ } else {
+ view.setVisible(false);
+ }
+ } else {
+ view.setVisible(false);
+ }
+ }
+
+ public void setVisible(final boolean visible) {
+ view.setVisible(visible);
+ }
+
protected void revertCurrentRate() {
- if (!isRating) {
- setRatePanel(currentRate);
- }
+ if (!isRating) {
+ setRatePanel(currentRate);
+ }
}
protected void starClicked(final int starClicked) {
- isRating = true;
- Double newValue = new Double(starClicked + 1);
- if (Math.ceil(currentRate.doubleValue()) == newValue.doubleValue()) {
- // Same star, rest 1/2
- newValue = new Double(currentRate.doubleValue() - 0.5);
- }
- setRatePanel(newValue);
- DefaultDispatcher.getInstance().fire(WorkspaceEvents.RATE_CONTENT, newValue);
+ isRating = true;
+ final Double newValue = starClicked + 1d == currentRate ? currentRate - 0.5d : starClicked + 1d;
+ setRatePanel(newValue);
+ Site.showProgressProcessing();
+ final StateDTO currentState = session.getCurrentState();
+ contentServiceProvider.get().rateContent(session.getUserHash(), currentState.getGroup().getShortName(),
+ currentState.getDocumentId(), newValue, new AsyncCallbackSimple<Object>() {
+ public void onSuccess(final Object result) {
+ Site.hideProgress();
+ Site.info(i18n.t("Content rated"));
+ stateManagerProvider.get().reload();
+ }
+ });
}
protected void starOver(final int starMouseOver) {
- Double value = new Double(starMouseOver + 1);
- if (Math.ceil(currentRate.doubleValue()) == value.doubleValue()) {
- // use user already rated -> live same value when mouse is over
- value = currentRate;
- }
- if (!isRating) {
- // If we are not doing a rate rpc call
- setRatePanel(value);
- }
+ Double value = new Double(starMouseOver + 1);
+ if (Math.ceil(currentRate.doubleValue()) == value.doubleValue()) {
+ // use user already rated -> live same value when mouse is over
+ value = currentRate;
+ }
+ if (!isRating) {
+ // If we are not doing a rate rpc call
+ setRatePanel(value);
+ }
}
private void setDesc(final int rateTruncated) {
- if (rateTruncated >= 0 && rateTruncated <= 1) {
- view.setDesc(i18n.t("Poor"));
- } else if (rateTruncated == 2) {
- view.setDesc(i18n.t("Below average"));
- } else if (rateTruncated == 3) {
- view.setDesc(i18n.t("Average"));
- } else if (rateTruncated == 4) {
- view.setDesc(i18n.t("Above average"));
- } else if (rateTruncated == 5) {
- view.setDesc(i18n.t("Excellent"));
- } else {
- view.setDesc("");
- }
+ if (rateTruncated >= 0 && rateTruncated <= 1) {
+ view.setDesc(i18n.t("Poor"));
+ } else if (rateTruncated == 2) {
+ view.setDesc(i18n.t("Below average"));
+ } else if (rateTruncated == 3) {
+ view.setDesc(i18n.t("Average"));
+ } else if (rateTruncated == 4) {
+ view.setDesc(i18n.t("Above average"));
+ } else if (rateTruncated == 5) {
+ view.setDesc(i18n.t("Excellent"));
+ } else {
+ view.setDesc("");
+ }
}
private void setRatePanel(final Double value) {
- if (value.equals(NOT_RATED)) {
- view.clearRate();
- view.setDesc("");
- } else {
- view.setStars(value);
- setDesc((int) Math.ceil(value.doubleValue()));
- }
+ if (value.equals(NOT_RATED)) {
+ view.clearRate();
+ view.setDesc("");
+ } else {
+ view.setStars(value);
+ setDesc((int) Math.ceil(value.doubleValue()));
+ }
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItView.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItView.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -21,10 +21,12 @@
public interface RateItView {
- void setStars(Double value);
-
void clearRate();
void setDesc(String desc);
+ void setStars(Double value);
+
+ void setVisible(boolean visible);
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -20,6 +20,8 @@
package org.ourproject.kune.platf.client.ui.rate;
import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.workspace.client.ui.newtmp.skel.Toolbar;
+import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Grid;
@@ -32,65 +34,69 @@
private Label rateDesc;
private final I18nTranslationService i18n;
- public RatePanel(final Double rate, final Integer byUsers, final I18nTranslationService i18n) {
- this.i18n = i18n;
- initialize();
- layout();
- setProperties();
- if (rate != null) {
- setRate(rate);
- }
- if (byUsers != null) {
- setByUsers(byUsers);
- }
+ public RatePanel(final Double rate, final Integer byUsers, final I18nTranslationService i18n,
+ final WorkspaceSkeleton ws) {
+ this.i18n = i18n;
+ initialize();
+ layout();
+ setProperties();
+ if (rate != null) {
+ setRate(rate);
+ }
+ if (byUsers != null) {
+ setByUsers(byUsers);
+ }
+ final Toolbar bottomBar = ws.getEntityWorkspace().getContentBottomBar();
+ bottomBar.addFill();
+ bottomBar.add(this);
}
public void setByUsers(final Integer byUsers) {
- if (byUsers.intValue() == 0) {
- rateDesc.setText(i18n.t("(Not rated)"));
- } else if (byUsers.intValue() == 1) {
- // i18n params pluralization
- rateDesc.setText(i18n.t("([%d] user)", byUsers));
- } else {
- rateDesc.setText(i18n.t("([%d] users)", byUsers));
- }
+ if (byUsers.intValue() == 0) {
+ rateDesc.setText(i18n.t("(Not rated)"));
+ } else if (byUsers.intValue() == 1) {
+ // i18n params pluralization
+ rateDesc.setText(i18n.t("([%d] user)", byUsers));
+ } else {
+ rateDesc.setText(i18n.t("([%d] users)", byUsers));
+ }
}
public void setRate(final Double rate) {
- setRate(Star.genStars(rate.doubleValue()));
+ setRate(Star.genStars(rate.doubleValue()));
}
private void initialize() {
- rateGrid = new Grid(1, 6);
- starImg = new Image[5];
- for (int i = 0; i < 5; i++) {
- starImg[i] = new Image();
- new Star(Star.GREY).getImage().applyTo(starImg[i]);
- }
- rateDesc = new Label();
+ rateGrid = new Grid(1, 6);
+ starImg = new Image[5];
+ for (int i = 0; i < 5; i++) {
+ starImg[i] = new Image();
+ new Star(Star.GREY).getImage().applyTo(starImg[i]);
+ }
+ rateDesc = new Label();
}
private void layout() {
- initWidget(rateGrid);
- for (int i = 0; i < 5; i++) {
- rateGrid.setWidget(0, i, starImg[i]);
- }
- rateGrid.setWidget(0, 5, rateDesc);
+ initWidget(rateGrid);
+ for (int i = 0; i < 5; i++) {
+ rateGrid.setWidget(0, i, starImg[i]);
+ }
+ rateGrid.setWidget(0, 5, rateDesc);
}
private void setProperties() {
- rateGrid.setCellPadding(0);
- rateGrid.setCellSpacing(0);
- rateGrid.setBorderWidth(0);
- rateGrid.addStyleName("kune-RatePanel-Stars");
- rateDesc.addStyleName("kune-RatePanel-Label");
- rateDesc.addStyleName("kune-Margin-Medium-lr");
+ rateGrid.setCellPadding(0);
+ rateGrid.setCellSpacing(0);
+ rateGrid.setBorderWidth(0);
+ rateGrid.addStyleName("kune-RatePanel-Stars");
+ rateDesc.addStyleName("kune-RatePanel-Label");
+ rateDesc.addStyleName("kune-Margin-Medium-lr");
}
private void setRate(final Star stars[]) {
- for (int i = 0; i < 5; i++) {
- stars[i].getImage().applyTo(starImg[i]);
- }
+ for (int i = 0; i < 5; i++) {
+ stars[i].getImage().applyTo(starImg[i]);
+ }
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateView.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateView.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -20,7 +20,11 @@
package org.ourproject.kune.platf.client.ui.rate;
public interface RateView {
+
+ public void setByUsers(Integer byUsers);
+
public void setRate(Double rate);
- public void setByUsers(Integer byUsers);
+ public void setVisible(boolean visible);
+
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceClientModule.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceClientModule.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -20,8 +20,6 @@
package org.ourproject.kune.workspace.client;
import org.ourproject.kune.platf.client.PlatformEvents;
-import org.ourproject.kune.platf.client.dispatch.DefaultDispatcher;
-import org.ourproject.kune.platf.client.dispatch.Dispatcher;
import org.ourproject.kune.platf.client.extend.ClientModule;
import org.ourproject.kune.platf.client.extend.Register;
import org.ourproject.kune.platf.client.state.Session;
@@ -29,9 +27,6 @@
import org.ourproject.kune.workspace.client.actions.AttachToExtensibleWidgetAction;
import org.ourproject.kune.workspace.client.actions.ClearExtensibleWidgetAction;
import org.ourproject.kune.workspace.client.actions.DetachFromExtensibleWidgetAction;
-import org.ourproject.kune.workspace.client.actions.DisableRateItAction;
-import org.ourproject.kune.workspace.client.actions.EnableRateItAction;
-import org.ourproject.kune.workspace.client.actions.RateContentAction;
import org.ourproject.kune.workspace.client.actions.RecalculateWorkspaceAction;
import org.ourproject.kune.workspace.client.actions.ReloadContextAction;
import org.ourproject.kune.workspace.client.actions.i18n.DoTranslationAction;
@@ -45,7 +40,6 @@
private final StateManager stateManager;
private final Workspace workspace;
- private final Dispatcher dispacher;
private final Session session;
private final I18nUITranslationService i18n;
@@ -54,7 +48,6 @@
this.session = session;
this.stateManager = stateManager;
this.i18n = i18n;
- dispacher = DefaultDispatcher.getInstance();
this.workspace = workspace;
}
@@ -63,9 +56,6 @@
register.addAction(PlatformEvents.DETACH_FROM_EXTENSIBLE_WIDGET,
new DetachFromExtensibleWidgetAction(workspace));
register.addAction(PlatformEvents.CLEAR_EXTENSIBLE_WIDGET, new ClearExtensibleWidgetAction(workspace));
- register.addAction(WorkspaceEvents.RATE_CONTENT, new RateContentAction(session, stateManager, i18n));
- register.addAction(WorkspaceEvents.ENABLE_RATEIT, new EnableRateItAction(workspace));
- register.addAction(WorkspaceEvents.DISABLE_RATEIT, new DisableRateItAction(workspace));
register.addAction(WorkspaceEvents.GET_TRANSLATION, new GetTranslationAction(session));
register.addAction(WorkspaceEvents.SHOW_TRANSLATOR, new ShowTranslatorAction(session, workspace, i18n));
register.addAction(WorkspaceEvents.DO_TRANSLATION, new DoTranslationAction(session, i18n));
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceEvents.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceEvents.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceEvents.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -21,9 +21,6 @@
package org.ourproject.kune.workspace.client;
public interface WorkspaceEvents {
- public static final String RATE_CONTENT = "ws.RateContent";
- public static final String ENABLE_RATEIT = "ws.EnableRateIt";
- public static final String DISABLE_RATEIT = "ws.DisableRateIt";
public static final String GET_LEXICON = "i18n.getLexicon";
public static final String SHOW_TRANSLATOR = "i18n.ShowTranslator";
public static final String SHOW_SEARCHER = "ws.ShowSearcher";
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceFactory.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceFactory.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceFactory.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -45,9 +45,6 @@
import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems;
import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItemsPanel;
import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItemsPresenter;
-import org.ourproject.kune.workspace.client.workspace.ContentBottomToolBarComponent;
-import org.ourproject.kune.workspace.client.workspace.ContentBottomToolBarPresenter;
-import org.ourproject.kune.workspace.client.workspace.ContentBottomToolBarView;
import org.ourproject.kune.workspace.client.workspace.ContentSubTitleComponent;
import org.ourproject.kune.workspace.client.workspace.ContentSubTitlePresenter;
import org.ourproject.kune.workspace.client.workspace.ContentSubTitleView;
@@ -60,7 +57,6 @@
import org.ourproject.kune.workspace.client.workspace.Workspace;
import org.ourproject.kune.workspace.client.workspace.WorkspacePresenter;
import org.ourproject.kune.workspace.client.workspace.WorkspaceView;
-import org.ourproject.kune.workspace.client.workspace.ui.ContentBottomToolBarPanel;
import org.ourproject.kune.workspace.client.workspace.ui.ContentSubTitlePanel;
import org.ourproject.kune.workspace.client.workspace.ui.ContentTitlePanel;
import org.ourproject.kune.workspace.client.workspace.ui.ContentToolBarPanel;
@@ -72,13 +68,6 @@
private static I18nTranslationService i18n;
private static KuneErrorHandler errorHandler;
- public static ContentBottomToolBarComponent createContentBottomToolBarComponent() {
- final ContentBottomToolBarPresenter presenter = new ContentBottomToolBarPresenter();
- final ContentBottomToolBarView view = new ContentBottomToolBarPanel(presenter, i18n);
- presenter.init(view);
- return presenter;
- }
-
public static ContentSubTitleComponent createContentSubTitleComponent() {
final ContentSubTitlePresenter presenter = new ContentSubTitlePresenter(i18n);
final ContentSubTitleView view = new ContentSubTitlePanel(presenter, i18n);
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/DisableRateItAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/DisableRateItAction.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/DisableRateItAction.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -1,40 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.workspace.client.actions;
-
-import org.ourproject.kune.platf.client.dispatch.Action;
-import org.ourproject.kune.workspace.client.workspace.Workspace;
-
-public class DisableRateItAction implements Action<Object> {
-
- private final Workspace workspace;
-
- public DisableRateItAction(final Workspace workspace) {
- this.workspace = workspace;
- }
-
- public void execute(final Object value) {
- onDisableRateItAction();
- }
-
- private void onDisableRateItAction() {
- workspace.getContentBottomToolBarComponent().setEnabledRateIt(false);
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/EnableRateItAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/EnableRateItAction.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/EnableRateItAction.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -1,41 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.workspace.client.actions;
-
-import org.ourproject.kune.platf.client.dispatch.Action;
-import org.ourproject.kune.workspace.client.workspace.Workspace;
-
- at SuppressWarnings("unchecked")
-public class EnableRateItAction implements Action {
-
- private final Workspace workspace;
-
- public EnableRateItAction(final Workspace workspace) {
- this.workspace = workspace;
- }
-
- public void execute(final Object value) {
- onEnableRateItAction();
- }
-
- private void onEnableRateItAction() {
- workspace.getContentBottomToolBarComponent().setEnabledRateIt(true);
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/RateContentAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/RateContentAction.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/RateContentAction.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -1,61 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.workspace.client.actions;
-
-import org.ourproject.kune.platf.client.dispatch.Action;
-import org.ourproject.kune.platf.client.dto.StateDTO;
-import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
-import org.ourproject.kune.platf.client.rpc.ContentService;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-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.workspace.client.sitebar.Site;
-
-public class RateContentAction implements Action<Double> {
-
- private final StateManager stateManager;
- private final Session session;
- private final I18nTranslationService i18n;
-
- public RateContentAction(final Session session, final StateManager stateManager, final I18nTranslationService i18n) {
- this.session = session;
- this.stateManager = stateManager;
- this.i18n = i18n;
- }
-
- public void execute(final Double value) {
- onRateContent(value);
- }
-
- private void onRateContent(final Double value) {
- Site.showProgressProcessing();
- ContentServiceAsync server = ContentService.App.getInstance();
- StateDTO currentState = session.getCurrentState();
- server.rateContent(session.getUserHash(), currentState.getGroup().getShortName(), currentState.getDocumentId(),
- value, new AsyncCallbackSimple<Object>() {
- public void onSuccess(final Object result) {
- Site.hideProgress();
- Site.info(i18n.t("Content rated"));
- stateManager.reload();
- }
- });
- }
-}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -2,6 +2,8 @@
import org.ourproject.kune.platf.client.dto.GroupDTO;
import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.ui.rate.RateIt;
+import org.ourproject.kune.platf.client.ui.rate.RatePresenter;
import org.ourproject.kune.workspace.client.ui.newtmp.licensefoot.EntityLicensePresenter;
import org.ourproject.kune.workspace.client.ui.newtmp.sitebar.sitepublic.SitePublicSpaceLink;
import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
@@ -29,13 +31,16 @@
private final Provider<ParticipationSummary> participationSummaryProvider;
private final Provider<GroupSummary> groupSummaryProvider;
private final SitePublicSpaceLink publicSpaceLink;
+ private final RateIt rateIt;
+ private final RatePresenter ratePresenter;
public WorkspaceManager(final SitePublicSpaceLink publicSpaceLink, final EntityLogo entityLogo,
final EntityTitlePresenter entityTitlePresenter, final EntitySubTitlePresenter entitySubTitlePresenter,
final WsThemePresenter wsThemePresenter, final EntityLicensePresenter entityLicensePresenter,
final Provider<GroupMembersSummary> groupMembersSummaryProvider,
final Provider<ParticipationSummary> participationSummaryProvider,
- final Provider<TagsSummary> tagsSummaryProvider, final Provider<GroupSummary> groupSummaryProvider) {
+ final Provider<TagsSummary> tagsSummaryProvider, final Provider<GroupSummary> groupSummaryProvider,
+ final RateIt rateIt, final RatePresenter ratePresenter) {
this.publicSpaceLink = publicSpaceLink;
this.entityLogo = entityLogo;
this.entityTitlePresenter = entityTitlePresenter;
@@ -46,6 +51,8 @@
this.participationSummaryProvider = participationSummaryProvider;
this.tagsProvider = tagsSummaryProvider;
this.groupSummaryProvider = groupSummaryProvider;
+ this.rateIt = rateIt;
+ this.ratePresenter = ratePresenter;
wsThemePresenter.onThemeChanged(new Slot2<WsTheme, WsTheme>() {
public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
entityLogo.setTheme(oldTheme, newTheme);
@@ -75,6 +82,8 @@
groupSummaryProvider.get().setState(state);
tagsProvider.get().setState(state);
wsThemePresenter.setState(state);
+ rateIt.setState(state);
+ ratePresenter.setState(state);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/Workspace.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/Workspace.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/Workspace.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -49,8 +49,6 @@
public void detachFromExtensibleWidget(ExtensibleWidgetChild ext);
- public ContentBottomToolBarComponent getContentBottomToolBarComponent();
-
public ContentSubTitleComponent getContentSubTitleComponent();
public ContentTitleComponent getContentTitleComponent();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/WorkspacePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/WorkspacePresenter.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/WorkspacePresenter.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -88,10 +88,6 @@
extensionPointManager.detachFromExtensible(child);
}
- public ContentBottomToolBarComponent getContentBottomToolBarComponent() {
- return components.getContentBottomToolBarComponent();
- }
-
public ContentSubTitleComponent getContentSubTitleComponent() {
return components.getContentSubTitleComponent();
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/WorkspaceUIComponents.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/WorkspaceUIComponents.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/WorkspaceUIComponents.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -27,27 +27,13 @@
public class WorkspaceUIComponents {
private LicenseComponent license;
private ContentTitleComponent contentTitle;
- private GroupMembersSummary groupMembers;
- private ParticipationSummary participatesInGroups;
- private GroupSummary groupSummary;
private ContentSubTitleComponent contentSubTitle;
- private ContentBottomToolBarComponent contentBottomToolBar;
- private ThemeMenuComponent themeMenu;
private ContentToolBarComponent contentToolBar;
- private GroupLiveSearcher groupLiveSearcher;
private I18nTranslatorComponent i18nTranslatorSearch;
- private UserLiveSearcher userLiveSearch;
public WorkspaceUIComponents(final WorkspacePresenter presenter) {
}
- public ContentBottomToolBarComponent getContentBottomToolBarComponent() {
- if (contentBottomToolBar == null) {
- contentBottomToolBar = WorkspaceFactory.createContentBottomToolBarComponent();
- }
- return contentBottomToolBar;
- }
-
public ContentSubTitleComponent getContentSubTitleComponent() {
if (contentSubTitle == null) {
contentSubTitle = WorkspaceFactory.createContentSubTitleComponent();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/ContentBottomToolBarPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/ContentBottomToolBarPanel.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/ContentBottomToolBarPanel.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -22,9 +22,6 @@
import org.ourproject.kune.platf.client.services.I18nTranslationService;
import org.ourproject.kune.platf.client.ui.CustomPushButton;
-import org.ourproject.kune.platf.client.ui.rate.RateItPanel;
-import org.ourproject.kune.platf.client.ui.rate.RateItPresenter;
-import org.ourproject.kune.platf.client.ui.rate.RatePanel;
import org.ourproject.kune.workspace.client.workspace.ContentBottomToolBarPresenter;
import org.ourproject.kune.workspace.client.workspace.ContentBottomToolBarView;
@@ -35,57 +32,57 @@
public class ContentBottomToolBarPanel extends HorizontalPanel implements ContentBottomToolBarView {
- private final RatePanel rate;
- private final RateItPresenter rateItPresenter;
- private final RateItPanel rateIt;
+ // private final RatePanel rate;
+ // private final RateItPresenter rateItPresenter;
+ // private final RateItPanel rateIt;
private CustomPushButton btn;
public ContentBottomToolBarPanel(final ContentBottomToolBarPresenter presenter, final I18nTranslationService i18n) {
- rate = new RatePanel(null, null, i18n);
- rateItPresenter = new RateItPresenter(i18n);
- rateIt = new RateItPanel(rateItPresenter, i18n);
- rateItPresenter.init(rateIt);
- Label expand = new Label("");
- this.add(rateIt);
- this.add(expand);
- this.add(rate);
- this.setWidth("100%");
- expand.setWidth("100%");
- this.setCellWidth(expand, "100%");
- this.addStyleName("kune-ContentToolBarPanel");
- this.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
- this.setCellVerticalAlignment(rate, VerticalPanel.ALIGN_MIDDLE);
- this.setCellVerticalAlignment(rateIt, VerticalPanel.ALIGN_MIDDLE);
- rate.setVisible(false);
- rateIt.setVisible(false);
- // TODO setEnabled false to RateIt
+ // rate = new RatePanel(null, null, i18n);
+ // rateItPresenter = null;
+ // rateIt = new RateItPanel(rateItPresenter, i18n, null);
+ // rateItPresenter.init(rateIt);
+ final Label expand = new Label("");
+ // this.add(rateIt);
+ this.add(expand);
+ // this.add(rate);
+ this.setWidth("100%");
+ expand.setWidth("100%");
+ this.setCellWidth(expand, "100%");
+ this.addStyleName("kune-ContentToolBarPanel");
+ this.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
+ // this.setCellVerticalAlignment(rate, VerticalPanel.ALIGN_MIDDLE);
+ // this.setCellVerticalAlignment(rateIt, VerticalPanel.ALIGN_MIDDLE);
+ // rate.setVisible(false);
+ // rateIt.setVisible(false);
+ // TODO setEnabled false to RateIt
}
public void addButton(final String caption, final ClickListener listener) {
- btn = new CustomPushButton(caption, listener);
- this.insert(btn, 0);
- btn.addStyleName("kune-Button-Large-lrSpace");
+ btn = new CustomPushButton(caption, listener);
+ this.insert(btn, 0);
+ btn.addStyleName("kune-Button-Large-lrSpace");
}
public void setButtonVisible(final boolean isEnabled) {
- btn.setVisible(isEnabled);
+ btn.setVisible(isEnabled);
}
public void setRate(final Double value, final Integer rateByUsers) {
- rate.setRate(value);
- rate.setByUsers(rateByUsers);
+ // rate.setRate(value);
+ // rate.setByUsers(rateByUsers);
}
public void setRateIt(final Double currentUserRate) {
- rateItPresenter.setRate(currentUserRate);
+ // rateItPresenter.setRate(currentUserRate);
}
public void setRateItVisible(final boolean visible) {
- rateIt.setVisible(visible);
+ // rateIt.setVisible(visible);
}
public void setRateVisible(final boolean visible) {
- rate.setVisible(visible);
+ // rate.setVisible(visible);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/WorkspacePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/WorkspacePanel.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/WorkspacePanel.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -222,7 +222,7 @@
setContentTitle(components.getContentTitleComponent().getView());
setContentSubTitle(components.getContentSubTitleComponent().getView());
setContentToolBar(components.getContentToolBarComponent().getView());
- setContentBottomToolBar(components.getContentBottomToolBarComponent().getView());
+ // setContentBottomToolBar(components.getContentBottomToolBarComponent().getView());
setBottom(components.getLicenseComponent().getView());
// addBottomIconComponent(components.getThemeMenuComponent().getView());
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/PersistenceTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/PersistenceTest.java 2008-07-26 17:03:52 UTC (rev 817)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/PersistenceTest.java 2008-07-26 20:07:21 UTC (rev 818)
@@ -16,53 +16,53 @@
private final String persistenceUnit;
private final String propetiesFileName;
+ public PersistenceTest() {
+ // test: use memory
+ // test_db: use mysql
+ this("test", "kune.properties");
+ }
+
public PersistenceTest(final String persistenceUnit, final String propetiesFileName) {
- this.persistenceUnit = persistenceUnit;
- this.propetiesFileName = propetiesFileName;
+ this.persistenceUnit = persistenceUnit;
+ this.propetiesFileName = propetiesFileName;
}
- public PersistenceTest() {
- // test: use memory
- // test_db: use mysql
- this("test", "kune.properties");
+ public void closeTransaction() {
+ getManager().getTransaction().commit();
}
- @Before
- public void prepare() {
- final Injector injector = TestHelper.create(new PlatformServerModule(), persistenceUnit, propetiesFileName);
- final PersistenceService persistence = injector.getInstance(PersistenceService.class);
- // To Debug insert breakpoint here
- persistence.start();
- injector.injectMembers(this);
+ public EntityTransaction getTransaction() {
+ return getManager().getTransaction();
}
public EntityManager openTransaction() {
- final EntityManager manager = getManager();
- final EntityTransaction transaction = manager.getTransaction();
- transaction.begin();
- return manager;
+ final EntityManager manager = getManager();
+ final EntityTransaction transaction = manager.getTransaction();
+ transaction.begin();
+ return manager;
}
- public void closeTransaction() {
- getManager().getTransaction().commit();
+ public void persist(final Object... entities) {
+ for (final Object entity : entities) {
+ getManager().persist(entity);
+ }
}
- public void rollbackTransaction() {
- getManager().getTransaction().rollback();
+ @Before
+ public void prepare() {
+ final Injector injector = TestHelper.create(new PlatformServerModule(), persistenceUnit, propetiesFileName);
+ final PersistenceService persistence = injector.getInstance(PersistenceService.class);
+ // To Debug insert breakpoint here
+ persistence.start();
+ injector.injectMembers(this);
}
- public void persist(final Object... entities) {
- for (final Object entity : entities) {
- getManager().persist(entity);
- }
+ public void rollbackTransaction() {
+ getManager().getTransaction().rollback();
}
private EntityManager getManager() {
- return provider.get();
+ return provider.get();
}
- public EntityTransaction getTransaction() {
- return getManager().getTransaction();
- }
-
}
More information about the kune-commits
mailing list