[kune-commits] r1116 - in trunk/src:
main/java/org/ourproject/kune/app/client
main/java/org/ourproject/kune/app/public/css
main/java/org/ourproject/kune/app/server
main/java/org/ourproject/kune/platf/client
main/java/org/ourproject/kune/platf/client/actions
main/java/org/ourproject/kune/platf/client/actions/ui
main/java/org/ourproject/kune/platf/client/dto
main/java/org/ourproject/kune/platf/client/i18n
main/java/org/ourproject/kune/platf/client/services
main/java/org/ourproject/kune/platf/client/shortcuts
main/java/org/ourproject/kune/platf/client/ui
main/java/org/ourproject/kune/platf/client/ui/dialogs
main/java/org/ourproject/kune/platf/client/ui/download
main/java/org/ourproject/kune/platf/client/ui/gridmenu
main/java/org/ourproject/kune/platf/client/ui/img
main/java/org/ourproject/kune/platf/client/ui/noti
main/java/org/ourproject/kune/platf/client/ui/palette
main/java/org/ourproject/kune/platf/client/ui/rte/basic
main/java/org/ourproject/kune/platf/client/ui/rte/edithtml
main/java/org/ourproject/kune/platf/client/ui/rte/img
main/java/org/ourproject/kune/platf/client/ui/rte/insertimg
main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar
main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/occidental
main/java/org/ourproject/kune/platf/client/ui/rte/saving
main/java/org/ourproject/kune/platf/server/domain
main/java/org/ourproject/kune/platf/server/manager
main/java/org/ourproject/kune/platf/server/manager/file
main/java/org/ourproject/kune/platf/server/manager/impl
main/java/org/ourproject/kune/platf/server/rpc
main/java/org/ourproject/kune/rack/filters/gwts
main/java/org/ourproject/kune/workspace/client
main/java/org/ourproject/kune/workspace/client/cnt
main/java/org/ourproject/kune/workspace/client/entityheader
main/java/org/ourproject/kune/workspace/client/hello
main/java/org/ourproject/kune/workspace/client/options/logo
main/java/org/ourproject/kune/workspace/client/rate
main/java/org/ourproject/kune/workspace/client/signin
main/java/org/ourproject/kune/workspace/client/socialnet
main/java/org/ourproject/kune/workspace/client/tags
main/java/org/ourproject/kune/workspace/client/upload
test/java/org/ourproject/kune/rack/filters/rest
vjrj
vjrj at ourproject.org
Sat May 30 01:30:32 CEST 2009
Author: vjrj
Date: 2009-05-30 01:30:06 +0200 (Sat, 30 May 2009)
New Revision: 1116
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButtonGui.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractComplexGuiItem.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiActionDescrip.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuGui.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItemGui.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BasicGuiBinding.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ButtonBinding.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ButtonGui.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiAddCondition.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiAddConditionAdapter.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiBinding.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiBindingAdapter.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiBindingsRegister.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiVisibleCondition.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiVisibleConditionAdapter.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuBinding.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuCheckItemGui.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuGui.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemBinding.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemGui.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparatorBinding.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButtonBinding.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButtonGui.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/SubMenuGui.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/AbstractPopupPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/
trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/ImgConstants.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/ImgResources.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/info.png
trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/kimg.css
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorNew.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanelNew.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenterNew.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorViewNew.java
Removed:
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButton.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenu.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItem.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIActionDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIElement.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultButton.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenu.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenuCheckItem.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenuItem.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultSubMenu.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButton.java
Modified:
trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java
trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
trunk/src/main/java/org/ourproject/kune/app/server/NotInObject.java
trunk/src/main/java/org/ourproject/kune/platf/client/PlatfMessages.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPosition.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparatorDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ButtonDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ComplexToolbar.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiActionCollection.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuCheckItemDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioItemDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparatorDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButtonDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ToolbarSeparatorDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRightsDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/CommentDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/TagCountDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserSimpleDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/i18n/Resources.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/SearcherConstants.java
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/ui/DropDownPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/download/FileConstants.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/noti/NotifyUser.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/AbstractPalettePanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/ColorWebSafePalettePanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/SimplePalettePanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTELinkPopup.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/edithtml/EditHtmlDialogView.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
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ContentPosition.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialogView.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/occidental/AbstractInsertCharPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/TagCount.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/FileManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerAbstract.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java
trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/DelegatedRemoteServlet.java
trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceMessages.java
trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java
trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateItPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/upload/FileUploaderDialog.java
trunk/src/test/java/org/ourproject/kune/rack/filters/rest/TestRESTServiceDefinition.java
Log:
The "Wave? what wave?" commit ;)
Complete - task Popup generalization
Incomplete - task New Action class (adapted from Swing) to replace ActionDescription
Modified: trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -45,9 +45,6 @@
public void onModuleLoad() {
Log.setUncaughtExceptionHandler();
- // At the moment, in runtime:
- Log.setCurrentLogLevel(Log.LOG_LEVEL_DEBUG);
-
DeferredCommand.addCommand(new Command() {
public void execute() {
onModuleLoadCont();
@@ -56,6 +53,9 @@
}
public void onModuleLoadCont() {
+ // At the moment, in runtime:
+ Log.setCurrentLogLevel(Log.LOG_LEVEL_DEBUG);
+
Suco.install(new CoreModule(), new RegistryModule(), new PlatformModule(), new EmiteUIModule(),
new DocumentClientModule(), new BlogClientModule(), new WikiClientModule(), new GalleryClientModule(),
new ChatClientModule(), new WorkspaceModule());
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2009-05-29 23:30:06 UTC (rev 1116)
@@ -999,4 +999,10 @@
font-size: 100%;
margin-left: 0px;
margin-top: 0px;
+}
+
+.k-def-popup {
+ z-index: 9999 !important;
+ background-color: #FFF;
+ border: 1px solid gray;
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/app/server/NotInObject.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/server/NotInObject.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/app/server/NotInObject.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -26,19 +26,20 @@
import com.google.inject.matcher.AbstractMatcher;
public class NotInObject extends AbstractMatcher<Method> {
+
private final List<String> excluded;
- Object o;
public NotInObject() {
+ super();
// FIXME exclude password
excluded = Arrays.asList(new String[] { "finalize", "toString", "hashCode", "getClass", "wait", "equals" });
}
- public boolean matches(final Method t) {
- String name = t.getName();
+ public boolean matches(final Method method) {
+ final String name = method.getName();
- boolean isGetter = name.startsWith("set");
- boolean isExcluded = excluded.contains(name);
+ final boolean isGetter = name.startsWith("set");
+ final boolean isExcluded = excluded.contains(name);
return !isGetter || !isExcluded;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/PlatfMessages.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/PlatfMessages.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/PlatfMessages.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -19,18 +19,21 @@
*/
package org.ourproject.kune.platf.client;
-public interface PlatfMessages {
- String BUDDIES_NOT_PUBLIC = "The buddies of this user are not public";
- String MEMBERS_NOT_PUBLIC = "The members of this group are not public";
- String REGISTER_TITLE = "Register";
- String SIGN_IN_TITLE = "Sign in";
- String EMAIL_IN_USE = "This email address is being used by another user. Please, try with another one";
- String NAME_IN_USE = "This name in already in use. Please try with a different name";
- String INCORRECT_NICKNAME_EMAIL_OR_PASSWORD = "The nickname/email/password is incorrect";
- String YOUR_HOMEPAGE = "Your homepage";
- String USER_DOESN_T_HAVE_A_HOMEPAGE = "This user does not have a homepage";
- String ENT_LOGO_SELECTOR_NORMAL_TITLE = "Logo";
- String ENT_LOGO_SELECTOR_PERSON_TITLE = "Avatar";
- String ENT_OPTIONS_GROUP_TITLE = "Group options";
- String ENT_OPTIONS_USER_TITLE = "User options";
+public final class PlatfMessages {
+ public final static String BUDDIES_NOT_PUBLIC = "The buddies of this user are not public";
+ public final static String MEMBERS_NOT_PUBLIC = "The members of this group are not public";
+ public final static String REGISTER_TITLE = "Register";
+ public final static String SIGN_IN_TITLE = "Sign in";
+ public final static String EMAIL_IN_USE = "This email address is being used by another user. Please, try with another one";
+ public final static String NAME_IN_USE = "This name in already in use. Please try with a different name";
+ public final static String INCORRECT_NICKNAME_EMAIL_OR_PASSWORD = "The nickname/email/password is incorrect";
+ public final static String YOUR_HOMEPAGE = "Your homepage";
+ public final static String USER_DOESN_T_HAVE_A_HOMEPAGE = "This user does not have a homepage";
+ public final static String ENT_LOGO_SELECTOR_NORMAL_TITLE = "Logo";
+ public final static String ENT_LOGO_SELECTOR_PERSON_TITLE = "Avatar";
+ public final static String ENT_OPTIONS_GROUP_TITLE = "Group options";
+ public final static String ENT_OPTIONS_USER_TITLE = "User options";
+
+ private PlatfMessages() {
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPosition.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPosition.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPosition.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -4,18 +4,21 @@
private final String id;
- public ActionToolbarPosition(String id) {
+ public ActionToolbarPosition(final String id) {
this.id = id;
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
ActionToolbarPosition other = (ActionToolbarPosition) obj;
if (id == null) {
if (other.id != null) {
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButton.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButton.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,68 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-import org.ourproject.kune.platf.client.actions.ActionEvent;
-import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources;
-
-import com.google.gwt.libideas.resources.client.ImageResource;
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.widgets.Button;
-import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-
-public abstract class AbstractButton extends AbstractGuiItem {
-
- private transient final Button button;
-
- public AbstractButton(final ButtonDescriptor buttonDescriptor) {
- this(buttonDescriptor, false);
- }
-
- public AbstractButton(final ButtonDescriptor buttonDescriptor, final boolean enableTongle) {
- super();
- button = new Button();
- button.setEnableToggle(enableTongle);
- initWidget(button);
- button.addListener(new ButtonListenerAdapter() {
- @Override
- public void onClick(final Button button, final EventObject event) {
- if (action != null) {
- action.actionPerformed(new ActionEvent(button, event.getBrowserEvent()));
- }
- }
- });
- setAction(buttonDescriptor.action);
- }
-
- @Override
- public void setEnabled(final boolean enabled) {
- if (enabled) {
- button.enable();
- } else {
- button.disable();
- }
- }
-
- @Override
- public void setIcon(final ImageResource imageResource) {
- if (imageResource != null) {
- // FIXME
- button.setIconCls(RTEImgResources.SUFFIX + imageResource.getName());
- }
- }
-
- public void setPressed(final boolean pressed) {
- if (button.isPressed() != pressed) {
- button.toggle();
- }
- }
-
- @Override
- public void setText(final String text) {
- button.setText(text);
- }
-
- @Override
- public void setToolTipText(final String tooltip) {
- button.setTooltip(tooltip);
- }
-
-}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButtonGui.java (from rev 1114, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButton.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButton.java 2009-05-26 16:04:44 UTC (rev 1114)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButtonGui.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,74 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.Action;
+import org.ourproject.kune.platf.client.actions.ActionEvent;
+import org.ourproject.kune.platf.client.actions.KeyStroke;
+import org.ourproject.kune.platf.client.ui.img.ImgConstants;
+
+import com.google.gwt.libideas.resources.client.ImageResource;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+
+public abstract class AbstractButtonGui extends AbstractGuiItem {
+
+ private transient final Button button;
+
+ public AbstractButtonGui(final ButtonDescriptor buttonDescriptor) {
+ this(buttonDescriptor, false);
+ }
+
+ public AbstractButtonGui(final ButtonDescriptor buttonDescriptor, final boolean enableTongle) {
+ super();
+ button = new Button();
+ button.setEnableToggle(enableTongle);
+ initWidget(button);
+ button.addListener(new ButtonListenerAdapter() {
+ @Override
+ public void onClick(final Button button, final EventObject event) {
+ if (action != null) {
+ action.actionPerformed(new ActionEvent(button, event.getBrowserEvent()));
+ }
+ }
+ });
+ setAction(buttonDescriptor.action);
+ }
+
+ @Override
+ public void setEnabled(final boolean enabled) {
+ if (enabled) {
+ button.enable();
+ } else {
+ button.disable();
+ }
+ }
+
+ @Override
+ public void setIcon(final ImageResource imageResource) {
+ if (imageResource != null) {
+ button.setIcon(ImgConstants.PATH_PREFIX + imageResource.getName());
+ }
+ }
+
+ public void setPressed(final boolean pressed) {
+ if (button.isPressed() != pressed) {
+ button.toggle();
+ }
+ }
+
+ @Override
+ public void setText(final String text) {
+ button.setText(text);
+ }
+
+ @Override
+ public void setToolTipText(final String tooltip) {
+ final KeyStroke key = (KeyStroke) action.getValue(Action.ACCELERATOR_KEY);
+ if (key == null) {
+ button.setTooltip(tooltip);
+ } else {
+ button.setTooltip(tooltip + key.toString());
+ }
+ }
+
+}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractComplexGuiItem.java (from rev 1114, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIElement.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIElement.java 2009-05-26 16:04:44 UTC (rev 1114)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractComplexGuiItem.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,44 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import java.util.List;
+
+import org.ourproject.kune.platf.client.actions.Action;
+import org.ourproject.kune.platf.client.actions.InputMap;
+import org.ourproject.kune.platf.client.actions.KeyStroke;
+
+import com.google.gwt.user.client.ui.Composite;
+
+public abstract class AbstractComplexGuiItem extends Composite {
+
+ private transient GuiActionCollection guiItems;
+ private transient InputMap inputMap;
+
+ public void add(final AbstractGuiActionDescrip... descriptors) {
+ for (AbstractGuiActionDescrip descriptor : descriptors) {
+ getGuiItems().add(descriptor);
+ }
+ }
+
+ public void addAction(final KeyStroke key, final Action action) {
+ getInputMap().put(key, action);
+ }
+
+ public void addAll(final List<AbstractGuiActionDescrip> descriptors) {
+ getGuiItems().addAll(descriptors);
+ }
+
+ public GuiActionCollection getGuiItems() {
+ if (guiItems == null) {
+ guiItems = new GuiActionCollection();
+ }
+ return guiItems;
+ }
+
+ private InputMap getInputMap() {
+ if (inputMap == null) {
+ inputMap = new InputMap();
+ }
+ return inputMap;
+ }
+
+}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiActionDescrip.java (from rev 1114, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIActionDescriptor.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIActionDescriptor.java 2009-05-26 16:04:44 UTC (rev 1114)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiActionDescrip.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,215 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.actions.AbstractAction;
+
+/**
+ * The Class AbstractUIActionDescriptor.
+ */
+public abstract class AbstractGuiActionDescrip {
+
+ protected static final int NO_POSITION = -1;
+ protected static final View NO_VIEW = null;
+ protected static final AbstractGuiActionDescrip NO_PARENT = null;
+
+ private GuiAddCondition addCondition = new GuiAddConditionAdapter();
+ private GuiVisibleCondition visibleCondition = new GuiVisibleConditionAdapter();
+
+ protected AbstractGuiActionDescrip parent;
+ private transient final Map<String, Object> store;
+
+ /** The action. */
+ protected transient AbstractAction action;
+
+ /** The position where the item will be inserted. */
+ private int position;
+
+ /** If the action must be confirmed. */
+ private boolean confirmRequired;
+
+ /** The confirmation dialog title. */
+ private String confirmationTitle;
+
+ /** The confirmation dialog text. */
+ private String confirmationText;
+
+ /** The item location. */
+ private String location;
+
+ /**
+ * Instantiates a new abstract ui action descriptor. This is used for
+ * describe UI button, menus, menu items and so on
+ *
+ * @param action
+ * the action
+ */
+ public AbstractGuiActionDescrip(final AbstractAction action) {
+ this.action = action;
+ position = NO_POSITION;
+ parent = NO_PARENT;
+ store = new HashMap<String, Object>();
+ }
+
+ public GuiAddCondition getAddCondition() {
+ return addCondition;
+ }
+
+ /**
+ * Gets the dialog confirmation text.
+ *
+ * @return the confirmation text
+ */
+ public String getConfirmationText() {
+ return confirmationText;
+ }
+
+ /**
+ * Gets the dialog confirmation title.
+ *
+ * @return the confirmation title
+ */
+ public String getConfirmationTitle() {
+ return confirmationTitle;
+ }
+
+ /**
+ * Gets the location, a string used to group actions with locations (top
+ * bar, bottom bar, user bar...).
+ *
+ * @return the location
+ */
+ public String getLocation() {
+ return location;
+ }
+
+ public AbstractGuiActionDescrip getParent() {
+ return parent;
+ }
+
+ /**
+ * Gets the position.
+ *
+ * @return the position
+ */
+ public int getPosition() {
+ return position;
+ }
+
+ public abstract Class<?> getType();
+
+ /**
+ * Returns the value associated with the specified key.
+ *
+ * @param key
+ * the key (not <code>null</code>).
+ *
+ * @return The value associated with the specified key, or <code>null</code>
+ * if the key is not found.
+ *
+ * @see #putValue(String, Object)
+ */
+ public Object getValue(final String key) {
+ return store.get(key);
+ }
+
+ public GuiVisibleCondition getVisibleCondition() {
+ return visibleCondition;
+ }
+
+ public boolean isChild() {
+ // @PMD:REVIEWED:CompareObjectsWithEquals: by vjrj on 26/05/09 20:57
+ return parent != NO_PARENT;
+ }
+
+ /**
+ * Checks if is confirm required previous to do the action.
+ *
+ * @return true, if is confirm required
+ */
+ public boolean isConfirmRequired() {
+ return confirmRequired;
+ }
+
+ /**
+ * Sets the value associated with the specified key.
+ *
+ * Any existing value associated with the key will be overwritten.
+ *
+ * @param key
+ * the key (not <code>null</code>).
+ * @param value
+ * the value (<code>null</code> permitted).
+ */
+ public void putValue(final String key, final Object value) {
+ store.put(key, value);
+ }
+
+ public void setAddCondition(final GuiAddCondition addCondition) {
+ this.addCondition = addCondition;
+ }
+
+ /**
+ * Sets the confirmation text.
+ *
+ * @param confirmationText
+ * the new confirmation text
+ */
+ public void setConfirmationText(final String confirmationText) {
+ this.confirmationText = confirmationText;
+ }
+
+ /**
+ * Sets the confirmation title.
+ *
+ * @param confirmationTitle
+ * the new confirmation title
+ */
+ public void setConfirmationTitle(final String confirmationTitle) {
+ this.confirmationTitle = confirmationTitle;
+ }
+
+ /**
+ * Sets the confirm required.
+ *
+ * @param isConfirmRequired
+ * the new confirm required
+ */
+ public void setConfirmRequired(final boolean isConfirmRequired) {
+ this.confirmRequired = isConfirmRequired;
+ }
+
+ /**
+ * If we have several toolbars, we can group with the "location" string key
+ * actions that must be in the same location (ex: top bar, bottom bar, and
+ * so on).
+ *
+ * @param location
+ * the new location
+ */
+ public void setLocation(final String location) {
+ this.location = location;
+ }
+
+ public void setParent(final AbstractGuiActionDescrip parent) {
+ this.parent = parent;
+ }
+
+ /**
+ * Sets the position (where the UI element will be positioned, for instance
+ * in a toolbar or in a menu).
+ *
+ * @param position
+ * the new position
+ */
+ public void setPosition(final int position) {
+ this.position = position;
+ }
+
+ public void setVisibleCondition(final GuiVisibleCondition visibleCondition) {
+ this.visibleCondition = visibleCondition;
+ }
+
+}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenu.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenu.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenu.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,28 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-import com.gwtext.client.widgets.menu.BaseItem;
-import com.gwtext.client.widgets.menu.Menu;
-
-public abstract class AbstractMenu extends AbstractGuiItem {
-
- protected final transient Menu menu;
-
- public AbstractMenu() {
- super();
- menu = new Menu();
- menu.setShadow(true);
- }
-
- public void add(final BaseItem item) {
- menu.addItem(item);
- }
-
- public void addSeparator() {
- menu.addSeparator();
- }
-
- public void insert(final int position, final BaseItem item) {
- menu.insert(position, item);
- }
-
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuGui.java (from rev 1114, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenu.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenu.java 2009-05-26 16:04:44 UTC (rev 1114)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuGui.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,28 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import com.gwtext.client.widgets.menu.BaseItem;
+import com.gwtext.client.widgets.menu.Menu;
+
+public abstract class AbstractMenuGui extends AbstractGuiItem {
+
+ protected final transient Menu menu;
+
+ public AbstractMenuGui() {
+ super();
+ menu = new Menu();
+ menu.setShadow(true);
+ }
+
+ public void add(final BaseItem item) {
+ menu.addItem(item);
+ }
+
+ public void addSeparator() {
+ menu.addSeparator();
+ }
+
+ public void insert(final int position, final BaseItem item) {
+ menu.insert(position, item);
+ }
+
+}
\ No newline at end of file
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItem.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItem.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItem.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,84 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-import org.ourproject.kune.platf.client.actions.ActionEvent;
-import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources;
-
-import com.google.gwt.libideas.resources.client.ImageResource;
-import com.google.gwt.user.client.ui.Widget;
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.widgets.menu.BaseItem;
-import com.gwtext.client.widgets.menu.CheckItem;
-import com.gwtext.client.widgets.menu.Item;
-import com.gwtext.client.widgets.menu.event.BaseItemListenerAdapter;
-
-public abstract class AbstractMenuItem extends AbstractGuiItem {
-
- private transient Item item;
-
- public AbstractMenuItem(final MenuItemDescriptor descriptor) {
- super();
- if (descriptor instanceof MenuRadioItemDescriptor) {
- final CheckItem checkItem = createCheckItem(descriptor);
- checkItem.setGroup(((MenuRadioItemDescriptor) descriptor).getGroup());
- item = checkItem;
- } else if (descriptor instanceof MenuCheckItemDescriptor) {
- final CheckItem checkItem = createCheckItem(descriptor);
- item = checkItem;
- } else {
- item = new Item();
- }
- // initWidget(item);
- final BaseItemListenerAdapter clickListener = new BaseItemListenerAdapter() {
- @Override
- public void onClick(final BaseItem item, final EventObject event) {
- if (action != null) {
- action.actionPerformed(new ActionEvent(item, event.getBrowserEvent()));
- }
- }
- };
- item.addListener(clickListener);
- setAction(descriptor.action);
- }
-
- @Override
- protected Widget getWidget() {
- return item;
- }
-
- @Override
- protected void setEnabled(final boolean enabled) {
- if (enabled) {
- item.enable();
- } else {
- item.disable();
- }
- }
-
- @Override
- protected void setIcon(final ImageResource imageResource) {
- if (imageResource != null) {
- // FIXME
- item.setIconCls(RTEImgResources.SUFFIX + imageResource.getName());
- }
- }
-
- @Override
- protected void setText(final String text) {
- if (text != null) {
- item.setText(text);
- }
- }
-
- @Override
- protected void setToolTipText(final String text) {
- if (text != null) {
- item.setTitle(text);
- }
- }
-
- private CheckItem createCheckItem(final MenuItemDescriptor descriptor) {
- final CheckItem checkItem = new CheckItem();
- checkItem.setChecked(((MenuCheckItemDescriptor) descriptor).isChecked());
- return checkItem;
- }
-}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItemGui.java (from rev 1114, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItem.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItem.java 2009-05-26 16:04:44 UTC (rev 1114)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItemGui.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,105 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.Action;
+import org.ourproject.kune.platf.client.actions.ActionEvent;
+import org.ourproject.kune.platf.client.actions.KeyStroke;
+import org.ourproject.kune.platf.client.ui.img.ImgConstants;
+
+import com.google.gwt.libideas.resources.client.ImageResource;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.menu.BaseItem;
+import com.gwtext.client.widgets.menu.CheckItem;
+import com.gwtext.client.widgets.menu.Item;
+import com.gwtext.client.widgets.menu.event.BaseItemListenerAdapter;
+
+public abstract class AbstractMenuItemGui extends AbstractGuiItem {
+
+ private transient Item item;
+
+ public AbstractMenuItemGui(final MenuItemDescriptor descriptor) {
+ super();
+ if (descriptor instanceof MenuRadioItemDescriptor) {
+ final CheckItem checkItem = createCheckItem(descriptor);
+ checkItem.setGroup(((MenuRadioItemDescriptor) descriptor).getGroup());
+ item = checkItem;
+ } else if (descriptor instanceof MenuCheckItemDescriptor) {
+ final CheckItem checkItem = createCheckItem(descriptor);
+ item = checkItem;
+ } else {
+ item = new Item();
+ }
+ // initWidget(item);
+ final BaseItemListenerAdapter clickListener = new BaseItemListenerAdapter() {
+ @Override
+ public void onClick(final BaseItem item, final EventObject event) {
+ if (action != null) {
+ action.actionPerformed(new ActionEvent(item, event.getBrowserEvent()));
+ }
+ }
+ };
+ item.addListener(clickListener);
+ setAction(descriptor.action);
+ }
+
+ @Override
+ public void setVisible(final boolean visible) {
+ item.setVisible(visible);
+ }
+
+ @Override
+ protected Widget getWidget() {
+ return item;
+ }
+
+ @Override
+ protected void setEnabled(final boolean enabled) {
+ if (enabled) {
+ item.enable();
+ } else {
+ item.disable();
+ }
+ }
+
+ @Override
+ protected void setIcon(final ImageResource imageResource) {
+ if (imageResource != null) {
+ // FIXME
+ item.setIconCls(ImgConstants.CSS_SUFFIX + imageResource.getName());
+ }
+ }
+
+ @Override
+ protected void setText(final String text) {
+ if (text != null) {
+ final KeyStroke key = (KeyStroke) action.getValue(Action.ACCELERATOR_KEY);
+ if (key == null) {
+ item.setText(text);
+ } else {
+ final FlowPanel fpanel = new FlowPanel();
+ fpanel.setWidth("100%");
+ fpanel.add(new Label(text));
+ final Label keyLabel = new Label(key.toString());
+ keyLabel.addStyleName("kune-floatright");
+ fpanel.add(keyLabel);
+ item.setText(DOM.getInnerHTML(fpanel.getElement()));
+ }
+ }
+ }
+
+ @Override
+ protected void setToolTipText(final String text) {
+ if (text != null) {
+ item.setTitle(text);
+ }
+ }
+
+ private CheckItem createCheckItem(final MenuItemDescriptor descriptor) {
+ final CheckItem checkItem = new CheckItem();
+ checkItem.setChecked(((MenuCheckItemDescriptor) descriptor).isChecked());
+ return checkItem;
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparatorDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparatorDescriptor.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparatorDescriptor.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -3,7 +3,7 @@
import org.ourproject.kune.platf.client.actions.AbstractAction;
import org.ourproject.kune.platf.client.actions.ActionEvent;
-public abstract class AbstractSeparatorDescriptor extends AbstractUIActionDescriptor {
+public abstract class AbstractSeparatorDescriptor extends AbstractGuiActionDescrip {
public AbstractSeparatorDescriptor() {
super(new AbstractAction() {
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIActionDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIActionDescriptor.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIActionDescriptor.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,163 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.actions.AbstractAction;
-
-/**
- * The Class AbstractUIActionDescriptor.
- */
-public class AbstractUIActionDescriptor {
-
- protected static final int NO_POSITION = -1;
- protected static final View NO_VIEW = null;
- protected static final AbstractUIActionDescriptor NO_PARENT = new AbstractUIActionDescriptor(null);
-
- protected transient View view;
- protected AbstractUIActionDescriptor parent;
-
- /** The action. */
- protected transient AbstractAction action;
-
- /** The position where the item will be inserted. */
- private int position;
-
- /** If the action must be confirmed. */
- private boolean confirmRequired;
-
- /** The confirmation dialog title. */
- private String confirmationTitle;
-
- /** The confirmation dialog text. */
- private String confirmationText;
-
- /** The item location. */
- private String location;
-
- /**
- * Instantiates a new abstract ui action descriptor. This is used for
- * describe UI button, menus, menu items and so on
- *
- * @param action
- * the action
- */
- public AbstractUIActionDescriptor(final AbstractAction action) {
- this.action = action;
- position = NO_POSITION;
- parent = NO_PARENT;
- }
-
- /**
- * Gets the dialog confirmation text.
- *
- * @return the confirmation text
- */
- public String getConfirmationText() {
- return confirmationText;
- }
-
- /**
- * Gets the dialog confirmation title.
- *
- * @return the confirmation title
- */
- public String getConfirmationTitle() {
- return confirmationTitle;
- }
-
- /**
- * Gets the location, a string used to group actions with locations (top
- * bar, bottom bar, user bar...).
- *
- * @return the location
- */
- public String getLocation() {
- return location;
- }
-
- public AbstractUIActionDescriptor getParent() {
- return parent;
- }
-
- /**
- * Gets the position.
- *
- * @return the position
- */
- public int getPosition() {
- return position;
- }
-
- public View getView() {
- return view;
- }
-
- public boolean isChild() {
- return !parent.equals(NO_PARENT);
- }
-
- /**
- * Checks if is confirm required previous to do the action.
- *
- * @return true, if is confirm required
- */
- public boolean isConfirmRequired() {
- return confirmRequired;
- }
-
- /**
- * Sets the confirmation text.
- *
- * @param confirmationText
- * the new confirmation text
- */
- public void setConfirmationText(final String confirmationText) {
- this.confirmationText = confirmationText;
- }
-
- /**
- * Sets the confirmation title.
- *
- * @param confirmationTitle
- * the new confirmation title
- */
- public void setConfirmationTitle(final String confirmationTitle) {
- this.confirmationTitle = confirmationTitle;
- }
-
- /**
- * Sets the confirm required.
- *
- * @param isConfirmRequired
- * the new confirm required
- */
- public void setConfirmRequired(final boolean isConfirmRequired) {
- this.confirmRequired = isConfirmRequired;
- }
-
- /**
- * If we have several toolbars, we can group with the "location" string key
- * actions that must be in the same location (ex: top bar, bottom bar, and
- * so on).
- *
- * @param location
- * the new location
- */
- public void setLocation(final String location) {
- this.location = location;
- }
-
- public void setParent(final AbstractUIActionDescriptor parent) {
- this.parent = parent;
- }
-
- /**
- * Sets the position (where the UI element will be positioned, for instance
- * in a toolbar or in a menu).
- *
- * @param position
- * the new position
- */
- public void setPosition(final int position) {
- this.position = position;
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIElement.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIElement.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIElement.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,42 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-import java.util.List;
-
-import org.ourproject.kune.platf.client.actions.Action;
-import org.ourproject.kune.platf.client.actions.InputMap;
-import org.ourproject.kune.platf.client.actions.KeyStroke;
-
-import com.google.gwt.user.client.ui.Composite;
-
-public abstract class AbstractUIElement extends Composite {
-
- private transient GuiActionCollection guiItems;
- private transient InputMap inputMap;
-
- public void add(final AbstractUIActionDescriptor descriptor) {
- getGuiItems().add(descriptor);
- }
-
- public void addAction(final KeyStroke key, final Action action) {
- getInputMap().put(key, action);
- }
-
- public void addAll(final List<AbstractUIActionDescriptor> moreDescriptor) {
- getGuiItems().addAll(moreDescriptor);
- }
-
- public GuiActionCollection getGuiItems() {
- if (guiItems == null) {
- guiItems = new GuiActionCollection();
- }
- return guiItems;
- }
-
- private InputMap getInputMap() {
- if (inputMap == null) {
- inputMap = new InputMap();
- }
- return inputMap;
- }
-
-}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BasicGuiBinding.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BasicGuiBinding.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BasicGuiBinding.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,15 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class BasicGuiBinding {
+
+ public BasicGuiBinding(final GuiBindingsRegister bindings) {
+ bindings.register(MenuDescriptor.class, new MenuBinding());
+ final MenuItemBinding menuItemBinding = new MenuItemBinding();
+ bindings.register(MenuRadioItemDescriptor.class, menuItemBinding);
+ bindings.register(MenuCheckItemDescriptor.class, menuItemBinding);
+ bindings.register(MenuItemDescriptor.class, menuItemBinding);
+ bindings.register(MenuSeparatorDescriptor.class, new MenuSeparatorBinding());
+ bindings.register(ButtonDescriptor.class, new ButtonBinding());
+ bindings.register(PushButtonDescriptor.class, new PushButtonBinding());
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ButtonBinding.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ButtonBinding.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ButtonBinding.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,10 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class ButtonBinding extends GuiBindingAdapter {
+
+ @Override
+ public AbstractGuiItem create(final AbstractGuiActionDescrip descriptor) {
+ return new ButtonGui((ButtonDescriptor) descriptor);
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ButtonDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ButtonDescriptor.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ButtonDescriptor.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,20 +1,15 @@
package org.ourproject.kune.platf.client.actions.ui;
-import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.actions.AbstractAction;
-public class ButtonDescriptor extends AbstractUIActionDescriptor {
+public class ButtonDescriptor extends AbstractGuiActionDescrip {
public ButtonDescriptor(final AbstractAction action) {
super(action);
}
@Override
- public View getView() {
- if (view == null) {
- final DefaultButton defaultButton = new DefaultButton(this);
- view = defaultButton;
- }
- return view;
+ public Class<?> getType() {
+ return ButtonDescriptor.class;
}
}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ButtonGui.java (from rev 1114, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultButton.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultButton.java 2009-05-26 16:04:44 UTC (rev 1114)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ButtonGui.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,12 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class ButtonGui extends AbstractButtonGui {
+
+ public ButtonGui(final ButtonDescriptor buttonDescriptor) {
+ super(buttonDescriptor);
+ }
+
+ public ButtonGui(final ButtonDescriptor buttonDescriptor, final boolean enableTongle) {
+ super(buttonDescriptor, enableTongle);
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ComplexToolbar.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ComplexToolbar.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ComplexToolbar.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -2,38 +2,51 @@
import java.util.List;
-import org.ourproject.kune.workspace.client.skel.Toolbar;
+import org.ourproject.kune.platf.client.ui.SimpleToolbar;
-import com.google.gwt.user.client.ui.Widget;
+public class ComplexToolbar extends AbstractComplexGuiItem {
-public class ComplexToolbar extends AbstractUIElement {
+ private final transient SimpleToolbar toolbar;
+ private final transient GuiBindingsRegister bindings;
- private final transient Toolbar toolbar;
-
- public ComplexToolbar() {
+ public ComplexToolbar(final GuiBindingsRegister bindings) {
super();
- toolbar = new Toolbar();
- initWidget(toolbar.getPanel());
+ this.bindings = bindings;
+ toolbar = new SimpleToolbar();
+ initWidget(toolbar);
}
@Override
- public void add(final AbstractUIActionDescriptor descrip) {
- super.add(descrip);
- addWidget(descrip);
+ public void add(final AbstractGuiActionDescrip... descriptors) {
+ for (final AbstractGuiActionDescrip descrip : descriptors) {
+ super.add(descrip);
+ addWidget(descrip);
+ }
}
@Override
- public void addAll(final List<AbstractUIActionDescriptor> moreItems) {
- super.addAll(moreItems);
- for (AbstractUIActionDescriptor item : moreItems) {
- addWidget(item);
+ public void addAll(final List<AbstractGuiActionDescrip> descriptors) {
+ super.addAll(descriptors);
+ for (final AbstractGuiActionDescrip descritor : descriptors) {
+ addWidget(descritor);
}
}
- private void addWidget(final AbstractUIActionDescriptor descrip) {
- final Widget view = (Widget) descrip.getView();
- if (!descrip.isChild()) {
- toolbar.add(view);
+ private void addWidget(final AbstractGuiActionDescrip descrip) {
+ if (descrip.getAddCondition().mustBeAdded()) {
+ final boolean visible = descrip.getVisibleCondition().mustBeVisible();
+ final GuiBinding binding = bindings.get(descrip.getType());
+ final AbstractGuiItem item = binding.create(descrip);
+ if (binding.isAttachable()) {
+ final int position = descrip.getPosition();
+ if (position == AbstractGuiActionDescrip.NO_POSITION) {
+ toolbar.add(item);
+ } else {
+ toolbar.insert(item, position);
+ }
+ item.setVisible(visible);
+ }
}
}
+
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultButton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultButton.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultButton.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,12 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-public class DefaultButton extends AbstractButton {
-
- public DefaultButton(final ButtonDescriptor buttonDescriptor) {
- super(buttonDescriptor);
- }
-
- public DefaultButton(final ButtonDescriptor buttonDescriptor, final boolean enableTongle) {
- super(buttonDescriptor, enableTongle);
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenu.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenu.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenu.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,63 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources;
-
-import com.google.gwt.libideas.resources.client.ImageResource;
-import com.gwtext.client.widgets.ToolbarButton;
-
-public class DefaultMenu extends AbstractMenu {
-
- // @PMD:REVIEWED:AtLeastOneConstructor: by vjrj on 26/05/09 15:56
- public class MenuButton extends ToolbarButton implements View {
- }
-
- private transient final MenuButton button;
-
- public DefaultMenu(final AbstractUIActionDescriptor descriptor) {
- super();
- button = new MenuButton();
- button.setMenu(menu);
- setAction(descriptor.action);
- initWidget(menu);
- }
-
- public void add(final DefaultSubMenu submenu) {
- menu.addItem(submenu.getMenuItem());
- };
-
- public MenuButton getButton() {
- return button;
- }
-
- public void insert(final int position, final DefaultSubMenu submenu) {
- menu.insert(position, submenu.getMenuItem());
- }
-
- @Override
- public void setEnabled(final boolean enabled) {
- if (enabled) {
- button.enable();
- } else {
- button.disable();
- }
- }
-
- @Override
- public void setIcon(final ImageResource imageResource) {
- if (imageResource != null) {
- // FIXME
- button.setIconCls(RTEImgResources.SUFFIX + imageResource.getName());
- }
- }
-
- @Override
- public void setText(final String text) {
- button.setText(text);
- }
-
- @Override
- public void setToolTipText(final String tooltip) {
- button.setTooltip(tooltip);
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenuCheckItem.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenuCheckItem.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenuCheckItem.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,9 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-public class DefaultMenuCheckItem extends AbstractMenuItem {
-
- public DefaultMenuCheckItem(final MenuCheckItemDescriptor descriptor) {
- super(descriptor);
- }
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenuItem.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenuItem.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenuItem.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,9 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-public class DefaultMenuItem extends AbstractMenuItem {
-
- public DefaultMenuItem(final MenuItemDescriptor descriptor) {
- super(descriptor);
- }
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultSubMenu.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultSubMenu.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultSubMenu.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,50 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources;
-
-import com.google.gwt.libideas.resources.client.ImageResource;
-import com.gwtext.client.widgets.menu.MenuItem;
-
-public class DefaultSubMenu extends AbstractMenu {
-
- private transient final MenuItem item;
-
- public DefaultSubMenu(final AbstractUIActionDescriptor descriptor) {
- super();
- item = new MenuItem();
- item.setMenu(menu);
- initWidget(menu);
- setAction(descriptor.action);
- }
-
- public MenuItem getMenuItem() {
- return item;
- }
-
- @Override
- public void setEnabled(final boolean enabled) {
- if (enabled) {
- item.enable();
- } else {
- item.disable();
- }
- }
-
- @Override
- public void setIcon(final ImageResource imageResource) {
- if (imageResource != null) {
- // FIXME
- item.setIconCls(RTEImgResources.SUFFIX + imageResource.getName());
- }
- }
-
- @Override
- public void setText(final String text) {
- item.setText(text);
- }
-
- @Override
- public void setToolTipText(final String tooltip) {
- item.setTitle(tooltip);
- }
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiActionCollection.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiActionCollection.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiActionCollection.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -3,8 +3,14 @@
import java.util.ArrayList;
// @PMD:REVIEWED:AtLeastOneConstructor: by vjrj on 26/05/09 12:31
-public class GuiActionCollection extends ArrayList<AbstractUIActionDescriptor> {
+public class GuiActionCollection extends ArrayList<AbstractGuiActionDescrip> {
private static final long serialVersionUID = 6759723760404227737L;
+ public void add(final AbstractGuiActionDescrip... descriptors) {
+ for (AbstractGuiActionDescrip descriptor : descriptors) {
+ super.add(descriptor);
+ }
+ }
+
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiAddCondition.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiAddCondition.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiAddCondition.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,7 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public interface GuiAddCondition {
+
+ boolean mustBeAdded();
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiAddConditionAdapter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiAddConditionAdapter.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiAddConditionAdapter.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,7 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class GuiAddConditionAdapter implements GuiAddCondition {
+ public boolean mustBeAdded() {
+ return true;
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiBinding.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiBinding.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiBinding.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,9 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public interface GuiBinding {
+
+ AbstractGuiItem create(AbstractGuiActionDescrip descriptor);
+
+ boolean isAttachable();
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiBindingAdapter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiBindingAdapter.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiBindingAdapter.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,13 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class GuiBindingAdapter implements GuiBinding {
+
+ public AbstractGuiItem create(final AbstractGuiActionDescrip descriptor) {
+ return null;
+ }
+
+ public boolean isAttachable() {
+ return true;
+ }
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiBindingsRegister.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiBindingsRegister.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiBindingsRegister.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,21 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class GuiBindingsRegister {
+
+ private transient final Map<Class<?>, GuiBinding> map;
+
+ public GuiBindingsRegister() {
+ map = new HashMap<Class<?>, GuiBinding>();
+ }
+
+ public <T> GuiBinding get(final Class<T> classType) {
+ return map.get(classType);
+ }
+
+ public <T> void register(final Class<T> classType, final GuiBinding binding) {
+ map.put(classType, binding);
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiVisibleCondition.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiVisibleCondition.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiVisibleCondition.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,7 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public interface GuiVisibleCondition {
+
+ boolean mustBeVisible();
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiVisibleConditionAdapter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiVisibleConditionAdapter.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiVisibleConditionAdapter.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,9 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class GuiVisibleConditionAdapter implements GuiVisibleCondition {
+
+ public boolean mustBeVisible() {
+ return true;
+ }
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuBinding.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuBinding.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuBinding.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,44 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.errors.UIException;
+
+public class MenuBinding extends GuiBindingAdapter {
+
+ public static final String UI_MENU = "UI_MENU";
+
+ private transient Boolean isSubmenu;
+
+ @Override
+ public AbstractGuiItem create(final AbstractGuiActionDescrip descriptor) {
+ AbstractGuiItem item;
+ if (descriptor.isChild()) {
+ final SubMenuGui submenu = new SubMenuGui(descriptor);
+ final AbstractMenuGui parentMenu = ((AbstractMenuGui) descriptor.getParent().getValue(UI_MENU));
+ final int position = descriptor.getPosition();
+ if (position == AbstractGuiActionDescrip.NO_POSITION) {
+ parentMenu.add(submenu.getMenuItem());
+ } else {
+ parentMenu.insert(position, submenu.getMenuItem());
+ }
+ descriptor.putValue(UI_MENU, submenu);
+ item = submenu;
+ isSubmenu = true;
+ } else {
+ // Is main parent menu
+ final MenuGui menu = new MenuGui(descriptor);
+ descriptor.putValue(UI_MENU, menu);
+ item = menu;
+ isSubmenu = false;
+ }
+ return item;
+ }
+
+ @Override
+ public boolean isAttachable() {
+ if (isSubmenu == null) {
+ throw new UIException("Please create element before to check if is attachable");
+ }
+ return !isSubmenu;
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuCheckItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuCheckItemDescriptor.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuCheckItemDescriptor.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -11,6 +11,11 @@
super(parent, action);
}
+ @Override
+ public Class<?> getType() {
+ return MenuCheckItemDescriptor.class;
+ }
+
public boolean isChecked() {
return checked;
}
@@ -21,5 +26,4 @@
action.putValue(CHECKED, this.checked);
}
}
-
}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuCheckItemGui.java (from rev 1113, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenuCheckItem.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenuCheckItem.java 2009-05-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuCheckItemGui.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,9 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class MenuCheckItemGui extends AbstractMenuItemGui {
+
+ public MenuCheckItemGui(final MenuCheckItemDescriptor descriptor) {
+ super(descriptor);
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,56 +1,40 @@
package org.ourproject.kune.platf.client.actions.ui;
-import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.actions.AbstractAction;
+import org.ourproject.kune.platf.client.actions.Action;
import com.google.gwt.libideas.resources.client.ImageResource;
-public class MenuDescriptor extends AbstractUIActionDescriptor {
+public class MenuDescriptor extends AbstractGuiActionDescrip {
- private transient AbstractMenu menu;
-
public MenuDescriptor(final AbstractAction action) {
this(NO_PARENT, action);
}
- public MenuDescriptor(final AbstractUIActionDescriptor parent, final AbstractAction action) {
+ public MenuDescriptor(final AbstractGuiActionDescrip parent, final AbstractAction action) {
super(action);
setParent(parent);
}
- public MenuDescriptor(final String text, final String tooltip, final ImageResource icon) {
- this(new BaseAction(text, tooltip, icon));
+ public MenuDescriptor(final String text) {
+ this(new BaseAction(text, null, null));
}
- public AbstractMenu getMenu() {
- createIfNeeded();
- return menu;
+ public MenuDescriptor(final String text, final ImageResource icon) {
+ this(new BaseAction(text, null, icon));
}
+ public MenuDescriptor(final String text, final String tooltip, final ImageResource icon) {
+ this(new BaseAction(text, tooltip, icon));
+ }
+
@Override
- public View getView() {
- createIfNeeded();
- return view;
+ public Class<?> getType() {
+ return MenuDescriptor.class;
}
- private void createIfNeeded() {
- if (view == NO_VIEW) {
- if (isChild()) {
- final DefaultSubMenu submenu = new DefaultSubMenu(this);
- final AbstractMenu parentMenu = ((MenuDescriptor) parent).getMenu();
- final int position = getPosition();
- if (position == NO_POSITION) {
- parentMenu.add(submenu.getMenuItem());
- } else {
- parentMenu.insert(position, submenu.getMenuItem());
- }
- view = menu = submenu;
- } else {
- // Is main parent menu
- final DefaultMenu newMenu = new DefaultMenu(this);
- menu = newMenu;
- view = newMenu.getButton();
- }
- }
+ public void setText(final String text) {
+ action.putValue(Action.NAME, text);
}
+
}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuGui.java (from rev 1114, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenu.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenu.java 2009-05-26 16:04:44 UTC (rev 1114)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuGui.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,53 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.ui.img.ImgConstants;
+
+import com.google.gwt.libideas.resources.client.ImageResource;
+import com.gwtext.client.widgets.ToolbarButton;
+
+public class MenuGui extends AbstractMenuGui {
+
+ private transient final ToolbarButton button;
+
+ public MenuGui(final AbstractGuiActionDescrip descriptor) {
+ super();
+ button = new ToolbarButton();
+ button.setMenu(menu);
+ setAction(descriptor.action);
+ initWidget(button);
+ }
+
+ public void add(final SubMenuGui submenu) {
+ menu.addItem(submenu.getMenuItem());
+ };
+
+ public void insert(final int position, final SubMenuGui submenu) {
+ menu.insert(position, submenu.getMenuItem());
+ }
+
+ @Override
+ public void setEnabled(final boolean enabled) {
+ if (enabled) {
+ button.enable();
+ } else {
+ button.disable();
+ }
+ }
+
+ @Override
+ public void setIcon(final ImageResource imageResource) {
+ if (imageResource != null) {
+ button.setIcon(ImgConstants.PATH_PREFIX + imageResource.getName());
+ }
+ }
+
+ @Override
+ public void setText(final String text) {
+ button.setText(text);
+ }
+
+ @Override
+ public void setToolTipText(final String tooltip) {
+ button.setTooltip(tooltip);
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemBinding.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemBinding.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemBinding.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,25 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import com.gwtext.client.widgets.menu.Item;
+
+public class MenuItemBinding extends GuiBindingAdapter {
+
+ @Override
+ public AbstractGuiItem create(final AbstractGuiActionDescrip descriptor) {
+ final MenuItemGui item = new MenuItemGui((MenuItemDescriptor) descriptor);
+ final int position = descriptor.getPosition();
+ final Item menuItem = (Item) item.getWidget();
+ final AbstractMenuGui menu = ((AbstractMenuGui) descriptor.getParent().getValue(MenuBinding.UI_MENU));
+ if (position == AbstractGuiActionDescrip.NO_POSITION) {
+ menu.add(menuItem);
+ } else {
+ menu.insert(position, menuItem);
+ }
+ return item;
+ }
+
+ @Override
+ public boolean isAttachable() {
+ return false;
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemDescriptor.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemDescriptor.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,32 +1,16 @@
package org.ourproject.kune.platf.client.actions.ui;
-import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.actions.AbstractAction;
-import com.gwtext.client.widgets.menu.Item;
+public class MenuItemDescriptor extends AbstractGuiActionDescrip {
-public class MenuItemDescriptor extends AbstractUIActionDescriptor {
-
public MenuItemDescriptor(final MenuDescriptor parent, final AbstractAction action) {
super(action);
setParent(parent);
}
@Override
- public View getView() {
- if (view == NO_VIEW) {
- final DefaultMenuItem item = new DefaultMenuItem(this);
- final int position = getPosition();
- final Item menuItem = (Item) item.getWidget();
- final AbstractMenu menu = ((MenuDescriptor) parent).getMenu();
- if (position == NO_POSITION) {
- menu.add(menuItem);
- } else {
- menu.insert(position, menuItem);
- }
- view = item;
- }
- return view;
+ public Class<?> getType() {
+ return MenuItemDescriptor.class;
}
-
}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemGui.java (from rev 1113, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenuItem.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenuItem.java 2009-05-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemGui.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,9 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class MenuItemGui extends AbstractMenuItemGui {
+
+ public MenuItemGui(final MenuItemDescriptor descriptor) {
+ super(descriptor);
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioItemDescriptor.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioItemDescriptor.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -14,4 +14,9 @@
public String getGroup() {
return group;
}
+
+ @Override
+ public Class<?> getType() {
+ return MenuRadioItemDescriptor.class;
+ }
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparatorBinding.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparatorBinding.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparatorBinding.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,16 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class MenuSeparatorBinding extends GuiBindingAdapter {
+
+ @Override
+ public AbstractGuiItem create(final AbstractGuiActionDescrip descriptor) {
+ final AbstractMenuGui menu = ((AbstractMenuGui) descriptor.getParent().getValue(MenuBinding.UI_MENU));
+ menu.addSeparator();
+ return menu;
+ }
+
+ @Override
+ public boolean isAttachable() {
+ return false;
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparatorDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparatorDescriptor.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparatorDescriptor.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,7 +1,5 @@
package org.ourproject.kune.platf.client.actions.ui;
-import org.ourproject.kune.platf.client.View;
-
public class MenuSeparatorDescriptor extends AbstractSeparatorDescriptor {
public MenuSeparatorDescriptor(final MenuDescriptor parent) {
@@ -10,12 +8,7 @@
}
@Override
- public View getView() {
- if (view == NO_VIEW) {
- final AbstractMenu menu = ((MenuDescriptor) getParent()).getMenu();
- menu.addSeparator();
- view = menu;
- }
- return view;
+ public Class<?> getType() {
+ return MenuSeparatorDescriptor.class;
}
}
\ No newline at end of file
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButton.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButton.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,20 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-import org.ourproject.kune.platf.client.actions.PropertyChangeEvent;
-import org.ourproject.kune.platf.client.actions.PropertyChangeListener;
-
-public class PushButton extends DefaultButton {
-
- public PushButton(final PushButtonDescriptor btn) {
- super(btn, true);
- setPressed(btn.isPushed());
- action.addPropertyChangeListener(new PropertyChangeListener() {
- public void propertyChange(final PropertyChangeEvent event) {
- if (event.getPropertyName().equals(PushButtonDescriptor.PUSHED)) {
- setPressed(btn.isPushed());
- }
- }
- });
- }
-
-}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButtonBinding.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButtonBinding.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButtonBinding.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,10 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class PushButtonBinding extends GuiBindingAdapter {
+
+ @Override
+ public AbstractGuiItem create(final AbstractGuiActionDescrip descriptor) {
+ return new ButtonGui((ButtonDescriptor) descriptor, true);
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButtonDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButtonDescriptor.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButtonDescriptor.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,6 +1,5 @@
package org.ourproject.kune.platf.client.actions.ui;
-import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.actions.AbstractAction;
public class PushButtonDescriptor extends ButtonDescriptor {
@@ -19,12 +18,8 @@
}
@Override
- public View getView() {
- if (view == null) {
- final PushButton button = new PushButton(this);
- view = button;
- }
- return view;
+ public Class<?> getType() {
+ return PushButtonDescriptor.class;
}
public boolean isPushed() {
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButtonGui.java (from rev 1114, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButton.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButton.java 2009-05-26 16:04:44 UTC (rev 1114)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButtonGui.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,19 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.PropertyChangeEvent;
+import org.ourproject.kune.platf.client.actions.PropertyChangeListener;
+
+public class PushButtonGui extends ButtonGui {
+
+ public PushButtonGui(final PushButtonDescriptor btn) {
+ super(btn, true);
+ setPressed(btn.isPushed());
+ action.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(final PropertyChangeEvent event) {
+ if (event.getPropertyName().equals(PushButtonDescriptor.PUSHED)) {
+ setPressed(btn.isPushed());
+ }
+ }
+ });
+ }
+}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/SubMenuGui.java (from rev 1114, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultSubMenu.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultSubMenu.java 2009-05-26 16:04:44 UTC (rev 1114)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/SubMenuGui.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,49 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.ui.img.ImgConstants;
+
+import com.google.gwt.libideas.resources.client.ImageResource;
+import com.gwtext.client.widgets.menu.MenuItem;
+
+public class SubMenuGui extends AbstractMenuGui {
+
+ private transient final MenuItem item;
+
+ public SubMenuGui(final AbstractGuiActionDescrip descriptor) {
+ super();
+ item = new MenuItem();
+ item.setMenu(menu);
+ setAction(descriptor.action);
+ // initWidget(item);
+ }
+
+ public MenuItem getMenuItem() {
+ return item;
+ }
+
+ @Override
+ public void setEnabled(final boolean enabled) {
+ if (enabled) {
+ item.enable();
+ } else {
+ item.disable();
+ }
+ }
+
+ @Override
+ public void setIcon(final ImageResource imageResource) {
+ if (imageResource != null) {
+ item.setIconCls(ImgConstants.CSS_SUFFIX + imageResource.getName());
+ }
+ }
+
+ @Override
+ public void setText(final String text) {
+ item.setText(text);
+ }
+
+ @Override
+ public void setToolTipText(final String tooltip) {
+ item.setTitle(tooltip);
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,19 +1,34 @@
package org.ourproject.kune.platf.client.actions.ui;
import org.ourproject.kune.platf.client.actions.AbstractAction;
-import org.ourproject.kune.platf.client.actions.Action;
import org.ourproject.kune.platf.client.actions.ActionEvent;
+import org.ourproject.kune.platf.client.ui.img.ImgResources;
import org.ourproject.kune.platf.client.ui.noti.NotifyUser;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+import com.google.gwt.libideas.resources.client.ImageResource;
import com.google.gwt.user.client.Timer;
public class TestButton {
- public class NotiAction extends AbstractAction {
- public NotiAction() {
+ static class Action extends AbstractAction {
+ public Action(final ImageResource icon) {
super();
+ super.putValue(Action.NAME, "FIXME");
+ super.putValue(Action.SHORT_DESCRIPTION, "FIXME");
+ super.putValue(Action.SMALL_ICON, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ // FIXME
+ }
+ }
+
+ static class NotiAction extends AbstractAction {
+ public NotiAction(final ImgResources img) {
+ super();
super.putValue(Action.NAME, "test");
super.putValue(Action.SHORT_DESCRIPTION, "test button");
+ super.putValue(Action.SMALL_ICON, img.info());
}
public void actionPerformed(final ActionEvent actionEvent) {
@@ -24,12 +39,13 @@
}
}
- public TestButton(final WorkspaceSkeleton wksp) {
- final NotiAction noti = new NotiAction();
+ public TestButton(final WorkspaceSkeleton wksp, final GuiBindingsRegister bindings, final ImgResources img) {
+ final NotiAction noti = new NotiAction(img);
final PushButtonDescriptor btn = new PushButtonDescriptor(noti);
final MenuDescriptor menu = new MenuDescriptor("File", "File menu tooltip", null);
+
final MenuItemDescriptor item = new MenuItemDescriptor(menu, noti);
final MenuItemDescriptor item2 = new MenuItemDescriptor(menu, noti);
final MenuDescriptor submenu = new MenuDescriptor("Options", "submenu tooltip", null);
@@ -40,13 +56,13 @@
final MenuRadioItemDescriptor item5 = new MenuRadioItemDescriptor(submenu, noti, "new");
final MenuRadioItemDescriptor item6 = new MenuRadioItemDescriptor(submenu, noti, "new");
item5.setChecked(true);
- final ComplexToolbar toolbar = new ComplexToolbar();
+ final ComplexToolbar toolbar = new ComplexToolbar(bindings);
- toolbar.add(btn);
- toolbar.add(menu);
+ toolbar.add(btn, menu);
toolbar.add(item);
toolbar.add(new MenuSeparatorDescriptor(menu));
toolbar.add(item2);
+ toolbar.add(submenu);
toolbar.add(item3);
toolbar.add(item4);
toolbar.add(new MenuSeparatorDescriptor(submenu));
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ToolbarSeparatorDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ToolbarSeparatorDescriptor.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ToolbarSeparatorDescriptor.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,6 +1,5 @@
package org.ourproject.kune.platf.client.actions.ui;
-import org.ourproject.kune.platf.client.View;
public class ToolbarSeparatorDescriptor extends AbstractSeparatorDescriptor {
@@ -16,13 +15,13 @@
this.type = type;
}
- public Type getType() {
+ public Type getSeparatorType() {
return type;
}
@Override
- public View getView() {
- return null;
+ public Class<?> getType() {
+ return ToolbarSeparatorDescriptor.class;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRightsDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRightsDTO.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRightsDTO.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -45,7 +45,10 @@
if (obj == null) {
return false;
}
- final AccessRightsDTO other = (AccessRightsDTO) obj;
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ AccessRightsDTO other = (AccessRightsDTO) obj;
if (administrable != other.administrable) {
return false;
}
@@ -60,10 +63,11 @@
@Override
public int hashCode() {
+ final int prime = 31;
int result = 1;
- result = PRIME * result + (administrable ? 1231 : 1237);
- result = PRIME * result + (editable ? 1231 : 1237);
- result = PRIME * result + (visible ? 1231 : 1237);
+ result = prime * result + (administrable ? 1231 : 1237);
+ result = prime * result + (editable ? 1231 : 1237);
+ result = prime * result + (visible ? 1231 : 1237);
return result;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/CommentDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/CommentDTO.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/CommentDTO.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -44,6 +44,9 @@
if (obj == null) {
return false;
}
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
final CommentDTO other = (CommentDTO) obj;
if (author == null) {
if (other.author != null) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -53,6 +53,9 @@
if (obj == null) {
return false;
}
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
final GroupDTO other = (GroupDTO) obj;
if (shortName == null) {
if (other.shortName != null) {
@@ -131,7 +134,7 @@
return groupType.equals(GroupType.PERSONAL);
}
- public void setAdmissionType(AdmissionTypeDTO admissionType) {
+ public void setAdmissionType(final AdmissionTypeDTO admissionType) {
this.admissionType = admissionType;
}
@@ -151,7 +154,7 @@
this.groupType = groupType;
}
- public void setHasLogo(boolean hasLogo) {
+ public void setHasLogo(final boolean hasLogo) {
this.hasLogo = hasLogo;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -109,6 +109,9 @@
if (obj == null) {
return false;
}
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
final StateToken other = (StateToken) obj;
if (getEncoded() == null) {
if (other.getEncoded() != null) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/TagCountDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/TagCountDTO.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/TagCountDTO.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -23,6 +23,7 @@
public class TagCountDTO implements IsSerializable {
private String name;
+ // FIXME: try to use Integer
private Long count;
public TagCountDTO() {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserSimpleDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserSimpleDTO.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserSimpleDTO.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -52,6 +52,9 @@
if (obj == null) {
return false;
}
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
final UserSimpleDTO other = (UserSimpleDTO) obj;
if (id == null) {
if (other.id != null) {
@@ -106,8 +109,8 @@
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + (id == null ? 0 : id.hashCode());
- result = prime * result + (shortName == null ? 0 : shortName.hashCode());
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((shortName == null) ? 0 : shortName.hashCode());
return result;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/i18n/Resources.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/i18n/Resources.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/i18n/Resources.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -4,7 +4,7 @@
public static I18nTranslationService i18n;
- public Resources(I18nTranslationService i18n) {
+ public Resources(final I18nTranslationService i18n) {
Resources.i18n = i18n;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -21,6 +21,8 @@
import org.ourproject.kune.platf.client.actions.ActionManager;
import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbarPanel;
+import org.ourproject.kune.platf.client.actions.ui.BasicGuiBinding;
+import org.ourproject.kune.platf.client.actions.ui.GuiBindingsRegister;
import org.ourproject.kune.platf.client.actions.ui.TestButton;
import org.ourproject.kune.platf.client.app.Application;
import org.ourproject.kune.platf.client.app.ApplicationComponentGroup;
@@ -46,6 +48,7 @@
import org.ourproject.kune.platf.client.state.StateManagerDefault;
import org.ourproject.kune.platf.client.ui.QuickTipsHelper;
import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
+import org.ourproject.kune.platf.client.ui.img.ImgResources;
import org.ourproject.kune.platf.client.ui.noti.NotifyUser;
import org.ourproject.kune.platf.client.ui.palette.ColorWebSafePalette;
import org.ourproject.kune.platf.client.ui.palette.ColorWebSafePalettePanel;
@@ -371,6 +374,15 @@
}
});
+ register(Singleton.class, new Factory<ImgResources>(ImgResources.class) {
+ @Override
+ public ImgResources create() {
+ final ImgResources instance = GWT.create(ImgResources.class);
+ StyleInjector.injectStylesheet(instance.css().getText());
+ return instance;
+ }
+ });
+
register(Singleton.class, new Factory<RTEImgResources>(RTEImgResources.class) {
@Override
public RTEImgResources create() {
@@ -521,16 +533,35 @@
return new ExternalMediaRegistry($(Session.class).getInitData().getExtMediaDescrips());
}});
+ register(Singleton.class, new Factory<BasicGuiBinding>(BasicGuiBinding.class) {
+ @Override
+ public BasicGuiBinding create() {
+ return new BasicGuiBinding($(GuiBindingsRegister.class));
+ }
+ });
+
+ register(Singleton.class, new Factory<GuiBindingsRegister>(GuiBindingsRegister.class) {
+ @Override
+ public GuiBindingsRegister create() {
+ return new GuiBindingsRegister();
+ }
+ @Override
+ public void onAfterCreated(final GuiBindingsRegister instance) {
+ $(BasicGuiBinding.class);
+ }
+ });
+
register(Singleton.class, new Factory<TestButton>(TestButton.class) {
@Override
public TestButton create() {
- final TestButton btn = new TestButton($(WorkspaceSkeleton.class));
+ final TestButton btn = new TestButton($(WorkspaceSkeleton.class), $(GuiBindingsRegister.class), $(ImgResources.class));
return btn;
}
});
- // $(TestButton.class);
+ $(TestButton.class);
+
$(ApplicationComponentGroup.class).createAll();
$(ToolGroup.class).createAll();
$(Application.class).start();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/SearcherConstants.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/SearcherConstants.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/SearcherConstants.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,21 +1,23 @@
package org.ourproject.kune.platf.client.services;
-public interface SearcherConstants {
+public final class SearcherConstants {
- String START_PARAM = "start";
- String LIMIT_PARAM = "limit";
- String QUERY_PARAM = "query";
- String MIMETYPE_PARAM = "mimetype";
- String MIMETYPE2_PARAM = "mimetype2";
- String GROUP_PARAM = "group";
+ public final static String START_PARAM = "start";
+ public final static String LIMIT_PARAM = "limit";
+ public final static String QUERY_PARAM = "query";
+ public final static String MIMETYPE_PARAM = "mimetype";
+ public final static String MIMETYPE2_PARAM = "mimetype2";
+ public final static String GROUP_PARAM = "group";
- String GROUP_DATA_PROXY_URL = "/ws/json/GroupJSONService/search";
- String USER_DATA_PROXY_URL = "/ws/json/UserJSONService/search";
- String CONTENT_DATA_PROXY_URL = "/ws/json/ContentJSONService/search";
- String I18N_JSON_SERVICE = "/ws/json/I18nTranslationJSONService/search";
- String I18N_JSON_SERVICE_TRANSLATED = "/ws/json/I18nTranslationJSONService/searchtranslated";
+ public final static String GROUP_DATA_PROXY_URL = "/ws/json/GroupJSONService/search";
+ public final static String USER_DATA_PROXY_URL = "/ws/json/UserJSONService/search";
+ public final static String CONTENT_DATA_PROXY_URL = "/ws/json/ContentJSONService/search";
+ public final static String I18N_JSON_SERVICE = "/ws/json/I18nTranslationJSONService/search";
+ public final static String I18N_JSON_SERVICE_TRANSLATED = "/ws/json/I18nTranslationJSONService/searchtranslated";
- String CONTENT_TEMPLATE_TEXT_PREFIX = "<div class=\"search-item\"><span class=\"kune-IconHyperlink\"><img src=\"";
- String CONTENT_TEMPLATE_TEXT_SUFFIX = "\" style=\"height: 16px; width: 16px;\" />{shortName}: {longName}</span></div>";
+ public final static String CONTENT_TEMPLATE_TEXT_PREFIX = "<div class=\"search-item\"><span class=\"kune-IconHyperlink\"><img src=\"";
+ public final static String CONTENT_TEMPLATE_TEXT_SUFFIX = "\" style=\"height: 16px; width: 16px;\" />{shortName}: {longName}</span></div>";
+ private SearcherConstants() {
+ }
}
Modified: 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-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/Keyboard.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,68 +1,71 @@
package org.ourproject.kune.platf.client.shortcuts;
-public interface Keyboard {
+public final class 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;
+ public final static int KEY_F1 = 112; /* Browser's help */
+ public final static int KEY_F2 = 113;
+ public final static int KEY_F3 = 114;
+ public final static int KEY_F4 = 115;
@Deprecated
- public int KEY_F5 = 116; /* Refresh in browsers */
- public int KEY_F6 = 117;
+ public final static int KEY_F5 = 116; /* Refresh in browsers */
+ public final static 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;
+ public final static int KEY_F7 = 118; /* Turn of caret in ff */
+ public final static int KEY_F8 = 119;
+ public final static int KEY_F9 = 120;
+ public final static int KEY_F10 = 121;
@Deprecated
- public int KEY_F11 = 122; /* Full screen */
- public int KEY_F12 = 123;
+ public final static int KEY_F11 = 122; /* Full screen */
+ public final static int KEY_F12 = 123;
- public int KEY_COMMA = ',';
- public int KEY_MINUS = '-';
- public int KEY_PERIOD = '.';
- public int KEY_SLASH = '/';
- public int KEY_0 = '0';
- public int KEY_1 = '1';
- public int KEY_2 = '2';
- public int KEY_3 = '3';
- public int KEY_4 = '4';
- public int KEY_5 = '5';
- public int KEY_6 = '6';
- public int KEY_7 = '7';
- public int KEY_8 = '8';
- public int KEY_9 = '9';
- public int KEY_SEMICOLON = ';';
- public int KEY_EQUALS = '=';
- public int KEY_A = 'A';
- public int KEY_B = 'B';
- public int KEY_C = 'C';
- public int KEY_D = 'D';
- public int KEY_E = 'E';
- public int KEY_F = 'F';
- public int KEY_G = 'G';
- public int KEY_H = 'H';
- public int KEY_I = 'I';
- public int KEY_J = 'J';
- public int KEY_K = 'K';
- public int KEY_L = 'L';
- public int KEY_M = 'M';
- public int KEY_N = 'N';
- public int KEY_O = 'O';
- public int KEY_P = 'P';
- public int KEY_Q = 'Q';
- public int KEY_R = 'R';
- public int KEY_S = 'S';
- public int KEY_T = 'T';
- public int KEY_U = 'U';
- public int KEY_V = 'V';
- public int KEY_W = 'W';
- public int KEY_X = 'X';
- public int KEY_Y = 'Y';
- public int KEY_Z = 'Z';
- public int KEY_OPEN_BRACKET = '[';
- public int KEY_BACK_SLASH = '\\';
- public int KEY_CLOSE_BRACKET = ']';
+ public final static int KEY_COMMA = ',';
+ public final static int KEY_MINUS = '-';
+ public final static int KEY_PERIOD = '.';
+ public final static int KEY_SLASH = '/';
+ public final static int KEY_0 = '0';
+ public final static int KEY_1 = '1';
+ public final static int KEY_2 = '2';
+ public final static int KEY_3 = '3';
+ public final static int KEY_4 = '4';
+ public final static int KEY_5 = '5';
+ public final static int KEY_6 = '6';
+ public final static int KEY_7 = '7';
+ public final static int KEY_8 = '8';
+ public final static int KEY_9 = '9';
+ public final static int KEY_SEMICOLON = ';';
+ public final static int KEY_EQUALS = '=';
+ public final static int KEY_A = 'A';
+ public final static int KEY_B = 'B';
+ public final static int KEY_C = 'C';
+ public final static int KEY_D = 'D';
+ public final static int KEY_E = 'E';
+ public final static int KEY_F = 'F';
+ public final static int KEY_G = 'G';
+ public final static int KEY_H = 'H';
+ public final static int KEY_I = 'I';
+ public final static int KEY_J = 'J';
+ public final static int KEY_K = 'K';
+ public final static int KEY_L = 'L';
+ public final static int KEY_M = 'M';
+ public final static int KEY_N = 'N';
+ public final static int KEY_O = 'O';
+ public final static int KEY_P = 'P';
+ public final static int KEY_Q = 'Q';
+ public final static int KEY_R = 'R';
+ public final static int KEY_S = 'S';
+ public final static int KEY_T = 'T';
+ public final static int KEY_U = 'U';
+ public final static int KEY_V = 'V';
+ public final static int KEY_W = 'W';
+ public final static int KEY_X = 'X';
+ public final static int KEY_Y = 'Y';
+ public final static int KEY_Z = 'Z';
+ public final static int KEY_OPEN_BRACKET = '[';
+ public final static int KEY_BACK_SLASH = '\\';
+ public final static int KEY_CLOSE_BRACKET = ']';
+ private Keyboard() {
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutDescriptor.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutDescriptor.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -100,7 +100,7 @@
}
public boolean is(final char keyCode, final int modifiers) {
- return (keyCode == keyCode && same(modifiers, KeyboardListener.MODIFIER_ALT, alt)
+ return (this.keycode == keyCode && same(modifiers, KeyboardListener.MODIFIER_ALT, alt)
&& same(modifiers, KeyboardListener.MODIFIER_CTRL, ctrl) && same(modifiers,
KeyboardListener.MODIFIER_SHIFT, shift));
}
@@ -115,7 +115,7 @@
s += sKey(alt, "Alt");
s += sKey(ctrl, "Ctrl");
s += sKey(shift, "Shift");
- s += keyName != NO_KEYNAME ? translateKey(keyName) + ")" : ("" + (char) keycode).toUpperCase() + ")";
+ s += !keyName.equals(NO_KEYNAME) ? translateKey(keyName) + ")" : ("" + (char) keycode).toUpperCase() + ")";
return s;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -94,7 +94,7 @@
}
public void onClick(final Widget sender) {
- if (sender.equals(titleHP) | sender.equals(arrowImage) | sender.equals(titleLabel)) {
+ if (sender.equals(titleHP) || sender.equals(arrowImage) || sender.equals(titleLabel)) {
setContentVisible(!isContentVisible());
}
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/AbstractPopupPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/AbstractPopupPanel.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/AbstractPopupPanel.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,61 @@
+package org.ourproject.kune.platf.client.ui.dialogs;
+
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.PopupPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+public abstract class AbstractPopupPanel {
+
+ private transient PopupPanel popupPalette;
+ protected transient Widget widget;
+
+ private final transient boolean autoHide;
+ private final transient boolean modal;
+
+ public AbstractPopupPanel() {
+ this(true, true);
+ }
+
+ public AbstractPopupPanel(final boolean autohide, final boolean modal) {
+ this.autoHide = autohide;
+ this.modal = modal;
+ }
+
+ public void addStyleName(final String style) {
+ assert popupPalette != null;
+ popupPalette.addStyleName(style);
+ }
+
+ public void hide() {
+ if (popupPalette != null) {
+ popupPalette.hide();
+ }
+ }
+
+ public boolean isVisible() {
+ if (popupPalette != null && popupPalette.isVisible()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public void show(final int left, final int top) {
+ popupPalette = new PopupPanel(autoHide, modal);
+ popupPalette.addStyleName("k-def-popup");
+ if (widget == null) {
+ createWidget();
+ }
+ popupPalette.setWidget(widget);
+ popupPalette.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
+ public void setPosition(final int offsetWidth, final int offsetHeight) {
+ final int maxLeft = Window.getClientWidth() - offsetWidth;
+ final int maxTop = Window.getClientHeight() - offsetHeight;
+ popupPalette.setPopupPosition(left < maxLeft ? left : maxLeft, top < maxTop ? top : maxTop);
+ }
+ });
+ }
+
+ protected abstract void createWidget();
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/download/FileConstants.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/download/FileConstants.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/download/FileConstants.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -19,16 +19,20 @@
\*/
package org.ourproject.kune.platf.client.ui.download;
-public interface FileConstants {
- String HASH = "hash";
- String TOKEN = "token";
- String DOWNLOAD = "download";
- String IMGSIZE = "imgsize";
- String FILENAME = "filename";
- String TYPE_ID = "typeid";
- String LOGO_FORM_FIELD = "k-elogov-ff";
- int LOGO_ICON_DEFAULT_HEIGHT = 60;
- int LOGO_ICON_DEFAULT_WIDTH = 468;
- int LOGO_ICON_MIN_HEIGHT = 28;
- int LOGO_ICON_MIN_WIDTH = 468;
+public final class FileConstants {
+
+ public final static String HASH = "hash";
+ public final static String TOKEN = "token";
+ public final static String DOWNLOAD = "download";
+ public final static String IMGSIZE = "imgsize";
+ public final static String FILENAME = "filename";
+ public final static String TYPE_ID = "typeid";
+ public final static String LOGO_FORM_FIELD = "k-elogov-ff";
+ public final static int LOGO_DEF_HEIGHT = 60;
+ public final static int LOGO_DEF_WIDTH = 468;
+ public final static int LOGO_MIN_HEIGHT = 28;
+ public final static int LOGO_MIN_WIDTH = 468;
+
+ private FileConstants() {
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Map;
import com.allen_sauer.gwt.log.client.Log;
import com.calclab.suco.client.events.Event;
@@ -72,8 +73,8 @@
private static final String END_ICON_HTML = "endIconHtmlField";
private static final String TOOLTIP = "tooltipField";
private static final String TOOLTIPTITLE = "tooltipTitleField";
- private final HashMap<String, CustomMenu<T>> menuMap;
- private final HashMap<T, Record> recordMap;
+ private final Map<String, CustomMenu<T>> menuMap;
+ private final Map<T, Record> recordMap;
private RecordDef recordDef;
private GroupingStore store;
private GridPanel grid;
@@ -232,13 +233,13 @@
public void removeItem(final GridItem<T> gridItem) {
final Record record = recordMap.get(gridItem.getItem());
- if (record != null) {
- menuMap.remove(record);
+ if (record == null) {
+ Log.error("Trying to remove a non existing item: " + gridItem.getId());
+ } else {
+ menuMap.remove(gridItem.getId());
store.remove(record);
recordMap.remove(gridItem.getItem());
doLayoutIfNeeded();
- } else {
- Log.error("Trying to remove a non existing item: " + gridItem.getId());
}
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/ImgConstants.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/ImgConstants.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/ImgConstants.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,12 @@
+package org.ourproject.kune.platf.client.ui.img;
+
+public final class ImgConstants {
+
+ public static final String CSS_SUFFIX = "k-icon-";
+
+ public static final String PATH_PREFIX = "images/";
+
+ private ImgConstants() {
+ }
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/ImgResources.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/ImgResources.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/ImgResources.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,15 @@
+package org.ourproject.kune.platf.client.ui.img;
+
+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 ImgResources extends ImmutableResourceBundle {
+
+ @Resource("kimg.css")
+ CssResource css();
+
+ @Resource("info.png")
+ ImageResource info();
+
+}
\ No newline at end of file
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/info.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/info.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/kimg.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/kimg.css 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/img/kimg.css 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,3 @@
+ at sprite div .k-icon-info {
+ gwt-image: 'info';
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/noti/NotifyUser.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/noti/NotifyUser.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/noti/NotifyUser.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -36,30 +36,26 @@
info, important, veryImportant, error,
}
- private static Event2<Level, String> onNotify;
+ private static final Event2<Level, String> ON_NOTIFY = new Event2<Level, String>("onNotify");
+ private static final Event2<String, String> ON_ALERT = new Event2<String, String>("onAlert");
+ private static final Event<ConfirmationAsk> ON_CONFIRMATION_ASK = new Event<ConfirmationAsk>("onConfirmationAsk");
+ private static final Event<String> ON_PROGRESS = new Event<String>("onProgress");
+ private static final Event0 ON_HIDE_PROGRESS = new Event0("onHideProgress");
- private static Event2<String, String> onAlert;
-
- private static Event<ConfirmationAsk> onConfirmationAsk;
-
- private static Event<String> onProgress;
-
- private static Event0 onHideProgress;
-
private static I18nTranslationService i18n;
private static Images images;
- public static void askConfirmation(String confirmationTitle, String confirmationText, Listener0 onConfirm,
- Listener0 onCancel) {
- onConfirmationAsk.fire(new ConfirmationAsk(confirmationTitle, confirmationText, onConfirm, onCancel));
+ public static void askConfirmation(final String confirmationTitle, final String confirmationText,
+ final Listener0 onConfirm, final Listener0 onCancel) {
+ ON_CONFIRMATION_ASK.fire(new ConfirmationAsk(confirmationTitle, confirmationText, onConfirm, onCancel));
}
public static void error(final String message) {
- onNotify.fire(Level.error, message);
+ ON_NOTIFY.fire(Level.error, message);
}
- public static String getCls(Level level) {
+ public static String getCls(final Level level) {
switch (level) {
case info:
return "k-stm-info-icon";
@@ -73,7 +69,7 @@
}
}
- public static AbstractImagePrototype getImage(Level level) {
+ public static AbstractImagePrototype getImage(final Level level) {
switch (level) {
case info:
return images.info();
@@ -88,73 +84,72 @@
}
public static void hideProgress() {
- onHideProgress.fire();
+ ON_HIDE_PROGRESS.fire();
}
public static void important(final String message) {
- onNotify.fire(Level.important, message);
+ ON_NOTIFY.fire(Level.important, message);
}
public static void info(final String message) {
- onNotify.fire(Level.info, message);
+ ON_NOTIFY.fire(Level.info, message);
}
- public static void showAlertMessage(String title, String message) {
- onAlert.fire(title, message);
+ public static void showAlertMessage(final String title, final String message) {
+ ON_ALERT.fire(title, message);
}
public static void showProgress(final String text) {
- onProgress.fire(text);
+ ON_PROGRESS.fire(text);
}
public static void showProgressLoading() {
- onProgress.fire(i18n.t("Loading"));
+ ON_PROGRESS.fire(i18n.t("Loading"));
}
public static void showProgressProcessing() {
- onProgress.fire(i18n.t("Processing"));
+ ON_PROGRESS.fire(i18n.t("Processing"));
}
public static void showProgressSaving() {
- onProgress.fire(i18n.t("Saving"));
+ ON_PROGRESS.fire(i18n.t("Saving"));
}
public static void showProgressStarting() {
- onProgress.fire(i18n.t("Starting"));
+ ON_PROGRESS.fire(i18n.t("Starting"));
}
public static void veryImportant(final String message) {
- onNotify.fire(Level.veryImportant, message);
+ ON_NOTIFY.fire(Level.veryImportant, message);
}
- public NotifyUser(I18nTranslationService i18n, Images images) {
+ public NotifyUser(final I18nTranslationService i18n, final Images images) {
+ this();
NotifyUser.i18n = i18n;
NotifyUser.images = images;
- onNotify = new Event2<Level, String>("onNotify");
- onAlert = new Event2<String, String>("onAlert");
- onProgress = new Event<String>("onProgress");
- onHideProgress = new Event0("onHideProgress");
- onConfirmationAsk = new Event<ConfirmationAsk>("onConfirmationAsk");
}
+ private NotifyUser() {
+ }
+
public void addAlerter(final Listener2<String, String> listener) {
- onAlert.add(listener);
+ ON_ALERT.add(listener);
}
public void addConfirmationAsker(final Listener<ConfirmationAsk> listener) {
- onConfirmationAsk.add(listener);
+ ON_CONFIRMATION_ASK.add(listener);
}
public void addHideProgressNotifier(final Listener0 listener) {
- onHideProgress.add(listener);
+ ON_HIDE_PROGRESS.add(listener);
}
public void addNotifier(final Listener2<Level, String> listener) {
- onNotify.add(listener);
+ ON_NOTIFY.add(listener);
}
public void addProgressNotifier(final Listener<String> listener) {
- onProgress.add(listener);
+ ON_PROGRESS.add(listener);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/AbstractPalettePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/AbstractPalettePanel.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/AbstractPalettePanel.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,31 +1,10 @@
package org.ourproject.kune.platf.client.ui.palette;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.Widget;
+import org.ourproject.kune.platf.client.ui.dialogs.AbstractPopupPanel;
-public abstract class AbstractPalettePanel {
- private PopupPanel popupPalette;
- Widget widget;
+public abstract class AbstractPalettePanel extends AbstractPopupPanel {
- public void hide() {
- if (popupPalette != null) {
- popupPalette.hide();
- }
- }
+ @Override
+ protected abstract void createWidget();
- public void show(final int left, final int top) {
- if (widget == null) {
- createPalette();
- }
- popupPalette = new PopupPanel(true, true);
- popupPalette.addStyleName("kune-WebSafePalette-popup");
- popupPalette.setVisible(false);
- popupPalette.show();
- popupPalette.setPopupPosition(left, top);
- popupPalette.setWidget(widget);
- popupPalette.setVisible(true);
- }
-
- protected abstract void createPalette();
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/ColorWebSafePalettePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/ColorWebSafePalettePanel.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/ColorWebSafePalettePanel.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -32,32 +32,33 @@
*/
public class ColorWebSafePalettePanel extends AbstractPalettePanel implements ColorWebSafePaletteView {
- private final ColorWebSafePalettePresenter presenter;
+ private final transient ColorWebSafePalettePresenter presenter;
public ColorWebSafePalettePanel(final ColorWebSafePalettePresenter initPresenter) {
+ super();
this.presenter = initPresenter;
}
@Override
- protected void createPalette() {
- Grid paletteGrid = new Grid(ROWS, COLS);
+ protected void createWidget() {
+ final Grid paletteGrid = new Grid(ROWS, COLS);
paletteGrid.setCellSpacing(1);
// Put color values in the grid cells
int row;
int col;
- int n = 0;
+ int num = 0;
for (String element : COLORS) {
for (String element2 : COLORS) {
for (String element3 : COLORS) {
- row = n / COLS;
- col = n % COLS;
+ row = num / COLS;
+ col = num % COLS;
final String currentColor = "#" + element3 + element + element2;
paletteGrid.setText(row, col, " ");
DOM.setStyleAttribute(paletteGrid.getCellFormatter().getElement(row, col), "backgroundColor",
currentColor);
- n++;
+ num++;
}
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/SimplePalettePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/SimplePalettePanel.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/SimplePalettePanel.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -7,21 +7,22 @@
public class SimplePalettePanel extends AbstractPalettePanel implements SimplePaletteView {
- private final SimplePalettePresenter presenter;
- private final I18nTranslationService i18n;
+ private transient final SimplePalettePresenter presenter;
+ private transient final I18nTranslationService i18n;
- public SimplePalettePanel(final SimplePalettePresenter presenter, I18nTranslationService i18n) {
+ public SimplePalettePanel(final SimplePalettePresenter presenter, final I18nTranslationService i18n) {
+ super();
this.presenter = presenter;
this.i18n = i18n;
}
@Override
- protected void createPalette() {
- ColorPalette colorPalette = new ColorPalette();
+ protected void createWidget() {
+ final ColorPalette colorPalette = new ColorPalette();
colorPalette.setTitle(i18n.t("Pick a color"));
colorPalette.addListener(new ColorPaletteListenerAdapter() {
@Override
- public void onSelect(ColorPalette colorPalette, String color) {
+ public void onSelect(final ColorPalette colorPalette, final String color) {
presenter.onColorSelected(color);
}
});
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTELinkPopup.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTELinkPopup.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTELinkPopup.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -3,35 +3,35 @@
import org.ourproject.kune.platf.client.actions.ActionItem;
import org.ourproject.kune.platf.client.services.Images;
import org.ourproject.kune.platf.client.ui.KuneUiUtils;
+import org.ourproject.kune.platf.client.ui.dialogs.AbstractPopupPanel;
import com.calclab.suco.client.events.Listener0;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.Widget;
-public class RTELinkPopup {
- private final HorizontalPanel hp;
- private PopupPanel popupPalette;
+public class RTELinkPopup extends AbstractPopupPanel {
+ private final transient HorizontalPanel hpanel;
public RTELinkPopup() {
- hp = new HorizontalPanel();
- hp.setSpacing(5);
- KuneUiUtils.setUnselectable(hp.getElement());
- Image close = new Image();
+ super(false, false);
+ hpanel = new HorizontalPanel();
+ hpanel.setSpacing(5);
+ KuneUiUtils.setUnselectable(hpanel.getElement());
+ final Image close = new Image();
Images.App.getInstance().kuneClose().applyTo(close);
close.addClickListener(new ClickListener() {
public void onClick(final Widget sender) {
hide();
}
});
- hp.add(close);
+ hpanel.add(close);
}
public void addAction(final ActionItem<Object> item, final Listener0 onClick) {
- Label actionLabel = new Label();
+ final Label actionLabel = new Label();
actionLabel.setText(item.getAction().getText());
actionLabel.addStyleName("k-rte-changelink");
KuneUiUtils.setUnselectable(actionLabel.getElement());
@@ -40,29 +40,12 @@
onClick.onEvent();
}
});
- hp.insert(actionLabel, 0);
+ hpanel.insert(actionLabel, 0);
}
- public void hide() {
- if (isVisible()) {
- popupPalette.hide();
- }
+ @Override
+ protected void createWidget() {
+ widget = hpanel;
+ super.addStyleName("k-rte-changelink-popup");
}
-
- public boolean isVisible() {
- if (popupPalette != null && popupPalette.isVisible()) {
- return true;
- } else {
- return false;
- }
- }
-
- public void show(final int left, final int top) {
- popupPalette = new PopupPanel(false, false);
- popupPalette.addStyleName("k-rte-changelink-popup");
- popupPalette.setWidget(hp);
- popupPalette.show();
- popupPalette.setPopupPosition(left, top);
- popupPalette.setVisible(true);
- }
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorNew.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorNew.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorNew.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,59 @@
+package org.ourproject.kune.platf.client.ui.rte.basic;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
+import org.ourproject.kune.platf.client.actions.ui.AbstractGuiActionDescrip;
+import org.ourproject.kune.platf.client.actions.ui.GuiActionCollection;
+import org.ourproject.kune.platf.client.actions.ui.GuiAddCondition;
+import org.ourproject.kune.platf.client.actions.ui.MenuDescriptor;
+
+import com.calclab.suco.client.events.Listener0;
+
+public interface RTEditorNew {
+
+ String TOPBAR = "rte-topbar";
+ String SNDBAR = "rte-sndbar";
+ String LINKCTX = "rte-linkctx";
+
+ void addAction(AbstractGuiActionDescrip action);
+
+ void addActions(GuiActionCollection actions);
+
+ void addOnEditListener(Listener0 listener);
+
+ void attach();
+
+ void detach();
+
+ GuiAddCondition getBasicAddCondition();
+
+ MenuDescriptor getEditMenu();
+
+ View getEditorArea();
+
+ GuiAddCondition getExtendedAddCondition();
+
+ MenuDescriptor getFormatMenu();
+
+ String getHtml();
+
+ MenuDescriptor getInsertMenu();
+
+ MenuDescriptor getLinkCtxMenu();
+
+ ActionToolbar<Object> getSndBar();
+
+ String getText();
+
+ ActionToolbar<Object> getTopBar();
+
+ void reset();
+
+ void setExtended(boolean extended);
+
+ void setFocus(boolean focus);
+
+ void setHtml(String html);
+
+ void setText(String text);
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanelNew.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanelNew.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanelNew.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,451 @@
+package org.ourproject.kune.platf.client.ui.rte.basic;
+
+import static com.google.gwt.user.client.ui.KeyboardListener.KEY_DOWN;
+import static com.google.gwt.user.client.ui.KeyboardListener.KEY_END;
+import static com.google.gwt.user.client.ui.KeyboardListener.KEY_ESCAPE;
+import static com.google.gwt.user.client.ui.KeyboardListener.KEY_HOME;
+import static com.google.gwt.user.client.ui.KeyboardListener.KEY_LEFT;
+import static com.google.gwt.user.client.ui.KeyboardListener.KEY_PAGEDOWN;
+import static com.google.gwt.user.client.ui.KeyboardListener.KEY_PAGEUP;
+import static com.google.gwt.user.client.ui.KeyboardListener.KEY_RIGHT;
+import static com.google.gwt.user.client.ui.KeyboardListener.KEY_UP;
+
+import java.util.Date;
+
+import org.ourproject.kune.platf.client.actions.ActionDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionItem;
+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.GlobalShortcutRegister;
+import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor;
+import org.ourproject.kune.platf.client.shortcuts.ShortcutRegister;
+import org.ourproject.kune.platf.client.ui.noti.NotifyUser;
+import org.ourproject.kune.platf.client.ui.rte.RichTextArea;
+import org.ourproject.kune.platf.client.ui.rte.insertlink.LinkExecutableUtils;
+import org.ourproject.kune.platf.client.ui.rte.insertlink.LinkInfo;
+import org.xwiki.gwt.dom.client.DocumentFragment;
+import org.xwiki.gwt.dom.client.Range;
+import org.xwiki.gwt.dom.client.Selection;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.calclab.suco.client.events.Listener0;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.DeferredCommand;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.FocusListener;
+import com.google.gwt.user.client.ui.Widget;
+
+public class RTEditorPanelNew extends RichTextArea implements RTEditorViewNew {
+
+ private class EventListener implements FocusListener {
+
+ public void onFocus(final Widget sender) {
+ presenter.onEditorFocus();
+ }
+
+ public void onLostFocus(final Widget sender) {
+ presenter.onLostFocus();
+ }
+ }
+ private final I18nUITranslationService i18n;
+ private final BasicFormatter basic;
+ private final ExtendedFormatter extended;
+ private final RTEditorPresenter presenter;
+ private final ActionManager actionManager;
+ private final ShortcutRegister shortcutRegister;
+ private final GlobalShortcutRegister globalShortcutReg;
+ private final RTELinkPopup linkCtxMenu;
+
+ public RTEditorPanelNew(final RTEditorPresenter presenter, final I18nUITranslationService i18n,
+ final ActionManager actionManager, final GlobalShortcutRegister globalShortcutReg) {
+ this.presenter = presenter;
+ this.i18n = i18n;
+ this.actionManager = actionManager;
+ this.globalShortcutReg = globalShortcutReg;
+ basic = getBasicFormatter();
+ extended = getExtendedFormatter();
+ shortcutRegister = new ShortcutRegister();
+ final EventListener listener = new EventListener();
+ addFocusListener(listener);
+ setWidth("96%");
+ setHeight("100%");
+ linkCtxMenu = new RTELinkPopup();
+ }
+
+ public void addActions(final ActionItemCollection<Object> actionItems) {
+ for (final ActionItem<Object> actionItem : actionItems) {
+ final ActionDescriptor<Object> action = actionItem.getAction();
+ if (action.hasShortcut() && action.mustBeAdded(null)) {
+ final ShortcutDescriptor shortcut = action.getShortcut();
+ shortcutRegister.put(shortcut, actionItem);
+ }
+ }
+ }
+
+ public void addCtxAction(final ActionItem<Object> actionItem) {
+ linkCtxMenu.addAction(actionItem, new Listener0() {
+ public void onEvent() {
+ DeferredCommand.addCommand(new Command() {
+ public void execute() {
+ actionManager.doAction(actionItem);
+ }
+ });
+ }
+ });
+ }
+
+ public void adjustSize(final int height) {
+ setHeight("" + height);
+ }
+
+ public boolean canBeBasic() {
+ return basic != null;
+ }
+
+ public boolean canBeExtended() {
+ return extended != null;
+ }
+
+ public void copy() {
+ extended.copy();
+ }
+
+ public void createLink(final String url) {
+ extended.createLink(url);
+ }
+
+ public void cut() {
+ extended.cut();
+ }
+
+ public void delete() {
+ extended.delete();
+ }
+
+ public void focus() {
+ setFocus(true);
+ }
+
+ public LinkInfo getLinkInfoIfHref() {
+ LinkInfo linkinfo = null;
+ final org.xwiki.gwt.dom.client.Element selectedAnchor = selectAndGetLink();
+ if (selectedAnchor != null) {
+ linkinfo = LinkInfo.parse(selectedAnchor);
+ } else {
+ linkinfo = new LinkInfo(getSelectionText());
+ }
+ Log.debug("Link info: " + linkinfo);
+ return linkinfo;
+ }
+
+ public void getRangeInfo() {
+ // Selection selection = getSelection();
+ // String info = "range count: " + selection.getRangeCount() +
+ // "<br/>focus offset: " + selection.getFocusOffset()
+ // + "<br/>anchor offset:" + selection.getAnchorOffset() +
+ // "<br/>range 0 as html: "
+ // + selection.getRangeAt(0).toHTML();
+ // NotifyUser.info(info);
+ final String info = "range count: " + getFstRange().getCommonAncestorContainer().getFirstChild().getNodeName();
+ NotifyUser.info(info);
+ }
+
+ public String getSelectionText() {
+ return getFstRange().cloneContents().getInnerText();
+ }
+
+ public void hideLinkCtxMenu() {
+ linkCtxMenu.hide();
+ }
+
+ public void insertBlockquote() {
+ final DocumentFragment extracted = getFstRange().cloneContents();
+ // delete();
+ insertHtml("<blockquote>" + extracted.getInnerHTML() + "</blockquote>");
+ focus();
+ }
+
+ public void insertComment(final String author) {
+ final String comment = null;
+ createCommentAndSelectIt(author, comment);
+ }
+
+ public void insertCommentNotUsingSelection(final String author) {
+ getFstRange().collapse(false);
+ createCommentAndSelectIt(author, null);
+ focus();
+ }
+
+ public void insertCommentUsingSelection(final String author) {
+ final DocumentFragment extracted = getFstRange().cloneContents();
+ extended.delete();
+ final String comment = extracted.getInnerText();
+ createCommentAndSelectIt(author, comment);
+ focus();
+ }
+
+ public void insertHorizontalRule() {
+ extended.insertHorizontalRule();
+ }
+
+ public void insertHtml(final String html) {
+ extended.insertHtml(html);
+ }
+
+ public void insertImage(final String url) {
+ extended.insertImage(url);
+ }
+
+ public void insertOrderedList() {
+ extended.insertOrderedList();
+ }
+
+ public void insertUnorderedList() {
+ extended.insertUnorderedList();
+ }
+
+ public boolean isAnythingSelected() {
+ return !getDocument().getSelection().isCollapsed();
+ }
+
+ public boolean isBold() {
+ return basic.isBold();
+ }
+
+ public boolean isCollapsed() {
+ return getFstRange().isCollapsed();
+ }
+
+ public boolean isCtxMenuVisible() {
+ return linkCtxMenu.isVisible();
+ }
+
+ public boolean isItalic() {
+ return basic.isItalic();
+ }
+
+ public boolean isLink() {
+ if (isAttached() && LinkExecutableUtils.getSelectedAnchor(this) != null) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isStrikethrough() {
+ return extended.isStrikethrough();
+ }
+
+ public boolean isSubscript() {
+ return basic.isSubscript();
+ }
+
+ public boolean isSuperscript() {
+ return basic.isSuperscript();
+ }
+
+ public boolean isUnderlined() {
+ return basic.isUnderlined();
+ }
+
+ public void justifyCenter() {
+ basic.setJustification(Justification.CENTER);
+ }
+
+ public void justifyLeft() {
+ basic.setJustification(Justification.LEFT);
+ }
+
+ public void justifyRight() {
+ basic.setJustification(Justification.RIGHT);
+ }
+
+ public void leftIndent() {
+ extended.leftIndent();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void onBrowserEvent(final Event event) {
+ switch (DOM.eventGetType(event)) {
+ case Event.ONCLICK:
+ updateStatus();
+ updateLinkInfo();
+ super.onBrowserEvent(event);
+ break;
+ case Event.ONKEYDOWN:
+ final ActionItem rtaActionItem = shortcutRegister.get(event);
+ final ActionItem actionItem = rtaActionItem != null ? rtaActionItem : globalShortcutReg.get(event);
+ if (actionItem != null) {
+ updateStatus();
+ fireEdit();
+ event.cancelBubble(true);
+ event.preventDefault();
+ actionManager.doAction(actionItem);
+ updateStatus();
+ } else {
+ super.onBrowserEvent(event);
+ updateStatus();
+ updateLinkInfo();
+ if (isAnEditionKey(event.getKeyCode())) {
+ fireEdit();
+ }
+ }
+ break;
+ default:
+ // Rest of events
+ super.onBrowserEvent(event);
+ updateStatus();
+ }
+ }
+
+ public void paste() {
+ extended.paste();
+ }
+
+ public void redo() {
+ extended.redo();
+ }
+
+ public void removeFormat() {
+ extended.removeFormat();
+ }
+
+ public void rightIndent() {
+ extended.rightIndent();
+ }
+
+ public void selectAll() {
+ basic.selectAll();
+ }
+
+ public void selectLink() {
+ selectAndGetLink();
+ }
+
+ public void setBackColor(final String color) {
+ basic.setBackColor(color);
+ }
+
+ public void setFontName(final String name) {
+ basic.setFontName(name);
+ }
+
+ public void setFontSize(final FontSize size) {
+ basic.setFontSize(size);
+ }
+
+ public void setForeColor(final String color) {
+ basic.setForeColor(color);
+ }
+
+ public void showLinkCtxMenu() {
+ DeferredCommand.addCommand(new Command() {
+ public void execute() {
+ final org.xwiki.gwt.dom.client.Element selectedAnchor = LinkExecutableUtils.getSelectedAnchor(RTEditorPanelNew.this);
+ if (selectedAnchor != null) {
+ linkCtxMenu.show(RTEditorPanelNew.this.getAbsoluteLeft() + selectedAnchor.getAbsoluteLeft(),
+ RTEditorPanelNew.this.getAbsoluteTop() + selectedAnchor.getAbsoluteTop() + 20);
+ }
+ }
+ });
+
+ }
+
+ public void toggleBold() {
+ basic.toggleBold();
+ }
+
+ public void toggleItalic() {
+ basic.toggleItalic();
+ }
+
+ public void toggleStrikethrough() {
+ extended.toggleStrikethrough();
+ }
+
+ public void toggleSubscript() {
+ basic.toggleSubscript();
+ }
+
+ public void toggleSuperscript() {
+ basic.toggleSuperscript();
+ }
+
+ public void toggleUnderline() {
+ basic.toggleUnderline();
+ }
+
+ public void undo() {
+ extended.undo();
+ }
+
+ public void unlink() {
+ extended.removeLink();
+ }
+
+ protected void fireEdit() {
+ presenter.fireOnEdit();
+ }
+
+ private void createCommentAndSelectIt(final String author, final String comment) {
+ final Element commentEl = createCommentElement(author, comment);
+ final Range innerCommentRange = getDocument().createRange();
+ getFstRange().insertNode(commentEl);
+ innerCommentRange.selectNodeContents(commentEl.getFirstChild());
+ getSelection().addRange(innerCommentRange);
+ fireEdit();
+ }
+
+ private Element createCommentElement(final String userName, final String insertComment) {
+ final String time = i18n.formatDateWithLocale(new Date(), true);
+ final Element span = getDocument().createSpanElement();
+ final String comment = insertComment != null ? insertComment : i18n.t("type your comment here");
+ span.setInnerHTML("<em>" + comment + "</em> -" + userName + " " + time);
+ DOM.setElementProperty(span.<com.google.gwt.user.client.Element> cast(), "className", "k-rte-comment");
+ // insertHtml(" " + span.getString() + " ");
+ return span;
+ }
+
+ private Range getFstRange() {
+ return getSelection().getRangeAt(0);
+ }
+
+ private Selection getSelection() {
+ return getDocument().getSelection();
+ }
+
+ private boolean isAnEditionKey(final int keyCode) {
+ if (keyCode != KEY_HOME && keyCode != KEY_END && keyCode != KEY_UP && keyCode != KEY_DOWN
+ && keyCode != KEY_LEFT && keyCode != KEY_RIGHT && keyCode != KEY_PAGEDOWN && keyCode != KEY_PAGEUP
+ && keyCode != KEY_ESCAPE) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private org.xwiki.gwt.dom.client.Element selectAndGetLink() {
+ final org.xwiki.gwt.dom.client.Element selectedAnchor = LinkExecutableUtils.getSelectedAnchor(this);
+ if (selectedAnchor != null) {
+ final Range range = getDocument().createRange();
+ range.selectNode(selectedAnchor);
+ getSelection().addRange(range);
+ }
+ return selectedAnchor;
+ }
+
+ private void updateLinkInfo() {
+ presenter.updateLinkInfo();
+ }
+
+ /**
+ * 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/basic/RTEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -16,6 +16,7 @@
import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor;
import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.ui.img.ImgConstants;
import org.ourproject.kune.platf.client.ui.noti.NotifyUser;
import org.ourproject.kune.platf.client.ui.palette.ColorWebSafePalette;
import org.ourproject.kune.platf.client.ui.rte.RichTextArea;
@@ -145,11 +146,20 @@
}
public ActionAddCondition<Object> canBeBasic() {
- return canBeBasic();
+ return new ActionAddCondition<Object>() {
+ public boolean mustBeAdded(final Object param) {
+ return view.canBeBasic();
+ }
+ };
+
}
public ActionAddCondition<Object> canBeExtended() {
- return canBeExtended();
+ return new ActionAddCondition<Object>() {
+ public boolean mustBeAdded(final Object param) {
+ return view.canBeExtended();
+ }
+ };
}
public void detach() {
@@ -240,8 +250,8 @@
}
private void createBasicActions() {
- ActionToolbarMenuDescriptor<Object> selectAll = new ActionToolbarMenuDescriptor<Object>(accessRol,
- TOPBAR, new Listener0() {
+ ActionToolbarMenuDescriptor<Object> selectAll = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
+ new Listener0() {
public void onEvent() {
view.selectAll();
}
@@ -288,8 +298,8 @@
underline.setShortcut(new ShortcutDescriptor(true, 'U'));
underline.setAddCondition(canBeBasic);
- ActionToolbarMenuDescriptor<Object> subscript = new ActionToolbarMenuDescriptor<Object>(accessRol,
- TOPBAR, new Listener0() {
+ ActionToolbarMenuDescriptor<Object> subscript = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
+ new Listener0() {
public void onEvent() {
view.toggleSubscript();
fireOnEdit();
@@ -301,8 +311,8 @@
subscript.setShortcut(new ShortcutDescriptor(true, 188, ","));
subscript.setAddCondition(canBeBasic);
- ActionToolbarMenuDescriptor<Object> superscript = new ActionToolbarMenuDescriptor<Object>(accessRol,
- TOPBAR, new Listener0() {
+ ActionToolbarMenuDescriptor<Object> superscript = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
+ new Listener0() {
public void onEvent() {
view.toggleSuperscript();
fireOnEdit();
@@ -377,8 +387,8 @@
redo.setBottomSeparator(true);
redo.setIconCls(getCssName(imgResources.redo()));
- ActionToolbarButtonDescriptor<Object> undoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol,
- SNDBAR, new Listener0() {
+ ActionToolbarButtonDescriptor<Object> undoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR,
+ new Listener0() {
public void onEvent() {
view.undo();
fireOnEdit();
@@ -389,8 +399,8 @@
undoBtn.setIconCls(getCssName(imgResources.undo()));
undoBtn.setPosition(0);
- ActionToolbarButtonDescriptor<Object> redoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol,
- SNDBAR, new Listener0() {
+ ActionToolbarButtonDescriptor<Object> redoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR,
+ new Listener0() {
public void onEvent() {
view.redo();
fireOnEdit();
@@ -440,8 +450,8 @@
paste.setAddCondition(canBeExtended);
paste.setIconCls(getCssName(imgResources.paste()));
- ActionToolbarMenuDescriptor<Object> editHtml = new ActionToolbarMenuDescriptor<Object>(accessRol,
- TOPBAR, new Listener0() {
+ ActionToolbarMenuDescriptor<Object> editHtml = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
+ new Listener0() {
public void onEvent() {
if (updateHtmlListener == null) {
@@ -464,8 +474,8 @@
editHtml.setParentMenuTitle(i18n.t(EDIT_MENU));
editHtml.setAddCondition(canBeExtended);
- ActionToolbarMenuDescriptor<Object> comment = new ActionToolbarMenuDescriptor<Object>(accessRol,
- TOPBAR, new Listener0() {
+ ActionToolbarMenuDescriptor<Object> comment = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
+ new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -521,8 +531,8 @@
hr.setParentMenuTitle(i18n.t(INSERT_MENU));
hr.setAddCondition(canBeExtended);
- ActionToolbarMenuDescriptor<Object> blockquote = new ActionToolbarMenuDescriptor<Object>(accessRol,
- TOPBAR, new Listener0() {
+ ActionToolbarMenuDescriptor<Object> blockquote = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
+ new Listener0() {
public void onEvent() {
view.focus();
view.insertBlockquote();
@@ -533,8 +543,8 @@
blockquote.setParentMenuTitle(i18n.t(FORMAT_MENU));
blockquote.setAddCondition(canBeExtended);
- ActionToolbarButtonDescriptor<Object> hrButton = new ActionToolbarButtonDescriptor<Object>(accessRol,
- SNDBAR, new Listener0() {
+ ActionToolbarButtonDescriptor<Object> hrButton = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR,
+ new Listener0() {
public void onEvent() {
view.focus();
view.insertHorizontalRule();
@@ -603,8 +613,8 @@
ul.setRightSeparator(ActionToolbarButtonSeparator.separator);
ul.setAddCondition(canBeExtended);
- ActionToolbarButtonDescriptor<Object> imgBtn = new ActionToolbarButtonDescriptor<Object>(accessRol,
- SNDBAR, new Listener0() {
+ ActionToolbarButtonDescriptor<Object> imgBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR,
+ new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -718,8 +728,8 @@
editLinkCtx.setShortcut(null);
editLinkCtx.setActionPosition(LINKCTX);
- ActionToolbarButtonDescriptor<Object> removeLink = new ActionToolbarButtonDescriptor<Object>(accessRol,
- SNDBAR, new Listener0() {
+ ActionToolbarButtonDescriptor<Object> removeLink = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR,
+ new Listener0() {
public void onEvent() {
if (view.isAnythingSelected()) {
// we try to unlink the selection
@@ -856,8 +866,8 @@
backgroundColor.setToolTip(i18n.t("Text Background Colour"));
backgroundColor.setAddCondition(canBeBasic);
- final ActionToolbarMenuDescriptor<Object> devInfo = new ActionToolbarMenuDescriptor<Object>(accessRol,
- TOPBAR, new Listener0() {
+ final ActionToolbarMenuDescriptor<Object> devInfo = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
+ new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -930,8 +940,8 @@
private ActionToolbarMenuDescriptor<Object> createFontNameAction(final ActionAddCondition<Object> canBeBasic,
final String fontName) {
- final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol,
- SNDBAR, new Listener0() {
+ final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol, SNDBAR,
+ new Listener0() {
public void onEvent() {
view.setFontName(fontName);
fireOnEdit();
@@ -946,8 +956,8 @@
private ActionToolbarMenuDescriptor<Object> createFontSizeAction(final ActionAddCondition<Object> canBeBasic,
final int fontSize, final String fontSizeName) {
- final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol,
- SNDBAR, new Listener0() {
+ final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol, SNDBAR,
+ new Listener0() {
public void onEvent() {
view.setFontSize(FONT_SIZES[fontSize]);
fireOnEdit();
@@ -971,7 +981,7 @@
}
private String getCssName(final ImageResource imageResource) {
- return RTEImgResources.SUFFIX + imageResource.getName();
+ return ImgConstants.CSS_SUFFIX + imageResource.getName();
}
private void getPalette() {
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenterNew.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenterNew.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenterNew.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,1162 @@
+package org.ourproject.kune.platf.client.ui.rte.basic;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.actions.AbstractAction;
+import org.ourproject.kune.platf.client.actions.Action;
+import org.ourproject.kune.platf.client.actions.ActionEvent;
+import org.ourproject.kune.platf.client.actions.InputMap;
+import org.ourproject.kune.platf.client.actions.KeyStroke;
+import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
+import org.ourproject.kune.platf.client.actions.ui.AbstractGuiActionDescrip;
+import org.ourproject.kune.platf.client.actions.ui.ButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ui.GuiActionCollection;
+import org.ourproject.kune.platf.client.actions.ui.GuiAddCondition;
+import org.ourproject.kune.platf.client.actions.ui.MenuDescriptor;
+import org.ourproject.kune.platf.client.actions.ui.MenuItemDescriptor;
+import org.ourproject.kune.platf.client.actions.ui.MenuSeparatorDescriptor;
+import org.ourproject.kune.platf.client.actions.ui.PushButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ui.ToolbarSeparatorDescriptor;
+import org.ourproject.kune.platf.client.actions.ui.ToolbarSeparatorDescriptor.Type;
+import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
+import org.ourproject.kune.platf.client.shortcuts.Keyboard;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.ui.noti.NotifyUser;
+import org.ourproject.kune.platf.client.ui.palette.ColorWebSafePalette;
+import org.ourproject.kune.platf.client.ui.rte.RichTextArea;
+import org.ourproject.kune.platf.client.ui.rte.edithtml.EditHtmlDialog;
+import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.ImageInfo;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.InsertImageDialog;
+import org.ourproject.kune.platf.client.ui.rte.insertlink.InsertLinkDialog;
+import org.ourproject.kune.platf.client.ui.rte.insertlink.LinkInfo;
+import org.ourproject.kune.platf.client.ui.rte.insertmedia.InsertMediaDialog;
+import org.ourproject.kune.platf.client.ui.rte.insertspecialchar.InsertSpecialCharDialog;
+import org.ourproject.kune.platf.client.ui.rte.inserttable.InsertTableDialog;
+import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.calclab.suco.client.events.Event0;
+import com.calclab.suco.client.events.Listener;
+import com.calclab.suco.client.events.Listener0;
+import com.calclab.suco.client.ioc.Provider;
+import com.google.gwt.libideas.resources.client.ImageResource;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.KeyboardListener;
+
+public class RTEditorPresenterNew implements RTEditorNew {
+
+ public abstract class AbstractRTEAction extends AbstractAction {
+
+ public AbstractRTEAction() {
+ super();
+ }
+
+ public AbstractRTEAction(final String text) {
+ this(text, null, null);
+ }
+
+ public AbstractRTEAction(final String text, final ImageResource icon) {
+ this(text, null, icon);
+ }
+
+ public AbstractRTEAction(final String text, final String tooltip, final ImageResource icon) {
+ super();
+ super.putValue(Action.NAME, text);
+ super.putValue(Action.SHORT_DESCRIPTION, tooltip);
+ super.putValue(Action.SMALL_ICON, icon);
+ }
+ }
+
+ public class BackgroundColorAction extends AbstractRTEAction {
+
+ public BackgroundColorAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ getPalette();
+ final Event event = actionEvent.getEvent();
+ palette.show(event.getClientX(), event.getClientY(), new Listener<String>() {
+ public void onEvent(final String color) {
+ palette.hide();
+ view.setBackColor(color);
+ fireOnEdit();
+ }
+ });
+ }
+ }
+
+ public class BlockquoteAction extends AbstractRTEAction {
+ public BlockquoteAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.focus();
+ view.insertBlockquote();
+ fireOnEdit();
+ }
+ }
+
+ public class BoldAction extends AbstractRTEAction {
+ public BoldAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.toggleBold();
+ fireOnEdit();
+ }
+ }
+
+ public class CommentAction extends AbstractRTEAction {
+ public CommentAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ deferred.addCommand(new Listener0() {
+ public void onEvent() {
+ view.focus();
+ final String author = session.isLogged() ? session.getCurrentUser().getShortName()
+ : i18n.t("anonymous user");
+ if (view.isAnythingSelected()) {
+ NotifyUser.askConfirmation(i18n.t("Insert a comment"),
+ i18n.t("Include the selected text in the comment?"), new Listener0() {
+ public void onEvent() {
+ // include selection in
+ // comment
+ view.insertCommentUsingSelection(author);
+ }
+ }, new Listener0() {
+ public void onEvent() {
+ // not include selection in
+ // comment;
+ view.insertCommentNotUsingSelection(author);
+ }
+ });
+ } else {
+ // Nothing selected > create comment in
+ // insertion point
+ view.insertComment(author);
+ }
+ }
+ });
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return session.isLogged();
+ }
+ }
+
+ public class CopyAction extends AbstractRTEAction {
+ public CopyAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.copy();
+ }
+ }
+
+ public class CreateOrEditLinkAction extends AbstractRTEAction {
+ public CreateOrEditLinkAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ deferred.addCommand(new Listener0() {
+ private InsertLinkDialog insLinkDialog;
+
+ public void onEvent() {
+ if (insLinkListener == null) {
+ insLinkListener = new Listener<LinkInfo>() {
+ public void onEvent(final LinkInfo linkInfo) {
+ final String link = linkInfo.toString();
+ Log.debug("Link: " + link);
+ view.focus();
+ view.insertHtml(link);
+ fireOnEdit();
+ }
+ };
+ }
+ final LinkInfo linkInfo = view.getLinkInfoIfHref();
+
+ if (insLinkDialog == null) {
+ insLinkDialog = insLinkDialogPv.get();
+ }
+ insLinkDialog.setLinkInfo(linkInfo);
+ insLinkDialog.setOnCreateLink(insLinkListener);
+ insLinkDialog.show();
+ hideLinkCtxMenu();
+ final String href = linkInfo.getHref();
+ if (href.length() > 0) {
+ if (href.startsWith("mailto")) {
+ insLinkDialog.activateTab(2);
+ } else {
+ insLinkDialog.activateTab(1);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ public class CutAction extends AbstractRTEAction {
+ public CutAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.cut();
+ fireOnEdit();
+ }
+ }
+
+ public class DecreaseIndentAction extends AbstractRTEAction {
+ public DecreaseIndentAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.leftIndent();
+ fireOnEdit();
+ }
+ }
+
+ public class DevInfoAction extends AbstractRTEAction {
+ public DevInfoAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ deferred.addCommand(new Listener0() {
+ public void onEvent() {
+ view.getRangeInfo();
+ }
+ });
+ }
+ }
+
+ public class EditHtmlAction extends AbstractRTEAction {
+ private transient EditHtmlDialog editHtmlDialog;
+
+ public EditHtmlAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ if (updHtmlListener == null) {
+ updHtmlListener = new Listener<String>() {
+ public void onEvent(final String html) {
+ view.setHTML(html);
+ fireOnEdit();
+ }
+ };
+ }
+ if (editHtmlDialog == null) {
+ editHtmlDialog = editHtmlDialogPv.get();
+ }
+ editHtmlDialog.setUpdateListener(updHtmlListener);
+ editHtmlDialog.show();
+ hideLinkCtxMenu();
+ editHtmlDialog.setHtml(view.getHTML());
+ }
+ }
+
+ public class FontAction extends AbstractRTEAction {
+ private final transient String fontName;
+
+ public FontAction(final String fontName, final String tooltip, final ImageResource icon) {
+ super("<span style=\"font-family: " + fontName + "\">" + fontName + "</span>", tooltip, icon);
+ this.fontName = fontName;
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.setFontName(fontName);
+ fontMenu.setText(fontName);
+ fireOnEdit();
+ }
+ }
+
+ public class FontColorAction extends AbstractRTEAction {
+ public FontColorAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ getPalette();
+ final Event event = actionEvent.getEvent();
+ palette.show(event.getClientX(), event.getClientY(), new Listener<String>() {
+ public void onEvent(final String color) {
+ palette.hide();
+ view.setForeColor(color);
+ fireOnEdit();
+ }
+ });
+ hideLinkCtxMenu();
+ }
+ }
+
+ public class FontSizeAction extends AbstractRTEAction {
+ private final transient String fontSizeName;
+ private final transient int fontSize;
+
+ public FontSizeAction(final String fontSizeName, final int fontSize, final String tooltip,
+ final ImageResource icon) {
+ super("<font size=\"" + (fontSize + 1) + "\">" + fontSizeName + "</font>", tooltip, icon);
+ this.fontSizeName = fontSizeName;
+ this.fontSize = fontSize;
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.setFontSize(FONT_SIZES[fontSize]);
+ fireOnEdit();
+ fontSizeMenu.setText(fontSizeName);
+ }
+ }
+
+ public class HrAction extends AbstractRTEAction {
+ public HrAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.focus();
+ view.insertHorizontalRule();
+ fireOnEdit();
+ }
+ }
+
+ public class ImgAction extends AbstractRTEAction {
+ public ImgAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ deferred.addCommand(new Listener0() {
+ private InsertImageDialog insImgDialog;
+
+ public void onEvent() {
+ if (insImgListener == null) {
+ insImgListener = new Listener<ImageInfo>() {
+ public void onEvent(final ImageInfo imageInfo) {
+ Log.debug("Image: " + imageInfo);
+ view.focus();
+ view.insertHtml(imageInfo.toString());
+ fireOnEdit();
+ }
+ };
+ }
+ if (insImgDialog == null) {
+ insImgDialog = insImgDialogProv.get();
+ }
+ insImgDialog.reset();
+ insImgDialog.setOnCreateImage(insImgListener);
+ insImgDialog.show();
+ hideLinkCtxMenu();
+ }
+ });
+ }
+ }
+
+ public class IncreaseIndentAction extends AbstractRTEAction {
+ public IncreaseIndentAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.rightIndent();
+ fireOnEdit();
+ }
+ }
+
+ public class InsertMediaAction extends AbstractRTEAction {
+ public InsertMediaAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ deferred.addCommand(new Listener0() {
+ private InsertMediaDialog insMediaDialog;
+
+ public void onEvent() {
+ if (insMediaListener == null) {
+ insMediaListener = new Listener<String>() {
+ public void onEvent(final String html) {
+ Log.debug("Media: " + html);
+ view.focus();
+ view.insertHtml(html);
+ fireOnEdit();
+ }
+ };
+ }
+ if (insMediaDialog == null) {
+ insMediaDialog = insMediaDialogPv.get();
+ }
+ insMediaDialog.setOnCreate(insMediaListener);
+ insMediaDialog.show();
+ hideLinkCtxMenu();
+ }
+ });
+ }
+ }
+
+ public class InsertSpecialCharAction extends AbstractRTEAction {
+ private transient InsertSpecialCharDialog insCharDialog;
+
+ public InsertSpecialCharAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ NotifyUser.showProgressLoading();
+ if (insCharListener == null) {
+ insCharListener = new Listener<String>() {
+ public void onEvent(final String character) {
+ view.insertHtml(character);
+ }
+ };
+ }
+ if (insCharDialog == null) {
+ insCharDialog = insCharDialogProv.get();
+ }
+ insCharDialog.setOnInsertSpecialChar(insCharListener);
+ insCharDialog.show();
+ hideLinkCtxMenu();
+ NotifyUser.hideProgress();
+ }
+ }
+
+ public class InsertTableAction extends AbstractRTEAction {
+ private transient InsertTableDialog insTableDialog;
+
+ public InsertTableAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ if (insTableListener == null) {
+ insTableListener = new Listener<String>() {
+ public void onEvent(final String table) {
+ view.insertHtml(table);
+ fireOnEdit();
+ }
+ };
+ }
+ if (insTableDialog == null) {
+ insTableDialog = insTableDialogPv.get();
+ }
+ insTableDialog.setOnInsertTable(insTableListener);
+ insTableDialog.show();
+ }
+ }
+
+ public class ItalicAction extends AbstractRTEAction {
+ public ItalicAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.toggleItalic();
+ fireOnEdit();
+ }
+ }
+
+ public class JustifyCentreAction extends AbstractRTEAction {
+ public JustifyCentreAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.justifyCenter();
+ fireOnEdit();
+ }
+ }
+
+ public class JustifyLeftAction extends AbstractRTEAction {
+ public JustifyLeftAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.justifyLeft();
+ fireOnEdit();
+ }
+ }
+
+ public class JustifyRightAction extends AbstractRTEAction {
+ public JustifyRightAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.justifyRight();
+ fireOnEdit();
+ }
+ }
+
+ public class OlAction extends AbstractRTEAction {
+ public OlAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.insertOrderedList();
+ fireOnEdit();
+ }
+ }
+
+ public class PasteAction extends AbstractRTEAction {
+ public PasteAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.paste();
+ fireOnEdit();
+ }
+ }
+
+ public class RedoAction extends AbstractRTEAction {
+ public RedoAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.redo();
+ fireOnEdit();
+ }
+ }
+
+ public class RemoveFormatAction extends AbstractRTEAction {
+ public RemoveFormatAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.removeFormat();
+ fireOnEdit();
+ }
+ }
+
+ public class RemoveLinkAction extends AbstractRTEAction {
+ public RemoveLinkAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ deferred.addCommand(new Listener0() {
+ public void onEvent() {
+ view.unlink();
+ hideLinkCtxMenu();
+ fireOnEdit();
+ }
+ });
+ }
+ }
+
+ public class SelectAllAction extends AbstractRTEAction {
+ public SelectAllAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.selectAll();
+ }
+ }
+
+ public class StrikethroughAction extends AbstractRTEAction {
+ public StrikethroughAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.toggleStrikethrough();
+ fireOnEdit();
+ }
+ }
+
+ public class SubscriptAction extends AbstractRTEAction {
+ public SubscriptAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.toggleSubscript();
+ fireOnEdit();
+ }
+ }
+
+ public class SuperscriptAction extends AbstractRTEAction {
+ public SuperscriptAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.toggleSuperscript();
+ fireOnEdit();
+ }
+ }
+
+ public class UlAction extends AbstractRTEAction {
+ public UlAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.insertUnorderedList();
+ fireOnEdit();
+ }
+ }
+
+ public class UnderlineAction extends AbstractRTEAction {
+ public UnderlineAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.toggleUnderline();
+ fireOnEdit();
+ }
+ }
+
+ public class UndoAction extends AbstractRTEAction {
+ public UndoAction(final String text, final String tooltip, final ImageResource icon) {
+ super(text, tooltip, icon);
+ }
+
+ public void actionPerformed(final ActionEvent actionEvent) {
+ view.undo();
+ fireOnEdit();
+ }
+ }
+
+ private static final String FONT_NAMES[] = { "Times New Roman", "Arial", "Courier New", "Georgia", "Trebuchet",
+ "Verdana" };
+ private static final String FONT_SIZE_NAMES[] = { "Extra small", "Very small (normal)", "Small", "Medium", "Large",
+ "Very large", "Extra large" };
+ private static final RichTextArea.FontSize[] FONT_SIZES = new RichTextArea.FontSize[] {
+ RichTextArea.FontSize.XX_SMALL, RichTextArea.FontSize.X_SMALL, RichTextArea.FontSize.SMALL,
+ RichTextArea.FontSize.MEDIUM, RichTextArea.FontSize.LARGE, RichTextArea.FontSize.X_LARGE,
+ RichTextArea.FontSize.XX_LARGE };
+
+ private static final String NONE = null;
+ private static final ImageResource NO_ICON = null;
+
+ private transient RTEditorViewNew view;
+ private boolean extended;
+ private final transient I18nTranslationService i18n;
+ private final transient Session session;
+ private final transient RTEImgResources imgResources;
+ private final transient RTEActionTopToolbar topBar;
+ private final transient RTEActionSndToolbar sndBar;
+ private final transient Event0 onEdit;
+ private final transient DeferredCommandWrapper deferred;
+ private final transient Provider<ColorWebSafePalette> paletteProvider;
+ private final transient Provider<InsertLinkDialog> insLinkDialogPv;
+ private final transient Provider<EditHtmlDialog> editHtmlDialogPv;
+ private final transient Provider<InsertImageDialog> insImgDialogProv;
+ private final transient Provider<InsertTableDialog> insTableDialogPv;
+ private final transient Provider<InsertSpecialCharDialog> insCharDialogProv;
+ private final transient Provider<InsertMediaDialog> insMediaDialogPv;
+ private transient Listener<String> insTableListener;
+ private transient Listener<LinkInfo> insLinkListener;
+ private transient Listener<ImageInfo> insImgListener;
+ private transient Listener<String> insMediaListener;
+ private transient Listener<String> updHtmlListener;
+ protected transient Listener<String> insCharListener;
+ protected transient ColorWebSafePalette palette;
+ private transient PushButtonDescriptor bold;
+ private transient PushButtonDescriptor italic;
+ private transient PushButtonDescriptor underline;
+ private transient PushButtonDescriptor strikethrough;
+ private transient final GuiAddCondition basicAddCond;
+ private transient final GuiAddCondition extendedAddCond;
+ private transient final InputMap inputMap;
+ private transient MenuDescriptor editMenu;
+ private transient MenuDescriptor insertMenu;
+ private transient MenuDescriptor formatMenu;
+ private transient MenuDescriptor linkCtxMenu;
+ private transient GuiActionCollection actions;
+ private transient MenuDescriptor fontMenu;
+ private transient MenuDescriptor fontSizeMenu;
+
+ public RTEditorPresenterNew(final I18nTranslationService i18n, final Session session,
+ final RTEActionTopToolbar topBar, final RTEActionSndToolbar sndBar, final RTEImgResources imgResources,
+ final Provider<InsertLinkDialog> insLinkDialog, final Provider<ColorWebSafePalette> palette,
+ final Provider<EditHtmlDialog> editHtmlDialog, final Provider<InsertImageDialog> insertImageDialog,
+ final Provider<InsertMediaDialog> insertMediaDialog, final Provider<InsertTableDialog> insertTableDialog,
+ final Provider<InsertSpecialCharDialog> insCharDialog, final DeferredCommandWrapper deferred) {
+ this.i18n = i18n;
+ this.session = session;
+ this.topBar = topBar;
+ this.sndBar = sndBar;
+ this.insLinkDialogPv = insLinkDialog;
+ this.paletteProvider = palette;
+ this.editHtmlDialogPv = editHtmlDialog;
+ this.insImgDialogProv = insertImageDialog;
+ this.insMediaDialogPv = insertMediaDialog;
+ this.insTableDialogPv = insertTableDialog;
+ this.insCharDialogProv = insCharDialog;
+ this.deferred = deferred;
+ inputMap = new InputMap();
+
+ styleToolbar(sndBar);
+ sndBar.attach();
+ this.imgResources = imgResources;
+ extended = true;
+ this.onEdit = new Event0("onRTEEdit");
+ extendedAddCond = new GuiAddCondition() {
+ public boolean mustBeAdded() {
+ return isExtended();
+ }
+ };
+ basicAddCond = new GuiAddCondition() {
+ public boolean mustBeAdded() {
+ return view.canBeBasic();
+ }
+ };
+ }
+
+ public void addAction(final AbstractGuiActionDescrip descriptor) {
+ actions.add(descriptor);
+ }
+
+ public void addActions(final GuiActionCollection actioncollection) {
+ actions.addAll(actioncollection);
+ }
+
+ public void addOnEditListener(final Listener0 listener) {
+ onEdit.add(listener);
+ }
+
+ public void adjustSize(final int height) {
+ view.adjustSize(height);
+ }
+
+ public void attach() {
+ topBar.clear();
+ sndBar.clear();
+ // FIXME
+ // topBar.addActions(actions, TOPBAR);
+ // sndBar.addActions(actions, SNDBAR);
+ // view.addActions(actions);
+ }
+
+ public void detach() {
+ topBar.clear();
+ sndBar.clear();
+ }
+
+ public void fireOnEdit() {
+ onEdit.fire();
+ }
+
+ public GuiAddCondition getBasicAddCondition() {
+ return basicAddCond;
+ }
+
+ public MenuDescriptor getEditMenu() {
+ return editMenu;
+ }
+
+ public View getEditorArea() {
+ return view;
+ }
+
+ public GuiAddCondition getExtendedAddCondition() {
+ return extendedAddCond;
+ }
+
+ public MenuDescriptor getFormatMenu() {
+ return formatMenu;
+ }
+
+ public String getHtml() {
+ return view.getHTML();
+ }
+
+ public MenuDescriptor getInsertMenu() {
+ return insertMenu;
+ }
+
+ public MenuDescriptor getLinkCtxMenu() {
+ return linkCtxMenu;
+ }
+
+ public ActionToolbar<Object> getSndBar() {
+ return sndBar;
+ }
+
+ public String getText() {
+ return view.getText();
+ }
+
+ public ActionToolbar<Object> getTopBar() {
+ return topBar;
+ }
+
+ public void init(final RTEditorViewNew view) {
+ this.view = view;
+ createMainMenus();
+ createBasicActions();
+ }
+
+ public void onEditorFocus() {
+ hideMenus();
+ }
+
+ public void onLostFocus() {
+ // Nothing for the moment
+ }
+
+ public void reset() {
+ hideMenus();
+ hideLinkCtxMenu();
+ }
+
+ public void setExtended(final boolean extended) {
+ this.extended = extended;
+ }
+
+ public void setFocus(final boolean focus) {
+ view.setFocus(focus);
+ }
+
+ public void setHtml(final String html) {
+ view.setHTML(html);
+ view.focus();
+ }
+
+ public void setText(final String text) {
+ view.setText(text);
+ view.focus();
+ }
+
+ public void updateLinkInfo() {
+ deferred.addCommand(new Listener0() {
+ public void onEvent() {
+ if (isExtended() && view.isLink()) {
+ view.showLinkCtxMenu();
+ } else {
+ hideLinkCtxMenu();
+ }
+ }
+ });
+ }
+
+ public void updateStatus() {
+ if (view.canBeBasic()) {
+ bold.setPushed(view.isBold());
+ italic.setPushed(view.isItalic());
+ underline.setPushed(view.isUnderlined());
+ }
+ if (isExtended()) {
+ strikethrough.setPushed(view.isStrikethrough());
+ }
+ }
+
+ private void crateFontAction(final MenuDescriptor fontMenu, final String fontName) {
+ final FontAction fontAction = new FontAction(fontName, NONE, NO_ICON);
+ final MenuItemDescriptor font = new MenuItemDescriptor(fontMenu, fontAction);
+ font.setAddCondition(basicAddCond);
+ font.setLocation(SNDBAR);
+ actions.add(font);
+ }
+
+ private void createBasicActions() {
+
+ final MenuSeparatorDescriptor editMenuSep = new MenuSeparatorDescriptor(editMenu);
+ final MenuSeparatorDescriptor insertMenuSep = new MenuSeparatorDescriptor(insertMenu);
+ final MenuSeparatorDescriptor formatMenuSep = new MenuSeparatorDescriptor(formatMenu);
+
+ final ToolbarSeparatorDescriptor separator = new ToolbarSeparatorDescriptor(Type.separator);
+
+ final SelectAllAction selectAllAction = new SelectAllAction(i18n.t("Select all"), NONE,
+ imgResources.selectall());
+ final MenuItemDescriptor select = new MenuItemDescriptor(editMenu, selectAllAction);
+ setActionShortcut(KeyStroke.getKeyStroke('A', KeyboardListener.MODIFIER_CTRL), selectAllAction);
+
+ final BoldAction boldAction = new BoldAction(NONE, i18n.t("Bold"), imgResources.bold());
+ bold = new PushButtonDescriptor(boldAction);
+ setActionShortcut(KeyStroke.getKeyStroke('B', KeyboardListener.MODIFIER_CTRL), boldAction);
+
+ final ItalicAction italicAction = new ItalicAction(NONE, i18n.t("Italic"), imgResources.italic());
+ italic = new PushButtonDescriptor(italicAction);
+ setActionShortcut(KeyStroke.getKeyStroke('I', KeyboardListener.MODIFIER_CTRL), italicAction);
+
+ final UnderlineAction underlineAction = new UnderlineAction(NONE, i18n.t("Underline"), imgResources.underline());
+ underline = new PushButtonDescriptor(underlineAction);
+ setActionShortcut(KeyStroke.getKeyStroke('U', KeyboardListener.MODIFIER_CTRL), underlineAction);
+
+ final SubscriptAction subscriptAction = new SubscriptAction(i18n.t("Subscript"), NONE, imgResources.subscript());
+ final MenuItemDescriptor subscript = new MenuItemDescriptor(formatMenu, subscriptAction);
+ setActionShortcut(KeyStroke.getKeyStroke(Keyboard.KEY_COMMA, KeyboardListener.MODIFIER_CTRL), subscriptAction);
+
+ final SuperscriptAction superscriptAction = new SuperscriptAction(i18n.t("Superscript"), NONE,
+ imgResources.superscript());
+ final MenuItemDescriptor superscript = new MenuItemDescriptor(formatMenu, superscriptAction);
+ setActionShortcut(KeyStroke.getKeyStroke(Keyboard.KEY_PERIOD, KeyboardListener.MODIFIER_CTRL),
+ superscriptAction);
+
+ final JustifyLeftAction jfyLeftAction = new JustifyLeftAction(NONE, i18n.t("Left Justify"),
+ imgResources.alignleft());
+ final ButtonDescriptor justifyLeft = new ButtonDescriptor(jfyLeftAction);
+ setActionShortcut(KeyStroke.getKeyStroke('L', KeyboardListener.MODIFIER_CTRL), jfyLeftAction);
+
+ final JustifyCentreAction jfyCentreAction = new JustifyCentreAction(NONE, i18n.t("Centre Justify"),
+ imgResources.centerpara());
+ final ButtonDescriptor justifyCentre = new ButtonDescriptor(jfyCentreAction);
+ setActionShortcut(KeyStroke.getKeyStroke('E', KeyboardListener.MODIFIER_CTRL), jfyCentreAction);
+
+ final JustifyRightAction jfyRightAction = new JustifyRightAction(NONE, i18n.t("Right Justify"),
+ imgResources.alignright());
+ final ButtonDescriptor justifyRight = new ButtonDescriptor(jfyRightAction);
+ setActionShortcut(KeyStroke.getKeyStroke('R', KeyboardListener.MODIFIER_CTRL), jfyRightAction);
+
+ final UndoAction undoAction = new UndoAction(i18n.t("Undo"), NONE, imgResources.undo());
+ final UndoAction undoActionBtn = new UndoAction(NONE, i18n.t("Undo"), imgResources.undo());
+ final MenuItemDescriptor undo = new MenuItemDescriptor(editMenu, undoAction);
+ final ButtonDescriptor undoBtn = new ButtonDescriptor(undoActionBtn);
+ undoBtn.setPosition(0);
+ setActionShortcut(KeyStroke.getKeyStroke(Keyboard.KEY_Z, KeyboardListener.MODIFIER_CTRL), undoAction);
+
+ final RedoAction redoAction = new RedoAction(i18n.t("Redo"), NONE, imgResources.redo());
+ final RedoAction redoActionBtn = new RedoAction(NONE, i18n.t("Redo"), imgResources.redo());
+ final MenuItemDescriptor redo = new MenuItemDescriptor(editMenu, redoAction);
+ final ButtonDescriptor redoBtn = new ButtonDescriptor(redoActionBtn);
+ redoBtn.setPosition(1);
+ setActionShortcut(KeyStroke.getKeyStroke(Keyboard.KEY_Y, KeyboardListener.MODIFIER_CTRL), redoAction);
+
+ final CopyAction copyAction = new CopyAction(i18n.t("Copy"), NONE, imgResources.copy());
+ final MenuItemDescriptor copy = new MenuItemDescriptor(editMenu, copyAction);
+ setActionShortcut(KeyStroke.getKeyStroke(Keyboard.KEY_C, KeyboardListener.MODIFIER_CTRL), copyAction);
+
+ final CutAction cutAction = new CutAction(i18n.t("Cut"), NONE, imgResources.cut());
+ final MenuItemDescriptor cut = new MenuItemDescriptor(editMenu, cutAction);
+ setActionShortcut(KeyStroke.getKeyStroke(Keyboard.KEY_X, KeyboardListener.MODIFIER_CTRL), cutAction);
+
+ final PasteAction pasteAction = new PasteAction(i18n.t("Paste"), NONE, imgResources.paste());
+ final MenuItemDescriptor paste = new MenuItemDescriptor(editMenu, pasteAction);
+ setActionShortcut(KeyStroke.getKeyStroke(Keyboard.KEY_V, KeyboardListener.MODIFIER_CTRL), pasteAction);
+
+ final EditHtmlAction editHtmlAction = new EditHtmlAction(i18n.t("Edit HTML"), NONE, imgResources.edithtml());
+ final MenuItemDescriptor editHtml = new MenuItemDescriptor(editMenu, editHtmlAction);
+ editHtml.setAddCondition(extendedAddCond);
+
+ final CommentAction commentAction = new CommentAction(i18n.t("Comment"), NONE, NO_ICON);
+ final MenuItemDescriptor comment = new MenuItemDescriptor(insertMenu, commentAction);
+ comment.setAddCondition(extendedAddCond);
+ setActionShortcut(KeyStroke.getKeyStroke(Keyboard.KEY_M, KeyboardListener.MODIFIER_CTRL), commentAction);
+
+ final HrAction hlineAction = new HrAction(i18n.t("Horizontal line"), NONE, imgResources.hfixedline());
+ final HrAction hlineBtnAction = new HrAction(NONE, i18n.t("Horizontal line"), imgResources.hfixedline());
+ final MenuItemDescriptor hline = new MenuItemDescriptor(insertMenu, hlineAction);
+ final ButtonDescriptor hlineBtn = new ButtonDescriptor(hlineBtnAction);
+ hline.setAddCondition(extendedAddCond);
+ hlineBtn.setAddCondition(extendedAddCond);
+ setActionShortcut(
+ KeyStroke.getKeyStroke(' ', KeyboardListener.MODIFIER_CTRL & KeyboardListener.MODIFIER_SHIFT),
+ hlineAction);
+
+ final BlockquoteAction blockquoteAction = new BlockquoteAction(i18n.t("Block Quotation"), NONE,
+ imgResources.hfixedline());
+ final MenuItemDescriptor blockquote = new MenuItemDescriptor(formatMenu, blockquoteAction);
+ blockquote.setAddCondition(extendedAddCond);
+
+ final StrikethroughAction strikeAction = new StrikethroughAction(NONE, i18n.t("Strikethrough"),
+ imgResources.strikeout());
+ strikethrough = new PushButtonDescriptor(strikeAction);
+ strikethrough.setAddCondition(extendedAddCond);
+
+ final DecreaseIndentAction decreIndentAction = new DecreaseIndentAction(NONE, i18n.t("Decrease Indent"),
+ imgResources.decrementindent());
+ final ButtonDescriptor decreaseIndent = new ButtonDescriptor(decreIndentAction);
+ decreaseIndent.setAddCondition(extendedAddCond);
+
+ final IncreaseIndentAction increIndentAction = new IncreaseIndentAction(NONE, i18n.t("Increase Indent"),
+ imgResources.incrementindent());
+ final ButtonDescriptor increaseIndent = new ButtonDescriptor(increIndentAction);
+ increaseIndent.setAddCondition(extendedAddCond);
+
+ final OlAction olistAction = new OlAction(NONE, i18n.t("Numbered List"), imgResources.defaultnumbering());
+ final ButtonDescriptor olist = new ButtonDescriptor(olistAction);
+ olist.setAddCondition(extendedAddCond);
+ setActionShortcut(KeyStroke.getKeyStroke(Keyboard.KEY_7, KeyboardListener.MODIFIER_CTRL), olistAction);
+
+ final UlAction ulistAction = new UlAction(NONE, i18n.t("Bullet List"), imgResources.defaultbullet());
+ final ButtonDescriptor ulist = new ButtonDescriptor(ulistAction);
+ ulist.setAddCondition(extendedAddCond);
+ setActionShortcut(KeyStroke.getKeyStroke(Keyboard.KEY_8, KeyboardListener.MODIFIER_CTRL), ulistAction);
+
+ final ImgAction imgAction = new ImgAction(i18n.t("Image..."), NONE, imgResources.images());
+ final ImgAction imgBtnAction = new ImgAction(NONE, i18n.t("Insert Image"), imgResources.images());
+ final MenuItemDescriptor img = new MenuItemDescriptor(insertMenu, imgAction);
+ final ButtonDescriptor imgBtn = new ButtonDescriptor(imgBtnAction);
+ img.setAddCondition(extendedAddCond);
+ imgBtn.setAddCondition(extendedAddCond);
+
+ final InsertMediaAction insertMediaAction = new InsertMediaAction(i18n.t("Audio/Video..."), NONE,
+ imgResources.film());
+ final MenuItemDescriptor insertMedia = new MenuItemDescriptor(insertMenu, insertMediaAction);
+ insertMedia.setAddCondition(extendedAddCond);
+
+ final CreateOrEditLinkAction editLinkAction = new CreateOrEditLinkAction(i18n.t("Link..."), NONE,
+ imgResources.link());
+ final CreateOrEditLinkAction editLinkBtnAction = new CreateOrEditLinkAction(NONE,
+ i18n.t("Create or Edit Link"), imgResources.link());
+ final CreateOrEditLinkAction editLinkCtxAction = new CreateOrEditLinkAction(i18n.t("Change"), NONE,
+ imgResources.link());
+ final MenuItemDescriptor editLink = new MenuItemDescriptor(insertMenu, editLinkAction);
+ final MenuItemDescriptor editLinkCtx = new MenuItemDescriptor(linkCtxMenu, editLinkCtxAction);
+ final ButtonDescriptor editLinkBtn = new ButtonDescriptor(editLinkBtnAction);
+ editLink.setAddCondition(extendedAddCond);
+ editLinkBtn.setAddCondition(extendedAddCond);
+ editLinkCtx.setAddCondition(extendedAddCond);
+ setActionShortcut(KeyStroke.getKeyStroke(Keyboard.KEY_K, KeyboardListener.MODIFIER_CTRL), editLinkAction,
+ editLinkBtnAction);
+
+ final KeyStroke key_K = KeyStroke.getKeyStroke(Keyboard.KEY_K, KeyboardListener.MODIFIER_CTRL
+ & KeyboardListener.MODIFIER_SHIFT);
+ final RemoveLinkAction delLinkBtnAction = new RemoveLinkAction(NONE, i18n.t("Remove Link"),
+ imgResources.linkbreak());
+ final RemoveLinkAction delLinkCtxAction = new RemoveLinkAction(i18n.t("Remove"), NONE, imgResources.linkbreak());
+ final MenuItemDescriptor removeLinkCtx = new MenuItemDescriptor(linkCtxMenu, delLinkCtxAction);
+ final ButtonDescriptor removeLinkBtn = new ButtonDescriptor(delLinkBtnAction);
+ removeLinkBtn.setAddCondition(extendedAddCond);
+ removeLinkCtx.setAddCondition(extendedAddCond);
+ setActionShortcut(key_K, delLinkBtnAction);
+
+ final RemoveFormatAction remFormatAction = new RemoveFormatAction(i18n.t("Clear Formatting..."), NONE,
+ imgResources.removeFormat());
+ final RemoveFormatAction remFormatBtnAc = new RemoveFormatAction(NONE, i18n.t("Clear Formatting..."),
+ imgResources.removeFormat());
+ final MenuItemDescriptor removeFormat = new MenuItemDescriptor(formatMenu, remFormatAction);
+ final ButtonDescriptor removeFormatBtn = new ButtonDescriptor(remFormatBtnAc);
+ removeFormat.setAddCondition(extendedAddCond);
+ removeFormatBtn.setAddCondition(extendedAddCond);
+ setActionShortcut(KeyStroke.getKeyStroke(' ', KeyboardListener.MODIFIER_CTRL), remFormatAction, remFormatBtnAc);
+
+ final InsertSpecialCharAction insCharAction = new InsertSpecialCharAction(i18n.t("Special characters..."),
+ NONE, imgResources.specialchars());
+ final MenuItemDescriptor insertSpecialChar = new MenuItemDescriptor(insertMenu, insCharAction);
+ insertSpecialChar.setAddCondition(extendedAddCond);
+
+ final InsertTableAction insTableAction = new InsertTableAction(i18n.t("Table..."), NONE,
+ imgResources.inserttable());
+ final InsertTableAction insTableBtnAction = new InsertTableAction(NONE, i18n.t("Insert Table"),
+ imgResources.inserttable());
+ final MenuItemDescriptor insertTable = new MenuItemDescriptor(insertMenu, insTableAction);
+ final ButtonDescriptor insertTableBtn = new ButtonDescriptor(insTableBtnAction);
+ insertTable.setAddCondition(extendedAddCond);
+ insertTableBtn.setAddCondition(extendedAddCond);
+
+ final FontColorAction fontColorAction = new FontColorAction(NONE, i18n.t("Text Colour"),
+ imgResources.fontcolor());
+ final ButtonDescriptor fontColor = new ButtonDescriptor(fontColorAction);
+ fontColor.setAddCondition(extendedAddCond);
+
+ final BackgroundColorAction backColorAction = new BackgroundColorAction(NONE, i18n.t("Text Background Colour"),
+ imgResources.backcolor());
+ final ButtonDescriptor backgroundColor = new ButtonDescriptor(backColorAction);
+ backgroundColor.setAddCondition(basicAddCond);
+
+ final DevInfoAction devInfoAction = new DevInfoAction(i18n.t("Developers info"), NONE,
+ imgResources.specialchars());
+ final MenuItemDescriptor devInfo = new MenuItemDescriptor(formatMenu, devInfoAction);
+ devInfo.setAddCondition(extendedAddCond);
+ setActionShortcut(KeyStroke.getKeyStroke(Keyboard.KEY_I, KeyboardListener.MODIFIER_ALT), devInfoAction);
+
+ fontMenu = new MenuDescriptor(NONE, i18n.t("Font"), imgResources.charfontname());
+ fontSizeMenu = new MenuDescriptor(NONE, i18n.t("Font size"), imgResources.fontheight());
+
+ actions = new GuiActionCollection();
+ actions.add(editMenuSep, subscript, superscript, undo, redo, editMenuSep, copy, cut, paste, editMenuSep,
+ select, editHtml, comment, hline, blockquote, img, insertTable, insertMedia, editLink, removeFormat,
+ formatMenuSep, insertMenuSep, insertSpecialChar, insertTable, devInfo, undoBtn, redoBtn, separator,
+ bold, italic, underline, strikethrough, justifyLeft, justifyCentre, justifyRight, undoBtn, redoBtn,
+ hlineBtn, separator, decreaseIndent, increaseIndent, olist, ulist, separator, hlineBtn, imgBtn,
+ editLinkBtn, removeLinkBtn, removeFormatBtn, separator, insertTableBtn, separator, fontColor,
+ backgroundColor);
+
+ setLocation(TOPBAR, new AbstractGuiActionDescrip[] { editMenuSep, subscript, superscript, undo, redo,
+ editMenuSep, copy, cut, paste, editMenuSep, select, editHtml, comment, hline, blockquote, img,
+ insertTable, insertMedia, editLink, removeFormat, formatMenuSep, insertMenuSep, insertSpecialChar,
+ insertTable, devInfo });
+ setLocation(SNDBAR, new AbstractGuiActionDescrip[] { undoBtn, redoBtn, separator, bold, italic, underline,
+ strikethrough, justifyLeft, justifyCentre, justifyRight, undoBtn, redoBtn, hlineBtn, separator,
+ decreaseIndent, increaseIndent, olist, ulist, separator, hlineBtn, imgBtn, editLinkBtn, removeLinkBtn,
+ removeFormatBtn, separator, insertTableBtn, separator, fontColor, backgroundColor });
+ setLocation(LINKCTX, new AbstractGuiActionDescrip[] { editLinkCtx, removeLinkCtx });
+
+ for (final String fontName : FONT_NAMES) {
+ crateFontAction(fontMenu, fontName);
+ }
+
+ for (int fontSize = 0; fontSize < FONT_SIZE_NAMES.length; fontSize++) {
+ createFontSizeAction(fontSizeMenu, fontSize);
+ }
+ }
+
+ private void createFontSizeAction(final MenuDescriptor fontSizeMenu, final int fontSize) {
+ final FontSizeAction fontSizeAction = new FontSizeAction(i18n.t(FONT_SIZE_NAMES[fontSize]), fontSize, NONE,
+ NO_ICON);
+ final MenuItemDescriptor fontSizeItem = new MenuItemDescriptor(fontSizeMenu, fontSizeAction);
+ fontSizeItem.setAddCondition(basicAddCond);
+ setActionShortcut(KeyStroke.getKeyStroke(48 + fontSize, KeyboardListener.MODIFIER_CTRL), fontSizeAction);
+ fontSizeItem.setLocation(SNDBAR);
+ actions.add(fontSizeItem);
+ }
+
+ private void createMainMenus() {
+ editMenu = new MenuDescriptor(i18n.t("Edit"));
+ insertMenu = new MenuDescriptor(i18n.t("Insert"));
+ formatMenu = new MenuDescriptor(i18n.t("Format"));
+ linkCtxMenu = new MenuDescriptor(i18n.t("Change Link"));
+ }
+
+ private void getPalette() {
+ if (palette == null) {
+ palette = paletteProvider.get();
+ }
+ }
+
+ private void hideLinkCtxMenu() {
+ if (view.isCtxMenuVisible()) {
+ view.hideLinkCtxMenu();
+ }
+ }
+
+ private void hideMenus() {
+ topBar.hideAllMenus();
+ sndBar.hideAllMenus();
+ if (palette != null) {
+ palette.hide();
+ }
+ }
+
+ private boolean isExtended() {
+ return extended && view.canBeExtended();
+ }
+
+ private void setActionShortcut(final KeyStroke key, final AbstractAction mainAction,
+ final AbstractAction... actions) {
+ inputMap.put(key, mainAction);
+ mainAction.putValue(Action.ACCELERATOR_KEY, key);
+ for (final AbstractAction action : actions) {
+ action.putValue(Action.ACCELERATOR_KEY, key);
+ }
+ }
+
+ private void setLocation(final String location, final AbstractGuiActionDescrip[] descripts) {
+ for (final AbstractGuiActionDescrip descript : descripts) {
+ descript.setLocation(location);
+ }
+ }
+
+ private void styleToolbar(final ActionToolbar<Object> bar) {
+ bar.setNormalStyle();
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorViewNew.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorViewNew.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorViewNew.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -0,0 +1,127 @@
+package org.ourproject.kune.platf.client.ui.rte.basic;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.ui.rte.RichTextArea.FontSize;
+import org.ourproject.kune.platf.client.ui.rte.insertlink.LinkInfo;
+
+public interface RTEditorViewNew extends View {
+
+ void adjustSize(int height);
+
+ boolean canBeBasic();
+
+ boolean canBeExtended();
+
+ void copy();
+
+ void createLink(String url);
+
+ void cut();
+
+ void delete();
+
+ void focus();
+
+ String getHTML();
+
+ LinkInfo getLinkInfoIfHref();
+
+ void getRangeInfo();
+
+ String getSelectionText();
+
+ String getText();
+
+ void hideLinkCtxMenu();
+
+ void insertBlockquote();
+
+ void insertComment(String author);
+
+ void insertCommentNotUsingSelection(String author);
+
+ void insertCommentUsingSelection(String author);
+
+ void insertHorizontalRule();
+
+ void insertHtml(String html);
+
+ void insertImage(String url);
+
+ void insertOrderedList();
+
+ void insertUnorderedList();
+
+ boolean isAnythingSelected();
+
+ boolean isAttached();
+
+ boolean isBold();
+
+ boolean isCtxMenuVisible();
+
+ boolean isItalic();
+
+ boolean isLink();
+
+ boolean isStrikethrough();
+
+ boolean isSubscript();
+
+ boolean isSuperscript();
+
+ boolean isUnderlined();
+
+ void justifyCenter();
+
+ void justifyLeft();
+
+ void justifyRight();
+
+ void leftIndent();
+
+ void paste();
+
+ void redo();
+
+ void removeFormat();
+
+ void rightIndent();
+
+ void selectAll();
+
+ void selectLink();
+
+ void setBackColor(String color);
+
+ void setFocus(boolean focus);
+
+ void setFontName(String name);
+
+ void setFontSize(FontSize fontSize);
+
+ void setForeColor(String color);
+
+ void setHTML(String html);
+
+ void setText(String text);
+
+ void showLinkCtxMenu();
+
+ void toggleBold();
+
+ void toggleItalic();
+
+ void toggleStrikethrough();
+
+ void toggleSubscript();
+
+ void toggleSuperscript();
+
+ void toggleUnderline();
+
+ void undo();
+
+ void unlink();
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogView.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogView.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -4,5 +4,7 @@
import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogView;
public interface EditHtmlDialogView extends AbstractTabbedDialogView, View {
+
int HEIGHT = 225;
+
}
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-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/RTEImgResources.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -4,116 +4,115 @@
import com.google.gwt.libideas.resources.client.ImageResource;
import com.google.gwt.libideas.resources.client.ImmutableResourceBundle;
+// @PMD:REVIEWED:TooManyMethods: by vjrj on 27/05/09 0:06
public interface RTEImgResources extends ImmutableResourceBundle {
- String SUFFIX = "k-rte-";
-
@Resource("alignleft.png")
- public ImageResource alignleft();
+ ImageResource alignleft();
@Resource("alignright.png")
- public ImageResource alignright();
+ ImageResource alignright();
@Resource("backcolor.png")
- public ImageResource backcolor();
+ ImageResource backcolor();
@Resource("bold.png")
- public ImageResource bold();
+ ImageResource bold();
@Resource("centerpara.png")
- public ImageResource centerpara();
+ ImageResource centerpara();
@Resource("charfontname.png")
- public ImageResource charfontname();
+ ImageResource charfontname();
@Resource("copy.png")
- public ImageResource copy();
+ ImageResource copy();
@Resource("rteimg.css")
- public CssResource css();
+ CssResource css();
@Resource("cut.png")
- public ImageResource cut();
+ ImageResource cut();
@Resource("decrementindent.png")
- public ImageResource decrementindent();
+ ImageResource decrementindent();
@Resource("defaultbullet.png")
- public ImageResource defaultbullet();
+ ImageResource defaultbullet();
@Resource("defaultnumbering.png")
- public ImageResource defaultnumbering();
+ ImageResource defaultnumbering();
@Resource("edithtml.png")
- public ImageResource edithtml();
+ ImageResource edithtml();
@Resource("film.png")
- public ImageResource film();
+ ImageResource film();
@Resource("fontcolor.png")
- public ImageResource fontcolor();
+ ImageResource fontcolor();
@Resource("fontheight.png")
- public ImageResource fontheight();
+ ImageResource fontheight();
@Resource("hfixedline.png")
- public ImageResource hfixedline();
+ ImageResource hfixedline();
@Resource("images.png")
- public ImageResource images();
+ ImageResource images();
@Resource("incrementindent.png")
- public ImageResource incrementindent();
+ ImageResource incrementindent();
@Resource("insertspreadsheet.png")
- public ImageResource insertspreadsheet();
+ ImageResource insertspreadsheet();
@Resource("insertsymbol.png")
- public ImageResource insertsymbol();
+ ImageResource insertsymbol();
@Resource("inserttable.png")
- public ImageResource inserttable();
+ ImageResource inserttable();
@Resource("italic.png")
- public ImageResource italic();
+ ImageResource italic();
@Resource("link.png")
- public ImageResource link();
+ ImageResource link();
@Resource("linkbreak.png")
- public ImageResource linkbreak();
+ ImageResource linkbreak();
@Resource("paste.png")
- public ImageResource paste();
+ ImageResource paste();
@Resource("redo.png")
- public ImageResource redo();
+ ImageResource redo();
@Resource("removeFormat.png")
- public ImageResource removeFormat();
+ ImageResource removeFormat();
@Resource("save.png")
- public ImageResource save();
+ ImageResource save();
@Resource("selectall.png")
- public ImageResource selectall();
+ ImageResource selectall();
@Resource("specialchars.png")
- public ImageResource specialchars();
+ ImageResource specialchars();
@Resource("strikeout.png")
- public ImageResource strikeout();
+ ImageResource strikeout();
@Resource("subscript.png")
- public ImageResource subscript();
+ ImageResource subscript();
@Resource("superscript.png")
- public ImageResource superscript();
+ ImageResource superscript();
@Resource("underline.png")
- public ImageResource underline();
+ ImageResource underline();
@Resource("undo.png")
- public ImageResource undo();
+ ImageResource undo();
}
\ No newline at end of file
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-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/rteimg.css 2009-05-29 23:30:06 UTC (rev 1116)
@@ -1,139 +1,139 @@
- at sprite div .k-rte-underline {
+ at sprite div .k-icon-underline {
gwt-image: 'underline';
}
- at sprite div .k-rte-superscript {
+ at sprite div .k-icon-superscript {
gwt-image: 'superscript';
}
- at sprite div .k-rte-subscript {
+ at sprite div .k-icon-subscript {
gwt-image: 'subscript';
}
- at sprite div .k-rte-film {
+ at sprite div .k-icon-film {
gwt-image: 'film';
}
- at sprite div .k-rte-strikeout {
+ at sprite div .k-icon-strikeout {
gwt-image: 'strikeout';
}
- at sprite div .k-rte-removeFormat {
+ at sprite div .k-icon-removeFormat {
gwt-image: 'removeFormat';
}
- at sprite div .k-rte-link {
+ at sprite div .k-icon-link {
gwt-image: 'link';
}
- at sprite div .k-rte-linkbreak {
+ at sprite div .k-icon-linkbreak {
gwt-image: 'linkbreak';
}
- at sprite div .k-rte-italic {
+ at sprite div .k-icon-italic {
gwt-image: 'italic';
}
- at sprite div .k-rte-incrementindent {
+ at sprite div .k-icon-incrementindent {
gwt-image: 'incrementindent';
}
- at sprite div .k-rte-images {
+ at sprite div .k-icon-images {
gwt-image: 'images';
}
- at sprite div .k-rte-hfixedline {
+ at sprite div .k-icon-hfixedline {
gwt-image: 'hfixedline';
}
- at sprite div .k-rte-fontheight {
+ at sprite div .k-icon-fontheight {
gwt-image: 'fontheight';
}
- at sprite div .k-rte-fontcolor {
+ at sprite div .k-icon-fontcolor {
gwt-image: 'fontcolor';
}
- at sprite div .k-rte-edithtml {
+ at sprite div .k-icon-edithtml {
gwt-image: 'edithtml';
}
- at sprite div .k-rte-defaultnumbering {
+ at sprite div .k-icon-defaultnumbering {
gwt-image: 'defaultnumbering';
}
- at sprite div .k-rte-defaultbullet {
+ at sprite div .k-icon-defaultbullet {
gwt-image: 'defaultbullet';
}
- at sprite div .k-rte-decrementindent {
+ at sprite div .k-icon-decrementindent {
gwt-image: 'decrementindent';
}
- at sprite div .k-rte-charfontname {
+ at sprite div .k-icon-charfontname {
gwt-image: 'charfontname';
}
- at sprite div .k-rte-centerpara {
+ at sprite div .k-icon-centerpara {
gwt-image: 'centerpara';
}
- at sprite div .k-rte-bold {
+ at sprite div .k-icon-bold {
gwt-image: 'bold';
}
- at sprite div .k-rte-backcolor {
+ at sprite div .k-icon-backcolor {
gwt-image: 'backcolor';
}
- at sprite div .k-rte-alignright {
+ at sprite div .k-icon-alignright {
gwt-image: 'alignright';
}
- at sprite div .k-rte-alignleft {
+ at sprite div .k-icon-alignleft {
gwt-image: 'alignleft';
}
- at sprite div .k-rte-specialchars {
+ at sprite div .k-icon-specialchars {
gwt-image: 'specialchars';
}
- at sprite div .k-rte-copy {
+ at sprite div .k-icon-copy {
gwt-image: 'copy';
}
- at sprite div .k-rte-cut {
+ at sprite div .k-icon-cut {
gwt-image: 'cut';
}
- at sprite div .k-rte-insertspreadsheet {
+ at sprite div .k-icon-insertspreadsheet {
gwt-image: 'insertspreadsheet';
}
- at sprite div .k-rte-insertsymbol {
+ at sprite div .k-icon-insertsymbol {
gwt-image: 'insertsymbol';
}
- at sprite div .k-rte-inserttable {
+ at sprite div .k-icon-inserttable {
gwt-image: 'inserttable';
}
- at sprite div .k-rte-paste {
+ at sprite div .k-icon-paste {
gwt-image: 'paste';
}
- at sprite div .k-rte-redo {
+ at sprite div .k-icon-redo {
gwt-image: 'redo';
}
- at sprite div .k-rte-save {
+ at sprite div .k-icon-save {
gwt-image: 'save';
}
- at sprite div .k-rte-selectall {
+ at sprite div .k-icon-selectall {
gwt-image: 'selectall';
}
- at sprite div .k-rte-undo {
+ at sprite div .k-icon-undo {
gwt-image: 'undo';
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ContentPosition.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ContentPosition.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ContentPosition.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -17,7 +17,7 @@
private static Object[][] positionObjs;
- public static Object[][] getPositions() {
+ public synchronized static Object[][] getPositions() {
if (positionObjs == null) {
String[][] values = positions;
positionObjs = new Object[values.length][1];
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialogView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialogView.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialogView.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -3,5 +3,7 @@
import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogView;
public interface InsertSpecialCharDialogView extends AbstractTabbedDialogView {
+
int HEIGHT = 315;
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/occidental/AbstractInsertCharPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/occidental/AbstractInsertCharPanel.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/occidental/AbstractInsertCharPanel.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -18,8 +18,8 @@
private FocusListener focusListener;
- public AbstractInsertCharPanel(final InsertSpecialCharDialog insertSpecialCharDialog, String title,
- String initialLabel, final char[] specialChars, int rows, final int cols) {
+ public AbstractInsertCharPanel(final InsertSpecialCharDialog insertSpecialCharDialog, final String title,
+ final String initialLabel, final char[] specialChars, final int rows, final int cols) {
super(title);
setAutoWidth(true);
setHeight(InsertSpecialCharDialogView.HEIGHT - 10);
@@ -40,8 +40,8 @@
n++;
}
grid.addTableListener(new TableListener() {
- public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
- if (sender == grid) {
+ public void onCellClicked(final SourcesTableEvents sender, final int row, final int cell) {
+ if (sender.equals(grid)) {
insertSpecialCharDialog.onInsert(specialChars[row * cols + cell]);
}
}
@@ -56,7 +56,7 @@
button.setStyleName("k-specialchar-pb");
if (focusListener == null) {
focusListener = new FocusListener() {
- public void onFocus(Widget sender) {
+ public void onFocus(final Widget sender) {
PopupPanel popup = new PopupPanel(true);
popup.setStyleName("k-specialchar-popup");
Label characterLabel = new Label(sender.getElement().getInnerText());
@@ -66,7 +66,7 @@
Log.info("Focus!!!!!");
}
- public void onLostFocus(Widget sender) {
+ public void onLostFocus(final Widget sender) {
}
};
}
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-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -10,6 +10,7 @@
import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor;
import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.ui.img.ImgConstants;
import org.ourproject.kune.platf.client.ui.rte.basic.RTEditor;
import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources;
import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper;
@@ -161,7 +162,7 @@
}
};
saveBtn = new ActionToolbarButtonDescriptor<Object>(AccessRolDTO.Editor, RTEditor.SNDBAR, onPerformSaveCall);
- saveBtn.setIconCls(RTEImgResources.SUFFIX + imgResources.save().getName());
+ saveBtn.setIconCls(ImgConstants.CSS_SUFFIX + imgResources.save().getName());
saveBtn.setToolTip(i18n.t("Save"));
ShortcutDescriptor ctrl_S = new ShortcutDescriptor(true, 'S');
saveBtn.setShortcut(ctrl_S);
@@ -169,7 +170,7 @@
ActionToolbarMenuDescriptor<Object> save = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
RTEditor.TOPBAR, onPerformSaveCall);
- save.setIconCls(RTEImgResources.SUFFIX + imgResources.save().getName());
+ save.setIconCls(ImgConstants.CSS_SUFFIX + imgResources.save().getName());
save.setParentMenuTitle(i18n.t(FILE_DEF_MENU_OPTION));
save.setTextDescription(i18n.t("Save") + (ctrl_S.toString()));
save.setPosition(0);
@@ -217,7 +218,7 @@
ActionToolbarButtonDescriptor<Object> saveCloseBtn = new ActionToolbarButtonDescriptor<Object>(
AccessRolDTO.Editor, RTEditor.TOPBAR, onPerformSaveAndCloseCall);
- // saveCloseBtn.setIconCls(RTEImgResources.SUFFIX +
+ // saveCloseBtn.setIconCls(ImgConstants.CSS_SUFFIX +
// imgResources.save().getName());
saveCloseBtn.setTextDescription(i18n.t("Save & Close"));
saveCloseBtn.setLeftSeparator(ActionToolbarButtonSeparator.fill);
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/TagCount.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/TagCount.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/TagCount.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -21,6 +21,7 @@
public class TagCount {
private String name;
+ // FIXME: try to use Integer
private Long count;
public TagCount() {
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -57,7 +57,7 @@
public static final User UNKNOWN_USER = new User();
public static boolean isKnownUser(final User user) {
- return user != UNKNOWN_USER;
+ return !user.equals(UNKNOWN_USER);
}
@Id
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/FileManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/FileManager.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/FileManager.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -49,6 +49,6 @@
* @param dir
* the directory (use File.separator for dir delimiters)
*/
- void rmdir(String dir) throws IOException;
+ boolean rmdir(String dir) throws IOException;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -78,14 +78,15 @@
File tmpDestFile = File.createTempFile("logoDest", "");
- boolean result = ImageUtilsDefault.scaleImageToMax(origFile.getAbsolutePath(), tmpDestFile.getAbsolutePath(),
- FileConstants.LOGO_ICON_DEFAULT_HEIGHT);
+ final boolean result = ImageUtilsDefault.scaleImageToMax(origFile.getAbsolutePath(),
+ tmpDestFile.getAbsolutePath(), FileConstants.LOGO_DEF_HEIGHT);
+
if (result) {
group.setLogo(FileUtils.getBytesFromFile(tmpDestFile));
group.setLogoMime(mimeType);
- tmpDestFile.delete();
+ logFileDel(tmpDestFile.delete());
} else {
- tmpDestFile.delete();
+ logFileDel(tmpDestFile.delete());
throw new Exception("Cannot create group logo thumb");
}
}
@@ -100,7 +101,7 @@
File tmpOrigFile = File.createTempFile("logoOrig", "");
file.write(tmpOrigFile);
createUploadedFile(stateToken, mimeTypeS, tmpOrigFile);
- tmpOrigFile.delete();
+ logFileDel(tmpOrigFile.delete());
}
/**
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileManagerDefault.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileManagerDefault.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -38,15 +38,18 @@
// 21/05/09 13:15
file = new File(dir, fileNameProposal);
}
- file.createNewFile();
- return file;
+ if (file.createNewFile()) {
+ return file;
+ } else {
+ throw new IOException("Cannot create sequential file name");
+ }
}
public boolean mkdir(final String dir) {
return new File(dir).mkdirs();
}
- public void rmdir(final String dir) throws IOException {
+ public boolean rmdir(final String dir) throws IOException {
final File file = new File(dir);
if (!file.isDirectory()) {
throw new IOException("rmdir: " + dir + ": Not a directory");
@@ -54,6 +57,6 @@
if (file.listFiles().length != 0) {
throw new IOException("rmdir: " + dir + ": Directory not empty");
}
- file.delete();
+ return file.delete();
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -143,7 +143,7 @@
return content;
} catch (final Exception e) {
if (file != null && file.exists()) {
- file.delete();
+ logFileDel(file.delete());
}
throw e;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerAbstract.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerAbstract.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerAbstract.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -77,7 +77,7 @@
final ServletFileUpload upload = new ServletFileUpload(factory);
// maximum size before a FileUploadException will be thrown
- upload.setSizeMax(Integer.valueOf(kuneProperties.get(KuneProperties.UPLOAD_MAX_FILE_SIZE)) * 1024 * 1024);
+ upload.setSizeMax(Long.valueOf(kuneProperties.get(KuneProperties.UPLOAD_MAX_FILE_SIZE)) * 1024 * 1024);
try {
final List fileItems = upload.parseRequest(req);
@@ -131,6 +131,12 @@
response.setStatus(responseCode);
}
+ protected void logFileDel(final boolean delResult) {
+ if (!delResult) {
+ LOG.error("Cannot delete file");
+ }
+ }
+
protected void onFileUploadException(final HttpServletResponse response) throws IOException {
doResponse(response, null);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -205,7 +205,7 @@
if (content.getMimeType().getType().equals("image")) {
group.setGroupFullLogo(content);
} else {
- new DefaultException("Trying to set not a image as group logo");
+ throw new DefaultException("Trying to set not a image as group logo");
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -135,10 +135,10 @@
final I18nLanguage language = languageManager.findByCode(languageId);
final I18nTranslation newTranslation = new I18nTranslation(text, language, translation);
persist(newTranslation);
- if (languageId != I18nTranslation.DEFAULT_LANG) {
+ if (languageId.equals(I18nTranslation.DEFAULT_LANG)) {
+ langCache.clear();
+ } else {
langCache.remove(languageId);
- } else {
- langCache.clear();
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -173,13 +173,15 @@
case anyone:
break;
case onlyyou:
- if (userLogged == User.UNKNOWN_USER || !userLogged.getUserGroup().equals(group)) {
+ if (userLogged.equals(User.UNKNOWN_USER) || !userLogged.getUserGroup().equals(group)) {
socialNetData.setIsBuddiesVisible(false);
socialNetData.setUserBuddies(UserBuddiesData.EMPTY);
}
break;
case yourbuddies:
- if (userLogged != userGroup && !userBuddies.contains(userLogged.getShortName())) {
+ boolean notMe = !userLogged.equals(userGroup);
+ boolean notABuddie = !userBuddies.contains(userLogged.getShortName());
+ if (notMe && notABuddie) {
socialNetData.setIsBuddiesVisible(false);
socialNetData.setUserBuddies(UserBuddiesData.EMPTY);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -137,7 +137,7 @@
final UserBuddiesVisibilityDTO visibility) {
final UserSession userSession = getUserSession();
final User user = userSession.getUser();
- if (groupToken.getGroup() != user.getShortName()) {
+ if (!groupToken.getGroup().equals(user.getShortName())) {
new AccessViolationException();
}
user.setBuddiesVisibility(UserBuddiesVisibility.valueOf(visibility.toString()));
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/DelegatedRemoteServlet.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/DelegatedRemoteServlet.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/DelegatedRemoteServlet.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -41,7 +41,7 @@
@Override
public String processCall(final String payload) throws SerializationException {
try {
- RPCRequest rpcRequest = RPC.decodeRequest(payload, service.getClass());
+ final RPCRequest rpcRequest = RPC.decodeRequest(payload, service.getClass());
return RPC.invokeAndEncodeResponse(service, rpcRequest.getMethod(), rpcRequest.getParameters());
} catch (IncompatibleRemoteServiceException ex) {
return RPC.encodeResponseForFailure(null, ex);
@@ -57,8 +57,8 @@
}
@Override
- protected void doUnexpectedFailure(final Throwable e) {
- e.printStackTrace();
- super.doUnexpectedFailure(e);
+ protected void doUnexpectedFailure(final Throwable except) {
+ except.printStackTrace();
+ super.doUnexpectedFailure(except);
}
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceMessages.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceMessages.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceMessages.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -19,9 +19,12 @@
*/
package org.ourproject.kune.workspace.client;
-public interface WorkspaceMessages {
- String REGISTER_A_NEW_GROUP_TITLE = "Register a new Group";
- String FIELD_MUST_BE_BETWEEN_3_AND_15 = "The name must be between 3 and 15 lowercase characters. It can only contain Western characters, numbers, and dashes";
- String NAME_IN_ALREADY_IN_USE = "This name is already in use. Please try with a different name";
- String REGISTER_TO_CREATE_A_GROUP = "Please, sign in or register to create a group";
+public final class WorkspaceMessages {
+ public final static String REGISTER_A_NEW_GROUP_TITLE = "Register a new Group";
+ public final static String FIELD_MUST_BE_BETWEEN_3_AND_15 = "The name must be between 3 and 15 lowercase characters. It can only contain Western characters, numbers, and dashes";
+ public final static String NAME_IN_ALREADY_IN_USE = "This name is already in use. Please try with a different name";
+ public final static String REGISTER_TO_CREATE_A_GROUP = "Please, sign in or register to create a group";
+
+ private WorkspaceMessages() {
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPresenter.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/cnt/FoldableContentPresenter.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -126,7 +126,7 @@
// This tool
if (stateCntCtx instanceof StateContentDTO) {
setState((StateContentDTO) stateCntCtx);
- } else if (stateCntCtx instanceof StateContainerDTO) {
+ } else {
setState(stateCntCtx);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -72,12 +72,12 @@
final String imageUrl = downloadProvider.get().getImageUrl(stateToken);
Image logo;
if (clipped) {
- logo = new Image(imageUrl, 0, 0, FileConstants.LOGO_ICON_DEFAULT_WIDTH,
- FileConstants.LOGO_ICON_DEFAULT_HEIGHT);
+ logo = new Image(imageUrl, 0, 0, FileConstants.LOGO_DEF_WIDTH,
+ FileConstants.LOGO_DEF_HEIGHT);
} else {
logo = new Image(imageUrl);
- logo.setWidth("" + FileConstants.LOGO_ICON_DEFAULT_WIDTH);
- logo.setHeight("" + FileConstants.LOGO_ICON_DEFAULT_HEIGHT);
+ logo.setWidth("" + FileConstants.LOGO_DEF_WIDTH);
+ logo.setHeight("" + FileConstants.LOGO_DEF_HEIGHT);
}
add(logo);
}
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-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -25,8 +25,8 @@
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.GlobalShortcutRegister;
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;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
@@ -69,7 +69,7 @@
* In the Panel classes we do all the UI stuff (with none business logic)
*
*/
- public class HelloWorldPanel implements HelloWorldView {
+ public static class HelloWorldPanel implements HelloWorldView {
private final I18nTranslationService i18n;
public HelloWorldPanel(final HelloWorldPresenter presenter, final WorkspaceSkeleton ws,
@@ -85,13 +85,13 @@
}
}
- public class HelloWorldPresenter implements HelloWorld {
+ public static class HelloWorldPresenter implements HelloWorld {
private HelloWorldView view;
private final Provider<UserActionRegistry> actionRegistry;
private final I18nTranslationService i18n;
- public HelloWorldPresenter(I18nTranslationService i18n, Provider<UserActionRegistry> actionRegistry) {
+ public HelloWorldPresenter(final I18nTranslationService i18n, final Provider<UserActionRegistry> actionRegistry) {
this.i18n = i18n;
this.actionRegistry = actionRegistry;
createActions();
@@ -101,7 +101,7 @@
return view;
}
- public void init(HelloWorldView view) {
+ public void init(final HelloWorldView view) {
this.view = view;
}
@@ -112,7 +112,7 @@
private void createActions() {
ActionToolbarMenuDescriptor<UserSimpleDTO> helloWorldBuddiesAction = new ActionToolbarMenuDescriptor<UserSimpleDTO>(
AccessRolDTO.Viewer, AbstractFoldableContentActions.CONTENT_TOPBAR, new Listener<UserSimpleDTO>() {
- public void onEvent(UserSimpleDTO parameter) {
+ public void onEvent(final UserSimpleDTO parameter) {
// We clicked:
view.showMessage();
}
@@ -188,7 +188,7 @@
* Optionally: we can do something after the instance is created
**/
@Override
- public void onAfterCreated(HelloWorld instance) {
+ public void onAfterCreated(final HelloWorld instance) {
Log.info("HelloWorld singleton instance created");
}
});
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPanel.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPanel.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -138,7 +138,7 @@
public void setNormalGroupsLabels() {
dialogInfoLabel.setHtml(i18n.t("Select an image in your computer as the logo for this group. "
+ "For best results use a [%d]x[%d] pixel image. We will automatically resize bigger images.",
- FileConstants.LOGO_ICON_DEFAULT_HEIGHT, FileConstants.LOGO_ICON_DEFAULT_HEIGHT)
+ FileConstants.LOGO_DEF_HEIGHT, FileConstants.LOGO_DEF_HEIGHT)
+ DefaultFormUtils.brbr());
super.setTitle(PlatfMessages.ENT_LOGO_SELECTOR_NORMAL_TITLE);
doLayoutIfNeeded();
@@ -147,7 +147,7 @@
public void setPersonalGroupsLabels() {
dialogInfoLabel.setHtml(i18n.t("Select an image in your computer as your avatar. "
+ "For best results use a [%d]x[%d] pixel image. We will automatically resize bigger images.",
- FileConstants.LOGO_ICON_DEFAULT_HEIGHT, FileConstants.LOGO_ICON_DEFAULT_HEIGHT)
+ FileConstants.LOGO_DEF_HEIGHT, FileConstants.LOGO_DEF_HEIGHT)
+ "<br/><br/>");
super.setTitle(PlatfMessages.ENT_LOGO_SELECTOR_PERSON_TITLE);
doLayoutIfNeeded();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateItPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateItPresenter.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateItPresenter.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -46,7 +46,7 @@
public RateItPresenter(final I18nTranslationService i18n, final Session session,
final Provider<ContentServiceAsync> contentServiceProvider, final StateManager stateManager,
- Provider<RatePresenter> ratePresenterProvider, final ContentCapabilitiesRegistry capabilitiesRegistry) {
+ final Provider<RatePresenter> ratePresenterProvider, final ContentCapabilitiesRegistry capabilitiesRegistry) {
this.i18n = i18n;
this.session = session;
this.contentServiceProvider = contentServiceProvider;
@@ -91,7 +91,7 @@
protected void starClicked(final int starClicked) {
isRating = true;
- final Double newValue = starClicked + 1d == currentRate ? currentRate - 0.5d : starClicked + 1d;
+ final Double newValue = Math.abs(starClicked + 1d - currentRate) < 0.01 ? currentRate - 0.5d : starClicked + 1d;
setRatePanel(newValue);
NotifyUser.showProgressProcessing();
final StateAbstractDTO currentState = session.getCurrentState();
@@ -147,7 +147,7 @@
}
}
- private void setState(boolean isRateable, Double currentUserRate) {
+ private void setState(final boolean isRateable, final Double currentUserRate) {
if (isRateable) {
if (session.isLogged()) {
setRate(currentUserRate);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -38,7 +38,7 @@
public static final String ERRMSG = "k-regp-errmsg";
- static RegisterForm registerForm;
+ private static RegisterForm registerForm;
public static final String CANCEL_BUTTON_ID = "k-regp-cb";
public static final String REGISTER_BUTTON_ID = "k-regp-rb";
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -132,7 +132,7 @@
final boolean isPersonal) {
return "<table><tr><td>"
+ (hasLogo ? downloadProvider.get().getLogoAvatarHtml(token, hasLogo, isPersonal,
- FileConstants.LOGO_ICON_DEFAULT_HEIGHT, 3) : "") + "</td><td>"
+ FileConstants.LOGO_DEF_HEIGHT, 3) : "") + "</td><td>"
+ i18n.t(isPersonal ? "Nickname: [%s]" : "Group short name: [%s]", shortName) + "</td></tr></table>";
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -41,9 +41,9 @@
private static final int MINSIZE = 11;
private static final int MAXSIZE = 26;
- private TagsSummaryView view;
- private final Provider<SiteSearcher> searcherProvider;
- private final Session session;
+ private transient TagsSummaryView view;
+ private transient final Provider<SiteSearcher> searcherProvider;
+ private transient final Session session;
public TagsSummaryPresenter(final Session session, final Provider<SiteSearcher> searcherProvider,
final StateManager stateManager, final WsThemePresenter wsThemePresenter) {
@@ -84,6 +84,7 @@
view.expand();
}
+ // @PMD:REVIEWED:DefaultPackage: by vjrj on 27/05/09 3:13
void setState(final StateContainerDTO state) {
if (state.getTagCloudResult() != null && state.getTagCloudResult().getTagCountList().size() > 0) {
Log.debug(state.getTagCloudResult().toString());
@@ -93,15 +94,15 @@
}
}
- private void setCloud(TagCloudResultDTO tagCloudResult) {
+ private void setCloud(final TagCloudResultDTO tagCloudResult) {
// Inspired in snippet http://www.bytemycode.com/snippets/snippet/415/
view.clear();
- int max = tagCloudResult.getMaxValue();
- int min = tagCloudResult.getMinValue();
- int diff = max - min;
- int step = (MAXSIZE - MINSIZE) / (diff == 0 ? 1 : diff);
+ final int max = tagCloudResult.getMaxValue();
+ final int min = tagCloudResult.getMinValue();
+ final int diff = max - min;
+ final int step = (MAXSIZE - MINSIZE) / (diff == 0 ? 1 : diff);
for (TagCountDTO tagCount : tagCloudResult.getTagCountList()) {
- int size = Math.round((MINSIZE + (tagCount.getCount() - min) * step));
+ final int size = Math.round((MINSIZE + (tagCount.getCount().floatValue() - min) * step));
view.addTag(tagCount.getName(), tagCount.getCount(), "kune-ft" + size + "px");
}
view.setVisible(true);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/upload/FileUploaderDialog.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/upload/FileUploaderDialog.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/upload/FileUploaderDialog.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -24,7 +24,6 @@
import org.ourproject.kune.platf.client.ui.noti.NotifyUser;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
@@ -187,7 +186,6 @@
if (dialog == null) {
createDialog(false);
}
- Log.info("PermittedExtensions: " + extensions.toString() + " length: " + extensions.length);
dialog.setPermittedExtensions(extensions);
}
});
Modified: trunk/src/test/java/org/ourproject/kune/rack/filters/rest/TestRESTServiceDefinition.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/rack/filters/rest/TestRESTServiceDefinition.java 2009-05-27 11:44:20 UTC (rev 1115)
+++ trunk/src/test/java/org/ourproject/kune/rack/filters/rest/TestRESTServiceDefinition.java 2009-05-29 23:30:06 UTC (rev 1116)
@@ -28,15 +28,11 @@
public static class SimpleRESTService {
@REST(params = { "one", "two" })
- public void two(final String one, final String two) {
+ public void two(final String one, final String two) {}
- }
-
@REST(params = { "one", "two", "three" })
- public void three(final String one, final String two, final String three) {
+ public void three(final String one, final String two, final String three) {}
- }
-
@REST(params = { "one" })
public void one(final String one) {
}
More information about the kune-commits
mailing list