Author: vjrj Date: 2008-09-08 02:57:22 +0200 (Mon, 08 Sep 2008) New Revision: 852 Added: trunk/src/main/java/org/ourproject/kune/workspace/client/site/ trunk/src/main/java/org/ourproject/kune/workspace/client/site/Site.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/SiteToken.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/ trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/ trunk/src/main/java/org/ourproject/kune/workspace/client/site/rpc/ Removed: trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBar.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarExtensionListener.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarListener.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarView.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/RegisterForm.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignIn.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignInForm.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignInPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignInPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignInView.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/rpc/SiteBarServiceMocked.java Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/MessagePresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SimpleMessagePanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessage.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessagePanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessagePresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessageView.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/rpc/UserService.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/rpc/UserServiceAsync.java Log: Refactorization Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/site/Site.java (from rev 842, trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/Site.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/Site.java 2008-08-30 14:57:17 UTC (rev 842) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/Site.java 2008-09-08 00:57:22 UTC (rev 852) @@ -0,0 +1,88 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.ourproject.kune.workspace.client.site; + +import org.ourproject.kune.platf.client.services.I18nTranslationService; +import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; +import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; +import org.ourproject.kune.workspace.client.site.msg.SiteMessage; +import org.ourproject.kune.workspace.client.ui.newtmp.sitebar.siteprogress.SiteProgress; + +import com.calclab.suco.client.provider.Provider; + +public class Site { + public static final String USERHASH = "userHash"; + public static final String IN_DEVELOPMENT = " (in development)"; + private static I18nTranslationService i18n; + private static SiteProgress progress; + private static Provider<SiteMessage> siteMessageProvider; + + public static void error(final String value) { + getSiteMessage().setMessage(value, SiteErrorType.error); + } + + public static void hideProgress() { + progress.hideProgress(); + } + + public static void important(final String value) { + getSiteMessage().setMessage(value, SiteErrorType.imp); + } + + public static void info(final String value) { + getSiteMessage().setMessage(value, SiteErrorType.info); + } + + public static void showProgress(final String text) { + progress.showProgress(text); + } + + public static void showProgressLoading() { + progress.showProgress(i18n.t("Loading")); + } + + public static void showProgressProcessing() { + progress.showProgress(i18n.t("Processing")); + } + + public static void showProgressSaving() { + progress.showProgress(i18n.t("Saving")); + } + + public static void showProgressStarting() { + progress.showProgress(i18n.t("Starting")); + } + + public static void veryImportant(final String value) { + getSiteMessage().setMessage(value, SiteErrorType.veryimp); + } + + private static SiteMessage getSiteMessage() { + return siteMessageProvider.get(); + } + + public Site(final I18nUITranslationService i18n, final SiteProgress progress, + final Provider<SiteMessage> siteMessageProvider) { + Site.i18n = i18n; + Site.progress = progress; + Site.siteMessageProvider = siteMessageProvider; + } + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/site/SiteToken.java (from rev 841, trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/SiteToken.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/SiteToken.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/SiteToken.java 2008-09-08 00:57:22 UTC (rev 852) @@ -0,0 +1,5 @@ +package org.ourproject.kune.workspace.client.site; + +public enum SiteToken { + signin, newgroup, translate +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar (from rev 841, trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBar.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBar.java 2008-09-08 00:57:22 UTC (rev 852) @@ -1,54 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.sitebar.bar; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.StateDTO; -import org.ourproject.kune.platf.client.dto.UserInfoDTO; - -public interface SiteBar { - - void showProgress(String text); - - void hideProgress(); - - View getView(); - - void showLoggedUser(UserInfoDTO user); - - void reloadUserInfo(String userHash); - - void doNewGroup(String returnToken); - - void doLogin(String returnToken); - - void showAlertMessage(String message); - - void doLogout(); - - void mask(); - - void unMask(); - - void mask(String message); - - void setState(StateDTO state); - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarExtensionListener.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarExtensionListener.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarExtensionListener.java 2008-09-08 00:57:22 UTC (rev 852) @@ -1,28 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.sitebar.bar; - -import org.ourproject.kune.platf.client.dto.UserInfoDTO; - -public interface SiteBarExtensionListener { - public void onUserLoggedIn(UserInfoDTO user); - - public void onUserLoggedOut(); -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarListener.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarListener.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarListener.java 2008-09-08 00:57:22 UTC (rev 852) @@ -1,30 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.sitebar.bar; - -import org.ourproject.kune.platf.client.dto.StateToken; - -public interface SiteBarListener { - - public void onUserLoggedOut(); - - public void onChangeState(StateToken token); - -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarPanel.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarPanel.java 2008-09-08 00:57:22 UTC (rev 852) @@ -1,421 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.sitebar.bar; - -import java.util.List; - -import org.ourproject.kune.platf.client.dto.LinkDTO; -import org.ourproject.kune.platf.client.dto.StateToken; -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.ui.IconLabel; -import org.ourproject.kune.platf.client.ui.RoundedBorderDecorator; -import org.ourproject.kune.workspace.client.newgroup.NewGroupPanel; -import org.ourproject.kune.workspace.client.sitebar.Site; -import org.ourproject.kune.workspace.client.sitebar.SiteToken; -import org.ourproject.kune.workspace.client.sitebar.login.SignInPanel; - -import com.google.gwt.user.client.Command; -import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.Timer; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.ui.ClickListener; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.FocusListener; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.Hyperlink; -import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.KeyboardListener; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.MenuBar; -import com.google.gwt.user.client.ui.MenuItem; -import com.google.gwt.user.client.ui.PushButton; -import com.google.gwt.user.client.ui.RootPanel; -import com.google.gwt.user.client.ui.TextBox; -import com.google.gwt.user.client.ui.Widget; -import com.gwtext.client.core.ExtElement; -import com.gwtext.client.widgets.MessageBox; - -public class SiteBarPanel extends Composite implements SiteBarView { - - private static final int MAX_TIME_PROGRESS_BAR = 20000; - private static final String SEARCH_TEXT_WIDTH_SMALL = "120"; - private static final String SEARCH_TEXT_WIDTH_BIG = "180"; - private final SiteBarPresenter presenter; - private final Image logoImage; - - private final HorizontalPanel siteBarHP; - - private final IconLabel gotoPublic; - private final Hyperlink loginHyperlink; - private final Hyperlink loggedUserHyperlink; - private final Hyperlink newGroupHyperlink; - private final HTML pipeSeparatorHtml2; - private PushButton searchButton; - private TextBox searchTextBox; - - private final Label logoutLabel; - private SignInPanel signInPanel; - private final Images img; - private final MenuBar optionsSubmenu; - private MenuItem linkHelpInTrans; - private MenuItem linkKuneBugs; - private final MenuBar yourGroupsSubmenu; - private NewGroupPanel newGroupPanel; - private final IconLabel contentNoPublic; - private final Widget progressPanel; - private final Widget progressText; - private final HorizontalPanel publicHP; - private final ExtElement extRootBody; - private String publicUrl; - private Timer timeProgressMaxTime; - private final I18nTranslationService i18n; - - public SiteBarPanel(final SiteBarPresenter initPresenter, final I18nTranslationService i18n) { - this.i18n = i18n; - img = Images.App.getInstance(); - - // Initialize - siteBarHP = new HorizontalPanel(); - - initWidget(siteBarHP); - this.presenter = initPresenter; - - progressPanel = RootPanel.get("kuneprogresspanel"); - progressText = RootPanel.get("kuneprogresstext"); - - publicHP = new HorizontalPanel(); - gotoPublic = new IconLabel(img.anybody(), i18n.t("Go to Public Space"), false); - contentNoPublic = new IconLabel(img.anybody(), i18n.t("This content is not public")); - - final Label expandLabel = new Label(""); - newGroupHyperlink = new Hyperlink(); - final HTML pipeSeparatorHtml = new HTML(); - pipeSeparatorHtml2 = new HTML(); - loginHyperlink = new Hyperlink(); - loggedUserHyperlink = new Hyperlink(); - logoutLabel = new Label(); - final HTML spaceSeparator1 = new HTML("<b></b>"); - final MenuBar options = new MenuBar(); - optionsSubmenu = new MenuBar(true); - yourGroupsSubmenu = new MenuBar(true); - final RoundedBorderDecorator optionsButton = new RoundedBorderDecorator(options, RoundedBorderDecorator.ALL, - RoundedBorderDecorator.SIMPLE); - final HTML spaceSeparator2 = new HTML("<b></b>"); - logoImage = new Image(); - - // Layout - siteBarHP.add(publicHP); - publicHP.add(gotoPublic); - publicHP.add(contentNoPublic); - siteBarHP.add(expandLabel); - siteBarHP.add(loginHyperlink); - siteBarHP.add(loggedUserHyperlink); - siteBarHP.add(pipeSeparatorHtml); - siteBarHP.add(logoutLabel); - siteBarHP.add(pipeSeparatorHtml2); - siteBarHP.add(newGroupHyperlink); - siteBarHP.add(spaceSeparator1); - siteBarHP.add(optionsButton); - siteBarHP.add(spaceSeparator2); - createSearchBox(); - siteBarHP.add(logoImage); - - // Set properties - siteBarHP.addStyleName("kune-SiteBarPanel"); - siteBarHP.setCellWidth(expandLabel, "100%"); - showProgress(i18n.t("Processing")); - gotoPublic.addStyleName("kune-Margin-Medium-r"); - setContentPublic(true); - gotoPublic.addClickListener(new ClickListener() { - public void onClick(final Widget sender) { - gotoPublic(); - } - }); - gotoPublic.setTitle(i18n.t("Leave the workspace and go to the public space of this group") - + Site.IN_DEVELOPMENT); - gotoPublic.addStyleName("kune-SiteBarPanel-LabelLink"); - contentNoPublic.addStyleName("kune-Margin-Medium-r"); - newGroupHyperlink.setText(i18n.t("Create New Group")); - newGroupHyperlink.setTargetHistoryToken(SiteToken.newgroup.toString()); - loggedUserHyperlink.setVisible(false); - pipeSeparatorHtml.setHTML("|"); - pipeSeparatorHtml.setStyleName("kune-SiteBarPanel-Separator"); - pipeSeparatorHtml2.setHTML("|"); - pipeSeparatorHtml2.setStyleName("kune-SiteBarPanel-Separator"); - loginHyperlink.setText(i18n.t("Sign in to collaborate")); - loginHyperlink.setTargetHistoryToken(SiteToken.signin.toString()); - logoutLabel.setText(i18n.t("Sign out")); - logoutLabel.addStyleName("kune-SiteBarPanel-LabelLink"); - options.addItem(i18n.t("Options"), true, optionsSubmenu); - options.setStyleName("kune-MenuBar"); - optionsButton.setColor("AAA"); - optionsButton.setHeight("16px"); - createOptionsSubmenu(); - addDefaultItemsToOptions(); - - spaceSeparator1.setStyleName("kune-SiteBarPanel-SpaceSeparator"); - spaceSeparator2.setStyleName("kune-SiteBarPanel-SpaceSeparator"); - - createListeners(); - - // TODO: externalize this - img.kuneLogo16px().applyTo(logoImage); - this.hideProgress(); - extRootBody = new ExtElement(RootPanel.getBodyElement()); - } - - public void centerLoginDialog() { - signInPanel.center(); - } - - public void centerNewGroupDialog() { - newGroupPanel.center(); - } - - public void clearSearchText() { - searchTextBox.setText(""); - } - - public void clearUserName() { - loginHyperlink.setText(i18n.t("Sign in to collaborate")); - } - - public void gotoPublic() { - Window.open(publicUrl, "_blank", ""); - } - - public void hideLoginDialog() { - signInPanel.hide(); - } - - public void hideNewGroupDialog() { - newGroupPanel.hide(); - } - - public void hideProgress() { - timeProgressMaxTime.cancel(); - progressPanel.setVisible(false); - publicHP.setVisible(true); - } - - public void mask() { - extRootBody.mask(); - } - - public void mask(final String message) { - extRootBody.mask(message, "x-mask-loading"); - } - - public void resetOptionsSubmenu() { - optionsSubmenu.clearItems(); - addDefaultItemsToOptions(); - } - - public void restoreLoginLink() { - loginHyperlink.setVisible(true); - loggedUserHyperlink.setVisible(false); - loginHyperlink.setTargetHistoryToken(SiteToken.signin.toString()); - } - - public void setContentGotoPublicUrl(final String publicUrl) { - this.publicUrl = publicUrl; - } - - public void setContentPublic(boolean visible) { - gotoPublic.setVisible(visible); - contentNoPublic.setVisible(!visible); - } - - public void setDefaultTextSearch() { - searchTextBox.setText(i18n.t("Search")); - } - - public void setGroupsIsMember(final List<LinkDTO> groupsIsAdmin, final List<LinkDTO> groupsIsCollab) { - optionsSubmenu.clearItems(); - yourGroupsSubmenu.clearItems(); - - final int isAdminCount = groupsIsAdmin.size(); - final int isCollabCount = groupsIsCollab.size(); - if (isAdminCount > 0 || isCollabCount > 0) { - optionsSubmenu.addItem(i18n.t("My Groups") + " ยป", yourGroupsSubmenu); - for (int i = 0; i < isAdminCount; i++) { - final LinkDTO link = groupsIsAdmin.get(i); - addItemToYourGroupSubmenu(link); - } - for (int i = 0; i < isCollabCount; i++) { - final LinkDTO link = groupsIsCollab.get(i); - addItemToYourGroupSubmenu(link); - } - } - addDefaultItemsToOptions(); - } - - public void setLogo(final Image logo) { - // TODO - } - - public void setLogoutLinkVisible(final boolean visible) { - logoutLabel.setVisible(visible); - pipeSeparatorHtml2.setVisible(visible); - } - - public void setSearchText(final String text) { - searchTextBox.setText(text); - } - - public void setTextSearchBig() { - searchTextBox.setWidth(SEARCH_TEXT_WIDTH_BIG); - } - - public void setTextSearchSmall() { - searchTextBox.setWidth(SEARCH_TEXT_WIDTH_SMALL); - } - - public void showAlertMessage(final String message) { - MessageBox.alert(i18n.t("Alert"), message, new MessageBox.AlertCallback() { - public void execute() { - // Do nothing - } - }); - } - - public void showLoggedUserName(final String name, final String homePage) { - loginHyperlink.setVisible(false); - loggedUserHyperlink.setVisible(true); - loggedUserHyperlink.setText(name); - loggedUserHyperlink.setTargetHistoryToken(homePage); - } - - public void showLoginDialog() { - // final SignIn login = SiteBarFactory.getLoginForm(presenter); - // signInPanel = (SignInPanel) login.getView(); - // signInPanel.show(); - - } - - public void showNewGroupDialog() { - } - - public void showProgress(final String text) { - if (timeProgressMaxTime == null) { - timeProgressMaxTime = new Timer() { - public void run() { - hideProgress(); - } - }; - } - timeProgressMaxTime.schedule(MAX_TIME_PROGRESS_BAR); - publicHP.setVisible(false); - progressPanel.setVisible(true); - DOM.setInnerText(progressText.getElement(), text); - } - - public void unMask() { - extRootBody.unmask(); - } - - private void addDefaultItemsToOptions() { - optionsSubmenu.addItem(linkHelpInTrans); - optionsSubmenu.addItem(linkKuneBugs); - } - - private void addItemToYourGroupSubmenu(final LinkDTO link) { - yourGroupsSubmenu.addItem(link.getShortName(), true, new Command() { - public void execute() { - presenter.changeState(new StateToken(link.getLink())); - } - }); - } - - private void createListeners() { - searchButton.addClickListener(new ClickListener() { - public void onClick(final Widget arg0) { - Site.showProgressProcessing(); - presenter.doSearch(searchTextBox.getText()); - } - }); - logoutLabel.addClickListener(new ClickListener() { - public void onClick(final Widget arg0) { - Site.showProgressProcessing(); - presenter.doLogout(); - } - }); - searchTextBox.addKeyboardListener(new KeyboardListener() { - public void onKeyDown(final Widget arg0, final char arg1, final int arg2) { - } - - public void onKeyPress(final Widget arg0, final char arg1, final int arg2) { - } - - public void onKeyUp(final Widget widget, final char key, final int mod) { - if (key == KEY_ENTER) { - if (searchTextBox.getText().length() > 0) { - Site.showProgressProcessing(); - presenter.doSearch(searchTextBox.getText()); - } - } - } - }); - } - - private void createOptionsSubmenu() { - linkHelpInTrans = new MenuItem(img.language().getHTML() + i18n.t("Help with the translation"), true, - new Command() { - public void execute() { - presenter.onHelpInTranslation(); - } - }); - linkKuneBugs = new MenuItem(img.kuneIcon16().getHTML() + i18n.t("Report kune bugs"), true, new Command() { - public void execute() { - Window.open("http://code.google.com/p/kune/issues/list", "_blank", null); - } - }); - // linkHelp = new MenuItem(img.kuneIcon16().getHTML() + - // i18n.t("Help"), true, new Command() { - // public void execute() { - // presenter.changeState(new StateToken("site.docs")); - // } - // }); - } - - private void createSearchBox() { - searchButton = new PushButton(img.kuneSearchIco().createImage(), img.kuneSearchIcoPush().createImage()); - searchTextBox = new TextBox(); - - siteBarHP.add(searchButton); - siteBarHP.add(searchTextBox); - - setTextSearchSmall(); - setDefaultTextSearch(); - searchTextBox.addFocusListener(new FocusListener() { - - public void onFocus(final Widget arg0) { - presenter.onSearchFocus(); - } - - public void onLostFocus(final Widget arg0) { - presenter.onSearchLostFocus(searchTextBox.getText()); - } - }); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarPresenter.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarPresenter.java 2008-09-08 00:57:22 UTC (rev 852) @@ -1,228 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.sitebar.bar; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.GroupListDTO; -import org.ourproject.kune.platf.client.dto.StateDTO; -import org.ourproject.kune.platf.client.dto.StateToken; -import org.ourproject.kune.platf.client.dto.UserInfoDTO; -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.workspace.client.sitebar.Site; - -public class SiteBarPresenter implements SiteBar { - - private SiteBarView view; - private final SiteBarListener listener; - private String previousToken; - private final Session session; - - public SiteBarPresenter(final SiteBarListener listener, final Session session, final I18nTranslationService i18n) { - this.listener = listener; - this.session = session; - } - - public void changeState(final StateToken token) { - listener.onChangeState(token); - } - - public void doLogin(final String previousToken) { - this.previousToken = previousToken; - Site.showProgressProcessing(); - view.showLoginDialog(); - view.centerLoginDialog(); - Site.hideProgress(); - } - - public void doLogout() { - // final AsyncCallback<Object> callback = new AsyncCallback<Object>() { - // public void onFailure(final Throwable caught) { - // Site.hideProgress(); - // try { - // throw caught; - // } catch (final SessionExpiredException e) { - // clientUILogout(); - // } catch (final UserMustBeLoggedException e) { - // clientUILogout(); - // } catch (final Throwable e) { - // GWT.log("Other kind of exception in doLogout", null); - // throw new RuntimeException(); - // } - // } - // - // public void onSuccess(final Object arg0) { - // Site.hideProgress(); - // clientUILogout(); - // } - // - // private void clientUILogout() { - // view.restoreLoginLink(); - // view.resetOptionsSubmenu(); - // view.setLogoutLinkVisible(false); - // listener.onUserLoggedOut(); - // } - // }; - // UserService.App.getInstance().logout(session.getUserHash(), - // callback); - } - - public void doNewGroup(final String previousTokenOrig) { - // DefaultDispatcher.getInstance().fire(WorkspaceEvents.ONLY_CHECK_USER_SESSION, - // new AsyncCallbackSimple<Object>() { - // public void onSuccess(final Object result) { - // previousToken = previousTokenOrig; - // if (session.isLogged()) { - // Site.showProgressProcessing(); - // view.showNewGroupDialog(); - // view.centerNewGroupDialog(); - // } else { - // returnToPreviousState(); - // Site.info(i18n.t("Sign in or register to create a group")); - // } - // } - // }); - } - - public void doSearch(final String termToSearch) { - // view.showSearchPanel(termToSearch); - } - - public View getView() { - return view; - } - - public void hideProgress() { - view.hideProgress(); - } - - public void init(final SiteBarView view) { - this.view = view; - view.setLogoutLinkVisible(false); - } - - public void mask() { - view.mask(); - } - - public void mask(final String message) { - view.mask(message); - } - - public void onHelpInTranslation() { - } - - public void onLoginCancelled() { - view.hideLoginDialog(); - returnToPreviousState(); - } - - public void onLoginClose() { - if (!session.isLogged()) { - returnToPreviousState(); - } - } - - public void onNewGroupCancel() { - view.hideNewGroupDialog(); - returnToPreviousState(); - } - - public void onNewGroupClose() { - returnToPreviousState(); - } - - public void onNewGroupCreated(final StateToken homePage) { - view.hideNewGroupDialog(); - changeState(homePage); - } - - public void reloadUserInfo(final String userHash) { - // //final UserServiceAsync siteBarService = - // UserService.App.getInstance(); - // siteBarService.reloadUserInfo(userHash, new - // AsyncCallback<UserInfoDTO>() { - // public void onFailure(final Throwable arg0) { - // Site.hideProgress(); - // } - // - // public void onSuccess(final UserInfoDTO response) { - // showLoggedUser(response); - // Site.hideProgress(); - // } - // }); - } - - public void setState(final StateDTO state) { - final StateToken token = state.getStateToken(); - if (state.getAccessLists().getViewers().getMode().equals(GroupListDTO.EVERYONE)) { - final String publicUrl = token.getPublicUrl(); - view.setContentGotoPublicUrl(publicUrl); - view.setContentPublic(true); - } else { - view.setContentPublic(false); - } - - } - - public void showAlertMessage(final String message) { - view.showAlertMessage(message); - } - - public void showLoggedUser(final UserInfoDTO user) { - if (user == null) { - view.restoreLoginLink(); - view.setLogoutLinkVisible(false); - } else { - view.showLoggedUserName(user.getShortName(), user.getHomePage()); - view.setLogoutLinkVisible(true); - // view.setGroupsIsMember(user.getGroupsIsAdmin(), - // user.getGroupsIsCollab()); - } - } - - public void showProgress(final String text) { - view.showProgress(text); - } - - public void unMask() { - view.unMask(); - } - - protected void onSearchFocus() { - view.setTextSearchBig(); - view.clearSearchText(); - } - - protected void onSearchLostFocus(final String search) { - if (search.length() == 0) { - view.setDefaultTextSearch(); - view.setTextSearchSmall(); - } - } - - private void returnToPreviousState() { - if (this.previousToken != null) { - listener.onChangeState(new StateToken(this.previousToken)); - this.previousToken = null; - } - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarView.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/bar/SiteBarView.java 2008-09-08 00:57:22 UTC (rev 852) @@ -1,83 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.sitebar.bar; - -import java.util.List; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.LinkDTO; - -import com.google.gwt.user.client.ui.Image; - -public interface SiteBarView extends View { - - public void hideLoginDialog(); - - void centerLoginDialog(); - - void centerNewGroupDialog(); - - void clearSearchText(); - - void clearUserName(); - - void hideNewGroupDialog(); - - void hideProgress(); - - void mask(); - - void mask(String message); - - void resetOptionsSubmenu(); - - void restoreLoginLink(); - - void setContentGotoPublicUrl(String publicUrl); - - void setContentPublic(boolean visible); - - void setDefaultTextSearch(); - - void setGroupsIsMember(List<LinkDTO> groupsIsAdmin, List<LinkDTO> groupsIsCollab); - - void setLogo(Image logo); - - void setLogoutLinkVisible(boolean visible); - - void setSearchText(String text); - - void setTextSearchBig(); - - void setTextSearchSmall(); - - void showAlertMessage(String message); - - void showLoggedUserName(String name, String homePage); - - void showLoginDialog(); - - void showNewGroupDialog(); - - void showProgress(String text); - - void unMask(); - -} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/site/login (from rev 841, trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/RegisterForm.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/RegisterForm.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/RegisterForm.java 2008-09-08 00:57:22 UTC (rev 852) @@ -1,206 +0,0 @@ -package org.ourproject.kune.workspace.client.sitebar.login; - -import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm; -import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; - -import com.gwtext.client.data.SimpleStore; -import com.gwtext.client.data.Store; -import com.gwtext.client.widgets.form.ComboBox; -import com.gwtext.client.widgets.form.TextField; -import com.gwtext.client.widgets.form.VType; -import com.gwtext.client.widgets.form.ValidationException; -import com.gwtext.client.widgets.form.Validator; - -public class RegisterForm extends DefaultForm { - - private static final String MUST_BE_BETWEEN_3_AND_15 = "Must be between 3 and 15 lowercase characters. Can only contain characters, numbers, and dashes"; - - private static final String NICK_FIELD = "nick"; - private static final String EMAIL_FIELD = "email"; - private static final String LONGNAME_FIELD = "long_name"; - private static final String PASSWORD_FIELD = "password"; - private static final String PASSWORD_FIELD_DUP = "passwordDup"; - private static final String LANG_FIELD = "lang"; - private static final String COUNTRY_FIELD = "country"; - private static final String TIMEZONE_FIELD = "timezone"; - - private final TextField shortNameRegField; - private final TextField longNameRegField; - private final TextField passwdRegField; - private final TextField passwdRegFieldDup; - private final TextField emailRegField; - private final ComboBox languageCombo; - private final ComboBox countryCombo; - private final ComboBox timezoneCombo; - - public RegisterForm(final SignInPresenter presenter, final I18nUITranslationService i18n) { - super.addStyleName("kune-Margin-Large-l"); - - shortNameRegField = new TextField(); - shortNameRegField.setFieldLabel(i18n.t("Nickname")); - shortNameRegField.setName(NICK_FIELD); - shortNameRegField.setWidth(DEF_FIELD_WIDTH); - shortNameRegField.setAllowBlank(false); - shortNameRegField.setMinLength(3); - shortNameRegField.setMaxLength(15); - shortNameRegField.setRegex("^[a-z0-9_\\-]+$"); - shortNameRegField.setMinLengthText(i18n.t(MUST_BE_BETWEEN_3_AND_15)); - shortNameRegField.setMaxLengthText(i18n.t(MUST_BE_BETWEEN_3_AND_15)); - shortNameRegField.setRegexText(i18n.t(MUST_BE_BETWEEN_3_AND_15)); - shortNameRegField.setValidationEvent(false); - add(shortNameRegField); - - longNameRegField = new TextField(); - longNameRegField.setFieldLabel(i18n.t("Full Name")); - longNameRegField.setName(LONGNAME_FIELD); - longNameRegField.setWidth(DEF_FIELD_WIDTH); - longNameRegField.setAllowBlank(false); - longNameRegField.setMinLength(3); - longNameRegField.setMaxLength(50); - longNameRegField.setValidationEvent(false); - add(longNameRegField); - - passwdRegField = new TextField(); - passwdRegField.setFieldLabel(i18n.t("Password")); - passwdRegField.setName(PASSWORD_FIELD); - passwdRegField.setPassword(true); - passwdRegField.setAllowBlank(false); - passwdRegField.setMaxLength(40); - passwdRegField.setWidth(DEF_FIELD_WIDTH); - passwdRegField.setValidationEvent(false); - add(passwdRegField); - - passwdRegFieldDup = new TextField(); - passwdRegFieldDup.setFieldLabel(i18n.t("Retype password")); - passwdRegFieldDup.setName(PASSWORD_FIELD_DUP); - passwdRegFieldDup.setPassword(true); - passwdRegFieldDup.setAllowBlank(false); - passwdRegFieldDup.setMinLength(6); - passwdRegFieldDup.setMaxLength(40); - passwdRegFieldDup.setWidth(DEF_FIELD_WIDTH); - passwdRegFieldDup.setInvalidText(i18n.t("Passwords do not match")); - passwdRegFieldDup.setValidator(new Validator() { - public boolean validate(final String value) throws ValidationException { - return passwdRegField.getValueAsString().equals(passwdRegFieldDup.getValueAsString()); - } - }); - passwdRegFieldDup.setValidationEvent(false); - add(passwdRegFieldDup); - - emailRegField = new TextField(); - emailRegField.setFieldLabel(i18n.t("Email")); - emailRegField.setName(EMAIL_FIELD); - emailRegField.setVtype(VType.EMAIL); - emailRegField.setWidth(DEF_FIELD_WIDTH); - emailRegField.setAllowBlank(false); - emailRegField.setValidationEvent(false); - - add(emailRegField); - - final Store langStore = new SimpleStore(new String[] { "abbr", "language" }, presenter.getLanguages()); - langStore.load(); - - languageCombo = new ComboBox(); - languageCombo.setName(LANG_FIELD); - languageCombo.setMinChars(1); - languageCombo.setFieldLabel(i18n.t("Language")); - languageCombo.setStore(langStore); - languageCombo.setDisplayField("language"); - languageCombo.setMode(ComboBox.LOCAL); - languageCombo.setTriggerAction(ComboBox.ALL); - languageCombo.setEmptyText(i18n.t("Enter language")); - languageCombo.setLoadingText(i18n.t("Searching...")); - languageCombo.setTypeAhead(true); - languageCombo.setTypeAheadDelay(1000); - languageCombo.setSelectOnFocus(false); - languageCombo.setWidth(186); - languageCombo.setAllowBlank(false); - languageCombo.setValueField("abbr"); - languageCombo.setValue(presenter.getCurrentLanguage().getCode()); - languageCombo.setPageSize(7); - languageCombo.setForceSelection(true); - languageCombo.setValidationEvent(false); - add(languageCombo); - - final Store countryStore = new SimpleStore(new String[] { "abbr", "country" }, presenter.getCountries()); - countryStore.load(); - - countryCombo = new ComboBox(); - countryCombo.setName(COUNTRY_FIELD); - countryCombo.setMinChars(1); - countryCombo.setFieldLabel(i18n.t("Country")); - countryCombo.setStore(countryStore); - countryCombo.setDisplayField("country"); - countryCombo.setMode(ComboBox.LOCAL); - countryCombo.setTriggerAction(ComboBox.ALL); - countryCombo.setEmptyText(i18n.t("Enter your country")); - countryCombo.setLoadingText(i18n.t("Searching...")); - countryCombo.setTypeAhead(true); - countryCombo.setTypeAheadDelay(1000); - countryCombo.setSelectOnFocus(false); - countryCombo.setWidth(186); - countryCombo.setAllowBlank(false); - countryCombo.setValueField("abbr"); - countryCombo.setPageSize(7); - countryCombo.setForceSelection(true); - countryCombo.setValidationEvent(false); - add(countryCombo); - - final Store timezoneStore = new SimpleStore(new String[] { "id" }, presenter.getTimezones()); - timezoneStore.load(); - - timezoneCombo = new ComboBox(); - timezoneCombo.setName(TIMEZONE_FIELD); - timezoneCombo.setMinChars(1); - timezoneCombo.setFieldLabel(i18n.t("Timezone")); - timezoneCombo.setStore(timezoneStore); - timezoneCombo.setDisplayField("id"); - timezoneCombo.setMode(ComboBox.LOCAL); - timezoneCombo.setTriggerAction(ComboBox.ALL); - timezoneCombo.setEmptyText(i18n.t("Enter your timezone")); - timezoneCombo.setLoadingText(i18n.t("Searching...")); - timezoneCombo.setTypeAhead(true); - timezoneCombo.setTypeAheadDelay(1000); - timezoneCombo.setSelectOnFocus(false); - timezoneCombo.setWidth(186); - timezoneCombo.setAllowBlank(false); - timezoneCombo.setValueField("id"); - timezoneCombo.setPageSize(7); - timezoneCombo.setForceSelection(true); - timezoneCombo.setValidationEvent(false); - add(timezoneCombo); - } - - public String getCountry() { - return countryCombo.getValueAsString(); - } - - public String getEmail() { - return emailRegField.getValueAsString(); - } - - public String getLanguage() { - return languageCombo.getValueAsString(); - } - - public String getLongName() { - return longNameRegField.getValueAsString(); - } - - public String getRegisterPassword() { - return passwdRegField.getValueAsString(); - } - - public String getRegisterPasswordDup() { - return passwdRegFieldDup.getValueAsString(); - } - - public String getShortName() { - return shortNameRegField.getValueAsString(); - } - - public String getTimezone() { - return timezoneCombo.getValueAsString(); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignIn.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignIn.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignIn.java 2008-09-08 00:57:22 UTC (rev 852) @@ -1,28 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.sitebar.login; - -import org.ourproject.kune.platf.client.dto.StateToken; - -public interface SignIn { - - void doSignIn(StateToken previousStateToken); - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignInForm.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInForm.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignInForm.java 2008-09-08 00:57:22 UTC (rev 852) @@ -1,48 +0,0 @@ -package org.ourproject.kune.workspace.client.sitebar.login; - -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm; - -import com.gwtext.client.widgets.form.TextField; - -public class SignInForm extends DefaultForm { - private static final String NICKOREMAIL_FIELD = "nickOrEmail"; - private static final String PASSWORD_FIELD = "password"; - - private final TextField loginNickOrEmailField; - private final TextField loginPassField; - - public SignInForm(final I18nTranslationService i18n) { - super.addStyleName("kune-Margin-Large-trbl"); - - loginNickOrEmailField = new TextField(); - loginNickOrEmailField.setFieldLabel(i18n.t("Nickname or email")); - loginNickOrEmailField.setName(NICKOREMAIL_FIELD); - loginNickOrEmailField.setWidth(DEF_FIELD_WIDTH); - loginNickOrEmailField.setAllowBlank(false); - loginNickOrEmailField.setValidationEvent(false); - super.add(loginNickOrEmailField); - - loginPassField = new TextField(); - loginPassField.setFieldLabel(i18n.t("Password")); - loginPassField.setName(PASSWORD_FIELD); - loginPassField.setWidth(DEF_FIELD_WIDTH); - loginPassField.setPassword(true); - loginPassField.setAllowBlank(false); - loginPassField.setValidationEvent(false); - super.add(loginPassField); - } - - public void focusLogin() { - loginNickOrEmailField.focus(); - } - - public String getLoginPassword() { - return loginPassField.getValueAsString(); - } - - public String getNickOrEmail() { - return loginNickOrEmailField.getValueAsString(); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignInPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInPanel.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignInPanel.java 2008-09-08 00:57:22 UTC (rev 852) @@ -1,344 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.sitebar.login; - -import org.ourproject.kune.platf.client.ui.dialogs.BasicDialog; -import org.ourproject.kune.platf.client.ui.dialogs.InfoDialog; -import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; -import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; -import org.ourproject.kune.workspace.client.sitebar.Site; -import org.ourproject.kune.workspace.client.sitebar.msg.SimpleMessagePanel; -import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; - -import com.google.gwt.user.client.Command; -import com.google.gwt.user.client.DeferredCommand; -import com.google.gwt.user.client.ui.ClickListener; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.Widget; -import com.gwtext.client.core.EventObject; -import com.gwtext.client.core.RegionPosition; -import com.gwtext.client.widgets.Button; -import com.gwtext.client.widgets.Component; -import com.gwtext.client.widgets.Panel; -import com.gwtext.client.widgets.TabPanel; -import com.gwtext.client.widgets.event.ButtonListenerAdapter; -import com.gwtext.client.widgets.event.PanelListenerAdapter; -import com.gwtext.client.widgets.event.WindowListenerAdapter; -import com.gwtext.client.widgets.form.Field; -import com.gwtext.client.widgets.layout.BorderLayout; -import com.gwtext.client.widgets.layout.BorderLayoutData; -import com.gwtext.client.widgets.layout.FitLayout; - -public class SignInPanel implements SignInView { - private class MessagePanel extends Panel { - private final SimpleMessagePanel messagesPanel; - - public MessagePanel() { - setPaddings(10); - setBorder(false); - setHeight(60); - messagesPanel = new SimpleMessagePanel(); - messagesPanel.setMessage("", SiteErrorType.info, SiteErrorType.error); - add(messagesPanel); - } - - public void hide() { - messagesPanel.hide(); - super.hide(); - } - - public void setMessage(final String message, final SiteErrorType lastMessageType, final SiteErrorType type) { - messagesPanel.setMessage(message, lastMessageType, type); - } - - public void show() { - messagesPanel.show(); - super.show(); - } - } - - private BasicDialog dialog; - private final SignInPresenter presenter; - private SignInForm signInForm; - private RegisterForm registerForm; - private MessagePanel messagesSignInPanel; - private InfoDialog welcomeDialog; - private TabPanel centerPanel; - private MessagePanel messagesRegisterPanel; - private final I18nUITranslationService i18n; - - public SignInPanel(final SignInPresenter presenter, final I18nUITranslationService i18n, final WorkspaceSkeleton ws) { - this.i18n = i18n; - Field.setMsgTarget("side"); - this.presenter = presenter; - createPanel(); - } - - public void center() { - dialog.center(); - } - - public String getCountry() { - return registerForm.getCountry(); - } - - public String getEmail() { - return registerForm.getEmail(); - } - - public String getLanguage() { - return registerForm.getLanguage(); - } - - public String getLoginPassword() { - return signInForm.getLoginPassword(); - } - - public String getLongName() { - return registerForm.getLongName(); - } - - public String getNickOrEmail() { - return signInForm.getNickOrEmail(); - } - - public String getRegisterPassword() { - return registerForm.getRegisterPassword(); - } - - public String getRegisterPasswordDup() { - return registerForm.getRegisterPasswordDup(); - } - - public String getShortName() { - return registerForm.getShortName(); - } - - public String getTimezone() { - return registerForm.getTimezone(); - } - - public void hide() { - dialog.hide(); - } - - public void hideMessages() { - messagesSignInPanel.hide(); - if (messagesRegisterPanel != null) { - messagesRegisterPanel.hide(); - } - renderDialogIfNeeded(); - } - - public boolean isRegisterFormValid() { - return registerForm.isValid(); - } - - public boolean isSignInFormValid() { - return signInForm.isValid(); - } - - public void mask(final String message) { - dialog.getEl().mask(message, "x-mask-loading"); - } - - public void maskProcessing() { - mask(i18n.t("Processing")); - } - - public void reset() { - DeferredCommand.addCommand(new Command() { - public void execute() { - signInForm.reset(); - if (registerForm != null) { - registerForm.reset(); - } - } - }); - } - - public void setRegisterMessage(final String message, final SiteErrorType type) { - messagesRegisterPanel.setMessage(message, type, type); - messagesRegisterPanel.show(); - renderDialogIfNeeded(); - } - - public void setSignInMessage(final String message, final SiteErrorType type) { - messagesSignInPanel.setMessage(message, type, type); - messagesSignInPanel.show(); - renderDialogIfNeeded(); - } - - public void show() { - centerPanel.activate(0); - dialog.setVisible(true); - dialog.show(); - Site.hideProgress(); - dialog.focus(); - signInForm.focusLogin(); - } - - public void showWelcolmeDialog() { - if (welcomeDialog == null) { - welcomeDialog = new InfoDialog(i18n.t("Welcome"), i18n.t("Thanks for registering"), i18n - .t("Now you can participate more actively in this site with other people and groups. " - + "You can also use your personal space to publish contents. " - + "Your email is not verified, please follow the instructions you will receive by email."), - i18n.t("Ok"), true, true, 400, 270); - } - welcomeDialog.show(); - } - - public void unMask() { - dialog.getEl().unmask(); - } - - private void confPanel(final Panel panel) { - // panel.setLayout(new FormLayout()); - // panel.setAutoWidth(true); - // anel.setAutoHeight(true); - } - - private Panel createNoAccountRegister() { - final Panel noAccRegisterPanel = new Panel(); - noAccRegisterPanel.setBorder(false); - noAccRegisterPanel.setMargins(0, 90, 0, 0); - final Label dontHaveAccountLabel = new Label(i18n.t("Don't have an account?")); - final Label registerLabel = new Label(i18n.t("Create one.")); - registerLabel.addClickListener(new ClickListener() { - public void onClick(final Widget arg0) { - centerPanel.activate(1); - } - }); - registerLabel.addStyleName("kune-Margin-Medium-l"); - registerLabel.addStyleName("kune-link"); - noAccRegisterPanel.add(dontHaveAccountLabel); - noAccRegisterPanel.add(registerLabel); - return noAccRegisterPanel; - } - - private void createPanel() { - dialog = new BasicDialog(i18n.t("Sign in"), true, false, 370, 400); - dialog.setLayout(new FitLayout()); - final Panel dialogPanel = new Panel(); - dialogPanel.setLayout(new BorderLayout()); - // dialog.setAutoHeight(false); - // dialog.setAutoWidth(false); - // dialog.setAutoHeight(true); - // dialog.setAutoWidth(true); - dialogPanel.setHeight("100%"); - dialogPanel.setWidth("auto"); - // dialog.setCollapsible(false); - - centerPanel = new TabPanel(); - centerPanel.setActiveTab(0); - // centerPanel.setAutoWidth(true); - // centerPanel.setAutoHeight(true); - centerPanel.setClosable(false); - - final Panel signInPanel = new Panel(i18n.t("Sign in")); - confPanel(signInPanel); - signInForm = new SignInForm(i18n); - signInPanel.add(signInForm.getForm()); - signInPanel.add(createNoAccountRegister()); - messagesSignInPanel = new MessagePanel(); - signInPanel.add(messagesSignInPanel); - - final Panel registerPanel = new Panel(i18n.t("Register")); - confPanel(registerPanel); - - centerPanel.add(signInPanel); - centerPanel.add(registerPanel); - dialogPanel.add(centerPanel, new BorderLayoutData(RegionPosition.CENTER)); - dialog.add(dialogPanel); - - final Button signInBtn = new Button(i18n.t("Sign in")); - signInBtn.addListener(new ButtonListenerAdapter() { - public void onClick(final Button button, final EventObject e) { - signInForm.validate(); - if (signInForm.isValid()) { - presenter.onFormSignIn(); - } - } - }); - dialog.addButton(signInBtn); - - final Button registerBtn = new Button(i18n.t("Register")); - registerBtn.addListener(new ButtonListenerAdapter() { - public void onClick(final Button button, final EventObject e) { - registerForm.validate(); - if (registerForm.isValid()) { - presenter.onFormRegister(); - } - } - }); - dialog.addButton(registerBtn); - registerBtn.hide(); - - final Button cancel = new Button(); - dialog.addButton(cancel); - cancel.setText(i18n.tWithNT("Cancel", "used in button")); - cancel.addListener(new ButtonListenerAdapter() { - public void onClick(final Button button, final EventObject e) { - presenter.onCancel(); - } - }); - - signInPanel.addListener(new PanelListenerAdapter() { - public void onActivate(final Panel panel) { - dialog.setTitle(i18n.t("Sign in")); - registerBtn.hide(); - signInBtn.show(); - } - }); - - registerPanel.addListener(new PanelListenerAdapter() { - public void onActivate(final Panel panel) { - if (registerForm == null) { - maskProcessing(); - registerForm = new RegisterForm(presenter, i18n); - registerPanel.add(registerForm.getForm()); - messagesRegisterPanel = new MessagePanel(); - registerPanel.add(messagesRegisterPanel); - messagesRegisterPanel.hide(); - renderDialogIfNeeded(); - unMask(); - } - dialog.setTitle(i18n.t("Register")); - signInBtn.hide(); - registerBtn.show(); - } - }); - - dialog.addListener(new WindowListenerAdapter() { - public void onHide(final Component component) { - presenter.onClose(); - } - }); - hideMessages(); - renderDialogIfNeeded(); - } - - private void renderDialogIfNeeded() { - if (dialog.isRendered()) { - dialog.doLayout(); - } - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignInPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInPresenter.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignInPresenter.java 2008-09-08 00:57:22 UTC (rev 852) @@ -1,218 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.sitebar.login; - -import java.util.Date; - -import org.ourproject.kune.platf.client.dto.I18nCountryDTO; -import org.ourproject.kune.platf.client.dto.I18nLanguageDTO; -import org.ourproject.kune.platf.client.dto.StateToken; -import org.ourproject.kune.platf.client.dto.TimeZoneDTO; -import org.ourproject.kune.platf.client.dto.UserDTO; -import org.ourproject.kune.platf.client.dto.UserInfoDTO; -import org.ourproject.kune.platf.client.errors.EmailAddressInUseException; -import org.ourproject.kune.platf.client.errors.GroupNameInUseException; -import org.ourproject.kune.platf.client.errors.UserAuthException; -import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; -import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; -import org.ourproject.kune.workspace.client.sitebar.Site; -import org.ourproject.kune.workspace.client.sitebar.rpc.UserServiceAsync; - -import com.calclab.emite.client.im.roster.RosterManager.SubscriptionMode; -import com.google.gwt.core.client.GWT; -import com.google.gwt.user.client.Cookies; -import com.google.gwt.user.client.rpc.AsyncCallback; - -public class SignInPresenter implements SignIn { - - SignInView view; - private final Session session; - private final I18nUITranslationService i18n; - private final UserServiceAsync userService; - private final StateManager stateManager; - private StateToken previousStateToken; - - public SignInPresenter(final Session session, final StateManager stateManager, final I18nUITranslationService i18n, - final UserServiceAsync userService) { - this.session = session; - this.stateManager = stateManager; - this.userService = userService; - this.i18n = i18n; - } - - public void doSignIn(final StateToken previousStateToken) { - this.previousStateToken = previousStateToken; - if (!session.isLogged()) { - Site.showProgressProcessing(); - view.show(); - view.center(); - Site.hideProgress(); - } else { - stateManager.setState(previousStateToken); - } - } - - public Object[][] getCountries() { - return session.getCountriesArray(); - } - - public I18nLanguageDTO getCurrentLanguage() { - return session.getCurrentLanguage(); - } - - public Object[][] getLanguages() { - return session.getLanguagesArray(); - } - - public Object[][] getTimezones() { - return session.getTimezones(); - } - - public void init(final SignInView loginview) { - this.view = loginview; - } - - public void onCancel() { - resetMessages(); - reset(); - view.hide(); - stateManager.setState(previousStateToken); - } - - public void onClose() { - reset(); - view.hideMessages(); - if (!session.isLogged()) { - stateManager.setState(previousStateToken); - } - } - - public void onFormRegister() { - if (view.isRegisterFormValid()) { - view.maskProcessing(); - - final I18nLanguageDTO language = new I18nLanguageDTO(); - language.setCode(view.getLanguage()); - - final I18nCountryDTO country = new I18nCountryDTO(); - country.setCode(view.getCountry()); - - final TimeZoneDTO timezone = new TimeZoneDTO(); - timezone.setId(view.getTimezone()); - - final UserDTO user = new UserDTO(view.getLongName(), view.getShortName(), view.getRegisterPassword(), view - .getEmail(), language, country, timezone, null, true, SubscriptionMode.manual, "blue"); - final AsyncCallback<UserInfoDTO> callback = new AsyncCallback<UserInfoDTO>() { - public void onFailure(final Throwable caught) { - view.unMask(); - try { - throw caught; - } catch (final EmailAddressInUseException e) { - view.setRegisterMessage(i18n.t("This email in in use by other person, try with another."), - SiteErrorType.error); - } catch (final GroupNameInUseException e) { - view.setRegisterMessage(i18n.t("This name in already in use, try with a different name."), - SiteErrorType.error); - } catch (final Throwable e) { - view.setRegisterMessage(i18n.t("Error during registration."), SiteErrorType.error); - GWT.log("Other kind of exception in user registration" + e.getMessage() + ", " - + e.getLocalizedMessage(), null); - e.printStackTrace(); - throw new RuntimeException(); - } - } - - public void onSuccess(final UserInfoDTO userInfoDTO) { - stateManager.gotoToken(userInfoDTO.getHomePage()); - onSignIn(userInfoDTO); - view.hide(); - view.unMask(); - view.showWelcolmeDialog(); - } - }; - userService.createUser(user, callback); - } - } - - protected void onFormSignIn() { - if (view.isSignInFormValid()) { - view.maskProcessing(); - - final String nickOrEmail = view.getNickOrEmail(); - final String passwd = view.getLoginPassword(); - - final UserDTO user = new UserDTO(); - user.setShortName(nickOrEmail); - user.setPassword(passwd); - - final AsyncCallback<UserInfoDTO> callback = new AsyncCallback<UserInfoDTO>() { - public void onFailure(final Throwable caught) { - view.unMask(); - Site.hideProgress(); - try { - throw caught; - } catch (final UserAuthException e) { - view.setSignInMessage(i18n.t("Incorrect nickname/email or password"), SiteErrorType.error); - } catch (final Throwable e) { - view.setSignInMessage("Error in login", SiteErrorType.error); - GWT.log("Other kind of exception in LoginFormPresenter/doLogin", null); - throw new RuntimeException(); - } - } - - public void onSuccess(final UserInfoDTO userInfoDTO) { - stateManager.setState(previousStateToken); - onSignIn(userInfoDTO); - view.hide(); - view.unMask(); - } - }; - userService.login(user.getShortName(), user.getPassword(), callback); - } - } - - private void onSignIn(final UserInfoDTO userInfoDTO) { - setCookie(userInfoDTO); - session.setUserHash(userInfoDTO.getUserHash()); - session.setCurrentUserInfo(userInfoDTO); - final I18nLanguageDTO language = userInfoDTO.getLanguage(); - i18n.changeCurrentLanguage(language.getCode()); - session.setCurrentLanguage(language); - } - - private void reset() { - view.reset(); - } - - private void resetMessages() { - view.hideMessages(); - } - - private void setCookie(final UserInfoDTO userInfoDTO) { - // http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ - final String sessionId = userInfoDTO.getUserHash(); - final long duration = Session.SESSION_DURATION; - final Date expires = new Date(System.currentTimeMillis() + duration); - Cookies.setCookie(Site.USERHASH, sessionId, expires, null, "/", false); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignInView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInView.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/login/SignInView.java 2008-09-08 00:57:22 UTC (rev 852) @@ -1,71 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.sitebar.login; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; - -public interface SignInView extends View { - - public void center(); - - public String getCountry(); - - public String getEmail(); - - public String getLanguage(); - - public String getLoginPassword(); - - public String getLongName(); - - public String getNickOrEmail(); - - public String getRegisterPassword(); - - public String getRegisterPasswordDup(); - - public String getShortName(); - - public String getTimezone(); - - public void hide(); - - public void hideMessages(); - - public boolean isRegisterFormValid(); - - public boolean isSignInFormValid(); - - public void maskProcessing(); - - public void reset(); - - public void show(); - - public void showWelcolmeDialog(); - - public void unMask(); - - void setRegisterMessage(String message, SiteErrorType type); - - void setSignInMessage(String message, SiteErrorType type); - -} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg (from rev 841, trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/msg) Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/MessagePresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/msg/MessagePresenter.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/MessagePresenter.java 2008-09-08 00:57:22 UTC (rev 852) @@ -18,7 +18,7 @@ * */ -package org.ourproject.kune.workspace.client.sitebar.msg; +package org.ourproject.kune.workspace.client.site.msg; import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SimpleMessagePanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/msg/SimpleMessagePanel.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SimpleMessagePanel.java 2008-09-08 00:57:22 UTC (rev 852) @@ -1,4 +1,4 @@ -package org.ourproject.kune.workspace.client.sitebar.msg; +package org.ourproject.kune.workspace.client.site.msg; import org.ourproject.kune.platf.client.services.Images; import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessage.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/msg/SiteMessage.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessage.java 2008-09-08 00:57:22 UTC (rev 852) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.workspace.client.sitebar.msg; +package org.ourproject.kune.workspace.client.site.msg; import org.ourproject.kune.platf.client.View; import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessagePanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/msg/SiteMessagePanel.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessagePanel.java 2008-09-08 00:57:22 UTC (rev 852) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.workspace.client.sitebar.msg; +package org.ourproject.kune.workspace.client.site.msg; import org.ourproject.kune.platf.client.services.Images; import org.ourproject.kune.platf.client.ui.KuneUiUtils; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessagePresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/msg/SiteMessagePresenter.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessagePresenter.java 2008-09-08 00:57:22 UTC (rev 852) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.workspace.client.sitebar.msg; +package org.ourproject.kune.workspace.client.site.msg; import org.ourproject.kune.platf.client.View; import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessageView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/msg/SiteMessageView.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteMessageView.java 2008-09-08 00:57:22 UTC (rev 852) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.workspace.client.sitebar.msg; +package org.ourproject.kune.workspace.client.site.msg; import org.ourproject.kune.platf.client.View; import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/site/rpc (from rev 841, trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/rpc) Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/rpc/SiteBarServiceMocked.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/rpc/SiteBarServiceMocked.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/rpc/SiteBarServiceMocked.java 2008-09-08 00:57:22 UTC (rev 852) @@ -1,68 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.ourproject.kune.workspace.client.sitebar.rpc; - -import org.ourproject.kune.platf.client.dto.UserDTO; -import org.ourproject.kune.platf.client.dto.UserInfoDTO; -import org.ourproject.kune.workspace.client.sitebar.Site; - -import com.google.gwt.user.client.Timer; -import com.google.gwt.user.client.rpc.AsyncCallback; - -public class SiteBarServiceMocked implements UserServiceAsync { - - public void login(final String nick, final String pass, final AsyncCallback<UserInfoDTO> callback) { - Site.showProgress("Login"); - Timer timer = new Timer() { - public void run() { - Site.hideProgress(); - callback.onSuccess(new UserInfoDTO()); - } - }; - timer.schedule(1000); - } - - public void logout(final String userHash, final AsyncCallback<?> callback) { - timerAndSuccess(callback); - } - - @SuppressWarnings("unchecked") - private void timerAndSuccess(final AsyncCallback callback) { - Timer timer = new Timer() { - public void run() { - callback.onSuccess(null); - } - }; - timer.schedule(1000); - } - - public void createUser(final UserDTO user, final AsyncCallback<UserInfoDTO> asyncCallback) { - timerAndSuccess(asyncCallback); - } - - public void reloadUserInfo(final String userHash, final AsyncCallback<UserInfoDTO> asyncCallback) { - timerAndSuccess(asyncCallback); - } - - public void onlyCheckSession(final String userHash, final AsyncCallback<?> asyncCallback) { - timerAndSuccess(asyncCallback); - } -} Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/rpc/UserService.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/rpc/UserService.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/rpc/UserService.java 2008-09-08 00:57:22 UTC (rev 852) @@ -18,7 +18,7 @@ * */ -package org.ourproject.kune.workspace.client.sitebar.rpc; +package org.ourproject.kune.workspace.client.site.rpc; import org.ourproject.kune.platf.client.dto.UserDTO; import org.ourproject.kune.platf.client.dto.UserInfoDTO; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/rpc/UserServiceAsync.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/rpc/UserServiceAsync.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/rpc/UserServiceAsync.java 2008-09-08 00:57:22 UTC (rev 852) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.workspace.client.sitebar.rpc; +package org.ourproject.kune.workspace.client.site.rpc; import org.ourproject.kune.platf.client.dto.UserDTO; import org.ourproject.kune.platf.client.dto.UserInfoDTO;
participants (1)
-
vjrj