[kune-commits] r1394 - in trunk: . src/main/java/cc/kune/common/client/ui src/main/java/cc/kune/core/client/errors src/main/java/cc/kune/domain src/main/java/cc/kune/gspace/client/resources src/main/java/cc/kune/wave/client
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Mon May 16 00:23:31 CEST 2011
Author: vjrj_
Date: 2011-05-16 00:23:30 +0200 (Mon, 16 May 2011)
New Revision: 1394
Modified:
trunk/
trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java
trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
trunk/src/main/java/cc/kune/domain/Content.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
Log:
logout/login wave fixed
Property changes on: trunk
___________________________________________________________________
Name: svn:ignore
- pmd-eclipse.log
.pmd
www-test
screenlog.0
client
public
target
target-local
Main-compile
.settings
.gwt-cache
repository
derby.log
star-yellow-grey.png
run.sh
tomcat
gwt-out
synccss.sh
.externalToolBuilders
.wtpmodules
www
testRepository
kune-OLD-jcr
KuneApp.launch
KuneApp NOSERVER.launch
old_src
org.ourproject.kune.app.Kune
org.ourproject.kune.iml
org.ourproject.kune.ipr
org.ourproject.kune.iws
nbproject
hibernate.reveng.xml
.gwt-tmp
target-eclipse
.checkstyle
.classpath-bien
pom.xml.*
.gwt
.jdee_sources
.jdee_classpath
prj.el
.factorypath
.apt_generated
target.old
_accounts
_certificates
_deltas
+ pmd-eclipse.log
.pmd
www-test
screenlog.0
client
public
target
target-local
Main-compile
.settings
.gwt-cache
repository
derby.log
star-yellow-grey.png
run.sh
tomcat
gwt-out
synccss.sh
.externalToolBuilders
.wtpmodules
www
testRepository
kune-OLD-jcr
KuneApp.launch
KuneApp NOSERVER.launch
old_src
org.ourproject.kune.app.Kune
org.ourproject.kune.iml
org.ourproject.kune.ipr
org.ourproject.kune.iws
nbproject
hibernate.reveng.xml
.gwt-tmp
target-eclipse
.checkstyle
.classpath-bien
pom.xml.*
.gwt
.jdee_sources
.jdee_classpath
prj.el
.factorypath
.apt_generated
target.old
_accounts
_certificates
_deltas
logs
Modified: trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java 2011-05-15 18:10:08 UTC (rev 1393)
+++ trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java 2011-05-15 22:23:30 UTC (rev 1394)
@@ -147,11 +147,6 @@
}
}
- @UiHandler("textbox")
- void onMouseOutTextBox(final MouseOutEvent event) {
- finishEdit();
- }
-
@UiHandler("label")
void onMouseOver(final MouseOverEvent event) {
if (editable) {
Modified: trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2011-05-15 18:10:08 UTC (rev 1393)
+++ trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2011-05-15 22:23:30 UTC (rev 1394)
@@ -19,6 +19,9 @@
*/
package cc.kune.core.client.errors;
+import org.waveprotocol.wave.client.common.safehtml.SafeHtml;
+import org.waveprotocol.wave.client.common.util.AsyncHolder.Accessor;
+
import cc.kune.common.client.log.Log;
import cc.kune.common.client.notify.NotifyLevel;
import cc.kune.common.client.notify.NotifyUser;
@@ -28,6 +31,7 @@
import cc.kune.core.client.state.SiteTokens;
import cc.kune.core.client.state.StateManager;
import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.wave.client.WebClient;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException;
@@ -35,93 +39,106 @@
public class ErrorHandler {
- private final EventBus eventBus;
- private final I18nTranslationService i18n;
- private final Session session;
- private final StateManager stateManager;
+ private final EventBus eventBus;
+ private final I18nTranslationService i18n;
+ private final Session session;
+ private final StateManager stateManager;
- @Inject
- public ErrorHandler(final Session session, final I18nTranslationService i18n, final StateManager stateManager,
- final EventBus eventBus) {
- this.session = session;
- this.i18n = i18n;
- this.stateManager = stateManager;
- this.eventBus = eventBus;
- }
+ @Inject
+ public ErrorHandler(final Session session, final I18nTranslationService i18n,
+ final StateManager stateManager, final EventBus eventBus) {
+ this.session = session;
+ this.i18n = i18n;
+ this.stateManager = stateManager;
+ this.eventBus = eventBus;
+ }
- public void doSessionExpired() {
- eventBus.fireEvent(new SessionExpiredEvent());
- eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.info, "Your session has expired. Please log in again."));
- }
+ public void doSessionExpired() {
+ eventBus.fireEvent(new SessionExpiredEvent());
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.info,
+ "Your session has expired. Please log in again."));
+ }
- private void goHome() {
- stateManager.gotoHistoryToken(SiteTokens.GROUP_HOME);
- }
+ private void goHome() {
+ stateManager.gotoHistoryToken(SiteTokens.GROUP_HOME);
+ }
- private void logException(final Throwable caught) {
- logException(caught, false);
- }
+ private void logException(final Throwable caught) {
+ logException(caught, false);
+ }
- private void logException(final Throwable caught, final boolean showException) {
- if (showException) {
- Log.debug("Exception in KuneErrorHandler", caught);
- } else {
- Log.debug("Exception in KuneErrorHandler: " + caught.getMessage());
- }
+ private void logException(final Throwable caught, final boolean showException) {
+ if (showException) {
+ Log.debug("Exception in KuneErrorHandler", caught);
+ } else {
+ Log.debug("Exception in KuneErrorHandler: " + caught.getMessage());
}
+ }
- public void process(final Throwable caught) {
- eventBus.fireEvent(new ProgressHideEvent());
- if (caught instanceof AccessViolationException) {
- logException(caught);
- eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
- i18n.t("You do not have rights to perform that action")));
- } else if (caught instanceof SessionExpiredException) {
- logException(caught);
- doSessionExpired();
- } else if (caught instanceof UserMustBeLoggedException) {
- logException(caught);
- if (session.isLogged()) {
- doSessionExpired();
- } else {
- eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.important,
- i18n.t("Please sign in or register to collaborate")));
- }
- } else if (caught instanceof GroupNotFoundException) {
- logException(caught);
- eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.veryImportant, i18n.t("Group not found")));
- goHome();
- } else if (caught instanceof IncompatibleRemoteServiceException) {
- eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
- i18n.t("Your browser is outdated with the server software. Please reload this page.")));
- } else if (caught instanceof ContentNotFoundException) {
- logException(caught);
- eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.veryImportant, i18n.t("Content not found")));
- goHome();
- } else if (caught instanceof ContentNotPermittedException) {
- logException(caught);
- eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error, i18n.t("Action not permitted in this location")));
- goHome();
- } else if (caught instanceof ContainerNotPermittedException) {
- logException(caught);
- eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error, i18n.t("Action not permitted in this location")));
- goHome();
- } else if (caught instanceof LastAdminInGroupException) {
- logException(caught);
- NotifyUser.showAlertMessage(i18n.t("Warning"), i18n.t("Sorry, you are the last admin of this group."
- + " Look for someone to substitute you appropriately as admin before leaving this group."));
- } else if (caught instanceof AlreadyGroupMemberException) {
- logException(caught);
- eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error, i18n.t("This group is already a group member")));
- } else if (caught instanceof AlreadyUserMemberException) {
- logException(caught);
- eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error, i18n.t("This user is already a group member")));
- } else {
- logException(caught, true);
- eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
- i18n.t("Oops! Something has gone wrong with our servers. Retry later, please.")));
- Log.error("Other kind of exception in StateManagerDefault/processErrorException", caught);
+ public void process(final Throwable caught) {
+ eventBus.fireEvent(new ProgressHideEvent());
+ if (caught instanceof AccessViolationException) {
+ logException(caught);
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
+ i18n.t("You do not have rights to perform that action")));
+ } else if (caught instanceof SessionExpiredException) {
+ logException(caught);
+ doSessionExpired();
+ } else if (caught instanceof UserMustBeLoggedException) {
+ logException(caught);
+ if (session.isLogged()) {
+ doSessionExpired();
+ } else {
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.important,
+ i18n.t("Please sign in or register to collaborate")));
+ }
+ } else if (caught instanceof GroupNotFoundException) {
+ logException(caught);
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.veryImportant, i18n.t("Group not found")));
+ goHome();
+ } else if (caught instanceof IncompatibleRemoteServiceException) {
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
+ i18n.t("Your browser is outdated with the server software. Please reload this page.")));
+ } else if (caught instanceof ContentNotFoundException) {
+ logException(caught);
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.veryImportant, i18n.t("Content not found")));
+ goHome();
+ } else if (caught instanceof ContentNotPermittedException) {
+ logException(caught);
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
+ i18n.t("Action not permitted in this location")));
+ goHome();
+ } else if (caught instanceof ContainerNotPermittedException) {
+ logException(caught);
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
+ i18n.t("Action not permitted in this location")));
+ goHome();
+ } else if (caught instanceof LastAdminInGroupException) {
+ logException(caught);
+ NotifyUser.showAlertMessage(i18n.t("Warning"),
+ i18n.t("Sorry, you are the last admin of this group."
+ + " Look for someone to substitute you appropriately as admin before leaving this group."));
+ } else if (caught instanceof AlreadyGroupMemberException) {
+ logException(caught);
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
+ i18n.t("This group is already a group member")));
+ } else if (caught instanceof AlreadyUserMemberException) {
+ logException(caught);
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
+ i18n.t("This user is already a group member")));
+ } else {
+ logException(caught, true);
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
+ i18n.t("Oops! Something has gone wrong with our servers. Retry later, please.")));
+ final String error = "Other kind of exception in StateManagerDefault/processErrorException";
+ Log.error(error, caught);
+ WebClient.ErrorHandler.getStackTraceAsync(caught, new Accessor<SafeHtml>() {
+ @Override
+ public void use(final SafeHtml stack) {
+ NotifyUser.logError(stack.asString().replace("<br>", "\n"));
}
+ });
}
+ }
}
Modified: trunk/src/main/java/cc/kune/domain/Content.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/Content.java 2011-05-15 18:10:08 UTC (rev 1393)
+++ trunk/src/main/java/cc/kune/domain/Content.java 2011-05-15 22:23:30 UTC (rev 1394)
@@ -135,7 +135,7 @@
private String typeId;
@Version
- private int version;
+ private Integer version;
private String waveId;
@@ -336,7 +336,7 @@
this.typeId = typeId;
}
- public void setVersion(final int version) {
+ public void setVersion(final Integer version) {
this.version = version;
}
Modified: trunk/src/main/java/cc/kune/gspace/client/resources/wsArmor.css
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/resources/wsArmor.css 2011-05-15 18:10:08 UTC (rev 1393)
+++ trunk/src/main/java/cc/kune/gspace/client/resources/wsArmor.css 2011-05-15 22:23:30 UTC (rev 1394)
@@ -69,7 +69,7 @@
font-weight: bold;
margin-left: 15px;
font: 'UbuntuBold', Arial;
- line-height: 1.3em;
+ line-height: 36px;
}
.docHeader input {
Modified: trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java 2011-05-15 18:10:08 UTC (rev 1393)
+++ trunk/src/main/java/cc/kune/wave/client/WaveClientManager.java 2011-05-15 22:23:30 UTC (rev 1394)
@@ -37,63 +37,65 @@
import com.google.inject.Inject;
public class WaveClientManager {
- private WebClient webClient;
+ private WebClient webClient;
- @Inject
- public WaveClientManager(final Session session, final StateManager stateManager, final EventBus eventBus,
- final UserServiceAsync userService, final GSpaceArmor wsArmor) {
- session.onUserSignIn(true, new UserSignInHandler() {
- @Override
- public void onUserSignIn(final UserSignInEvent event) {
- userService.getWaveClientParameters(session.getUserHash(), new AsyncCallbackSimple<WaveClientParams>() {
-
- @Override
- public void onSuccess(final WaveClientParams result) {
- // NotifyUser.info(result.getSessionJSON(), true);
- setUseSocketIO(result.useSocketIO());
- setSessionJSON(JsonUtils.safeEval(result.getSessionJSON()));
- setClientFlags(JsonUtils.safeEval(result.getClientFlags()));
- // Only for testing:
- final ForIsWidget userSpace = wsArmor.getUserSpace();
- if (webClient == null) {
- if (userSpace.getWidgetCount() > 0) {
- userSpace.remove(0);
- }
- webClient = new WebClient(eventBus);
- userSpace.add(webClient);
- } else {
- webClient.setVisible(true);
- }
- }
- });
- }
- });
- session.onUserSignOut(true, new UserSignOutHandler() {
- @Override
- public void onUserSignOut(final UserSignOutEvent event) {
- if (webClient != null) {
- webClient.setVisible(false);
+ @Inject
+ public WaveClientManager(final Session session, final StateManager stateManager,
+ final EventBus eventBus, final UserServiceAsync userService, final GSpaceArmor wsArmor) {
+ session.onUserSignIn(true, new UserSignInHandler() {
+ @Override
+ public void onUserSignIn(final UserSignInEvent event) {
+ userService.getWaveClientParameters(session.getUserHash(),
+ new AsyncCallbackSimple<WaveClientParams>() {
+ @Override
+ public void onSuccess(final WaveClientParams result) {
+ // NotifyUser.info(result.getSessionJSON(), true);
+ setUseSocketIO(result.useSocketIO());
+ setSessionJSON(JsonUtils.safeEval(result.getSessionJSON()));
+ setClientFlags(JsonUtils.safeEval(result.getClientFlags()));
+ // Only for testing:
+ final ForIsWidget userSpace = wsArmor.getUserSpace();
+ if (webClient == null) {
+ if (userSpace.getWidgetCount() > 0) {
+ userSpace.remove(0);
+ }
+ webClient = new WebClient(eventBus);
+ userSpace.add(webClient);
+ } else {
+ webClient.login();
+ webClient.setVisible(true);
}
- setUseSocketIO(false);
- setSessionJSON(JsonUtils.safeEval("{}"));
- setClientFlags(JsonUtils.safeEval("{}"));
- }
- });
- }
+ }
+ });
+ }
+ });
+ session.onUserSignOut(true, new UserSignOutHandler() {
+ @Override
+ public void onUserSignOut(final UserSignOutEvent event) {
+ if (webClient != null) {
+ webClient.setVisible(false);
+ webClient.logout();
+ }
+ setUseSocketIO(false);
+ setSessionJSON(JsonUtils.safeEval("{}"));
+ setClientFlags(JsonUtils.safeEval("{}"));
+ }
+ });
+ }
- public WebClient getWebClient() {
- return webClient;
- }
+ public WebClient getWebClient() {
+ return webClient;
+ }
- private native void setClientFlags(JavaScriptObject object) /*-{
+ private native void setClientFlags(JavaScriptObject object) /*-{
$wnd.__client_flags = object;
- }-*/;
+ }-*/;
- private native void setSessionJSON(JavaScriptObject object) /*-{
+ private native void setSessionJSON(JavaScriptObject object) /*-{
$wnd.__session = object;
- }-*/;
+ }-*/;
- private native void setUseSocketIO(boolean use) /*-{
+ private native void setUseSocketIO(boolean use) /*-{
$wnd.__useSocketIO = use;
- }-*/;
+ }-*/;
}
Modified: trunk/src/main/java/cc/kune/wave/client/WebClient.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WebClient.java 2011-05-15 18:10:08 UTC (rev 1393)
+++ trunk/src/main/java/cc/kune/wave/client/WebClient.java 2011-05-15 22:23:30 UTC (rev 1394)
@@ -64,7 +64,6 @@
import cc.kune.common.client.notify.NotifyUser;
import cc.kune.core.client.errors.DefaultException;
-import cc.kune.core.client.sitebar.ErrorsDialog;
import cc.kune.core.client.sitebar.spaces.Space;
import cc.kune.core.client.sitebar.spaces.SpaceConfEvent;
import cc.kune.core.client.state.SiteTokens;
@@ -98,7 +97,7 @@
* (an alert placed on the top of the screen). Once the stack trace is
* prepared, it is revealed in the banner via a link.
*/
- static class ErrorHandler implements UncaughtExceptionHandler {
+ public static class ErrorHandler implements UncaughtExceptionHandler {
public static void install() {
GWT.setUncaughtExceptionHandler(new ErrorHandler(GWT.getUncaughtExceptionHandler()));
}
@@ -124,7 +123,7 @@
this.next = next;
}
- private void getStackTraceAsync(final Throwable t, final Accessor<SafeHtml> whenReady) {
+ public static void getStackTraceAsync(final Throwable t, final Accessor<SafeHtml> whenReady) {
// TODO: Request stack-trace de-obfuscation. For now, just use the
// javascript stack trace.
//
@@ -245,7 +244,7 @@
/**
* Create a remote websocket to talk to the server-side FedOne service.
*/
- private final WaveWebSocketClient websocket;
+ private WaveWebSocketClient websocket;
/**
* This is the entry point method.
@@ -274,19 +273,40 @@
HistorySupport.init();
+ //createWebSocket();
+
+ loginImpl();
+
+ setupUi();
+
+ // History.fireCurrentHistoryState();
+ LOG.info("SimpleWebClient.onModuleLoad() done");
+ }
+
+ private void createWebSocket() {
websocket = new WaveWebSocketClient(useSocketIO(), getWebSocketBaseUrl(GWT.getModuleBaseURL()));
websocket.connect();
+ }
+ public void login() {
+ loginImpl();
+ }
+
+ public void logout() {
+ loggedInUser = null;
+ channel = null;
+ idGenerator = null;
+ websocket = null;
+ clear();
+ }
+
+ private void loginImpl() {
+ createWebSocket();
if (Session.get().isLoggedIn()) {
loggedInUser = new ParticipantId(Session.get().getAddress());
idGenerator = ClientIdGenerator.create();
loginToServer();
}
-
- setupUi();
-
- // History.fireCurrentHistoryState();
- LOG.info("SimpleWebClient.onModuleLoad() done");
}
public RemoteViewServiceMultiplexer getChannel() {
@@ -315,10 +335,14 @@
}
public void clear() {
+ // Duplicate below
if (wave != null) {
wave.destroy();
wave = null;
}
+ if (waveHolder.isAttached()) {
+ waveHolder.removeFromParent();
+ }
}
/**
* Shows a wave in a wave panel.
More information about the kune-commits
mailing list