[kune-commits] r1056 - in trunk/src/main/java/org/ourproject/kune:
app/public/css platf/client/actions/toolbar
platf/client/services platf/client/ui/rte
platf/client/ui/rte/img workspace/client/site/msg
vjrj
vjrj at ourproject.org
Tue Mar 3 16:10:57 CET 2009
Author: vjrj
Date: 2009-03-03 16:10:55 +0100 (Tue, 03 Mar 2009)
New Revision: 1056
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/linkbreak.png
Removed:
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/link_break.png
trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/MessagePresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SimpleMessagePanel.java
Modified:
trunk/src/main/java/org/ourproject/kune/app/public/css/richtext.css
trunk/src/main/java/org/ourproject/kune/app/public/css/rte.css
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/services/KunePlatformModule.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/app/public/css/richtext.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/richtext.css 2009-03-03 01:35:36 UTC (rev 1055)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/richtext.css 2009-03-03 15:10:55 UTC (rev 1056)
@@ -13,4 +13,4 @@
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.4.1
-*/h1{font-size:138.5%;}h2{font-size:123.099998%;}h3{font-size:108%;}h1,h2,h3{margin:1em 0;}h1,h2,h3,h4,h5,h6,strong{font-weight:700;}abbr,acronym{border-bottom:1px dotted #000;cursor:help;}em{font-style:italic;}blockquote,ul,ol,dl{margin:1em;}ol,ul,dl{margin-left:2em;}ol li{list-style:decimal outside;}ul li{list-style:disc outside;}dl dd{margin-left:1em;}th,td{border:1px solid #000;padding:.5em;}th{font-weight:700;text-align:center;}caption{margin-bottom:.5em;text-align:center;}p,fieldset,table,pre{margin-bottom:1em;}input[type=text],input[type=password],textarea{width:12.25em;width:11.9em;}body{font-family:arial, sans;margin:5px;}
\ No newline at end of file
+*/h1{font-size:138.5%;}h2{font-size:123.099998%;}h3{font-size:108%;}h1,h2,h3{margin:1em 0;}h1,h2,h3,h4,h5,h6,strong{font-weight:700;}abbr,acronym{border-bottom:1px dotted #000;cursor:help;}em{font-style:italic;}blockquote,ul,ol,dl{margin:1em;}ol,ul,dl{margin-left:2em;}ol li{list-style:decimal outside;}ul li{list-style:disc outside;}dl dd{margin-left:1em;}th,td{border:1px solid #000;padding:.5em;}th{font-weight:700;text-align:center;}caption{margin-bottom:.5em;text-align:center;}p,fieldset,table,pre{margin-bottom:1em;}input[type=text],input[type=password],textarea{width:12.25em;width:11.9em;}body{font-family:arial, sans;margin:5px;}.k-rte-comment{border:1px dashed silver;font-size:85%;line-height:1.4;padding:1px;background-color:#D7FFD7;}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/rte.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/rte.css 2009-03-03 01:35:36 UTC (rev 1055)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/rte.css 2009-03-03 15:10:55 UTC (rev 1056)
@@ -1,4 +1,12 @@
body {
font-family: arial, sans;
margin: 5px;
+}
+
+.k-rte-comment span {
+ border:1px dashed #C0C0C0;
+ font-size:85%;
+ line-height:1.4;
+ padding:1px;
+ background-color:#D7FFD7;
}
\ No newline at end of file
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-03 01:35:36 UTC (rev 1055)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbar.java 2009-03-03 15:10:55 UTC (rev 1056)
@@ -19,10 +19,13 @@
\*/
package org.ourproject.kune.platf.client.actions.toolbar;
+import org.ourproject.kune.platf.client.actions.ActionDescriptor;
import org.ourproject.kune.platf.client.actions.ActionItemCollection;
public interface ActionToolbar<T> {
+ void addActions(ActionItemCollection<T> actionItemCollection);
+
void attach();
void clear();
@@ -33,6 +36,8 @@
ActionToolbarView<T> getView();
- void addActions(ActionItemCollection<T> actionItemCollection);
+ void setButtonEnable(ActionDescriptor<T> action, boolean enable);
+ 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-03 01:35:36 UTC (rev 1055)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPanel.java 2009-03-03 15:10:55 UTC (rev 1056)
@@ -41,6 +41,7 @@
import com.calclab.suco.client.ioc.Provider;
import com.google.gwt.user.client.ui.Widget;
import com.gwtext.client.core.EventObject;
+import com.gwtext.client.core.Ext;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.ToolbarButton;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
@@ -75,20 +76,18 @@
}
public void addButtonAction(final ActionItem<T> actionItem, final boolean enable) {
+ final ToolbarButton button = new ToolbarButton();
final ActionToolbarButtonDescriptor<T> action = (ActionToolbarButtonDescriptor<T>) actionItem.getAction();
T item = actionItem.getItem();
final ActionToolbarPosition pos = action.getActionPosition();
- final ToolbarButton button = new ToolbarButton();
final String text = action.getText();
- final String id = action.getId();
final String iconUrl = action.getIconUrl();
final String iconCls = action.getIconCls();
if (text != null) {
button.setText(text);
}
- if (id != null) {
- button.setId(id);
- }
+ String id = generateIdIfEmpty(action);
+ button.setId(id);
if (action instanceof ActionToolbarPushButtonDescriptor) {
button.setEnableToggle(true);
ActionPressedCondition<T> mustInitialyPressed = ((ActionToolbarPushButtonDescriptor<T>) action).getMustInitialyPressed();
@@ -119,7 +118,7 @@
if (action.hasRightSeparator()) {
add(toolbar, action.getRightSeparator());
}
- toolbarButtons.put(genButtonKey(pos, text), button);
+ toolbarButtons.put(genButtonKey(pos, id), button);
}
public void addMenuAction(final ActionItem<T> actionItem, final boolean enable) {
@@ -130,7 +129,7 @@
final String itemKey = genMenuKey(pos, menuTitle, menuSubTitle, action.getText());
Item item = menuItems.get(itemKey);
if (item == null) {
- item = createToolbarMenu(pos, menuTitle, menuSubTitle, actionItem, action.getId());
+ item = createToolbarMenu(pos, menuTitle, menuSubTitle, actionItem, generateIdIfEmpty(action));
menuItems.put(itemKey, item);
}
setEnableMenuItem(item, enable);
@@ -169,8 +168,7 @@
}
public void setButtonEnable(final ActionDescriptor<T> action, final boolean enable) {
- final ActionToolbarPosition pos = ((ActionToolbarDescriptor<T>) action).getActionPosition();
- final ToolbarButton button = toolbarButtons.get(genButtonKey(pos, action.getText()));
+ final ToolbarButton button = findButton(action);
if (button != null) {
setEnableButton(button, enable);
} else {
@@ -178,6 +176,16 @@
}
}
+ public void setPushButtonPressed(final ActionDescriptor<T> action, final boolean pressed) {
+ final ToolbarButton button = findButton(action);
+ if (button != null && button.isEnableToggle()) {
+ // Log.debug("Setting button pressed: " + pressed);
+ button.toggle(pressed);
+ } else {
+ Log.error("Tryng to set pressed a non existent toolbar push button");
+ }
+ }
+
private void add(final ActionToolbarPosition toolbar, final Widget widget) {
getToolbar(toolbar).add(widget);
}
@@ -272,11 +280,26 @@
return menu;
}
- private String genButtonKey(final ActionToolbarPosition pos, final String actionText) {
- final String basePart = "km-act-btn-" + pos.toString().substring(0, 2) + "-" + actionText;
+ private ToolbarButton findButton(final ActionDescriptor<T> action) {
+ final ActionToolbarPosition pos = ((ActionToolbarDescriptor<T>) action).getActionPosition();
+ final ToolbarButton button = toolbarButtons.get(genButtonKey(pos, action.getId()));
+ return button;
+ }
+
+ private String genButtonKey(final ActionToolbarPosition pos, final String id) {
+ final String basePart = "km-act-btn-" + pos.toString().substring(0, 2) + "-" + id;
return basePart;
}
+ private String generateIdIfEmpty(final ActionDescriptor<T> action) {
+ String id = action.getId();
+ if (id == null) {
+ id = Ext.generateId();
+ action.setId(id);
+ }
+ return id;
+ }
+
private String genMenuKey(final ActionToolbarPosition pos, final String menuTitle, final String menuSubTitle,
final String actionText) {
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-03 01:35:36 UTC (rev 1055)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarPresenter.java 2009-03-03 15:10:55 UTC (rev 1056)
@@ -36,6 +36,24 @@
this.view = toolbar;
}
+ public void addActions(final ActionItemCollection<T> actions) {
+ for (final ActionItem<T> actionItem : actions) {
+ final ActionDescriptor<T> action = actionItem.getAction();
+ if (actionItem.mustBeAdded()) {
+ if (isToolbarMenu(action)) {
+ view.addMenuAction(actionItem, actionItem.mustBeEnabled());
+ } else {
+ if (isToolbarButton(action)) {
+ view.addButtonAction(actionItem, actionItem.mustBeEnabled());
+ } else {
+ Log.error("Code error: Not an ActionMenuDescriptor or ActionButtonDescriptor: "
+ + action.getText());
+ }
+ }
+ }
+ }
+ }
+
public void attach() {
view.attach();
}
@@ -56,24 +74,14 @@
return view;
}
- public void addActions(final ActionItemCollection<T> actions) {
- for (final ActionItem<T> actionItem : actions) {
- final ActionDescriptor<T> action = actionItem.getAction();
- if (actionItem.mustBeAdded()) {
- if (isToolbarMenu(action)) {
- view.addMenuAction(actionItem, actionItem.mustBeEnabled());
- } else {
- if (isToolbarButton(action)) {
- view.addButtonAction(actionItem, actionItem.mustBeEnabled());
- } else {
- Log.error("Code error: Not an ActionMenuDescriptor or ActionButtonDescriptor: "
- + action.getText());
- }
- }
- }
- }
+ public void setButtonEnable(ActionDescriptor<T> action, boolean enable) {
+ view.setButtonEnable(action, enable);
}
+ public void setPushButtonPressed(ActionDescriptor<T> action, boolean pressed) {
+ view.setPushButtonPressed(action, pressed);
+ }
+
private boolean isToolbarButton(final ActionDescriptor<T> action) {
return action instanceof ActionToolbarButtonDescriptor
|| action instanceof ActionToolbarButtonAndItemDescriptor;
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-03 01:35:36 UTC (rev 1055)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarView.java 2009-03-03 15:10:55 UTC (rev 1056)
@@ -39,4 +39,6 @@
void setButtonEnable(ActionDescriptor<T> action, boolean enable);
+ void setPushButtonPressed(ActionDescriptor<T> action, boolean pressed);
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KunePlatformModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KunePlatformModule.java 2009-03-03 01:35:36 UTC (rev 1055)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KunePlatformModule.java 2009-03-03 15:10:55 UTC (rev 1056)
@@ -64,6 +64,7 @@
import com.calclab.suco.client.ioc.module.AbstractModule;
import com.calclab.suco.client.ioc.module.Factory;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.libideas.client.StyleInjector;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
@@ -231,7 +232,7 @@
RTEActionTopToolbar topBar = $(RTEActionTopToolbar.class);
RTEActionSndToolbar sndBar = $(RTEActionSndToolbar.class);
final RTEditorPresenter presenter = new RTEditorPresenter($(I18nTranslationService.class),
- $(Session.class), topBar, sndBar, RTEImgResources.INSTANCE);
+ $(Session.class), topBar, sndBar, $(RTEImgResources.class));
final RTEditorPanel panel = new RTEditorPanel(presenter, $(I18nUITranslationService.class),
$(ActionManager.class));
presenter.init(panel);
@@ -252,6 +253,15 @@
}
});
+ register(Singleton.class, new Factory<RTEImgResources>(RTEImgResources.class) {
+ @Override
+ public RTEImgResources create() {
+ RTEImgResources instance = GWT.create(RTEImgResources.class);
+ StyleInjector.injectStylesheet(instance.css().getText());
+ return instance;
+ }
+ });
+
$(ApplicationComponentGroup.class).createAll();
$(ToolGroup.class).createAll();
$(Application.class).start();
@@ -260,6 +270,5 @@
// $(TestRTEDialog.class);
// $(TestRTEDialog.class);
// $(TestRTEDialog.class);
-
}
}
\ No newline at end of file
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-03 01:35:36 UTC (rev 1055)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPanel.java 2009-03-03 15:10:55 UTC (rev 1056)
@@ -9,16 +9,15 @@
import org.ourproject.kune.platf.client.actions.ActionManager;
import org.ourproject.kune.platf.client.actions.ActionShortcut;
import org.ourproject.kune.platf.client.i18n.I18nUITranslationService;
-import org.ourproject.kune.platf.client.ui.noti.NotifyUser;
import org.ourproject.kune.platf.client.ui.rte.RichTextArea.BasicFormatter;
import org.ourproject.kune.platf.client.ui.rte.RichTextArea.ExtendedFormatter;
import org.ourproject.kune.platf.client.ui.rte.RichTextArea.FontSize;
import org.ourproject.kune.platf.client.ui.rte.RichTextArea.Justification;
-import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.dom.client.Element;
-import com.google.gwt.libideas.client.StyleInjector;
import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.KeyboardListener;
import com.google.gwt.user.client.ui.Widget;
@@ -30,14 +29,15 @@
private final ExtendedFormatter extended;
private final HashMap<ActionShortcut, ActionItem<Object>> shortcuts;
private final ActionManager actionManager;
+ private final RTEditorPresenter presenter;
public RTEditorPanel(final RTEditorPresenter presenter, I18nUITranslationService i18n, ActionManager actionManager) {
+ this.presenter = presenter;
this.i18n = i18n;
this.actionManager = actionManager;
rta = new RichTextArea();
basic = rta.getBasicFormatter();
extended = rta.getExtendedFormatter();
- StyleInjector.injectStylesheet(RTEImgResources.INSTANCE.css().getText());
shortcuts = new HashMap<ActionShortcut, ActionItem<Object>>();
createListeners();
}
@@ -56,11 +56,14 @@
String time = i18n.formatDateWithLocale(new Date());
Element span = DOM.createSpan();
span.setInnerText(i18n.t("type here") + " -" + userName + " " + time);
- DOM.setElementAttribute((com.google.gwt.user.client.Element) span, "backgroundColor", "rgb(255,255,215");
- // FIXME: addCustomStyle
+ DOM.setElementProperty(span.<com.google.gwt.user.client.Element> cast(), "className", "k-rte-comment");
insertHtml(span.getString());
}
+ public boolean canBeBasic() {
+ return basic != null;
+ }
+
public boolean canBeExtended() {
return extended != null;
}
@@ -110,27 +113,28 @@
}
public boolean isBold() {
- return rta.isAttached() && basic.isBold();
+ Log.debug("Is bold: " + basic.isBold());
+ return basic.isBold();
}
public boolean isItalic() {
- return rta.isAttached() && basic.isItalic();
+ return basic.isItalic();
}
public boolean isStrikethrough() {
- return rta.isAttached() && extended.isStrikethrough();
+ return extended.isStrikethrough();
}
public boolean isSubscript() {
- return rta.isAttached() && basic.isSubscript();
+ return basic.isSubscript();
}
public boolean isSuperscript() {
- return rta.isAttached() && basic.isSuperscript();
+ return basic.isSuperscript();
}
public boolean isUnderlined() {
- return rta.isAttached() && basic.isUnderlined();
+ return basic.isUnderlined();
}
public void justifyCenter() {
@@ -236,7 +240,21 @@
}
private void createListeners() {
+ rta.addClickListener(new ClickListener() {
+ public void onClick(Widget sender) {
+ if (sender == rta) {
+ // We use the RichTextArea's onKeyUp event to update the
+ // toolbar status.
+ // This will catch any cases where the user moves the cursur
+ // using the
+ // keyboard, or uses one of the browser's built-in keyboard
+ // shortcuts.
+ updateStatus();
+ }
+ }
+ });
rta.addKeyboardListener(new KeyboardListener() {
+
public void onKeyDown(final Widget sender, final char keyCode, final int modifiers) {
}
@@ -251,12 +269,12 @@
// using the keyboard, or uses one of the browser's built-in
// keyboard shortcuts.
- // updateStatus();
+ updateStatus();
// fireEdit();
if (modifiers != 0) {
ActionItem<Object> actionItem = shortcuts.get(new ActionShortcut(keyCode, modifiers));
if (actionItem != null) {
- NotifyUser.info("Shortcut");
+ Log.debug("RTE shortcut pressed (" + modifiers + ", " + keyCode + ")");
actionManager.doAction(actionItem);
}
}
@@ -264,4 +282,11 @@
}
});
}
+
+ /**
+ * Updates the status of all the stateful buttons.
+ */
+ private void updateStatus() {
+ presenter.updateStatus();
+ }
}
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-03 01:35:36 UTC (rev 1055)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPresenter.java 2009-03-03 15:10:55 UTC (rev 1056)
@@ -6,7 +6,6 @@
import org.ourproject.kune.platf.client.actions.ActionEnableCondition;
import org.ourproject.kune.platf.client.actions.ActionItem;
import org.ourproject.kune.platf.client.actions.ActionItemCollection;
-import org.ourproject.kune.platf.client.actions.ActionPressedCondition;
import org.ourproject.kune.platf.client.actions.ActionShortcut;
import org.ourproject.kune.platf.client.actions.ActionToolbarMenuDescriptor;
import org.ourproject.kune.platf.client.actions.ActionToolbarPosition;
@@ -41,6 +40,10 @@
private final RTEImgResources imgResources;
private final RTEActionTopToolbar topBar;
private final RTEActionSndToolbar sndBar;
+ private ActionToolbarPushButtonDescriptor<Object> bold;
+ private ActionToolbarPushButtonDescriptor<Object> italic;
+ private ActionToolbarPushButtonDescriptor<Object> underline;
+ private ActionToolbarPushButtonDescriptor<Object> strikethrough;
public RTEditorPresenter(I18nTranslationService i18n, Session session, RTEActionTopToolbar topBar,
RTEActionSndToolbar sndBar, RTEImgResources imgResources) {
@@ -114,10 +117,12 @@
public void init(RTEditorView view) {
this.view = view;
createDefBasicActions();
- topBar.addActions(basicTopActions);
- sndBar.addActions(basicSndActions);
- view.addActions(basicTopActions);
- view.addActions(basicSndActions);
+ if (view.canBeBasic()) {
+ view.addActions(basicTopActions);
+ view.addActions(basicSndActions);
+ topBar.addActions(basicTopActions);
+ sndBar.addActions(basicSndActions);
+ }
if (isExtended()) {
createDefExtendedActions();
view.addActions(extendedTopActions);
@@ -135,6 +140,17 @@
this.extended = extended;
}
+ public void updateStatus() {
+ if (view.canBeBasic()) {
+ sndBar.setPushButtonPressed(bold, view.isBold());
+ sndBar.setPushButtonPressed(italic, view.isItalic());
+ sndBar.setPushButtonPressed(underline, view.isUnderlined());
+ }
+ if (isExtended()) {
+ sndBar.setPushButtonPressed(strikethrough, view.isStrikethrough());
+ }
+ }
+
private void createDefBasicActions() {
ActionToolbarMenuDescriptor<Object> selectAll = new ActionToolbarMenuDescriptor<Object>(accessRol,
ActionToolbarPosition.topbar, new Listener0() {
@@ -146,49 +162,33 @@
selectAll.setTextDescription(i18n.t("Select all"));
selectAll.setParentMenuTitle(i18n.t(EDIT_MENU));
- ActionToolbarPushButtonDescriptor<Object> bold = new ActionToolbarPushButtonDescriptor<Object>(accessRol,
- ActionToolbarPosition.topbar, new Listener0() {
- public void onEvent() {
- view.toggleBold();
- }
- });
- bold.setIconCls(getCssName(imgResources.bold()));
- bold.setToolTip(i18n.t("Toggle Bold"));
- bold.setMustInitialyPressed(new ActionPressedCondition<Object>() {
- public boolean mustBePressed(Object param) {
- return view.isBold();
+ bold = new ActionToolbarPushButtonDescriptor<Object>(accessRol, ActionToolbarPosition.topbar, new Listener0() {
+ public void onEvent() {
+ view.toggleBold();
}
});
+ bold.setIconCls(getCssName(imgResources.bold()));
+ bold.setToolTip(i18n.t("Toggle Bold"));
bold.setShortcut(new ActionShortcut(true, 'B'));
- ActionToolbarPushButtonDescriptor<Object> italic = new ActionToolbarPushButtonDescriptor<Object>(accessRol,
- ActionToolbarPosition.topbar, new Listener0() {
+ italic = new ActionToolbarPushButtonDescriptor<Object>(accessRol, ActionToolbarPosition.topbar,
+ new Listener0() {
public void onEvent() {
view.toggleItalic();
}
});
italic.setIconCls(getCssName(imgResources.italic()));
italic.setToolTip(i18n.t("Toggle Italic"));
- italic.setMustInitialyPressed(new ActionPressedCondition<Object>() {
- public boolean mustBePressed(Object param) {
- return view.isItalic();
- }
- });
italic.setShortcut(new ActionShortcut(true, 'I'));
- ActionToolbarPushButtonDescriptor<Object> underline = new ActionToolbarPushButtonDescriptor<Object>(accessRol,
- ActionToolbarPosition.topbar, new Listener0() {
+ underline = new ActionToolbarPushButtonDescriptor<Object>(accessRol, ActionToolbarPosition.topbar,
+ new Listener0() {
public void onEvent() {
view.toggleUnderline();
}
});
- underline.setIconCls(imgResources.underline().getName());
+ underline.setIconCls(getCssName(imgResources.underline()));
underline.setToolTip(i18n.t("Toggle Underline"));
- underline.setMustInitialyPressed(new ActionPressedCondition<Object>() {
- public boolean mustBePressed(Object param) {
- return view.isUnderlined();
- }
- });
basicTopActions.add(withNoItem(selectAll));
basicSndActions.add(withNoItem(bold));
@@ -281,19 +281,14 @@
hr.setTextDescription(i18n.t("Horizontal line"));
hr.setParentMenuTitle(i18n.t(INSERT_MENU));
- ActionToolbarPushButtonDescriptor<Object> strikethrough = new ActionToolbarPushButtonDescriptor<Object>(
- accessRol, ActionToolbarPosition.topbar, new Listener0() {
+ strikethrough = new ActionToolbarPushButtonDescriptor<Object>(accessRol, ActionToolbarPosition.topbar,
+ new Listener0() {
public void onEvent() {
view.toggleStrikethrough();
}
});
strikethrough.setIconCls(getCssName(imgResources.strikeout()));
strikethrough.setToolTip(i18n.t("Toggle Strikethrough"));
- strikethrough.setMustInitialyPressed(new ActionPressedCondition<Object>() {
- public boolean mustBePressed(Object param) {
- return view.isStrikethrough();
- }
- });
extendedTopActions.add(withNoItem(undo));
extendedTopActions.add(withNoItem(redo));
@@ -307,7 +302,7 @@
}
private String getCssName(ImageResource imageResource) {
- return ".k-rte-" + imageResource.getName();
+ return "k-rte-" + imageResource.getName();
}
private boolean isExtended() {
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-03 01:35:36 UTC (rev 1055)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorView.java 2009-03-03 15:10:55 UTC (rev 1056)
@@ -9,6 +9,8 @@
void addComment(String userName);
+ boolean canBeBasic();
+
boolean canBeExtended();
void copy();
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-03 01:35:36 UTC (rev 1055)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/RTEImgResources.java 2009-03-03 15:10:55 UTC (rev 1056)
@@ -1,84 +1,81 @@
package org.ourproject.kune.platf.client.ui.rte.img;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.libideas.resources.client.CssResource;
import com.google.gwt.libideas.resources.client.ImageResource;
import com.google.gwt.libideas.resources.client.ImmutableResourceBundle;
public interface RTEImgResources extends ImmutableResourceBundle {
- public static final RTEImgResources INSTANCE = GWT.create(RTEImgResources.class);
-
@Resource("alignleft.png")
- ImageResource alignleft();
+ public ImageResource alignleft();
@Resource("alignright.png")
- ImageResource alignright();
+ public ImageResource alignright();
@Resource("backcolor.png")
- ImageResource backcolor();
+ public ImageResource backcolor();
@Resource("bold.png")
- ImageResource bold();
+ public ImageResource bold();
@Resource("centerpara.png")
- ImageResource centerpara();
+ public ImageResource centerpara();
@Resource("charfontname.png")
- ImageResource charfontname();
+ public ImageResource charfontname();
@Resource("rteimg.css")
- CssResource css();
+ public CssResource css();
@Resource("decrementindent.png")
- ImageResource decrementindent();
+ public ImageResource decrementindent();
@Resource("defaultbullet.png")
- ImageResource defaultbullet();
+ public ImageResource defaultbullet();
@Resource("defaultnumbering.png")
- ImageResource defaultnumbering();
+ public ImageResource defaultnumbering();
@Resource("edithtml.png")
- ImageResource edithtml();
+ public ImageResource edithtml();
@Resource("fontcolor.png")
- ImageResource fontcolor();
+ public ImageResource fontcolor();
@Resource("fontheight.png")
- ImageResource fontheight();
+ public ImageResource fontheight();
@Resource("hfixedline.png")
- ImageResource hfixedline();
+ public ImageResource hfixedline();
@Resource("images.png")
- ImageResource images();
+ public ImageResource images();
@Resource("incrementindent.png")
- ImageResource incrementindent();
+ public ImageResource incrementindent();
@Resource("italic.png")
- ImageResource italic();
+ public ImageResource italic();
@Resource("link.png")
- ImageResource link();
+ public ImageResource link();
- @Resource("link_break.png")
- ImageResource link_break();
+ @Resource("linkbreak.png")
+ public ImageResource linkbreak();
@Resource("removeFormat.png")
- ImageResource removeFormat();
+ public ImageResource removeFormat();
@Resource("strikeout.png")
- ImageResource strikeout();
+ public ImageResource strikeout();
@Resource("subscript.png")
- ImageResource subscript();
+ public ImageResource subscript();
@Resource("superscript.png")
- ImageResource superscript();
+ public ImageResource superscript();
@Resource("underline.png")
- ImageResource underline();
+ public ImageResource underline();
}
\ No newline at end of file
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/link_break.png
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/linkbreak.png (from rev 1054, trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/link_break.png)
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/linkbreak.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:mergeinfo
+
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-03 01:35:36 UTC (rev 1055)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/rteimg.css 2009-03-03 15:10:55 UTC (rev 1056)
@@ -1,91 +1,91 @@
- at stripe .k-rte-underline {
+ at sprite .x-btn-icon .k-rte-underline {
gwt-image: 'underline';
}
- at stripe .k-rte-superscript {
+ at sprite .x-btn-icon .k-rte-superscript {
gwt-image: 'superscript';
}
- at stripe .k-rte-subscript {
+ at sprite .x-btn-icon .k-rte-subscript {
gwt-image: 'subscript';
}
- at stripe .k-rte-strikeout {
+ at sprite .x-btn-icon .k-rte-strikeout {
gwt-image: 'strikeout';
}
- at stripe .k-rte-removeFormat {
+ at sprite .x-btn-icon .k-rte-removeFormat {
gwt-image: 'removeFormat';
}
- at stripe .k-rte-link {
+ at sprite .x-btn-icon .k-rte-link {
gwt-image: 'link';
}
- at stripe .k-rte-link_break {
- gwt-image: 'link_break';
+ at sprite .x-btn-icon .k-rte-linkbreak {
+ gwt-image: 'linkbreak';
}
- at stripe .k-rte-italic {
+ at sprite .x-btn-icon .k-rte-italic {
gwt-image: 'italic';
}
- at stripe .k-rte-incrementindent {
+ at sprite .x-btn-icon .k-rte-incrementindent {
gwt-image: 'incrementindent';
}
- at stripe .k-rte-images {
+ at sprite .x-btn-icon .k-rte-images {
gwt-image: 'images';
}
- at stripe .k-rte-hfixedline {
+ at sprite .x-btn-icon .k-rte-hfixedline {
gwt-image: 'hfixedline';
}
- at stripe .k-rte-fontheight {
+ at sprite .x-btn-icon .k-rte-fontheight {
gwt-image: 'fontheight';
}
- at stripe .k-rte-fontcolor {
+ at sprite .x-btn-icon .k-rte-fontcolor {
gwt-image: 'fontcolor';
}
- at stripe .k-rte-edithtml {
+ at sprite .x-btn-icon .k-rte-edithtml {
gwt-image: 'edithtml';
}
- at stripe .k-rte-defaultnumbering {
+ at sprite .x-btn-icon .k-rte-defaultnumbering {
gwt-image: 'defaultnumbering';
}
- at stripe .k-rte-defaultbullet {
+ at sprite .x-btn-icon .k-rte-defaultbullet {
gwt-image: 'defaultbullet';
}
- at stripe .k-rte-decrementindent {
+ at sprite .x-btn-icon .k-rte-decrementindent {
gwt-image: 'decrementindent';
}
- at stripe .k-rte-charfontname {
+ at sprite .x-btn-icon .k-rte-charfontname {
gwt-image: 'charfontname';
}
- at stripe .k-rte-centerpara {
+ at sprite .x-btn-icon .k-rte-centerpara {
gwt-image: 'centerpara';
}
- at stripe .k-rte-bold {
+ at sprite .x-btn-icon .k-rte-bold {
gwt-image: 'bold';
}
- at stripe .k-rte-backcolor {
+ at sprite .x-btn-icon .k-rte-backcolor {
gwt-image: 'backcolor';
}
- at stripe .k-rte-alignright {
+ at sprite .x-btn-icon .k-rte-alignright {
gwt-image: 'alignright';
}
- at stripe .k-rte-alignleft {
+ at sprite .x-btn-icon .k-rte-alignleft {
gwt-image: 'alignleft';
}
\ No newline at end of file
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/MessagePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/MessagePresenter.java 2009-03-03 01:35:36 UTC (rev 1055)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/MessagePresenter.java 2009-03-03 15:10:55 UTC (rev 1056)
@@ -1,30 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2009 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.workspace.client.site.msg;
-
-import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level;
-
-public interface MessagePresenter {
-
- void resetMessage();
-
- void setMessage(final String message, final Level level);
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SimpleMessagePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SimpleMessagePanel.java 2009-03-03 01:35:36 UTC (rev 1055)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SimpleMessagePanel.java 2009-03-03 15:10:55 UTC (rev 1056)
@@ -1,95 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2009 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- \*/
-package org.ourproject.kune.workspace.client.site.msg;
-
-import org.ourproject.kune.platf.client.services.Images;
-import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level;
-
-import com.google.gwt.user.client.ui.AbstractImagePrototype;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.VerticalPanel;
-
-public class SimpleMessagePanel extends HorizontalPanel {
- HTML message = null;
- Image messageIcon = null;
- private final Images images;
-
- public SimpleMessagePanel(Images images) {
- this.images = images;
- message = new HTML();
- messageIcon = new Image();
- add(messageIcon);
- add(message);
- setCellVerticalAlignment(messageIcon, VerticalPanel.ALIGN_MIDDLE);
- setVisible(false);
- setStyleName("kune-SiteMessagePanel");
- addStyleDependentName("info");
- images.info().applyTo(messageIcon);
- messageIcon.addStyleName("gwt-Image");
- message.setWidth("100%");
- this.setCellWidth(message, "100%");
- }
-
- public void adjustWidth(final int windowWidth) {
- final int messageWidth = windowWidth * 60 / 100 - 3;
- this.setWidth("" + messageWidth);
- }
-
- public void hide() {
- message.setText("");
- this.setVisible(false);
- }
-
- public void reset() {
- message.setText("");
- }
-
- public void setMessage(final String text) {
- this.message.setHTML(text);
- }
-
- public void setMessage(final String text, final Level lastMessageType, final Level type) {
- AbstractImagePrototype imagePrototype = null;
- switch (type) {
- case error:
- imagePrototype = images.error();
- break;
- case veryImportant:
- imagePrototype = images.important();
- break;
- case important:
- imagePrototype = images.emblemImportant();
- break;
- case info:
- imagePrototype = images.info();
- break;
- }
- imagePrototype.applyTo(messageIcon);
- removeStyleDependentName(lastMessageType.toString());
- addStyleDependentName(type.toString());
- setMessage(text);
- }
-
- public void show() {
- this.setVisible(true);
- }
-}
More information about the kune-commits
mailing list