[kune-commits] r1776 - in trunk: img/icons/custom-iconic src/main/java/cc/kune/common/client/actions/gwtui src/main/java/cc/kune/common/client/actions/gxtui src/main/java/cc/kune/common/client/actions/ui src/main/java/cc/kune/common/client/actions/ui/descrip src/main/java/cc/kune/common/client/log src/main/java/cc/kune/common/public src/main/java/cc/kune/common/public/gxt/css src/main/java/cc/kune/core/client src/main/java/cc/kune/core/client/auth src/main/java/cc/kune/core/client/events src/main/java/cc/kune/core/client/groups/newgroup src/main/java/cc/kune/core/client/rpcservices src/main/java/cc/kune/core/client/sitebar src/main/java/cc/kune/core/client/sn/actions src/main/java/cc/kune/core/client/state src/main/java/cc/kune/core/client/state/impl src/main/webapp src/main/webapp/css src/main/webapp/others/splash/style src/test/java/cc/kune/selenium/spaces
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Fri Mar 23 18:43:05 CET 2012
Author: vjrj_
Date: 2012-03-23 18:43:04 +0100 (Fri, 23 Mar 2012)
New Revision: 1776
Added:
trunk/img/icons/custom-iconic/ideas.svg
trunk/src/main/java/cc/kune/common/client/actions/gwtui/HasMenuItem.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuShowAction.java
trunk/src/main/java/cc/kune/common/client/log/EventBusWithoutLogging.java
trunk/src/main/java/cc/kune/core/client/events/MyGroupsChangedEvent.java
trunk/src/main/java/cc/kune/core/client/rpcservices/GroupServiceHelper.java
trunk/src/main/java/cc/kune/core/client/sitebar/MyGroupsMenu.java
trunk/src/main/java/cc/kune/core/client/sitebar/SitebarGroupsLink.java
trunk/src/main/webapp/css/
trunk/src/main/webapp/css/reset.css
Removed:
trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java
Modified:
trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuGui.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtIconLabelGui.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuSeparatorGui.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtSubMenuGui.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtToolbarGui.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtToolbarSeparatorGui.java
trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtButtonGui.java
trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuItemGui.java
trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuSeparatorGui.java
trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuTitleItemGui.java
trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtToolbarGui.java
trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtToolbarSeparatorGui.java
trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuDescriptor.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuItemDescriptor.java
trunk/src/main/java/cc/kune/common/public/gxt/css/gxt-all.css
trunk/src/main/java/cc/kune/common/public/kune-common.css
trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
trunk/src/main/java/cc/kune/core/client/auth/SignInForm.java
trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java
trunk/src/main/java/cc/kune/core/client/rpcservices/SocialNetServiceHelper.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/client/sitebar/SitebarSignInLink.java
trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignOutLink.java
trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java
trunk/src/main/java/cc/kune/core/client/state/Session.java
trunk/src/main/java/cc/kune/core/client/state/impl/SessionDefault.java
trunk/src/main/webapp/others/splash/style/main.css
trunk/src/main/webapp/ws.html
trunk/src/test/java/cc/kune/selenium/spaces/SitePageObject.java
Log:
My Groups menu option (thanks to @sembrestels). Other minor improvements.
Added: trunk/img/icons/custom-iconic/ideas.svg
===================================================================
--- trunk/img/icons/custom-iconic/ideas.svg (rev 0)
+++ trunk/img/icons/custom-iconic/ideas.svg 2012-03-23 17:43:04 UTC (rev 1776)
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="32"
+ height="32"
+ viewBox="0 0 31.999999 32"
+ xml:space="preserve"
+ inkscape:version="0.48.2 r9819"
+ sodipodi:docname="ideas.svg"
+ inkscape:export-filename="/tmp/location-grey.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"><metadata
+ id="metadata13"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs11" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1078"
+ inkscape:window-height="919"
+ id="namedview9"
+ showgrid="true"
+ inkscape:zoom="11.594073"
+ inkscape:cx="42.459611"
+ inkscape:cy="15.224037"
+ inkscape:window-x="0"
+ inkscape:window-y="709"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="Layer_1"><inkscape:grid
+ type="xygrid"
+ id="grid3009"
+ empspacing="5"
+ visible="true"
+ enabled="true"
+ snapvisiblegridlinesonly="true" /></sodipodi:namedview>
+<g
+ id="g3">
+ <path
+ style="fill:#231f20"
+ d="m 16.024,4.007 c 3.32,0 6.019,2.7 6.019,6.017 0,1.894 -0.867,3.636 -2.379,4.773 C 18.042084,16.123195 16.999999,17.4375 16,19 15,17 14,16 12.39,14.797 10.875,13.66 10.008,11.918 10.008,10.024 c 0,-3.317 2.699,-6.017 6.016,-6.017 M 16.024,0 C 10.488,0 6,4.488 6,10.024 c 0,3.28 1.547,6.147 3.977,7.976 1.121,0.844 1.57325,4 2.023,5 0.449749,1 0.92143,-1.477118 4,-2 3,0 4,4 4,2 0,-2 1,-3.531174 2.074,-5 2.43,-1.829 3.977,-4.696 3.977,-7.976 C 26.051,4.488 21.562,0 16.024,0 z"
+ id="path5"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cscccsccsczczcsc" />
+
+</g>
+<path
+ style="fill:#231f20;fill-opacity:1;stroke:#231f20;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 11,23.920971 21,21"
+ id="path3614"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cc" /><path
+ sodipodi:nodetypes="cc"
+ inkscape:connector-curvature="0"
+ id="path4386"
+ d="M 11,27.920971 21,25"
+ style="fill:#231f20;fill-opacity:1;stroke:#231f20;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1" /><path
+ sodipodi:type="arc"
+ style="color:#000000;fill:#231f20;fill-opacity:1;fill-rule:evenodd;stroke:#231f20;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path4427"
+ sodipodi:cx="16.427052"
+ sodipodi:cy="27.5"
+ sodipodi:rx="2.4270511"
+ sodipodi:ry="1.5"
+ d="M 18.854103,27.5 A 2.4270511,1.5 0 1 1 14,27.5 a 2.4270511,1.5 0 1 1 4.854103,0 z"
+ transform="translate(-0.3901141,1)" /></svg>
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -19,9 +19,7 @@
*/
package cc.kune.common.client.actions.gwtui;
-import cc.kune.common.client.actions.Action;
import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.KeyStroke;
import cc.kune.common.client.actions.ui.AbstractChildGuiItem;
import cc.kune.common.client.actions.ui.AbstractGuiItem;
import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
@@ -156,14 +154,6 @@
}
@Override
- public void setToolTipText(final String tooltipText) {
- if (tooltipText != null && !tooltipText.isEmpty()) {
- final KeyStroke key = (KeyStroke) descriptor.getValue(Action.ACCELERATOR_KEY);
- tooltip = Tooltip.to(button, key == null ? tooltipText : tooltipText + key.toString());
- }
- }
-
- @Override
public void setVisible(final boolean visible) {
button.setVisible(visible);
}
@@ -173,15 +163,4 @@
return !descriptor.isChild();
}
- @Override
- protected void toogleTooltipVisible() {
- if (tooltip != null) {
- if (tooltip.isVisibleOrWillBe()) {
- tooltip.hide();
- } else {
- tooltip.showTemporally();
- }
- }
- }
-
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuGui.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -26,6 +26,7 @@
import cc.kune.common.client.actions.ui.ParentWidget;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
+import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
import cc.kune.common.client.actions.ui.descrip.Position;
import cc.kune.common.client.resources.SubMenuResources;
@@ -86,17 +87,18 @@
if (popup != null && popup.isShowing()) {
popup.hide();
}
+ } else if (event.getPropertyName().equals(MenuDescriptor.MENU_SHOW)) {
+ show();
+ } else if (event.getPropertyName().equals(MenuDescriptor.MENU_SELECTION_DOWN)) {
+ menu.moveSelectionDown();
+ } else if (event.getPropertyName().equals(MenuDescriptor.MENU_SELECTION_UP)) {
+ menu.moveSelectionUp();
+ } else if (event.getPropertyName().equals(MenuDescriptor.MENU_SELECT_ITEM)) {
+ final HasMenuItem item = (HasMenuItem) ((MenuItemDescriptor) descriptor.getValue(MenuDescriptor.MENU_SELECT_ITEM)).getValue(MenuItemDescriptor.UI);
+ menu.selectItem(item.getMenuItem());
}
}
});
- descriptor.addPropertyChangeListener(new PropertyChangeListener() {
- @Override
- public void propertyChange(final PropertyChangeEvent event) {
- if (event.getPropertyName().equals(MenuDescriptor.MENU_SHOW)) {
- show(descriptor.getValue(MenuDescriptor.MENU_SHOW_NEAR_TO));
- }
- }
- });
return this;
}
@@ -130,8 +132,12 @@
return !descriptor.isChild();
}
- public void show(final Object relative) {
- createPopup();
+ protected abstract void show();
+
+ public void showRelativeTo(final Object relative) {
+ if (popup == null) {
+ createPopup();
+ }
if (relative instanceof String) {
popup.showRelativeTo(RootPanel.get((String) relative));
} else if (relative instanceof UIObject) {
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 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -34,7 +34,6 @@
import cc.kune.common.client.actions.ui.descrip.MenuTitleItemDescriptor;
import cc.kune.common.client.errors.UIException;
import cc.kune.common.client.resources.CommonResources;
-import cc.kune.common.client.tooltip.Tooltip;
import cc.kune.common.client.ui.IconLabel;
import com.google.gwt.resources.client.ImageResource;
@@ -42,10 +41,12 @@
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.MenuItem;
-public abstract class AbstractGwtMenuItemGui extends AbstractGuiItem {
+public abstract class AbstractGwtMenuItemGui extends AbstractGuiItem implements HasMenuItem {
private IconLabel iconLabel;
+
private GwtBaseMenuItem item;
private final CommonResources res = CommonResources.INSTANCE;
@@ -100,7 +101,7 @@
} else {
item = new GwtBaseMenuItem("", true);
}
-
+ descriptor.putValue(MenuItemDescriptor.UI, this);
final String id = descriptor.getId();
if (id != null) {
item.ensureDebugId(id);
@@ -164,6 +165,11 @@
return item;
}
+ @Override
+ public MenuItem getMenuItem() {
+ return item;
+ }
+
private AbstractGwtMenuGui getParentMenu(final GuiActionDescrip descriptor) {
return ((AbstractGwtMenuGui) descriptor.getParent().getValue(ParentWidget.PARENT_UI));
}
@@ -227,16 +233,6 @@
}
@Override
- protected void setToolTipText(final String text) {
- if (text != null) {
- final KeyStroke key = (KeyStroke) descriptor.getValue(Action.ACCELERATOR_KEY);
- // FIXME This doesn't works... (don't show the tooltip)
- Tooltip.to(iconLabel, key == null ? text : text + key.toString());
- layout();
- }
- }
-
- @Override
public void setVisible(final boolean visible) {
item.setVisible(visible);
iconLabel.setVisible(visible);
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtIconLabelGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtIconLabelGui.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtIconLabelGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -20,9 +20,7 @@
package cc.kune.common.client.actions.gwtui;
import cc.kune.common.client.actions.AbstractAction;
-import cc.kune.common.client.actions.Action;
import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.KeyStroke;
import cc.kune.common.client.actions.ui.AbstractGuiItem;
import cc.kune.common.client.actions.ui.ParentWidget;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
@@ -97,12 +95,6 @@
}
@Override
- public void setToolTipText(final String tooltip) {
- final KeyStroke key = (KeyStroke) descriptor.getValue(Action.ACCELERATOR_KEY);
- iconLabel.setTooltip(key == null ? tooltip : tooltip + key.toString());
- }
-
- @Override
public boolean shouldBeAdded() {
return true;
}
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 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -23,7 +23,6 @@
import cc.kune.common.client.actions.ui.ParentWidget;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
-import cc.kune.common.client.tooltip.Tooltip;
import cc.kune.common.client.ui.IconLabel;
import com.google.gwt.event.dom.client.ClickEvent;
@@ -67,7 +66,7 @@
@Override
public void onClick(final ClickEvent event) {
event.stopPropagation();
- show(button);
+ show();
}
});
final String id = descriptor.getId();
@@ -139,9 +138,9 @@
}
@Override
- public void setToolTipText(final String tooltip) {
+ public void setToolTipText(final String tooltipText) {
if (notStandAlone) {
- Tooltip.to(button, tooltip);
+ setToolTipTextNextTo(button, tooltipText);
}
}
@@ -154,4 +153,13 @@
}
}
+ @Override
+ protected void show() {
+ if (notStandAlone) {
+ showRelativeTo(button);
+ } else {
+ showRelativeTo(descriptor.getValue(MenuDescriptor.MENU_SHOW_NEAR_TO));
+ }
+ }
+
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuSeparatorGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuSeparatorGui.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuSeparatorGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -59,10 +59,6 @@
}
@Override
- protected void setToolTipText(final String text) {
- }
-
- @Override
public boolean shouldBeAdded() {
return false;
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtSubMenuGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtSubMenuGui.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtSubMenuGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -22,14 +22,17 @@
import cc.kune.common.client.actions.ui.AbstractGuiItem;
import cc.kune.common.client.actions.ui.ParentWidget;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
import cc.kune.common.client.ui.IconLabel;
+import cc.kune.common.shared.utils.TextUtils;
import com.google.gwt.user.client.ui.MenuItem;
-public class GwtSubMenuGui extends AbstractGwtMenuGui {
+public class GwtSubMenuGui extends AbstractGwtMenuGui implements HasMenuItem {
private IconLabel iconLabel;
private MenuItem item;
+ private AbstractGwtMenuGui parentMenu;
@Override
public AbstractGuiItem create(final GuiActionDescrip descriptor) {
@@ -38,8 +41,7 @@
item = new MenuItem("", menu);
iconLabel = new IconLabel("");
configureItemFromProperties();
- final AbstractGwtMenuGui parentMenu = ((AbstractGwtMenuGui) descriptor.getParent().getValue(
- PARENT_UI));
+ parentMenu = ((AbstractGwtMenuGui) descriptor.getParent().getValue(PARENT_UI));
final int position = descriptor.getPosition();
if (position == GuiActionDescrip.NO_POSITION) {
parentMenu.add(item);
@@ -47,9 +49,15 @@
parentMenu.insert(position, item);
}
descriptor.putValue(ParentWidget.PARENT_UI, this);
+ descriptor.putValue(MenuItemDescriptor.UI, this);
return this;
}
+ @Override
+ public MenuItem getMenuItem() {
+ return item;
+ }
+
private void layout() {
item.setHTML(iconLabel.toString());
}
@@ -85,7 +93,9 @@
@Override
public void setToolTipText(final String tooltip) {
- item.setTitle(tooltip);
+ if (TextUtils.notEmpty(tooltip)) {
+ item.setTitle(tooltip);
+ }
}
@Override
@@ -94,4 +104,10 @@
iconLabel.setVisible(visible);
layout();
}
+
+ @Override
+ protected void show() {
+ parentMenu.show();
+ // FIXME: item.selectItem
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtToolbarGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtToolbarGui.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtToolbarGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -83,11 +83,6 @@
}
@Override
- protected void setToolTipText(final String text) {
- toolbar.setTitle(text);
- }
-
- @Override
public boolean shouldBeAdded() {
return true;
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtToolbarSeparatorGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtToolbarSeparatorGui.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtToolbarSeparatorGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -80,10 +80,6 @@
}
@Override
- protected void setToolTipText(final String text) {
- }
-
- @Override
public void setVisible(final boolean visible) {
widget.setVisible(visible);
}
Added: trunk/src/main/java/cc/kune/common/client/actions/gwtui/HasMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/HasMenuItem.java (rev 0)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/HasMenuItem.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -0,0 +1,7 @@
+package cc.kune.common.client.actions.gwtui;
+
+import com.google.gwt.user.client.ui.MenuItem;
+
+public interface HasMenuItem {
+ MenuItem getMenuItem();
+}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtButtonGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtButtonGui.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtButtonGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -19,9 +19,7 @@
*/
package cc.kune.common.client.actions.gxtui;
-import cc.kune.common.client.actions.Action;
import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.KeyStroke;
import cc.kune.common.client.actions.ui.AbstractChildGuiItem;
import cc.kune.common.client.actions.ui.AbstractGuiItem;
import cc.kune.common.client.actions.ui.ParentWidget;
@@ -133,21 +131,6 @@
}
@Override
- protected void setToolTipText(final String tooltip) {
- if (tooltip != null && !tooltip.isEmpty()) {
- final KeyStroke key = (KeyStroke) descriptor.getValue(Action.ACCELERATOR_KEY);
- if (key == null) {
- // button.setToolTip(new GxtDefTooltip(tooltip));
- button.setTitle(tooltip);
- } else {
- // button.setToolTip(new GxtDefTooltip(tooltip +
- // key.toString()));
- button.setTitle(tooltip + key.toString());
- }
- }
- }
-
- @Override
public void setVisible(final boolean visible) {
if (button.isRendered()) {
// ??
Modified: trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuItemGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuItemGui.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuItemGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -32,7 +32,6 @@
import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
import cc.kune.common.client.actions.ui.descrip.MenuRadioItemDescriptor;
import cc.kune.common.client.errors.NotImplementedException;
-import cc.kune.common.shared.utils.TextUtils;
import com.extjs.gxt.ui.client.event.MenuEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
@@ -161,13 +160,6 @@
}
@Override
- protected void setToolTipText(final String tooltip) {
- if (TextUtils.notEmpty(tooltip)) {
- item.setToolTip(new GxtDefTooltip(tooltip));
- }
- }
-
- @Override
public void setVisible(final boolean visible) {
item.setVisible(visible);
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuSeparatorGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuSeparatorGui.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuSeparatorGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -65,10 +65,6 @@
}
@Override
- protected void setToolTipText(final String text) {
- }
-
- @Override
public boolean shouldBeAdded() {
return false;
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuTitleItemGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuTitleItemGui.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuTitleItemGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -87,7 +87,7 @@
}
@Override
- protected void setToolTipText(final String tooltip) {
+ public void setToolTipText(final String tooltip) {
if (TextUtils.notEmpty(tooltip)) {
item.setToolTip(new GxtDefTooltip(tooltip));
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtToolbarGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtToolbarGui.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtToolbarGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -97,9 +97,4 @@
protected void setText(final String text) {
}
- @Override
- protected void setToolTipText(final String text) {
- toolbar.setTitle(text);
- }
-
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtToolbarSeparatorGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtToolbarSeparatorGui.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtToolbarSeparatorGui.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -77,11 +77,6 @@
}
@Override
- protected void setToolTipText(final String text) {
- // do nothing
- }
-
- @Override
public boolean shouldBeAdded() {
return false;
}
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 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -22,19 +22,23 @@
import cc.kune.common.client.actions.AbstractAction;
import cc.kune.common.client.actions.Action;
import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.actions.KeyStroke;
import cc.kune.common.client.actions.PropertyChangeEvent;
import cc.kune.common.client.actions.PropertyChangeListener;
import cc.kune.common.client.actions.ui.descrip.DropTarget;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
import cc.kune.common.client.errors.NotImplementedException;
+import cc.kune.common.client.tooltip.Tooltip;
import cc.kune.common.shared.utils.TextUtils;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Widget;
public abstract class AbstractGuiItem extends Composite implements GuiBinding {
protected GuiActionDescrip descriptor;
+ protected Tooltip tooltip;
public AbstractGuiItem() {
super();
@@ -116,13 +120,13 @@
// the action, if not we only pass the menuitem
return descriptor.hasTarget() ? descriptor.getTarget()
: descriptor.isChild() ? descriptor.getParent().getTarget() : ActionEvent.NO_TARGET;
- };
+ }
private void setDropTarget(final DropTarget dropTarget) {
if (dropTarget != null) {
dropTarget.init(this);
}
- }
+ };
protected abstract void setEnabled(boolean enabled);
@@ -170,8 +174,20 @@
protected abstract void setText(String text);
- protected abstract void setToolTipText(String text);
+ public void setToolTipText(final String tooltipText) {
+ if (shouldBeAdded()) {
+ setToolTipTextNextTo(getWidget(), tooltipText);
+ }
+ }
+ public void setToolTipTextNextTo(final Widget widget, final String tooltipText) {
+ if (tooltipText != null && !tooltipText.isEmpty()) {
+ final KeyStroke key = (KeyStroke) descriptor.getValue(Action.ACCELERATOR_KEY);
+ final String compountTooltip = key == null ? tooltipText : tooltipText + key.toString();
+ tooltip = Tooltip.to(widget, compountTooltip);
+ }
+ }
+
private void setVisible(final Boolean visible) {
// if you have problems with setVisible check if the GuiItem calls
// configureItemFromProperties on creation
@@ -183,8 +199,13 @@
return true;
}
- protected void toogleTooltipVisible() {
- // do nothing by default
- return;
+ public void toogleTooltipVisible() {
+ if (tooltip != null) {
+ if (tooltip.isVisibleOrWillBe()) {
+ tooltip.hide();
+ } else {
+ tooltip.showTemporally();
+ }
+ }
}
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -27,6 +27,8 @@
import cc.kune.common.client.actions.ActionEvent;
import cc.kune.common.client.actions.ChangeableObject;
import cc.kune.common.client.actions.KeyStroke;
+import cc.kune.common.client.actions.Shortcut;
+import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
import com.google.gwt.i18n.client.HasDirection.Direction;
@@ -36,7 +38,7 @@
public abstract class AbstractGuiActionDescrip extends ChangeableObject implements GuiActionDescrip {
/** The action. */
- private final AbstractAction action;
+ private AbstractAction action;
private final List<GuiAddCondition> addConditions;
@@ -178,6 +180,10 @@
return result;
}
+ public void setAction(final AbstractAction action) {
+ this.action = action;
+ }
+
@Override
public void setDropTarget(final DropTarget dropTarget) {
putValue(DROP_TARGET, dropTarget);
@@ -258,10 +264,22 @@
putValue(VISIBLE, visible);
}
+ /**
+ * Toggle the value of a boolean property
+ *
+ * @param property
+ * the property
+ */
+ protected void toggle(final String property) {
+ // Action detects changes in values, then we fire a change (whatever) to
+ // fire this method in the UI
+ final Object value = getValue(property);
+ putValue(property, value == null ? true : !((Boolean) value));
+ }
+
@Override
public void toggleTooltipVisible() {
- final Object value = getValue(TOOGLE_TOOLTIP_VISIBLE);
- putValue(TOOGLE_TOOLTIP_VISIBLE, value == null ? true : !(Boolean) value);
+ toggle(TOOGLE_TOOLTIP_VISIBLE);
}
@Override
@@ -278,6 +296,12 @@
}
@Override
+ public GuiActionDescrip withAction(final AbstractAction action) {
+ setAction(action);
+ return this;
+ }
+
+ @Override
public GuiActionDescrip withIcon(final Object icon) {
super.putValue(Action.SMALL_ICON, icon);
return this;
@@ -308,12 +332,26 @@
}
@Override
- public GuiActionDescrip withShortcut(final KeyStroke shortcut) {
+ public GuiActionDescrip withShortcut(final KeyStroke shortcut, final GlobalShortcutRegister register) {
putValue(Action.ACCELERATOR_KEY, shortcut);
+ register.put(shortcut, action);
return this;
}
@Override
+ public GuiActionDescrip withShortcut(final String keys, final GlobalShortcutRegister register) {
+ final boolean hasCtrl = keys.contains("Ctrl");
+ final boolean hasAlt = keys.contains("Alt");
+ final boolean hasMeta = keys.contains("Meta");
+ final boolean hasShift = keys.contains("Shift");
+ final Character key = keys.charAt(keys.length() - 1);
+ final KeyStroke shortcut = Shortcut.getShortcut(hasCtrl, hasAlt, hasShift, hasMeta, key);
+ putValue(Action.ACCELERATOR_KEY, shortcut);
+ register.put(shortcut, action);
+ return this;
+ }
+
+ @Override
public GuiActionDescrip withStyles(final String styles) {
setStyles(styles);
return this;
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -23,83 +23,246 @@
import cc.kune.common.client.actions.ActionEvent;
import cc.kune.common.client.actions.KeyStroke;
import cc.kune.common.client.actions.PropertyChangeListener;
+import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
import com.google.gwt.i18n.client.HasDirection.Direction;
+// TODO: Auto-generated Javadoc
+/**
+ * The Interface GuiActionDescrip.
+ */
public interface GuiActionDescrip {
+ /** The Constant DROP_TARGET. */
public static final String DROP_TARGET = "dropTarget";
+ /** The Constant NO_PARENT. */
public static final AbstractGuiActionDescrip NO_PARENT = new NoParentGuiActionDescriptor();
+ /** The Constant NO_POSITION. */
public static final int NO_POSITION = -1;
/**
- * {@link #TARGET} is used to associate a {@link #AbstractGuiActionDescrip}
- * with an object like groups, group names, users, and so on, and used to
- * execute actions against these targets
+ * The Constant TARGET. {@link #TARGET} is used to associate a
+ * {@link #AbstractGuiActionDescrip} with an object like groups, group names,
+ * users, and so on, and used to execute actions against these targets
*/
public static final String TARGET = "target";
+ /** The Constant TOOGLE_TOOLTIP_VISIBLE. */
public static final String TOOGLE_TOOLTIP_VISIBLE = "toogle-tooltip-visible";
+
+ /** The Constant VISIBLE. */
public static final String VISIBLE = "visibleprop";
+ /**
+ * Adds the.
+ *
+ * @param addCondition
+ * the add condition
+ */
void add(final GuiAddCondition addCondition);
+ /**
+ * Adds the property change listener.
+ *
+ * @param listener
+ * the listener
+ */
void addPropertyChangeListener(final PropertyChangeListener listener);
+ /**
+ * Fire.
+ *
+ * @param event
+ * the event
+ */
void fire(final ActionEvent event);
+ /**
+ * Gets the action.
+ *
+ * @return the action
+ */
AbstractAction getAction();
+ /**
+ * Gets the direction.
+ *
+ * @return the direction
+ */
Direction getDirection();
+ /**
+ * Gets the id.
+ *
+ * @return the id
+ */
String getId();
+ /**
+ * Gets the keys.
+ *
+ * @return the keys
+ */
Object[] getKeys();
+ /**
+ * Gets the location.
+ *
+ * @return the location
+ */
String getLocation();
+ /**
+ * Gets the parent.
+ *
+ * @return the parent
+ */
GuiActionDescrip getParent();
+ /**
+ * Gets the position.
+ *
+ * @return the position
+ */
int getPosition();
+ /**
+ * Gets the property change listeners.
+ *
+ * @return the property change listeners
+ */
PropertyChangeListener[] getPropertyChangeListeners();
+ /**
+ * Gets the target.
+ *
+ * @return the target
+ */
Object getTarget();
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
Class<?> getType();
+ /**
+ * Gets the value.
+ *
+ * @param key
+ * the key
+ * @return the value
+ */
Object getValue(final String key);
+ /**
+ * Checks for target.
+ *
+ * @return true, if successful
+ */
boolean hasTarget();
+ /**
+ * Checks if is child.
+ *
+ * @return true, if is child
+ */
boolean isChild();
+ /**
+ * Checks if is enabled.
+ *
+ * @return true, if is enabled
+ */
boolean isEnabled();
+ /**
+ * Checks if is rTL.
+ *
+ * @return true, if is rTL
+ */
boolean isRTL();
+ /**
+ * Checks if is visible.
+ *
+ * @return true, if is visible
+ */
boolean isVisible();
+ /**
+ * Must be added.
+ *
+ * @return true, if successful
+ */
boolean mustBeAdded();
+ /**
+ * Put value.
+ *
+ * @param key
+ * the key
+ * @param value
+ * the value
+ */
public void putValue(final String key, final Object value);
+ /**
+ * Removes the property change listener.
+ *
+ * @param listener
+ * the listener
+ */
void removePropertyChangeListener(final PropertyChangeListener listener);
+ /**
+ * Sets the drop target.
+ *
+ * @param dropTarget
+ * the new drop target
+ */
void setDropTarget(DropTarget dropTarget);
+ /**
+ * Sets the enabled.
+ *
+ * @param enabled
+ * the new enabled
+ */
void setEnabled(final boolean enabled);
+ /**
+ * Sets the id.
+ *
+ * @param id
+ * the new id
+ */
void setId(final String id);
+ /**
+ * Sets the location.
+ *
+ * @param location
+ * the new location
+ */
void setLocation(final String location);
+ /**
+ * Sets the parent.
+ *
+ * @param parent
+ * the new parent
+ */
void setParent(final GuiActionDescrip parent);
/**
+ * Sets the parent.
+ *
* @param parent
+ * the parent
* @param addToParent
* if yes, the action will be added directly to the parent, useful to
* attach menu items (or other child actions) directly to its parent
@@ -108,42 +271,156 @@
*/
void setParent(GuiActionDescrip parent, boolean addToParent);
+ /**
+ * Sets the position.
+ *
+ * @param position
+ * the new position
+ */
void setPosition(final int position);
+ /**
+ * Sets the rTL.
+ *
+ * @param isRTL
+ * the new rTL
+ */
void setRTL(final boolean isRTL);
+ /**
+ * Sets the styles.
+ *
+ * @param styles
+ * the new styles
+ */
void setStyles(final String styles);
+ /**
+ * Sets the target.
+ *
+ * @param object
+ * the new target
+ */
void setTarget(final Object object);
+ /**
+ * Sets the visible.
+ *
+ * @param visible
+ * the new visible
+ */
void setVisible(final boolean visible);
+ /**
+ * Toggle tooltip visible.
+ */
void toggleTooltipVisible();
+ /**
+ * Toogle visible.
+ */
void toogleVisible();
+ /**
+ * With action.
+ *
+ * @param action
+ * the action
+ * @return the gui action descrip
+ */
+ GuiActionDescrip withAction(AbstractAction action);
+
+ /**
+ * With icon.
+ *
+ * @param icon
+ * the icon
+ * @return the gui action descrip
+ */
GuiActionDescrip withIcon(Object icon);
+ /**
+ * With icon cls.
+ *
+ * @param icon
+ * the icon
+ * @return the gui action descrip
+ */
GuiActionDescrip withIconCls(String icon);
+ /**
+ * With id.
+ *
+ * @param id
+ * the id
+ * @return the gui action descrip
+ */
GuiActionDescrip withId(String id);
+ /**
+ * With parent.
+ *
+ * @param parent
+ * the parent
+ * @return the gui action descrip
+ */
GuiActionDescrip withParent(GuiActionDescrip parent);
/**
+ * With parent.
+ *
* @param parent
+ * the parent
* @param addToParent
* if yes, the action will be added directly to the parent, useful to
* attach menu items (or other child actions) directly to its parent
* without any other check (for instance session status, etc)
+ * @return the gui action descrip
*/
GuiActionDescrip withParent(GuiActionDescrip parent, boolean addToParent);
- GuiActionDescrip withShortcut(KeyStroke keystroke);
+ /**
+ * With shortcut.
+ *
+ * @param keystroke
+ * the keystroke
+ * @return the gui action descrip
+ */
+ GuiActionDescrip withShortcut(KeyStroke keystroke, GlobalShortcutRegister register);
+ /**
+ * With shortcut.
+ *
+ * @param keys
+ * the keys (for instance "Ctrl+A")
+ * @return the gui action descrip
+ */
+ GuiActionDescrip withShortcut(String keys, GlobalShortcutRegister register);
+
+ /**
+ * With styles.
+ *
+ * @param styles
+ * the styles
+ * @return the gui action descrip
+ */
GuiActionDescrip withStyles(String styles);
+ /**
+ * With text.
+ *
+ * @param text
+ * the text
+ * @return the gui action descrip
+ */
GuiActionDescrip withText(String text);
+ /**
+ * With tool tip.
+ *
+ * @param tooltip
+ * the tooltip
+ * @return the gui action descrip
+ */
GuiActionDescrip withToolTip(String tooltip);
}
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 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuDescriptor.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -31,7 +31,10 @@
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";
+ protected static final String MENU_RIGHTICON = "menurighticon";
+ public static final String MENU_SELECT_ITEM = "menuselitem";
+ public static final String MENU_SELECTION_DOWN = "menuseldown";
+ public static final String MENU_SELECTION_UP = "menuselup";
public static final String MENU_SHOW = "showmenu";
public static final String MENU_SHOW_NEAR_TO = "showmenunearto";
protected static final String MENU_STANDALONE = "menustandalone";
@@ -51,6 +54,8 @@
putValue(MENU_SHOW, false);
putValue(MENU_CLEAR, false);
putValue(MENU_STANDALONE, false);
+ putValue(MENU_SELECTION_DOWN, false);
+ putValue(MENU_SELECTION_UP, false);
}
public MenuDescriptor(final String text) {
@@ -75,9 +80,7 @@
@Override
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)));
+ toggle(MENU_CLEAR);
super.clear();
}
@@ -91,13 +94,25 @@
}
public void hide() {
- putValue(MENU_HIDE, !((Boolean) getValue(MENU_HIDE)));
+ toggle(MENU_HIDE);
}
public boolean isStandalone() {
return (Boolean) super.getValue(MENU_STANDALONE);
}
+ public void moveSelectionDown() {
+ toggle(MENU_SELECTION_DOWN);
+ }
+
+ public void moveSelectionUp() {
+ toggle(MENU_SELECTION_UP);
+ }
+
+ public void selectMenu(final MenuItemDescriptor item) {
+ putValue(MENU_SELECT_ITEM, item);
+ }
+
public void setMenuPosition(final Position position) {
putValue(MENU_SHOW_NEAR_TO, position);
}
@@ -125,7 +140,7 @@
* Show the menu (remember to set the menu position before)
*/
public void show() {
- putValue(MENU_SHOW, !((Boolean) getValue(MENU_SHOW)));
+ toggle(MENU_SHOW);
}
/**
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuItemDescriptor.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuItemDescriptor.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuItemDescriptor.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -23,6 +23,8 @@
public class MenuItemDescriptor extends AbstractGuiActionDescrip {
+ public static String UI = "menuitem-ui";
+
public static MenuItemDescriptor build(final AbstractAction action) {
return new MenuItemDescriptor(action);
}
Added: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuShowAction.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuShowAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuShowAction.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -0,0 +1,23 @@
+package cc.kune.common.client.actions.ui.descrip;
+
+import cc.kune.common.client.actions.AbstractExtendedAction;
+import cc.kune.common.client.actions.ActionEvent;
+
+import com.google.inject.Singleton;
+
+ at Singleton
+public class MenuShowAction extends AbstractExtendedAction {
+
+ private MenuDescriptor menu;
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ menu.show();
+ menu.moveSelectionDown();
+ }
+
+ public void setMenu(final MenuDescriptor menu) {
+ this.menu = menu;
+ }
+
+}
\ No newline at end of file
Added: trunk/src/main/java/cc/kune/common/client/log/EventBusWithoutLogging.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/log/EventBusWithoutLogging.java (rev 0)
+++ trunk/src/main/java/cc/kune/common/client/log/EventBusWithoutLogging.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -0,0 +1,30 @@
+/*
+ *
+ * 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.common.client.log;
+
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.SimpleEventBus;
+
+public class EventBusWithoutLogging extends SimpleEventBus {
+ @Override
+ public void fireEvent(final GwtEvent<?> event) {
+ super.fireEvent(event);
+ }
+}
Modified: trunk/src/main/java/cc/kune/common/public/gxt/css/gxt-all.css
===================================================================
--- trunk/src/main/java/cc/kune/common/public/gxt/css/gxt-all.css 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/public/gxt/css/gxt-all.css 2012-03-23 17:43:04 UTC (rev 1776)
@@ -1,4 +1,4 @@
-html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}img,body,html{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;}q:before,q:after{content:'';}
+html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}img,body,html{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{/* font-size:100%; */}q:before,q:after{content:'';}
.x-contrast-test {
background: url(../images/default/s.gif);
visibility: hidden;
Modified: trunk/src/main/java/cc/kune/common/public/kune-common.css
===================================================================
--- trunk/src/main/java/cc/kune/common/public/kune-common.css 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/common/public/kune-common.css 2012-03-23 17:43:04 UTC (rev 1776)
@@ -1,10 +1,10 @@
/* Here the styles of cc.kune.commom (reused by other projects like gadgets and so on) */
.k-popup-top-centered {
-
+
}
.k-popup-bottom-centered { /* z-index:100000; */
-
+
}
.k-floatleft,.k-fl {
@@ -21,24 +21,24 @@
}
.k-opacity80 {
- kfilter: alpha(opacity =
- 80);
+ kfilter: alpha(opacity =
+ 80);
-moz-opacity: 0.80;
-khtml-opacity: 0.80;
opacity: 0.80;
}
.k-opacity90 {
- kfilter: alpha(opacity =
- 90);
+ kfilter: alpha(opacity =
+ 90);
-moz-opacity: 0.90;
-khtml-opacity: 0.90;
opacity: 0.90;
}
.k-opacity95 {
- kfilter: alpha(opacity =
- 95);
+ kfilter: alpha(opacity =
+ 95);
-moz-opacity: 0.95;
-khtml-opacity: 0.95;
opacity: 0.95;
@@ -46,8 +46,8 @@
.gwt-PopupPanelGlass {
background-color: #f7ebe3 !important;
- kfilter: alpha(opacity =
- 68) !important;
+ kfilter: alpha(opacity =
+ 68) !important;
-moz-opacity: 0.68 !important;
-khtml-opacity: 0.68 !important;
opacity: 0.68 !important;
@@ -166,7 +166,7 @@
}
.k-dialog-btn-area div { /* margin: 10px */
-
+
}
.k-dialog-btn {
@@ -185,13 +185,13 @@
}
.k-dialog-close-btn-dialog {
- top: -26px;
+ top: -26px;
left: 1px;
}
.k-dialog-close-btn-normal {
top: 10px;
- left: 0px;
+ left: 0px;
}
.k-dialog-firstBtn {
@@ -316,7 +316,7 @@
-webkit-border-bottom-left-radius: 5px;
-moz-border-radius-bottomleft: 5px;
border-bottom-left-radius: 5px;
- kfilter: alpha(opacity = 90);
+ kfilter: alpha(opacity = 90);
-moz-opacity: 0.90;
-khtml-opacity: 0.90;
opacity: 0.90;
@@ -498,7 +498,7 @@
.k-iconlabel-right {
float: left;
- /* margin-left: 5px; */
+ /* margin-left: 5px; */
}
.k-menuimtem-title {
@@ -514,7 +514,6 @@
margin-top: 4px;
}
-
.gwt-MenuBar-vertical .subMenuIcon-selected {
background: none repeat scroll 0 0 #808080;
}
@@ -569,13 +568,13 @@
_border-left-color: pink;
_border-bottom-color: pink;
_border-right-color: pink;
- _filter: chroma(color = pink);
+ _filter: chroma(color = pink);
}
/* end tooltip */
/* tabbar */
.gwt-DecoratedTabBar {
-
+
}
.gwt-DecoratedTabBar .gwt-TabBarFirst {
@@ -583,7 +582,7 @@
}
.gwt-DecoratedTabBar .gwt-TabBarRest {
-
+
}
.gwt-DecoratedTabBar .gwt-TabBarItem {
@@ -725,4 +724,36 @@
-webkit-border-radius: 3px;
border-radius: 3px;
padding: 3px;
-}
\ No newline at end of file
+}
+
+/* Menu separators */
+
+.gwt-MenuBar-horizontal .gwt-MenuItemSeparator {
+ width: 1px;
+ padding: 0px;
+ margin: 0px;
+ border: 0px;
+ border-left: 1px solid #888888;
+ background: white;
+}
+
+.gwt-MenuBar-horizontal .gwt-MenuItemSeparator .menuSeparatorInner {
+ width: 1px;
+ height: 1px;
+ background: white;
+}
+
+.gwt-MenuBar-vertical .gwt-MenuItemSeparator {
+ padding: 2px 0px;
+}
+
+.gwt-MenuBar-vertical .gwt-MenuItemSeparator .menuSeparatorInner {
+ height: 1px;
+ padding: 0px;
+ border: 0px;
+ border-top: 1px solid #777777;
+ background: #ddddee;
+ overflow: hidden;
+}
+
+/* END Menu separators */
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -32,6 +32,8 @@
import cc.kune.core.client.actions.ActionRegistryByType;
import cc.kune.core.client.actions.xml.XMLActionsParser;
import cc.kune.core.client.auth.AnonUsersManager;
+import cc.kune.core.client.auth.LoginRememberManager;
+import cc.kune.core.client.auth.LoginRememberManagerImpl;
import cc.kune.core.client.auth.Register;
import cc.kune.core.client.auth.RegisterPanel;
import cc.kune.core.client.auth.RegisterPresenter;
@@ -41,8 +43,6 @@
import cc.kune.core.client.auth.SignInPresenter;
import cc.kune.core.client.auth.SignInPresenter.SignInView;
import cc.kune.core.client.auth.UserFieldFactory;
-import cc.kune.core.client.auth.LoginRememberManager;
-import cc.kune.core.client.auth.LoginRememberManagerImpl;
import cc.kune.core.client.cookies.CookiesManager;
import cc.kune.core.client.cookies.CookiesManagerImpl;
import cc.kune.core.client.dnd.KuneDragController;
@@ -69,12 +69,13 @@
import cc.kune.core.client.rpcservices.ContentServiceHelper;
import cc.kune.core.client.rpcservices.SocialNetServiceHelper;
import cc.kune.core.client.sitebar.ErrorsDialog;
+import cc.kune.core.client.sitebar.MyGroupsMenu;
import cc.kune.core.client.sitebar.SiteUserOptions;
import cc.kune.core.client.sitebar.SiteUserOptionsPresenter;
import cc.kune.core.client.sitebar.SitebarActions;
import cc.kune.core.client.sitebar.SitebarActionsPanel;
import cc.kune.core.client.sitebar.SitebarActionsPresenter;
-import cc.kune.core.client.sitebar.SitebarNewGroupLink;
+import cc.kune.core.client.sitebar.SitebarGroupsLink;
import cc.kune.core.client.sitebar.SitebarSignInLink;
import cc.kune.core.client.sitebar.SitebarSignOutLink;
import cc.kune.core.client.sitebar.SitebarSignOutLink.BeforeSignOut;
@@ -237,9 +238,10 @@
s(ContentServiceHelper.class);
s(SocialNetServiceHelper.class);
+ s(MyGroupsMenu.class);
s(SiteUserOptionsPresenter.class);
s(SiteUserOptions.class, SiteUserOptionsPresenter.class);
- s(SitebarNewGroupLink.class);
+ s(SitebarGroupsLink.class);
s(SitebarSignInLink.class);
s(SitebarSignOutLink.class);
@@ -247,5 +249,4 @@
s(XMLActionsParser.class);
s(Services.class, GWTServices.class);
}
-
}
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignInForm.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInForm.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInForm.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -50,6 +50,15 @@
* >this</a>.
*/
public SignInForm(final I18nTranslationService i18n) {
+ final Listener<FieldEvent> enterListener = new Listener<FieldEvent>() {
+ @Override
+ public void handleEvent(final FieldEvent fe) {
+ if (fe.getEvent().getKeyCode() == 13) {
+ onAcceptCallback.onSuccess();
+ }
+ }
+ };
+
super.addStyleName("kune-Margin-Large-trbl");
loginNickOrEmailField = new TextField<String>() {
@Override
@@ -70,6 +79,7 @@
loginNickOrEmailField.render(RootPanel.get(LOGIN_ID).getElement());
ComponentHelper.doAttach(loginNickOrEmailField);
super.add(loginNickOrEmailField);
+ loginNickOrEmailField.addListener(Events.OnKeyPress, enterListener);
loginPassField = new TextField<String>() {
@Override
@@ -91,15 +101,7 @@
loginPassField.setTabIndex(101);
loginPassField.render(RootPanel.get(LOGIN_ID).getElement());
ComponentHelper.doAttach(loginPassField);
-
- loginPassField.addListener(Events.OnKeyPress, new Listener<FieldEvent>() {
- @Override
- public void handleEvent(final FieldEvent fe) {
- if (fe.getEvent().getKeyCode() == 13) {
- onAcceptCallback.onSuccess();
- }
- }
- });
+ loginPassField.addListener(Events.OnKeyPress, enterListener);
super.add(loginPassField);
}
Added: trunk/src/main/java/cc/kune/core/client/events/MyGroupsChangedEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/events/MyGroupsChangedEvent.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/events/MyGroupsChangedEvent.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -0,0 +1,55 @@
+package cc.kune.core.client.events;
+
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+public class MyGroupsChangedEvent extends GwtEvent<MyGroupsChangedEvent.MyGroupsChangedHandler> {
+
+ public interface HasMyGroupsChangedHandlers extends HasHandlers {
+ HandlerRegistration addMyGroupsChangedHandler(MyGroupsChangedHandler handler);
+ }
+
+ public interface MyGroupsChangedHandler extends EventHandler {
+ public void onMyGroupsChanged(MyGroupsChangedEvent event);
+ }
+
+ private static final Type<MyGroupsChangedHandler> TYPE = new Type<MyGroupsChangedHandler>();
+
+ public static void fire(final HasHandlers source) {
+ source.fireEvent(new MyGroupsChangedEvent());
+ }
+
+ public static Type<MyGroupsChangedHandler> getType() {
+ return TYPE;
+ }
+
+ public MyGroupsChangedEvent() {
+ }
+
+ @Override
+ protected void dispatch(final MyGroupsChangedHandler handler) {
+ handler.onMyGroupsChanged(this);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return super.equals(obj);
+ }
+
+ @Override
+ public Type<MyGroupsChangedHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "MyGroupsChangedEvent[" + "]";
+ }
+}
Modified: trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -26,6 +26,7 @@
import cc.kune.core.client.auth.SignIn;
import cc.kune.core.client.errors.GroupLongNameInUseException;
import cc.kune.core.client.errors.GroupShortNameInUseException;
+import cc.kune.core.client.events.MyGroupsChangedEvent;
import cc.kune.core.client.resources.CoreMessages;
import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
import cc.kune.core.client.rpcservices.GroupServiceAsync;
@@ -192,6 +193,9 @@
getView().hide();
reset();
getView().unMask();
+ // Add the new group to your info
+ session.getCurrentUserInfo().getGroupsIsAdmin().add(state.getGroup());
+ MyGroupsChangedEvent.fire(getEventBus());
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
@@ -201,7 +205,8 @@
@Override
public void run() {
ShowHelpContainerEvent.fire(getEventBus(), state.getStateToken().getTool());
- }}.schedule(2000);
+ }
+ }.schedule(2000);
}
});
}
Added: trunk/src/main/java/cc/kune/core/client/rpcservices/GroupServiceHelper.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/GroupServiceHelper.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/GroupServiceHelper.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -0,0 +1,15 @@
+package cc.kune.core.client.rpcservices;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class GroupServiceHelper {
+
+ @SuppressWarnings("unused")
+ private final Provider<GroupServiceAsync> groupService;
+
+ @Inject
+ public GroupServiceHelper(final Provider<GroupServiceAsync> groupService) {
+ this.groupService = groupService;
+ }
+}
Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/SocialNetServiceHelper.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/SocialNetServiceHelper.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/SocialNetServiceHelper.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -1,16 +1,21 @@
package cc.kune.core.client.rpcservices;
import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.client.utils.OnAcceptCallback;
import cc.kune.common.shared.i18n.I18nTranslationService;
+import cc.kune.core.client.events.MyGroupsChangedEvent;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.core.shared.dto.SocialNetworkDataDTO;
+import com.google.gwt.event.shared.EventBus;
import com.google.inject.Inject;
import com.google.inject.Provider;
public class SocialNetServiceHelper {
+ private final EventBus eventbus;
private final I18nTranslationService i18n;
private final Session session;
private final Provider<SocialNetServiceAsync> snServiceProvider;
@@ -18,9 +23,11 @@
@Inject
public SocialNetServiceHelper(final StateManager stateManager, final Session session,
- final I18nTranslationService i18n, final Provider<SocialNetServiceAsync> snServiceProvider) {
+ final EventBus eventbus, final I18nTranslationService i18n,
+ final Provider<SocialNetServiceAsync> snServiceProvider) {
this.stateManager = stateManager;
this.session = session;
+ this.eventbus = eventbus;
this.i18n = i18n;
this.snServiceProvider = snServiceProvider;
}
@@ -54,4 +61,28 @@
NotifyUser.info(i18n.t("Member type changed"));
stateManager.setSocialNetwork(result);
}
+
+ public void unJoinGroup(final StateToken groupToken) {
+ NotifyUser.askConfirmation(i18n.t("Leave this group"), i18n.t("Are you sure?"),
+ new OnAcceptCallback() {
+ @Override
+ public void onSuccess() {
+ NotifyUser.showProgress();
+ snServiceProvider.get().unJoinGroup(session.getUserHash(), groupToken,
+ new AsyncCallbackSimple<Void>() {
+ @Override
+ public void onSuccess(final Void result) {
+ NotifyUser.hideProgress();
+ NotifyUser.info(i18n.t("Removed as member"));
+ stateManager.refreshCurrentStateWithoutCache();
+ session.getCurrentUserInfo().getGroupsIsAdmin().remove(
+ session.getCurrentState().getGroup());
+ session.getCurrentUserInfo().getGroupsIsCollab().remove(
+ session.getCurrentState().getGroup());
+ MyGroupsChangedEvent.fire(eventbus);
+ }
+ });
+ }
+ });
+ }
}
Added: trunk/src/main/java/cc/kune/core/client/sitebar/MyGroupsMenu.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/MyGroupsMenu.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/MyGroupsMenu.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -0,0 +1,101 @@
+package cc.kune.core.client.sitebar;
+
+import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
+import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
+import cc.kune.common.client.actions.ui.descrip.MenuSeparatorDescriptor;
+import cc.kune.common.client.actions.ui.descrip.MenuShowAction;
+import cc.kune.common.client.shortcuts.GlobalShortcutRegister;
+import cc.kune.common.shared.i18n.I18nTranslationService;
+import cc.kune.core.client.events.MyGroupsChangedEvent;
+import cc.kune.core.client.events.UserSignInOrSignOutEvent;
+import cc.kune.core.client.events.UserSignInOrSignOutEvent.UserSignInOrSignOutHandler;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.services.ClientFileDownloadUtils;
+import cc.kune.core.client.sitebar.SitebarGroupsLink.SitebarNewGroupAction;
+import cc.kune.core.client.sn.actions.GotoGroupAction;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.dto.GroupDTO;
+import cc.kune.core.shared.dto.UserInfoDTO;
+
+import com.google.gwt.event.shared.EventBus;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
+ at Singleton
+public class MyGroupsMenu extends MenuDescriptor {
+ public static final String MENU_ID = "k-sitebar-my-group";
+ private final Provider<ClientFileDownloadUtils> downloadProvider;
+ private final GotoGroupAction gotoGroupAction;
+ private final SitebarNewGroupAction newGroupAction;
+ private final Session session;
+ private final SitebarActions siteOptions;
+
+ @Inject
+ public MyGroupsMenu(final I18nTranslationService i18n,
+ final Provider<ClientFileDownloadUtils> downloadProvider, final CoreResources res,
+ final Session session, final GotoGroupAction gotoGroupAction,
+ final SitebarNewGroupAction newGroupAction, final SitebarActions siteOptions,
+ final GlobalShortcutRegister global, final MenuShowAction menuShowAction, final EventBus eventBus) {
+ super(menuShowAction);
+ this.session = session;
+ this.newGroupAction = newGroupAction;
+ this.siteOptions = siteOptions;
+ // menuShowAction.setMenu(this);
+ setId(MENU_ID);
+ setParent(siteOptions.getRightToolbar());
+ setStyles("k-no-backimage, k-btn-sitebar");
+ this.downloadProvider = downloadProvider;
+ this.gotoGroupAction = gotoGroupAction;
+ withText(i18n.t("Your groups"));
+ withToolTip(i18n.t("See your groups or create a new one"));
+ withIcon(res.arrowdownsitebar());
+ withShortcut("Alt+G", global);
+ eventBus.addHandler(MyGroupsChangedEvent.getType(),
+ new MyGroupsChangedEvent.MyGroupsChangedHandler() {
+ @Override
+ public void onMyGroupsChanged(final MyGroupsChangedEvent event) {
+ regenerateMenu(session.isLogged());
+ }
+ });
+
+ session.onUserSignInOrSignOut(true, new UserSignInOrSignOutHandler() {
+ @Override
+ public void onUserSignInOrSignOut(final UserSignInOrSignOutEvent event) {
+ regenerateMenu(event.isLogged());
+ }
+ });
+
+ }
+
+ private void addPartipationToMenu(final GroupDTO group) {
+ // FIXME, better user URL in GuiDescritors...
+ final String logoImageUrl = session.getSiteUrl() + "/" + downloadProvider.get().getGroupLogo(group);
+ final MenuItemDescriptor participant = new MenuItemDescriptor(gotoGroupAction);
+ participant.setTarget(group);
+ participant.withText(group.getLongName()).withIcon(logoImageUrl).setParent(this, true);
+ }
+
+ private void regenerateMenu(final boolean isLogged) {
+ if (isLogged) {
+ if (session.userIsJoiningGroups()) {
+ MyGroupsMenu.this.clear();
+ setVisible(true);
+ final UserInfoDTO userInfoDTO = session.getCurrentUserInfo();
+ for (final GroupDTO group : userInfoDTO.getGroupsIsAdmin()) {
+ addPartipationToMenu(group);
+ }
+ for (final GroupDTO group : userInfoDTO.getGroupsIsCollab()) {
+ addPartipationToMenu(group);
+ }
+ new MenuSeparatorDescriptor(MyGroupsMenu.this);
+ new MenuItemDescriptor(MyGroupsMenu.this, newGroupAction);
+ siteOptions.refreshActions();
+ } else {
+ setVisible(false);
+ }
+ } else {
+ setVisible(false);
+ }
+ }
+}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -19,33 +19,26 @@
\*/
package cc.kune.core.client.sitebar;
-import java.util.Set;
-
import cc.kune.common.client.actions.AbstractExtendedAction;
import cc.kune.common.client.actions.Action;
import cc.kune.common.client.actions.ActionEvent;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
-import cc.kune.common.client.actions.ui.descrip.SubMenuDescriptor;
import cc.kune.common.client.actions.ui.descrip.ToolbarSeparatorDescriptor;
import cc.kune.common.client.actions.ui.descrip.ToolbarSeparatorDescriptor.Type;
import cc.kune.common.shared.i18n.I18nTranslationService;
import cc.kune.core.client.events.UserSignInEvent;
-import cc.kune.core.client.events.UserSignOutEvent;
import cc.kune.core.client.events.UserSignInEvent.UserSignInHandler;
+import cc.kune.core.client.events.UserSignOutEvent;
import cc.kune.core.client.events.UserSignOutEvent.UserSignOutHandler;
import cc.kune.core.client.resources.CoreMessages;
import cc.kune.core.client.resources.CoreResources;
-import cc.kune.core.client.services.ClientFileDownloadUtils;
-import cc.kune.core.client.sn.actions.GotoGroupAction;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.StateManager;
-import cc.kune.core.shared.dto.GroupDTO;
import cc.kune.core.shared.dto.UserInfoDTO;
import com.google.inject.Inject;
-import com.google.inject.Provider;
import com.google.inject.Singleton;
@Singleton
@@ -53,10 +46,7 @@
public static final MenuDescriptor LOGGED_USER_MENU = new MenuDescriptor();
public static final String LOGGED_USER_MENU_ID = "kune-sump-lum";
- private final Provider<ClientFileDownloadUtils> downloadProvider;
- private final GotoGroupAction gotoGroupAction;
private final I18nTranslationService i18n;
- private SubMenuDescriptor partiMenu;
private final CoreResources res;
private ToolbarSeparatorDescriptor separator;
private final Session session;
@@ -65,16 +55,13 @@
@Inject
public SiteUserOptionsPresenter(final Session session, final StateManager stateManager,
- final Provider<ClientFileDownloadUtils> downloadProvider, final I18nTranslationService i18n,
- final CoreResources img, final SitebarActions siteOptions, final GotoGroupAction gotoGroupAction) {
+ final I18nTranslationService i18n, final CoreResources img, final SitebarActions siteOptions) {
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() {
@@ -103,24 +90,12 @@
descriptor.setParent(LOGGED_USER_MENU, true);
}
- private void addPartipation(final GroupDTO group) {
- final String logoImageUrl = downloadProvider.get().getGroupLogo(group);
- final MenuItemDescriptor participant = new MenuItemDescriptor(gotoGroupAction);
- participant.setTarget(group);
- participant.putValue(Action.NAME, group.getLongName());
- participant.putValue(Action.SMALL_ICON, logoImageUrl);
- participant.setParent(partiMenu, true);
- // siteOptions.getRightToolbar().add(participant);
- }
-
private void createActions() {
LOGGED_USER_MENU.setId(LOGGED_USER_MENU_ID);
LOGGED_USER_MENU.setParent(siteOptions.getRightToolbar());
LOGGED_USER_MENU.setStyles("k-no-backimage, k-btn-sitebar");
LOGGED_USER_MENU.setRightIcon(res.arrowdownsitebar());
separator = new ToolbarSeparatorDescriptor(Type.separator, siteOptions.getRightToolbar());
- partiMenu = new SubMenuDescriptor(i18n.t("Your groups"));
- addActionImpl(partiMenu);
final AbstractExtendedAction userHomeAction = new AbstractExtendedAction() {
@Override
@@ -143,16 +118,6 @@
LOGGED_USER_MENU.setVisible(true);
LOGGED_USER_MENU.setEnabled(true);
setLoggedUserName(userInfoDTO.getShortName());
- partiMenu.clear();
- final Set<GroupDTO> groupsIsAdmin = userInfoDTO.getGroupsIsAdmin();
- final Set<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);
siteOptions.refreshActions();
}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -65,12 +65,13 @@
void showErrorDialog();
}
private static final ToolbarDescriptor LEFT_TOOLBAR = new ToolbarDescriptor();
- private static final MenuDescriptor OPTIONS_MENU = new MenuDescriptor();
+ private static final MenuDescriptor MORE_MENU = new MenuDescriptor();
private static final ToolbarDescriptor RIGHT_TOOLBAR = new ToolbarDescriptor();
public static final String SITE_OPTIONS_MENU = "kune-sop-om";
private final CommonResources commonRes;
private final I18nTranslationService i18n;
- private final Provider<SitebarNewGroupLink> newGroupLink;
+ private final Provider<MyGroupsMenu> myGroupsMenu;
+ private final Provider<SitebarGroupsLink> newGroupLink;
private final CoreResources res;
private final Provider<SitebarSignInLink> signInLink;
private final Provider<SitebarSignOutLink> signOutLink;
@@ -78,27 +79,27 @@
@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<SitebarGroupsLink> newGroupLink, final Provider<SitebarSignOutLink> signOutLink,
final Provider<SitebarSignInLink> signInLink, final CoreResources res,
- final CommonResources commonRes) {
+ final CommonResources commonRes, final Provider<MyGroupsMenu> myGroupsMenu) {
super(eventBus, view, proxy);
this.i18n = i18n;
this.newGroupLink = newGroupLink;
this.signOutLink = signOutLink;
this.signInLink = signInLink;
+ this.myGroupsMenu = myGroupsMenu;
this.res = res;
this.commonRes = commonRes;
init();
}
private MenuItemDescriptor createGotoKune() {
- final MenuItemDescriptor gotoKuneDevSite = new MenuItemDescriptor(OPTIONS_MENU,
- new AbstractAction() {
- @Override
- public void actionPerformed(final ActionEvent event) {
- KuneWindowUtils.open("http://kune.ourproject.org/");
- }
- });
+ final MenuItemDescriptor gotoKuneDevSite = new MenuItemDescriptor(MORE_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, res.kuneIcon16());
return gotoKuneDevSite;
@@ -110,7 +111,7 @@
}
public MenuDescriptor getOptionsMenu() {
- return OPTIONS_MENU;
+ return MORE_MENU;
}
@Override
@@ -119,14 +120,14 @@
}
private void init() {
- OPTIONS_MENU.withId(SITE_OPTIONS_MENU);
+ MORE_MENU.withId(SITE_OPTIONS_MENU);
}
@ProxyEvent
public void onAppStart(final AppStartEvent event) {
- OPTIONS_MENU.putValue(Action.NAME, i18n.t("More"));
- OPTIONS_MENU.putValue(Action.SMALL_ICON, res.arrowdownsitebar());
- OPTIONS_MENU.setStyles("k-no-backimage, k-btn-sitebar");
+ MORE_MENU.withText(i18n.t("More"));
+ MORE_MENU.withIcon(res.arrowdownsitebar());
+ MORE_MENU.setStyles("k-no-backimage, k-btn-sitebar");
// OPTIONS_MENU.putValue(AbstractGxtMenuGui.MENU_POSITION,
// AbstractGxtMenuGui.MenuPosition.bl);
@@ -170,17 +171,17 @@
// shortcutReg.put(shortcut, aboutAction);
signInLink.get();
- signOutLink.get();
- new ToolbarSeparatorDescriptor(Type.separator, RIGHT_TOOLBAR);
+ myGroupsMenu.get();
newGroupLink.get();
new ToolbarSeparatorDescriptor(Type.separator, RIGHT_TOOLBAR);
createGotoKune();
- MenuItemDescriptor.build(OPTIONS_MENU, bugsAction);
- MenuItemDescriptor.build(OPTIONS_MENU, errorAction);
- MenuItemDescriptor.build(OPTIONS_MENU, aboutAction);
- MenuSeparatorDescriptor.build(OPTIONS_MENU);
- MenuItemDescriptor.build(OPTIONS_MENU, wavePowered);
- OPTIONS_MENU.setParent(RIGHT_TOOLBAR);
+ MenuItemDescriptor.build(MORE_MENU, bugsAction);
+ MenuItemDescriptor.build(MORE_MENU, errorAction);
+ MenuItemDescriptor.build(MORE_MENU, aboutAction);
+ MenuSeparatorDescriptor.build(MORE_MENU);
+ MenuItemDescriptor.build(MORE_MENU, wavePowered);
+ MORE_MENU.setParent(RIGHT_TOOLBAR);
+ signOutLink.get();
refreshActionsImpl();
}
Copied: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarGroupsLink.java (from rev 1747, trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarGroupsLink.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarGroupsLink.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -0,0 +1,93 @@
+/*
+ *
+ * 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;
+
+import cc.kune.common.client.actions.AbstractExtendedAction;
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.common.shared.i18n.I18nTranslationService;
+import cc.kune.core.client.events.MyGroupsChangedEvent;
+import cc.kune.core.client.events.UserSignInOrSignOutEvent;
+import cc.kune.core.client.events.UserSignInOrSignOutEvent.UserSignInOrSignOutHandler;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.SiteTokens;
+import cc.kune.core.client.state.StateManager;
+
+import com.google.gwt.event.shared.EventBus;
+import com.google.inject.Inject;
+
+public class SitebarGroupsLink extends ButtonDescriptor {
+ public static class SitebarNewGroupAction extends AbstractExtendedAction {
+
+ private final StateManager stateManager;
+
+ @Inject
+ public SitebarNewGroupAction(final StateManager stateManager, final I18nTranslationService i18n) {
+ super();
+ this.stateManager = stateManager;
+ withText(i18n.t("Create New Group"));
+ withToolTip(i18n.t("Create a new group for your initiative or organization "
+ + "(NGO, collective, academic group...)"));
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ stateManager.gotoHistoryToken(SiteTokens.NEW_GROUP);
+ }
+ }
+
+ public static final String NEW_GROUP_BTN_ID = "k-site-newgroup-btn";
+ private final Session session;
+
+ @Inject
+ public SitebarGroupsLink(final SitebarNewGroupAction newGroupAction,
+ final SitebarActions sitebarActions, final I18nTranslationService i18n, final EventBus eventBus,
+ final CoreResources coreResources, final Session session) {
+ super(newGroupAction);
+ this.session = session;
+ withId(NEW_GROUP_BTN_ID).withStyles("k-no-backimage, k-btn-sitebar, k-fl, k-noborder, k-nobackcolor");
+ withParent(sitebarActions.getRightToolbar());
+ eventBus.addHandler(MyGroupsChangedEvent.getType(),
+ new MyGroupsChangedEvent.MyGroupsChangedHandler() {
+ @Override
+ public void onMyGroupsChanged(final MyGroupsChangedEvent event) {
+ recalculate(session.isNotLogged());
+ }
+ });
+ session.onUserSignInOrSignOut(true, new UserSignInOrSignOutHandler() {
+ @Override
+ public void onUserSignInOrSignOut(final UserSignInOrSignOutEvent event) {
+ final boolean notLogged = !event.isLogged();
+ recalculate(notLogged);
+ }
+ });
+
+ }
+
+ private void recalculate(final boolean notLogged) {
+ if (notLogged) {
+ setVisible(true);
+ } else {
+ setVisible(!session.userIsJoiningGroups());
+ }
+ }
+
+}
Deleted: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -1,62 +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;
-
-import cc.kune.common.client.actions.AbstractExtendedAction;
-import cc.kune.common.client.actions.Action;
-import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
-import cc.kune.common.shared.i18n.I18nTranslationService;
-import cc.kune.core.client.state.SiteTokens;
-import cc.kune.core.client.state.StateManager;
-
-import com.google.inject.Inject;
-
-public class SitebarNewGroupLink extends ButtonDescriptor {
- public static class SitebarNewGroupAction extends AbstractExtendedAction {
-
- private final StateManager stateManager;
-
- @Inject
- public SitebarNewGroupAction(final StateManager stateManager, final I18nTranslationService i18n) {
- super();
- this.stateManager = stateManager;
- putValue(Action.NAME, i18n.t("Create New Group"));
-
- putValue(Action.TOOLTIP, i18n.t("Create a new group for your initiative or organization "
- + "(NGO, collective, academic group...)"));
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- stateManager.gotoHistoryToken(SiteTokens.NEW_GROUP);
- }
-
- }
-
- public static final String NEW_GROUP_BTN_ID = "k-site-newgroup-btn";
-
- @Inject
- public SitebarNewGroupLink(final SitebarNewGroupAction action, final SitebarActions sitebarActions) {
- super(action);
- withId(NEW_GROUP_BTN_ID).withStyles("k-no-backimage, k-btn-sitebar, k-fl, k-noborder, k-nobackcolor");
- withParent(sitebarActions.getRightToolbar());
- }
-}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -23,10 +23,10 @@
import cc.kune.common.client.actions.Action;
import cc.kune.common.client.actions.ActionEvent;
import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
-import cc.kune.core.client.events.UserSignInEvent;
-import cc.kune.core.client.events.UserSignInEvent.UserSignInHandler;
-import cc.kune.core.client.events.UserSignOutEvent;
-import cc.kune.core.client.events.UserSignOutEvent.UserSignOutHandler;
+import cc.kune.common.client.actions.ui.descrip.ToolbarSeparatorDescriptor;
+import cc.kune.common.client.actions.ui.descrip.ToolbarSeparatorDescriptor.Type;
+import cc.kune.core.client.events.UserSignInOrSignOutEvent;
+import cc.kune.core.client.events.UserSignInOrSignOutEvent.UserSignInOrSignOutHandler;
import cc.kune.core.client.i18n.I18nUITranslationService;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.SiteTokens;
@@ -72,17 +72,15 @@
setVisible(!session.isLogged());
setStyles("k-no-backimage, k-btn-sitebar, k-fl, k-noborder, k-nobackcolor");
setParent(sitebarActions.getRightToolbar());
- session.onUserSignIn(true, new UserSignInHandler() {
+ final ToolbarSeparatorDescriptor separator = new ToolbarSeparatorDescriptor(Type.separator,
+ sitebarActions.getRightToolbar());
+ session.onUserSignInOrSignOut(true, new UserSignInOrSignOutHandler() {
@Override
- public void onUserSignIn(final UserSignInEvent event) {
- SitebarSignInLink.this.setVisible(false);
+ public void onUserSignInOrSignOut(final UserSignInOrSignOutEvent event) {
+ final boolean logged = event.isLogged();
+ SitebarSignInLink.this.setVisible(!logged);
+ separator.setVisible(!logged);
}
});
- session.onUserSignOut(true, new UserSignOutHandler() {
- @Override
- public void onUserSignOut(final UserSignOutEvent event) {
- SitebarSignInLink.this.setVisible(true);
- }
- });
}
}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignOutLink.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignOutLink.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignOutLink.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -24,19 +24,18 @@
import cc.kune.common.client.actions.ActionEvent;
import cc.kune.common.client.actions.BeforeActionCollection;
import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.common.client.actions.ui.descrip.ToolbarSeparatorDescriptor;
+import cc.kune.common.client.actions.ui.descrip.ToolbarSeparatorDescriptor.Type;
import cc.kune.common.client.errors.UIException;
import cc.kune.common.client.notify.ProgressHideEvent;
import cc.kune.common.client.notify.ProgressShowEvent;
import cc.kune.common.shared.i18n.I18nTranslationService;
import cc.kune.core.client.auth.WaveClientSimpleAuthenticator;
-import cc.kune.core.client.cookies.CookiesManager;
import cc.kune.core.client.errors.ErrorHandler;
import cc.kune.core.client.errors.SessionExpiredException;
import cc.kune.core.client.errors.UserMustBeLoggedException;
-import cc.kune.core.client.events.UserSignInEvent;
-import cc.kune.core.client.events.UserSignOutEvent;
-import cc.kune.core.client.events.UserSignInEvent.UserSignInHandler;
-import cc.kune.core.client.events.UserSignOutEvent.UserSignOutHandler;
+import cc.kune.core.client.events.UserSignInOrSignOutEvent;
+import cc.kune.core.client.events.UserSignInOrSignOutEvent.UserSignInOrSignOutHandler;
import cc.kune.core.client.rpcservices.UserServiceAsync;
import cc.kune.core.client.state.Session;
@@ -54,7 +53,6 @@
public static class SitebarSignOutAction extends AbstractExtendedAction {
private final BeforeSignOut beforeSignOut;
- private final CookiesManager cookiesManager;
private final EventBus eventBus;
private final Session session;
private final Provider<UserServiceAsync> userService;
@@ -63,13 +61,11 @@
@Inject
public SitebarSignOutAction(final EventBus eventBus, final I18nTranslationService i18n,
final BeforeSignOut beforeSignOut, final Provider<UserServiceAsync> userService,
- final Session session, final CookiesManager cookiesManager,
- final WaveClientSimpleAuthenticator waveAuth) {
+ final Session session, final WaveClientSimpleAuthenticator waveAuth) {
super();
this.eventBus = eventBus;
this.userService = userService;
this.session = session;
- this.cookiesManager = cookiesManager;
this.beforeSignOut = beforeSignOut;
this.waveAuth = waveAuth;
putValue(Action.NAME, i18n.t("Sign out"));
@@ -126,20 +122,18 @@
final ErrorHandler errorHandler, final Session session, final SitebarActions sitebarActions) {
super(action);
setId(SITE_SIGN_OUT);
+ final ToolbarSeparatorDescriptor separator = new ToolbarSeparatorDescriptor(Type.separator,
+ sitebarActions.getRightToolbar());
setParent(sitebarActions.getRightToolbar());
setVisible(session.isLogged());
setStyles("k-no-backimage, k-btn-sitebar, k-fl, k-noborder, k-nobackcolor");
- session.onUserSignIn(true, new UserSignInHandler() {
+ session.onUserSignInOrSignOut(true, new UserSignInOrSignOutHandler() {
@Override
- public void onUserSignIn(final UserSignInEvent event) {
- SitebarSignOutLink.this.setVisible(true);
+ public void onUserSignInOrSignOut(final UserSignInOrSignOutEvent event) {
+ final boolean logged = event.isLogged();
+ SitebarSignOutLink.this.setVisible(logged);
+ separator.setVisible(logged);
}
});
- session.onUserSignOut(true, new UserSignOutHandler() {
- @Override
- public void onUserSignOut(final UserSignOutEvent event) {
- SitebarSignOutLink.this.setVisible(false);
- }
- });
}
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -26,6 +26,7 @@
import cc.kune.common.shared.i18n.I18nTranslationService;
import cc.kune.common.shared.utils.SimpleResponseCallback;
import cc.kune.core.client.auth.SignIn;
+import cc.kune.core.client.events.MyGroupsChangedEvent;
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
import cc.kune.core.client.rpcservices.SocialNetServiceAsync;
@@ -37,20 +38,23 @@
import cc.kune.core.shared.dto.AccessRolDTO;
import cc.kune.core.shared.dto.SocialNetworkRequestResult;
+import com.google.gwt.event.shared.EventBus;
import com.google.inject.Inject;
import com.google.inject.Provider;
public class JoinGroupAction extends SNRolAction {
+ private final EventBus eventBus;
private final Provider<SignIn> signIn;
@Inject
public JoinGroupAction(final StateManager stateManager, final Session session,
- final I18nTranslationService i18n, final CoreResources res,
+ final I18nTranslationService i18n, final CoreResources res, final EventBus eventBus,
final Provider<SocialNetServiceAsync> snServiceProvider, final Provider<SignIn> signIn,
final AccessRightsClientManager rightsClientManager) {
super(stateManager, session, i18n, res, snServiceProvider, rightsClientManager, AccessRolDTO.Viewer,
false, true, false);
+ this.eventBus = eventBus;
this.signIn = signIn;
putValue(NAME, i18n.t("Join"));
putValue(TOOLTIP, i18n.t("Request to Join in this group"));
@@ -80,6 +84,9 @@
switch ((result)) {
case accepted:
NotifyUser.info(i18n.t("You are now member of this group"));
+ session.getCurrentUserInfo().getGroupsIsCollab().add(
+ session.getCurrentState().getGroup());
+ MyGroupsChangedEvent.fire(eventBus);
stateManager.refreshCurrentStateWithoutCache();
break;
case denied:
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -21,12 +21,10 @@
import cc.kune.common.client.actions.Action;
import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.notify.NotifyUser;
-import cc.kune.common.client.utils.OnAcceptCallback;
import cc.kune.common.shared.i18n.I18nTranslationService;
import cc.kune.core.client.resources.CoreResources;
-import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
import cc.kune.core.client.rpcservices.SocialNetServiceAsync;
+import cc.kune.core.client.rpcservices.SocialNetServiceHelper;
import cc.kune.core.client.state.AccessRightsClientManager;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.StateManager;
@@ -36,14 +34,17 @@
import com.google.inject.Provider;
public class UnJoinFromCurrentGroupAction extends SNRolAction {
+ private final Provider<SocialNetServiceHelper> snServiceHelper;
@Inject
public UnJoinFromCurrentGroupAction(final StateManager stateManager, final Session session,
final I18nTranslationService i18n, final CoreResources res,
- final Provider<SocialNetServiceAsync> snServiceProvider,
- final AccessRightsClientManager rightsClientManager) {
- super(stateManager, session, i18n, res, snServiceProvider, rightsClientManager, AccessRolDTO.Editor,
- true, false, true);
+ final Provider<SocialNetServiceHelper> snServiceHelper,
+ final AccessRightsClientManager rightsClientManager,
+ final Provider<SocialNetServiceAsync> snService) {
+ super(stateManager, session, i18n, res, snService, rightsClientManager, AccessRolDTO.Editor, true,
+ false, true);
+ this.snServiceHelper = snServiceHelper;
putValue(NAME, i18n.t("Leave this group"));
// putValue(TOOLTIP, i18n.t("I want to leave this group"));
putValue(Action.SMALL_ICON, res.del());
@@ -52,22 +53,7 @@
@Override
public void actionPerformed(final ActionEvent event) {
- NotifyUser.askConfirmation(i18n.t("Leave this group"), i18n.t("Are you sure?"),
- new OnAcceptCallback() {
- @Override
- public void onSuccess() {
- NotifyUser.showProgress();
- snServiceProvider.get().unJoinGroup(session.getUserHash(),
- session.getCurrentState().getStateToken(), new AsyncCallbackSimple<Void>() {
- @Override
- public void onSuccess(final Void result) {
- NotifyUser.hideProgress();
- NotifyUser.info(i18n.t("Removed as member"));
- stateManager.refreshCurrentStateWithoutCache();
- }
- });
- }
- });
+ snServiceHelper.get().unJoinGroup(session.getCurrentState().getStateToken());
}
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -21,16 +21,11 @@
import cc.kune.common.client.actions.Action;
import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.notify.NotifyUser;
-import cc.kune.common.client.utils.OnAcceptCallback;
import cc.kune.common.shared.i18n.I18nTranslationService;
import cc.kune.core.client.actions.RolAction;
import cc.kune.core.client.resources.CoreResources;
-import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
-import cc.kune.core.client.rpcservices.SocialNetServiceAsync;
+import cc.kune.core.client.rpcservices.SocialNetServiceHelper;
import cc.kune.core.client.state.AccessRightsClientManager;
-import cc.kune.core.client.state.Session;
-import cc.kune.core.client.state.StateManager;
import cc.kune.core.shared.dto.AccessRolDTO;
import cc.kune.core.shared.dto.GroupDTO;
@@ -44,20 +39,13 @@
*/
public class UnJoinFromThisGroupAction extends RolAction {
- private final I18nTranslationService i18n;
- private final Session session;
- private final Provider<SocialNetServiceAsync> snServiceProvider;
- private final StateManager stateManager;
+ private final Provider<SocialNetServiceHelper> snServiceProvider;
@Inject
- public UnJoinFromThisGroupAction(final StateManager stateManager, final Session session,
- final I18nTranslationService i18n, final CoreResources res,
- final Provider<SocialNetServiceAsync> snServiceProvider,
+ public UnJoinFromThisGroupAction(final I18nTranslationService i18n, final CoreResources res,
+ final Provider<SocialNetServiceHelper> snServiceProvider,
final AccessRightsClientManager rightsClientManager) {
super(AccessRolDTO.Editor, true);
- this.stateManager = stateManager;
- this.session = session;
- this.i18n = i18n;
this.snServiceProvider = snServiceProvider;
putValue(NAME, i18n.t("Leave this group"));
// putValue(TOOLTIP, i18n.t("I want to leave this group"));
@@ -67,22 +55,7 @@
@Override
public void actionPerformed(final ActionEvent event) {
- NotifyUser.askConfirmation(i18n.t("Leave this group"), i18n.t("Are you sure?"),
- new OnAcceptCallback() {
- @Override
- public void onSuccess() {
- NotifyUser.showProgress();
- snServiceProvider.get().unJoinGroup(session.getUserHash(),
- ((GroupDTO) event.getTarget()).getStateToken(), new AsyncCallbackSimple<Void>() {
- @Override
- public void onSuccess(final Void result) {
- NotifyUser.hideProgress();
- NotifyUser.info(i18n.t("Removed as member"));
- stateManager.refreshCurrentStateWithoutCache();
- }
- });
- }
- });
+ snServiceProvider.get().unJoinGroup(((GroupDTO) event.getTarget()).getStateToken());
}
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/state/Session.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/Session.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/core/client/state/Session.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -161,4 +161,11 @@
void signOut();
+ /**
+ * User is joining to some groups (as admin or collaborator).
+ *
+ * @return true, if successful
+ */
+ boolean userIsJoiningGroups();
+
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/state/impl/SessionDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/impl/SessionDefault.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/java/cc/kune/core/client/state/impl/SessionDefault.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -376,4 +376,9 @@
setUserHash(null);
setCurrentUserInfo(null, null);
}
+
+ @Override
+ public boolean userIsJoiningGroups() {
+ return currentUserInfo.getGroupsIsAdmin().size() + currentUserInfo.getGroupsIsCollab().size() > 0;
+ }
}
Added: trunk/src/main/webapp/css/reset.css
===================================================================
--- trunk/src/main/webapp/css/reset.css (rev 0)
+++ trunk/src/main/webapp/css/reset.css 2012-03-23 17:43:04 UTC (rev 1776)
@@ -0,0 +1,7 @@
+/*
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 2.8.0r4
+*/
+html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var,optgroup{font-style:inherit;font-weight:inherit;}del,ins{text-decoration:none;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:baseline;}sub{vertical-align:baseline;}legend{color:#000;}input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;}input,button,textarea,select{*font-size:100%;}
Modified: trunk/src/main/webapp/others/splash/style/main.css
===================================================================
--- trunk/src/main/webapp/others/splash/style/main.css 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/webapp/others/splash/style/main.css 2012-03-23 17:43:04 UTC (rev 1776)
@@ -87,12 +87,6 @@
}
h1 {
- float: left;
- width: 180px;
- height: 43px;
- margin: 6px 10px 0 10px;
- background-image: url(../images/logo_on_black.png);
- background-repeat: no-repeat;
}
h1 a {
Modified: trunk/src/main/webapp/ws.html
===================================================================
--- trunk/src/main/webapp/ws.html 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/main/webapp/ws.html 2012-03-23 17:43:04 UTC (rev 1776)
@@ -33,8 +33,6 @@
<meta name="hablar.width" content="550px" />
<meta name="hablar.height" content="400px" />
<link rel="shortcut icon" href="ws/favicon.ico" />
-<link rel="stylesheet" type="text/css"
- href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css">
<!-- FIXME: make something local -->
<script type="text/javascript">
WebFontConfig = {
@@ -55,8 +53,7 @@
<link
href='http://fonts.googleapis.com/css?family=Ubuntu:regular,italic,bold,bolditalic'
rel='stylesheet' type='text/css'>
-<!-- <link href='http://fonts.googleapis.com/css?family=Inconsolata'
- rel='stylesheet' type='text/css'> -->
+<link type="text/css" rel="stylesheet" href="css/reset.css">
<link type="text/css" rel="stylesheet" href="ws/gxt/css/gxt-all.css">
<link type="text/css" rel="stylesheet" href="ws/gxt/css/gxt-gray.css">
<link type="text/css" rel="stylesheet"
Modified: trunk/src/test/java/cc/kune/selenium/spaces/SitePageObject.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/spaces/SitePageObject.java 2012-03-21 17:42:15 UTC (rev 1775)
+++ trunk/src/test/java/cc/kune/selenium/spaces/SitePageObject.java 2012-03-23 17:43:04 UTC (rev 1776)
@@ -23,7 +23,7 @@
import org.openqa.selenium.support.FindBy;
import cc.kune.core.client.notify.confirm.UserConfirmPanel;
-import cc.kune.core.client.sitebar.SitebarNewGroupLink;
+import cc.kune.core.client.sitebar.SitebarGroupsLink;
import cc.kune.core.client.sitebar.search.SitebarSearchPanel;
import cc.kune.core.client.sitebar.spaces.SpaceSelectorPresenter.SpaceSelectorView;
import cc.kune.selenium.PageObject;
@@ -39,7 +39,7 @@
public WebElement groupSpaceBtn;
@FindBy(id = SeleniumConstants.GWTDEV + SpaceSelectorView.HOME_SPACE_ID)
public WebElement homeSpaceBtn;
- @FindBy(id = SeleniumConstants.GWTDEV + SitebarNewGroupLink.NEW_GROUP_BTN_ID)
+ @FindBy(id = SeleniumConstants.GWTDEV + SitebarGroupsLink.NEW_GROUP_BTN_ID)
public WebElement newGroupBtn;
@FindBy(id = SeleniumConstants.GWTDEV + SpaceSelectorView.PUBLIC_SPACE_ID)
public WebElement publicSpaceBtn;
More information about the kune-commits
mailing list