-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
295 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,16 @@ | |
|
||
import org.waveprotocol.wave.client.common.util.UserAgent; | ||
|
||
import com.google.gwt.user.client.Timer; | ||
import com.google.gwt.user.client.Window; | ||
import com.google.gwt.user.client.Window.ClosingEvent; | ||
import com.google.gwt.user.client.Window.ClosingHandler; | ||
import com.google.gwt.user.client.Window.Navigator; | ||
import com.google.gwt.user.client.rpc.AsyncCallback; | ||
import com.google.gwt.user.client.ui.RootPanel; | ||
import com.google.inject.Inject; | ||
import com.google.web.bindery.event.shared.EventBus; | ||
|
||
import cc.kune.common.client.log.Log; | ||
import cc.kune.common.client.notify.NotifyLevel; | ||
import cc.kune.common.client.notify.NotifyUser; | ||
|
@@ -40,21 +50,12 @@ | |
import cc.kune.core.client.state.SiteParameters; | ||
import cc.kune.core.shared.CoreConstants; | ||
import cc.kune.core.shared.dto.InitDataDTO; | ||
|
||
import com.google.web.bindery.event.shared.EventBus; | ||
import com.google.gwt.user.client.Timer; | ||
import com.google.gwt.user.client.Window; | ||
import com.google.gwt.user.client.Window.ClosingEvent; | ||
import com.google.gwt.user.client.Window.ClosingHandler; | ||
import com.google.gwt.user.client.Window.Navigator; | ||
import com.google.gwt.user.client.rpc.AsyncCallback; | ||
import com.google.gwt.user.client.ui.RootPanel; | ||
import com.google.inject.Inject; | ||
import cc.kune.core.shared.dto.UserInfoDTO; | ||
|
||
// TODO: Auto-generated Javadoc | ||
/** | ||
* The Class AppStarterDefault. | ||
* | ||
* | ||
* @author [email protected] | ||
* @author [email protected] (Vicente J. Ruiz Jurado) | ||
*/ | ||
|
@@ -77,7 +78,7 @@ public class AppStarterDefault implements AppStarter { | |
|
||
/** | ||
* Instantiates a new app starter default. | ||
* | ||
* | ||
* @param session | ||
* the session | ||
* @param siteService | ||
|
@@ -107,7 +108,7 @@ public void onWindowClosing(final ClosingEvent event) { | |
|
||
/** | ||
* Check navigator compatibility. | ||
* | ||
* | ||
* @param navSupport | ||
* the nav support | ||
*/ | ||
|
@@ -130,45 +131,57 @@ private void checkNavigatorCompatibility(final NavigatorSupport navSupport) { | |
|
||
/** | ||
* Gets the inits the data. | ||
* | ||
* | ||
* @return the inits the data | ||
*/ | ||
private void getInitData() { | ||
siteService.getInitData(session.getUserHash(), new AsyncCallback<InitDataDTO>() { | ||
siteService.getInitData(new AsyncCallback<InitDataDTO>() { | ||
private void continueStart(final InitDataDTO initData) { | ||
eventBus.fireEvent(new AppStartEvent(initData)); | ||
} | ||
|
||
private void hideInitialPanels() { | ||
final RootPanel loadingElement = RootPanel.get("k-home-loading"); | ||
if (loadingElement != null) { | ||
loadingElement.setVisible(false); | ||
} | ||
} | ||
|
||
@Override | ||
public void onFailure(final Throwable error) { | ||
onError(error); | ||
} | ||
|
||
private void onError(final Throwable error) { | ||
eventBus.fireEvent(new ProgressHideEvent()); | ||
eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error, | ||
"Error fetching initial data from Kune server")); | ||
eventBus.fireEvent( | ||
new UserNotifyEvent(NotifyLevel.error, "Error fetching initial data from Kune server")); | ||
Log.debug(error.getMessage()); | ||
hideInitialPanels(); | ||
} | ||
|
||
private void hideInitialPanels() { | ||
final RootPanel loadingElement = RootPanel.get("k-home-loading"); | ||
if (loadingElement != null) { | ||
loadingElement.setVisible(false); | ||
} | ||
} | ||
|
||
@Override | ||
public void onSuccess(final InitDataDTO initData) { | ||
session.setInitData(initData); | ||
session.setCurrentUserInfo(initData.getUserInfo(), null); | ||
hideInitialPanels(); | ||
checkNavigatorCompatibility(new NavigatorSupport() { | ||
siteService.getUserInfo(session.getUserHash(), new AsyncCallback<UserInfoDTO>() { | ||
|
||
@Override | ||
public void onNotSupported() { | ||
NotifyUser.askConfirmation( | ||
res.important32(), | ||
"Your browser is currently unsupported", | ||
"Please, use a free/libre modern navigator like " | ||
+ TextUtils.generateHtmlLink(CoreConstants.MOZILLA_FF_LINK, "Mozilla Firefox") | ||
+ " instead. Continue anyway?", new SimpleResponseCallback() { | ||
public void onFailure(Throwable error) { | ||
onError(error); | ||
} | ||
|
||
@Override | ||
public void onSuccess(UserInfoDTO userInfo) { | ||
session.setInitData(initData); | ||
session.setCurrentUserInfo(userInfo); | ||
hideInitialPanels(); | ||
checkNavigatorCompatibility(new NavigatorSupport() { | ||
@Override | ||
public void onNotSupported() { | ||
NotifyUser.askConfirmation(res.important32(), "Your browser is currently unsupported", | ||
"Please, use a free/libre modern navigator like " | ||
+ TextUtils.generateHtmlLink(CoreConstants.MOZILLA_FF_LINK, "Mozilla Firefox") | ||
+ " instead. Continue anyway?", | ||
new SimpleResponseCallback() { | ||
@Override | ||
public void onCancel() { | ||
WindowUtils.changeHref(CoreConstants.MOZILLA_FF_LINK); | ||
|
@@ -179,11 +192,13 @@ public void onSuccess() { | |
continueStart(initData); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
@Override | ||
public void onSupported() { | ||
continueStart(initData); | ||
@Override | ||
public void onSupported() { | ||
continueStart(initData); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
|
@@ -192,7 +207,7 @@ public void onSupported() { | |
|
||
/* | ||
* (non-Javadoc) | ||
* | ||
* | ||
* @see cc.kune.core.client.init.AppStarter#start() | ||
*/ | ||
@Override | ||
|
@@ -207,4 +222,5 @@ public void run() { | |
}; | ||
prefetchTimer.schedule(20000); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,28 +24,34 @@ | |
|
||
import cc.kune.core.client.errors.DefaultException; | ||
import cc.kune.core.shared.dto.InitDataDTO; | ||
import cc.kune.core.shared.dto.MotdDTO; | ||
import cc.kune.core.shared.dto.UserInfoDTO; | ||
|
||
import com.google.gwt.user.client.rpc.RemoteService; | ||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; | ||
|
||
// TODO: Auto-generated Javadoc | ||
/** | ||
* The Interface SiteService. | ||
* | ||
* | ||
* @author [email protected] (Vicente J. Ruiz Jurado) | ||
*/ | ||
@RemoteServiceRelativePath("SiteService") | ||
public interface SiteService extends RemoteService { | ||
|
||
/** | ||
* Gets the inits the data. | ||
* | ||
* | ||
* @param userHash | ||
* the user hash | ||
* @return the inits the data | ||
* @throws DefaultException | ||
* the default exception | ||
*/ | ||
InitDataDTO getInitData(String userHash) throws DefaultException; | ||
InitDataDTO getInitData() throws DefaultException; | ||
|
||
UserInfoDTO getUserInfo(String userHash) throws DefaultException; | ||
|
||
MotdDTO getMotd(String userHash) throws DefaultException; | ||
|
||
} |
Oops, something went wrong.