[kune-commits] r1335 - in trunk/src: main/java/cc/kune/blogs/client/actions main/java/cc/kune/common/client/ui main/java/cc/kune/common/client/ui/dialogs main/java/cc/kune/common/public main/java/cc/kune/core/client/sitebar main/java/cc/kune/core/public main/java/cc/kune/core/server/state main/java/cc/kune/core/shared/dto main/java/cc/kune/docs/client/actions main/java/cc/kune/gspace/client/actions main/java/cc/kune/gspace/client/viewers main/java/cc/kune/wave/server test/java/cc/kune/core/server/mapper test/java/cc/kune/wave/server
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Tue May 3 13:29:34 CEST 2011
Author: vjrj_
Date: 2011-05-03 13:29:33 +0200 (Tue, 03 May 2011)
New Revision: 1335
Modified:
trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java
trunk/src/main/java/cc/kune/common/client/ui/AbstractAtBorderPopupPanel.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicDialog.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicTopDialog.java
trunk/src/main/java/cc/kune/common/public/kune-common.css
trunk/src/main/java/cc/kune/core/client/sitebar/AboutKuneDialog.java
trunk/src/main/java/cc/kune/core/client/sitebar/AboutKuneDialog.ui.xml
trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.java
trunk/src/main/java/cc/kune/core/public/ws.css
trunk/src/main/java/cc/kune/core/server/state/StateContent.java
trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java
trunk/src/main/java/cc/kune/core/shared/dto/StateContentDTO.java
trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
trunk/src/main/java/cc/kune/gspace/client/actions/GoParentContainerBtn.java
trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java
trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.java
trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.ui.xml
trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java
trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java
trunk/src/test/java/cc/kune/core/server/mapper/MapperTest.java
trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java
Log:
Wave participation, and dialogs size (continuation)
Modified: trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/blogs/client/actions/BlogsClientActions.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -39,36 +39,40 @@
public class BlogsClientActions extends AbstractFoldableToolActions {
- final String[] all = { TYPE_ROOT, TYPE_BLOG, TYPE_POST, TYPE_UPLOADEDFILE };
- final String[] containers = { TYPE_ROOT, TYPE_BLOG };
- final String[] containersNoRoot = { TYPE_BLOG };
- final String[] contents = { TYPE_POST, TYPE_UPLOADEDFILE };
- final String[] contentsModerated = { TYPE_POST, TYPE_UPLOADEDFILE };
+ final String[] all = { TYPE_ROOT, TYPE_BLOG, TYPE_POST, TYPE_UPLOADEDFILE };
+ final String[] containers = { TYPE_ROOT, TYPE_BLOG };
+ final String[] containersNoRoot = { TYPE_BLOG };
+ final String[] contents = { TYPE_POST, TYPE_UPLOADEDFILE };
+ final String[] contentsModerated = { TYPE_POST, TYPE_UPLOADEDFILE };
- @Inject
- public BlogsClientActions(final I18nUITranslationService i18n, final Session session,
- final StateManager stateManager, final ActionRegistryByType registry, final CoreResources res,
- final Provider<GoParentBlogBtn> folderGoUp, final Provider<NewPostBtn> newDocBtn,
- final Provider<NewBlogBtn> newFolderBtn, final Provider<OpenBlogMenuItem> openContentMenuItem,
- final Provider<DelPostMenuItem> delContentMenuItem, final Provider<RefreshContentMenuItem> refresh,
- final Provider<ContentViewerOptionsMenu> optionsMenuContent,
- final Provider<ParticipateInContentBtn> participateBtn, final Provider<DelBlogMenuItem> delFolderMenuItem,
- final Provider<SetAsHomePageMenuItem> setAsHomePage) {
- super(session, stateManager, i18n, registry);
- actionsRegistry.addAction(ActionGroups.VIEW, folderGoUp, contents);
- actionsRegistry.addAction(ActionGroups.VIEW, folderGoUp, containersNoRoot);
- actionsRegistry.addAction(ActionGroups.VIEW, optionsMenuContent, all);
- actionsRegistry.addAction(ActionGroups.VIEW, participateBtn, contents);
- actionsRegistry.addAction(ActionGroups.VIEW, refresh, all);
- actionsRegistry.addAction(ActionGroups.VIEW, newDocBtn, containersNoRoot);
- actionsRegistry.addAction(ActionGroups.VIEW, newFolderBtn, TYPE_ROOT);
- actionsRegistry.addAction(ActionGroups.MENUITEM, openContentMenuItem, contents);
- actionsRegistry.addAction(ActionGroups.MENUITEM, openContentMenuItem, containersNoRoot);
- actionsRegistry.addAction(ActionGroups.MENUITEM, delContentMenuItem, contents);
- actionsRegistry.addAction(ActionGroups.MENUITEM, delFolderMenuItem, containersNoRoot);
- }
+ @Inject
+ public BlogsClientActions(final I18nUITranslationService i18n, final Session session,
+ final StateManager stateManager, final ActionRegistryByType registry, final CoreResources res,
+ final Provider<GoParentBlogBtn> folderGoUp, final Provider<NewPostBtn> newDocBtn,
+ final Provider<NewBlogBtn> newFolderBtn, final Provider<OpenBlogMenuItem> openContentMenuItem,
+ final Provider<DelPostMenuItem> delContentMenuItem,
+ final Provider<RefreshContentMenuItem> refresh,
+ final Provider<ContentViewerOptionsMenu> optionsMenuContent,
+ final Provider<ParticipateInContentBtn> participateBtn,
+ final Provider<DelBlogMenuItem> delFolderMenuItem,
+ final Provider<SetAsHomePageMenuItem> setAsHomePage) {
+ super(session, stateManager, i18n, registry);
+ actionsRegistry.addAction(ActionGroups.VIEW, folderGoUp, contents);
+ actionsRegistry.addAction(ActionGroups.VIEW, folderGoUp, containersNoRoot);
+ actionsRegistry.addAction(ActionGroups.VIEW, optionsMenuContent, all);
+ actionsRegistry.addAction(ActionGroups.VIEW, participateBtn, contents);
+ actionsRegistry.addAction(ActionGroups.VIEW, refresh, all);
+ actionsRegistry.addAction(ActionGroups.VIEW, newDocBtn, containersNoRoot);
+ actionsRegistry.addAction(ActionGroups.VIEW, newFolderBtn, TYPE_ROOT);
+ actionsRegistry.addAction(ActionGroups.MENUITEM, openContentMenuItem, contents);
+ actionsRegistry.addAction(ActionGroups.MENUITEM, openContentMenuItem, containersNoRoot);
+ actionsRegistry.addAction(ActionGroups.MENUITEM, delContentMenuItem, contents);
+ actionsRegistry.addAction(ActionGroups.MENUITEM, delFolderMenuItem, containersNoRoot);
+ // actionsRegistry.addAction(ActionGroups.MENUITEM, setAsHomePage,
+ // TYPE_BLOG);
+ }
- @Override
- protected void createPostSessionInitActions() {
- }
+ @Override
+ protected void createPostSessionInitActions() {
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/ui/AbstractAtBorderPopupPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/AbstractAtBorderPopupPanel.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/common/client/ui/AbstractAtBorderPopupPanel.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -27,109 +27,61 @@
public abstract class AbstractAtBorderPopupPanel extends PopupPanel {
- private String height;
- private boolean showCentered = true;
- protected UIObject showNearObject;
- private String width;
+ private boolean showCentered = true;
+ protected UIObject showNearObject;
- public AbstractAtBorderPopupPanel() {
- super(false, false);
- }
+ public AbstractAtBorderPopupPanel() {
+ super(false, false);
+ }
- public AbstractAtBorderPopupPanel(final boolean autohide) {
- this(autohide, false);
- }
+ public AbstractAtBorderPopupPanel(final boolean autohide) {
+ this(autohide, false);
+ }
- public AbstractAtBorderPopupPanel(final boolean autohide, final boolean modal) {
- super(autohide, modal);
- setGlassEnabled(modal);
- init();
- }
+ public AbstractAtBorderPopupPanel(final boolean autohide, final boolean modal) {
+ super(autohide, modal);
+ setGlassEnabled(modal);
+ init();
+ }
- private String calculatePercent(final int currentSize, final String percent) {
- return String.valueOf(currentSize * Integer.valueOf(percent.replace("%", "")) / 100) + "px";
- }
+ public void defaultStyle() {
+ addStyleName("k-opacity90");
+ addStyleName("k-box-10shadow");
+ }
- public void defaultStyle() {
- addStyleName("k-opacity90");
- addStyleName("k-box-10shadow");
- }
-
- private void init() {
- setSizes();
- Window.addResizeHandler(new ResizeHandler() {
- @Override
- public void onResize(final ResizeEvent event) {
- setSizeWithListener(event.getWidth(), event.getHeight());
- if (isShowing()) {
- if (showCentered) {
- setCenterPositionImpl();
- } else {
- showRelativeImpl();
- }
- }
- }
- });
- }
-
- public void setCenterPosition() {
- setCenterPositionImpl();
- }
-
- protected abstract void setCenterPositionImpl();
-
- @Override
- public void setHeight(final String height) {
- this.height = height;
- setSizes();
- }
-
- @Override
- public void setSize(final String width, final String height) {
- this.width = width;
- this.height = height;
- setSizes();
- }
-
- private void setSizes() {
- setSizeWithListener(Window.getClientWidth(), Window.getClientHeight());
- }
-
- private void setSizeWithListener(final int windowWidth, final int windowHeight) {
- if (width != null) {
- if (width.contains("%")) {
- calculatePercent(windowWidth, width);
- } else {
- super.setWidth(width);
- }
+ private void init() {
+ Window.addResizeHandler(new ResizeHandler() {
+ @Override
+ public void onResize(final ResizeEvent event) {
+ if (isShowing()) {
+ if (showCentered) {
+ setCenterPositionImpl();
+ } else {
+ showRelativeImpl();
+ }
}
- if (height != null) {
- if (height.contains("%")) {
- calculatePercent(windowHeight, height);
- } else {
- super.setHeight(height);
- }
- }
- }
+ }
+ });
+ }
- @Override
- public void setWidth(final String width) {
- this.width = width;
- setSizes();
- }
+ public void setCenterPosition() {
+ setCenterPositionImpl();
+ }
- public void showCentered() {
- showCentered = true;
- setCenterPositionImpl();
- }
+ protected abstract void setCenterPositionImpl();
- public void showNear(final UIObject object) {
- this.showNearObject = object;
- showCentered = false;
- showRelativeImpl();
- }
+ public void showCentered() {
+ showCentered = true;
+ setCenterPositionImpl();
+ }
- private void showRelativeImpl() {
- showRelativeTo(showNearObject);
- }
+ public void showNear(final UIObject object) {
+ this.showNearObject = object;
+ showCentered = false;
+ showRelativeImpl();
+ }
+
+ private void showRelativeImpl() {
+ showRelativeTo(showNearObject);
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicDialog.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicDialog.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -118,6 +118,14 @@
firstBtn.setVisible(visible);
}
+ public void setInnerHeight(final String height) {
+ vp.setHeight(height);
+ }
+
+ public void setInnerWidth(final String width) {
+ vp.setWidth(width);
+ }
+
public void setSecondBtnId(final String id) {
secondBtn.ensureDebugId(id);
}
Modified: trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicTopDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicTopDialog.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicTopDialog.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -19,143 +19,214 @@
*/
package cc.kune.common.client.ui.dialogs;
+import cc.kune.common.client.notify.NotifyUser;
import cc.kune.common.client.ui.PopupTopPanel;
import cc.kune.common.client.utils.TextUtils;
import com.google.gwt.event.logical.shared.HasCloseHandlers;
+import com.google.gwt.event.logical.shared.ResizeEvent;
+import com.google.gwt.event.logical.shared.ResizeHandler;
+import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.UIObject;
public class BasicTopDialog extends BasicDialog {
- public static class Builder {
- private final boolean autohide;
- private boolean autoscroll = false;
- private final String dialogId;
- private String firstButtonId;
- private String firstButtonTitle;
- private String height = "70%";
- private String icon;
- private final boolean modal;
- private String sndButtonId;
- private String sndButtonTitle;
- private int tabIndexStart = 0;
- private String title;
- private String width = "400px";
+ public static class Builder {
+ private final boolean autohide;
+ private boolean autoscroll = false;
+ private final String dialogId;
+ private String firstButtonId;
+ private String firstButtonTitle;
+ private String height = "70%";
+ private String icon;
+ private final boolean modal;
+ private String sndButtonId;
+ private String sndButtonTitle;
+ private int tabIndexStart = 0;
+ private String title;
+ private String width;
- public Builder(final String dialogId, final boolean autohide, final boolean modal) {
- // Required params
- this.autohide = autohide;
- this.modal = modal;
- this.dialogId = dialogId;
- }
+ public Builder(final String dialogId, final boolean autohide, final boolean modal) {
+ // Required params
+ this.autohide = autohide;
+ this.modal = modal;
+ this.dialogId = dialogId;
+ }
- public Builder autoscroll(final boolean autoscroll) {
- // Not used for now
- this.autoscroll = autoscroll;
- return this;
- }
+ public Builder autoscroll(final boolean autoscroll) {
+ // Not used for now
+ this.autoscroll = autoscroll;
+ return this;
+ }
- public BasicTopDialog build() {
- return new BasicTopDialog(this);
- }
+ public BasicTopDialog build() {
+ return new BasicTopDialog(this);
+ }
- public Builder firstButtonId(final String firstButtonId) {
- this.firstButtonId = firstButtonId;
- return this;
- }
+ public Builder firstButtonId(final String firstButtonId) {
+ this.firstButtonId = firstButtonId;
+ return this;
+ }
- public Builder firstButtonTitle(final String firstButtonTitle) {
- this.firstButtonTitle = firstButtonTitle;
- return this;
- }
+ public Builder firstButtonTitle(final String firstButtonTitle) {
+ this.firstButtonTitle = firstButtonTitle;
+ return this;
+ }
- public Builder height(final int height) {
- this.height = String.valueOf(height);
- return this;
- }
+ public Builder height(final int height) {
+ this.height = String.valueOf(height);
+ return this;
+ }
- public Builder height(final String height) {
- this.height = height;
- return this;
- }
+ public Builder height(final String height) {
+ this.height = height;
+ return this;
+ }
- public Builder icon(final String icon) {
- this.icon = icon;
- return this;
- }
+ public Builder icon(final String icon) {
+ this.icon = icon;
+ return this;
+ }
- public Builder sndButtonId(final String sndButtonId) {
- this.sndButtonId = sndButtonId;
- return this;
- }
+ public Builder sndButtonId(final String sndButtonId) {
+ this.sndButtonId = sndButtonId;
+ return this;
+ }
- public Builder sndButtonTitle(final String sndButtonTitle) {
- this.sndButtonTitle = sndButtonTitle;
- return this;
- }
+ public Builder sndButtonTitle(final String sndButtonTitle) {
+ this.sndButtonTitle = sndButtonTitle;
+ return this;
+ }
- public Builder tabIndexStart(final int tabIndexStart) {
- this.tabIndexStart = tabIndexStart;
- return this;
- }
+ public Builder tabIndexStart(final int tabIndexStart) {
+ this.tabIndexStart = tabIndexStart;
+ return this;
+ }
- public Builder title(final String title) {
- this.title = title;
- return this;
- }
+ public Builder title(final String title) {
+ this.title = title;
+ return this;
+ }
- public Builder width(final int width) {
- this.width = String.valueOf(width);
- return this;
- }
+ public Builder width(final int width) {
+ this.width = String.valueOf(width);
+ return this;
+ }
- public Builder width(final String width) {
- this.width = width;
- return this;
- }
-
+ public Builder width(final String width) {
+ this.width = width;
+ return this;
}
- private final PopupTopPanel popup;
+ }
- private BasicTopDialog(final Builder builder) {
- popup = new PopupTopPanel(builder.autohide, builder.modal);
- popup.add(this);
- popup.ensureDebugId(builder.dialogId);
- super.getTitleText().setText(builder.title);
- if (TextUtils.notEmpty(builder.icon)) {
- super.setTitleIcon(builder.icon);
- }
- super.setFirstBtnText(builder.firstButtonTitle);
- super.setFirstBtnId(builder.firstButtonId);
- super.setFirstBtnTabIndex(builder.tabIndexStart);
- super.setSecondBtnText(builder.sndButtonTitle);
- super.setSecondBtnId(builder.sndButtonId);
- super.setSecondBtnTabIndex(builder.tabIndexStart + 1);
- super.getTitleText().setText(builder.title);
- popup.setWidth(builder.width);
- popup.setHeight(builder.height);
- }
+ private String height;
+ private final PopupTopPanel popup;
+ private String width;
- public HasCloseHandlers<PopupPanel> getClose() {
- return popup;
+ private BasicTopDialog(final Builder builder) {
+ popup = new PopupTopPanel(builder.autohide, builder.modal);
+ popup.add(this);
+ popup.ensureDebugId(builder.dialogId);
+ super.getTitleText().setText(builder.title);
+ if (TextUtils.notEmpty(builder.icon)) {
+ super.setTitleIcon(builder.icon);
}
+ super.setFirstBtnText(builder.firstButtonTitle);
+ super.setFirstBtnId(builder.firstButtonId);
+ super.setFirstBtnTabIndex(builder.tabIndexStart);
+ super.setSecondBtnText(builder.sndButtonTitle);
+ super.setSecondBtnId(builder.sndButtonId);
+ super.setSecondBtnTabIndex(builder.tabIndexStart + 1);
+ super.getTitleText().setText(builder.title);
+ this.setWidth(builder.width);
+ this.setHeight(builder.height);
+ setSizes();
+ Window.addResizeHandler(new ResizeHandler() {
+ @Override
+ public void onResize(final ResizeEvent event) {
+ setSizes(event.getWidth(), event.getHeight());
+ }
+ });
+ }
- public void hide() {
- popup.hide();
- }
+ private String calculatePercent(final int currentSize, final String percent) {
+ return String.valueOf(currentSize * Integer.valueOf(percent.replace("%", "")) / 100) + "px";
+ }
- @Override
- public void setFirstBtnTitle(final String title) {
- super.setFirstBtnTitle(title);
- }
+ public HasCloseHandlers<PopupPanel> getClose() {
+ return popup;
+ }
- public void showCentered() {
- popup.showCentered();
+ public void hide() {
+ popup.hide();
+ }
+
+ @Override
+ public void setFirstBtnTitle(final String title) {
+ super.setFirstBtnTitle(title);
+ }
+
+ @Override
+ public void setHeight(final String height) {
+ this.height = height;
+ setSizes();
+ }
+
+ @Override
+ public void setSize(final String width, final String height) {
+ this.width = width;
+ this.height = height;
+ setSizes();
+ }
+
+ private void setSizes() {
+ setSizes(Window.getClientWidth(), Window.getClientHeight());
+ }
+
+ private void setSizes(final int windowWidth, final int windowHeight) {
+ String newWidth = null;
+ String newHeight = null;
+ if (width != null) {
+ if (width.contains("%")) {
+ newWidth = calculatePercent(windowWidth, width);
+ } else {
+ newWidth = width;
+ }
}
+ if (height != null) {
+ if (height.contains("%")) {
+ newHeight = calculatePercent(windowHeight, height);
+ } else {
+ newHeight = height;
+ }
+ }
+ if (newWidth != null) {
+ NotifyUser.info(newWidth);
+ // popup.setWidth(newWidth);
+ // super.setWidth(newWidth);
+ super.setInnerWidth(newWidth);
+ }
+ if (newHeight != null) {
+ NotifyUser.info(newHeight);
+ // popup.setHeight(newHeight);
+ // super.setHeight(newHeight);
+ super.setInnerHeight(newHeight);
+ }
+ }
- public void showRelativeTo(final UIObject object) {
- popup.showRelativeTo(object);
- }
+ @Override
+ public void setWidth(final String width) {
+ this.width = width;
+ setSizes();
+ }
+
+ public void showCentered() {
+ popup.showCentered();
+ }
+
+ public void showRelativeTo(final UIObject object) {
+ popup.showRelativeTo(object);
+ }
}
Modified: trunk/src/main/java/cc/kune/common/public/kune-common.css
===================================================================
--- trunk/src/main/java/cc/kune/common/public/kune-common.css 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/common/public/kune-common.css 2011-05-03 11:29:33 UTC (rev 1335)
@@ -138,17 +138,17 @@
color: #552200;
font-size: 20px;
font-weight: bold;
- margin: 0 0 0 6px;
+ margin: 0 0 0 0px;
}
.k-dialog-innerp {
background-color: #FFFFFF;
border: solid 1px #F2F2F2;
- margin: 0px 4px 10px;
+ margin: 34px 16px 20px 16px;
}
.k-dialog-btn-area {
- padding: 0 5px 5px 5px;
+ padding: 0 15px 15px 15px;
margin-bottom: 30px;
}
@@ -634,3 +634,7 @@
background-color: #FFFBC1;
color: black !important;
}
+
+.k-btn-min {
+ min-width: 19px !important;
+}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/AboutKuneDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/AboutKuneDialog.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/AboutKuneDialog.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -15,32 +15,33 @@
public class AboutKuneDialog {
- interface Binder extends UiBinder<Widget, AboutKuneDialog> {
- }
- public static final String ABOUT_KUNE_BTN_ID = "kune-about-button-diag";
- public static final String ABOUT_KUNE_ID = "kune-about-diag";
- private static final Binder BINDER = GWT.create(Binder.class);
- private final BasicTopDialog dialog;
- @UiField
- FlowPanel flow;
- @UiField
- Frame frame;
+ interface Binder extends UiBinder<Widget, AboutKuneDialog> {
+ }
+ public static final String ABOUT_KUNE_BTN_ID = "kune-about-button-diag";
+ public static final String ABOUT_KUNE_ID = "kune-about-diag";
+ private static final Binder BINDER = GWT.create(Binder.class);
+ private final BasicTopDialog dialog;
+ @UiField
+ FlowPanel flow;
+ @UiField
+ Frame frame;
- @Inject
- public AboutKuneDialog(final I18nTranslationService i18n) {
- dialog = new BasicTopDialog.Builder(ABOUT_KUNE_ID, true, true).title(i18n.t("About Kune")).autoscroll(false).firstButtonTitle(
- i18n.t("Ok")).firstButtonId(ABOUT_KUNE_BTN_ID).tabIndexStart(1).height("70%").build();
- dialog.getInnerPanel().add(BINDER.createAndBindUi(this));
- dialog.getFirstBtn().addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- dialog.hide();
- }
- });
- }
+ @Inject
+ public AboutKuneDialog(final I18nTranslationService i18n) {
+ dialog = new BasicTopDialog.Builder(ABOUT_KUNE_ID, true, true).title(i18n.t("About Kune")).autoscroll(
+ false).firstButtonTitle(i18n.t("Ok")).firstButtonId(ABOUT_KUNE_BTN_ID).tabIndexStart(1).height(
+ "300px").width("400px").build();
+ dialog.getInnerPanel().add(BINDER.createAndBindUi(this));
+ dialog.getFirstBtn().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ dialog.hide();
+ }
+ });
+ }
- public void showCentered() {
- dialog.showCentered();
- }
+ public void showCentered() {
+ dialog.showCentered();
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/AboutKuneDialog.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/AboutKuneDialog.ui.xml 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/AboutKuneDialog.ui.xml 2011-05-03 11:29:33 UTC (rev 1335)
@@ -7,15 +7,16 @@
}
.frame {
- border: 0px;
- margin: 0px;
- width: 100%;
- background-color: #F2F2F2;
+ border: 0px;
+ margin: 0px;
+ width: 100%;
+ height: 300px;
+ background-color: #F2F2F2;
}
</ui:style>
<g:FlowPanel styleName="{style.panel}" ui:field="flow">
- <g:Frame styleName="{style.frame}" url="about.html"
- ui:field="frame" />
+ <g:Frame styleName="{style.frame}" url="about.html"
+ ui:field="frame" />
</g:FlowPanel>
</ui:UiBinder>
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -20,45 +20,47 @@
public class ErrorsDialog {
- interface Binder extends UiBinder<Widget, ErrorsDialog> {
- }
- private static final Binder BINDER = GWT.create(Binder.class);
- public static final String ERROR_LOGGER_BUTTON_ID = "kune-error-button-diag";
- public static final String ERROR_LOGGER_ID = "kune-error-diag";
+ interface Binder extends UiBinder<Widget, ErrorsDialog> {
+ }
+ private static final Binder BINDER = GWT.create(Binder.class);
+ public static final String ERROR_LOGGER_BUTTON_ID = "kune-error-button-diag";
+ public static final String ERROR_LOGGER_ID = "kune-error-diag";
- private final BasicTopDialog dialog;
- @UiField
- VerticalPanel panel;
+ private final BasicTopDialog dialog;
+ @UiField
+ VerticalPanel panel;
- @Inject
- public ErrorsDialog(final I18nTranslationService i18n, final EventBus eventBus) {
- dialog = new BasicTopDialog.Builder(ERROR_LOGGER_ID, true, true).title(i18n.t("Errors info")).autoscroll(true).firstButtonTitle(
- i18n.t("Ok")).firstButtonId(ERROR_LOGGER_BUTTON_ID).tabIndexStart(1).height("300px").build();
- dialog.getTitleText().setText(i18n.t("Info about errors"));
- final InlineLabel subTitle = new InlineLabel(i18n.t("Please copy/paste this info to report problems"));
- dialog.getInnerPanel().add(subTitle);
- dialog.getInnerPanel().add(BINDER.createAndBindUi(this));
- dialog.getFirstBtn().addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- dialog.hide();
- }
- });
- eventBus.addHandler(UserNotifyEvent.getType(), new UserNotifyEvent.UserNotifyHandler() {
- @Override
- public void onUserNotify(final UserNotifyEvent event) {
- final NotifyLevel level = event.getLevel();
- final IconLabel iconMessage = new IconLabel();
- iconMessage.setLeftIconResource(UserMessageImagesUtil.getIcon(level));
- iconMessage.setText(event.getMessage());
- iconMessage.setWordWrap(true);
- panel.insert(iconMessage, 0);
- }
- });
- }
+ @Inject
+ public ErrorsDialog(final I18nTranslationService i18n, final EventBus eventBus) {
+ dialog = new BasicTopDialog.Builder(ERROR_LOGGER_ID, true, true).title(i18n.t("Errors info")).autoscroll(
+ true).firstButtonTitle(i18n.t("Ok")).firstButtonId(ERROR_LOGGER_BUTTON_ID).tabIndexStart(1).width(
+ "400px").height("400px").build();
+ dialog.getTitleText().setText(i18n.t("Info about errors"));
+ final InlineLabel subTitle = new InlineLabel(
+ i18n.t("Please copy/paste this info to report problems"));
+ dialog.getInnerPanel().add(subTitle);
+ dialog.getInnerPanel().add(BINDER.createAndBindUi(this));
+ dialog.getFirstBtn().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ dialog.hide();
+ }
+ });
+ eventBus.addHandler(UserNotifyEvent.getType(), new UserNotifyEvent.UserNotifyHandler() {
+ @Override
+ public void onUserNotify(final UserNotifyEvent event) {
+ final NotifyLevel level = event.getLevel();
+ final IconLabel iconMessage = new IconLabel();
+ iconMessage.setLeftIconResource(UserMessageImagesUtil.getIcon(level));
+ iconMessage.setText(event.getMessage());
+ iconMessage.setWordWrap(true);
+ panel.insert(iconMessage, 0);
+ }
+ });
+ }
- public void showCentered() {
- dialog.showCentered();
- }
+ public void showCentered() {
+ dialog.showCentered();
+ }
}
Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/core/public/ws.css 2011-05-03 11:29:33 UTC (rev 1335)
@@ -17,7 +17,7 @@
font: 'Ubuntu', Arial;
}
-div, span {
+div,span {
outline: 0 none;
}
@@ -870,6 +870,10 @@
outline: 0 none;
/* height: 26px !important; */
font-weight: bold;
+ width: auto !IMPORTANT;
+ width: 50px;
+ min-width: 50px;
+ "
/*
font-size:small;
cursor: pointer;
@@ -877,18 +881,21 @@
padding-left: 25px !important; */
}
-.k-sn-mainpanel .x-btn button:hover,.k-sn-mainpanel button:hover,button.k-button:hover {
+.k-sn-mainpanel .x-btn button:hover,.k-sn-mainpanel button:hover,button.k-button:hover
+ {
border: 2px orange solid;
outline: 0 none;
/* background: #f0f0f0; */
}
-.k-sn-mainpanel .x-btn button:hover span,.k-sn-mainpanel button:hover span,button.k-button:hover span {
+.k-sn-mainpanel .x-btn button:hover span,.k-sn-mainpanel button:hover span,button.k-button:hover span
+ {
color: brown !important;
outline: 0 none;
}
-.k-sn-mainpanel .x-btn button:active,.k-sn-mainpanel button:active,button.k-button:active {
+.k-sn-mainpanel .x-btn button:active,.k-sn-mainpanel button:active,button.k-button:active
+ {
border-top-color: #ffffff;
background: #ffffff;
}
@@ -1138,6 +1145,6 @@
}
table.k-folder-viewer {
- border: 5px solid #FFF;
- border-collapse: separate;
+ border: 5px solid #FFF;
+ border-collapse: separate;
}
Modified: trunk/src/main/java/cc/kune/core/server/state/StateContent.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/state/StateContent.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/core/server/state/StateContent.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -28,144 +28,149 @@
import cc.kune.domain.User;
public class StateContent extends StateContainer {
- private List<User> authors;
- private String content;
- private AccessRights contentRights;
- private Double currentUserRate;
- private String documentId;
- private boolean isParticipant;
- private boolean isWave;
- private BasicMimeType mimeType;
- private Date publishedOn;
- private Double rate;
- private Integer rateByUsers;
- private ContentStatus status;
- private String tags;
- private int version;
- private String waveRef;
+ private List<User> authors;
+ private String content;
+ private AccessRights contentRights;
+ private Double currentUserRate;
+ private String documentId;
+ private boolean isParticipant;
+ private boolean isWave;
+ private BasicMimeType mimeType;
+ private Date publishedOn;
+ private Double rate;
+ private Integer rateByUsers;
+ private ContentStatus status;
+ private String tags;
+ private int version;
+ private String waveRef;
- public StateContent() {
- }
+ public StateContent() {
+ }
- public List<User> getAuthors() {
- return authors;
- }
+ public List<User> getAuthors() {
+ return authors;
+ }
- public String getContent() {
- return content;
- }
+ public String getContent() {
+ return content;
+ }
- public AccessRights getContentRights() {
- return contentRights;
- }
+ public AccessRights getContentRights() {
+ return contentRights;
+ }
- public Double getCurrentUserRate() {
- return currentUserRate;
- }
+ public Double getCurrentUserRate() {
+ return currentUserRate;
+ }
- public String getDocumentId() {
- return documentId;
- }
+ public String getDocumentId() {
+ return documentId;
+ }
- public BasicMimeType getMimeType() {
- return mimeType;
- }
+ public boolean getIsParticipant() {
+ return isParticipant;
+ }
- public Date getPublishedOn() {
- return publishedOn;
- }
+ public BasicMimeType getMimeType() {
+ return mimeType;
+ }
- public Double getRate() {
- return rate;
- }
+ public Date getPublishedOn() {
+ return publishedOn;
+ }
- public Integer getRateByUsers() {
- return rateByUsers;
- }
+ public Double getRate() {
+ return rate;
+ }
- public ContentStatus getStatus() {
- return status;
- }
+ public Integer getRateByUsers() {
+ return rateByUsers;
+ }
- public String getTags() {
- return tags;
- }
+ public ContentStatus getStatus() {
+ return status;
+ }
- public int getVersion() {
- return version;
- }
+ public String getTags() {
+ return tags;
+ }
- public String getWaveRef() {
- return waveRef;
- }
+ public int getVersion() {
+ return version;
+ }
- public boolean isParticipant() {
- return isParticipant;
- }
+ public String getWaveRef() {
+ return waveRef;
+ }
- public boolean isWave() {
- return waveRef != null;
- }
+ public boolean isParticipant() {
+ return isParticipant;
+ }
- public void setAuthors(final List<User> authors) {
- this.authors = authors;
- }
+ public boolean isWave() {
+ return waveRef != null;
+ }
- public void setContent(final String content) {
- this.content = content;
- }
+ public void setAuthors(final List<User> authors) {
+ this.authors = authors;
+ }
- public void setContentRights(final AccessRights contentRights) {
- this.contentRights = contentRights;
- }
+ public void setContent(final String content) {
+ this.content = content;
+ }
- public void setCurrentUserRate(final Double currentUserRate) {
- this.currentUserRate = currentUserRate;
- }
+ public void setContentRights(final AccessRights contentRights) {
+ this.contentRights = contentRights;
+ }
- public void setDocumentId(final String documentId) {
- this.documentId = documentId;
- }
+ public void setCurrentUserRate(final Double currentUserRate) {
+ this.currentUserRate = currentUserRate;
+ }
- void setIsParticipant(final boolean isParticipant) {
- this.isParticipant = isParticipant;
- }
+ public void setDocumentId(final String documentId) {
+ this.documentId = documentId;
+ }
- public void setMimeType(final BasicMimeType mimeType) {
- this.mimeType = mimeType;
- }
+ public void setIsParticipant(final boolean isParticipant) {
+ this.isParticipant = isParticipant;
+ }
- public void setPublishedOn(final Date publishedOn) {
- this.publishedOn = publishedOn;
- }
+ public void setMimeType(final BasicMimeType mimeType) {
+ this.mimeType = mimeType;
+ }
- public void setRate(final Double rate) {
- this.rate = rate;
- }
+ public void setPublishedOn(final Date publishedOn) {
+ this.publishedOn = publishedOn;
+ }
- public void setRateByUsers(final Integer rateByUsers) {
- this.rateByUsers = rateByUsers;
- }
+ public void setRate(final Double rate) {
+ this.rate = rate;
+ }
- public void setStatus(final ContentStatus status) {
- this.status = status;
- }
+ public void setRateByUsers(final Integer rateByUsers) {
+ this.rateByUsers = rateByUsers;
+ }
- public void setTags(final String tags) {
- this.tags = tags;
- }
+ public void setStatus(final ContentStatus status) {
+ this.status = status;
+ }
- public void setVersion(final int version) {
- this.version = version;
- }
+ public void setTags(final String tags) {
+ this.tags = tags;
+ }
- public void setWaveRef(final String waveRef) {
- this.waveRef = waveRef;
- }
+ public void setVersion(final int version) {
+ this.version = version;
+ }
- @Override
- public String toString() {
- return "State[" + getStateToken() + "/" + getTypeId() + (mimeType != null ? "-" + mimeType : "") + "]";
- }
+ public void setWaveRef(final String waveRef) {
+ this.waveRef = waveRef;
+ }
+ @Override
+ public String toString() {
+ return "State[" + getStateToken() + "/" + getTypeId() + (mimeType != null ? "-" + mimeType : "")
+ + "]";
+ }
+
}
Modified: trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -44,123 +44,125 @@
@Singleton
public class StateServiceDefault implements StateService {
- private final ContentManager contentManager;
- private final GroupManager groupManager;
- private final I18nTranslationService i18n;
- private final KuneWaveManager kuneWaveManager;
- private final AccessRightsService rightsService;
- private final SocialNetworkManager socialNetworkManager;
- private final TagUserContentManager tagManager;
+ private final ContentManager contentManager;
+ private final GroupManager groupManager;
+ private final I18nTranslationService i18n;
+ private final KuneWaveManager kuneWaveManager;
+ private final AccessRightsService rightsService;
+ private final SocialNetworkManager socialNetworkManager;
+ private final TagUserContentManager tagManager;
- @Inject
- public StateServiceDefault(final GroupManager groupManager, final SocialNetworkManager socialNetworkManager,
- final ContentManager contentManager, final TagUserContentManager tagManager,
- final AccessRightsService rightsService, final I18nTranslationService i18n,
- final KuneWaveManager kuneWaveManager) {
- this.groupManager = groupManager;
- this.socialNetworkManager = socialNetworkManager;
- this.contentManager = contentManager;
- this.tagManager = tagManager;
- this.rightsService = rightsService;
- this.i18n = i18n;
- this.kuneWaveManager = kuneWaveManager;
- }
+ @Inject
+ public StateServiceDefault(final GroupManager groupManager,
+ final SocialNetworkManager socialNetworkManager, final ContentManager contentManager,
+ final TagUserContentManager tagManager, final AccessRightsService rightsService,
+ final I18nTranslationService i18n, final KuneWaveManager kuneWaveManager) {
+ this.groupManager = groupManager;
+ this.socialNetworkManager = socialNetworkManager;
+ this.contentManager = contentManager;
+ this.tagManager = tagManager;
+ this.rightsService = rightsService;
+ this.i18n = i18n;
+ this.kuneWaveManager = kuneWaveManager;
+ }
- private Container calculateRootContainer(final Container container) {
- return container.isRoot() ? container : container.getAbsolutePath().get(0);
- }
+ private Container calculateRootContainer(final Container container) {
+ return container.isRoot() ? container : container.getAbsolutePath().get(0);
+ }
- @Override
- public StateContainer create(final User userLogged, final Container container) {
- final StateContainer state = new StateContainer();
- state.setTitle(container.getName());
- state.setTypeId(container.getTypeId());
- state.setLanguage(container.getLanguage());
- state.setStateToken(container.getStateToken());
- state.setRootContainer(calculateRootContainer(container));
- state.setLicense(container.getOwner().getDefaultLicense());
- state.setAccessLists(container.getAccessLists());
- final Group group = container.getOwner();
- setCommon(state, userLogged, group, container);
- return state;
- }
+ @Override
+ public StateContainer create(final User userLogged, final Container container) {
+ final StateContainer state = new StateContainer();
+ state.setTitle(container.getName());
+ state.setTypeId(container.getTypeId());
+ state.setLanguage(container.getLanguage());
+ state.setStateToken(container.getStateToken());
+ state.setRootContainer(calculateRootContainer(container));
+ state.setLicense(container.getOwner().getDefaultLicense());
+ state.setAccessLists(container.getAccessLists());
+ final Group group = container.getOwner();
+ setCommon(state, userLogged, group, container);
+ return state;
+ }
- @Override
- public StateContent create(final User userLogged, final Content content) {
- final StateContent state = new StateContent();
- final String typeId = content.getTypeId();
- state.setTypeId(typeId);
- state.setMimeType(content.getMimeType());
- state.setDocumentId(content.getId().toString());
- state.setLanguage(content.getLanguage());
- state.setPublishedOn(content.getPublishedOn());
- state.setAuthors(content.getAuthors());
- state.setTags(tagManager.getTagsAsString(userLogged, content));
- state.setStatus(content.getStatus());
- state.setStateToken(content.getStateToken());
- final Revision revision = content.getLastRevision();
- state.setVersion(content.getVersion());
- final char[] text = revision.getBody();
- final String textBody = text == null ? null : new String(text);
- if (content.isWave()) {
- state.setWaveRef(textBody);
- try {
- final Wavelet wavelet = kuneWaveManager.fetchWavelet(
- JavaWaverefEncoder.decodeWaveRefFromPath(textBody), content.getAuthors().get(0).getShortName());
- state.setContent(wavelet.getRootBlip().getContent());
- state.setTitle(wavelet.getTitle());
- state.setIsParticipant(kuneWaveManager.isParticipant(wavelet, userLogged.getShortName()));
- } catch (final InvalidWaveRefException e) {
- throw new DefaultException("Error retriving Wave");
- }
- } else {
- state.setContent(textBody);
- state.setTitle(revision.getTitle());
- }
- final Container container = content.getContainer();
- state.setRootContainer(calculateRootContainer(container));
- final License license = content.getLicense();
- final Group group = container.getOwner();
- state.setLicense(license == null ? group.getDefaultLicense() : license);
- state.setContentRights(rightsService.get(userLogged, content.getAccessLists()));
- state.setAccessLists(content.getAccessLists());
- setCommon(state, userLogged, group, container);
- if (userLogged != User.UNKNOWN_USER) {
- state.setCurrentUserRate(contentManager.getRateContent(userLogged, content));
- }
- // FIXME: user RateResult
- final Double rateAvg = contentManager.getRateAvg(content);
- state.setRate(rateAvg != null ? rateAvg : 0D);
- final Long rateByUsers = contentManager.getRateByUsers(content);
- state.setRateByUsers(rateByUsers != null ? rateByUsers.intValue() : 0);
- return state;
+ @Override
+ public StateContent create(final User userLogged, final Content content) {
+ final StateContent state = new StateContent();
+ final String typeId = content.getTypeId();
+ state.setTypeId(typeId);
+ state.setMimeType(content.getMimeType());
+ state.setDocumentId(content.getId().toString());
+ state.setLanguage(content.getLanguage());
+ state.setPublishedOn(content.getPublishedOn());
+ state.setAuthors(content.getAuthors());
+ state.setTags(tagManager.getTagsAsString(userLogged, content));
+ state.setStatus(content.getStatus());
+ state.setStateToken(content.getStateToken());
+ final Revision revision = content.getLastRevision();
+ state.setVersion(content.getVersion());
+ final char[] text = revision.getBody();
+ final String textBody = text == null ? null : new String(text);
+ if (content.isWave()) {
+ state.setWaveRef(textBody);
+ try {
+ final Wavelet wavelet = kuneWaveManager.fetchWavelet(
+ JavaWaverefEncoder.decodeWaveRefFromPath(textBody),
+ content.getAuthors().get(0).getShortName());
+ state.setContent(wavelet.getRootBlip().getContent());
+ state.setTitle(wavelet.getTitle());
+ state.setIsParticipant(userLogged != User.UNKNOWN_USER ? kuneWaveManager.isParticipant(wavelet,
+ userLogged.getShortName()) : false);
+ } catch (final InvalidWaveRefException e) {
+ throw new DefaultException("Error retriving Wave");
+ }
+ } else {
+ state.setContent(textBody);
+ state.setTitle(revision.getTitle());
}
-
- @Override
- public StateNoContent createNoHome(final User userLogged, final String groupShortName) {
- final Group group = groupManager.findByShortName(groupShortName);
- assert (group.isPersonal());
- final StateNoContent state = new StateNoContent();
- state.setGroup(group);
- state.setEnabledTools(groupManager.findEnabledTools(group.getId()));
- setSocialNetwork(state, userLogged, group);
- state.setStateToken(group.getStateToken());
- state.setTitle("<h2>" + i18n.t("This user does not have a homepage") + "</h2>");
- return state;
+ final Container container = content.getContainer();
+ state.setRootContainer(calculateRootContainer(container));
+ final License license = content.getLicense();
+ final Group group = container.getOwner();
+ state.setLicense(license == null ? group.getDefaultLicense() : license);
+ state.setContentRights(rightsService.get(userLogged, content.getAccessLists()));
+ state.setAccessLists(content.getAccessLists());
+ setCommon(state, userLogged, group, container);
+ if (userLogged != User.UNKNOWN_USER) {
+ state.setCurrentUserRate(contentManager.getRateContent(userLogged, content));
}
+ // FIXME: user RateResult
+ final Double rateAvg = contentManager.getRateAvg(content);
+ state.setRate(rateAvg != null ? rateAvg : 0D);
+ final Long rateByUsers = contentManager.getRateByUsers(content);
+ state.setRateByUsers(rateByUsers != null ? rateByUsers.intValue() : 0);
+ return state;
+ }
- private void setCommon(final StateContainer state, final User userLogged, final Group group,
- final Container container) {
- state.setToolName(container.getToolName());
- state.setGroup(group);
- state.setContainer(container);
- state.setContainerRights(rightsService.get(userLogged, container.getAccessLists()));
- state.setEnabledTools(groupManager.findEnabledTools(group.getId()));
- state.setTagCloudResult(tagManager.getTagCloudResultByGroup(group));
- setSocialNetwork(state, userLogged, group);
- }
+ @Override
+ public StateNoContent createNoHome(final User userLogged, final String groupShortName) {
+ final Group group = groupManager.findByShortName(groupShortName);
+ assert (group.isPersonal());
+ final StateNoContent state = new StateNoContent();
+ state.setGroup(group);
+ state.setEnabledTools(groupManager.findEnabledTools(group.getId()));
+ setSocialNetwork(state, userLogged, group);
+ state.setStateToken(group.getStateToken());
+ state.setTitle("<h2>" + i18n.t("This user does not have a homepage") + "</h2>");
+ return state;
+ }
- private void setSocialNetwork(final StateAbstract state, final User userLogged, final Group group) {
- state.setSocialNetworkData(socialNetworkManager.getSocialNetworkData(userLogged, group));
- }
+ private void setCommon(final StateContainer state, final User userLogged, final Group group,
+ final Container container) {
+ state.setToolName(container.getToolName());
+ state.setGroup(group);
+ state.setContainer(container);
+ state.setContainerRights(rightsService.get(userLogged, container.getAccessLists()));
+ state.setEnabledTools(groupManager.findEnabledTools(group.getId()));
+ state.setTagCloudResult(tagManager.getTagCloudResultByGroup(group));
+ setSocialNetwork(state, userLogged, group);
+ }
+
+ private void setSocialNetwork(final StateAbstract state, final User userLogged, final Group group) {
+ state.setSocialNetworkData(socialNetworkManager.getSocialNetworkData(userLogged, group));
+ }
}
Modified: trunk/src/main/java/cc/kune/core/shared/dto/StateContentDTO.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/dto/StateContentDTO.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/core/shared/dto/StateContentDTO.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -30,145 +30,154 @@
public class StateContentDTO extends StateContainerDTO implements IsSerializable, HasContent {
- private List<UserSimpleDTO> authors;
- private String content;
- private AccessRights contentRights;
- private Double currentUserRate;
- private String documentId;
- private boolean isParticipant;
- private BasicMimeTypeDTO mimeType;
- private Date publishedOn;
- private Double rate;
- private Integer rateByUsers;
- private ContentStatus status;
- private String tags;
- private int version;
- private String waveRef;
+ private List<UserSimpleDTO> authors;
+ private String content;
+ private AccessRights contentRights;
+ private Double currentUserRate;
+ private String documentId;
+ private boolean isParticipant;
+ private BasicMimeTypeDTO mimeType;
+ private Date publishedOn;
+ private Double rate;
+ private Integer rateByUsers;
+ private ContentStatus status;
+ private String tags;
+ private int version;
+ private String waveRef;
- public StateContentDTO() {
- }
+ public StateContentDTO() {
+ }
- public List<UserSimpleDTO> getAuthors() {
- return authors;
- }
+ public List<UserSimpleDTO> getAuthors() {
+ return authors;
+ }
- public String getContent() {
- return content;
- }
+ public String getContent() {
+ return content;
+ }
- public AccessRights getContentRights() {
- return contentRights;
- }
+ public AccessRights getContentRights() {
+ return contentRights;
+ }
- public Double getCurrentUserRate() {
- return currentUserRate;
- }
+ public Double getCurrentUserRate() {
+ return currentUserRate;
+ }
- public String getDocumentId() {
- return documentId;
- }
+ public String getDocumentId() {
+ return documentId;
+ }
- public BasicMimeTypeDTO getMimeType() {
- return mimeType;
- }
+ public boolean getIsParticipant() {
+ return isParticipant;
+ }
- public Date getPublishedOn() {
- return publishedOn;
- }
+ public BasicMimeTypeDTO getMimeType() {
+ return mimeType;
+ }
- public Double getRate() {
- return rate;
- }
+ public Date getPublishedOn() {
+ return publishedOn;
+ }
- public Integer getRateByUsers() {
- return rateByUsers;
- }
+ public Double getRate() {
+ return rate;
+ }
- public ContentStatus getStatus() {
- return status;
- }
+ public Integer getRateByUsers() {
+ return rateByUsers;
+ }
- public String getTags() {
- return tags;
- }
+ public ContentStatus getStatus() {
+ return status;
+ }
- public int getVersion() {
- return version;
- }
+ public String getTags() {
+ return tags;
+ }
- public String getWaveRef() {
- return waveRef;
- }
+ public int getVersion() {
+ return version;
+ }
- public boolean isParticipant() {
- return isParticipant;
- }
+ public String getWaveRef() {
+ return waveRef;
+ }
- public void setAuthors(final List<UserSimpleDTO> authors) {
- this.authors = authors;
- }
+ public boolean isParticipant() {
+ return isParticipant;
+ }
- public void setContent(final String content) {
- this.content = content;
- }
+ public boolean isWave() {
+ return waveRef != null;
+ }
- public void setContentRights(final AccessRights contentRights) {
- this.contentRights = contentRights;
- }
+ public void setAuthors(final List<UserSimpleDTO> authors) {
+ this.authors = authors;
+ }
- public void setCurrentUserRate(final Double currentUserRate) {
- this.currentUserRate = currentUserRate;
- }
+ public void setContent(final String content) {
+ this.content = content;
+ }
- public void setDocumentId(final String documentId) {
- this.documentId = documentId;
- }
+ public void setContentRights(final AccessRights contentRights) {
+ this.contentRights = contentRights;
+ }
- void setIsParticipant(final boolean isParticipant) {
- this.isParticipant = isParticipant;
- }
+ public void setCurrentUserRate(final Double currentUserRate) {
+ this.currentUserRate = currentUserRate;
+ }
- public void setMimeType(final BasicMimeTypeDTO mimeType) {
- this.mimeType = mimeType;
- }
+ public void setDocumentId(final String documentId) {
+ this.documentId = documentId;
+ }
- public void setPublishedOn(final Date publishedOn) {
- this.publishedOn = publishedOn;
- }
+ public void setIsParticipant(final boolean isParticipant) {
+ this.isParticipant = isParticipant;
+ }
- public void setRate(final Double rate) {
- this.rate = rate;
- }
+ public void setMimeType(final BasicMimeTypeDTO mimeType) {
+ this.mimeType = mimeType;
+ }
- public void setRate(final RateResult result) {
- setRate(result.getRate());
- setRateByUsers(result.getRateByUsers());
- setCurrentUserRate(result.getCurrentUserRate());
- }
+ public void setPublishedOn(final Date publishedOn) {
+ this.publishedOn = publishedOn;
+ }
- public void setRateByUsers(final Integer rateByUsers) {
- this.rateByUsers = rateByUsers;
- }
+ public void setRate(final Double rate) {
+ this.rate = rate;
+ }
- public void setStatus(final ContentStatus status) {
- this.status = status;
- }
+ public void setRate(final RateResult result) {
+ setRate(result.getRate());
+ setRateByUsers(result.getRateByUsers());
+ setCurrentUserRate(result.getCurrentUserRate());
+ }
- public void setTags(final String tags) {
- this.tags = tags;
- }
+ public void setRateByUsers(final Integer rateByUsers) {
+ this.rateByUsers = rateByUsers;
+ }
- public void setVersion(final int version) {
- this.version = version;
- }
+ public void setStatus(final ContentStatus status) {
+ this.status = status;
+ }
- public void setWaveRef(final String waveRef) {
- this.waveRef = waveRef;
- }
+ public void setTags(final String tags) {
+ this.tags = tags;
+ }
- @Override
- public String toString() {
- return "StateDTO[" + getStateToken() + "/" + getTypeId() + (mimeType != null ? "-" + mimeType : "") + "]";
- }
+ public void setVersion(final int version) {
+ this.version = version;
+ }
+ public void setWaveRef(final String waveRef) {
+ this.waveRef = waveRef;
+ }
+
+ @Override
+ public String toString() {
+ return "StateDTO[" + getStateToken() + "/" + getTypeId() + (mimeType != null ? "-" + mimeType : "")
+ + "]";
+ }
+
}
Modified: trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -40,39 +40,38 @@
public class DocsClientActions extends AbstractFoldableToolActions {
- final String[] all = { TYPE_ROOT, TYPE_FOLDER, TYPE_DOCUMENT, TYPE_UPLOADEDFILE };
- final String[] containers = { TYPE_ROOT, TYPE_FOLDER };
- final String[] containersNoRoot = { TYPE_FOLDER };
- final String[] contents = { TYPE_DOCUMENT, TYPE_UPLOADEDFILE };
- final String[] contentsModerated = { TYPE_DOCUMENT, TYPE_UPLOADEDFILE };
+ final String[] all = { TYPE_ROOT, TYPE_FOLDER, TYPE_DOCUMENT, TYPE_UPLOADEDFILE };
+ final String[] containers = { TYPE_ROOT, TYPE_FOLDER };
+ final String[] containersNoRoot = { TYPE_FOLDER };
+ final String[] contents = { TYPE_DOCUMENT, TYPE_UPLOADEDFILE };
+ final String[] contentsModerated = { TYPE_DOCUMENT, TYPE_UPLOADEDFILE };
- @Inject
- public DocsClientActions(final I18nUITranslationService i18n, final Session session,
- final StateManager stateManager, final ActionRegistryByType registry, final CoreResources res,
- final Provider<GoParentFolderBtn> folderGoUp, final Provider<NewDocBtn> newDocBtn,
- final Provider<NewFolderBtn> newFolderBtn, final Provider<OpenDocMenuItem> openContentMenuItem,
- final Provider<DelDocMenuItem> delContentMenuItem,
- final Provider<ContentViewerOptionsMenu> optionsMenuContent,
- final Provider<ParticipateInContentBtn> participateBtn,
- final Provider<DelFolderMenuItem> delFolderMenuItem, final Provider<RefreshContentMenuItem> refresh,
- final Provider<SetAsHomePageMenuItem> setAsHomePage) {
- super(session, stateManager, i18n, registry);
- actionsRegistry.addAction(ActionGroups.VIEW, optionsMenuContent, all);
- actionsRegistry.addAction(ActionGroups.VIEW, refresh, all);
- actionsRegistry.addAction(ActionGroups.VIEW, folderGoUp, contents);
- actionsRegistry.addAction(ActionGroups.VIEW, folderGoUp, containersNoRoot);
- actionsRegistry.addAction(ActionGroups.VIEW, newDocBtn, containers);
- actionsRegistry.addAction(ActionGroups.VIEW, participateBtn,
- contents);
- actionsRegistry.addAction(ActionGroups.VIEW, newFolderBtn, containers);
- actionsRegistry.addAction(ActionGroups.MENUITEM, openContentMenuItem, contents);
- actionsRegistry.addAction(ActionGroups.MENUITEM, openContentMenuItem, containersNoRoot);
- actionsRegistry.addAction(ActionGroups.MENUITEM, delContentMenuItem, contents);
- actionsRegistry.addAction(ActionGroups.MENUITEM, delFolderMenuItem, containersNoRoot);
- actionsRegistry.addAction(ActionGroups.MENUITEM, setAsHomePage, contents);
- }
+ @Inject
+ public DocsClientActions(final I18nUITranslationService i18n, final Session session,
+ final StateManager stateManager, final ActionRegistryByType registry, final CoreResources res,
+ final Provider<GoParentFolderBtn> folderGoUp, final Provider<NewDocBtn> newDocBtn,
+ final Provider<NewFolderBtn> newFolderBtn, final Provider<OpenDocMenuItem> openContentMenuItem,
+ final Provider<DelDocMenuItem> delContentMenuItem,
+ final Provider<ContentViewerOptionsMenu> optionsMenuContent,
+ final Provider<ParticipateInContentBtn> participateBtn,
+ final Provider<DelFolderMenuItem> delFolderMenuItem,
+ final Provider<RefreshContentMenuItem> refresh, final Provider<SetAsHomePageMenuItem> setAsHomePage) {
+ super(session, stateManager, i18n, registry);
+ actionsRegistry.addAction(ActionGroups.VIEW, optionsMenuContent, all);
+ actionsRegistry.addAction(ActionGroups.VIEW, refresh, all);
+ actionsRegistry.addAction(ActionGroups.VIEW, folderGoUp, contents);
+ actionsRegistry.addAction(ActionGroups.VIEW, folderGoUp, containersNoRoot);
+ actionsRegistry.addAction(ActionGroups.VIEW, newDocBtn, containers);
+ actionsRegistry.addAction(ActionGroups.VIEW, participateBtn, contents);
+ actionsRegistry.addAction(ActionGroups.VIEW, newFolderBtn, containers);
+ actionsRegistry.addAction(ActionGroups.MENUITEM, openContentMenuItem, contents);
+ actionsRegistry.addAction(ActionGroups.MENUITEM, openContentMenuItem, containersNoRoot);
+ actionsRegistry.addAction(ActionGroups.MENUITEM, delContentMenuItem, contents);
+ actionsRegistry.addAction(ActionGroups.MENUITEM, delFolderMenuItem, containersNoRoot);
+ actionsRegistry.addAction(ActionGroups.MENUITEM, setAsHomePage, contents);
+ }
- @Override
- protected void createPostSessionInitActions() {
- }
+ @Override
+ protected void createPostSessionInitActions() {
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/GoParentContainerBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/GoParentContainerBtn.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/GoParentContainerBtn.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -18,38 +18,39 @@
public class GoParentContainerBtn extends ButtonDescriptor {
- public static class GoParentContainerAction extends AbstractExtendedAction {
+ public static class GoParentContainerAction extends AbstractExtendedAction {
- private final Session session;
- private final StateManager stateManager;
+ private final Session session;
+ private final StateManager stateManager;
- @Inject
- public GoParentContainerAction(final Session session, final StateManager stateManager) {
- this.session = session;
- this.stateManager = stateManager;
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- NotifyUser.showProgress();
- StateToken stateToken;
- final StateAbstractDTO state = session.getCurrentState();
- if (state instanceof StateContentDTO) {
- stateToken = ((StateContentDTO) state).getContainer().getStateToken();
- } else {
- final ContainerDTO container = ((StateContainerDTO) state).getContainer();
- stateToken = container.getStateToken().copy().setFolder(container.getParentFolderId());
- }
- stateManager.gotoStateToken(stateToken);
- // NotifyUser.hideProgress();
- }
-
+ @Inject
+ public GoParentContainerAction(final Session session, final StateManager stateManager) {
+ this.session = session;
+ this.stateManager = stateManager;
}
- public GoParentContainerBtn(final I18nTranslationService i18n, final GoParentContainerAction action,
- final CoreResources res) {
- super(action);
- this.withToolTip(i18n.t("Go up: Open the container folder")).withIcon(res.folderGoUp()).withStyles("k-fl");
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ NotifyUser.showProgress();
+ StateToken stateToken;
+ final StateAbstractDTO state = session.getCurrentState();
+ if (state instanceof StateContentDTO) {
+ stateToken = ((StateContentDTO) state).getContainer().getStateToken();
+ } else {
+ final ContainerDTO container = ((StateContainerDTO) state).getContainer();
+ stateToken = container.getStateToken().copy().setFolder(container.getParentFolderId());
+ }
+ stateManager.gotoStateToken(stateToken);
+ // NotifyUser.hideProgress();
}
+ }
+
+ public GoParentContainerBtn(final I18nTranslationService i18n, final GoParentContainerAction action,
+ final CoreResources res) {
+ super(action);
+ this.withToolTip(i18n.t("Go up: Open the container folder")).withIcon(res.folderGoUp()).withStyles(
+ "k-btn-min, k-fl");
+ }
+
}
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -21,44 +21,45 @@
public class ParticipateInContentBtn extends ButtonDescriptor {
- public static class ParticipateInContentAction extends RolAction {
+ public static class ParticipateInContentAction extends RolAction {
- private final Provider<ContentServiceAsync> contentService;
- private final Session session;
- private final StateManager stateManager;
+ private final Provider<ContentServiceAsync> contentService;
+ private final Session session;
+ private final StateManager stateManager;
- @Inject
- public ParticipateInContentAction(final Session session, final StateManager stateManager,
- final I18nTranslationService i18n, final Provider<ContentServiceAsync> contentService) {
- super(AccessRolDTO.Editor, true);
- this.session = session;
- this.stateManager = stateManager;
- this.contentService = contentService;
- }
+ @Inject
+ public ParticipateInContentAction(final Session session, final StateManager stateManager,
+ final I18nTranslationService i18n, final Provider<ContentServiceAsync> contentService) {
+ super(AccessRolDTO.Editor, true);
+ this.session = session;
+ this.stateManager = stateManager;
+ this.contentService = contentService;
+ }
- @Override
- public void actionPerformed(final ActionEvent event) {
- NotifyUser.showProgressProcessing();
- stateManager.gotoStateToken(((HasContent) session.getCurrentState()).getContainer().getStateToken());
- contentService.get().addParticipant(session.getUserHash(), session.getCurrentStateToken(),
- session.getCurrentUser().getShortName(), new AsyncCallbackSimple<Void>() {
- @Override
- public void onSuccess(final Void arg) {
- NotifyUser.hideProgress();
- }
- });
- }
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ NotifyUser.showProgressProcessing();
+ stateManager.gotoStateToken(((HasContent) session.getCurrentState()).getContainer().getStateToken());
+ contentService.get().addParticipant(session.getUserHash(), session.getCurrentStateToken(),
+ session.getCurrentUser().getShortName(), new AsyncCallbackSimple<Void>() {
+ @Override
+ public void onSuccess(final Void arg) {
+ NotifyUser.hideProgress();
+ }
+ });
}
+ }
- @Inject
- public ParticipateInContentBtn(final I18nTranslationService i18n, final ParticipateInContentAction action,
- final IsLoggedCondition isLogged, final IsCurrentStateEditableCondition isEditable,
- final IsNotParticipantOfCurrentStateCondition isNotParticipant, final CoreResources res) {
- super(action);
- this.withText(i18n.t("Participate")).withToolTip("Participate in the edition of this page").withIcon(
- res.contentEdit()).withStyles("k-def-docbtn, k-fl");
- super.add(isLogged);
- super.add(isEditable);
- super.add(isNotParticipant);
- }
+ @Inject
+ public ParticipateInContentBtn(final I18nTranslationService i18n,
+ final ParticipateInContentAction action, final IsLoggedCondition isLogged,
+ final IsCurrentStateEditableCondition isEditable,
+ final IsNotParticipantOfCurrentStateCondition isNotParticipant, final CoreResources res) {
+ super(action);
+ this.withText(i18n.t("Edit")).withToolTip("Participate in the edition of this page").withIcon(
+ res.contentEdit()).withStyles("k-def-docbtn, k-fl");
+ super.add(isLogged);
+ super.add(isEditable);
+ super.add(isNotParticipant);
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -7,7 +7,6 @@
import org.waveprotocol.box.webclient.client.StagesProvider;
import org.waveprotocol.box.webclient.client.WaveWebSocketClient;
import org.waveprotocol.box.webclient.search.WaveStore;
-import org.waveprotocol.box.webclient.widget.frame.FramedPanel;
import org.waveprotocol.box.webclient.widget.loading.LoadingIndicator;
import org.waveprotocol.wave.client.account.ProfileManager;
import org.waveprotocol.wave.client.account.impl.ProfileManagerImpl;
@@ -44,147 +43,141 @@
import com.gwtplatform.mvp.client.ViewImpl;
public class DocViewerPanel extends ViewImpl implements DocViewerView {
- interface DocsViewerPanelUiBinder extends UiBinder<Widget, DocViewerPanel> {
- }
+ interface DocsViewerPanelUiBinder extends UiBinder<Widget, DocViewerPanel> {
+ }
- private static DocsViewerPanelUiBinder uiBinder = GWT.create(DocsViewerPanelUiBinder.class);
+ private static DocsViewerPanelUiBinder uiBinder = GWT.create(DocsViewerPanelUiBinder.class);
- private final ContentCapabilitiesRegistry capabilitiesRegistry;
- private RemoteViewServiceMultiplexer channel;
- private final ContentTitleWidget contentTitle;
- @UiField
- DeckPanel deck;
- private final GSpaceArmor gsArmor;
- private IdGenerator idGenerator;
- private final Element loading = new LoadingIndicator().getElement();
- @UiField
- InlineHTML onlyViewPanel;
- private ProfileManager profiles;
- /** The wave panel, if a wave is open. */
- private StagesProvider wave;
- @UiField
- FramedPanel waveFrame;
- @UiField
- ImplPanel waveHolder;
- private final WaveStore waveStore = new SimpleWaveStore();
+ private final ContentCapabilitiesRegistry capabilitiesRegistry;
+ private RemoteViewServiceMultiplexer channel;
+ private final ContentTitleWidget contentTitle;
+ @UiField
+ DeckPanel deck;
+ private final GSpaceArmor gsArmor;
+ private IdGenerator idGenerator;
+ private final Element loading = new LoadingIndicator().getElement();
+ @UiField
+ InlineHTML onlyViewPanel;
+ private ProfileManager profiles;
+ /** The wave panel, if a wave is open. */
+ private StagesProvider wave;
+ @UiField
+ ImplPanel waveHolder;
+ private final WaveStore waveStore = new SimpleWaveStore();
- private final Widget widget;
+ private final Widget widget;
- @Inject
- public DocViewerPanel(final GSpaceArmor wsArmor, final ContentCapabilitiesRegistry capabilitiesRegistry,
- final I18nTranslationService i18n) {
- this.gsArmor = wsArmor;
- this.capabilitiesRegistry = capabilitiesRegistry;
- widget = uiBinder.createAndBindUi(this);
- contentTitle = new ContentTitleWidget(i18n, gsArmor, capabilitiesRegistry.getIconsRegistry());
- }
+ @Inject
+ public DocViewerPanel(final GSpaceArmor wsArmor,
+ final ContentCapabilitiesRegistry capabilitiesRegistry, final I18nTranslationService i18n) {
+ this.gsArmor = wsArmor;
+ this.capabilitiesRegistry = capabilitiesRegistry;
+ widget = uiBinder.createAndBindUi(this);
+ contentTitle = new ContentTitleWidget(i18n, gsArmor, capabilitiesRegistry.getIconsRegistry());
+ }
- @Override
- public Widget asWidget() {
- return widget;
- }
+ @Override
+ public Widget asWidget() {
+ return widget;
+ }
- @Override
- public void attach() {
- final ForIsWidget docContainer = gsArmor.getDocContainer();
- docContainer.add(widget);
- }
+ @Override
+ public void attach() {
+ final ForIsWidget docContainer = gsArmor.getDocContainer();
+ docContainer.add(widget);
+ }
- @Override
- public void clear() {
- onlyViewPanel.setHTML("");
- gsArmor.getSubheaderToolbar().clear();
- UiUtils.clear(gsArmor.getDocContainer());
- UiUtils.clear(gsArmor.getDocHeader());
- }
+ @Override
+ public void clear() {
+ onlyViewPanel.setHTML("");
+ gsArmor.getSubheaderToolbar().clear();
+ UiUtils.clear(gsArmor.getDocContainer());
+ UiUtils.clear(gsArmor.getDocHeader());
+ }
- @Override
- public void detach() {
- clear();
- }
+ @Override
+ public void detach() {
+ clear();
+ }
- @Override
- public HasEditHandler getEditTitle() {
- return contentTitle.getEditableTitle();
- }
+ @Override
+ public HasEditHandler getEditTitle() {
+ return contentTitle.getEditableTitle();
+ }
- private WaveRef getWaveRef(final String waveRefS) {
- try {
- return GwtWaverefEncoder.decodeWaveRefFromPath(waveRefS);
- } catch (final InvalidWaveRefException e) {
- throw new UIException("Invalid waveref: " + waveRefS);
- }
+ private WaveRef getWaveRef(final String waveRefS) {
+ try {
+ return GwtWaverefEncoder.decodeWaveRefFromPath(waveRefS);
+ } catch (final InvalidWaveRefException e) {
+ throw new UIException("Invalid waveref: " + waveRefS);
}
+ }
- private void initWaveClientIfNeeded() {
- if (channel == null) {
- final WaveWebSocketClient webSocket = new WaveWebSocketClient(WebClient.useSocketIO(),
- WebClient.getWebSocketBaseUrl(GWT.getModuleBaseURL()));
- webSocket.connect();
- channel = new RemoteViewServiceMultiplexer(webSocket,
- new ParticipantId(Session.get().getAddress()).getAddress());
- profiles = new ProfileManagerImpl(Session.get().getDomain());
- idGenerator = ClientIdGenerator.create();
- }
+ private void initWaveClientIfNeeded() {
+ if (channel == null) {
+ final WaveWebSocketClient webSocket = new WaveWebSocketClient(WebClient.useSocketIO(),
+ WebClient.getWebSocketBaseUrl(GWT.getModuleBaseURL()));
+ webSocket.connect();
+ channel = new RemoteViewServiceMultiplexer(webSocket,
+ new ParticipantId(Session.get().getAddress()).getAddress());
+ profiles = new ProfileManagerImpl(Session.get().getDomain());
+ idGenerator = ClientIdGenerator.create();
}
+ }
- @Override
- public void setActions(final GuiActionDescCollection actions) {
- gsArmor.getSubheaderToolbar().clear();
- gsArmor.getSubheaderToolbar().addAll(actions);
- }
+ @Override
+ public void setActions(final GuiActionDescCollection actions) {
+ gsArmor.getSubheaderToolbar().clear();
+ gsArmor.getSubheaderToolbar().addAll(actions);
+ }
- @Override
- public void setContent(final StateContentDTO state) {
- final boolean editable = state.getContentRights().isEditable();
- setTitle(state, editable);
- onlyViewPanel.setHTML(SafeHtmlUtils.fromTrustedString(state.getContent()));
- deck.showWidget(1);
- }
+ @Override
+ public void setContent(final StateContentDTO state) {
+ final boolean editable = state.getContentRights().isEditable();
+ setTitle(state, editable);
+ onlyViewPanel.setHTML(SafeHtmlUtils.fromTrustedString(state.getContent()));
+ deck.showWidget(1);
+ }
- @Override
- public void setEditableContent(final StateContentDTO state) {
- setTitle(state, true);
- initWaveClientIfNeeded();
- setEditableWaveContent(state.getWaveRef(), false);
- deck.showWidget(0);
- // waveHolder.clear();
- // waveHolder.add(new Label(state.getContent()
- // + " (but here goes the Wave editor -we are testing it-)"));
- // onlyViewPanel.setHTML(SafeHtmlUtils.fromTrustedString(state.getContent()));
- }
+ @Override
+ public void setEditableContent(final StateContentDTO state) {
+ setTitle(state, true);
+ initWaveClientIfNeeded();
+ setEditableWaveContent(state.getWaveRef(), false);
+ deck.showWidget(0);
+ }
- @Override
- public void setEditableTitle(final String title) {
- contentTitle.setText(title);
- }
+ @Override
+ public void setEditableTitle(final String title) {
+ contentTitle.setText(title);
+ }
- private void setEditableWaveContent(final String waveRefS, final boolean isNewWave) {
- final WaveRef waveRef = getWaveRef(waveRefS);
+ private void setEditableWaveContent(final String waveRefS, final boolean isNewWave) {
+ final WaveRef waveRef = getWaveRef(waveRefS);
- if (wave != null) {
- wave.destroy();
- wave = null;
- }
-
- // Release the display:none.
- // UIObject.setVisible(waveFrame.getElement(), true);
- waveHolder.getElement().appendChild(loading);
- final Element holder = waveHolder.getElement().appendChild(Document.get().createDivElement());
- final StagesProvider wave = new StagesProvider(holder, waveHolder, waveRef, channel, idGenerator, profiles,
- waveStore, isNewWave);
- this.wave = wave;
- wave.load(new Command() {
- @Override
- public void execute() {
- loading.removeFromParent();
- }
- });
+ if (wave != null) {
+ wave.destroy();
+ wave = null;
}
- private void setTitle(final StateContentDTO state, final boolean editable) {
- contentTitle.setTitle(state.getTitle(), state.getTypeId(), state.getMimeType(), editable
- && capabilitiesRegistry.isRenamable(state.getTypeId()));
- }
+ // Release the display:none.
+ // UIObject.setVisible(waveFrame.getElement(), true);
+ waveHolder.getElement().appendChild(loading);
+ final Element holder = waveHolder.getElement().appendChild(Document.get().createDivElement());
+ final StagesProvider wave = new StagesProvider(holder, waveHolder, waveRef, channel, idGenerator,
+ profiles, waveStore, isNewWave);
+ this.wave = wave;
+ wave.load(new Command() {
+ @Override
+ public void execute() {
+ loading.removeFromParent();
+ }
+ });
+ }
+ private void setTitle(final StateContentDTO state, final boolean editable) {
+ contentTitle.setTitle(state.getTitle(), state.getTypeId(), state.getMimeType(), editable
+ && capabilitiesRegistry.isRenamable(state.getTypeId()));
+ }
+
}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.ui.xml 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPanel.ui.xml 2011-05-03 11:29:33 UTC (rev 1335)
@@ -4,23 +4,25 @@
xmlns:w='urn:import:org.waveprotocol.wave.client.widget.common'>
<ui:style>
.wavePanel {
- margin: 0 0 0 0;
+ margin: 0 0 0 0;
}
.waveHolder {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
}
+
+ .viewonly {
+ margin: 5px;
+ }
</ui:style>
<g:HTMLPanel width="100%" height="100%">
<g:DeckPanel ui:field="deck" addStyleNames="k-doc-content-deck">
- <f:FramedPanel ui:field="waveFrame" addStyleNames="{style.wavePanel}">
- <w:ImplPanel ui:field="waveHolder" addStyleNames="{style.waveHolder}" />
- </f:FramedPanel>
- <g:InlineHTML ui:field="onlyViewPanel" />
+ <w:ImplPanel ui:field="waveHolder" addStyleNames="{style.waveHolder}" />
+ <g:InlineHTML ui:field="onlyViewPanel" styleName="{style.viewonly}" />
</g:DeckPanel>
</g:HTMLPanel>
</ui:UiBinder>
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/DocViewerPresenter.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -33,112 +33,117 @@
import com.gwtplatform.mvp.client.proxy.Proxy;
import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent;
-public class DocViewerPresenter extends Presenter<DocViewerPresenter.DocViewerView, DocViewerPresenter.DocViewerProxy>
- implements ContentViewer {
+public class DocViewerPresenter extends
+ Presenter<DocViewerPresenter.DocViewerView, DocViewerPresenter.DocViewerProxy> implements
+ ContentViewer {
- @ProxyCodeSplit
- public interface DocViewerProxy extends Proxy<DocViewerPresenter> {
- }
+ @ProxyCodeSplit
+ public interface DocViewerProxy extends Proxy<DocViewerPresenter> {
+ }
- public interface DocViewerView extends View {
+ public interface DocViewerView extends View {
- void attach();
+ void attach();
- void clear();
+ void clear();
- void detach();
+ void detach();
- HasEditHandler getEditTitle();
+ HasEditHandler getEditTitle();
- void setActions(GuiActionDescCollection actions);
+ void setActions(GuiActionDescCollection actions);
- void setContent(StateContentDTO state);
+ void setContent(StateContentDTO state);
- void setEditableContent(StateContentDTO state);
+ void setEditableContent(StateContentDTO state);
- void setEditableTitle(String title);
- }
+ void setEditableTitle(String title);
+ }
- private final ActionRegistryByType actionsRegistry;
- private HandlerRegistration editHandler;
- private final Provider<RenameAction> renameAction;
- private final Session session;
+ private final ActionRegistryByType actionsRegistry;
+ private HandlerRegistration editHandler;
+ private final Provider<RenameAction> renameAction;
+ private final Session session;
- @Inject
- public DocViewerPresenter(final EventBus eventBus, final DocViewerView view, final DocViewerProxy proxy,
- final Session session, final ContentViewerSelector viewerSelector,
- final ActionRegistryByType actionsRegistry, final DocsClientActions docsActions,
- final BlogsClientActions blogActions, final Provider<RenameAction> renameAction) {
- super(eventBus, view, proxy);
- this.session = session;
- this.actionsRegistry = actionsRegistry;
- this.renameAction = renameAction;
- viewerSelector.register(this, true, DocsConstants.TYPE_DOCUMENT);
- viewerSelector.register(this, true, BlogsConstants.TYPE_POST);
- }
+ @Inject
+ public DocViewerPresenter(final EventBus eventBus, final DocViewerView view,
+ final DocViewerProxy proxy, final Session session, final ContentViewerSelector viewerSelector,
+ final ActionRegistryByType actionsRegistry, final DocsClientActions docsActions,
+ final BlogsClientActions blogActions, final Provider<RenameAction> renameAction) {
+ super(eventBus, view, proxy);
+ this.session = session;
+ this.actionsRegistry = actionsRegistry;
+ this.renameAction = renameAction;
+ viewerSelector.register(this, true, DocsConstants.TYPE_DOCUMENT);
+ viewerSelector.register(this, true, BlogsConstants.TYPE_POST);
+ }
- @Override
- public void attach() {
- getView().attach();
- if (editHandler == null) {
- createEditHandler();
- }
+ @Override
+ public void attach() {
+ getView().attach();
+ if (editHandler == null) {
+ createEditHandler();
}
+ }
- private void createEditHandler() {
- editHandler = getView().getEditTitle().addEditHandler(new EditHandler() {
- @Override
- public void fire(final EditEvent event) {
- renameAction.get().rename(session.getCurrentStateToken(), session.getCurrentState().getTitle(),
- event.getText(), new RenameListener() {
- @Override
- public void onFail(final StateToken token, final String oldTitle) {
- getView().setEditableTitle(oldTitle);
- }
+ private void createEditHandler() {
+ editHandler = getView().getEditTitle().addEditHandler(new EditHandler() {
+ @Override
+ public void fire(final EditEvent event) {
+ renameAction.get().rename(session.getCurrentStateToken(), session.getCurrentState().getTitle(),
+ event.getText(), new RenameListener() {
+ @Override
+ public void onFail(final StateToken token, final String oldTitle) {
+ getView().setEditableTitle(oldTitle);
+ }
- @Override
- public void onSuccess(final StateToken token, final String title) {
- getView().setEditableTitle(title);
- }
- });
- }
- });
- }
+ @Override
+ public void onSuccess(final StateToken token, final String title) {
+ getView().setEditableTitle(title);
+ }
+ });
+ }
+ });
+ }
- @Override
- public void detach() {
- getView().detach();
- }
+ @Override
+ public void detach() {
+ getView().detach();
+ }
- @Override
- protected void revealInParent() {
- RevealRootContentEvent.fire(this, this);
- }
+ @Override
+ protected void revealInParent() {
+ RevealRootContentEvent.fire(this, this);
+ }
- @Override
- public void setContent(@Nonnull final HasContent state) {
- getView().clear();
- final StateContentDTO stateContent = (StateContentDTO) state;
- final AccessRights rights = stateContent.getContentRights();
- if (session.isLogged() && rights.isEditable()) {
- if (stateContent.isParticipant()) {
- // is already participant, show wave editor
- getView().setEditableContent(stateContent);
- } else {
- // add "participate" action
- getView().setContent(stateContent);
- }
+ @Override
+ public void setContent(@Nonnull final HasContent state) {
+ getView().clear();
+ final StateContentDTO stateContent = (StateContentDTO) state;
+ final AccessRights rights = stateContent.getContentRights();
+ if (session.isLogged() && rights.isEditable()) {
+ if (stateContent.isParticipant()) {
+ // is already participant, show wave editor
+ if (org.waveprotocol.box.webclient.client.Session.get().isLoggedIn()) {
+ getView().setEditableContent(stateContent);
} else {
- if (rights.isVisible()) {
- // Show contents
- getView().setContent(stateContent);
- } else {
- throw new UIException("Unexpected status in Viewer");
- }
+ getView().setContent(stateContent);
+ // When logged setEditable!
}
- final GuiActionDescCollection actions = actionsRegistry.getCurrentActions(stateContent.getGroup(),
- stateContent.getTypeId(), session.isLogged(), rights, ActionGroups.VIEW);
- getView().setActions(actions);
+ } else {
+ // add "participate" action
getView().setContent(stateContent);
+ }
+ } else {
+ if (rights.isVisible()) {
+ // Show contents
+ getView().setContent(stateContent);
+ } else {
+ throw new UIException("Unexpected status in Viewer");
+ }
}
+ final GuiActionDescCollection actions = actionsRegistry.getCurrentActions(stateContent.getGroup(),
+ stateContent.getTypeId(), session.isLogged(), rights, ActionGroups.VIEW);
+ getView().setActions(actions);
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -40,210 +40,212 @@
import com.google.wave.api.impl.WaveletData;
public class KuneWaveManagerDefault implements KuneWaveManager {
- public static final Log LOG = LogFactory.getLog(KuneWaveManagerDefault.class);
+ public static final Log LOG = LogFactory.getLog(KuneWaveManagerDefault.class);
- private static final String NO_TITLE = "";
+ private static final String NO_TITLE = "";
- private final ConversationUtil conversationUtil;
- private final EventDataConverterManager converterManager;
- private final String domain;
- private final OperationServiceRegistry operationRegistry;
- private final ParticipantUtils participantUtils;
- private final WaveletProvider waveletProvider;
+ private final ConversationUtil conversationUtil;
+ private final EventDataConverterManager converterManager;
+ private final String domain;
+ private final OperationServiceRegistry operationRegistry;
+ private final ParticipantUtils participantUtils;
+ private final WaveletProvider waveletProvider;
- @Inject
- public KuneWaveManagerDefault(final EventDataConverterManager converterManager,
- @Named("DataApiRegistry") final OperationServiceRegistry operationRegistry,
- final WaveletProvider waveletProvider, final ConversationUtil conversationUtil,
- final ParticipantUtils participantUtils, @Named(CoreSettings.WAVE_SERVER_DOMAIN) final String domain) {
- this.converterManager = converterManager;
- this.waveletProvider = waveletProvider;
- this.conversationUtil = conversationUtil;
- this.operationRegistry = operationRegistry;
- this.participantUtils = participantUtils;
- this.domain = domain;
+ @Inject
+ public KuneWaveManagerDefault(final EventDataConverterManager converterManager,
+ @Named("DataApiRegistry") final OperationServiceRegistry operationRegistry,
+ final WaveletProvider waveletProvider, final ConversationUtil conversationUtil,
+ final ParticipantUtils participantUtils,
+ @Named(CoreSettings.WAVE_SERVER_DOMAIN) final String domain) {
+ this.converterManager = converterManager;
+ this.waveletProvider = waveletProvider;
+ this.conversationUtil = conversationUtil;
+ this.operationRegistry = operationRegistry;
+ this.participantUtils = participantUtils;
+ this.domain = domain;
+ }
+
+ @Override
+ public void addParticipant(final WaveRef waveName, final String author, final String userWhoAdds,
+ final String participant) {
+ final Wavelet wavelet = fetchWavelet(waveName, author);
+ final String whoAdd = wavelet.getParticipants().contains(participantUtils.of(userWhoAdds)) ? userWhoAdds
+ : author;
+ final OperationQueue opQueue = new OperationQueue();
+ opQueue.addParticipantToWavelet(wavelet, participantUtils.of(participant).toString());
+ final OperationContextImpl context = new OperationContextImpl(waveletProvider,
+ converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);
+ final OperationRequest request = opQueue.getPendingOperations().get(0);
+ OperationUtil.executeOperation(request, operationRegistry, context, participantUtils.of(whoAdd));
+ final String reqId = request.getId();
+ final JsonRpcResponse response = context.getResponse(reqId);
+ if (response != null && response.isError()) {
+ onFailure(context.getResponse(reqId).getErrorMessage());
}
+ OperationUtil.submitDeltas(context, waveletProvider, new SubmitRequestListener() {
+ @Override
+ public void onFailure(final String arg0) {
+ KuneWaveManagerDefault.this.onFailure("Wave add participant failed, onFailure: " + arg0);
+ }
- @Override
- public void addParticipant(final WaveRef waveName, final String author, final String userWhoAdds,
- final String participant) {
- final Wavelet wavelet = fetchWavelet(waveName, author);
- final String whoAdd = wavelet.getParticipants().contains(participantUtils.of(userWhoAdds)) ? userWhoAdds
- : author;
- final OperationQueue opQueue = new OperationQueue();
- opQueue.addParticipantToWavelet(wavelet, participantUtils.of(participant).toString());
- final OperationContextImpl context = new OperationContextImpl(waveletProvider,
- converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);
- final OperationRequest request = opQueue.getPendingOperations().get(0);
- OperationUtil.executeOperation(request, operationRegistry, context, participantUtils.of(whoAdd));
- final String reqId = request.getId();
- final JsonRpcResponse response = context.getResponse(reqId);
- if (response != null && response.isError()) {
- onFailure(context.getResponse(reqId).getErrorMessage());
- }
- OperationUtil.submitDeltas(context, waveletProvider, new SubmitRequestListener() {
- @Override
- public void onFailure(final String arg0) {
- KuneWaveManagerDefault.this.onFailure("Wave add participant failed, onFailure: " + arg0);
- }
+ @Override
+ public void onSuccess(final int arg0, final HashedVersion arg1, final long arg2) {
+ LOG.info("Wave addParticipant success: " + arg1);
+ }
+ });
+ }
- @Override
- public void onSuccess(final int arg0, final HashedVersion arg1, final long arg2) {
- LOG.info("Wave addParticipant success: " + arg1);
- }
- });
- }
+ @Override
+ public WaveRef createWave(final String message, final ParticipantId participant) {
+ return createWave(NO_TITLE, message, participant);
+ }
- @Override
- public WaveRef createWave(final String message, final ParticipantId participant) {
- return createWave(NO_TITLE, message, participant);
+ @Override
+ public WaveRef createWave(@Nonnull final String title, final String message,
+ @Nonnull final ParticipantId... participantsArray) {
+ String newWaveId = null;
+ String newWaveletId = null;
+ final Set<String> participants = new HashSet<String>();
+ for (final ParticipantId participant : participantsArray) {
+ participants.add(participant.toString());
}
-
- @Override
- public WaveRef createWave(@Nonnull final String title, final String message,
- @Nonnull final ParticipantId... participantsArray) {
- String newWaveId = null;
- String newWaveletId = null;
- final Set<String> participants = new HashSet<String>();
- for (final ParticipantId participant : participantsArray) {
- participants.add(participant.toString());
+ final ParticipantId user = participantsArray[0];
+ final OperationQueue opQueue = new OperationQueue();
+ final Wavelet newWavelet = opQueue.createWavelet(domain, participants);
+ opQueue.setTitleOfWavelet(newWavelet, title);
+ final Blip rootBlip = newWavelet.getRootBlip();
+ rootBlip.append(new com.google.wave.api.Markup(message).getText());
+ final OperationContextImpl context = new OperationContextImpl(waveletProvider,
+ converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);
+ for (final OperationRequest req : opQueue.getPendingOperations()) {
+ OperationUtil.executeOperation(req, operationRegistry, context, user);
+ final String reqId = req.getId();
+ final JsonRpcResponse response = context.getResponse(reqId);
+ if (response != null) {
+ if (response.isError()) {
+ onFailure(context.getResponse(reqId).getErrorMessage());
+ } else {
+ final Object responseWaveId = response.getData().get(ParamsProperty.WAVE_ID);
+ final Object responseWaveletId = response.getData().get(ParamsProperty.WAVELET_ID);
+ if (responseWaveId != null && responseWaveletId != null) {
+ // This is serialized use
+ // ApiIdSerializer.instance().deserialiseWaveId (see
+ // WaveService)
+ newWaveId = (String) responseWaveId;
+ newWaveletId = (String) responseWaveletId;
+ }
}
- final ParticipantId user = participantsArray[0];
- final OperationQueue opQueue = new OperationQueue();
- final Wavelet newWavelet = opQueue.createWavelet(domain, participants);
- opQueue.setTitleOfWavelet(newWavelet, title);
- final Blip rootBlip = newWavelet.getRootBlip();
- rootBlip.append(new com.google.wave.api.Markup(message).getText());
- final OperationContextImpl context = new OperationContextImpl(waveletProvider,
- converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);
- for (final OperationRequest req : opQueue.getPendingOperations()) {
- OperationUtil.executeOperation(req, operationRegistry, context, user);
- final String reqId = req.getId();
- final JsonRpcResponse response = context.getResponse(reqId);
- if (response != null) {
- if (response.isError()) {
- onFailure(context.getResponse(reqId).getErrorMessage());
- } else {
- final Object responseWaveId = response.getData().get(ParamsProperty.WAVE_ID);
- final Object responseWaveletId = response.getData().get(ParamsProperty.WAVELET_ID);
- if (responseWaveId != null && responseWaveletId != null) {
- // This is serialized use
- // ApiIdSerializer.instance().deserialiseWaveId (see
- // WaveService)
- newWaveId = (String) responseWaveId;
- newWaveletId = (String) responseWaveletId;
- }
- }
- }
- }
- OperationUtil.submitDeltas(context, waveletProvider, new SubmitRequestListener() {
- @Override
- public void onFailure(final String arg0) {
- KuneWaveManagerDefault.this.onFailure("Wave creation failed, onFailure: " + arg0);
- }
+ }
+ }
+ OperationUtil.submitDeltas(context, waveletProvider, new SubmitRequestListener() {
+ @Override
+ public void onFailure(final String arg0) {
+ KuneWaveManagerDefault.this.onFailure("Wave creation failed, onFailure: " + arg0);
+ }
- @Override
- public void onSuccess(final int arg0, final HashedVersion arg1, final long arg2) {
- LOG.info("Wave creation success: " + arg1);
- }
- });
- LOG.info("WaveId: " + newWaveId + " waveletId: " + newWaveletId);
- WaveRef wavename;
- try {
- wavename = WaveRef.of(ApiIdSerializer.instance().deserialiseWaveId(newWaveId),
- ApiIdSerializer.instance().deserialiseWaveletId(newWaveletId));
- } catch (final InvalidIdException e) {
- throw new DefaultException("Error getting wave id");
- }
- return wavename;
+ @Override
+ public void onSuccess(final int arg0, final HashedVersion arg1, final long arg2) {
+ LOG.info("Wave creation success: " + arg1);
+ }
+ });
+ LOG.info("WaveId: " + newWaveId + " waveletId: " + newWaveletId);
+ WaveRef wavename;
+ try {
+ wavename = WaveRef.of(ApiIdSerializer.instance().deserialiseWaveId(newWaveId),
+ ApiIdSerializer.instance().deserialiseWaveletId(newWaveletId));
+ } catch (final InvalidIdException e) {
+ throw new DefaultException("Error getting wave id");
}
+ return wavename;
+ }
- public void doOperations(final WaveRef waveName, final String author, final OperationQueue opQueue,
- final SubmitRequestListener listener) {
- final OperationContextImpl context = new OperationContextImpl(waveletProvider,
- converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);
- for (final OperationRequest req : opQueue.getPendingOperations()) {
- OperationUtil.executeOperation(req, operationRegistry, context, participantUtils.of(author));
- }
- OperationUtil.submitDeltas(context, waveletProvider, listener);
+ public void doOperations(final WaveRef waveName, final String author, final OperationQueue opQueue,
+ final SubmitRequestListener listener) {
+ final OperationContextImpl context = new OperationContextImpl(waveletProvider,
+ converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);
+ for (final OperationRequest req : opQueue.getPendingOperations()) {
+ OperationUtil.executeOperation(req, operationRegistry, context, participantUtils.of(author));
}
+ OperationUtil.submitDeltas(context, waveletProvider, listener);
+ }
- @Override
- public Wavelet fetchWavelet(final WaveRef waveName, final String author) {
- Wavelet wavelet = null;
- final OperationQueue opQueue = new OperationQueue();
- opQueue.fetchWavelet(waveName.getWaveId(), waveName.getWaveletId());
- final OperationContextImpl context = new OperationContextImpl(waveletProvider,
- converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);
- final OperationRequest request = opQueue.getPendingOperations().get(0);
- OperationUtil.executeOperation(request, operationRegistry, context, participantUtils.of(author));
- final String reqId = request.getId();
- final JsonRpcResponse response = context.getResponse(reqId);
- if (response != null && response.isError()) {
- onFailure(context.getResponse(reqId).getErrorMessage());
- } else {
- // Duplicate code from WaveService
- final WaveletData waveletData = (WaveletData) response.getData().get(ParamsProperty.WAVELET_DATA);
- final Map<String, Blip> blips = new HashMap<String, Blip>();
- final Map<String, BlipThread> threads = new HashMap<String, BlipThread>();
- wavelet = Wavelet.deserialize(opQueue, blips, threads, waveletData);
+ @Override
+ public Wavelet fetchWavelet(final WaveRef waveName, final String author) {
+ Wavelet wavelet = null;
+ final OperationQueue opQueue = new OperationQueue();
+ opQueue.fetchWavelet(waveName.getWaveId(), waveName.getWaveletId());
+ final OperationContextImpl context = new OperationContextImpl(waveletProvider,
+ converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);
+ final OperationRequest request = opQueue.getPendingOperations().get(0);
+ OperationUtil.executeOperation(request, operationRegistry, context, participantUtils.of(author));
+ final String reqId = request.getId();
+ final JsonRpcResponse response = context.getResponse(reqId);
+ if (response != null && response.isError()) {
+ onFailure(context.getResponse(reqId).getErrorMessage());
+ } else {
+ // Duplicate code from WaveService
+ final WaveletData waveletData = (WaveletData) response.getData().get(ParamsProperty.WAVELET_DATA);
+ final Map<String, Blip> blips = new HashMap<String, Blip>();
+ final Map<String, BlipThread> threads = new HashMap<String, BlipThread>();
+ wavelet = Wavelet.deserialize(opQueue, blips, threads, waveletData);
- // Deserialize threads.
- @SuppressWarnings("unchecked")
- final Map<String, BlipThread> tempThreads = (Map<String, BlipThread>) response.getData().get(
- ParamsProperty.THREADS);
- for (final Map.Entry<String, BlipThread> entry : tempThreads.entrySet()) {
- final BlipThread thread = entry.getValue();
- threads.put(entry.getKey(), new BlipThread(thread.getId(), thread.getLocation(), thread.getBlipIds(),
- blips));
- }
+ // Deserialize threads.
+ @SuppressWarnings("unchecked")
+ final Map<String, BlipThread> tempThreads = (Map<String, BlipThread>) response.getData().get(
+ ParamsProperty.THREADS);
+ for (final Map.Entry<String, BlipThread> entry : tempThreads.entrySet()) {
+ final BlipThread thread = entry.getValue();
+ threads.put(entry.getKey(),
+ new BlipThread(thread.getId(), thread.getLocation(), thread.getBlipIds(), blips));
+ }
- // Deserialize blips.
- @SuppressWarnings("unchecked")
- final Map<String, BlipData> blipDatas = (Map<String, BlipData>) response.getData().get(ParamsProperty.BLIPS);
- for (final Map.Entry<String, BlipData> entry : blipDatas.entrySet()) {
- blips.put(entry.getKey(), Blip.deserialize(opQueue, wavelet, entry.getValue()));
- }
- }
- return wavelet;
+ // Deserialize blips.
+ @SuppressWarnings("unchecked")
+ final Map<String, BlipData> blipDatas = (Map<String, BlipData>) response.getData().get(
+ ParamsProperty.BLIPS);
+ for (final Map.Entry<String, BlipData> entry : blipDatas.entrySet()) {
+ blips.put(entry.getKey(), Blip.deserialize(opQueue, wavelet, entry.getValue()));
+ }
}
+ return wavelet;
+ }
- @Override
- public boolean isParticipant(final Wavelet wavelet, final String user) {
- return wavelet.getParticipants().contains(participantUtils.of(user));
- }
+ @Override
+ public boolean isParticipant(final Wavelet wavelet, final String user) {
+ return wavelet.getParticipants().contains(participantUtils.of(user).toString());
+ }
- private void onFailure(final String message) {
- final String errorMsg = TextUtils.notEmpty(message) ? message : "Wave operation failed";
- LOG.error(errorMsg);
- throw new DefaultException(errorMsg);
+ private void onFailure(final String message) {
+ final String errorMsg = TextUtils.notEmpty(message) ? message : "Wave operation failed";
+ LOG.error(errorMsg);
+ throw new DefaultException(errorMsg);
+ }
+
+ @Override
+ public void setTitle(final WaveRef waveName, final String title, final String author) {
+ final Wavelet wavelet = fetchWavelet(waveName, author);
+ final OperationQueue opQueue = new OperationQueue();
+ opQueue.setTitleOfWavelet(wavelet, title);
+ final OperationContextImpl context = new OperationContextImpl(waveletProvider,
+ converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);
+ final OperationRequest request = opQueue.getPendingOperations().get(0);
+ OperationUtil.executeOperation(request, operationRegistry, context, participantUtils.of(author));
+ final String reqId = request.getId();
+ final JsonRpcResponse response = context.getResponse(reqId);
+ if (response != null && response.isError()) {
+ onFailure(context.getResponse(reqId).getErrorMessage());
}
+ OperationUtil.submitDeltas(context, waveletProvider, new SubmitRequestListener() {
+ @Override
+ public void onFailure(final String arg0) {
+ KuneWaveManagerDefault.this.onFailure("Wave set title failed, onFailure: " + arg0);
+ }
- @Override
- public void setTitle(final WaveRef waveName, final String title, final String author) {
- final Wavelet wavelet = fetchWavelet(waveName, author);
- final OperationQueue opQueue = new OperationQueue();
- opQueue.setTitleOfWavelet(wavelet, title);
- final OperationContextImpl context = new OperationContextImpl(waveletProvider,
- converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);
- final OperationRequest request = opQueue.getPendingOperations().get(0);
- OperationUtil.executeOperation(request, operationRegistry, context, participantUtils.of(author));
- final String reqId = request.getId();
- final JsonRpcResponse response = context.getResponse(reqId);
- if (response != null && response.isError()) {
- onFailure(context.getResponse(reqId).getErrorMessage());
- }
- OperationUtil.submitDeltas(context, waveletProvider, new SubmitRequestListener() {
- @Override
- public void onFailure(final String arg0) {
- KuneWaveManagerDefault.this.onFailure("Wave set title failed, onFailure: " + arg0);
- }
+ @Override
+ public void onSuccess(final int arg0, final HashedVersion arg1, final long arg2) {
+ LOG.info("Wave set title success: " + arg1);
+ }
+ });
+ }
- @Override
- public void onSuccess(final int arg0, final HashedVersion arg1, final long arg2) {
- LOG.info("Wave set title success: " + arg1);
- }
- });
- }
-
}
Modified: trunk/src/test/java/cc/kune/core/server/mapper/MapperTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/mapper/MapperTest.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/test/java/cc/kune/core/server/mapper/MapperTest.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -33,7 +33,6 @@
import cc.kune.core.server.TestDomainHelper;
import cc.kune.core.server.TestHelper;
import cc.kune.core.server.manager.GroupManager;
-import cc.kune.core.server.mapper.Mapper;
import cc.kune.core.server.state.StateContent;
import cc.kune.core.shared.domain.GroupListMode;
import cc.kune.core.shared.domain.SocialNetworkVisibility;
@@ -67,296 +66,302 @@
import com.google.inject.Inject;
public class MapperTest {
- private static final String TESTGROUPSHORTNAME = "grouptest";
- private static final String TESTTOOL = "docs";
- @Inject
- GroupManager groupManager;
- @Inject
- Mapper mapper;
+ private static final String TESTGROUPSHORTNAME = "grouptest";
+ private static final String TESTTOOL = "docs";
+ @Inject
+ GroupManager groupManager;
+ @Inject
+ Mapper mapper;
- private void assertMapping(final GroupListMode mode, final String modeName) {
- final GroupList list = new GroupList();
- list.setMode(mode);
- final GroupListDTO dto = mapper.map(list, GroupListDTO.class);
- assertEquals(modeName, dto.getMode());
- final GroupList listBack = mapper.map(dto, GroupList.class);
- assertEquals(mode, listBack.getMode());
- }
+ private void assertMapping(final GroupListMode mode, final String modeName) {
+ final GroupList list = new GroupList();
+ list.setMode(mode);
+ final GroupListDTO dto = mapper.map(list, GroupListDTO.class);
+ assertEquals(modeName, dto.getMode());
+ final GroupList listBack = mapper.map(dto, GroupList.class);
+ assertEquals(mode, listBack.getMode());
+ }
- private void assertValidAccessListsMapping(final GroupList groupList, final GroupListDTO groupListDTO) {
- final List<Group> listOrig = groupList.getList();
- final List<GroupDTO> listDto = groupListDTO.getList();
- assertEquals(listDto.size(), listOrig.size());
- for (int i = 0; i < listDto.size(); i++) {
- final Object object = listDto.get(i);
- assertEquals(GroupDTO.class, object.getClass());
- final GroupDTO d = (GroupDTO) object;
- final Group g = listOrig.get(i);
- assertNotNull(d);
- assertNotNull(g);
- final GroupDTO map = mapper.map(g, GroupDTO.class);
- assertEquals(map, d);
- }
+ private void assertValidAccessListsMapping(final GroupList groupList, final GroupListDTO groupListDTO) {
+ final List<Group> listOrig = groupList.getList();
+ final List<GroupDTO> listDto = groupListDTO.getList();
+ assertEquals(listDto.size(), listOrig.size());
+ for (int i = 0; i < listDto.size(); i++) {
+ final Object object = listDto.get(i);
+ assertEquals(GroupDTO.class, object.getClass());
+ final GroupDTO d = (GroupDTO) object;
+ final Group g = listOrig.get(i);
+ assertNotNull(d);
+ assertNotNull(g);
+ final GroupDTO map = mapper.map(g, GroupDTO.class);
+ assertEquals(map, d);
}
+ }
- private Container createDefContainer() {
- return createDefContainer(createDeGroup());
- }
+ private Container createDefContainer() {
+ return createDefContainer(createDeGroup());
+ }
- private Container createDefContainer(final Group group) {
- final Container container = new Container();
- container.setId(1L);
- container.setToolName(TESTTOOL);
- container.setOwner(group);
- container.setName("folder");
- return container;
- }
+ private Container createDefContainer(final Group group) {
+ final Container container = new Container();
+ container.setId(1L);
+ container.setToolName(TESTTOOL);
+ container.setOwner(group);
+ container.setName("folder");
+ return container;
+ }
- private Content createDefContent() {
- final Container container = createDefContainer(createDeGroup());
- final Content d = new Content();
- d.setId(1L);
- final Revision revision = new Revision(d);
- revision.setTitle("title");
- d.addRevision(revision);
- d.setContainer(container);
- return d;
- }
+ private Content createDefContent() {
+ final Container container = createDefContainer(createDeGroup());
+ final Content d = new Content();
+ d.setId(1L);
+ final Revision revision = new Revision(d);
+ revision.setTitle("title");
+ d.addRevision(revision);
+ d.setContainer(container);
+ return d;
+ }
- private Group createDeGroup() {
- final Group group = new Group(TESTGROUPSHORTNAME, "This is a group Test");
- return group;
- }
+ private Group createDeGroup() {
+ final Group group = new Group(TESTGROUPSHORTNAME, "This is a group Test");
+ return group;
+ }
- @Test
- public void groupHasLogo() {
- final Group group = new Group("test", "this is a test");
- GroupDTO groupDTO = mapper.map(group, GroupDTO.class);
- assertFalse(group.hasLogo());
- assertFalse(groupDTO.hasLogo());
- group.setLogo(new byte[2]);
- group.setLogoMime(new BasicMimeType("image/png"));
- groupDTO = mapper.map(group, GroupDTO.class);
- assertTrue(group.hasLogo());
- assertTrue(groupDTO.hasLogo());
- }
+ @Test
+ public void groupHasLogo() {
+ final Group group = new Group("test", "this is a test");
+ GroupDTO groupDTO = mapper.map(group, GroupDTO.class);
+ assertFalse(group.hasLogo());
+ assertFalse(groupDTO.hasLogo());
+ group.setLogo(new byte[2]);
+ group.setLogoMime(new BasicMimeType("image/png"));
+ groupDTO = mapper.map(group, GroupDTO.class);
+ assertTrue(group.hasLogo());
+ assertTrue(groupDTO.hasLogo());
+ }
- @Before
- public void inject() {
- TestHelper.inject(this);
- }
+ @Before
+ public void inject() {
+ TestHelper.inject(this);
+ }
- @Test
- public void testCommentMapper() {
- final Content d = createDefContent();
- final Comment comment = new Comment();
- comment.setContent(d);
- comment.setText("Some text");
- final User user = new User();
- comment.addPositiveVoter(user);
- comment.addPositiveVoter(user);
- CommentDTO commentDTO = mapper.map(comment, CommentDTO.class);
- assertEquals(0, commentDTO.getNegativeVotersCount());
- assertEquals(0, commentDTO.getAbuseInformersCount());
- assertEquals(1, commentDTO.getPositiveVotersCount());
- comment.addNegativeVoter(user);
- comment.addNegativeVoter(user);
- commentDTO = mapper.map(comment, CommentDTO.class);
- assertEquals(1, commentDTO.getNegativeVotersCount());
- assertEquals(0, commentDTO.getAbuseInformersCount());
- assertEquals(0, commentDTO.getPositiveVotersCount());
- comment.addAbuseInformer(user);
- comment.addAbuseInformer(user);
- commentDTO = mapper.map(comment, CommentDTO.class);
- assertEquals(1, commentDTO.getNegativeVotersCount());
- assertEquals(1, commentDTO.getAbuseInformersCount());
- assertEquals(0, commentDTO.getPositiveVotersCount());
- final Comment childComment = new Comment();
- childComment.setContent(d);
- childComment.setParent(comment);
- comment.getChilds().add(childComment);
- commentDTO = mapper.map(comment, CommentDTO.class);
- final CommentDTO childCommentDTO = mapper.map(childComment, CommentDTO.class);
- assertEquals(1, comment.getChilds().size());
- assertEquals(commentDTO, childCommentDTO.getParent());
- }
+ @Test
+ public void testCommentMapper() {
+ final Content d = createDefContent();
+ final Comment comment = new Comment();
+ comment.setContent(d);
+ comment.setText("Some text");
+ final User user = new User();
+ comment.addPositiveVoter(user);
+ comment.addPositiveVoter(user);
+ CommentDTO commentDTO = mapper.map(comment, CommentDTO.class);
+ assertEquals(0, commentDTO.getNegativeVotersCount());
+ assertEquals(0, commentDTO.getAbuseInformersCount());
+ assertEquals(1, commentDTO.getPositiveVotersCount());
+ comment.addNegativeVoter(user);
+ comment.addNegativeVoter(user);
+ commentDTO = mapper.map(comment, CommentDTO.class);
+ assertEquals(1, commentDTO.getNegativeVotersCount());
+ assertEquals(0, commentDTO.getAbuseInformersCount());
+ assertEquals(0, commentDTO.getPositiveVotersCount());
+ comment.addAbuseInformer(user);
+ comment.addAbuseInformer(user);
+ commentDTO = mapper.map(comment, CommentDTO.class);
+ assertEquals(1, commentDTO.getNegativeVotersCount());
+ assertEquals(1, commentDTO.getAbuseInformersCount());
+ assertEquals(0, commentDTO.getPositiveVotersCount());
+ final Comment childComment = new Comment();
+ childComment.setContent(d);
+ childComment.setParent(comment);
+ comment.getChilds().add(childComment);
+ commentDTO = mapper.map(comment, CommentDTO.class);
+ final CommentDTO childCommentDTO = mapper.map(childComment, CommentDTO.class);
+ assertEquals(1, comment.getChilds().size());
+ assertEquals(commentDTO, childCommentDTO.getParent());
+ }
- @Test
- public void testContentDescriptorMapping() {
- final Content d = createDefContent();
- final StateToken expectedToken = new StateToken(TESTGROUPSHORTNAME, TESTTOOL, "1", "1");
- assertEquals(expectedToken, d.getStateToken());
+ @Test
+ public void testContentDescriptorMapping() {
+ final Content d = createDefContent();
+ final StateToken expectedToken = new StateToken(TESTGROUPSHORTNAME, TESTTOOL, "1", "1");
+ assertEquals(expectedToken, d.getStateToken());
- final ContentSimpleDTO dto = mapper.map(d, ContentSimpleDTO.class);
- assertEquals(1, (long) dto.getId());
- assertEquals("title", dto.getTitle());
- assertEquals(expectedToken, dto.getStateToken());
- }
+ final ContentSimpleDTO dto = mapper.map(d, ContentSimpleDTO.class);
+ assertEquals(1, (long) dto.getId());
+ assertEquals("title", dto.getTitle());
+ assertEquals(expectedToken, dto.getStateToken());
+ }
- @Test
- public void testContentDescriptorToLinkMapping() {
- final Content d = createDefContent();
+ @Test
+ public void testContentDescriptorToLinkMapping() {
+ final Content d = createDefContent();
- final LinkDTO dto = mapper.map(d, LinkDTO.class);
- assertEquals("title", dto.getLongName());
- assertEquals(TESTGROUPSHORTNAME, dto.getShortName());
- assertEquals("grouptest.docs.1.1", dto.getLink());
- }
+ final LinkDTO dto = mapper.map(d, LinkDTO.class);
+ assertEquals("title", dto.getLongName());
+ assertEquals(TESTGROUPSHORTNAME, dto.getShortName());
+ assertEquals("grouptest.docs.1.1", dto.getLink());
+ }
- @Test
- public void testContentMapping() {
- final StateContent c = new StateContent();
- c.setContentRights(new AccessRights(true, true, true));
- final Group groupAdmins = TestDomainHelper.createGroup(1);
- final Group groupEdit = TestDomainHelper.createGroup(2);
- final Group groupView = TestDomainHelper.createGroup(3);
- c.setAccessLists(TestDomainHelper.createAccessLists(groupAdmins, groupEdit, groupView));
- c.setRate(10.2D);
- c.setRateByUsers(3);
- c.setCurrentUserRate(null);
+ @Test
+ public void testContentMapping() {
+ final StateContent c = new StateContent();
+ c.setContentRights(new AccessRights(true, true, true));
+ final Group groupAdmins = TestDomainHelper.createGroup(1);
+ final Group groupEdit = TestDomainHelper.createGroup(2);
+ final Group groupView = TestDomainHelper.createGroup(3);
+ c.setIsParticipant(true);
+ c.setAccessLists(TestDomainHelper.createAccessLists(groupAdmins, groupEdit, groupView));
+ c.setRate(10.2D);
+ c.setRateByUsers(3);
+ c.setCurrentUserRate(null);
- final StateContentDTO dto = mapper.map(c, StateContentDTO.class);
- assertEquals(c.getContentRights().isAdministrable(), dto.getContentRights().isAdministrable());
+ final StateContentDTO dto = mapper.map(c, StateContentDTO.class);
+ assertEquals(c.getContentRights().isAdministrable(), dto.getContentRights().isAdministrable());
- assertValidAccessListsMapping(c.getAccessLists().getAdmins(), dto.getAccessLists().getAdmins());
- assertValidAccessListsMapping(c.getAccessLists().getEditors(), dto.getAccessLists().getEditors());
- assertValidAccessListsMapping(c.getAccessLists().getViewers(), dto.getAccessLists().getViewers());
+ assertValidAccessListsMapping(c.getAccessLists().getAdmins(), dto.getAccessLists().getAdmins());
+ assertValidAccessListsMapping(c.getAccessLists().getEditors(), dto.getAccessLists().getEditors());
+ assertValidAccessListsMapping(c.getAccessLists().getViewers(), dto.getAccessLists().getViewers());
- assertEquals(dto.getRate(), c.getRate());
- assertEquals(dto.getRateByUsers(), c.getRateByUsers());
- assertEquals(dto.getCurrentUserRate(), c.getCurrentUserRate());
- }
+ assertEquals(dto.getRate(), c.getRate());
+ assertEquals(dto.getRateByUsers(), c.getRateByUsers());
+ assertEquals(dto.getCurrentUserRate(), c.getCurrentUserRate());
+ assertEquals(dto.isParticipant(), true);
+ assertEquals(dto.getIsParticipant(), true);
+ }
- @Test
- public void testFolderMapping() {
- final Container container = createDefContainer();
- final StateToken expectedToken = new StateToken(TESTGROUPSHORTNAME, TESTTOOL, 1L);
- assertEquals(expectedToken, container.getStateToken());
- container.addChild(createDefContainer());
- container.addChild(createDefContainer());
- container.addContent(createDefContent());
- container.addContent(createDefContent());
- container.addContent(createDefContent());
- final Container containerChild = createDefContainer();
- container.addChild(containerChild);
- final List<Container> absolutePathChild = new ArrayList<Container>();
- absolutePathChild.add(container);
- containerChild.setAbsolutePath(absolutePathChild);
+ @Test
+ public void testFolderMapping() {
+ final Container container = createDefContainer();
+ final StateToken expectedToken = new StateToken(TESTGROUPSHORTNAME, TESTTOOL, 1L);
+ assertEquals(expectedToken, container.getStateToken());
+ container.addChild(createDefContainer());
+ container.addChild(createDefContainer());
+ container.addContent(createDefContent());
+ container.addContent(createDefContent());
+ container.addContent(createDefContent());
+ final Container containerChild = createDefContainer();
+ container.addChild(containerChild);
+ final List<Container> absolutePathChild = new ArrayList<Container>();
+ absolutePathChild.add(container);
+ containerChild.setAbsolutePath(absolutePathChild);
- final ContainerDTO dto = mapper.map(container, ContainerDTO.class);
- assertEquals(3, dto.getChilds().size());
- assertEquals(3, dto.getContents().size());
- assertTrue(dto.getContents().get(0) instanceof ContentSimpleDTO);
- assertTrue(dto.getChilds().get(0) instanceof ContainerSimpleDTO);
- assertEquals(new StateToken(TESTGROUPSHORTNAME, TESTTOOL),
- dto.getChilds().get(0).getStateToken().copy().clearFolder());
- assertEquals(expectedToken, dto.getContents().get(0).getStateToken().copy().clearDocument());
- assertEquals(expectedToken, dto.getStateToken());
+ final ContainerDTO dto = mapper.map(container, ContainerDTO.class);
+ assertEquals(3, dto.getChilds().size());
+ assertEquals(3, dto.getContents().size());
+ assertTrue(dto.getContents().get(0) instanceof ContentSimpleDTO);
+ assertTrue(dto.getChilds().get(0) instanceof ContainerSimpleDTO);
+ assertEquals(new StateToken(TESTGROUPSHORTNAME, TESTTOOL),
+ dto.getChilds().get(0).getStateToken().copy().clearFolder());
+ assertEquals(expectedToken, dto.getContents().get(0).getStateToken().copy().clearDocument());
+ assertEquals(expectedToken, dto.getStateToken());
- final ContainerDTO dtoChild = mapper.map(containerChild, ContainerDTO.class);
- assertNotNull(dtoChild.getAbsolutePath()[0]);
- }
+ final ContainerDTO dtoChild = mapper.map(containerChild, ContainerDTO.class);
+ assertNotNull(dtoChild.getAbsolutePath()[0]);
+ }
- @Test
- public void testGroupListMapping() {
- assertMapping(GroupListMode.EVERYONE, GroupListDTO.EVERYONE);
- assertMapping(GroupListMode.NOBODY, GroupListDTO.NOBODY);
- assertMapping(GroupListMode.NORMAL, GroupListDTO.NORMAL);
- }
+ @Test
+ public void testGroupListMapping() {
+ assertMapping(GroupListMode.EVERYONE, GroupListDTO.EVERYONE);
+ assertMapping(GroupListMode.NOBODY, GroupListDTO.NOBODY);
+ assertMapping(GroupListMode.NORMAL, GroupListDTO.NORMAL);
+ }
- @Test
- public void testGroupMapping() {
- final Group group = new Group("shortName", "name");
- final GroupDTO dto = mapper.map(group, GroupDTO.class);
- assertEquals(group.getLongName(), dto.getLongName());
- assertEquals(group.getShortName(), dto.getShortName());
- }
+ @Test
+ public void testGroupMapping() {
+ final Group group = new Group("shortName", "name");
+ final GroupDTO dto = mapper.map(group, GroupDTO.class);
+ assertEquals(group.getLongName(), dto.getLongName());
+ assertEquals(group.getShortName(), dto.getShortName());
+ }
- @Test
- public void testLicenseMapping() {
- final License licenseCC = new License("by-nc-nd", "Creative Commons Attribution-NonCommercial-NoDerivs", "cc1",
- "http://creativecommons.org/licenses/by-nc-nd/3.0/", true, false, false, "cc2", "cc3");
+ @Test
+ public void testLicenseMapping() {
+ final License licenseCC = new License("by-nc-nd",
+ "Creative Commons Attribution-NonCommercial-NoDerivs", "cc1",
+ "http://creativecommons.org/licenses/by-nc-nd/3.0/", true, false, false, "cc2", "cc3");
- final License licenseNotCC = new License("gfdl", "GNU Free Documentation License", "nocc1",
- "http://www.gnu.org/copyleft/fdl.html", false, true, false, "nocc2", "nocc3");
+ final License licenseNotCC = new License("gfdl", "GNU Free Documentation License", "nocc1",
+ "http://www.gnu.org/copyleft/fdl.html", false, true, false, "nocc2", "nocc3");
- final LicenseDTO dtoCC = mapper.map(licenseCC, LicenseDTO.class);
- final LicenseDTO dtoNotCC = mapper.map(licenseNotCC, LicenseDTO.class);
+ final LicenseDTO dtoCC = mapper.map(licenseCC, LicenseDTO.class);
+ final LicenseDTO dtoNotCC = mapper.map(licenseNotCC, LicenseDTO.class);
- assertEquals("by-nc-nd", dtoCC.getShortName());
- assertEquals("gfdl", dtoNotCC.getShortName());
- assertEquals("Creative Commons Attribution-NonCommercial-NoDerivs", dtoCC.getLongName());
- assertEquals("GNU Free Documentation License", dtoNotCC.getLongName());
- assertEquals("http://creativecommons.org/licenses/by-nc-nd/3.0/", dtoCC.getUrl());
- assertEquals("http://www.gnu.org/copyleft/fdl.html", dtoNotCC.getUrl());
- assertTrue(dtoCC.isCC());
- assertFalse(dtoNotCC.isCC());
- assertFalse(dtoCC.isCopyleft());
- assertTrue(dtoNotCC.isCopyleft());
- assertFalse(dtoCC.isDeprecated());
- assertFalse(dtoNotCC.isDeprecated());
- assertEquals("cc1", dtoCC.getDescription());
- assertEquals("cc2", dtoCC.getRdf());
- assertEquals("cc3", dtoCC.getImageUrl());
- assertEquals("nocc1", dtoNotCC.getDescription());
- assertEquals("nocc2", dtoNotCC.getRdf());
- assertEquals("nocc3", dtoNotCC.getImageUrl());
- }
+ assertEquals("by-nc-nd", dtoCC.getShortName());
+ assertEquals("gfdl", dtoNotCC.getShortName());
+ assertEquals("Creative Commons Attribution-NonCommercial-NoDerivs", dtoCC.getLongName());
+ assertEquals("GNU Free Documentation License", dtoNotCC.getLongName());
+ assertEquals("http://creativecommons.org/licenses/by-nc-nd/3.0/", dtoCC.getUrl());
+ assertEquals("http://www.gnu.org/copyleft/fdl.html", dtoNotCC.getUrl());
+ assertTrue(dtoCC.isCC());
+ assertFalse(dtoNotCC.isCC());
+ assertFalse(dtoCC.isCopyleft());
+ assertTrue(dtoNotCC.isCopyleft());
+ assertFalse(dtoCC.isDeprecated());
+ assertFalse(dtoNotCC.isDeprecated());
+ assertEquals("cc1", dtoCC.getDescription());
+ assertEquals("cc2", dtoCC.getRdf());
+ assertEquals("cc3", dtoCC.getImageUrl());
+ assertEquals("nocc1", dtoNotCC.getDescription());
+ assertEquals("nocc2", dtoNotCC.getRdf());
+ assertEquals("nocc3", dtoNotCC.getImageUrl());
+ }
- @Test
- public void testMimeMapping() {
- final Content d = createDefContent();
- d.setMimeType(new BasicMimeType("application/pdf"));
- final ContentSimpleDTO contentSimpleDTO = mapper.map(d, ContentSimpleDTO.class);
- assertEquals("application/pdf", contentSimpleDTO.getMimeType().toString());
- }
+ @Test
+ public void testMimeMapping() {
+ final Content d = createDefContent();
+ d.setMimeType(new BasicMimeType("application/pdf"));
+ final ContentSimpleDTO contentSimpleDTO = mapper.map(d, ContentSimpleDTO.class);
+ assertEquals("application/pdf", contentSimpleDTO.getMimeType().toString());
+ }
- @Test
- public void testSnResultMap() {
- final Group group = new Group("test", "this is a test");
- final SocialNetwork sn = new SocialNetwork();
- sn.addAdmin(group);
- final ParticipationData part = new ParticipationData();
- part.setGroupsIsAdmin(sn.getAccessLists().getAdmins().getList());
- final UserBuddiesData budData = new UserBuddiesData();
- final ArrayList<User> buddies = new ArrayList<User>();
- final User user = new User();
- user.setShortName("usertest");
- user.setUserGroup(new Group("test2", "this is test2"));
- buddies.add(user);
- budData.setBuddies(buddies);
- final SocialNetworkData snResult = new SocialNetworkData(SocialNetworkVisibility.onlymembers, sn, part,
- UserSNetVisibility.yourbuddies, budData, new AccessRights(false, false, true), true, true);
- final SocialNetworkDataDTO map = mapper.map(snResult, SocialNetworkDataDTO.class);
- assertNotNull(map);
- assertEquals(SocialNetworkVisibility.onlymembers, map.getSocialNetworkVisibility());
- assertEquals(UserSNetVisibility.yourbuddies, map.getUserBuddiesVisibility());
- assertEquals("test", map.getGroupMembers().getAccessLists().getAdmins().getList().get(0).getShortName());
- assertEquals("test", map.getUserParticipation().getGroupsIsAdmin().get(0).getShortName());
- assertEquals("usertest", map.getUserBuddies().getBuddies().get(0).getShortName());
- assertFalse(map.getGroupRights().isAdministrable());
- assertFalse(map.getGroupRights().isEditable());
- assertTrue(map.getGroupRights().isVisible());
- assertTrue(map.isMembersVisible());
- assertTrue(map.isBuddiesVisible());
- }
+ @Test
+ public void testSnResultMap() {
+ final Group group = new Group("test", "this is a test");
+ final SocialNetwork sn = new SocialNetwork();
+ sn.addAdmin(group);
+ final ParticipationData part = new ParticipationData();
+ part.setGroupsIsAdmin(sn.getAccessLists().getAdmins().getList());
+ final UserBuddiesData budData = new UserBuddiesData();
+ final ArrayList<User> buddies = new ArrayList<User>();
+ final User user = new User();
+ user.setShortName("usertest");
+ user.setUserGroup(new Group("test2", "this is test2"));
+ buddies.add(user);
+ budData.setBuddies(buddies);
+ final SocialNetworkData snResult = new SocialNetworkData(SocialNetworkVisibility.onlymembers, sn,
+ part, UserSNetVisibility.yourbuddies, budData, new AccessRights(false, false, true), true, true);
+ final SocialNetworkDataDTO map = mapper.map(snResult, SocialNetworkDataDTO.class);
+ assertNotNull(map);
+ assertEquals(SocialNetworkVisibility.onlymembers, map.getSocialNetworkVisibility());
+ assertEquals(UserSNetVisibility.yourbuddies, map.getUserBuddiesVisibility());
+ assertEquals("test",
+ map.getGroupMembers().getAccessLists().getAdmins().getList().get(0).getShortName());
+ assertEquals("test", map.getUserParticipation().getGroupsIsAdmin().get(0).getShortName());
+ assertEquals("usertest", map.getUserBuddies().getBuddies().get(0).getShortName());
+ assertFalse(map.getGroupRights().isAdministrable());
+ assertFalse(map.getGroupRights().isEditable());
+ assertTrue(map.getGroupRights().isVisible());
+ assertTrue(map.isMembersVisible());
+ assertTrue(map.isBuddiesVisible());
+ }
- @Test
- public void testStateTokenInStateMap() {
- final StateToken stateToken = new StateToken(TESTGROUPSHORTNAME, TESTTOOL, "1", "2");
- final StateToken stateTokenMapped = mapper.map(stateToken, StateToken.class);
- assertEquals(stateToken, stateTokenMapped);
- final StateContent state = new StateContent();
- state.setStateToken(stateToken);
- final StateContentDTO stateDTO = mapper.map(state, StateContentDTO.class);
- assertEquals(stateToken, stateDTO.getStateToken());
- }
+ @Test
+ public void testStateTokenInStateMap() {
+ final StateToken stateToken = new StateToken(TESTGROUPSHORTNAME, TESTTOOL, "1", "2");
+ final StateToken stateTokenMapped = mapper.map(stateToken, StateToken.class);
+ assertEquals(stateToken, stateTokenMapped);
+ final StateContent state = new StateContent();
+ state.setStateToken(stateToken);
+ final StateContentDTO stateDTO = mapper.map(state, StateContentDTO.class);
+ assertEquals(stateToken, stateDTO.getStateToken());
+ }
- @Test
- public void testUserToLinkMappping() {
- final User user = new User("shortName", "longName", "", "", "".getBytes(), "".getBytes(), null, null, null);
- final LinkDTO dto = mapper.map(user, LinkDTO.class);
- assertEquals("shortName", dto.getShortName());
- assertEquals("longName", dto.getLongName());
- }
+ @Test
+ public void testUserToLinkMappping() {
+ final User user = new User("shortName", "longName", "", "", "".getBytes(), "".getBytes(), null,
+ null, null);
+ final LinkDTO dto = mapper.map(user, LinkDTO.class);
+ assertEquals("shortName", dto.getShortName());
+ assertEquals("longName", dto.getLongName());
+ }
}
Modified: trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java 2011-05-03 08:22:21 UTC (rev 1334)
+++ trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java 2011-05-03 11:29:33 UTC (rev 1335)
@@ -19,75 +19,79 @@
public class KuneWaveManagerDefaultTest extends IntegrationTest {
- private static final String MESSAGE = "testing";
- private static final String NEW_PARTICIPANT = "newparti";
- private static final String TITLE = "title";
- private static final String TITLENEW = "titleNew";
- @Inject
- KuneWaveManagerDefault manager;
- @Inject
- ParticipantUtils participantUtils;
+ private static final String MESSAGE = "testing";
+ private static final String NEW_PARTICIPANT = "newparti";
+ private static final String TITLE = "title";
+ private static final String TITLENEW = "titleNew";
+ @Inject
+ KuneWaveManagerDefault manager;
+ @Inject
+ ParticipantUtils participantUtils;
- private void addParticipant(final String whoAdds) throws IOException {
- doLogin();
- final WaveRef waveletName = manager.createWave(TITLE, MESSAGE, participantUtils.of(getSiteAdminShortName()));
- assertNotNull(waveletName);
- manager.addParticipant(waveletName, getSiteAdminShortName(), whoAdds, NEW_PARTICIPANT);
- final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName());
- assertNotNull(fetchWavelet);
- assertEquals(2, fetchWavelet.getParticipants().size());
- manager.isParticipant(fetchWavelet, NEW_PARTICIPANT);
- }
+ private void addParticipant(final String whoAdds) throws IOException {
+ doLogin();
+ final WaveRef waveletName = manager.createWave(TITLE, MESSAGE,
+ participantUtils.of(getSiteAdminShortName()));
+ assertNotNull(waveletName);
+ manager.addParticipant(waveletName, getSiteAdminShortName(), whoAdds, NEW_PARTICIPANT);
+ final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName());
+ assertNotNull(fetchWavelet);
+ assertEquals(2, fetchWavelet.getParticipants().size());
+ manager.isParticipant(fetchWavelet, NEW_PARTICIPANT);
+ manager.isParticipant(fetchWavelet, "newparti");
+ }
- @Test
- public void authorAddParticipant() throws DefaultException, IOException {
- final String whoAdds = getSiteAdminShortName();
- addParticipant(whoAdds);
- }
+ @Test
+ public void authorAddParticipant() throws DefaultException, IOException {
+ final String whoAdds = getSiteAdminShortName();
+ addParticipant(whoAdds);
+ }
- @Before
- public void before() {
- new IntegrationTestHelper(this);
+ @Before
+ public void before() {
+ new IntegrationTestHelper(this);
- }
+ }
- @Test
- public void createWave() throws DefaultException, IOException {
- doLogin();
- final WaveRef waveletName = manager.createWave(MESSAGE, participantUtils.of(getSiteAdminShortName()));
- assertNotNull(waveletName);
- final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName());
- assertNotNull(fetchWavelet);
- assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE));
- }
+ @Test
+ public void createWave() throws DefaultException, IOException {
+ doLogin();
+ final WaveRef waveletName = manager.createWave(MESSAGE, participantUtils.of(getSiteAdminShortName()));
+ assertNotNull(waveletName);
+ final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName());
+ assertNotNull(fetchWavelet);
+ assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE));
+ }
- @Test
- public void createWaveWithTitle() throws DefaultException, IOException {
- doLogin();
- final WaveRef waveletName = manager.createWave(TITLE, MESSAGE, participantUtils.of(getSiteAdminShortName()));
- assertNotNull(waveletName);
- final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName());
- assertNotNull(fetchWavelet);
- assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE));
- assertEquals(TITLE, fetchWavelet.getTitle());
- }
+ @Test
+ public void createWaveWithTitle() throws DefaultException, IOException {
+ doLogin();
+ final WaveRef waveletName = manager.createWave(TITLE, MESSAGE,
+ participantUtils.of(getSiteAdminShortName()));
+ assertNotNull(waveletName);
+ final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName());
+ assertNotNull(fetchWavelet);
+ assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE));
+ assertEquals(TITLE, fetchWavelet.getTitle());
+ }
- @Test
- public void otherMemberAddParticipant() throws DefaultException, IOException {
- final String whoAdds = "otherMember";
- addParticipant(whoAdds);
- }
+ @Test
+ public void otherMemberAddParticipant() throws DefaultException, IOException {
+ final String whoAdds = "otherMember";
+ addParticipant(whoAdds);
+ }
- @Test
- public void setTitle() throws DefaultException, IOException {
- doLogin();
- final WaveRef waveletName = manager.createWave(TITLE, MESSAGE, participantUtils.of(getSiteAdminShortName()));
- assertNotNull(waveletName);
- manager.setTitle(waveletName, TITLENEW, getSiteAdminShortName());
- final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName());
- assertNotNull(fetchWavelet);
- assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE));
- assertEquals(TITLENEW, fetchWavelet.getTitle());
- }
+ @Test
+ public void setTitle() throws DefaultException, IOException {
+ doLogin();
+ final WaveRef waveletName = manager.createWave(TITLE, MESSAGE,
+ participantUtils.of(getSiteAdminShortName()));
+ assertNotNull(waveletName);
+ manager.setTitle(waveletName, TITLENEW, getSiteAdminShortName());
+ final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName());
+ assertNotNull(fetchWavelet);
+ assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE));
+ assertEquals(TITLENEW, fetchWavelet.getTitle());
+ }
}
More information about the kune-commits
mailing list