[kune-commits] r1343 - in trunk/src/main/java/cc/kune: common/client/actions/gwtui common/client/actions/gxtui common/client/actions/ui common/client/ui common/public core/client/services core/client/sitebar core/client/sn core/client/sn/actions/registry wave/client
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Thu May 5 04:24:51 CEST 2011
Author: vjrj_
Date: 2011-05-05 04:24:50 +0200 (Thu, 05 May 2011)
New Revision: 1343
Modified:
trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.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/AbstractGxtMenuGui.java
trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuItemGui.java
trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuGui.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/ui/IconLabel.java
trunk/src/main/java/cc/kune/common/public/kune-common.css
trunk/src/main/java/cc/kune/core/client/services/FileDownloadUtils.java
trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java
trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPresenter.java
trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java
trunk/src/main/java/cc/kune/wave/client/WebClient.java
Log:
Some style fixes
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 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -123,6 +123,12 @@
layout();
}
+ @Override
+ public void setIconUrl(final String url) {
+ iconLabel.setLeftIconUrl(url);
+ layout();
+ }
+
public void setPressed(final boolean pressed) {
final ToggleButton toggleButton = (ToggleButton) button;
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -192,6 +192,12 @@
layout();
}
+ @Override
+ public void setIconUrl(final String url) {
+ iconLabel.setRightIconUrl(url);
+ layout();
+ }
+
private void setRadioChecked(final Boolean checked) {
iconLabel.setLeftIconResource(checked ? res.radioChecked() : res.radioUnChecked());
}
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 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtIconLabelGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -81,6 +81,11 @@
}
@Override
+ public void setIconUrl(final String url) {
+ iconLabel.setLeftIconUrl(url);
+ }
+
+ @Override
public void setText(final String text) {
iconLabel.setText(text);
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -114,6 +114,14 @@
}
@Override
+ public void setIconUrl(final String url) {
+ if (notStandAlone) {
+ iconLabel.setLeftIconUrl(url);
+ layout();
+ }
+ }
+
+ @Override
public void setText(final String text) {
if (notStandAlone) {
iconLabel.setText(text);
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 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuSeparatorGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -26,34 +26,40 @@
public class GwtMenuSeparatorGui extends AbstractGuiItem {
- @Override
- public AbstractGuiItem create(final GuiActionDescrip descriptor) {
- final AbstractGwtMenuGui menu = ((AbstractGwtMenuGui) descriptor.getParent().getValue(ParentWidget.PARENT_UI));
- if (menu == null) {
- throw new UIException("To add a menu separator you need to add the menu before. Item: " + descriptor);
- }
- menu.addSeparator();
- return menu;
+ @Override
+ public AbstractGuiItem create(final GuiActionDescrip descriptor) {
+ final AbstractGwtMenuGui menu = ((AbstractGwtMenuGui) descriptor.getParent().getValue(
+ ParentWidget.PARENT_UI));
+ if (menu == null) {
+ throw new UIException("To add a menu separator you need to add the menu before. Item: "
+ + descriptor);
}
+ menu.addSeparator();
+ return menu;
+ }
- @Override
- protected void setEnabled(final boolean enabled) {
- }
+ @Override
+ protected void setEnabled(final boolean enabled) {
+ }
- @Override
- protected void setIconStyle(final String style) {
- }
+ @Override
+ protected void setIconStyle(final String style) {
+ }
- @Override
- protected void setText(final String text) {
- }
+ @Override
+ public void setIconUrl(final String url) {
+ }
- @Override
- protected void setToolTipText(final String text) {
- }
+ @Override
+ protected void setText(final String text) {
+ }
- @Override
- public boolean shouldBeAdded() {
- return false;
- }
+ @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 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtSubMenuGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -28,57 +28,64 @@
public class GwtSubMenuGui extends AbstractGwtMenuGui {
- private IconLabel iconLabel;
- private MenuItem item;
+ private IconLabel iconLabel;
+ private MenuItem item;
- @Override
- public AbstractGuiItem create(final GuiActionDescrip descriptor) {
- super.descriptor = descriptor;
- super.create(descriptor);
- item = new MenuItem("", menu);
- iconLabel = new IconLabel("");
- configureItemFromProperties();
- final AbstractGwtMenuGui parentMenu = ((AbstractGwtMenuGui) descriptor.getParent().getValue(PARENT_UI));
- final int position = descriptor.getPosition();
- if (position == GuiActionDescrip.NO_POSITION) {
- parentMenu.add(item);
- } else {
- parentMenu.insert(position, item);
- }
- descriptor.putValue(ParentWidget.PARENT_UI, this);
- return this;
+ @Override
+ public AbstractGuiItem create(final GuiActionDescrip descriptor) {
+ super.descriptor = descriptor;
+ super.create(descriptor);
+ item = new MenuItem("", menu);
+ iconLabel = new IconLabel("");
+ configureItemFromProperties();
+ final AbstractGwtMenuGui parentMenu = ((AbstractGwtMenuGui) descriptor.getParent().getValue(
+ PARENT_UI));
+ final int position = descriptor.getPosition();
+ if (position == GuiActionDescrip.NO_POSITION) {
+ parentMenu.add(item);
+ } else {
+ parentMenu.insert(position, item);
}
+ descriptor.putValue(ParentWidget.PARENT_UI, this);
+ return this;
+ }
- private void layout() {
- item.setHTML(iconLabel.toString());
- }
+ private void layout() {
+ item.setHTML(iconLabel.toString());
+ }
- @Override
- public void setEnabled(final boolean enabled) {
- item.setVisible(enabled);
- }
+ @Override
+ public void setEnabled(final boolean enabled) {
+ item.setVisible(enabled);
+ }
- @Override
- public void setIconStyle(final String style) {
- iconLabel.setRightIcon(style);
- layout();
- }
+ @Override
+ public void setIconStyle(final String style) {
+ iconLabel.setRightIcon(style);
+ layout();
+ }
- @Override
- public void setText(final String text) {
- iconLabel.setText(text);
- layout();
- }
+ @Override
+ public void setIconUrl(final String url) {
+ iconLabel.setRightIconUrl(url);
+ layout();
+ }
- @Override
- public void setToolTipText(final String tooltip) {
- item.setTitle(tooltip);
- }
+ @Override
+ public void setText(final String text) {
+ iconLabel.setText(text);
+ layout();
+ }
- @Override
- public void setVisible(final boolean visible) {
- item.setVisible(visible);
- iconLabel.setVisible(visible);
- layout();
- }
+ @Override
+ public void setToolTipText(final String tooltip) {
+ item.setTitle(tooltip);
+ }
+
+ @Override
+ public void setVisible(final boolean visible) {
+ item.setVisible(visible);
+ iconLabel.setVisible(visible);
+ layout();
+ }
}
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 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtToolbarGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -28,60 +28,64 @@
public class GwtToolbarGui extends AbstractGuiItem implements ParentWidget {
- private GwtComplexToolbar toolbar;
+ private GwtComplexToolbar toolbar;
- @Override
- public void add(final UIObject uiObject) {
- toolbar.add(uiObject);
- }
+ @Override
+ public void add(final UIObject uiObject) {
+ toolbar.add(uiObject);
+ }
- public Widget addFill() {
- return toolbar.addFill();
- }
+ public Widget addFill() {
+ return toolbar.addFill();
+ }
- public Widget addSeparator() {
- return toolbar.addSeparator();
- }
+ public Widget addSeparator() {
+ return toolbar.addSeparator();
+ }
- public Widget addSpacer() {
- return toolbar.addSpacer();
- }
+ public Widget addSpacer() {
+ return toolbar.addSpacer();
+ }
- @Override
- public AbstractGuiItem create(final GuiActionDescrip descriptor) {
- super.descriptor = descriptor;
- toolbar = new GwtComplexToolbar();
- initWidget(toolbar);
- configureItemFromProperties();
- descriptor.putValue(ParentWidget.PARENT_UI, this);
- return this;
- }
+ @Override
+ public AbstractGuiItem create(final GuiActionDescrip descriptor) {
+ super.descriptor = descriptor;
+ toolbar = new GwtComplexToolbar();
+ initWidget(toolbar);
+ configureItemFromProperties();
+ descriptor.putValue(ParentWidget.PARENT_UI, this);
+ return this;
+ }
- @Override
- public void insert(final int position, final UIObject widget) {
- toolbar.insert(widget, position);
- }
+ @Override
+ public void insert(final int position, final UIObject widget) {
+ toolbar.insert(widget, position);
+ }
- @Override
- protected void setEnabled(final boolean enabled) {
- }
+ @Override
+ protected void setEnabled(final boolean enabled) {
+ }
- @Override
- protected void setIconStyle(final String style) {
- }
+ @Override
+ protected void setIconStyle(final String style) {
+ }
- @Override
- protected void setText(final String text) {
- }
+ @Override
+ public void setIconUrl(final String url) {
+ }
- @Override
- protected void setToolTipText(final String text) {
- toolbar.setTitle(text);
- }
+ @Override
+ protected void setText(final String text) {
+ }
- @Override
- public boolean shouldBeAdded() {
- return true;
- }
+ @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 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtToolbarSeparatorGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -30,56 +30,62 @@
public class GwtToolbarSeparatorGui extends AbstractGuiItem {
- private Widget widget;
+ private Widget widget;
- @Override
- public AbstractGuiItem create(final GuiActionDescrip descriptor) {
- super.descriptor = descriptor;
- final GwtToolbarGui toolbar = ((GwtToolbarGui) descriptor.getParent().getValue(ParentWidget.PARENT_UI));
- if (toolbar == null) {
- throw new UIException("To add a toolbar separator you need to add the toolbar before. Item: " + descriptor);
- }
- final Type type = ((ToolbarSeparatorDescriptor) descriptor).getSeparatorType();
- switch (type) {
- case fill:
- widget = toolbar.addFill();
- break;
- case spacer:
- widget = toolbar.addSpacer();
- break;
- case separator:
- widget = toolbar.addSeparator();
- break;
- default:
- break;
- }
- configureItemFromProperties();
- return toolbar;
+ @Override
+ public AbstractGuiItem create(final GuiActionDescrip descriptor) {
+ super.descriptor = descriptor;
+ final GwtToolbarGui toolbar = ((GwtToolbarGui) descriptor.getParent().getValue(
+ ParentWidget.PARENT_UI));
+ if (toolbar == null) {
+ throw new UIException("To add a toolbar separator you need to add the toolbar before. Item: "
+ + descriptor);
}
-
- @Override
- protected void setEnabled(final boolean enabled) {
+ final Type type = ((ToolbarSeparatorDescriptor) descriptor).getSeparatorType();
+ switch (type) {
+ case fill:
+ widget = toolbar.addFill();
+ break;
+ case spacer:
+ widget = toolbar.addSpacer();
+ break;
+ case separator:
+ widget = toolbar.addSeparator();
+ break;
+ default:
+ break;
}
+ configureItemFromProperties();
+ return toolbar;
+ }
- @Override
- protected void setIconStyle(final String style) {
- }
+ @Override
+ protected void setEnabled(final boolean enabled) {
+ }
- @Override
- protected void setText(final String text) {
- }
+ @Override
+ protected void setIconStyle(final String style) {
+ }
- @Override
- protected void setToolTipText(final String text) {
- }
+ @Override
+ public void setIconUrl(final String url) {
+ }
- @Override
- public void setVisible(final boolean visible) {
- widget.setVisible(visible);
- }
+ @Override
+ protected void setText(final String text) {
+ }
- @Override
- public boolean shouldBeAdded() {
- return false;
- }
+ @Override
+ protected void setToolTipText(final String text) {
+ }
+
+ @Override
+ public void setVisible(final boolean visible) {
+ widget.setVisible(visible);
+ }
+
+ @Override
+ public boolean shouldBeAdded() {
+ return false;
+ }
}
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 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtButtonGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -28,6 +28,7 @@
import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
import cc.kune.common.client.actions.ui.descrip.PushButtonDescriptor;
+import cc.kune.common.client.errors.NotImplementedException;
import com.extjs.gxt.ui.client.Style.ButtonScale;
import com.extjs.gxt.ui.client.event.ButtonEvent;
@@ -40,112 +41,118 @@
public abstract class AbstractGxtButtonGui extends AbstractChildGuiItem {
- private Button button;
+ private Button button;
- public AbstractGxtButtonGui() {
- super();
- }
+ public AbstractGxtButtonGui() {
+ super();
+ }
- public AbstractGxtButtonGui(final ButtonDescriptor buttonDescriptor) {
- super(buttonDescriptor);
- }
+ public AbstractGxtButtonGui(final ButtonDescriptor buttonDescriptor) {
+ super(buttonDescriptor);
+ }
- @Override
- protected void addStyle(final String style) {
- button.addStyleName(style);
- }
+ @Override
+ protected void addStyle(final String style) {
+ button.addStyleName(style);
+ }
- @Override
- public AbstractGuiItem create(final GuiActionDescrip descriptor) {
- super.descriptor = descriptor;
- descriptor.putValue(ParentWidget.PARENT_UI, this);
- if (descriptor instanceof PushButtonDescriptor) {
- button = new ToggleButton();
- } else {
- button = new Button();
- }
- button.setAutoWidth(false);
- button.setAutoHeight(false);
- button.setBorders(false);
- final String id = descriptor.getId();
- if (id != null) {
- button.ensureDebugId(id);
- }
- button.addSelectionListener(new SelectionListener<ButtonEvent>() {
- @Override
- public void componentSelected(final ButtonEvent event) {
- descriptor.fire(new ActionEvent(button, getTargetObjectOfAction(descriptor), Event.as(event.getEvent())));
- }
- });
- if (!descriptor.isChild()) {
- // If button is inside a toolbar don't init...
- initWidget(button);
- } else {
- if (descriptor.isChild()) {
- child = button;
- }
- }
- super.create(descriptor);
- configureItemFromProperties();
- return this;
+ @Override
+ public AbstractGuiItem create(final GuiActionDescrip descriptor) {
+ super.descriptor = descriptor;
+ descriptor.putValue(ParentWidget.PARENT_UI, this);
+ if (descriptor instanceof PushButtonDescriptor) {
+ button = new ToggleButton();
+ } else {
+ button = new Button();
}
-
- @Override
- protected void setEnabled(final boolean enabled) {
- button.setEnabled(enabled);
+ button.setAutoWidth(false);
+ button.setAutoHeight(false);
+ button.setBorders(false);
+ final String id = descriptor.getId();
+ if (id != null) {
+ button.ensureDebugId(id);
}
-
- @Override
- public void setIconResource(final ImageResource icon) {
- button.setIcon(AbstractImagePrototype.create(icon));
- button.setScale(ButtonScale.SMALL);
+ button.addSelectionListener(new SelectionListener<ButtonEvent>() {
+ @Override
+ public void componentSelected(final ButtonEvent event) {
+ descriptor.fire(new ActionEvent(button, getTargetObjectOfAction(descriptor),
+ Event.as(event.getEvent())));
+ }
+ });
+ if (!descriptor.isChild()) {
+ // If button is inside a toolbar don't init...
+ initWidget(button);
+ } else {
+ if (descriptor.isChild()) {
+ child = button;
+ }
}
+ super.create(descriptor);
+ configureItemFromProperties();
+ return this;
+ }
- @Override
- protected void setIconStyle(final String style) {
- button.setIconStyle(style);
- button.setScale(ButtonScale.SMALL);
- }
+ @Override
+ protected void setEnabled(final boolean enabled) {
+ button.setEnabled(enabled);
+ }
- public void setPressed(final boolean pressed) {
- final ToggleButton toggleButton = (ToggleButton) button;
+ @Override
+ public void setIconResource(final ImageResource icon) {
+ button.setIcon(AbstractImagePrototype.create(icon));
+ button.setScale(ButtonScale.SMALL);
+ }
- if (toggleButton.isPressed() != pressed) {
- toggleButton.toggle(pressed);
- }
- }
+ @Override
+ protected void setIconStyle(final String style) {
+ button.setIconStyle(style);
+ button.setScale(ButtonScale.SMALL);
+ }
- @Override
- protected void setText(final String text) {
- button.setText(text);
- }
+ @Override
+ public void setIconUrl(final String url) {
+ throw new NotImplementedException();
+ }
- @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());
- }
- }
+ public void setPressed(final boolean pressed) {
+ final ToggleButton toggleButton = (ToggleButton) button;
+
+ if (toggleButton.isPressed() != pressed) {
+ toggleButton.toggle(pressed);
}
+ }
- @Override
- public void setVisible(final boolean visible) {
- if (button.isRendered()) {
- // ??
- }
- button.setVisible(visible);
+ @Override
+ protected void setText(final String text) {
+ button.setText(text);
+ }
+ @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 boolean shouldBeAdded() {
- return !descriptor.isChild();
+ @Override
+ public void setVisible(final boolean visible) {
+ if (button.isRendered()) {
+ // ??
}
+ button.setVisible(visible);
+
+ }
+
+ @Override
+ public boolean shouldBeAdded() {
+ return !descriptor.isChild();
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuGui.java 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -27,6 +27,7 @@
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.Position;
+import cc.kune.common.client.errors.NotImplementedException;
import com.extjs.gxt.ui.client.widget.menu.Menu;
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
@@ -36,98 +37,103 @@
public abstract class AbstractGxtMenuGui extends AbstractChildGuiItem implements ParentWidget {
- public enum MenuPosition {
- b, // The top left corner (default)
- bl, // The center of the top edge
- br, // The bottom right corner ,// The top right corner
- c, // The center of the left edge
- l, // In the center of the element
- r, // The center of the right edge
- t, // The bottom left corner
- tl, // The center of the bottom edge
- tr
- }
- public static final String DEF_MENU_POSITION = "bl";
- public static final String MENU_POSITION = "menu-position";
- protected Menu menu;
+ public enum MenuPosition {
+ b, // The top left corner (default)
+ bl, // The center of the top edge
+ br, // The bottom right corner ,// The top right corner
+ c, // The center of the left edge
+ l, // In the center of the element
+ r, // The center of the right edge
+ t, // The bottom left corner
+ tl, // The center of the bottom edge
+ tr
+ }
+ public static final String DEF_MENU_POSITION = "bl";
+ public static final String MENU_POSITION = "menu-position";
+ protected Menu menu;
- public AbstractGxtMenuGui() {
- }
+ public AbstractGxtMenuGui() {
+ }
- public AbstractGxtMenuGui(final GuiActionDescrip descriptor) {
- super(descriptor);
- }
+ public AbstractGxtMenuGui(final GuiActionDescrip descriptor) {
+ super(descriptor);
+ }
- @Override
- public void add(final UIObject item) {
- menu.add((MenuItem) item);
- }
+ @Override
+ public void add(final UIObject item) {
+ menu.add((MenuItem) item);
+ }
- public void addSeparator() {
- menu.add(new SeparatorMenuItem());
- }
+ public void addSeparator() {
+ menu.add(new SeparatorMenuItem());
+ }
- @Override
- public void configureItemFromProperties() {
- super.configureItemFromProperties();
- descriptor.addPropertyChangeListener(new PropertyChangeListener() {
- @Override
- public void propertyChange(final PropertyChangeEvent event) {
- if (event.getPropertyName().equals(MenuDescriptor.MENU_CLEAR)) {
- menu.removeAll();
- }
- }
- });
- }
+ @Override
+ public void configureItemFromProperties() {
+ super.configureItemFromProperties();
+ descriptor.addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(final PropertyChangeEvent event) {
+ if (event.getPropertyName().equals(MenuDescriptor.MENU_CLEAR)) {
+ menu.removeAll();
+ }
+ }
+ });
+ }
- @Override
- public AbstractGuiItem create(final GuiActionDescrip descriptor) {
- super.descriptor = descriptor;
- super.create(descriptor);
- menu = new Menu();
- descriptor.addPropertyChangeListener(new PropertyChangeListener() {
- @Override
- public void propertyChange(final PropertyChangeEvent event) {
- if (event.getPropertyName().equals(MenuDescriptor.MENU_HIDE)) {
- menu.hide();
- }
- }
- });
- 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;
- }
+ @Override
+ public AbstractGuiItem create(final GuiActionDescrip descriptor) {
+ super.descriptor = descriptor;
+ super.create(descriptor);
+ menu = new Menu();
+ descriptor.addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(final PropertyChangeEvent event) {
+ if (event.getPropertyName().equals(MenuDescriptor.MENU_HIDE)) {
+ menu.hide();
+ }
+ }
+ });
+ 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;
+ }
- protected String getMenuPosition() {
- final MenuPosition position = (MenuPosition) descriptor.getValue(MENU_POSITION);
- return position == null ? DEF_MENU_POSITION : position.name();
- }
+ protected String getMenuPosition() {
+ final MenuPosition position = (MenuPosition) descriptor.getValue(MENU_POSITION);
+ return position == null ? DEF_MENU_POSITION : position.name();
+ }
- @Override
- public void insert(final int position, final UIObject item) {
- menu.insert((MenuItem) item, position);
- }
+ @Override
+ public void insert(final int position, final UIObject item) {
+ menu.insert((MenuItem) item, position);
+ }
- @Override
- public boolean shouldBeAdded() {
- return !descriptor.isChild();
- }
+ @Override
+ public void setIconUrl(final String url) {
+ throw new NotImplementedException();
+ }
- public void show(final Object relative) {
- if (relative instanceof String) {
- menu.show(RootPanel.get((String) relative).getElement(), getMenuPosition());
- } else if (relative instanceof UIObject) {
- menu.show(((UIObject) relative).getElement(), getMenuPosition());
- } else if (relative instanceof Position) {
- final Position position = (Position) relative;
- menu.showAt(position.getX(), position.getY());
- }
+ @Override
+ public boolean shouldBeAdded() {
+ return !descriptor.isChild();
+ }
+
+ public void show(final Object relative) {
+ if (relative instanceof String) {
+ menu.show(RootPanel.get((String) relative).getElement(), getMenuPosition());
+ } else if (relative instanceof UIObject) {
+ menu.show(((UIObject) relative).getElement(), getMenuPosition());
+ } else if (relative instanceof Position) {
+ final Position position = (Position) relative;
+ menu.showAt(position.getX(), position.getY());
}
+ }
}
\ No newline at end of file
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 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuItemGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -31,6 +31,7 @@
import cc.kune.common.client.actions.ui.descrip.MenuCheckItemDescriptor;
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.client.utils.TextUtils;
import com.extjs.gxt.ui.client.event.MenuEvent;
@@ -45,123 +46,129 @@
public abstract class AbstractGxtMenuItemGui extends AbstractChildGuiItem {
- private MenuItem item;
+ private MenuItem item;
- public AbstractGxtMenuItemGui() {
- super();
- }
+ public AbstractGxtMenuItemGui() {
+ super();
+ }
- public AbstractGxtMenuItemGui(final MenuItemDescriptor descriptor) {
- super(descriptor);
+ public AbstractGxtMenuItemGui(final MenuItemDescriptor descriptor) {
+ super(descriptor);
- }
+ }
- private void confCheckListener(final MenuItemDescriptor descriptor, final CheckMenuItem checkItem) {
- descriptor.addPropertyChangeListener(new PropertyChangeListener() {
- @Override
- public void propertyChange(final PropertyChangeEvent event) {
- if (event.getPropertyName().equals(MenuCheckItemDescriptor.CHECKED)) {
- checkItem.setChecked((Boolean) event.getNewValue());
- }
- }
- });
- }
-
- @Override
- public AbstractGuiItem create(final GuiActionDescrip descriptor) {
- super.descriptor = descriptor;
- if (descriptor instanceof MenuRadioItemDescriptor) {
- final CheckMenuItem checkItem = createCheckItem((MenuItemDescriptor) descriptor);
- checkItem.setGroup(((MenuRadioItemDescriptor) descriptor).getGroup());
- confCheckListener((MenuItemDescriptor) descriptor, checkItem);
- item = checkItem;
- } else if (descriptor instanceof MenuCheckItemDescriptor) {
- final CheckMenuItem checkItem = createCheckItem((MenuItemDescriptor) descriptor);
- confCheckListener((MenuItemDescriptor) descriptor, checkItem);
- item = checkItem;
- } else {
- item = new MenuItem("");
+ private void confCheckListener(final MenuItemDescriptor descriptor, final CheckMenuItem checkItem) {
+ descriptor.addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(final PropertyChangeEvent event) {
+ if (event.getPropertyName().equals(MenuCheckItemDescriptor.CHECKED)) {
+ checkItem.setChecked((Boolean) event.getNewValue());
}
+ }
+ });
+ }
- final String id = descriptor.getId();
- if (id != null) {
- item.ensureDebugId(id);
- }
- item.addSelectionListener(new SelectionListener<MenuEvent>() {
- @Override
- public void componentSelected(final MenuEvent ce) {
- final AbstractAction action = descriptor.getAction();
- if (action != null) {
- action.actionPerformed(new ActionEvent(item, getTargetObjectOfAction(descriptor),
- Event.getCurrentEvent()));
- }
- }
- });
- child = item;
- super.create(descriptor);
- configureItemFromProperties();
- return this;
+ @Override
+ public AbstractGuiItem create(final GuiActionDescrip descriptor) {
+ super.descriptor = descriptor;
+ if (descriptor instanceof MenuRadioItemDescriptor) {
+ final CheckMenuItem checkItem = createCheckItem((MenuItemDescriptor) descriptor);
+ checkItem.setGroup(((MenuRadioItemDescriptor) descriptor).getGroup());
+ confCheckListener((MenuItemDescriptor) descriptor, checkItem);
+ item = checkItem;
+ } else if (descriptor instanceof MenuCheckItemDescriptor) {
+ final CheckMenuItem checkItem = createCheckItem((MenuItemDescriptor) descriptor);
+ confCheckListener((MenuItemDescriptor) descriptor, checkItem);
+ item = checkItem;
+ } else {
+ item = new MenuItem("");
}
- private CheckMenuItem createCheckItem(final MenuItemDescriptor descriptor) {
- final CheckMenuItem checkItem = new CheckMenuItem();
- checkItem.setChecked(((MenuCheckItemDescriptor) descriptor).isChecked());
- return checkItem;
+ final String id = descriptor.getId();
+ if (id != null) {
+ item.ensureDebugId(id);
}
+ item.addSelectionListener(new SelectionListener<MenuEvent>() {
+ @Override
+ public void componentSelected(final MenuEvent ce) {
+ final AbstractAction action = descriptor.getAction();
+ if (action != null) {
+ action.actionPerformed(new ActionEvent(item, getTargetObjectOfAction(descriptor),
+ Event.getCurrentEvent()));
+ }
+ }
+ });
+ child = item;
+ super.create(descriptor);
+ configureItemFromProperties();
+ return this;
+ }
- private String createShortCut(final KeyStroke key, final String style) {
- // See: https://yui-ext.com/forum/showthread.php?t=5762
- final Element keyLabel = DOM.createSpan();
- keyLabel.setId(style);
- keyLabel.setInnerText(key.toString());
- return keyLabel.getString();
- }
+ private CheckMenuItem createCheckItem(final MenuItemDescriptor descriptor) {
+ final CheckMenuItem checkItem = new CheckMenuItem();
+ checkItem.setChecked(((MenuCheckItemDescriptor) descriptor).isChecked());
+ return checkItem;
+ }
- public MenuItem getItem() {
- return item;
- }
+ private String createShortCut(final KeyStroke key, final String style) {
+ // See: https://yui-ext.com/forum/showthread.php?t=5762
+ final Element keyLabel = DOM.createSpan();
+ keyLabel.setId(style);
+ keyLabel.setInnerText(key.toString());
+ return keyLabel.getString();
+ }
- @Override
- protected void setEnabled(final boolean enabled) {
- item.setVisible(enabled);
- }
+ public MenuItem getItem() {
+ return item;
+ }
- @Override
- public void setIconResource(final ImageResource icon) {
- item.setIcon(AbstractImagePrototype.create(icon));
- }
+ @Override
+ protected void setEnabled(final boolean enabled) {
+ item.setVisible(enabled);
+ }
- @Override
- protected void setIconStyle(final String style) {
- item.setIconStyle(style);
- }
+ @Override
+ public void setIconResource(final ImageResource icon) {
+ item.setIcon(AbstractImagePrototype.create(icon));
+ }
- @Override
- protected void setText(final String text) {
- if (text != null) {
- final KeyStroke key = (KeyStroke) descriptor.getValue(Action.ACCELERATOR_KEY);
- if (key == null) {
- item.setText(text);
- } else {
- item.setText(text + createShortCut(key, "oc-mshortcut-hidden") + createShortCut(key, "oc-mshortcut"));
- }
- }
- }
+ @Override
+ protected void setIconStyle(final String style) {
+ item.setIconStyle(style);
+ }
- @Override
- protected void setToolTipText(final String tooltip) {
- if (TextUtils.notEmpty(tooltip)) {
- item.setToolTip(new GxtDefTooltip(tooltip));
- }
+ @Override
+ public void setIconUrl(final String url) {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ protected void setText(final String text) {
+ if (text != null) {
+ final KeyStroke key = (KeyStroke) descriptor.getValue(Action.ACCELERATOR_KEY);
+ if (key == null) {
+ item.setText(text);
+ } else {
+ item.setText(text + createShortCut(key, "oc-mshortcut-hidden")
+ + createShortCut(key, "oc-mshortcut"));
+ }
}
+ }
- @Override
- public void setVisible(final boolean visible) {
- item.setVisible(visible);
+ @Override
+ protected void setToolTipText(final String tooltip) {
+ if (TextUtils.notEmpty(tooltip)) {
+ item.setToolTip(new GxtDefTooltip(tooltip));
}
+ }
- @Override
- public boolean shouldBeAdded() { // NOPMD by vjrj on 18/01/11 0:48
- return false;
- }
+ @Override
+ public void setVisible(final boolean visible) {
+ item.setVisible(visible);
+ }
+
+ @Override
+ public boolean shouldBeAdded() { // NOPMD by vjrj on 18/01/11 0:48
+ return false;
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuGui.java 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -25,6 +25,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.errors.NotImplementedException;
import cc.kune.common.client.utils.TextUtils;
import com.extjs.gxt.ui.client.Style.ButtonScale;
@@ -39,125 +40,130 @@
public class GxtMenuGui extends AbstractGxtMenuGui implements ParentWidget {
- private SplitButton button;
- private boolean notStandAlone;
+ private SplitButton button;
+ private boolean notStandAlone;
- public GxtMenuGui() {
- super();
- }
+ public GxtMenuGui() {
+ super();
+ }
- @Override
- public void add(final UIObject item) {
- menu.add((MenuItem) item);
- }
+ @Override
+ public void add(final UIObject item) {
+ menu.add((MenuItem) item);
+ }
- @Override
- public void addSeparator() {
- menu.add(new SeparatorMenuItem());
- }
+ @Override
+ public void addSeparator() {
+ menu.add(new SeparatorMenuItem());
+ }
- @Override
- protected void addStyle(final String style) {
- button.addStyleName(style);
- }
+ @Override
+ protected void addStyle(final String style) {
+ button.addStyleName(style);
+ }
- @Override
- public void configureItemFromProperties() {
- super.configureItemFromProperties();
- descriptor.addPropertyChangeListener(new PropertyChangeListener() {
- @Override
- public void propertyChange(final PropertyChangeEvent event) {
- if (event.getPropertyName().equals(MenuDescriptor.MENU_CLEAR)) {
- menu.removeAll();
- }
- }
- });
- }
+ @Override
+ public void configureItemFromProperties() {
+ super.configureItemFromProperties();
+ descriptor.addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(final PropertyChangeEvent event) {
+ if (event.getPropertyName().equals(MenuDescriptor.MENU_CLEAR)) {
+ menu.removeAll();
+ }
+ }
+ });
+ }
- @Override
- public AbstractGuiItem create(final GuiActionDescrip descriptor) {
- super.descriptor = descriptor;
- descriptor.putValue(ParentWidget.PARENT_UI, this);
- // Standalone menus are menus without and associated button in a
- // toolbar (sometimes, a menu showed in a grid, or other special
- // widgets)
- notStandAlone = !((MenuDescriptor) descriptor).isStandalone();
- if (notStandAlone) {
- button = new SplitButton("");
- button.setStylePrimaryName("oc-button");
- button.addSelectionListener(new SelectionListener<ButtonEvent>() {
- @Override
- public void componentSelected(final ButtonEvent ce) {
- show(button);
- }
- });
- final String id = descriptor.getId();
- if (id != null) {
- button.ensureDebugId(id);
- }
- if (!descriptor.isChild()) {
- initWidget(button);
- } else {
- child = button;
- }
+ @Override
+ public AbstractGuiItem create(final GuiActionDescrip descriptor) {
+ super.descriptor = descriptor;
+ descriptor.putValue(ParentWidget.PARENT_UI, this);
+ // Standalone menus are menus without and associated button in a
+ // toolbar (sometimes, a menu showed in a grid, or other special
+ // widgets)
+ notStandAlone = !((MenuDescriptor) descriptor).isStandalone();
+ if (notStandAlone) {
+ button = new SplitButton("");
+ button.setStylePrimaryName("oc-button");
+ button.addSelectionListener(new SelectionListener<ButtonEvent>() {
+ @Override
+ public void componentSelected(final ButtonEvent ce) {
+ show(button);
}
- super.create(descriptor);
- configureItemFromProperties();
- return this;
+ });
+ final String id = descriptor.getId();
+ if (id != null) {
+ button.ensureDebugId(id);
+ }
+ if (!descriptor.isChild()) {
+ initWidget(button);
+ } else {
+ child = button;
+ }
}
+ super.create(descriptor);
+ configureItemFromProperties();
+ return this;
+ }
- @Override
- public void insert(final int position, final UIObject item) {
- menu.insert((MenuItem) item, position);
- }
+ @Override
+ public void insert(final int position, final UIObject item) {
+ menu.insert((MenuItem) item, position);
+ }
- @Override
- public void setEnabled(final boolean enabled) {
- if (button != null) {
- button.setEnabled(enabled);
- }
+ @Override
+ public void setEnabled(final boolean enabled) {
+ if (button != null) {
+ button.setEnabled(enabled);
}
+ }
- @Override
- public void setIconResource(final ImageResource icon) {
- if (button != null) {
- button.setIcon(AbstractImagePrototype.create(icon));
- button.setScale(ButtonScale.SMALL);
- }
+ @Override
+ public void setIconResource(final ImageResource icon) {
+ if (button != null) {
+ button.setIcon(AbstractImagePrototype.create(icon));
+ button.setScale(ButtonScale.SMALL);
}
+ }
- @Override
- public void setIconStyle(final String style) {
- if (button != null) {
- button.setIconStyle(style);
- }
+ @Override
+ public void setIconStyle(final String style) {
+ if (button != null) {
+ button.setIconStyle(style);
}
+ }
- @Override
- public void setText(final String text) {
- if (button != null) {
- button.setText(text);
- }
+ @Override
+ public void setIconUrl(final String url) {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void setText(final String text) {
+ if (button != null) {
+ button.setText(text);
}
+ }
- @Override
- public void setToolTipText(final String tooltip) {
- if (button != null) {
- if (TextUtils.notEmpty(tooltip)) {
- button.setToolTip(new GxtDefTooltip(tooltip));
- }
- }
+ @Override
+ public void setToolTipText(final String tooltip) {
+ if (button != null) {
+ if (TextUtils.notEmpty(tooltip)) {
+ button.setToolTip(new GxtDefTooltip(tooltip));
+ }
}
+ }
- @Override
- public void setVisible(final boolean visible) {
- if (button != null) {
- button.setVisible(visible);
- }
+ @Override
+ public void setVisible(final boolean visible) {
+ if (button != null) {
+ button.setVisible(visible);
}
+ }
- @Override
- public boolean shouldBeAdded() {
- return notStandAlone;
- }
+ @Override
+ public boolean shouldBeAdded() {
+ return notStandAlone;
+ }
}
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 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuSeparatorGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -28,40 +28,44 @@
public class GxtMenuSeparatorGui extends AbstractChildGuiItem implements ParentWidget {
- @Override
- public void add(final UIObject uiObject) {
- }
+ @Override
+ public void add(final UIObject uiObject) {
+ }
- @Override
- public AbstractGuiItem create(final GuiActionDescrip descriptor) {
- super.create(descriptor);
- final GxtMenuGui menu = (GxtMenuGui) parent;
- menu.addSeparator();
- return menu;
- }
+ @Override
+ public AbstractGuiItem create(final GuiActionDescrip descriptor) {
+ super.create(descriptor);
+ final GxtMenuGui menu = (GxtMenuGui) parent;
+ menu.addSeparator();
+ return menu;
+ }
- @Override
- public void insert(final int position, final UIObject widget) {
- }
+ @Override
+ public void insert(final int position, final UIObject widget) {
+ }
- @Override
- protected void setEnabled(final boolean enabled) {
- }
+ @Override
+ protected void setEnabled(final boolean enabled) {
+ }
- @Override
- protected void setIconStyle(final String style) {
- }
+ @Override
+ protected void setIconStyle(final String style) {
+ }
- @Override
- protected void setText(final String text) {
- }
+ @Override
+ public void setIconUrl(final String url) {
+ }
- @Override
- protected void setToolTipText(final String text) {
- }
+ @Override
+ protected void setText(final String text) {
+ }
- @Override
- public boolean shouldBeAdded() {
- return false;
- }
+ @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 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuTitleItemGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -23,73 +23,79 @@
import cc.kune.common.client.actions.ui.AbstractGuiItem;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
+import cc.kune.common.client.errors.NotImplementedException;
import cc.kune.common.client.utils.TextUtils;
import com.extjs.gxt.ui.client.widget.menu.HeaderMenuItem;
public class GxtMenuTitleItemGui extends AbstractChildGuiItem {
- private HeaderMenuItem item;
+ private HeaderMenuItem item;
- public GxtMenuTitleItemGui() {
- super();
- }
+ public GxtMenuTitleItemGui() {
+ super();
+ }
- public GxtMenuTitleItemGui(final MenuItemDescriptor descriptor) {
- super(descriptor);
+ public GxtMenuTitleItemGui(final MenuItemDescriptor descriptor) {
+ super(descriptor);
- }
+ }
- @Override
- public AbstractGuiItem create(final GuiActionDescrip descriptor) {
- super.descriptor = descriptor;
- item = new HeaderMenuItem("");
+ @Override
+ public AbstractGuiItem create(final GuiActionDescrip descriptor) {
+ super.descriptor = descriptor;
+ item = new HeaderMenuItem("");
- final String id = descriptor.getId();
- if (id != null) {
- item.ensureDebugId(id);
- }
- child = item;
- super.create(descriptor);
- configureItemFromProperties();
- return this;
+ final String id = descriptor.getId();
+ if (id != null) {
+ item.ensureDebugId(id);
}
+ child = item;
+ super.create(descriptor);
+ configureItemFromProperties();
+ return this;
+ }
- public HeaderMenuItem getItem() {
- return item;
- }
+ public HeaderMenuItem getItem() {
+ return item;
+ }
- @Override
- protected void setEnabled(final boolean enabled) {
- item.setVisible(enabled);
- }
+ @Override
+ protected void setEnabled(final boolean enabled) {
+ item.setVisible(enabled);
+ }
- @Override
- protected void setIconStyle(final String style) {
- item.addStyleName(style);
- }
+ @Override
+ protected void setIconStyle(final String style) {
+ item.addStyleName(style);
+ }
- @Override
- protected void setText(final String text) {
- if (text != null) {
- item.setText(text);
- }
- }
+ @Override
+ public void setIconUrl(final String url) {
+ throw new NotImplementedException();
+ }
- @Override
- protected void setToolTipText(final String tooltip) {
- if (TextUtils.notEmpty(tooltip)) {
- item.setToolTip(new GxtDefTooltip(tooltip));
- }
+ @Override
+ protected void setText(final String text) {
+ if (text != null) {
+ item.setText(text);
}
+ }
- @Override
- public void setVisible(final boolean visible) {
- item.setVisible(visible);
+ @Override
+ protected void setToolTipText(final String tooltip) {
+ if (TextUtils.notEmpty(tooltip)) {
+ item.setToolTip(new GxtDefTooltip(tooltip));
}
+ }
- @Override
- public boolean shouldBeAdded() { // NOPMD by vjrj on 18/01/11 0:48
- return false;
- }
+ @Override
+ public void setVisible(final boolean visible) {
+ item.setVisible(visible);
+ }
+
+ @Override
+ public boolean shouldBeAdded() { // NOPMD by vjrj on 18/01/11 0:48
+ return false;
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtToolbarGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtToolbarGui.java 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtToolbarGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -29,69 +29,73 @@
public class GxtToolbarGui extends AbstractGuiItem implements ParentWidget {
- private ToolBar toolbar;
+ private ToolBar toolbar;
- public GxtToolbarGui() {
- super();
- }
+ public GxtToolbarGui() {
+ super();
+ }
- public GxtToolbarGui(final GuiActionDescrip descriptor) {
- super(descriptor);
- }
+ public GxtToolbarGui(final GuiActionDescrip descriptor) {
+ super(descriptor);
+ }
- @Override
- public void add(final UIObject uiObject) {
- toolbar.add((Component) uiObject);
- }
+ @Override
+ public void add(final UIObject uiObject) {
+ toolbar.add((Component) uiObject);
+ }
- // public FillToolItem addFill() {
- // final FillToolItem item = new FillToolItem();
- // toolbar.add(item);
- // return item;
- // }
- //
- // public SeparatorToolItem addSeparator() {
- // final SeparatorToolItem item = new SeparatorToolItem();
- // toolbar.add(item);
- // return item;
- // }
- //
- // public LabelToolItem addSpacer() {
- // final LabelToolItem item = new LabelToolItem();
- // toolbar.add(item);
- // return item;
- // }
+ // public FillToolItem addFill() {
+ // final FillToolItem item = new FillToolItem();
+ // toolbar.add(item);
+ // return item;
+ // }
+ //
+ // public SeparatorToolItem addSeparator() {
+ // final SeparatorToolItem item = new SeparatorToolItem();
+ // toolbar.add(item);
+ // return item;
+ // }
+ //
+ // public LabelToolItem addSpacer() {
+ // final LabelToolItem item = new LabelToolItem();
+ // toolbar.add(item);
+ // return item;
+ // }
- @Override
- public AbstractGuiItem create(final GuiActionDescrip descriptor) {
- super.descriptor = descriptor;
- toolbar = new ToolBar();
- initWidget(toolbar);
- configureItemFromProperties();
- descriptor.putValue(ParentWidget.PARENT_UI, this);
- return this;
- }
+ @Override
+ public AbstractGuiItem create(final GuiActionDescrip descriptor) {
+ super.descriptor = descriptor;
+ toolbar = new ToolBar();
+ initWidget(toolbar);
+ configureItemFromProperties();
+ descriptor.putValue(ParentWidget.PARENT_UI, this);
+ return this;
+ }
- @Override
- public void insert(final int position, final UIObject uiObject) {
- toolbar.insert((Component) uiObject, position);
- }
+ @Override
+ public void insert(final int position, final UIObject uiObject) {
+ toolbar.insert((Component) uiObject, position);
+ }
- @Override
- protected void setEnabled(final boolean enabled) {
- }
+ @Override
+ protected void setEnabled(final boolean enabled) {
+ }
- @Override
- protected void setIconStyle(final String style) {
- }
+ @Override
+ protected void setIconStyle(final String style) {
+ }
- @Override
- protected void setText(final String text) {
- }
+ @Override
+ public void setIconUrl(final String url) {
+ }
- @Override
- protected void setToolTipText(final String text) {
- toolbar.setTitle(text);
- }
+ @Override
+ 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 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtToolbarSeparatorGui.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -31,50 +31,54 @@
public class GxtToolbarSeparatorGui extends AbstractChildGuiItem {
- @Override
- public AbstractGuiItem create(final GuiActionDescrip descriptor) {
- final GxtToolbarGui toolbar = (GxtToolbarGui) parent;
- final Type type = ((ToolbarSeparatorDescriptor) descriptor).getSeparatorType();
- switch (type) {
- case fill:
- child = new FillToolItem();
- break;
- case spacer:
- child = new LabelToolItem();
- break;
- case separator:
- child = new SeparatorToolItem();
- break;
- default:
- break;
- }
- super.create(descriptor);
- configureItemFromProperties();
- return toolbar;
+ @Override
+ public AbstractGuiItem create(final GuiActionDescrip descriptor) {
+ final GxtToolbarGui toolbar = (GxtToolbarGui) parent;
+ final Type type = ((ToolbarSeparatorDescriptor) descriptor).getSeparatorType();
+ switch (type) {
+ case fill:
+ child = new FillToolItem();
+ break;
+ case spacer:
+ child = new LabelToolItem();
+ break;
+ case separator:
+ child = new SeparatorToolItem();
+ break;
+ default:
+ break;
}
+ super.create(descriptor);
+ configureItemFromProperties();
+ return toolbar;
+ }
- @Override
- protected void setEnabled(final boolean enabled) {
- // do nothing
- }
+ @Override
+ protected void setEnabled(final boolean enabled) {
+ // do nothing
+ }
- @Override
- protected void setIconStyle(final String style) {
- // do nothing
- }
+ @Override
+ protected void setIconStyle(final String style) {
+ // do nothing
+ }
- @Override
- protected void setText(final String text) {
- // do nothing
- }
+ @Override
+ public void setIconUrl(final String url) {
+ }
- @Override
- protected void setToolTipText(final String text) {
- // do nothing
- }
+ @Override
+ protected void setText(final String text) {
+ // do nothing
+ }
- @Override
- public boolean shouldBeAdded() {
- return false;
- }
+ @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 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -35,128 +35,135 @@
public abstract class AbstractGuiItem extends Composite implements GuiBinding {
- protected GuiActionDescrip descriptor;
+ protected GuiActionDescrip descriptor;
- public AbstractGuiItem() {
- super();
- }
+ public AbstractGuiItem() {
+ super();
+ }
- public AbstractGuiItem(final GuiActionDescrip descriptor) {
- super();
- this.descriptor = descriptor;
- }
+ public AbstractGuiItem(final GuiActionDescrip descriptor) {
+ super();
+ this.descriptor = descriptor;
+ }
- protected void addStyle(final String style) {
- if (super.isOrWasAttached()) {
- super.addStyleName(style);
- }
+ protected void addStyle(final String style) {
+ if (super.isOrWasAttached()) {
+ super.addStyleName(style);
}
+ }
- protected void clearStyles() {
- if (super.isOrWasAttached()) {
- super.setStyleName("k-none");
- }
+ protected void clearStyles() {
+ if (super.isOrWasAttached()) {
+ super.setStyleName("k-none");
}
+ }
- private void configure() {
- configureProperties();
- final PropertyChangeListener changeListener = createActionPropertyChangeListener();
- descriptor.getAction().addPropertyChangeListener(changeListener);
- descriptor.addPropertyChangeListener(changeListener);
- }
+ private void configure() {
+ configureProperties();
+ final PropertyChangeListener changeListener = createActionPropertyChangeListener();
+ descriptor.getAction().addPropertyChangeListener(changeListener);
+ descriptor.addPropertyChangeListener(changeListener);
+ }
- /**
- * Sets the item properties from the stored values
- */
- public void configureItemFromProperties() {
- configure();
- }
+ /**
+ * Sets the item properties from the stored values
+ */
+ public void configureItemFromProperties() {
+ configure();
+ }
- private void configureProperties() {
- setText((String) (descriptor.getValue(Action.NAME)));
- setToolTipText((String) (descriptor.getValue(Action.SHORT_DESCRIPTION)));
- setIcon(descriptor.getValue(Action.SMALL_ICON));
- setEnabled((Boolean) descriptor.getValue(AbstractAction.ENABLED));
- setVisible((Boolean) descriptor.getValue(GuiActionDescrip.VISIBLE));
- setStyles((String) descriptor.getValue(Action.STYLES));
- }
+ private void configureProperties() {
+ setText((String) (descriptor.getValue(Action.NAME)));
+ setToolTipText((String) (descriptor.getValue(Action.SHORT_DESCRIPTION)));
+ setIcon(descriptor.getValue(Action.SMALL_ICON));
+ setEnabled((Boolean) descriptor.getValue(AbstractAction.ENABLED));
+ setVisible((Boolean) descriptor.getValue(GuiActionDescrip.VISIBLE));
+ setStyles((String) descriptor.getValue(Action.STYLES));
+ }
- @Override
- public abstract AbstractGuiItem create(final GuiActionDescrip descriptor);
+ @Override
+ public abstract AbstractGuiItem create(final GuiActionDescrip descriptor);
- private PropertyChangeListener createActionPropertyChangeListener() {
- return new PropertyChangeListener() {
- @Override
- public void propertyChange(final PropertyChangeEvent event) {
- final Object newValue = event.getNewValue();
- if (event.getPropertyName().equals(Action.ENABLED)) {
- setEnabled((Boolean) newValue);
- } else if (event.getPropertyName().equals(Action.NAME)) {
- setText((String) newValue);
- } else if (event.getPropertyName().equals(Action.SMALL_ICON)) {
- setIcon(newValue);
- } else if (event.getPropertyName().equals(Action.SHORT_DESCRIPTION)) {
- setToolTipText((String) newValue);
- } else if (event.getPropertyName().equals(GuiActionDescrip.VISIBLE)) {
- setVisible((Boolean) newValue);
- } else if (event.getPropertyName().equals(Action.STYLES)) {
- setStyles((String) newValue);
- }
- }
- };
- }
+ private PropertyChangeListener createActionPropertyChangeListener() {
+ return new PropertyChangeListener() {
+ @Override
+ public void propertyChange(final PropertyChangeEvent event) {
+ final Object newValue = event.getNewValue();
+ if (event.getPropertyName().equals(Action.ENABLED)) {
+ setEnabled((Boolean) newValue);
+ } else if (event.getPropertyName().equals(Action.NAME)) {
+ setText((String) newValue);
+ } else if (event.getPropertyName().equals(Action.SMALL_ICON)) {
+ setIcon(newValue);
+ } else if (event.getPropertyName().equals(Action.SHORT_DESCRIPTION)) {
+ setToolTipText((String) newValue);
+ } else if (event.getPropertyName().equals(GuiActionDescrip.VISIBLE)) {
+ setVisible((Boolean) newValue);
+ } else if (event.getPropertyName().equals(Action.STYLES)) {
+ setStyles((String) newValue);
+ }
+ }
+ };
+ }
- protected Object getTargetObjectOfAction(final GuiActionDescrip descriptor) {
- // If the action is associated with a item (like a Group, a
- // group shortname, a username, etc) we pass this item to
- // the action, if not we only pass the menuitem
- return descriptor.hasTarget() ? descriptor.getTarget()
- : descriptor.isChild() ? descriptor.getParent().getTarget() : ActionEvent.NO_TARGET;
- }
+ protected Object getTargetObjectOfAction(final GuiActionDescrip descriptor) {
+ // If the action is associated with a item (like a Group, a
+ // group shortname, a username, etc) we pass this item to
+ // the action, if not we only pass the menuitem
+ return descriptor.hasTarget() ? descriptor.getTarget()
+ : descriptor.isChild() ? descriptor.getParent().getTarget() : ActionEvent.NO_TARGET;
+ }
- protected abstract void setEnabled(boolean enabled);
+ protected abstract void setEnabled(boolean enabled);
- private void setEnabled(final Boolean enabled) {
- setEnabled(enabled == null ? true : enabled);
- }
+ private void setEnabled(final Boolean enabled) {
+ setEnabled(enabled == null ? true : enabled);
+ }
- private void setIcon(final Object icon) {
- if (icon instanceof ImageResource) {
- setIconResource((ImageResource) icon);
- } else if (icon instanceof String) {
- setIconStyle((String) icon);
- } else if (icon != null) {
- throw new NotImplementedException();
- }
+ private void setIcon(final Object icon) {
+ if (icon instanceof ImageResource) {
+ setIconResource((ImageResource) icon);
+ } else if (icon instanceof String) {
+ final String iconS = (String) icon;
+ if (iconS.startsWith("http")) {
+ setIconUrl(iconS);
+ } else {
+ setIconStyle(iconS);
+ }
+ } else if (icon != null) {
+ throw new NotImplementedException();
}
+ }
- public void setIconResource(final ImageResource icon) {
- setIconStyle((IconConstants.CSS_SUFFIX + icon.getName()));
- }
+ public void setIconResource(final ImageResource icon) {
+ setIconStyle((IconConstants.CSS_SUFFIX + icon.getName()));
+ }
- protected abstract void setIconStyle(String style);
+ protected abstract void setIconStyle(String style);
- private void setStyles(final String styles) {
- if (styles != null) {
- clearStyles();
- for (final String style : TextUtils.splitTags(styles)) {
- addStyle(style);
- }
- }
+ public abstract void setIconUrl(String url);
+
+ private void setStyles(final String styles) {
+ if (styles != null) {
+ clearStyles();
+ for (final String style : TextUtils.splitTags(styles)) {
+ addStyle(style);
+ }
}
+ }
- protected abstract void setText(String text);
+ protected abstract void setText(String text);
- protected abstract void setToolTipText(String text);
+ protected abstract void setToolTipText(String text);
- private void setVisible(final Boolean visible) {
- // if you have problems with setVisible check if the GuiItem calls
- // configureItemFromProperties on creation
- setVisible(visible == null ? true : visible);
- }
+ private void setVisible(final Boolean visible) {
+ // if you have problems with setVisible check if the GuiItem calls
+ // configureItemFromProperties on creation
+ setVisible(visible == null ? true : visible);
+ }
- @Override
- public boolean shouldBeAdded() { // NOPMD by vjrj on 18/01/11 0:48
- return true;
- }
+ @Override
+ public boolean shouldBeAdded() { // NOPMD by vjrj on 18/01/11 0:48
+ return true;
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/ui/IconLabel.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/IconLabel.java 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/client/ui/IconLabel.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -43,6 +43,8 @@
interface IconTitleUiBinder extends UiBinder<Widget, IconLabel> {
}
+ private static final String DEF = "16px";
+
private static IconTitleUiBinder uiBinder = GWT.create(IconTitleUiBinder.class);
@UiField
@@ -137,6 +139,12 @@
iconLeft.addStyleName("k-iconlabel-left");
}
+ public void setLeftIconUrl(final String url) {
+ iconLeft.setUrl(url);
+ iconLeft.setSize(DEF, DEF);
+ iconLeft.addStyleName("k-iconlabel-left");
+ }
+
public void setRightIcon(final String imgCss) {
iconRight.setUrl("images/clear.gif");
iconRight.setStyleName(imgCss);
@@ -149,6 +157,12 @@
iconRight.addStyleName("k-iconlabel-right");
}
+ public void setRightIconUrl(final String url) {
+ iconRight.setUrl(url);
+ iconRight.setSize(DEF, DEF);
+ iconRight.addStyleName("k-iconlabel-right");
+ }
+
@Override
public void setStyleName(final String style) {
flow.setStyleName(style);
Modified: trunk/src/main/java/cc/kune/common/public/kune-common.css
===================================================================
--- trunk/src/main/java/cc/kune/common/public/kune-common.css 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/common/public/kune-common.css 2011-05-05 02:24:50 UTC (rev 1343)
@@ -449,6 +449,7 @@
.k-iconlabel-text {
vertical-align: top;
padding-left: 3px;
+ padding-right: 3px;
float: left;
}
Modified: trunk/src/main/java/cc/kune/core/client/services/FileDownloadUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/services/FileDownloadUtils.java 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/core/client/services/FileDownloadUtils.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -23,6 +23,8 @@
import cc.kune.common.client.utils.UrlParam;
import cc.kune.core.client.state.Session;
import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.core.shared.dto.GroupDTO;
+import cc.kune.core.shared.dto.UserSimpleDTO;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.DOM;
@@ -31,63 +33,75 @@
public class FileDownloadUtils {
- private static final String DOWNLOADSERVLET = "servlets/FileDownloadManager";
- private static final String LOGODOWNLOADSERVLET = "servlets/EntityLogoDownloadManager";
+ private static final String DOWNLOADSERVLET = "servlets/FileDownloadManager";
+ protected static final String GROUP_NO_AVATAR_IMAGE = "images/group-def-icon.png";
+ private static final String LOGODOWNLOADSERVLET = "servlets/EntityLogoDownloadManager";
+ protected static final String PERSON_NO_AVATAR_IMAGE = "images/unknown.jpg";
- private final ImageUtils imageUtils;
- private final Session session;
+ private final ImageUtils imageUtils;
+ private final Session session;
- @Inject
- public FileDownloadUtils(final Session session, final ImageUtils imageUtils) {
- this.session = session;
- this.imageUtils = imageUtils;
- }
+ @Inject
+ public FileDownloadUtils(final Session session, final ImageUtils imageUtils) {
+ this.session = session;
+ this.imageUtils = imageUtils;
+ }
- private String calculateUrl(final StateToken token, final boolean download, final boolean useHash) {
- final Url url = new Url(GWT.getModuleBaseURL() + DOWNLOADSERVLET, new UrlParam(FileConstants.TOKEN,
- token.toString()));
- if (download) {
- url.add(new UrlParam(FileConstants.DOWNLOAD, download));
- }
- if (useHash) {
- final String hash = session.getUserHash();
- if (hash != null) {
- url.add(new UrlParam(FileConstants.HASH, hash));
- }
- }
- return url.toString();
+ private String calculateUrl(final StateToken token, final boolean download, final boolean useHash) {
+ final Url url = new Url(GWT.getModuleBaseURL() + DOWNLOADSERVLET, new UrlParam(FileConstants.TOKEN,
+ token.toString()));
+ if (download) {
+ url.add(new UrlParam(FileConstants.DOWNLOAD, download));
}
-
- public void downloadFile(final StateToken token) {
- final String url = calculateUrl(token, true, true);
- DOM.setElementAttribute(RootPanel.get("__download").getElement(), "src", url);
+ if (useHash) {
+ final String hash = session.getUserHash();
+ if (hash != null) {
+ url.add(new UrlParam(FileConstants.HASH, hash));
+ }
}
+ return url.toString();
+ }
- public String getImageResizedUrl(final StateToken token, final ImageSize imageSize) {
- return calculateUrl(token, false, true) + "&" + new UrlParam(FileConstants.IMGSIZE, imageSize.toString());
- }
+ public void downloadFile(final StateToken token) {
+ final String url = calculateUrl(token, true, true);
+ DOM.setElementAttribute(RootPanel.get("__download").getElement(), "src", url);
+ }
- public String getImageUrl(final StateToken token) {
- return calculateUrl(token, false, true);
- }
+ public String getGroupLogo(final GroupDTO group) {
+ return group.hasLogo() ? getLogoImageUrl(group.getStateToken())
+ : group.isPersonal() ? PERSON_NO_AVATAR_IMAGE : GROUP_NO_AVATAR_IMAGE;
+ }
- public String getLogoAvatarHtml(final StateToken groupToken, final boolean groupHasLogo, final boolean isPersonal,
- final int size, final int hvspace) {
- if (groupHasLogo) {
- return "<img hspace='" + hvspace + "' vspace='" + hvspace + "' align='left' style='width: " + size
- + "px; height: " + size + "px;' src='" + getLogoImageUrl(groupToken) + "'>";
- } else {
- return isPersonal ? imageUtils.getImageHtml(ImageDescriptor.personDef)
- : imageUtils.getImageHtml(ImageDescriptor.groupDefIcon);
- }
- }
+ public String getImageResizedUrl(final StateToken token, final ImageSize imageSize) {
+ return calculateUrl(token, false, true) + "&"
+ + new UrlParam(FileConstants.IMGSIZE, imageSize.toString());
+ }
- public String getLogoImageUrl(final StateToken token) {
- return new Url(GWT.getModuleBaseURL() + LOGODOWNLOADSERVLET,
- new UrlParam(FileConstants.TOKEN, token.toString())).toString();
+ public String getImageUrl(final StateToken token) {
+ return calculateUrl(token, false, true);
+ }
+
+ public String getLogoAvatarHtml(final StateToken groupToken, final boolean groupHasLogo,
+ final boolean isPersonal, final int size, final int hvspace) {
+ if (groupHasLogo) {
+ return "<img hspace='" + hvspace + "' vspace='" + hvspace + "' align='left' style='width: " + size
+ + "px; height: " + size + "px;' src='" + getLogoImageUrl(groupToken) + "'>";
+ } else {
+ return isPersonal ? imageUtils.getImageHtml(ImageDescriptor.personDef)
+ : imageUtils.getImageHtml(ImageDescriptor.groupDefIcon);
}
+ }
- public String getUrl(final StateToken token) {
- return calculateUrl(token, false, false);
- }
+ public String getLogoImageUrl(final StateToken token) {
+ return new Url(GWT.getModuleBaseURL() + LOGODOWNLOADSERVLET, new UrlParam(FileConstants.TOKEN,
+ token.toString())).toString();
+ }
+
+ public String getUrl(final StateToken token) {
+ return calculateUrl(token, false, false);
+ }
+
+ public String getUserAvatar(final UserSimpleDTO user) {
+ return user.hasLogo() ? getLogoImageUrl(user.getStateToken()) : PERSON_NO_AVATAR_IMAGE;
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -104,8 +104,7 @@
}
private void addPartipation(final GroupDTO group) {
- final String logoImageUrl = group.hasLogo() ? downloadProvider.get().getLogoImageUrl(
- group.getStateToken()) : "images/group-def-icon.gif";
+ final String logoImageUrl = downloadProvider.get().getGroupLogo(group);
final MenuItemDescriptor participant = new MenuItemDescriptor(gotoGroupAction);
participant.setTarget(group);
participant.putValue(Action.NAME, group.getLongName());
Modified: trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPresenter.java 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPresenter.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -13,32 +13,31 @@
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.proxy.Proxy;
-public abstract class AbstractSNPresenter<V extends View, Proxy_ extends Proxy<?>> extends Presenter<View, Proxy<?>> {
- protected static final String GROUP_NO_AVATAR_IMAGE = "images/group-def-icon.png";
- protected static final String PERSON_NO_AVATAR_IMAGE = "images/unknown.jpg";
- protected final Provider<FileDownloadUtils> downloadProvider;
+public abstract class AbstractSNPresenter<V extends View, Proxy_ extends Proxy<?>> extends
+ Presenter<View, Proxy<?>> {
- public AbstractSNPresenter(final EventBus eventBus, final View view, final Proxy<?> proxy,
- final Provider<FileDownloadUtils> downloadProvider) {
- super(eventBus, view, proxy);
- this.downloadProvider = downloadProvider;
- }
+ protected final Provider<FileDownloadUtils> downloadProvider;
- protected GuiActionDescCollection createMenuItems(final Object target,
- final AbstractSNMembersActionsRegistry registry, final String title) {
- final GuiActionDescCollection items = new GuiActionDescCollection();
- items.add(new MenuTitleItemDescriptor(title));
- for (final Provider<MenuItemDescriptor> provider : registry) {
- final MenuItemDescriptor menuItem = provider.get();
- menuItem.setTarget(target);
- items.add(menuItem);
- }
- return items;
- }
+ public AbstractSNPresenter(final EventBus eventBus, final View view, final Proxy<?> proxy,
+ final Provider<FileDownloadUtils> downloadProvider) {
+ super(eventBus, view, proxy);
+ this.downloadProvider = downloadProvider;
+ }
- protected String getAvatar(final GroupDTO group) {
- return group.hasLogo() ? downloadProvider.get().getLogoImageUrl(group.getStateToken())
- : group.isPersonal() ? PERSON_NO_AVATAR_IMAGE : GROUP_NO_AVATAR_IMAGE;
+ protected GuiActionDescCollection createMenuItems(final Object target,
+ final AbstractSNMembersActionsRegistry registry, final String title) {
+ final GuiActionDescCollection items = new GuiActionDescCollection();
+ items.add(new MenuTitleItemDescriptor(title));
+ for (final Provider<MenuItemDescriptor> provider : registry) {
+ final MenuItemDescriptor menuItem = provider.get();
+ menuItem.setTarget(target);
+ items.add(menuItem);
}
+ return items;
+ }
+ protected String getAvatar(final GroupDTO group) {
+ return downloadProvider.get().getGroupLogo(group);
+ }
+
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -152,8 +152,7 @@
final UserBuddiesDataDTO userBuddiesData = state.getUserBuddies();
final List<UserSimpleDTO> buddies = userBuddiesData.getBuddies();
for (final UserSimpleDTO user : buddies) {
- final String avatarUrl = user.hasLogo() ? downloadProvider.get().getLogoImageUrl(
- user.getStateToken()) : PERSON_NO_AVATAR_IMAGE;
+ final String avatarUrl = downloadProvider.get().getUserAvatar(user);
getView().addBuddie(user, avatarUrl, user.getName(), "",
createMenuItems(user, userMenuItemsRegistry, user.getName()));
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -29,80 +29,84 @@
@SuppressWarnings("serial")
public class GroupSNConfActions extends AbstractSNActionsRegistry {
- public static final SubMenuDescriptor MODERATION_SUBMENU = new SubMenuDescriptor();
- public static final MenuDescriptor OPTIONS_MENU = new MenuDescriptor();
- public static final SubMenuDescriptor VISIBILITY_SUBMENU = new SubMenuDescriptor();
+ public static final SubMenuDescriptor MODERATION_SUBMENU = new SubMenuDescriptor();
+ public static final MenuDescriptor OPTIONS_MENU = new MenuDescriptor();
+ public static final String OPTIONS_STYLES = "k-sn-options-menu, k-noborder, k-nobackcolor, k-btn-min";
+ public static final SubMenuDescriptor VISIBILITY_SUBMENU = new SubMenuDescriptor();
- @Inject
- public GroupSNConfActions(final Session session, final StateManager stateManager,
- final I18nTranslationService i18n, final Provider<MembersVisibilityMenuItem> membersVisibility,
- final Provider<MembersModerationMenuItem> membersModeration, final CoreResources res,
- final IsLoggedCondition isLoggedCondition, final JoinGroupAction joinGroupAction,
- final IsGroupCondition isGroupCondition, final UnJoinGroupAction unJoinGroupAction) {
- OPTIONS_MENU.withToolTip(i18n.t("Options")).withIcon(res.arrowdownsitebar()).withStyles(
- "k-sn-options-menu, k-noborder, k-nobackcolor");
- final GuiActionDescrip optionsTitle = new MenuTitleItemDescriptor(i18n.t("Options")).withParent(OPTIONS_MENU);
- final MenuRadioItemDescriptor anyoneItem = membersVisibility.get().withVisibility(
- SocialNetworkVisibility.anyone);
- final MenuRadioItemDescriptor onlyMembersItem = membersVisibility.get().withVisibility(
- SocialNetworkVisibility.onlymembers);
- final MenuRadioItemDescriptor onlyAdminsItem = membersVisibility.get().withVisibility(
- SocialNetworkVisibility.onlyadmins);
- final MenuRadioItemDescriptor closedItem = membersModeration.get().withModeration(AdmissionType.Closed);
- final MenuRadioItemDescriptor moderatedItem = membersModeration.get().withModeration(AdmissionType.Moderated);
- final MenuRadioItemDescriptor openItem = membersModeration.get().withModeration(AdmissionType.Open);
- add(OPTIONS_MENU);
- add(optionsTitle);
- add(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view this member list")).withParent(OPTIONS_MENU));
- add(MODERATION_SUBMENU.withText(i18n.t("New members policy")).withParent(OPTIONS_MENU));
- add(anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone")));
- add(onlyMembersItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only members")));
- add(onlyAdminsItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only admins")));
- add(moderatedItem.withParent(MODERATION_SUBMENU).withText(i18n.t("moderate request to join")));
- add(openItem.withParent(MODERATION_SUBMENU).withText(i18n.t("auto accept request to join")));
- // add(closedItem.withParent(MODERATION_SUBMENU).withText(
- // i18n.t("closed for new members")));
+ @Inject
+ public GroupSNConfActions(final Session session, final StateManager stateManager,
+ final I18nTranslationService i18n, final Provider<MembersVisibilityMenuItem> membersVisibility,
+ final Provider<MembersModerationMenuItem> membersModeration, final CoreResources res,
+ final IsLoggedCondition isLoggedCondition, final JoinGroupAction joinGroupAction,
+ final IsGroupCondition isGroupCondition, final UnJoinGroupAction unJoinGroupAction) {
+ OPTIONS_MENU.withToolTip(i18n.t("Options")).withIcon(res.arrowdownsitebar()).withStyles(
+ OPTIONS_STYLES);
+ final GuiActionDescrip optionsTitle = new MenuTitleItemDescriptor(i18n.t("Options")).withParent(OPTIONS_MENU);
+ final MenuRadioItemDescriptor anyoneItem = membersVisibility.get().withVisibility(
+ SocialNetworkVisibility.anyone);
+ final MenuRadioItemDescriptor onlyMembersItem = membersVisibility.get().withVisibility(
+ SocialNetworkVisibility.onlymembers);
+ final MenuRadioItemDescriptor onlyAdminsItem = membersVisibility.get().withVisibility(
+ SocialNetworkVisibility.onlyadmins);
+ final MenuRadioItemDescriptor closedItem = membersModeration.get().withModeration(
+ AdmissionType.Closed);
+ final MenuRadioItemDescriptor moderatedItem = membersModeration.get().withModeration(
+ AdmissionType.Moderated);
+ final MenuRadioItemDescriptor openItem = membersModeration.get().withModeration(AdmissionType.Open);
+ add(OPTIONS_MENU);
+ add(optionsTitle);
+ add(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view this member list")).withParent(
+ OPTIONS_MENU));
+ add(MODERATION_SUBMENU.withText(i18n.t("New members policy")).withParent(OPTIONS_MENU));
+ add(anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone")));
+ add(onlyMembersItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only members")));
+ add(onlyAdminsItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only admins")));
+ add(moderatedItem.withParent(MODERATION_SUBMENU).withText(i18n.t("moderate request to join")));
+ add(openItem.withParent(MODERATION_SUBMENU).withText(i18n.t("auto accept request to join")));
+ // add(closedItem.withParent(MODERATION_SUBMENU).withText(
+ // i18n.t("closed for new members")));
- final ButtonDescriptor joinBtn = new ButtonDescriptor(joinGroupAction);
- final ButtonDescriptor unJoinBtn = new ButtonDescriptor(unJoinGroupAction);
- // unJoinBtn.add(isLoggedCondition);
- add(joinBtn); // .withStyles("k-no-backimage, k-noborder, k-nobackcolor"));
- add(unJoinBtn); // .withStyles("k-no-backimage, k-noborder, k-nobackcolor"));
+ final ButtonDescriptor joinBtn = new ButtonDescriptor(joinGroupAction);
+ final ButtonDescriptor unJoinBtn = new ButtonDescriptor(unJoinGroupAction);
+ // unJoinBtn.add(isLoggedCondition);
+ add(joinBtn); // .withStyles("k-no-backimage, k-noborder, k-nobackcolor"));
+ add(unJoinBtn); // .withStyles("k-no-backimage, k-noborder, k-nobackcolor"));
- stateManager.onStateChanged(true, new StateChangedHandler() {
- @Override
- public void onStateChanged(final StateChangedEvent event) {
- final boolean administrable = event.getState().getGroupRights().isAdministrable();
- OPTIONS_MENU.setVisible(administrable);
- OPTIONS_MENU.setEnabled(administrable);
- final StateAbstractDTO state = event.getState();
- final GroupDTO currentGroup = state.getGroup();
- if (currentGroup.isNotPersonal()) {
- switch (state.getSocialNetworkData().getSocialNetworkVisibility()) {
- case anyone:
- anyoneItem.setChecked(true);
- break;
- case onlyadmins:
- onlyAdminsItem.setChecked(true);
- break;
- case onlymembers:
- onlyMembersItem.setChecked(true);
- break;
- }
- }
- switch (currentGroup.getAdmissionType()) {
- case Moderated:
- moderatedItem.setChecked(true);
- break;
- case Open:
- openItem.setChecked(true);
- break;
- case Closed:
- closedItem.setChecked(true);
- break;
- }
- unJoinBtn.setVisible(session.isLogged());
- }
- });
- }
+ stateManager.onStateChanged(true, new StateChangedHandler() {
+ @Override
+ public void onStateChanged(final StateChangedEvent event) {
+ final boolean administrable = event.getState().getGroupRights().isAdministrable();
+ OPTIONS_MENU.setVisible(administrable);
+ OPTIONS_MENU.setEnabled(administrable);
+ final StateAbstractDTO state = event.getState();
+ final GroupDTO currentGroup = state.getGroup();
+ if (currentGroup.isNotPersonal()) {
+ switch (state.getSocialNetworkData().getSocialNetworkVisibility()) {
+ case anyone:
+ anyoneItem.setChecked(true);
+ break;
+ case onlyadmins:
+ onlyAdminsItem.setChecked(true);
+ break;
+ case onlymembers:
+ onlyMembersItem.setChecked(true);
+ break;
+ }
+ }
+ switch (currentGroup.getAdmissionType()) {
+ case Moderated:
+ moderatedItem.setChecked(true);
+ break;
+ case Open:
+ openItem.setChecked(true);
+ break;
+ case Closed:
+ closedItem.setChecked(true);
+ break;
+ }
+ unJoinBtn.setVisible(session.isLogged());
+ }
+ });
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -22,57 +22,60 @@
@SuppressWarnings("serial")
public class UserSNConfActions extends AbstractSNActionsRegistry {
- public static final MenuDescriptor OPTIONS_MENU = new MenuDescriptor();
- public static final SubMenuDescriptor VISIBILITY_SUBMENU = new SubMenuDescriptor();
+ public static final MenuDescriptor OPTIONS_MENU = new MenuDescriptor();
+ public static final SubMenuDescriptor VISIBILITY_SUBMENU = new SubMenuDescriptor();
- @Inject
- public UserSNConfActions(final Session session, final StateManager stateManager, final I18nTranslationService i18n,
- final Provider<UserSNVisibilityMenuItem> userBuddiesVisibility, final CoreResources res,
- final IsGroupCondition isGroupCondition, final AddNewBuddiesAction addNewBuddiesAction) {
- OPTIONS_MENU.withToolTip(i18n.t("Options")).withIcon(res.arrowdownsitebar()).withStyles(
- "k-sn-options-menu, k-noborder, k-nobackcolor");
- final MenuRadioItemDescriptor anyoneItem = userBuddiesVisibility.get().withVisibility(UserSNetVisibility.anyone);
- final MenuRadioItemDescriptor onlyYourBuddiesItem = userBuddiesVisibility.get().withVisibility(
- UserSNetVisibility.yourbuddies);
- final MenuRadioItemDescriptor onlyYou = userBuddiesVisibility.get().withVisibility(UserSNetVisibility.onlyyou);
- assert anyoneItem.getAction() != onlyYourBuddiesItem.getAction();
- assert anyoneItem.getAction() != onlyYou.getAction();
- add(OPTIONS_MENU);
- add(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view your network")).withParent(OPTIONS_MENU));
- add(anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone")));
- add(onlyYourBuddiesItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only your buddies")));
- add(onlyYou.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only you")));
+ @Inject
+ public UserSNConfActions(final Session session, final StateManager stateManager,
+ final I18nTranslationService i18n, final Provider<UserSNVisibilityMenuItem> userBuddiesVisibility,
+ final CoreResources res, final IsGroupCondition isGroupCondition,
+ final AddNewBuddiesAction addNewBuddiesAction) {
+ OPTIONS_MENU.withToolTip(i18n.t("Options")).withIcon(res.arrowdownsitebar()).withStyles(
+ GroupSNConfActions.OPTIONS_STYLES);
+ final MenuRadioItemDescriptor anyoneItem = userBuddiesVisibility.get().withVisibility(
+ UserSNetVisibility.anyone);
+ final MenuRadioItemDescriptor onlyYourBuddiesItem = userBuddiesVisibility.get().withVisibility(
+ UserSNetVisibility.yourbuddies);
+ final MenuRadioItemDescriptor onlyYou = userBuddiesVisibility.get().withVisibility(
+ UserSNetVisibility.onlyyou);
+ assert anyoneItem.getAction() != onlyYourBuddiesItem.getAction();
+ assert anyoneItem.getAction() != onlyYou.getAction();
+ add(OPTIONS_MENU);
+ add(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view your network")).withParent(OPTIONS_MENU));
+ add(anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone")));
+ add(onlyYourBuddiesItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only your buddies")));
+ add(onlyYou.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only you")));
- final ButtonDescriptor addBuddieBtn = new ButtonDescriptor(addNewBuddiesAction);
+ final ButtonDescriptor addBuddieBtn = new ButtonDescriptor(addNewBuddiesAction);
- add(addBuddieBtn.withStyles("k-no-backimage"));
+ add(addBuddieBtn.withStyles("k-no-backimage"));
- stateManager.onStateChanged(true, new StateChangedHandler() {
- @Override
- public void onStateChanged(final StateChangedEvent event) {
- final StateAbstractDTO state = event.getState();
- final boolean administrable = state.getGroupRights().isAdministrable();
- OPTIONS_MENU.setVisible(administrable);
- OPTIONS_MENU.setEnabled(administrable);
- if (state.getGroup().isPersonal()) {
- final UserSNetVisibility visibility = state.getSocialNetworkData().getUserBuddiesVisibility();
- switch (visibility) {
- case anyone:
- anyoneItem.setChecked(true);
- break;
- case yourbuddies:
- onlyYourBuddiesItem.setChecked(true);
- break;
- case onlyyou:
- onlyYou.setChecked(true);
- break;
- }
- // NotifyUser.info(i18n.t("Visibility of your network is " +
- // visibility.toString()));
- }
- addBuddieBtn.setVisible(session.isLogged() && state.getGroup().isPersonal()
- && session.getCurrentUser().getShortName().equals(state.getGroup().getShortName()));
- }
- });
- }
+ stateManager.onStateChanged(true, new StateChangedHandler() {
+ @Override
+ public void onStateChanged(final StateChangedEvent event) {
+ final StateAbstractDTO state = event.getState();
+ final boolean administrable = state.getGroupRights().isAdministrable();
+ OPTIONS_MENU.setVisible(administrable);
+ OPTIONS_MENU.setEnabled(administrable);
+ if (state.getGroup().isPersonal()) {
+ final UserSNetVisibility visibility = state.getSocialNetworkData().getUserBuddiesVisibility();
+ switch (visibility) {
+ case anyone:
+ anyoneItem.setChecked(true);
+ break;
+ case yourbuddies:
+ onlyYourBuddiesItem.setChecked(true);
+ break;
+ case onlyyou:
+ onlyYou.setChecked(true);
+ break;
+ }
+ // NotifyUser.info(i18n.t("Visibility of your network is " +
+ // visibility.toString()));
+ }
+ addBuddieBtn.setVisible(session.isLogged() && state.getGroup().isPersonal()
+ && session.getCurrentUser().getShortName().equals(state.getGroup().getShortName()));
+ }
+ });
+ }
}
Modified: trunk/src/main/java/cc/kune/wave/client/WebClient.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WebClient.java 2011-05-05 01:45:26 UTC (rev 1342)
+++ trunk/src/main/java/cc/kune/wave/client/WebClient.java 2011-05-05 02:24:50 UTC (rev 1343)
@@ -358,7 +358,7 @@
getStackTraceAsync(e, new Accessor<SafeHtml>() {
@Override
public void use(SafeHtml stack) {
- NotifyUser.error("Oops! Something has gone wrong. Please contact the site admins with <em>more details</em>", true);
+ NotifyUser.error("Oops! Something has gone wrong. Please contact the site admins with <em>more details</em>");
// error.addDetail(stack, null);
String message = stack.asString().replace("<br>", "\n");
REMOTE_LOG.severe(message);
More information about the kune-commits
mailing list