[kune-commits] r1353 - in trunk/src/main/java/cc/kune: . core/client/state core/public gspace/client/tool/old gspace/client/viewers wave/client
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Fri May 6 14:42:51 CEST 2011
Author: vjrj_
Date: 2011-05-06 14:42:51 +0200 (Fri, 06 May 2011)
New Revision: 1353
Added:
trunk/src/main/java/cc/kune/wave/client/WaveClientClearEvent.java
Modified:
trunk/src/main/java/cc/kune/Kune.gwt.xml
trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java
trunk/src/main/java/cc/kune/core/public/ws.css
trunk/src/main/java/cc/kune/gspace/client/tool/old/FoldableAbstractClientTool.java
trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java
trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.ui.xml
trunk/src/main/java/cc/kune/wave/client/WebClient.java
trunk/src/main/java/cc/kune/wave/client/WebClient.ui.xml
Log:
Webclient multiple workaround
Modified: trunk/src/main/java/cc/kune/Kune.gwt.xml
===================================================================
--- trunk/src/main/java/cc/kune/Kune.gwt.xml 2011-05-06 02:36:59 UTC (rev 1352)
+++ trunk/src/main/java/cc/kune/Kune.gwt.xml 2011-05-06 12:42:51 UTC (rev 1353)
@@ -35,7 +35,7 @@
<!-- NOTE: this only compiles for chromium/safari ============= -->
<!--http://code.google.com/p/google-web-toolkit/issues/detail?id=42 -->
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
-<!-- <set-property name="user.agent" value="safari,gecko1_8" /> -->
+ <set-property name="user.agent" value="safari,gecko1_8" />
<!-- gwt-platform ============================================= -->
<inherits name='com.gwtplatform.mvp.Mvp' />
<define-configuration-property name="gin.ginjector"
Modified: trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java 2011-05-06 02:36:59 UTC (rev 1352)
+++ trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java 2011-05-06 12:42:51 UTC (rev 1353)
@@ -50,372 +50,376 @@
import com.google.inject.Inject;
public class StateManagerDefault implements StateManager, ValueChangeHandler<String> {
- private final BeforeActionCollection beforeStateChangeCollection;
- private final ContentCache contentCache;
- private final EventBus eventBus;
- private final HistoryWrapper history;
- private StateToken previousToken;
- /**
- * When a historyChanged is interrupted (for instance because you are
- * editing something), the new history token is stored here
- */
- private String resumedHistoryToken;
- private final Session session;
- private final SiteTokenListeners siteTokens;
- private final TokenMatcher tokenMatcher;
+ private final BeforeActionCollection beforeStateChangeCollection;
+ private final ContentCache contentCache;
+ private final EventBus eventBus;
+ private final HistoryWrapper history;
+ private StateToken previousToken;
+ /**
+ * When a historyChanged is interrupted (for instance because you are editing
+ * something), the new history token is stored here
+ */
+ private String resumedHistoryToken;
+ private final Session session;
+ private final SiteTokenListeners siteTokens;
+ private final TokenMatcher tokenMatcher;
- @Inject
- public StateManagerDefault(final ContentCache contentProvider, final Session session, final HistoryWrapper history,
- final TokenMatcher tokenMatcher, final EventBus eventBus, final SiteTokenListeners siteTokens) {
- this.tokenMatcher = tokenMatcher;
- this.eventBus = eventBus;
- this.contentCache = contentProvider;
- this.session = session;
- this.history = history;
- this.previousToken = null;
- this.resumedHistoryToken = null;
- tokenMatcher.init(GwtWaverefEncoder.INSTANCE);
- this.siteTokens = siteTokens;
- beforeStateChangeCollection = new BeforeActionCollection();
- session.onAppStart(true, new AppStartHandler() {
- @Override
- public void onAppStart(final AppStartEvent event) {
- session.onUserSignIn(false, new UserSignInEvent.UserSignInHandler() {
- @Override
- public void onUserSignIn(final UserSignInEvent event) {
- refreshCurrentGroupState();
- }
- });
- session.onUserSignOut(false, new UserSignOutEvent.UserSignOutHandler() {
- @Override
- public void onUserSignOut(final UserSignOutEvent event) {
- refreshCurrentGroupState();
- }
- });
- processCurrentHistoryToken();
- }
+ @Inject
+ public StateManagerDefault(final ContentCache contentProvider, final Session session,
+ final HistoryWrapper history, final TokenMatcher tokenMatcher, final EventBus eventBus,
+ final SiteTokenListeners siteTokens) {
+ this.tokenMatcher = tokenMatcher;
+ this.eventBus = eventBus;
+ this.contentCache = contentProvider;
+ this.session = session;
+ this.history = history;
+ this.previousToken = null;
+ this.resumedHistoryToken = null;
+ tokenMatcher.init(GwtWaverefEncoder.INSTANCE);
+ this.siteTokens = siteTokens;
+ beforeStateChangeCollection = new BeforeActionCollection();
+ session.onAppStart(true, new AppStartHandler() {
+ @Override
+ public void onAppStart(final AppStartEvent event) {
+ session.onUserSignIn(false, new UserSignInEvent.UserSignInHandler() {
+ @Override
+ public void onUserSignIn(final UserSignInEvent event) {
+ refreshCurrentGroupState();
+ }
});
- }
+ session.onUserSignOut(false, new UserSignOutEvent.UserSignOutHandler() {
+ @Override
+ public void onUserSignOut(final UserSignOutEvent event) {
+ refreshCurrentGroupState();
+ }
+ });
+ processCurrentHistoryToken();
+ }
+ });
+ }
- @Override
- public void addBeforeStateChangeListener(final BeforeActionListener listener) {
- beforeStateChangeCollection.add(listener);
- }
+ @Override
+ public void addBeforeStateChangeListener(final BeforeActionListener listener) {
+ beforeStateChangeCollection.add(listener);
+ }
- @Override
- public void addSiteToken(final String token, final HistoryTokenCallback callback) {
- siteTokens.put(token.toLowerCase(), callback);
- }
+ @Override
+ public void addSiteToken(final String token, final HistoryTokenCallback callback) {
+ siteTokens.put(token.toLowerCase(), callback);
+ }
- private void checkGroupAndToolChange(final StateAbstractDTO newState) {
- final String newGroup = newState.getStateToken().getGroup();
- final String previousGroup = getPreviousGroup();
- if (startingUp() || !previousGroup.equals(newGroup)) {
- GroupChangedEvent.fire(eventBus, previousGroup, newGroup);
- }
- final String previousToolName = getPreviousTool();
- final String newTokenTool = newState.getStateToken().getTool();
- final String newToolName = newTokenTool == null ? "" : newTokenTool;
- if (startingUp() || previousToolName == null || !previousToolName.equals(newToolName)) {
- ToolChangedEvent.fire(eventBus, previousToolName, newToolName);
- }
+ private void checkGroupAndToolChange(final StateAbstractDTO newState) {
+ final String newGroup = newState.getStateToken().getGroup();
+ final String previousGroup = getPreviousGroup();
+ if (startingUp() || !previousGroup.equals(newGroup)) {
+ GroupChangedEvent.fire(eventBus, previousGroup, newGroup);
}
-
- private String getPreviousGroup() {
- final String previousGroup = startingUp() ? "" : previousToken.getGroup();
- return previousGroup;
+ final String previousToolName = getPreviousTool();
+ final String newTokenTool = newState.getStateToken().getTool();
+ final String newToolName = newTokenTool == null ? "" : newTokenTool;
+ if (startingUp() || previousToolName == null || !previousToolName.equals(newToolName)) {
+ ToolChangedEvent.fire(eventBus, previousToolName, newToolName);
}
+ }
- private String getPreviousTool() {
- final String previousTool = startingUp() ? "" : previousToken.getTool();
- return previousTool;
- }
+ private String getPreviousGroup() {
+ final String previousGroup = startingUp() ? "" : previousToken.getGroup();
+ return previousGroup;
+ }
- @Override
- public void gotoHistoryToken(final String token) {
- Log.debug("StateManager: history goto-string-token :" + token);
- history.newItem(token);
- }
+ private String getPreviousTool() {
+ final String previousTool = startingUp() ? "" : previousToken.getTool();
+ return previousTool;
+ }
- @Override
- public void gotoHistoryTokenButRedirectToCurrent(final String token) {
- gotoHistoryToken(TokenUtils.addRedirect(token, history.getToken()));
+ @Override
+ public void gotoHistoryToken(final String token) {
+ Log.debug("StateManager: history goto-string-token :" + token);
+ history.newItem(token);
+ }
- }
+ @Override
+ public void gotoHistoryTokenButRedirectToCurrent(final String token) {
+ gotoHistoryToken(TokenUtils.addRedirect(token, history.getToken()));
- @Override
- public void gotoStateToken(final StateToken newToken) {
- Log.debug("StateManager: history goto-token: " + newToken + ", previous: " + previousToken);
- history.newItem(newToken.getEncoded());
+ }
+
+ @Override
+ public void gotoStateToken(final StateToken newToken) {
+ Log.debug("StateManager: history goto-token: " + newToken + ", previous: " + previousToken);
+ history.newItem(newToken.getEncoded());
+ }
+
+ @Override
+ public void gotoStateToken(final StateToken token, final boolean useCache) {
+ if (!useCache) {
+ contentCache.removeContent(token);
}
+ gotoStateToken(token);
+ }
- @Override
- public void gotoStateToken(final StateToken token, final boolean useCache) {
- if (!useCache) {
- contentCache.removeContent(token);
- }
- gotoStateToken(token);
+ @Override
+ public void onGroupChanged(final boolean fireNow, final GroupChangedHandler handler) {
+ eventBus.addHandler(GroupChangedEvent.getType(), handler);
+ final StateAbstractDTO currentState = session.getCurrentState();
+ if (fireNow && currentState != null) {
+ handler.onGroupChanged(new GroupChangedEvent(getPreviousGroup(),
+ currentState.getStateToken().getGroup()));
}
- @Override
- public void onGroupChanged(final boolean fireNow, final GroupChangedHandler handler) {
- eventBus.addHandler(GroupChangedEvent.getType(), handler);
- final StateAbstractDTO currentState = session.getCurrentState();
- if (fireNow && currentState != null) {
- handler.onGroupChanged(new GroupChangedEvent(getPreviousGroup(), currentState.getStateToken().getGroup()));
- }
+ }
- }
+ @Override
+ public void onGroupChanged(final Listener2<String, String> listener) {
+ throw new NotImplementedException();
+ }
- @Override
- public void onGroupChanged(final Listener2<String, String> listener) {
- throw new NotImplementedException();
- }
-
- private void onHistoryChanged(final StateToken newState) {
- // NotifyUser.info("loading: " + newState + " because current:" +
- // session.getCurrentStateToken());
- contentCache.getContent(session.getUserHash(), newState, new AsyncCallbackSimple<StateAbstractDTO>() {
- @Override
- public void onSuccess(final StateAbstractDTO newState) {
- setState(newState);
- }
+ private void onHistoryChanged(final StateToken newState) {
+ // NotifyUser.info("loading: " + newState + " because current:" +
+ // session.getCurrentStateToken());
+ contentCache.getContent(session.getUserHash(), newState,
+ new AsyncCallbackSimple<StateAbstractDTO>() {
+ @Override
+ public void onSuccess(final StateAbstractDTO newState) {
+ setState(newState);
+ }
});
- }
+ }
- @Override
- public void onSocialNetworkChanged(final boolean fireNow, final SocialNetworkChangedHandler handler) {
- eventBus.addHandler(SocialNetworkChangedEvent.getType(), handler);
- final StateAbstractDTO currentState = session.getCurrentState();
- if (fireNow && currentState != null) {
- handler.onSocialNetworkChanged(new SocialNetworkChangedEvent(currentState));
- }
+ @Override
+ public void onSocialNetworkChanged(final boolean fireNow, final SocialNetworkChangedHandler handler) {
+ eventBus.addHandler(SocialNetworkChangedEvent.getType(), handler);
+ final StateAbstractDTO currentState = session.getCurrentState();
+ if (fireNow && currentState != null) {
+ handler.onSocialNetworkChanged(new SocialNetworkChangedEvent(currentState));
}
+ }
- @Override
- public void onSocialNetworkChanged(final Listener<StateAbstractDTO> listener) {
- throw new NotImplementedException();
- }
+ @Override
+ public void onSocialNetworkChanged(final Listener<StateAbstractDTO> listener) {
+ throw new NotImplementedException();
+ }
- @Override
- public void onStateChanged(final boolean fireNow, final StateChangedHandler handler) {
- eventBus.addHandler(StateChangedEvent.getType(), handler);
- final StateAbstractDTO currentState = session.getCurrentState();
- if (fireNow && currentState != null) {
- handler.onStateChanged(new StateChangedEvent(currentState));
- }
+ @Override
+ public void onStateChanged(final boolean fireNow, final StateChangedHandler handler) {
+ eventBus.addHandler(StateChangedEvent.getType(), handler);
+ final StateAbstractDTO currentState = session.getCurrentState();
+ if (fireNow && currentState != null) {
+ handler.onStateChanged(new StateChangedEvent(currentState));
}
+ }
- @Override
- public void onStateChanged(final Listener<StateAbstractDTO> listener) {
- throw new NotImplementedException();
- }
+ @Override
+ public void onStateChanged(final Listener<StateAbstractDTO> listener) {
+ throw new NotImplementedException();
+ }
- @Override
- public void onToolChanged(final boolean fireNow, final ToolChangedHandler handler) {
- eventBus.addHandler(ToolChangedEvent.getType(), handler);
- final StateAbstractDTO currentState = session.getCurrentState();
- if (fireNow && currentState != null) {
- handler.onToolChanged(new ToolChangedEvent(getPreviousTool(), currentState.getStateToken().getTool()));
- }
+ @Override
+ public void onToolChanged(final boolean fireNow, final ToolChangedHandler handler) {
+ eventBus.addHandler(ToolChangedEvent.getType(), handler);
+ final StateAbstractDTO currentState = session.getCurrentState();
+ if (fireNow && currentState != null) {
+ handler.onToolChanged(new ToolChangedEvent(getPreviousTool(),
+ currentState.getStateToken().getTool()));
}
+ }
- @Override
- public void onToolChanged(final Listener2<String, String> listener) {
- throw new NotImplementedException();
- }
+ @Override
+ public void onToolChanged(final Listener2<String, String> listener) {
+ throw new NotImplementedException();
+ }
- @Override
- public void onValueChange(final ValueChangeEvent<String> event) {
- Log.info("History event value changed: " + event.getValue());
- processHistoryToken(event.getValue());
- }
+ @Override
+ public void onValueChange(final ValueChangeEvent<String> event) {
+ Log.info("History event value changed: " + event.getValue());
+ processHistoryToken(event.getValue());
+ }
- private void processCurrentHistoryToken() {
- processHistoryToken(history.getToken());
- }
+ private void processCurrentHistoryToken() {
+ processHistoryToken(history.getToken());
+ }
- void processHistoryToken(final String newHistoryToken) {
- // http://code.google.com/p/google-web-toolkit-doc-1-5/wiki/DevGuideHistory
- if (beforeStateChangeCollection.checkBeforeAction()) {
- // There isn't a beforeStateChange listener that stops this history
- // change
- HistoryTokenCallback tokenListener = null;
- if (newHistoryToken != null) {
- final String nToken = newHistoryToken.toLowerCase();
- tokenListener = siteTokens.get(nToken);
- }
- Log.debug("StateManager: on history changed (" + newHistoryToken + ")");
- if (tokenListener == null) {
- Log.debug("Is not a special hash");
- // token is not one of #newgroup #signin #translate ...
- final String nToken = newHistoryToken != null ? newHistoryToken.toLowerCase() : null;
- if (tokenMatcher.hasRedirect(nToken)) {
- final Pair<String, String> redirect = tokenMatcher.getRedirect(nToken);
- final String firstToken = redirect.getLeft();
- final String sndToken = redirect.getRight();
- if (firstToken.equals(SiteTokens.PREVIEW)) {
- SpaceSelectEvent.fire(eventBus, Space.publicSpace);
- SpaceConfEvent.fire(eventBus, Space.groupSpace, sndToken);
- SpaceConfEvent.fire(eventBus, Space.publicSpace, TokenUtils.preview(sndToken));
- onHistoryChanged(new StateToken(sndToken));
- } else if (firstToken.equals(SiteTokens.NEWGROUP)) {
- siteTokens.get(SiteTokens.NEWGROUP).onHistoryToken();
- } else if (firstToken.equals(SiteTokens.SIGNIN)) {
- if (session.isLogged()) {
- // We are logged, then redirect:
- history.newItem(sndToken, false);
- processHistoryToken(sndToken);
- } else {
- // We have to loggin
- siteTokens.get(SiteTokens.SIGNIN).onHistoryToken();
- }
- }
- } else if (tokenMatcher.isWaveToken(newHistoryToken)) {
- if (session.isLogged()) {
- SpaceSelectEvent.fire(eventBus, Space.userSpace);
- } else {
- history.newItem(TokenUtils.addRedirect(SiteTokens.SIGNIN, newHistoryToken));
- }
- if (startingUp()) {
- // Starting application (with Wave url)
- onHistoryChanged(new StateToken(SiteTokens.GROUP_HOME));
- }
- } else if (tokenMatcher.isGroupToken(newHistoryToken)) {
- SpaceConfEvent.fire(eventBus, Space.groupSpace, newHistoryToken);
- SpaceConfEvent.fire(eventBus, Space.publicSpace, TokenUtils.preview(newHistoryToken));
- SpaceSelectEvent.fire(eventBus, Space.groupSpace);
- onHistoryChanged(new StateToken(newHistoryToken));
- } else {
- // While we don't redefine token "" as home:
- SpaceConfEvent.fire(eventBus, Space.groupSpace, SiteTokens.GROUP_HOME);
- SpaceConfEvent.fire(eventBus, Space.publicSpace, TokenUtils.preview(SiteTokens.GROUP_HOME));
- SpaceSelectEvent.fire(eventBus, Space.groupSpace);
- onHistoryChanged(new StateToken(SiteTokens.GROUP_HOME));
- }
+ void processHistoryToken(final String newHistoryToken) {
+ // http://code.google.com/p/google-web-toolkit-doc-1-5/wiki/DevGuideHistory
+ if (beforeStateChangeCollection.checkBeforeAction()) {
+ // There isn't a beforeStateChange listener that stops this history
+ // change
+ HistoryTokenCallback tokenListener = null;
+ if (newHistoryToken != null) {
+ final String nToken = newHistoryToken.toLowerCase();
+ tokenListener = siteTokens.get(nToken);
+ }
+ Log.debug("StateManager: on history changed (" + newHistoryToken + ")");
+ if (tokenListener == null) {
+ // Log.debug("Is not a special hash");
+ // token is not one of #newgroup #signin #translate ...
+ final String nToken = newHistoryToken != null ? newHistoryToken.toLowerCase() : null;
+ if (tokenMatcher.hasRedirect(nToken)) {
+ final Pair<String, String> redirect = tokenMatcher.getRedirect(nToken);
+ final String firstToken = redirect.getLeft();
+ final String sndToken = redirect.getRight();
+ if (firstToken.equals(SiteTokens.PREVIEW)) {
+ SpaceSelectEvent.fire(eventBus, Space.publicSpace);
+ SpaceConfEvent.fire(eventBus, Space.groupSpace, sndToken);
+ SpaceConfEvent.fire(eventBus, Space.publicSpace, TokenUtils.preview(sndToken));
+ onHistoryChanged(new StateToken(sndToken));
+ } else if (firstToken.equals(SiteTokens.NEWGROUP)) {
+ siteTokens.get(SiteTokens.NEWGROUP).onHistoryToken();
+ } else if (firstToken.equals(SiteTokens.SIGNIN)) {
+ if (session.isLogged()) {
+ // We are logged, then redirect:
+ history.newItem(sndToken, false);
+ processHistoryToken(sndToken);
} else {
- // token is one of #newgroup #signin #translate ...
- if (startingUp()) {
- // Starting with some token like "signin": load defContent
- // also
- processHistoryToken("");
- // SpaceSelectEvent.fire(eventBus, Space.groupSpace);
- }
- // Fire the listener of this #hash token
- tokenListener.onHistoryToken();
+ // We have to loggin
+ siteTokens.get(SiteTokens.SIGNIN).onHistoryToken();
}
- } else {
- resumedHistoryToken = newHistoryToken;
- }
- }
-
- @Override
- public void redirectOrRestorePreviousToken() {
- final String token = history.getToken();
- if (tokenMatcher.hasRedirect(token)) {
- // URL of the form signin(group.tool)
- final String previousToken = tokenMatcher.getRedirect(token).getRight();
- if (previousToken.equals(SiteTokens.WAVEINBOX) && session.isNotLogged()) {
- // signin(inbox) && cancel
- restorePreviousToken();
- } else {
- history.newItem(previousToken);
+ }
+ } else if (tokenMatcher.isWaveToken(newHistoryToken)) {
+ if (session.isLogged()) {
+ SpaceSelectEvent.fire(eventBus, Space.userSpace);
+ } else {
+ history.newItem(TokenUtils.addRedirect(SiteTokens.SIGNIN, newHistoryToken));
+ if (startingUp()) {
+ // Starting application (with Wave url)
+ onHistoryChanged(new StateToken(SiteTokens.GROUP_HOME));
}
+ }
+ } else if (tokenMatcher.isGroupToken(newHistoryToken)) {
+ SpaceConfEvent.fire(eventBus, Space.groupSpace, newHistoryToken);
+ SpaceConfEvent.fire(eventBus, Space.publicSpace, TokenUtils.preview(newHistoryToken));
+ SpaceSelectEvent.fire(eventBus, Space.groupSpace);
+ onHistoryChanged(new StateToken(newHistoryToken));
} else {
- // No redirect then restore previous token
- restorePreviousToken();
+ // While we don't redefine token "" as home:
+ SpaceConfEvent.fire(eventBus, Space.groupSpace, SiteTokens.GROUP_HOME);
+ SpaceConfEvent.fire(eventBus, Space.publicSpace, TokenUtils.preview(SiteTokens.GROUP_HOME));
+ SpaceSelectEvent.fire(eventBus, Space.groupSpace);
+ onHistoryChanged(new StateToken(SiteTokens.GROUP_HOME));
}
- }
-
- /**
- * <p>
- * Reload current state (not using client cache)
- * </p>
- */
- @Override
- public void refreshCurrentGroupState() {
- final StateToken currentStateToken = session.getCurrentStateToken();
- if (currentStateToken == null) {
- processCurrentHistoryToken();
- } else {
- contentCache.removeContent(currentStateToken);
- onHistoryChanged(currentStateToken);
+ } else {
+ // token is one of #newgroup #signin #translate ...
+ if (startingUp()) {
+ // Starting with some token like "signin": load defContent
+ // also
+ processHistoryToken("");
+ // SpaceSelectEvent.fire(eventBus, Space.groupSpace);
}
+ // Fire the listener of this #hash token
+ tokenListener.onHistoryToken();
+ }
+ } else {
+ resumedHistoryToken = newHistoryToken;
}
+ }
- /**
- * <p>
- * Reload current state (using client cache if available)
- * </p>
- */
- @Override
- public void reload() {
- processHistoryToken(history.getToken());
+ @Override
+ public void redirectOrRestorePreviousToken() {
+ final String token = history.getToken();
+ if (tokenMatcher.hasRedirect(token)) {
+ // URL of the form signin(group.tool)
+ final String previousToken = tokenMatcher.getRedirect(token).getRight();
+ if (previousToken.equals(SiteTokens.WAVEINBOX) && session.isNotLogged()) {
+ // signin(inbox) && cancel
+ restorePreviousToken();
+ } else {
+ history.newItem(previousToken);
+ }
+ } else {
+ // No redirect then restore previous token
+ restorePreviousToken();
}
+ }
- @Override
- public void removeBeforeStateChangeListener(final BeforeActionListener listener) {
- beforeStateChangeCollection.remove(listener);
+ /**
+ * <p>
+ * Reload current state (not using client cache)
+ * </p>
+ */
+ @Override
+ public void refreshCurrentGroupState() {
+ final StateToken currentStateToken = session.getCurrentStateToken();
+ if (currentStateToken == null) {
+ processCurrentHistoryToken();
+ } else {
+ contentCache.removeContent(currentStateToken);
+ onHistoryChanged(currentStateToken);
}
+ }
- @Override
- public void removeSiteToken(final String token) {
- siteTokens.remove(token);
- }
+ /**
+ * <p>
+ * Reload current state (using client cache if available)
+ * </p>
+ */
+ @Override
+ public void reload() {
+ processHistoryToken(history.getToken());
+ }
- @Override
- public void restorePreviousToken() {
- if (previousToken != null) {
- gotoStateToken(previousToken);
- }
- }
+ @Override
+ public void removeBeforeStateChangeListener(final BeforeActionListener listener) {
+ beforeStateChangeCollection.remove(listener);
+ }
- @Override
- public void resumeTokenChange() {
- if (resumedHistoryToken != null) {
- // Is this reload redundant?
- reload();
- gotoHistoryToken(resumedHistoryToken);
- resumedHistoryToken = null;
- }
- }
+ @Override
+ public void removeSiteToken(final String token) {
+ siteTokens.remove(token);
+ }
- @Override
- public void setRetrievedState(final StateAbstractDTO newState) {
- contentCache.cache(newState.getStateToken(), newState);
+ @Override
+ public void restorePreviousToken() {
+ if (previousToken != null) {
+ gotoStateToken(previousToken);
}
+ }
- @Override
- public void setRetrievedStateAndGo(final StateAbstractDTO newState) {
- setRetrievedState(newState);
- // setState(newState);
- history.newItem(newState.getStateToken().toString());
+ @Override
+ public void resumeTokenChange() {
+ if (resumedHistoryToken != null) {
+ // Is this reload redundant?
+ reload();
+ gotoHistoryToken(resumedHistoryToken);
+ resumedHistoryToken = null;
}
+ }
- @Override
- public void setSocialNetwork(final SocialNetworkDataDTO socialNet) {
- StateAbstractDTO state;
- if (session != null && (state = session.getCurrentState()) != null) {
- // After a SN operation, usually returns a SocialNetworkResultDTO
- // with new SN data and we refresh the state
- // to avoid to reload() again the state
- state.setSocialNetworkData(socialNet);
- SocialNetworkChangedEvent.fire(eventBus, state);
- }
- }
+ @Override
+ public void setRetrievedState(final StateAbstractDTO newState) {
+ contentCache.cache(newState.getStateToken(), newState);
+ }
- void setState(final StateAbstractDTO newState) {
- session.setCurrentState(newState);
- final StateToken newToken = newState.getStateToken();
- contentCache.cache(newToken, newState);
- // history.newItem(newToken.toString(), false);
- StateChangedEvent.fire(eventBus, newState);
- checkGroupAndToolChange(newState);
- previousToken = newToken;
- eventBus.fireEvent(new ProgressHideEvent());
+ @Override
+ public void setRetrievedStateAndGo(final StateAbstractDTO newState) {
+ setRetrievedState(newState);
+ // setState(newState);
+ history.newItem(newState.getStateToken().toString());
+ }
+
+ @Override
+ public void setSocialNetwork(final SocialNetworkDataDTO socialNet) {
+ StateAbstractDTO state;
+ if (session != null && (state = session.getCurrentState()) != null) {
+ // After a SN operation, usually returns a SocialNetworkResultDTO
+ // with new SN data and we refresh the state
+ // to avoid to reload() again the state
+ state.setSocialNetworkData(socialNet);
+ SocialNetworkChangedEvent.fire(eventBus, state);
}
+ }
- private boolean startingUp() {
- return previousToken == null;
- }
+ void setState(final StateAbstractDTO newState) {
+ session.setCurrentState(newState);
+ final StateToken newToken = newState.getStateToken();
+ contentCache.cache(newToken, newState);
+ // history.newItem(newToken.toString(), false);
+ StateChangedEvent.fire(eventBus, newState);
+ checkGroupAndToolChange(newState);
+ previousToken = newToken;
+ eventBus.fireEvent(new ProgressHideEvent());
+ }
+
+ private boolean startingUp() {
+ return previousToken == null;
+ }
}
Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css 2011-05-06 02:36:59 UTC (rev 1352)
+++ trunk/src/main/java/cc/kune/core/public/ws.css 2011-05-06 12:42:51 UTC (rev 1353)
@@ -1,6 +1,4 @@
-CHARSET "UTF-8 ";
-
-body {
+CHARSET "UTF-8 "; body {
background-color: white;
color: black;
font-family: 'Ubuntu', Arial;
@@ -172,7 +170,6 @@
cursor: hand;
}
-
.gwt-RichTextArea {
border: 1px solid black;
background-color: white;
@@ -886,15 +883,8 @@
outline: 0 none;
}
-button[disabled]:active, button[disabled],
-input[type="reset"][disabled]:active,
-input[type="reset"][disabled],
-input[type="button"][disabled]:active,
-input[type="button"][disabled],
-select[disabled] > input[type="button"],
-select[disabled] > input[type="button"]:active,
-input[type="submit"][disabled]:active,
-input[type="submit"][disabled], .k-button-disabled {
+button[disabled]:active,button[disabled],input[type="reset"][disabled]:active,input[type="reset"][disabled],input[type="button"][disabled]:active,input[type="button"][disabled],select[disabled]>input[type="button"],select[disabled]>input[type="button"]:active,input[type="submit"][disabled]:active,input[type="submit"][disabled],.k-button-disabled
+ {
color: gray !important;
}
@@ -1164,7 +1154,7 @@
-webkit-border-bottom-left-radius: 5px;
-moz-border-radius-bottomleft: 5px;
border-bottom-left-radius: 5px;
- kfilter: alpha(opacity = 90);
+ kfilter: alpha(opacity = 90);
-moz-opacity: 0.90;
-khtml-opacity: 0.90;
opacity: 0.90;
@@ -1316,4 +1306,12 @@
color: #999999;
}
-/* end Decorated tabbar */
\ No newline at end of file
+/* end Decorated tabbar */
+
+.k-waveHolder {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/gspace/client/tool/old/FoldableAbstractClientTool.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/tool/old/FoldableAbstractClientTool.java 2011-05-06 02:36:59 UTC (rev 1352)
+++ trunk/src/main/java/cc/kune/gspace/client/tool/old/FoldableAbstractClientTool.java 2011-05-06 12:42:51 UTC (rev 1353)
@@ -24,99 +24,101 @@
import cc.kune.gspace.client.tool.selector.ToolSelector;
public abstract class FoldableAbstractClientTool extends AbstractClientTool {
- public static final String UPLOADEDFILE_SUFFIX = "uploaded";
- public static final String WAVE_SUFFIX = "wave";
- protected final ContentCapabilitiesRegistry contentCapabilitiesRegistry;
+ protected final ContentCapabilitiesRegistry contentCapabilitiesRegistry;
- public FoldableAbstractClientTool(final String shortName, final String longName, final ToolSelector toolSelector,
- final ContentCapabilitiesRegistry contentCapabilitiesRegistry) {
- super(shortName, longName, toolSelector);
- this.contentCapabilitiesRegistry = contentCapabilitiesRegistry;
- }
+ public FoldableAbstractClientTool(final String shortName, final String longName,
+ final ToolSelector toolSelector, final ContentCapabilitiesRegistry contentCapabilitiesRegistry) {
+ super(shortName, longName, toolSelector);
+ this.contentCapabilitiesRegistry = contentCapabilitiesRegistry;
+ }
- protected void registerAclEditableTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getAclEditable().register(typeIds);
- }
+ protected void registerAclEditableTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getAclEditable().register(typeIds);
+ }
- protected void registerAuthorableTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getAuthorable().register(typeIds);
- }
+ protected void registerAuthorableTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getAuthorable().register(typeIds);
+ }
- protected void registerComentableTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getComentable().register(typeIds);
- }
+ protected void registerComentableTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getComentable().register(typeIds);
+ }
- public void registerContentTypeIcon(final String typeId, final BasicMimeTypeDTO mimeType, final String iconUrl) {
- contentCapabilitiesRegistry.getIconsRegistry().registerContentTypeIcon(typeId, mimeType, iconUrl);
- }
+ public void registerContentTypeIcon(final String typeId, final BasicMimeTypeDTO mimeType,
+ final String iconUrl) {
+ contentCapabilitiesRegistry.getIconsRegistry().registerContentTypeIcon(typeId, mimeType, iconUrl);
+ }
- public void registerContentTypeIcon(final String contentTypeId, final Object icon) {
- contentCapabilitiesRegistry.getIconsRegistry().registerContentTypeIcon(contentTypeId, icon);
- }
+ public void registerContentTypeIcon(final String contentTypeId, final Object icon) {
+ contentCapabilitiesRegistry.getIconsRegistry().registerContentTypeIcon(contentTypeId, icon);
+ }
- protected void registerDragableTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getDragable().register(typeIds);
- }
+ protected void registerDragableTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getDragable().register(typeIds);
+ }
- protected void registerDropableTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getDropable().register(typeIds);
- }
+ protected void registerDropableTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getDropable().register(typeIds);
+ }
- protected void registerEmailSubscribeAbleTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getEmailSubscribeAble().register(typeIds);
- }
+ protected void registerEmailSubscribeAbleTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getEmailSubscribeAble().register(typeIds);
+ }
- protected void registerLicensableTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getLicensable().register(typeIds);
- }
+ protected void registerLicensableTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getLicensable().register(typeIds);
+ }
- protected void registerPublishModerableTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getPublishModerable().register(typeIds);
- }
+ protected void registerPublishModerableTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getPublishModerable().register(typeIds);
+ }
- protected void registerRateableTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getRateable().register(typeIds);
- }
+ protected void registerRateableTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getRateable().register(typeIds);
+ }
- protected void registerRenamableTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getRenamable().register(typeIds);
- }
+ protected void registerRenamableTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getRenamable().register(typeIds);
+ }
- protected void registerTageableTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getTageable().register(typeIds);
- }
+ protected void registerTageableTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getTageable().register(typeIds);
+ }
- protected void registerTranslatableTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getTranslatable().register(typeIds);
- }
+ protected void registerTranslatableTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getTranslatable().register(typeIds);
+ }
- protected void registerUploadTypesAndMimes(final String typeUploadedfile) {
- registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("image"), "images/nav/picture.png");
- registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("video"), "images/nav/film.png");
- registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("audio"), "images/nav/music.png");
- registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "pdf"), "images/nav/page_pdf.png");
- registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "zip"), "images/nav/page_zip.png");
- registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "zip"), "images/nav/page_zip.png");
- registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("text"), "images/nav/page_text.png");
- registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "msword"),
- "images/nav/page_word.png");
- registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "excel"),
- "images/nav/page_excel.png");
- registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "mspowerpoint"),
- "images/nav/page_pps.png");
- registerContentTypeIcon(typeUploadedfile, "images/nav/page.png");
- }
+ protected void registerUploadTypesAndMimes(final String typeUploadedfile) {
+ registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("image"), "images/nav/picture.png");
+ registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("video"), "images/nav/film.png");
+ registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("audio"), "images/nav/music.png");
+ registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "pdf"),
+ "images/nav/page_pdf.png");
+ registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "zip"),
+ "images/nav/page_zip.png");
+ registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "zip"),
+ "images/nav/page_zip.png");
+ registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("text"), "images/nav/page_text.png");
+ registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "msword"),
+ "images/nav/page_word.png");
+ registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "excel"),
+ "images/nav/page_excel.png");
+ registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "mspowerpoint"),
+ "images/nav/page_pps.png");
+ registerContentTypeIcon(typeUploadedfile, "images/nav/page.png");
+ }
- protected void registerVersionableTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getVersionable().register(typeIds);
- }
+ protected void registerVersionableTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getVersionable().register(typeIds);
+ }
- protected void registerXmppComentableTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getXmppComentable().register(typeIds);
- }
+ protected void registerXmppComentableTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getXmppComentable().register(typeIds);
+ }
- protected void registerXmppNotifyCapableTypes(final String... typeIds) {
- contentCapabilitiesRegistry.getXmppNotificyCapable().register(typeIds);
- }
+ protected void registerXmppNotifyCapableTypes(final String... typeIds) {
+ contentCapabilitiesRegistry.getXmppNotificyCapable().register(typeIds);
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java 2011-05-06 02:36:59 UTC (rev 1352)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java 2011-05-06 12:42:51 UTC (rev 1353)
@@ -2,17 +2,12 @@
import org.waveprotocol.box.webclient.client.ClientIdGenerator;
import org.waveprotocol.box.webclient.client.RemoteViewServiceMultiplexer;
-import org.waveprotocol.box.webclient.client.Session;
import org.waveprotocol.box.webclient.client.SimpleWaveStore;
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.loading.LoadingIndicator;
import org.waveprotocol.wave.client.account.ProfileManager;
-import org.waveprotocol.wave.client.account.impl.ProfileManagerImpl;
import org.waveprotocol.wave.client.widget.common.ImplPanel;
import org.waveprotocol.wave.model.id.IdGenerator;
-import org.waveprotocol.wave.model.wave.ParticipantId;
import org.waveprotocol.wave.model.waveref.InvalidWaveRefException;
import org.waveprotocol.wave.model.waveref.WaveRef;
import org.waveprotocol.wave.util.escapers.GwtWaverefEncoder;
@@ -26,12 +21,14 @@
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.GSpaceArmor;
import cc.kune.gspace.client.viewers.ContentViewerPresenter.ContentViewerView;
+import cc.kune.wave.client.WaveClientClearEvent;
import cc.kune.wave.client.WaveClientManager;
import cc.kune.wave.client.WebClient;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.event.shared.EventBus;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
@@ -39,6 +36,7 @@
import com.google.gwt.user.client.ui.DeckPanel;
import com.google.gwt.user.client.ui.InlineHTML;
import com.google.gwt.user.client.ui.InsertPanel.ForIsWidget;
+import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.gwtplatform.mvp.client.ViewImpl;
@@ -58,29 +56,40 @@
DeckPanel deck;
private final GSpaceArmor gsArmor;
private IdGenerator idGenerator;
- private final Element loading = new LoadingIndicator().getElement();
+ private Element loading;
@UiField
InlineHTML onlyViewPanel;
private ProfileManager profiles;
/** The wave panel, if a wave is open. */
private StagesProvider wave;
private final WaveClientManager waveClient;
+ private ImplPanel waveHolder;
+
@UiField
- ImplPanel waveHolder;
+ VerticalPanel waveHolderParent;
private final WaveStore waveStore = new SimpleWaveStore();
+ private WebClient webClient;
+
private final Widget widget;
@Inject
public ContentViewerPanel(final GSpaceArmor wsArmor, final WaveClientManager waveClient,
- final ContentCapabilitiesRegistry capabilitiesRegistry, final I18nTranslationService i18n) {
+ final ContentCapabilitiesRegistry capabilitiesRegistry, final I18nTranslationService i18n,
+ final EventBus eventBus) {
this.gsArmor = wsArmor;
this.waveClient = waveClient;
this.capabilitiesRegistry = capabilitiesRegistry;
widget = uiBinder.createAndBindUi(this);
contentTitle = new ContentTitleWidget(i18n, gsArmor, capabilitiesRegistry.getIconsRegistry());
- loading.addClassName("kune-Margin-40-tb");
+ eventBus.addHandler(WaveClientClearEvent.getType(),
+ new WaveClientClearEvent.WaveClientClearHandler() {
+ @Override
+ public void onWaveClientClear(final WaveClientClearEvent event) {
+ waveClear();
+ }
+ });
}
@Override
@@ -100,6 +109,7 @@
gsArmor.getSubheaderToolbar().clear();
UiUtils.clear(gsArmor.getDocContainer());
UiUtils.clear(gsArmor.getDocHeader());
+ waveClear();
}
@Override
@@ -122,13 +132,13 @@
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());
+ webClient = waveClient.getWebClient();
+ loading = webClient.getLoading();
+ waveHolder = webClient.getWaveHolder();
+ channel = webClient.getChannel();
+ profiles = webClient.getProfiles();
idGenerator = ClientIdGenerator.create();
+ loading.addClassName("kune-Margin-40-tb");
}
}
@@ -161,13 +171,17 @@
private void setEditableWaveContent(final String waveRefS, final boolean isNewWave) {
final WaveRef waveRef = getWaveRef(waveRefS);
- if (wave != null) {
- wave.destroy();
- wave = null;
+ initWaveClientIfNeeded();
+
+ webClient.clear();
+ waveClear();
+
+ if (waveHolder.isAttached()) {
+ waveHolder.removeFromParent();
+ waveHolderParent.remove(waveHolder);
}
+ waveHolderParent.add(waveHolder);
- initWaveClientIfNeeded();
-
// Release the display:none.
// UIObject.setVisible(waveFrame.getElement(), true);
waveHolder.getElement().appendChild(loading);
@@ -199,4 +213,11 @@
channel = NO_CHANNEL;
}
+ private void waveClear() {
+ if (wave != null) {
+ wave.destroy();
+ wave = null;
+ }
+ }
+
}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.ui.xml 2011-05-06 02:36:59 UTC (rev 1352)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.ui.xml 2011-05-06 12:42:51 UTC (rev 1353)
@@ -21,7 +21,8 @@
</ui:style>
<g:HTMLPanel width="100%" height="100%">
<g:DeckPanel ui:field="deck" addStyleNames="k-doc-content-deck">
- <w:ImplPanel ui:field="waveHolder" addStyleNames="{style.waveHolder}" />
+ <!-- <w:ImplPanel ui:field="waveHolder" addStyleNames="{style.waveHolder}" /> -->
+ <g:VerticalPanel ui:field="waveHolderParent" />
<g:InlineHTML ui:field="onlyViewPanel" styleName="{style.viewonly}" />
</g:DeckPanel>
</g:HTMLPanel>
Added: trunk/src/main/java/cc/kune/wave/client/WaveClientClearEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WaveClientClearEvent.java (rev 0)
+++ trunk/src/main/java/cc/kune/wave/client/WaveClientClearEvent.java 2011-05-06 12:42:51 UTC (rev 1353)
@@ -0,0 +1,58 @@
+package cc.kune.wave.client;
+
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HandlerRegistration;
+
+import com.google.gwt.event.shared.HasHandlers;
+
+public class WaveClientClearEvent extends GwtEvent<WaveClientClearEvent.WaveClientClearHandler> {
+
+ public interface HasWaveClientClearHandlers extends HasHandlers {
+ HandlerRegistration addWaveClientClearHandler(WaveClientClearHandler handler);
+ }
+
+ public interface WaveClientClearHandler extends EventHandler {
+ public void onWaveClientClear(WaveClientClearEvent event);
+ }
+
+ private static final Type<WaveClientClearHandler> TYPE = new Type<WaveClientClearHandler>();
+
+ public static void fire(HasHandlers source) {
+ source.fireEvent(new WaveClientClearEvent());
+ }
+
+ public static Type<WaveClientClearHandler> getType() {
+ return TYPE;
+ }
+
+
+ public WaveClientClearEvent() {
+ }
+
+ @Override
+ public Type<WaveClientClearHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+ @Override
+ protected void dispatch(WaveClientClearHandler handler) {
+ handler.onWaveClientClear(this);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return super.equals(obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "WaveClientClearEvent["
+ + "]";
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/wave/client/WaveClientClearEvent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/main/java/cc/kune/wave/client/WebClient.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WebClient.java 2011-05-06 02:36:59 UTC (rev 1352)
+++ trunk/src/main/java/cc/kune/wave/client/WebClient.java 2011-05-06 12:42:51 UTC (rev 1353)
@@ -93,61 +93,165 @@
interface Binder extends UiBinder<DockLayoutPanel, WebClient> {
}
+ /**
+ * An exception handler that reports exceptions using a <em>shiny banner</em>
+ * (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 void install() {
+ GWT.setUncaughtExceptionHandler(new ErrorHandler(GWT.getUncaughtExceptionHandler()));
+ }
+
+ private static String maybe(final int value, final String otherwise) {
+ return value != -1 ? String.valueOf(value) : otherwise;
+ }
+
+ private static String maybe(final String value, final String otherwise) {
+ return value != null ? value : otherwise;
+ }
+
+ /**
+ * Indicates whether an error has already been reported (at most one error
+ * is ever reported by this handler).
+ */
+ private boolean hasFired;
+
+ /** Next handler in the handler chain. */
+ private final UncaughtExceptionHandler next;
+
+ private ErrorHandler(final UncaughtExceptionHandler next) {
+ this.next = next;
+ }
+
+ private void getStackTraceAsync(final Throwable t, final Accessor<SafeHtml> whenReady) {
+ // TODO: Request stack-trace de-obfuscation. For now, just use the
+ // javascript stack trace.
+ //
+ // Use minimal services here, in order to avoid the chance that reporting
+ // the error produces more errors. In particular, do not use WIAB's
+ // scheduler to run this command.
+ // Also, this code could potentially be put behind a runAsync boundary, to
+ // save whatever dependencies it uses from the initial download.
+ new Timer() {
+ @Override
+ public void run() {
+ final SafeHtmlBuilder stack = new SafeHtmlBuilder();
+
+ Throwable error = t;
+ while (error != null) {
+ final String token = String.valueOf((new Date()).getTime());
+ stack.appendHtmlConstant("Token: " + token + "<br> ");
+ stack.appendEscaped(String.valueOf(error.getMessage())).appendHtmlConstant("<br>");
+ for (final StackTraceElement elt : error.getStackTrace()) {
+ stack.appendHtmlConstant(" ")
+ .appendEscaped(maybe(elt.getClassName(), "??")).appendHtmlConstant(".") //
+ .appendEscaped(maybe(elt.getMethodName(), "??")).appendHtmlConstant(" (") //
+ .appendEscaped(maybe(elt.getFileName(), "??")).appendHtmlConstant(":") //
+ .appendEscaped(maybe(elt.getLineNumber(), "??")).appendHtmlConstant(")") //
+ .appendHtmlConstant("<br>");
+ }
+ error = error.getCause();
+ if (error != null) {
+ stack.appendHtmlConstant("Caused by: ");
+ }
+ }
+
+ whenReady.use(stack.toSafeHtml());
+ }
+ }.schedule(1);
+ }
+
+ @Override
+ public void onUncaughtException(final Throwable e) {
+ if (!hasFired) {
+ hasFired = true;
+ // final ErrorIndicatorPresenter error =
+ // ErrorIndicatorPresenter.create(RootPanel.get("banner"));
+ getStackTraceAsync(e, new Accessor<SafeHtml>() {
+ @Override
+ public void use(final SafeHtml stack) {
+ NotifyUser.error("Oops! Something has gone wrong. Please contact the site admins with <em>more details</em>");
+ // error.addDetail(stack, null);
+ final String message = stack.asString().replace("<br>", "\n");
+ REMOTE_LOG.severe(message);
+ NotifyUser.logError(message);
+ }
+ });
+ }
+
+ if (next != null) {
+ next.onUncaughtException(e);
+ }
+ }
+ }
+
interface Style extends CssResource {
}
private static final Binder BINDER = GWT.create(Binder.class);
+ static final Log LOG = Log.get(WebClient.class);
- static final Log LOG = Log.get(WebClient.class);
// Use of GWT logging is only intended for sending exception reports to the
// server, nothing else in the client should use java.util.logging.
// Please also see WebClientDemo.gwt.xml.
private static final Logger REMOTE_LOG = Logger.getLogger("REMOTE_LOG");
- private final ProfileManager profiles = new ProfileManagerImpl(Session.get().getDomain());
+ /**
+ * Returns <code>ws://yourhost[:port]/</code>.
+ */
+ // XXX check formatting wrt GPE
+ public native static String getWebSocketBaseUrl(String moduleBase) /*-{
+ return "ws" + /:\/\/[^\/]+/.exec(moduleBase)[0] + "/";
+ }-*/;
- @UiField
- SplitLayoutPanel splitPanel;
+ public native static boolean useSocketIO() /*-{
+ return !!$wnd.__useSocketIO
+ }-*/;
- @UiField
- Style style;
+ private RemoteViewServiceMultiplexer channel;
- @UiField
- FramedPanel waveFrame;
+ private final EventBus eventBus;
+ private IdGenerator idGenerator;
- @UiField
- ImplPanel waveHolder;
private final Element loading = new LoadingIndicator().getElement();
+ private ParticipantId loggedInUser;
+
+ @UiField
+ DebugMessagePanel logPanel;
+
+ private final ProfileManager profiles = new ProfileManagerImpl(Session.get().getDomain());
+
@UiField(provided = true)
final SearchPanelWidget searchPanel = new SearchPanelWidget(new SearchPanelRenderer(profiles));
@UiField
- DebugMessagePanel logPanel;
+ SplitLayoutPanel splitPanel;
+ @UiField
+ Style style;
+
/** The wave panel, if a wave is open. */
private StagesProvider wave;
+ at UiField
+FramedPanel waveFrame;
+
+ ImplPanel waveHolder;
+
private final WaveStore waveStore = new SimpleWaveStore();
/**
* Create a remote websocket to talk to the server-side FedOne service.
*/
- private WaveWebSocketClient websocket;
+ private final WaveWebSocketClient websocket;
- private ParticipantId loggedInUser;
-
- private IdGenerator idGenerator;
-
- private RemoteViewServiceMultiplexer channel;
-
-private final EventBus eventBus;
-
/**
* This is the entry point method.
*/
@Inject
- public WebClient(EventBus eventBus) {
+ public WebClient(final EventBus eventBus) {
this.eventBus = eventBus;
ErrorHandler.install();
@@ -156,7 +260,7 @@
new WaveCreationEventHandler() {
@Override
- public void onCreateRequest(WaveCreationEvent event) {
+ public void onCreateRequest(final WaveCreationEvent event) {
LOG.info("WaveCreationEvent received");
if (channel == null) {
throw new DefaultException("Spaghetti attack. Create occured before login");
@@ -185,118 +289,62 @@
LOG.info("SimpleWebClient.onModuleLoad() done");
}
- private void setupUi() {
- // Set up UI
- DockLayoutPanel self = BINDER.createAndBindUi(this);
- // kune-patch
- // RootPanel.get("app").add(self);
- initWidget(self);
- // DockLayoutPanel forcibly conflicts with sensible layout control, and
- // sticks inline styles on elements without permission. They must be
- // cleared.
- self.getElement().getStyle().clearPosition();
- splitPanel.setWidgetMinSize(searchPanel, 300);
-
- if (LogLevel.showDebug()) {
- logPanel.enable();
- } else {
- logPanel.removeFromParent();
- }
-
- setupSearchPanel();
- setupWavePanel();
+ public RemoteViewServiceMultiplexer getChannel() {
+ return channel;
}
- private void setupSearchPanel() {
- // On wave selection, fire an event.
- SearchPresenter.WaveSelectionHandler selectHandler =
- new SearchPresenter.WaveSelectionHandler() {
- @Override
- public void onWaveSelected(WaveId id) {
- ClientEvents.get().fireEvent(new WaveSelectionEvent(WaveRef.of(id)));
- }
- };
- Search search = SimpleSearch.create(RemoteSearchService.create(), waveStore);
- SearchPresenter.create(search, searchPanel, selectHandler);
+ public Element getLoading() {
+ return loading;
}
- private void setupWavePanel() {
- // Hide the frame until waves start getting opened.
- UIObject.setVisible(waveFrame.getElement(), false);
-
- // Handles opening waves.
- ClientEvents.get().addWaveSelectionEventHandler(new WaveSelectionEventHandler() {
- @Override
- public void onSelection(WaveRef waveRef) {
- openWave(waveRef, false);
- }
- });
+ public ProfileManager getProfiles() {
+ return profiles;
}
- private void setupConnectionIndicator() {
- ClientEvents.get().addNetworkStatusEventHandler(new NetworkStatusEventHandler() {
- @Override
- public void onNetworkStatus(NetworkStatusEvent event) {
- Element element = Document.get().getElementById("netstatus");
- if (element != null) {
- switch (event.getStatus()) {
- case CONNECTED:
- case RECONNECTED:
- element.setInnerText("Online");
- element.setClassName("online");
- break;
- case DISCONNECTED:
- element.setInnerText("Offline");
- element.setClassName("offline");
- break;
- case RECONNECTING:
- element.setInnerText("Connecting...");
- element.setClassName("connecting");
- break;
- }
- }
- }
- });
+ public ImplPanel getWaveHolder() {
+ return waveHolder;
}
-
+public WaveWebSocketClient getWebSocket() {
+ return websocket;
+}
/**
- * Returns <code>ws://yourhost[:port]/</code>.
*/
- // XXX check formatting wrt GPE
- public native static String getWebSocketBaseUrl(String moduleBase) /*-{
- return "ws" + /:\/\/[^\/]+/.exec(moduleBase)[0] + "/";
- }-*/;
-
- public native static boolean useSocketIO() /*-{
- return !!$wnd.__useSocketIO
- }-*/;
-
- /**
- */
private void loginToServer() {
assert loggedInUser != null;
channel = new RemoteViewServiceMultiplexer(websocket, loggedInUser.getAddress());
}
+ public void clear() {
+ if (wave != null) {
+ wave.destroy();
+ wave = null;
+ }
+}
/**
* Shows a wave in a wave panel.
*
* @param waveRef wave id to open
* @param isNewWave whether the wave is being created by this client session.
*/
- private void openWave(WaveRef waveRef, boolean isNewWave) {
+ private void openWave(final WaveRef waveRef, final boolean isNewWave) {
LOG.info("WebClient.openWave()");
+ WaveClientClearEvent.fire(eventBus);
if (wave != null) {
wave.destroy();
wave = null;
}
-
+ if (waveHolder.isAttached()) {
+ waveHolder.removeFromParent();
+ }
+ waveFrame.remove(waveHolder);
+ waveFrame.clear();
+ waveFrame.add(waveHolder);
// Release the display:none.
UIObject.setVisible(waveFrame.getElement(), true);
waveHolder.getElement().appendChild(loading);
- Element holder = waveHolder.getElement().appendChild(Document.get().createDivElement());
- StagesProvider wave = new StagesProvider(
+ 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() {
@@ -305,11 +353,11 @@
loading.removeFromParent();
}
});
- String encodedToken = History.getToken();
+ final String encodedToken = History.getToken();
// NotifyUser.info("Open Wave: " + encodedToken + " waveRef: " + waveRef.getWaveId(), true);
// Kune patch
if (encodedToken != null && !encodedToken.isEmpty() && !encodedToken.equals(SiteTokens.WAVEINBOX)) {
- WaveRef fromWaveRef = HistorySupport.waveRefFromHistoryToken(encodedToken);
+ final WaveRef fromWaveRef = HistorySupport.waveRefFromHistoryToken(encodedToken);
if (waveRef == null) {
LOG.info("History token contains invalid path: " + encodedToken);
return;
@@ -321,113 +369,85 @@
return;
}
}
- String tokenFromWaveref = HistorySupport.historyTokenFromWaveref(waveRef);
+ final String tokenFromWaveref = HistorySupport.historyTokenFromWaveref(waveRef);
SpaceConfEvent.fire(eventBus, Space.userSpace, tokenFromWaveref);
History.newItem(tokenFromWaveref, false);
}
- /**
- * An exception handler that reports exceptions using a <em>shiny banner</em>
- * (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 {
- /** Next handler in the handler chain. */
- private final UncaughtExceptionHandler next;
-
- /**
- * Indicates whether an error has already been reported (at most one error
- * is ever reported by this handler).
- */
- private boolean hasFired;
-
- private ErrorHandler(UncaughtExceptionHandler next) {
- this.next = next;
- }
-
- public static void install() {
- GWT.setUncaughtExceptionHandler(new ErrorHandler(GWT.getUncaughtExceptionHandler()));
- }
-
- @Override
- public void onUncaughtException(Throwable e) {
- if (!hasFired) {
- hasFired = true;
- // final ErrorIndicatorPresenter error =
- // ErrorIndicatorPresenter.create(RootPanel.get("banner"));
- getStackTraceAsync(e, new Accessor<SafeHtml>() {
- @Override
- public void use(SafeHtml stack) {
- NotifyUser.error("Oops! Something has gone wrong. Please contact the site admins with <em>more details</em>");
- // error.addDetail(stack, null);
- String message = stack.asString().replace("<br>", "\n");
- REMOTE_LOG.severe(message);
- NotifyUser.logError(message);
+ private void setupConnectionIndicator() {
+ ClientEvents.get().addNetworkStatusEventHandler(new NetworkStatusEventHandler() {
+ @Override
+ public void onNetworkStatus(final NetworkStatusEvent event) {
+ final Element element = Document.get().getElementById("netstatus");
+ if (element != null) {
+ switch (event.getStatus()) {
+ case CONNECTED:
+ case RECONNECTED:
+ element.setInnerText("Online");
+ element.setClassName("online");
+ break;
+ case DISCONNECTED:
+ element.setInnerText("Offline");
+ element.setClassName("offline");
+ break;
+ case RECONNECTING:
+ element.setInnerText("Connecting...");
+ element.setClassName("connecting");
+ break;
}
- });
+ }
}
+ });
+ }
- if (next != null) {
- next.onUncaughtException(e);
- }
- }
-
- private void getStackTraceAsync(final Throwable t, final Accessor<SafeHtml> whenReady) {
- // TODO: Request stack-trace de-obfuscation. For now, just use the
- // javascript stack trace.
- //
- // Use minimal services here, in order to avoid the chance that reporting
- // the error produces more errors. In particular, do not use WIAB's
- // scheduler to run this command.
- // Also, this code could potentially be put behind a runAsync boundary, to
- // save whatever dependencies it uses from the initial download.
- new Timer() {
- @Override
- public void run() {
- SafeHtmlBuilder stack = new SafeHtmlBuilder();
-
- Throwable error = t;
- while (error != null) {
- String token = String.valueOf((new Date()).getTime());
- stack.appendHtmlConstant("Token: " + token + "<br> ");
- stack.appendEscaped(String.valueOf(error.getMessage())).appendHtmlConstant("<br>");
- for (StackTraceElement elt : error.getStackTrace()) {
- stack.appendHtmlConstant(" ")
- .appendEscaped(maybe(elt.getClassName(), "??")).appendHtmlConstant(".") //
- .appendEscaped(maybe(elt.getMethodName(), "??")).appendHtmlConstant(" (") //
- .appendEscaped(maybe(elt.getFileName(), "??")).appendHtmlConstant(":") //
- .appendEscaped(maybe(elt.getLineNumber(), "??")).appendHtmlConstant(")") //
- .appendHtmlConstant("<br>");
- }
- error = error.getCause();
- if (error != null) {
- stack.appendHtmlConstant("Caused by: ");
- }
+ private void setupSearchPanel() {
+ // On wave selection, fire an event.
+ final SearchPresenter.WaveSelectionHandler selectHandler =
+ new SearchPresenter.WaveSelectionHandler() {
+ @Override
+ public void onWaveSelected(final WaveId id) {
+ ClientEvents.get().fireEvent(new WaveSelectionEvent(WaveRef.of(id)));
}
+ };
+ final Search search = SimpleSearch.create(RemoteSearchService.create(), waveStore);
+ SearchPresenter.create(search, searchPanel, selectHandler);
+ }
- whenReady.use(stack.toSafeHtml());
- }
- }.schedule(1);
- }
+ private void setupUi() {
+ // Set up UI
+ final DockLayoutPanel self = BINDER.createAndBindUi(this);
+ // kune-patch
+ // RootPanel.get("app").add(self);
+ initWidget(self);
+ waveHolder = new ImplPanel("");
+ waveHolder.addStyleName("k-waveHolder");
+ waveFrame.add(waveHolder);
+ // DockLayoutPanel forcibly conflicts with sensible layout control, and
+ // sticks inline styles on elements without permission. They must be
+ // cleared.
+ self.getElement().getStyle().clearPosition();
+ splitPanel.setWidgetMinSize(searchPanel, 300);
- private static String maybe(String value, String otherwise) {
- return value != null ? value : otherwise;
+ if (LogLevel.showDebug()) {
+ logPanel.enable();
+ } else {
+ logPanel.removeFromParent();
}
- private static String maybe(int value, String otherwise) {
- return value != -1 ? String.valueOf(value) : otherwise;
- }
+ setupSearchPanel();
+ setupWavePanel();
}
- public WaveWebSocketClient getWebSocket() {
- return websocket;
- }
+ private void setupWavePanel() {
+ // Hide the frame until waves start getting opened.
+ UIObject.setVisible(waveFrame.getElement(), false);
- public RemoteViewServiceMultiplexer getChannel() {
- return channel;
+ // Handles opening waves.
+ ClientEvents.get().addWaveSelectionEventHandler(new WaveSelectionEventHandler() {
+ @Override
+ public void onSelection(final WaveRef waveRef) {
+ openWave(waveRef, false);
+ }
+ });
}
-
- public ProfileManager getProfiles() {
- return profiles;
- }
}
Modified: trunk/src/main/java/cc/kune/wave/client/WebClient.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WebClient.ui.xml 2011-05-06 02:36:59 UTC (rev 1352)
+++ trunk/src/main/java/cc/kune/wave/client/WebClient.ui.xml 2011-05-06 12:42:51 UTC (rev 1353)
@@ -1,13 +1,10 @@
-<ui:UiBinder
- xmlns:ui="urn:ui:com.google.gwt.uibinder"
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:d='urn:import:org.waveprotocol.box.webclient.client'
- xmlns:s='urn:import:org.waveprotocol.box.webclient.search'
- xmlns:f='urn:import:org.waveprotocol.box.webclient.widget.frame'
- xmlns:w='urn:import:org.waveprotocol.wave.client.widget.common'>
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+ xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:d='urn:import:org.waveprotocol.box.webclient.client'
+ xmlns:s='urn:import:org.waveprotocol.box.webclient.search' xmlns:f='urn:import:org.waveprotocol.box.webclient.widget.frame'
+ xmlns:w='urn:import:org.waveprotocol.wave.client.widget.common'>
<ui:style type="cc.kune.wave.client.WebClient.Style">
- @def rootBackground #f0f0ff;
- @def gap 10px;
+ @def rootBackground #f4e3d7;
+ @def gap 5px;
.root {
background: rootBackground;
position: absolute;
@@ -15,6 +12,9 @@
left: 0;
right: 0;
bottom: 0;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
}
.root2 {
@@ -22,19 +22,20 @@
}
.splitPanel {
+
}
@external gwt-SplitLayoutPanel-HDragger;
@external gwt-SplitLayoutPanel-VDragger;
- .splitPanel .gwt-SplitLayoutPanel-HDragger,.splitPanel .gwt-SplitLayoutPanel-VDragger {
+ .splitPanel .gwt-SplitLayoutPanel-HDragger,.splitPanel .gwt-SplitLayoutPanel-VDragger
+ {
background-color: rootBackground;
}
- .searchPanel {
- /*
- * GWT's drag panel separators are already huge, so no margin needed on
- * sides that have drag panels.
- */
+ .searchPanel { /*
+ * GWT's drag panel separators are already huge, so no margin needed on
+ * sides that have drag panels.
+ */
margin: gap 0 0 gap;
}
@@ -45,11 +46,10 @@
margin: 0 gap gap gap;
}
- .wavePanel {
- /*
- * GWT's drag panel separators are already huge, so no margin needed on
- * sides that have drag panels.
- */
+ .wavePanel { /*
+ * GWT's drag panel separators are already huge, so no margin needed on
+ * sides that have drag panels.
+ */
margin: gap 0 0 0;
}
@@ -63,16 +63,21 @@
</ui:style>
<g:DockLayoutPanel unit="PX" styleName="{style.root}">
<g:center>
- <g:SplitLayoutPanel ui:field="splitPanel" stylePrimaryName="{style.splitPanel}">
+ <g:SplitLayoutPanel ui:field="splitPanel"
+ stylePrimaryName="{style.splitPanel}">
<g:south size="200">
- <d:DebugMessagePanel ui:field="logPanel" addStyleNames="{style.debugPanel}" />
+ <d:DebugMessagePanel ui:field="logPanel"
+ addStyleNames="{style.debugPanel}" />
</g:south>
<g:west size="400">
- <s:SearchPanelWidget ui:field="searchPanel" addStyleNames="{style.searchPanel}"/>
+ <s:SearchPanelWidget ui:field="searchPanel"
+ addStyleNames="{style.searchPanel}" />
</g:west>
<g:center>
- <f:FramedPanel ui:field="waveFrame" addStyleNames="{style.wavePanel}">
- <w:ImplPanel ui:field="waveHolder" addStyleNames="{style.waveHolder}"/>
+ <f:FramedPanel ui:field="waveFrame"
+ addStyleNames="{style.wavePanel}">
+ <!-- <w:ImplPanel ui:field="waveHolder"
+ addStyleNames="{style.waveHolder}" /> -->
</f:FramedPanel>
</g:center>
</g:SplitLayoutPanel>
More information about the kune-commits
mailing list