[kune-commits] r1128 - in trunk: . src/main/java/org/ourproject/kune/platf/client/actions/ui src/main/java/org/ourproject/kune/platf/client/services src/main/java/org/ourproject/kune/platf/client/ui/img src/main/java/org/ourproject/kune/platf/client/ui/rte/basic src/main/java/org/ourproject/kune/platf/client/ui/rte/saving src/main/java/org/ourproject/kune/workspace/client src/main/java/org/ourproject/kune/workspace/client/editor src/main/java/org/ourproject/kune/workspace/client/i18n src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions

vjrj vjrj at ourproject.org
Sat Jun 13 02:43:31 CEST 2009


Author: vjrj
Date: 2009-06-13 02:43:29 +0200 (Sat, 13 Jun 2009)
New Revision: 1128

Added:
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractActionExtensiblePresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractActionExtensibleView.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractComposedGuiItem.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BasicGuiBindings.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/IsActionExtensible.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/kune-icon16.png
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/language.png
   trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/SiteOptionsI18nTranslatorAction.java
Removed:
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractComplexGuiItem.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BasicGuiBinding.java
Modified:
   trunk/pom.xml
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuGui.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItemGui.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ComplexToolbar.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiActionDescrip.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuBinding.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuGui.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemDescriptor.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/ImgResources.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptions.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsView.java
Log:
Complete - task Hello World updated and Application Boot improved 

Complete - task SiteOptions use of new Actions class 


Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/pom.xml	2009-06-13 00:43:29 UTC (rev 1128)
@@ -121,6 +121,7 @@
     </dependency>
     <dependency>
       <groupId>org.xwiki.platform</groupId>
+      <!-- https://yui-ext.com/forum/showthread.php?t=5762 -->
       <artifactId>xwiki-web-gwt-dom</artifactId>
       <version>2.0-SNAPSHOT-g164</version>
     </dependency>

Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractActionExtensiblePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractActionExtensiblePresenter.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractActionExtensiblePresenter.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -0,0 +1,19 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public abstract class AbstractActionExtensiblePresenter implements IsActionExtensible {
+
+    public abstract void addAction(final GuiActionDescrip descriptor);
+
+    public void addActionCollection(final GuiActionDescCollection descriptors) {
+        for (final GuiActionDescrip descriptor : descriptors) {
+            addAction(descriptor);
+        }
+    }
+
+    public void addActions(final GuiActionDescrip... descriptors) {
+        for (final GuiActionDescrip descriptor : descriptors) {
+            addAction(descriptor);
+        }
+    }
+
+}

Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractActionExtensibleView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractActionExtensibleView.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractActionExtensibleView.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -0,0 +1,9 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.View;
+
+public interface AbstractActionExtensibleView extends View {
+
+    void addAction(GuiActionDescrip descriptor);
+
+}

Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractComplexGuiItem.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractComplexGuiItem.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractComplexGuiItem.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -1,56 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-import java.util.List;
-
-import org.ourproject.kune.platf.client.actions.AbstractAction;
-import org.ourproject.kune.platf.client.actions.InputMap;
-import org.ourproject.kune.platf.client.actions.KeyStroke;
-
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.ui.Composite;
-
-public abstract class AbstractComplexGuiItem extends Composite {
-
-    private GuiActionDescCollection guiItems;
-    private InputMap inputMap;
-
-    public void add(final GuiActionDescrip... descriptors) {
-        for (final GuiActionDescrip descriptor : descriptors) {
-            getGuiItems().add(descriptor);
-        }
-    }
-
-    public void addAll(final GuiActionDescCollection items) {
-        getGuiItems().addAll(items);
-    }
-
-    public void addAll(final List<GuiActionDescrip> items) {
-        getGuiItems().addAll(items);
-    }
-
-    public void addShortcut(final KeyStroke key, final AbstractAction action) {
-        getInputMap().put(key, action);
-    }
-
-    public AbstractAction getAction(final Event event) {
-        return getInputMap().get(KeyStroke.getKeyStrokeForEvent(event));
-    }
-
-    public GuiActionDescCollection getGuiItems() {
-        if (guiItems == null) {
-            guiItems = new GuiActionDescCollection();
-        }
-        return guiItems;
-    }
-
-    public void setInputMap(final InputMap inputMap) {
-        this.inputMap = inputMap;
-    }
-
-    private InputMap getInputMap() {
-        if (inputMap == null) {
-            inputMap = new InputMap();
-        }
-        return inputMap;
-    }
-}

Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractComposedGuiItem.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractComposedGuiItem.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractComposedGuiItem.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -0,0 +1,63 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import java.util.List;
+
+import org.ourproject.kune.platf.client.errors.UIException;
+
+import com.google.gwt.user.client.ui.Composite;
+
+public abstract class AbstractComposedGuiItem extends Composite {
+    private GuiActionDescCollection guiItems;
+    private final GuiBindingsRegister bindings;
+
+    public AbstractComposedGuiItem(final GuiBindingsRegister bindings) {
+        super();
+        this.bindings = bindings;
+    }
+
+    public void add(final GuiActionDescrip... descriptors) {
+        for (final GuiActionDescrip descriptor : descriptors) {
+            addAction(descriptor);
+        }
+    }
+
+    public void addAction(final GuiActionDescrip descriptor) {
+        getGuiItems().add(descriptor);
+        beforeAddWidget(descriptor);
+    }
+
+    public void addAll(final GuiActionDescCollection descriptors) {
+        for (final GuiActionDescrip descriptor : descriptors) {
+            addAction(descriptor);
+        }
+    }
+
+    public void addAll(final List<GuiActionDescrip> descriptors) {
+        for (final GuiActionDescrip descriptor : descriptors) {
+            addAction(descriptor);
+        }
+    }
+
+    public GuiActionDescCollection getGuiItems() {
+        if (guiItems == null) {
+            guiItems = new GuiActionDescCollection();
+        }
+        return guiItems;
+    }
+
+    protected abstract void addWidget(AbstractGuiItem item, int position, boolean visible);
+
+    protected void beforeAddWidget(final GuiActionDescrip descrip) {
+        if (descrip.mustBeAdded()) {
+            final GuiBinding binding = bindings.get(descrip.getType());
+            if (binding == null) {
+                throw new UIException("Unknown binding for: " + descrip);
+            } else {
+                final AbstractGuiItem item = binding.create(descrip);
+                if (binding.isAttachable()) {
+                    addWidget(item, descrip.getPosition(), descrip.mustBeVisible());
+                }
+            }
+        }
+    }
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuGui.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuGui.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuGui.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -25,4 +25,12 @@
         menu.insert(position, item);
     }
 
+    public void show(final int x, final int y) {
+        menu.showAt(x, y);
+    }
+
+    public void show(final String id) {
+        menu.show(id);
+    }
+
 }
\ No newline at end of file

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItemGui.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItemGui.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItemGui.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -110,6 +110,7 @@
     }
 
     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());

Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BasicGuiBinding.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BasicGuiBinding.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BasicGuiBinding.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -1,16 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-public class BasicGuiBinding {
-
-    public BasicGuiBinding(final GuiBindingsRegister bindings) {
-        bindings.register(MenuDescriptor.class, new MenuBinding());
-        final MenuItemBinding menuItemBinding = new MenuItemBinding();
-        bindings.register(MenuRadioItemDescriptor.class, menuItemBinding);
-        bindings.register(MenuCheckItemDescriptor.class, menuItemBinding);
-        bindings.register(MenuItemDescriptor.class, menuItemBinding);
-        bindings.register(MenuSeparatorDescriptor.class, new MenuSeparatorBinding());
-        bindings.register(PushButtonDescriptor.class, new PushButtonBinding());
-        bindings.register(ButtonDescriptor.class, new ButtonBinding());
-        bindings.register(ToolbarSeparatorDescriptor.class, new ToolbarSeparatorBinding());
-    }
-}

Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BasicGuiBindings.java (from rev 1124, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BasicGuiBinding.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BasicGuiBinding.java	2009-06-10 14:37:53 UTC (rev 1124)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BasicGuiBindings.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -0,0 +1,16 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class BasicGuiBindings {
+
+    public BasicGuiBindings(final GuiBindingsRegister bindings) {
+        final MenuItemBinding menuItemBinding = new MenuItemBinding();
+        bindings.register(MenuDescriptor.class, new MenuBinding());
+        bindings.register(MenuRadioItemDescriptor.class, menuItemBinding);
+        bindings.register(MenuCheckItemDescriptor.class, menuItemBinding);
+        bindings.register(MenuItemDescriptor.class, menuItemBinding);
+        bindings.register(MenuSeparatorDescriptor.class, new MenuSeparatorBinding());
+        bindings.register(PushButtonDescriptor.class, new PushButtonBinding());
+        bindings.register(ButtonDescriptor.class, new ButtonBinding());
+        bindings.register(ToolbarSeparatorDescriptor.class, new ToolbarSeparatorBinding());
+    }
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ComplexToolbar.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ComplexToolbar.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ComplexToolbar.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -1,39 +1,18 @@
 package org.ourproject.kune.platf.client.actions.ui;
 
-import java.util.List;
-
 import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.errors.UIException;
 import org.ourproject.kune.platf.client.ui.FlowToolbar;
 
-public class ComplexToolbar extends AbstractComplexGuiItem implements View {
+public class ComplexToolbar extends AbstractComposedGuiItem implements View {
 
     private final FlowToolbar toolbar;
-    private final GuiBindingsRegister bindings;
 
     public ComplexToolbar(final GuiBindingsRegister bindings) {
-        super();
-        this.bindings = bindings;
+        super(bindings);
         toolbar = new FlowToolbar();
         initWidget(toolbar);
     }
 
-    @Override
-    public void add(final GuiActionDescrip... descriptors) {
-        for (final GuiActionDescrip descrip : descriptors) {
-            super.add(descrip);
-            addWidget(descrip);
-        }
-    }
-
-    @Override
-    public void addAll(final List<GuiActionDescrip> descriptors) {
-        super.addAll(descriptors);
-        for (final GuiActionDescrip descritor : descriptors) {
-            addWidget(descritor);
-        }
-    }
-
     public void addFill() {
         toolbar.addFill();
     }
@@ -54,26 +33,15 @@
         toolbar.setNormalStyle();
     }
 
-    private void addWidget(final GuiActionDescrip descrip) {
-        if (descrip.getAddCondition().mustBeAdded()) {
-            final boolean visible = descrip.getVisibleCondition().mustBeVisible();
-            final GuiBinding binding = bindings.get(descrip.getType());
-            if (binding == null) {
-                throw new UIException("Unknown binding for: " + descrip);
-            } else {
-                final AbstractGuiItem item = binding.create(descrip);
-                if (binding.isAttachable()) {
-                    item.addStyleName("kune-floatleft");
-                    final int position = descrip.getPosition();
-                    if (position == GuiActionDescrip.NO_POSITION) {
-                        toolbar.add(item);
-                    } else {
-                        toolbar.insert(item, position);
-                    }
-                    item.setVisible(visible);
-                }
-            }
+    @Override
+    protected void addWidget(final AbstractGuiItem item, final int position, final boolean visible) {
+        item.addStyleName("kune-floatleft");
+        if (position == GuiActionDescrip.NO_POSITION) {
+            toolbar.add(item);
+        } else {
+            toolbar.insert(item, position);
         }
+        item.setVisible(visible);
     }
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiActionDescrip.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiActionDescrip.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiActionDescrip.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -98,6 +98,22 @@
         return parent != NO_PARENT;
     }
 
+    public boolean mustBeAdded() {
+        boolean result = false;
+        if (addCondition != null) {
+            result = addCondition.mustBeAdded();
+        }
+        return result;
+    }
+
+    public boolean mustBeVisible() {
+        boolean result = false;
+        if (visibleCondition != null) {
+            result = visibleCondition.mustBeVisible();
+        }
+        return result;
+    }
+
     /**
      * Sets the value associated with the specified key.
      * 

Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/IsActionExtensible.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/IsActionExtensible.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/IsActionExtensible.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -0,0 +1,29 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public interface IsActionExtensible {
+
+    /**
+     * Adds a action description
+     * 
+     * @param action
+     *            the action
+     */
+    void addAction(GuiActionDescrip action);
+
+    /**
+     * Adds some action descriptions
+     * 
+     * @param actions
+     *            the actions
+     */
+    void addActionCollection(GuiActionDescCollection actions);
+
+    /**
+     * Adds some action descriptions
+     * 
+     * @param action
+     *            the action
+     */
+    void addActions(GuiActionDescrip... actions);
+
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuBinding.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuBinding.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuBinding.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -25,7 +25,7 @@
             isSubmenu = true;
         } else {
             // Is main parent menu
-            final MenuGui menu = new MenuGui(descriptor);
+            final MenuGui menu = new MenuGui((MenuDescriptor) descriptor);
             descriptor.putValue(UI_MENU, menu);
             item = menu;
             isSubmenu = false;

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -9,6 +9,12 @@
 
     public static final String MENU_HIDE = "hidemenu";
 
+    private boolean standalone;
+
+    public MenuDescriptor() {
+        this(new BaseAction(null, null, null));
+    }
+
     public MenuDescriptor(final AbstractAction action) {
         this(NO_PARENT, action);
     }
@@ -17,6 +23,7 @@
         super(action);
         setParent(parent);
         action.putValue(MENU_HIDE, false);
+        standalone = false;
     }
 
     public MenuDescriptor(final String text) {
@@ -44,6 +51,21 @@
         action.putValue(MENU_HIDE, !((Boolean) action.getValue(MENU_HIDE)));
     }
 
+    public boolean isStandalone() {
+        return standalone;
+    }
+
+    /**
+     * Sets the standalone property (if the menu should have button (for a
+     * toolbar) or is a menu independent.
+     * 
+     * @param standalone
+     *            the new standalone
+     */
+    public void setStandalone(final boolean standalone) {
+        this.standalone = standalone;
+    }
+
     public void setText(final String text) {
         action.putValue(Action.NAME, text);
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuGui.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuGui.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuGui.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -9,14 +9,20 @@
 
 public class MenuGui extends AbstractMenuGui {
 
-    private final ToolbarButton button;
+    private final boolean notStandAlone;
+    private ToolbarButton button = null;
 
-    public MenuGui(final GuiActionDescrip descriptor) {
+    public MenuGui(final MenuDescriptor descriptor) {
         super();
-        button = new ToolbarButton();
-        button.setMenu(menu);
         setAction(descriptor.action);
-        initWidget(button);
+        // Standalone menus are menus without and associated button in a toolbar
+        // (sometimes, a menu showed in a grid, or other special widgets)
+        notStandAlone = !descriptor.isStandalone();
+        if (notStandAlone) {
+            button = new ToolbarButton();
+            button.setMenu(menu);
+            initWidget(button);
+        }
         descriptor.action.addPropertyChangeListener(new PropertyChangeListener() {
             public void propertyChange(final PropertyChangeEvent event) {
                 if (event.getPropertyName().equals(MenuDescriptor.MENU_HIDE)) {
@@ -26,37 +32,37 @@
         });
     }
 
-    public void add(final SubMenuGui submenu) {
-        menu.addItem(submenu.getMenuItem());
-    };
-
-    public void insert(final int position, final SubMenuGui submenu) {
-        menu.insert(position, submenu.getMenuItem());
-    }
-
     @Override
     public void setEnabled(final boolean enabled) {
-        if (enabled) {
-            button.enable();
-        } else {
-            button.disable();
+        if (notStandAlone) {
+            if (enabled) {
+                button.enable();
+            } else {
+                button.disable();
+            }
         }
     }
 
     @Override
     public void setIcon(final ImageResource imageResource) {
-        if (imageResource != null) {
-            button.setIcon(ImgConstants.PATH_PREFIX + imageResource.getName() + ".png");
+        if (notStandAlone) {
+            if (imageResource != null) {
+                button.setIcon(ImgConstants.PATH_PREFIX + imageResource.getName() + ".png");
+            }
         }
     }
 
     @Override
     public void setText(final String text) {
-        button.setText(text);
+        if (notStandAlone) {
+            button.setText(text);
+        }
     }
 
     @Override
     public void setToolTipText(final String tooltip) {
-        button.setTooltip(tooltip);
+        if (notStandAlone) {
+            button.setTooltip(tooltip);
+        }
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemDescriptor.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemDescriptor.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -4,6 +4,10 @@
 
 public class MenuItemDescriptor extends GuiActionDescrip {
 
+    public MenuItemDescriptor(final AbstractAction action) {
+        super(action);
+    }
+
     public MenuItemDescriptor(final MenuDescriptor parent, final AbstractAction action) {
         super(action);
         setParent(parent);

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -19,7 +19,7 @@
  \*/
 package org.ourproject.kune.platf.client.services;
 
-import org.ourproject.kune.platf.client.actions.ui.BasicGuiBinding;
+import org.ourproject.kune.platf.client.actions.ui.BasicGuiBindings;
 import org.ourproject.kune.platf.client.actions.ui.GuiBindingsRegister;
 import org.ourproject.kune.platf.client.app.Application;
 import org.ourproject.kune.platf.client.app.ApplicationComponentGroup;
@@ -439,10 +439,10 @@
                 return new ExternalMediaRegistry(i(Session.class).getInitData().getExtMediaDescrips());
             }});
 
-        register(Singleton.class, new Factory<BasicGuiBinding>(BasicGuiBinding.class) {
+        register(Singleton.class, new Factory<BasicGuiBindings>(BasicGuiBindings.class) {
             @Override
-            public BasicGuiBinding create() {
-                return new BasicGuiBinding(i(GuiBindingsRegister.class));
+            public BasicGuiBindings create() {
+                return new BasicGuiBindings(i(GuiBindingsRegister.class));
             }
         });
 
@@ -453,7 +453,7 @@
             }
             @Override
             public void onAfterCreated(final GuiBindingsRegister instance) {
-                i(BasicGuiBinding.class);
+                i(BasicGuiBindings.class);
             }
         });
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/ImgResources.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/ImgResources.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/ImgResources.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -12,4 +12,10 @@
     @Resource("info.png")
     ImageResource info();
 
+    @Resource("kune-icon16.png")
+    ImageResource kuneIcon16();
+
+    @Resource("language.png")
+    ImageResource language();
+
 }
\ No newline at end of file

Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/kune-icon16.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/kune-icon16.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/language.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/language.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -3,9 +3,9 @@
 import org.ourproject.kune.platf.client.View;
 import org.ourproject.kune.platf.client.actions.AbstractAction;
 import org.ourproject.kune.platf.client.actions.KeyStroke;
-import org.ourproject.kune.platf.client.actions.ui.GuiActionDescCollection;
 import org.ourproject.kune.platf.client.actions.ui.GuiActionDescrip;
 import org.ourproject.kune.platf.client.actions.ui.GuiAddCondition;
+import org.ourproject.kune.platf.client.actions.ui.IsActionExtensible;
 import org.ourproject.kune.platf.client.actions.ui.MenuDescriptor;
 
 import com.calclab.suco.client.events.Listener0;
@@ -14,7 +14,7 @@
 /**
  * The Interface RTEditor.
  */
-public interface RTEditor {
+public interface RTEditor extends IsActionExtensible {
 
     /**
      * The TOPBAR location used in {@link GuiActionDescrip#setLocation(String)}
@@ -35,30 +35,6 @@
     String LINKCTX = "rte-linkctx";
 
     /**
-     * Adds a action description
-     * 
-     * @param action
-     *            the action
-     */
-    void addAction(GuiActionDescrip action);
-
-    /**
-     * Adds some action descriptions
-     * 
-     * @param actions
-     *            the actions
-     */
-    void addActionCollection(GuiActionDescCollection actions);
-
-    /**
-     * Adds some action descriptions
-     * 
-     * @param action
-     *            the action
-     */
-    void addActions(GuiActionDescrip... actions);
-
-    /**
      * Adds the on edit listener (fired when the user do some edit).
      * 
      * @param listener

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -6,9 +6,9 @@
 import org.ourproject.kune.platf.client.View;
 import org.ourproject.kune.platf.client.actions.AbstractAction;
 import org.ourproject.kune.platf.client.actions.ActionEvent;
-import org.ourproject.kune.platf.client.actions.ui.AbstractComplexGuiItem;
+import org.ourproject.kune.platf.client.actions.InputMap;
+import org.ourproject.kune.platf.client.actions.KeyStroke;
 import org.ourproject.kune.platf.client.actions.ui.ComplexToolbar;
-import org.ourproject.kune.platf.client.actions.ui.GuiActionDescCollection;
 import org.ourproject.kune.platf.client.actions.ui.GuiActionDescrip;
 import org.ourproject.kune.platf.client.actions.ui.GuiBindingsRegister;
 import org.ourproject.kune.platf.client.errors.UIException;
@@ -38,8 +38,9 @@
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.DeferredCommand;
 import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.Composite;
 
-public class RTEditorPanel extends AbstractComplexGuiItem implements RTEditorView, FocusHandler, BlurHandler {
+public class RTEditorPanel extends Composite implements RTEditorView, FocusHandler, BlurHandler {
 
     private static final Element NO_ELEMENT = null;
     private final I18nUITranslationService i18n;
@@ -51,18 +52,18 @@
     private final RichTextArea rta;
     private final ComplexToolbar topBar;
     private final ComplexToolbar sndBar;
+    private InputMap inputMap;
 
     public RTEditorPanel(final RTEditorPresenter presenter, final I18nUITranslationService i18n,
-            final GlobalShortcutRegister globalShortcutReg, final GuiBindingsRegister bindReg) {
-        super();
+            final GlobalShortcutRegister globalShortcutReg, final GuiBindingsRegister bindings) {
         this.presenter = presenter;
         this.i18n = i18n;
         this.globalShortcutReg = globalShortcutReg;
         rta = new RichTextArea();
         basic = rta.getBasicFormatter();
         extended = rta.getExtendedFormatter();
-        topBar = new ComplexToolbar(bindReg);
-        sndBar = new ComplexToolbar(bindReg);
+        topBar = new ComplexToolbar(bindings);
+        sndBar = new ComplexToolbar(bindings);
         sndBar.setNormalStyle();
         rta.addFocusHandler(this);
         rta.addBlurHandler(this);
@@ -72,23 +73,20 @@
         setHeight("100%");
     }
 
-    public void addActions(final GuiActionDescCollection items) {
-        super.addAll(items);
-        for (final GuiActionDescrip item : items) {
-            final String location = item.getLocation();
-            if (location == null) {
-                throw new UIException("Unknown location in action item: " + item);
-            }
-            if (location.equals(RTEditor.TOPBAR)) {
-                topBar.add(item);
-            } else if (location.equals(RTEditor.SNDBAR)) {
-                sndBar.add(item);
-            } else if (location.equals(RTEditor.LINKCTX)) {
-                linkCtxMenu.add(item);
-            } else {
-                throw new UIException("Unknown location in action item: " + item);
-            }
+    public void addAction(final GuiActionDescrip item) {
+        final String location = item.getLocation();
+        if (location == null) {
+            throw new UIException("Unknown location in action item: " + item);
         }
+        if (location.equals(RTEditor.TOPBAR)) {
+            topBar.addAction(item);
+        } else if (location.equals(RTEditor.SNDBAR)) {
+            sndBar.addAction(item);
+        } else if (location.equals(RTEditor.LINKCTX)) {
+            linkCtxMenu.add(item);
+        } else {
+            throw new UIException("Unknown location in action item: " + item);
+        }
     }
 
     public void adjustSize(final int height) {
@@ -299,7 +297,7 @@
             super.onBrowserEvent(event);
             break;
         case Event.ONKEYPRESS:
-            final AbstractAction rtaActionItem = super.getAction(event);
+            final AbstractAction rtaActionItem = inputMap.get(KeyStroke.getKeyStrokeForEvent(event));
             // FIXME
             // final Action actionItem = rtaActionItem == null ?
             // globalShortcutReg.get(event) : rtaActionItem;
@@ -379,6 +377,10 @@
         rta.setHTML(html);
     }
 
+    public void setInputMap(final InputMap inputMap) {
+        this.inputMap = inputMap;
+    }
+
     public void setText(final String text) {
         rta.setText(text);
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -15,6 +15,7 @@
 import org.ourproject.kune.platf.client.actions.ActionEvent;
 import org.ourproject.kune.platf.client.actions.InputMap;
 import org.ourproject.kune.platf.client.actions.KeyStroke;
+import org.ourproject.kune.platf.client.actions.ui.AbstractActionExtensiblePresenter;
 import org.ourproject.kune.platf.client.actions.ui.ButtonDescriptor;
 import org.ourproject.kune.platf.client.actions.ui.GuiActionDescCollection;
 import org.ourproject.kune.platf.client.actions.ui.GuiActionDescrip;
@@ -52,7 +53,7 @@
 import com.google.gwt.libideas.resources.client.ImageResource;
 import com.google.gwt.user.client.Event;
 
-public class RTEditorPresenter implements RTEditor {
+public class RTEditorPresenter extends AbstractActionExtensiblePresenter implements RTEditor {
 
     public class BackgroundColorAction extends AbstractExtendedAction {
 
@@ -710,25 +711,12 @@
         fontActions = new HashMap<String, MenuCheckItemDescriptor>();
     }
 
+    @Override
     public void addAction(final GuiActionDescrip descriptor) {
         actions.add(descriptor);
         checkForMenus(descriptor);
     }
 
-    public void addActionCollection(final GuiActionDescCollection descriptors) {
-        actions.addAll(descriptors);
-        for (final GuiActionDescrip descriptor : descriptors) {
-            checkForMenus(descriptor);
-        }
-    }
-
-    public void addActions(final GuiActionDescrip... descriptors) {
-        actions.add(descriptors);
-        for (final GuiActionDescrip descriptor : descriptors) {
-            checkForMenus(descriptor);
-        }
-    }
-
     public void addOnEditListener(final Listener0 listener) {
         onEdit.add(listener);
     }
@@ -740,7 +728,7 @@
     public void attach() {
         if (!attached) {
             attached = true;
-            view.addActions(actions);
+            attachActions();
             view.setInputMap(inputMap);
         }
     }
@@ -884,6 +872,12 @@
         }
     }
 
+    private void attachActions() {
+        for (final GuiActionDescrip descriptor : actions) {
+            view.addAction(descriptor);
+        }
+    }
+
     private void checkForMenus(final GuiActionDescrip descriptor) {
         if (descriptor instanceof MenuDescriptor) {
             menus.add((MenuDescriptor) descriptor);
@@ -1098,7 +1092,7 @@
         setActionShortcut(KeyStroke.getKeyStroke(Character.valueOf('I'), Keyboard.MODIFIER_ALT), devInfoAction);
 
         actions = new GuiActionDescCollection();
-        actions.add(fileMenu, editMenu, formatMenu, insertMenu, undo, redo, editMenuSep, copy, cut, paste, editMenuSep,
+        addActions(fileMenu, editMenu, formatMenu, insertMenu, undo, redo, editMenuSep, copy, cut, paste, editMenuSep,
                 select, editMenuSep, editHtml, editLink, img, insertTable, insertMedia, insertMenuSep,
                 insertSpecialChar, comment, hline, removeFormat, formatMenuSep, insertMenuSep, undoBtn, redoBtn,
                 sndbarSep, bold, italic, underline, strikethrough, sndbarSep, justifyLeft, justifyCentre, justifyRight,

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -2,14 +2,12 @@
 
 import org.ourproject.kune.platf.client.View;
 import org.ourproject.kune.platf.client.actions.InputMap;
-import org.ourproject.kune.platf.client.actions.ui.GuiActionDescCollection;
+import org.ourproject.kune.platf.client.actions.ui.AbstractActionExtensibleView;
 import org.ourproject.kune.platf.client.ui.rte.RichTextArea.FontSize;
 import org.ourproject.kune.platf.client.ui.rte.insertlink.LinkInfo;
 
-public interface RTEditorView extends View {
+public interface RTEditorView extends AbstractActionExtensibleView {
 
-    void addActions(GuiActionDescCollection actions);
-
     void adjustSize(int height);
 
     boolean canBeBasic();

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -262,12 +262,12 @@
         saveClose.setLocation(RTEditor.TOPBAR);
         saveCloseBtn.setLocation(RTEditor.TOPBAR);
 
-        super.addAction(saveMenu);
-        super.addAction(saveBtn);
-        super.addAction(autoSaveItem);
-        super.addAction(saveClose);
-        super.addAction(saveCloseBtn);
-        super.addAction(closeItem);
+        addAction(saveMenu);
+        addAction(saveBtn);
+        addAction(autoSaveItem);
+        addAction(saveClose);
+        addAction(saveCloseBtn);
+        addAction(closeItem);
     }
 
     private void enableSaveBtn(final boolean enabled) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -49,9 +49,9 @@
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
+import org.ourproject.kune.platf.client.ui.img.ImgResources;
 import org.ourproject.kune.platf.client.ui.noti.NotifyUser;
 import org.ourproject.kune.platf.client.ui.palette.ColorWebSafePalette;
-import org.ourproject.kune.platf.client.ui.rte.TestRTEDialog;
 import org.ourproject.kune.platf.client.ui.rte.edithtml.EditHtmlDialog;
 import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources;
 import org.ourproject.kune.platf.client.ui.rte.insertimg.InsertImageDialog;
@@ -104,6 +104,7 @@
 import org.ourproject.kune.workspace.client.i18n.LanguageSelectorPanel;
 import org.ourproject.kune.workspace.client.i18n.LanguageSelectorPresenter;
 import org.ourproject.kune.workspace.client.i18n.LanguageSelectorView;
+import org.ourproject.kune.workspace.client.i18n.SiteOptionsI18nTranslatorAction;
 import org.ourproject.kune.workspace.client.licensefoot.EntityLicensePanel;
 import org.ourproject.kune.workspace.client.licensefoot.EntityLicensePresenter;
 import org.ourproject.kune.workspace.client.licensewizard.LicenseChangeAction;
@@ -375,9 +376,10 @@
         register(ApplicationComponentGroup.class, new Factory<SiteOptions>(SiteOptions.class) {
             @Override
             public SiteOptions create() {
-                final SiteOptionsPresenter presenter = new SiteOptionsPresenter();
-                final SiteOptionsPanel panel = new SiteOptionsPanel(presenter, i(WorkspaceSkeleton.class),
-                        i(I18nUITranslationService.class), p(I18nTranslator.class), p(TestRTEDialog.class));
+                final SiteOptionsPresenter presenter = new SiteOptionsPresenter(i(I18nUITranslationService.class),
+                        i(ImgResources.class));
+                final SiteOptionsPanel panel = new SiteOptionsPanel(i(WorkspaceSkeleton.class),
+                        i(I18nUITranslationService.class), i(GuiBindingsRegister.class));
                 presenter.init(panel);
                 return presenter;
             }
@@ -572,8 +574,8 @@
                         i(Session.class), p(SocialNetworkServiceAsync.class), i(WsThemePresenter.class),
                         i(GroupActionRegistry.class), i(ActionParticipationToolbar.class), p(FileDownloadUtils.class));
                 final ParticipationSummaryView view = new ParticipationSummaryPanel(presenter,
-                        i(I18nUITranslationService.class), i(WorkspaceSkeleton.class),
-                        (i(ActionParticipationToolbar.class).getView()));
+                        i(I18nUITranslationService.class), i(WorkspaceSkeleton.class), i(
+                                ActionParticipationToolbar.class).getView());
                 presenter.init(view);
                 return presenter;
             }
@@ -762,6 +764,15 @@
             }
         });
 
+        register(ApplicationComponentGroup.class, new Factory<SiteOptionsI18nTranslatorAction>(
+                SiteOptionsI18nTranslatorAction.class) {
+            @Override
+            public SiteOptionsI18nTranslatorAction create() {
+                return new SiteOptionsI18nTranslatorAction(i(SiteOptions.class), i(I18nTranslationService.class),
+                        i(ImgResources.class), p(I18nTranslator.class));
+            }
+        });
+
         register(Singleton.class, new Factory<SignIn>(SignIn.class) {
             @Override
             public SignIn create() {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorPresenter.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorPresenter.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -137,7 +137,7 @@
         final KeyStroke key = KeyStroke.getKeyStroke(Keyboard.KEY_F2, 0);
         renameAction.putValue(Action.ACCELERATOR_KEY, key);
         super.setActionShortcut(key, renameAction);
-        super.addAction(renameItem);
+        addAction(renameItem);
     }
 
     private void adjHeight(final int height) {

Added: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/SiteOptionsI18nTranslatorAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/SiteOptionsI18nTranslatorAction.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/SiteOptionsI18nTranslatorAction.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -0,0 +1,31 @@
+package org.ourproject.kune.workspace.client.i18n;
+
+import org.ourproject.kune.platf.client.actions.AbstractAction;
+import org.ourproject.kune.platf.client.actions.Action;
+import org.ourproject.kune.platf.client.actions.ActionEvent;
+import org.ourproject.kune.platf.client.actions.ui.MenuItemDescriptor;
+import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
+import org.ourproject.kune.platf.client.ui.img.ImgResources;
+import org.ourproject.kune.workspace.client.sitebar.siteoptions.SiteOptions;
+
+import com.calclab.suco.client.ioc.Provider;
+
+public class SiteOptionsI18nTranslatorAction extends AbstractAction {
+    private final Provider<I18nTranslator> translator;
+
+    public SiteOptionsI18nTranslatorAction(final SiteOptions siteOptions, final I18nTranslationService i18n,
+            final ImgResources img, final Provider<I18nTranslator> translator) {
+        super();
+        this.translator = translator;
+        putValue(Action.NAME, i18n.t("Help with the translation"));
+        putValue(Action.SMALL_ICON, img.language());
+        final MenuItemDescriptor item = new MenuItemDescriptor(this);
+        item.setPosition(0);
+        siteOptions.addAction(item);
+    }
+
+    public void actionPerformed(final ActionEvent event) {
+        translator.get().doShowTranslator();
+    }
+
+}

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptions.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptions.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -19,6 +19,7 @@
  \*/
 package org.ourproject.kune.workspace.client.sitebar.siteoptions;
 
-public interface SiteOptions {
+import org.ourproject.kune.platf.client.actions.ui.IsActionExtensible;
 
+public interface SiteOptions extends IsActionExtensible {
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsPanel.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsPanel.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -19,81 +19,52 @@
  \*/
 package org.ourproject.kune.workspace.client.sitebar.siteoptions;
 
+import org.ourproject.kune.platf.client.actions.ui.AbstractComposedGuiItem;
+import org.ourproject.kune.platf.client.actions.ui.AbstractGuiItem;
+import org.ourproject.kune.platf.client.actions.ui.AbstractMenuGui;
+import org.ourproject.kune.platf.client.actions.ui.GuiBindingsRegister;
+import org.ourproject.kune.platf.client.actions.ui.MenuBinding;
+import org.ourproject.kune.platf.client.actions.ui.MenuDescriptor;
 import org.ourproject.kune.platf.client.i18n.I18nUITranslationService;
-import org.ourproject.kune.platf.client.ui.KuneWindowUtils;
-import org.ourproject.kune.platf.client.ui.rte.TestRTEDialog;
-import org.ourproject.kune.workspace.client.i18n.I18nTranslator;
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
 
-import com.calclab.suco.client.ioc.Provider;
-import com.google.gwt.dom.client.Element;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.user.client.ui.PushButton;
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.widgets.menu.BaseItem;
-import com.gwtext.client.widgets.menu.Item;
-import com.gwtext.client.widgets.menu.Menu;
-import com.gwtext.client.widgets.menu.event.BaseItemListenerAdapter;
 
-public class SiteOptionsPanel implements SiteOptionsView {
+public class SiteOptionsPanel extends AbstractComposedGuiItem implements SiteOptionsView {
 
-    public SiteOptionsPanel(final SiteOptionsPresenter presenter, final WorkspaceSkeleton ws,
-            final I18nUITranslationService i18n, final Provider<I18nTranslator> translatorProvider,
-            final Provider<TestRTEDialog> editor) {
+    private static final String BTN_ID = "k-sopts-btn-id";
+    private AbstractMenuGui menu;
+
+    public SiteOptionsPanel(final WorkspaceSkeleton wspace, final I18nUITranslationService i18n,
+            final GuiBindingsRegister bindings) {
+        super(bindings);
         final PushButton optionsButton = new PushButton("");
         // optionsButton.setText(i18n.t("Options"));
         optionsButton.setHTML(i18n.t("Options")
                 + "<img style=\"vertical-align: middle;\" src=\"images/arrowdown.png\" />");
         optionsButton.setStyleName("k-sitebar-labellink");
-        ws.getSiteBar().addSeparator();
-        ws.getSiteBar().add(optionsButton);
-        ws.getSiteBar().addSpacer();
-        ws.getSiteBar().addSpacer();
-        final Menu optionsMenu = new Menu();
+        optionsButton.ensureDebugId(BTN_ID);
+        wspace.getSiteBar().addSeparator();
+        wspace.getSiteBar().add(optionsButton);
+        wspace.getSiteBar().addSpacer();
+        wspace.getSiteBar().addSpacer();
+
         optionsButton.addClickHandler(new ClickHandler() {
             public void onClick(final ClickEvent event) {
-                final Element sender = event.getRelativeElement();
-                optionsMenu.showAt(sender.getAbsoluteLeft(), sender.getAbsoluteTop() + 10);
+                menu.show(optionsButton.getElement().getId());
             }
         });
+    }
 
-        final Item testRTE = new Item(i18n.t("Test new RTE"), new BaseItemListenerAdapter() {
-            @Override
-            public void onClick(final BaseItem item, final EventObject e) {
-                final TestRTEDialog testRTEDialog = editor.get();
-                testRTEDialog.setExtended(true);
-                testRTEDialog.show();
-            }
-        }, "");
+    public void setMenu(final MenuDescriptor menuDescriptor) {
+        menu = (AbstractMenuGui) menuDescriptor.getValue(MenuBinding.UI_MENU);
+    }
 
-        final Item testRTEbasic = new Item(i18n.t("Test new RTE (basic mode)"), new BaseItemListenerAdapter() {
-            @Override
-            public void onClick(final BaseItem item, final EventObject e) {
-                final TestRTEDialog testRTEDialog = editor.get();
-                testRTEDialog.setExtended(false);
-                testRTEDialog.show();
-            }
-        }, "");
-
-        final Item linkHelpInTrans = new Item(i18n.t("Help with the translation"), new BaseItemListenerAdapter() {
-            @Override
-            public void onClick(final BaseItem item, final EventObject e) {
-                super.onClick(item, e);
-                translatorProvider.get().doShowTranslator();
-            }
-        }, "images/language.gif");
-
-        final Item linkKuneBugs = new Item(i18n.t("Report kune bugs"), new BaseItemListenerAdapter() {
-            @Override
-            public void onClick(final BaseItem item, final EventObject e) {
-                super.onClick(item, e);
-                KuneWindowUtils.open("http://ourproject.org/tracker/?group_id=407");
-            }
-        }, "images/kuneicon16.gif");
-        optionsMenu.addItem(testRTEbasic);
-        optionsMenu.addItem(testRTE);
-        optionsMenu.addItem(linkHelpInTrans);
-        optionsMenu.addItem(linkKuneBugs);
+    @Override
+    protected void addWidget(final AbstractGuiItem item, final int position, final boolean visible) {
+        // Do nothing (menu items are attached automatically to its menu
     }
+
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsPresenter.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsPresenter.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -20,20 +20,60 @@
 package org.ourproject.kune.workspace.client.sitebar.siteoptions;
 
 import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.actions.AbstractExtendedAction;
+import org.ourproject.kune.platf.client.actions.Action;
+import org.ourproject.kune.platf.client.actions.ActionEvent;
+import org.ourproject.kune.platf.client.actions.ui.AbstractActionExtensiblePresenter;
+import org.ourproject.kune.platf.client.actions.ui.GuiActionDescrip;
+import org.ourproject.kune.platf.client.actions.ui.MenuDescriptor;
+import org.ourproject.kune.platf.client.actions.ui.MenuItemDescriptor;
+import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
+import org.ourproject.kune.platf.client.ui.KuneWindowUtils;
+import org.ourproject.kune.platf.client.ui.img.ImgResources;
 
-public class SiteOptionsPresenter implements SiteOptions {
+public class SiteOptionsPresenter extends AbstractActionExtensiblePresenter implements SiteOptions {
 
     private SiteOptionsView view;
+    private MenuDescriptor menuDescriptor;
+    private final I18nTranslationService i18n;
+    private final ImgResources img;
 
-    public SiteOptionsPresenter() {
+    public SiteOptionsPresenter(final I18nTranslationService i18n, final ImgResources img) {
+        super();
+        this.i18n = i18n;
+        this.img = img;
     }
 
+    @Override
+    public void addAction(final GuiActionDescrip descriptor) {
+        descriptor.setParent(menuDescriptor);
+        view.addAction(descriptor);
+    }
+
     public View getView() {
         return view;
     }
 
     public void init(final SiteOptionsView view) {
         this.view = view;
+        createActions();
     }
 
+    private void createActions() {
+        menuDescriptor = new MenuDescriptor();
+        menuDescriptor.setStandalone(true);
+        view.addAction(menuDescriptor);
+        view.setMenu(menuDescriptor);
+
+        final AbstractExtendedAction bugsAction = new AbstractExtendedAction() {
+            public void actionPerformed(final ActionEvent event) {
+                KuneWindowUtils.open("http://ourproject.org/tracker/?group_id=407");
+            }
+        };
+        bugsAction.putValue(Action.NAME, i18n.t("Report kune bugs"));
+        bugsAction.putValue(Action.SMALL_ICON, img.kuneIcon16());
+        final MenuItemDescriptor item = new MenuItemDescriptor(bugsAction);
+        addAction(item);
+    }
+
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsView.java	2009-06-12 00:39:51 UTC (rev 1127)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsView.java	2009-06-13 00:43:29 UTC (rev 1128)
@@ -19,7 +19,11 @@
  \*/
 package org.ourproject.kune.workspace.client.sitebar.siteoptions;
 
-import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.actions.ui.AbstractActionExtensibleView;
+import org.ourproject.kune.platf.client.actions.ui.MenuDescriptor;
 
-public interface SiteOptionsView extends View {
+public interface SiteOptionsView extends AbstractActionExtensibleView {
+
+    void setMenu(MenuDescriptor menuDescriptor);
+
 }




More information about the kune-commits mailing list