r1339 - in trunk/src/main/java: cc/kune/core/client/sitebar cc/kune/core/client/sitebar/search org/ourproject/kune/workspace/client/sitebar/sitesearch
Author: vjrj_ Date: 2011-05-04 17:18:43 +0200 (Wed, 04 May 2011) New Revision: 1339 Added: trunk/src/main/java/cc/kune/core/client/sitebar/search/ trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearch.java trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPanel.java trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPresenter.java trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchView.java Removed: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearch.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchView.java Log: site search work in progress Copied: trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearch.java (from rev 1333, trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearch.java) =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearch.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearch.java 2011-05-04 15:18:43 UTC (rev 1339) @@ -0,0 +1,24 @@ +/* + * + * Copyright (C) 2007-2011 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 cc.kune.core.client.sitebar.search; + +public interface SiteSearch { + +} Copied: trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPanel.java (from rev 1333, trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java) =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPanel.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPanel.java 2011-05-04 15:18:43 UTC (rev 1339) @@ -0,0 +1,125 @@ +/* + * + * Copyright (C) 2007-2011 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 cc.kune.core.client.sitebar.search; + +import cc.kune.common.client.notify.NotifyUser; +import cc.kune.core.client.resources.CoreResources; +import cc.kune.gspace.client.GSpaceArmor; + +import com.google.gwt.event.dom.client.BlurEvent; +import com.google.gwt.event.dom.client.BlurHandler; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.FocusHandler; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyUpEvent; +import com.google.gwt.event.dom.client.KeyUpHandler; +import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.PushButton; +import com.google.gwt.user.client.ui.TextBox; +import com.google.inject.Inject; + +public class SiteSearchPanel implements SiteSearchView { + private static final int SEARCH_TEXT_HEIGHT = 15; + private static final int SEARCH_TEXT_WIDTH_BIG = 180; + private static final int SEARCH_TEXT_WIDTH_SMALL = 120; + public static final String SITE_SEARCH_BUTTON = "kune-ssp-searchbt"; + public static final String SITE_SEARCH_TEXTBOX = "kune-ssp-tbox"; + + private final PushButton searchButton; + private final TextBox searchTextBox; + + @Inject + public SiteSearchPanel(final SiteSearchPresenter presenter, final GSpaceArmor gs, final CoreResources img) { + searchButton = new PushButton(new Image(img.kuneSearchIco()), new Image(img.kuneSearchIcoPush())); + searchButton.ensureDebugId(SITE_SEARCH_BUTTON); + searchTextBox = new TextBox(); + searchTextBox.ensureDebugId(SITE_SEARCH_TEXTBOX); + + gs.getSitebar().add(searchButton); + gs.getSitebar().add(searchTextBox); + + setTextSearchSmallImpl(); + searchTextBox.addBlurHandler(new BlurHandler() { + @Override + public void onBlur(final BlurEvent event) { + presenter.onSearchLostFocus(searchTextBox.getText()); + } + }); + searchTextBox.addFocusHandler(new FocusHandler() { + @Override + public void onFocus(final FocusEvent event) { + presenter.onSearchFocus(); + } + }); + searchButton.addClickHandler(new ClickHandler() { + @Override + public void onClick(final ClickEvent event) { + NotifyUser.showProgressProcessing(); + presenter.doSearch(searchTextBox.getText()); + } + }); + searchTextBox.addKeyUpHandler(new KeyUpHandler() { + @Override + public void onKeyUp(final KeyUpEvent event) { + if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + if (searchTextBox.getText().length() > 0) { + NotifyUser.showProgressProcessing(); + presenter.doSearch(searchTextBox.getText()); + } + } + } + }); + } + + @Override + public void clearSearchText() { + searchTextBox.setText(""); + } + + @Override + public void selectSearchText() { + searchTextBox.selectAll(); + } + + public void setSearchText(final String text) { + searchTextBox.setText(text); + } + + @Override + public void setTextSearch(final String text) { + searchTextBox.setText(text); + } + + @Override + public void setTextSearchBig() { + searchTextBox.setPixelSize(SEARCH_TEXT_WIDTH_BIG, 15); + } + + @Override + public void setTextSearchSmall() { + setTextSearchSmallImpl(); + } + + private void setTextSearchSmallImpl() { + searchTextBox.setPixelSize(SEARCH_TEXT_WIDTH_SMALL, SEARCH_TEXT_HEIGHT); + } +} Copied: trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPresenter.java (from rev 1333, trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPresenter.java) =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPresenter.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPresenter.java 2011-05-04 15:18:43 UTC (rev 1339) @@ -0,0 +1,63 @@ +/* + * + * Copyright (C) 2007-2011 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 cc.kune.core.client.sitebar.search; + +import cc.kune.core.shared.i18n.I18nTranslationService; + +import com.google.inject.Inject; + +public class SiteSearchPresenter implements SiteSearch { + + private final String defaultSearchText; + private SiteSearchView view; + + @Inject + public SiteSearchPresenter(final I18nTranslationService i18n) { + defaultSearchText = i18n.t("Search"); + } + + public void doSearch(final String termToSearch) { + // provider.get().doSearch(termToSearch); + view.setTextSearchSmall(); + } + + public void init(final SiteSearchView view) { + this.view = view; + setDefText(); + } + + public void onSearchFocus() { + view.setTextSearchBig(); + view.selectSearchText(); + } + + public void onSearchLostFocus(final String search) { + if (search.length() == 0 || search.equals(defaultSearchText)) { + view.setTextSearchSmall(); + } + if (search.length() == 0) { + setDefText(); + } + } + + private void setDefText() { + view.setTextSearch(defaultSearchText); + } +} Copied: trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchView.java (from rev 1333, trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchView.java) =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchView.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchView.java 2011-05-04 15:18:43 UTC (rev 1339) @@ -0,0 +1,33 @@ +/* + * + * Copyright (C) 2007-2011 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 cc.kune.core.client.sitebar.search; + +public interface SiteSearchView { + + void clearSearchText(); + + void selectSearchText(); + + void setTextSearch(String text); + + void setTextSearchBig(); + + void setTextSearchSmall(); +} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearch.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearch.java 2011-05-03 17:09:08 UTC (rev 1338) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearch.java 2011-05-04 15:18:43 UTC (rev 1339) @@ -1,24 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.sitesearch; - -public interface SiteSearch { - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java 2011-05-03 17:09:08 UTC (rev 1338) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java 2011-05-04 15:18:43 UTC (rev 1339) @@ -1,118 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.sitesearch; - -import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.ui.AbstractToolbar; -import org.ourproject.kune.platf.client.ui.noti.OldNotifyUser; -import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; - -import com.google.gwt.event.dom.client.BlurEvent; -import com.google.gwt.event.dom.client.BlurHandler; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.FocusEvent; -import com.google.gwt.event.dom.client.FocusHandler; -import com.google.gwt.event.dom.client.KeyCodes; -import com.google.gwt.event.dom.client.KeyUpEvent; -import com.google.gwt.event.dom.client.KeyUpHandler; -import com.google.gwt.user.client.ui.PushButton; -import com.google.gwt.user.client.ui.TextBox; - -public class SiteSearchPanel implements SiteSearchView { - private static final int SEARCH_TEXT_HEIGHT = 15; - private static final int SEARCH_TEXT_WIDTH_SMALL = 120; - private static final int SEARCH_TEXT_WIDTH_BIG = 180; - public static final String SITE_SEARCH_BUTTON = "kune-ssp-searchbt"; - public static final String SITE_SEARCH_TEXTBOX = "kune-ssp-tbox"; - - private final PushButton searchButton; - private final TextBox searchTextBox; - private final AbstractToolbar siteBar; - - public SiteSearchPanel(final SiteSearchPresenter presenter, final WorkspaceSkeleton ws, final Images img) { - siteBar = ws.getSiteBar(); - siteBar.addSpacer(); - searchButton = new PushButton(img.kuneSearchIco().createImage(), img.kuneSearchIcoPush().createImage()); - searchButton.ensureDebugId(SITE_SEARCH_BUTTON); - searchTextBox = new TextBox(); - searchTextBox.ensureDebugId(SITE_SEARCH_TEXTBOX); - - siteBar.add(searchButton); - siteBar.addSpacer(); - siteBar.add(searchTextBox); - - setTextSearchSmallImpl(); - searchTextBox.addBlurHandler(new BlurHandler() { - public void onBlur(final BlurEvent event) { - presenter.onSearchLostFocus(searchTextBox.getText()); - } - }); - searchTextBox.addFocusHandler(new FocusHandler() { - public void onFocus(final FocusEvent event) { - presenter.onSearchFocus(); - } - }); - searchButton.addClickHandler(new ClickHandler() { - public void onClick(final ClickEvent event) { - OldNotifyUser.showProgressProcessing(); - presenter.doSearch(searchTextBox.getText()); - } - }); - searchTextBox.addKeyUpHandler(new KeyUpHandler() { - public void onKeyUp(final KeyUpEvent event) { - if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { - if (searchTextBox.getText().length() > 0) { - OldNotifyUser.showProgressProcessing(); - presenter.doSearch(searchTextBox.getText()); - } - } - } - }); - } - - public void clearSearchText() { - searchTextBox.setText(""); - } - - public void selectSearchText() { - searchTextBox.selectAll(); - } - - public void setSearchText(final String text) { - searchTextBox.setText(text); - } - - public void setTextSearch(final String text) { - searchTextBox.setText(text); - } - - public void setTextSearchBig() { - searchTextBox.setPixelSize(SEARCH_TEXT_WIDTH_BIG, 15); - } - - public void setTextSearchSmall() { - setTextSearchSmallImpl(); - } - - private void setTextSearchSmallImpl() { - searchTextBox.setPixelSize(SEARCH_TEXT_WIDTH_SMALL, SEARCH_TEXT_HEIGHT); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPresenter.java 2011-05-03 17:09:08 UTC (rev 1338) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPresenter.java 2011-05-04 15:18:43 UTC (rev 1339) @@ -1,71 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.sitesearch; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.workspace.client.search.SiteSearcher; - -import cc.kune.core.shared.i18n.I18nTranslationService; - -import com.calclab.suco.client.ioc.Provider; - -public class SiteSearchPresenter implements SiteSearch { - - private SiteSearchView view; - private final Provider<SiteSearcher> provider; - private final String defaultSearchText; - - public SiteSearchPresenter(final Provider<SiteSearcher> provider, I18nTranslationService i18n) { - this.provider = provider; - defaultSearchText = i18n.t("Search"); - } - - public void doSearch(final String termToSearch) { - provider.get().doSearch(termToSearch); - view.setTextSearchSmall(); - } - - public View getView() { - return view; - } - - public void init(final SiteSearchView view) { - this.view = view; - setDefText(); - } - - public void onSearchFocus() { - view.setTextSearchBig(); - view.selectSearchText(); - } - - public void onSearchLostFocus(final String search) { - if (search.length() == 0 || search.equals(defaultSearchText)) { - view.setTextSearchSmall(); - } - if (search.length() == 0) { - setDefText(); - } - } - - private void setDefText() { - view.setTextSearch(defaultSearchText); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchView.java 2011-05-03 17:09:08 UTC (rev 1338) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchView.java 2011-05-04 15:18:43 UTC (rev 1339) @@ -1,35 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.sitesearch; - -import org.ourproject.kune.platf.client.View; - -public interface SiteSearchView extends View { - - void clearSearchText(); - - void selectSearchText(); - - void setTextSearch(String text); - - void setTextSearchBig(); - - void setTextSearchSmall(); -}
participants (1)
-
Vicente J. Ruiz Jurado