Author: vjrj_ Date: 2011-05-04 22:29:42 +0200 (Wed, 04 May 2011) New Revision: 1340 Added: trunk/src/main/java/cc/kune/core/client/resources/IconConstants.java trunk/src/main/java/cc/kune/core/client/resources/bug.png trunk/src/main/java/cc/kune/core/client/resources/checked.png trunk/src/main/java/cc/kune/core/client/resources/del-green.png trunk/src/main/java/cc/kune/core/client/resources/radiochecked.png trunk/src/main/java/cc/kune/core/client/resources/radiounchecked.png trunk/src/main/java/cc/kune/core/client/resources/unchecked.png trunk/src/main/java/cc/kune/core/client/sitebar/search/FormFeedback.java trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPanel.java trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPresenter.java trunk/src/main/java/cc/kune/core/public/images/vborder.png trunk/src/main/java/cc/kune/core/public/images/vborder_ie6.png Removed: trunk/src/main/java/cc/kune/core/client/resources/icons/IconConstants.java 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 Modified: trunk/src/main/java/cc/kune/chat/client/actions/AddAsBuddieHeaderButton.java trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuDescriptor.java trunk/src/main/java/cc/kune/common/client/ui/IconLabel.java trunk/src/main/java/cc/kune/common/public/kune-common.css trunk/src/main/java/cc/kune/core/client/resources/CoreResources.java trunk/src/main/java/cc/kune/core/client/resources/core.css trunk/src/main/java/cc/kune/core/client/resources/icons/IconResources.java trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java trunk/src/main/java/cc/kune/core/public/ws.css trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java trunk/src/main/java/cc/kune/core/shared/SearcherConstants.java trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.ui.xml trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java trunk/src/main/java/cc/kune/gspace/client/GSpaceGinjector.java trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPresenter.java trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPresenter.java trunk/src/main/java/cc/kune/pspace/client/PSpaceGinModule.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/other/AddAsBuddieHeaderButton.java Log: search of users & groups Modified: trunk/src/main/java/cc/kune/chat/client/actions/AddAsBuddieHeaderButton.java =================================================================== --- trunk/src/main/java/cc/kune/chat/client/actions/AddAsBuddieHeaderButton.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/chat/client/actions/AddAsBuddieHeaderButton.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -28,7 +28,7 @@ import cc.kune.common.client.actions.PropertyChangeListener; import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor; import cc.kune.common.client.notify.NotifyUser; -import cc.kune.core.client.resources.icons.IconResources; +import cc.kune.core.client.resources.CoreResources; import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateChangedEvent; import cc.kune.core.client.state.StateChangedEvent.StateChangedHandler; @@ -45,76 +45,76 @@ public class AddAsBuddieHeaderButton { - public static class AddAsBuddieAction extends AbstractExtendedAction { - private final ChatClient chatEngine; - private final Session session; + public static class AddAsBuddieAction extends AbstractExtendedAction { + private final ChatClient chatEngine; + private final Session session; - @Inject - public AddAsBuddieAction(final ChatClient chatEngine, final Session session, final StateManager stateManager, - final I18nTranslationService i18n, final IconResources img) { - super(); - this.chatEngine = chatEngine; - this.session = session; - stateManager.onStateChanged(true, new StateChangedHandler() { - @Override - public void onStateChanged(final StateChangedEvent event) { - setState(event.getState()); - } - }); - Suco.get(XmppRoster.class).addRosterGroupChangedHandler(new RosterGroupChangedHandler() { - - @Override - public void onGroupChanged(final RosterGroupChangedEvent event) { - final StateAbstractDTO currentState = session.getCurrentState(); - if (currentState != null) { - setState(currentState); - } - } - }); - putValue(Action.NAME, i18n.t("Add as a buddie")); - putValue(Action.SMALL_ICON, img.addGreen()); + @Inject + public AddAsBuddieAction(final ChatClient chatEngine, final Session session, + final StateManager stateManager, final I18nTranslationService i18n, final CoreResources img) { + super(); + this.chatEngine = chatEngine; + this.session = session; + stateManager.onStateChanged(true, new StateChangedHandler() { + @Override + public void onStateChanged(final StateChangedEvent event) { + setState(event.getState()); } + }); + Suco.get(XmppRoster.class).addRosterGroupChangedHandler(new RosterGroupChangedHandler() { @Override - public void actionPerformed(final ActionEvent event) { - chatEngine.addNewBuddie(session.getCurrentState().getGroup().getShortName()); - NotifyUser.info("Added as buddie. Waiting buddie response"); - setEnabled(false); + public void onGroupChanged(final RosterGroupChangedEvent event) { + final StateAbstractDTO currentState = session.getCurrentState(); + if (currentState != null) { + setState(currentState); + } } + }); + putValue(Action.NAME, i18n.t("Add as a buddie")); + putValue(Action.SMALL_ICON, img.addGreen()); + } - private boolean currentGroupsIsAsPerson(final StateAbstractDTO state) { - return state.getGroup().isPersonal(); - } + @Override + public void actionPerformed(final ActionEvent event) { + chatEngine.addNewBuddie(session.getCurrentState().getGroup().getShortName()); + NotifyUser.info("Added as buddie. Waiting buddie response"); + setEnabled(false); + } - private boolean isNotMe(final String groupName) { - return !session.getCurrentUser().getShortName().equals(groupName); - } + private boolean currentGroupsIsAsPerson(final StateAbstractDTO state) { + return state.getGroup().isPersonal(); + } - private void setState(final StateAbstractDTO state) { - final String groupName = state.getGroup().getShortName(); - final boolean imLogged = session.isLogged(); - final boolean isNotBuddie = !chatEngine.isBuddie(groupName); - if (imLogged && currentGroupsIsAsPerson(state) && isNotBuddie && isNotMe(groupName)) { - setEnabled(true); - } else { - setEnabled(false); - } - } + private boolean isNotMe(final String groupName) { + return !session.getCurrentUser().getShortName().equals(groupName); } - @Inject - public AddAsBuddieHeaderButton(final AddAsBuddieAction buddieAction, final EntityHeader entityHeader) { - final ButtonDescriptor button = new ButtonDescriptor(buddieAction); - button.setVisible(false); - button.setStyles("k-chat-add-as-buddie"); - buddieAction.addPropertyChangeListener(new PropertyChangeListener() { - @Override - public void propertyChange(final PropertyChangeEvent event) { - if (event.getPropertyName().equals(AbstractAction.ENABLED)) { - button.setVisible((Boolean) event.getNewValue()); - } - } - }); - entityHeader.addAction(button); + private void setState(final StateAbstractDTO state) { + final String groupName = state.getGroup().getShortName(); + final boolean imLogged = session.isLogged(); + final boolean isNotBuddie = !chatEngine.isBuddie(groupName); + if (imLogged && currentGroupsIsAsPerson(state) && isNotBuddie && isNotMe(groupName)) { + setEnabled(true); + } else { + setEnabled(false); + } } + } + + @Inject + public AddAsBuddieHeaderButton(final AddAsBuddieAction buddieAction, final EntityHeader entityHeader) { + final ButtonDescriptor button = new ButtonDescriptor(buddieAction); + button.setVisible(false); + button.setStyles("k-chat-add-as-buddie"); + buddieAction.addPropertyChangeListener(new PropertyChangeListener() { + @Override + public void propertyChange(final PropertyChangeEvent event) { + if (event.getPropertyName().equals(AbstractAction.ENABLED)) { + button.setVisible((Boolean) event.getNewValue()); + } + } + }); + entityHeader.addAction(button); + } } \ No newline at end of file Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java =================================================================== --- trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -45,186 +45,189 @@ public abstract class AbstractGwtMenuItemGui extends AbstractGuiItem { - private IconLabel iconLabel; - private GwtBaseMenuItem item; - private final CommonIconResources res = CommonIconResources.INSTANCE; + private IconLabel iconLabel; + private GwtBaseMenuItem item; + private final CommonIconResources res = CommonIconResources.INSTANCE; - private void confCheckListener(final MenuCheckItemDescriptor descriptor, final GwtCheckItem checkItem) { - descriptor.addPropertyChangeListener(new PropertyChangeListener() { - @Override - public void propertyChange(final PropertyChangeEvent event) { - if (event.getPropertyName().equals(MenuCheckItemDescriptor.CHECKED)) { - final Boolean checked = (Boolean) event.getNewValue(); - setCheckedIcon(checked); - layout(); - } - } - }); - setCheckedIcon(descriptor.isChecked()); - iconLabel.setWidth("100%"); - } - - private void confRadioCheckListener(final MenuRadioItemDescriptor descriptor, final GwtCheckItem checkItem) { - descriptor.addPropertyChangeListener(new PropertyChangeListener() { - @Override - public void propertyChange(final PropertyChangeEvent event) { - - if (event.getPropertyName().equals(MenuCheckItemDescriptor.CHECKED)) { - final Boolean checked = (Boolean) event.getNewValue(); - setRadioChecked(checked); - layout(); - } - } - }); - setRadioChecked(descriptor.isChecked()); - iconLabel.setWidth("100%"); - } - - @Override - public AbstractGuiItem create(final GuiActionDescrip descriptor) { - super.descriptor = descriptor; - iconLabel = new IconLabel(""); - if (descriptor instanceof MenuRadioItemDescriptor) { - final GwtCheckItem checkItem = createCheckItem((MenuItemDescriptor) descriptor); - final MenuRadioItemDescriptor radioDescrip = (MenuRadioItemDescriptor) descriptor; - confRadioCheckListener(radioDescrip, checkItem); - item = checkItem; - } else if (descriptor instanceof MenuCheckItemDescriptor) { - final GwtCheckItem checkItem = createCheckItem((MenuItemDescriptor) descriptor); - confCheckListener((MenuCheckItemDescriptor) descriptor, checkItem); - item = checkItem; - } else if (descriptor instanceof MenuTitleItemDescriptor) { - item = new GwtBaseMenuItem("", true); - item.setStyleName("k-menuimtem-title"); - } else { - item = new GwtBaseMenuItem("", true); + private void confCheckListener(final MenuCheckItemDescriptor descriptor, final GwtCheckItem checkItem) { + descriptor.addPropertyChangeListener(new PropertyChangeListener() { + @Override + public void propertyChange(final PropertyChangeEvent event) { + if (event.getPropertyName().equals(MenuCheckItemDescriptor.CHECKED)) { + final Boolean checked = (Boolean) event.getNewValue(); + setCheckedIcon(checked); + layout(); } + } + }); + setCheckedIcon(descriptor.isChecked()); + iconLabel.setWidth("100%"); + } - final String id = descriptor.getId(); - if (id != null) { - item.ensureDebugId(id); - } - // initWidget(item); - item.setCommand(new Command() { - @Override - public void execute() { - getParentMenu(descriptor).hide(); - final AbstractAction action = descriptor.getAction(); - if (action != null) { - if (descriptor instanceof MenuRadioItemDescriptor) { - final MenuRadioItemDescriptor checkItem = (MenuRadioItemDescriptor) descriptor; - if (!checkItem.isChecked()) { - checkItem.setChecked(true); - } - } else if (descriptor instanceof MenuCheckItemDescriptor) { - final MenuCheckItemDescriptor checkItem = (MenuCheckItemDescriptor) descriptor; - final boolean currentValue = checkItem.isChecked(); - checkItem.setChecked(!currentValue); - } - descriptor.getAction().actionPerformed( - new ActionEvent(item, getTargetObjectOfAction(descriptor), Event.getCurrentEvent())); - } - } - }); - configureItemFromProperties(); + private void confRadioCheckListener(final MenuRadioItemDescriptor descriptor, + final GwtCheckItem checkItem) { + descriptor.addPropertyChangeListener(new PropertyChangeListener() { + @Override + public void propertyChange(final PropertyChangeEvent event) { - final int position = descriptor.getPosition(); - final AbstractGwtMenuGui menu = getParentMenu(descriptor); - if (menu == null) { - throw new UIException("Warning: To add a menu item you need to add the menu before. Item: " + descriptor); + if (event.getPropertyName().equals(MenuCheckItemDescriptor.CHECKED)) { + final Boolean checked = (Boolean) event.getNewValue(); + setRadioChecked(checked); + layout(); } - if (position == GuiActionDescrip.NO_POSITION) { - menu.add(item); - } else { - menu.insert(position, item); - } - return this; - } + } + }); + setRadioChecked(descriptor.isChecked()); + iconLabel.setWidth("100%"); + } - private GwtCheckItem createCheckItem(final MenuItemDescriptor descriptor) { - final GwtCheckItem checkItem = new GwtCheckItem(); - checkItem.setChecked(((MenuCheckItemDescriptor) descriptor).isChecked()); - return checkItem; + @Override + public AbstractGuiItem create(final GuiActionDescrip descriptor) { + super.descriptor = descriptor; + iconLabel = new IconLabel(""); + if (descriptor instanceof MenuRadioItemDescriptor) { + final GwtCheckItem checkItem = createCheckItem((MenuItemDescriptor) descriptor); + final MenuRadioItemDescriptor radioDescrip = (MenuRadioItemDescriptor) descriptor; + confRadioCheckListener(radioDescrip, checkItem); + item = checkItem; + } else if (descriptor instanceof MenuCheckItemDescriptor) { + final GwtCheckItem checkItem = createCheckItem((MenuItemDescriptor) descriptor); + confCheckListener((MenuCheckItemDescriptor) descriptor, checkItem); + item = checkItem; + } else if (descriptor instanceof MenuTitleItemDescriptor) { + item = new GwtBaseMenuItem("", true); + item.setStyleName("k-menuimtem-title"); + } else { + item = new GwtBaseMenuItem("", true); } - private String createShortCut(final KeyStroke key, final String style) { - // See: https://yui-ext.com/forum/showthread.php?t=5762 - final Element keyLabel = DOM.createSpan(); - keyLabel.setId(style); - keyLabel.setInnerText(key.toString()); - return keyLabel.getString(); + final String id = descriptor.getId(); + if (id != null) { + item.ensureDebugId(id); } + // initWidget(item); + item.setCommand(new Command() { + @Override + public void execute() { + getParentMenu(descriptor).hide(); + final AbstractAction action = descriptor.getAction(); + if (action != null) { + if (descriptor instanceof MenuRadioItemDescriptor) { + final MenuRadioItemDescriptor checkItem = (MenuRadioItemDescriptor) descriptor; + if (!checkItem.isChecked()) { + checkItem.setChecked(true); + } + } else if (descriptor instanceof MenuCheckItemDescriptor) { + final MenuCheckItemDescriptor checkItem = (MenuCheckItemDescriptor) descriptor; + final boolean currentValue = checkItem.isChecked(); + checkItem.setChecked(!currentValue); + } + descriptor.getAction().actionPerformed( + new ActionEvent(item, getTargetObjectOfAction(descriptor), Event.getCurrentEvent())); + } + } + }); + configureItemFromProperties(); - public GwtBaseMenuItem getItem() { - return item; + final int position = descriptor.getPosition(); + final AbstractGwtMenuGui menu = getParentMenu(descriptor); + if (menu == null) { + throw new UIException("Warning: To add a menu item you need to add the menu before. Item: " + + descriptor); } - - private AbstractGwtMenuGui getParentMenu(final GuiActionDescrip descriptor) { - return ((AbstractGwtMenuGui) descriptor.getParent().getValue(ParentWidget.PARENT_UI)); + if (position == GuiActionDescrip.NO_POSITION) { + menu.add(item); + } else { + menu.insert(position, item); } + return this; + } - private void layout() { - item.setHTML(iconLabel.toString()); - } + private GwtCheckItem createCheckItem(final MenuItemDescriptor descriptor) { + final GwtCheckItem checkItem = new GwtCheckItem(); + checkItem.setChecked(((MenuCheckItemDescriptor) descriptor).isChecked()); + return checkItem; + } - private void setCheckedIcon(final Boolean checked) { - iconLabel.setLeftIconResource(checked ? res.checked() : res.unChecked()); - } + private String createShortCut(final KeyStroke key, final String style) { + // See: https://yui-ext.com/forum/showthread.php?t=5762 + final Element keyLabel = DOM.createSpan(); + keyLabel.setId(style); + keyLabel.setInnerText(key.toString()); + return keyLabel.getString(); + } - @Override - protected void setEnabled(final boolean enabled) { - item.setEnabled(enabled); - setVisible(enabled); - } + public GwtBaseMenuItem getItem() { + return item; + } - @Override - public void setIconResource(final ImageResource icon) { - iconLabel.setRightIconResource(icon); - layout(); - } + private AbstractGwtMenuGui getParentMenu(final GuiActionDescrip descriptor) { + return ((AbstractGwtMenuGui) descriptor.getParent().getValue(ParentWidget.PARENT_UI)); + } - @Override - protected void setIconStyle(final String style) { - iconLabel.setRightIcon(style); - layout(); - } + private void layout() { + item.setHTML(iconLabel.toString()); + } - private void setRadioChecked(final Boolean checked) { - iconLabel.setLeftIconResource(checked ? res.radioChecked() : res.radioUnChecked()); - } + private void setCheckedIcon(final Boolean checked) { + iconLabel.setLeftIconResource(checked ? res.checked() : res.unChecked()); + } - @Override - protected void setText(final String text) { - if (text != null) { - final KeyStroke key = (KeyStroke) descriptor.getValue(Action.ACCELERATOR_KEY); - if (key == null) { - iconLabel.setText(text); - } else { - iconLabel.setLabelText(text + createShortCut(key, "oc-mshortcut-hidden") - + createShortCut(key, "oc-mshortcut")); - } - } - layout(); - } + @Override + protected void setEnabled(final boolean enabled) { + item.setEnabled(enabled); + setVisible(enabled); + } - @Override - protected void setToolTipText(final String text) { - if (text != null) { - final KeyStroke key = (KeyStroke) descriptor.getValue(Action.ACCELERATOR_KEY); - Tooltip.to(iconLabel, key == null ? text : text + key.toString()); - layout(); - } + @Override + public void setIconResource(final ImageResource icon) { + iconLabel.setRightIconResource(icon); + iconLabel.addRightIconStyle("k-fl"); + layout(); + } + + @Override + protected void setIconStyle(final String style) { + iconLabel.setRightIcon(style); + layout(); + } + + private void setRadioChecked(final Boolean checked) { + iconLabel.setLeftIconResource(checked ? res.radioChecked() : res.radioUnChecked()); + } + + @Override + protected void setText(final String text) { + if (text != null) { + final KeyStroke key = (KeyStroke) descriptor.getValue(Action.ACCELERATOR_KEY); + if (key == null) { + iconLabel.setText(text); + } else { + iconLabel.setLabelText(text + createShortCut(key, "oc-mshortcut-hidden") + + createShortCut(key, "oc-mshortcut")); + } } + layout(); + } - @Override - public void setVisible(final boolean visible) { - item.setVisible(visible); - iconLabel.setVisible(visible); - layout(); + @Override + protected void setToolTipText(final String text) { + if (text != null) { + final KeyStroke key = (KeyStroke) descriptor.getValue(Action.ACCELERATOR_KEY); + Tooltip.to(iconLabel, key == null ? text : text + key.toString()); + layout(); } + } - @Override - public boolean shouldBeAdded() { // NOPMD by vjrj on 18/01/11 0:48 - return false; - } + @Override + public void setVisible(final boolean visible) { + item.setVisible(visible); + iconLabel.setVisible(visible); + layout(); + } + + @Override + public boolean shouldBeAdded() { // NOPMD by vjrj on 18/01/11 0:48 + return false; + } } Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java =================================================================== --- trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) + * opyright (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 @@ -34,102 +34,107 @@ public class GwtMenuGui extends AbstractGwtMenuGui { - private Button button; - private IconLabel iconLabel; - private boolean notStandAlone; + private Button button; + private IconLabel iconLabel; + private boolean notStandAlone; - @Override - protected void addStyle(final String style) { - if (notStandAlone) { - iconLabel.addStyleName(style); - button.addStyleName(style); - layout(); - } + @Override + protected void addStyle(final String style) { + if (notStandAlone) { + iconLabel.addStyleName(style); + button.addStyleName(style); + layout(); } + } - @Override - public AbstractGuiItem create(final GuiActionDescrip descriptor) { - super.descriptor = descriptor; - descriptor.putValue(ParentWidget.PARENT_UI, this); - // Standalone menus are menus without and associated button in a toolbar - // (sometimes, a menu showed in a grid, or other special widgets) - notStandAlone = !((MenuDescriptor) descriptor).isStandalone(); - if (notStandAlone) { - button = new Button(); - button.setStylePrimaryName("oc-button"); - iconLabel = new IconLabel(""); - button.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - show(button); - } - }); - final String id = descriptor.getId(); - if (id != null) { - button.ensureDebugId(id); - } - if (!descriptor.isChild()) { - initWidget(button); - } else { - child = button; - } - } else { - initWidget(new Label()); + @Override + public AbstractGuiItem create(final GuiActionDescrip descriptor) { + super.descriptor = descriptor; + descriptor.putValue(ParentWidget.PARENT_UI, this); + // Standalone menus are menus without and associated button in a toolbar + // (sometimes, a menu showed in a grid, or other special widgets) + notStandAlone = !((MenuDescriptor) descriptor).isStandalone(); + if (notStandAlone) { + button = new Button(); + button.setStylePrimaryName("oc-button"); + iconLabel = new IconLabel(""); + final ImageResource rightIcon = ((MenuDescriptor) descriptor).getRightIcon(); + if (rightIcon != null) { + iconLabel.setRightIconResource(rightIcon); + iconLabel.addRightIconStyle("k-fr"); + } + button.addClickHandler(new ClickHandler() { + @Override + public void onClick(final ClickEvent event) { + show(button); } - super.create(descriptor); - configureItemFromProperties(); - return this; + }); + final String id = descriptor.getId(); + if (id != null) { + button.ensureDebugId(id); + } + if (!descriptor.isChild()) { + initWidget(button); + } else { + child = button; + } + } else { + initWidget(new Label()); } + super.create(descriptor); + configureItemFromProperties(); + return this; + } - private void layout() { - button.setHTML(iconLabel.getElement().getInnerHTML()); - } + private void layout() { + button.setHTML(iconLabel.getElement().getInnerHTML()); + } - @Override - public void setEnabled(final boolean enabled) { - if (notStandAlone) { - button.setVisible(enabled); - } + @Override + public void setEnabled(final boolean enabled) { + if (notStandAlone) { + button.setVisible(enabled); } + } - @Override - public void setIconResource(final ImageResource resource) { - if (notStandAlone) { - iconLabel.setLeftIconResource(resource); - layout(); - } + @Override + public void setIconResource(final ImageResource resource) { + if (notStandAlone) { + iconLabel.setLeftIconResource(resource); + layout(); } + } - @Override - public void setIconStyle(final String style) { - if (notStandAlone) { - iconLabel.setRightIcon(style); - layout(); - } + @Override + public void setIconStyle(final String style) { + if (notStandAlone) { + iconLabel.setRightIcon(style); + layout(); } + } - @Override - public void setText(final String text) { - if (notStandAlone) { - iconLabel.setText(text); - layout(); - } + @Override + public void setText(final String text) { + if (notStandAlone) { + iconLabel.setText(text); + layout(); } + } - @Override - public void setToolTipText(final String tooltip) { - if (notStandAlone) { - Tooltip.to(button, tooltip); - } + @Override + public void setToolTipText(final String tooltip) { + if (notStandAlone) { + Tooltip.to(button, tooltip); } + } - @Override - public void setVisible(final boolean visible) { - if (notStandAlone) { - button.setVisible(visible); - } else { - // button.setVisible(visible); - } + @Override + public void setVisible(final boolean visible) { + if (notStandAlone) { + button.setVisible(visible); + } else { + // button.setVisible(visible); } + } } Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java =================================================================== --- trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -28,7 +28,7 @@ import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip; import cc.kune.common.client.errors.NotImplementedException; import cc.kune.common.client.utils.TextUtils; -import cc.kune.core.client.resources.icons.IconConstants; +import cc.kune.core.client.resources.IconConstants; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.user.client.ui.Composite; Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuDescriptor.java =================================================================== --- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuDescriptor.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuDescriptor.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -27,115 +27,124 @@ public class MenuDescriptor extends AbstractGuiActionDescrip { - public static final String MENU_CLEAR = "menuclear"; - public static final String MENU_HIDE = "hidemenu"; - public static final String MENU_ONHIDE = "menuonhide"; - public static final String MENU_ONSHOW = "menuonshow"; - public static final String MENU_SHOW = "showmenu"; - public static final String MENU_SHOW_NEAR_TO = "showmenunearto"; - protected static final String MENU_STANDALONE = "menustandalone"; + public static final String MENU_CLEAR = "menuclear"; + public static final String MENU_HIDE = "hidemenu"; + public static final String MENU_ONHIDE = "menuonhide"; + public static final String MENU_ONSHOW = "menuonshow"; + protected static final String MENU_RIGHTICON = "menurighicon"; + public static final String MENU_SHOW = "showmenu"; + public static final String MENU_SHOW_NEAR_TO = "showmenunearto"; + protected static final String MENU_STANDALONE = "menustandalone"; - public MenuDescriptor() { - this(new BaseAction(null, null)); - } + public MenuDescriptor() { + this(new BaseAction(null, null)); + } - public MenuDescriptor(final AbstractAction action) { - this(NO_PARENT, action); - } + public MenuDescriptor(final AbstractAction action) { + this(NO_PARENT, action); + } - public MenuDescriptor(final GuiActionDescrip parent, final AbstractAction action) { - super(action); - setParent(parent); - putValue(MENU_HIDE, false); - putValue(MENU_SHOW, false); - putValue(MENU_CLEAR, false); - putValue(MENU_STANDALONE, false); - } + public MenuDescriptor(final GuiActionDescrip parent, final AbstractAction action) { + super(action); + setParent(parent); + putValue(MENU_HIDE, false); + putValue(MENU_SHOW, false); + putValue(MENU_CLEAR, false); + putValue(MENU_STANDALONE, false); + } - public MenuDescriptor(final String text) { - this(new BaseAction(text, null)); - } + public MenuDescriptor(final String text) { + this(new BaseAction(text, null)); + } - public MenuDescriptor(final String text, final ImageResource icon) { - this(new BaseAction(text, null, icon)); - } + public MenuDescriptor(final String text, final ImageResource icon) { + this(new BaseAction(text, null, icon)); + } - public MenuDescriptor(final String text, final String tooltip) { - this(new BaseAction(text, tooltip)); - } + public MenuDescriptor(final String text, final String tooltip) { + this(new BaseAction(text, tooltip)); + } - public MenuDescriptor(final String text, final String tooltip, final ImageResource icon) { - this(new BaseAction(text, tooltip, icon)); - } + public MenuDescriptor(final String text, final String tooltip, final ImageResource icon) { + this(new BaseAction(text, tooltip, icon)); + } - public MenuDescriptor(final String text, final String tooltip, final String icon) { - this(new BaseAction(text, tooltip, icon)); - } + public MenuDescriptor(final String text, final String tooltip, final String icon) { + this(new BaseAction(text, tooltip, icon)); + } - public void clear() { - // Action detects changes in values, then we fire a change (whatever) to - // fire this method in the UI - putValue(MENU_CLEAR, !((Boolean) getValue(MENU_CLEAR))); - } + public void clear() { + // Action detects changes in values, then we fire a change (whatever) to + // fire this method in the UI + putValue(MENU_CLEAR, !((Boolean) getValue(MENU_CLEAR))); + } - @Override - public Class<?> getType() { - return MenuDescriptor.class; - } + public ImageResource getRightIcon() { + return (ImageResource) super.getValue(MENU_RIGHTICON); + } - public void hide() { - putValue(MENU_HIDE, !((Boolean) getValue(MENU_HIDE))); - } + @Override + public Class<?> getType() { + return MenuDescriptor.class; + } - public boolean isStandalone() { - return (Boolean) super.getValue(MENU_STANDALONE); - } + public void hide() { + putValue(MENU_HIDE, !((Boolean) getValue(MENU_HIDE))); + } - /** - * Sets the standalone property (if the menu should have button (for a - * toolbar) or is a menu independent. - * - * @param standalone - * the new standalone - */ - public void setStandalone(final boolean standalone) { - putValue(MENU_STANDALONE, standalone); - } + public boolean isStandalone() { + return (Boolean) super.getValue(MENU_STANDALONE); + } - public void setText(final String text) { - putValue(Action.NAME, text); - } + public void setRightIcon(final ImageResource icon) { + putValue(MENU_RIGHTICON, icon); + } - /** - * Show the menu near the Element object specified - * - * @param object - * the element to show menu near of it - */ - public void show(final Object object) { - putValue(MENU_SHOW_NEAR_TO, object); - putValue(MENU_SHOW, !((Boolean) getValue(MENU_SHOW))); - } + /** + * Sets the standalone property (if the menu should have button (for a + * toolbar) or is a menu independent. + * + * @param standalone + * the new standalone + */ + public void setStandalone(final boolean standalone) { + putValue(MENU_STANDALONE, standalone); + } - /** - * Show the menu near the position specified - * - * @param position - * the position to show menu near of it - */ - public void show(final Position position) { - putValue(MENU_SHOW_NEAR_TO, position); - putValue(MENU_SHOW, !((Boolean) getValue(MENU_SHOW))); - } + public void setText(final String text) { + putValue(Action.NAME, text); + } - /** - * Show the menu near the Element id specified - * - * @param id - * the element id to show menu near of it - */ - public void show(final String id) { - putValue(MENU_SHOW_NEAR_TO, id); - putValue(MENU_SHOW, !((Boolean) getValue(MENU_SHOW))); - } + /** + * Show the menu near the Element object specified + * + * @param object + * the element to show menu near of it + */ + public void show(final Object object) { + putValue(MENU_SHOW_NEAR_TO, object); + putValue(MENU_SHOW, !((Boolean) getValue(MENU_SHOW))); + } + + /** + * Show the menu near the position specified + * + * @param position + * the position to show menu near of it + */ + public void show(final Position position) { + putValue(MENU_SHOW_NEAR_TO, position); + putValue(MENU_SHOW, !((Boolean) getValue(MENU_SHOW))); + } + + /** + * Show the menu near the Element id specified + * + * @param id + * the element id to show menu near of it + */ + public void show(final String id) { + putValue(MENU_SHOW_NEAR_TO, id); + putValue(MENU_SHOW, !((Boolean) getValue(MENU_SHOW))); + } } Modified: trunk/src/main/java/cc/kune/common/client/ui/IconLabel.java =================================================================== --- trunk/src/main/java/cc/kune/common/client/ui/IconLabel.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/common/client/ui/IconLabel.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -40,131 +40,135 @@ public class IconLabel extends Composite implements HasWidgets, HasDirectionalText { - interface IconTitleUiBinder extends UiBinder<Widget, IconLabel> { - } + interface IconTitleUiBinder extends UiBinder<Widget, IconLabel> { + } - private static IconTitleUiBinder uiBinder = GWT.create(IconTitleUiBinder.class); + private static IconTitleUiBinder uiBinder = GWT.create(IconTitleUiBinder.class); - @UiField - FlowPanel flow; - @UiField - Image iconLeft; - @UiField - Image iconRight; - @UiField - InlineLabel label; - @UiField - FocusPanel self; + @UiField + FlowPanel flow; + @UiField + Image iconLeft; + @UiField + Image iconRight; + @UiField + InlineLabel label; + @UiField + FocusPanel self; - public IconLabel() { - this(""); - } + public IconLabel() { + this(""); + } - public IconLabel(final ImageResource imgRes, final String text) { - this(text); - if (imgRes != null) { - iconLeft.setResource(imgRes); - } + public IconLabel(final ImageResource imgRes, final String text) { + this(text); + if (imgRes != null) { + iconLeft.setResource(imgRes); } + } - public IconLabel(final String text) { - initWidget(uiBinder.createAndBindUi(this)); - label.setText(text); - label.addStyleName("k-space-nowrap"); - label.addStyleName("k-iconlabel-text"); - } + public IconLabel(final String text) { + initWidget(uiBinder.createAndBindUi(this)); + label.setText(text); + label.addStyleName("k-space-nowrap"); + label.addStyleName("k-iconlabel-text"); + } - @Override - public void add(final Widget w) { - flow.add(w); - } + @Override + public void add(final Widget w) { + flow.add(w); + } - @Override - public void addStyleName(final String style) { - flow.addStyleName(style); - } + public void addRightIconStyle(final String style) { + iconRight.addStyleName(style); + } - public void addTextStyleName(final String style) { - label.addStyleName(style); - } + @Override + public void addStyleName(final String style) { + flow.addStyleName(style); + } - @Override - public void clear() { - flow.clear(); - } + public void addTextStyleName(final String style) { + label.addStyleName(style); + } - public HasClickHandlers getFocus() { - return self; - } + @Override + public void clear() { + flow.clear(); + } - @Override - public String getText() { - return label.getText(); - } + public HasClickHandlers getFocus() { + return self; + } - @Override - public Direction getTextDirection() { - return label.getTextDirection(); - } + @Override + public String getText() { + return label.getText(); + } - @Override - public Iterator<Widget> iterator() { - return flow.iterator(); - } + @Override + public Direction getTextDirection() { + return label.getTextDirection(); + } - @Override - public boolean remove(final Widget w) { - return flow.remove(w); - } + @Override + public Iterator<Widget> iterator() { + return flow.iterator(); + } - public void setLabelText(final String text) { - label.setText(text); - } + @Override + public boolean remove(final Widget w) { + return flow.remove(w); + } - public void setLeftIcon(final String imgCss) { - iconLeft.setUrl("images/clear.gif"); - iconLeft.setStyleName(imgCss); - iconLeft.addStyleName("k-iconlabel-left"); - iconLeft.addStyleName("oc-ico-pad"); - } + public void setLabelText(final String text) { + label.setText(text); + } - public void setLeftIconResource(final ImageResource res) { - iconLeft.setResource(res); - iconLeft.addStyleName("k-iconlabel-left"); - } + public void setLeftIcon(final String imgCss) { + iconLeft.setUrl("images/clear.gif"); + iconLeft.setStyleName(imgCss); + iconLeft.addStyleName("k-iconlabel-left"); + iconLeft.addStyleName("oc-ico-pad"); + } - public void setRightIcon(final String imgCss) { - iconRight.setUrl("images/clear.gif"); - iconRight.setStyleName(imgCss); - iconRight.addStyleName("oc-ico-pad"); - iconRight.addStyleName("k-iconlabel-right"); - } + public void setLeftIconResource(final ImageResource res) { + iconLeft.setResource(res); + iconLeft.addStyleName("k-iconlabel-left"); + } - public void setRightIconResource(final ImageResource res) { - iconRight.setResource(res); - iconRight.addStyleName("k-iconlabel-right"); - } + public void setRightIcon(final String imgCss) { + iconRight.setUrl("images/clear.gif"); + iconRight.setStyleName(imgCss); + iconRight.addStyleName("oc-ico-pad"); + iconRight.addStyleName("k-iconlabel-right"); + } - @Override - public void setStyleName(final String style) { - flow.setStyleName(style); - } + public void setRightIconResource(final ImageResource res) { + iconRight.setResource(res); + iconRight.addStyleName("k-iconlabel-right"); + } - @Override - public void setText(final String text) { - label.setText(text); - } + @Override + public void setStyleName(final String style) { + flow.setStyleName(style); + } - @Override - public void setText(final String text, final Direction dir) { - label.setText(text, dir); - } + @Override + public void setText(final String text) { + label.setText(text); + } - public void setTooltip(final String text) { - Tooltip.to(label, text); - } + @Override + public void setText(final String text, final Direction dir) { + label.setText(text, dir); + } - public void setWordWrap(final boolean wordWrap) { - label.setWordWrap(wordWrap); - } + public void setTooltip(final String text) { + Tooltip.to(label, text); + } + + public void setWordWrap(final boolean wordWrap) { + label.setWordWrap(wordWrap); + } } Modified: trunk/src/main/java/cc/kune/common/public/kune-common.css =================================================================== --- trunk/src/main/java/cc/kune/common/public/kune-common.css 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/common/public/kune-common.css 2011-05-04 20:29:42 UTC (rev 1340) @@ -470,7 +470,7 @@ } .k-iconlabel-right { - float: left; + /* float: left; */ /* margin-left: 5px; */ } Modified: trunk/src/main/java/cc/kune/core/client/resources/CoreResources.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/resources/CoreResources.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/core/client/resources/CoreResources.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -24,467 +24,491 @@ import com.google.gwt.resources.client.ImageResource; public interface CoreResources extends ClientBundle { - public interface Style extends CssResource { - String loadingSpiner(); - } + public interface Style extends CssResource { + String loadingSpiner(); + } - @Source("accept.png") - ImageResource accept(); + @Source("accept.png") + ImageResource accept(); - @Source("add.png") - ImageResource add(); + @Source("add.png") + ImageResource add(); - @Source("add-green.png") - ImageResource addGreen(); + @Source("add-green.png") + ImageResource addGreen(); - @Source("alert.png") - ImageResource alert(); + @Source("alert.png") + ImageResource alert(); - @Source("anybody.png") - ImageResource anybody(); + @Source("anybody.png") + ImageResource anybody(); - @Source("arrowdown.png") - ImageResource arrowdown(); + @Source("arrowdown.png") + ImageResource arrowdown(); - @Source("arrow-down-black.gif") - ImageResource arrowDownBlack(); + @Source("arrow-down-black.gif") + ImageResource arrowDownBlack(); - @Source("arrow-down-green.png") - ImageResource arrowDownGreen(); + @Source("arrow-down-green.png") + ImageResource arrowDownGreen(); - @Source("arrowdownsitebar.gif") - ImageResource arrowdownsitebar(); + @Source("arrowdownsitebar.gif") + ImageResource arrowdownsitebar(); - @Source("arrowdownsquarewhite.gif") - ImageResource arrowdownsquarewhite(); + @Source("arrowdownsquarewhite.gif") + ImageResource arrowdownsquarewhite(); - @Source("arrow-down-white.gif") - ImageResource arrowDownWhite(); + @Source("arrow-down-white.gif") + ImageResource arrowDownWhite(); - @Source("arrow_in.png") - ImageResource arrowIn(); + @Source("arrow_in.png") + ImageResource arrowIn(); - @Source("arrow-left-green.png") - ImageResource arrowLeftGreen(); + @Source("arrow-left-green.png") + ImageResource arrowLeftGreen(); - @Source("arrow_out.png") - ImageResource arrowOut(); + @Source("arrow_out.png") + ImageResource arrowOut(); - @Source("arrow-right-black.gif") - ImageResource arrowRightBlack(); + @Source("arrow-right-black.gif") + ImageResource arrowRightBlack(); - @Source("arrow-right-green.png") - ImageResource arrowRightGreen(); + @Source("arrow-right-green.png") + ImageResource arrowRightGreen(); - @Source("arrow-right-white.gif") - ImageResource arrowRightWhite(); + @Source("arrow-right-white.gif") + ImageResource arrowRightWhite(); - @Source("arrow-up-green.png") - ImageResource arrowUpGreen(); + @Source("arrow-up-green.png") + ImageResource arrowUpGreen(); - @Source("browser-32.png") - ImageResource browser32(); + @Source("browser-32.png") + ImageResource browser32(); - @Source("bullet_add.png") - ImageResource bulletAdd(); + @Source("bug.png") + ImageResource bug(); - @Source("bullet_black.png") - ImageResource bulletBlack(); + @Source("bullet_add.png") + ImageResource bulletAdd(); - @Source("bullet_blue.png") - ImageResource bulletBlue(); + @Source("bullet_black.png") + ImageResource bulletBlack(); - @Source("bullet_delete.png") - ImageResource bulletDelete(); + @Source("bullet_blue.png") + ImageResource bulletBlue(); - @Source("bullet_green.png") - ImageResource bulletGreen(); + @Source("bullet_delete.png") + ImageResource bulletDelete(); - @Source("bullet_pink.png") - ImageResource bulletPink(); + @Source("bullet_green.png") + ImageResource bulletGreen(); - @Source("bullet_purple.png") - ImageResource bulletPurple(); + @Source("bullet_pink.png") + ImageResource bulletPink(); - @Source("bullet_red.png") - ImageResource bulletRed(); + @Source("bullet_purple.png") + ImageResource bulletPurple(); - @Source("bullet_star.png") - ImageResource bulletStar(); + @Source("bullet_red.png") + ImageResource bulletRed(); - @Source("bullet_toggle_minus.png") - ImageResource bulletToggleMinus(); + @Source("bullet_star.png") + ImageResource bulletStar(); - @Source("bullet_toggle_plus.png") - ImageResource bulletTogglePlus(); + @Source("bullet_toggle_minus.png") + ImageResource bulletToggleMinus(); - @Source("bullet_yellow.png") - ImageResource bulletYellow(); + @Source("bullet_toggle_plus.png") + ImageResource bulletTogglePlus(); - @Source("button15cblue.png") - ImageResource button15cblue(); + @Source("bullet_yellow.png") + ImageResource bulletYellow(); - @Source("button15cdark.png") - ImageResource button15cdark(); + @Source("button15cblue.png") + ImageResource button15cblue(); - @Source("button15clight.png") - ImageResource button15clight(); + @Source("button15cdark.png") + ImageResource button15cdark(); - @Source("button15cxlight.png") - ImageResource button15cxlight(); + @Source("button15clight.png") + ImageResource button15clight(); - @Source("button15lblue.png") - ImageResource button15lblue(); + @Source("button15cxlight.png") + ImageResource button15cxlight(); - @Source("button15ldark.png") - ImageResource button15ldark(); + @Source("button15lblue.png") + ImageResource button15lblue(); - @Source("button15llight.png") - ImageResource button15llight(); + @Source("button15ldark.png") + ImageResource button15ldark(); - @Source("button15lxlight.png") - ImageResource button15lxlight(); + @Source("button15llight.png") + ImageResource button15llight(); - @Source("button15rblue.png") - ImageResource button15rblue(); + @Source("button15lxlight.png") + ImageResource button15lxlight(); - @Source("button15rdark.png") - ImageResource button15rdark(); + @Source("button15rblue.png") + ImageResource button15rblue(); - @Source("button15rlight.png") - ImageResource button15rlight(); + @Source("button15rdark.png") + ImageResource button15rdark(); - @Source("button15rxlight.png") - ImageResource button15rxlight(); + @Source("button15rlight.png") + ImageResource button15rlight(); - @Source("button17cblue.png") - ImageResource button17cblue(); + @Source("button15rxlight.png") + ImageResource button15rxlight(); - @Source("button17cdark.png") - ImageResource button17cdark(); + @Source("button17cblue.png") + ImageResource button17cblue(); - @Source("button17clight.png") - ImageResource button17clight(); + @Source("button17cdark.png") + ImageResource button17cdark(); - @Source("button17cxlight.png") - ImageResource button17cxlight(); + @Source("button17clight.png") + ImageResource button17clight(); - @Source("button17lblue.png") - ImageResource button17lblue(); + @Source("button17cxlight.png") + ImageResource button17cxlight(); - @Source("button17ldark.png") - ImageResource button17ldark(); + @Source("button17lblue.png") + ImageResource button17lblue(); - @Source("button17llight.png") - ImageResource button17llight(); + @Source("button17ldark.png") + ImageResource button17ldark(); - @Source("button17lxlight.png") - ImageResource button17lxlight(); + @Source("button17llight.png") + ImageResource button17llight(); - @Source("button17rblue.png") - ImageResource button17rblue(); + @Source("button17lxlight.png") + ImageResource button17lxlight(); - @Source("button17rdark.png") - ImageResource button17rdark(); + @Source("button17rblue.png") + ImageResource button17rblue(); - @Source("button17rlight.png") - ImageResource button17rlight(); + @Source("button17rdark.png") + ImageResource button17rdark(); - @Source("button17rxlight.png") - ImageResource button17rxlight(); + @Source("button17rlight.png") + ImageResource button17rlight(); - @Source("button20cblue.png") - ImageResource button20cblue(); + @Source("button17rxlight.png") + ImageResource button17rxlight(); - @Source("button20cdark.png") - ImageResource button20cdark(); + @Source("button20cblue.png") + ImageResource button20cblue(); - @Source("button20clight.png") - ImageResource button20clight(); + @Source("button20cdark.png") + ImageResource button20cdark(); - @Source("button20cxlight.png") - ImageResource button20cxlight(); + @Source("button20clight.png") + ImageResource button20clight(); - @Source("button20lblue.png") - ImageResource button20lblue(); + @Source("button20cxlight.png") + ImageResource button20cxlight(); - @Source("button20ldark.png") - ImageResource button20ldark(); + @Source("button20lblue.png") + ImageResource button20lblue(); - @Source("button20llight.png") - ImageResource button20llight(); + @Source("button20ldark.png") + ImageResource button20ldark(); - @Source("button20lxlight.png") - ImageResource button20lxlight(); + @Source("button20llight.png") + ImageResource button20llight(); - @Source("button20rblue.png") - ImageResource button20rblue(); + @Source("button20lxlight.png") + ImageResource button20lxlight(); - @Source("button20rdark.png") - ImageResource button20rdark(); + @Source("button20rblue.png") + ImageResource button20rblue(); - @Source("button20rlight.png") - ImageResource button20rlight(); + @Source("button20rdark.png") + ImageResource button20rdark(); - @Source("button20rxlight.png") - ImageResource button20rxlight(); + @Source("button20rlight.png") + ImageResource button20rlight(); - @Source("button-arrow-down.png") - ImageResource buttonArrowDown(); + @Source("button20rxlight.png") + ImageResource button20rxlight(); - @Source("button-help-blue.png") - ImageResource buttonHelpBlue(); + @Source("button-arrow-down.png") + ImageResource buttonArrowDown(); - @Source("button-help-dark.png") - ImageResource buttonHelpDark(); + @Source("button-help-blue.png") + ImageResource buttonHelpBlue(); - @Source("button-help-light.png") - ImageResource buttonHelpLight(); + @Source("button-help-dark.png") + ImageResource buttonHelpDark(); - @Source("by80x15.png") - ImageResource by80x15(); + @Source("button-help-light.png") + ImageResource buttonHelpLight(); - @Source("bync80x15.png") - ImageResource bync80x15(); + @Source("by80x15.png") + ImageResource by80x15(); - @Source("byncnd80x15.png") - ImageResource byncnd80x15(); + @Source("bync80x15.png") + ImageResource bync80x15(); - @Source("byncsa80x15.png") - ImageResource byncsa80x15(); + @Source("byncnd80x15.png") + ImageResource byncnd80x15(); - @Source("bynd80x15.png") - ImageResource bynd80x15(); + @Source("byncsa80x15.png") + ImageResource byncsa80x15(); - @Source("bysa80x15.png") - ImageResource bysa80x15(); + @Source("bynd80x15.png") + ImageResource bynd80x15(); - @Source("cancel.png") - ImageResource cancel(); + @Source("bysa80x15.png") + ImageResource bysa80x15(); - @Source("cancel-32.png") - ImageResource cancel32(); + @Source("cancel.png") + ImageResource cancel(); - @Source("charfontname.png") - ImageResource charfontname(); + @Source("cancel-32.png") + ImageResource cancel32(); - @Source("clear.png") - ImageResource clear(); + @Source("charfontname.png") + ImageResource charfontname(); - @Source("content_edit.png") - ImageResource contentEdit(); + @Source("checked.png") + ImageResource checked(); - @Source("copyleft.png") - ImageResource copyleft(); + @Source("clear.png") + ImageResource clear(); - @Source("cross.png") - ImageResource cross(); + @Source("content_edit.png") + ImageResource contentEdit(); - @Source("cross-dark.png") - ImageResource crossDark(); + @Source("copyleft.png") + ImageResource copyleft(); - @Source("core.css") - Style css(); + @Source("cross.png") + ImageResource cross(); - @Source("del.png") - ImageResource del(); + @Source("cross-dark.png") + ImageResource crossDark(); - @Source("emblem-important.png") - ImageResource emblemImportant(); + @Source("core.css") + Style css(); - @Source("emblem-system.png") - ImageResource emblemSystem(); + @Source("del.png") + ImageResource del(); - @Source("emite-room.png") - ImageResource emiteRoom(); + @Source("del-green.png") + ImageResource delGreen(); - @Source("error.png") - ImageResource error(); + @Source("emblem-important.png") + ImageResource emblemImportant(); - @Source("everybody.png") - ImageResource everybody(); + @Source("emblem-system.png") + ImageResource emblemSystem(); - @Source("folder-go-up.gif") - ImageResource folderGoUp(); + @Source("emite-room.png") + ImageResource emiteRoom(); - @Source("folderpathmenu.gif") - ImageResource folderpathmenu(); + @Source("error.png") + ImageResource error(); - @Source("fontheight.png") - ImageResource fontheight(); + @Source("everybody.png") + ImageResource everybody(); - @Source("fullscreen.png") - ImageResource fullscreen(); + @Source("folder-go-up.gif") + ImageResource folderGoUp(); - @Source("gnu-fdl.gif") - ImageResource gnuFdl(); + @Source("folderpathmenu.gif") + ImageResource folderpathmenu(); - @Source("group-def-icon.png") - ImageResource groupDefIcon(); + @Source("fontheight.png") + ImageResource fontheight(); - @Source("group-home.png") - ImageResource groupHome(); + @Source("fullscreen.png") + ImageResource fullscreen(); - @Source("important.png") - ImageResource important(); + @Source("gnu-fdl.gif") + ImageResource gnuFdl(); - @Source("important-32.png") - ImageResource important32(); + @Source("group-def-icon.png") + ImageResource groupDefIcon(); - @Source("info.png") - ImageResource info(); + @Source("group-home.png") + ImageResource groupHome(); - @Source("info-light.png") - ImageResource infoLight(); + @Source("important.png") + ImageResource important(); - @Source("kune-anim.gif") - ImageResource kuneAnim(); + @Source("important-32.png") + ImageResource important32(); - @Source("kune-anim-g.gif") - ImageResource kuneAnimG(); + @Source("info.png") + ImageResource info(); - @Source("kune-close.png") - ImageResource kuneClose(); + @Source("info-light.png") + ImageResource infoLight(); - @Source("kune-external-window.png") - ImageResource kuneExternalWindow(); + @Source("kune-anim.gif") + ImageResource kuneAnim(); - @Source("kune-help-translation-icon.png") - ImageResource kuneHelpTranslationIcon(); + @Source("kune-anim-g.gif") + ImageResource kuneAnimG(); - @Source("kuneicon16.gif") - ImageResource kuneicon16(); + @Source("kune-close.png") + ImageResource kuneClose(); - @Source("kune-icon16.png") - ImageResource kuneIcon16(); + @Source("kune-external-window.png") + ImageResource kuneExternalWindow(); - @Source("kune-logo-16px.png") - ImageResource kuneLogo16px(); + @Source("kune-help-translation-icon.png") + ImageResource kuneHelpTranslationIcon(); - @Source("kune-preferences.png") - ImageResource kunePreferences(); + @Source("kuneicon16.gif") + ImageResource kuneicon16(); - @Source("kune-search-ico.png") - ImageResource kuneSearchIco(); + @Source("kune-icon16.png") + ImageResource kuneIcon16(); - @Source("kune-search-ico-push.png") - ImageResource kuneSearchIcoPush(); + @Source("kune-logo-16px.png") + ImageResource kuneLogo16px(); - @Source("language.png") - ImageResource language(); + @Source("kune-preferences.png") + ImageResource kunePreferences(); - @Source("loading_gadget.gif") - ImageResource loadingGadget(); + @Source("kune-search-ico.png") + ImageResource kuneSearchIco(); - @Source("loading_gadget_small.gif") - ImageResource loadingGadgetSmall(); + @Source("kune-search-ico-push.png") + ImageResource kuneSearchIcoPush(); - @Source("loading-spiner.gif") - ImageResource loadingSpiner(); + @Source("language.png") + ImageResource language(); - @Source("new-chat.gif") - ImageResource newChat(); + @Source("loading_gadget.gif") + ImageResource loadingGadget(); - @Source("nobody.png") - ImageResource nobody(); + @Source("loading_gadget_small.gif") + ImageResource loadingGadgetSmall(); - @Source("no-copyleft.png") - ImageResource noCopyleft(); + @Source("loading-spiner.gif") + ImageResource loadingSpiner(); - @Source("nt.png") - ImageResource nt(); + @Source("arrow_out.png") + ImageResource maximize(); - @Source("opentriangle.gif") - ImageResource opentriangle(); + @Source("arrow_in.png") + ImageResource minimize(); - @Source("person2-60.png") - ImageResource person260(); + @Source("new-chat.gif") + ImageResource newChat(); - @Source("person-def.png") - ImageResource personDef(); + @Source("nobody.png") + ImageResource nobody(); - @Source("prefs.png") - ImageResource prefs(); + @Source("no-copyleft.png") + ImageResource noCopyleft(); - @Source("remove.png") - ImageResource remove(); + @Source("nt.png") + ImageResource nt(); - @Source("rss-icon.png") - ImageResource rssIcon(); + @Source("opentriangle.gif") + ImageResource opentriangle(); - @Source("search-ico.png") - ImageResource searchIco(); + @Source("person2-60.png") + ImageResource person260(); - @Source("spin-kune-thund-green.gif") - ImageResource spinKuneThundGreen(); + @Source("person-def.png") + ImageResource personDef(); - @Source("splitter-vert-bar.gif") - ImageResource splitterVertBar(); + @Source("prefs.png") + ImageResource prefs(); - @Source("star-10.png") - ImageResource star10(); + @Source("radiochecked.png") + ImageResource radiochecked(); - @Source("star-20.png") - ImageResource star20(); + @Source("radiounchecked.png") + ImageResource radioUnChecked(); - @Source("star-30.png") - ImageResource star30(); + @Source("remove.png") + ImageResource remove(); - @Source("star-40.png") - ImageResource star40(); + @Source("rss-icon.png") + ImageResource rssIcon(); - @Source("star-50.png") - ImageResource star50(); + @Source("search-ico.png") + ImageResource searchIco(); - @Source("star-60.png") - ImageResource star60(); + @Source("spin-kune-thund-green.gif") + ImageResource spinKuneThundGreen(); - @Source("star-70.png") - ImageResource star70(); + @Source("splitter-vert-bar.gif") + ImageResource splitterVertBar(); - @Source("star-80.png") - ImageResource star80(); + @Source("star-10.png") + ImageResource star10(); - @Source("star-90.png") - ImageResource star90(); + @Source("star-20.png") + ImageResource star20(); - @Source("star-grey.png") - ImageResource starGrey(); + @Source("star-30.png") + ImageResource star30(); - @Source("star-small-yellow.png") - ImageResource starSmallYellow(); + @Source("star-40.png") + ImageResource star40(); - @Source("star-vsmall-yellow.png") - ImageResource starVsmallYellow(); + @Source("star-50.png") + ImageResource star50(); - @Source("star-yellow.png") - ImageResource starYellow(); + @Source("star-60.png") + ImageResource star60(); - @Source("step1.png") - ImageResource step1(); + @Source("star-70.png") + ImageResource star70(); - @Source("step2.png") - ImageResource step2(); + @Source("star-80.png") + ImageResource star80(); - @Source("step3.png") - ImageResource step3(); + @Source("star-90.png") + ImageResource star90(); - @Source("step4.png") - ImageResource step4(); + @Source("star-grey.png") + ImageResource starGrey(); - @Source("step5.png") - ImageResource step5(); + @Source("star-small-yellow.png") + ImageResource starSmallYellow(); - @Source("theme-choose.png") - ImageResource themeChoose(); + @Source("star-vsmall-yellow.png") + ImageResource starVsmallYellow(); - @Source("triangle.gif") - ImageResource triangle(); + @Source("star-yellow.png") + ImageResource starYellow(); - @Source("unknown-60.png") - ImageResource unknown60(); + @Source("step1.png") + ImageResource step1(); - @Source("wave-icon.png") - ImageResource waveIcon(); + @Source("step2.png") + ImageResource step2(); + @Source("step3.png") + ImageResource step3(); + + @Source("step4.png") + ImageResource step4(); + + @Source("step5.png") + ImageResource step5(); + + @Source("theme-choose.png") + ImageResource themeChoose(); + + @Source("triangle.gif") + ImageResource triangle(); + + @Source("unchecked.png") + ImageResource unChecked(); + + @Source("unknown-60.png") + ImageResource unknown60(); + + @Source("wave-icon.png") + ImageResource waveIcon(); + } Copied: trunk/src/main/java/cc/kune/core/client/resources/IconConstants.java (from rev 1339, trunk/src/main/java/cc/kune/core/client/resources/icons/IconConstants.java) =================================================================== --- trunk/src/main/java/cc/kune/core/client/resources/IconConstants.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/resources/IconConstants.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -0,0 +1,39 @@ +/* + * + * 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.resources; + +import com.google.gwt.resources.client.ImageResource; + +@Deprecated +public final class IconConstants { + + @Deprecated + public static final String CSS_SUFFIX = "k-icon-"; + + private static final String PATH_PREFIX = "images/"; + + @Deprecated + public static String toPath(final ImageResource img) { + return PATH_PREFIX + img.getName() + ".png"; + } + + private IconConstants() { + } +} Added: trunk/src/main/java/cc/kune/core/client/resources/bug.png =================================================================== (Binary files differ) Property changes on: trunk/src/main/java/cc/kune/core/client/resources/bug.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/main/java/cc/kune/core/client/resources/checked.png =================================================================== (Binary files differ) Property changes on: trunk/src/main/java/cc/kune/core/client/resources/checked.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/src/main/java/cc/kune/core/client/resources/core.css =================================================================== --- trunk/src/main/java/cc/kune/core/client/resources/core.css 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/core/client/resources/core.css 2011-05-04 20:29:42 UTC (rev 1340) @@ -1,9 +1,46 @@ @CHARSET "UTF-8"; +@external k-icon-info,k-icon-language,k-icon-kuneIcon16,k-icon-bug,k-icon-prefs,k-icon-groupHome,k-icon-addGreen,k-icon-maximize,k-icon-minimize,k-*; -/* @sprite */ +/* @sprite */ .loadingSpiner { - /* Unused - gwt-image: 'loadingSpiner'; - */ - margin-top: 2px; + /* Unused + gwt-image: 'loadingSpiner'; + */ + margin-top: 2px; } + +@sprite div .k-icon-info { + gwt-image: "info"; +} + +@sprite div .k-icon-language { + gwt-image: "language"; +} + +@sprite div .k-icon-kuneIcon16 { + gwt-image: "kuneIcon16"; +} + +@sprite div .k-icon-bug { + gwt-image: "bug"; +} + +@sprite div .k-icon-prefs { + gwt-image: "prefs"; +} + +@sprite div .k-icon-groupHome { + gwt-image: "groupHome"; +} + +@sprite div .k-icon-addGreen { + gwt-image: "addGreen"; +} + +@sprite div .k-icon-maximize { + gwt-image: "maximize"; +} + +@sprite div .k-icon-minimize { + gwt-image: "minimize"; +} \ No newline at end of file Added: trunk/src/main/java/cc/kune/core/client/resources/del-green.png =================================================================== (Binary files differ) Property changes on: trunk/src/main/java/cc/kune/core/client/resources/del-green.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Deleted: trunk/src/main/java/cc/kune/core/client/resources/icons/IconConstants.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/resources/icons/IconConstants.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/core/client/resources/icons/IconConstants.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -1,39 +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 cc.kune.core.client.resources.icons; - -import com.google.gwt.resources.client.ImageResource; - -@Deprecated -public final class IconConstants { - - @Deprecated - public static final String CSS_SUFFIX = "k-icon-"; - - private static final String PATH_PREFIX = "images/"; - - @Deprecated - public static String toPath(final ImageResource img) { - return PATH_PREFIX + img.getName() + ".png"; - } - - private IconConstants() { - } -} Modified: trunk/src/main/java/cc/kune/core/client/resources/icons/IconResources.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/resources/icons/IconResources.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/core/client/resources/icons/IconResources.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -22,50 +22,51 @@ import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.ImageResource; +@Deprecated public interface IconResources extends ClientBundle { - @Source("add-green.png") - ImageResource addGreen(); + @Source("add-green.png") + ImageResource addGreen(); - @Source("bug.png") - ImageResource bug(); + @Source("bug.png") + ImageResource bug(); - @Source("checked.png") - ImageResource checked(); + @Source("checked.png") + ImageResource checked(); - @Source("kicon.css") - IconCssResource css(); + @Source("kicon.css") + IconCssResource css(); - @Source("del-green.png") - ImageResource delGreen(); + @Source("del-green.png") + ImageResource delGreen(); - @Source("group-home.png") - ImageResource groupHome(); + @Source("group-home.png") + ImageResource groupHome(); - @Source("info.png") - ImageResource info(); + @Source("info.png") + ImageResource info(); - @Source("kune-icon16.png") - ImageResource kuneIcon16(); + @Source("kune-icon16.png") + ImageResource kuneIcon16(); - @Source("language.png") - ImageResource language(); + @Source("language.png") + ImageResource language(); - @Source("arrow_out.png") - ImageResource maximize(); + @Source("arrow_out.png") + ImageResource maximize(); - @Source("arrow_in.png") - ImageResource minimize(); + @Source("arrow_in.png") + ImageResource minimize(); - @Source("prefs.png") - ImageResource prefs(); + @Source("prefs.png") + ImageResource prefs(); - @Source("radiochecked.png") - ImageResource radiochecked(); + @Source("radiochecked.png") + ImageResource radiochecked(); - @Source("radiounchecked.png") - ImageResource radioUnChecked(); + @Source("radiounchecked.png") + ImageResource radioUnChecked(); - @Source("unchecked.png") - ImageResource unChecked(); + @Source("unchecked.png") + ImageResource unChecked(); } Added: trunk/src/main/java/cc/kune/core/client/resources/radiochecked.png =================================================================== (Binary files differ) Property changes on: trunk/src/main/java/cc/kune/core/client/resources/radiochecked.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/main/java/cc/kune/core/client/resources/radiounchecked.png =================================================================== (Binary files differ) Property changes on: trunk/src/main/java/cc/kune/core/client/resources/radiounchecked.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/main/java/cc/kune/core/client/resources/unchecked.png =================================================================== (Binary files differ) Property changes on: trunk/src/main/java/cc/kune/core/client/resources/unchecked.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -31,7 +31,7 @@ import cc.kune.common.client.actions.ui.descrip.ToolbarSeparatorDescriptor; import cc.kune.common.client.actions.ui.descrip.ToolbarSeparatorDescriptor.Type; import cc.kune.core.client.resources.CoreMessages; -import cc.kune.core.client.resources.icons.IconResources; +import cc.kune.core.client.resources.CoreResources; import cc.kune.core.client.services.FileDownloadUtils; import cc.kune.core.client.sn.actions.GotoGroupAction; import cc.kune.core.client.state.Session; @@ -49,115 +49,117 @@ public class SiteUserOptionsPresenter implements SiteUserOptions { - public static final MenuDescriptor LOGGED_USER_MENU = new MenuDescriptor(); - public static final String LOGGED_USER_MENU_ID = "kune-sump-lum"; - private final Provider<FileDownloadUtils> downloadProvider; - private final GotoGroupAction gotoGroupAction; - private final I18nTranslationService i18n; - private final IconResources img; - private SubMenuDescriptor partiMenu; - private ToolbarSeparatorDescriptor separator; - private final Session session; - private final SitebarActionsPresenter siteOptions; - private final StateManager stateManager; + public static final MenuDescriptor LOGGED_USER_MENU = new MenuDescriptor(); + public static final String LOGGED_USER_MENU_ID = "kune-sump-lum"; + private final Provider<FileDownloadUtils> downloadProvider; + private final GotoGroupAction gotoGroupAction; + private final I18nTranslationService i18n; + private SubMenuDescriptor partiMenu; + private final CoreResources res; + private ToolbarSeparatorDescriptor separator; + private final Session session; + private final SitebarActionsPresenter siteOptions; + private final StateManager stateManager; - @Inject - public SiteUserOptionsPresenter(final Session session, final StateManager stateManager, - final Provider<FileDownloadUtils> downloadProvider, final I18nTranslationService i18n, - final IconResources img, final SitebarActionsPresenter siteOptions, final GotoGroupAction gotoGroupAction) { - super(); - this.session = session; - this.stateManager = stateManager; - this.downloadProvider = downloadProvider; - this.i18n = i18n; - this.img = img; - this.siteOptions = siteOptions; - this.gotoGroupAction = gotoGroupAction; - createActions(); + @Inject + public SiteUserOptionsPresenter(final Session session, final StateManager stateManager, + final Provider<FileDownloadUtils> downloadProvider, final I18nTranslationService i18n, + final CoreResources img, final SitebarActionsPresenter siteOptions, + final GotoGroupAction gotoGroupAction) { + super(); + this.session = session; + this.stateManager = stateManager; + this.downloadProvider = downloadProvider; + this.i18n = i18n; + this.res = img; + this.siteOptions = siteOptions; + this.gotoGroupAction = gotoGroupAction; + createActions(); + separator.setVisible(false); + session.onUserSignIn(true, new UserSignInHandler() { + @Override + public void onUserSignIn(final UserSignInEvent event) { + SiteUserOptionsPresenter.this.onUserSignIn(event.getUserInfo()); + separator.setVisible(true); + } + }); + session.onUserSignOut(true, new UserSignOutHandler() { + @Override + public void onUserSignOut(final UserSignOutEvent event) { + LOGGED_USER_MENU.setVisible(false); separator.setVisible(false); - session.onUserSignIn(true, new UserSignInHandler() { - @Override - public void onUserSignIn(final UserSignInEvent event) { - SiteUserOptionsPresenter.this.onUserSignIn(event.getUserInfo()); - separator.setVisible(true); - } - }); - session.onUserSignOut(true, new UserSignOutHandler() { - @Override - public void onUserSignOut(final UserSignOutEvent event) { - LOGGED_USER_MENU.setVisible(false); - separator.setVisible(false); - SiteUserOptionsPresenter.this.setLoggedUserName(""); - } - }); - } + SiteUserOptionsPresenter.this.setLoggedUserName(""); + } + }); + } - @Override - public void addAction(final GuiActionDescrip descriptor) { - addActionImpl(descriptor); - } + @Override + public void addAction(final GuiActionDescrip descriptor) { + addActionImpl(descriptor); + } - private void addActionImpl(final GuiActionDescrip descriptor) { - descriptor.setParent(LOGGED_USER_MENU); - siteOptions.getRightToolbar().add(descriptor); - } + private void addActionImpl(final GuiActionDescrip descriptor) { + descriptor.setParent(LOGGED_USER_MENU); + siteOptions.getRightToolbar().add(descriptor); + } - private void addPartipation(final GroupDTO group) { - final String logoImageUrl = group.hasLogo() ? downloadProvider.get().getLogoImageUrl(group.getStateToken()) - : "images/group-def-icon.gif"; - final MenuItemDescriptor participant = new MenuItemDescriptor(gotoGroupAction); - participant.setTarget(group); - participant.putValue(Action.NAME, group.getLongName()); - participant.putValue(Action.SMALL_ICON, logoImageUrl); - participant.setParent(partiMenu); - siteOptions.getRightToolbar().add(participant); - } + private void addPartipation(final GroupDTO group) { + final String logoImageUrl = group.hasLogo() ? downloadProvider.get().getLogoImageUrl( + group.getStateToken()) : "images/group-def-icon.gif"; + final MenuItemDescriptor participant = new MenuItemDescriptor(gotoGroupAction); + participant.setTarget(group); + participant.putValue(Action.NAME, group.getLongName()); + participant.putValue(Action.SMALL_ICON, logoImageUrl); + participant.setParent(partiMenu); + siteOptions.getRightToolbar().add(participant); + } - private void createActions() { - LOGGED_USER_MENU.setId(LOGGED_USER_MENU_ID); - LOGGED_USER_MENU.setParent(SitebarActionsPresenter.RIGHT_TOOLBAR); - LOGGED_USER_MENU.setStyles("k-no-backimage, k-btn-sitebar, k-fl"); - siteOptions.getRightToolbar().add(LOGGED_USER_MENU); - separator = new ToolbarSeparatorDescriptor(Type.separator, SitebarActionsPresenter.RIGHT_TOOLBAR); - siteOptions.getRightToolbar().add(separator); - partiMenu = new SubMenuDescriptor(i18n.t("Your groups")); - addActionImpl(partiMenu); + private void createActions() { + LOGGED_USER_MENU.setId(LOGGED_USER_MENU_ID); + LOGGED_USER_MENU.setParent(SitebarActionsPresenter.RIGHT_TOOLBAR); + LOGGED_USER_MENU.setStyles("k-no-backimage, k-btn-sitebar, k-fl"); + LOGGED_USER_MENU.setRightIcon(res.arrowdownsitebar()); + siteOptions.getRightToolbar().add(LOGGED_USER_MENU); + separator = new ToolbarSeparatorDescriptor(Type.separator, SitebarActionsPresenter.RIGHT_TOOLBAR); + siteOptions.getRightToolbar().add(separator); + partiMenu = new SubMenuDescriptor(i18n.t("Your groups")); + addActionImpl(partiMenu); - final AbstractExtendedAction userHomeAction = new AbstractExtendedAction() { - @Override - public void actionPerformed(final ActionEvent event) { - goUserHome(); - } - }; - userHomeAction.putValue(Action.NAME, i18n.t(CoreMessages.YOUR_HOMEPAGE)); - userHomeAction.putValue(Action.SMALL_ICON, img.groupHome()); - final MenuItemDescriptor item = new MenuItemDescriptor(userHomeAction); - item.setPosition(0); - addActionImpl(item); - } + final AbstractExtendedAction userHomeAction = new AbstractExtendedAction() { + @Override + public void actionPerformed(final ActionEvent event) { + goUserHome(); + } + }; + userHomeAction.putValue(Action.NAME, i18n.t(CoreMessages.YOUR_HOMEPAGE)); + userHomeAction.putValue(Action.SMALL_ICON, res.groupHome()); + final MenuItemDescriptor item = new MenuItemDescriptor(userHomeAction); + item.setPosition(0); + addActionImpl(item); + } - private void goUserHome() { - stateManager.gotoHistoryToken(session.getCurrentUserInfo().getShortName()); - } + private void goUserHome() { + stateManager.gotoHistoryToken(session.getCurrentUserInfo().getShortName()); + } - private void onUserSignIn(final UserInfoDTO userInfoDTO) { - LOGGED_USER_MENU.setVisible(true); - LOGGED_USER_MENU.setEnabled(true); - setLoggedUserName(userInfoDTO.getShortName()); - partiMenu.clear(); - final List<GroupDTO> groupsIsAdmin = userInfoDTO.getGroupsIsAdmin(); - final List<GroupDTO> groupsIsCollab = userInfoDTO.getGroupsIsCollab(); - for (final GroupDTO group : groupsIsAdmin) { - addPartipation(group); - } - for (final GroupDTO group : groupsIsCollab) { - addPartipation(group); - } - partiMenu.setEnabled((groupsIsAdmin.size() + groupsIsCollab.size()) > 0); + private void onUserSignIn(final UserInfoDTO userInfoDTO) { + LOGGED_USER_MENU.setVisible(true); + LOGGED_USER_MENU.setEnabled(true); + setLoggedUserName(userInfoDTO.getShortName()); + partiMenu.clear(); + final List<GroupDTO> groupsIsAdmin = userInfoDTO.getGroupsIsAdmin(); + final List<GroupDTO> groupsIsCollab = userInfoDTO.getGroupsIsCollab(); + for (final GroupDTO group : groupsIsAdmin) { + addPartipation(group); } - - private void setLoggedUserName(final String shortName) { - LOGGED_USER_MENU.putValue(Action.NAME, shortName); + for (final GroupDTO group : groupsIsCollab) { + addPartipation(group); } + partiMenu.setEnabled((groupsIsAdmin.size() + groupsIsCollab.size()) > 0); + } + private void setLoggedUserName(final String shortName) { + LOGGED_USER_MENU.putValue(Action.NAME, shortName); + } + } Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -34,7 +34,6 @@ import cc.kune.common.client.ui.KuneWindowUtils; import cc.kune.core.client.init.AppStartEvent; import cc.kune.core.client.resources.CoreResources; -import cc.kune.core.client.resources.icons.IconResources; import cc.kune.core.shared.i18n.I18nTranslationService; import com.google.gwt.event.shared.EventBus; @@ -48,149 +47,152 @@ import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent; public class SitebarActionsPresenter extends - Presenter<SitebarActionsPresenter.SitebarActionsView, SitebarActionsPresenter.SitebarActionsProxy> implements - SitebarActions { + Presenter<SitebarActionsPresenter.SitebarActionsView, SitebarActionsPresenter.SitebarActionsProxy> + implements SitebarActions { - @ProxyCodeSplit - public interface SitebarActionsProxy extends Proxy<SitebarActionsPresenter> { - } + @ProxyCodeSplit + public interface SitebarActionsProxy extends Proxy<SitebarActionsPresenter> { + } - public interface SitebarActionsView extends View { + public interface SitebarActionsView extends View { - IsActionExtensible getLeftBar(); + IsActionExtensible getLeftBar(); - IsActionExtensible getRightBar(); + IsActionExtensible getRightBar(); - void showAboutDialog(); + void showAboutDialog(); - void showErrorDialog(); - } - public static final ToolbarDescriptor LEFT_TOOLBAR = new ToolbarDescriptor(); + void showErrorDialog(); + } + public static final ToolbarDescriptor LEFT_TOOLBAR = new ToolbarDescriptor(); - public static final MenuDescriptor OPTIONS_MENU = new MenuDescriptor(); - public static final ToolbarDescriptor RIGHT_TOOLBAR = new ToolbarDescriptor(); - public static final String SITE_OPTIONS_MENU = "kune-sop-om"; + public static final MenuDescriptor OPTIONS_MENU = new MenuDescriptor(); + public static final ToolbarDescriptor RIGHT_TOOLBAR = new ToolbarDescriptor(); + public static final String SITE_OPTIONS_MENU = "kune-sop-om"; - private final I18nTranslationService i18n; - private final IconResources icons; - private final Provider<SitebarNewGroupLink> newGroupLink; + private final I18nTranslationService i18n; + private final CoreResources icons; + private final Provider<SitebarNewGroupLink> newGroupLink; - private final CoreResources res; - private final Provider<SitebarSignInLink> signInLink; - private final Provider<SitebarSignOutLink> signOutLink; + private final CoreResources res; + private final Provider<SitebarSignInLink> signInLink; + private final Provider<SitebarSignOutLink> signOutLink; - @Inject - public SitebarActionsPresenter(final EventBus eventBus, final SitebarActionsView view, - final SitebarActionsProxy proxy, final I18nTranslationService i18n, - final Provider<SitebarNewGroupLink> newGroupLink, final Provider<SitebarSignOutLink> signOutLink, - final Provider<SitebarSignInLink> signInLink, final CoreResources res, final IconResources icons) { - super(eventBus, view, proxy); - this.i18n = i18n; - this.newGroupLink = newGroupLink; - this.signOutLink = signOutLink; - this.signInLink = signInLink; - this.res = res; - this.icons = icons; - init(); - } + @Inject + public SitebarActionsPresenter(final EventBus eventBus, final SitebarActionsView view, + final SitebarActionsProxy proxy, final I18nTranslationService i18n, + final Provider<SitebarNewGroupLink> newGroupLink, final Provider<SitebarSignOutLink> signOutLink, + final Provider<SitebarSignInLink> signInLink, final CoreResources res, final CoreResources icons) { + super(eventBus, view, proxy); + this.i18n = i18n; + this.newGroupLink = newGroupLink; + this.signOutLink = signOutLink; + this.signInLink = signInLink; + this.res = res; + this.icons = icons; + init(); + } - @Override - public IsActionExtensible getLeftToolbar() { - return getView().getLeftBar(); - } + @Override + public IsActionExtensible getLeftToolbar() { + return getView().getLeftBar(); + } - public MenuDescriptor getOptionsMenu() { - return OPTIONS_MENU; - } + public MenuDescriptor getOptionsMenu() { + return OPTIONS_MENU; + } - @Override - public IsActionExtensible getRightToolbar() { - return getView().getRightBar(); - } + @Override + public IsActionExtensible getRightToolbar() { + return getView().getRightBar(); + } - private void init() { - OPTIONS_MENU.withId(SITE_OPTIONS_MENU); - getView().getLeftBar().add(LEFT_TOOLBAR); - getView().getRightBar().add(RIGHT_TOOLBAR); - } + private void init() { + OPTIONS_MENU.withId(SITE_OPTIONS_MENU); + getView().getLeftBar().add(LEFT_TOOLBAR); + getView().getRightBar().add(RIGHT_TOOLBAR); + } - @ProxyEvent - public void onAppStart(final AppStartEvent event) { - final IsActionExtensible right = getView().getRightBar(); - OPTIONS_MENU.putValue(Action.NAME, i18n.t("Options")); - OPTIONS_MENU.putValue(Action.SMALL_ICON, res.arrowdownsitebar()); - OPTIONS_MENU.setParent(RIGHT_TOOLBAR); - OPTIONS_MENU.setStyles("k-no-backimage, k-btn-sitebar, k-fl"); - OPTIONS_MENU.putValue(AbstractGxtMenuGui.MENU_POSITION, AbstractGxtMenuGui.MenuPosition.bl); - final ToolbarSeparatorDescriptor separator = new ToolbarSeparatorDescriptor(Type.separator, RIGHT_TOOLBAR); - final ToolbarSeparatorDescriptor separator2 = new ToolbarSeparatorDescriptor(Type.separator, RIGHT_TOOLBAR); + @ProxyEvent + public void onAppStart(final AppStartEvent event) { + final IsActionExtensible right = getView().getRightBar(); + OPTIONS_MENU.putValue(Action.NAME, i18n.t("Options")); + OPTIONS_MENU.putValue(Action.SMALL_ICON, res.arrowdownsitebar()); + OPTIONS_MENU.setParent(RIGHT_TOOLBAR); + OPTIONS_MENU.setStyles("k-no-backimage, k-btn-sitebar, k-fl"); + OPTIONS_MENU.putValue(AbstractGxtMenuGui.MENU_POSITION, AbstractGxtMenuGui.MenuPosition.bl); + final ToolbarSeparatorDescriptor separator = new ToolbarSeparatorDescriptor(Type.separator, + RIGHT_TOOLBAR); + final ToolbarSeparatorDescriptor separator2 = new ToolbarSeparatorDescriptor(Type.separator, + RIGHT_TOOLBAR); - final MenuSeparatorDescriptor menuSeparator = new MenuSeparatorDescriptor(OPTIONS_MENU); - final AbstractExtendedAction bugsAction = new AbstractExtendedAction() { - @Override - public void actionPerformed(final ActionEvent event) { - KuneWindowUtils.open("http://kune.ourproject.org/issues/"); - } - }; - bugsAction.putValue(Action.NAME, i18n.t("Report Kune issues/problems")); - bugsAction.putValue(Action.SMALL_ICON, icons.bug()); - final MenuItemDescriptor reportBugs = new MenuItemDescriptor(OPTIONS_MENU, bugsAction); + final MenuSeparatorDescriptor menuSeparator = new MenuSeparatorDescriptor(OPTIONS_MENU); + final AbstractExtendedAction bugsAction = new AbstractExtendedAction() { + @Override + public void actionPerformed(final ActionEvent event) { + KuneWindowUtils.open("http://kune.ourproject.org/issues/"); + } + }; + bugsAction.putValue(Action.NAME, i18n.t("Report Kune issues/problems")); + bugsAction.putValue(Action.SMALL_ICON, icons.bug()); + final MenuItemDescriptor reportBugs = new MenuItemDescriptor(OPTIONS_MENU, bugsAction); - final AbstractExtendedAction errorAction = new AbstractExtendedAction() { - @Override - public void actionPerformed(final ActionEvent event) { - getView().showErrorDialog(); - } - }; + final AbstractExtendedAction errorAction = new AbstractExtendedAction() { + @Override + public void actionPerformed(final ActionEvent event) { + getView().showErrorDialog(); + } + }; - final AbstractExtendedAction aboutAction = new AbstractExtendedAction() { - @Override - public void actionPerformed(final ActionEvent event) { - getView().showAboutDialog(); - } - }; + final AbstractExtendedAction aboutAction = new AbstractExtendedAction() { + @Override + public void actionPerformed(final ActionEvent event) { + getView().showAboutDialog(); + } + }; - final AbstractExtendedAction wavePowered = new AbstractExtendedAction() { - @Override - public void actionPerformed(final ActionEvent event) { - KuneWindowUtils.open("http://incubator.apache.org/wave/"); - } - }; - final MenuItemDescriptor gotoKuneDevSite = new MenuItemDescriptor(OPTIONS_MENU, new AbstractAction() { - @Override - public void actionPerformed(final ActionEvent event) { - KuneWindowUtils.open("http://kune.ourproject.org/"); - } + final AbstractExtendedAction wavePowered = new AbstractExtendedAction() { + @Override + public void actionPerformed(final ActionEvent event) { + KuneWindowUtils.open("http://incubator.apache.org/wave/"); + } + }; + final MenuItemDescriptor gotoKuneDevSite = new MenuItemDescriptor(OPTIONS_MENU, + new AbstractAction() { + @Override + public void actionPerformed(final ActionEvent event) { + KuneWindowUtils.open("http://kune.ourproject.org/"); + } }); - gotoKuneDevSite.putValue(Action.NAME, i18n.t("kune development site")); - gotoKuneDevSite.putValue(Action.SMALL_ICON, icons.kuneIcon16()); + gotoKuneDevSite.putValue(Action.NAME, i18n.t("kune development site")); + gotoKuneDevSite.putValue(Action.SMALL_ICON, icons.kuneIcon16()); - wavePowered.putValue(Action.NAME, i18n.t("Apache Wave powered")); - wavePowered.putValue(Action.SMALL_ICON, res.waveIcon()); - aboutAction.putValue(Action.NAME, i18n.t("About kune")); - aboutAction.putValue(Action.SMALL_ICON, res.info()); - errorAction.putValue(Action.NAME, i18n.t("Errors info")); - errorAction.putValue(Action.SMALL_ICON, res.important()); - // aboutAction.setShortcut(shortcut); - // shortcutReg.put(shortcut, aboutAction); + wavePowered.putValue(Action.NAME, i18n.t("Apache Wave powered")); + wavePowered.putValue(Action.SMALL_ICON, res.waveIcon()); + aboutAction.putValue(Action.NAME, i18n.t("About kune")); + aboutAction.putValue(Action.SMALL_ICON, res.info()); + errorAction.putValue(Action.NAME, i18n.t("Errors info")); + errorAction.putValue(Action.SMALL_ICON, res.important()); + // aboutAction.setShortcut(shortcut); + // shortcutReg.put(shortcut, aboutAction); - right.add(signInLink.get()); - right.add(signOutLink.get()); - right.add(separator2); - right.add(newGroupLink.get()); - right.add(separator); - right.add(OPTIONS_MENU); - right.add(gotoKuneDevSite); - right.add(reportBugs); - right.add(new MenuItemDescriptor(OPTIONS_MENU, errorAction)); - right.add(new MenuItemDescriptor(OPTIONS_MENU, aboutAction)); - right.add(menuSeparator); - right.add(new MenuItemDescriptor(OPTIONS_MENU, wavePowered)); - } + right.add(signInLink.get()); + right.add(signOutLink.get()); + right.add(separator2); + right.add(newGroupLink.get()); + right.add(separator); + right.add(OPTIONS_MENU); + right.add(gotoKuneDevSite); + right.add(reportBugs); + right.add(new MenuItemDescriptor(OPTIONS_MENU, errorAction)); + right.add(new MenuItemDescriptor(OPTIONS_MENU, aboutAction)); + right.add(menuSeparator); + right.add(new MenuItemDescriptor(OPTIONS_MENU, wavePowered)); + } - @Override - protected void revealInParent() { - RevealRootContentEvent.fire(this, this); - } + @Override + protected void revealInParent() { + RevealRootContentEvent.fire(this, this); + } } Added: trunk/src/main/java/cc/kune/core/client/sitebar/search/FormFeedback.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/search/FormFeedback.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/sitebar/search/FormFeedback.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -0,0 +1,126 @@ +/******************************************************************************* + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ +package cc.kune.core.client.sitebar.search; + +import com.google.gwt.user.client.ui.Label; + +/** + * This widget shows an icon to give feedback on form fields + */ +public class FormFeedback extends Label { + /** + * Feedback status error + */ + public static final int ERROR = 2; + + private static final String ERROR_STYLE = "error"; + + /** + * Feedback status loading + */ + public static final int LOADING = 4; + + private static final String LOADING_STYLE = "loading"; + + /** + * Feedback status none + */ + public static final int NONE = 5; + + /** + * Feedback status valid + */ + public static final int VALID = 3; + private static final String VALID_STYLE = "valid"; + /** + * Feedback status warning + */ + public static final int WARNING = 1; + private static final String WARNING_STYLE = "warning"; + + private int mstatus = NONE; + + /** + * Creates a new FormFeedback widget + */ + public FormFeedback() { + this(true); + } + + /** + * Creates a new FormFeedback widget + * + * @param inform + * true if this feedback widget needs our standard for styles and + * false otherwise + */ + public FormFeedback(final boolean inform) { + getElement().addClassName("rpt-formfeedback"); + if (inform) { + getElement().addClassName("rpt-formfeedback-inform"); + } + } + + /** + * Gets the status of this FormFeedback + * + * @return the form feedback + */ + public int getStatus() { + return mstatus; + } + + private void removeStyles() { + getElement().removeClassName(WARNING_STYLE); + getElement().removeClassName(ERROR_STYLE); + getElement().removeClassName(LOADING_STYLE); + getElement().removeClassName(VALID_STYLE); + } + + /** + * Sets the status for this FormFeedback + * + * @param status + * the status + */ + public void setStatus(final int status) { + mstatus = status; + removeStyles(); + + switch (status) { + case WARNING: + getElement().addClassName(WARNING_STYLE); + setTitle("Warning"); + return; + case ERROR: + getElement().addClassName(ERROR_STYLE); + setTitle("Error"); + return; + case LOADING: + getElement().addClassName(LOADING_STYLE); + setTitle("Loading"); + return; + case VALID: + getElement().addClassName(VALID_STYLE); + setTitle("Valid"); + return; + default: + setTitle(""); + removeStyles(); + return; + } + } +} \ No newline at end of file Property changes on: trunk/src/main/java/cc/kune/core/client/sitebar/search/FormFeedback.java ___________________________________________________________________ Name: svn:mime-type + text/plain Added: trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -0,0 +1,906 @@ +/******************************************************************************* + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Source: http://www.zackgrossbart.com/hackito/gwt-rest-auto/ + * + ******************************************************************************/ +package cc.kune.core.client.sitebar.search; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import cc.kune.common.client.log.Log; +import cc.kune.core.shared.SearcherConstants; + +import com.google.gwt.event.dom.client.KeyUpEvent; +import com.google.gwt.event.dom.client.KeyUpHandler; +import com.google.gwt.event.logical.shared.SelectionEvent; +import com.google.gwt.event.logical.shared.SelectionHandler; +import com.google.gwt.http.client.RequestBuilder; +import com.google.gwt.http.client.RequestCallback; +import com.google.gwt.http.client.RequestException; +import com.google.gwt.http.client.Response; +import com.google.gwt.http.client.URL; +import com.google.gwt.json.client.JSONArray; +import com.google.gwt.json.client.JSONObject; +import com.google.gwt.json.client.JSONParser; +import com.google.gwt.json.client.JSONValue; +import com.google.gwt.user.client.Timer; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.Focusable; +import com.google.gwt.user.client.ui.SuggestBox; +import com.google.gwt.user.client.ui.SuggestOracle; +import com.google.gwt.user.client.ui.SuggestOracle.Callback; +import com.google.gwt.user.client.ui.SuggestOracle.Request; +import com.google.gwt.user.client.ui.SuggestOracle.Suggestion; +import com.google.gwt.user.client.ui.TextArea; +import com.google.gwt.user.client.ui.TextBox; +import com.google.gwt.user.client.ui.TextBoxBase; + +/** + * A SuggestBox that uses REST and allows for multiple values, autocomplete and + * browsing + * + * @author Bess Siegal <[email protected]> + */ +public class MultivalueSuggestBox extends Composite implements SelectionHandler<Suggestion>, Focusable, + KeyUpHandler { + /** + * Bean for name-value pairs + */ + private class Option { + + private String mname; + private String mvalue; + + /** + * No argument constructor + */ + public Option() { + } + + /** + * @return Returns the name. + */ + public String getName() { + return mname; + } + + /** + * @return Returns the value. + */ + public String getValue() { + return mvalue; + } + + /** + * @param name + * The name to set. + */ + public void setName(final String name) { + mname = name; + } + + /** + * @param value + * The value to set. + */ + public void setValue(final String value) { + mvalue = value; + } + + } + /** + * An abstract class that handles success and error conditions from the REST + * call + */ + private abstract class OptionQueryCallback { + abstract void error(Throwable exception); + + abstract void success(OptionResultSet optResults); + } + /** + * Bean for total size and options + */ + protected class OptionResultSet { + /** JSON key for DisplayName */ + public static final String DISPLAY_NAME = "longName"; + /** JSON key for Options */ + public static final String OPTIONS = "list"; + /** JSON key for the size of the Results */ + public static final String TOTAL_SIZE = "size"; + + /** JSON key for Value */ + public static final String VALUE = "shortName"; + + private final List<Option> m_options = new ArrayList<Option>(); + private int mtotalSize; + + /** + * Constructor. Must pass in the total size. + * + * @param totalSize + * the total size of the template + */ + public OptionResultSet(final int totalSize) { + setTotalSize(totalSize); // NOPMD by vjrj on 4/05/11 19:45 + } + + /** + * Add an option + * + * @param option + * - the Option to add + */ + public void addOption(final Option option) { + m_options.add(option); + } + + /** + * @return an array of Options + */ + public Option[] getOptions() { + return m_options.toArray(new Option[m_options.size()]); + } + + /** + * @return Returns the totalSize. + */ + public int getTotalSize() { + return mtotalSize; + } + + /** + * @param totalSize + * The totalSize to set. + */ + public void setTotalSize(final int totalSize) { + mtotalSize = totalSize; + } + } + /** + * A bean to serve as a custom suggestion so that the value is available and + * the replace will look like it is supporting multivalues + */ + class OptionSuggestion implements SuggestOracle.Suggestion { + static final String NEXT_VALUE = "NEXT"; + static final String PREVIOUS_VALUE = "PREVIOUS"; + private String mdisplay; + private String mname; + private final String mreplace; + private final String mvalue; + + /** + * Constructor for navigation options + * + * @param nav + * - next or previous value + * @param currentTextValue + * - the current contents of the text box + */ + OptionSuggestion(final String nav, final String currentTextValue) { + if (NEXT_VALUE.equals(nav)) { + mdisplay = "<div class=\"autocompleterNext\" title=\"Next\"></div>"; + } else { + mdisplay = "<div class=\"autocompleterPrev\" title=\"Previous\"></div>"; + } + mreplace = currentTextValue; + mvalue = nav; + } + + /** + * Constructor for regular options + * + * @param displ + * - the name of the option + * @param val + * - the value of the option + * @param replacePre + * - the current contents of the text box + * @param query + * - the query + */ + OptionSuggestion(final String displ, final String val, final String replacePre, final String query) { + mname = displ; + final int begin = displ.toLowerCase().indexOf(query.toLowerCase()); + if (begin >= 0) { + final int end = begin + query.length(); + final String match = displ.substring(begin, end); + mdisplay = displ.replaceFirst(match, "<b>" + match + "</b>"); + } else { + // may not necessarily be a part of the query, for example if "*" was + // typed. + mdisplay = displ; + } + mreplace = getFullReplaceText(displ, replacePre); + mvalue = val; + } + + @Override + public String getDisplayString() { + return mdisplay; + } + + /** + * Get the name of the option. (when not multivalued, this will be the same + * as getReplacementString) + * + * @return name + */ + public String getName() { + return mname; + } + + @Override + public String getReplacementString() { + return mreplace; + } + + /** + * Get the value of the option + * + * @return value + */ + public String getValue() { + return mvalue; + } + } + /** + * A custom callback that has the original SuggestOracle.Request and + * SuggestOracle.Callback + */ + private class RestSuggestCallback extends OptionQueryCallback { + private final SuggestOracle.Callback m_callback; + private final String m_query; // this may be different from + // m_request.getQuery when multivalued it's + // only the substring after the last delimiter + private final SuggestOracle.Request m_request; + + RestSuggestCallback(final Request request, final Callback callback, final String query) { + m_request = request; + m_callback = callback; + m_query = query; + } + + @Override + public void error(final Throwable exception) { + updateFormFeedback(FormFeedback.ERROR, "Invalid: " + m_query); + } + + @Override + public void success(final OptionResultSet optResults) { + final SuggestOracle.Response resp = new SuggestOracle.Response(); + final List<OptionSuggestion> suggs = new ArrayList<OptionSuggestion>(); + final int totSize = optResults.getTotalSize(); + + if (totSize < 1) { + // if there were no suggestions, then it's an invalid value + updateFormFeedback(FormFeedback.ERROR, "Invalid: " + m_query); + + } else if (totSize == 1) { + // it's an exact match, so do not bother with showing suggestions, + final Option o = optResults.getOptions()[0]; + final String displ = o.getName(); + + // remove the last bit up to separator + // mfield.setText(getFullReplaceText(displ, m_request.getQuery())); + + Log.info("RestSuggestCallback.success! exact match found for displ = " + displ); + + // it's valid! + updateFormFeedback(FormFeedback.VALID, null); + + // set the value into the valueMap + putValue(displ, o.getValue()); + + } else { + // more than 1 so show the suggestions + + // if not at the first page, show PREVIOUS + if (mindexFrom > 0) { + final OptionSuggestion prev = new OptionSuggestion(OptionSuggestion.PREVIOUS_VALUE, + m_request.getQuery()); + suggs.add(prev); + } + + // show the suggestions + for (final Option o : optResults.getOptions()) { + final OptionSuggestion sugg = new OptionSuggestion(o.getName(), o.getValue(), + m_request.getQuery(), m_query); + suggs.add(sugg); + } + + // if there are more pages, show NEXT + if (mindexTo < totSize) { + final OptionSuggestion next = new OptionSuggestion(OptionSuggestion.NEXT_VALUE, + m_request.getQuery()); + suggs.add(next); + } + + // nothing has been picked yet, so let the feedback show an error + // (unsaveable) + updateFormFeedback(FormFeedback.ERROR, "Invalid: " + m_query); + } + + // it's ok (and good) to pass an empty suggestion list back to the suggest + // box's callback method + // the list is not shown at all if the list is empty. + resp.setSuggestions(suggs); + m_callback.onSuggestionsReady(m_request, resp); + } + + } + /* + * Some custom inner classes for our SuggestOracle + */ + /** + * A custom Suggest Oracle + */ + private class RestSuggestOracle extends SuggestOracle { + private SuggestOracle.Callback mcallback; + private SuggestOracle.Request mrequest; + private final Timer mtimer; + + RestSuggestOracle() { + mtimer = new Timer() { + + @Override + public void run() { + /* + * The reason we check for empty string is found at + * http://development.lombardi.com/?p=39 -- paraphrased, if you + * backspace quickly the contents of the field are emptied but a query + * for a single character is still executed. Workaround for this is to + * check for an empty string field here. + */ + + if (!mfield.getText().trim().isEmpty()) { + if (misMultivalued) { + // calling this here in case a user is trying to correct the "kev" + // value of Allison Andrews, Kev, Josh Nolan or pasted in multiple + // values + findExactMatches(); + } + getSuggestions(); + } + } + }; + } + + private void getSuggestions() { + String query = mrequest.getQuery(); + + // find the last thing entered up to the last separator + // and use that as the query + if (misMultivalued) { + final int sep = query.lastIndexOf(DISPLAY_SEPARATOR); + if (sep > 0) { + query = query.substring(sep + DISPLAY_SEPARATOR.length()); + } + } + query = query.trim(); + + // do not query if it's just an empty String + // also do not get suggestions you've already got an exact match for this + // string in the m_valueMap + if (query.length() > 0 && mvalueMap.get(query) == null) { + // JSUtil.println("getting Suggestions for: " + query); + updateFormFeedback(FormFeedback.LOADING, null); + + queryOptions(query, mindexFrom, mindexTo, new RestSuggestCallback(mrequest, mcallback, query)); + } + } + + @Override + public boolean isDisplayStringHTML() { + return true; + } + + @Override + public void requestSuggestions(final SuggestOracle.Request request, + final SuggestOracle.Callback callback) { + // This is the method that gets called by the SuggestBox whenever some + // types into the text field + mrequest = request; + mcallback = callback; + + // reset the indexes (b/c NEXT and PREV call getSuggestions directly) + resetPageIndices(); + + // If the user keeps triggering this event (e.g., keeps typing), cancel + // and restart the timer + mtimer.cancel(); + mtimer.schedule(DELAY); + } + } + private static final int DELAY = 1000; + + private static final String DISPLAY_SEPARATOR = ", "; + private static final int FIND_EXACT_MATCH_QUERY_LIMIT = 20; + private static final int PAGE_SIZE = 15; + private static final String VALUE_DELIM = ";"; + + /** + * Returns a String without the last delimiter + * + * @param str + * - String to trim + * @param delim + * - the delimiter + * @return the String without the last delimter + */ + private static String trimLastDelimiter(String str, final String delim) { // NOPMD + // by + // vjrj + // on + // 4/05/11 + // 19:46 + if (str.length() > 0) { + str = str.substring(0, str.length() - delim.length()); + } + return str; + } + + private final FormFeedback mfeedback; + private final SuggestBox mfield; + private int mfindExactMatchesFound = 0; + + private final ArrayList<String> mfindExactMatchesNot = new ArrayList<String>(); + + private int mfindExactMatchesTotal = 0; + + private int mindexFrom = 0; + + private int mindexTo = 0; + + private boolean misMultivalued = false; + + private final String mrestEndpointUrl; + private final Map<String, String> mvalueMap; + + /** + * Constructor. + * + * @param the + * URL for the REST endpoint. This URL should accept the parameters q + * (for query), indexFrom and indexTo + * @param isMultivalued + * - true for allowing multiple values + */ + public MultivalueSuggestBox(final String restEndpointUrl, final boolean isMultivalued) { + mrestEndpointUrl = restEndpointUrl; + misMultivalued = isMultivalued; + + final FlowPanel panel = new FlowPanel(); + TextBoxBase textfield; + if (isMultivalued) { + panel.addStyleName("textarearow"); + textfield = new TextArea(); + } else { + panel.addStyleName("textfieldrow"); + textfield = new TextBox(); + } + + // Create our own SuggestOracle that queries REST endpoint + final SuggestOracle oracle = new RestSuggestOracle(); + // intialize the SuggestBox + mfield = new SuggestBox(oracle, textfield); + if (isMultivalued) { + // have to do this here b/c gwt suggest box wipes + // style name if added in previous if + textfield.addStyleName("multivalue"); + } + mfield.addStyleName("wideTextField"); + mfield.addSelectionHandler(this); + mfield.addKeyUpHandler(this); + + panel.add(mfield); + mfeedback = new FormFeedback(); + // panel.add(mfeedback); + + initWidget(panel); + + /* + * Create a Map that holds the values that should be stored. It will be + * keyed on "display value", so that any time a "display value" is added or + * removed the valueMap can be updated. + */ + mvalueMap = new HashMap<String, String>(); + + resetPageIndices(); + } + + private void findExactMatch(final String displayValue, final int position) { + updateFormFeedback(FormFeedback.LOADING, null); + + queryOptions(displayValue, 0, FIND_EXACT_MATCH_QUERY_LIMIT, // return a + // relatively + // small amount + // in case + // wanted "Red" + // and + // "Brick Red" + // is the first + // thing + // returned + new OptionQueryCallback() { + + @Override + public void error(final Throwable exception) { + // an exact match couldn't be found, just increment not found + mfindExactMatchesNot.add(displayValue); + finalizeFindExactMatches(); + } + + private void extactMatchFound(final int position, final Option option) { + putValue(option.getName(), option.getValue()); + Log.info("extactMatchFound ! exact match found for displ = " + displayValue); + + // and replace the text + final String text = mfield.getText(); + final String[] keys = text.split(DISPLAY_SEPARATOR.trim()); + keys[position] = option.getName(); + String join = ""; + for (final String n : keys) { + join += n.trim() + DISPLAY_SEPARATOR; + } + join = trimLastDelimiter(join, DISPLAY_SEPARATOR); + // Commented mfield.setText(join); + + mfindExactMatchesFound++; + } + + private void finalizeFindExactMatches() { + if (mfindExactMatchesFound + mfindExactMatchesNot.size() == mfindExactMatchesTotal) { + // when the found + not = total, we're done + if (mfindExactMatchesNot.size() > 0) { + String join = ""; + for (final String val : mfindExactMatchesNot) { + join += val.trim() + DISPLAY_SEPARATOR; + } + join = trimLastDelimiter(join, DISPLAY_SEPARATOR); + updateFormFeedback(FormFeedback.ERROR, "Invalid:" + join); + } else { + updateFormFeedback(FormFeedback.VALID, null); + } + } + } + + @Override + public void success(final OptionResultSet optResults) { + final int totSize = optResults.getTotalSize(); + if (totSize == 1) { + // an exact match was found, so place it in the value map + final Option option = optResults.getOptions()[0]; + extactMatchFound(position, option); + } else { + // try to find the exact matches within the results + boolean found = false; + for (final Option option : optResults.getOptions()) { + if (displayValue.equalsIgnoreCase(option.getName())) { + extactMatchFound(position, option); + found = true; + break; + } + } + if (!found) { + mfindExactMatchesNot.add(displayValue); + Log.info("RestExactMatchCallback -- exact match not found for displ = " + displayValue); + } + } + finalizeFindExactMatches(); + } + }); + } + + /** + * If there is more than one key in the text field, check that every key has a + * value in the map. For any that do not, try to find its exact match. + */ + private void findExactMatches() { + final String text = mfield.getText(); + final String[] keys = text.split(DISPLAY_SEPARATOR.trim()); + final int len = keys.length; + if (len < 2) { + // do not continue. if there's 1, it is the last one, and getSuggestions + // can handle it + return; + } + + mfindExactMatchesTotal = 0; + mfindExactMatchesFound = 0; + mfindExactMatchesNot.clear(); + for (int pos = 0; pos < len; pos++) { + final String key = keys[pos].trim(); + + if (!key.isEmpty()) { + final String v = mvalueMap.get(key); + if (null == v) { + mfindExactMatchesTotal++; + } + } + } + // then loop through again and try to find them + /* + * We may have invalid values due to a multi-value copy-n-paste, or going + * back and messing with a middle or first key; so for each invalid value, + * try to find an exact match. * + */ + for (int pos = 0; pos < len; pos++) { + final String key = keys[pos].trim(); + if (!key.isEmpty()) { + final String v = mvalueMap.get(key); + if (null == v) { + findExactMatch(key, pos); + } + } + } + } + + private String getFullReplaceText(final String displ, String replacePre) { // NOPMD + // by + // vjrj + // on + // 4/05/11 + // 19:45 + // replace the last bit after the last comma + if (replacePre.lastIndexOf(DISPLAY_SEPARATOR) > 0) { + replacePre = replacePre.substring(0, replacePre.lastIndexOf(DISPLAY_SEPARATOR)) + + DISPLAY_SEPARATOR; + } else { + replacePre = ""; + } + // then add a comma + if (misMultivalued) { + return replacePre + displ + DISPLAY_SEPARATOR; + } else { + return displ; + } + } + + public SuggestBox getSuggestBox() { + return mfield; + } + + @Override + public int getTabIndex() { + return mfield.getTabIndex(); + } + + /** + * Get the value(s) as a String. If allowing multivalues, separated by the + * VALUE_DELIM + * + * @return value(s) as a String + */ + public String getValue() { + // String together all the values in the valueMap + // based on the display values shown in the field + final String text = mfield.getText(); + + String values = ""; + String invalids = ""; + String newKeys = ""; + if (misMultivalued) { + final String[] keys = text.split(DISPLAY_SEPARATOR); + for (String key : keys) { + key = key.trim(); + if (!key.isEmpty()) { + final String v = mvalueMap.get(key); + Log.info("getValue for key = " + key + " is v = " + v); + if (null != v) { + values += v + VALUE_DELIM; + // rebuild newKeys removing invalids and dups + newKeys += key + DISPLAY_SEPARATOR; + } else { + invalids += key + DISPLAY_SEPARATOR; + } + } + } + values = trimLastDelimiter(values, VALUE_DELIM); + // set the new display values + mfield.setText(newKeys); + } else { + values = mvalueMap.get(text); + } + + // if there were any invalid show warning + if (!invalids.isEmpty()) { + // trim last separator + invalids = trimLastDelimiter(invalids, DISPLAY_SEPARATOR); + updateFormFeedback(FormFeedback.ERROR, "Invalids: " + invalids); + } + return values; + } + + /** + * Get the value map + * + * @return value map + */ + public Map<String, String> getValueMap() { + return mvalueMap; + } + + @Override + public void onKeyUp(final KeyUpEvent event) { + /* + * Because SuggestOracle.requestSuggestions does not get called when the + * text field is empty this key up handler is necessary for handling the + * case when there is an empty text field... Here, the FormFeedback is + * reset. + */ + updateFormFeedback(FormFeedback.NONE, null); + } + + @Override + public void onSelection(final SelectionEvent<Suggestion> event) { + final Suggestion suggestion = event.getSelectedItem(); + if (suggestion instanceof OptionSuggestion) { + final OptionSuggestion osugg = (OptionSuggestion) suggestion; + // if NEXT or PREVIOUS were selected, requery but bypass the timer + final String value = osugg.getValue(); + if (OptionSuggestion.NEXT_VALUE.equals(value)) { + mindexFrom += PAGE_SIZE; + mindexTo += PAGE_SIZE; + + final RestSuggestOracle oracle = (RestSuggestOracle) mfield.getSuggestOracle(); + oracle.getSuggestions(); + + } else if (OptionSuggestion.PREVIOUS_VALUE.equals(value)) { + mindexFrom -= PAGE_SIZE; + mindexTo -= PAGE_SIZE; + + final RestSuggestOracle oracle = (RestSuggestOracle) mfield.getSuggestOracle(); + oracle.getSuggestions(); + + } else { + // made a valid selection + updateFormFeedback(FormFeedback.VALID, null); + + // add the option's value to the value map + putValue(osugg.getName(), value); + + // put the focus back into the textfield so user + // can enter more + // Commented mfield.setFocus(true); + } + } + } + + private void putValue(final String key, final String value) { + Log.info("putting key = " + key + "; value = " + value); + mvalueMap.put(key, value); + } + + /** + * Retrieve Options (name-value pairs) that are suggested from the REST + * endpoint + * + * @param query + * - the String search term + * @param from + * - the 0-based begin index int + * @param to + * - the end index inclusive int + * @param callback + * - the OptionQueryCallback to handle the response + */ + private void queryOptions(final String query, final int from, final int to, + final OptionQueryCallback callback) { + final RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(mrestEndpointUrl + // Falta limit + + "?" + SearcherConstants.QUERY_PARAM + "=" + query + "&" + SearcherConstants.START_PARAM + "=" + + from + "&indexTo=" + to)); + + // Set our headers + builder.setHeader("Accept", "application/json"); + builder.setHeader("Accept-Charset", "UTF-8"); + + builder.setCallback(new RequestCallback() { + + @Override + public void onError(final com.google.gwt.http.client.Request request, final Throwable exception) { + callback.error(exception); + } + + @Override + public void onResponseReceived(final com.google.gwt.http.client.Request request, + final Response response) { + final JSONValue val = JSONParser.parse(response.getText()); + final JSONObject obj = val.isObject(); + final int totSize = (int) obj.get(OptionResultSet.TOTAL_SIZE).isNumber().doubleValue(); + final OptionResultSet options = new OptionResultSet(totSize); + final JSONArray optionsArray = obj.get(OptionResultSet.OPTIONS).isArray(); + + if (options.getTotalSize() > 0 && optionsArray != null) { + + for (int i = 0; i < optionsArray.size(); i++) { + if (optionsArray.get(i) == null) { + /* + * This happens when a JSON array has an invalid trailing comma + */ + continue; + } + + final JSONObject jsonOpt = optionsArray.get(i).isObject(); + final Option option = new Option(); + option.setName(jsonOpt.get(OptionResultSet.DISPLAY_NAME).isString().stringValue() + " (" + + jsonOpt.get(OptionResultSet.VALUE).isString().stringValue() + ")"); + option.setValue(jsonOpt.get(OptionResultSet.VALUE).isString().stringValue()); + options.addOption(option); + } + } + callback.success(options); + } + }); + + try { + builder.send(); + } catch (final RequestException e) { + updateFormFeedback(FormFeedback.ERROR, "Error: " + e.getMessage()); + } + } + + private void resetPageIndices() { + mindexFrom = 0; + mindexTo = mindexFrom + PAGE_SIZE - 1; + } + + @Override + public void setAccessKey(final char key) { + mfield.setAccessKey(key); + } + + @Override + public void setFocus(final boolean focused) { + mfield.setFocus(focused); + } + + @Override + public void setTabIndex(final int index) { + mfield.setTabIndex(index); + } + + /** + * Convenience method to set the status and tooltip of the FormFeedback + * + * @param status + * - a FormFeedback status + * @param tooltip + * - a String tooltip + */ + public void updateFormFeedback(final int status, final String tooltip) { + mfeedback.setStatus(status); + if (tooltip != null) { + mfeedback.setTitle(tooltip); + } + + final TextBoxBase textBox = mfield.getTextBox(); + if (FormFeedback.LOADING == status) { + // textBox.setEnabled(false); + } else { + // textBox.setEnabled(true); + textBox.setFocus(false); // Blur then focus b/c of a strange problem with + // the cursor or selection highlights no longer + // visible within the textfield (this is a + // workaround) + textBox.setFocus(true); + } + } + +} \ No newline at end of file Property changes on: trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java ___________________________________________________________________ Name: svn:mime-type + text/plain Deleted: trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearch.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearch.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearch.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -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 cc.kune.core.client.sitebar.search; - -public interface SiteSearch { - -} Deleted: trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPanel.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPanel.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPanel.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -1,125 +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 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); - } -} Deleted: trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPresenter.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPresenter.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPresenter.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -1,63 +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 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); - } -} Deleted: trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchView.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchView.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchView.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -1,33 +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 cc.kune.core.client.sitebar.search; - -public interface SiteSearchView { - - void clearSearchText(); - - void selectSearchText(); - - void setTextSearch(String text); - - void setTextSearchBig(); - - void setTextSearchSmall(); -} Copied: trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPanel.java (from rev 1339, trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPanel.java) =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPanel.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPanel.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -0,0 +1,135 @@ +/* + * + * 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.client.resources.CoreResources; +import cc.kune.core.client.sitebar.search.SitebarSearchPresenter.SitebarSearchView; +import cc.kune.core.client.state.StateManager; +import cc.kune.core.shared.SearcherConstants; +import cc.kune.gspace.client.GSpaceArmor; + +import com.google.gwt.event.dom.client.HasAllFocusHandlers; +import com.google.gwt.event.dom.client.HasClickHandlers; +import com.google.gwt.user.client.ui.HasText; +import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.PushButton; +import com.google.gwt.user.client.ui.SuggestBox; +import com.google.gwt.user.client.ui.SuggestOracle.Suggestion; +import com.google.gwt.user.client.ui.TextBoxBase; +import com.google.gwt.user.client.ui.Widget; +import com.google.inject.Inject; +import com.gwtplatform.mvp.client.ViewImpl; + +public class SitebarSearchPanel extends ViewImpl implements SitebarSearchView { + private static final int SEARCH_TEXT_HEIGHT = 13; + private static final int SEARCH_TEXT_WIDTH_BIG = 160; + 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 TextBoxBase searchTextBox; + private final SuggestBox suggestBox; + + @Inject + public SitebarSearchPanel(final GSpaceArmor gs, final CoreResources img, + final StateManager stateManager) { + searchButton = new PushButton(new Image(img.kuneSearchIco()), new Image(img.kuneSearchIcoPush())); + searchButton.ensureDebugId(SITE_SEARCH_BUTTON); + final MultivalueSuggestBox multivalueSBox = new MultivalueSuggestBox( + SearcherConstants.GROUP_DATA_PROXY_URL, false) { + @Override + public void onSelection( + final com.google.gwt.event.logical.shared.SelectionEvent<com.google.gwt.user.client.ui.SuggestOracle.Suggestion> event) { + super.onSelection(event); + final Suggestion suggestion = event.getSelectedItem(); + if (suggestion instanceof OptionSuggestion) { + final OptionSuggestion osugg = (OptionSuggestion) suggestion; + final String value = osugg.getValue(); + if (!OptionSuggestion.NEXT_VALUE.equals(value) + && !OptionSuggestion.PREVIOUS_VALUE.equals(value)) { + stateManager.gotoHistoryToken(value); + setTextSearch(""); + } + } + }; + }; + suggestBox = multivalueSBox.getSuggestBox(); + searchTextBox = suggestBox.getTextBox(); + searchTextBox.ensureDebugId(SITE_SEARCH_TEXTBOX); + searchTextBox.addStyleName("k-fr"); + searchTextBox.addStyleName("k-sitebarsearch"); + searchTextBox.addStyleName("k-fr"); + searchButton.addStyleName("k-sitebarsearch-img"); + searchButton.addStyleName("k-fr"); + gs.getSitebar().add(multivalueSBox); + gs.getSitebar().add(searchButton); + setTextSearchSmallImpl(); + } + + @Override + public Widget asWidget() { + return null; + } + + @Override + public void clearSearchText() { + searchTextBox.setValue(""); + } + + @Override + public HasClickHandlers getButton() { + return searchButton; + } + + @Override + public HasAllFocusHandlers getFocus() { + return searchTextBox; + } + + @Override + public HasText getTextBox() { + return searchTextBox; + } + + @Override + public void selectSearchText() { + searchTextBox.selectAll(); + } + + @Override + public void setTextSearch(final String text) { + suggestBox.setValue(text, false); + } + + @Override + public void setTextSearchBig() { + searchTextBox.setPixelSize(SEARCH_TEXT_WIDTH_BIG, SEARCH_TEXT_HEIGHT); + } + + @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/SitebarSearchPresenter.java (from rev 1339, trunk/src/main/java/cc/kune/core/client/sitebar/search/SiteSearchPresenter.java) =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPresenter.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPresenter.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -0,0 +1,145 @@ +/* + * + * 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.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.HasAllFocusHandlers; +import com.google.gwt.event.dom.client.HasClickHandlers; +import com.google.gwt.event.shared.EventBus; +import com.google.gwt.user.client.ui.HasText; +import com.google.inject.Inject; +import com.gwtplatform.mvp.client.Presenter; +import com.gwtplatform.mvp.client.View; +import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit; +import com.gwtplatform.mvp.client.proxy.Proxy; +import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent; + +public class SitebarSearchPresenter extends + Presenter<SitebarSearchPresenter.SitebarSearchView, SitebarSearchPresenter.SitebarSearchProxy> { + + @ProxyCodeSplit + public interface SitebarSearchProxy extends Proxy<SitebarSearchPresenter> { + } + + public interface SitebarSearchView extends View { + + void clearSearchText(); + + HasClickHandlers getButton(); + + HasAllFocusHandlers getFocus(); + + HasText getTextBox(); + + void selectSearchText(); + + void setTextSearch(String text); + + void setTextSearchBig(); + + void setTextSearchSmall(); + } + + private final String defaultSearchText; + + @Inject + public SitebarSearchPresenter(final EventBus eventBus, final SitebarSearchView view, + final SitebarSearchProxy proxy, final I18nTranslationService i18n) { + super(eventBus, view, proxy); + defaultSearchText = i18n.t("Search"); + setDefText(); + getView().setTextSearchSmall(); + } + + private void doSearch() { + doSearch(getView().getTextBox().getText()); + } + + public void doSearch(final String termToSearch) { + getView().setTextSearchSmall(); + } + + @Override + protected void onBind() { + super.onBind(); + getView().getFocus().addBlurHandler(new BlurHandler() { + @Override + public void onBlur(final BlurEvent event) { + onSearchLostFocus(getView().getTextBox().getText()); + } + }); + getView().getFocus().addFocusHandler(new FocusHandler() { + @Override + public void onFocus(final FocusEvent event) { + onSearchFocus(); + } + }); + getView().getButton().addClickHandler(new ClickHandler() { + @Override + public void onClick(final ClickEvent event) { + doSearch(); + } + + }); + // getView().getKeyUp().addKeyUpHandler(new KeyUpHandler() { + // @Override + // public void onKeyUp(final KeyUpEvent event) { + // if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + // if (getView().getTextBox().getText().length() > 0) { + // NotifyUser.showProgressProcessing(); + // doSearch(); + // } + // } + // } + // }); + } + + public void onSearchFocus() { + if (getView().getTextBox().getText().equals(defaultSearchText)) { + getView().setTextSearchBig(); + getView().selectSearchText(); + } + } + + public void onSearchLostFocus(final String search) { + if (search.length() == 0 || search.equals(defaultSearchText)) { + getView().setTextSearchSmall(); + } + if (search.length() == 0) { + setDefText(); + } + } + + @Override + protected void revealInParent() { + RevealRootContentEvent.fire(this, this); + } + + private void setDefText() { + getView().setTextSearch(defaultSearchText); + } +} Added: trunk/src/main/java/cc/kune/core/public/images/vborder.png =================================================================== (Binary files differ) Property changes on: trunk/src/main/java/cc/kune/core/public/images/vborder.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/main/java/cc/kune/core/public/images/vborder_ie6.png =================================================================== (Binary files differ) Property changes on: trunk/src/main/java/cc/kune/core/public/images/vborder_ie6.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/src/main/java/cc/kune/core/public/ws.css =================================================================== --- trunk/src/main/java/cc/kune/core/public/ws.css 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/core/public/ws.css 2011-05-04 20:29:42 UTC (rev 1340) @@ -1,4 +1,4 @@ -@CHARSET "UTF-8"; +CHARSET "UTF-8 "; body { background-color: white; @@ -305,19 +305,6 @@ cursor: move; } -.gwt-SuggestBoxPopup { - border: 2px solid #C3D9FF; -} - -.gwt-SuggestBoxPopup .item { - padding: 2px; -} - -.gwt-SuggestBoxPopup .item-selected { - background-color: #C3D9FF; - padding: 2px; -} - .gwt-DisclosurePanel { border: 2px solid #C3D9FF; } @@ -1148,3 +1135,57 @@ border: 5px solid #FFF; border-collapse: separate; } + +/* Suggest box */ +.gwt-SuggestBox { + padding: 2px; +} + +.gwt-SuggestBoxPopup { + background-color: #FFF; + border: 2px solid #552200; + padding: 3px; + color: white; + -webkit-border-bottom-right-radius: 5px; + -moz-border-radius-bottomright: 5px; + border-bottom-right-radius: 5px; + -webkit-border-bottom-left-radius: 5px; + -moz-border-radius-bottomleft: 5px; + border-bottom-left-radius: 5px; + kfilter: alpha(opacity = 90); + -moz-opacity: 0.90; + -khtml-opacity: 0.90; + opacity: 0.90; + margin-left: 3px; +} + +.gwt-SuggestBoxPopup .item { + padding: 2px 6px; + color: #424242; + cursor: default; +} + +.gwt-SuggestBoxPopup .item-selected { + background: #cdcdcd; +} + +.gwt-SuggestBoxPopup .suggestPopupContent { + background: white; +} + +.k-sitebarsearch { + border: 1px solid #E4A374; + margin: 1px 6px 0 3px; + padding-left: 1px; + color: #B3B3B3; + background: transparent; +} + +.k-sitebarsearch-img { + cursor: pointer; + background: none; + border: 0px; + padding: 2px 0 0 0 !important; +} + +/* end of suggestbox */ \ No newline at end of file Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -43,6 +43,7 @@ import cc.kune.core.server.properties.KuneProperties; import cc.kune.core.server.tool.ServerTool; import cc.kune.core.server.tool.ServerToolRegistry; +import cc.kune.core.shared.SearcherConstants; import cc.kune.core.shared.domain.AdmissionType; import cc.kune.core.shared.domain.GroupListMode; import cc.kune.core.shared.dto.GroupType; @@ -65,223 +66,229 @@ @Singleton public class GroupManagerDefault extends DefaultManager<Group, Long> implements GroupManager { - private final GroupFinder finder; - private final I18nTranslationService i18n; - private final KuneProperties kuneProperties; - private final LicenseFinder licenseFinder; - private final LicenseManager licenseManager; - private final DatabaseProperties properties; - private final ServerToolRegistry registry; - private final ServerToolRegistry serverToolRegistry; - private final UserFinder userFinder; + private final GroupFinder finder; + private final I18nTranslationService i18n; + private final KuneProperties kuneProperties; + private final LicenseFinder licenseFinder; + private final LicenseManager licenseManager; + private final DatabaseProperties properties; + private final ServerToolRegistry registry; + private final ServerToolRegistry serverToolRegistry; + private final UserFinder userFinder; - @Inject - public GroupManagerDefault(final Provider<EntityManager> provider, final GroupFinder finder, - final UserFinder userFinder, final KuneProperties kuneProperties, final DatabaseProperties properties, - final ServerToolRegistry registry, final LicenseManager licenseManager, final LicenseFinder licenseFinder, - final ServerToolRegistry serverToolRegistry, final I18nTranslationService i18n) { - super(provider, Group.class); - this.finder = finder; - this.userFinder = userFinder; - this.kuneProperties = kuneProperties; - this.properties = properties; - this.registry = registry; - this.licenseManager = licenseManager; - this.licenseFinder = licenseFinder; - this.serverToolRegistry = serverToolRegistry; - this.i18n = i18n; - } + @Inject + public GroupManagerDefault(final Provider<EntityManager> provider, final GroupFinder finder, + final UserFinder userFinder, final KuneProperties kuneProperties, + final DatabaseProperties properties, final ServerToolRegistry registry, + final LicenseManager licenseManager, final LicenseFinder licenseFinder, + final ServerToolRegistry serverToolRegistry, final I18nTranslationService i18n) { + super(provider, Group.class); + this.finder = finder; + this.userFinder = userFinder; + this.kuneProperties = kuneProperties; + this.properties = properties; + this.registry = registry; + this.licenseManager = licenseManager; + this.licenseFinder = licenseFinder; + this.serverToolRegistry = serverToolRegistry; + this.i18n = i18n; + } - @Override - public void changeDefLicense(final User user, final Group group, final String licName) { - final License license = licenseFinder.findByShortName(licName); - if (license == null) { - throw new ServerManagerException("Unknown license"); - } - group.setDefaultLicense(license); + @Override + public void changeDefLicense(final User user, final Group group, final String licName) { + final License license = licenseFinder.findByShortName(licName); + if (license == null) { + throw new ServerManagerException("Unknown license"); } + group.setDefaultLicense(license); + } - @Override - public void changeWsTheme(final User user, final Group group, final String theme) throws AccessViolationException { - // TODO: check theme - group.setWorkspaceTheme(theme); - } + @Override + public void changeWsTheme(final User user, final Group group, final String theme) + throws AccessViolationException { + // TODO: check theme + group.setWorkspaceTheme(theme); + } - @Override - public void clearGroupBackImage(final Group group) { - group.setGroupBackImage(null); + @Override + public void clearGroupBackImage(final Group group) { + group.setGroupBackImage(null); + } + + @Override + public Group createGroup(final Group group, final User user, final String publicDescrip) + throws GroupNameInUseException, UserMustBeLoggedException { + final String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF); + if (User.isKnownUser(user)) { + if (group.getGroupType().equals(GroupType.COMMUNITY)) { + group.setAdmissionType(AdmissionType.Open); + } else if (group.getGroupType().equals(GroupType.ORGANIZATION)) { + group.setAdmissionType(AdmissionType.Moderated); + } else if (group.getGroupType().equals(GroupType.PROJECT)) { + group.setAdmissionType(AdmissionType.Moderated); + } else if (group.getGroupType().equals(GroupType.ORPHANED_PROJECT)) { + group.setAdmissionType(AdmissionType.Open); + } + final String licName = group.getDefaultLicense().getShortName(); + final License license = licenseFinder.findByShortName(licName); + group.setDefaultLicense(license); + group.setWorkspaceTheme(defaultSiteWorkspaceTheme); + initSocialNetwork(group, user.getUserGroup()); + final String title = i18n.t("About [%s]", group.getLongName()); + initGroup(user, group, serverToolRegistry.getToolsForGroupsKeys(), title, publicDescrip); + return group; + } else { + throw new UserMustBeLoggedException(); } + } - @Override - public Group createGroup(final Group group, final User user, final String publicDescrip) - throws GroupNameInUseException, UserMustBeLoggedException { - final String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF); - if (User.isKnownUser(user)) { - if (group.getGroupType().equals(GroupType.COMMUNITY)) { - group.setAdmissionType(AdmissionType.Open); - } else if (group.getGroupType().equals(GroupType.ORGANIZATION)) { - group.setAdmissionType(AdmissionType.Moderated); - } else if (group.getGroupType().equals(GroupType.PROJECT)) { - group.setAdmissionType(AdmissionType.Moderated); - } else if (group.getGroupType().equals(GroupType.ORPHANED_PROJECT)) { - group.setAdmissionType(AdmissionType.Open); - } - final String licName = group.getDefaultLicense().getShortName(); - final License license = licenseFinder.findByShortName(licName); - group.setDefaultLicense(license); - group.setWorkspaceTheme(defaultSiteWorkspaceTheme); - initSocialNetwork(group, user.getUserGroup()); - final String title = i18n.t("About [%s]", group.getLongName()); - initGroup(user, group, serverToolRegistry.getToolsForGroupsKeys(), title, publicDescrip); - return group; - } else { - throw new UserMustBeLoggedException(); - } + @Override + public Group createUserGroup(final User user) throws GroupNameInUseException, + EmailAddressInUseException { + return createUserGroup(user, true); + } + + @Override + public Group createUserGroup(final User user, final boolean wantPersonalHomepage) + throws GroupNameInUseException, EmailAddressInUseException { + final String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF); + final License licenseDef = licenseManager.getDefLicense(); + final Group userGroup = new Group(user.getShortName(), user.getName(), licenseDef, + GroupType.PERSONAL); + User userSameEmail = null; + try { + userSameEmail = userFinder.getByEmail(user.getEmail()); + } catch (final NoResultException e) { + // Ok, no more with this email } + if (userSameEmail != null) { + throw new EmailAddressInUseException(); + } + userGroup.setAdmissionType(AdmissionType.Closed); + userGroup.setWorkspaceTheme(defaultSiteWorkspaceTheme); + userGroup.setDefaultContent(null); + user.setUserGroup(userGroup); + initSocialNetwork(userGroup, userGroup); - @Override - public Group createUserGroup(final User user) throws GroupNameInUseException, EmailAddressInUseException { - return createUserGroup(user, true); + final String title = i18n.t("[%s] Bio", user.getName()); + final String body = "<h1>" + title + "</h1>" + i18n.t("This user has not written its biography yet"); + try { + initGroup(user, userGroup, wantPersonalHomepage ? serverToolRegistry.getToolsForUserKeys() + : ServerToolRegistry.emptyToolList, title, body); + super.persist(user, User.class); + } catch (final PersistenceException e) { + if (e.getCause() instanceof ConstraintViolationException) { + throw new GroupNameInUseException(); + } + throw e; } + return userGroup; + } - @Override - public Group createUserGroup(final User user, final boolean wantPersonalHomepage) throws GroupNameInUseException, - EmailAddressInUseException { - final String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF); - final License licenseDef = licenseManager.getDefLicense(); - final Group userGroup = new Group(user.getShortName(), user.getName(), licenseDef, GroupType.PERSONAL); - User userSameEmail = null; - try { - userSameEmail = userFinder.getByEmail(user.getEmail()); - } catch (final NoResultException e) { - // Ok, no more with this email - } - if (userSameEmail != null) { - throw new EmailAddressInUseException(); - } - userGroup.setAdmissionType(AdmissionType.Closed); - userGroup.setWorkspaceTheme(defaultSiteWorkspaceTheme); - userGroup.setDefaultContent(null); - user.setUserGroup(userGroup); - initSocialNetwork(userGroup, userGroup); + @Override + public List<Group> findAdminInGroups(final Long groupId) { + return finder.findAdminInGroups(groupId); + } - final String title = i18n.t("[%s] Bio", user.getName()); - final String body = "<h1>" + title + "</h1>" + i18n.t("This user has not written its biography yet"); - try { - initGroup(user, userGroup, wantPersonalHomepage ? serverToolRegistry.getToolsForUserKeys() - : ServerToolRegistry.emptyToolList, title, body); - super.persist(user, User.class); - } catch (final PersistenceException e) { - if (e.getCause() instanceof ConstraintViolationException) { - throw new GroupNameInUseException(); - } - throw e; - } - return userGroup; - } + @Override + public Group findByShortName(final String shortName) { + return finder.findByShortName(shortName); + } - @Override - public List<Group> findAdminInGroups(final Long groupId) { - return finder.findAdminInGroups(groupId); - } + @Override + public List<Group> findCollabInGroups(final Long groupId) { + return finder.findCollabInGroups(groupId); + } - @Override - public Group findByShortName(final String shortName) { - return finder.findByShortName(shortName); - } + @Override + public List<String> findEnabledTools(final Long id) { + return finder.findEnabledTools(id); + } - @Override - public List<Group> findCollabInGroups(final Long groupId) { - return finder.findCollabInGroups(groupId); - } + @Override + public Group getGroupOfUserWithId(final Long userId) { + return userId != null ? find(User.class, userId).getUserGroup() : null; + } - @Override - public List<String> findEnabledTools(final Long id) { - return finder.findEnabledTools(id); - } + @Override + public Group getSiteDefaultGroup() { + final String shortName = properties.getDefaultSiteShortName(); + return findByShortName(shortName); + } - @Override - public Group getGroupOfUserWithId(final Long userId) { - return userId != null ? find(User.class, userId).getUserGroup() : null; + private void initGroup(final User user, final Group group, final Collection<String> toolsToEnable, + final Object... vars) throws GroupNameInUseException { + try { + persist(group); + } catch (final IllegalStateException e) { + e.printStackTrace(); + } catch (final PersistenceException e) { + if (e.getCause() instanceof ConstraintViolationException) { + throw new GroupNameInUseException(); + } + throw e; } - - @Override - public Group getSiteDefaultGroup() { - final String shortName = properties.getDefaultSiteShortName(); - return findByShortName(shortName); + for (final ServerTool tool : registry.all()) { + if (toolsToEnable.contains(tool.getName())) { + tool.initGroup(user, group, vars); + } } + } - private void initGroup(final User user, final Group group, final Collection<String> toolsToEnable, - final Object... vars) throws GroupNameInUseException { - try { - persist(group); - } catch (final IllegalStateException e) { - e.printStackTrace(); - } catch (final PersistenceException e) { - if (e.getCause() instanceof ConstraintViolationException) { - throw new GroupNameInUseException(); - } - throw e; - } - for (final ServerTool tool : registry.all()) { - if (toolsToEnable.contains(tool.getName())) { - tool.initGroup(user, group, vars); - } - } + private void initSocialNetwork(final Group group, final Group userGroup) { + final SocialNetwork network = group.getSocialNetwork(); + final AccessLists lists = network.getAccessLists(); + lists.getEditors().setMode(GroupListMode.NOBODY); + lists.getViewers().setMode(GroupListMode.EVERYONE); + if (!group.getGroupType().equals(GroupType.ORPHANED_PROJECT)) { + network.addAdmin(userGroup); } + } - private void initSocialNetwork(final Group group, final Group userGroup) { - final SocialNetwork network = group.getSocialNetwork(); - final AccessLists lists = network.getAccessLists(); - lists.getEditors().setMode(GroupListMode.NOBODY); - lists.getViewers().setMode(GroupListMode.EVERYONE); - if (!group.getGroupType().equals(GroupType.ORPHANED_PROJECT)) { - network.addAdmin(userGroup); - } - } + @Override + public SearchResult<Group> search(final String search) { + return this.search(search, null, null); + } - @Override - public SearchResult<Group> search(final String search) { - return this.search(search, null, null); + @Override + public SearchResult<Group> search(final String search, final Integer firstResult, + final Integer maxResults) { + final MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[] { "longName", + "shortName", "publicDesc" }, new StandardAnalyzer()); + Query query; + try { + query = parser.parse(search + SearcherConstants.WILDCARD); + } catch (final ParseException e) { + throw new ServerManagerException("Error parsing search"); } + return super.search(query, firstResult, maxResults); + } - @Override - public SearchResult<Group> search(final String search, final Integer firstResult, final Integer maxResults) { - final MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[] { "longName", "shortName", - "publicDesc" }, new StandardAnalyzer()); - Query query; - try { - query = parser.parse(search); - } catch (final ParseException e) { - throw new ServerManagerException("Error parsing search"); - } - return super.search(query, firstResult, maxResults); - } + @Override + public void setDefaultContent(final String groupShortName, final Content content) { + final Group group = findByShortName(groupShortName); + group.setDefaultContent(content); + } - @Override - public void setDefaultContent(final String groupShortName, final Content content) { - final Group group = findByShortName(groupShortName); - group.setDefaultContent(content); + @Override + public void setGroupBackImage(final Group group, final Content content) { + if (content.getMimeType().isImage()) { + group.setGroupBackImage(content); + } else { + throw new DefaultException("Trying to set not a image as group logo"); } + } - @Override - public void setGroupBackImage(final Group group, final Content content) { - if (content.getMimeType().isImage()) { - group.setGroupBackImage(content); - } else { - throw new DefaultException("Trying to set not a image as group logo"); - } + @Override + public void setToolEnabled(final User userLogged, final String groupShortName, final String tool, + final boolean enabled) { + final Group group = findByShortName(groupShortName); + ToolConfiguration toolConfiguration = group.getToolConfiguration(tool); + if (toolConfiguration == null) { + toolConfiguration = serverToolRegistry.get(tool).initGroup(userLogged, group).getToolConfiguration( + tool); } + toolConfiguration.setEnabled(enabled); + } - @Override - public void setToolEnabled(final User userLogged, final String groupShortName, final String tool, - final boolean enabled) { - final Group group = findByShortName(groupShortName); - ToolConfiguration toolConfiguration = group.getToolConfiguration(tool); - if (toolConfiguration == null) { - toolConfiguration = serverToolRegistry.get(tool).initGroup(userLogged, group).getToolConfiguration(tool); - } - toolConfiguration.setEnabled(enabled); - } - } Modified: trunk/src/main/java/cc/kune/core/shared/SearcherConstants.java =================================================================== --- trunk/src/main/java/cc/kune/core/shared/SearcherConstants.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/core/shared/SearcherConstants.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -21,22 +21,23 @@ public final class SearcherConstants { - public final static String START_PARAM = "start"; - public final static String LIMIT_PARAM = "limit"; - public final static String QUERY_PARAM = "query"; - public final static String MIMETYPE_PARAM = "mimetype"; - public final static String MIMETYPE2_PARAM = "mimetype2"; - public final static String GROUP_PARAM = "group"; + public final static String CONTENT_DATA_PROXY_URL = "/ws/json/ContentJSONService/search"; + public final static String CONTENT_TEMPLATE_TEXT_PREFIX = "<div class=\"search-item\"><span class=\"kune-IconHyperlink\"><img src=\""; + public final static String CONTENT_TEMPLATE_TEXT_SUFFIX = "\" style=\"height: 16px; width: 16px;\" />{shortName}: {longName}</span></div>"; + public final static String GROUP_DATA_PROXY_URL = "/ws/json/GroupJSONService/search"; + public final static String GROUP_PARAM = "group"; + public final static String I18N_JSON_SERVICE = "/ws/json/I18nTranslationJSONService/search"; - public final static String GROUP_DATA_PROXY_URL = "/ws/json/GroupJSONService/search"; - public final static String USER_DATA_PROXY_URL = "/ws/json/UserJSONService/search"; - public final static String CONTENT_DATA_PROXY_URL = "/ws/json/ContentJSONService/search"; - public final static String I18N_JSON_SERVICE = "/ws/json/I18nTranslationJSONService/search"; - public final static String I18N_JSON_SERVICE_TRANSLATED = "/ws/json/I18nTranslationJSONService/searchtranslated"; + public final static String I18N_JSON_SERVICE_TRANSLATED = "/ws/json/I18nTranslationJSONService/searchtranslated"; + public final static String LIMIT_PARAM = "limit"; + public final static String MIMETYPE_PARAM = "mimetype"; + public final static String MIMETYPE2_PARAM = "mimetype2"; + public final static String QUERY_PARAM = "query"; - public final static String CONTENT_TEMPLATE_TEXT_PREFIX = "<div class=\"search-item\"><span class=\"kune-IconHyperlink\"><img src=\""; - public final static String CONTENT_TEMPLATE_TEXT_SUFFIX = "\" style=\"height: 16px; width: 16px;\" />{shortName}: {longName}</span></div>"; + public final static String START_PARAM = "start"; + public final static String USER_DATA_PROXY_URL = "/ws/json/UserJSONService/search"; + public static final String WILDCARD = "*"; - private SearcherConstants() { - } + private SearcherConstants() { + } } Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.ui.xml =================================================================== --- trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.ui.xml 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.ui.xml 2011-05-04 20:29:42 UTC (rev 1340) @@ -12,8 +12,8 @@ </ui:style> <g:DockLayoutPanel ui:field="mainpanel" styleName='{res.style.mainPanel}' unit="PX"> - <g:north size="22"> - <g:FlowPanel ui:field="sitebar" height="22px" + <g:north size="23"> + <g:FlowPanel ui:field="sitebar" height="23px" styleName='{res.style.siteBar}'> </g:FlowPanel> </g:north> Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java =================================================================== --- trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -21,6 +21,8 @@ import cc.kune.blogs.client.actions.ContentViewerOptionsMenu; import cc.kune.client.ExtendedGinModule; +import cc.kune.core.client.sitebar.search.SitebarSearchPanel; +import cc.kune.core.client.sitebar.search.SitebarSearchPresenter; import cc.kune.gspace.client.actions.RenameAction; import cc.kune.gspace.client.options.GroupOptions; import cc.kune.gspace.client.options.GroupOptionsCollection; @@ -82,58 +84,60 @@ public class GSpaceGinModule extends ExtendedGinModule { - /* - * (non-Javadoc) - * - * @see com.google.gwt.inject.client.AbstractGinModule#configure() - */ - @Override - protected void configure() { - bindPresenter(EntityLicensePresenter.class, EntityLicensePresenter.EntityLicenseView.class, - EntityLicensePanel.class, EntityLicensePresenter.EntityLicenseProxy.class); - bindPresenter(TagsSummaryPresenter.class, TagsSummaryPresenter.TagsSummaryView.class, TagsSummaryPanel.class, - TagsSummaryPresenter.TagsSummaryProxy.class); - bind(GSpaceArmorImpl.class).in(Singleton.class); - bind(GSpaceArmor.class).to(GSpaceArmorImpl.class).in(Singleton.class); - bind(GSpaceParts.class).asEagerSingleton(); - bindPresenter(ToolSelectorPresenter.class, ToolSelectorPresenter.ToolSelectorView.class, - ToolSelectorPanel.class, ToolSelectorPresenter.ToolSelectorProxy.class); - bind(ToolSelector.class).to(ToolSelectorPresenter.class).in(Singleton.class); - bindPresenter(DocViewerPresenter.class, DocViewerPresenter.DocViewerView.class, DocViewerPanel.class, - DocViewerPresenter.DocViewerProxy.class); - bindPresenter(FolderViewerPresenter.class, FolderViewerPresenter.FolderViewerView.class, - FolderViewerAsTablePanel.class, FolderViewerPresenter.FolderViewerProxy.class); + /* + * (non-Javadoc) + * + * @see com.google.gwt.inject.client.AbstractGinModule#configure() + */ + @Override + protected void configure() { + bindPresenter(EntityLicensePresenter.class, EntityLicensePresenter.EntityLicenseView.class, + EntityLicensePanel.class, EntityLicensePresenter.EntityLicenseProxy.class); + bindPresenter(TagsSummaryPresenter.class, TagsSummaryPresenter.TagsSummaryView.class, + TagsSummaryPanel.class, TagsSummaryPresenter.TagsSummaryProxy.class); + bind(GSpaceArmorImpl.class).in(Singleton.class); + bind(GSpaceArmor.class).to(GSpaceArmorImpl.class).in(Singleton.class); + bind(GSpaceParts.class).asEagerSingleton(); + bindPresenter(ToolSelectorPresenter.class, ToolSelectorPresenter.ToolSelectorView.class, + ToolSelectorPanel.class, ToolSelectorPresenter.ToolSelectorProxy.class); + bind(ToolSelector.class).to(ToolSelectorPresenter.class).in(Singleton.class); + bindPresenter(DocViewerPresenter.class, DocViewerPresenter.DocViewerView.class, + DocViewerPanel.class, DocViewerPresenter.DocViewerProxy.class); + bindPresenter(FolderViewerPresenter.class, FolderViewerPresenter.FolderViewerView.class, + FolderViewerAsTablePanel.class, FolderViewerPresenter.FolderViewerProxy.class); + bindPresenter(SitebarSearchPresenter.class, SitebarSearchPresenter.SitebarSearchView.class, + SitebarSearchPanel.class, SitebarSearchPresenter.SitebarSearchProxy.class); - s(GroupOptions.class, GroupOptionsPresenter.class); - s(GroupOptionsView.class, GroupOptionsPanel.class); - s(UserOptions.class, UserOptionsPresenter.class); - s(UserOptionsView.class, UserOptionsPanel.class); + s(GroupOptions.class, GroupOptionsPresenter.class); + s(GroupOptionsView.class, GroupOptionsPanel.class); + s(UserOptions.class, UserOptionsPresenter.class); + s(UserOptionsView.class, UserOptionsPanel.class); - s(UserOptionsCollection.class); - s(GroupOptionsCollection.class); + s(UserOptionsCollection.class); + s(GroupOptionsCollection.class); - s(GroupOptionsDefLicense.class, GroupOptionsDefLicensePresenter.class); - s(GroupOptionsDefLicenseView.class, GroupOptionsDefLicensePanel.class); - s(GroupOptionsPublicSpaceConf.class, GroupOptionsPublicSpaceConfPresenter.class); - s(GroupOptionsPublicSpaceConfView.class, GroupOptionsPublicSpaceConfPanel.class); - s(GroupOptionsLogo.class, GroupOptionsLogoPresenter.class); - s(GroupOptionsLogoView.class, GroupOptionsLogoPanel.class); - s(GroupOptionsToolsConf.class, GroupOptionsToolsConfPresenter.class); - s(GroupOptionsToolsConfView.class, GroupOptionsToolsConfPanel.class); + s(GroupOptionsDefLicense.class, GroupOptionsDefLicensePresenter.class); + s(GroupOptionsDefLicenseView.class, GroupOptionsDefLicensePanel.class); + s(GroupOptionsPublicSpaceConf.class, GroupOptionsPublicSpaceConfPresenter.class); + s(GroupOptionsPublicSpaceConfView.class, GroupOptionsPublicSpaceConfPanel.class); + s(GroupOptionsLogo.class, GroupOptionsLogoPresenter.class); + s(GroupOptionsLogoView.class, GroupOptionsLogoPanel.class); + s(GroupOptionsToolsConf.class, GroupOptionsToolsConfPresenter.class); + s(GroupOptionsToolsConfView.class, GroupOptionsToolsConfPanel.class); - s(UserOptionsDefLicense.class, UserOptionsDefLicensePresenter.class); - s(UserOptionsDefLicenseView.class, UserOptionsDefLicensePanel.class); - s(UserOptionsPublicSpaceConf.class, UserOptionsPublicSpaceConfPresenter.class); - s(UserOptionsPublicSpaceConfView.class, UserOptionsPublicSpaceConfPanel.class); - s(UserOptionsLogo.class, UserOptionsLogoPresenter.class); - s(UserOptionsLogoView.class, UserOptionsLogoPanel.class); - s(UserOptionsToolsConf.class, UserOptionsToolsConfPresenter.class); - s(UserOptionsToolsConfView.class, UserOptionsToolsConfPanel.class); + s(UserOptionsDefLicense.class, UserOptionsDefLicensePresenter.class); + s(UserOptionsDefLicenseView.class, UserOptionsDefLicensePanel.class); + s(UserOptionsPublicSpaceConf.class, UserOptionsPublicSpaceConfPresenter.class); + s(UserOptionsPublicSpaceConfView.class, UserOptionsPublicSpaceConfPanel.class); + s(UserOptionsLogo.class, UserOptionsLogoPresenter.class); + s(UserOptionsLogoView.class, UserOptionsLogoPanel.class); + s(UserOptionsToolsConf.class, UserOptionsToolsConfPresenter.class); + s(UserOptionsToolsConfView.class, UserOptionsToolsConfPanel.class); - s(GSpaceBackManager.class, GSpaceBackManagerImpl.class); + s(GSpaceBackManager.class, GSpaceBackManagerImpl.class); - // Actions - s(ContentViewerOptionsMenu.class); - s(RenameAction.class); - } + // Actions + s(ContentViewerOptionsMenu.class); + s(RenameAction.class); + } } \ No newline at end of file Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceGinjector.java =================================================================== --- trunk/src/main/java/cc/kune/gspace/client/GSpaceGinjector.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/gspace/client/GSpaceGinjector.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -1,5 +1,6 @@ package cc.kune.gspace.client; +import cc.kune.core.client.sitebar.search.SitebarSearchPresenter; import cc.kune.gspace.client.tags.TagsSummaryPresenter; import cc.kune.gspace.client.tool.ContentViewerSelector; import cc.kune.gspace.client.tool.selector.ToolSelectorPresenter; @@ -12,17 +13,19 @@ public interface GSpaceGinjector extends Ginjector { - ContentViewerSelector getContentViewerSelector(); + ContentViewerSelector getContentViewerSelector(); - AsyncProvider<DocViewerPresenter> getDocsViewerPresenter(); + AsyncProvider<DocViewerPresenter> getDocsViewerPresenter(); - AsyncProvider<EntityLicensePresenter> getEntityLicensePresenter(); + AsyncProvider<EntityLicensePresenter> getEntityLicensePresenter(); - AsyncProvider<FolderViewerPresenter> getFolderViewerPresenter(); + AsyncProvider<FolderViewerPresenter> getFolderViewerPresenter(); - GSpaceParts getGSpaceParts(); + GSpaceParts getGSpaceParts(); - AsyncProvider<TagsSummaryPresenter> getTagsSummaryPresenter(); + AsyncProvider<SitebarSearchPresenter> getSitebarSearchPresenter(); - AsyncProvider<ToolSelectorPresenter> getToolSelectorPresenter(); + AsyncProvider<TagsSummaryPresenter> getTagsSummaryPresenter(); + + AsyncProvider<ToolSelectorPresenter> getToolSelectorPresenter(); } Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java =================================================================== --- trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -2,6 +2,7 @@ import cc.kune.core.client.init.AppStartEvent; import cc.kune.core.client.init.AppStartEvent.AppStartHandler; +import cc.kune.core.client.sitebar.search.SitebarSearchPresenter; import cc.kune.core.client.state.Session; import cc.kune.gspace.client.options.GroupOptions; import cc.kune.gspace.client.options.GroupOptionsCollection; @@ -26,50 +27,52 @@ public class GSpaceParts { - @Inject - public GSpaceParts(final Session session, final Provider<EntityLicensePresenter> licenseFooter, - final Provider<TagsSummaryPresenter> tagsPresenter, final Provider<ToolSelector> toolSelector, - final Provider<DocViewerPresenter> docsViewer, final Provider<FolderViewerPresenter> folderViewer, - final Provider<GroupOptions> go, final Provider<UserOptions> uo, - final Provider<GroupOptionsCollection> goc, final Provider<UserOptionsCollection> uoc, - final Provider<GroupOptionsDefLicense> gdl, final Provider<GroupOptionsPublicSpaceConf> gps, - final Provider<GroupOptionsLogo> gl, final Provider<GroupOptionsToolsConf> gtc, - final Provider<UserOptionsDefLicense> udl, final Provider<UserOptionsPublicSpaceConf> ups, - final Provider<UserOptionsLogo> ul, final Provider<UserOptionsToolsConf> utc) { - // , final Provider<GroupOptionsPanel> gop, - // , final Provider<UserOptionsPanel> uop, - // final Provider<GroupOptionsPublicSpaceConfPanel> gpsp, - // final Provider<GroupOptionsDefLicensePanel> gdlp, - // final Provider<GroupOptionsLogoPanel> glp, - // final Provider<GroupOptionsToolsConfPanel> gtcp, - // final Provider<UserOptionsLogoPanel> ulp, - // final Provider<UserOptionsDefLicensePanel> udlp, - // final Provider<UserOptionsPublicSpaceConfPanel> upsp, - // final Provider<UserOptionsToolsConfPanel> utcp + @Inject + public GSpaceParts(final Session session, final Provider<EntityLicensePresenter> licenseFooter, + final Provider<TagsSummaryPresenter> tagsPresenter, final Provider<ToolSelector> toolSelector, + final Provider<DocViewerPresenter> docsViewer, final Provider<FolderViewerPresenter> folderViewer, + final Provider<GroupOptions> go, final Provider<UserOptions> uo, + final Provider<GroupOptionsCollection> goc, final Provider<UserOptionsCollection> uoc, + final Provider<GroupOptionsDefLicense> gdl, final Provider<GroupOptionsPublicSpaceConf> gps, + final Provider<GroupOptionsLogo> gl, final Provider<GroupOptionsToolsConf> gtc, + final Provider<UserOptionsDefLicense> udl, final Provider<UserOptionsPublicSpaceConf> ups, + final Provider<UserOptionsLogo> ul, final Provider<UserOptionsToolsConf> utc, + final Provider<SitebarSearchPresenter> siteSearch) { + // , final Provider<GroupOptionsPanel> gop, + // , final Provider<UserOptionsPanel> uop, + // final Provider<GroupOptionsPublicSpaceConfPanel> gpsp, + // final Provider<GroupOptionsDefLicensePanel> gdlp, + // final Provider<GroupOptionsLogoPanel> glp, + // final Provider<GroupOptionsToolsConfPanel> gtcp, + // final Provider<UserOptionsLogoPanel> ulp, + // final Provider<UserOptionsDefLicensePanel> udlp, + // final Provider<UserOptionsPublicSpaceConfPanel> upsp, + // final Provider<UserOptionsToolsConfPanel> utcp - session.onAppStart(true, new AppStartHandler() { - @Override - public void onAppStart(final AppStartEvent event) { - licenseFooter.get(); - tagsPresenter.get(); - toolSelector.get(); - docsViewer.get(); - folderViewer.get(); + session.onAppStart(true, new AppStartHandler() { + @Override + public void onAppStart(final AppStartEvent event) { + licenseFooter.get(); + tagsPresenter.get(); + toolSelector.get(); + docsViewer.get(); + folderViewer.get(); + siteSearch.get(); - // Add User & Groups Options - goc.get().add(gtc); - goc.get().add(gl); - goc.get().add(gps); - goc.get().add(gdl); - uoc.get().add(utc); - uoc.get().add(ul); - uoc.get().add(ups); - uoc.get().add(udl); + // Add User & Groups Options + goc.get().add(gtc); + goc.get().add(gl); + goc.get().add(gps); + goc.get().add(gdl); + uoc.get().add(utc); + uoc.get().add(ul); + uoc.get().add(ups); + uoc.get().add(udl); - // Init - go.get(); - uo.get(); - } - }); - } + // Init + go.get(); + uo.get(); + } + }); + } } Modified: trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPresenter.java =================================================================== --- trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPresenter.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPresenter.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -24,7 +24,7 @@ import cc.kune.common.client.actions.ActionEvent; import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor; import cc.kune.common.client.ui.dialogs.tabbed.AbstractTabbedDialogPresenter; -import cc.kune.core.client.resources.icons.IconResources; +import cc.kune.core.client.resources.CoreResources; import cc.kune.core.client.state.StateChangedEvent; import cc.kune.core.client.state.StateChangedEvent.StateChangedHandler; import cc.kune.core.client.state.StateManager; @@ -34,51 +34,51 @@ import com.google.inject.Inject; public class GroupOptionsPresenter extends AbstractTabbedDialogPresenter implements GroupOptions { - public static final String GROUP_OPTIONS_ICON = "k-eop-icon"; - private final I18nTranslationService i18n; - private final IconResources img; - private ButtonDescriptor prefsItem; - private GroupOptionsView view; + public static final String GROUP_OPTIONS_ICON = "k-eop-icon"; + private final I18nTranslationService i18n; + private final CoreResources img; + private ButtonDescriptor prefsItem; + private GroupOptionsView view; - @Inject - public GroupOptionsPresenter(final StateManager stateManager, final I18nTranslationService i18n, - final IconResources img, final GroupOptionsView view) { - this.i18n = i18n; - this.img = img; - stateManager.onStateChanged(true, new StateChangedHandler() { - @Override - public void onStateChanged(final StateChangedEvent event) { - final StateAbstractDTO state = event.getState(); - if (!state.getGroup().isPersonal() && state.getGroupRights().isAdministrable()) { - prefsItem.setVisible(true); - } else { - view.hide(); - prefsItem.setVisible(false); - } - } - }); - init(view); - } + @Inject + public GroupOptionsPresenter(final StateManager stateManager, final I18nTranslationService i18n, + final CoreResources img, final GroupOptionsView view) { + this.i18n = i18n; + this.img = img; + stateManager.onStateChanged(true, new StateChangedHandler() { + @Override + public void onStateChanged(final StateChangedEvent event) { + final StateAbstractDTO state = event.getState(); + if (!state.getGroup().isPersonal() && state.getGroupRights().isAdministrable()) { + prefsItem.setVisible(true); + } else { + view.hide(); + prefsItem.setVisible(false); + } + } + }); + init(view); + } - private void createActions() { - final AbstractExtendedAction groupPrefsAction = new AbstractExtendedAction() { - @Override - public void actionPerformed(final ActionEvent event) { - show(); - } - }; - groupPrefsAction.putValue(Action.NAME, i18n.t("Group options")); - groupPrefsAction.putValue(Action.SMALL_ICON, img.prefs()); - prefsItem = new ButtonDescriptor(groupPrefsAction); - prefsItem.withStyles("k-ent-header-btn"); - prefsItem.setId(GROUP_OPTIONS_ICON); - prefsItem.setVisible(false); - view.addAction(prefsItem); - } + private void createActions() { + final AbstractExtendedAction groupPrefsAction = new AbstractExtendedAction() { + @Override + public void actionPerformed(final ActionEvent event) { + show(); + } + }; + groupPrefsAction.putValue(Action.NAME, i18n.t("Group options")); + groupPrefsAction.putValue(Action.SMALL_ICON, img.prefs()); + prefsItem = new ButtonDescriptor(groupPrefsAction); + prefsItem.withStyles("k-ent-header-btn"); + prefsItem.setId(GROUP_OPTIONS_ICON); + prefsItem.setVisible(false); + view.addAction(prefsItem); + } - private void init(final GroupOptionsView view) { - super.init(view); - this.view = view; - createActions(); - } + private void init(final GroupOptionsView view) { + super.init(view); + this.view = view; + createActions(); + } } Modified: trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPresenter.java =================================================================== --- trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPresenter.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPresenter.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -24,7 +24,7 @@ import cc.kune.common.client.actions.ActionEvent; import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor; import cc.kune.common.client.ui.dialogs.tabbed.AbstractTabbedDialogPresenter; -import cc.kune.core.client.resources.icons.IconResources; +import cc.kune.core.client.resources.CoreResources; import cc.kune.core.client.sitebar.SiteUserOptions; import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateManager; @@ -36,52 +36,52 @@ public class UserOptionsPresenter extends AbstractTabbedDialogPresenter implements UserOptions { - private final I18nTranslationService i18n; - private final IconResources img; - private final Session session; - private final StateManager stateManager; - private final SiteUserOptions userOptions; - private UserOptionsView view; + private final I18nTranslationService i18n; + private final CoreResources res; + private final Session session; + private final StateManager stateManager; + private final SiteUserOptions userOptions; + private UserOptionsView view; - @Inject - public UserOptionsPresenter(final Session session, final StateManager stateManager, - final I18nTranslationService i18n, final IconResources img, final SiteUserOptions userOptions, - final UserOptionsView view) { - this.session = session; - this.stateManager = stateManager; - this.i18n = i18n; - this.img = img; - this.userOptions = userOptions; - session.onUserSignIn(false, new UserSignInHandler() { - @Override - public void onUserSignIn(final UserSignInEvent event) { - view.hide(); - } - }); - init(view); - } + @Inject + public UserOptionsPresenter(final Session session, final StateManager stateManager, + final I18nTranslationService i18n, final CoreResources res, final SiteUserOptions userOptions, + final UserOptionsView view) { + this.session = session; + this.stateManager = stateManager; + this.i18n = i18n; + this.res = res; + this.userOptions = userOptions; + session.onUserSignIn(false, new UserSignInHandler() { + @Override + public void onUserSignIn(final UserSignInEvent event) { + view.hide(); + } + }); + init(view); + } - private void createActions() { - final AbstractExtendedAction userPrefsAction = new AbstractExtendedAction() { + private void createActions() { + final AbstractExtendedAction userPrefsAction = new AbstractExtendedAction() { - @Override - public void actionPerformed(final ActionEvent event) { - if (!session.isInCurrentUserSpace()) { - stateManager.gotoStateToken(session.getCurrentUser().getStateToken()); - } - show(); - } - }; - userPrefsAction.putValue(Action.NAME, i18n.t("Your preferences")); - userPrefsAction.putValue(Action.SMALL_ICON, img.prefs()); - final MenuItemDescriptor prefsItem = new MenuItemDescriptor(userPrefsAction); - prefsItem.setPosition(1); - userOptions.addAction(prefsItem); - } + @Override + public void actionPerformed(final ActionEvent event) { + if (!session.isInCurrentUserSpace()) { + stateManager.gotoStateToken(session.getCurrentUser().getStateToken()); + } + show(); + } + }; + userPrefsAction.putValue(Action.NAME, i18n.t("Your preferences")); + userPrefsAction.putValue(Action.SMALL_ICON, res.prefs()); + final MenuItemDescriptor prefsItem = new MenuItemDescriptor(userPrefsAction); + prefsItem.setPosition(1); + userOptions.addAction(prefsItem); + } - private void init(final UserOptionsView view) { - super.init(view); - this.view = view; - createActions(); - } + private void init(final UserOptionsView view) { + super.init(view); + this.view = view; + createActions(); + } } Modified: trunk/src/main/java/cc/kune/pspace/client/PSpaceGinModule.java =================================================================== --- trunk/src/main/java/cc/kune/pspace/client/PSpaceGinModule.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/cc/kune/pspace/client/PSpaceGinModule.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -23,16 +23,16 @@ public class PSpaceGinModule extends AbstractPresenterModule { - /* - * (non-Javadoc) - * - * @see com.google.gwt.inject.client.AbstractGinModule#configure() - */ - @Override - protected void configure() { - bindPresenter(PSpacePresenter.class, PSpacePresenter.PSpaceView.class, PSpacePanel.class, - PSpacePresenter.PSpaceProxy.class); - bind(PSpaceParts.class).asEagerSingleton(); - } + /* + * (non-Javadoc) + * + * @see com.google.gwt.inject.client.AbstractGinModule#configure() + */ + @Override + protected void configure() { + bindPresenter(PSpacePresenter.class, PSpacePresenter.PSpaceView.class, PSpacePanel.class, + PSpacePresenter.PSpaceProxy.class); + bind(PSpaceParts.class).asEagerSingleton(); + } } \ No newline at end of file Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -25,7 +25,7 @@ import org.ourproject.kune.platf.client.actions.PropertyChangeEvent; import org.ourproject.kune.platf.client.actions.PropertyChangeListener; -import cc.kune.core.client.resources.icons.IconConstants; +import cc.kune.core.client.resources.IconConstants; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.user.client.ui.Composite; Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -61,7 +61,7 @@ import org.ourproject.kune.platf.client.ui.rte.inserttable.InsertTableDialog; import cc.kune.common.client.utils.SchedulerManager; -import cc.kune.core.client.resources.icons.IconConstants; +import cc.kune.core.client.resources.IconConstants; import cc.kune.core.client.state.Session; import cc.kune.core.shared.i18n.I18nTranslationService; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/other/AddAsBuddieHeaderButton.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/other/AddAsBuddieHeaderButton.java 2011-05-04 15:18:43 UTC (rev 1339) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/other/AddAsBuddieHeaderButton.java 2011-05-04 20:29:42 UTC (rev 1340) @@ -30,7 +30,7 @@ import org.ourproject.kune.platf.client.ui.noti.OldNotifyUser; import org.ourproject.kune.workspace.client.entityheader.EntityHeader; -import cc.kune.core.client.resources.icons.IconConstants; +import cc.kune.core.client.resources.IconConstants; import cc.kune.core.client.resources.icons.IconResources; import cc.kune.core.client.state.Session; import cc.kune.core.client.state.StateManager;