[kune-commits] r1082 - in trunk: .
src/main/java/org/ourproject/kune/app/public/css
src/main/java/org/ourproject/kune/chat/client
src/main/java/org/ourproject/kune/platf/client/actions
src/main/java/org/ourproject/kune/platf/client/actions/toolbar
src/main/java/org/ourproject/kune/platf/client/shortcuts
src/main/java/org/ourproject/kune/platf/client/ui
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/hello
src/main/java/org/ourproject/kune/workspace/client/title
src/test/java/org/ourproject/kune/platf/client/actions
vjrj
vjrj at ourproject.org
Wed Mar 18 15:37:42 CET 2009
Author: vjrj
Date: 2009-03-18 15:37:36 +0100 (Wed, 18 Mar 2009)
New Revision: 1082
Added:
trunk/TODO_done
trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/Keyboard.java
trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutRegister.java
Removed:
trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ActionShortcut.java
trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ActionShortcutRegister.java
Modified:
trunk/TODO
trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarButton.java
trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/GlobalShortcutRegister.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.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/AbstractFoldableContentActions.java
trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java
trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java
trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitle.java
trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitleView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/title/RenameAction.java
trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionShortcutTest.java
Log:
Shortcuts improved...
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/TODO 2009-03-18 14:37:36 UTC (rev 1082)
@@ -1,4 +1,5 @@
TODO-list for kune -*- mode: org; -*-
+#+ARCHIVE: %s_done::
#+SEQ_TODO: TODO danigb samer vjrj FEEDBACK VERIFY | FIXED CANCELED WONTFIX
@@ -14,15 +15,6 @@
http://maven.xwiki.org/releases/com/xpn/xwiki/platform/xwiki-web-wysiwyg/1.8-rc-2/
** vjrj <v> better RTE
*** Pending
-**** W3C Range/Selection support in RTE
- https://developer.mozilla.org/en/DOM/selection
- http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html
- As an intro:
- http://www.quirksmode.org/dom/range_intro.html
- http://maven.xwiki.org/site/xwiki-web/xwiki-web-wysiwyg/apidocs/com/xpn/xwiki/wysiwyg/client/dom/internal/AbstractRange.html
- other links:
- http://groups.google.com/group/rocket-gwt/browse_frm/thread/e56540d4168479c0/d25dca75958ba923?hl=en-GB&lnk=gst&q=Range#d25dca75958ba923
- http://code.google.com/p/gwt-html-editor/source/browse/branches/gwt1.4/src/com/gc/gwt/wysiwyg/public/fckeditor/editor/_source/classes/fckdomrange_ie.js?r=81
**** Insert/Edit link
***** use cases
^<a href="http://example.com">sample</a>^ --- Parse and edit
@@ -30,19 +22,11 @@
<a href="http://example.com">s^amp^le</a> --- Parse and edit
<a href="http://example.com">s^a<em>kk</em>mp^le</a> --- Parse, get contains and edit
^some text <a href="http://example.com">samp^le</a> --- new link with get inner content?
-**** Quite urgent: Shortcuts propagation to browser
- http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/Event.html#preventDefault
- http://openkm.cvs.sourceforge.net/viewvc/openkm/openkm/src/es/git/openkm/frontend/client/panel/ExtendedDockPanel.java?revision=1.20&view=markup
- http://openkm.cvs.sourceforge.net/viewvc/openkm/openkm/src/es/git/openkm/frontend/client/util/Keyboard.java?revision=1.20&view=markup
- http://whatwouldnickdo.com/wordpress/370/gwt-right-click-context-menu/
**** with different menus (File/Blog ...)
**** bidi support
-**** Insert special chars (for table or from unicode).
**** images (local/remote) with preview
**** youtube videos/podcasts
-**** Edit HTML
**** File > Rename (F2)
-**** Insert > Special char
**** Insert > Page break (for printing)
**** Shortcut to fonts (Ctrl + numbers)
*** Links
@@ -167,10 +151,6 @@
- for ogg :: http://www.flumotion.net/cortado/
- for mp3+ogg :: flowplayer
** TODO <d> Inform to translators when original content changes
-** TODO <v> extjs i18n
- http://extjs.com/deploy/ext/examples/locale/dutch-form.js
- http://groups.google.com/group/gwt-ext/browse_thread/thread/ebec316effea2b80/bfbdadc7239b4e5d?lnk=gst&q=i18n#bfbdadc7239b4e5d
- http://extjs.com/forum/showthread.php?t=20160&highlight=localization
** TODO <v> Restarting server don't affect client session
Now there are problems if client was started before server, when server restart (session persist)
** TODO <v> Interceptors also useful for translation of db fields
Added: trunk/TODO_done
===================================================================
--- trunk/TODO_done 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/TODO_done 2009-03-18 14:37:36 UTC (rev 1082)
@@ -0,0 +1,45 @@
+# -*- mode: org -*-
+
+
+Archived entries from file TODO
+* FIXED Quite urgent: Shortcuts propagation to browser
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2009-03-17 mar 15:13
+ :ARCHIVE_FILE: TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)/<v> better RTE/Pending
+ :ARCHIVE_CATEGORY: TODO
+ :END:
+ http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/Event.html#preventDefault
+ http://openkm.cvs.sourceforge.net/viewvc/openkm/openkm/src/es/git/openkm/frontend/client/panel/ExtendedDockPanel.java?revision=1.20&view=markup
+ http://openkm.cvs.sourceforge.net/viewvc/openkm/openkm/src/es/git/openkm/frontend/client/util/Keyboard.java?revision=1.20&view=markup
+ http://whatwouldnickdo.com/wordpress/370/gwt-right-click-context-menu/
+* FIXED W3C Range/Selection support in RTE
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2009-03-17 mar 15:15
+ :ARCHIVE_FILE: TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)/<v> better RTE/Pending
+ :ARCHIVE_CATEGORY: TODO
+ :END:
+ https://developer.mozilla.org/en/DOM/selection
+ http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html
+ As an intro:
+ http://www.quirksmode.org/dom/range_intro.html
+ http://maven.xwiki.org/site/xwiki-web/xwiki-web-wysiwyg/apidocs/com/xpn/xwiki/wysiwyg/client/dom/internal/AbstractRange.html
+ other links:
+ http://groups.google.com/group/rocket-gwt/browse_frm/thread/e56540d4168479c0/d25dca75958ba923?hl=en-GB&lnk=gst&q=Range#d25dca75958ba923
+ http://code.google.com/p/gwt-html-editor/source/browse/branches/gwt1.4/src/com/gc/gwt/wysiwyg/public/fckeditor/editor/_source/classes/fckdomrange_ie.js?r=81
+* FIXED <v> extjs i18n :ARCHIVE:
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2009-03-17 mar 15:20
+ :ARCHIVE_FILE: TODO
+ :ARCHIVE_OLPATH: MID-TERM
+ :ARCHIVE_CATEGORY: TODO
+ :ARCHIVE_TODO: TODO
+ :END:
+ http://extjs.com/deploy/ext/examples/locale/dutch-form.js
+ http://groups.google.com/group/gwt-ext/browse_thread/thread/ebec316effea2b80/bfbdadc7239b4e5d?lnk=gst&q=i18n#bfbdadc7239b4e5d
+ http://extjs.com/forum/showthread.php?t=20160&highlight=localization
+
+
+
+
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2009-03-18 14:37:36 UTC (rev 1082)
@@ -41,4 +41,4 @@
padding: 1px 0px 1px 1px;
text-decoration:none;
}
-*/.x-tree-node .k-ctn-status-normal a span{}.x-tree-node .k-ctn-status-deleted a span{text-decoration:line-through;color:gray;}.x-tree-node .k-ctn-status-rejected a span{text-decoration:line-through;/* color: #FF6633; */color:#F30;}.x-tree-node .k-ctn-status-editing a span{font-style:italic;color:gray;}.x-tree-node .k-ctn-status-submitted a span{color:green;}.k-info-links{text-decoration:underline;color:gray;cursor:pointer;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}.k-basic-thumb{background:#FAFAFA none repeat scroll 0 50%;border:1px solid #EBEBEB;padding:3px;margin:3px;}.k-basic-thumb td{padding:2px 3px;border:none;}.k-text-gray{color:gray;}.k-elp-limg{margin-top:4px;margin-left:5px;cursor:pointer;overflow:hidden;}.k-tsp-tag{float:right;margin-right:5px;cursor:pointer;color:#00F;}.k-tsp-cloud{vertical-align:bottom;}.k-link-icon{background-image:url(img/link.gif)!important;}.k-options-icon{background-image:url(img/emblem-system.gif)!important;}.k-copyleft-icon{background-image:url(img/copyleft.png)!important;}.k-picture-icon{background-image:url(img/picture.png)!important;}.k-info-icon{background-image:url(img/info.gif)!important;}.k-newgroup-icon{background-image:url(img/kune-icon16.png)!important;}.k-colors-icon{background-image:url(img/colors.gif)!important;}.x-toolbar-body table{/* width: 100%; */}.k-preview-msg{background:#FCA;}.k-preview-msg-lab{background:#FCA;padding:0 5px;}.k-eil-edit{border:thin solid #000;}/* duplicated in rte.css */.k-rte-comment{border:1px dashed silver;line-height:1.4;padding:1px;background-color:#D7FFD7;}.k-specialchar-grid{border:1px solid #ACA899;}.k-specialchar-grid table{}.k-specialchar-grid div{line-height:22px;}.k-specialchar-grid td{padding:1px;}.k-specialchar-pb{border:1px solid #EBE8D7;cursor:pointer;font-size:108%!important;text-align:center;vertical-align:middle;width:18px;height:18px;}.k-specialchar-pb-up{}.k-specialchar-big{padding:3px;line-height:22px;font-size:153.899994%!important;}.k-specialchar-adv-label{margin-left:-30px;}.k-specialchar-popup{border:1px solid silver;z-index:9999!important;background-color:#FFF;}.k-specialchar-pb-down{color:#161616;}.k-specialchar-pb-up-hovering{border:thin solid #ACA899;}.k-specialchar-pb-down-hovering{color:#161616;}
\ No newline at end of file
+*/.x-tree-node .k-ctn-status-normal a span{}.x-tree-node .k-ctn-status-deleted a span{text-decoration:line-through;color:gray;}.x-tree-node .k-ctn-status-rejected a span{text-decoration:line-through;/* color: #FF6633; */color:#F30;}.x-tree-node .k-ctn-status-editing a span{font-style:italic;color:gray;}.x-tree-node .k-ctn-status-submitted a span{color:green;}.k-info-links{text-decoration:underline;color:gray;cursor:pointer;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}.k-basic-thumb{background:#FAFAFA none repeat scroll 0 50%;border:1px solid #EBEBEB;padding:3px;margin:3px;}.k-basic-thumb td{padding:2px 3px;border:none;}.k-text-gray{color:gray;}.k-elp-limg{margin-top:4px;margin-left:5px;cursor:pointer;overflow:hidden;}.k-tsp-tag{float:right;margin-right:5px;cursor:pointer;color:#00F;}.k-tsp-cloud{vertical-align:bottom;}.k-link-icon{background-image:url(img/link.gif)!important;}.k-options-icon{background-image:url(img/emblem-system.gif)!important;}.k-copyleft-icon{background-image:url(img/copyleft.png)!important;}.k-picture-icon{background-image:url(img/picture.png)!important;}.k-info-icon{background-image:url(img/info.gif)!important;}.k-newgroup-icon{background-image:url(img/kune-icon16.png)!important;}.k-colors-icon{background-image:url(img/colors.gif)!important;}.x-toolbar-body table{/* width: 100%; */}.k-preview-msg{background:#FCA;}.k-preview-msg-lab{background:#FCA;padding:0 5px;}.k-eil-edit{border:thin solid #000;}/* duplicated in rte.css */.k-rte-comment{border:1px dashed silver;line-height:1.4;padding:1px;background-color:#D7FFD7;}.k-specialchar-grid{border:1px solid #ACA899;}.k-specialchar-grid table{}.k-specialchar-grid div{line-height:22px;}.k-specialchar-grid td{padding:1px;}.k-specialchar-pb{border:1px solid #EBE8D7;cursor:pointer;font-size:108%!important;text-align:center;vertical-align:middle;width:18px;height:18px;}.k-specialchar-pb-up{}.k-specialchar-big{padding:3px;line-height:22px;font-size:153.899994%!important;}.k-specialchar-adv-label{margin-left:-10px;}.k-specialchar-popup{border:1px solid silver;z-index:9999!important;background-color:#FFF;}.k-specialchar-pb-down{color:#161616;}.k-specialchar-pb-up-hovering{border:thin solid #ACA899;}.k-specialchar-pb-down-hovering{color:#161616;}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -27,7 +27,7 @@
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
-import org.ourproject.kune.platf.client.shortcuts.ActionShortcut;
+import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor;
import org.ourproject.kune.platf.client.shortcuts.GlobalShortcutRegister;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.ui.WindowUtils;
@@ -61,7 +61,7 @@
private final Provider<FileDownloadUtils> downloadUtils;
private Collection<RosterItem> roster;
private final Event0 onRosterChanged;
- private final ActionShortcut shortcut;
+ private final ShortcutDescriptor shortcut;
public ChatEngineDefault(final I18nTranslationService i18n, final WorkspaceSkeleton ws, Application application,
Session session, final Provider<EmiteUIDialog> emiteUIProvider,
@@ -71,7 +71,7 @@
this.emiteUIProvider = emiteUIProvider;
this.downloadUtils = downloadUtils;
this.onRosterChanged = new Event0("onRosterChanged");
- shortcut = new ActionShortcut(false, true, false, 'C');
+ shortcut = new ShortcutDescriptor(false, true, false, 'C');
globalShortcutRegister.put(shortcut, new Listener0() {
public void onEvent() {
if (isDialogStarted()) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -21,7 +21,7 @@
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
import org.ourproject.kune.platf.client.services.ImageDescriptor;
-import org.ourproject.kune.platf.client.shortcuts.ActionShortcut;
+import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor;
import com.calclab.suco.client.events.Listener;
import com.calclab.suco.client.events.Listener0;
@@ -78,7 +78,7 @@
/** The id. */
private String id;
- private ActionShortcut shortcut;
+ private ShortcutDescriptor shortcut;
private int position = NO_POSITION;
@@ -232,7 +232,7 @@
return position;
}
- public ActionShortcut getShortcut() {
+ public ShortcutDescriptor getShortcut() {
return shortcut;
}
@@ -401,7 +401,7 @@
this.position = position;
}
- public void setShortcut(ActionShortcut shortcut) {
+ public void setShortcut(ShortcutDescriptor shortcut) {
this.shortcut = shortcut;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarButton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarButton.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionToolbarButton.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -1,7 +1,7 @@
package org.ourproject.kune.platf.client.actions.toolbar;
import org.ourproject.kune.platf.client.actions.ActionToolbarDescriptor;
-import org.ourproject.kune.platf.client.shortcuts.ActionShortcut;
+import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor;
import com.calclab.suco.client.events.Listener0;
import com.gwtext.client.core.EventObject;
@@ -37,7 +37,7 @@
super.setIconCls(iconCls);
}
String toolTip = action.getToolTip();
- ActionShortcut shortcut = action.getShortcut();
+ ShortcutDescriptor shortcut = action.getShortcut();
super.setTooltip((toolTip == null ? "" : toolTip) + (shortcut != null ? shortcut.toString() : ""));
setEnableButton(enabled);
// Waring: If you put set Id above click listener fires twice
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ActionShortcut.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ActionShortcut.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ActionShortcut.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -1,125 +0,0 @@
-package org.ourproject.kune.platf.client.shortcuts;
-
-import org.ourproject.kune.platf.client.i18n.Resources;
-
-import com.google.gwt.user.client.ui.KeyboardListener;
-
-public class ActionShortcut {
-
- private static final String NO_KEYNAME = "nokeyname";
-
- private static boolean has(int modifiers, int modifier) {
- return ((modifiers & modifier) == modifier);
- }
-
- private final boolean alt;
- private final boolean ctrl;
- private final boolean shift;
- private final char key;
- private final String keyName;
-
- public ActionShortcut(boolean ctrl, boolean alt, boolean shift, char key) {
- this(ctrl, alt, shift, key, NO_KEYNAME);
- }
-
- public ActionShortcut(boolean ctrl, boolean alt, boolean shift, char key, String keyName) {
- this.alt = alt;
- this.ctrl = ctrl;
- this.shift = shift;
- this.key = key;
- this.keyName = keyName;
- }
-
- public ActionShortcut(boolean ctrl, boolean shift, char key) {
- this(ctrl, false, shift, key, NO_KEYNAME);
- }
-
- public ActionShortcut(boolean ctrl, boolean shift, char key, String keyName) {
- this(ctrl, false, shift, key, keyName);
- }
-
- public ActionShortcut(boolean ctrl, char key) {
- this(ctrl, false, false, key, NO_KEYNAME);
- }
-
- public ActionShortcut(boolean ctrl, char key, String keyName) {
- this(ctrl, false, false, key, keyName);
- }
-
- public ActionShortcut(char key, int modifiers) {
- this(has(modifiers, KeyboardListener.MODIFIER_CTRL), has(modifiers, KeyboardListener.MODIFIER_ALT), has(
- modifiers, KeyboardListener.MODIFIER_SHIFT), key, NO_KEYNAME);
- }
-
- public ActionShortcut(char key, int modifiers, String keyName) {
- this(has(modifiers, KeyboardListener.MODIFIER_CTRL), has(modifiers, KeyboardListener.MODIFIER_ALT), has(
- modifiers, KeyboardListener.MODIFIER_SHIFT), key, keyName);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ActionShortcut other = (ActionShortcut) obj;
- if (alt != other.alt) {
- return false;
- }
- if (ctrl != other.ctrl) {
- return false;
- }
- if (key != other.key) {
- return false;
- }
- if (shift != other.shift) {
- return false;
- }
- return true;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (alt ? 1231 : 1237);
- result = prime * result + (ctrl ? 1231 : 1237);
- result = prime * result + key;
- result = prime * result + (shift ? 1231 : 1237);
- return result;
- }
-
- public boolean is(char keyCode, int modifiers) {
- return (keyCode == keyCode && same(modifiers, KeyboardListener.MODIFIER_ALT, alt)
- && same(modifiers, KeyboardListener.MODIFIER_CTRL, ctrl) && same(modifiers,
- KeyboardListener.MODIFIER_SHIFT, shift));
- }
-
- public boolean same(int modifiers, int modifier, boolean keyValue) {
- return (has(modifiers, modifier) == keyValue);
- }
-
- @Override
- public String toString() {
- String s = " (";
- s += sKey(alt, "Alt");
- s += sKey(ctrl, "Ctrl");
- s += sKey(shift, "Shift");
- s += keyName != NO_KEYNAME ? translateKey(keyName) + ")" : String.valueOf(key).toUpperCase() + ")";
- return s;
- }
-
- private String sKey(boolean key, String specialKeyName) {
- return key ? translateKey(specialKeyName) + "+" : "";
- }
-
- private String translateKey(String keyNameToTranslate) {
- return Resources.i18n.tWithNT(keyNameToTranslate, "The '" + keyNameToTranslate + "' keyboard key");
- }
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ActionShortcutRegister.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ActionShortcutRegister.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ActionShortcutRegister.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -1,62 +0,0 @@
-package org.ourproject.kune.platf.client.shortcuts;
-
-import java.util.HashMap;
-
-import org.ourproject.kune.platf.client.actions.ActionDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionItem;
-import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-
-import com.allen_sauer.gwt.log.client.Log;
-import com.calclab.suco.client.events.Listener0;
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.ui.KeyboardListenerCollection;
-
-public class ActionShortcutRegister {
-
- @SuppressWarnings("unchecked")
- private final HashMap<ActionShortcut, ActionItem> shortcuts;
-
- @SuppressWarnings("unchecked")
- public ActionShortcutRegister() {
- shortcuts = new HashMap<ActionShortcut, ActionItem>();
- }
-
- @SuppressWarnings("unchecked")
- public ActionItem get(ActionShortcut shortcut) {
- return shortcuts.get(shortcut);
- }
-
- @SuppressWarnings("unchecked")
- public ActionItem get(Event event) {
- int modifiers = KeyboardListenerCollection.getKeyboardModifiers(event);
- if (event.getTypeInt() == Event.ONKEYDOWN && modifiers != 0) {
- ActionShortcut shortcut = new ActionShortcut((char) event.getKeyCode(), modifiers);
- Log.debug("Shortcut pressed" + shortcut.toString());
- return shortcuts.get(shortcut);
- }
- // if (modifiers != 0) {
- // Log.debug("Not action associated with this shortcut");
- // }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public void put(ActionShortcut shortcut, ActionItem actionItem) {
- if (shortcuts.get(shortcut) != null) {
- Log.warn("Shortcut" + shortcut + " already registered");
- }
- shortcuts.put(shortcut, actionItem);
- }
-
- @SuppressWarnings("unchecked")
- public void put(ActionShortcut shortcut, final Listener0 listener) {
- ActionDescriptor descriptor = new ActionDescriptor(AccessRolDTO.Viewer, new Listener0() {
- public void onEvent() {
- listener.onEvent();
- }
- });
- ActionItem item = new ActionItem(descriptor, null);
- put(shortcut, item);
- }
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/GlobalShortcutRegister.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/GlobalShortcutRegister.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/GlobalShortcutRegister.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -7,7 +7,7 @@
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.EventPreview;
-public class GlobalShortcutRegister extends ActionShortcutRegister {
+public class GlobalShortcutRegister extends ShortcutRegister {
private final EventPreview eventPreview;
Added: trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/Keyboard.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/Keyboard.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/Keyboard.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -0,0 +1,22 @@
+package org.ourproject.kune.platf.client.shortcuts;
+
+public interface Keyboard {
+
+ @Deprecated
+ public int KEY_F1 = 112; /* Browser's help */
+ public int KEY_F2 = 113;
+ public int KEY_F3 = 114;
+ public int KEY_F4 = 115;
+ @Deprecated
+ public int KEY_F5 = 116; /* Refresh in browsers */
+ public int KEY_F6 = 117;
+ @Deprecated
+ public int KEY_F7 = 118; /* Turn of caret in ff */
+ public int KEY_F8 = 119;
+ public int KEY_F9 = 120;
+ public int KEY_F10 = 121;
+ @Deprecated
+ public int KEY_F11 = 122; /* Full screen */
+ public int KEY_F12 = 123;
+
+}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutDescriptor.java (from rev 1078, trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ActionShortcut.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ActionShortcut.java 2009-03-16 04:13:36 UTC (rev 1078)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutDescriptor.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -0,0 +1,125 @@
+package org.ourproject.kune.platf.client.shortcuts;
+
+import org.ourproject.kune.platf.client.i18n.Resources;
+
+import com.google.gwt.user.client.ui.KeyboardListener;
+
+public class ShortcutDescriptor {
+
+ private static final String NO_KEYNAME = "nokeyname";
+
+ private static boolean has(int modifiers, int modifier) {
+ return ((modifiers & modifier) == modifier);
+ }
+
+ private final boolean alt;
+ private final boolean ctrl;
+ private final boolean shift;
+ private final int keycode;
+ private final String keyName;
+
+ public ShortcutDescriptor(boolean ctrl, boolean alt, boolean shift, int key) {
+ this(ctrl, alt, shift, key, NO_KEYNAME);
+ }
+
+ public ShortcutDescriptor(boolean ctrl, boolean alt, boolean shift, int key, String keyName) {
+ this.alt = alt;
+ this.ctrl = ctrl;
+ this.shift = shift;
+ this.keycode = key;
+ this.keyName = keyName;
+ }
+
+ public ShortcutDescriptor(boolean ctrl, boolean shift, int key) {
+ this(ctrl, false, shift, key, NO_KEYNAME);
+ }
+
+ public ShortcutDescriptor(boolean ctrl, boolean shift, int key, String keyName) {
+ this(ctrl, false, shift, key, keyName);
+ }
+
+ public ShortcutDescriptor(boolean ctrl, int key) {
+ this(ctrl, false, false, key, NO_KEYNAME);
+ }
+
+ public ShortcutDescriptor(boolean ctrl, int keycode, String keyName) {
+ this(ctrl, false, false, keycode, keyName);
+ }
+
+ public ShortcutDescriptor(int keycode, int modifiers) {
+ this(has(modifiers, KeyboardListener.MODIFIER_CTRL), has(modifiers, KeyboardListener.MODIFIER_ALT), has(
+ modifiers, KeyboardListener.MODIFIER_SHIFT), keycode, NO_KEYNAME);
+ }
+
+ public ShortcutDescriptor(int keycode, int modifiers, String keyName) {
+ this(has(modifiers, KeyboardListener.MODIFIER_CTRL), has(modifiers, KeyboardListener.MODIFIER_ALT), has(
+ modifiers, KeyboardListener.MODIFIER_SHIFT), keycode, keyName);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ShortcutDescriptor other = (ShortcutDescriptor) obj;
+ if (alt != other.alt) {
+ return false;
+ }
+ if (ctrl != other.ctrl) {
+ return false;
+ }
+ if (keycode != other.keycode) {
+ return false;
+ }
+ if (shift != other.shift) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (alt ? 1231 : 1237);
+ result = prime * result + (ctrl ? 1231 : 1237);
+ result = prime * result + keycode;
+ result = prime * result + (shift ? 1231 : 1237);
+ return result;
+ }
+
+ public boolean is(char keyCode, int modifiers) {
+ return (keyCode == keyCode && same(modifiers, KeyboardListener.MODIFIER_ALT, alt)
+ && same(modifiers, KeyboardListener.MODIFIER_CTRL, ctrl) && same(modifiers,
+ KeyboardListener.MODIFIER_SHIFT, shift));
+ }
+
+ public boolean same(int modifiers, int modifier, boolean keyValue) {
+ return (has(modifiers, modifier) == keyValue);
+ }
+
+ @Override
+ public String toString() {
+ String s = " (";
+ s += sKey(alt, "Alt");
+ s += sKey(ctrl, "Ctrl");
+ s += sKey(shift, "Shift");
+ s += keyName != NO_KEYNAME ? translateKey(keyName) + ")" : ("" + (char) keycode).toUpperCase() + ")";
+ return s;
+ }
+
+ private String sKey(boolean key, String specialKeyName) {
+ return key ? translateKey(specialKeyName) + "+" : "";
+ }
+
+ private String translateKey(String keyNameToTranslate) {
+ return Resources.i18n.tWithNT(keyNameToTranslate, "The '" + keyNameToTranslate + "' keyboard key");
+ }
+
+}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutRegister.java (from rev 1078, trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ActionShortcutRegister.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ActionShortcutRegister.java 2009-03-16 04:13:36 UTC (rev 1078)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutRegister.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -0,0 +1,65 @@
+package org.ourproject.kune.platf.client.shortcuts;
+
+import java.util.HashMap;
+
+import org.ourproject.kune.platf.client.actions.ActionDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionItem;
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.calclab.suco.client.events.Listener0;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.KeyboardListenerCollection;
+
+public class ShortcutRegister {
+
+ @SuppressWarnings("unchecked")
+ private final HashMap<ShortcutDescriptor, ActionItem> shortcuts;
+
+ @SuppressWarnings("unchecked")
+ public ShortcutRegister() {
+ shortcuts = new HashMap<ShortcutDescriptor, ActionItem>();
+ }
+
+ @SuppressWarnings("unchecked")
+ public ActionItem get(Event event) {
+ if (event.getTypeInt() == Event.ONKEYDOWN) {
+ int modifiers = KeyboardListenerCollection.getKeyboardModifiers(event);
+ boolean fnKey = (event.getKeyCode() >= Keyboard.KEY_F2 && event.getKeyCode() <= Keyboard.KEY_F12);
+ if (modifiers != 0 || fnKey) {
+ ShortcutDescriptor shortcut = new ShortcutDescriptor(event.getKeyCode(), modifiers);
+ return get(shortcut);
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public ActionItem get(ShortcutDescriptor shortcut) {
+ ActionItem actionItem = shortcuts.get(shortcut);
+ if (actionItem != null) {
+ Log.debug("Shortcut pressed" + actionItem.getAction().getShortcut());
+ }
+ return actionItem;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void put(ShortcutDescriptor shortcut, ActionItem actionItem) {
+ if (shortcuts.get(shortcut) != null) {
+ Log.warn("Shortcut" + shortcut + " already registered");
+ }
+ shortcuts.put(shortcut, actionItem);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void put(ShortcutDescriptor shortcut, final Listener0 listener) {
+ ActionDescriptor descriptor = new ActionDescriptor(AccessRolDTO.Viewer, new Listener0() {
+ public void onEvent() {
+ listener.onEvent();
+ }
+ });
+ ActionItem item = new ActionItem(descriptor, null);
+ put(shortcut, item);
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -72,6 +72,11 @@
init(text, useDoubleClick);
}
+ public void edit() {
+ showEditor();
+ editor.setFocus(true);
+ }
+
public String getText() {
return label.getText();
}
@@ -123,7 +128,7 @@
}
private void init(final String text, final boolean useDoubleClick) {
- this.onEdit = new Event2<String, String>("onEdit");
+ this.onEdit = new Event2<String, String>("onLabelEdit");
doubleClickToRenameLabel = "Double click to rename";
clickToRenameLabel = "Click to rename";
hp = new HorizontalPanel();
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-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -40,6 +40,8 @@
void setExtended(boolean extended);
+ void setFocus(boolean focus);
+
void setHtml(String html);
void setText(String text);
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-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -17,9 +17,9 @@
import org.ourproject.kune.platf.client.actions.ActionItemCollection;
import org.ourproject.kune.platf.client.actions.ActionManager;
import org.ourproject.kune.platf.client.i18n.I18nUITranslationService;
-import org.ourproject.kune.platf.client.shortcuts.ActionShortcut;
-import org.ourproject.kune.platf.client.shortcuts.ActionShortcutRegister;
import org.ourproject.kune.platf.client.shortcuts.GlobalShortcutRegister;
+import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor;
+import org.ourproject.kune.platf.client.shortcuts.ShortcutRegister;
import org.ourproject.kune.platf.client.ui.rte.RichTextArea;
import com.google.gwt.dom.client.Element;
@@ -47,7 +47,7 @@
private final ExtendedFormatter extended;
private final RTEditorPresenter presenter;
private final ActionManager actionManager;
- private final ActionShortcutRegister shortcutRegister;
+ private final ShortcutRegister shortcutRegister;
private final GlobalShortcutRegister globalShortcutReg;
public RTEditorPanel(final RTEditorPresenter presenter, I18nUITranslationService i18n,
@@ -58,7 +58,7 @@
this.globalShortcutReg = globalShortcutReg;
basic = getBasicFormatter();
extended = getExtendedFormatter();
- shortcutRegister = new ActionShortcutRegister();
+ shortcutRegister = new ShortcutRegister();
EventListener listener = new EventListener();
addFocusListener(listener);
setWidth("96%");
@@ -70,7 +70,7 @@
for (ActionItem<Object> actionItem : actionItems) {
ActionDescriptor<Object> action = actionItem.getAction();
if (action.hasShortcut() && action.mustBeAdded(null)) {
- ActionShortcut shortcut = action.getShortcut();
+ ShortcutDescriptor shortcut = action.getShortcut();
shortcutRegister.put(shortcut, actionItem);
}
}
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-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -14,7 +14,7 @@
import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
-import org.ourproject.kune.platf.client.shortcuts.ActionShortcut;
+import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.ui.TextUtils;
import org.ourproject.kune.platf.client.ui.noti.NotifyUser;
@@ -188,6 +188,10 @@
this.extended = extended;
}
+ public void setFocus(boolean focus) {
+ view.setFocus(focus);
+ }
+
public void setHtml(String html) {
view.setHTML(html);
view.focus();
@@ -217,7 +221,7 @@
}
});
selectAll.setIconCls(getCssName(imgResources.selectall()));
- selectAll.setShortcut(new ActionShortcut(true, 'A'));
+ selectAll.setShortcut(new ShortcutDescriptor(true, 'A'));
selectAll.setTextDescription(i18n.t("Select all"));
selectAll.setParentMenuTitle(i18n.t(EDIT_MENU));
selectAll.setAddCondition(canBeBasic);
@@ -232,7 +236,7 @@
});
bold.setIconCls(getCssName(imgResources.bold()));
bold.setToolTip(i18n.t("Bold"));
- bold.setShortcut(new ActionShortcut(true, 'B'));
+ bold.setShortcut(new ShortcutDescriptor(true, 'B'));
bold.setAddCondition(canBeBasic);
italic = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbar, new Listener0() {
@@ -243,7 +247,7 @@
});
italic.setIconCls(getCssName(imgResources.italic()));
italic.setToolTip(i18n.t("Italic"));
- italic.setShortcut(new ActionShortcut(true, 'I'));
+ italic.setShortcut(new ShortcutDescriptor(true, 'I'));
italic.setAddCondition(canBeBasic);
italic.setAddCondition(canBeBasic);
@@ -255,7 +259,7 @@
});
underline.setIconCls(getCssName(imgResources.underline()));
underline.setToolTip(i18n.t("Underline"));
- underline.setShortcut(new ActionShortcut(true, 'U'));
+ underline.setShortcut(new ShortcutDescriptor(true, 'U'));
underline.setAddCondition(canBeBasic);
ActionToolbarMenuDescriptor<Object> subscript = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
@@ -268,7 +272,7 @@
subscript.setParentMenuTitle(i18n.t(FORMAT_MENU));
subscript.setTextDescription(i18n.t("Subscript"));
subscript.setIconCls(getCssName(imgResources.subscript()));
- subscript.setShortcut(new ActionShortcut(true, '0'));
+ subscript.setShortcut(new ShortcutDescriptor(true, 188, ","));
subscript.setAddCondition(canBeBasic);
ActionToolbarMenuDescriptor<Object> superscript = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
@@ -281,7 +285,7 @@
superscript.setParentMenuTitle(i18n.t(FORMAT_MENU));
superscript.setTextDescription(i18n.t("Superscript"));
superscript.setIconCls(getCssName(imgResources.superscript()));
- superscript.setShortcut(new ActionShortcut(true, '9'));
+ superscript.setShortcut(new ShortcutDescriptor(true, 190, "."));
superscript.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> justifyLeft = new ActionToolbarButtonDescriptor<Object>(accessRol,
@@ -293,7 +297,7 @@
});
justifyLeft.setIconCls(getCssName(imgResources.alignleft()));
justifyLeft.setToolTip(i18n.t("Left Justify"));
- justifyLeft.setShortcut(new ActionShortcut(true, 'L'));
+ justifyLeft.setShortcut(new ShortcutDescriptor(true, 'L'));
justifyLeft.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> justifyCentre = new ActionToolbarButtonDescriptor<Object>(accessRol,
@@ -305,7 +309,7 @@
});
justifyCentre.setIconCls(getCssName(imgResources.centerpara()));
justifyCentre.setToolTip(i18n.t("Centre Justify"));
- justifyCentre.setShortcut(new ActionShortcut(true, 'E'));
+ justifyCentre.setShortcut(new ShortcutDescriptor(true, 'E'));
justifyCentre.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> justifyRight = new ActionToolbarButtonDescriptor<Object>(accessRol,
@@ -317,7 +321,7 @@
});
justifyRight.setIconCls(getCssName(imgResources.alignright()));
justifyRight.setToolTip(i18n.t("Right Justify"));
- justifyRight.setShortcut(new ActionShortcut(true, 'R'));
+ justifyRight.setShortcut(new ShortcutDescriptor(true, 'R'));
justifyRight.setAddCondition(canBeBasic);
ActionToolbarMenuDescriptor<Object> undo = new ActionToolbarMenuDescriptor<Object>(accessRol, topbar,
@@ -327,7 +331,7 @@
fireOnEdit();
}
});
- undo.setShortcut(new ActionShortcut(true, 'Z'));
+ undo.setShortcut(new ShortcutDescriptor(true, 'Z'));
undo.setTextDescription(i18n.t("Undo"));
undo.setParentMenuTitle(i18n.t(EDIT_MENU));
undo.setAddCondition(canBeExtended);
@@ -340,7 +344,7 @@
fireOnEdit();
}
});
- redo.setShortcut(new ActionShortcut(true, 'Y'));
+ redo.setShortcut(new ShortcutDescriptor(true, 'Y'));
redo.setTextDescription(i18n.t("Redo"));
redo.setParentMenuTitle(i18n.t(EDIT_MENU));
redo.setAddCondition(canBeExtended);
@@ -378,7 +382,7 @@
view.copy();
}
});
- copy.setShortcut(new ActionShortcut(true, 'C'));
+ copy.setShortcut(new ShortcutDescriptor(true, 'C'));
copy.setTextDescription(i18n.t("Copy"));
copy.setParentMenuTitle(i18n.t(EDIT_MENU));
copy.setAddCondition(canBeExtended);
@@ -391,7 +395,7 @@
fireOnEdit();
}
});
- cut.setShortcut(new ActionShortcut(true, 'X'));
+ cut.setShortcut(new ShortcutDescriptor(true, 'X'));
cut.setTextDescription(i18n.t("Cut"));
cut.setParentMenuTitle(i18n.t(EDIT_MENU));
cut.setAddCondition(canBeExtended);
@@ -404,7 +408,7 @@
fireOnEdit();
}
});
- paste.setShortcut(new ActionShortcut(true, 'V'));
+ paste.setShortcut(new ShortcutDescriptor(true, 'V'));
paste.setTextDescription(i18n.t("Paste"));
paste.setParentMenuTitle(i18n.t(EDIT_MENU));
paste.setAddCondition(canBeExtended);
@@ -470,7 +474,7 @@
return session.isLogged();
}
});
- comment.setShortcut(new ActionShortcut(true, 'M'));
+ comment.setShortcut(new ShortcutDescriptor(true, 'M'));
comment.setTextDescription(i18n.t("Comment"));
comment.setParentMenuTitle(i18n.t(INSERT_MENU));
comment.setEnableCondition(isInsertHtmlSupported());
@@ -485,7 +489,7 @@
}
});
hr.setTextDescription(i18n.t("Horizontal line"));
- hr.setShortcut(new ActionShortcut(true, true, ' ', "Space"));
+ hr.setShortcut(new ShortcutDescriptor(true, true, ' ', "Space"));
hr.setIconCls(getCssName(imgResources.hfixedline()));
hr.setParentMenuTitle(i18n.t(INSERT_MENU));
hr.setAddCondition(canBeExtended);
@@ -556,7 +560,7 @@
});
ol.setIconCls(getCssName(imgResources.defaultnumbering()));
ol.setToolTip(i18n.t("Numbered List"));
- ol.setShortcut(new ActionShortcut(true, '7'));
+ ol.setShortcut(new ShortcutDescriptor(true, '7'));
ol.setAddCondition(canBeExtended);
ActionToolbarButtonDescriptor<Object> ul = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbar,
@@ -568,7 +572,7 @@
});
ul.setIconCls(getCssName(imgResources.defaultbullet()));
ul.setToolTip(i18n.t("Bullet List"));
- ul.setShortcut(new ActionShortcut(true, '8'));
+ ul.setShortcut(new ShortcutDescriptor(true, '8'));
ul.setRightSeparator(ActionToolbarButtonSeparator.separator);
ul.setAddCondition(canBeExtended);
@@ -603,7 +607,7 @@
});
createLink.setIconCls(getCssName(imgResources.link()));
createLink.setToolTip(i18n.t("Create Link"));
- createLink.setShortcut(new ActionShortcut(true, 'K'));
+ createLink.setShortcut(new ShortcutDescriptor(true, 'K'));
createLink.setAddCondition(canBeExtended);
ActionToolbarButtonDescriptor<Object> removeLink = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbar,
@@ -615,7 +619,7 @@
});
removeLink.setIconCls(getCssName(imgResources.linkbreak()));
removeLink.setToolTip(i18n.t("Remove Link"));
- removeLink.setShortcut(new ActionShortcut(true, true, 'K'));
+ removeLink.setShortcut(new ShortcutDescriptor(true, true, 'K'));
removeLink.setAddCondition(canBeExtended);
final ActionToolbarMenuDescriptor<Object> removeFormat = new ActionToolbarMenuDescriptor<Object>(accessRol,
@@ -626,7 +630,7 @@
}
});
removeFormat.setIconCls(getCssName(imgResources.removeFormat()));
- ActionShortcut ctrl_space = new ActionShortcut(true, ' ', "Space");
+ ShortcutDescriptor ctrl_space = new ShortcutDescriptor(true, ' ', "Space");
removeFormat.setTextDescription(i18n.t("Clear Formatting") + (ctrl_space.toString()));
removeFormat.setAddCondition(canBeExtended);
removeFormat.setParentMenuTitle(i18n.t(FORMAT_MENU));
@@ -756,7 +760,7 @@
devInfo.setTextDescription(i18n.t("Developers info"));
devInfo.setAddCondition(canBeExtended);
devInfo.setParentMenuTitle(i18n.t(FORMAT_MENU));
- devInfo.setShortcut(new ActionShortcut(false, true, false, 'I'));
+ devInfo.setShortcut(new ShortcutDescriptor(false, true, false, 'I'));
actions.add(withNoItem(bold));
actions.add(withNoItem(italic));
@@ -839,6 +843,7 @@
font.setParentMenuTooltip(i18n.t("Font size"));
font.setParentMenuIconCls(getCssName(imgResources.fontheight()));
font.setAddCondition(canBeBasic);
+ font.setShortcut(new ShortcutDescriptor(true, 48 + fontSize));
return font;
}
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-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -82,6 +82,8 @@
void setBackColor(String color);
+ void setFocus(boolean focus);
+
void setFontName(String name);
void setFontSize(FontSize fontSize);
@@ -107,4 +109,5 @@
void undo();
void unlink();
+
}
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-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -6,7 +6,7 @@
import org.ourproject.kune.platf.client.actions.BeforeActionListener;
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
-import org.ourproject.kune.platf.client.shortcuts.ActionShortcut;
+import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.ui.rte.basic.RTEditor;
import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources;
@@ -19,7 +19,7 @@
public class RTESavingEditorPresenter implements RTESavingEditor {
@Deprecated
- private static final String FILE_MENU_OPTION = "File";
+ public static final String FILE_MENU_OPTION = "File";
public static final int AUTOSAVE_AFTER_FAILS_IN_MILLISECONS = 20000;
public static final int AUTOSAVE_IN_MILLISECONDS = 10000;
@@ -183,7 +183,7 @@
saveBtn = new ActionToolbarButtonDescriptor<Object>(AccessRolDTO.Editor, RTEditor.sndbar, onPerformSaveCall);
saveBtn.setIconCls(RTEImgResources.SUFFIX + imgResources.save().getName());
saveBtn.setToolTip(i18n.t("Save"));
- ActionShortcut ctrl_S = new ActionShortcut(true, 'S');
+ ShortcutDescriptor ctrl_S = new ShortcutDescriptor(true, 'S');
saveBtn.setShortcut(ctrl_S);
saveBtn.setPosition(0);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -157,6 +157,8 @@
renameCtn.setTextDescription(textDescription);
renameCtn.setParentMenuTitle(parentMenuTitle);
renameCtn.setEnableCondition(notDeleted());
+ // renameCtn.setShortcut(new ShortcutDescriptor(false, Keyboard.KEY_F2,
+ // i18n.tWithNT("F2", "The F2 Function key")));
contentActionRegistry.addAction(renameCtn, registerInTypes);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -873,7 +873,7 @@
return new ContentEditor($(RTEditor.class), true, $(I18nTranslationService.class),
$(StateManager.class), $(SiteSignOutLink.class), $(DeferredCommandWrapper.class),
$(RTEImgResources.class), $(WorkspaceSkeleton.class), $(TimerWrapper.class),
- new RTESavingEditorPanel());
+ new RTESavingEditorPanel(), $(EntityTitle.class));
}
});
register(NoDecoration.class, new Factory<ActionContextTopToolbar>(ActionContextTopToolbar.class) {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -1,7 +1,11 @@
package org.ourproject.kune.workspace.client.editor;
+import org.ourproject.kune.platf.client.actions.ActionToolbarMenuDescriptor;
import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbarPanel;
+import org.ourproject.kune.platf.client.dto.AccessRolDTO;
import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
+import org.ourproject.kune.platf.client.shortcuts.Keyboard;
+import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.ui.AbstractToolbar;
import org.ourproject.kune.platf.client.ui.rte.basic.RTEditor;
@@ -14,6 +18,7 @@
import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignOutLink;
import org.ourproject.kune.workspace.client.skel.Toolbar;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+import org.ourproject.kune.workspace.client.title.EntityTitle;
import com.calclab.suco.client.events.Listener;
import com.calclab.suco.client.events.Listener0;
@@ -32,12 +37,17 @@
private final RTEditorPanel editorPanel;
private final AbstractToolbar topbar;
private final SiteSignOutLink siteSignOutLink;
+ private final I18nTranslationService i18n;
+ private final EntityTitle entityTitle;
public ContentEditor(RTEditor editor, boolean autoSave, final I18nTranslationService i18n,
StateManager stateManager, SiteSignOutLink siteSignOutLink, DeferredCommandWrapper deferredCommandWrapper,
- RTEImgResources imgResources, WorkspaceSkeleton ws, TimerWrapper timer, RTESavingEditorView view) {
+ RTEImgResources imgResources, WorkspaceSkeleton ws, TimerWrapper timer, RTESavingEditorView view,
+ EntityTitle entityTitle) {
super(editor, autoSave, i18n, stateManager, deferredCommandWrapper, imgResources, timer);
+ this.i18n = i18n;
this.siteSignOutLink = siteSignOutLink;
+ this.entityTitle = entityTitle;
super.init(view);
this.ws = ws;
Window.addWindowCloseListener(new WindowCloseListener() {
@@ -55,6 +65,7 @@
});
vp = new VerticalPanel();
basicEditor = super.getBasicEditor();
+ addContentActions();
vp.add((Widget) ((ActionToolbarPanel<Object>) basicEditor.getSndBar().getView()).getToolbar());
editorPanel = (RTEditorPanel) basicEditor.getEditorArea();
vp.add(editorPanel);
@@ -88,6 +99,20 @@
siteSignOutLink.addBeforeSignOut(getBeforeSavingListener());
}
+ private void addContentActions() {
+ ActionToolbarMenuDescriptor<Object> rename = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
+ RTEditor.topbar, new Listener0() {
+ public void onEvent() {
+ entityTitle.edit();
+ // basicEditor.setFocus(false);
+ }
+ });
+ rename.setParentMenuTitle(i18n.t(RTESavingEditorPresenter.FILE_MENU_OPTION));
+ rename.setShortcut(new ShortcutDescriptor(false, Keyboard.KEY_F2, i18n.tWithNT("F2", "The F2 Function key")));
+ rename.setTextDescription(i18n.t("Rename"));
+ basicEditor.addAction(rename);
+ }
+
private void adjHeight(final int height) {
AbstractToolbar sndbar = ((ActionToolbarPanel<Object>) basicEditor.getSndBar().getView()).getToolbar();
int barHeight = sndbar.getOffsetHeight();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -25,7 +25,7 @@
import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
import org.ourproject.kune.platf.client.i18n.I18nTranslationServiceMocked;
-import org.ourproject.kune.platf.client.shortcuts.ActionShortcut;
+import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor;
import org.ourproject.kune.platf.client.shortcuts.GlobalShortcutRegister;
import org.ourproject.kune.platf.client.ui.noti.NotifyUser;
import org.ourproject.kune.workspace.client.AbstractFoldableContentActions;
@@ -208,7 +208,7 @@
/**
* Global shortcut sample definition
*/
- $(GlobalShortcutRegister.class).put(new ActionShortcut(false, true, false, 'S'), new Listener0() {
+ $(GlobalShortcutRegister.class).put(new ShortcutDescriptor(false, true, false, 'S'), new Listener0() {
public void onEvent() {
NotifyUser.info("Global Ctrl+S pressed");
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitle.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitle.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitle.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -19,9 +19,10 @@
\*/
package org.ourproject.kune.workspace.client.title;
-
public interface EntityTitle {
+ void edit();
+
void setContentTitle(String title);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePanel.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePanel.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -52,6 +52,10 @@
icon.setVisible(false);
}
+ public void edit() {
+ titleLabel.edit();
+ }
+
public void setContentIcon(final String iconUrl) {
icon.setUrl(iconUrl);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -62,6 +62,10 @@
addRenameListeners();
}
+ public void edit() {
+ view.edit();
+ }
+
public View getView() {
return view;
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitleView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitleView.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitleView.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -23,6 +23,8 @@
public interface EntityTitleView extends View {
+ void edit();
+
void setContentIcon(String iconUrl);
void setContentIconVisible(boolean visible);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/RenameAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/RenameAction.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/RenameAction.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -44,8 +44,8 @@
this.i18n = i18n;
this.session = session;
this.contentService = contentService;
- this.onSuccess = new Event2<StateToken, String>("onSuccess");
- this.onFail = new Event2<StateToken, String>("onFail");
+ this.onSuccess = new Event2<StateToken, String>("onRenameSuccess");
+ this.onFail = new Event2<StateToken, String>("onRenamaFail");
}
public void onFail(final Listener2<StateToken, String> slot) {
Modified: trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionShortcutTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionShortcutTest.java 2009-03-17 12:48:20 UTC (rev 1081)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionShortcutTest.java 2009-03-18 14:37:36 UTC (rev 1082)
@@ -5,7 +5,7 @@
import org.junit.Before;
import org.junit.Test;
-import org.ourproject.kune.platf.client.shortcuts.ActionShortcut;
+import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor;
import com.google.gwt.user.client.ui.KeyboardListener;
@@ -13,7 +13,7 @@
@Test
public void altS() {
- ActionShortcut shortcut = new ActionShortcut(false, true, false, 'S', null);
+ ShortcutDescriptor shortcut = new ShortcutDescriptor(false, true, false, 'S', null);
assertEquals(" (Alt+S)", shortcut.toString());
assertTrue(shortcut.is('S', KeyboardListener.MODIFIER_ALT));
assertTrue(!shortcut.is('S', KeyboardListener.MODIFIER_CTRL));
@@ -26,7 +26,7 @@
@Test
public void ctrl_coma() {
- ActionShortcut shortcut = new ActionShortcut(true, ',');
+ ShortcutDescriptor shortcut = new ShortcutDescriptor(true, ',');
assertEquals(" (Ctrl+,)", shortcut.toString());
assertTrue(shortcut.is(',', KeyboardListener.MODIFIER_CTRL));
assertTrue(!shortcut.is(',', KeyboardListener.MODIFIER_ALT));
@@ -35,7 +35,7 @@
@Test
public void ctrl_s() {
- ActionShortcut shortcut = new ActionShortcut(true, 's');
+ ShortcutDescriptor shortcut = new ShortcutDescriptor(true, 's');
assertEquals(" (Ctrl+S)", shortcut.toString());
assertTrue(shortcut.is('s', KeyboardListener.MODIFIER_CTRL));
assertTrue(!shortcut.is('s', KeyboardListener.MODIFIER_ALT));
@@ -44,7 +44,7 @@
@Test
public void ctrlS() {
- ActionShortcut shortcut = new ActionShortcut(true, 'S');
+ ShortcutDescriptor shortcut = new ShortcutDescriptor(true, 'S');
assertEquals(" (Ctrl+S)", shortcut.toString());
assertTrue(shortcut.is('S', KeyboardListener.MODIFIER_CTRL));
assertTrue(!shortcut.is('S', KeyboardListener.MODIFIER_ALT));
@@ -53,7 +53,7 @@
@Test
public void ctrlShiftS() {
- ActionShortcut shortcut = new ActionShortcut(true, false, true, 'S', null);
+ ShortcutDescriptor shortcut = new ShortcutDescriptor(true, false, true, 'S', null);
assertEquals(" (Ctrl+Shift+S)", shortcut.toString());
assertTrue(!shortcut.is('S', KeyboardListener.MODIFIER_ALT));
assertTrue(shortcut.is('S', KeyboardListener.MODIFIER_SHIFT | KeyboardListener.MODIFIER_CTRL));
More information about the kune-commits
mailing list