[kune-commits] r1312 - in trunk/src: main/java/cc/kune/common/client/tooltip main/java/cc/kune/core/client/auth main/java/cc/kune/core/client/cnt main/java/cc/kune/core/client/sn/actions/registry main/java/cc/kune/core/client/ui main/java/cc/kune/core/server/init main/java/cc/kune/core/server/rpc main/java/cc/kune/core/server/state main/java/cc/kune/core/shared/dto main/java/cc/kune/docs/client/cnt main/java/cc/kune/docs/server main/java/cc/kune/gspace/client main/java/cc/kune/gspace/client/resources main/java/cc/kune/wave/client main/java/cc/kune/wave/server main/java/org/ourproject/kune/blogs/client/cnt main/java/org/ourproject/kune/chat/client/cnt main/java/org/ourproject/kune/gallery/client/cnt main/java/org/ourproject/kune/wiki/client/cnt test/java/cc/kune/common/client/tooltip test/java/cc/kune/wave/server
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Thu Apr 14 16:15:22 CEST 2011
Author: vjrj_
Date: 2011-04-14 16:15:20 +0200 (Thu, 14 Apr 2011)
New Revision: 1312
Modified:
trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java
trunk/src/main/java/cc/kune/common/client/tooltip/TooltipPosition.java
trunk/src/main/java/cc/kune/common/client/tooltip/TooltipTimers.java
trunk/src/main/java/cc/kune/core/client/auth/SignInForm.java
trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java
trunk/src/main/java/cc/kune/core/client/auth/SignInPresenter.java
trunk/src/main/java/cc/kune/core/client/auth/SignInView.java
trunk/src/main/java/cc/kune/core/client/cnt/AbstractContentView.java
trunk/src/main/java/cc/kune/core/client/cnt/FoldableContentPanel.java
trunk/src/main/java/cc/kune/core/client/cnt/FoldableContentPresenter.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNMenuItemsRegistry.java
trunk/src/main/java/cc/kune/core/client/ui/DefaultFormUtils.java
trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java
trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java
trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
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/cnt/DocFolderContentPanel.java
trunk/src/main/java/cc/kune/docs/client/cnt/DocumentViewerPanel.java
trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java
trunk/src/main/java/cc/kune/gspace/client/WsArmorImpl.ui.xml
trunk/src/main/java/cc/kune/gspace/client/resources/WsArmorResources.java
trunk/src/main/java/cc/kune/gspace/client/resources/wsArmor.css
trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java
trunk/src/main/java/cc/kune/wave/client/WebClient.java
trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java
trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java
trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java
trunk/src/main/java/org/ourproject/kune/blogs/client/cnt/BlogFolderContentPanel.java
trunk/src/main/java/org/ourproject/kune/blogs/client/cnt/BlogViewerPanel.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatRoomPanel.java
trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPanel.java
trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPanel.java
trunk/src/main/java/org/ourproject/kune/wiki/client/cnt/WikiFolderContentPanel.java
trunk/src/main/java/org/ourproject/kune/wiki/client/cnt/WikiViewerPanel.java
trunk/src/test/java/cc/kune/common/client/tooltip/TooltipTimersTest.java
trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java
Log:
CLOSED - # 37: Implement a GWT Tooltip widget similar to qtip or others
http://kune.ourproject.org/issues/ticket/37
Modified: trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -6,6 +6,10 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.event.dom.client.MouseOverEvent;
@@ -69,14 +73,17 @@
show();
}
});
- final TimerWrapper outTimer = new TimerWrapper();
- outTimer.configure(new Executer() {
+ final Executer hideExecuter = new Executer() {
@Override
public void execute() {
hide();
}
- });
- timers = new TooltipTimers(overTimer, outTimer);
+ };
+ final TimerWrapper outTimer = new TimerWrapper();
+ final TimerWrapper securityTimer = new TimerWrapper();
+ outTimer.configure(hideExecuter);
+ securityTimer.configure(hideExecuter);
+ timers = new TooltipTimers(overTimer, outTimer, securityTimer);
}
protected int getHeight() {
@@ -150,6 +157,18 @@
timers.onOver();
}
}, MouseOverEvent.getType());
+ ofWidget.addDomHandler(new FocusHandler() {
+ @Override
+ public void onFocus(final FocusEvent event) {
+ // timers.onOver();
+ }
+ }, FocusEvent.getType());
+ ofWidget.addDomHandler(new BlurHandler() {
+ @Override
+ public void onBlur(final BlurEvent event) {
+ timers.onOut();
+ }
+ }, BlurEvent.getType());
ofWidget.addDomHandler(new MouseOutHandler() {
@Override
public void onMouseOut(final MouseOutEvent event) {
Modified: trunk/src/main/java/cc/kune/common/client/tooltip/TooltipPosition.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/tooltip/TooltipPosition.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/common/client/tooltip/TooltipPosition.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -8,7 +8,7 @@
public static final int ARROW_DEF_MARGIN = 10;
public static final int ARROW_SIZE = 7;
- public static final int TOOLTIP_DISTANCE = 7;
+ public static final int TOOLTIP_DISTANCE = 12;
private int arrowLeft;
private ArrowPosition arrowPosition;
Modified: trunk/src/main/java/cc/kune/common/client/tooltip/TooltipTimers.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/tooltip/TooltipTimers.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/common/client/tooltip/TooltipTimers.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -5,11 +5,13 @@
public class TooltipTimers {
private final TimerWrapper hideTimer;
+ private final TimerWrapper securityTimer;
private final TimerWrapper showTimer;
- public TooltipTimers(final TimerWrapper showTimer, final TimerWrapper hideTimer) {
+ public TooltipTimers(final TimerWrapper showTimer, final TimerWrapper hideTimer, final TimerWrapper securityTimer) {
this.showTimer = showTimer;
this.hideTimer = hideTimer;
+ this.securityTimer = securityTimer;
}
public void onOut() {
@@ -19,14 +21,20 @@
if (!hideTimer.isScheduled()) {
hideTimer.schedule(650);
}
+ if (!securityTimer.isScheduled()) {
+ securityTimer.cancel();
+ }
}
public void onOver() {
if (!showTimer.isScheduled()) {
- showTimer.schedule(500);
+ showTimer.schedule(700);
}
if (hideTimer.isScheduled()) {
hideTimer.cancel();
}
+ if (!securityTimer.isScheduled()) {
+ securityTimer.schedule(7000);
+ }
}
}
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignInForm.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInForm.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInForm.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -19,6 +19,7 @@
\*/
package cc.kune.core.client.auth;
+import cc.kune.common.client.utils.OnAcceptCallback;
import cc.kune.core.client.ui.DefaultForm;
import cc.kune.core.shared.i18n.I18nTranslationService;
@@ -34,6 +35,7 @@
private final TextField<String> loginNickOrEmailField;
private final TextField<String> loginPassField;
+ private OnAcceptCallback onAcceptCallback;
public SignInForm(final I18nTranslationService i18n) {
super.addStyleName("kune-Margin-Large-trbl");
@@ -61,8 +63,7 @@
@Override
public void handleEvent(final FieldEvent fe) {
if (fe.getEvent().getKeyCode() == 13) {
- // Window.alert("SignInForm");
- // presenter.onFormSignIn();
+ onAcceptCallback.onSuccess();
}
}
});
@@ -96,4 +97,8 @@
public void setNickOrEmail(final String nickOrEmail) {
loginNickOrEmailField.setValue(nickOrEmail);
}
+
+ public void setOnPasswordReturn(final OnAcceptCallback onAcceptCallback) {
+ this.onAcceptCallback = onAcceptCallback;
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -21,6 +21,7 @@
import cc.kune.common.client.notify.NotifyLevelImages;
import cc.kune.common.client.ui.MaskWidgetView;
+import cc.kune.common.client.utils.OnAcceptCallback;
import cc.kune.core.client.resources.CoreMessages;
import cc.kune.core.client.ui.KuneUiUtils;
import cc.kune.core.client.ui.dialogs.MessageToolbar;
@@ -122,6 +123,11 @@
}
@Override
+ public void setOnPasswordReturn(final OnAcceptCallback onAcceptCallback) {
+ signInForm.setOnPasswordReturn(onAcceptCallback);
+ }
+
+ @Override
public void show() {
super.show();
KuneUiUtils.focusOnField(getNickname());
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignInPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInPresenter.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInPresenter.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -21,6 +21,7 @@
import cc.kune.common.client.log.Log;
import cc.kune.common.client.notify.NotifyLevel;
+import cc.kune.common.client.utils.OnAcceptCallback;
import cc.kune.common.client.utils.TextUtils;
import cc.kune.common.client.utils.TimerWrapper;
import cc.kune.common.client.utils.TimerWrapper.Executer;
@@ -131,6 +132,12 @@
onFormSignIn();
}
});
+ getView().setOnPasswordReturn(new OnAcceptCallback() {
+ @Override
+ public void onSuccess() {
+ onFormSignIn();
+ }
+ });
getView().getSecondBtn().addClickHandler(new ClickHandler() {
@Override
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignInView.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInView.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInView.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -19,6 +19,8 @@
*/
package cc.kune.core.client.auth;
+import cc.kune.common.client.utils.OnAcceptCallback;
+
import com.google.gwt.event.dom.client.HasClickHandlers;
public interface SignInView extends SignInAbstractView {
@@ -39,6 +41,8 @@
void setNickOrEmail(String nickOrEmail);
+ void setOnPasswordReturn(OnAcceptCallback onAcceptCallback);
+
void validate();
}
Modified: trunk/src/main/java/cc/kune/core/client/cnt/AbstractContentView.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/cnt/AbstractContentView.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/client/cnt/AbstractContentView.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -19,12 +19,12 @@
*/
package cc.kune.core.client.cnt;
+import org.waveprotocol.wave.model.waveref.WaveRef;
+
import com.google.gwt.user.client.ui.Widget;
public interface AbstractContentView {
- public void setRawContent(final String content);
-
void attach();
void detach();
@@ -37,6 +37,10 @@
void setNoPreview();
+ public void setRawContent(final String content);
+
+ void setEditableWaveContent(WaveRef waveRef, boolean isNewWave);
+
void setWidgetAsContent(final Widget widget, boolean setDefMargins);
void showImage(String imageUrl, String imageResizedUrl, boolean showPreviewMsg);
Modified: trunk/src/main/java/cc/kune/core/client/cnt/FoldableContentPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/cnt/FoldableContentPanel.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/client/cnt/FoldableContentPanel.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -19,28 +19,56 @@
*/
package cc.kune.core.client.cnt;
+import org.waveprotocol.box.webclient.client.RemoteViewServiceMultiplexer;
+import org.waveprotocol.box.webclient.client.SimpleWaveStore;
+import org.waveprotocol.box.webclient.client.StagesProvider;
+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.widget.common.ImplPanel;
+import org.waveprotocol.wave.model.id.IdGenerator;
+import org.waveprotocol.wave.model.waveref.WaveRef;
+
+import cc.kune.common.client.log.Log;
import cc.kune.common.client.ui.IconLabel;
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.WsArmor;
+import cc.kune.wave.client.WaveClientManager;
+import cc.kune.wave.client.WebClient;
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.UIObject;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
public abstract class FoldableContentPanel extends AbstractContentPanel implements AbstractContentView {
private static final String DEF_CONTENT_MARGINS_STYLE = "kune-Margin-7-trbl";
+ private final RemoteViewServiceMultiplexer channel;
private final I18nTranslationService i18n;
+ private final IdGenerator idGenerator;
+ private final Element loading = new LoadingIndicator().getElement();
private final IconLabel messageLabel;
private final FlowPanel messagePanel;
+ private final ProfileManager profiles;
+ /** The wave panel, if a wave is open. */
+ private StagesProvider wave;
+ private final FramedPanel waveFrame;
+ private final ImplPanel waveHolder;
+ private final WaveStore waveStore = new SimpleWaveStore();
- public FoldableContentPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res) {
+ public FoldableContentPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res,
+ final WaveClientManager waveClientManager) {
super(ws);
this.i18n = i18n;
messageLabel = new IconLabel("");
@@ -50,6 +78,13 @@
messagePanel.add(messageLabel);
messagePanel.addStyleName("k-preview-msg");
messagePanel.addStyleName("kune-Margin-7-b");
+ waveFrame = new FramedPanel();
+ waveHolder = new ImplPanel("");
+ waveFrame.add(waveHolder);
+ final WebClient webClient = waveClientManager.getWebClient();
+ channel = webClient.getChannel();
+ profiles = webClient.getProfiles();
+ idGenerator = webClient.getIdGenerator();
}
private VerticalPanel createMessageVp(final boolean showMsg) {
@@ -137,6 +172,31 @@
}
@Override
+ public void setEditableWaveContent(final WaveRef waveRef, final boolean isNewWave) {
+ Log.info("FCPanel.setWave()");
+
+ 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();
+ }
+ });
+ setWidgetAsContent(waveFrame, false);
+ }
+
+ @Override
public void setWidgetAsContent(final Widget widget, final boolean setDefMargins) {
if (setDefMargins) {
widget.addStyleName(DEF_CONTENT_MARGINS_STYLE);
Modified: trunk/src/main/java/cc/kune/core/client/cnt/FoldableContentPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/cnt/FoldableContentPresenter.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/client/cnt/FoldableContentPresenter.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -19,7 +19,10 @@
*/
package cc.kune.core.client.cnt;
+import org.waveprotocol.box.webclient.client.HistorySupport;
+
import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
+import cc.kune.common.client.notify.NotifyUser;
import cc.kune.core.client.services.FileDownloadUtils;
import cc.kune.core.client.services.ImageSize;
import cc.kune.core.client.services.MediaUtils;
@@ -91,10 +94,12 @@
protected void setContent(final StateContentDTO state) {
final String typeId = state.getTypeId();
+ NotifyUser.info(typeId);
if (typeId.equals(getUploadType())) {
setUploadedContent(state);
} else if (typeId.equals(getWaveType())) {
- // setWaveContent(state);
+ setNormalContent(state);
+ // setWaveContent(state.getContent());
} else {
setNormalContent(state);
}
@@ -179,6 +184,10 @@
this.uploadType = uploadType;
}
+ private void setWaveContent(final String id) {
+ view.setEditableWaveContent(HistorySupport.waveRefFromHistoryToken(id), false);
+ }
+
public void setWaveType(final String waveType) {
this.waveType = waveType;
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -13,7 +13,6 @@
import cc.kune.core.client.state.StateChangedEvent.StateChangedHandler;
import cc.kune.core.client.state.StateManager;
import cc.kune.core.shared.domain.UserSNetVisibility;
-import cc.kune.core.shared.dto.GroupDTO;
import cc.kune.core.shared.dto.StateAbstractDTO;
import cc.kune.core.shared.i18n.I18nTranslationService;
@@ -30,8 +29,8 @@
public UserSNConfActions(final Session session, final StateManager stateManager, final I18nTranslationService i18n,
final Provider<UserSNVisibilityMenuItem> userBuddiesVisibility, final CoreResources res,
final IsGroupCondition isGroupCondition, final AddNewBuddiesAction addNewBuddiesAction) {
- OPTIONS_MENU.withToolTip(i18n.t("Options")).withIcon(res.arrowDownSitebar()).withStyles("k-sn-options-menu");
-
+ OPTIONS_MENU.withToolTip(i18n.t("Options")).withIcon(res.arrowDownSitebar()).withStyles(
+ "k-sn-options-menu, k-noborder, k-nobackcolor");
final MenuRadioItemDescriptor anyoneItem = userBuddiesVisibility.get().withVisibility(UserSNetVisibility.anyone);
final MenuRadioItemDescriptor onlyYourBuddiesItem = userBuddiesVisibility.get().withVisibility(
UserSNetVisibility.yourbuddies);
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNMenuItemsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNMenuItemsRegistry.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNMenuItemsRegistry.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -25,7 +25,8 @@
public class UserSNMenuItemsRegistry extends AbstractSNMembersActionsRegistry {
@Inject
- public UserSNMenuItemsRegistry(final Session session, final IsCurrentStateAdministrableCondition isAdministrableCondition,
+ public UserSNMenuItemsRegistry(final Session session,
+ final IsCurrentStateAdministrableCondition isAdministrableCondition,
final IsPersonCondition isPersonCondition, final IsGroupCondition isGroupCondition,
final IsLoggedCondition isLoggedCondition, final IsMeCondition isMe, final IsNotMeCondition isNotMe,
final ChangeToCollabAction changeToCollabAction, final ChangeToAdminAction changeToAdminAction,
@@ -50,14 +51,16 @@
return item;
}
});
- add(new Provider<MenuItemDescriptor>() {
- @Override
- public MenuItemDescriptor get() {
- final MenuItemDescriptor item = new MenuItemDescriptor(unjoinAction);
- item.add(isLoggedCondition);
- item.add(isGroupCondition);
- return item;
- }
- });
+ // This doesn't works, because its unregister from current state not
+ // from target group
+ // add(new Provider<MenuItemDescriptor>() {
+ // @Override
+ // public MenuItemDescriptor get() {
+ // final MenuItemDescriptor item = new MenuItemDescriptor(unjoinAction);
+ // item.add(isLoggedCondition);
+ // item.add(isGroupCondition);
+ // return item;
+ // }
+ // });
}
}
Modified: trunk/src/main/java/cc/kune/core/client/ui/DefaultFormUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/ui/DefaultFormUtils.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/client/ui/DefaultFormUtils.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -19,6 +19,8 @@
*/
package cc.kune.core.client.ui;
+import cc.kune.common.client.tooltip.Tooltip;
+
import com.extjs.gxt.ui.client.widget.form.FieldSet;
import com.extjs.gxt.ui.client.widget.form.Radio;
@@ -34,7 +36,8 @@
fieldSet.add(radio);
if (radioTip != null) {
- radio.setTitle(radioTip);
+ Tooltip.to(radio, radioTip);
+ // radio.setTitle(radioTip);
radio.setBoxLabel(radioLabel);
// radio.setBoxLabel(KuneUiUtils.genQuickTipLabel(radioLabel, null,
// radioTip));
Modified: trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -5,6 +5,8 @@
import javax.persistence.NoResultException;
import org.waveprotocol.box.server.authentication.PasswordDigest;
+import org.waveprotocol.wave.model.waveref.WaveRef;
+import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
import cc.kune.core.client.errors.UserMustBeLoggedException;
import cc.kune.core.server.content.ContentManager;
@@ -87,9 +89,9 @@
groupManager.reIndex();
final Content defaultContent = siteGroup.getDefaultContent();
- final String waveId = kuneWaveManager.createWave(
+ final WaveRef waveId = kuneWaveManager.createWave(
ContentConstants.INITIAL_CONTENT.replaceAll("\\[%s\\]", siteName), user.getShortName());
- contentManager.save(user, defaultContent, waveId);
+ contentManager.save(user, defaultContent, JavaWaverefEncoder.encodeToUriPathSegment(waveId));
contentManager.setStatus(defaultContent.getId(), ContentStatus.publishedOnline);
}
Modified: trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -19,6 +19,9 @@
*/
package cc.kune.core.server.rpc;
+import org.waveprotocol.wave.model.waveref.WaveRef;
+import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
+
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.rpcservices.GroupService;
import cc.kune.core.server.UserSession;
@@ -106,9 +109,9 @@
final User user = getUserLogged();
final Group group = mapper.map(groupDTO, Group.class);
final Group newGroup = groupManager.createGroup(group, user);
- final String waveId = kuneWaveManager.createWave("<h1>" + i18n.t("About [%s]", groupDTO.getLongName())
+ final WaveRef waveId = kuneWaveManager.createWave("<h1>" + i18n.t("About [%s]", groupDTO.getLongName())
+ "</h1>" + publicDesc, user.getShortName());
- contentManager.save(user, newGroup.getDefaultContent(), waveId);
+ contentManager.save(user, newGroup.getDefaultContent(), JavaWaverefEncoder.encodeToUriPathSegment(waveId));
// contentManager.setTags(user, defContentId, tags);
return newGroup.getDefaultContent().getStateToken();
};
Modified: trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -25,6 +25,8 @@
import org.json.JSONObject;
import org.waveprotocol.box.server.CoreSettings;
import org.waveprotocol.box.server.authentication.SessionManager;
+import org.waveprotocol.wave.model.waveref.WaveRef;
+import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
import cc.kune.core.client.errors.AccessViolationException;
import cc.kune.core.client.errors.DefaultException;
@@ -104,9 +106,9 @@
userDTO.getPassword(), userDTO.getLanguage().getCode(), userDTO.getCountry().getCode(),
userDTO.getTimezone().getId());
final Group userGroup = groupManager.createUserGroup(user, wantPersonalHomepage);
- final String waveId = kuneWaveManager.createWave("<h1>" + i18n.t("[%s] Bio", userDTO.getName()) + "</h1>"
+ final WaveRef waveId = kuneWaveManager.createWave("<h1>" + i18n.t("[%s] Bio", userDTO.getName()) + "</h1>"
+ i18n.t("This user has not written its biography yet"), user.getShortName());
- contentManager.save(user, userGroup.getDefaultContent(), waveId);
+ contentManager.save(user, userGroup.getDefaultContent(), JavaWaverefEncoder.encodeToUriPathSegment(waveId));
}
@Override
Modified: trunk/src/main/java/cc/kune/core/server/state/StateContent.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/state/StateContent.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/server/state/StateContent.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -27,21 +27,21 @@
import cc.kune.domain.BasicMimeType;
import cc.kune.domain.User;
-
public class StateContent extends StateContainer {
- private String documentId;
- private int version;
+ private List<User> authors;
private String content;
private AccessRights contentRights;
- private ContentStatus status;
- private Double rate;
- private Integer rateByUsers;
private Double currentUserRate;
+ private String documentId;
private BasicMimeType mimeType;
private Date publishedOn;
+ private Double rate;
+ private Integer rateByUsers;
+ private ContentStatus status;
private String tags;
- private List<User> authors;
+ private int version;
+ private String waveRef;
public StateContent() {
}
@@ -94,54 +94,62 @@
return version;
}
- public void setAuthors(List<User> authors) {
+ public String getWaveRef() {
+ return waveRef;
+ }
+
+ public void setAuthors(final List<User> authors) {
this.authors = authors;
}
- public void setContent(String content) {
+ public void setContent(final String content) {
this.content = content;
}
- public void setContentRights(AccessRights contentRights) {
+ public void setContentRights(final AccessRights contentRights) {
this.contentRights = contentRights;
}
- public void setCurrentUserRate(Double currentUserRate) {
+ public void setCurrentUserRate(final Double currentUserRate) {
this.currentUserRate = currentUserRate;
}
- public void setDocumentId(String documentId) {
+ public void setDocumentId(final String documentId) {
this.documentId = documentId;
}
- public void setMimeType(BasicMimeType mimeType) {
+ public void setMimeType(final BasicMimeType mimeType) {
this.mimeType = mimeType;
}
- public void setPublishedOn(Date publishedOn) {
+ public void setPublishedOn(final Date publishedOn) {
this.publishedOn = publishedOn;
}
- public void setRate(Double rate) {
+ public void setRate(final Double rate) {
this.rate = rate;
}
- public void setRateByUsers(Integer rateByUsers) {
+ public void setRateByUsers(final Integer rateByUsers) {
this.rateByUsers = rateByUsers;
}
- public void setStatus(ContentStatus status) {
+ public void setStatus(final ContentStatus status) {
this.status = status;
}
- public void setTags(String tags) {
+ public void setTags(final String tags) {
this.tags = tags;
}
- public void setVersion(int version) {
+ public void setVersion(final int version) {
this.version = version;
}
+ 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-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -19,19 +19,24 @@
*/
package cc.kune.core.server.state;
+import org.waveprotocol.wave.model.waveref.InvalidWaveRefException;
+import org.waveprotocol.wave.util.escapers.jvm.JavaWaverefEncoder;
+import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.server.access.AccessRightsService;
import cc.kune.core.server.content.ContentManager;
import cc.kune.core.server.manager.GroupManager;
import cc.kune.core.server.manager.SocialNetworkManager;
import cc.kune.core.server.manager.TagUserContentManager;
import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.docs.server.DocumentServerTool;
import cc.kune.domain.Container;
import cc.kune.domain.Content;
import cc.kune.domain.Group;
import cc.kune.domain.License;
import cc.kune.domain.Revision;
import cc.kune.domain.User;
+import cc.kune.wave.server.KuneWaveManager;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -39,26 +44,34 @@
@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 GroupManager groupManager;
private final TagUserContentManager tagManager;
- private final ContentManager contentManager;
- private final I18nTranslationService i18n;
@Inject
- public StateServiceDefault(GroupManager groupManager, SocialNetworkManager socialNetworkManager,
- ContentManager contentManager, TagUserContentManager tagManager, AccessRightsService rightsService,
- I18nTranslationService i18n) {
+ 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;
}
- public StateContainer create(User userLogged, Container container) {
+ 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());
@@ -67,14 +80,16 @@
state.setRootContainer(calculateRootContainer(container));
state.setLicense(container.getOwner().getDefaultLicense());
state.setAccessLists(container.getAccessLists());
- Group group = container.getOwner();
+ final Group group = container.getOwner();
setCommon(state, userLogged, group, container);
return state;
}
- public StateContent create(User userLogged, Content content) {
- StateContent state = new StateContent();
- state.setTypeId(content.getTypeId());
+ @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());
@@ -83,15 +98,25 @@
state.setTags(tagManager.getTagsAsString(userLogged, content));
state.setStatus(content.getStatus());
state.setStateToken(content.getStateToken());
- Revision revision = content.getLastRevision();
+ final Revision revision = content.getLastRevision();
state.setTitle(revision.getTitle());
state.setVersion(content.getVersion());
- char[] text = revision.getBody();
- state.setContent(text == null ? null : new String(text));
- Container container = content.getContainer();
+ final char[] text = revision.getBody();
+ final String textBody = text == null ? null : new String(text);
+ if (typeId.equals(DocumentServerTool.TYPE_WAVE)) {
+ state.setWaveRef(textBody);
+ try {
+ state.setContent(kuneWaveManager.fetchWavelet(JavaWaverefEncoder.decodeWaveRefFromPath(textBody)).getRootBlip().getContent());
+ } catch (final InvalidWaveRefException e) {
+ throw new DefaultException("Error retriving Wave");
+ }
+ } else {
+ state.setContent(textBody);
+ }
+ final Container container = content.getContainer();
state.setRootContainer(calculateRootContainer(container));
- License license = content.getLicense();
- Group group = container.getOwner();
+ 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());
@@ -100,17 +125,18 @@
state.setCurrentUserRate(contentManager.getRateContent(userLogged, content));
}
// FIXME: user RateResult
- Double rateAvg = contentManager.getRateAvg(content);
+ final Double rateAvg = contentManager.getRateAvg(content);
state.setRate(rateAvg != null ? rateAvg : 0D);
- Long rateByUsers = contentManager.getRateByUsers(content);
+ final Long rateByUsers = contentManager.getRateByUsers(content);
state.setRateByUsers(rateByUsers != null ? rateByUsers.intValue() : 0);
return state;
}
- public StateNoContent createNoHome(User userLogged, String groupShortName) {
- Group group = groupManager.findByShortName(groupShortName);
+ @Override
+ public StateNoContent createNoHome(final User userLogged, final String groupShortName) {
+ final Group group = groupManager.findByShortName(groupShortName);
assert (group.isPersonal());
- StateNoContent state = new StateNoContent();
+ final StateNoContent state = new StateNoContent();
state.setGroup(group);
state.setEnabledTools(groupManager.findEnabledTools(group.getId()));
setSocialNetwork(state, userLogged, group);
@@ -119,11 +145,8 @@
return state;
}
- private Container calculateRootContainer(Container container) {
- return container.isRoot() ? container : container.getAbsolutePath().get(0);
- }
-
- private void setCommon(StateContainer state, User userLogged, Group group, Container container) {
+ 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);
@@ -133,7 +156,7 @@
setSocialNetwork(state, userLogged, group);
}
- private void setSocialNetwork(StateAbstract state, User userLogged, Group 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-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/core/shared/dto/StateContentDTO.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -30,18 +30,19 @@
public class StateContentDTO extends StateContainerDTO implements IsSerializable {
- private String documentId;
- private int version;
+ private List<UserSimpleDTO> authors;
private String content;
private AccessRights contentRights;
- private ContentStatus status;
- private Double rate;
- private Integer rateByUsers;
private Double currentUserRate;
+ private String documentId;
private BasicMimeTypeDTO mimeType;
private Date publishedOn;
+ private Double rate;
+ private Integer rateByUsers;
+ private ContentStatus status;
private String tags;
- private List<UserSimpleDTO> authors;
+ private int version;
+ private String waveRef;
public StateContentDTO() {
}
@@ -94,6 +95,10 @@
return version;
}
+ public String getWaveRef() {
+ return waveRef;
+ }
+
public void setAuthors(final List<UserSimpleDTO> authors) {
this.authors = authors;
}
@@ -148,6 +153,10 @@
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/cnt/DocFolderContentPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/cnt/DocFolderContentPanel.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/docs/client/cnt/DocFolderContentPanel.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -23,14 +23,16 @@
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.WsArmor;
+import cc.kune.wave.client.WaveClientManager;
import com.google.inject.Inject;
public class DocFolderContentPanel extends FoldableContentPanel implements DocFolderContentView {
@Inject
- public DocFolderContentPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res) {
- super(ws, i18n, res);
+ public DocFolderContentPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res,
+ final WaveClientManager waveClientManager) {
+ super(ws, i18n, res, waveClientManager);
setInfo("");
}
}
Modified: trunk/src/main/java/cc/kune/docs/client/cnt/DocumentViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/cnt/DocumentViewerPanel.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/docs/client/cnt/DocumentViewerPanel.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -23,13 +23,15 @@
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.WsArmor;
+import cc.kune.wave.client.WaveClientManager;
import com.google.inject.Inject;
public class DocumentViewerPanel extends FoldableContentPanel implements DocumentViewerView {
@Inject
- public DocumentViewerPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res) {
- super(ws, i18n, res);
+ public DocumentViewerPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res,
+ final WaveClientManager waveClientManager) {
+ super(ws, i18n, res, waveClientManager);
}
}
Modified: trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -46,6 +46,7 @@
public static final String TYPE_FOLDER = NAME + "." + "folder";
public static final String TYPE_ROOT = NAME + "." + "root";
public static final String TYPE_UPLOADEDFILE = NAME + "." + ServerTool.UPLOADEDFILE_SUFFIX;
+ public static final String TYPE_WAVE = NAME + "." + ServerTool.WAVE_SUFFIX;
private final ToolConfigurationManager configurationManager;
private final ContainerManager containerManager;
@@ -75,9 +76,10 @@
}
void checkContentTypeId(final String parentTypeId, final String typeId) {
- if (typeId.equals(TYPE_DOCUMENT) || typeId.equals(TYPE_UPLOADEDFILE)) {
+ if (typeId.equals(TYPE_DOCUMENT) || typeId.equals(TYPE_UPLOADEDFILE) || typeId.equals(TYPE_WAVE)) {
// ok valid content
if ((typeId.equals(TYPE_DOCUMENT) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER)))
+ || (typeId.equals(TYPE_WAVE) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER)))
|| (typeId.equals(TYPE_UPLOADEDFILE) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER)))) {
// ok
} else {
@@ -123,10 +125,10 @@
configurationManager.persist(config);
final String longName = group.getLongName();
final Content content = contentManager.createContent(i18n.t("About [%s]", longName), "", user, rootFolder,
- DocumentServerTool.TYPE_DOCUMENT);
+ DocumentServerTool.TYPE_WAVE);
content.addAuthor(user);
content.setLanguage(user.getLanguage());
- content.setTypeId(TYPE_DOCUMENT);
+ content.setTypeId(TYPE_WAVE);
content.setStatus(ContentStatus.publishedOnline);
content.setPublishedOn(new Date());
group.setDefaultContent(content);
Modified: trunk/src/main/java/cc/kune/gspace/client/WsArmorImpl.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/WsArmorImpl.ui.xml 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/gspace/client/WsArmorImpl.ui.xml 2011-04-14 14:15:20 UTC (rev 1312)
@@ -49,8 +49,7 @@
</g:FlowPanel>
<g:FlowPanel width="100%" height="60px"
styleName="{res.style.docSubheader}" ui:field="docSubheader">
- <g:Image resource='{res.defThemeDocArrowDown}'
- styleName='{res.style.docHeaderArrow}' />
+ <g:HTMLPanel ui:field="arrow" styleName="{res.style.docSubheaderArrow}" />
</g:FlowPanel>
</g:VerticalPanel>
</g:north>
Modified: trunk/src/main/java/cc/kune/gspace/client/resources/WsArmorResources.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/resources/WsArmorResources.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/gspace/client/resources/WsArmorResources.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -38,6 +38,8 @@
String docSubheader();
+ String docSubheaderArrow();
+
String docSubheaderLeft();
String entityFooter();
Modified: trunk/src/main/java/cc/kune/gspace/client/resources/wsArmor.css
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/resources/wsArmor.css 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/gspace/client/resources/wsArmor.css 2011-04-14 14:15:20 UTC (rev 1312)
@@ -169,4 +169,24 @@
color: #a05a2c;
font-size: 20px;
font-weight: bold;
+}
+
+/* Derived from: from http://jonrohan.me/guide/css/creating-triangles-in-css/ */
+.docSubheaderArrow {
+ border-color: #C87137 transparent transparent transparent;
+ border-style: solid;
+ border-width: 7px;
+ height: 0;
+ width: 0;
+ position: absolute;
+ bottom: 47px;
+ left: 36px;
+}
+
+/* IE6 */
+.docSubheaderArrow {
+ _border-left-color: pink;
+ _border-bottom-color: pink;
+ _border-right-color: pink;
+ _filter: literal("chroma(color=pink)");
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -62,6 +62,10 @@
});
}
+ public WebClient getWebClient() {
+ return webClient;
+ }
+
private native void setClientFlags(JavaScriptObject object) /*-{
$wnd.__client_flags = object;
}-*/;
Modified: trunk/src/main/java/cc/kune/wave/client/WebClient.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WebClient.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/wave/client/WebClient.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -132,6 +132,18 @@
private RemoteViewServiceMultiplexer channel;
+ public RemoteViewServiceMultiplexer getChannel() {
+ return channel;
+}
+
+ public IdGenerator getIdGenerator() {
+ return idGenerator;
+}
+
+ public ProfileManager getProfiles() {
+ return profiles;
+}
+
private final EventBus eventBus;
/**
@@ -254,9 +266,13 @@
* Returns <code>ws://yourhost[:port]/</code>.
*/
// XXX check formatting wrt GPE
- private native String getWebSocketBaseUrl(String moduleBase) /*-{return "ws" + /:\/\/[^\/]+/.exec(moduleBase)[0] + "/";}-*/;
+ private native String getWebSocketBaseUrl(String moduleBase) /*-{
+ return "ws" + /:\/\/[^\/]+/.exec(moduleBase)[0] + "/";
+}-*/;
- private native boolean useSocketIO() /*-{ return !!$wnd.__useSocketIO }-*/;
+ private native boolean useSocketIO() /*-{
+ return !!$wnd.__useSocketIO
+}-*/;
/**
*/
Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -1,7 +1,13 @@
package cc.kune.wave.server;
+import org.waveprotocol.wave.model.waveref.WaveRef;
+
+import com.google.wave.api.Wavelet;
+
public interface KuneWaveManager {
- String createWave(String message, String... participants);
+ WaveRef createWave(String message, String... participants);
+ Wavelet fetchWavelet(WaveRef waveRef);
+
}
Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -1,6 +1,8 @@
package cc.kune.wave.server;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
@@ -12,15 +14,20 @@
import org.waveprotocol.box.server.robots.util.OperationUtil;
import org.waveprotocol.box.server.waveserver.WaveletProvider;
import org.waveprotocol.box.server.waveserver.WaveletProvider.SubmitRequestListener;
+import org.waveprotocol.wave.model.id.InvalidIdException;
import org.waveprotocol.wave.model.version.HashedVersion;
import org.waveprotocol.wave.model.wave.ParticipantId;
+import org.waveprotocol.wave.model.waveref.WaveRef;
import cc.kune.common.client.utils.TextUtils;
import cc.kune.core.client.errors.DefaultException;
import com.google.inject.Inject;
import com.google.inject.name.Named;
+import com.google.wave.api.ApiIdSerializer;
import com.google.wave.api.Blip;
+import com.google.wave.api.BlipData;
+import com.google.wave.api.BlipThread;
import com.google.wave.api.JsonRpcConstant.ParamsProperty;
import com.google.wave.api.JsonRpcResponse;
import com.google.wave.api.OperationQueue;
@@ -28,6 +35,7 @@
import com.google.wave.api.ProtocolVersion;
import com.google.wave.api.Wavelet;
import com.google.wave.api.data.converter.EventDataConverterManager;
+import com.google.wave.api.impl.WaveletData;
public class KuneWaveManagerDefault implements KuneWaveManager {
public static final Log LOG = LogFactory.getLog(KuneWaveManagerDefault.class);
@@ -53,8 +61,9 @@
}
@Override
- public String createWave(final String message, final String... participantArray) {
+ public WaveRef createWave(final String message, final String... participantArray) {
String newWaveId = null;
+ String newWaveletId = null;
final Set<String> participants = new HashSet<String>();
for (final String participant : participantArray) {
participants.add(participantUtils.of(participant).toString());
@@ -62,16 +71,8 @@
final ParticipantId user = participantUtils.of(participantArray[0]);
final OperationQueue opQueue = new OperationQueue();
final Wavelet newWavelet = opQueue.createWavelet(domain, participants);
- // opQueue.appendMarkupToDocument(newWavelet.getRootBlip(),
- // Markup.of(message).getMarkup());
- // opQueue.appendBlipToWavelet(newWavelet,
- // Markup.of(message).getMarkup());
- //
final Blip rootBlip = newWavelet.getRootBlip();
- // rootBlip.append(Markup.of(message));
- rootBlip.append(new com.google.wave.api.Markup("<b>kk</b>"));
- // opQueue.modifyDocument(rootBlip).addParameter(
- // Parameter.of(ParamsProperty.MODIFY_ACTION, ModifyHow.INSERT_AFTER));
+ 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()) {
@@ -83,11 +84,13 @@
onFailure(context.getResponse(reqId).getErrorMessage());
} else {
final Object responseWaveId = response.getData().get(ParamsProperty.WAVE_ID);
- if (responseWaveId != null) {
+ 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;
}
}
}
@@ -103,9 +106,60 @@
LOG.info("Wave creation success: " + arg1);
}
});
- return newWaveId;
+ 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 Wavelet fetchWavelet(final WaveRef waveName) {
+ 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.getSuperAdmin());
+ final String reqId = request.getId();
+ final JsonRpcResponse response = context.getResponse(reqId);
+ if (response != null) {
+ if (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 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;
+ }
+
private void onFailure(final String message) {
final String errorMsg = TextUtils.notEmpty(message) ? message : "Wave operation failed";
LOG.error(errorMsg);
Modified: trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -5,6 +5,7 @@
import org.waveprotocol.wave.model.wave.ParticipantId;
import cc.kune.core.client.errors.DefaultException;
+import cc.kune.core.server.properties.DatabaseProperties;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -14,12 +15,19 @@
public class ParticipantUtils {
private final String domain;
+ private final ParticipantId superAdmin;
@Inject
- public ParticipantUtils(@Named(CoreSettings.WAVE_SERVER_DOMAIN) final String domain) {
+ public ParticipantUtils(@Named(CoreSettings.WAVE_SERVER_DOMAIN) final String domain,
+ final DatabaseProperties databaseProperties) throws InvalidParticipantAddress {
this.domain = domain;
+ superAdmin = of(databaseProperties.getAdminShortName());
}
+ public ParticipantId getSuperAdmin() {
+ return superAdmin;
+ }
+
public ParticipantId of(final String username) {
try {
if (username.contains(ParticipantId.DOMAIN_PREFIX)) {
Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/cnt/BlogFolderContentPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/blogs/client/cnt/BlogFolderContentPanel.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/org/ourproject/kune/blogs/client/cnt/BlogFolderContentPanel.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -23,13 +23,15 @@
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.WsArmor;
+import cc.kune.wave.client.WaveClientManager;
import com.google.inject.Inject;
public class BlogFolderContentPanel extends FoldableContentPanel implements BlogFolderContentView {
@Inject
- public BlogFolderContentPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res) {
- super(ws, i18n, res);
+ public BlogFolderContentPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res,
+ final WaveClientManager waveClientManager) {
+ super(ws, i18n, res, waveClientManager);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/cnt/BlogViewerPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/blogs/client/cnt/BlogViewerPanel.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/org/ourproject/kune/blogs/client/cnt/BlogViewerPanel.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -23,12 +23,14 @@
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.WsArmor;
+import cc.kune.wave.client.WaveClientManager;
import com.google.inject.Inject;
public class BlogViewerPanel extends FoldableContentPanel implements BlogViewerView {
@Inject
- public BlogViewerPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res) {
- super(ws, i18n, res);
+ public BlogViewerPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res,
+ final WaveClientManager waveClientManager) {
+ super(ws, i18n, res, waveClientManager);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatRoomPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatRoomPanel.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatRoomPanel.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -23,13 +23,15 @@
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.WsArmor;
+import cc.kune.wave.client.WaveClientManager;
import com.google.inject.Inject;
public class ChatRoomPanel extends FoldableContentPanel implements ChatRoomView {
@Inject
- public ChatRoomPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res) {
- super(ws, i18n, res);
+ public ChatRoomPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res,
+ final WaveClientManager waveClientManager) {
+ super(ws, i18n, res, waveClientManager);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPanel.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryFolderContentPanel.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -27,6 +27,7 @@
import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.WsArmor;
+import cc.kune.wave.client.WaveClientManager;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
@@ -44,8 +45,8 @@
@Inject
public GalleryFolderContentPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res,
- final StateManager stateManager, final Session session) {
- super(ws, i18n, res);
+ final StateManager stateManager, final Session session, final WaveClientManager waveClientManager) {
+ super(ws, i18n, res, waveClientManager);
this.stateManager = stateManager;
this.session = session;
}
Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPanel.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/GalleryViewerPanel.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -23,13 +23,15 @@
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.WsArmor;
+import cc.kune.wave.client.WaveClientManager;
import com.google.inject.Inject;
public class GalleryViewerPanel extends FoldableContentPanel implements GalleryViewerView {
@Inject
- public GalleryViewerPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res) {
- super(ws, i18n, res);
+ public GalleryViewerPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res,
+ final WaveClientManager waveClientManager) {
+ super(ws, i18n, res, waveClientManager);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/wiki/client/cnt/WikiFolderContentPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/wiki/client/cnt/WikiFolderContentPanel.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/org/ourproject/kune/wiki/client/cnt/WikiFolderContentPanel.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -23,14 +23,16 @@
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.WsArmor;
+import cc.kune.wave.client.WaveClientManager;
import com.google.inject.Inject;
public class WikiFolderContentPanel extends FoldableContentPanel implements WikiFolderContentView {
@Inject
- public WikiFolderContentPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res) {
- super(ws, i18n, res);
+ public WikiFolderContentPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res,
+ final WaveClientManager waveClientManager) {
+ super(ws, i18n, res, waveClientManager);
super.setLabel("");
}
}
Modified: trunk/src/main/java/org/ourproject/kune/wiki/client/cnt/WikiViewerPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/wiki/client/cnt/WikiViewerPanel.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/main/java/org/ourproject/kune/wiki/client/cnt/WikiViewerPanel.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -23,12 +23,14 @@
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.WsArmor;
+import cc.kune.wave.client.WaveClientManager;
import com.google.inject.Inject;
public class WikiViewerPanel extends FoldableContentPanel implements WikiViewerView {
@Inject
- public WikiViewerPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res) {
- super(ws, i18n, res);
+ public WikiViewerPanel(final WsArmor ws, final I18nTranslationService i18n, final CoreResources res,
+ final WaveClientManager waveClientManager) {
+ super(ws, i18n, res, waveClientManager);
}
}
Modified: trunk/src/test/java/cc/kune/common/client/tooltip/TooltipTimersTest.java
===================================================================
--- trunk/src/test/java/cc/kune/common/client/tooltip/TooltipTimersTest.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/test/java/cc/kune/common/client/tooltip/TooltipTimersTest.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -11,6 +11,7 @@
public class TooltipTimersTest {
private TimerWrapper hideTimer;
protected boolean hideTimerScheduled = false;
+ private TimerWrapper securityTimer;
private TimerWrapper showTimer;
protected boolean showTimerScheduled = false;
private TooltipTimers timers;
@@ -19,7 +20,8 @@
public void before() {
showTimer = Mockito.mock(TimerWrapper.class);
hideTimer = Mockito.mock(TimerWrapper.class);
- timers = new TooltipTimers(showTimer, hideTimer);
+ securityTimer = Mockito.mock(TimerWrapper.class);
+ timers = new TooltipTimers(showTimer, hideTimer, securityTimer);
Mockito.doAnswer(new Answer<Object>() {
@Override
public Object answer(final InvocationOnMock invocation) throws Throwable {
Modified: trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java 2011-04-13 15:41:45 UTC (rev 1311)
+++ trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java 2011-04-14 14:15:20 UTC (rev 1312)
@@ -1,20 +1,24 @@
package cc.kune.wave.server;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
+import org.waveprotocol.wave.model.waveref.WaveRef;
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.server.integration.IntegrationTest;
import cc.kune.core.server.integration.IntegrationTestHelper;
import com.google.inject.Inject;
+import com.google.wave.api.Wavelet;
public class KuneWaveManagerDefaultTest extends IntegrationTest {
+ private static final String MESSAGE = "testing";
@Inject
KuneWaveManagerDefault manager;
@@ -27,6 +31,10 @@
@Test
public void createWave() throws DefaultException, IOException {
doLogin();
- assertNotNull(manager.createWave("testing", getSiteAdminShortName()));
+ final WaveRef waveletName = manager.createWave(MESSAGE, getSiteAdminShortName());
+ assertNotNull(waveletName);
+ final Wavelet fetchWavelet = manager.fetchWavelet(waveletName);
+ assertNotNull(fetchWavelet);
+ assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE));
}
}
More information about the kune-commits
mailing list