[kune-commits] r1061 - in trunk/src/main/java/org/ourproject/kune/platf/client: actions actions/toolbar ui/rte ui/rte/img

vjrj vjrj at ourproject.org
Fri Mar 6 04:09:13 CET 2009


Author: vjrj
Date: 2009-03-06 04:09:10 +0100 (Fri, 06 Mar 2009)
New Revision: 1061

Added:
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/copy.png
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/cut.png
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/insertspreadsheet.png
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/insertsymbol.png
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/inserttable.png
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/paste.png
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/redo.png
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/save.png
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/selectall.png
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/specialchars.png
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/undo.png
Modified:
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbar.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarView.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPanel.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorView.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/RTEImgResources.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/rteimg.css
Log:
Incomplete - task Better RTE (Rich Text Editor) support 


Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java	2009-03-06 01:07:03 UTC (rev 1060)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java	2009-03-06 03:09:10 UTC (rev 1061)
@@ -31,6 +31,7 @@
     private String parentMenuIconUrl;
     private String parentMenuIconCls;
     private String parentSubMenuTitle;
+    private String parentMenuTooltip;
 
     public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO,
             final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall) {
@@ -78,6 +79,10 @@
         return parentMenuTitle;
     }
 
+    public String getParentMenuTooltip() {
+        return parentMenuTooltip;
+    }
+
     public String getParentSubMenuTitle() {
         return parentSubMenuTitle;
     }
@@ -94,6 +99,10 @@
         this.parentMenuTitle = parentMenuTitle;
     }
 
+    public void setParentMenuTooltip(String parentMenuTooltip) {
+        this.parentMenuTooltip = parentMenuTooltip;
+    }
+
     public void setParentSubMenuTitle(final String parentSubMenuTitle) {
         if (parentMenuTitle == null) {
             Log.warn("Please set parentMenuTitle before");

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbar.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbar.java	2009-03-06 01:07:03 UTC (rev 1060)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbar.java	2009-03-06 03:09:10 UTC (rev 1061)
@@ -21,6 +21,7 @@
 
 import org.ourproject.kune.platf.client.actions.ActionDescriptor;
 import org.ourproject.kune.platf.client.actions.ActionItemCollection;
+import org.ourproject.kune.platf.client.actions.ActionToolbarMenuDescriptor;
 
 public interface ActionToolbar<T> {
 
@@ -36,8 +37,12 @@
 
     ActionToolbarView<T> getView();
 
+    void hideAllMenus();
+
     void setButtonEnable(ActionDescriptor<T> action, boolean enable);
 
+    void setParentMenuTitle(ActionToolbarMenuDescriptor<T> action, String origTitle, String origTooltip, String newTitle);
+
     void setPushButtonPressed(ActionDescriptor<T> action, boolean pressed);
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java	2009-03-06 01:07:03 UTC (rev 1060)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java	2009-03-06 03:09:10 UTC (rev 1061)
@@ -125,11 +125,12 @@
         final ActionToolbarMenuDescriptor<T> action = (ActionToolbarMenuDescriptor<T>) actionItem.getAction();
         final String menuTitle = action.getParentMenuTitle();
         final String menuSubTitle = action.getParentSubMenuTitle();
+        final String menuTooltip = action.getParentMenuTooltip();
         final ActionToolbarPosition pos = action.getActionPosition();
-        final String itemKey = genMenuKey(pos, menuTitle, menuSubTitle, action.getText());
+        final String itemKey = genMenuKey(pos, menuTitle, action.getParentMenuTooltip(), menuSubTitle, action.getText());
         Item item = menuItems.get(itemKey);
         if (item == null) {
-            item = createToolbarMenu(pos, menuTitle, menuSubTitle, actionItem, generateIdIfEmpty(action));
+            item = createToolbarMenu(pos, menuTitle, menuTooltip, menuSubTitle, actionItem, generateIdIfEmpty(action));
             menuItems.put(itemKey, item);
         }
         setEnableMenuItem(item, enable);
@@ -167,6 +168,12 @@
         }
     }
 
+    public void hideAllMenus() {
+        for (Menu menu : toolbarMenus.values()) {
+            menu.hide(true);
+        }
+    }
+
     public void setButtonEnable(final ActionDescriptor<T> action, final boolean enable) {
         final ToolbarButton button = findButton(action);
         if (button != null) {
@@ -176,6 +183,17 @@
         }
     }
 
+    public void setParentMenuTitle(ActionToolbarMenuDescriptor<T> action, String origTitle, String origTooltip,
+            String newTitle) {
+        final String menuKey = genMenuKey(action.getActionPosition(), origTitle, origTooltip, null, null);
+        Menu menu = toolbarMenus.get(menuKey);
+        if (menu != null) {
+            menu.setTitle(newTitle);
+        } else {
+            Log.error("Tryng to rename a non existent menu");
+        }
+    }
+
     public void setPushButtonPressed(final ActionDescriptor<T> action, final boolean pressed) {
         final ToolbarButton button = findButton(action);
         if (button != null && button.isEnableToggle()) {
@@ -203,7 +221,7 @@
     }
 
     private Item createToolbarMenu(final ActionToolbarPosition toolBarPos, final String menuTitle,
-            final String menuSubTitle, final ActionItem<T> actionItem, String id) {
+            final String menuTooltip, final String menuSubTitle, final ActionItem<T> actionItem, String id) {
         final ActionToolbarMenuDescriptor<T> action = (ActionToolbarMenuDescriptor<T>) actionItem.getAction();
         final Item item;
         if (action instanceof ActionToolbarMenuRadioDescriptor) {
@@ -244,8 +262,8 @@
             item.setId(id);
         }
 
-        final String menuKey = genMenuKey(toolBarPos, menuTitle, null, null);
-        final String subMenuKey = genMenuKey(toolBarPos, menuTitle, menuSubTitle, null);
+        final String menuKey = genMenuKey(toolBarPos, menuTitle, menuTooltip, null, null);
+        final String subMenuKey = genMenuKey(toolBarPos, menuTitle, menuTooltip, menuSubTitle, null);
         Menu menu = toolbarMenus.get(menuKey);
         Menu subMenu = toolbarMenus.get(subMenuKey);
         if (menuSubTitle != null) {
@@ -254,7 +272,7 @@
                 final MenuItem subMenuItem = new MenuItem(menuSubTitle, subMenu);
                 if (menu == null) {
                     menu = createToolbarMenu(toolBarPos, action.getParentMenuIconUrl(), action.getParentMenuIconCls(),
-                            menuTitle, menuKey);
+                            menuTitle, menuKey, "");
                 }
                 menu.addItem(subMenuItem);
                 toolbarMenus.put(subMenuKey, subMenu);
@@ -264,7 +282,8 @@
         } else {
             // Menu action without submenu
             if (menu == null) {
-                menu = createToolbarMenu(toolBarPos, action.getParentMenuIconUrl(), null, menuTitle, menuKey);
+                menu = createToolbarMenu(toolBarPos, action.getParentMenuIconUrl(), action.getParentMenuIconCls(),
+                        menuTitle, menuKey, action.getParentMenuTooltip());
             }
             menu.addItem(item);
         }
@@ -272,8 +291,9 @@
     }
 
     private Menu createToolbarMenu(final ActionToolbarPosition barPosition, final String iconUrl, final String iconCls,
-            final String menuTitle, final String menuKey) {
+            final String menuTitle, final String menuKey, final String menuTooltip) {
         final Menu menu = new Menu();
+        menu.setShadow(true);
         final ToolbarButton toolbarMenu = new ToolbarButton(menuTitle);
         toolbarMenu.setMenu(menu);
         if (iconUrl != null) {
@@ -282,6 +302,9 @@
         if (iconCls != null) {
             toolbarMenu.setIconCls(iconCls);
         }
+        if (menuTooltip != null) {
+            toolbarMenu.setTooltip(menuTooltip);
+        }
         toolbarMenus.put(menuKey, menu);
         add(barPosition, toolbarMenu);
         return menu;
@@ -317,10 +340,10 @@
         return action.getText() + action.getShortcutToS(i18n);
     }
 
-    private String genMenuKey(final ActionToolbarPosition pos, final String menuTitle, final String menuSubTitle,
-            final String actionText) {
+    private String genMenuKey(final ActionToolbarPosition pos, final String menuTitle, final String menuTooltip,
+            final String menuSubTitle, final String actionText) {
 
-        final String basePart = "km-atp-menu-" + pos.toString().substring(0, 2) + "-" + menuTitle;
+        final String basePart = "km-atp-menu-" + pos.toString().substring(0, 2) + "-" + menuTitle + "-" + menuTooltip;
         final String subMenuPart = menuSubTitle != null ? "-subm-" + menuSubTitle : "";
         final String itemPart = actionText != null ? "-item-" + actionText : "";
         return basePart + subMenuPart + itemPart;

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java	2009-03-06 01:07:03 UTC (rev 1060)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java	2009-03-06 03:09:10 UTC (rev 1061)
@@ -74,10 +74,19 @@
         return view;
     }
 
+    public void hideAllMenus() {
+        view.hideAllMenus();
+    }
+
     public void setButtonEnable(ActionDescriptor<T> action, boolean enable) {
         view.setButtonEnable(action, enable);
     }
 
+    public void setParentMenuTitle(ActionToolbarMenuDescriptor<T> action, String origTitle, String origTooltip,
+            String newTitle) {
+        view.setParentMenuTitle(action, origTitle, origTooltip, newTitle);
+    }
+
     public void setPushButtonPressed(ActionDescriptor<T> action, boolean pressed) {
         view.setPushButtonPressed(action, pressed);
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarView.java	2009-03-06 01:07:03 UTC (rev 1060)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarView.java	2009-03-06 03:09:10 UTC (rev 1061)
@@ -22,6 +22,7 @@
 import org.ourproject.kune.platf.client.View;
 import org.ourproject.kune.platf.client.actions.ActionDescriptor;
 import org.ourproject.kune.platf.client.actions.ActionItem;
+import org.ourproject.kune.platf.client.actions.ActionToolbarMenuDescriptor;
 
 public interface ActionToolbarView<T> extends View {
 
@@ -37,8 +38,12 @@
 
     void disableAllMenuItems();
 
+    void hideAllMenus();
+
     void setButtonEnable(ActionDescriptor<T> action, boolean enable);
 
+    void setParentMenuTitle(ActionToolbarMenuDescriptor<T> action, String origTitle, String origTooltip, String newTitle);
+
     void setPushButtonPressed(ActionDescriptor<T> action, boolean pressed);
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPanel.java	2009-03-06 01:07:03 UTC (rev 1060)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPanel.java	2009-03-06 03:09:10 UTC (rev 1061)
@@ -18,6 +18,7 @@
 import com.google.gwt.dom.client.Element;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.FocusListener;
 import com.google.gwt.user.client.ui.KeyboardListener;
 import com.google.gwt.user.client.ui.Widget;
 
@@ -182,30 +183,8 @@
         basic.setFontName(name);
     }
 
-    public void setFontSize(int size) {
-        switch (size) {
-        case 1:
-            basic.setFontSize(FontSize.XX_SMALL);
-            break;
-        case 2:
-            basic.setFontSize(FontSize.X_SMALL);
-            break;
-        case 3:
-            basic.setFontSize(FontSize.SMALL);
-            break;
-        case 4:
-            basic.setFontSize(FontSize.MEDIUM);
-            break;
-        case 5:
-            basic.setFontSize(FontSize.LARGE);
-            break;
-        case 6:
-            basic.setFontSize(FontSize.X_LARGE);
-            break;
-        case 7:
-            basic.setFontSize(FontSize.XX_LARGE);
-            break;
-        }
+    public void setFontSize(FontSize size) {
+        basic.setFontSize(size);
     }
 
     public void setForeColor(String color) {
@@ -249,6 +228,14 @@
     }
 
     private void createListeners() {
+        rta.addFocusListener(new FocusListener() {
+            public void onFocus(Widget sender) {
+                presenter.onEditorFocus();
+            }
+
+            public void onLostFocus(Widget sender) {
+            }
+        });
         rta.addClickListener(new ClickListener() {
             public void onClick(Widget sender) {
                 if (sender == rta) {

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPresenter.java	2009-03-06 01:07:03 UTC (rev 1060)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPresenter.java	2009-03-06 03:09:10 UTC (rev 1061)
@@ -35,6 +35,14 @@
         top, snd
     };
 
+    private final String fontNames[] = { "Times New Roman", "Arial", "Courier New", "Georgia", "Trebuchet", "Verdana" };
+    private final String fontSizes[] = { "Extra small", "Very small", "Small", "Medium", "Large", "Very large",
+            "Extra large" };
+    private static final RichTextArea.FontSize[] fontSizesConstants = new RichTextArea.FontSize[] {
+            RichTextArea.FontSize.XX_SMALL, RichTextArea.FontSize.X_SMALL, RichTextArea.FontSize.SMALL,
+            RichTextArea.FontSize.MEDIUM, RichTextArea.FontSize.LARGE, RichTextArea.FontSize.X_LARGE,
+            RichTextArea.FontSize.XX_LARGE };
+
     private static final String EDIT_MENU = "Edit";
     private static final String INSERT_MENU = "Insert";
     private static final String FORMAT_MENU = "Format";
@@ -136,6 +144,11 @@
         createBasicActions();
     }
 
+    public void onEditorFocus() {
+        topBar.hideAllMenus();
+        sndBar.hideAllMenus();
+    }
+
     public void setExtended(boolean extended) {
         this.extended = extended;
     }
@@ -169,6 +182,7 @@
                         view.selectAll();
                     }
                 });
+        selectAll.setIconCls(getCssName(imgResources.selectall()));
         selectAll.setShortcut(new ActionShortcut(true, 'A'));
         selectAll.setTextDescription(i18n.t("Select all"));
         selectAll.setParentMenuTitle(i18n.t(EDIT_MENU));
@@ -275,6 +289,7 @@
         undo.setTextDescription(i18n.t("Undo"));
         undo.setParentMenuTitle(i18n.t(EDIT_MENU));
         undo.setAddCondition(canBeExtended);
+        undo.setIconCls(getCssName(imgResources.undo()));
 
         ActionToolbarMenuDescriptor<Object> redo = new ActionToolbarMenuDescriptor<Object>(accessRol,
                 ActionToolbarPosition.topbar, new Listener0() {
@@ -286,7 +301,29 @@
         redo.setTextDescription(i18n.t("Redo"));
         redo.setParentMenuTitle(i18n.t(EDIT_MENU));
         redo.setAddCondition(canBeExtended);
+        redo.setIconCls(getCssName(imgResources.redo()));
 
+        ActionToolbarButtonDescriptor<Object> undoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol,
+                ActionToolbarPosition.topbar, new Listener0() {
+                    public void onEvent() {
+                        view.undo();
+                    }
+                });
+        undoBtn.setToolTip(i18n.t("Undo"));
+        undoBtn.setAddCondition(canBeExtended);
+        undoBtn.setIconCls(getCssName(imgResources.undo()));
+
+        ActionToolbarButtonDescriptor<Object> redoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol,
+                ActionToolbarPosition.topbar, new Listener0() {
+                    public void onEvent() {
+                        view.redo();
+                    }
+                });
+        redoBtn.setToolTip(i18n.t("Redo"));
+        redoBtn.setAddCondition(canBeExtended);
+        redoBtn.setIconCls(getCssName(imgResources.redo()));
+        redoBtn.setRightSeparator(ActionToolbarButtonSeparator.separator);
+
         ActionToolbarMenuDescriptor<Object> copy = new ActionToolbarMenuDescriptor<Object>(accessRol,
                 ActionToolbarPosition.topbar, new Listener0() {
                     public void onEvent() {
@@ -297,6 +334,7 @@
         copy.setTextDescription(i18n.t("Copy"));
         copy.setParentMenuTitle(i18n.t(EDIT_MENU));
         copy.setAddCondition(canBeExtended);
+        copy.setIconCls(getCssName(imgResources.copy()));
 
         ActionToolbarMenuDescriptor<Object> cut = new ActionToolbarMenuDescriptor<Object>(accessRol,
                 ActionToolbarPosition.topbar, new Listener0() {
@@ -308,6 +346,7 @@
         cut.setTextDescription(i18n.t("Cut"));
         cut.setParentMenuTitle(i18n.t(EDIT_MENU));
         cut.setAddCondition(canBeExtended);
+        cut.setIconCls(getCssName(imgResources.cut()));
 
         ActionToolbarMenuDescriptor<Object> paste = new ActionToolbarMenuDescriptor<Object>(accessRol,
                 ActionToolbarPosition.topbar, new Listener0() {
@@ -319,6 +358,7 @@
         paste.setTextDescription(i18n.t("Paste"));
         paste.setParentMenuTitle(i18n.t(EDIT_MENU));
         paste.setAddCondition(canBeExtended);
+        paste.setIconCls(getCssName(imgResources.paste()));
 
         ActionToolbarMenuDescriptor<Object> editHtml = new ActionToolbarMenuDescriptor<Object>(accessRol,
                 ActionToolbarPosition.topbar, new Listener0() {
@@ -326,6 +366,7 @@
                         NotifyUser.info("In dev");
                     }
                 });
+        editHtml.setIconCls(getCssName(imgResources.edithtml()));
         editHtml.setTextDescription(i18n.t("Edit HTML"));
         editHtml.setParentMenuTitle(i18n.t(EDIT_MENU));
         editHtml.setAddCondition(canBeExtended);
@@ -471,12 +512,40 @@
         removeFormat.setToolTip(i18n.t("Clear Formatting"));
         removeFormat.setShortcut(new ActionShortcut(true, ' ', "Space"));
         removeFormat.setAddCondition(canBeExtended);
+        removeFormat.setRightSeparator(ActionToolbarButtonSeparator.separator);
 
+        ActionToolbarButtonDescriptor<Object> insertTable = new ActionToolbarButtonDescriptor<Object>(accessRol,
+                ActionToolbarPosition.topbar, new Listener0() {
+                    public void onEvent() {
+                        view.insertHtml("<table id=\"iorh\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">\n"
+                                + "<tbody>\n"
+                                + "<tr>\n"
+                                + "<td width=\"50%\"><br>\n"
+                                + "</td>\n"
+                                + "<td width=\"50%\"><br>\n"
+                                + "</td>\n"
+                                + "</tr>\n"
+                                + "<tr>\n"
+                                + "<td width=\"50%\"><br>\n"
+                                + "</td>\n"
+                                + "<td width=\"50%\"><br>\n"
+                                + "</td>\n"
+                                + "</tr>\n</tbody>\n</table>");
+                    }
+                });
+        insertTable.setIconCls(getCssName(imgResources.inserttable()));
+        insertTable.setToolTip(i18n.t("Insert Table ..."));
+        insertTable.setAddCondition(canBeExtended);
+        insertTable.setRightSeparator(ActionToolbarButtonSeparator.separator);
+
         topActions.add(withNoItem(selectAll));
+        sndActions.add(withNoItem(undoBtn));
+        sndActions.add(withNoItem(redoBtn));
         sndActions.add(withNoItem(bold));
         sndActions.add(withNoItem(italic));
         sndActions.add(withNoItem(underline));
         sndActions.add(withNoItem(strikethrough));
+
         sndActions.add(withNoItem(justifyLeft));
         sndActions.add(withNoItem(justifyCentre));
         sndActions.add(withNoItem(justifyRight));
@@ -494,14 +563,57 @@
         sndActions.add(withNoItem(increaseIndent));
         sndActions.add(withNoItem(ol));
         sndActions.add(withNoItem(ul));
+        sndActions.add(withNoItem(removeFormat));
         sndActions.add(withNoItem(hrButton));
         sndActions.add(withNoItem(img));
         sndActions.add(withNoItem(createLink));
         sndActions.add(withNoItem(removeLink));
-        sndActions.add(withNoItem(removeFormat));
+        sndActions.add(withNoItem(insertTable));
         topActions.add(withNoItem(comment));
+
+        for (String fontName : this.fontNames) {
+            ActionToolbarMenuDescriptor<Object> fontNameAction = createFontNameAction(canBeBasic, fontName);
+            sndActions.add(withNoItem(fontNameAction));
+        }
+        for (int fontSize = 0; fontSize < fontSizes.length; fontSize++) {
+            ActionToolbarMenuDescriptor<Object> fontSizeAction = createFontSizeAction(canBeBasic, fontSize, fontSizes[fontSize]);
+            sndActions.add(withNoItem(fontSizeAction));
+        }
+
     }
 
+    private ActionToolbarMenuDescriptor<Object> createFontNameAction(ActionAddCondition<Object> canBeBasic,
+            final String fontName) {
+        final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol,
+                ActionToolbarPosition.topbar, new Listener0() {
+                    public void onEvent() {
+                        view.setFontName(fontName);
+                        fireOnEdit();
+                    }
+                });
+        font.setTextDescription("<span style=\"font-family: " + fontName + "\">" + fontName + "</span>");
+        font.setParentMenuTooltip(i18n.t("Font"));
+        font.setParentMenuIconCls(getCssName(imgResources.charfontname()));
+        font.setAddCondition(canBeBasic);
+        return font;
+    }
+
+    private ActionToolbarMenuDescriptor<Object> createFontSizeAction(ActionAddCondition<Object> canBeBasic,
+            final int fontSize, String fontSizeName) {
+        final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol,
+                ActionToolbarPosition.topbar, new Listener0() {
+                    public void onEvent() {
+                        view.setFontSize(fontSizesConstants[fontSize]);
+                        fireOnEdit();
+                    }
+                });
+        font.setTextDescription("<font size=\"" + (fontSize + 1) + "\">" + i18n.t(fontSizeName) + "</font>");
+        font.setParentMenuTooltip(i18n.t("Font size"));
+        font.setParentMenuIconCls(getCssName(imgResources.fontheight()));
+        font.setAddCondition(canBeBasic);
+        return font;
+    }
+
     private String getCssName(ImageResource imageResource) {
         return "k-rte-" + imageResource.getName();
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorView.java	2009-03-06 01:07:03 UTC (rev 1060)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorView.java	2009-03-06 03:09:10 UTC (rev 1061)
@@ -2,6 +2,7 @@
 
 import org.ourproject.kune.platf.client.View;
 import org.ourproject.kune.platf.client.actions.ActionItemCollection;
+import org.ourproject.kune.platf.client.ui.rte.RichTextArea.FontSize;
 
 public interface RTEditorView extends View {
 
@@ -67,7 +68,7 @@
 
     void setFontName(String name);
 
-    void setFontSize(int size);
+    void setFontSize(FontSize fontSize);
 
     void setForeColor(String color);
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/RTEImgResources.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/RTEImgResources.java	2009-03-06 01:07:03 UTC (rev 1060)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/RTEImgResources.java	2009-03-06 03:09:10 UTC (rev 1061)
@@ -24,9 +24,15 @@
     @Resource("charfontname.png")
     public ImageResource charfontname();
 
+    @Resource("copy.png")
+    public ImageResource copy();
+
     @Resource("rteimg.css")
     public CssResource css();
 
+    @Resource("cut.png")
+    public ImageResource cut();
+
     @Resource("decrementindent.png")
     public ImageResource decrementindent();
 
@@ -54,6 +60,15 @@
     @Resource("incrementindent.png")
     public ImageResource incrementindent();
 
+    @Resource("insertspreadsheet.png")
+    public ImageResource insertspreadsheet();
+
+    @Resource("insertsymbol.png")
+    public ImageResource insertsymbol();
+
+    @Resource("inserttable.png")
+    public ImageResource inserttable();
+
     @Resource("italic.png")
     public ImageResource italic();
 
@@ -63,9 +78,24 @@
     @Resource("linkbreak.png")
     public ImageResource linkbreak();
 
+    @Resource("paste.png")
+    public ImageResource paste();
+
+    @Resource("redo.png")
+    public ImageResource redo();
+
     @Resource("removeFormat.png")
     public ImageResource removeFormat();
 
+    @Resource("save.png")
+    public ImageResource save();
+
+    @Resource("selectall.png")
+    public ImageResource selectall();
+
+    @Resource("specialchars.png")
+    public ImageResource specialchars();
+
     @Resource("strikeout.png")
     public ImageResource strikeout();
 
@@ -78,4 +108,7 @@
     @Resource("underline.png")
     public ImageResource underline();
 
+    @Resource("undo.png")
+    public ImageResource undo();
+
 }
\ No newline at end of file

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


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

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


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

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


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

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


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

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


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

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


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

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


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

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/rteimg.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/rteimg.css	2009-03-06 01:07:03 UTC (rev 1060)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/rteimg.css	2009-03-06 03:09:10 UTC (rev 1061)
@@ -88,4 +88,48 @@
 
 @sprite div .k-rte-alignleft {
   gwt-image: 'alignleft';
-}
\ No newline at end of file
+}
+
+ at sprite div .k-rte-specialchars {
+  gwt-image: 'specialchars';
+}
+
+ at sprite div .k-rte-copy {
+  gwt-image: 'copy';
+}
+
+ at sprite div .k-rte-cut {
+  gwt-image: 'cut';
+}
+
+ at sprite div .k-rte-insertspreadsheet {
+  gwt-image: 'insertspreadsheet';
+}
+
+ at sprite div .k-rte-insertsymbol {
+  gwt-image: 'insertsymbol';
+}
+
+ at sprite div .k-rte-inserttable {
+  gwt-image: 'inserttable';
+}
+
+ at sprite div .k-rte-paste {
+  gwt-image: 'paste';
+}
+
+ at sprite div .k-rte-redo {
+  gwt-image: 'redo';
+}
+
+ at sprite div .k-rte-save {
+  gwt-image: 'save';
+}
+
+ at sprite div .k-rte-selectall {
+  gwt-image: 'selectall';
+}
+
+ at sprite div .k-rte-undo {
+  gwt-image: 'undo';
+}

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


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

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


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

Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/specialchars.png
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/specialchars.png	2009-03-06 01:07:03 UTC (rev 1060)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/specialchars.png	2009-03-06 03:09:10 UTC (rev 1061)
@@ -0,0 +1,5 @@
+‰PNG
+
+   
IHDR         óÿa  
IDATx^µ“ÍJÃ@€3“ll̦ƒ‘™XJ´ZŠ—x
+| ½yõ=écø$‚·êl\Ó¤Ù‹ßi?ö×ûÏn ®…ð.¬„¯
bA¹ÞzçÖ…Àв?{+ë©@n ðÑ\Z—®—^àš= DÚB%¼v[¨€w¢˜( 70"îE:™š€L:5öý€³üê›åö ÈØk5«Ïµ	dy93TÈ\ÑÝã³
ÐÜßú&PTGåO at qQÍiùðä8nØ®€ØŸÓ|B'͵[ NuÅ#þ=Ä0
+Iï'èúÚ€˜××è ¸ìžðÚcÁ9 öígü…oP¿7›ïrîˆ    IEND®B`‚
\ No newline at end of file


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/specialchars.png
___________________________________________________________________
Name: svn:mergeinfo
   + 

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


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




More information about the kune-commits mailing list