kune-commits
Threads by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
May 2009
- 1 participants
- 11 discussions
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 @@
+@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 @@
-@sprite div .k-rte-underline {
+@sprite div .k-icon-underline {
gwt-image: 'underline';
}
-@sprite div .k-rte-superscript {
+@sprite div .k-icon-superscript {
gwt-image: 'superscript';
}
-@sprite div .k-rte-subscript {
+@sprite div .k-icon-subscript {
gwt-image: 'subscript';
}
-@sprite div .k-rte-film {
+@sprite div .k-icon-film {
gwt-image: 'film';
}
-@sprite div .k-rte-strikeout {
+@sprite div .k-icon-strikeout {
gwt-image: 'strikeout';
}
-@sprite div .k-rte-removeFormat {
+@sprite div .k-icon-removeFormat {
gwt-image: 'removeFormat';
}
-@sprite div .k-rte-link {
+@sprite div .k-icon-link {
gwt-image: 'link';
}
-@sprite div .k-rte-linkbreak {
+@sprite div .k-icon-linkbreak {
gwt-image: 'linkbreak';
}
-@sprite div .k-rte-italic {
+@sprite div .k-icon-italic {
gwt-image: 'italic';
}
-@sprite div .k-rte-incrementindent {
+@sprite div .k-icon-incrementindent {
gwt-image: 'incrementindent';
}
-@sprite div .k-rte-images {
+@sprite div .k-icon-images {
gwt-image: 'images';
}
-@sprite div .k-rte-hfixedline {
+@sprite div .k-icon-hfixedline {
gwt-image: 'hfixedline';
}
-@sprite div .k-rte-fontheight {
+@sprite div .k-icon-fontheight {
gwt-image: 'fontheight';
}
-@sprite div .k-rte-fontcolor {
+@sprite div .k-icon-fontcolor {
gwt-image: 'fontcolor';
}
-@sprite div .k-rte-edithtml {
+@sprite div .k-icon-edithtml {
gwt-image: 'edithtml';
}
-@sprite div .k-rte-defaultnumbering {
+@sprite div .k-icon-defaultnumbering {
gwt-image: 'defaultnumbering';
}
-@sprite div .k-rte-defaultbullet {
+@sprite div .k-icon-defaultbullet {
gwt-image: 'defaultbullet';
}
-@sprite div .k-rte-decrementindent {
+@sprite div .k-icon-decrementindent {
gwt-image: 'decrementindent';
}
-@sprite div .k-rte-charfontname {
+@sprite div .k-icon-charfontname {
gwt-image: 'charfontname';
}
-@sprite div .k-rte-centerpara {
+@sprite div .k-icon-centerpara {
gwt-image: 'centerpara';
}
-@sprite div .k-rte-bold {
+@sprite div .k-icon-bold {
gwt-image: 'bold';
}
-@sprite div .k-rte-backcolor {
+@sprite div .k-icon-backcolor {
gwt-image: 'backcolor';
}
-@sprite div .k-rte-alignright {
+@sprite div .k-icon-alignright {
gwt-image: 'alignright';
}
-@sprite div .k-rte-alignleft {
+@sprite div .k-icon-alignleft {
gwt-image: 'alignleft';
}
-@sprite div .k-rte-specialchars {
+@sprite div .k-icon-specialchars {
gwt-image: 'specialchars';
}
-@sprite div .k-rte-copy {
+@sprite div .k-icon-copy {
gwt-image: 'copy';
}
-@sprite div .k-rte-cut {
+@sprite div .k-icon-cut {
gwt-image: 'cut';
}
-@sprite div .k-rte-insertspreadsheet {
+@sprite div .k-icon-insertspreadsheet {
gwt-image: 'insertspreadsheet';
}
-@sprite div .k-rte-insertsymbol {
+@sprite div .k-icon-insertsymbol {
gwt-image: 'insertsymbol';
}
-@sprite div .k-rte-inserttable {
+@sprite div .k-icon-inserttable {
gwt-image: 'inserttable';
}
-@sprite div .k-rte-paste {
+@sprite div .k-icon-paste {
gwt-image: 'paste';
}
-@sprite div .k-rte-redo {
+@sprite div .k-icon-redo {
gwt-image: 'redo';
}
-@sprite div .k-rte-save {
+@sprite div .k-icon-save {
gwt-image: 'save';
}
-@sprite div .k-rte-selectall {
+@sprite div .k-icon-selectall {
gwt-image: 'selectall';
}
-@sprite div .k-rte-undo {
+@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) {
}
1
0
Author: vjrj
Date: 2009-05-27 13:44:20 +0200 (Wed, 27 May 2009)
New Revision: 1115
Modified:
trunk/TODO
Log:
Samer comments to UI
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2009-05-26 16:04:44 UTC (rev 1114)
+++ trunk/TODO 2009-05-27 11:44:20 UTC (rev 1115)
@@ -13,13 +13,22 @@
* SHORT-TERM (URGENT)
** New Action class
*** Things to support
-**** [X] menu and toolbars separators (space, bar, expand)
-**** [X] index position insertion (for buttons added by other plugins)
-**** [X] menu button property change (icon, text). If we select a menu option, maybe this require a change in the menu button.
-**** [X] confirmation of actions yes, no.... (confirmation title, text, and onNotConfirmed)
-**** [X] tongle/push buttons with isPressed (initially and later)...
-**** [X] position id, that is, if we have some toolbars and a list of actions, how to select which action in which toolbar.
-**** [X] radio menu (with group) and check menu item
+- [X] menu and toolbars separators (space, bar, expand)
+- [X] index position insertion (for buttons added by other plugins)
+- [X] menu button property change (icon, text). If we select a menu option, maybe this require a change in the menu button.
+- [X] confirmation of actions yes, no.... (confirmation title, text, and onNotConfirmed)
+- [X] tongle/push buttons with isPressed (initially and later)...
+- [X] position id, that is, if we have some toolbars and a list of actions, how to select which action in which toolbar.
+- [X] radio menu (with group) and check menu item
+** <s> Changes in UI
+ - [ ] 2:21 (video) add member dialog with confirmation (other way to do confirmation)
+ - [ ] Leave this group, with green icon
+ - [ ] 2.23 "page 1 de 1"
+ - [ ] "Those who can view..." too long
+ - [ ] cute menus ala https://addons.mozilla.org/es-ES/firefox/addon/1330
+ - [ ] 2:27 (?) icon ...
+ - [ ] 2:35 "Start a chat with this member"-> chat! and other long items
+ - [ ] 2.41 long submenus...
** maven-gwt problem (using another plugin from codehaus)
mvn com.totsp.gwt:maven-googlewebtoolkit2-plugin:compile
and so on.
@@ -144,7 +153,7 @@
- keep always the user informed
- consider integration of chryptopgraphy (keyczar.org ? )
- encourage the use of nicknames; discourage the use of real names (as in Facebook). If a political group uses real names, an undercover would have too much info
- - take into account the rms recommendations about privacy...
+ - take into account the rms recommendations about privacy...
** <v> trash icon area d&d
** vjrj <v> shortcuts enhacement
*** Clarify the keycodes vs utf8 chars Shortcut definition (Function keys and so on...)
@@ -192,8 +201,8 @@
- for ogg :: http://www.flumotion.net/cortado/
http://www.flumotion.net/cortado/
https://code.fluendo.com/flumotion/trac/browser/cortado/trunk/README
- http://en.flossmanuals.net/TheoraCookbook/Cortado
- - for mp3+flv :: flowplayer
+ http://en.flossmanuals.net/TheoraCookbook/Cortado
+ - for mp3+flv :: flowplayer
- for avi :: some links:
http://www.w3schools.com/media/media_browservideos.asp
http://www.solitude.dk/archives/embedquicktime/
@@ -480,7 +489,7 @@
http://creativecommons.org/license/zero/
** TODO <v> Revise use the HP and VP in gwt code
http://groups.google.com/group/Google-Web-Toolkit/browse_frm/thread/5d01cd8…
-** TODO <v> captcha in anonymous comments/edits
+** TODO <v> captcha in anonymous comments/edits
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/99c2…
** TODO <v> Study P2P integration
Study of P2P usage:
@@ -488,7 +497,7 @@
*** torrent
http://en.wikipedia.org/wiki/Torrent_tracker
BT FAQ:
- http://www.dessent.net/btfaq/
+ http://www.dessent.net/btfaq/
mod_bt:
http://www.crackerjack.net/mod_bt/mod_bt.html
apt-cache show libapache2-mod-bt
1
0
26 May '09
Author: vjrj
Date: 2009-05-26 18:04:44 +0200 (Tue, 26 May 2009)
New Revision: 1114
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenu.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/AbstractUIElement.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BaseAction.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/DefaultMenu.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/GuiActionCollection.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/ToolbarSeparatorDescriptor.java
Removed:
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparator.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparator.java
Modified:
trunk/
trunk/TODO
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButton.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.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/ButtonDescriptor.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/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/PushButton.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/ToolbarSeparator.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
trunk/src/main/java/org/ourproject/kune/workspace/client/skel/Toolbar.java
Log:
Incomplete - task New Action class (adapted from Swing) to replace ActionDescription
Property changes on: trunk
___________________________________________________________________
Name: svn:ignore
- www-test
screenlog.0
bin
client
public
target
Main-compile
bin
.settings
.gwt-cache
repository
derby.log
star-yellow-grey.png
run.sh
tomcat
.classpath
gwt-out
synccss.sh
.externalToolBuilders
.project
.wtpmodules
www
testRepository
kune-OLD-jcr
KuneApp.launch
KuneApp NOSERVER.launch
old_src
org.ourproject.kune.app.Kune
org.ourproject.kune.iml
org.ourproject.kune.ipr
org.ourproject.kune.iws
nbproject
hibernate.reveng.xml
.gwt-tmp
target-eclipse
.checkstyle
+ .pmd
www-test
screenlog.0
bin
client
public
target
Main-compile
bin
.settings
.gwt-cache
repository
derby.log
star-yellow-grey.png
run.sh
tomcat
.classpath
gwt-out
synccss.sh
.externalToolBuilders
.project
.wtpmodules
www
testRepository
kune-OLD-jcr
KuneApp.launch
KuneApp NOSERVER.launch
old_src
org.ourproject.kune.app.Kune
org.ourproject.kune.iml
org.ourproject.kune.ipr
org.ourproject.kune.iws
nbproject
hibernate.reveng.xml
.gwt-tmp
target-eclipse
.checkstyle
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2009-05-24 18:56:49 UTC (rev 1113)
+++ trunk/TODO 2009-05-26 16:04:44 UTC (rev 1114)
@@ -128,6 +128,11 @@
** vjrj <v> IconHyperlink.java and IconLabel.java to gwt1.5
* MID-TERM
+** TODO <v> use guice 2.0
+ http://google-code-updates.blogspot.com/2009/05/guice-deuce.html
+ http://code.google.com/docreader/#p=google-guice&s=google-guice
+ http://groups.google.com/group/warp-core
+ when warp-persist also support it
** TODO <v> encourage use of free formats
** TODO <v> study opensocial, openstack and related
http://developer.yahoo.net/blog/archives/2008/12/the_open_stack.html
Modified: 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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButton.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -13,8 +13,13 @@
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
@@ -36,10 +41,6 @@
}
}
- public void setEnableToggle(final boolean enableToggle) {
- button.setEnableToggle(enableToggle);
- }
-
@Override
public void setIcon(final ImageResource imageResource) {
if (imageResource != null) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.java 2009-05-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -1,5 +1,6 @@
package org.ourproject.kune.platf.client.actions.ui;
+import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.actions.Action;
import org.ourproject.kune.platf.client.actions.PropertyChangeEvent;
import org.ourproject.kune.platf.client.actions.PropertyChangeListener;
@@ -7,7 +8,7 @@
import com.google.gwt.libideas.resources.client.ImageResource;
import com.google.gwt.user.client.ui.Composite;
-public abstract class AbstractGuiItem extends Composite {
+public abstract class AbstractGuiItem extends Composite implements View {
protected transient Action action;
Added: 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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenu.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -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 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
Modified: 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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItem.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -4,31 +4,48 @@
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.MenuItem;
+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 final MenuItem item;
+ private transient Item item;
public AbstractMenuItem(final MenuItemDescriptor descriptor) {
super();
- item = new MenuItem();
- initWidget(item);
- item.addListener(new BaseItemListenerAdapter() {
+ 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();
@@ -47,11 +64,21 @@
@Override
protected void setText(final String text) {
- item.setText(text);
+ if (text != null) {
+ item.setText(text);
+ }
}
@Override
protected void setToolTipText(final String text) {
- item.setTitle(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;
+ }
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparator.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparator.java 2009-05-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparator.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -1,16 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-import org.ourproject.kune.platf.client.actions.AbstractAction;
-import org.ourproject.kune.platf.client.actions.ActionEvent;
-
-public class AbstractSeparator extends AbstractUIActionDescriptor {
-
- public AbstractSeparator() {
- super(new AbstractAction() {
- public void actionPerformed(final ActionEvent event) {
- // No action
- }
- });
- }
-
-}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparatorDescriptor.java (from rev 1113, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparator.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparator.java 2009-05-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparatorDescriptor.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -0,0 +1,16 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.AbstractAction;
+import org.ourproject.kune.platf.client.actions.ActionEvent;
+
+public abstract class AbstractSeparatorDescriptor extends AbstractUIActionDescriptor {
+
+ public AbstractSeparatorDescriptor() {
+ super(new AbstractAction() {
+ public void actionPerformed(final ActionEvent event) {
+ // No action
+ }
+ });
+ }
+
+}
Modified: 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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIActionDescriptor.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -1,13 +1,20 @@
package org.ourproject.kune.platf.client.actions.ui;
+import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.actions.AbstractAction;
-// TODO: Auto-generated Javadoc
/**
* The Class AbstractUIActionDescriptor.
*/
-public abstract 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;
@@ -35,6 +42,8 @@
*/
public AbstractUIActionDescriptor(final AbstractAction action) {
this.action = action;
+ position = NO_POSITION;
+ parent = NO_PARENT;
}
/**
@@ -65,6 +74,10 @@
return location;
}
+ public AbstractUIActionDescriptor getParent() {
+ return parent;
+ }
+
/**
* Gets the position.
*
@@ -74,6 +87,14 @@
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.
*
@@ -125,6 +146,10 @@
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).
Added: 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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIElement.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -0,0 +1,42 @@
+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/BaseAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BaseAction.java 2009-05-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/BaseAction.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -0,0 +1,20 @@
+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 com.google.gwt.libideas.resources.client.ImageResource;
+
+public class BaseAction extends AbstractAction {
+ public BaseAction(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 void actionPerformed(final ActionEvent actionEvent) {
+ // Nothing to do
+ }
+}
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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ButtonDescriptor.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -1,5 +1,6 @@
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 {
@@ -7,4 +8,13 @@
public ButtonDescriptor(final AbstractAction action) {
super(action);
}
+
+ @Override
+ public View getView() {
+ if (view == null) {
+ final DefaultButton defaultButton = new DefaultButton(this);
+ view = defaultButton;
+ }
+ return view;
+ }
}
Added: 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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ComplexToolbar.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -0,0 +1,39 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import java.util.List;
+
+import org.ourproject.kune.workspace.client.skel.Toolbar;
+
+import com.google.gwt.user.client.ui.Widget;
+
+public class ComplexToolbar extends AbstractUIElement {
+
+ private final transient Toolbar toolbar;
+
+ public ComplexToolbar() {
+ super();
+ toolbar = new Toolbar();
+ initWidget(toolbar.getPanel());
+ }
+
+ @Override
+ public void add(final AbstractUIActionDescriptor descrip) {
+ super.add(descrip);
+ addWidget(descrip);
+ }
+
+ @Override
+ public void addAll(final List<AbstractUIActionDescriptor> moreItems) {
+ super.addAll(moreItems);
+ for (AbstractUIActionDescriptor item : moreItems) {
+ addWidget(item);
+ }
+ }
+
+ private void addWidget(final AbstractUIActionDescriptor descrip) {
+ final Widget view = (Widget) descrip.getView();
+ if (!descrip.isChild()) {
+ toolbar.add(view);
+ }
+ }
+}
Modified: 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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultButton.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -1,10 +1,12 @@
package org.ourproject.kune.platf.client.actions.ui;
-
public class DefaultButton extends AbstractButton {
- public DefaultButton(final ButtonDescriptor btn) {
- super(btn);
+ public DefaultButton(final ButtonDescriptor buttonDescriptor) {
+ super(buttonDescriptor);
}
+ public DefaultButton(final ButtonDescriptor buttonDescriptor, final boolean enableTongle) {
+ super(buttonDescriptor, enableTongle);
+ }
}
Added: 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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenu.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -0,0 +1,63 @@
+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);
+ }
+}
Added: 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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultSubMenu.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -0,0 +1,50 @@
+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);
+ }
+}
Added: 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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/GuiActionCollection.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -0,0 +1,10 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import java.util.ArrayList;
+
+// @PMD:REVIEWED:AtLeastOneConstructor: by vjrj on 26/05/09 12:31
+public class GuiActionCollection extends ArrayList<AbstractUIActionDescriptor> {
+
+ private static final long serialVersionUID = 6759723760404227737L;
+
+}
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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuCheckItemDescriptor.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -5,7 +5,7 @@
public class MenuCheckItemDescriptor extends MenuItemDescriptor {
private static final String CHECKED = "checked";
- protected transient boolean checked = false;
+ private transient boolean checked = false;
public MenuCheckItemDescriptor(final MenuDescriptor parent, final AbstractAction action) {
super(parent, action);
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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -1,23 +1,56 @@
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.google.gwt.libideas.resources.client.ImageResource;
+
public class MenuDescriptor extends AbstractUIActionDescriptor {
- private static final MenuDescriptor NO_PARENT = null;
- private transient final MenuDescriptor parent;
+ private transient AbstractMenu menu;
public MenuDescriptor(final AbstractAction action) {
this(NO_PARENT, action);
}
- public MenuDescriptor(final MenuDescriptor parent, final AbstractAction action) {
+ public MenuDescriptor(final AbstractUIActionDescriptor parent, final AbstractAction action) {
super(action);
- this.parent = parent;
+ setParent(parent);
}
- public MenuDescriptor getParent() {
- return parent;
+ public MenuDescriptor(final String text, final String tooltip, final ImageResource icon) {
+ this(new BaseAction(text, tooltip, icon));
}
+ public AbstractMenu getMenu() {
+ createIfNeeded();
+ return menu;
+ }
+
+ @Override
+ public View getView() {
+ createIfNeeded();
+ return view;
+ }
+
+ 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();
+ }
+ }
+ }
}
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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemDescriptor.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -1,17 +1,32 @@
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 AbstractUIActionDescriptor {
- private transient final MenuDescriptor parent;
-
public MenuItemDescriptor(final MenuDescriptor parent, final AbstractAction action) {
super(action);
- this.parent = parent;
+ setParent(parent);
}
- public MenuDescriptor getParent() {
- return 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;
}
+
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioDescriptor.java 2009-05-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioDescriptor.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -1,17 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-import org.ourproject.kune.platf.client.actions.AbstractAction;
-
-public class MenuRadioDescriptor extends MenuCheckItemDescriptor {
-
- private transient final String group;
-
- public MenuRadioDescriptor(final MenuDescriptor parent, final AbstractAction action, final String group) {
- super(parent, action);
- this.group = group;
- }
-
- public String getGroup() {
- return group;
- }
-}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioItemDescriptor.java (from rev 1113, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioDescriptor.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioDescriptor.java 2009-05-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioItemDescriptor.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -0,0 +1,17 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.AbstractAction;
+
+public class MenuRadioItemDescriptor extends MenuCheckItemDescriptor {
+
+ private transient final String group;
+
+ public MenuRadioItemDescriptor(final MenuDescriptor parent, final AbstractAction action, final String group) {
+ super(parent, action);
+ this.group = group;
+ }
+
+ public String getGroup() {
+ return group;
+ }
+}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparator.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparator.java 2009-05-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparator.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -1,5 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-// @PMD:REVIEWED:AtLeastOneConstructor: by vjrj on 24/05/09 15:59
-public class MenuSeparator extends AbstractSeparator {
-}
\ No newline at end of file
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparatorDescriptor.java (from rev 1113, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparator.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparator.java 2009-05-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparatorDescriptor.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -0,0 +1,21 @@
+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) {
+ super();
+ setParent(parent);
+ }
+
+ @Override
+ public View getView() {
+ if (view == NO_VIEW) {
+ final AbstractMenu menu = ((MenuDescriptor) getParent()).getMenu();
+ menu.addSeparator();
+ view = menu;
+ }
+ return view;
+ }
+}
\ No newline at end of file
Modified: 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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButton.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -6,8 +6,7 @@
public class PushButton extends DefaultButton {
public PushButton(final PushButtonDescriptor btn) {
- super(btn);
- setEnableToggle(true);
+ super(btn, true);
setPressed(btn.isPushed());
action.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(final PropertyChangeEvent event) {
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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButtonDescriptor.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -1,5 +1,6 @@
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 {
@@ -17,6 +18,15 @@
pushed = button.pushed;
}
+ @Override
+ public View getView() {
+ if (view == null) {
+ final PushButton button = new PushButton(this);
+ view = button;
+ }
+ return view;
+ }
+
public boolean isPushed() {
return pushed;
}
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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -27,21 +27,45 @@
public TestButton(final WorkspaceSkeleton wksp) {
final NotiAction noti = new NotiAction();
- final PushButtonDescriptor descriptor = new PushButtonDescriptor(noti);
+ final PushButtonDescriptor btn = new PushButtonDescriptor(noti);
- final DefaultButton btn = new DefaultButton(descriptor);
+ 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);
+ submenu.setParent(menu);
+ final MenuItemDescriptor item3 = new MenuItemDescriptor(submenu, noti);
+ final MenuCheckItemDescriptor item4 = new MenuCheckItemDescriptor(submenu, noti);
+ item4.setChecked(true);
+ final MenuRadioItemDescriptor item5 = new MenuRadioItemDescriptor(submenu, noti, "new");
+ final MenuRadioItemDescriptor item6 = new MenuRadioItemDescriptor(submenu, noti, "new");
+ item5.setChecked(true);
+ final ComplexToolbar toolbar = new ComplexToolbar();
- wksp.getEntityWorkspace().getBottomTitle().add(btn);
+ toolbar.add(btn);
+ toolbar.add(menu);
+ toolbar.add(item);
+ toolbar.add(new MenuSeparatorDescriptor(menu));
+ toolbar.add(item2);
+ toolbar.add(item3);
+ toolbar.add(item4);
+ toolbar.add(new MenuSeparatorDescriptor(submenu));
+ toolbar.add(item5);
+ toolbar.add(item6);
+ // toolbar.add(new ToolbarSeparatorDescriptor(Type.separator));
+
+ wksp.getEntityWorkspace().getBottomTitle().add(toolbar);
+
new Timer() {
@Override
public void run() {
noti.putValue(Action.NAME, "test2");
noti.putValue(Action.SHORT_DESCRIPTION, "test2 button");
- descriptor.setPushed(false);
+ btn.setPushed(false);
}
}.schedule(10000);
- descriptor.setPushed(true);
+ btn.setPushed(true);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ToolbarSeparator.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ToolbarSeparator.java 2009-05-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ToolbarSeparator.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -1,20 +1,7 @@
package org.ourproject.kune.platf.client.actions.ui;
-public class ToolbarSeparator extends AbstractSeparator {
+public class ToolbarSeparator {
- public enum Type {
- spacer, separator, fill
+ public ToolbarSeparator(final ToolbarSeparatorDescriptor descriptor) {
}
-
- private transient final Type type;
-
- public ToolbarSeparator(final Type type) {
- super();
- this.type = type;
- }
-
- public Type getType() {
- return type;
- }
-
}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ToolbarSeparatorDescriptor.java (from rev 1113, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ToolbarSeparator.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ToolbarSeparator.java 2009-05-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ToolbarSeparatorDescriptor.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -0,0 +1,28 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.View;
+
+public class ToolbarSeparatorDescriptor extends AbstractSeparatorDescriptor {
+
+ public enum Type {
+ spacer, separator, fill
+ }
+
+ private transient final Type type;
+
+ public ToolbarSeparatorDescriptor(final Type type) {
+ super();
+ // setParent(parent);
+ this.type = type;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ @Override
+ public View getView() {
+ return null;
+ }
+
+}
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-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -529,7 +529,7 @@
}
});
- //$(TestButton.class);
+ // $(TestButton.class);
$(ApplicationComponentGroup.class).createAll();
$(ToolGroup.class).createAll();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/skel/Toolbar.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/skel/Toolbar.java 2009-05-24 18:56:49 UTC (rev 1113)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/skel/Toolbar.java 2009-05-26 16:04:44 UTC (rev 1114)
@@ -27,15 +27,16 @@
import com.gwtext.client.widgets.Panel;
public class Toolbar {
- private final Panel container;
- private final HorizontalPanel childPanel;
+ private static final String _100PC = "100%";
+ private transient final Panel container;
+ private transient final HorizontalPanel childPanel;
public Toolbar() {
container = new Panel();
container.setBorder(false);
container.setBodyBorder(false);
container.setHeight(WorkspaceSkeleton.DEF_TOOLBAR_HEIGHT);
- container.setWidth("100%");
+ container.setWidth(_100PC);
container.setHeader(false);
container.setBaseCls("x-toolbar");
container.addClass("x-panel");
@@ -46,8 +47,8 @@
public void add(final Widget widget) {
childPanel.add(widget);
if (widget instanceof SimpleToolbar) {
- widget.setWidth("100%");
- childPanel.setCellWidth(widget, "100%");
+ widget.setWidth(_100PC);
+ childPanel.setCellWidth(widget, _100PC);
}
doLayoutIfNeeded();
}
@@ -55,7 +56,7 @@
public Widget addFill() {
final Label emptyLabel = new Label("");
this.add(emptyLabel);
- childPanel.setCellWidth(emptyLabel, "100%");
+ childPanel.setCellWidth(emptyLabel, _100PC);
return emptyLabel;
}
1
0
24 May '09
Author: vjrj
Date: 2009-05-24 20:56:49 +0200 (Sun, 24 May 2009)
New Revision: 1113
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.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/AbstractSeparator.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/ButtonDescriptor.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/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/MenuRadioDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparator.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButton.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/ToolbarSeparator.java
Removed:
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/CheckButton.java
Modified:
trunk/DEV-GUIDE
trunk/TODO
trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButton.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/TestButton.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
Log:
Incomplete - task New Action class (adapted from Swing) to replace ActionDescription
Modified: trunk/DEV-GUIDE
===================================================================
--- trunk/DEV-GUIDE 2009-05-21 18:31:14 UTC (rev 1112)
+++ trunk/DEV-GUIDE 2009-05-24 18:56:49 UTC (rev 1113)
@@ -172,6 +172,10 @@
Also you have to set the variable M2_REPO (Eclipse Preferences > Java > Build Path > Classpath Variables > New) to the location of your local maven repo (in our case /home/ouruser/.m2/repository).
+Is recommended that you use the PMD plugin:
+http://pmd.sourceforge.net/
+http://pmd.sourceforge.net/eclipse/
+
Useful info about gwt and Eclipse:
http://code.google.com/p/gwt-examples/wiki/gwtEclipseFaqs
@@ -214,6 +218,10 @@
http://docs.codehaus.org/display/PICO/Good+Citizen
+Is recommended that you use the PMD plugin in eclipse:
+http://pmd.sourceforge.net/
+http://pmd.sourceforge.net/eclipse/
+
==Use of mylyn in eclipse==
To use mylyn and to track the kune issues from eclipse, you have to add a "Web Repository" and select "ASM (gforge" with server: http://ourproject.org.
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2009-05-21 18:31:14 UTC (rev 1112)
+++ trunk/TODO 2009-05-24 18:56:49 UTC (rev 1113)
@@ -13,14 +13,13 @@
* SHORT-TERM (URGENT)
** New Action class
*** Things to support
-**** menu and toolbars separators (space, bar, expand)
-**** index position insertion (for buttons added by other plugins)
-**** menu button property change (icon, text). If we select a menu option, maybe this require a change in the menu button.
-**** confirmation of actions yes, no.... (confirmation title, text, and onNotConfirmed)
-**** tongle/push buttons with isPressed (initially and later)...
-**** position id, that is, if we have some toolbars and a list of actions, how to select which action in which toolbar.
-**** radio menu (with group) and check menu item
-
+**** [X] menu and toolbars separators (space, bar, expand)
+**** [X] index position insertion (for buttons added by other plugins)
+**** [X] menu button property change (icon, text). If we select a menu option, maybe this require a change in the menu button.
+**** [X] confirmation of actions yes, no.... (confirmation title, text, and onNotConfirmed)
+**** [X] tongle/push buttons with isPressed (initially and later)...
+**** [X] position id, that is, if we have some toolbars and a list of actions, how to select which action in which toolbar.
+**** [X] radio menu (with group) and check menu item
** maven-gwt problem (using another plugin from codehaus)
mvn com.totsp.gwt:maven-googlewebtoolkit2-plugin:compile
and so on.
@@ -129,6 +128,7 @@
** vjrj <v> IconHyperlink.java and IconLabel.java to gwt1.5
* MID-TERM
+** TODO <v> encourage use of free formats
** TODO <v> study opensocial, openstack and related
http://developer.yahoo.net/blog/archives/2008/12/the_open_stack.html
** TODO <v> Use of command key ⌘ for Mac shortcuts
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java 2009-05-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -1,194 +0,0 @@
-/* ActionMap.java --
- Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package org.ourproject.kune.platf.client.actions;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Maps arbitrary keys (usually Strings) to {@link Action} instances. This is
- * used in combination with {@link InputMap}s.
- *
- * If a component receives an input event, this is looked up in the component's
- * <code>InputMap</code>. The result is an object which serves as a key to the
- * components <code>ActionMap</code>. Finally the <code>Action</code> that is
- * stored is executed.
- *
- * @author Andrew Selkirk
- * @author Adapted version for GWT (C) The kune development team
- * @author Michael Koch
- */
-public class ActionMap {
-
- /**
- * actionMap
- */
- private final Map<Object, Action> actionMap = new HashMap<Object, Action>();
-
- /**
- * parent
- */
- private ActionMap parent;
-
- /**
- * Creates a new <code>ActionMap</code> instance.
- */
- public ActionMap() {
- // Nothing to do here.
- }
-
- /**
- * Returns all keys of entries in this <code>ActionMap</code> and all its
- * parents.
- *
- * @return an array of keys
- */
- // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:03
- public Object[] allKeys() {
- Set<Object> set = new HashSet<Object>();
-
- if (parent != null) {
- set.addAll(Arrays.asList(parent.allKeys()));
- }
-
- set.addAll(actionMap.keySet());
- if (set.size() != 0) {
- return set.toArray();
- }
- return null;
- }
-
- /**
- * Clears the <code>ActionMap</code>.
- */
- public void clear() {
- actionMap.clear();
- }
-
- /**
- * Returns an action associated with an object.
- *
- * @param key
- * the key of the enty
- *
- * @return the action associated with key, may be null
- */
- public Action get(final Object key) {
- Object result = actionMap.get(key);
-
- if (result == null && parent != null) {
- result = parent.get(key);
- }
-
- return (Action) result;
- }
-
- /**
- * Returns the parent of this <code>ActionMap</code>.
- *
- * @return the parent, may be null.
- */
- public ActionMap getParent() {
- return parent;
- }
-
- /**
- * Returns all keys of entries in this <code>ActionMap</code>.
- *
- * @return an array of keys
- */
- // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:03
- public Object[] keys() {
- if (size() != 0) {
- return actionMap.keySet().toArray();
- }
- return null;
- }
-
- /**
- * Puts a new <code>Action</code> into the <code>ActionMap</code>. If action
- * is null an existing entry will be removed.
- *
- * @param key
- * the key for the entry
- * @param action
- * the action.
- */
- public void put(final Object key, final Action action) {
- if (action == null) {
- actionMap.remove(key);
- } else {
- actionMap.put(key, action);
- }
- }
-
- /**
- * Remove an entry from the <code>ActionMap</code>.
- *
- * @param key
- * the key of the entry to remove
- */
- public void remove(final Object key) {
- actionMap.remove(key);
- }
-
- /**
- * Sets a parent for this <code>ActionMap</code>.
- *
- * @param parentMap
- * the new parent
- */
- public void setParent(final ActionMap parentMap) {
- if (parentMap != this) {
- parent = parentMap;
- }
- }
-
- /**
- * Returns the number of entries in this <code>ActionMap</code>.
- *
- * @return the number of entries
- */
- public int size() {
- return actionMap.size();
- }
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java 2009-05-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -85,10 +85,10 @@
* @return An array of keys (may be <code>null</code> or have zero length).
*/
public KeyStroke[] allKeys() {
- Set<KeyStroke> set = new HashSet<KeyStroke>();
+ final Set<KeyStroke> set = new HashSet<KeyStroke>();
if (parent != null) {
- KeyStroke[] parentKeys = parent.allKeys();
+ final KeyStroke[] parentKeys = parent.allKeys();
if (parentKeys != null) {
set.addAll(Arrays.asList(parentKeys));
}
@@ -96,10 +96,10 @@
if (inputMap != null) {
set.addAll(inputMap.keySet());
}
- if (set.size() == 0) {
+ if (set.isEmpty()) {
return null;
}
- KeyStroke[] array = new KeyStroke[set.size()];
+ final KeyStroke[] array = new KeyStroke[set.size()];
return set.toArray(array);
}
@@ -122,8 +122,8 @@
* @return The binding associated with the specified keystroke (or
* <code>null</code>).
*/
- public Object get(final KeyStroke keystroke) {
- Object result = null;
+ public Action get(final KeyStroke keystroke) {
+ Action result = null;
if (inputMap != null) {
result = inputMap.get(keystroke);
}
@@ -161,7 +161,7 @@
// @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:33
public KeyStroke[] keys() {
if (inputMap != null) {
- KeyStroke[] array = new KeyStroke[size()];
+ final KeyStroke[] array = new KeyStroke[size()];
return inputMap.keySet().toArray(array);
}
return null;
Modified: 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-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButton.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -1,59 +1,33 @@
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.PropertyChangeEvent;
-import org.ourproject.kune.platf.client.actions.PropertyChangeListener;
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.Composite;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-public abstract class AbstractButton extends Composite {
+public abstract class AbstractButton extends AbstractGuiItem {
- private Action action;
- private final Button button;
+ private transient final Button button;
- /**
- * Listener the button uses to receive PropertyChangeEvents from its Action.
- */
- PropertyChangeListener actionPropertyChangeListener;
-
- public AbstractButton() {
+ public AbstractButton(final ButtonDescriptor buttonDescriptor) {
+ super();
button = new Button();
initWidget(button);
button.addListener(new ButtonListenerAdapter() {
@Override
- public void onClick(final Button button, final EventObject e) {
+ public void onClick(final Button button, final EventObject event) {
if (action != null) {
- action.actionPerformed(new ActionEvent(button, e.getBrowserEvent()));
+ action.actionPerformed(new ActionEvent(button, event.getBrowserEvent()));
}
}
});
+ setAction(buttonDescriptor.action);
}
- public void setAction(final Action a) {
- if (action != null) {
- action.removePropertyChangeListener(actionPropertyChangeListener);
- // removeActionListener(action);
- if (actionPropertyChangeListener != null) {
- action.removePropertyChangeListener(actionPropertyChangeListener);
- actionPropertyChangeListener = null;
- }
- }
-
- action = a;
- configurePropertiesFromAction(action);
- if (action != null) {
- actionPropertyChangeListener = createActionPropertyChangeListener(a);
- action.addPropertyChangeListener(actionPropertyChangeListener);
- // addActionListener(action);
- }
- }
-
+ @Override
public void setEnabled(final boolean enabled) {
if (enabled) {
button.enable();
@@ -62,6 +36,11 @@
}
}
+ public void setEnableToggle(final boolean enableToggle) {
+ button.setEnableToggle(enableToggle);
+ }
+
+ @Override
public void setIcon(final ImageResource imageResource) {
if (imageResource != null) {
// FIXME
@@ -69,68 +48,20 @@
}
}
+ 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);
}
- protected void configurePropertiesFromAction(final Action a) {
- if (a == null) {
- setText(null);
- setIcon(null);
- setEnabled(true);
- setToolTipText(null);
- } else {
- setText((String) (a.getValue(Action.NAME)));
- setIcon((ImageResource) (a.getValue(Action.SMALL_ICON)));
- setEnabled(a.isEnabled());
- setToolTipText((String) (a.getValue(Action.SHORT_DESCRIPTION)));
- // if (a.getValue(Action.MNEMONIC_KEY) != null) {
- // setMnemonic(((Integer)
- // (a.getValue(Action.MNEMONIC_KEY))).intValue());
- // }
- // String actionCommand = (String)
- // (a.getValue(Action.ACTION_COMMAND_KEY));
- //
- // // Set actionCommand to button's text by default if it is not
- // // specified
- // if (actionCommand != null) {
- // setActionCommand((String)
- // (a.getValue(Action.ACTION_COMMAND_KEY)));
- // } else {
- // setActionCommand(getText());
- // }
- }
- }
-
- protected PropertyChangeListener createActionPropertyChangeListener(final Action a) {
- return new PropertyChangeListener() {
- public void propertyChange(final PropertyChangeEvent e) {
- Action act = (Action) (e.getSource());
- if (e.getPropertyName().equals(Action.ENABLED)) {
- setEnabled(act.isEnabled());
- } else if (e.getPropertyName().equals(Action.NAME)) {
- setText((String) (act.getValue(Action.NAME)));
- } else if (e.getPropertyName().equals(Action.SMALL_ICON)) {
- setIcon((ImageResource) (act.getValue(Action.SMALL_ICON)));
- } else if (e.getPropertyName().equals(Action.SHORT_DESCRIPTION)) {
- setToolTipText((String) (act.getValue(Action.SHORT_DESCRIPTION)));
- }
- // else if (e.getPropertyName().equals(Action.MNEMONIC_KEY)) {
- // if (act.getValue(Action.MNEMONIC_KEY) != null) {
- // setMnemonic(((Integer) (act.getValue(Action.MNEMONIC_KEY)))
- // .intValue());
- // } else if
- // (e.getPropertyName().equals(Action.ACTION_COMMAND_KEY)) {
- // setActionCommand((String)
- // (act.getValue(Action.ACTION_COMMAND_KEY)));
- // }
- // }
- }
- };
- }
-
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.java 2009-05-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractGuiItem.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,107 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.Action;
+import org.ourproject.kune.platf.client.actions.PropertyChangeEvent;
+import org.ourproject.kune.platf.client.actions.PropertyChangeListener;
+
+import com.google.gwt.libideas.resources.client.ImageResource;
+import com.google.gwt.user.client.ui.Composite;
+
+public abstract class AbstractGuiItem extends Composite {
+
+ protected transient Action action;
+
+ /**
+ * Listener the button uses to receive PropertyChangeEvents from its Action.
+ */
+ protected transient PropertyChangeListener changeListener;
+
+ public void setAction(final Action newaction) {
+ if (action != null) {
+ action.removePropertyChangeListener(changeListener);
+ // removeActionListener(action);
+ if (changeListener != null) {
+ action.removePropertyChangeListener(changeListener);
+ // @PMD:REVIEWED:NullAssignment: by vjrj on 24/05/09 20:05
+ changeListener = null;
+ }
+ }
+
+ action = newaction;
+ configurePropertiesFromAction(action);
+ if (action != null) {
+ changeListener = createActionPropertyChangeListener(newaction);
+ action.addPropertyChangeListener(changeListener);
+ // addActionListener(action);
+ }
+ }
+
+ protected void configurePropertiesFromAction(final Action action) {
+ configurePropertiesFromActionImpl(action);
+ }
+
+ protected PropertyChangeListener createActionPropertyChangeListener(final Action action) {
+ return new PropertyChangeListener() {
+ public void propertyChange(final PropertyChangeEvent event) {
+ final Action act = (Action) (event.getSource());
+ if (event.getPropertyName().equals(Action.ENABLED)) {
+ setEnabled(act.isEnabled());
+ } else if (event.getPropertyName().equals(Action.NAME)) {
+ setText((String) (act.getValue(Action.NAME)));
+ } else if (event.getPropertyName().equals(Action.SMALL_ICON)) {
+ setIcon((ImageResource) (act.getValue(Action.SMALL_ICON)));
+ } else if (event.getPropertyName().equals(Action.SHORT_DESCRIPTION)) {
+ setToolTipText((String) (act.getValue(Action.SHORT_DESCRIPTION)));
+ }
+ // else if (e.getPropertyName().equals(Action.MNEMONIC_KEY)) {
+ // if (act.getValue(Action.MNEMONIC_KEY) != null) {
+ // setMnemonic(((Integer) (act.getValue(Action.MNEMONIC_KEY)))
+ // .intValue());
+ // } else if
+ // (e.getPropertyName().equals(Action.ACTION_COMMAND_KEY)) {
+ // setActionCommand((String)
+ // (act.getValue(Action.ACTION_COMMAND_KEY)));
+ // }
+ // }
+ }
+ };
+ }
+
+ protected abstract void setEnabled(boolean enabled);
+
+ protected abstract void setIcon(ImageResource imageResource);
+
+ protected abstract void setText(String text);
+
+ protected abstract void setToolTipText(String text);
+
+ private void configurePropertiesFromActionImpl(final Action action) {
+ if (action == null) {
+ setText(null);
+ setIcon(null);
+ setEnabled(true);
+ setToolTipText(null);
+ } else {
+ setText((String) (action.getValue(Action.NAME)));
+ setIcon((ImageResource) (action.getValue(Action.SMALL_ICON)));
+ setEnabled(action.isEnabled());
+ setToolTipText((String) (action.getValue(Action.SHORT_DESCRIPTION)));
+ // if (a.getValue(Action.MNEMONIC_KEY) != null) {
+ // setMnemonic(((Integer)
+ // (a.getValue(Action.MNEMONIC_KEY))).intValue());
+ // }
+ // String actionCommand = (String)
+ // (a.getValue(Action.ACTION_COMMAND_KEY));
+ //
+ // // Set actionCommand to button's text by default if it is not
+ // // specified
+ // if (actionCommand != null) {
+ // setActionCommand((String)
+ // (a.getValue(Action.ACTION_COMMAND_KEY)));
+ // } else {
+ // setActionCommand(getText());
+ // }
+ }
+ }
+
+}
Added: 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-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractMenuItem.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,57 @@
+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.menu.BaseItem;
+import com.gwtext.client.widgets.menu.MenuItem;
+import com.gwtext.client.widgets.menu.event.BaseItemListenerAdapter;
+
+public abstract class AbstractMenuItem extends AbstractGuiItem {
+
+ private transient final MenuItem item;
+
+ public AbstractMenuItem(final MenuItemDescriptor descriptor) {
+ super();
+ item = new MenuItem();
+ initWidget(item);
+ item.addListener(new BaseItemListenerAdapter() {
+ @Override
+ public void onClick(final BaseItem item, final EventObject event) {
+ if (action != null) {
+ action.actionPerformed(new ActionEvent(item, event.getBrowserEvent()));
+ }
+ }
+ });
+ setAction(descriptor.action);
+ }
+
+ @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) {
+ item.setText(text);
+ }
+
+ @Override
+ protected void setToolTipText(final String text) {
+ item.setTitle(text);
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparator.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparator.java 2009-05-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractSeparator.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,16 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.AbstractAction;
+import org.ourproject.kune.platf.client.actions.ActionEvent;
+
+public class AbstractSeparator extends AbstractUIActionDescriptor {
+
+ public AbstractSeparator() {
+ super(new AbstractAction() {
+ public void actionPerformed(final ActionEvent event) {
+ // No action
+ }
+ });
+ }
+
+}
Added: 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-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractUIActionDescriptor.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,138 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.AbstractAction;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class AbstractUIActionDescriptor.
+ */
+public abstract class AbstractUIActionDescriptor {
+
+ /** 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;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * Gets the position.
+ *
+ * @return the position
+ */
+ public int getPosition() {
+ return position;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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;
+ }
+}
Added: 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-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ButtonDescriptor.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,10 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.AbstractAction;
+
+public class ButtonDescriptor extends AbstractUIActionDescriptor {
+
+ public ButtonDescriptor(final AbstractAction action) {
+ super(action);
+ }
+}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/CheckButton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/CheckButton.java 2009-05-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/CheckButton.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -1,5 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-public class CheckButton {
-
-}
Modified: 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-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultButton.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -1,28 +1,10 @@
package org.ourproject.kune.platf.client.actions.ui;
-import org.ourproject.kune.platf.client.actions.Action;
-import com.google.gwt.libideas.resources.client.ImageResource;
-
public class DefaultButton extends AbstractButton {
- public DefaultButton() {
- }
- public DefaultButton(final Action action) {
- configurePropertiesFromAction(action);
+ public DefaultButton(final ButtonDescriptor btn) {
+ super(btn);
}
- public DefaultButton(final ImageResource icon) {
- setIcon(icon);
- }
-
- public DefaultButton(final String text) {
- setText(text);
- }
-
- public DefaultButton(final String text, final ImageResource icon) {
- setText(text);
- setIcon(icon);
- }
-
}
Added: 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-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenuCheckItem.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,9 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class DefaultMenuCheckItem extends AbstractMenuItem {
+
+ public DefaultMenuCheckItem(final MenuCheckItemDescriptor descriptor) {
+ super(descriptor);
+ }
+
+}
Added: 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-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultMenuItem.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,9 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class DefaultMenuItem extends AbstractMenuItem {
+
+ public DefaultMenuItem(final MenuItemDescriptor descriptor) {
+ super(descriptor);
+ }
+
+}
Added: 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-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuCheckItemDescriptor.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,25 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.AbstractAction;
+
+public class MenuCheckItemDescriptor extends MenuItemDescriptor {
+ private static final String CHECKED = "checked";
+
+ protected transient boolean checked = false;
+
+ public MenuCheckItemDescriptor(final MenuDescriptor parent, final AbstractAction action) {
+ super(parent, action);
+ }
+
+ public boolean isChecked() {
+ return checked;
+ }
+
+ public void setChecked(final boolean checked) {
+ if (checked != this.checked) {
+ this.checked = checked;
+ action.putValue(CHECKED, this.checked);
+ }
+ }
+
+}
Added: 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-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuDescriptor.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,23 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.AbstractAction;
+
+public class MenuDescriptor extends AbstractUIActionDescriptor {
+
+ private static final MenuDescriptor NO_PARENT = null;
+ private transient final MenuDescriptor parent;
+
+ public MenuDescriptor(final AbstractAction action) {
+ this(NO_PARENT, action);
+ }
+
+ public MenuDescriptor(final MenuDescriptor parent, final AbstractAction action) {
+ super(action);
+ this.parent = parent;
+ }
+
+ public MenuDescriptor getParent() {
+ return parent;
+ }
+
+}
Added: 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-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuItemDescriptor.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,17 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.AbstractAction;
+
+public class MenuItemDescriptor extends AbstractUIActionDescriptor {
+
+ private transient final MenuDescriptor parent;
+
+ public MenuItemDescriptor(final MenuDescriptor parent, final AbstractAction action) {
+ super(action);
+ this.parent = parent;
+ }
+
+ public MenuDescriptor getParent() {
+ return parent;
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuRadioDescriptor.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,17 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.AbstractAction;
+
+public class MenuRadioDescriptor extends MenuCheckItemDescriptor {
+
+ private transient final String group;
+
+ public MenuRadioDescriptor(final MenuDescriptor parent, final AbstractAction action, final String group) {
+ super(parent, action);
+ this.group = group;
+ }
+
+ public String getGroup() {
+ return group;
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparator.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparator.java 2009-05-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/MenuSeparator.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,5 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+// @PMD:REVIEWED:AtLeastOneConstructor: by vjrj on 24/05/09 15:59
+public class MenuSeparator extends AbstractSeparator {
+}
\ No newline at end of file
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButton.java (from rev 1112, trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/CheckButton.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/CheckButton.java 2009-05-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButton.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,21 @@
+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);
+ setEnableToggle(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/PushButtonDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButtonDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/PushButtonDescriptor.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,30 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.AbstractAction;
+
+public class PushButtonDescriptor extends ButtonDescriptor {
+
+ public static final String PUSHED = "pushed";
+
+ protected transient boolean pushed = false;
+
+ public PushButtonDescriptor(final AbstractAction action) {
+ super(action);
+ }
+
+ public PushButtonDescriptor(final PushButtonDescriptor button) {
+ super(button.action);
+ pushed = button.pushed;
+ }
+
+ public boolean isPushed() {
+ return pushed;
+ }
+
+ public void setPushed(final boolean pushed) {
+ if (pushed != this.pushed) {
+ this.pushed = pushed;
+ action.putValue(PUSHED, this.pushed);
+ }
+ }
+}
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-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -8,9 +8,10 @@
import com.google.gwt.user.client.Timer;
-public class TestButton extends DefaultButton {
+public class TestButton {
public class NotiAction extends AbstractAction {
public NotiAction() {
+ super();
super.putValue(Action.NAME, "test");
super.putValue(Action.SHORT_DESCRIPTION, "test button");
}
@@ -21,24 +22,26 @@
}
NotifyUser.info("Button clicked");
}
-
- @Override
- public boolean isEnabled() {
- return super.isEnabled();
- }
}
- public TestButton(final WorkspaceSkeleton ws) {
- super();
- ws.getEntityWorkspace().getBottomTitle().add(this);
+ public TestButton(final WorkspaceSkeleton wksp) {
final NotiAction noti = new NotiAction();
- super.setAction(noti);
+
+ final PushButtonDescriptor descriptor = new PushButtonDescriptor(noti);
+
+ final DefaultButton btn = new DefaultButton(descriptor);
+
+ wksp.getEntityWorkspace().getBottomTitle().add(btn);
new Timer() {
@Override
public void run() {
noti.putValue(Action.NAME, "test2");
noti.putValue(Action.SHORT_DESCRIPTION, "test2 button");
+ descriptor.setPushed(false);
}
- }.schedule(5000);
+ }.schedule(10000);
+
+ descriptor.setPushed(true);
+
}
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ToolbarSeparator.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ToolbarSeparator.java 2009-05-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ToolbarSeparator.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -0,0 +1,20 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class ToolbarSeparator extends AbstractSeparator {
+
+ public enum Type {
+ spacer, separator, fill
+ }
+
+ private transient final Type type;
+
+ public ToolbarSeparator(final Type type) {
+ super();
+ this.type = type;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+}
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-21 18:31:14 UTC (rev 1112)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java 2009-05-24 18:56:49 UTC (rev 1113)
@@ -258,10 +258,6 @@
public Application create() {
return new ApplicationDefault($(Session.class));
}
-
- @Override
- public void onAfterCreated(final Application instance) {
- }
});
register(Singleton.class, new Factory<DeferredCommandWrapper>(DeferredCommandWrapper.class) {
@@ -338,8 +334,8 @@
register(NoDecoration.class, new Factory<RTEditor>(RTEditor.class) {
@Override
public RTEditor create() {
- RTEActionTopToolbar topBar = $(RTEActionTopToolbar.class);
- RTEActionSndToolbar sndBar = $(RTEActionSndToolbar.class);
+ final RTEActionTopToolbar topBar = $(RTEActionTopToolbar.class);
+ final RTEActionSndToolbar sndBar = $(RTEActionSndToolbar.class);
final RTEditorPresenter presenter = new RTEditorPresenter($(I18nTranslationService.class),
$(Session.class), topBar, sndBar, $(RTEImgResources.class), $$(InsertLinkDialog.class),
$$(ColorWebSafePalette.class), $$(EditHtmlDialog.class), $$(InsertImageDialog.class),
@@ -352,10 +348,10 @@
}, new Factory<RTESavingEditor>(RTESavingEditor.class) {
@Override
public RTESavingEditor create() {
- RTESavingEditorPresenter presenter = new RTESavingEditorPresenter($(RTEditor.class), true,
+ final RTESavingEditorPresenter presenter = new RTESavingEditorPresenter($(RTEditor.class), true,
$(I18nTranslationService.class), $(StateManager.class), $(DeferredCommandWrapper.class),
$(RTEImgResources.class), $(TimerWrapper.class));
- RTESavingEditorPanel panel = new RTESavingEditorPanel();
+ final RTESavingEditorPanel panel = new RTESavingEditorPanel();
presenter.init(panel);
return presenter;
}
@@ -378,7 +374,7 @@
register(Singleton.class, new Factory<RTEImgResources>(RTEImgResources.class) {
@Override
public RTEImgResources create() {
- RTEImgResources instance = GWT.create(RTEImgResources.class);
+ final RTEImgResources instance = GWT.create(RTEImgResources.class);
StyleInjector.injectStylesheet(instance.css().getText());
return instance;
}
1
0
Author: vjrj
Date: 2009-05-21 20:31:14 +0200 (Thu, 21 May 2009)
New Revision: 1112
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/CheckButton.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/UIException.java
trunk/src/main/java/org/ourproject/kune/platf/server/ServerException.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/ServerManagerException.java
trunk/src/main/java/org/ourproject/kune/rack/filters/AbstractInjectedFilter.java
Removed:
trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationService.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationServiceMocked.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java
trunk/src/main/java/org/ourproject/kune/rack/filters/InjectedFilter.java
Modified:
trunk/TODO
trunk/src/main/java/org/ourproject/kune/app/server/AbstractExtendedModule.java
trunk/src/main/java/org/ourproject/kune/app/server/KuneContainerListener.java
trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java
trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java
trunk/src/main/java/org/ourproject/kune/chat/server/managers/RoomConfigurationDumper.java
trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractAction.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuCheckItemDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuRadioDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPushButtonDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRightsDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/ContainerSimpleDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/I18nCountryDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDataDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateTokenUtils.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserBuddiesDataDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserSimpleDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/i18n/I18nTranslationService.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/ErrorHandler.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/LabelWrapper.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/RoundedPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDropConfiguration.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridGroup.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/AbstractPalettePanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImpl.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplSafari.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplStandard.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/LinkInfo.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8/InsertSpecialUTF8CharPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/inserttable/InsertTableDialogPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/utils/Convert.java
trunk/src/main/java/org/ourproject/kune/platf/client/utils/Url.java
trunk/src/main/java/org/ourproject/kune/platf/server/KunePersistenceService.java
trunk/src/main/java/org/ourproject/kune/platf/server/LoggerMethodInterceptor.java
trunk/src/main/java/org/ourproject/kune/platf/server/OutermostCallInterceptor.java
trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRights.java
trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java
trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentUtils.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java
trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.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/FileDownloadManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileJsonUploadManagerAbstract.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/file/FileUtils.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.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/manager/impl/UserManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/properties/KunePropertiesDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java
trunk/src/main/java/org/ourproject/kune/platf/server/sn/UserBuddiesData.java
trunk/src/main/java/org/ourproject/kune/platf/server/utils/StringW.java
trunk/src/main/java/org/ourproject/kune/platf/server/utils/XmlW.java
trunk/src/main/java/org/ourproject/kune/rack/Rack.java
trunk/src/main/java/org/ourproject/kune/rack/RackHelper.java
trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/ForwardFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/ListenerFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/rest/DefaultRESTMethodFinder.java
trunk/src/main/java/org/ourproject/kune/rack/filters/rest/JSONLibRESTSerializer.java
trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTMethod.java
trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTServiceFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/servlet/ServletServiceFilter.java
trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java
trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java
trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java
trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RatePanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/rate/Star.java
trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitepublic/SitePublicSpaceLinkPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/title/RenameAction.java
trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenter.java
trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionShortcutTest.java
trunk/src/test/java/org/ourproject/kune/platf/client/state/StateTokenTest.java
trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenterTest.java
trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java
trunk/src/test/java/org/ourproject/kune/platf/integration/HttpServletRequestMocked.java
trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java
trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java
trunk/src/test/java/org/ourproject/kune/platf/server/PersistencePreLoadedDataTest.java
trunk/src/test/java/org/ourproject/kune/platf/server/TestDomainHelper.java
trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java
trunk/src/test/java/org/ourproject/kune/platf/server/manager/I18nManagerTest.java
Log:
Several PMD error/warning fixes
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/TODO 2009-05-21 18:31:14 UTC (rev 1112)
@@ -11,6 +11,16 @@
Use org-mode in emacs to easy manage this file
* SHORT-TERM (URGENT)
+** New Action class
+*** Things to support
+**** menu and toolbars separators (space, bar, expand)
+**** index position insertion (for buttons added by other plugins)
+**** menu button property change (icon, text). If we select a menu option, maybe this require a change in the menu button.
+**** confirmation of actions yes, no.... (confirmation title, text, and onNotConfirmed)
+**** tongle/push buttons with isPressed (initially and later)...
+**** position id, that is, if we have some toolbars and a list of actions, how to select which action in which toolbar.
+**** radio menu (with group) and check menu item
+
** maven-gwt problem (using another plugin from codehaus)
mvn com.totsp.gwt:maven-googlewebtoolkit2-plugin:compile
and so on.
@@ -119,6 +129,8 @@
** vjrj <v> IconHyperlink.java and IconLabel.java to gwt1.5
* MID-TERM
+** TODO <v> study opensocial, openstack and related
+ http://developer.yahoo.net/blog/archives/2008/12/the_open_stack.html
** TODO <v> Use of command key ⌘ for Mac shortcuts
** TODO <v,s> harden our privacy policy. Goals:
- permit user/projects/contents how much private or public are
@@ -127,6 +139,7 @@
- keep always the user informed
- consider integration of chryptopgraphy (keyczar.org ? )
- encourage the use of nicknames; discourage the use of real names (as in Facebook). If a political group uses real names, an undercover would have too much info
+ - take into account the rms recommendations about privacy...
** <v> trash icon area d&d
** vjrj <v> shortcuts enhacement
*** Clarify the keycodes vs utf8 chars Shortcut definition (Function keys and so on...)
@@ -464,6 +477,21 @@
http://groups.google.com/group/Google-Web-Toolkit/browse_frm/thread/5d01cd8…
** TODO <v> captcha in anonymous comments/edits
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/99c2…
+** TODO <v> Study P2P integration
+ Study of P2P usage:
+ http://torrentfreak.com/p2p-traffic-still-booming-071128/
+*** torrent
+ http://en.wikipedia.org/wiki/Torrent_tracker
+ BT FAQ:
+ http://www.dessent.net/btfaq/
+ mod_bt:
+ http://www.crackerjack.net/mod_bt/mod_bt.html
+ apt-cache show libapache2-mod-bt
+ http://mail.milwaukeelug.org/wws/arc/mlug-list/2007-10/msg00119.html
+
+ http://hightechsorcery.com/2008/02/bittorrent-tracker-debian-and-ubuntu
+ http://erdgeist.org/arts/software/opentracker/
+ http://torrentfreak.com/the-pirate-bay-switches-to-opentracker-071208/
* LONG-TERM
** <s> integrate some blog/wiki converter:
http://code.google.com/p/google-blog-converters-appengine/
Modified: trunk/src/main/java/org/ourproject/kune/app/server/AbstractExtendedModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/server/AbstractExtendedModule.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/app/server/AbstractExtendedModule.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -49,6 +49,24 @@
public abstract class AbstractExtendedModule extends AbstractModule {
/**
+ * Hack to ensure unique Keys for binding different instances of
+ * ExtendedModule. The prefix is chosen to reduce the chances of a conflict
+ * with some other use of
+ *
+ * @Named. A better solution would be to invent an Annotation for just this
+ * purpose.
+ */
+ private static Annotation getUniqueAnnotation() {
+ return named("ExtendedModule-" + COUNT.incrementAndGet());
+ }
+
+ private final Set<Object> toBeInjected = new HashSet<Object>();
+
+ private boolean selfInjected = false;
+
+ private static final AtomicInteger COUNT = new AtomicInteger();
+
+ /**
* Overridden version of bindInterceptor that, in addition to the standard
* behavior, arranges for field and method injection of each
* MethodInterceptor in {@code interceptors}.
@@ -77,6 +95,13 @@
}
}
+ private void ensureSelfInjection() {
+ if (!selfInjected) {
+ bind(AbstractExtendedModule.class).annotatedWith(getUniqueAnnotation()).toInstance(this);
+ selfInjected = true;
+ }
+ }
+
@SuppressWarnings("unused")
@Inject
private void injectRegisteredObjects(final Injector injector) {
@@ -84,29 +109,4 @@
injector.injectMembers(injectee);
}
}
-
- private void ensureSelfInjection() {
- if (!selfInjectionInitialized) {
- bind(AbstractExtendedModule.class).annotatedWith(getUniqueAnnotation()).toInstance(this);
- selfInjectionInitialized = true;
- }
- }
-
- private final Set<Object> toBeInjected = new HashSet<Object>();
-
- private boolean selfInjectionInitialized = false;
-
- /**
- * Hack to ensure unique Keys for binding different instances of
- * ExtendedModule. The prefix is chosen to reduce the chances of a conflict
- * with some other use of
- *
- * @Named. A better solution would be to invent an Annotation for just this
- * purpose.
- */
- private static Annotation getUniqueAnnotation() {
- return named("ExtendedModule-" + count.incrementAndGet());
- }
-
- private static final AtomicInteger count = new AtomicInteger();
}
Modified: trunk/src/main/java/org/ourproject/kune/app/server/KuneContainerListener.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/server/KuneContainerListener.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/app/server/KuneContainerListener.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -19,7 +19,7 @@
*/
/**
- *
+ *
\*/
package org.ourproject.kune.app.server;
@@ -41,11 +41,12 @@
KunePersistenceService persistenceService;
ServerToolRegistry toolRegistry;
DocumentServerTool documentTool;
+ // @PMD:REVIEWED:LoggerIsNotStaticFinal: by vjrj on 21/05/09 16:55
Logger logger;
@Inject
- public KuneContainerListener(KunePersistenceService persistenceService, ServerToolRegistry toolRegistry,
- DocumentServerTool documentTool, Logger logger) {
+ public KuneContainerListener(final KunePersistenceService persistenceService,
+ final ServerToolRegistry toolRegistry, final DocumentServerTool documentTool, final Logger logger) {
this.persistenceService = persistenceService;
this.toolRegistry = toolRegistry;
this.documentTool = documentTool;
@@ -57,9 +58,14 @@
logger.log(Level.INFO, "starting Kune...");
toolRegistry.register(documentTool);
persistenceService.start();
- logger.log(Level.INFO, "started");
+ logger.log(Level.INFO, "Kune server started");
}
+ public void stop() {
+ logger.log(Level.INFO, "stoping Kune...");
+ logger.log(Level.INFO, "Kune server stoped");
+ }
+
private void configureLog4j() {
try {
Properties properties = new Properties();
@@ -71,9 +77,4 @@
e.printStackTrace();
}
}
-
- public void stop() {
- logger.log(Level.INFO, "stoping Kune...");
- logger.log(Level.INFO, "stoped");
- }
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -104,4 +104,8 @@
createDelContentAction(parentMenuTitle, i18n.t("Delete"), contents);
createShowDeletedItems(parentMenuTitleCtx, all);
}
+
+ @Override
+ protected void createPostSessionInitActions() {
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -35,8 +35,8 @@
public BlogClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,
- ContentCapabilitiesRegistry contentCapabilitiesRegistry) {
- super(NAME, i18n.t("blogs"), toolSelector, wsThemePresenter, ws, contentCapabilitiesRegistry);
+ final ContentCapabilitiesRegistry cntCapReg) {
+ super(NAME, i18n.t("blogs"), toolSelector, wsThemePresenter, ws, cntCapReg);
// registerAclEditableTypes();
registerAuthorableTypes(TYPE_POST, TYPE_UPLOADEDFILE);
@@ -55,7 +55,7 @@
return NAME;
}
- protected void registerIcons() {
+ private void registerIcons() {
registerContentTypeIcon(TYPE_BLOG, "images/nav/blog.png");
registerContentTypeIcon(TYPE_POST, "images/nav/post.png");
registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
Modified: trunk/src/main/java/org/ourproject/kune/chat/server/managers/RoomConfigurationDumper.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/server/managers/RoomConfigurationDumper.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/chat/server/managers/RoomConfigurationDumper.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -21,6 +21,8 @@
import java.util.Iterator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.Form;
import org.jivesoftware.smackx.FormField;
@@ -28,6 +30,8 @@
class RoomConfigurationDumper {
+ private static final Log LOG = LogFactory.getLog(RoomConfigurationDumper.class);
+
public static void showConfiguration(final Form form) {
for (Iterator<FormField> fields = form.getFields(); fields.hasNext();) {
FormField formField = fields.next();
@@ -50,7 +54,7 @@
}
private static void log(final String string) {
- System.out.println(string);
+ LOG.debug(string);
}
void configure2(final MultiUserChat muc) throws XMPPException {
Modified: trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -44,7 +44,7 @@
@Singleton
public class XmppManagerDefault implements XmppManager {
- public static final Log log = LogFactory.getLog(XmppManagerDefault.class);
+ public static final Log LOG = LogFactory.getLog(XmppManagerDefault.class);
private final ChatProperties chatProperties;
@@ -136,7 +136,7 @@
String userJid = userName + "@" + chatProperties.getDomain();
Chat newChat = xmppConn.getChatManager().createChat(userJid, new MessageListener() {
public void processMessage(final Chat arg0, final Message arg1) {
- log.info("Sended message: " + text);
+ LOG.info("Sended message: " + text);
}
});
try {
@@ -146,7 +146,7 @@
message.setBody(text);
newChat.sendMessage(message);
} catch (Exception e) {
- log.error("Error Delivering xmpp message to " + userName);
+ LOG.error("Error Delivering xmpp message to " + userName);
}
xmppConn.disconnect();
}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -35,8 +35,8 @@
public DocumentClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,
- ContentCapabilitiesRegistry contentCapabilitiesRegistry) {
- super(NAME, i18n.t("documents"), toolSelector, wsThemePresenter, ws, contentCapabilitiesRegistry);
+ final ContentCapabilitiesRegistry cntCapRegistry) {
+ super(NAME, i18n.t("documents"), toolSelector, wsThemePresenter, ws, cntCapRegistry);
// registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
registerAuthorableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
@@ -55,7 +55,7 @@
return NAME;
}
- protected void registerIcons() {
+ private void registerIcons() {
registerContentTypeIcon(TYPE_FOLDER, "images/nav/folder.png");
registerContentTypeIcon(TYPE_DOCUMENT, "images/nav/page.png");
registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -34,8 +34,8 @@
public GalleryClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,
- ContentCapabilitiesRegistry contentCapabilitiesRegistry) {
- super(NAME, i18n.t("gallery"), toolSelector, wsThemePresenter, ws, contentCapabilitiesRegistry);
+ final ContentCapabilitiesRegistry cntCapabReg) {
+ super(NAME, i18n.t("gallery"), toolSelector, wsThemePresenter, ws, cntCapabReg);
// registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
registerAuthorableTypes(TYPE_UPLOADEDFILE);
@@ -54,7 +54,7 @@
return NAME;
}
- protected void registerIcons() {
+ private void registerIcons() {
registerContentTypeIcon(TYPE_ALBUM, "images/nav/gallery.png");
registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractAction.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractAction.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -62,7 +62,7 @@
/**
* store
*/
- private final HashMap<String, Object> store = new HashMap<String, Object>();
+ private HashMap<String, Object> store = new HashMap<String, Object>();
/**
* Creates a new action with no properties set.
@@ -72,6 +72,15 @@
}
/**
+ * Copy constructor used as a substitute of clone
+ */
+ @SuppressWarnings("unchecked")
+ public AbstractAction(final AbstractAction action) {
+ enabled = action.enabled;
+ store = (HashMap<String, Object>) action.store.clone();
+ }
+
+ /**
* Creates a new action with the specified name. The name is stored as a
* property with the key {@link Action#NAME}, and no other properties are
* initialised.
@@ -80,6 +89,7 @@
* the name (<code>null</code> permitted).
*/
public AbstractAction(final String name) {
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09 15:19
putValue(NAME, name);
}
@@ -95,7 +105,9 @@
* the icon (<code>null</code> permitted).
*/
public AbstractAction(final String name, final ImageResource icon) {
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09 15:19
putValue(NAME, name);
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09 15:19
putValue(SMALL_ICON, icon);
}
@@ -181,7 +193,7 @@
* the value (<code>null</code> permitted).
*/
public void putValue(final String key, final Object value) {
- Object old = getValue(key);
+ final Object old = getValue(key);
if ((old == null && value != null) || (old != null && !old.equals(value))) {
store.put(key, value);
firePropertyChange(key, old, value);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -123,7 +123,7 @@
public ActionDescriptor(final AccessRolDTO accessRolDTO, final Listener0 onPerformCall) {
this(accessRolDTO, new Listener<T>() {
- public void onEvent(T parameter) {
+ public void onEvent(final T parameter) {
onPerformCall.onEvent();
}
});
@@ -141,21 +141,49 @@
this.enableCondition = enableCondition;
}
- public ActionDescriptor(ActionDescriptor<T> copy) {
+ public ActionDescriptor(final ActionDescriptor<T> copy) {
this(copy.getAccessRol(), copy.getOnPerformCall());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setAddCondition(copy.getAddCondition());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:22
setConfirmationText(copy.getConfirmationText());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:22
setConfirmationTitle(copy.getConfirmationTitle());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setEnableCondition(copy.getEnableCondition());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setIconCls(copy.getIconCls());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setIconDescriptor(copy.getIconDescriptor());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setIconUrl(copy.getIconUrl());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setMustBeAuthenticated(copy.mustBeAuthenticated());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setMustBeConfirmed(copy.mustBeConfirmed());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setOnNotConfirmed(copy.getOnNotConfirmed());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setPosition(copy.getPosition());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setShortcut(copy.getShortcut());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setTextDescription(copy.getTextDescription());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setToolTip(copy.getToolTip());
}
@@ -280,7 +308,7 @@
return shortcut != null;
}
- public boolean mustBeAdded(T item) {
+ public boolean mustBeAdded(final T item) {
return addCondition != null ? addCondition.mustBeAdded(item) : true;
}
@@ -302,7 +330,7 @@
return mustBeConfirmed;
}
- public boolean mustBeEnabled(T item) {
+ public boolean mustBeEnabled(final T item) {
return enableCondition != null ? enableCondition.mustBeEnabled(item) : true;
}
@@ -356,7 +384,7 @@
this.enableCondition = enableCondition;
}
- public void setIconCls(String iconCls) {
+ public void setIconCls(final String iconCls) {
this.iconCls = iconCls;
}
@@ -386,7 +414,7 @@
* @param id
* the new id
*/
- public void setId(String id) {
+ public void setId(final String id) {
this.id = id;
}
@@ -415,11 +443,11 @@
*
* @param position
*/
- public void setPosition(int position) {
+ public void setPosition(final int position) {
this.position = position;
}
- public void setShortcut(ShortcutDescriptor shortcut) {
+ public void setShortcut(final ShortcutDescriptor shortcut) {
this.shortcut = shortcut;
}
@@ -463,7 +491,7 @@
return textDescription;
}
- private void setOnNotConfirmed(Listener<T> onNotConfirmed) {
+ private void setOnNotConfirmed(final Listener<T> onNotConfirmed) {
this.onNotConfirmed = onNotConfirmed;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -81,6 +81,7 @@
*
* @return an array of keys
*/
+ // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:03
public Object[] allKeys() {
Set<Object> set = new HashSet<Object>();
@@ -134,6 +135,7 @@
*
* @return an array of keys
*/
+ // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:03
public Object[] keys() {
if (size() != 0) {
return actionMap.keySet().toArray();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -29,9 +29,4 @@
super(accessRolDTO, onPerformCall);
}
- public ActionMenuItemDescriptor(final AccessRolDTO accessRolDTO, final Listener<T> onPerformCall,
- final ActionEnableCondition<T> enableCondition) {
- super(accessRolDTO, onPerformCall, enableCondition);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -32,20 +32,8 @@
}
public ActionToolbarButtonAndItemDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall,
- final ActionEnableCondition<T> enableCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
- }
-
- public ActionToolbarButtonAndItemDescriptor(final AccessRolDTO accessRolDTO,
final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall) {
super(accessRolDTO, actionToolbarPosition, onPerformCall);
}
- public ActionToolbarButtonAndItemDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall,
- final ActionEnableCondition<T> enableCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -63,10 +63,6 @@
super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
}
- public ActionToolbarButtonDescriptor(ActionDescriptor<T> copy) {
- super(copy);
- }
-
public ActionToolbarButtonSeparator getLeftSeparator() {
return leftSeparator;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -64,13 +64,13 @@
this.actionToolbarPosition = actionToolbarPosition;
}
- public ActionToolbarDescriptor(ActionDescriptor<T> copy) {
+ public ActionToolbarDescriptor(final ActionDescriptor<T> copy) {
super(copy);
}
- public ActionToolbarDescriptor(ActionToolbarDescriptor<T> copy) {
+ public ActionToolbarDescriptor(final ActionToolbarDescriptor<T> copy) {
super(copy);
- setActionPosition(copy.getActionPosition());
+ this.actionToolbarPosition = copy.getActionPosition();
}
public ActionToolbarPosition getActionPosition() {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -32,20 +32,8 @@
}
public ActionToolbarMenuAndItemDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall,
- final ActionEnableCondition<T> enableCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
- }
-
- public ActionToolbarMenuAndItemDescriptor(final AccessRolDTO accessRolDTO,
final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall) {
super(accessRolDTO, actionToolbarPosition, onPerformCall);
}
- public ActionToolbarMenuAndItemDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall,
- final ActionEnableCondition<T> enableCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuCheckItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuCheckItemDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuCheckItemDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -21,25 +21,19 @@
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import com.calclab.suco.client.events.Listener;
import com.calclab.suco.client.events.Listener0;
public class ActionToolbarMenuCheckItemDescriptor<T> extends ActionToolbarMenuDescriptor<T> {
private final ActionCheckedCondition mustBeChecked;
- public ActionToolbarMenuCheckItemDescriptor(AccessRolDTO accessRol, ActionToolbarPosition toolbarPosition,
- Listener<T> onPerformCall, ActionCheckedCondition mustBeChecked) {
+ public ActionToolbarMenuCheckItemDescriptor(final AccessRolDTO accessRol,
+ final ActionToolbarPosition toolbarPosition, final Listener0 onPerformCall,
+ final ActionCheckedCondition mustBeChecked) {
super(accessRol, toolbarPosition, onPerformCall);
this.mustBeChecked = mustBeChecked;
}
- public ActionToolbarMenuCheckItemDescriptor(AccessRolDTO accessRol, ActionToolbarPosition toolbarPosition,
- Listener0 onPerformCall, ActionCheckedCondition mustBeChecked) {
- super(accessRol, toolbarPosition, onPerformCall);
- this.mustBeChecked = mustBeChecked;
- }
-
public ActionCheckedCondition getMustBeChecked() {
return mustBeChecked;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -42,12 +42,6 @@
public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO,
final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall,
- final ActionAddCondition<T> addCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, addCondition);
- }
-
- public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall,
final ActionEnableCondition<T> enableCondition) {
super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
}
@@ -59,17 +53,11 @@
public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO,
final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall,
- final ActionAddCondition<T> addCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, addCondition);
- }
-
- public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall,
final ActionEnableCondition<T> enableCondition) {
super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
}
- public ActionToolbarMenuDescriptor(ActionDescriptor<T> copy) {
+ public ActionToolbarMenuDescriptor(final ActionDescriptor<T> copy) {
super(copy);
}
@@ -101,11 +89,11 @@
return topSeparator;
}
- public void setBottomSeparator(boolean bottomSeparator) {
+ public void setBottomSeparator(final boolean bottomSeparator) {
this.bottomSeparator = bottomSeparator;
}
- public void setParentMenuIconCls(String parentMenuIconCls) {
+ public void setParentMenuIconCls(final String parentMenuIconCls) {
this.parentMenuIconCls = parentMenuIconCls;
}
@@ -117,7 +105,7 @@
this.parentMenuTitle = parentMenuTitle;
}
- public void setParentMenuTooltip(String parentMenuTooltip) {
+ public void setParentMenuTooltip(final String parentMenuTooltip) {
this.parentMenuTooltip = parentMenuTooltip;
}
@@ -128,7 +116,7 @@
this.parentSubMenuTitle = parentSubMenuTitle;
}
- public void setTopSeparator(boolean topSeparator) {
+ public void setTopSeparator(final boolean topSeparator) {
this.topSeparator = topSeparator;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuRadioDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuRadioDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuRadioDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -22,26 +22,18 @@
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
import com.calclab.suco.client.events.Listener;
-import com.calclab.suco.client.events.Listener0;
public class ActionToolbarMenuRadioDescriptor<T> extends ActionToolbarMenuDescriptor<T> {
private final String group;
private final RadioMustBeChecked mustBeChecked;
- public ActionToolbarMenuRadioDescriptor(AccessRolDTO accessRol, ActionToolbarPosition toolbarPosition,
- Listener<T> onPerformCall, String group, RadioMustBeChecked mustBeChecked) {
+ public ActionToolbarMenuRadioDescriptor(final AccessRolDTO accessRol, final ActionToolbarPosition toolbarPosition,
+ final Listener<T> onPerformCall, final String group, final RadioMustBeChecked mustBeChecked) {
super(accessRol, toolbarPosition, onPerformCall);
this.group = group;
this.mustBeChecked = mustBeChecked;
}
- public ActionToolbarMenuRadioDescriptor(AccessRolDTO accessRol, ActionToolbarPosition toolbarPosition,
- Listener0 onPerformCall, String group, RadioMustBeChecked mustBeChecked) {
- super(accessRol, toolbarPosition, onPerformCall);
- this.group = group;
- this.mustBeChecked = mustBeChecked;
- }
-
public String getGroup() {
return group;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPushButtonDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPushButtonDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPushButtonDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -2,52 +2,22 @@
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import com.calclab.suco.client.events.Listener;
import com.calclab.suco.client.events.Listener0;
public class ActionToolbarPushButtonDescriptor<T> extends ActionToolbarButtonDescriptor<T> {
- ActionPressedCondition<T> mustInitialyPressed;
+ private ActionPressedCondition<T> mustInitialyPressed;
public ActionToolbarPushButtonDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall);
- }
-
- public ActionToolbarPushButtonDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall,
- final ActionAddCondition<T> addCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, addCondition);
- }
-
- public ActionToolbarPushButtonDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall,
- final ActionEnableCondition<T> enableCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
- }
-
- public ActionToolbarPushButtonDescriptor(final AccessRolDTO accessRolDTO,
final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall) {
super(accessRolDTO, actionToolbarPosition, onPerformCall);
}
- public ActionToolbarPushButtonDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall,
- final ActionAddCondition<T> addCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, addCondition);
- }
-
- public ActionToolbarPushButtonDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall,
- final ActionEnableCondition<T> enableCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
- }
-
public ActionPressedCondition<T> getMustInitialyPressed() {
return mustInitialyPressed;
}
- public void setMustInitialyPressed(ActionPressedCondition<T> mustInitialyPressed) {
+ public void setMustInitialyPressed(final ActionPressedCondition<T> mustInitialyPressed) {
this.mustInitialyPressed = mustInitialyPressed;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -158,6 +158,7 @@
*
* @return An array of keys (may be <code>null</code> or have zero length).
*/
+ // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:33
public KeyStroke[] keys() {
if (inputMap != null) {
KeyStroke[] array = new KeyStroke[size()];
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -73,7 +73,7 @@
* under the assumption that garbage collection of a new keystroke is easy
* when we find the old one that it matches in the cache.
*/
- private static final HashMap<KeyStroke, KeyStroke> cache = new HashMap<KeyStroke, KeyStroke>();
+ private static final HashMap<KeyStroke, KeyStroke> CACHE = new HashMap<KeyStroke, KeyStroke>();
/** The most recently generated keystroke, or null. */
private static KeyStroke recent;
@@ -84,7 +84,7 @@
*
* @see #getKeyStroke(String)
*/
- static final HashMap<String, Object> vktable = new HashMap<String, Object>();
+ static final HashMap<String, Object> VKTABLE = new HashMap<String, Object>();
private static final int VK_UNDEFINED = 0;
private static final char CHAR_UNDEFINED = '\uffff';
@@ -207,9 +207,9 @@
}
stroke = new KeyStroke(keyChar, keyCode, modifiers, release);
// Check level 1 cache.
- KeyStroke cached = cache.get(stroke);
+ KeyStroke cached = CACHE.get(stroke);
if (cached == null) {
- cache.put(stroke, stroke);
+ CACHE.put(stroke, stroke);
} else {
stroke = cached;
}
@@ -503,11 +503,11 @@
* @return a cached replacement if something goes wrong
*/
protected Object readResolve() {
- KeyStroke s = cache.get(this);
+ KeyStroke s = CACHE.get(this);
if (s != null) {
return s;
}
- cache.put(this, this);
+ CACHE.put(this, this);
return this;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -96,6 +96,7 @@
public PropertyChangeSupport(final Object source) {
this.source = source;
if (source == null) {
+ // @PMD:REVIEWED:AvoidThrowingNullPointerException: by vjrj on 21/05/09 14:12
throw new NullPointerException();
}
}
@@ -148,6 +149,7 @@
* @throws NullPointerException
* if propertyName is null
*/
+ // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:12
public void addPropertyChangeListener(final String propertyName, PropertyChangeListener l) {
if (l == null) {
return;
@@ -410,6 +412,7 @@
* @throws NullPointerException
* if propertyName is null
*/
+ // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:12
public void removePropertyChangeListener(final String propertyName, PropertyChangeListener l) {
if (children == null) {
return;
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/CheckButton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/CheckButton.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/CheckButton.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -0,0 +1,5 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class CheckButton {
+
+}
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -21,6 +21,11 @@
}
NotifyUser.info("Button clicked");
}
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled();
+ }
}
public TestButton(final WorkspaceSkeleton ws) {
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRightsDTO.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -22,18 +22,19 @@
import com.google.gwt.user.client.rpc.IsSerializable;
public class AccessRightsDTO implements IsSerializable {
- private boolean isAdministrable;
- private boolean isEditable;
- private boolean isVisible;
+ private boolean administrable;
+ private boolean editable;
+ private boolean visible;
+ private static final int PRIME = 31;
public AccessRightsDTO() {
this(false, false, false);
}
public AccessRightsDTO(final boolean isAdministrable, final boolean isEditable, final boolean isVisible) {
- this.isAdministrable = isAdministrable;
- this.isEditable = isEditable;
- this.isVisible = isVisible;
+ this.administrable = isAdministrable;
+ this.editable = isEditable;
+ this.visible = isVisible;
}
@Override
@@ -45,13 +46,13 @@
return false;
}
final AccessRightsDTO other = (AccessRightsDTO) obj;
- if (isAdministrable != other.isAdministrable) {
+ if (administrable != other.administrable) {
return false;
}
- if (isEditable != other.isEditable) {
+ if (editable != other.editable) {
return false;
}
- if (isVisible != other.isVisible) {
+ if (visible != other.visible) {
return false;
}
return true;
@@ -59,40 +60,39 @@
@Override
public int hashCode() {
- final int prime = 31;
int result = 1;
- result = prime * result + (isAdministrable ? 1231 : 1237);
- result = prime * result + (isEditable ? 1231 : 1237);
- result = prime * result + (isVisible ? 1231 : 1237);
+ result = PRIME * result + (administrable ? 1231 : 1237);
+ result = PRIME * result + (editable ? 1231 : 1237);
+ result = PRIME * result + (visible ? 1231 : 1237);
return result;
}
public boolean isAdministrable() {
- return isAdministrable;
+ return administrable;
}
public boolean isEditable() {
- return isEditable;
+ return editable;
}
public boolean isVisible() {
- return isVisible;
+ return visible;
}
- public void setAdministrable(final boolean isAdministrable) {
- this.isAdministrable = isAdministrable;
+ public void setAdministrable(final boolean administrable) {
+ this.administrable = administrable;
}
- public void setEditable(final boolean isEditable) {
- this.isEditable = isEditable;
+ public void setEditable(final boolean editable) {
+ this.editable = editable;
}
- public void setVisible(final boolean isVisible) {
- this.isVisible = isVisible;
+ public void setVisible(final boolean visible) {
+ this.visible = visible;
}
@Override
public String toString() {
- return "AccessRightsDTO[a: " + isAdministrable + ", e: " + isEditable + ", v: " + isVisible + "]";
+ return "AccessRightsDTO[a: " + administrable + ", e: " + editable + ", v: " + visible + "]";
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/ContainerSimpleDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/ContainerSimpleDTO.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/ContainerSimpleDTO.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -32,9 +32,6 @@
private StateToken stateToken;
private Long parentFolderId;
- public ContainerSimpleDTO() {
- }
-
public Long getId() {
return id;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/I18nCountryDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/I18nCountryDTO.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/I18nCountryDTO.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -43,7 +43,7 @@
this.code = code;
}
- public void setDateFormat(String dateFormat) {
+ public void setDateFormat(final String dateFormat) {
this.dateFormat = dateFormat;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDataDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDataDTO.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDataDTO.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -36,10 +36,10 @@
this(null, null, null, null, null, null, false, false);
}
- public SocialNetworkDataDTO(SocialNetworkVisibilityDTO socialNetworkVisibility,
+ public SocialNetworkDataDTO(final SocialNetworkVisibilityDTO socialNetworkVisibility,
final SocialNetworkDTO groupMembers, final ParticipationDataDTO userParticipation,
- UserBuddiesVisibilityDTO userBuddiesVisibility, final UserBuddiesDataDTO userBuddies,
- AccessRightsDTO groupRights, boolean isBuddiesVisible, boolean isMembersVisible) {
+ final UserBuddiesVisibilityDTO userBuddiesVisibility, final UserBuddiesDataDTO userBuddies,
+ final AccessRightsDTO groupRights, final boolean isBuddiesVisible, final boolean isMembersVisible) {
this.socialNetworkVisibility = socialNetworkVisibility;
this.groupMembers = groupMembers;
this.userParticipation = userParticipation;
@@ -90,7 +90,7 @@
return isMembersVisible;
}
- public void setBuddiesVisible(boolean isBuddiesVisible) {
+ public void setBuddiesVisible(final boolean isBuddiesVisible) {
this.isBuddiesVisible = isBuddiesVisible;
}
@@ -98,31 +98,31 @@
this.groupMembers = groupMembers;
}
- public void setGroupRights(AccessRightsDTO groupRights) {
+ public void setGroupRights(final AccessRightsDTO groupRights) {
this.groupRights = groupRights;
}
- public void setIsBuddiesVisible(boolean isBuddiesVisible) {
+ public void setIsBuddiesVisible(final boolean isBuddiesVisible) {
setBuddiesVisible(isBuddiesVisible);
}
- public void setIsMembersVisible(boolean isMembersVisible) {
+ public void setIsMembersVisible(final boolean isMembersVisible) {
setMembersVisible(isMembersVisible);
}
- public void setMembersVisible(boolean isMembersVisible) {
+ public void setMembersVisible(final boolean isMembersVisible) {
this.isMembersVisible = isMembersVisible;
}
- public void setSocialNetworkVisibility(SocialNetworkVisibilityDTO socialNetworkVisibilityDTO) {
+ public void setSocialNetworkVisibility(final SocialNetworkVisibilityDTO socialNetworkVisibilityDTO) {
this.socialNetworkVisibility = socialNetworkVisibilityDTO;
}
- public void setUserBuddies(UserBuddiesDataDTO userBuddies) {
+ public void setUserBuddies(final UserBuddiesDataDTO userBuddies) {
this.userBuddies = userBuddies;
}
- public void setUserBuddiesVisibility(UserBuddiesVisibilityDTO userBuddiesVisibilityDTO) {
+ public void setUserBuddiesVisibility(final UserBuddiesVisibilityDTO userBuddiesVisibilityDTO) {
this.userBuddiesVisibility = userBuddiesVisibilityDTO;
}
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -35,9 +35,9 @@
*/
public class StateToken implements IsSerializable {
public static final String SEPARATOR = ".";
- private static final String[] EMPTY = new String[0];
+ private static final String[] EMPTYA = new String[0];
- public static String encode(final String group, final String tool, final String folder, final String document) {
+ private static String encode(final String group, final String tool, final String folder, final String document) {
String encoded = "";
if (group != null) {
encoded += group;
@@ -57,7 +57,6 @@
private String group;
private String tool;
private String folder;
-
private String document;
private String encoded;
@@ -70,7 +69,7 @@
parse(encoded);
}
- public StateToken(final String group, final String tool) {
+ public StateToken(final String group, final String tool) { // NO_UCD
this(group, tool, null, null);
}
@@ -79,22 +78,22 @@
}
public StateToken(final String group, final String tool, final String folder, final String document) {
- this.setGroup(group);
- this.setTool(tool);
- this.setFolder(folder);
- this.setDocument(document);
- encoded = null;
+ this.group = group;
+ this.tool = tool;
+ this.folder = folder;
+ this.document = document;
+ resetEncoded();
}
public StateToken clearDocument() {
this.document = null;
- encoded = null;
+ resetEncoded();
return this;
}
- public StateToken clearFolder() {
+ public StateToken clearFolder() { // NO_UCD
this.folder = null;
- encoded = null;
+ resetEncoded();
return this;
}
@@ -170,10 +169,11 @@
}
public boolean hasSameContainer(final StateToken currentStateToken) {
+ boolean same = false;
if (copy().clearDocument().getEncoded().equals(currentStateToken.copy().clearDocument().getEncoded())) {
- return true;
+ same = true;
}
- return false;
+ return same;
}
public boolean isComplete() {
@@ -182,13 +182,13 @@
public StateToken setDocument(final Long document) {
this.document = document == null ? null : document.toString();
- encoded = null;
+ resetEncoded();
return this;
}
public StateToken setDocument(final String document) {
this.document = document;
- encoded = null;
+ resetEncoded();
return this;
}
@@ -198,25 +198,25 @@
public StateToken setFolder(final Long folder) {
this.folder = folder == null ? null : folder.toString();
- encoded = null;
+ resetEncoded();
return this;
}
- public StateToken setFolder(final String folder) {
+ public StateToken setFolder(final String folder) { // NO_UCD
this.folder = folder;
- encoded = null;
+ resetEncoded();
return this;
}
- public StateToken setGroup(final String group) {
+ public StateToken setGroup(final String group) { // NO_UCD
this.group = group;
- encoded = null;
+ resetEncoded();
return this;
}
- public StateToken setTool(final String tool) {
+ public StateToken setTool(final String tool) { // NO_UCD
this.tool = tool;
- encoded = null;
+ resetEncoded();
return this;
}
@@ -238,11 +238,16 @@
if (encoded != null && encoded.length() > 0) {
splitted = encoded.split("\\.");
} else {
- splitted = EMPTY;
+ splitted = EMPTYA;
}
- setGroup(conditionalAssign(0, splitted));
- setTool(conditionalAssign(1, splitted));
- setFolder(conditionalAssign(2, splitted));
- setDocument(conditionalAssign(3, splitted));
+ group = conditionalAssign(0, splitted);
+ tool = conditionalAssign(1, splitted);
+ folder = conditionalAssign(2, splitted);
+ document = conditionalAssign(3, splitted);
+ resetEncoded();
}
+
+ private void resetEncoded() {
+ encoded = null;
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateTokenUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateTokenUtils.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateTokenUtils.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -5,6 +5,7 @@
public class StateTokenUtils {
private final Session session;
+ private static final String SEPARATOR = ".";
public StateTokenUtils(final Session session) {
this.session = session;
@@ -12,12 +13,11 @@
public String getPublicUrl(final StateToken token) {
String publicUrl = "";
- String separator = ".";
- String group = token.getGroup();
- String tool = token.getTool();
- String folder = token.getFolder();
- String document = token.getDocument();
+ final String group = token.getGroup();
+ final String tool = token.getTool();
+ final String folder = token.getFolder();
+ final String document = token.getDocument();
publicUrl += session.getSiteUrl() + "/public";
@@ -25,13 +25,13 @@
publicUrl += "/" + group;
}
if (tool != null) {
- publicUrl += separator + tool;
+ publicUrl += SEPARATOR + tool;
}
if (folder != null) {
- publicUrl += separator + folder;
+ publicUrl += SEPARATOR + folder;
}
if (document != null) {
- publicUrl += separator + document;
+ publicUrl += SEPARATOR + document;
}
return publicUrl;
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserBuddiesDataDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserBuddiesDataDTO.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserBuddiesDataDTO.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -26,17 +26,17 @@
public class UserBuddiesDataDTO implements IsSerializable {
- public static UserBuddiesDataDTO NO_BUDDIES = new UserBuddiesDataDTO();
+ public static final UserBuddiesDataDTO NO_BUDDIES = new UserBuddiesDataDTO();
private List<UserSimpleDTO> buddies;
- int otherExternalBuddies;
+ private int otherExtBuddies;
public UserBuddiesDataDTO() {
buddies = new ArrayList<UserSimpleDTO>();
- otherExternalBuddies = 0;
+ otherExtBuddies = 0;
}
- public boolean contains(String shortName) {
+ public boolean contains(final String shortName) {
for (UserSimpleDTO buddie : buddies) {
if (buddie.getShortName().equals(shortName)) {
return true;
@@ -49,20 +49,20 @@
return buddies;
}
- public int getOtherExternalBuddies() {
- return otherExternalBuddies;
+ public int getOtherExtBuddies() {
+ return otherExtBuddies;
}
- public void setBuddies(List<UserSimpleDTO> buddies) {
+ public void setBuddies(final List<UserSimpleDTO> buddies) {
this.buddies = buddies;
}
- public void setOtherExternalBuddies(int otherExternalBuddies) {
- this.otherExternalBuddies = otherExternalBuddies;
+ public void setOtherExtBuddies(final int otherExternalBuddies) {
+ this.otherExtBuddies = otherExternalBuddies;
}
@Override
public String toString() {
- return "UserBuddiesDataDTO[ext: " + otherExternalBuddies + " / int: " + buddies + "]";
+ return "UserBuddiesDataDTO[ext: " + otherExtBuddies + " / int: " + buddies + "]";
}
}
\ No newline at end of file
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserSimpleDTO.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -119,7 +119,7 @@
this.country = country;
}
- public void setHasLogo(boolean hasLogo) {
+ public void setHasLogo(final boolean hasLogo) {
this.hasLogo = hasLogo;
}
@@ -139,7 +139,7 @@
this.shortName = shortName;
}
- public void setStateToken(StateToken stateToken) {
+ public void setStateToken(final StateToken stateToken) {
this.stateToken = stateToken;
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/errors/UIException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/UIException.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/UIException.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -0,0 +1,43 @@
+/*
+ *
+ * Copyright (C) 2007-2009 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.platf.client.errors;
+
+import com.allen_sauer.gwt.log.client.Log;
+
+public class UIException extends RuntimeException {
+
+ private static final long serialVersionUID = -1327164226202923181L;
+
+ public UIException(final String text) {
+ super(text);
+ Log.error(text);
+ }
+
+ public UIException(final String text, final Throwable cause) {
+ super(text, cause);
+ Log.error(text, cause);
+ }
+
+ public UIException(final Throwable cause) {
+ super(cause);
+ Log.error("UIException", cause);
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/i18n/I18nTranslationService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/i18n/I18nTranslationService.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/i18n/I18nTranslationService.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -19,7 +19,6 @@
*/
package org.ourproject.kune.platf.client.i18n;
-
public abstract class I18nTranslationService {
protected static final String TRANSLATION_NOTE_REGEXP = " (\\[)%NT (.*)(\\])$";
protected static final String NOTE_FOR_TRANSLATOR_TAG_BEGIN = " [%NT ";
@@ -48,14 +47,14 @@
* @param text
* @return text translated in the current language
*/
- public String t(final String text) {
- return null;
- }
+ // @PMD:REVIEWED:ShortMethodName: by vjrj on 21/05/09 13:49
+ public abstract String t(final String text);
/**
* Use [%d] to reference the Integer parameters
*
*/
+ // @PMD:REVIEWED:ShortMethodName: by vjrj on 21/05/09 13:50
public String t(final String text, final Integer... args) {
String translation = t(text);
for (Integer arg : args) {
@@ -68,6 +67,7 @@
* Use [%d] to reference the Long parameter
*
*/
+ // @PMD:REVIEWED:ShortMethodName: by vjrj on 21/05/09 13:50
public String t(final String text, final Long... args) {
String translation = t(text);
for (Long arg : args) {
@@ -80,6 +80,7 @@
* Use [%s] to reference the string parameter
*
*/
+ // @PMD:REVIEWED:ShortMethodName: by vjrj on 21/05/09 13:50
public String t(final String text, final String... args) {
String translation = t(text);
for (String arg : args) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/ErrorHandler.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/ErrorHandler.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/ErrorHandler.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -66,65 +66,63 @@
public void process(final Throwable caught) {
NotifyUser.hideProgress();
- try {
- throw caught;
- } catch (final AccessViolationException e) {
- logException(e);
+ if (caught instanceof AccessViolationException) {
+ logException(caught);
NotifyUser.error(i18n.t("You do not have rights to perform that action"));
- } catch (final SessionExpiredException e) {
- logException(e);
+ } else if (caught instanceof SessionExpiredException) {
+ logException(caught);
doSessionExpired();
- } catch (final UserMustBeLoggedException e) {
- logException(e);
+ } else if (caught instanceof UserMustBeLoggedException) {
+ logException(caught);
if (session.isLogged()) {
doSessionExpired();
} else {
NotifyUser.important(i18n.t("Please sign in or register to collaborate"));
}
- } catch (final GroupNotFoundException e) {
- logException(e);
+ } else if (caught instanceof GroupNotFoundException) {
+ logException(caught);
NotifyUser.veryImportant(i18n.t("Group not found"));
stateManagerProvider.get().gotoToken("");
- } catch (final IncompatibleRemoteServiceException e) {
+ } else if (caught instanceof IncompatibleRemoteServiceException) {
NotifyUser.error(i18n.t("Your browser is outdated with the server software. Please reload this page."));
- } catch (final ContentNotFoundException e) {
- logException(e);
+ } else if (caught instanceof ContentNotFoundException) {
+ logException(caught);
NotifyUser.veryImportant(i18n.t("Content not found"));
stateManagerProvider.get().gotoToken("");
- } catch (final ContentNotPermittedException e) {
- logException(e);
+ } else if (caught instanceof ContentNotPermittedException) {
+ logException(caught);
NotifyUser.error(i18n.t("Action not permitted in this location"));
stateManagerProvider.get().gotoToken("");
- } catch (final ContainerNotPermittedException e) {
- logException(e);
+ } else if (caught instanceof ContainerNotPermittedException) {
+ logException(caught);
NotifyUser.error(i18n.t("Action not permitted in this location"));
stateManagerProvider.get().gotoToken("");
- } catch (final LastAdminInGroupException e) {
- logException(e);
+ } else if (caught instanceof LastAdminInGroupException) {
+ logException(caught);
NotifyUser.showAlertMessage(i18n.t("Warning"), i18n.t("Sorry, you are the last admin of this group."
+ " Look for someone to substitute you appropriately as admin before leaving this group."));
- } catch (final AlreadyGroupMemberException e) {
- logException(e);
+ } else if (caught instanceof AlreadyGroupMemberException) {
+ logException(caught);
NotifyUser.error(i18n.t("This group is already a group member"));
- } catch (final AlreadyUserMemberException e) {
- logException(e);
+ } else if (caught instanceof AlreadyUserMemberException) {
+ logException(caught);
NotifyUser.error(i18n.t("This user is already a group member"));
- } catch (final Throwable e) {
- logException(e, true);
+ } else {
+ logException(caught, true);
NotifyUser.error(i18n.t("Error performing operation"));
- GWT.log("Other kind of exception in StateManagerDefault/processErrorException", null);
+ GWT.log("Other kind of exception in StateManagerDefault/processErrorException", caught);
}
}
- private void logException(final Throwable e) {
- logException(e, false);
+ private void logException(final Throwable caught) {
+ logException(caught, false);
}
- private void logException(final Throwable e, final boolean showException) {
+ private void logException(final Throwable caught, final boolean showException) {
if (showException) {
- Log.debug("Exception in KuneErrorHandler", e);
+ Log.debug("Exception in KuneErrorHandler", caught);
} else {
- Log.debug("Exception in KuneErrorHandler: " + e.getMessage());
+ Log.debug("Exception in KuneErrorHandler: " + caught.getMessage());
}
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationService.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationService.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -1,6 +0,0 @@
-package org.ourproject.kune.platf.client.services;
-
-@Deprecated
-public class I18nTranslationService extends org.ourproject.kune.platf.client.i18n.I18nTranslationService {
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationServiceMocked.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationServiceMocked.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationServiceMocked.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -1,12 +0,0 @@
-package org.ourproject.kune.platf.client.services;
-
-import org.ourproject.kune.platf.client.ui.TextUtils;
-
-@Deprecated
-public class I18nTranslationServiceMocked extends I18nTranslationService {
- public String t(final String text) {
- String encodeText = TextUtils.escapeHtmlLight(text);
- String translation = removeNT(encodeText);
- return decodeHtml(translation);
- }
-}
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -538,7 +538,7 @@
$(ApplicationComponentGroup.class).createAll();
$(ToolGroup.class).createAll();
$(Application.class).start();
- // $(HelloWorld.class);
+ //$(HelloWorld.class);
}
}
\ No newline at end of file
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -8,7 +8,7 @@
private static final String NO_KEYNAME = "nokeyname";
- private static boolean has(int modifiers, int modifier) {
+ private static boolean has(final int modifiers, final int modifier) {
return ((modifiers & modifier) == modifier);
}
@@ -18,46 +18,51 @@
private final int keycode;
private final String keyName;
- public ShortcutDescriptor(boolean ctrl, boolean alt, boolean shift, int key) {
+ public ShortcutDescriptor(final boolean ctrl, final boolean alt, final boolean shift, final int key) {
this(ctrl, alt, shift, key, NO_KEYNAME);
}
- public ShortcutDescriptor(boolean ctrl, boolean alt, boolean shift, int key, String keyName) {
+ public ShortcutDescriptor(final boolean ctrl, final boolean alt, final boolean shift, final int key,
+ final String keyName) {
this.alt = alt;
this.ctrl = ctrl;
this.shift = shift;
this.keycode = key;
- this.keyName = keyName;
+ if (keyName == null) {
+ this.keyName = NO_KEYNAME;
+ } else {
+ this.keyName = keyName;
+ }
}
- public ShortcutDescriptor(boolean ctrl, boolean shift, int key) {
+ public ShortcutDescriptor(final boolean ctrl, final boolean shift, final int key) {
this(ctrl, false, shift, key, NO_KEYNAME);
}
- public ShortcutDescriptor(boolean ctrl, boolean shift, int key, String keyName) {
+ public ShortcutDescriptor(final boolean ctrl, final boolean shift, final int key, final String keyName) {
this(ctrl, false, shift, key, keyName);
}
- public ShortcutDescriptor(boolean ctrl, int key) {
+ public ShortcutDescriptor(final boolean ctrl, final int key) {
this(ctrl, false, false, key, NO_KEYNAME);
}
- public ShortcutDescriptor(boolean ctrl, int keycode, String keyName) {
+ public ShortcutDescriptor(final boolean ctrl, final int keycode, final String keyName) {
this(ctrl, false, false, keycode, keyName);
}
- public ShortcutDescriptor(int keycode, int modifiers) {
+ public ShortcutDescriptor(final int keycode, final int modifiers) {
this(has(modifiers, KeyboardListener.MODIFIER_CTRL), has(modifiers, KeyboardListener.MODIFIER_ALT), has(
modifiers, KeyboardListener.MODIFIER_SHIFT), keycode, NO_KEYNAME);
}
- public ShortcutDescriptor(int keycode, int modifiers, String keyName) {
+ public ShortcutDescriptor(final int keycode, final int modifiers, final String keyName) {
this(has(modifiers, KeyboardListener.MODIFIER_CTRL), has(modifiers, KeyboardListener.MODIFIER_ALT), has(
modifiers, KeyboardListener.MODIFIER_SHIFT), keycode, keyName);
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
@@ -94,13 +99,13 @@
return result;
}
- public boolean is(char keyCode, int modifiers) {
+ public boolean is(final char keyCode, final int modifiers) {
return (keyCode == keyCode && same(modifiers, KeyboardListener.MODIFIER_ALT, alt)
&& same(modifiers, KeyboardListener.MODIFIER_CTRL, ctrl) && same(modifiers,
KeyboardListener.MODIFIER_SHIFT, shift));
}
- public boolean same(int modifiers, int modifier, boolean keyValue) {
+ public boolean same(final int modifiers, final int modifier, final boolean keyValue) {
return (has(modifiers, modifier) == keyValue);
}
@@ -114,11 +119,11 @@
return s;
}
- private String sKey(boolean key, String specialKeyName) {
+ private String sKey(final boolean key, final String specialKeyName) {
return key ? translateKey(specialKeyName) + "+" : "";
}
- private String translateKey(String keyNameToTranslate) {
+ private String translateKey(final String keyNameToTranslate) {
return Resources.i18n.tWithNT(keyNameToTranslate, "The '" + keyNameToTranslate + "' keyboard key");
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -129,6 +129,8 @@
boolean isLogged();
+ boolean isNotLogged();
+
void onInitDataReceived(Listener<InitDataDTO> listener);
void onUserSignIn(Listener<UserInfoDTO> listener);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -46,7 +46,7 @@
public class SessionDefault implements Session {
private String userHash;
- InitDataDTO initData;
+ private InitDataDTO initData;
private UserInfoDTO currentUserInfo;
private Object[][] languagesArray;
private Object[][] countriesArray;
@@ -201,6 +201,10 @@
return userHash != null;
}
+ public boolean isNotLogged() {
+ return !isLogged();
+ }
+
public void onInitDataReceived(final Listener<InitDataDTO> listener) {
onInitDataReceived.add(listener);
}
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -37,55 +37,56 @@
*
*/
public class DropDownPanel extends Composite implements ClickListener {
- private final VerticalPanel vp;
- private final HorizontalPanel titleHP;
- private final Label titleLabel;
- private final SimplePanel contentPanel;
- private final Images img;
- private final Image arrowImage;
- private final RoundedPanel outerBorder;
- private String stylePrimaryName;
+ private transient final VerticalPanel vpanel;
+ private transient final HorizontalPanel titleHP;
+ private transient final Label titleLabel;
+ private transient final SimplePanel contentPanel;
+ private transient final Images img;
+ private transient final Image arrowImage;
+ private transient final RoundedPanel outerBorder;
+ private transient String stylePrimaryName;
- public DropDownPanel(Images img) {
+ public DropDownPanel(final Images img) {
+ super();
this.img = img;
- vp = new VerticalPanel();
- outerBorder = new RoundedPanel(vp, RoundedPanel.ALL);
+ vpanel = new VerticalPanel();
+ outerBorder = new RoundedPanel(vpanel, RoundedPanel.ALL);
titleHP = new HorizontalPanel();
arrowImage = new Image();
titleLabel = new Label();
contentPanel = new SimplePanel();
initWidget(outerBorder);
- vp.add(titleHP);
- vp.add(contentPanel);
+ vpanel.add(titleHP);
+ vpanel.add(contentPanel);
titleHP.add(arrowImage);
titleHP.add(titleLabel);
this.stylePrimaryName = "k-dropdownouter";
outerBorder.setCornerStyleName(stylePrimaryName);
- vp.setStylePrimaryName(stylePrimaryName);
- vp.setWidth("100%");
- vp.setCellWidth(contentPanel, "100%");
- vp.setCellWidth(titleHP, "100%");
+ vpanel.setStylePrimaryName(stylePrimaryName);
+ vpanel.setWidth("100%");
+ vpanel.setCellWidth(contentPanel, "100%");
+ vpanel.setCellWidth(titleHP, "100%");
titleHP.setStylePrimaryName("k-dropdownlabel");
img.arrowDownWhite().applyTo(arrowImage);
titleLabel.setText("");
contentPanel.setStylePrimaryName("k-dropdowninner");
- setContentVisible(false);
+ setContentVisibleImpl(false);
arrowImage.addClickListener(this);
titleLabel.addClickListener(this);
}
- public DropDownPanel(Images img, final boolean visible) {
+ public DropDownPanel(final Images img, final boolean visible) {
this(img);
- setContentVisible(visible);
+ setContentVisibleImpl(visible);
}
- public DropDownPanel(Images img, final String headerText, final boolean visible) {
+ public DropDownPanel(final Images img, final String headerText, final boolean visible) {
this(img);
- setContentVisible(visible);
- setHeaderText(headerText);
+ setContentVisibleImpl(visible);
+ setHeaderTextImpl(headerText);
}
public boolean isContentVisible() {
@@ -93,7 +94,7 @@
}
public void onClick(final Widget sender) {
- if (sender == titleHP | sender == arrowImage | sender == titleLabel) {
+ if (sender.equals(titleHP) | sender.equals(arrowImage) | sender.equals(titleLabel)) {
setContentVisible(!isContentVisible());
}
}
@@ -101,7 +102,7 @@
public void setBorderStylePrimaryName(final String stylePrimaryName) {
this.stylePrimaryName = stylePrimaryName;
outerBorder.setCornerStyleName(stylePrimaryName);
- vp.setStylePrimaryName(stylePrimaryName);
+ vpanel.setStylePrimaryName(stylePrimaryName);
}
public void setContent(final Widget widget) {
@@ -115,18 +116,11 @@
}
public void setContentVisible(final boolean visible) {
- if (visible) {
- img.arrowDownWhite().applyTo(arrowImage);
- contentPanel.setVisible(true);
-
- } else {
- img.arrowRightWhite().applyTo(arrowImage);
- contentPanel.setVisible(false);
- }
+ setContentVisibleImpl(visible);
}
public void setHeaderText(final String text) {
- titleLabel.setText(text);
+ setHeaderTextImpl(text);
}
public void setHeaderTitle(final String title) {
@@ -144,13 +138,13 @@
public void setTheme(final String oldTheme, final String newTheme) {
if (oldTheme != null) {
// outerBorder.removeStyleDependentName(oldThemeS);
- vp.removeStyleDependentName(oldTheme);
+ vpanel.removeStyleDependentName(oldTheme);
titleHP.removeStyleDependentName(oldTheme);
contentPanel.removeStyleDependentName(oldTheme);
}
outerBorder.setCornerStyleName(stylePrimaryName + "-" + newTheme);
// outerBorder.addStyleDependentName(newThemeS);
- vp.addStyleDependentName(newTheme);
+ vpanel.addStyleDependentName(newTheme);
titleHP.addStyleDependentName(newTheme);
contentPanel.addStyleDependentName(newTheme);
}
@@ -161,4 +155,19 @@
outerBorder.setWidth(width);
}
+ private void setContentVisibleImpl(final boolean visible) {
+ if (visible) {
+ img.arrowDownWhite().applyTo(arrowImage);
+ contentPanel.setVisible(true);
+
+ } else {
+ img.arrowRightWhite().applyTo(arrowImage);
+ contentPanel.setVisible(false);
+ }
+ }
+
+ private void setHeaderTextImpl(final String text) {
+ titleLabel.setText(text);
+ }
+
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -1,199 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2009 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.platf.client.ui;
-
-import com.google.gwt.user.client.ui.AbstractImagePrototype;
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.MouseListenerAdapter;
-import com.google.gwt.user.client.ui.Widget;
-import com.gwtext.client.widgets.MessageBox;
-import com.gwtext.client.widgets.MessageBoxConfig;
-
-@Deprecated
-public class EditableIconLabel extends Composite {
-
- private boolean useDoubleClick;
- private ClickListener listener;
- private String currentText;
- private String oldText;
- private EditableClickListener editableListener;
- private MouseListenerAdapter mouseOverListener;
- private final AbstractLabel label;
- private String renameDialogTitle;
- private String renameDialogLabel;
- private String doubleClickToRenameLabel;
- private String clickToRenameLabel;
-
- public EditableIconLabel(final AbstractImagePrototype icon, final String text, final boolean useDoubleClick,
- final EditableClickListener editableListenerOrig) {
- label = new IconLabel(icon, text);
- init(text, useDoubleClick, editableListenerOrig);
- }
-
- public EditableIconLabel(final AbstractImagePrototype icon, final String text, final String targetHistoryToken,
- final boolean useDoubleClick, final EditableClickListener editableListenerOrig) {
- label = new IconHyperlink(icon, text, targetHistoryToken);
- init(text, useDoubleClick, editableListenerOrig);
- }
-
- public EditableIconLabel(final EditableClickListener editableListener) {
- this("", editableListener);
- }
-
- public EditableIconLabel(final String text, final boolean wordWrap, final boolean useDoubleClick,
- final EditableClickListener editableListenerOrig) {
- label = new LabelWrapper(text, wordWrap);
- init(text, useDoubleClick, editableListenerOrig);
- }
-
- public EditableIconLabel(final String text, final boolean useDoubleClick,
- final EditableClickListener editableListener) {
- this(text, false, false, editableListener);
- }
-
- public EditableIconLabel(final String text, final EditableClickListener editableListener) {
- this(text, false, editableListener);
- }
-
- public EditableClickListener getEditableListener() {
- return editableListener;
- }
-
- public String getText() {
- return label.getText();
- }
-
- public void restoreOldText() {
- label.setText(oldText);
- this.currentText = this.oldText;
- }
-
- public void setClickToRenameLabel(final String clickToRenameLabel) {
- this.clickToRenameLabel = clickToRenameLabel;
- }
-
- public void setDoubleClickToRenameLabel(final String doubleClickToRenameLabel) {
- this.doubleClickToRenameLabel = doubleClickToRenameLabel;
- }
-
- public void setEditable(final boolean editable) {
- reset();
- if (editable) {
- if (useDoubleClick) {
- label.setTitle(doubleClickToRenameLabel);
- label.addDoubleClickListener(listener);
- } else {
- label.setTitle(clickToRenameLabel);
- label.addClickListener(listener);
- }
- label.addStyleDependentName("editable");
- // label.addDoubleClickListener(listener);
- label.addMouseListener(mouseOverListener);
- } else {
- label.setTitle(null);
- label.addStyleDependentName("noneditable");
- }
- }
-
- public void setEditableListener(final EditableClickListener editableListener) {
- this.editableListener = editableListener;
- }
-
- public void setRenameDialogLabel(final String renameDialogLabel) {
- this.renameDialogLabel = renameDialogLabel;
- }
-
- public void setRenameDialogTitle(final String renameDialogTitle) {
- this.renameDialogTitle = renameDialogTitle;
- }
-
- public void setText(final String text) {
- this.oldText = this.currentText;
- this.currentText = text;
- label.setText(text);
- }
-
- private void init(final String text, final boolean useDoubleClick, final EditableClickListener editableListenerOrig) {
- doubleClickToRenameLabel = "Double click to rename";
- clickToRenameLabel = "Click to rename";
- renameDialogLabel = "Write a new name:";
- renameDialogTitle = "Rename";
- initWidget((Widget) label);
- this.currentText = text;
- this.oldText = text;
- this.useDoubleClick = useDoubleClick;
- this.editableListener = editableListenerOrig;
- this.listener = new ClickListener() {
- public void onClick(final Widget sender) {
- showEditableDialog();
- }
- };
- mouseOverListener = new MouseListenerAdapter() {
- @Override
- public void onMouseEnter(final Widget sender) {
- label.addStyleDependentName("high");
- }
-
- @Override
- public void onMouseLeave(final Widget sender) {
- label.removeStyleDependentName("high");
- }
- };
- label.setStylePrimaryName("kune-EditableLabel");
- label.addMouseListener(mouseOverListener);
- setEditable(false);
- }
-
- private void reset() {
- label.removeStyleDependentName("noneditable");
- label.removeStyleDependentName("editable");
- label.removeClickListener(listener);
- label.removeDoubleClickListener(listener);
- label.removeMouseListener(mouseOverListener);
- }
-
- private void showEditableDialog() {
- MessageBox.show(new MessageBoxConfig() {
- {
- // i18n
- setClosable(true);
- setModal(true);
- setWidth(300);
- setDefaultTextHeight(2);
- setButtons(MessageBox.OKCANCEL);
- setTitle(renameDialogTitle);
- setMsg(renameDialogLabel);
- setCallback(new MessageBox.PromptCallback() {
- public void execute(final String btnID, final String text) {
- if (btnID.equals("ok") && text != null) {
- editableListener.onEdited(text);
- } else {
- // Do nothing
- }
- }
- });
- setMultiline(true);
- setValue(currentText);
- }
- });
- }
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -56,17 +56,17 @@
final String targetHistoryToken) {
this(image);
if (asHTML) {
- setLabelHTML(text);
+ setLabelHtmlImpl(text);
} else {
- setLabelText(text);
+ setLabelTextImpl(text);
}
- setTargetHistoryToken(targetHistoryToken);
+ setTargetHistoryTokenImpl(targetHistoryToken);
}
public IconHyperlink(final AbstractImagePrototype image, final String text, final String targetHistoryToken) {
this(image);
- setLabelText(text);
- setTargetHistoryToken(targetHistoryToken);
+ setLabelTextImpl(text);
+ setTargetHistoryTokenImpl(targetHistoryToken);
}
public void addClickListener(final ClickListener listener) {
@@ -153,16 +153,15 @@
}
public void setLabelHTML(final String html) {
- DOM.setInnerHTML(link, html);
+ setLabelHtmlImpl(html);
}
public void setLabelText(final String text) {
- DOM.setInnerText(link, text);
+ setLabelTextImpl(text);
}
public void setTargetHistoryToken(final String targetHistoryToken) {
- this.targetHistoryToken = targetHistoryToken;
- DOM.setElementProperty(anchorElem, "href", "#" + targetHistoryToken);
+ setTargetHistoryTokenImpl(targetHistoryToken);
}
public void setText(final String text) {
@@ -174,4 +173,17 @@
KuneUiUtils.setQuickTip(icon, title);
KuneUiUtils.setQuickTip(anchorElem, title);
}
+
+ private void setLabelHtmlImpl(final String html) {
+ DOM.setInnerHTML(link, html);
+ }
+
+ private void setLabelTextImpl(final String text) {
+ DOM.setInnerText(link, text);
+ }
+
+ private void setTargetHistoryTokenImpl(final String targetHistoryToken) {
+ this.targetHistoryToken = targetHistoryToken;
+ DOM.setElementProperty(anchorElem, "href", "#" + targetHistoryToken);
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -59,6 +59,28 @@
private final Element textLabel;
/**
+ * Creates an empty label with a icon.
+ *
+ * @param image
+ * the icon to add
+ */
+ public IconLabel(final AbstractImagePrototype image, final boolean leftIcon) {
+ setElement(DOM.createDiv());
+ sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS | Event.ONMOUSEWHEEL | Event.ONDBLCLICK);
+ setIconImpl(image);
+ textLabel = DOM.createSpan();
+ if (leftIcon) {
+ setStyleName("kune-IconLabel-l");
+ DOM.appendChild(getElement(), icon);
+ DOM.appendChild(getElement(), textLabel);
+ } else {
+ setStyleName("kune-IconLabel-r");
+ DOM.appendChild(getElement(), textLabel);
+ DOM.appendChild(getElement(), icon);
+ }
+ }
+
+ /**
* Creates a label with the specified text and a icon in the left.
*
* @param image
@@ -68,7 +90,7 @@
*/
public IconLabel(final AbstractImagePrototype image, final String text) {
this(image, true);
- setText(text);
+ setTextImpl(text);
}
/**
@@ -83,7 +105,7 @@
*/
public IconLabel(final AbstractImagePrototype image, final String text, final boolean wordWrap) {
this(image, text);
- setWordWrap(wordWrap);
+ setWordWrapImpl(wordWrap);
}
/**
@@ -96,7 +118,7 @@
*/
public IconLabel(final String text, final AbstractImagePrototype image) {
this(image, false);
- setText(text);
+ setTextImpl(text);
}
/**
@@ -111,31 +133,9 @@
*/
public IconLabel(final String text, final AbstractImagePrototype image, final boolean wordWrap) {
this(text, image);
- setWordWrap(wordWrap);
+ setWordWrapImpl(wordWrap);
}
- /**
- * Creates an empty label with a icon.
- *
- * @param image
- * the icon to add
- */
- private IconLabel(final AbstractImagePrototype image, final boolean leftIcon) {
- setElement(DOM.createDiv());
- sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS | Event.ONMOUSEWHEEL | Event.ONDBLCLICK);
- setIcon(image);
- textLabel = DOM.createSpan();
- if (leftIcon) {
- setStyleName("kune-IconLabel-l");
- DOM.appendChild(getElement(), icon);
- DOM.appendChild(getElement(), textLabel);
- } else {
- setStyleName("kune-IconLabel-r");
- DOM.appendChild(getElement(), textLabel);
- DOM.appendChild(getElement(), icon);
- }
- }
-
public void addClickListener(final ClickListener listener) {
if (clickListeners == null) {
clickListeners = new ClickListenerCollection();
@@ -240,8 +240,8 @@
DOM.setStyleAttribute(textLabel, "textAlign", align.getTextAlignString());
}
- public void setIcon(AbstractImagePrototype image) {
- icon = getImageElement(image);
+ public void setIcon(final AbstractImagePrototype image) {
+ setIconImpl(image);
}
public void setStyleNameToText(final String styleName) {
@@ -249,7 +249,7 @@
}
public void setText(final String text) {
- DOM.setInnerText(textLabel, text);
+ setTextImpl(text);
}
@Override
@@ -259,11 +259,23 @@
}
public void setWordWrap(final boolean wrap) {
- DOM.setStyleAttribute(textLabel, "whiteSpace", wrap ? "normal" : "nowrap");
+ setWordWrapImpl(wrap);
}
private Element getImageElement(final AbstractImagePrototype image) {
return image.createImage().getElement();
}
+ private void setIconImpl(final AbstractImagePrototype image) {
+ icon = getImageElement(image);
+ }
+
+ private void setTextImpl(final String text) {
+ DOM.setInnerText(textLabel, text);
+ }
+
+ private void setWordWrapImpl(final boolean wrap) {
+ DOM.setStyleAttribute(textLabel, "whiteSpace", wrap ? "normal" : "nowrap");
+ }
+
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -31,31 +31,37 @@
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
+/**
+ * @author vjrj
+ *
+ */
public class IconLabelEditable extends Composite {
- private boolean useDoubleClick;
- private ClickListener listener;
- private String currentText;
- private MouseListenerAdapter mouseOverListener;
- private final AbstractLabel label;
- private String doubleClickToRenameLabel;
- private String clickToRenameLabel;
- private Event2<String, String> onEdit;
- private TextBox editor;
- private HorizontalPanel hp;
+ private transient boolean useDoubleClick;
+ private transient ClickListener listener;
+ private transient String currentText;
+ private transient MouseListenerAdapter mouseOverListener;
+ private transient final AbstractLabel label;
+ private transient String dblClickLabel;
+ private transient String clickLabel;
+ private transient Event2<String, String> onEditEvent;
+ private transient TextBox editor;
+ private transient HorizontalPanel hpanel;
public IconLabelEditable() {
this("");
}
- public IconLabelEditable(final AbstractImagePrototype icon, final String text, final boolean useDoubleClick) {
+ public IconLabelEditable(final AbstractImagePrototype icon, final String text, final boolean useDoubleClick) { // NO_UCD
+ super();
label = new IconLabel(icon, text);
init(text, useDoubleClick);
}
- public IconLabelEditable(final AbstractImagePrototype icon, final String text, final String targetHistoryToken,
+ public IconLabelEditable(final AbstractImagePrototype icon, final String text, final String targetToken, // NO_UCD
final boolean useDoubleClick) {
- label = new IconHyperlink(icon, text, targetHistoryToken);
+ super();
+ label = new IconHyperlink(icon, text, targetToken);
init(text, useDoubleClick);
}
@@ -63,11 +69,12 @@
this(text, false);
}
- public IconLabelEditable(final String text, final boolean useDoubleClick) {
- this(text, false, false);
+ public IconLabelEditable(final String text, final boolean useDoubleClick) { // NO_UCD
+ this(text, false, useDoubleClick);
}
- public IconLabelEditable(final String text, final boolean wordWrap, final boolean useDoubleClick) {
+ public IconLabelEditable(final String text, final boolean wordWrap, final boolean useDoubleClick) { // NO_UCD
+ super();
label = new LabelWrapper(text, wordWrap);
init(text, useDoubleClick);
}
@@ -82,45 +89,41 @@
}
public void onEdit(final Listener2<String, String> slot) {
- onEdit.add(slot);
+ onEditEvent.add(slot);
}
- public void setClickToRenameLabel(final String clickToRenameLabel) {
- this.clickToRenameLabel = clickToRenameLabel;
+ /**
+ * Sets the text tooltip showed to indicate "click to rename".
+ *
+ * @param text
+ * the new click to rename label
+ */
+ public void setClickToRenameLabel(final String text) {
+ this.clickLabel = text;
}
- public void setDoubleClickToRenameLabel(final String doubleClickToRenameLabel) {
- this.doubleClickToRenameLabel = doubleClickToRenameLabel;
+ /**
+ * Sets the text tooltip showed to indicate "double click to rename".
+ *
+ * @param text
+ * the new double click to rename label
+ */
+ public void setDoubleClickToRenameLabel(final String text) {
+ this.dblClickLabel = text;
}
public void setEditable(final boolean editable) {
- reset();
- if (editable) {
- if (useDoubleClick) {
- label.setTitle(doubleClickToRenameLabel);
- label.addDoubleClickListener(listener);
- } else {
- label.setTitle(clickToRenameLabel);
- label.addClickListener(listener);
- }
- label.addStyleDependentName("editable");
- // label.addDoubleClickListener(listener);
- label.addMouseListener(mouseOverListener);
- } else {
- label.setTitle(null);
- label.addStyleDependentName("noneditable");
- }
+ setEditableImpl(editable);
}
public void setText(final String text) {
- this.currentText = text;
- label.setText(text);
+ setTextImpl(text);
}
private void afterEdit() {
- String text = editor.getText();
- onEdit.fire(currentText, text);
- setText(text);
+ final String text = editor.getText();
+ onEditEvent.fire(currentText, text);
+ setTextImpl(text);
editor.setVisible(false);
editor.setReadOnly(true);
label.setVisible(true);
@@ -128,12 +131,12 @@
}
private void init(final String text, final boolean useDoubleClick) {
- this.onEdit = new Event2<String, String>("onLabelEdit");
- doubleClickToRenameLabel = "Double click to rename";
- clickToRenameLabel = "Click to rename";
- hp = new HorizontalPanel();
- hp.add((Widget) label);
- initWidget(hp);
+ this.onEditEvent = new Event2<String, String>("onLabelEdit");
+ dblClickLabel = "Double click to rename";
+ clickLabel = "Click to rename";
+ hpanel = new HorizontalPanel();
+ hpanel.add((Widget) label);
+ initWidget(hpanel);
this.currentText = text;
this.useDoubleClick = useDoubleClick;
this.listener = new ClickListener() {
@@ -155,7 +158,7 @@
};
label.setStylePrimaryName("kune-EditableLabel");
label.addMouseListener(mouseOverListener);
- setEditable(false);
+ setEditableImpl(false);
}
private void reset() {
@@ -166,15 +169,40 @@
label.removeMouseListener(mouseOverListener);
}
+ private void setEditableImpl(final boolean editable) {
+ reset();
+ if (editable) {
+ if (useDoubleClick) {
+ label.setTitle(dblClickLabel);
+ label.addDoubleClickListener(listener);
+ } else {
+ label.setTitle(clickLabel);
+ label.addClickListener(listener);
+ }
+ label.addStyleDependentName("editable");
+ // label.addDoubleClickListener(listener);
+ label.addMouseListener(mouseOverListener);
+ } else {
+ label.setTitle(null);
+ label.addStyleDependentName("noneditable");
+ }
+ }
+
+ private void setTextImpl(final String text) {
+ this.currentText = text;
+ label.setText(text);
+ }
+
private void showEditor() {
- int hpWidth = hp.getParent().getOffsetWidth();
+ final int hpWidth = hpanel.getParent().getOffsetWidth();
label.setVisible(false);
if (editor == null) {
editor = new TextBox();
editor.setStyleName("k-eil-edit");
- hp.add(editor);
+ hpanel.add(editor);
editor.addFocusListener(new FocusListener() {
public void onFocus(final Widget sender) {
+ // doNothing
}
public void onLostFocus(final Widget sender) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -29,7 +29,7 @@
import com.gwtext.client.widgets.ToolTip;
import com.gwtext.client.widgets.form.Field;
-public class KuneUiUtils {
+public final class KuneUiUtils {
public enum IconPosition {
left, right
@@ -67,24 +67,20 @@
iconImg.setStyleName("vamiddle");
// setQuickTip(iconImg, tipText, tipTitle);
- ToolTip tooltip = new ToolTip();
+ final ToolTip tooltip = new ToolTip();
tooltip.setHtml(tipText);
tooltip.setWidth(250);
tooltip.applyTo(iconImg.getElement());
- switch (iconPosition) {
- case left:
+ if (iconPosition.equals(IconPosition.left)) {
tipHtml += iconImg.toString();
tipHtml += " ";
tipHtml += labelText;
- break;
- case right:
+ } else if (iconPosition.equals(IconPosition.right)) {
tipHtml += labelText;
tipHtml += " ";
tipHtml += iconImg.toString();
- break;
}
-
tipHtml += "</span>";
return tipHtml;
}
@@ -114,7 +110,7 @@
if (tipText == null || tipText.length() == 0) {
DOM.removeElementAttribute(element, "ext:qtip");
} else {
- ToolTip tip = new ToolTip();
+ final ToolTip tip = new ToolTip();
tip.setHtml(tipText);
if (tipTitle != null) {
tip.setTitle(tipTitle);
@@ -141,4 +137,7 @@
public static void setUnselectable(final Element element) {
Ext.get(element).unselectable();
}
+
+ private KuneUiUtils() {
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/LabelWrapper.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/LabelWrapper.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/LabelWrapper.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -26,8 +26,9 @@
import com.google.gwt.user.client.ui.Label;
public class LabelWrapper extends Label implements AbstractLabel {
- private ClickListenerCollection doubleClickListeners;
+ private transient ClickListenerCollection dblClickListeners;
+
public LabelWrapper() {
super();
}
@@ -41,32 +42,29 @@
super(text, wordWrap);
}
- public void setColor(final String color) {
- DOM.setStyleAttribute(super.getElement(), "color", color);
+ public void addDoubleClickListener(final ClickListener listener) {
+ if (dblClickListeners == null) {
+ dblClickListeners = new ClickListenerCollection();
+ }
+ dblClickListeners.add(listener);
}
- public void addDoubleClickListener(final ClickListener listener) {
- if (doubleClickListeners == null) {
- doubleClickListeners = new ClickListenerCollection();
+ @Override
+ public void onBrowserEvent(final Event event) {
+ if (DOM.eventGetType(event) == Event.ONDBLCLICK && dblClickListeners != null) {
+ dblClickListeners.fireClick(this);
}
- doubleClickListeners.add(listener);
+ super.onBrowserEvent(event);
}
public void removeDoubleClickListener(final ClickListener listener) {
- if (doubleClickListeners != null) {
- doubleClickListeners.remove(listener);
+ if (dblClickListeners != null) {
+ dblClickListeners.remove(listener);
}
}
- public void onBrowserEvent(final Event event) {
- switch (DOM.eventGetType(event)) {
- case Event.ONDBLCLICK:
-
- if (doubleClickListeners != null) {
- doubleClickListeners.fireClick(this);
- }
- break;
- }
- super.onBrowserEvent(event);
+ public void setColor(final String color) {
+ DOM.setStyleAttribute(super.getElement(), "color", color);
}
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/RoundedPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/RoundedPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/RoundedPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -183,6 +183,13 @@
*/
public class RoundedPanel extends SimplePanel {
+ private static final String _1PX = "1px";
+ private static final String _2PX = "2px";
+ private static final String _3PX = "3px";
+ private static final String _4PX = "4px";
+ private static final String _5PX = "5px";
+ private static final String _6PX = "6px";
+
/**
* <code>TOPLEFT</code> top left rounded corner
*/
@@ -236,29 +243,26 @@
/**
* Lookup table for corner border width
*/
- private final static String[][] CORNERBORDER = { { "1px" }, { "1px", "1px" }, { "1px", "1px", "1px" },
- { "1px", "1px", "1px", "1px" }, { "1px", "1px", "1px", "2px", "1px" },
- { "1px", "1px", "1px", "1px", "2px", "1px" }, { "1px", "1px", "1px", "1px", "1px", "2px", "1px" },
- { "1px", "1px", "1px", "1px", "1px", "2px", "2px", "1px" },
- { "1px", "1px", "1px", "1px", "1px", "1px", "2px", "3px", "1px" } };
+ private final static String[][] CORNERBORDER = { { _1PX }, { _1PX, _1PX }, { _1PX, _1PX, _1PX },
+ { _1PX, _1PX, _1PX, _1PX }, { _1PX, _1PX, _1PX, _2PX, _1PX }, { _1PX, _1PX, _1PX, _1PX, _2PX, _1PX },
+ { _1PX, _1PX, _1PX, _1PX, _1PX, _2PX, _1PX }, { _1PX, _1PX, _1PX, _1PX, _1PX, _2PX, _2PX, _1PX },
+ { _1PX, _1PX, _1PX, _1PX, _1PX, _1PX, _2PX, _3PX, _1PX } };
/**
* Lookup table for corner height
*/
- private final static String[][] CORNERHEIGHT = { { "1px" }, { "1px", "1px" }, { "1px", "1px", "1px" },
- { "1px", "1px", "1px", "1px" }, { "2px", "1px", "1px", "1px", "1px" },
- { "2px", "1px", "1px", "1px", "1px", "1px" }, { "2px", "1px", "1px", "1px", "1px", "1px", "1px" },
- { "2px", "1px", "1px", "1px", "1px", "1px", "1px", "1px" },
- { "3px", "2px", "1px", "1px", "1px", "1px", "1px", "1px", "1px" } };
+ private final static String[][] CORNERHEIGHT = { { _1PX }, { _1PX, _1PX }, { _1PX, _1PX, _1PX },
+ { _1PX, _1PX, _1PX, _1PX }, { _2PX, _1PX, _1PX, _1PX, _1PX }, { _2PX, _1PX, _1PX, _1PX, _1PX, _1PX },
+ { _2PX, _1PX, _1PX, _1PX, _1PX, _1PX, _1PX }, { _2PX, _1PX, _1PX, _1PX, _1PX, _1PX, _1PX, _1PX },
+ { _3PX, _2PX, _1PX, _1PX, _1PX, _1PX, _1PX, _1PX, _1PX } };
/**
* Lookup table for corner margin
*/
- private final static String[][] CORNERMARGIN = { { "1px" }, { "1px", "2px" }, { "1px", "2px", "3px" },
- { "1px", "2px", "3px", "4px" }, { "1px", "2px", "3px", "4px", "6px" },
- { "1px", "2px", "3px", "4px", "5px", "7px" }, { "1px", "2px", "3px", "4px", "5px", "6px", "8px" },
- { "1px", "2px", "3px", "4px", "5px", "6px", "8px", "10px" },
- { "1px", "2px", "3px", "4px", "5px", "6px", "7px", "9px", "12px" }, };
+ private final static String[][] CORNERMARGIN = { { _1PX }, { _1PX, _2PX }, { _1PX, _2PX, _3PX },
+ { _1PX, _2PX, _3PX, _4PX }, { _1PX, _2PX, _3PX, _4PX, _6PX }, { _1PX, _2PX, _3PX, _4PX, _5PX, "7px" },
+ { _1PX, _2PX, _3PX, _4PX, _5PX, _6PX, "8px" }, { _1PX, _2PX, _3PX, _4PX, _5PX, _6PX, "8px", "10px" },
+ { _1PX, _2PX, _3PX, _4PX, _5PX, _6PX, "7px", "9px", "12px" }, };
/**
* Element array containing all div elements of the top corner div's.
@@ -348,6 +352,8 @@
divb[i] = addLine(cb, cornerHeight - (i + 1));
}
}
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 14:17
setCornerStyleName(RPSTYLE);
}
@@ -450,6 +456,7 @@
* @param style
* css style name
*/
+ @Override
public void setStyleName(final String style) {
DOM.setElementProperty(body, "className", style);
}
@@ -457,25 +464,12 @@
/**
* Overwrite of parent getContainerElement()
*/
+ @Override
protected Element getContainerElement() {
return divElement;
}
/**
- * Convenience method to check if given <code>input</code> is with the
- * <code>mask</code>.
- *
- * @param input
- * input to check
- * @param mask
- * mask to check against
- * @return true if input within mask
- */
- protected boolean inMask(final int input, final int mask) {
- return (input & mask) > 0;
- }
-
- /**
* Creates div element representing part of the rounded corner.
*
* @param corner
@@ -501,4 +495,18 @@
DOM.appendChild(body, div);
return div;
}
+
+ /**
+ * Convenience method to check if given <code>input</code> is with the
+ * <code>mask</code>.
+ *
+ * @param input
+ * input to check
+ * @param mask
+ * mask to check against
+ * @return true if input within mask
+ */
+ private boolean inMask(final int input, final int mask) {
+ return (input & mask) > 0;
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDropConfiguration.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDropConfiguration.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDropConfiguration.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -51,7 +51,7 @@
public GridDropConfiguration(final String ddGroupId, final Listener<String> listener) {
this.ddGroupId = ddGroupId;
this.onDrop = new Event<String>("onDrop");
- this.onDrop(listener);
+ this.onDropImpl(listener);
}
public void fire(final String id) {
@@ -63,6 +63,10 @@
}
public void onDrop(final Listener<String> listener) {
+ onDropImpl(listener);
+ }
+
+ private void onDropImpl(final Listener<String> listener) {
onDrop.add(listener);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridGroup.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridGroup.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridGroup.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -21,7 +21,7 @@
public class GridGroup {
- public static GridGroup NoGridGroup = new GridGroup("", "", "", "", false);
+ public static GridGroup noGridGroup = new GridGroup("", "", "", "", false);
private String name;
private String tooltipTitle;
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -282,14 +282,14 @@
}
}
- private void configureDrag(final GridDragConfiguration gridDragConfiguration) {
+ private void configureDragImpl(final GridDragConfiguration gridDragConfiguration) {
// TODO: put this in GDConf
grid.setEnableDragDrop(true);
grid.setDdGroup(gridDragConfiguration.getDdGroupId());
grid.setDragDropText(gridDragConfiguration.getDragMessage());
}
- private void configureDrop(final GridDropConfiguration gridDropConfiguration) {
+ private void configureDropImpl(final GridDropConfiguration gridDropConfiguration) {
// TODO: put this in GDConf
grid.setEnableDragDrop(true);
grid.setDdGroup(gridDropConfiguration.getDdGroupId());
@@ -346,24 +346,24 @@
final String commonTootipHtmlRender = "<span ext:qtitle=\"{1}\" ext:qtip=\"{2}\">{0}</span>";
final Renderer iconHtmlRenderer = new Renderer() {
- public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum,
- Store store) {
+ public String render(final Object value, final CellMetadata cellMetadata, final Record record,
+ final int rowIndex, final int colNum, final Store store) {
return Format.format(commonTootipHtmlRender, new String[] { record.getAsString(ICON_HTML),
record.getAsString(TOOLTIPTITLE), record.getAsString(TOOLTIP) });
}
};
final Renderer titleHtmlRenderer = new Renderer() {
- public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum,
- Store store) {
+ public String render(final Object value, final CellMetadata cellMetadata, final Record record,
+ final int rowIndex, final int colNum, final Store store) {
return Format.format(commonTootipHtmlRender, new String[] { record.getAsString(TITLE_HTML),
record.getAsString(TOOLTIPTITLE), record.getAsString(TOOLTIP) });
}
};
final Renderer endIconHtmlRenderer = new Renderer() {
- public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum,
- Store store) {
+ public String render(final Object value, final CellMetadata cellMetadata, final Record record,
+ final int rowIndex, final int colNum, final Store store) {
return Format.format(commonTootipHtmlRender, new String[] { record.getAsString(END_ICON_HTML),
record.getAsString(TOOLTIPTITLE), record.getAsString(TOOLTIP) });
}
@@ -398,7 +398,7 @@
grid.addGridRowListener(new GridRowListener() {
public void onRowClick(final GridPanel grid, final int rowIndex, final EventObject e) {
showMenu(rowIndex, e);
- onClick(rowIndex);
+ onClickImpl(rowIndex);
}
public void onRowContextMenu(final GridPanel grid, final int rowIndex, final EventObject e) {
@@ -406,7 +406,7 @@
}
public void onRowDblClick(final GridPanel grid, final int rowIndex, final EventObject e) {
- onDoubleClick(rowIndex);
+ onDoubleClickImpl(rowIndex);
}
private void showMenu(final int rowIndex, final EventObject e) {
@@ -461,22 +461,22 @@
grid.setAutoHeight(true);
if (gridDropConfiguration != null) {
- configureDrop(gridDropConfiguration);
+ configureDropImpl(gridDropConfiguration);
}
if (gridDragConfiguration != null) {
- configureDrag(gridDragConfiguration);
+ configureDragImpl(gridDragConfiguration);
} else {
grid.setDraggable(false);
}
super.add(grid);
}
- private void onClick(final int rowIndex) {
+ private void onClickImpl(final int rowIndex) {
final Record record = store.getRecordAt(rowIndex);
onClick.fire(record.getAsString(ID));
}
- private void onDoubleClick(final int rowIndex) {
+ private void onDoubleClickImpl(final int rowIndex) {
final Record record = store.getRecordAt(rowIndex);
onDoubleClick.fire(record.getAsString(ID));
}
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/AbstractPalettePanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -26,7 +26,6 @@
popupPalette.setVisible(true);
}
- protected void createPalette() {
- }
+ protected abstract void createPalette();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -11,9 +11,9 @@
public interface RTEditor {
- public final ActionToolbarPosition topbarPosition = new ActionToolbarPosition("rte-topbar");
- public final ActionToolbarPosition sndbarPosition = new ActionToolbarPosition("rte-sndbar");;
- public final ActionToolbarPosition linkCtxPosition = new ActionToolbarPosition("rte-linkctx");;
+ ActionToolbarPosition TOPBAR = new ActionToolbarPosition("rte-topbar");
+ ActionToolbarPosition SNDBAR = new ActionToolbarPosition("rte-sndbar");;
+ ActionToolbarPosition LINKCTX = new ActionToolbarPosition("rte-linkctx");;
void addAction(ActionDescriptor<Object> action);
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -42,7 +42,7 @@
private final String fontNames[] = { "Times New Roman", "Arial", "Courier New", "Georgia", "Trebuchet", "Verdana" };
private final String fontSizes[] = { "Extra small", "Very small (normal)", "Small", "Medium", "Large",
"Very large", "Extra large" };
- private static final RichTextArea.FontSize[] fontSizesConstants = new RichTextArea.FontSize[] {
+ 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 };
@@ -139,8 +139,8 @@
public void attach() {
topBar.clear();
sndBar.clear();
- topBar.addActions(actions, topbarPosition);
- sndBar.addActions(actions, sndbarPosition);
+ topBar.addActions(actions, TOPBAR);
+ sndBar.addActions(actions, SNDBAR);
view.addActions(actions);
}
@@ -241,7 +241,7 @@
private void createBasicActions() {
ActionToolbarMenuDescriptor<Object> selectAll = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
view.selectAll();
}
@@ -254,7 +254,7 @@
selectAll.setTopSeparator(true);
selectAll.setBottomSeparator(true);
- bold = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
+ bold = new ActionToolbarPushButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() {
public void onEvent() {
view.toggleBold();
fireOnEdit();
@@ -265,7 +265,7 @@
bold.setShortcut(new ShortcutDescriptor(true, 'B'));
bold.setAddCondition(canBeBasic);
- italic = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
+ italic = new ActionToolbarPushButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() {
public void onEvent() {
view.toggleItalic();
fireOnEdit();
@@ -277,7 +277,7 @@
italic.setAddCondition(canBeBasic);
italic.setAddCondition(canBeBasic);
- underline = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
+ underline = new ActionToolbarPushButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() {
public void onEvent() {
view.toggleUnderline();
fireOnEdit();
@@ -289,7 +289,7 @@
underline.setAddCondition(canBeBasic);
ActionToolbarMenuDescriptor<Object> subscript = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
view.toggleSubscript();
fireOnEdit();
@@ -302,7 +302,7 @@
subscript.setAddCondition(canBeBasic);
ActionToolbarMenuDescriptor<Object> superscript = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
view.toggleSuperscript();
fireOnEdit();
@@ -315,7 +315,7 @@
superscript.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> justifyLeft = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.justifyLeft();
fireOnEdit();
@@ -327,7 +327,7 @@
justifyLeft.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> justifyCentre = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.justifyCenter();
fireOnEdit();
@@ -339,7 +339,7 @@
justifyCentre.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> justifyRight = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.justifyRight();
fireOnEdit();
@@ -350,7 +350,7 @@
justifyRight.setShortcut(new ShortcutDescriptor(true, 'R'));
justifyRight.setAddCondition(canBeBasic);
- ActionToolbarMenuDescriptor<Object> undo = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
+ ActionToolbarMenuDescriptor<Object> undo = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
new Listener0() {
public void onEvent() {
view.undo();
@@ -363,7 +363,7 @@
undo.setAddCondition(canBeExtended);
undo.setIconCls(getCssName(imgResources.undo()));
- ActionToolbarMenuDescriptor<Object> redo = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
+ ActionToolbarMenuDescriptor<Object> redo = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
new Listener0() {
public void onEvent() {
view.redo();
@@ -378,7 +378,7 @@
redo.setIconCls(getCssName(imgResources.redo()));
ActionToolbarButtonDescriptor<Object> undoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.undo();
fireOnEdit();
@@ -390,7 +390,7 @@
undoBtn.setPosition(0);
ActionToolbarButtonDescriptor<Object> redoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.redo();
fireOnEdit();
@@ -402,7 +402,7 @@
redoBtn.setPosition(1);
redoBtn.setRightSeparator(ActionToolbarButtonSeparator.separator);
- ActionToolbarMenuDescriptor<Object> copy = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
+ ActionToolbarMenuDescriptor<Object> copy = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
new Listener0() {
public void onEvent() {
view.copy();
@@ -414,7 +414,7 @@
copy.setAddCondition(canBeExtended);
copy.setIconCls(getCssName(imgResources.copy()));
- ActionToolbarMenuDescriptor<Object> cut = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
+ ActionToolbarMenuDescriptor<Object> cut = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
new Listener0() {
public void onEvent() {
view.cut();
@@ -427,7 +427,7 @@
cut.setAddCondition(canBeExtended);
cut.setIconCls(getCssName(imgResources.cut()));
- ActionToolbarMenuDescriptor<Object> paste = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
+ ActionToolbarMenuDescriptor<Object> paste = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
new Listener0() {
public void onEvent() {
view.paste();
@@ -441,7 +441,7 @@
paste.setIconCls(getCssName(imgResources.paste()));
ActionToolbarMenuDescriptor<Object> editHtml = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
if (updateHtmlListener == null) {
@@ -465,7 +465,7 @@
editHtml.setAddCondition(canBeExtended);
ActionToolbarMenuDescriptor<Object> comment = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -507,7 +507,7 @@
comment.setEnableCondition(isInsertHtmlSupported());
comment.setAddCondition(canBeExtended);
- ActionToolbarMenuDescriptor<Object> hr = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
+ ActionToolbarMenuDescriptor<Object> hr = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
new Listener0() {
public void onEvent() {
view.focus();
@@ -522,7 +522,7 @@
hr.setAddCondition(canBeExtended);
ActionToolbarMenuDescriptor<Object> blockquote = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
view.focus();
view.insertBlockquote();
@@ -534,7 +534,7 @@
blockquote.setAddCondition(canBeExtended);
ActionToolbarButtonDescriptor<Object> hrButton = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.focus();
view.insertHorizontalRule();
@@ -545,7 +545,7 @@
hrButton.setToolTip(i18n.t("Horizontal line"));
hrButton.setAddCondition(canBeExtended);
- strikethrough = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
+ strikethrough = new ActionToolbarPushButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() {
public void onEvent() {
view.toggleStrikethrough();
fireOnEdit();
@@ -557,7 +557,7 @@
strikethrough.setAddCondition(canBeExtended);
ActionToolbarButtonDescriptor<Object> decreaseIndent = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.leftIndent();
fireOnEdit();
@@ -568,7 +568,7 @@
decreaseIndent.setAddCondition(canBeExtended);
ActionToolbarButtonDescriptor<Object> increaseIndent = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.rightIndent();
fireOnEdit();
@@ -578,7 +578,7 @@
increaseIndent.setToolTip(i18n.t("Increase Indent"));
increaseIndent.setAddCondition(canBeExtended);
- ActionToolbarButtonDescriptor<Object> ol = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
+ ActionToolbarButtonDescriptor<Object> ol = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR,
new Listener0() {
public void onEvent() {
view.insertOrderedList();
@@ -590,7 +590,7 @@
ol.setShortcut(new ShortcutDescriptor(true, '7'));
ol.setAddCondition(canBeExtended);
- ActionToolbarButtonDescriptor<Object> ul = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
+ ActionToolbarButtonDescriptor<Object> ul = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR,
new Listener0() {
public void onEvent() {
view.insertUnorderedList();
@@ -604,7 +604,7 @@
ul.setAddCondition(canBeExtended);
ActionToolbarButtonDescriptor<Object> imgBtn = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -636,10 +636,10 @@
imgMenu.setTextDescription(i18n.t("Image..."));
imgMenu.setToolTip(null);
imgMenu.setParentMenuTitle(i18n.t(INSERT_MENU));
- imgMenu.setActionPosition(topbarPosition);
+ imgMenu.setActionPosition(TOPBAR);
final ActionToolbarMenuDescriptor<Object> insertMedia = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -666,7 +666,7 @@
insertMedia.setAddCondition(canBeExtended);
insertMedia.setParentMenuTitle(i18n.t(INSERT_MENU));
ActionToolbarButtonDescriptor<Object> createOrEditLinkBtn = new ActionToolbarButtonDescriptor<Object>(
- accessRol, sndbarPosition, new Listener0() {
+ accessRol, SNDBAR, new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -709,17 +709,17 @@
createOrEditLink.setTextDescription(i18n.t("Link...") + createOrEditLinkBtn.getShortcutToS());
createOrEditLink.setToolTip(null);
createOrEditLink.setShortcut(null);
- createOrEditLink.setActionPosition(topbarPosition);
+ createOrEditLink.setActionPosition(TOPBAR);
createOrEditLink.setParentMenuTitle(i18n.t(INSERT_MENU));
ActionToolbarMenuDescriptor<Object> editLinkCtx = new ActionToolbarMenuDescriptor<Object>(createOrEditLink);
editLinkCtx.setTextDescription(i18n.t("Change"));
editLinkCtx.setToolTip(null);
editLinkCtx.setShortcut(null);
- editLinkCtx.setActionPosition(linkCtxPosition);
+ editLinkCtx.setActionPosition(LINKCTX);
ActionToolbarButtonDescriptor<Object> removeLink = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
if (view.isAnythingSelected()) {
// we try to unlink the selection
@@ -745,10 +745,10 @@
removeLinkCtx.setTextDescription(i18n.t("Remove"));
removeLinkCtx.setToolTip(null);
removeLinkCtx.setShortcut(null);
- removeLinkCtx.setActionPosition(linkCtxPosition);
+ removeLinkCtx.setActionPosition(LINKCTX);
final ActionToolbarMenuDescriptor<Object> removeFormat = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
view.removeFormat();
fireOnEdit();
@@ -762,7 +762,7 @@
removeFormat.setBottomSeparator(true);
final ActionToolbarButtonDescriptor<Object> removeFormatBtn = new ActionToolbarButtonDescriptor<Object>(
- accessRol, sndbarPosition, new Listener0() {
+ accessRol, SNDBAR, new Listener0() {
public void onEvent() {
view.removeFormat();
fireOnEdit();
@@ -775,7 +775,7 @@
removeFormatBtn.setRightSeparator(ActionToolbarButtonSeparator.separator);
final ActionToolbarMenuDescriptor<Object> insertSpecialChar = new ActionToolbarMenuDescriptor<Object>(
- accessRol, topbarPosition, new Listener0() {
+ accessRol, TOPBAR, new Listener0() {
public void onEvent() {
NotifyUser.showProgressLoading();
if (insertSpecialCharListener == null) {
@@ -798,7 +798,7 @@
insertSpecialChar.setTopSeparator(true);
final ActionToolbarMenuDescriptor<Object> insertTable = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
onInsertTablePressed();
}
@@ -808,7 +808,7 @@
insertTable.setAddCondition(canBeExtended);
insertTable.setParentMenuTitle(i18n.t(INSERT_MENU));
- insertTableBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
+ insertTableBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() {
public void onEvent() {
onInsertTablePressed();
}
@@ -819,7 +819,7 @@
insertTableBtn.setRightSeparator(ActionToolbarButtonSeparator.separator);
final ActionToolbarButtonDescriptor<Object> fontColor = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
getPalette();
palette.show(getActionLeftPosition(sndBar, insertTableBtn), getActionTopPosition(sndBar,
@@ -838,7 +838,7 @@
fontColor.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> backgroundColor = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
getPalette();
palette.show(getActionLeftPosition(sndBar, fontColor), getActionTopPosition(sndBar, fontColor),
@@ -857,7 +857,7 @@
backgroundColor.setAddCondition(canBeBasic);
final ActionToolbarMenuDescriptor<Object> devInfo = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -931,7 +931,7 @@
private ActionToolbarMenuDescriptor<Object> createFontNameAction(final ActionAddCondition<Object> canBeBasic,
final String fontName) {
final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.setFontName(fontName);
fireOnEdit();
@@ -947,9 +947,9 @@
private ActionToolbarMenuDescriptor<Object> createFontSizeAction(final ActionAddCondition<Object> canBeBasic,
final int fontSize, final String fontSizeName) {
final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
- view.setFontSize(fontSizesConstants[fontSize]);
+ view.setFontSize(FONT_SIZES[fontSize]);
fireOnEdit();
}
});
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImpl.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImpl.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImpl.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -32,6 +32,7 @@
protected Element elem;
public RichTextAreaImpl() {
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09 14:39
elem = createElement();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplSafari.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplSafari.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplSafari.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -23,6 +23,7 @@
*/
public class RichTextAreaImplSafari extends RichTextAreaImplStandard {
+ // @PMD:REVIEWED:VariableNamingConventions: by vjrj on 21/05/09 16:12
private static final String[] sizeNumberCSSValues = new String[] { "medium", "xx-small", "x-small", "small",
"medium", "large", "x-large", "xx-large" };
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplStandard.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplStandard.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplStandard.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -118,6 +118,7 @@
}
@Override
+ // @PMD:REVIEWED:EmptyMethodInAbstractClassShouldBeAbstract: by vjrj on 21/05/09 13:58
public boolean isBasicEditingSupported() {
return true;
}
@@ -127,6 +128,7 @@
}
@Override
+ // @PMD:REVIEWED:EmptyMethodInAbstractClassShouldBeAbstract: by vjrj on 21/05/09 13:58
public boolean isExtendedEditingSupported() {
return true;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -38,8 +38,8 @@
this.src = src;
this.wraptext = wraptext;
this.clickOriginal = clickOriginal;
- this.setPosition(position);
- this.setSize(size);
+ setPositionImpl(position);
+ setSizeImpl(size);
}
public boolean getClickOriginal() {
@@ -80,11 +80,11 @@
}
public void setPosition(final String position) {
- this.position = position;
+ setPositionImpl(position);
}
public void setSize(final String size) {
- this.size = size;
+ setSizeImpl(size);
}
public void setSrc(final String src) {
@@ -116,4 +116,12 @@
}
return "";
}
+
+ private void setPositionImpl(final String position) {
+ this.position = position;
+ }
+
+ private void setSizeImpl(final String size) {
+ this.size = size;
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/LinkInfo.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/LinkInfo.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/LinkInfo.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -11,13 +11,13 @@
private static final String NO_TARGET = null;
public static LinkInfo parse(final Element element) {
- String target = element.getAttribute(TARGET);
+ final String target = element.getAttribute(TARGET);
return new LinkInfo(element.getInnerText(), element.getTitle(), element.getAttribute(HREF), target != null
&& target.equals(_BLANK));
}
public static LinkInfo parse(final org.xwiki.gwt.dom.client.Element element) {
- String target = element.getAttribute(TARGET);
+ final String target = element.getAttribute(TARGET);
return new LinkInfo(element.getInnerText(), element.getTitle(), element.getAttribute(HREF), target != null
&& target.equals(_BLANK));
}
@@ -40,12 +40,12 @@
this.text = text;
this.href = href;
this.title = title;
- setInNewWindow(inNewWindow);
+ setInNewWindowImpl(inNewWindow);
}
public Element getElement() {
- Element anchor = DOM.createAnchor();
- com.google.gwt.user.client.Element element = (com.google.gwt.user.client.Element) anchor;
+ final Element anchor = DOM.createAnchor();
+ final com.google.gwt.user.client.Element element = (com.google.gwt.user.client.Element) anchor;
DOM.setElementProperty(element, HREF, href);
if (getTarget() != NO_TARGET) {
DOM.setElementProperty(element, TARGET, getTarget());
@@ -74,10 +74,10 @@
}
public boolean inSameWindow() {
- if (target != NO_TARGET) {
+ if (target.equals(NO_TARGET)) {
+ return false;
+ } else {
return target.equals(_BLANK);
- } else {
- return false;
}
}
@@ -86,15 +86,11 @@
}
public void setInNewWindow(final boolean inNewWindow) {
- if (inNewWindow) {
- this.setTarget(_BLANK);
- } else {
- setTarget(NO_TARGET);
- }
+ setInNewWindowImpl(inNewWindow);
}
public void setTarget(final String target) {
- this.target = target;
+ setTargetImpl(target);
}
public void setText(final String text) {
@@ -107,8 +103,20 @@
@Override
public String toString() {
- Element anchor = getElement();
+ final Element anchor = getElement();
return anchor.getString();
}
+ private void setInNewWindowImpl(final boolean inNewWindow) {
+ if (inNewWindow) {
+ setTargetImpl(_BLANK);
+ } else {
+ setTargetImpl(NO_TARGET);
+ }
+ }
+
+ private void setTargetImpl(final String target) {
+ this.target = target;
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -12,7 +12,7 @@
public class InsertMediaAbstractPanel extends InsertElementAbstractPanel implements InsertMediaAbstractView {
- protected TextField hrefField;
+ protected transient TextField hrefField;
public InsertMediaAbstractPanel(final String title, final InsertMediaAbstractPresenter presenter) {
super(title, InsertMediaDialogView.HEIGHT);
@@ -33,7 +33,7 @@
}
});
- insert(1, hrefField);
+ insertImpl(1, hrefField);
defValues();
}
@@ -44,7 +44,7 @@
@Override
public void insert(final int index, final Component component) {
- super.insert(index, component);
+ insertImpl(index, component);
}
@Override
@@ -67,4 +67,8 @@
wrapText.setChecked(true);
positionCombo.setValue(ContentPosition.RIGHT);
}
+
+ private void insertImpl(final int index, final Component component) {
+ super.insert(index, component);
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8/InsertSpecialUTF8CharPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8/InsertSpecialUTF8CharPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8/InsertSpecialUTF8CharPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -83,7 +83,7 @@
private char getCharEntered() {
try {
- return (char) (new Integer(inputUnicodeField.getRawValue())).intValue();
+ return (char) Integer.valueOf(inputUnicodeField.getRawValue()).intValue();
} catch (Exception except) {
Log.debug("Not possible to cast utf8 int to char");
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/inserttable/InsertTableDialogPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/inserttable/InsertTableDialogPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/inserttable/InsertTableDialogPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -17,7 +17,7 @@
view.hide();
}
- public void init(InsertTableDialogView view) {
+ public void init(final InsertTableDialogView view) {
this.view = view;
}
@@ -26,14 +26,14 @@
view.reset();
}
- public void onInsert(String rowsS, String colsS, String borderS) {
+ public void onInsert(final String rowsS, final String colsS, final String borderS) {
if (onInsertTable != null) {
- Integer rows = new Integer(rowsS);
- Integer cols = new Integer(colsS);
- Integer border = new Integer(borderS);
- boolean validRows = rows < MAX_ROWS && rows > 0;
- boolean validCols = cols < MAX_COLS && cols > 0;
- boolean validBorder = border < MAX_BORDER && border > 0;
+ final Integer rows = Integer.valueOf(rowsS);
+ final Integer cols = Integer.valueOf(colsS);
+ final Integer border = Integer.valueOf(borderS);
+ final boolean validRows = rows < MAX_ROWS && rows > 0;
+ final boolean validCols = cols < MAX_COLS && cols > 0;
+ final boolean validBorder = border < MAX_BORDER && border > 0;
onInsertTable.onEvent(createTable(validRows ? rows : MAX_ROWS, validCols ? cols : MAX_COLS,
validBorder ? border : MAX_BORDER));
}
@@ -41,7 +41,7 @@
view.reset();
}
- public void setOnInsertTable(Listener<String> listener) {
+ public void setOnInsertTable(final Listener<String> listener) {
this.onInsertTable = listener;
}
@@ -49,7 +49,7 @@
view.show();
}
- private String createTable(int rows, int cols, int border) {
+ private String createTable(final int rows, final int cols, final int border) {
return view.generateTable(rows, cols, view.getSameColWidth(), view.getBackgroundColor(), border,
view.getBorderColor());
}
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -96,8 +96,7 @@
}
public void onDoSaveAndClose() {
- saveAndCloseConfirmed = true;
- onDoSave();
+ onDoSaveAndCloseImpl();
}
public void onSavedSuccessful() {
@@ -120,40 +119,16 @@
}
protected void onCancel() {
- if (savePending) {
- timer.cancel();
- Listener0 onYes = new Listener0() {
- public void onEvent() {
- onDoSaveAndClose();
- }
- };
- Listener0 onCancel = new Listener0() {
- public void onEvent() {
- onCancelConfirmed();
- }
- };
- view.askConfirmation(i18n.t("Save confirmation"),
- i18n.t("Do you want to save before closing the editor?"), onYes, onCancel);
- } else {
- onCancelConfirmed();
- }
+ onCancelImpl();
}
protected void onCancelConfirmed() {
- stateManager.removeBeforeStateChangeListener(beforeStateChangeListener);
- stateManager.resumeTokenChange();
- reset();
- editor.detach();
- onDoEditCancelled();
+ onCancelConfirmedImpl();
}
- protected void onDoSave() {
- onSave.onEvent(editor.getHtml());
- }
-
boolean beforeTokenChange() {
if (savePending) {
- onCancel();
+ onCancelImpl();
return false;
} else {
deferredCommandWrapper.addCommand(new Listener0() {
@@ -165,6 +140,10 @@
}
}
+ void onDoSave() {
+ onDoSaveImpl();
+ }
+
void onEdit() {
if (!savePending) {
savePending = true;
@@ -178,10 +157,10 @@
private void createActions() {
Listener0 onPerformSaveCall = new Listener0() {
public void onEvent() {
- onDoSave();
+ onDoSaveImpl();
}
};
- saveBtn = new ActionToolbarButtonDescriptor<Object>(AccessRolDTO.Editor, RTEditor.sndbarPosition, onPerformSaveCall);
+ saveBtn = new ActionToolbarButtonDescriptor<Object>(AccessRolDTO.Editor, RTEditor.SNDBAR, onPerformSaveCall);
saveBtn.setIconCls(RTEImgResources.SUFFIX + imgResources.save().getName());
saveBtn.setToolTip(i18n.t("Save"));
ShortcutDescriptor ctrl_S = new ShortcutDescriptor(true, 'S');
@@ -189,14 +168,14 @@
saveBtn.setPosition(0);
ActionToolbarMenuDescriptor<Object> save = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
- RTEditor.topbarPosition, onPerformSaveCall);
+ RTEditor.TOPBAR, onPerformSaveCall);
save.setIconCls(RTEImgResources.SUFFIX + imgResources.save().getName());
save.setParentMenuTitle(i18n.t(FILE_DEF_MENU_OPTION));
save.setTextDescription(i18n.t("Save") + (ctrl_S.toString()));
save.setPosition(0);
ActionToolbarMenuCheckItemDescriptor<Object> autoSaveMenuItem = new ActionToolbarMenuCheckItemDescriptor<Object>(AccessRolDTO.Editor,
- RTEditor.topbarPosition, new Listener0() {
+ RTEditor.TOPBAR, new Listener0() {
public void onEvent() {
autoSave = !autoSave;
if (autoSave) {
@@ -213,9 +192,9 @@
autoSaveMenuItem.setTextDescription(i18n.t("Autosave"));
ActionToolbarMenuDescriptor<Object> close = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
- RTEditor.topbarPosition, new Listener<Object>() {
+ RTEditor.TOPBAR, new Listener<Object>() {
public void onEvent(final Object parameter) {
- onCancel();
+ onCancelImpl();
}
});
close.setParentMenuTitle(i18n.t(FILE_DEF_MENU_OPTION));
@@ -225,19 +204,19 @@
public void onEvent() {
if (savePending) {
timer.cancel();
- onDoSaveAndClose();
+ onDoSaveAndCloseImpl();
} else {
- onCancelConfirmed();
+ onCancelConfirmedImpl();
}
}
};
ActionToolbarMenuDescriptor<Object> saveclose = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
- RTEditor.topbarPosition, onPerformSaveAndCloseCall);
+ RTEditor.TOPBAR, onPerformSaveAndCloseCall);
saveclose.setParentMenuTitle(i18n.t(FILE_DEF_MENU_OPTION));
saveclose.setTextDescription(i18n.t("Save & Close"));
ActionToolbarButtonDescriptor<Object> saveCloseBtn = new ActionToolbarButtonDescriptor<Object>(
- AccessRolDTO.Editor, RTEditor.topbarPosition, onPerformSaveAndCloseCall);
+ AccessRolDTO.Editor, RTEditor.TOPBAR, onPerformSaveAndCloseCall);
// saveCloseBtn.setIconCls(RTEImgResources.SUFFIX +
// imgResources.save().getName());
saveCloseBtn.setTextDescription(i18n.t("Save & Close"));
@@ -256,10 +235,47 @@
editor.getSndBar().setButtonEnable(saveBtn, enable);
}
+ private void onCancelConfirmedImpl() {
+ stateManager.removeBeforeStateChangeListener(beforeStateChangeListener);
+ stateManager.resumeTokenChange();
+ reset();
+ editor.detach();
+ onDoEditCancelled();
+ }
+
+ private void onCancelImpl() {
+ if (savePending) {
+ timer.cancel();
+ Listener0 onYes = new Listener0() {
+ public void onEvent() {
+ onDoSaveAndCloseImpl();
+ }
+ };
+ Listener0 onCancel = new Listener0() {
+ public void onEvent() {
+ onCancelConfirmedImpl();
+ }
+ };
+ view.askConfirmation(i18n.t("Save confirmation"),
+ i18n.t("Do you want to save before closing the editor?"), onYes, onCancel);
+ } else {
+ onCancelConfirmedImpl();
+ }
+ }
+
private void onDoEditCancelled() {
onEditCancelled.onEvent();
}
+ private void onDoSaveAndCloseImpl() {
+ saveAndCloseConfirmed = true;
+ onDoSaveImpl();
+ }
+
+ private void onDoSaveImpl() {
+ onSave.onEvent(editor.getHtml());
+ }
+
private void reset() {
timer.cancel();
savePending = false;
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/utils/Convert.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/utils/Convert.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/utils/Convert.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -19,8 +19,11 @@
*/
package org.ourproject.kune.platf.client.utils;
-public class Convert {
- public static int toInt(String value) {
- return new Integer(value).intValue();
+public final class Convert {
+ public static int toInt(final String value) {
+ return Integer.valueOf(value);
}
+
+ private Convert() {
+ };
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/utils/Url.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/utils/Url.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/utils/Url.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -20,10 +20,11 @@
package org.ourproject.kune.platf.client.utils;
import java.util.ArrayList;
+import java.util.List;
public class Url {
- private final String base;
- private final ArrayList<UrlParam> params;
+ private transient final String base;
+ private transient final List<UrlParam> params;
public Url(final String base) {
this.base = base;
@@ -33,12 +34,12 @@
public Url(final String base, final UrlParam... iniParams) {
this(base);
for (UrlParam param : iniParams) {
- add(param);
+ addImpl(param);
}
}
public void add(final UrlParam param) {
- params.add(param);
+ addImpl(param);
}
@Override
@@ -55,4 +56,8 @@
}
return base + paramPart;
}
+
+ private void addImpl(final UrlParam param) {
+ params.add(param);
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/KunePersistenceService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/KunePersistenceService.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/KunePersistenceService.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -37,7 +37,7 @@
persistenceService.start();
databaseInitializer.initConditional();
} catch (Exception e) {
- throw new RuntimeException(e);
+ throw new ServerException("Error starting persistence service", e);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/LoggerMethodInterceptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/LoggerMethodInterceptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/LoggerMethodInterceptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -26,7 +26,7 @@
public class LoggerMethodInterceptor implements MethodInterceptor {
- private static final Log log = LogFactory.getLog(LoggerMethodInterceptor.class);
+ private static final Log LOG = LogFactory.getLog(LoggerMethodInterceptor.class);
private final boolean simplifyNames;
public LoggerMethodInterceptor() {
@@ -40,17 +40,17 @@
public Object invoke(final MethodInvocation invocation) throws Throwable {
logInvocation(invocation);
try {
- Object result = invocation.proceed();
+ final Object result = invocation.proceed();
logResult(invocation, result);
return result;
- } catch (Throwable e) {
+ } catch (Exception e) {
logException(invocation, e);
throw e;
}
}
protected void log(final String output) {
- log.debug(output);
+ LOG.debug(output);
}
protected void logException(final MethodInvocation invocation, final Throwable e) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/OutermostCallInterceptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/OutermostCallInterceptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/OutermostCallInterceptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -28,10 +28,10 @@
/*
* See:
* http://tembrel.blogspot.com/2007/09/matcher-and-methodinterceptor-for-dwr.h…
- *
+ *
*/
-public class OutermostCallInterceptor implements MethodInterceptor {
+public final class OutermostCallInterceptor implements MethodInterceptor {
/**
* Decorates a MethodInterceptor so that only the outermost invocation using
* that interceptor will be intercepted and nested invocations willbe
Added: trunk/src/main/java/org/ourproject/kune/platf/server/ServerException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/ServerException.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/ServerException.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -0,0 +1,31 @@
+package org.ourproject.kune.platf.server;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class ServerException extends RuntimeException {
+
+ private static final long serialVersionUID = 2028618233098694418L;
+
+ private static final Log LOG = LogFactory.getLog(ServerException.class);
+
+ public ServerException() {
+ super();
+ }
+
+ public ServerException(final String text) {
+ super(text);
+ LOG.error(text);
+ }
+
+ public ServerException(final String text, final Throwable cause) {
+ super(text, cause);
+ LOG.error(text, cause);
+ }
+
+ public ServerException(final Throwable cause) {
+ super(cause);
+ LOG.error("ServerManagerException", cause);
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRights.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRights.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRights.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -20,45 +20,46 @@
package org.ourproject.kune.platf.server.access;
public class AccessRights {
- boolean isAdministrable;
- boolean isEditable;
- boolean isVisible;
+ boolean administrable;
+ boolean editable;
+ boolean visible;
public AccessRights() {
this(false, false, false);
}
- public AccessRights(final boolean isAdministrable, final boolean isEditable, final boolean isVisible) {
- this.isAdministrable = isAdministrable;
- this.isEditable = isEditable;
- this.isVisible = isVisible;
+ public AccessRights(final boolean administrable, final boolean editable, final boolean visible) {
+ this.administrable = administrable;
+ this.editable = editable;
+ this.visible = visible;
}
public boolean isAdministrable() {
- return isAdministrable;
+ return administrable;
}
public boolean isEditable() {
- return isEditable;
+ return editable;
}
public boolean isVisible() {
- return isVisible;
+ return visible;
}
public void setAdministrable(final boolean isAdministrable) {
- this.isAdministrable = isAdministrable;
+ this.administrable = isAdministrable;
}
public void setEditable(final boolean isEditable) {
- this.isEditable = isEditable;
+ this.editable = isEditable;
}
public void setVisible(final boolean isVisible) {
- this.isVisible = isVisible;
+ this.visible = isVisible;
}
+ @Override
public String toString() {
- return "AccessRights[a: " + isAdministrable + ", e: " + isEditable + ", v: " + isVisible + "]";
+ return "AccessRights[a: " + administrable + ", e: " + editable + ", v: " + visible + "]";
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -34,7 +34,7 @@
public class AuthenticatedMethodInterceptor implements MethodInterceptor {
- public static final Log log = LogFactory.getLog(AuthenticatedMethodInterceptor.class);
+ public static final Log LOG = LogFactory.getLog(AuthenticatedMethodInterceptor.class);
@Inject
Provider<UserSession> userSessionProvider;
@@ -50,9 +50,9 @@
// Some browsers getCookie returns "null" as String instead of null
final String userHash = arguments[0] == null || arguments[0].equals("null") ? null : (String) arguments[0];
- log.info("Method: " + invocation.getMethod().getName());
- log.info("Userhash received: " + userHash);
- log.info("--------------------------------------------------------------------------------");
+ LOG.info("Method: " + invocation.getMethod().getName());
+ LOG.info("Userhash received: " + userHash);
+ LOG.info("--------------------------------------------------------------------------------");
final UserSession userSession = userSessionProvider.get();
final SessionService sessionService = sessionServiceProvider.get();
@@ -64,18 +64,18 @@
throw new UserMustBeLoggedException();
} else if (userSession.isUserNotLoggedIn() && mandatory) {
sessionService.getNewSession();
- log.info("Session expired (not logged in server and mandatory)");
+ LOG.info("Session expired (not logged in server and mandatory)");
throw new SessionExpiredException();
} else if (userSession.isUserNotLoggedIn() && userHash == null) {
// Ok, do nothing
} else if (userSession.isUserNotLoggedIn() && userHash != null) {
sessionService.getNewSession();
- log.info("Session expired (not logged in server)");
+ LOG.info("Session expired (not logged in server)");
throw new SessionExpiredException();
} else if (!userSession.getHash().equals(userHash)) {
userSession.logout();
sessionService.getNewSession();
- log.info("Session expired (userHash different in server)");
+ LOG.info("Session expired (userHash different in server)");
throw new SessionExpiredException();
}
final Object result = invocation.proceed();
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -38,6 +38,7 @@
import org.ourproject.kune.platf.server.manager.file.FileUtils;
import org.ourproject.kune.platf.server.manager.impl.DefaultManager;
import org.ourproject.kune.platf.server.manager.impl.SearchResult;
+import org.ourproject.kune.platf.server.manager.impl.ServerManagerException;
import org.ourproject.kune.platf.server.utils.FilenameUtils;
import com.google.inject.Inject;
@@ -51,7 +52,7 @@
private final Content contentFinder;
@Inject
- public ContainerManagerDefault(Content contentFinder, Container containerFinder,
+ public ContainerManagerDefault(final Content contentFinder, final Container containerFinder,
final Provider<EntityManager> provider) {
super(provider, Container.class);
this.contentFinder = contentFinder;
@@ -59,7 +60,7 @@
}
public Container createFolder(final Group group, final Container parent, final String name,
- final I18nLanguage language, String typeId) {
+ final I18nLanguage language, final String typeId) {
FilenameUtils.checkBasicFilename(name);
String newtitle = findInexistentName(parent, name);
final List<Container> parentAbsolutePath = parent.getAbsolutePath();
@@ -90,7 +91,7 @@
}
/** Duplicate code in ContentMD **/
- public boolean findIfExistsTitle(Container container, String title) {
+ public boolean findIfExistsTitle(final Container container, final String title) {
return (contentFinder.findIfExistsTitle(container, title) > 0)
|| (containerFinder.findIfExistsTitle(container, title) > 0);
}
@@ -100,7 +101,7 @@
FilenameUtils.checkBasicFilename(newName);
String newNameWithoutNT = FilenameUtils.chomp(newName);
if (container.isRoot()) {
- throw new RuntimeException("Root folder cannot be renamed");
+ throw new DefaultException("Root folder cannot be renamed");
}
if (findIfExistsTitle(container.getParent(), newNameWithoutNT)) {
throw new NameInUseException();
@@ -120,19 +121,19 @@
try {
query = parser.parse(search);
} catch (final ParseException e) {
- throw new RuntimeException("Error parsing search");
+ throw new ServerManagerException("Error parsing search");
}
return super.search(query, firstResult, maxResults);
}
- public void setAccessList(Container container, AccessLists accessList) {
+ public void setAccessList(final Container container, final AccessLists accessList) {
container.setAccessLists(accessList);
persist(container);
}
/** Duplicate code in ContentMD **/
- private String findInexistentName(Container container, String title) {
- String initialTitle = new String(title);
+ private String findInexistentName(final Container container, final String title) {
+ String initialTitle = String.valueOf(title);
while (findIfExistsTitle(container, initialTitle)) {
initialTitle = FileUtils.getNextSequentialFileName(initialTitle);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -45,6 +45,7 @@
import org.ourproject.kune.platf.server.manager.file.FileUtils;
import org.ourproject.kune.platf.server.manager.impl.DefaultManager;
import org.ourproject.kune.platf.server.manager.impl.SearchResult;
+import org.ourproject.kune.platf.server.manager.impl.ServerManagerException;
import org.ourproject.kune.platf.server.utils.FilenameUtils;
import com.google.inject.Inject;
@@ -177,7 +178,7 @@
try {
query = parser.parse(search);
} catch (final ParseException e) {
- throw new RuntimeException("Error parsing search");
+ throw new ServerManagerException("Error parsing search");
}
return super.search(query, firstResult, maxResults);
}
@@ -243,7 +244,7 @@
}
private String findInexistentTitle(final Container container, final String title) {
- String initialTitle = new String(title);
+ String initialTitle = String.valueOf(title);
while (findIfExistsTitle(container, initialTitle)) {
initialTitle = FileUtils.getNextSequentialFileName(initialTitle);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentUtils.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentUtils.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -21,13 +21,18 @@
import org.ourproject.kune.platf.client.errors.ContentNotFoundException;
-public class ContentUtils {
+public final class ContentUtils {
+ // @PMD:REVIEWED:ShortVariable: by vjrj on 21/05/09 14:05
public static Long parseId(final String id) throws ContentNotFoundException {
try {
- return new Long(id);
+ return Long.valueOf(id);
} catch (final NumberFormatException e) {
+ // @PMD:REVIEWED:PreserveStackTrace: by vjrj on 21/05/09 14:05
throw new ContentNotFoundException();
}
}
+
+ private ContentUtils() {
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -64,11 +64,16 @@
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Content implements HasStateToken {
- public static Content NO_CONTENT = new Content();
+ private static final String TITLE = "title";
+ private static final String GROUP = "group";
+ private static final String MIMETYPE = "mimetype";
+ public static final Content NO_CONTENT = new Content();
+
@Id
@DocumentId
@GeneratedValue
+ // @PMD:REVIEWED:ShortVariable: by vjrj on 21/05/09 15:28
private Long id;
@Version
@@ -162,32 +167,32 @@
}
@Finder(query = "FROM Content WHERE lastRevision.title LIKE :title AND (mimeType.mimetype=:mimetype OR mimeType.mimetype=:mimetype2) AND container.owner.shortName=:group AND deletedOn=null ORDER BY lastRevision.title ASC")
- public List<Content> find2Mime(@Named("group") final String groupShortName, @Named("title") final String title,
- @Named("mimetype") final String mimetype, @Named("mimetype2") final String mimetype2,
+ public List<Content> find2Mime(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
+ @Named(MIMETYPE) final String mimetype, @Named("mimetype2") final String mimetype2,
@FirstResult final int offset, @MaxResults final int limit) {
return null;
}
@Finder(query = "SELECT count(id) FROM Content WHERE lastRevision.title LIKE :title AND (mimeType.mimetype=:mimetype OR mimeType.mimetype=:mimetype2) AND container.owner.shortName=:group AND deletedOn=null")
- public int find2MimeCount(@Named("group") final String groupShortName, @Named("title") final String title,
- @Named("mimetype") final String mimetype, @Named("mimetype2") final String mimetype2) {
+ public int find2MimeCount(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
+ @Named(MIMETYPE) final String mimetype, @Named("mimetype2") final String mimetype2) {
return 0;
}
@Finder(query = "select count(*) from Container ctx, Content ctn where ctn.container.id = ctx.id and ctx = :container and ctn.lastRevision.title LIKE :title")
- public Long findIfExistsTitle(@Named("container") final Container container, @Named("title") final String title) {
+ public Long findIfExistsTitle(@Named("container") final Container container, @Named(TITLE) final String title) {
return null;
}
@Finder(query = "FROM Content WHERE lastRevision.title LIKE :title AND mimeType.mimetype=:mimetype AND container.owner.shortName=:group AND deletedOn=null ORDER BY lastRevision.title ASC")
- public List<Content> findMime(@Named("group") final String groupShortName, @Named("title") final String title,
- @Named("mimetype") final String mimetype, @FirstResult final int offset, @MaxResults final int limit) {
+ public List<Content> findMime(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
+ @Named(MIMETYPE) final String mimetype, @FirstResult final int offset, @MaxResults final int limit) {
return null;
}
@Finder(query = "SELECT count(id) FROM Content WHERE lastRevision.title LIKE :title AND mimeType.mimetype=:mimetype AND container.owner.shortName=:group AND deletedOn=null")
- public int findMimeCount(@Named("group") final String groupShortName, @Named("title") final String title,
- @Named("mimetype") final String mimetype) {
+ public int findMimeCount(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
+ @Named(MIMETYPE) final String mimetype) {
return 0;
}
@@ -315,6 +320,7 @@
this.filename = filename;
}
+ // @PMD:REVIEWED:ShortVariable: by vjrj on 21/05/09 15:28
public void setId(final Long id) {
this.id = id;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -58,7 +58,7 @@
// see: http://docs.codehaus.org/display/PICO/Good+Citizen:
// Never expect or return null
- public static Group NO_GROUP = null;
+ public static final Group NO_GROUP = null;
@Id
@DocumentId
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -128,7 +128,7 @@
customProperties = new CustomProperties();
buddiesVisibility = UserBuddiesVisibility.anyone;
this.createdOn = System.currentTimeMillis();
- this.setLastLogin(null);
+ this.lastLogin = null;
}
@Finder(query = "from User")
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -53,13 +53,13 @@
}
public void createOthers() {
- final I18nLanguage english = new I18nLanguage(new Long(1819), "en", "ltr", "English", "", "", "en", "eng",
+ final I18nLanguage english = new I18nLanguage(Long.valueOf(1819), "en", "ltr", "English", "", "", "en", "eng",
"eng", false, "", "", "", "c == 1 ? 1 : 2", null, "L", "MMM d\\, yyyy");
- final I18nLanguage spanish = new I18nLanguage(new Long(5889), "es", "ltr", "Spanish", "", "", "es", "spa",
+ final I18nLanguage spanish = new I18nLanguage(Long.valueOf(5889), "es", "ltr", "Spanish", "", "", "es", "spa",
"spa", true, "Español", "", "", "c == 1 ? 1 : 2", null, "L", "dd/MM/yyyy");
languageManager.persist(english);
languageManager.persist(spanish);
- final I18nCountry gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom",
+ final I18nCountry gb = new I18nCountry(Long.valueOf(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom",
"western", ",");
countryManager.persist(gb);
final I18nTranslation test = new I18nTranslation("test", english, "test");
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/FileManager.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -49,6 +49,6 @@
* @param dir
* the directory (use File.separator for dir delimiters)
*/
- void rmdir(String dir);
+ void 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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -55,8 +55,11 @@
I18nTranslationService i18n;
@Override
+ protected void beforePostStart() {
+ }
+
+ @Override
protected void beforeRespond(final HttpServletResponse response, final Writer w) throws IOException {
- super.beforeRespond(response, w);
response.setCharacterEncoding("utf-8");
response.setContentType("text/xml");
}
@@ -141,7 +144,7 @@
@Override
protected void onOtherException(final HttpServletResponse response, final Exception e) throws IOException {
super.onOtherException(response, e);
- log.info("Exception: " + e.getCause());
+ LOG.info("Exception: " + e.getCause());
// e.printStackTrace();
doResponse(response, createXmlResponse(false, i18n.t("Error uploading file")).toString(),
HttpServletResponse.SC_BAD_REQUEST);
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManager.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManager.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -62,7 +62,7 @@
static final String APPLICATION_X_DOWNLOAD = "application/x-download";
- public static final Log log = LogFactory.getLog(FileDownloadManager.class);
+ public static final Log LOG = LogFactory.getLog(FileDownloadManager.class);
@Inject
ContentManager contentManager;
@@ -132,7 +132,7 @@
contentType = mimeType.toString();
}
resp.setContentType(contentType);
- log.info("Content type returned: " + contentType);
+ LOG.info("Content type returned: " + contentType);
resp.setHeader(RESP_HEADER_CONTEND_DISP, RESP_HEADER_ATTACHMENT_FILENAME + title + extension + RESP_HEADER_END);
return absFilename;
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileJsonUploadManagerAbstract.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileJsonUploadManagerAbstract.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileJsonUploadManagerAbstract.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -38,7 +38,6 @@
@Override
protected void beforeRespond(final HttpServletResponse response, final Writer w) throws IOException {
- super.beforeRespond(response, w);
response.setCharacterEncoding("utf-8");
response.setContentType("text/html");
}
@@ -55,7 +54,7 @@
@Override
protected void onOtherException(final HttpServletResponse response, final Exception e) throws IOException {
super.onOtherException(response, e);
- log.info("Exception: " + e.getCause());
+ LOG.info("Exception: " + e.getCause());
// e.printStackTrace();
doResponse(response, createJsonResponse(false, i18n.t("Error uploading file")).toString());
}
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -30,10 +30,12 @@
public class FileManagerDefault implements FileManager {
public File createFileWithSequentialName(final String dir, final String fileName) throws IOException {
- String fileNameProposal = new String(fileName);
+ String fileNameProposal = String.valueOf(fileName);
File file = new File(dir, fileNameProposal);
while (file.exists()) {
fileNameProposal = FileUtils.getNextSequentialFileName(fileNameProposal, true);
+ // @PMD:REVIEWED:AvoidInstantiatingObjectsInLoops: by vjrj on
+ // 21/05/09 13:15
file = new File(dir, fileNameProposal);
}
file.createNewFile();
@@ -41,16 +43,16 @@
}
public boolean mkdir(final String dir) {
- return (new File(dir)).mkdirs();
+ return new File(dir).mkdirs();
}
- public void rmdir(final String dir) {
+ public void rmdir(final String dir) throws IOException {
final File file = new File(dir);
if (!file.isDirectory()) {
- throw new RuntimeException("rmdir: " + dir + ": Not a directory");
+ throw new IOException("rmdir: " + dir + ": Not a directory");
}
if (file.listFiles().length != 0) {
- throw new RuntimeException("rmdir: " + dir + ": Directory not empty");
+ throw new IOException("rmdir: " + dir + ": Directory not empty");
}
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -66,6 +66,10 @@
I18nTranslationService i18n;
@Override
+ protected void beforePostStart() {
+ }
+
+ @Override
protected JSONObject createJsonResponse(final boolean success, final String message) {
/**
*
@@ -86,7 +90,7 @@
response.put("error", message);
response.put("code", "232");
} catch (final Exception e) {
- log.error("Error building response");
+ LOG.error("Error building response");
}
return response;
}
@@ -114,7 +118,7 @@
final String mimetype = fileUploadItem.getContentType();
BasicMimeType basicMimeType = new BasicMimeType(mimetype);
- log.info("Mimetype: " + basicMimeType);
+ LOG.info("Mimetype: " + basicMimeType);
final String extension = FileUtils.getFileNameExtension(file.getName(), false);
String preview = "";
@@ -167,12 +171,11 @@
ImageUtilsDefault.createThumbFromPdf(fileOrig, previewName);
}
} catch (NumberFormatException e) {
- log.error("Image sizes in kune.properties are not integers");
- e.printStackTrace();
+ LOG.error("Image sizes in kune.properties are not integers", e);
} catch (MagickException e) {
- log.info("Problem generating image thumb for " + filename);
+ LOG.info("Problem generating image thumb for " + filename, e);
} catch (FileNotFoundException e) {
- log.info("Original image not found generating image thumb for " + filename);
+ LOG.info("Original image not found generating image thumb for " + filename, 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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerAbstract.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -47,23 +47,17 @@
private static final long serialVersionUID = -4227762495128652369L;
- public static final Log log = LogFactory.getLog(FileUploadManager.class);
+ public static final Log LOG = LogFactory.getLog(FileUploadManager.class);
protected static final String UTF8 = "UTF-8";
@Inject
KuneProperties kuneProperties;
- protected void beforePostStart() {
- }
+ protected abstract void beforePostStart();
- protected void beforeRespond(final HttpServletResponse response, final Writer w) throws IOException {
- }
+ protected abstract void beforeRespond(final HttpServletResponse response, final Writer w) throws IOException;
- protected void createUploadedFile(final String userHash, final StateToken stateToken, final String fileName,
- final FileItem file, final String typeId) throws Exception {
- }
-
@Override
@SuppressWarnings( { "unchecked", "deprecation" })
protected void doPost(final HttpServletRequest req, final HttpServletResponse response) throws ServletException,
@@ -78,12 +72,12 @@
factory.setRepository(new File("/tmp"));
if (!ServletFileUpload.isMultipartContent(req)) {
- log.warn("Not a multipart upload");
+ LOG.warn("Not a multipart upload");
}
final ServletFileUpload upload = new ServletFileUpload(factory);
// maximum size before a FileUploadException will be thrown
- upload.setSizeMax(new Integer(kuneProperties.get(KuneProperties.UPLOAD_MAX_FILE_SIZE)) * 1024 * 1024);
+ upload.setSizeMax(Integer.valueOf(kuneProperties.get(KuneProperties.UPLOAD_MAX_FILE_SIZE)) * 1024 * 1024);
try {
final List fileItems = upload.parseRequest(req);
@@ -97,7 +91,7 @@
if (item.isFormField()) {
final String name = item.getFieldName();
final String value = item.getString();
- log.info("name: " + name + " value: " + value);
+ LOG.info("name: " + name + " value: " + value);
if (name.equals(FileConstants.HASH)) {
userHash = value;
}
@@ -109,7 +103,7 @@
}
} else {
fileName = item.getName();
- log.info("file: " + fileName + " fieldName: " + item.getFieldName() + " size: " + item.getSize()
+ LOG.info("file: " + fileName + " fieldName: " + item.getFieldName() + " size: " + item.getSize()
+ " typeId: " + typeId);
file = item;
}
@@ -142,7 +136,7 @@
}
protected void onOtherException(final HttpServletResponse response, final Exception e) throws IOException {
- log.info("Exception: " + e.getCause());
+ LOG.info("Exception: " + e.getCause());
e.printStackTrace();
doResponse(response, null);
}
@@ -151,4 +145,7 @@
doResponse(response, null);
}
+ abstract void createUploadedFile(final String userHash, final StateToken stateToken, final String fileName,
+ final FileItem file, final String typeId) throws Exception;
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUtils.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUtils.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -35,23 +35,23 @@
* http://www.java-tips.org/java-se-tips/java.io/reading-a-file
* -into-a-byte-array.html
*/
- public static byte[] getBytesFromFile(File file) throws IOException {
- InputStream is = new FileInputStream(file);
+ public static byte[] getBytesFromFile(final File file) throws IOException {
+ final InputStream iStream = new FileInputStream(file);
// Get the size of the file
- long length = file.length();
+ final long length = file.length();
if (length > Integer.MAX_VALUE) {
// File is too large
}
// Create the byte array to hold the data
- byte[] bytes = new byte[(int) length];
+ final byte[] bytes = new byte[(int) length];
// Read in the bytes
int offset = 0;
int numRead = 0;
- while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) {
+ while (offset < bytes.length && (numRead = iStream.read(bytes, offset, bytes.length - offset)) >= 0) {
offset += numRead;
}
@@ -61,7 +61,7 @@
}
// Close the input stream and return bytes
- is.close();
+ iStream.close();
return bytes;
}
@@ -77,7 +77,7 @@
if (filename == null) {
return "";
}
- final int dotIndex = filename.lastIndexOf(".");
+ final int dotIndex = filename.lastIndexOf('.');
if (dotIndex == -1 || dotIndex == 0) {
return "";
} else {
@@ -93,7 +93,7 @@
public static String getFileNameWithoutExtension(final String fileName, final String extension) {
final int extlength = extension.length();
if (extlength > 0) {
- boolean withDot = extension.charAt(0) == '.';
+ final boolean withDot = extension.charAt(0) == '.';
return fileName.substring(0, fileName.length() - extlength - (withDot ? 0 : 1));
} else {
return fileName;
@@ -105,7 +105,7 @@
if (lastSpace != -1) {
final String suffix = fileName.substring(lastSpace + 1);
try {
- final Integer i = new Integer(suffix);
+ final Integer i = Integer.valueOf(suffix);
return fileName.substring(0, lastSpace + 1) + (i + 1);
} catch (final NumberFormatException e) {
}
@@ -113,7 +113,7 @@
return fileName + " 1";
}
- public static String getNextSequentialFileName(final String fileName, boolean preserveExtension) {
+ public static String getNextSequentialFileName(final String fileName, final boolean preserveExtension) {
if (!preserveExtension) {
return getNextSequentialFileName(fileName);
}
@@ -130,7 +130,7 @@
return SLASH + stateToken.getGroup() + SLASH + stateToken.getTool() + SLASH + stateToken.getFolder() + SLASH;
}
- public boolean exist(String file) {
+ public boolean exist(final String file) {
return new File(file).exists();
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -23,6 +23,8 @@
import javax.persistence.EntityManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
@@ -37,10 +39,12 @@
public abstract class DefaultManager<T, K> {
private final Provider<EntityManager> provider;
private final Class<T> entityClass;
+ protected final Log log;
public DefaultManager(final Provider<EntityManager> provider, final Class<T> entityClass) {
this.provider = provider;
this.entityClass = entityClass;
+ log = LogFactory.getLog(entityClass);
}
public T find(final Long primaryKey) {
@@ -100,7 +104,7 @@
try {
queryQ = MultiFieldQueryParser.parse(query, fields, flags, new StandardAnalyzer());
} catch (final ParseException e) {
- throw new RuntimeException("Error parsing search");
+ throw new ServerManagerException("Error parsing search", e);
}
return search(queryQ, firstResult, maxResults);
}
@@ -111,7 +115,7 @@
try {
query = MultiFieldQueryParser.parse(queries, fields, flags, new StandardAnalyzer());
} catch (final ParseException e) {
- throw new RuntimeException("Error parsing search");
+ throw new ServerManagerException("Error parsing search", e);
}
return search(query, firstResult, maxResults);
}
@@ -122,7 +126,7 @@
try {
query = MultiFieldQueryParser.parse(queries, fields, new StandardAnalyzer());
} catch (final ParseException e) {
- throw new RuntimeException("Error parsing search");
+ throw new ServerManagerException("Error parsing search", e);
}
return search(query, firstResult, maxResults);
}
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -87,7 +87,7 @@
public void changeDefLicense(final User user, final Group group, final String licName) {
final License license = licenseFinder.findByShortName(licName);
if (license == null) {
- throw new RuntimeException("Unknown license");
+ throw new ServerManagerException("Unknown license");
}
group.setDefaultLicense(license);
}
@@ -191,7 +191,7 @@
try {
query = parser.parse(search);
} catch (final ParseException e) {
- throw new RuntimeException("Error parsing search");
+ throw new ServerManagerException("Error parsing search");
}
return super.search(query, firstResult, maxResults);
}
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -120,7 +120,7 @@
}
public String setTranslation(final String id, final String translation) throws DefaultException {
- final I18nTranslation trans = super.find(new Long(id));
+ final I18nTranslation trans = super.find(Long.valueOf(id));
if (trans != null) {
final String escapedTranslation = TextUtils.escapeHtmlLight(translation);
trans.setText(escapedTranslation);
Added: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/ServerManagerException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/ServerManagerException.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/ServerManagerException.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -0,0 +1,25 @@
+package org.ourproject.kune.platf.server.manager.impl;
+
+import org.ourproject.kune.platf.server.ServerException;
+
+public class ServerManagerException extends ServerException {
+
+ private static final long serialVersionUID = -8407996943857184946L;
+
+ public ServerManagerException() {
+ super();
+ }
+
+ public ServerManagerException(final String text) {
+ super(text);
+ }
+
+ public ServerManagerException(final String text, final Throwable cause) {
+ super(text, cause);
+ }
+
+ public ServerManagerException(final Throwable cause) {
+ super(cause);
+ }
+
+}
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -31,6 +31,7 @@
import org.ourproject.kune.platf.client.errors.DefaultException;
import org.ourproject.kune.platf.client.errors.LastAdminInGroupException;
import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
+import org.ourproject.kune.platf.server.ServerException;
import org.ourproject.kune.platf.server.access.AccessRights;
import org.ourproject.kune.platf.server.access.AccessRightsService;
import org.ourproject.kune.platf.server.domain.AdmissionType;
@@ -155,7 +156,7 @@
return sn;
}
- public SocialNetworkData getSocialNetworkData(User userLogged, Group group) {
+ public SocialNetworkData getSocialNetworkData(final User userLogged, final Group group) {
SocialNetworkData socialNetData = new SocialNetworkData();
socialNetData.setGroupMembers(get(userLogged, group));
AccessRights groupRights = accessRightsService.get(userLogged, group.getAccessLists());
@@ -218,7 +219,7 @@
}
final AdmissionType admissionType = inGroup.getAdmissionType();
if (admissionType == null) {
- throw new RuntimeException();
+ throw new ServerException("No admissionType");
}
final Group userGroup = userLogged.getUserGroup();
checkGroupIsNotAlreadyAMember(userGroup, sn);
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -31,6 +31,7 @@
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.search.Query;
import org.jivesoftware.smack.RosterEntry;
+import org.jivesoftware.smack.packet.RosterPacket.ItemType;
import org.ourproject.kune.chat.server.managers.ChatConnection;
import org.ourproject.kune.chat.server.managers.XmppManager;
import org.ourproject.kune.platf.client.errors.I18nNotFoundException;
@@ -106,15 +107,14 @@
// two db at the same time). This compromise solution is server
// independent.
// In the future cache this.
- String domain = "@" + properties.getDomain();
+ final String domain = "@" + properties.getDomain();
UserBuddiesData buddiesData = new UserBuddiesData();
User user = finder.getByShortName(shortName);
ChatConnection connection = xmppManager.login(user.getShortName() + domain, user.getPassword(), "kserver");
Collection<RosterEntry> roster = xmppManager.getRoster(connection);
xmppManager.disconnect(connection);
for (RosterEntry entry : roster) {
- switch (entry.getType()) {
- case both:
+ if (entry.getType().equals(ItemType.both)) {
// only show buddies with subscription 'both'
int index = entry.getUser().indexOf(domain);
if (index > 0) {
@@ -127,7 +127,7 @@
}
} else {
// ext user (only count)
- buddiesData.setOtherExternalBuddies(buddiesData.getOtherExternalBuddies() + 1);
+ buddiesData.setOtherExtBuddies(buddiesData.getOtherExtBuddies() + 1);
}
}
}
@@ -172,7 +172,7 @@
try {
query = parser.parse(search);
} catch (ParseException e) {
- throw new RuntimeException("Error parsing search");
+ throw new ServerManagerException("Error parsing search", e);
}
return super.search(query, firstResult, maxResults);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/properties/KunePropertiesDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/properties/KunePropertiesDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/properties/KunePropertiesDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -24,6 +24,8 @@
import java.text.MessageFormat;
import java.util.Properties;
+import org.ourproject.kune.platf.server.ServerException;
+
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -41,7 +43,7 @@
properties.load(input);
} catch (IOException e) {
String msg = MessageFormat.format("Couldn't open property file {0}", fileName);
- throw new RuntimeException(msg, e);
+ throw new ServerException(msg, e);
}
}
@@ -49,7 +51,7 @@
public String get(final String key) {
String value = properties.getProperty(key);
if (value == null) {
- throw new RuntimeException("PROPERTY: " + key + " not defined in " + fileName);
+ throw new ServerException("PROPERTY: " + key + " not defined in " + fileName);
}
return value;
}
@@ -63,7 +65,7 @@
InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName);
if (input == null) {
String msg = MessageFormat.format("Properties file: ''{0}'' not found", fileName);
- throw new RuntimeException(msg);
+ throw new ServerException(msg);
}
return input;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -55,7 +55,7 @@
private final I18nLanguageManager languageManager;
private final I18nCountryManager countryManager;
private final ServerToolRegistry serverToolRegistry;
- private final ExtMediaDescripManager extMediaDescripManager;
+ private final ExtMediaDescripManager extMediaDescManager;
// TODO: refactor: too many parameters! refactor to Facade Pattern
@Inject
@@ -63,7 +63,7 @@
final UserInfoService userInfoService, final LicenseManager licenseManager, final Mapper mapper,
final KuneProperties kuneProperties, final ChatProperties chatProperties,
final I18nLanguageManager languageManager, final I18nCountryManager countryManager,
- final ServerToolRegistry serverToolRegistry, final ExtMediaDescripManager extMediaDescripManager) {
+ final ServerToolRegistry serverToolRegistry, final ExtMediaDescripManager extMediaDescManager) {
this.userSessionProvider = userSessionProvider;
this.userManager = userManager;
this.userInfoService = userInfoService;
@@ -74,7 +74,7 @@
this.languageManager = languageManager;
this.countryManager = countryManager;
this.serverToolRegistry = serverToolRegistry;
- this.extMediaDescripManager = extMediaDescripManager;
+ this.extMediaDescManager = extMediaDescManager;
}
@Transactional(type = TransactionType.READ_ONLY)
@@ -102,15 +102,15 @@
data.setMaxFileSizeInMb(kuneProperties.get(KuneProperties.UPLOAD_MAX_FILE_SIZE));
data.setUserTools(serverToolRegistry.getToolsForUsers());
data.setGroupTools(serverToolRegistry.getToolsForGroups());
- data.setImgResizewidth(new Integer(kuneProperties.get(KuneProperties.IMAGES_RESIZEWIDTH)));
- data.setImgThumbsize(new Integer(kuneProperties.get(KuneProperties.IMAGES_THUMBSIZE)));
- data.setImgCropsize(new Integer(kuneProperties.get(KuneProperties.IMAGES_CROPSIZE)));
- data.setImgIconsize(new Integer(kuneProperties.get(KuneProperties.IMAGES_ICONSIZE)));
+ data.setImgResizewidth(Integer.valueOf(kuneProperties.get(KuneProperties.IMAGES_RESIZEWIDTH)));
+ data.setImgThumbsize(Integer.valueOf(kuneProperties.get(KuneProperties.IMAGES_THUMBSIZE)));
+ data.setImgCropsize(Integer.valueOf(kuneProperties.get(KuneProperties.IMAGES_CROPSIZE)));
+ data.setImgIconsize(Integer.valueOf(kuneProperties.get(KuneProperties.IMAGES_ICONSIZE)));
data.setFlvEmbedObject(kuneProperties.get(KuneProperties.FLV_EMBEDED_OBJECT));
data.setMp3EmbedObject(kuneProperties.get(KuneProperties.MP3_EMBEDED_OBJECT));
data.setOggEmbedObject(kuneProperties.get(KuneProperties.OGG_EMBEDED_OBJECT));
data.setAviEmbedObject(kuneProperties.get(KuneProperties.AVI_EMBEDED_OBJECT));
- data.setExtMediaDescrips(extMediaDescripManager.getAll());
+ data.setExtMediaDescrips(extMediaDescManager.getAll());
return mapper.map(data, InitDataDTO.class);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/sn/UserBuddiesData.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/sn/UserBuddiesData.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/sn/UserBuddiesData.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -26,17 +26,17 @@
public class UserBuddiesData {
- public static UserBuddiesData EMPTY = new UserBuddiesData();
+ public static final UserBuddiesData EMPTY = new UserBuddiesData();
private List<User> buddies;
- int otherExternalBuddies;
+ private int otherExtBuddies;
public UserBuddiesData() {
- otherExternalBuddies = 0;
+ otherExtBuddies = 0;
buddies = new ArrayList<User>();
}
- public boolean contains(String shortName) {
+ public boolean contains(final String shortName) {
for (User buddie : buddies) {
if (buddie.getShortName().equals(shortName)) {
return true;
@@ -49,20 +49,20 @@
return buddies;
}
- public int getOtherExternalBuddies() {
- return otherExternalBuddies;
+ public int getOtherExtBuddies() {
+ return otherExtBuddies;
}
- public void setBuddies(List<User> buddies) {
+ public void setBuddies(final List<User> buddies) {
this.buddies = buddies;
}
- public void setOtherExternalBuddies(int otherExternalBuddies) {
- this.otherExternalBuddies = otherExternalBuddies;
+ public void setOtherExtBuddies(final int otherExtBuddies) {
+ this.otherExtBuddies = otherExtBuddies;
}
@Override
public String toString() {
- return "UserBuddiesData[ext: " + otherExternalBuddies + " / int: " + buddies + "]";
+ return "UserBuddiesData[ext: " + otherExtBuddies + " / int: " + buddies + "]";
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/utils/StringW.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/utils/StringW.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/utils/StringW.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -86,6 +86,7 @@
*
* @author timster(a)mac.com
*/
+ // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:13
public static String truncateNicely(String str, int lower, int upper, String appendToEnd) {
// strip markup from the string
str = XmlW.removeXml(str);
@@ -180,6 +181,7 @@
*
* @return String that has been word wrapped
*/
+ // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:13
static public String wordWrap(String str, int width, String delim, String split, boolean delimInside) {
int sz = str.length();
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/utils/XmlW.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/utils/XmlW.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/utils/XmlW.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -29,6 +29,7 @@
*/
final public class XmlW {
+ // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:13
static public String escapeXml(String str) {
str = StringUtils.replace(str, "&", "&");
str = StringUtils.replace(str, "<", "<");
@@ -59,6 +60,7 @@
return unescapeXml(text.substring(attrStartIdx, attrCloseIdx));
}
+ // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:13
static public String getContent(String tag, String text) {
int idx = XmlW.getIndexOpeningTag(tag, text);
if (idx == -1) {
@@ -135,6 +137,7 @@
return buffer.toString();
}
+ // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:13
static public String unescapeXml(String str) {
str = StringUtils.replace(str, "&", "&");
str = StringUtils.replace(str, "<", "<");
Modified: trunk/src/main/java/org/ourproject/kune/rack/Rack.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/Rack.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/Rack.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -48,7 +48,7 @@
import com.google.inject.Module;
public class Rack {
- public static final Log log = LogFactory.getLog(Rack.class);
+ public static final Log LOG = LogFactory.getLog(Rack.class);
private final ArrayList<Dock> docks;
private final ArrayList<Module> modules;
private final ArrayList<RequestMatcher> excludes;
@@ -67,7 +67,7 @@
}
public void add(final Dock dock) {
- log.debug("INSTALLING: " + dock.toString());
+ LOG.debug("INSTALLING: " + dock.toString());
docks.add(dock);
}
Modified: trunk/src/main/java/org/ourproject/kune/rack/RackHelper.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/RackHelper.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/RackHelper.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -22,8 +22,10 @@
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
-public class RackHelper {
- private RackHelper() {
+public final class RackHelper {
+ public static String buildForwardString(final ServletRequest request, final String forward) {
+ String parameters = RackHelper.extractParameters(request);
+ return new StringBuilder(forward).append(parameters).toString();
}
public static String extractParameters(final ServletRequest request) {
@@ -49,9 +51,7 @@
return httpServletRequest.getRequestURI();
}
- public static String buildForwardString(final ServletRequest request, final String forward) {
- String parameters = RackHelper.extractParameters(request);
- return new StringBuilder(forward).append(parameters).toString();
+ private RackHelper() {
}
}
Modified: trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -32,6 +32,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.ourproject.kune.platf.server.ServerException;
import org.ourproject.kune.rack.dock.Dock;
import org.ourproject.kune.rack.dock.RequestMatcher;
@@ -69,7 +70,7 @@
}
public static final String INJECTOR_ATTRIBUTE = Injector.class.getName();
private static final String MODULE_PARAMETER = RackModule.class.getName();
- private static final Log log = LogFactory.getLog(RackServletFilter.class);
+ private static final Log LOG = LogFactory.getLog(RackServletFilter.class);
private List<Dock> docks;
private List<RequestMatcher> excludes;
@@ -98,7 +99,7 @@
}
public void init(final FilterConfig filterConfig) throws ServletException {
- log.debug("INITIALIZING RackServletFilter...");
+ LOG.debug("INITIALIZING RackServletFilter...");
final RackModule module = getModule(filterConfig);
final RackBuilder builder = new RackBuilder();
module.configure(builder);
@@ -110,7 +111,7 @@
docks = rack.getDocks();
excludes = rack.getExcludes();
initFilters(filterConfig);
- log.debug("INITIALIZATION DONE!");
+ LOG.debug("INITIALIZATION DONE!");
}
private RackModule getModule(final FilterConfig filterConfig) {
@@ -120,14 +121,14 @@
final RackModule module = (RackModule) clazz.newInstance();
return module;
} catch (final Exception e) {
- throw new RuntimeException("couldn't instantiate the rack module", e);
+ throw new ServerException("couldn't instantiate the rack module", e);
}
}
private String getModuleName(final FilterConfig filterConfig) {
final String moduleName = filterConfig.getInitParameter(MODULE_PARAMETER);
if (moduleName == null) {
- throw new RuntimeException("Rack module name can't be null!");
+ throw new ServerException("Rack module name can't be null!");
}
return moduleName;
}
@@ -146,7 +147,7 @@
private void startContainerListeners(final List<Class<? extends ContainerListener>> listenerClasses,
final Injector injector) {
- log.debug("STARTING CONTAINER LISTENERS...");
+ LOG.debug("STARTING CONTAINER LISTENERS...");
for (final Class<? extends ContainerListener> listenerClass : listenerClasses) {
final ContainerListener listener = injector.getInstance(listenerClass);
listener.start();
@@ -157,7 +158,7 @@
@SuppressWarnings("unused")
private void stopContainerListeners(final List<Class<? extends ContainerListener>> listenerClasses,
final Injector injector) {
- log.debug("STOPING CONTAINER LISTENERS...");
+ LOG.debug("STOPING CONTAINER LISTENERS...");
for (final Class<? extends ContainerListener> listenerClass : listenerClasses) {
final ContainerListener listener = injector.getInstance(listenerClass);
listener.stop();
Copied: trunk/src/main/java/org/ourproject/kune/rack/filters/AbstractInjectedFilter.java (from rev 1105, trunk/src/main/java/org/ourproject/kune/rack/filters/InjectedFilter.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/InjectedFilter.java 2009-04-29 22:05:47 UTC (rev 1105)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/AbstractInjectedFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -0,0 +1,50 @@
+/*
+ *
+ * Copyright (C) 2007-2009 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.rack.filters;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.ourproject.kune.rack.RackServletFilter;
+
+import com.google.inject.Injector;
+
+public abstract class AbstractInjectedFilter implements Filter {
+
+ protected ServletContext ctx;
+
+ public abstract void destroy();
+
+ public <T> T getInstance(final Class<T> type) {
+ return getInjector().getInstance(type);
+ }
+
+ public void init(final FilterConfig filterConfig) throws ServletException {
+ this.ctx = filterConfig.getServletContext();
+ getInjector().injectMembers(this);
+ }
+
+ private Injector getInjector() {
+ return (Injector) ctx.getAttribute(RackServletFilter.INJECTOR_ATTRIBUTE);
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/ForwardFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/ForwardFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/ForwardFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -31,7 +31,7 @@
import org.ourproject.kune.rack.RackHelper;
-public class ForwardFilter extends InjectedFilter {
+public class ForwardFilter extends AbstractInjectedFilter {
// private static final Log log = LogFactory.getLog(ForwardFilter.class);
private final String forward;
@@ -46,6 +46,10 @@
this.pattern = Pattern.compile(pattern);
}
+ @Override
+ public void destroy() {
+ }
+
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
Deleted: trunk/src/main/java/org/ourproject/kune/rack/filters/InjectedFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/InjectedFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/InjectedFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -1,50 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2009 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.rack.filters;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-
-import org.ourproject.kune.rack.RackServletFilter;
-
-import com.google.inject.Injector;
-
-public abstract class InjectedFilter implements Filter {
- protected ServletContext ctx;
-
- public void destroy() {
- }
-
- public <T> T getInstance(final Class<T> type) {
- return getInjector().getInstance(type);
- }
-
- public void init(final FilterConfig filterConfig) throws ServletException {
- this.ctx = filterConfig.getServletContext();
- getInjector().injectMembers(this);
- }
-
- private Injector getInjector() {
- return (Injector) ctx.getAttribute(RackServletFilter.INJECTOR_ATTRIBUTE);
- }
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/ListenerFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/ListenerFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/ListenerFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -28,15 +28,19 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-public class ListenerFilter extends InjectedFilter {
- private Class<? extends ApplicationListener> listenerClass;
+public class ListenerFilter extends AbstractInjectedFilter {
+ private final Class<? extends ApplicationListener> listenerClass;
- public ListenerFilter(Class<? extends ApplicationListener> listenerClass) {
+ public ListenerFilter(final Class<? extends ApplicationListener> listenerClass) {
this.listenerClass = listenerClass;
}
- public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
- ServletException {
+ @Override
+ public void destroy() {
+ }
+
+ public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
+ throws IOException, ServletException {
ApplicationListener listener = super.getInstance(listenerClass);
listener.doBefore((HttpServletRequest) request, (HttpServletResponse) response);
chain.doFilter(request, response);
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -33,7 +33,7 @@
import org.ourproject.kune.rack.RackHelper;
public class LogFilter implements Filter {
- public static final Log log = LogFactory.getLog(LogFilter.class);
+ public static final Log LOG = LogFactory.getLog(LogFilter.class);
public void destroy() {
}
@@ -41,7 +41,7 @@
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
// final long start = System.currentTimeMillis();
- log.debug("REQUEST: " + RackHelper.getURI(request));
+ LOG.debug("REQUEST: " + RackHelper.getURI(request));
chain.doFilter(request, response);
// final long finish = System.currentTimeMillis();
// log.debug("TOTAL TIME: " + (finish - start) + " miliseconds");
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -32,12 +32,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.ourproject.kune.rack.RackHelper;
-import org.ourproject.kune.rack.filters.InjectedFilter;
+import org.ourproject.kune.rack.filters.AbstractInjectedFilter;
import com.google.gwt.user.client.rpc.RemoteService;
-public class GWTServiceFilter extends InjectedFilter {
- public static final Log log = LogFactory.getLog(GWTServiceFilter.class);
+public class GWTServiceFilter extends AbstractInjectedFilter {
+ public static final Log LOG = LogFactory.getLog(GWTServiceFilter.class);
private final Class<? extends RemoteService> serviceClass;
private final DelegatedRemoteServlet servlet;
@@ -47,10 +47,14 @@
this.servlet = new DelegatedRemoteServlet();
}
+ @Override
+ public void destroy() {
+ }
+
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
- log.info("--------------------------------------------------------------------------------");
- log.debug("SERVICE: " + RackHelper.getURI(request) + " - " + serviceClass.getSimpleName());
+ LOG.info("--------------------------------------------------------------------------------");
+ LOG.debug("SERVICE: " + RackHelper.getURI(request) + " - " + serviceClass.getSimpleName());
final RemoteService service = getInstance(serviceClass);
servlet.setService(service);
servlet.doPost((HttpServletRequest) request, (HttpServletResponse) response);
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/rest/DefaultRESTMethodFinder.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/rest/DefaultRESTMethodFinder.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/rest/DefaultRESTMethodFinder.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -27,20 +27,20 @@
import org.apache.commons.logging.LogFactory;
public class DefaultRESTMethodFinder implements RESTMethodFinder {
- private static final Log log = LogFactory.getLog(DefaultRESTMethodFinder.class);
+ private static final Log LOG = LogFactory.getLog(DefaultRESTMethodFinder.class);
- private HashMap<Class<?>, RESTServiceDefinition> definitionCache;
+ private final HashMap<Class<?>, RESTServiceDefinition> definitionCache;
public DefaultRESTMethodFinder() {
this.definitionCache = new HashMap<Class<?>, RESTServiceDefinition>();
}
- public RESTMethod findMethod(String methodName, Parameters parameters, Class<?> serviceType) {
+ public RESTMethod findMethod(final String methodName, final Parameters parameters, final Class<?> serviceType) {
RESTServiceDefinition serviceDefinition = getServiceDefinition(serviceType);
Method[] serviceMethods = serviceDefinition.getMethods();
- log.debug("SERVICE METHODS: " + Arrays.toString(serviceMethods));
+ LOG.debug("SERVICE METHODS: " + Arrays.toString(serviceMethods));
for (Method method : serviceMethods) {
- log.debug("CHEKING: " + method.toString());
+ LOG.debug("CHEKING: " + method.toString());
if (method.getName().equals(methodName)) {
REST methodAnnotation = method.getAnnotation(REST.class);
if (checkParams(methodAnnotation, parameters)) {
@@ -51,7 +51,16 @@
return null;
}
- private RESTServiceDefinition getServiceDefinition(Class<?> serviceType) {
+ private boolean checkParams(final REST methodAnnotation, final Parameters parameters) {
+ for (String name : methodAnnotation.params()) {
+ if (parameters.get(name) == null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private RESTServiceDefinition getServiceDefinition(final Class<?> serviceType) {
RESTServiceDefinition serviceDefinition = definitionCache.get(serviceType);
if (serviceDefinition == null) {
serviceDefinition = new RESTServiceDefinition(serviceType);
@@ -59,13 +68,4 @@
}
return serviceDefinition;
}
-
- private boolean checkParams(REST methodAnnotation, Parameters parameters) {
- for (String name : methodAnnotation.params()) {
- if (parameters.get(name) == null) {
- return false;
- }
- }
- return true;
- }
}
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/rest/JSONLibRESTSerializer.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/rest/JSONLibRESTSerializer.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/rest/JSONLibRESTSerializer.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -23,6 +23,8 @@
import net.sf.json.JsonConfig;
import net.sf.json.util.CycleDetectionStrategy;
+import org.ourproject.kune.platf.server.ServerException;
+
public class JSONLibRESTSerializer implements RESTSerializer {
private final JsonConfig config;
@@ -31,11 +33,11 @@
config.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
}
- public String serialize(Object target, String format) {
+ public String serialize(final Object target, final String format) {
if (format.equals(RESTMethod.FORMAT_JSON)) {
return JSONSerializer.toJSON(target, config).toString();
} else {
- throw new RuntimeException("format not implemented!");
+ throw new ServerException("format not implemented!");
}
}
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTMethod.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTMethod.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTMethod.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -21,6 +21,8 @@
import java.lang.reflect.Method;
+import org.ourproject.kune.platf.server.ServerException;
+
public class RESTMethod {
public static final String FORMAT_JSON = "json";
public static final String FORMAT_XML = "xml";
@@ -31,14 +33,22 @@
private Object response;
private final String format;
- public RESTMethod(Method method, String[] names, Parameters parameters, String format) {
+ public RESTMethod(final Method method, final String[] names, final Parameters parameters, final String format) {
this.method = method;
this.names = names;
this.parameters = parameters;
this.format = format;
}
- public boolean invoke(Object service) {
+ public String getFormat() {
+ return format;
+ }
+
+ public Object getResponse() {
+ return response;
+ }
+
+ public boolean invoke(final Object service) {
Object[] values = convertParameters();
try {
response = method.invoke(service, values);
@@ -48,19 +58,7 @@
}
}
- private Object[] convertParameters() {
- int total = names.length;
- Object[] values = new Object[total];
- Class<?>[] types = method.getParameterTypes();
-
- for (int index = 0; index < total; index++) {
- values[index] = convert(types[index], parameters.get(names[index]));
- }
-
- return values;
- }
-
- private Object convert(Class<?> type, String stringValue) {
+ private Object convert(final Class<?> type, final String stringValue) {
if (type.equals(String.class)) {
return stringValue;
} else if (type.equals(Integer.TYPE) || type.equals(Integer.class)) {
@@ -68,16 +66,20 @@
} else if (type.equals(Long.TYPE) || type.equals(Long.class)) {
return Long.parseLong(stringValue);
} else {
- throw new RuntimeException("unable to convert parameter in JSON method to type: " + type);
+ throw new ServerException("unable to convert parameter in JSON method to type: " + type);
}
}
- public String getFormat() {
- return format;
- }
+ private Object[] convertParameters() {
+ int total = names.length;
+ Object[] values = new Object[total];
+ Class<?>[] types = method.getParameterTypes();
- public Object getResponse() {
- return response;
+ for (int index = 0; index < total; index++) {
+ values[index] = convert(types[index], parameters.get(names[index]));
+ }
+
+ return values;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTServiceFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTServiceFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTServiceFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -32,12 +32,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.ourproject.kune.rack.RackHelper;
-import org.ourproject.kune.rack.filters.InjectedFilter;
+import org.ourproject.kune.rack.filters.AbstractInjectedFilter;
import com.google.inject.Inject;
-public class RESTServiceFilter extends InjectedFilter {
- private static final Log log = LogFactory.getLog(RESTServiceFilter.class);
+public class RESTServiceFilter extends AbstractInjectedFilter {
+ private static final Log LOG = LogFactory.getLog(RESTServiceFilter.class);
private final Pattern pattern;
private final Class<?> serviceClass;
@@ -50,12 +50,16 @@
this.pattern = Pattern.compile(pattern);
}
+ @Override
+ public void destroy() {
+ }
+
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
String methodName = getMethodName(request);
ParametersAdapter parameters = new ParametersAdapter(request);
- log.debug("JSON METHOD: '" + methodName + "' on: " + serviceClass.getSimpleName());
+ LOG.debug("JSON METHOD: '" + methodName + "' on: " + serviceClass.getSimpleName());
response.setCharacterEncoding("utf-8");
response.setContentType("text/json");
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/servlet/ServletServiceFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/servlet/ServletServiceFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/servlet/ServletServiceFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -31,9 +31,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.ourproject.kune.rack.RackHelper;
-import org.ourproject.kune.rack.filters.InjectedFilter;
+import org.ourproject.kune.rack.filters.AbstractInjectedFilter;
-public class ServletServiceFilter extends InjectedFilter {
+public class ServletServiceFilter extends AbstractInjectedFilter {
Log log = LogFactory.getLog(ServletServiceFilter.class);
private final Class<? extends HttpServlet> servletClass;
@@ -41,6 +41,10 @@
this.servletClass = servletClass;
}
+ @Override
+ public void destroy() {
+ }
+
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
log.debug("SERVICE: " + RackHelper.getURI(request) + " - " + servletClass.getSimpleName());
Modified: trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -35,8 +35,8 @@
public WikiClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,
- ContentCapabilitiesRegistry contentCapabilitiesRegistry) {
- super(NAME, i18n.t("wiki"), toolSelector, wsThemePresenter, ws, contentCapabilitiesRegistry);
+ final ContentCapabilitiesRegistry cntCapabReg) {
+ super(NAME, i18n.t("wiki"), toolSelector, wsThemePresenter, ws, cntCapabReg);
// registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
registerAuthorableTypes(TYPE_WIKIPAGE, TYPE_UPLOADEDFILE);
@@ -55,7 +55,7 @@
return NAME;
}
- protected void registerIcons() {
+ private void registerIcons() {
registerContentTypeIcon(TYPE_FOLDER, "images/nav/folder.png");
// registerContentTypeIcon(TYPE_FOLDER, "images/nav/wiki.png");
registerContentTypeIcon(TYPE_WIKIPAGE, "images/nav/wikipage.png");
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -133,8 +133,7 @@
});
}
- protected void createActions() {
- }
+ protected abstract void createActions();
protected void createContentModeratedActions(final String parentMenuTitle, final String... contentsModerated) {
createSetStatusAction(AccessRolDTO.Administrator, i18n.t("Published online"), ContentStatusDTO.publishedOnline,
@@ -252,11 +251,9 @@
new AsyncCallback<Object>() {
public void onFailure(final Throwable caught) {
NotifyUser.hideProgress();
- try {
- throw caught;
- } catch (final SessionExpiredException e) {
+ if (caught instanceof SessionExpiredException) {
errorHandler.doSessionExpired();
- } catch (final Throwable e) {
+ } else {
NotifyUser.error(i18n.t("Error saving document. Retrying..."));
errorHandler.process(caught);
editor.onSaveFailed();
@@ -383,8 +380,7 @@
return addContent;
}
- protected void createPostSessionInitActions() {
- }
+ protected abstract void createPostSessionInitActions();
protected ActionToolbarMenuDescriptor<StateToken> createRefreshCntAction(final String parentMenuTitle,
final String... registerInTypes) {
@@ -614,13 +610,10 @@
private void register(final ActionToolbarMenuAndItemDescriptor<StateToken> action, final Position position,
final String... registerInTypes) {
- switch (position) {
- case ctx:
+ if (position.equals(Position.ctx)) {
contextActionRegistry.addAction(action, registerInTypes);
- break;
- case cnt:
+ } else if (position.equals(Position.cnt)) {
contentActionRegistry.addAction(action, registerInTypes);
- break;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -97,7 +97,7 @@
}
public void setFileMenuTitle(String fileMenuTitleNew) {
- basicEditor.getTopBar().setParentMenuTitle(RTEditor.topbarPosition, fileMenuTitle, null, fileMenuTitleNew);
+ basicEditor.getTopBar().setParentMenuTitle(RTEditor.TOPBAR, fileMenuTitle, null, fileMenuTitleNew);
}
@Override
@@ -109,7 +109,7 @@
private void addContentActions() {
ActionToolbarMenuDescriptor<Object> rename = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
- RTEditor.topbarPosition, new Listener0() {
+ RTEditor.TOPBAR, new Listener0() {
public void onEvent() {
entityTitle.edit();
// basicEditor.setFocus(false);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -30,11 +30,11 @@
import com.calclab.suco.client.events.Listener2;
public class EntityHeaderPresenter implements EntityHeader {
- int GROUP_MEDIUM_NAME_LIMIT_SIZE = 90;
- int GROUP_LARGE_NAME_LIMIT_SIZE = 20;
+ private static final int MEDIUM_NAME_LIMIT = 90;
+ private static final int LARGE_NAME_LIMIT = 20;
- private EntityHeaderView view;
- private final Session session;
+ private transient EntityHeaderView view;
+ private transient final Session session;
public EntityHeaderPresenter(final StateManager stateManager, final WsThemePresenter theme, final Session session) {
this.session = session;
@@ -51,7 +51,7 @@
});
}
- public void addWidget(View widget) {
+ public void addWidget(final View widget) {
view.addWidget(widget);
}
@@ -86,11 +86,11 @@
}
}
- void setLogoText(String name) {
+ void setLogoText(final String name) {
int length = name.length();
- if (length <= GROUP_LARGE_NAME_LIMIT_SIZE) {
+ if (length <= LARGE_NAME_LIMIT) {
view.setLargeFont();
- } else if (length <= GROUP_MEDIUM_NAME_LIMIT_SIZE) {
+ } else if (length <= MEDIUM_NAME_LIMIT) {
view.setMediumFont();
} else {
view.setSmallFont();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -40,8 +40,8 @@
public EntityTextLogo() {
// Initialize
super();
- HorizontalPanel generalHP = new HorizontalPanel();
- VerticalPanel logoTextVP = new VerticalPanel();
+ final HorizontalPanel generalHP = new HorizontalPanel();
+ final VerticalPanel logoTextVP = new VerticalPanel();
logoImage = new Image();
logoLabel = new Label();
final Label expandCell = new Label("");
@@ -70,7 +70,7 @@
setStylePrimaryName("k-entitytextlogo");
addStyleName("k-entitytextlogo-no-border");
logoImage.setVisible(false);
- setLogoText("");
+ setLogoTextImpl("");
}
public void setLargeFont() {
@@ -78,7 +78,7 @@
logoLabel.addStyleName(LOGO_LARGE_FONT_STYLE);
}
- public void setLogoImage(AbstractImagePrototype imageProto) {
+ public void setLogoImage(final AbstractImagePrototype imageProto) {
imageProto.applyTo(logoImage);
}
@@ -88,7 +88,7 @@
}
public void setLogoText(final String text) {
- logoLabel.setText(text);
+ setLogoTextImpl(text);
}
public void setLogoVisible(final boolean visible) {
@@ -110,4 +110,8 @@
logoLabel.removeStyleName(LOGO_SMALL_FONT_STYLE);
logoLabel.removeStyleName(LOGO_MEDIUM_FONT_STYLE);
}
+
+ private void setLogoTextImpl(final String text) {
+ logoLabel.setText(text);
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -88,7 +88,7 @@
private LicenseDTO license;
public NewGroupPanel(final NewGroupPresenter presenter, final I18nTranslationService i18n,
- final Provider<LicenseWizard> licenseWizard, Images img) {
+ final Provider<LicenseWizard> licenseWizard, final Images img) {
super(NEWGROUP_WIZARD, WorkspaceMessages.REGISTER_A_NEW_GROUP_TITLE, true, true, 450, 430, "k-newgroup-icon",
i18n.t("Cancel"), CANCEL_BUTTON, i18n.t("Register"), REGISTER_BUTTON, new Listener0() {
public void onEvent() {
@@ -101,12 +101,12 @@
}, 9);
super.addListener(new WindowListenerAdapter() {
@Override
- public void onHide(Component component) {
+ public void onHide(final Component component) {
presenter.onClose();
}
@Override
- public void onShow(Component component) {
+ public void onShow(final Component component) {
KuneUiUtils.focusOnField(shortNameField);
}
});
@@ -170,10 +170,8 @@
mask(i18n.t("Processing"));
}
- public void setLicense(LicenseDTO license) {
- this.license = license;
- licenseImage.setUrl(license.getImageUrl());
- KuneUiUtils.setQuickTip(licenseImage, license.getLongName());
+ public void setLicense(final LicenseDTO license) {
+ setLicenseImpl(license);
}
public void setMessage(final String message, final Level level) {
@@ -247,7 +245,7 @@
licenseImage = new Image("images/lic/bysa80x15.png");
licenseImage.addClickListener(new ClickListener() {
- public void onClick(Widget arg0) {
+ public void onClick(final Widget arg0) {
KuneWindowUtils.open(license.getUrl());
}
});
@@ -261,10 +259,10 @@
changeLicenseButton.setTabIndex(5);
changeLicenseButton.addListener(new ButtonListenerAdapter() {
@Override
- public void onClick(Button button, EventObject e) {
+ public void onClick(final Button button, final EventObject e) {
licenseWizard.get().start(new Listener<LicenseDTO>() {
- public void onEvent(LicenseDTO license) {
- setLicense(license);
+ public void onEvent(final LicenseDTO license) {
+ setLicenseImpl(license);
}
});
}
@@ -314,4 +312,10 @@
return form;
}
+
+ private void setLicenseImpl(final LicenseDTO license) {
+ this.license = license;
+ licenseImage.setUrl(license.getImageUrl());
+ KuneUiUtils.setQuickTip(licenseImage, license.getLongName());
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -25,6 +25,7 @@
import org.ourproject.kune.platf.client.dto.LicenseDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.errors.GroupNameInUseException;
+import org.ourproject.kune.platf.client.errors.UIException;
import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
import org.ourproject.kune.platf.client.rpc.GroupServiceAsync;
@@ -37,24 +38,23 @@
import com.calclab.suco.client.events.Listener0;
import com.calclab.suco.client.ioc.Provider;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
public class NewGroupPresenter implements NewGroup {
- private NewGroupView view;
- private final I18nTranslationService i18n;
- private final Session session;
- private final StateManager stateManager;
- private final Provider<GroupServiceAsync> groupServiceProvider;
- private boolean mustGoToPrevious;
+ private transient NewGroupView view;
+ private transient final I18nTranslationService i18n;
+ private transient final Session session;
+ private transient final StateManager stateManager;
+ private transient final Provider<GroupServiceAsync> groupService;
+ private transient boolean mustGoToPrevious;
public NewGroupPresenter(final I18nTranslationService i18n, final Session session, final StateManager stateManager,
- final Provider<GroupServiceAsync> groupServiceProvider) {
+ final Provider<GroupServiceAsync> groupService) {
this.i18n = i18n;
this.session = session;
this.stateManager = stateManager;
- this.groupServiceProvider = groupServiceProvider;
+ this.groupService = groupService;
stateManager.addSiteToken(SiteToken.newgroup.toString(), new Listener0() {
public void onEvent() {
doNewGroup();
@@ -113,16 +113,13 @@
final AsyncCallback<StateToken> callback = new AsyncCallback<StateToken>() {
public void onFailure(final Throwable caught) {
- try {
- throw caught;
- } catch (final GroupNameInUseException e) {
+ if (caught instanceof GroupNameInUseException) {
view.unMask();
setMessage(i18n.t(WorkspaceMessages.NAME_IN_ALREADY_IN_USE), Level.error);
- } catch (final Throwable e) {
+ } else {
view.unMask();
setMessage(i18n.t("Error creating group"), Level.error);
- GWT.log("Other kind of exception in group registration", null);
- throw new RuntimeException();
+ throw new UIException("Other kind of exception in group registration", caught);
}
}
@@ -134,8 +131,7 @@
view.unMask();
}
};
- groupServiceProvider.get().createNewGroup(session.getUserHash(), group, publicDesc, view.getTags(), null,
- callback);
+ groupService.get().createNewGroup(session.getUserHash(), group, publicDesc, view.getTags(), null, callback);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -56,8 +56,7 @@
@Override
public void createAndShow() {
// FIXME: use onAfterCreate in Factory/Module
- entityPreferencesGroup.createAll();
- super.createAndShow();
+ createAndShowItImpl();
}
public void setButtonVisible(final boolean visible) {
@@ -74,11 +73,16 @@
optionsButton.setText(i18n.t(PlatfMessages.ENT_OPTIONS_USER_TITLE));
}
+ private void createAndShowItImpl() {
+ entityPreferencesGroup.createAll();
+ super.createAndShow();
+ }
+
private void createOptionsButton() {
optionsButton = new EntityHeaderButton("", images.emblemSystem());
optionsButton.addClickListener(new ClickListener() {
public void onClick(final Widget arg0) {
- createAndShow();
+ createAndShowItImpl();
}
});
optionsButton.ensureDebugId(GROUP_OPTIONS_ICON);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RatePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RatePanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RatePanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -41,10 +41,10 @@
layout();
setProperties();
if (rate != null) {
- setRate(rate);
+ setRateImpl(rate);
}
if (byUsers != null) {
- setByUsers(byUsers);
+ setByUsersImpl(byUsers);
}
final Toolbar bottomBar = ws.getEntityWorkspace().getContentBottomBar();
bottomBar.addFill();
@@ -52,18 +52,11 @@
}
public void setByUsers(final Integer byUsers) {
- if (byUsers.intValue() == 0) {
- rateDesc.setText(i18n.t("(Not rated)"));
- } else if (byUsers.intValue() == 1) {
- // i18n params pluralization
- rateDesc.setText(i18n.t("([%d] user)", byUsers));
- } else {
- rateDesc.setText(i18n.t("([%d] users)", byUsers));
- }
+ setByUsersImpl(byUsers);
}
public void setRate(final Double rate) {
- setRate(Star.genStars(rate.doubleValue()));
+ setRateImpl(rate);
}
private void initialize() {
@@ -84,6 +77,17 @@
rateGrid.setWidget(0, 5, rateDesc);
}
+ private void setByUsersImpl(final Integer byUsers) {
+ if (byUsers.intValue() == 0) {
+ rateDesc.setText(i18n.t("(Not rated)"));
+ } else if (byUsers.intValue() == 1) {
+ // i18n params pluralization
+ rateDesc.setText(i18n.t("([%d] user)", byUsers));
+ } else {
+ rateDesc.setText(i18n.t("([%d] users)", byUsers));
+ }
+ }
+
private void setProperties() {
rateGrid.setCellPadding(0);
rateGrid.setCellSpacing(0);
@@ -93,7 +97,11 @@
rateDesc.addStyleName("kune-Margin-Small-lr");
}
- private void setRate(final Star stars[]) {
+ private void setRateImpl(final Double rate) {
+ setRateImpl(Star.genStars(rate.doubleValue()));
+ }
+
+ private void setRateImpl(final Star stars[]) {
for (int i = 0; i < 5; i++) {
stars[i].getImage().applyTo(starImg[i]);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/rate/Star.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/rate/Star.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/Star.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -24,69 +24,69 @@
import com.google.gwt.user.client.ui.AbstractImagePrototype;
public class Star {
- private static final Images img = Images.App.getInstance();
+ private static final Images IMG = Images.App.getInstance();
public static final int GREY = 0;
public static final int YELLOW = 1;
public final static Star[] CLEAR = { new Star(), new Star(), new Star(), new Star(), new Star() };
- private AbstractImagePrototype image;
+ public static Star[] genStars(final double rate) {
+ Star[] stars;
+ stars = new Star[5];
+ final int rateTruncated = (int) rate;
+ final double rateDecimals = rate - rateTruncated;
- public Star() {
- image = img.starGrey();
+ for (int i = 0; i < 5; i++) {
+ if (i < rateTruncated) {
+ stars[i] = new Star(Star.YELLOW);
+ } else {
+ if (i == rateTruncated) {
+ stars[i] = new Star(rateDecimals);
+ } else {
+ stars[i] = new Star(Star.GREY);
+ }
+ }
+ }
+ return stars;
}
- public AbstractImagePrototype getImage() {
- return image;
+ private transient AbstractImagePrototype image;
+
+ public Star() {
+ image = IMG.starGrey();
}
public Star(final double rateDecimals) {
if (rateDecimals == 1) {
- image = img.starYellow();
+ image = IMG.starYellow();
} else if (rateDecimals == 0) {
- image = img.starGrey();
+ image = IMG.starGrey();
} else {
final int rateTrucated = (int) rateDecimals;
final int rateDecimal = (int) ((rateDecimals - rateTrucated) * 10) * 10;
if (rateDecimal == 10) {
- image = img.star10();
+ image = IMG.star10();
} else if (rateDecimal == 20) {
- image = img.star20();
+ image = IMG.star20();
} else if (rateDecimal == 30) {
- image = img.star30();
+ image = IMG.star30();
} else if (rateDecimal == 40) {
- image = img.star40();
+ image = IMG.star40();
} else if (rateDecimal == 50) {
- image = img.star50();
+ image = IMG.star50();
} else if (rateDecimal == 60) {
- image = img.star60();
+ image = IMG.star60();
} else if (rateDecimal == 70) {
- image = img.star70();
+ image = IMG.star70();
} else if (rateDecimal == 80) {
- image = img.star80();
+ image = IMG.star80();
} else if (rateDecimal == 90) {
- image = img.star90();
+ image = IMG.star90();
}
}
}
- public static Star[] genStars(final double rate) {
- Star[] stars;
- stars = new Star[5];
- final int rateTruncated = (int) rate;
- final double rateDecimals = rate - rateTruncated;
-
- for (int i = 0; i < 5; i++) {
- if (i < rateTruncated) {
- stars[i] = new Star(Star.YELLOW);
- } else {
- if (i == rateTruncated) {
- stars[i] = new Star(rateDecimals);
- } else {
- stars[i] = new Star(Star.GREY);
- }
- }
- }
- return stars;
+ public AbstractImagePrototype getImage() {
+ return image;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -19,6 +19,7 @@
*/
package org.ourproject.kune.workspace.client.search;
+import org.ourproject.kune.platf.client.errors.UIException;
import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
import org.ourproject.kune.platf.client.services.SearcherConstants;
import org.ourproject.kune.platf.client.ui.AbstractSearcherPanel;
@@ -188,13 +189,11 @@
searchField.addListener(new FieldListenerAdapter() {
@Override
- public void onSpecialKey(final Field field, final EventObject e) {
- switch (e.getKey()) {
- case KeyboardListener.KEY_ENTER:
+ public void onSpecialKey(final Field field, final EventObject event) {
+ if (event.getKey() == KeyboardListener.KEY_ENTER) {
presenter.doSearch(field.getValueAsString());
- break;
}
- e.stopEvent();
+ event.stopEvent();
}
});
@@ -204,7 +203,7 @@
searchBtn.addListener(new ButtonListenerAdapter() {
@Override
public void onClick(final Button button, final EventObject e) {
- presenter.doSearch(getTextToSearch());
+ presenter.doSearch(searchField.getValueAsString());
}
});
hp.add(form);
@@ -229,7 +228,7 @@
store = contentStore = createStore(fieldDefs, SearcherConstants.CONTENT_DATA_PROXY_URL, id);
break;
default:
- throw new RuntimeException("Unknown type of search");
+ throw new UIException("Unknown type of search");
}
final ColumnModel columnModel = new ColumnModel(new ColumnConfig[] { new ColumnConfig() {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -28,6 +28,7 @@
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
import org.ourproject.kune.platf.client.errors.EmailAddressInUseException;
import org.ourproject.kune.platf.client.errors.GroupNameInUseException;
+import org.ourproject.kune.platf.client.errors.UIException;
import org.ourproject.kune.platf.client.i18n.I18nUITranslationService;
import org.ourproject.kune.platf.client.rpc.UserServiceAsync;
import org.ourproject.kune.platf.client.state.Session;
@@ -37,7 +38,6 @@
import com.calclab.emiteuimodule.client.SubscriptionMode;
import com.calclab.suco.client.ioc.Provider;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
public class RegisterPresenter extends SignInAbstractPresenter implements Register {
@@ -46,8 +46,9 @@
private final Provider<UserServiceAsync> userServiceProvider;
private final Provider<SignIn> signInProvider;
- public RegisterPresenter(Session session, StateManager stateManager, I18nUITranslationService i18n,
- Provider<UserServiceAsync> userServiceProvider, Provider<SignIn> signInProvider) {
+ public RegisterPresenter(final Session session, final StateManager stateManager,
+ final I18nUITranslationService i18n, final Provider<UserServiceAsync> userServiceProvider,
+ final Provider<SignIn> signInProvider) {
super(session, stateManager, i18n);
this.userServiceProvider = userServiceProvider;
this.signInProvider = signInProvider;
@@ -69,7 +70,7 @@
return view;
}
- public void init(RegisterView view) {
+ public void init(final RegisterView view) {
this.view = view;
super.view = view;
}
@@ -87,25 +88,21 @@
final TimeZoneDTO timezone = new TimeZoneDTO();
timezone.setId(view.getTimezone());
- final boolean wantPersonalHomepage = view.wantPersonalHomepage();
+ final boolean wantHomepage = view.wantPersonalHomepage();
final UserDTO user = new UserDTO(view.getLongName(), view.getShortName(), view.getRegisterPassword(),
view.getEmail(), language, country, timezone, null, true, SubscriptionMode.manual, "blue");
final AsyncCallback<UserInfoDTO> callback = new AsyncCallback<UserInfoDTO>() {
public void onFailure(final Throwable caught) {
view.unMask();
- try {
- throw caught;
- } catch (final EmailAddressInUseException e) {
+ if (caught instanceof EmailAddressInUseException) {
view.setErrorMessage(i18n.t(PlatfMessages.EMAIL_IN_USE), Level.error);
- } catch (final GroupNameInUseException e) {
+ } else if (caught instanceof GroupNameInUseException) {
view.setErrorMessage(i18n.t(PlatfMessages.NAME_IN_USE), Level.error);
- } catch (final Throwable e) {
+ } else {
view.setErrorMessage(i18n.t("Error during registration."), Level.error);
- GWT.log("Other kind of exception in user registration" + e.getMessage() + ", "
- + e.getLocalizedMessage(), null);
- e.printStackTrace();
- throw new RuntimeException();
+ throw new UIException("Other kind of exception in user registration", caught);
+
}
}
@@ -114,14 +111,14 @@
stateManager.gotoToken(userInfoDTO.getHomePage());
view.hide();
view.unMask();
- if (wantPersonalHomepage) {
+ if (wantHomepage) {
view.showWelcolmeDialog();
} else {
view.showWelcolmeDialogNoHomepage();
}
}
};
- userServiceProvider.get().createUser(user, wantPersonalHomepage, callback);
+ userServiceProvider.get().createUser(user, wantHomepage, callback);
}
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -42,8 +42,8 @@
private final Provider<UserServiceAsync> userServiceProvider;
private final Provider<Register> registerProvider;
- public SignInPresenter(Session session, StateManager stateManager, I18nUITranslationService i18n,
- Provider<UserServiceAsync> userServiceProvider, Provider<Register> registerProvider) {
+ public SignInPresenter(final Session session, final StateManager stateManager, final I18nUITranslationService i18n,
+ final Provider<UserServiceAsync> userServiceProvider, final Provider<Register> registerProvider) {
super(session, stateManager, i18n);
this.userServiceProvider = userServiceProvider;
this.registerProvider = registerProvider;
@@ -66,7 +66,7 @@
return view;
}
- public void init(SignInView view) {
+ public void init(final SignInView view) {
this.view = view;
super.view = view;
}
@@ -93,11 +93,9 @@
public void onFailure(final Throwable caught) {
view.unMask();
NotifyUser.hideProgress();
- try {
- throw caught;
- } catch (final UserAuthException e) {
+ if (caught instanceof UserAuthException) {
view.setErrorMessage(i18n.t(PlatfMessages.INCORRECT_NICKNAME_EMAIL_OR_PASSWORD), Level.error);
- } catch (final Throwable e) {
+ } else {
view.setErrorMessage("Error in login", Level.error);
Log.error("Other kind of exception in SignInPresenter/doLogin");
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitepublic/SitePublicSpaceLinkPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitepublic/SitePublicSpaceLinkPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitepublic/SitePublicSpaceLinkPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -54,7 +54,7 @@
siteBar.addFill();
gotoPublic.addStyleName("kune-Margin-Medium-r");
- setContentPublic(true);
+ setContentPublicImpl(true);
gotoPublic.addClickListener(new ClickListener() {
public void onClick(final Widget sender) {
gotoPublic();
@@ -80,9 +80,8 @@
this.publicUrl = publicUrl;
}
- public void setContentPublic(boolean visible) {
- gotoPublic.setVisible(visible);
- contentNoPublic.setVisible(!visible);
+ public void setContentPublic(final boolean visible) {
+ setContentPublicImpl(visible);
}
public void setVisible(final boolean visible) {
@@ -93,4 +92,9 @@
private void gotoPublic() {
Window.open(publicUrl, "_kunepublic", "");
}
+
+ private void setContentPublicImpl(final boolean visible) {
+ gotoPublic.setVisible(visible);
+ contentNoPublic.setVisible(!visible);
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -42,7 +42,7 @@
private final TextBox searchTextBox;
private final AbstractToolbar siteBar;
- public SiteSearchPanel(final SiteSearchPresenter presenter, final WorkspaceSkeleton ws, Images img) {
+ public SiteSearchPanel(final SiteSearchPresenter presenter, final WorkspaceSkeleton ws, final Images img) {
siteBar = ws.getSiteBar();
siteBar.addSpacer();
searchButton = new PushButton(img.kuneSearchIco().createImage(), img.kuneSearchIcoPush().createImage());
@@ -54,7 +54,7 @@
siteBar.addSpacer();
siteBar.add(searchTextBox);
- setTextSearchSmall();
+ setTextSearchSmallImpl();
searchTextBox.addFocusListener(new FocusListener() {
public void onFocus(final Widget arg0) {
presenter.onSearchFocus();
@@ -102,7 +102,7 @@
searchTextBox.setText(text);
}
- public void setTextSearch(String text) {
+ public void setTextSearch(final String text) {
searchTextBox.setText(text);
}
@@ -111,6 +111,10 @@
}
public void setTextSearchSmall() {
+ setTextSearchSmallImpl();
+ }
+
+ private void setTextSearchSmallImpl() {
searchTextBox.setPixelSize(SEARCH_TEXT_WIDTH_SMALL, SEARCH_TEXT_HEIGHT);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -26,6 +26,7 @@
import org.ourproject.kune.platf.client.actions.BeforeActionListener;
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
import org.ourproject.kune.platf.client.errors.SessionExpiredException;
+import org.ourproject.kune.platf.client.errors.UIException;
import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
import org.ourproject.kune.platf.client.rpc.UserServiceAsync;
import org.ourproject.kune.platf.client.services.ErrorHandler;
@@ -35,21 +36,20 @@
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.core.client.GWT;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.rpc.AsyncCallback;
public class SiteSignOutLinkPresenter implements SiteSignOutLink {
- private SiteSignOutLinkView view;
- private final Session session;
- private final Provider<UserServiceAsync> userServiceProvider;
- private final BeforeActionCollection beforeSignOutCollection;
+ private transient SiteSignOutLinkView view;
+ private transient final Session session;
+ private transient final Provider<UserServiceAsync> userService;
+ private transient final BeforeActionCollection beforeSignOut;
- public SiteSignOutLinkPresenter(final Session session, final Provider<UserServiceAsync> userServiceProvider,
- final Provider<ErrorHandler> kuneErrorHandlerProvider) {
+ public SiteSignOutLinkPresenter(final Session session, final Provider<UserServiceAsync> userService,
+ final Provider<ErrorHandler> errorHandler) {
this.session = session;
- this.userServiceProvider = userServiceProvider;
+ this.userService = userService;
session.onUserSignIn(new Listener<UserInfoDTO>() {
public void onEvent(final UserInfoDTO userInfoDTO) {
view.setVisible(true);
@@ -60,32 +60,29 @@
view.setVisible(false);
}
});
- kuneErrorHandlerProvider.get().onSessionExpired(new Listener0() {
+ errorHandler.get().onSessionExpired(new Listener0() {
public void onEvent() {
clientUIsignOut();
}
});
- beforeSignOutCollection = new BeforeActionCollection();
+ beforeSignOut = new BeforeActionCollection();
}
- public void addBeforeSignOut(BeforeActionListener listener) {
- beforeSignOutCollection.add(listener);
+ public void addBeforeSignOut(final BeforeActionListener listener) {
+ beforeSignOut.add(listener);
}
public void doSignOut() {
- if (beforeSignOutCollection.checkBeforeAction()) {
- userServiceProvider.get().logout(session.getUserHash(), new AsyncCallback<Object>() {
+ if (beforeSignOut.checkBeforeAction()) {
+ userService.get().logout(session.getUserHash(), new AsyncCallback<Object>() {
public void onFailure(final Throwable caught) {
NotifyUser.hideProgress();
- try {
- throw caught;
- } catch (final SessionExpiredException e) {
+ if (caught instanceof SessionExpiredException) {
clientUIsignOut();
- } catch (final UserMustBeLoggedException e) {
+ } else if (caught instanceof UserMustBeLoggedException) {
clientUIsignOut();
- } catch (final Throwable e) {
- GWT.log("Other kind of exception in doLogout", null);
- throw new RuntimeException();
+ } else {
+ throw new UIException("Other kind of exception in doLogout", caught);
}
}
@@ -109,8 +106,8 @@
view.setVisible(false);
}
- public void removeBeforeSignOut(BeforeActionListener listener) {
- beforeSignOutCollection.remove(listener);
+ public void removeBeforeSignOut(final BeforeActionListener listener) {
+ beforeSignOut.remove(listener);
}
private void clientUIsignOut() {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -115,7 +115,7 @@
new AccessRightsDTO(true, true, true), false), avatarUrl, user.getName(), tooltip);
}
boolean hasLocalBuddies = buddies.size() > 0;
- int numExtBuddies = userBuddies.getOtherExternalBuddies();
+ int numExtBuddies = userBuddies.getOtherExtBuddies();
if (numExtBuddies > 0) {
if (hasLocalBuddies) {
// i18n: plural
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-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -74,7 +74,7 @@
public SocialNetworkPresenter(final I18nTranslationService i18n, final StateManager stateManager,
final Session session, final Provider<SocialNetworkServiceAsync> snServiceProvider,
- GroupActionRegistry groupActionRegistry, final Provider<FileDownloadUtils> downloadProvider) {
+ final GroupActionRegistry groupActionRegistry, final Provider<FileDownloadUtils> downloadProvider) {
this.i18n = i18n;
this.stateManager = stateManager;
this.session = session;
@@ -128,23 +128,18 @@
return gridItem;
}
- protected String createTooltipWithLogo(String shortName, StateToken token, boolean hasLogo, boolean isPersonal) {
+ protected String createTooltipWithLogo(final String shortName, final StateToken token, final boolean hasLogo,
+ final boolean isPersonal) {
return "<table><tr><td>"
+ (hasLogo ? downloadProvider.get().getLogoAvatarHtml(token, hasLogo, isPersonal,
FileConstants.LOGO_ICON_DEFAULT_HEIGHT, 3) : "") + "</td><td>"
+ i18n.t(isPersonal ? "Nickname: [%s]" : "Group short name: [%s]", shortName) + "</td></tr></table>";
}
- protected boolean isMember(AccessRightsDTO rights) {
- boolean userIsAdmin = rights.isAdministrable();
- final boolean userIsCollab = !userIsAdmin && rights.isEditable();
- return isMember(userIsAdmin, userIsCollab);
- }
-
private void createButtons() {
participate = new ActionToolbarButtonDescriptor<StateToken>(AccessRolDTO.Viewer, membersBottom,
new Listener<StateToken>() {
- public void onEvent(StateToken parameter) {
+ public void onEvent(final StateToken parameter) {
NotifyUser.showProgressProcessing();
snServiceProvider.get().requestJoinGroup(session.getUserHash(),
session.getCurrentState().getStateToken(), new AsyncCallbackSimple<Object>() {
@@ -172,14 +167,14 @@
participate.setToolTip(i18n.t("Request to participate in this group"));
participate.setMustBeAuthenticated(false);
participate.setAddCondition(new ActionAddCondition<StateToken>() {
- public boolean mustBeAdded(StateToken token) {
+ public boolean mustBeAdded(final StateToken token) {
return !isMember(session.getCurrentState().getGroupRights());
}
});
unJoin = new ActionToolbarMenuDescriptor<StateToken>(AccessRolDTO.Editor, membersBottom,
new Listener<StateToken>() {
- public void onEvent(StateToken parameter) {
+ public void onEvent(final StateToken parameter) {
removeMemberAction();
}
});
@@ -322,6 +317,12 @@
});
}
+ private boolean isMember(final AccessRightsDTO rights) {
+ boolean userIsAdmin = rights.isAdministrable();
+ final boolean userIsCollab = !userIsAdmin && rights.isEditable();
+ return isMember(userIsAdmin, userIsCollab);
+ }
+
private boolean isMember(final boolean userIsAdmin, final boolean userIsCollab) {
return userIsAdmin || userIsCollab;
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/RenameAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/RenameAction.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/RenameAction.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -40,7 +40,8 @@
private final Event2<StateToken, String> onSuccess;
private final Event2<StateToken, String> onFail;
- public RenameAction(I18nTranslationService i18n, Session session, Provider<ContentServiceAsync> contentService) {
+ public RenameAction(final I18nTranslationService i18n, final Session session,
+ final Provider<ContentServiceAsync> contentService) {
this.i18n = i18n;
this.session = session;
this.contentService = contentService;
@@ -62,15 +63,13 @@
final AsyncCallback<StateAbstractDTO> asyncCallback = new AsyncCallback<StateAbstractDTO>() {
public void onFailure(final Throwable caught) {
NotifyUser.hideProgress();
- try {
- throw caught;
- } catch (final NameInUseException e) {
+ if (caught instanceof NameInUseException) {
NotifyUser.error(i18n.tWithNT("This name already exists",
"It is used when a file or a folder with the same name already exists"));
- } catch (final NameNotPermittedException e) {
+ } else if (caught instanceof NameNotPermittedException) {
NotifyUser.error(i18n.tWithNT("This name is not permitted",
"It is used when a file or a folder does not have a permitted name"));
- } catch (final Throwable e) {
+ } else {
NotifyUser.error(i18n.t("Error renaming"));
}
onFail.fire(token, oldName);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -23,6 +23,7 @@
import java.util.List;
import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.errors.UIException;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
@@ -37,7 +38,7 @@
public ToolSelectorPresenter(final StateManager stateManager, final WsThemePresenter wsThemePresenter) {
tools = new HashMap<String, ToolSelectorItem>();
stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
- public void onEvent(StateAbstractDTO state) {
+ public void onEvent(final StateAbstractDTO state) {
for (String tool : tools.keySet()) {
List<String> enabledTools = state.getEnabledTools();
if (enabledTools != null && enabledTools.contains(tool)) {
@@ -63,10 +64,10 @@
public void addTool(final ToolSelectorItem item) {
final String name = item.getShortName();
if (name == null) {
- throw new RuntimeException("You cannot add a tool without a name");
+ throw new UIException("You cannot add a tool without a name");
}
if (tools.get(name) != null) {
- throw new RuntimeException("A tool with the same name already added");
+ throw new UIException("A tool with the same name already added");
}
tools.put(name, item);
item.setSelected(false);
Modified: trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionShortcutTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionShortcutTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionShortcutTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -5,6 +5,8 @@
import org.junit.Before;
import org.junit.Test;
+import org.ourproject.kune.platf.client.i18n.I18nTranslationServiceMocked;
+import org.ourproject.kune.platf.client.i18n.Resources;
import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor;
import com.google.gwt.user.client.ui.KeyboardListener;
@@ -22,10 +24,11 @@
@Before
public void before() {
+ new Resources(new I18nTranslationServiceMocked());
}
@Test
- public void ctrl_coma() {
+ public void ctrlComa() {
ShortcutDescriptor shortcut = new ShortcutDescriptor(true, ',');
assertEquals(" (Ctrl+,)", shortcut.toString());
assertTrue(shortcut.is(',', KeyboardListener.MODIFIER_CTRL));
@@ -34,7 +37,7 @@
}
@Test
- public void ctrl_s() {
+ public void ctrlS() {
ShortcutDescriptor shortcut = new ShortcutDescriptor(true, 's');
assertEquals(" (Ctrl+S)", shortcut.toString());
assertTrue(shortcut.is('s', KeyboardListener.MODIFIER_CTRL));
@@ -43,7 +46,7 @@
}
@Test
- public void ctrlS() {
+ public void ctrlSCapital() {
ShortcutDescriptor shortcut = new ShortcutDescriptor(true, 'S');
assertEquals(" (Ctrl+S)", shortcut.toString());
assertTrue(shortcut.is('S', KeyboardListener.MODIFIER_CTRL));
Modified: trunk/src/test/java/org/ourproject/kune/platf/client/state/StateTokenTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/state/StateTokenTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/state/StateTokenTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -38,4 +38,15 @@
final StateToken token2 = new StateToken("abc", "da", 1L);
assertFalse(token1.equals(token2));
}
+
+ @Test
+ public void parseEncodedNotCatched() {
+ final StateToken token1 = new StateToken();
+ final StateToken token2 = new StateToken();
+ token1.getEncoded();
+ token2.getEncoded();
+ token1.setEncoded("abc.da.1.1");
+ token2.setEncoded("abc.da.1.2");
+ assertFalse(token1.equals(token2));
+ }
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenterTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenterTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -8,12 +8,12 @@
import org.mockito.Mockito;
import org.mockito.internal.verification.api.VerificationMode;
import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
-import org.ourproject.kune.platf.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
+import org.ourproject.kune.platf.client.i18n.I18nTranslationServiceMocked;
+import org.ourproject.kune.platf.client.i18n.Resources;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.ui.rte.basic.RTEditor;
import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources;
-import org.ourproject.kune.platf.client.ui.rte.saving.RTESavingEditorPresenter;
-import org.ourproject.kune.platf.client.ui.rte.saving.RTESavingEditorView;
import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper;
import org.ourproject.kune.platf.client.utils.TimerWrapper;
@@ -38,7 +38,8 @@
@SuppressWarnings("unchecked")
@Before
public void createObjects() {
- I18nUITranslationService i18n = Mockito.mock(I18nUITranslationService.class);
+ I18nTranslationService i18n = new I18nTranslationServiceMocked();
+ new Resources(i18n);
stateManager = Mockito.mock(StateManager.class);
deferredCommandWrapper = Mockito.mock(DeferredCommandWrapper.class);
rteEditor = Mockito.mock(RTEditor.class);
@@ -153,7 +154,7 @@
return newToken;
}
- private void verifyAskConfirmationCalled(VerificationMode mode) {
+ private void verifyAskConfirmationCalled(final VerificationMode mode) {
Mockito.verify(view, mode).askConfirmation(Mockito.anyString(), Mockito.anyString(),
(Listener0) Mockito.anyObject(), (Listener0) Mockito.anyObject());
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -81,9 +81,9 @@
@Test
public void testI18n() {
- assertNotNull(countryManager.find(new Long(75)));
+ assertNotNull(countryManager.find(Long.valueOf(75)));
assertNotNull(languageManager.findByCode("en"));
- assertNotNull(languageManager.find(new Long(1819)));
+ assertNotNull(languageManager.find(Long.valueOf(1819)));
}
@Test
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/HttpServletRequestMocked.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/HttpServletRequestMocked.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/HttpServletRequestMocked.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -45,6 +45,7 @@
return null;
}
+ // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:17
public Cookie[] getCookies() {
return null;
}
@@ -114,6 +115,7 @@
return null;
}
+ // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:17
public String[] getParameterValues(final String arg0) {
return null;
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -1,6 +1,7 @@
package org.ourproject.kune.platf.integration.content;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -52,7 +53,7 @@
defaultContent.getStateToken());
assertEquals(new Double(4.5), again.getCurrentUserRate());
assertEquals(new Double(4.5), again.getRate());
- assertEquals(new Integer(1), again.getRateByUsers());
+ assertEquals(Integer.valueOf(1), again.getRateByUsers());
}
@Test
@@ -173,7 +174,7 @@
final ContentSimpleDTO newDefContent = contentService.setAsDefaultContent(session.getHash(),
added.getStateToken());
- assertTrue(!defaultContent.getStateToken().equals(newDefContent.getStateToken()));
+ assertFalse(defaultContent.getStateToken().equals(newDefContent.getStateToken()));
assertTrue(added.getStateToken().equals(newDefContent.getStateToken()));
}
@@ -204,7 +205,7 @@
assertEquals(newTitle, folderAgain.getContainer().getName());
}
- private void checkResult(TagCloudResultDTO cloudResultDTO) {
+ private void checkResult(final TagCloudResultDTO cloudResultDTO) {
assertNotNull(cloudResultDTO.getTagCountList());
List<TagCountDTO> summaryTags = cloudResultDTO.getTagCountList();
assertEquals(3, summaryTags.size());
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -9,6 +9,7 @@
import org.junit.BeforeClass;
import org.ourproject.kune.platf.client.dto.GroupType;
import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.server.ServerException;
import org.ourproject.kune.workspace.client.WorkspaceMessages;
import org.ourproject.kune.workspace.client.newgroup.NewGroupPanel;
import org.ourproject.kune.workspace.client.signin.RegisterForm;
@@ -54,16 +55,16 @@
selenium.refresh();
selenium.windowMaximize();
} catch (final UnsupportedOperationException e) {
- System.err.println("Seems that selenium server is not running; run before: 'mvn selenium:start-server' ");
+ new ServerException("Seems that selenium server is not running; run before: 'mvn selenium:start-server' ");
}
}
- public void setMustCapture(boolean mustCapture) {
+ public void setMustCapture(final boolean mustCapture) {
this.mustCapture = mustCapture;
}
- protected void fillNewGroup1stPage(String shortname, String longName, String description, String tags,
- GroupType groupType) throws Exception {
+ protected void fillNewGroup1stPage(final String shortname, final String longName, final String description,
+ final String tags, final GroupType groupType) throws Exception {
type(NewGroupPanel.SHORTNAME_FIELD, shortname);
type(NewGroupPanel.LONGNAME_FIELD, longName);
type(NewGroupPanel.PUBLICDESC_FIELD, description);
@@ -95,24 +96,24 @@
}
}
- protected void newGroupRegistrationDefLicense(String shortname, String longName, String description, String tags)
- throws Exception {
+ protected void newGroupRegistrationDefLicense(final String shortname, final String longName,
+ final String description, final String tags) throws Exception {
GroupType organization = GroupType.ORGANIZATION;
signInAndNewGroup();
fillNewGroup1stPage(shortname, longName, description, tags, organization);
click(NewGroupPanel.REGISTER_BUTTON);
}
- protected void open(SiteToken token) {
+ protected void open(final SiteToken token) {
open(KUNE_BASE_URL + token.toString());
}
- protected void open(StateToken token) {
+ protected void open(final StateToken token) {
open(KUNE_BASE_URL + token.toString());
}
@Override
- protected void open(String url) {
+ protected void open(final String url) {
try {
selenium.setTimeout("0");
super.open(url);
@@ -127,8 +128,8 @@
waitForTextInside(gid(EntityTitlePanel.ENTITY_TITLE_RIGHT_TITLE), "Welcome to kune");
}
- protected void register(String shortName, String longName, String passwd, String passwdDup, String email,
- String country, String language, String tz, boolean wantHomepage) {
+ protected void register(final String shortName, final String longName, final String passwd, final String passwdDup,
+ final String email, final String country, final String language, final String tz, final boolean wantHomepage) {
click(gid(SiteSignInLinkPanel.SITE_SIGN_IN));
click(gid(SignInPanel.CREATE_ONE));
type(RegisterForm.NICK_FIELD, shortName);
@@ -159,7 +160,7 @@
click(RegisterPanel.REGISTER_BUTTON_ID);
}
- protected String registerValidUser(boolean wantHomepage) {
+ protected String registerValidUser(final boolean wantHomepage) {
String shortName = "u" + genPrefix();
register(shortName, "some name " + genPrefix(), "somepasswd", "somepasswd", genPrefix() + "@example.com",
"Andorra", "English", "MET", wantHomepage);
@@ -170,7 +171,7 @@
signIn("admin", "easyeasy");
}
- protected void signIn(String nick, String passwd) {
+ protected void signIn(final String nick, final String passwd) {
click(gid(SiteSignInLinkPanel.SITE_SIGN_IN));
type(SignInForm.NICKOREMAIL_FIELD, nick);
type(SignInForm.PASSWORD_FIELD, passwd);
@@ -189,7 +190,7 @@
click("gwt-debug-k-ssolp-lb");
}
- protected void verifyLoggedUserShorName(String userShortName) throws Exception {
+ protected void verifyLoggedUserShorName(final String userShortName) throws Exception {
waitForTextInside(gid(SiteUserMenuPanel.LOGGED_USER_MENU), userShortName);
}
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -2,6 +2,7 @@
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import org.ourproject.kune.platf.server.ServerException;
import com.google.gwt.user.client.ui.UIObject;
import com.thoughtworks.selenium.DefaultSelenium;
@@ -12,7 +13,7 @@
private static boolean mustStopFinally = true;
@AfterClass
- public static void afterClass() throws Exception {
+ public static void afterClass() {
if (mustStopFinally) {
selenium.stop();
}
@@ -49,22 +50,22 @@
selenium.start();
}
- public static void setMustStopFinally(boolean mustStopFinally) {
+ public static void setMustStopFinally(final boolean mustStopFinally) {
SeleniumTestHelper.mustStopFinally = mustStopFinally;
}
- protected void click(String id) {
+ protected void click(final String id) {
selenium.click(id);
}
- protected void clickOnPushButton(String id) {
+ protected void clickOnPushButton(final String id) {
selenium.mouseOver(id);
selenium.mouseDown(id);
selenium.mouseUp(id);
}
- protected void fail(String message) throws Exception {
- throw new Exception(message);
+ protected void fail(final String message) throws Exception {
+ throw new ServerException(message);
}
/**
@@ -73,31 +74,32 @@
* @param id
* @return
*/
- protected String gid(String id) {
+ protected String gid(final String id) {
return UIObject.DEBUG_ID_PREFIX + id;
}
- protected String linkId(String link) {
+ protected String linkId(final String link) {
return "link=" + link;
}
- protected void open(String url) {
+ protected void open(final String url) {
try {
selenium.open(url);
} catch (final UnsupportedOperationException e) {
- System.err.println("Seems that selenium server is not running; run before: 'mvn selenium:start-server' ");
+ new ServerException("Seems that selenium server is not running; run before: 'mvn selenium:start-server' ",
+ e);
}
}
- protected void setSpeed(int milliseconds) {
+ protected void setSpeed(final int milliseconds) {
selenium.setSpeed("" + milliseconds);
}
- protected void type(String id, String text) {
+ protected void type(final String id, final String text) {
selenium.type(id, text);
}
- protected void wait(int milliseconds) {
+ protected void wait(final int milliseconds) {
try {
Thread.sleep(milliseconds);
} catch (InterruptedException e) {
@@ -106,7 +108,7 @@
}
}
- protected void waitForTextInside(String id, String text) throws Exception {
+ protected void waitForTextInside(final String id, final String text) throws Exception {
for (int second = 0;; second++) {
if (second >= 60) {
fail("timeout");
@@ -122,7 +124,7 @@
}
}
- protected void waitForTextRegExp(String id, String text) throws Exception {
+ protected void waitForTextRegExp(final String id, final String text) throws Exception {
for (int second = 0;; second++) {
if (second >= 60) {
fail("timeout");
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/PersistencePreLoadedDataTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/PersistencePreLoadedDataTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/PersistencePreLoadedDataTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -77,9 +77,9 @@
assertEquals(0, userFinder.getAll().size());
assertEquals(0, groupFinder.getAll().size());
assertEquals(0, licenseFinder.getAll().size());
- english = new I18nLanguage(new Long(1819), "English", "English", "en");
+ english = new I18nLanguage(Long.valueOf(1819), "English", "English", "en");
languageManager.persist(english);
- gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western", ",");
+ gb = new I18nCountry(Long.valueOf(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western", ",");
countryManager.persist(gb);
user = userManager.createUser(USER_SHORT_NAME, USER_LONG_NAME, USER_EMAIL, USER_PASSWORD, "en", "GB",
TimeZone.getDefault().getID());
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/TestDomainHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/TestDomainHelper.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/TestDomainHelper.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -13,57 +13,6 @@
public abstract class TestDomainHelper {
- public static User createUser(final int number) {
- String shortName = "shortname" + number;
- String longName = "name" + number;
- User user = new User(shortName, longName, "email@domain" + number, "password" + number, null, null,
- TimeZone.getDefault());
- Group userGroup = new Group(shortName, longName);
- userGroup.setAdmissionType(AdmissionType.Closed);
- userGroup.setSocialNetwork(createSocialNetwork(userGroup, userGroup, userGroup, null));
- user.setUserGroup(userGroup);
- return user;
- }
-
- public static Container createFolderWithId(final long id) {
- Container container = new Container();
- container.setId(id);
- return container;
- }
-
- public static Container createFolderWithIdAndToolName(final int i, final String toolName) {
- Container container = createFolderWithId(i);
- container.setToolName(toolName);
- return container;
- }
-
- public static Container createFolderWithIdAndGroupAndTool(final int i, final String groupShortName,
- final String toolName) {
- Container container = createFolderWithIdAndToolName(i, toolName);
- Group owner = new Group();
- owner.setShortName(groupShortName);
- container.setOwner(owner);
- return container;
-
- }
-
- public static Group createGroup(final int number) {
- Group group = new Group("ysei" + number, "Yellow Submarine Environmental Initiative" + number);
- group.setId(new Long(number));
- return group;
- }
-
- public static SocialNetwork createSocialNetwork(final Group groupInAdmins, final Group groupInCollab,
- final Group groupInViewer, final Group groupInPendings) {
-
- SocialNetwork socialNetwork = new SocialNetwork();
- socialNetwork.addAdmin(groupInAdmins);
- socialNetwork.addCollaborator(groupInCollab);
- socialNetwork.addViewer(groupInViewer);
- socialNetwork.addPendingCollaborator(groupInPendings);
- return socialNetwork;
- }
-
public static AccessLists createAccessLists(final Group groupAdmin, final Group groupEditor, final Group groupViewer) {
AccessLists lists = new AccessLists();
@@ -79,16 +28,6 @@
return lists;
}
- public static Content createDescriptor(final long id, final String title, final String content) {
- Content descriptor = new Content();
- descriptor.setId(id);
- Revision rev = new Revision(descriptor);
- descriptor.addRevision(rev);
- rev.setTitle(title);
- rev.setBody(content);
- return descriptor;
- }
-
public static String createBigText() {
String text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce leo felis, cursus eget, scelerisque adipiscing, fringilla vel, sem. Vestibulum semper tristique sem. Etiam quam neque, consectetuer at, fermentum id, vulputate non, leo. Ut condimentum, mauris et sollicitudin faucibus, lectus arcu facilisis mi, eu pretium arcu tortor quis sem. Pellentesque sit amet nulla ut tellus dapibus blandit. Donec eu dolor vitae mi scelerisque pretium. Donec sit amet nunc ut risus laoreet porta. Integer dictum mi at mauris. Vivamus vulputate, dolor quis pharetra interdum, augue nisi congue eros, a consectetuer libero mi ut quam. Fusce commodo sem blandit massa. Phasellus vehicula varius felis.\n"
+ "\n"
@@ -237,4 +176,65 @@
+ "Cras vulputate. Praesent tempus fringilla diam. Suspendisse at elit. Cras ut nulla eget mi dapibus pretium. Etiam hendrerit tortor sed lectus. Cras mauris. Nam ligula. Mauris semper, arcu ut facilisis molestie, lorem sapien iaculis quam, at dignissim sapien mauris id pede. In metus ante, porttitor id, fringilla a, adipiscing eget, nisi. Ut ornare sapien nec velit. Aenean tortor metus, pellentesque vitae, iaculis eget, imperdiet nec, turpis. Vestibulum sit amet erat ac urna auctor imperdiet. Nulla facilisi. Quisque facilisis pede vel mi consequat dignissim. Vivamus sapien.\n";
return text;
}
+
+ public static Content createDescriptor(final long id, final String title, final String content) {
+ Content descriptor = new Content();
+ descriptor.setId(id);
+ Revision rev = new Revision(descriptor);
+ descriptor.addRevision(rev);
+ rev.setTitle(title);
+ rev.setBody(content);
+ return descriptor;
+ }
+
+ public static Container createFolderWithId(final long id) {
+ Container container = new Container();
+ container.setId(id);
+ return container;
+ }
+
+ public static Container createFolderWithIdAndGroupAndTool(final int i, final String groupShortName,
+ final String toolName) {
+ Container container = createFolderWithIdAndToolName(i, toolName);
+ Group owner = new Group();
+ owner.setShortName(groupShortName);
+ container.setOwner(owner);
+ return container;
+
+ }
+
+ public static Container createFolderWithIdAndToolName(final int i, final String toolName) {
+ Container container = createFolderWithId(i);
+ container.setToolName(toolName);
+ return container;
+ }
+
+ public static Group createGroup(final int number) {
+ Group group = new Group("ysei" + number, "Yellow Submarine Environmental Initiative" + number);
+ group.setId(Long.valueOf(number));
+ return group;
+ }
+
+ public static SocialNetwork createSocialNetwork(final Group groupInAdmins, final Group groupInCollab,
+ final Group groupInViewer, final Group groupInPendings) {
+
+ SocialNetwork socialNetwork = new SocialNetwork();
+ socialNetwork.addAdmin(groupInAdmins);
+ socialNetwork.addCollaborator(groupInCollab);
+ socialNetwork.addViewer(groupInViewer);
+ socialNetwork.addPendingCollaborator(groupInPendings);
+ return socialNetwork;
+ }
+
+ public static User createUser(final int number) {
+ String shortName = "shortname" + number;
+ String longName = "name" + number;
+ User user = new User(shortName, longName, "email@domain" + number, "password" + number, null, null,
+ TimeZone.getDefault());
+ Group userGroup = new Group(shortName, longName);
+ userGroup.setAdmissionType(AdmissionType.Closed);
+ userGroup.setSocialNetwork(createSocialNetwork(userGroup, userGroup, userGroup, null));
+ user.setUserGroup(userGroup);
+ return user;
+ }
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -74,7 +74,7 @@
final Long rateByUsers = rateFinder.calculateRateNumberOfUsers(cd);
final Double average = (1.3 + 4.3) / 2;
assertEquals(average, rate);
- assertEquals(new Long(2), rateByUsers);
+ assertEquals(Long.valueOf(2), rateByUsers);
final Rate newRate1 = rateFinder.find(user1, cd);
final Rate newRate2 = rateFinder.find(user2, cd);
assertEquals(new Double(1.3), newRate1.getValue());
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/I18nManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/I18nManagerTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/I18nManagerTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -27,66 +27,18 @@
@Inject
I18nTranslationService translationService;
- @Before
- public void insertData() {
- openTransaction();
- I18nLanguage english = new I18nLanguage(new Long(1819), "English", "English", "en");
- I18nLanguage spanish = new I18nLanguage(new Long(5889), "Spanish", "Español", "es");
- I18nLanguage afrikaans = new I18nLanguage(new Long(114), "Afrikaans", "Afrikaans", "af");
- I18nLanguage greek = new I18nLanguage(new Long(1793), "Greek", "Ελληνικά", "el");
- languageManager.persist(english);
- languageManager.persist(spanish);
- languageManager.persist(afrikaans);
- languageManager.persist(greek);
- translationManager.persist(new I18nTranslation("Sunday [weekday]", english, "Sunday"));
- translationManager.persist(new I18nTranslation("January [month]", english, "January"));
- translationManager.persist(new I18nTranslation("Sunday [weekday]", afrikaans, "Sondag"));
- translationManager.persist(new I18nTranslation("January [month]", greek, "Ιανουάριος"));
- translationManager.persist(new I18nTranslation(StringEscapeUtils.escapeHtml("[%s] users"), english,
- StringEscapeUtils.escapeHtml("[%s] users")));
- translationManager.persist(new I18nTranslation(StringEscapeUtils.escapeHtml("[%d] users"), english,
- StringEscapeUtils.escapeHtml("[%d] users")));
- I18nCountry gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western",
- ",");
- countryManager.persist(gb);
- }
-
@Test
- public void testGetLexicon() {
- HashMap<String, String> map = translationManager.getLexicon("af");
- assertTrue(map.size() > 0);
- }
-
- @Test
- public void getTranslation() {
- String translation = translationManager.getTranslation("af", "Sunday [weekday]");
- assertEquals("Sondag", translation);
- }
-
- @Test
- public void getTranslationUTF8() {
- String translation = translationManager.getTranslation("el", "January [month]");
- assertEquals("Ιανουάριος", translation);
- }
-
- @Test
- public void setTranslation() {
- translationManager.setTranslation("en", "Foo foo foo", "Foo foo foo translation");
- String translation = translationManager.getTranslation("en", "Foo foo foo");
- assertEquals("Foo foo foo translation", translation);
- }
-
- @Test
public void byDefaultUseEnglish() {
HashMap<String, String> map = translationManager.getLexicon("en");
HashMap<String, String> map2 = translationManager.getLexicon("af");
assertEquals(map.size(), map2.size());
}
- @Test
- public void getNonExistentTranslationReturnsDefaultLanguage() {
- String translation = translationManager.getTranslation("af", "January [month]");
- assertEquals("January", translation);
+ @After
+ public void close() {
+ if (getTransaction().isActive()) {
+ getTransaction().rollback();
+ }
}
@Test
@@ -112,12 +64,24 @@
}
@Test
- public void getTranslationWithStringArg() {
- String translation = translationManager.getTranslation("en", "[%s] users", "Twenty");
- assertEquals("Twenty users", translation);
+ public void getNonExistentTranslationReturnsDefaultLanguage() {
+ String translation = translationManager.getTranslation("af", "January [month]");
+ assertEquals("January", translation);
}
@Test
+ public void getTranslation() {
+ String translation = translationManager.getTranslation("af", "Sunday [weekday]");
+ assertEquals("Sondag", translation);
+ }
+
+ @Test
+ public void getTranslationUTF8() {
+ String translation = translationManager.getTranslation("el", "January [month]");
+ assertEquals("Ιανουάριος", translation);
+ }
+
+ @Test
public void getTranslationWithIntArg() {
String translation = translationManager.getTranslation("en", "[%d] users", 20);
assertEquals("20 users", translation);
@@ -130,15 +94,21 @@
}
@Test
- public void getTranslationWithStringArgFromService() {
- String translation = translationService.t("[%s] users", "Twenty");
+ public void getTranslationWithIntArgFromWithNtService() {
+ String translation = translationService.tWithNT("[%d] users", "foo foo", 20);
+ assertEquals("20 users", translation);
+ }
+
+ @Test
+ public void getTranslationWithStringArg() {
+ String translation = translationManager.getTranslation("en", "[%s] users", "Twenty");
assertEquals("Twenty users", translation);
}
@Test
- public void getTranslationWithIntArgFromWithNtService() {
- String translation = translationService.tWithNT("[%d] users", "foo foo", 20);
- assertEquals("20 users", translation);
+ public void getTranslationWithStringArgFromService() {
+ String translation = translationService.t("[%s] users", "Twenty");
+ assertEquals("Twenty users", translation);
}
@Test
@@ -147,10 +117,40 @@
assertEquals("Twenty users", translation);
}
- @After
- public void close() {
- if (getTransaction().isActive()) {
- getTransaction().rollback();
- }
+ @Before
+ public void insertData() {
+ openTransaction();
+ I18nLanguage english = new I18nLanguage(Long.valueOf(1819), "English", "English", "en");
+ I18nLanguage spanish = new I18nLanguage(Long.valueOf(5889), "Spanish", "Español", "es");
+ I18nLanguage afrikaans = new I18nLanguage(Long.valueOf(114), "Afrikaans", "Afrikaans", "af");
+ I18nLanguage greek = new I18nLanguage(Long.valueOf(1793), "Greek", "Ελληνικά", "el");
+ languageManager.persist(english);
+ languageManager.persist(spanish);
+ languageManager.persist(afrikaans);
+ languageManager.persist(greek);
+ translationManager.persist(new I18nTranslation("Sunday [weekday]", english, "Sunday"));
+ translationManager.persist(new I18nTranslation("January [month]", english, "January"));
+ translationManager.persist(new I18nTranslation("Sunday [weekday]", afrikaans, "Sondag"));
+ translationManager.persist(new I18nTranslation("January [month]", greek, "Ιανουάριος"));
+ translationManager.persist(new I18nTranslation(StringEscapeUtils.escapeHtml("[%s] users"), english,
+ StringEscapeUtils.escapeHtml("[%s] users")));
+ translationManager.persist(new I18nTranslation(StringEscapeUtils.escapeHtml("[%d] users"), english,
+ StringEscapeUtils.escapeHtml("[%d] users")));
+ I18nCountry gb = new I18nCountry(Long.valueOf(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom",
+ "western", ",");
+ countryManager.persist(gb);
}
+
+ @Test
+ public void setTranslation() {
+ translationManager.setTranslation("en", "Foo foo foo", "Foo foo foo translation");
+ String translation = translationManager.getTranslation("en", "Foo foo foo");
+ assertEquals("Foo foo foo translation", translation);
+ }
+
+ @Test
+ public void testGetLexicon() {
+ HashMap<String, String> map = translationManager.getLexicon("af");
+ assertTrue(map.size() > 0);
+ }
}
1
0
r1111 - in trunk/src/main/java/org/ourproject/kune/platf/client: actions actions/ui services
by vjrj 13 May '09
by vjrj 13 May '09
13 May '09
Author: vjrj
Date: 2009-05-13 16:29:29 +0200 (Wed, 13 May 2009)
New Revision: 1111
Modified:
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEvent.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButton.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
Log:
Incomplete - task New Action class (adapted from Swing) to replace ActionDescription
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEvent.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEvent.java 2009-05-13 13:53:01 UTC (rev 1110)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEvent.java 2009-05-13 14:29:29 UTC (rev 1111)
@@ -37,7 +37,7 @@
package org.ourproject.kune.platf.client.actions;
-import com.google.gwt.user.client.ui.KeyboardListener;
+import com.google.gwt.user.client.Event;
/**
* This event is generated when an action on a component (such as a button
@@ -51,143 +51,19 @@
*/
public class ActionEvent {
- /** Bit mask indicating the shift key was pressed. */
- public static final int SHIFT_MASK = KeyboardListener.MODIFIER_SHIFT;
+ private final Event event;
+ private final Object source;
- /** Bit mask indicating the control key was pressed. */
- public static final int CTRL_MASK = KeyboardListener.MODIFIER_CTRL;
-
- /** Bit mask indicating the that meta key was pressed. */
- public static final int META_MASK = KeyboardListener.MODIFIER_META;
-
- /** Bit mask indicating that the alt key was pressed. */
- public static final int ALT_MASK = KeyboardListener.MODIFIER_ALT;
-
- /** The first id number in the range of action id's. */
- public static final int ACTION_FIRST = 1001;
-
- /** The last id number in the range of action id's. */
- public static final int ACTION_LAST = 1001;
-
- /** An event id indicating that an action has occurred. */
- public static final int ACTION_PERFORMED = 1001;
-
- /**
- * A nonlocalized string that gives more specific details of the event
- * cause.
- *
- * @see #getActionCommand()
- * @serial the command for this event
- */
- private final String actionCommand;
-
- /**
- * The bitmask of the modifiers that were pressed during the action.
- *
- * @see #getModifiers()
- * @serial modifiers for this event
- */
- private final int modifiers;
-
- /**
- * The timestamp of this event; usually the same as the underlying input
- * event.
- *
- * @see #getWhen()
- * @serial the timestamp of the event
- * @since 1.4
- */
- private final long when;
-
- private final int id;
-
- /**
- * Initializes a new instance of <code>ActionEvent</code> with the specified
- * source, id, command, and modifiers, and timestamp. Note that an invalid
- * id leads to unspecified results.
- *
- * @param source
- * the event source
- * @param id
- * the event id
- * @param command
- * the command string for this action
- * @param when
- * the timestamp of the event
- * @param modifiers
- * the bitwise or of modifier keys down during the action
- * @throws IllegalArgumentException
- * if source is null
- * @since 1.4
- */
- public ActionEvent(final Object source, final int id, final String command, final long when, final int modifiers) {
- super();
- this.id = id;
- actionCommand = command;
- this.when = when;
- this.modifiers = modifiers;
+ public ActionEvent(final Object source, final Event event) {
+ this.source = source;
+ this.event = event;
}
- /**
- * Returns the command string associated with this action.
- *
- * @return the command string associated with this action
- */
- public String getActionCommand() {
- return actionCommand;
+ public Event getEvent() {
+ return event;
}
- /**
- * Returns the keys held down during the action. This value will be a
- * combination of the bit mask constants defined in this class, or 0 if no
- * modifiers were pressed.
- *
- * @return the modifier bits
- */
- public int getModifiers() {
- return modifiers;
+ public Object getSource() {
+ return source;
}
-
- /**
- * Gets the timestamp of when this action took place. Usually, this
- * corresponds to the timestamp of the underlying InputEvent.
- *
- * @return the timestamp of this action
- * @since 1.4
- */
- public long getWhen() {
- return when;
- }
-
- /**
- * Returns a string that identifies the action event. This is in the format
- * <code>"ACTION_PERFORMED,cmd=" + getActionCommand() + ",when=" + getWhen()
- * + ",modifiers=" + <modifier string></code>, where the modifier
- * string is in the order "Meta", "Ctrl", "Alt", "Shift", "Alt Graph", and
- * "Button1", separated by '+', according to the bits set in getModifiers().
- *
- * @return a string identifying the event
- */
- public String paramString() {
- String s = new String(id == ACTION_PERFORMED ? "ACTION_PERFORMED,cmd=" : "unknown type,cmd=");
- s = s + actionCommand + ",when=" + when + ",modifiers";
- if ((modifiers & META_MASK) != 0) {
- s += "+Meta";
- }
- if ((modifiers & CTRL_MASK) != 0) {
- s += "+Ctrl";
- }
- if ((modifiers & ALT_MASK) != 0) {
- s += "+Alt";
- }
- if ((modifiers & SHIFT_MASK) != 0) {
- s += "+Shift";
- }
- // if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0)
- // s+="+Alt Graph");
- // if ((modifiers & InputEvent.BUTTON1_MASK) != 0)
- // s+="+Button1");
- // s.setCharAt(len, '=');
- return s;
- }
-} // class ActionEvent
+}
Modified: 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-13 13:53:01 UTC (rev 1110)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButton.java 2009-05-13 14:29:29 UTC (rev 1111)
@@ -1,13 +1,16 @@
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.PropertyChangeEvent;
import org.ourproject.kune.platf.client.actions.PropertyChangeListener;
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.Composite;
+import com.gwtext.client.core.EventObject;
import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
public abstract class AbstractButton extends Composite {
@@ -22,6 +25,14 @@
public AbstractButton() {
button = new Button();
initWidget(button);
+ button.addListener(new ButtonListenerAdapter() {
+ @Override
+ public void onClick(final Button button, final EventObject e) {
+ if (action != null) {
+ action.actionPerformed(new ActionEvent(button, e.getBrowserEvent()));
+ }
+ }
+ });
}
public void setAction(final Action a) {
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-13 13:53:01 UTC (rev 1110)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java 2009-05-13 14:29:29 UTC (rev 1111)
@@ -15,7 +15,10 @@
super.putValue(Action.SHORT_DESCRIPTION, "test button");
}
- public void actionPerformed(final ActionEvent event) {
+ public void actionPerformed(final ActionEvent actionEvent) {
+ if (actionEvent.getEvent().getCtrlKey()) {
+ NotifyUser.info("Button clicked with ctrl button");
+ }
NotifyUser.info("Button clicked");
}
}
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-13 13:53:01 UTC (rev 1110)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java 2009-05-13 14:29:29 UTC (rev 1111)
@@ -533,6 +533,8 @@
}
});
+ //$(TestButton.class);
+
$(ApplicationComponentGroup.class).createAll();
$(ToolGroup.class).createAll();
$(Application.class).start();
1
0
Author: vjrj
Date: 2009-05-13 15:53:01 +0200 (Wed, 13 May 2009)
New Revision: 1110
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractAction.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/Action.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEvent.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionListener.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/EventListener.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/EventListenerProxy.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeEvent.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeListener.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeListenerProxy.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButton.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/TestButton.java
Modified:
trunk/COPYRIGHT
trunk/TODO
trunk/src/main/java/org/ourproject/kune/chat/server/managers/ChatException.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollection.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionItemCollection.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionCollection.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/AccessViolationException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/AlreadyGroupMemberException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/AlreadyUserMemberException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContainerNotPermittedException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContentNotFoundException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContentNotPermittedException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/DefaultException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/EmailAddressInUseException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/GroupNameInUseException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/GroupNotFoundException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/I18nNotFoundException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/LastAdminInGroupException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/NameInUseException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/NameNotPermittedException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/NoDefaultContentException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/SessionExpiredException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/ToolNotFoundException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/UserAuthException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/UserMustBeLoggedException.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/UserNotFoundException.java
trunk/src/main/java/org/ourproject/kune/platf/client/i18n/I18nChangeListenerCollection.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/Keyboard.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItemCollection.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaRegistry.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/ChatUserParams.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoDownloadManager.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/FileDownloadManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManagerUtils.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileJsonUploadManagerAbstract.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/rack/filters/gwts/DelegatedRemoteServlet.java
Log:
Incomplete - task New Action class (adapted from Classpath Swing classes) to replace ActionDescription
Modified: trunk/COPYRIGHT
===================================================================
--- trunk/COPYRIGHT 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/COPYRIGHT 2009-05-13 13:53:01 UTC (rev 1110)
@@ -121,10 +121,15 @@
Copyright: (C) 2004 Fluendo S.L under GNU General Public License
video embed dialog:
- Some ideas and embeded video code from:
- http://www.jovelstefan.de/embedded-video/ (GPL)
- http://www.daburna.de/blog/2006/12/13/wordpress-video-plugin/
+ Some ideas and embeded video code from:
+ http://www.jovelstefan.de/embedded-video/ (GPL)
+ http://www.daburna.de/blog/2006/12/13/wordpress-video-plugin/
some license description:
- from Wikipedia
- Copyright: under GFDL http://www.gnu.org/copyleft/fdl.html
+ from Wikipedia
+ Copyright: under GFDL http://www.gnu.org/copyleft/fdl.html
+
+some Action classes:
+ from GNU Classpath
+ Copyright: under GNU General Public License
+ http://www.gnu.org/licenses/gpl.html
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/TODO 2009-05-13 13:53:01 UTC (rev 1110)
@@ -152,6 +152,8 @@
I am talking about, but I'm sure there is something to do.
** vjrj <v> Login: Follow incubation recomendations. See:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/e8e1…
+ Also autocomplete user/passwordi (for browser store):
+ http://groups.google.fr/group/Google-Web-Toolkit/browse_thread/thread/2b2ce…
** vjrj <v> kune debian package:
Study fat jar + deb package:
http://anydoby.com/fatjar/
Modified: trunk/src/main/java/org/ourproject/kune/chat/server/managers/ChatException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/server/managers/ChatException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/chat/server/managers/ChatException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -23,13 +23,13 @@
public class ChatException extends RuntimeException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 3777046831841032482L;
+ public ChatException() {
+ super("");
+ }
+
public ChatException(final XMPPException cause) {
super(cause);
}
-
- public ChatException() {
- super("");
- }
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractAction.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractAction.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,252 @@
+/* AbstractAction.java --
+ Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.ourproject.kune.platf.client.actions;
+
+import java.util.HashMap;
+
+import com.google.gwt.libideas.resources.client.ImageResource;
+
+/**
+ * A base class for implementing the {@link Action} interface.
+ *
+ * @author Andrew Selkirk
+ * @author Adapted version for GWT (C) The kune development team
+ */
+public abstract class AbstractAction implements Action {
+
+ /**
+ * A flag that indicates whether or not the action is enabled.
+ */
+ protected boolean enabled = true;
+
+ /**
+ * Provides support for property change event notification.
+ */
+ protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
+
+ /**
+ * store
+ */
+ private final HashMap<String, Object> store = new HashMap<String, Object>();
+
+ /**
+ * Creates a new action with no properties set.
+ */
+ public AbstractAction() {
+ // Nothing to do.
+ }
+
+ /**
+ * Creates a new action with the specified name. The name is stored as a
+ * property with the key {@link Action#NAME}, and no other properties are
+ * initialised.
+ *
+ * @param name
+ * the name (<code>null</code> permitted).
+ */
+ public AbstractAction(final String name) {
+ putValue(NAME, name);
+ }
+
+ /**
+ * Creates a new action with the specified name and icon. The name is stored
+ * as a property with the key {@link Action#NAME}, the icon is stored as a
+ * property with the key {@link Action#SMALL_ICON}, and no other properties
+ * are initialised.
+ *
+ * @param name
+ * the name (<code>null</code> permitted).
+ * @param icon
+ * the icon (<code>null</code> permitted).
+ */
+ public AbstractAction(final String name, final ImageResource icon) {
+ putValue(NAME, name);
+ putValue(SMALL_ICON, icon);
+ }
+
+ /**
+ * Registers a listener to receive {@link PropertyChangeEvent} notifications
+ * from this action.
+ *
+ * @param listener
+ * the listener.
+ *
+ * @see #removePropertyChangeListener(PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(final PropertyChangeListener listener) {
+ changeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Returns an array of the keys for the property values that have been
+ * defined via the {@link #putValue(String, Object)} method (or the class
+ * constructor).
+ *
+ * @return An array of keys.
+ */
+ public Object[] getKeys() {
+ return store.keySet().toArray();
+ }
+
+ /**
+ * Returns all registered listeners.
+ *
+ * @return An array of listeners.
+ *
+ * @since 1.4
+ */
+ public PropertyChangeListener[] getPropertyChangeListeners() {
+ return changeSupport.getPropertyChangeListeners();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Returns the flag that indicates whether or not the action is enabled.
+ *
+ * @return The flag.
+ *
+ * @see #setEnabled(boolean)
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * Sets the value associated with the specified key and sends a
+ * {@link java.beans.PropertyChangeEvent} to all registered listeners. The
+ * standard keys are:
+ * <ul>
+ * <li>{@link #NAME}</li>
+ * <li>{@link #SHORT_DESCRIPTION}</li>
+ * <li>{@link #LONG_DESCRIPTION}</li>
+ * <li>{@link #SMALL_ICON}</li>
+ * <li>{@link #ACTION_COMMAND_KEY}</li>
+ * <li>{@link #ACCELERATOR_KEY}</li>
+ * <li>{@link #MNEMONIC_KEY}</li>
+ * </ul>
+ * 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) {
+ Object old = getValue(key);
+ if ((old == null && value != null) || (old != null && !old.equals(value))) {
+ store.put(key, value);
+ firePropertyChange(key, old, value);
+ }
+ }
+
+ /**
+ * Deregisters a listener so that it no longer receives
+ * {@link PropertyChangeEvent} notifications from this action.
+ *
+ * @param listener
+ * the listener.
+ *
+ * @see #addPropertyChangeListener(PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(final PropertyChangeListener listener) {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Sets the flag that indicates whether or not the action is enabled and, if
+ * the value of the flag changed from the previous setting, sends a
+ * {@link java.beans.PropertyChangeEvent} to all registered listeners (using
+ * the property name 'enabled').
+ *
+ * @param enabled
+ * the new flag value.
+ *
+ * @see #isEnabled()
+ */
+ public void setEnabled(final boolean enabled) {
+ if (enabled != this.enabled) {
+ this.enabled = enabled;
+ firePropertyChange(ENABLED, !this.enabled, this.enabled);
+ }
+ }
+
+ /**
+ * Sends a {@link PropertyChangeEvent} for the named property to all
+ * registered listeners.
+ *
+ * @param propertyName
+ * the property name.
+ * @param oldValue
+ * the old value of the property.
+ * @param newValue
+ * the new value of the property.
+ */
+ protected void firePropertyChange(final String propertyName, final Object oldValue, final Object newValue) {
+ changeSupport.firePropertyChange(propertyName, oldValue, newValue);
+ }
+
+ /**
+ * Sends a {@link PropertyChangeEvent} for the named property to all
+ * registered listeners. This private method is called by the
+ * {@link #setEnabled(boolean)} method.
+ *
+ * @param propertyName
+ * the property name.
+ * @param oldValue
+ * the old value of the property.
+ * @param newValue
+ * the new value of the property.
+ */
+ private void firePropertyChange(final String propertyName, final boolean oldValue, final boolean newValue) {
+ changeSupport.firePropertyChange(propertyName, oldValue, newValue);
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/Action.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/Action.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/Action.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,159 @@
+/* Action.java --
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.ourproject.kune.platf.client.actions;
+
+/**
+ * Provides a convenient central point of control for some task that can be
+ * triggered by more than one control in a Swing user interface (for example, a
+ * menu item and a toolbar button).
+ *
+ * @author Ronald Veldema (rveldema(a)cs.vu.nl)
+ * @author Adapted version for GWT (C) The kune development team
+ * @author Andrew Selkirk
+ */
+public interface Action extends ActionListener {
+
+ /**
+ * A key to access the default property for the action (this is not used).
+ */
+ String DEFAULT = "Default";
+
+ /**
+ * A key to access the long description for the action.
+ */
+ String LONG_DESCRIPTION = "LongDescription";
+
+ /**
+ * A key to access the name for the action.
+ */
+ String NAME = "Name";
+
+ /**
+ * A key to access the enabled property for the action.
+ */
+ String ENABLED = "enabled";
+
+ /**
+ * A key to access the short description for the action (the short
+ * description is typically used as the tool tip text).
+ */
+ String SHORT_DESCRIPTION = "ShortDescription";
+
+ /**
+ * A key to access the icon for the action.
+ */
+ String SMALL_ICON = "SmallIcon";
+
+ /**
+ * A key to access the KeyStroke used as the accelerator for the action.
+ */
+ String ACCELERATOR_KEY = "AcceleratorKey";
+
+ /**
+ * A key to access the action command string for the action.
+ */
+ String ACTION_COMMAND_KEY = "ActionCommandKey";
+
+ /**
+ * A key to access the mnemonic for the action.
+ */
+ String MNEMONIC_KEY = "MnemonicKey";
+
+ /**
+ * Registers a listener to receive notification whenever one of the action's
+ * properties is modified.
+ *
+ * @param listener
+ * the listener.
+ */
+ void addPropertyChangeListener(PropertyChangeListener listener);
+
+ /**
+ * 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.
+ */
+ Object getValue(String key);
+
+ /**
+ * Returns the flag that indicates whether or not this action is enabled.
+ *
+ * @return The flag.
+ */
+ boolean isEnabled();
+
+ /**
+ * Sets the value associated with the specified key and sends a
+ * {@link PropertyChangeEvent} to all registered listeners. The standard
+ * keys are defined in this interface: {@link #NAME},
+ * {@link #SHORT_DESCRIPTION}, {@link #LONG_DESCRIPTION},
+ * {@link #SMALL_ICON}, {@link #ACTION_COMMAND_KEY},
+ * {@link #ACCELERATOR_KEY} and {@link #MNEMONIC_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).
+ */
+ void putValue(String key, Object value);
+
+ /**
+ * Deregisters a listener so that it no longer receives notification of
+ * changes to the action's properties.
+ *
+ * @param listener
+ * the listener.
+ */
+ void removePropertyChangeListener(PropertyChangeListener listener);
+
+ /**
+ * Sets the flag that indicates whether or not this action is enabled. If
+ * the value changes, a {@link java.beans.PropertyChangeEvent} is sent to
+ * all registered listeners.
+ *
+ * @param b
+ * the new value of the flag.
+ */
+ void setEnabled(boolean b);
+
+} // Action
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollection.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollection.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollection.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -23,6 +23,6 @@
public class ActionCollection<T> extends ArrayList<ActionDescriptor<T>> {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -3308296009308246636L;
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEvent.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEvent.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEvent.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,193 @@
+/* ActionEvent.java -- an action has been triggered
+ Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.ourproject.kune.platf.client.actions;
+
+import com.google.gwt.user.client.ui.KeyboardListener;
+
+/**
+ * This event is generated when an action on a component (such as a button
+ * press) occurs.
+ *
+ * @author Aaron M. Renn (arenn(a)urbanophile.com)
+ * @author Adapted version for GWT (C) The kune development team
+ * @see ActionListener
+ * @since 1.1
+ * @status updated to 1.4
+ */
+public class ActionEvent {
+
+ /** Bit mask indicating the shift key was pressed. */
+ public static final int SHIFT_MASK = KeyboardListener.MODIFIER_SHIFT;
+
+ /** Bit mask indicating the control key was pressed. */
+ public static final int CTRL_MASK = KeyboardListener.MODIFIER_CTRL;
+
+ /** Bit mask indicating the that meta key was pressed. */
+ public static final int META_MASK = KeyboardListener.MODIFIER_META;
+
+ /** Bit mask indicating that the alt key was pressed. */
+ public static final int ALT_MASK = KeyboardListener.MODIFIER_ALT;
+
+ /** The first id number in the range of action id's. */
+ public static final int ACTION_FIRST = 1001;
+
+ /** The last id number in the range of action id's. */
+ public static final int ACTION_LAST = 1001;
+
+ /** An event id indicating that an action has occurred. */
+ public static final int ACTION_PERFORMED = 1001;
+
+ /**
+ * A nonlocalized string that gives more specific details of the event
+ * cause.
+ *
+ * @see #getActionCommand()
+ * @serial the command for this event
+ */
+ private final String actionCommand;
+
+ /**
+ * The bitmask of the modifiers that were pressed during the action.
+ *
+ * @see #getModifiers()
+ * @serial modifiers for this event
+ */
+ private final int modifiers;
+
+ /**
+ * The timestamp of this event; usually the same as the underlying input
+ * event.
+ *
+ * @see #getWhen()
+ * @serial the timestamp of the event
+ * @since 1.4
+ */
+ private final long when;
+
+ private final int id;
+
+ /**
+ * Initializes a new instance of <code>ActionEvent</code> with the specified
+ * source, id, command, and modifiers, and timestamp. Note that an invalid
+ * id leads to unspecified results.
+ *
+ * @param source
+ * the event source
+ * @param id
+ * the event id
+ * @param command
+ * the command string for this action
+ * @param when
+ * the timestamp of the event
+ * @param modifiers
+ * the bitwise or of modifier keys down during the action
+ * @throws IllegalArgumentException
+ * if source is null
+ * @since 1.4
+ */
+ public ActionEvent(final Object source, final int id, final String command, final long when, final int modifiers) {
+ super();
+ this.id = id;
+ actionCommand = command;
+ this.when = when;
+ this.modifiers = modifiers;
+ }
+
+ /**
+ * Returns the command string associated with this action.
+ *
+ * @return the command string associated with this action
+ */
+ public String getActionCommand() {
+ return actionCommand;
+ }
+
+ /**
+ * Returns the keys held down during the action. This value will be a
+ * combination of the bit mask constants defined in this class, or 0 if no
+ * modifiers were pressed.
+ *
+ * @return the modifier bits
+ */
+ public int getModifiers() {
+ return modifiers;
+ }
+
+ /**
+ * Gets the timestamp of when this action took place. Usually, this
+ * corresponds to the timestamp of the underlying InputEvent.
+ *
+ * @return the timestamp of this action
+ * @since 1.4
+ */
+ public long getWhen() {
+ return when;
+ }
+
+ /**
+ * Returns a string that identifies the action event. This is in the format
+ * <code>"ACTION_PERFORMED,cmd=" + getActionCommand() + ",when=" + getWhen()
+ * + ",modifiers=" + <modifier string></code>, where the modifier
+ * string is in the order "Meta", "Ctrl", "Alt", "Shift", "Alt Graph", and
+ * "Button1", separated by '+', according to the bits set in getModifiers().
+ *
+ * @return a string identifying the event
+ */
+ public String paramString() {
+ String s = new String(id == ACTION_PERFORMED ? "ACTION_PERFORMED,cmd=" : "unknown type,cmd=");
+ s = s + actionCommand + ",when=" + when + ",modifiers";
+ if ((modifiers & META_MASK) != 0) {
+ s += "+Meta";
+ }
+ if ((modifiers & CTRL_MASK) != 0) {
+ s += "+Ctrl";
+ }
+ if ((modifiers & ALT_MASK) != 0) {
+ s += "+Alt";
+ }
+ if ((modifiers & SHIFT_MASK) != 0) {
+ s += "+Shift";
+ }
+ // if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0)
+ // s+="+Alt Graph");
+ // if ((modifiers & InputEvent.BUTTON1_MASK) != 0)
+ // s+="+Button1");
+ // s.setCharAt(len, '=');
+ return s;
+ }
+} // class ActionEvent
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionItemCollection.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionItemCollection.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionItemCollection.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -26,10 +26,10 @@
public class ActionItemCollection<T> extends ArrayList<ActionItem<T>> {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1127359948648860754L;
@Override
- public boolean add(ActionItem<T> actionItem) {
+ public boolean add(final ActionItem<T> actionItem) {
ActionDescriptor<T> action = actionItem.getAction();
int position = action.getPosition();
if (position == ActionDescriptor.NO_POSITION) {
@@ -47,7 +47,7 @@
}
@Override
- public boolean addAll(Collection<? extends ActionItem<T>> actionItems) {
+ public boolean addAll(final Collection<? extends ActionItem<T>> actionItems) {
for (ActionItem<T> actionItem : actionItems) {
add(actionItem);
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionListener.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionListener.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionListener.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,57 @@
+/* ActionListener.java -- listens for action events
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.ourproject.kune.platf.client.actions;
+
+/**
+ * This interface is for classes that listen for action events.
+ *
+ * @author Aaron M. Renn (arenn(a)urbanophile.com)
+ * @author Adapted version for GWT (C) The kune development team
+ * @see ActionEvent
+ * @since 1.1
+ * @status updated to 1.4
+ */
+public interface ActionListener extends EventListener {
+ /**
+ * This method is invoked when an action occurs.
+ *
+ * @param event
+ * the <code>ActionEvent</code> that occurred
+ */
+ void actionPerformed(ActionEvent event);
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,192 @@
+/* ActionMap.java --
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.ourproject.kune.platf.client.actions;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Maps arbitrary keys (usually Strings) to {@link Action} instances. This is
+ * used in combination with {@link InputMap}s.
+ *
+ * If a component receives an input event, this is looked up in the component's
+ * <code>InputMap</code>. The result is an object which serves as a key to the
+ * components <code>ActionMap</code>. Finally the <code>Action</code> that is
+ * stored is executed.
+ *
+ * @author Andrew Selkirk
+ * @author Adapted version for GWT (C) The kune development team
+ * @author Michael Koch
+ */
+public class ActionMap {
+
+ /**
+ * actionMap
+ */
+ private final Map<Object, Action> actionMap = new HashMap<Object, Action>();
+
+ /**
+ * parent
+ */
+ private ActionMap parent;
+
+ /**
+ * Creates a new <code>ActionMap</code> instance.
+ */
+ public ActionMap() {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns all keys of entries in this <code>ActionMap</code> and all its
+ * parents.
+ *
+ * @return an array of keys
+ */
+ public Object[] allKeys() {
+ Set<Object> set = new HashSet<Object>();
+
+ if (parent != null) {
+ set.addAll(Arrays.asList(parent.allKeys()));
+ }
+
+ set.addAll(actionMap.keySet());
+ if (set.size() != 0) {
+ return set.toArray();
+ }
+ return null;
+ }
+
+ /**
+ * Clears the <code>ActionMap</code>.
+ */
+ public void clear() {
+ actionMap.clear();
+ }
+
+ /**
+ * Returns an action associated with an object.
+ *
+ * @param key
+ * the key of the enty
+ *
+ * @return the action associated with key, may be null
+ */
+ public Action get(final Object key) {
+ Object result = actionMap.get(key);
+
+ if (result == null && parent != null) {
+ result = parent.get(key);
+ }
+
+ return (Action) result;
+ }
+
+ /**
+ * Returns the parent of this <code>ActionMap</code>.
+ *
+ * @return the parent, may be null.
+ */
+ public ActionMap getParent() {
+ return parent;
+ }
+
+ /**
+ * Returns all keys of entries in this <code>ActionMap</code>.
+ *
+ * @return an array of keys
+ */
+ public Object[] keys() {
+ if (size() != 0) {
+ return actionMap.keySet().toArray();
+ }
+ return null;
+ }
+
+ /**
+ * Puts a new <code>Action</code> into the <code>ActionMap</code>. If action
+ * is null an existing entry will be removed.
+ *
+ * @param key
+ * the key for the entry
+ * @param action
+ * the action.
+ */
+ public void put(final Object key, final Action action) {
+ if (action == null) {
+ actionMap.remove(key);
+ } else {
+ actionMap.put(key, action);
+ }
+ }
+
+ /**
+ * Remove an entry from the <code>ActionMap</code>.
+ *
+ * @param key
+ * the key of the entry to remove
+ */
+ public void remove(final Object key) {
+ actionMap.remove(key);
+ }
+
+ /**
+ * Sets a parent for this <code>ActionMap</code>.
+ *
+ * @param parentMap
+ * the new parent
+ */
+ public void setParent(final ActionMap parentMap) {
+ if (parentMap != this) {
+ parent = parentMap;
+ }
+ }
+
+ /**
+ * Returns the number of entries in this <code>ActionMap</code>.
+ *
+ * @return the number of entries
+ */
+ public int size() {
+ return actionMap.size();
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionCollection.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionCollection.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionCollection.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -26,7 +26,7 @@
*/
public class BeforeActionCollection extends ArrayList<BeforeActionListener> {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -1508664709628420137L;
/**
* Check before action listeners.
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/EventListener.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/EventListener.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/EventListener.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,53 @@
+/* EventListener.java -- tagging interface for all event listeners
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.ourproject.kune.platf.client.actions;
+
+/**
+ * Empty interface that is implemented by classes that need to receive events.
+ * Subinterfaces define methods that can be called to fire an event
+ * notification. Normally the name of these subinterfaces end in
+ * <code>Listener</code> and all method described by the subinterface take as
+ * argument an subclass of <code>EventObject</code>.
+ *
+ * @author Tom Tromey (tromey(a)cygnus.com)
+ * @author Adapted version for GWT (C) The kune development team
+ * @see EventObject
+ * @status updated to 1.4
+ */
+public interface EventListener {
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/EventListenerProxy.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/EventListenerProxy.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/EventListenerProxy.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,74 @@
+/* EventListenerProxy.java -- abstract wrapper for event listeners
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.ourproject.kune.platf.client.actions;
+
+/**
+ * An abstract wrapper for event listeners. This allows subclasses to attach
+ * additional parameters to an existing event listener to create a new one.
+ * Subclasses are expected to add methods to set and retrieve any attached
+ * properties.
+ *
+ * @author Eric Blake (ebb9(a)email.byu.edu)
+ * @author Adapted version for GWT (C) The kune development team
+ *
+ * @since 1.4
+ * @status updated to 1.4
+ */
+public abstract class EventListenerProxy implements EventListener {
+ /** The listener that this proxy wraps. */
+ private final EventListener listener;
+
+ /**
+ * Construct a proxy event listener, given an existing one to augment.
+ *
+ * @param listener
+ * the listener to wrap
+ */
+ public EventListenerProxy(final EventListener listener) {
+ this.listener = listener;
+ }
+
+ /**
+ * Return the wrapped event listener.
+ *
+ * @return the listener associated with this proxy
+ */
+ public EventListener getListener() {
+ return listener;
+ }
+} // class EventListenerProxy
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,234 @@
+/* InputMap.java --
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.ourproject.kune.platf.client.actions;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Maps {@link KeyStroke}s to arbitrary objects, usually Strings. This is used
+ * in combination with {@link ActionMap}s.
+ *
+ * If a component receives an input event, this is looked up in the component's
+ * <code>InputMap</code>. The result is an object which serves as a key to the
+ * component's <code>ActionMap</code>. Finally the <code>Action</code> that is
+ * stored is executed.
+ *
+ * @author Andrew Selkirk
+ * @author Michael Koch
+ * @author Adapted version for GWT (C) The kune development team
+ *
+ * @since 1.3
+ */
+public class InputMap {
+
+ /**
+ * Storage for the KeyStroke --> Object mappings.
+ */
+ private Map<KeyStroke, Action> inputMap;
+
+ /**
+ * An optional parent map.
+ */
+ private InputMap parent;
+
+ /**
+ * Creates a new <code>InputMap</code> instance. This default instance
+ * contains no mappings and has no parent.
+ */
+ public InputMap() {
+ // nothing to do
+ }
+
+ /**
+ * Returns all keys of entries in this <code>InputMap</code> and all its
+ * parents.
+ *
+ * @return An array of keys (may be <code>null</code> or have zero length).
+ */
+ public KeyStroke[] allKeys() {
+ Set<KeyStroke> set = new HashSet<KeyStroke>();
+
+ if (parent != null) {
+ KeyStroke[] parentKeys = parent.allKeys();
+ if (parentKeys != null) {
+ set.addAll(Arrays.asList(parentKeys));
+ }
+ }
+ if (inputMap != null) {
+ set.addAll(inputMap.keySet());
+ }
+ if (set.size() == 0) {
+ return null;
+ }
+ KeyStroke[] array = new KeyStroke[set.size()];
+ return set.toArray(array);
+ }
+
+ /**
+ * Clears the entries from this <code>InputMap</code>. The parent map, if
+ * there is one, is not cleared.
+ */
+ public void clear() {
+ if (inputMap != null) {
+ inputMap.clear();
+ }
+ }
+
+ /**
+ * Returns the binding for the specified keystroke, if there is one.
+ *
+ * @param keystroke
+ * the key of the entry (<code>null</code> is ignored).
+ *
+ * @return The binding associated with the specified keystroke (or
+ * <code>null</code>).
+ */
+ public Object get(final KeyStroke keystroke) {
+ Object result = null;
+ if (inputMap != null) {
+ result = inputMap.get(keystroke);
+ }
+
+ if (result == null && parent != null) {
+ result = parent.get(keystroke);
+ }
+ return result;
+ }
+
+ /**
+ * Returns the parent of this <code>InputMap</code>. The default value is
+ * <code>null</code>.
+ *
+ * @return The parent map (possibly <code>null</code>).
+ *
+ * @see #setParent(InputMap)
+ */
+ public InputMap getParent() {
+ return parent;
+ }
+
+ /**
+ * Returns all keys of entries in this <code>InputMap</code>. This does not
+ * include keys defined in the parent, if there is one (use the
+ * {@link #allKeys()} method for that case). <br>
+ * <br>
+ * Following the behaviour of the reference implementation, this method will
+ * return <code>null</code> when no entries have been added to the map, and
+ * a zero length array if entries have been added but subsequently removed
+ * (or cleared) from the map.
+ *
+ * @return An array of keys (may be <code>null</code> or have zero length).
+ */
+ public KeyStroke[] keys() {
+ if (inputMap != null) {
+ KeyStroke[] array = new KeyStroke[size()];
+ return inputMap.keySet().toArray(array);
+ }
+ return null;
+ }
+
+ /**
+ * Puts a new entry into the <code>InputMap</code>. If
+ * <code>actionMapKey</code> is <code>null</code> any existing entry will be
+ * removed.
+ *
+ * @param keystroke
+ * the keystroke for the entry (<code>null</code> is ignored).
+ * @param actionMapKey
+ * the action (<code>null</code> permitted).
+ */
+ public void put(final KeyStroke keystroke, final Action actionMapKey) {
+ if (keystroke == null) {
+ return;
+ }
+ if (inputMap == null) {
+ inputMap = new HashMap<KeyStroke, Action>();
+ }
+ if (actionMapKey == null) {
+ inputMap.remove(keystroke);
+ } else {
+ inputMap.put(keystroke, actionMapKey);
+ }
+ }
+
+ /**
+ * Removes an entry from this <code>InputMap</code>. Note that this will not
+ * remove any entry from the parent map, if there is one.
+ *
+ * @param keystroke
+ * the key of the entry to remove (<code>null</code> is ignored).
+ */
+ public void remove(final KeyStroke keystroke) {
+ if (inputMap != null) {
+ inputMap.remove(keystroke);
+ }
+ }
+
+ /**
+ * Sets a parent for this <code>InputMap</code>. If a parent is specified,
+ * the {@link #get(KeyStroke)} method will look in the parent if it cannot
+ * find an entry in this map.
+ *
+ * @param parentMap
+ * the new parent (<code>null</code> permitted).
+ *
+ * @see #getParent()
+ */
+ public void setParent(final InputMap parentMap) {
+ parent = parentMap;
+ }
+
+ /**
+ * Returns the number of entries in this <code>InputMap</code>. This count
+ * does not include any entries from the parent map, if there is one.
+ *
+ * @return The number of entries.
+ */
+ public int size() {
+ int result = 0;
+ if (inputMap != null) {
+ result = inputMap.size();
+ }
+ return result;
+ }
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,518 @@
+/* AWTKeyStroke.java -- an immutable key stroke
+ Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.ourproject.kune.platf.client.actions;
+
+import java.util.HashMap;
+
+import org.ourproject.kune.platf.client.i18n.Resources;
+import org.ourproject.kune.platf.client.shortcuts.Keyboard;
+
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.KeyboardListener;
+import com.google.gwt.user.client.ui.KeyboardListenerCollection;
+
+/**
+ * This class mirrors KeyEvents, representing both low-level key presses and key
+ * releases, and high level key typed inputs. However, this class forms
+ * immutable strokes, and can be efficiently reused via the factory methods for
+ * creating them.
+ *
+ * <p>
+ * For backwards compatibility with Swing, this supports a way to build
+ * instances of a subclass, using reflection, provided the subclass has a no-arg
+ * constructor (of any accessibility).
+ *
+ * @author Eric Blake (ebb9(a)email.byu.edu)
+ * @author Andrew John Hughes (gnu_andrew(a)member.fsf.org)
+ * @author Adapted version for GWT (C) The kune development team
+ * @see #getKeyStroke(char)
+ * @since 1.4
+ * @status updated to 1.4
+ */
+public class KeyStroke {
+
+ /**
+ * The cache of recently created keystrokes. This maps KeyStrokes to
+ * KeyStrokes in a cache which removes the least recently accessed entry,
+ * under the assumption that garbage collection of a new keystroke is easy
+ * when we find the old one that it matches in the cache.
+ */
+ private static final HashMap<KeyStroke, KeyStroke> cache = new HashMap<KeyStroke, KeyStroke>();
+
+ /** The most recently generated keystroke, or null. */
+ private static KeyStroke recent;
+
+ /**
+ * A table of keyCode names to values. This is package-private to avoid an
+ * accessor method.
+ *
+ * @see #getKeyStroke(String)
+ */
+ static final HashMap<String, Object> vktable = new HashMap<String, Object>();
+
+ private static final int VK_UNDEFINED = 0;
+ private static final char CHAR_UNDEFINED = '\uffff';
+
+ /**
+ * Returns a keystroke representing a typed character.
+ *
+ * @param keyChar
+ * the typed character
+ * @return the specified keystroke
+ */
+ public static KeyStroke getKeyStroke(final char keyChar) {
+ return getKeyStroke(keyChar, VK_UNDEFINED, 0, false);
+ }
+
+ /**
+ * Returns a keystroke representing a typed character with the given
+ * modifiers. Note that keyChar is a <code>Character</code> instead of a
+ * <code>char</code> to avoid accidental ambiguity with
+ * <code>getKeyStroke(int, int)</code>. The modifiers are the bitwise or of
+ * the masks found in InputEvent; the new style (*_DOWN_MASK) is preferred,
+ * but the old style will work.
+ *
+ * @param keyChar
+ * the typed character
+ * @param modifiers
+ * the modifiers, or 0
+ * @return the specified keystroke
+ * @throws IllegalArgumentException
+ * if keyChar is null
+ */
+ public static KeyStroke getKeyStroke(final Character keyChar, final int modifiers) {
+ if (keyChar == null) {
+ throw new IllegalArgumentException();
+ }
+ return getKeyStroke(keyChar.charValue(), VK_UNDEFINED, modifiers, false);
+ }
+
+ /**
+ * Returns a keystroke representing a pressed key event, with the given
+ * modifiers. The "virtual key" should be one of the VK_* constants in
+ * {@link KeyEvent}. The modifiers are the bitwise or of the masks found in
+ * InputEvent; the new style (*_DOWN_MASK) is preferred, but the old style
+ * will work.
+ *
+ * @param keyCode
+ * the virtual key
+ * @param modifiers
+ * the modifiers, or 0
+ * @return the specified keystroke
+ */
+ public static KeyStroke getKeyStroke(final int keyCode, final int modifiers) {
+ return getKeyStroke(CHAR_UNDEFINED, keyCode, modifiers, false);
+ }
+
+ /**
+ * Returns a keystroke representing a pressed or released key event, with
+ * the given modifiers. The "virtual key" should be one of the VK_*
+ * constants in {@link KeyEvent}. The modifiers are the bitwise or of the
+ * masks found in InputEvent; the new style (*_DOWN_MASK) is preferred, but
+ * the old style will work.
+ *
+ * @param keyCode
+ * the virtual key
+ * @param modifiers
+ * the modifiers, or 0
+ * @param release
+ * true if this is a key release instead of a key press
+ * @return the specified keystroke
+ */
+ public static KeyStroke getKeyStroke(final int keyCode, final int modifiers, final boolean release) {
+ return getKeyStroke(CHAR_UNDEFINED, keyCode, modifiers, release);
+ }
+
+ /**
+ * Returns a keystroke representing what caused the key event.
+ *
+ * @param event
+ * the key event to convert
+ * @return the specified keystroke, or null if the event is invalid
+ * @throws NullPointerException
+ * if event is null
+ */
+ public static KeyStroke getKeyStrokeForEvent(final Event event) {
+ switch (DOM.eventGetType(event)) {
+ case Event.ONKEYDOWN:
+ return getKeyStroke((char) event.getKeyCode(), VK_UNDEFINED,
+ KeyboardListenerCollection.getKeyboardModifiers(event), false);
+ case Event.ONKEYPRESS:
+ return getKeyStroke(CHAR_UNDEFINED, event.getKeyCode(),
+ KeyboardListenerCollection.getKeyboardModifiers(event), false);
+ case Event.ONKEYUP:
+ return getKeyStroke(CHAR_UNDEFINED, event.getKeyCode(),
+ KeyboardListenerCollection.getKeyboardModifiers(event), true);
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Gets the appropriate keystroke, creating one if necessary.
+ *
+ * @param keyChar
+ * the keyChar
+ * @param keyCode
+ * the keyCode
+ * @param modifiers
+ * the modifiers
+ * @param release
+ * true for key release
+ * @return the specified keystroke
+ */
+ private static KeyStroke getKeyStroke(final char keyChar, final int keyCode, final int modifiers,
+ final boolean release) {
+ // Check level 0 cache.
+ KeyStroke stroke = recent; // Avoid thread races.
+ if (stroke != null && stroke.keyChar == keyChar && stroke.keyCode == keyCode && stroke.modifiers == modifiers
+ && stroke.onKeyRelease == release) {
+ return stroke;
+ }
+ stroke = new KeyStroke(keyChar, keyCode, modifiers, release);
+ // Check level 1 cache.
+ KeyStroke cached = cache.get(stroke);
+ if (cached == null) {
+ cache.put(stroke, stroke);
+ } else {
+ stroke = cached;
+ }
+ return recent = stroke;
+ }
+
+ /**
+ * The typed character, or CHAR_UNDEFINED for key presses and releases.
+ *
+ * @serial the keyChar
+ */
+ private final char keyChar;
+
+ /**
+ * The virtual key code, or VK_UNDEFINED for key typed. Package visible for
+ * use by Component.
+ *
+ * @serial the keyCode
+ */
+ int keyCode;
+
+ /**
+ * The modifiers in effect. To match Sun, this stores the old style masks
+ * for shift, control, alt, meta, and alt-graph (but not button1); as well
+ * as the new style of extended modifiers for all modifiers.
+ *
+ * @serial bitwise or of the *_DOWN_MASK modifiers
+ */
+ private int modifiers;
+
+ /**
+ * True if this is a key release; should only be true if keyChar is
+ * CHAR_UNDEFINED.
+ *
+ * @serial true to distinguish key pressed from key released
+ */
+ private boolean onKeyRelease;
+
+ /**
+ * Construct a keystroke with default values: it will be interpreted as a
+ * key typed event with an invalid character and no modifiers. Client code
+ * should use the factory methods instead.
+ *
+ * @see #getKeyStroke(char)
+ * @see #getKeyStroke(Character, int)
+ * @see #getKeyStroke(int, int, boolean)
+ * @see #getKeyStroke(int, int)
+ * @see #getKeyStrokeForEvent(KeyEvent)
+ * @see #getKeyStroke(String)
+ */
+ protected KeyStroke() {
+ keyChar = CHAR_UNDEFINED;
+ }
+
+ /**
+ * Construct a keystroke with the given values. Client code should use the
+ * factory methods instead.
+ *
+ * @param keyChar
+ * the character entered, if this is a key typed
+ * @param keyCode
+ * the key pressed or released, or VK_UNDEFINED for key typed
+ * @param modifiers
+ * the modifier keys for the keystroke, in old or new style
+ * @param onKeyRelease
+ * true if this is a key release instead of a press
+ * @see #getKeyStroke(char)
+ * @see #getKeyStroke(Character, int)
+ * @see #getKeyStroke(int, int, boolean)
+ * @see #getKeyStroke(int, int)
+ * @see #getKeyStrokeForEvent(KeyEvent)
+ * @see #getKeyStroke(String)
+ */
+ protected KeyStroke(final char keyChar, final int keyCode, final int modifiers, final boolean onKeyRelease) {
+ this.keyChar = keyChar;
+ this.keyCode = keyCode;
+ // No need to call extend(), as only trusted code calls this
+ // constructor.
+ this.modifiers = modifiers;
+ this.onKeyRelease = onKeyRelease;
+ }
+
+ /**
+ * Tests two keystrokes for equality.
+ *
+ * @param o
+ * the object to test
+ * @return true if it is equal
+ */
+ @Override
+ public final boolean equals(final Object o) {
+ if (!(o instanceof KeyStroke)) {
+ return false;
+ }
+ KeyStroke s = (KeyStroke) o;
+ return this == o
+ || (keyChar == s.keyChar && keyCode == s.keyCode && modifiers == s.modifiers && onKeyRelease == s.onKeyRelease);
+ }
+
+ /**
+ * Returns the character of this keystroke, if it was typed.
+ *
+ * @return the character value, or CHAR_UNDEFINED
+ * @see #getKeyStroke(char)
+ */
+ public final char getKeyChar() {
+ return keyChar;
+ }
+
+ /**
+ * Returns the virtual key code of this keystroke, if it was pressed or
+ * released. This will be a VK_* constant from KeyEvent.
+ *
+ * @return the virtual key code value, or VK_UNDEFINED
+ * @see #getKeyStroke(int, int)
+ */
+ public final int getKeyCode() {
+ return keyCode;
+ }
+
+ /**
+ * Returns the AWT event type of this keystroke. This is one of
+ * {@link KeyEvent#KEY_TYPED}, {@link KeyEvent#KEY_PRESSED}, or
+ * {@link KeyEvent#KEY_RELEASED}.
+ *
+ * @return the key event type
+ */
+ public final int getKeyEventType() {
+ return keyCode == VK_UNDEFINED ? Event.ONKEYDOWN : onKeyRelease ? Event.ONKEYUP : Event.ONKEYPRESS;
+ }
+
+ @SuppressWarnings("deprecation")
+ public String getKeyText(final int keyCode) {
+ switch (keyCode) {
+ case KeyboardListener.KEY_BACKSPACE:
+ return translateKey("Backspace");
+ // case KeyboardListener.KEY_DELETE:
+ // return translateKey("Delete");
+ case KeyboardListener.KEY_DOWN:
+ return translateKey("Down");
+ case KeyboardListener.KEY_END:
+ return translateKey("End");
+ case KeyboardListener.KEY_ENTER:
+ return translateKey("Enter");
+ case KeyboardListener.KEY_ESCAPE:
+ return translateKey("Escape");
+ case KeyboardListener.KEY_HOME:
+ return translateKey("Home");
+ case KeyboardListener.KEY_LEFT:
+ return translateKey("Left");
+ case KeyboardListener.KEY_PAGEDOWN:
+ return translateKey("Page Down");
+ case KeyboardListener.KEY_PAGEUP:
+ return translateKey("Page Up");
+ case KeyboardListener.KEY_RIGHT:
+ return translateKey("Right");
+ case KeyboardListener.KEY_TAB:
+ return translateKey("Tab");
+ case KeyboardListener.KEY_UP:
+ return translateKey("Up");
+ case Keyboard.KEY_F1:
+ case Keyboard.KEY_F2:
+ case Keyboard.KEY_F3:
+ case Keyboard.KEY_F4:
+ case Keyboard.KEY_F5:
+ case Keyboard.KEY_F6:
+ case Keyboard.KEY_F7:
+ case Keyboard.KEY_F8:
+ case Keyboard.KEY_F9:
+ case Keyboard.KEY_F10:
+ case Keyboard.KEY_F11:
+ case Keyboard.KEY_F12:
+ return translateKey("F" + (keyCode - (Keyboard.KEY_F1 - 1)));
+ case Keyboard.KEY_COMMA:
+ case Keyboard.KEY_PERIOD:
+ case Keyboard.KEY_SLASH:
+ case Keyboard.KEY_0:
+ case Keyboard.KEY_1:
+ case Keyboard.KEY_2:
+ case Keyboard.KEY_3:
+ case Keyboard.KEY_4:
+ case Keyboard.KEY_5:
+ case Keyboard.KEY_6:
+ case Keyboard.KEY_7:
+ case Keyboard.KEY_8:
+ case Keyboard.KEY_9:
+ case Keyboard.KEY_SEMICOLON:
+ case Keyboard.KEY_EQUALS:
+ case Keyboard.KEY_A:
+ case Keyboard.KEY_B:
+ case Keyboard.KEY_C:
+ case Keyboard.KEY_D:
+ case Keyboard.KEY_E:
+ case Keyboard.KEY_F:
+ case Keyboard.KEY_G:
+ case Keyboard.KEY_H:
+ case Keyboard.KEY_I:
+ case Keyboard.KEY_J:
+ case Keyboard.KEY_K:
+ case Keyboard.KEY_L:
+ case Keyboard.KEY_M:
+ case Keyboard.KEY_N:
+ case Keyboard.KEY_O:
+ case Keyboard.KEY_P:
+ case Keyboard.KEY_Q:
+ case Keyboard.KEY_R:
+ case Keyboard.KEY_S:
+ case Keyboard.KEY_T:
+ case Keyboard.KEY_U:
+ case Keyboard.KEY_V:
+ case Keyboard.KEY_W:
+ case Keyboard.KEY_X:
+ case Keyboard.KEY_Y:
+ case Keyboard.KEY_Z:
+ case Keyboard.KEY_OPEN_BRACKET:
+ case Keyboard.KEY_BACK_SLASH:
+ case Keyboard.KEY_CLOSE_BRACKET:
+ return ("" + (char) keyCode).toUpperCase();
+ default:
+ return "Unknown keyCode: 0x" + (keyCode < 0 ? "-" : "") + Integer.toHexString(Math.abs(keyCode));
+ }
+ }
+
+ /**
+ * Returns the modifiers for this keystroke. This will be a bitwise or of
+ * constants from InputEvent; it includes the old style masks for shift,
+ * control, alt, meta, and alt-graph (but not button1); as well as the new
+ * style of extended modifiers for all modifiers.
+ *
+ * @return the modifiers
+ * @see #getKeyStroke(Character, int)
+ * @see #getKeyStroke(int, int)
+ */
+ public final int getModifiers() {
+ return modifiers;
+ }
+
+ /**
+ * Returns a hashcode for this key event. It is not documented, but appears
+ * to be: <code>(getKeyChar() + 1) * (getKeyCode() + 1)
+ * * (getModifiers() + 1) * 2 + (isOnKeyRelease() ? 1 : 2)</code>.
+ *
+ * @return the hashcode
+ */
+ @Override
+ public int hashCode() {
+ return (keyChar + 1) * (keyCode + 1) * (modifiers + 1) * 2 + (onKeyRelease ? 1 : 2);
+ }
+
+ /**
+ * Tests if this keystroke is a key release.
+ *
+ * @return true if this is a key release
+ * @see #getKeyStroke(int, int, boolean)
+ */
+ public final boolean isOnKeyRelease() {
+ return onKeyRelease;
+ }
+
+ @Override
+ public String toString() {
+ String s = " (";
+ if ((modifiers & KeyboardListener.MODIFIER_META) != 0) {
+ s += translateKey("Meta") + "+";
+ }
+ if ((modifiers & KeyboardListener.MODIFIER_CTRL) != 0) {
+ s += translateKey("Ctrl") + "+";
+ }
+ if ((modifiers & KeyboardListener.MODIFIER_ALT) != 0) {
+ s += translateKey("Alt") + "+";
+ }
+ if ((modifiers & KeyboardListener.MODIFIER_SHIFT) != 0) {
+ s += translateKey("Shift") + "+";
+ }
+ if ((modifiers & Event.BUTTON_LEFT) != 0) {
+ s += translateKey("Button1") + "+";
+ }
+ if ((modifiers & Event.BUTTON_RIGHT) != 0) {
+ s += translateKey("Button2") + "+";
+ }
+ if ((modifiers & Event.BUTTON_MIDDLE) != 0) {
+ s += translateKey("Button3") + "+";
+ }
+ s += getKeyText(keyCode) + ")";
+ return s;
+ }
+
+ /**
+ * Returns a cached version of the deserialized keystroke, if available.
+ *
+ * @return a cached replacement if something goes wrong
+ */
+ protected Object readResolve() {
+ KeyStroke s = cache.get(this);
+ if (s != null) {
+ return s;
+ }
+ cache.put(this, this);
+ return this;
+ }
+
+ private String translateKey(final String keyNameToTranslate) {
+ return Resources.i18n.tWithNT(keyNameToTranslate, "The '" + keyNameToTranslate + "' keyboard key");
+ }
+
+} // class KeyStroke
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeEvent.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeEvent.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeEvent.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,185 @@
+/* PropertyChangeEvent.java -- describes a change in a property
+ Copyright (C) 1998, 2000, 2002, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.ourproject.kune.platf.client.actions;
+
+/**
+ * PropertyChangeEvents are fired in the PropertyChange and VetoableChange event
+ * classes. They represent the old and new values as well as the source Bean. If
+ * the old or new value is a primitive type, it must be wrapped in the
+ * appropriate wrapper type (java.lang.Integer for int, etc., etc.).
+ *
+ * <p>
+ * If the old or new values are unknown (although why that would be I do not
+ * know), they may be null. Also, if the set of properties itself has changed,
+ * the name should be null, and the old and new values may also be null. Right
+ * now Sun put in a propagationId, reserved for future use. Read the comments on
+ * the constructor and on setPropagationId for more information.
+ *
+ * @author John Keiser
+ * @author Eric Blake (ebb9(a)email.byu.edu)
+ * @author Adapted version for GWT (C) The kune development team
+ * @since 1.1
+ * @status udpated to 1.4
+ */
+public class PropertyChangeEvent {
+
+ /**
+ * The name of the property that changed, may be null. Package visible for
+ * use by PropertyChangeSupport.
+ *
+ * @serial the changed property name
+ */
+ final String propertyName;
+
+ /**
+ * The new value of the property, may be null. Package visible for use by
+ * PropertyChangeSupport.
+ *
+ * @serial the new property value
+ */
+ final Object newValue;
+
+ /**
+ * The old value of the property, may be null. Package visible for use by
+ * PropertyChangeSupport.
+ *
+ * @serial the old property value
+ */
+ final Object oldValue;
+
+ /**
+ * The propagation ID, reserved for future use. May be null.
+ *
+ * @see #getPropagationId()
+ * @serial the Propagation ID
+ */
+ private Object propagationId;
+
+ private final Object source;
+
+ /**
+ * Create a new PropertyChangeEvent. Remember that if you received a
+ * PropertyChangeEvent and are sending a new one, you should also set the
+ * propagation ID from the old PropertyChangeEvent.
+ *
+ * @param source
+ * the Bean containing the property
+ * @param propertyName
+ * the property's name
+ * @param oldVal
+ * the old value of the property
+ * @param newVal
+ * the new value of the property
+ * @throws IllegalArgumentException
+ * if source is null
+ */
+ public PropertyChangeEvent(final Object source, final String propertyName, final Object oldVal, final Object newVal) {
+ this.source = source;
+ this.propertyName = propertyName;
+ this.oldValue = oldVal;
+ this.newValue = newVal;
+ }
+
+ /**
+ * Get the property's new value. May be null if multiple properties changed.
+ *
+ * @return the property's new value
+ */
+ public Object getNewValue() {
+ return newValue;
+ }
+
+ /**
+ * Get the property's old value. May be null if multiple properties changed.
+ *
+ * @return the property's old value
+ */
+ public Object getOldValue() {
+ return oldValue;
+ }
+
+ /**
+ * Get the propagation ID. Right now, it is not used for anything.
+ *
+ * @return the propagation ID
+ * @see #setPropagationId(Object)
+ */
+ public Object getPropagationId() {
+ return propagationId;
+ }
+
+ /**
+ * Get the property name. May be null if multiple properties changed.
+ *
+ * @return the property name
+ */
+ public String getPropertyName() {
+ return propertyName;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+ /**
+ * Set the propagation ID. This is a way for the event to be passed from
+ * hand to hand and retain a little extra state. Right now it is unused, but
+ * it should be propagated anyway so that future versions of JavaBeans can
+ * use it, for God knows what.
+ *
+ * @param propagationId
+ * the propagation ID
+ * @see #getPropagationId()
+ */
+ public void setPropagationId(final Object propagationId) {
+ this.propagationId = propagationId;
+ }
+
+ /**
+ * Utility method to rollback a change.
+ *
+ * @param event
+ * the event to rollback
+ * @return a new event with old and new swapped
+ */
+ PropertyChangeEvent rollback() {
+ PropertyChangeEvent result = new PropertyChangeEvent(source, propertyName, newValue, oldValue);
+ result.propagationId = propagationId;
+ return result;
+ }
+} // class PropertyChangeEvent
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeListener.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeListener.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeListener.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,58 @@
+/* PropertyChangeListener.java -- listen for changes in a bound property
+ Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.ourproject.kune.platf.client.actions;
+
+/**
+ * PropertyChangeListener allows a class to monitor properties of a Bean for
+ * changes. A propertyChange() event will only be fired <em>after</em> the
+ * property has changed.
+ *
+ * @author John Keiser
+ * @author Adapted version for GWT (C) The kune development team
+ * @since 1.1
+ * @status updated to 1.4
+ */
+public interface PropertyChangeListener extends EventListener {
+ /**
+ * Fired after a Bean's property has changed.
+ *
+ * @param e
+ * the change (containing the old and new values)
+ */
+ void propertyChange(PropertyChangeEvent e);
+} // interface PropertyChangeListener
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeListenerProxy.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeListenerProxy.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeListenerProxy.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,99 @@
+/* PropertyChangeListenerProxy.java -- adds a name to a property listener
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.ourproject.kune.platf.client.actions;
+
+/**
+ * This class provides an extension to <code>PropertyChangeListener</code> -
+ * associating a name with the listener. This can be used to filter the changes
+ * that one is interested in.
+ *
+ * @author Eric Blake (ebb9(a)email.byu.edu)
+ * @author Adapted version for GWT (C) The kune development team
+ * @since 1.4
+ * @status udpated to 1.4
+ */
+public class PropertyChangeListenerProxy extends EventListenerProxy implements PropertyChangeListener {
+ /**
+ * The name of the property to listen for. Package visible for use by
+ * PropertyChangeSupport.
+ */
+ final String propertyName;
+
+ /**
+ * Create a new proxy which filters property change events and only passes
+ * changes to the named property on to the delegate. A null propertyName or
+ * listener does not fail now, but may cause a NullPointerException down the
+ * road.
+ *
+ * @param propertyName
+ * the property's name to filter on
+ * @param listener
+ * the delegate listener
+ */
+ public PropertyChangeListenerProxy(final String propertyName, final PropertyChangeListener listener) {
+ super(listener);
+ this.propertyName = propertyName;
+ }
+
+ /**
+ * Gets the name of the property this proxy is filtering on.
+ *
+ * @return the property name
+ */
+ public String getPropertyName() {
+ return propertyName;
+ }
+
+ /**
+ * Forwards the event on to the delegate if the property name matches.
+ *
+ * @param event
+ * the event to pass on, if it meets the filter
+ * @throws NullPointerException
+ * if the delegate this was created with is null
+ */
+ public void propertyChange(final PropertyChangeEvent event) {
+ // Note: Sun does not filter, under the assumption that since
+ // PropertyChangeSupport unwraps proxys, this method should never be
+ // called by normal use of listeners.
+ String name = event == null ? null : event.getPropertyName();
+ if (name == null ? propertyName == null : name.equals(propertyName)) {
+ ((PropertyChangeListener) getListener()).propertyChange(event);
+ }
+ }
+} // class PropertyChangeListenerProxy
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,436 @@
+/* PropertyChangeSupport.java -- support to manage property change listeners
+ Copyright (C) 1998, 1999, 2000, 2002, 2005, 2006
+ Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.ourproject.kune.platf.client.actions;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Vector;
+import java.util.Map.Entry;
+
+/**
+ * PropertyChangeSupport makes it easy to fire property change events and handle
+ * listeners. It allows chaining of listeners, as well as filtering by property
+ * name. In addition, it will serialize only those listeners which are
+ * serializable, ignoring the others without problem. This class is thread-safe.
+ *
+ * @author John Keiser
+ * @author Eric Blake (ebb9(a)email.byu.edu)
+ * @author Adapted version for GWT (C) The kune development team
+ * @since 1.1
+ * @status updated to 1.4
+ */
+public class PropertyChangeSupport {
+
+ /**
+ * Maps property names (String) to named listeners (PropertyChangeSupport).
+ * If this is a child instance, this field will be null.
+ *
+ * @serial the map of property names to named listener managers
+ * @since 1.2
+ */
+ private HashMap<String, PropertyChangeSupport> children;
+
+ /**
+ * The non-null source object for any generated events.
+ *
+ * @serial the event source
+ */
+ private final Object source;
+
+ /**
+ * The list of all registered property listeners. If this instance was
+ * created by user code, this only holds the global listeners (ie. not tied
+ * to a name), and may be null. If it was created by this class, as a helper
+ * for named properties, then this vector will be non-null, and this
+ * instance appears as a value in the <code>children</code> hashtable of
+ * another instance, so that the listeners are tied to the key of that
+ * hashtable entry.
+ */
+ private Vector<PropertyChangeListener> listeners;
+
+ /**
+ * Create a PropertyChangeSupport to work with a specific source bean.
+ *
+ * @param source
+ * the source bean to use
+ * @throws NullPointerException
+ * if source is null
+ */
+ public PropertyChangeSupport(final Object source) {
+ this.source = source;
+ if (source == null) {
+ throw new NullPointerException();
+ }
+ }
+
+ /**
+ * Adds a PropertyChangeListener to the list of global listeners. All
+ * property change events will be sent to this listener. The listener add is
+ * not unique: that is, <em>n</em> adds with the same listener will result
+ * in <em>n</em> events being sent to that listener for every property
+ * change. Adding a null listener is silently ignored. This method will
+ * unwrap a PropertyChangeListenerProxy, registering the underlying delegate
+ * to the named property list.
+ *
+ * @param l
+ * the listener to add
+ */
+ public void addPropertyChangeListener(final PropertyChangeListener l) {
+ if (l == null) {
+ return;
+ }
+
+ if (l instanceof PropertyChangeListenerProxy) {
+ PropertyChangeListenerProxy p = (PropertyChangeListenerProxy) l;
+ addPropertyChangeListener(p.propertyName, (PropertyChangeListener) p.getListener());
+ } else {
+ if (listeners == null) {
+ listeners = new Vector<PropertyChangeListener>();
+ }
+ listeners.add(l);
+ }
+ }
+
+ /**
+ * Adds a PropertyChangeListener listening on the specified property. Events
+ * will be sent to the listener only if the property name matches. The
+ * listener add is not unique; that is, <em>n</em> adds on a particular
+ * property for a particular listener will result in <em>n</em> events being
+ * sent to that listener when that property is changed. The effect is
+ * cumulative, too; if you are registered to listen to receive events on all
+ * property changes, and then you register on a particular property, you
+ * will receive change events for that property twice. Adding a null
+ * listener is silently ignored. This method will unwrap a
+ * PropertyChangeListenerProxy, registering the underlying delegate to the
+ * named property list if the names match, and discarding it otherwise.
+ *
+ * @param propertyName
+ * the name of the property to listen on
+ * @param l
+ * the listener to add
+ * @throws NullPointerException
+ * if propertyName is null
+ */
+ public void addPropertyChangeListener(final String propertyName, PropertyChangeListener l) {
+ if (l == null) {
+ return;
+ }
+
+ while (l instanceof PropertyChangeListenerProxy) {
+ PropertyChangeListenerProxy p = (PropertyChangeListenerProxy) l;
+ if (propertyName == null ? p.propertyName != null : !propertyName.equals(p.propertyName)) {
+ return;
+ }
+ l = (PropertyChangeListener) p.getListener();
+ }
+ PropertyChangeSupport s = null;
+ if (children == null) {
+ children = new HashMap<String, PropertyChangeSupport>();
+ } else {
+ s = children.get(propertyName);
+ }
+ if (s == null) {
+ s = new PropertyChangeSupport(source);
+ s.listeners = new Vector<PropertyChangeListener>();
+ children.put(propertyName, s);
+ }
+ s.listeners.add(l);
+ }
+
+ /**
+ * Fire an indexed property change event. This will only fire an event if
+ * the old and new values are not equal.
+ *
+ * @param name
+ * the name of the property which changed
+ * @param index
+ * the index of the property which changed
+ * @param oldValue
+ * the old value of the property
+ * @param newValue
+ * the new value of the property
+ * @since 1.5
+ */
+ public void fireIndexedPropertyChange(final String name, final int index, final boolean oldValue,
+ final boolean newValue) {
+ if (oldValue != newValue) {
+ fireIndexedPropertyChange(name, index, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
+ }
+ }
+
+ /**
+ * Fire an indexed property change event. This will only fire an event if
+ * the old and new values are not equal.
+ *
+ * @param name
+ * the name of the property which changed
+ * @param index
+ * the index of the property which changed
+ * @param oldValue
+ * the old value of the property
+ * @param newValue
+ * the new value of the property
+ * @since 1.5
+ */
+ public void fireIndexedPropertyChange(final String name, final int index, final int oldValue, final int newValue) {
+ if (oldValue != newValue) {
+ fireIndexedPropertyChange(name, index, Integer.valueOf(oldValue), Integer.valueOf(newValue));
+ }
+ }
+
+ /**
+ * Fire a PropertyChangeEvent to all the global listeners, and to all the
+ * listeners for the specified property name. This does nothing if old and
+ * new values of the event are equal.
+ *
+ * @param event
+ * the event to fire
+ * @throws NullPointerException
+ * if event is null
+ */
+ public void firePropertyChange(final PropertyChangeEvent event) {
+ if (event.oldValue != null && event.oldValue.equals(event.newValue)) {
+ return;
+ }
+ Vector<PropertyChangeListener> v = listeners; // Be thread-safe.
+ if (v != null) {
+ int i = v.size();
+ while (--i >= 0) {
+ (v.get(i)).propertyChange(event);
+ }
+ }
+ HashMap<String, PropertyChangeSupport> h = children; // Be
+ // thread-safe.
+ if (h != null && event.propertyName != null) {
+ PropertyChangeSupport s = h.get(event.propertyName);
+ if (s != null) {
+ v = s.listeners; // Be thread-safe.
+ int i = v == null ? 0 : v.size();
+ while (--i >= 0) {
+ (v.get(i)).propertyChange(event);
+ }
+ }
+ }
+ }
+
+ /**
+ * Fire a PropertyChangeEvent containing the old and new values of the
+ * property to all the global listeners, and to all the listeners for the
+ * specified property name. This does nothing if old and new are equal.
+ *
+ * @param propertyName
+ * the name of the property that changed
+ * @param oldVal
+ * the old value
+ * @param newVal
+ * the new value
+ */
+ public void firePropertyChange(final String propertyName, final boolean oldVal, final boolean newVal) {
+ if (oldVal != newVal) {
+ firePropertyChange(new PropertyChangeEvent(source, propertyName, Boolean.valueOf(oldVal),
+ Boolean.valueOf(newVal)));
+ }
+ }
+
+ /**
+ * Fire a PropertyChangeEvent containing the old and new values of the
+ * property to all the global listeners, and to all the listeners for the
+ * specified property name. This does nothing if old and new are equal.
+ *
+ * @param propertyName
+ * the name of the property that changed
+ * @param oldVal
+ * the old value
+ * @param newVal
+ * the new value
+ */
+ public void firePropertyChange(final String propertyName, final int oldVal, final int newVal) {
+ if (oldVal != newVal) {
+ firePropertyChange(new PropertyChangeEvent(source, propertyName, Integer.valueOf(oldVal),
+ Integer.valueOf(newVal)));
+ }
+ }
+
+ /**
+ * Fire a PropertyChangeEvent containing the old and new values of the
+ * property to all the global listeners, and to all the listeners for the
+ * specified property name. This does nothing if old and new are non-null
+ * and equal.
+ *
+ * @param propertyName
+ * the name of the property that changed
+ * @param oldVal
+ * the old value
+ * @param newVal
+ * the new value
+ */
+ public void firePropertyChange(final String propertyName, final Object oldVal, final Object newVal) {
+ firePropertyChange(new PropertyChangeEvent(source, propertyName, oldVal, newVal));
+ }
+
+ /**
+ * Returns an array of all registered property change listeners. Those that
+ * were registered under a name will be wrapped in a
+ * <code>PropertyChangeListenerProxy</code>, so you must check whether the
+ * listener is an instance of the proxy class in order to see what name the
+ * real listener is registered under. If there are no registered listeners,
+ * this returns an empty array.
+ *
+ * @return the array of registered listeners
+ * @see PropertyChangeListenerProxy
+ * @since 1.4
+ */
+ public PropertyChangeListener[] getPropertyChangeListeners() {
+ ArrayList<PropertyChangeListener> list = new ArrayList<PropertyChangeListener>();
+ if (listeners != null) {
+ list.addAll(listeners);
+ }
+ if (children != null) {
+ int i = children.size();
+ Iterator<Entry<String, PropertyChangeSupport>> iter = children.entrySet().iterator();
+ while (--i >= 0) {
+ Entry<String, PropertyChangeSupport> e = iter.next();
+ String name = e.getKey();
+ Vector<PropertyChangeListener> v = (e.getValue()).listeners;
+ int j = v.size();
+ while (--j >= 0) {
+ list.add(new PropertyChangeListenerProxy(name, v.get(j)));
+ }
+ }
+ }
+ return list.toArray(new PropertyChangeListener[list.size()]);
+ }
+
+ /**
+ * Returns an array of all property change listeners registered under the
+ * given property name. If there are no registered listeners, or
+ * propertyName is null, this returns an empty array.
+ *
+ * @return the array of registered listeners
+ * @since 1.4
+ */
+ public PropertyChangeListener[] getPropertyChangeListeners(final String propertyName) {
+ if (children == null || propertyName == null) {
+ return new PropertyChangeListener[0];
+ }
+ PropertyChangeSupport s = children.get(propertyName);
+ if (s == null) {
+ return new PropertyChangeListener[0];
+ }
+ return s.listeners.toArray(new PropertyChangeListener[s.listeners.size()]);
+ }
+
+ /**
+ * Tell whether the specified property is being listened on or not. This
+ * will only return <code>true</code> if there are listeners on all
+ * properties or if there is a listener specifically on this property.
+ *
+ * @param propertyName
+ * the property that may be listened on
+ * @return whether the property is being listened on
+ */
+ public boolean hasListeners(final String propertyName) {
+ return listeners != null || (children != null && children.get(propertyName) != null);
+ }
+
+ /**
+ * Removes a PropertyChangeListener from the list of global listeners. If
+ * any specific properties are being listened on, they must be deregistered
+ * by themselves; this will only remove the general listener to all
+ * properties. If <code>add()</code> has been called multiple times for a
+ * particular listener, <code>remove()</code> will have to be called the
+ * same number of times to deregister it. This method will unwrap a
+ * PropertyChangeListenerProxy, removing the underlying delegate from the
+ * named property list.
+ *
+ * @param l
+ * the listener to remove
+ */
+ public void removePropertyChangeListener(final PropertyChangeListener l) {
+ if (l instanceof PropertyChangeListenerProxy) {
+ PropertyChangeListenerProxy p = (PropertyChangeListenerProxy) l;
+ removePropertyChangeListener(p.propertyName, (PropertyChangeListener) p.getListener());
+ } else if (listeners != null) {
+ listeners.remove(l);
+ if (listeners.isEmpty()) {
+ listeners = null;
+ }
+ }
+ }
+
+ /**
+ * Removes a PropertyChangeListener from listening to a specific property.
+ * If <code>add()</code> has been called multiple times for a particular
+ * listener on a property, <code>remove()</code> will have to be called the
+ * same number of times to deregister it. This method will unwrap a
+ * PropertyChangeListenerProxy, removing the underlying delegate from the
+ * named property list if the names match.
+ *
+ * @param propertyName
+ * the property to stop listening on
+ * @param l
+ * the listener to remove
+ * @throws NullPointerException
+ * if propertyName is null
+ */
+ public void removePropertyChangeListener(final String propertyName, PropertyChangeListener l) {
+ if (children == null) {
+ return;
+ }
+ PropertyChangeSupport s = children.get(propertyName);
+ if (s == null) {
+ return;
+ }
+ while (l instanceof PropertyChangeListenerProxy) {
+ PropertyChangeListenerProxy p = (PropertyChangeListenerProxy) l;
+ if (propertyName == null ? p.propertyName != null : !propertyName.equals(p.propertyName)) {
+ return;
+ }
+ l = (PropertyChangeListener) p.getListener();
+ }
+ s.listeners.remove(l);
+ if (s.listeners.isEmpty()) {
+ children.remove(propertyName);
+ if (children.isEmpty()) {
+ children = null;
+ }
+ }
+ }
+} // class PropertyChangeSupport
Added: 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-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/AbstractButton.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,125 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.Action;
+import org.ourproject.kune.platf.client.actions.PropertyChangeEvent;
+import org.ourproject.kune.platf.client.actions.PropertyChangeListener;
+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.Composite;
+import com.gwtext.client.widgets.Button;
+
+public abstract class AbstractButton extends Composite {
+
+ private Action action;
+ private final Button button;
+
+ /**
+ * Listener the button uses to receive PropertyChangeEvents from its Action.
+ */
+ PropertyChangeListener actionPropertyChangeListener;
+
+ public AbstractButton() {
+ button = new Button();
+ initWidget(button);
+ }
+
+ public void setAction(final Action a) {
+ if (action != null) {
+ action.removePropertyChangeListener(actionPropertyChangeListener);
+ // removeActionListener(action);
+ if (actionPropertyChangeListener != null) {
+ action.removePropertyChangeListener(actionPropertyChangeListener);
+ actionPropertyChangeListener = null;
+ }
+ }
+
+ action = a;
+ configurePropertiesFromAction(action);
+ if (action != null) {
+ actionPropertyChangeListener = createActionPropertyChangeListener(a);
+ action.addPropertyChangeListener(actionPropertyChangeListener);
+ // addActionListener(action);
+ }
+ }
+
+ public void setEnabled(final boolean enabled) {
+ if (enabled) {
+ button.enable();
+ } else {
+ button.disable();
+ }
+ }
+
+ public void setIcon(final ImageResource imageResource) {
+ if (imageResource != null) {
+ // FIXME
+ button.setIconCls(RTEImgResources.SUFFIX + imageResource.getName());
+ }
+ }
+
+ public void setText(final String text) {
+ button.setText(text);
+ }
+
+ public void setToolTipText(final String tooltip) {
+ button.setTooltip(tooltip);
+ }
+
+ protected void configurePropertiesFromAction(final Action a) {
+ if (a == null) {
+ setText(null);
+ setIcon(null);
+ setEnabled(true);
+ setToolTipText(null);
+ } else {
+ setText((String) (a.getValue(Action.NAME)));
+ setIcon((ImageResource) (a.getValue(Action.SMALL_ICON)));
+ setEnabled(a.isEnabled());
+ setToolTipText((String) (a.getValue(Action.SHORT_DESCRIPTION)));
+ // if (a.getValue(Action.MNEMONIC_KEY) != null) {
+ // setMnemonic(((Integer)
+ // (a.getValue(Action.MNEMONIC_KEY))).intValue());
+ // }
+ // String actionCommand = (String)
+ // (a.getValue(Action.ACTION_COMMAND_KEY));
+ //
+ // // Set actionCommand to button's text by default if it is not
+ // // specified
+ // if (actionCommand != null) {
+ // setActionCommand((String)
+ // (a.getValue(Action.ACTION_COMMAND_KEY)));
+ // } else {
+ // setActionCommand(getText());
+ // }
+ }
+ }
+
+ protected PropertyChangeListener createActionPropertyChangeListener(final Action a) {
+ return new PropertyChangeListener() {
+ public void propertyChange(final PropertyChangeEvent e) {
+ Action act = (Action) (e.getSource());
+ if (e.getPropertyName().equals(Action.ENABLED)) {
+ setEnabled(act.isEnabled());
+ } else if (e.getPropertyName().equals(Action.NAME)) {
+ setText((String) (act.getValue(Action.NAME)));
+ } else if (e.getPropertyName().equals(Action.SMALL_ICON)) {
+ setIcon((ImageResource) (act.getValue(Action.SMALL_ICON)));
+ } else if (e.getPropertyName().equals(Action.SHORT_DESCRIPTION)) {
+ setToolTipText((String) (act.getValue(Action.SHORT_DESCRIPTION)));
+ }
+ // else if (e.getPropertyName().equals(Action.MNEMONIC_KEY)) {
+ // if (act.getValue(Action.MNEMONIC_KEY) != null) {
+ // setMnemonic(((Integer) (act.getValue(Action.MNEMONIC_KEY)))
+ // .intValue());
+ // } else if
+ // (e.getPropertyName().equals(Action.ACTION_COMMAND_KEY)) {
+ // setActionCommand((String)
+ // (act.getValue(Action.ACTION_COMMAND_KEY)));
+ // }
+ // }
+ }
+ };
+ }
+
+}
Added: 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-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/DefaultButton.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,28 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+import org.ourproject.kune.platf.client.actions.Action;
+
+import com.google.gwt.libideas.resources.client.ImageResource;
+
+public class DefaultButton extends AbstractButton {
+ public DefaultButton() {
+ }
+
+ public DefaultButton(final Action action) {
+ configurePropertiesFromAction(action);
+ }
+
+ public DefaultButton(final ImageResource icon) {
+ setIcon(icon);
+ }
+
+ public DefaultButton(final String text) {
+ setText(text);
+ }
+
+ public DefaultButton(final String text, final ImageResource icon) {
+ setText(text);
+ setIcon(icon);
+ }
+
+}
Added: 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-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -0,0 +1,36 @@
+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.noti.NotifyUser;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+import com.google.gwt.user.client.Timer;
+
+public class TestButton extends DefaultButton {
+ public class NotiAction extends AbstractAction {
+ public NotiAction() {
+ super.putValue(Action.NAME, "test");
+ super.putValue(Action.SHORT_DESCRIPTION, "test button");
+ }
+
+ public void actionPerformed(final ActionEvent event) {
+ NotifyUser.info("Button clicked");
+ }
+ }
+
+ public TestButton(final WorkspaceSkeleton ws) {
+ super();
+ ws.getEntityWorkspace().getBottomTitle().add(this);
+ final NotiAction noti = new NotiAction();
+ super.setAction(noti);
+ new Timer() {
+ @Override
+ public void run() {
+ noti.putValue(Action.NAME, "test2");
+ noti.putValue(Action.SHORT_DESCRIPTION, "test2 button");
+ }
+ }.schedule(5000);
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/AccessViolationException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/AccessViolationException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/AccessViolationException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class AccessViolationException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -3786772632052256999L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/AlreadyGroupMemberException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/AlreadyGroupMemberException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/AlreadyGroupMemberException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class AlreadyGroupMemberException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 6663958867752546481L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/AlreadyUserMemberException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/AlreadyUserMemberException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/AlreadyUserMemberException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class AlreadyUserMemberException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -6365615768192330492L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContainerNotPermittedException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContainerNotPermittedException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContainerNotPermittedException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class ContainerNotPermittedException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 6866318170714609691L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContentNotFoundException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContentNotFoundException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContentNotFoundException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class ContentNotFoundException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -4641212341448422627L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContentNotPermittedException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContentNotPermittedException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/ContentNotPermittedException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class ContentNotPermittedException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 4771568826852748873L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/DefaultException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/DefaultException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/DefaultException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -23,8 +23,9 @@
import com.google.gwt.user.client.rpc.StatusCodeException;
public class DefaultException extends StatusCodeException implements IsSerializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -6111471089427505005L;
+
public DefaultException() {
this(0, "");
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/EmailAddressInUseException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/EmailAddressInUseException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/EmailAddressInUseException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class EmailAddressInUseException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 3740509040361715407L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/GroupNameInUseException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/GroupNameInUseException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/GroupNameInUseException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class GroupNameInUseException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -4746775725822225687L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/GroupNotFoundException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/GroupNotFoundException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/GroupNotFoundException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class GroupNotFoundException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2358855015943550817L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/I18nNotFoundException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/I18nNotFoundException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/I18nNotFoundException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class I18nNotFoundException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -2400899465805236215L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/LastAdminInGroupException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/LastAdminInGroupException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/LastAdminInGroupException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class LastAdminInGroupException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -8727443733339361388L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/NameInUseException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/NameInUseException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/NameInUseException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class NameInUseException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 4890594846432830537L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/NameNotPermittedException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/NameNotPermittedException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/NameNotPermittedException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class NameNotPermittedException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -8022844560909422614L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/NoDefaultContentException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/NoDefaultContentException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/NoDefaultContentException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class NoDefaultContentException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 7443824340580555859L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/SessionExpiredException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/SessionExpiredException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/SessionExpiredException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class SessionExpiredException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -1603881986661302041L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/ToolNotFoundException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/ToolNotFoundException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/ToolNotFoundException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class ToolNotFoundException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 472511647264356558L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/UserAuthException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/UserAuthException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/UserAuthException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class UserAuthException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -8383513776573054971L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/UserMustBeLoggedException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/UserMustBeLoggedException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/UserMustBeLoggedException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class UserMustBeLoggedException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -5091069990899662849L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/errors/UserNotFoundException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/UserNotFoundException.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/UserNotFoundException.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,5 +20,5 @@
package org.ourproject.kune.platf.client.errors;
public class UserNotFoundException extends DefaultException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 6207713694613166661L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/i18n/I18nChangeListenerCollection.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/i18n/I18nChangeListenerCollection.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/i18n/I18nChangeListenerCollection.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -20,7 +20,6 @@
package org.ourproject.kune.platf.client.i18n;
import java.util.ArrayList;
-import java.util.Iterator;
/**
* A helper class for implementers of the SourcesI18nChangeEvents interface.
@@ -29,15 +28,14 @@
*/
public class I18nChangeListenerCollection extends ArrayList<I18nChangeListener> {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -2435290836445582410L;
/**
* Fires a locale change event to all listeners.
*
*/
public void fireI18nLanguageChange() {
- for (Iterator<I18nChangeListener> it = iterator(); it.hasNext();) {
- I18nChangeListener listener = it.next();
+ for (I18nChangeListener listener : this) {
listener.onI18nLanguageChange();
}
}
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-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -21,6 +21,7 @@
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.TestButton;
import org.ourproject.kune.platf.client.app.Application;
import org.ourproject.kune.platf.client.app.ApplicationComponentGroup;
import org.ourproject.kune.platf.client.app.ApplicationDefault;
@@ -115,6 +116,7 @@
import org.ourproject.kune.platf.client.ui.rte.saving.RTESavingEditorPresenter;
import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper;
import org.ourproject.kune.platf.client.utils.TimerWrapper;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
import com.calclab.suco.client.events.Listener0;
import com.calclab.suco.client.ioc.decorator.NoDecoration;
@@ -523,9 +525,18 @@
return new ExternalMediaRegistry($(Session.class).getInitData().getExtMediaDescrips());
}});
+ register(Singleton.class, new Factory<TestButton>(TestButton.class) {
+ @Override
+ public TestButton create() {
+ final TestButton btn = new TestButton($(WorkspaceSkeleton.class));
+ return btn;
+ }
+ });
+
$(ApplicationComponentGroup.class).createAll();
$(ToolGroup.class).createAll();
$(Application.class).start();
// $(HelloWorld.class);
+
}
}
\ No newline at end of file
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-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/Keyboard.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -19,4 +19,50 @@
public int KEY_F11 = 122; /* Full screen */
public 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 = ']';
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItemCollection.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItemCollection.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItemCollection.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -44,6 +44,6 @@
public class MenuItemCollection<T> extends ArrayList<MenuItem<T>> {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -4719030300216601947L;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaRegistry.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaRegistry.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaRegistry.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -9,8 +9,7 @@
public class ExternalMediaRegistry extends ArrayList<ExtMediaDescripDTO> {
- private static final long serialVersionUID = 1L;
-
+ private static final long serialVersionUID = -9109609520119776917L;
public static final ExtMediaDescripDTO NO_MEDIA = new ExtMediaDescripDTO(null, null, null, null, null, 0, 0);
public ExternalMediaRegistry(final List<ExtMediaDescripDTO> extMediaDescrips) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/ChatUserParams.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/ChatUserParams.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/ChatUserParams.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -25,7 +25,7 @@
public class ChatUserParams implements Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -1343712336914940957L;
private String avatar;
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoDownloadManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoDownloadManager.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoDownloadManager.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -36,8 +36,7 @@
public class EntityLogoDownloadManager extends HttpServlet {
- private static final long serialVersionUID = 1L;
-
+ private static final long serialVersionUID = -1958945058088446881L;
@Inject
GroupManager groupManager;
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-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -46,7 +46,7 @@
public class EntityLogoUploadManager extends FileUploadManagerAbstract {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -4281058427935636238L;
@Inject
GroupManager groupManager;
@@ -55,14 +55,14 @@
I18nTranslationService i18n;
@Override
- protected void beforeRespond(HttpServletResponse response, Writer w) throws IOException {
+ protected void beforeRespond(final HttpServletResponse response, final Writer w) throws IOException {
super.beforeRespond(response, w);
response.setCharacterEncoding("utf-8");
response.setContentType("text/xml");
}
- protected void createUploadedFile(StateToken stateToken, String mimeTypeS, File origFile) throws Exception,
- IOException, MagickException, FileNotFoundException {
+ protected void createUploadedFile(final StateToken stateToken, final String mimeTypeS, final File origFile)
+ throws Exception, IOException, MagickException, FileNotFoundException {
BasicMimeType mimeType = new BasicMimeType(mimeTypeS);
if (!mimeType.getType().equals("image")) {
throw new Exception("Trying to set a non image (" + mimeTypeS + ") as group logo");
@@ -91,8 +91,8 @@
@Authenticated
@Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
@Transactional(type = TransactionType.READ_WRITE)
- protected void createUploadedFile(String userHash, StateToken stateToken, String fileName, FileItem file,
- String typeId) throws Exception {
+ protected void createUploadedFile(final String userHash, final StateToken stateToken, final String fileName,
+ final FileItem file, final String typeId) throws Exception {
String mimeTypeS = file.getContentType();
File tmpOrigFile = File.createTempFile("logoOrig", "");
file.write(tmpOrigFile);
@@ -133,13 +133,13 @@
}
@Override
- protected void onFileUploadException(HttpServletResponse response) throws IOException {
+ protected void onFileUploadException(final HttpServletResponse response) throws IOException {
doResponse(response, createXmlResponse(false, i18n.t("Error: File too large")).toString(),
HttpServletResponse.SC_BAD_REQUEST);
}
@Override
- protected void onOtherException(HttpServletResponse response, Exception e) throws IOException {
+ protected void onOtherException(final HttpServletResponse response, final Exception e) throws IOException {
super.onOtherException(response, e);
log.info("Exception: " + e.getCause());
// e.printStackTrace();
@@ -148,7 +148,7 @@
}
@Override
- protected void onSuccess(HttpServletResponse response) throws IOException {
+ protected void onSuccess(final HttpServletResponse response) throws IOException {
doResponse(response, createXmlResponse(true, i18n.t("Success uploading")).toString());
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManager.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManager.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -54,13 +54,14 @@
*/
public class FileDownloadManager extends HttpServlet {
+ private static final long serialVersionUID = -1160659289588014049L;
+
static final String RESP_HEADER_ATTACHMENT_FILENAME = "attachment; filename=\"";
static final String RESP_HEADER_CONTEND_DISP = "Content-Disposition";
static final String RESP_HEADER_END = "\"";
static final String APPLICATION_X_DOWNLOAD = "application/x-download";
- private static final long serialVersionUID = 1L;
public static final Log log = LogFactory.getLog(FileDownloadManager.class);
@Inject
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManagerUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManagerUtils.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManagerUtils.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -30,8 +30,6 @@
public class FileDownloadManagerUtils {
- private static final long serialVersionUID = 1L;
-
public static void returnFile(final String filename, final OutputStream out) throws FileNotFoundException,
IOException {
InputStream in = null;
@@ -49,7 +47,7 @@
}
}
- public static void returnNotFound(HttpServletResponse resp) throws IOException {
+ public static void returnNotFound(final HttpServletResponse resp) throws IOException {
resp.getWriter().println("Content not found");
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileJsonUploadManagerAbstract.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileJsonUploadManagerAbstract.java 2009-05-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileJsonUploadManagerAbstract.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -32,13 +32,12 @@
public abstract class FileJsonUploadManagerAbstract extends FileUploadManagerAbstract {
- private static final long serialVersionUID = 1L;
-
+ private static final long serialVersionUID = 8437422616838698647L;
@Inject
I18nTranslationService i18n;
@Override
- protected void beforeRespond(HttpServletResponse response, Writer w) throws IOException {
+ protected void beforeRespond(final HttpServletResponse response, final Writer w) throws IOException {
super.beforeRespond(response, w);
response.setCharacterEncoding("utf-8");
response.setContentType("text/html");
@@ -49,12 +48,12 @@
}
@Override
- protected void onFileUploadException(HttpServletResponse response) throws IOException {
+ protected void onFileUploadException(final HttpServletResponse response) throws IOException {
doResponse(response, createJsonResponse(false, i18n.t("Error: File too large")).toString());
}
@Override
- protected void onOtherException(HttpServletResponse response, Exception e) throws IOException {
+ protected void onOtherException(final HttpServletResponse response, final Exception e) throws IOException {
super.onOtherException(response, e);
log.info("Exception: " + e.getCause());
// e.printStackTrace();
@@ -62,7 +61,7 @@
}
@Override
- protected void onSuccess(HttpServletResponse response) throws IOException {
+ protected void onSuccess(final HttpServletResponse response) throws IOException {
doResponse(response, createJsonResponse(true, i18n.t("Uploading was successful")).toString());
}
}
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-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -53,8 +53,7 @@
@RequestScoped
public class FileUploadManager extends FileJsonUploadManagerAbstract {
- private static final long serialVersionUID = 1L;
-
+ private static final long serialVersionUID = -7209922761735338754L;
@Inject
UserSession userSession;
@Inject
@@ -93,8 +92,8 @@
}
@Override
- protected void createUploadedFile(String userHash, StateToken stateToken, String fileName, FileItem file,
- String typeId) throws Exception {
+ protected void createUploadedFile(final String userHash, final StateToken stateToken, final String fileName,
+ final FileItem file, final String typeId) throws Exception {
createUploadedFileWrapped(userHash, stateToken, fileName, file, typeId);
}
@@ -102,7 +101,7 @@
@Authorizated(accessRolRequired = AccessRol.Editor, actionLevel = ActionLevel.container, mustCheckMembership = false)
@Transactional(type = TransactionType.READ_WRITE)
Content createUploadedFileWrapped(final String userHash, final StateToken stateToken, final String fileName,
- final FileItem fileUploadItem, String typeId) throws Exception {
+ final FileItem fileUploadItem, final String typeId) throws Exception {
final String relDir = FileUtils.toDir(stateToken);
final String absDir = kuneProperties.get(KuneProperties.UPLOAD_LOCATION) + relDir;
fileManager.mkdir(absDir);
@@ -146,7 +145,7 @@
}
}
- private void generateThumbs(String absDir, String filename, String extension, boolean isPdf) {
+ private void generateThumbs(final String absDir, final String filename, final String extension, final boolean isPdf) {
try {
String fileOrig = absDir + filename;
String withoutExtension = FileUtils.getFileNameWithoutExtension(filename, extension);
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-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerAbstract.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -45,7 +45,7 @@
public abstract class FileUploadManagerAbstract extends HttpServlet {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -4227762495128652369L;
public static final Log log = LogFactory.getLog(FileUploadManager.class);
@@ -60,8 +60,8 @@
protected void beforeRespond(final HttpServletResponse response, final Writer w) throws IOException {
}
- protected void createUploadedFile(String userHash, StateToken stateToken, String fileName, FileItem file,
- String typeId) throws Exception {
+ protected void createUploadedFile(final String userHash, final StateToken stateToken, final String fileName,
+ final FileItem file, final String typeId) throws Exception {
}
@Override
@@ -123,12 +123,12 @@
}
}
- protected void doResponse(final HttpServletResponse response, String additionalResponse) throws IOException {
+ protected void doResponse(final HttpServletResponse response, final String additionalResponse) throws IOException {
doResponse(response, additionalResponse, HttpServletResponse.SC_OK);
}
- protected void doResponse(final HttpServletResponse response, String additionalResponse, int responseCode)
- throws IOException {
+ protected void doResponse(final HttpServletResponse response, final String additionalResponse,
+ final int responseCode) throws IOException {
final Writer w = new OutputStreamWriter(response.getOutputStream());
if (additionalResponse != null) {
w.write(additionalResponse);
@@ -141,13 +141,13 @@
doResponse(response, null);
}
- protected void onOtherException(HttpServletResponse response, final Exception e) throws IOException {
+ protected void onOtherException(final HttpServletResponse response, final Exception e) throws IOException {
log.info("Exception: " + e.getCause());
e.printStackTrace();
doResponse(response, null);
}
- protected void onSuccess(HttpServletResponse response) throws IOException {
+ protected void onSuccess(final HttpServletResponse response) throws IOException {
doResponse(response, null);
}
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-11 20:23:46 UTC (rev 1109)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/DelegatedRemoteServlet.java 2009-05-13 13:53:01 UTC (rev 1110)
@@ -29,12 +29,13 @@
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
public class DelegatedRemoteServlet extends RemoteServiceServlet {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -7646054921925214953L;
private transient RemoteService service;
private ServletContext servletContext;
- public void setService(final RemoteService service) {
- this.service = service;
+ @Override
+ public ServletContext getServletContext() {
+ return servletContext;
}
@Override
@@ -47,17 +48,17 @@
}
}
- @Override
- protected void doUnexpectedFailure(final Throwable e) {
- e.printStackTrace();
- super.doUnexpectedFailure(e);
+ public void setService(final RemoteService service) {
+ this.service = service;
}
public void setServletContext(final ServletContext servletContext) {
this.servletContext = servletContext;
}
- public ServletContext getServletContext() {
- return servletContext;
+ @Override
+ protected void doUnexpectedFailure(final Throwable e) {
+ e.printStackTrace();
+ super.doUnexpectedFailure(e);
}
}
\ No newline at end of file
1
0
Author: vjrj
Date: 2009-05-11 22:23:46 +0200 (Mon, 11 May 2009)
New Revision: 1109
Modified:
trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java
trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManager.java
trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/InfoDialog.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/RTEditor.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/properties/ChatProperties.java
trunk/src/main/java/org/ourproject/kune/platf/server/properties/DatabaseProperties.java
trunk/src/main/java/org/ourproject/kune/platf/server/properties/KuneProperties.java
trunk/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java
trunk/src/test/java/org/ourproject/kune/chat/server/managers/XmppManagerTest.java
Log:
Complete - task link editing/remove not working
Complete - task link editing close option
Complete - task Elements unselectable utility
Incomplete - task 192: Make a chat notification library to users
http://ourproject.org/tracker/?group_id=407&func=detail&atid=139&aid=192
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -286,7 +286,7 @@
final String resource = "emiteui-" + new Date().getTime() + "-kune"; // +
// getGwtMetaProperty(GWT_PROPERTY_RELEASE);
// FIXME, get this from user profile
- return new UserChatOptions(jid + "@" + chatOptions.domain, passwd, resource, "blue",
- SubscriptionMode.autoAcceptAll, true);
+ return new UserChatOptions(jid + "@" + chatOptions.domain, passwd, resource, "blue", SubscriptionMode.manual,
+ true);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManager.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManager.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -39,4 +39,6 @@
void sendMessage(Room room, String message);
+ void sendMessage(String userName, String message);
+
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -24,7 +24,11 @@
import java.util.Iterator;
import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.ConnectionConfiguration;
+import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.RosterEntry;
import org.jivesoftware.smack.XMPPConnection;
@@ -40,6 +44,7 @@
@Singleton
public class XmppManagerDefault implements XmppManager {
+ public static final Log log = LogFactory.getLog(XmppManagerDefault.class);
private final ChatProperties chatProperties;
@@ -78,7 +83,7 @@
}
- public Collection<RosterEntry> getRoster(ChatConnection conn) {
+ public Collection<RosterEntry> getRoster(final ChatConnection conn) {
XmppConnection xConn = (XmppConnection) conn;
Roster roster = xConn.getConn().getRoster();
return roster.getEntries();
@@ -123,6 +128,29 @@
}
}
+ public void sendMessage(final String userName, final String text) {
+ ChatConnection connection = login(chatProperties.getAdminJID(), chatProperties.getAdminPasswd(),
+ "kuneserveradmin" + System.currentTimeMillis());
+ XMPPConnection xmppConn = ((XmppConnection) connection).getConn();
+
+ String userJid = userName + "@" + chatProperties.getDomain();
+ Chat newChat = xmppConn.getChatManager().createChat(userJid, new MessageListener() {
+ public void processMessage(final Chat arg0, final Message arg1) {
+ log.info("Sended message: " + text);
+ }
+ });
+ try {
+ final Message message = new Message();
+ message.setFrom(chatProperties.getDomain());
+ message.setTo(userJid);
+ message.setBody(text);
+ newChat.sendMessage(message);
+ } catch (Exception e) {
+ log.error("Error Delivering xmpp message to " + userName);
+ }
+ xmppConn.disconnect();
+ }
+
private void configure(final MultiUserChat muc) throws XMPPException {
Form form = muc.getConfigurationForm();
Form answer = form.createAnswerForm();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -25,6 +25,7 @@
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
+import com.gwtext.client.core.Ext;
import com.gwtext.client.widgets.ToolTip;
import com.gwtext.client.widgets.form.Field;
@@ -55,7 +56,7 @@
}
public static String genQuickTipLabel(final String labelText, final String tipTitle, final String tipText,
- final AbstractImagePrototype icon, IconPosition iconPosition) {
+ final AbstractImagePrototype icon, final IconPosition iconPosition) {
String tipHtml = "<span style=\"vertical-align: middle;\" ext:qtip=\"" + tipText + "\"";
if (tipTitle != null && tipTitle.length() > 0) {
tipHtml += " ext:qtitle=\"" + tipTitle + "\"";
@@ -88,7 +89,7 @@
return tipHtml;
}
- public static String genQuickTipWithImage(String imageResizedUrl, int size) {
+ public static String genQuickTipWithImage(final String imageResizedUrl, final int size) {
return new Image(imageResizedUrl).toString();
}
@@ -131,4 +132,13 @@
public static void setQuickTip(final Widget widget, final String tip, final String tipTitle) {
setQuickTip(widget.getElement(), tip, tipTitle);
}
+
+ /**
+ * Disables text selection on element
+ *
+ * @param element
+ */
+ public static void setUnselectable(final Element element) {
+ Ext.get(element).unselectable();
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/InfoDialog.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/InfoDialog.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/InfoDialog.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -27,7 +27,7 @@
public class InfoDialog extends BasicDialog {
public InfoDialog(final String dialogId, final String title, final String header, final String text,
- final String okButtonText, String okButtonId, final boolean modal, final boolean autoScroll,
+ final String okButtonText, final String okButtonId, final boolean modal, final boolean autoScroll,
final int width, final int height) {
super(dialogId, title, modal, autoScroll, width, height);
final Button okButton = new Button(okButtonText);
@@ -35,7 +35,7 @@
okButton.addListener(new ButtonListenerAdapter() {
@Override
public void onClick(final Button button, final EventObject e) {
- hide();
+ destroy();
}
});
final Panel panel = new Panel();
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-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTELinkPopup.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -1,10 +1,13 @@
package org.ourproject.kune.platf.client.ui.rte.basic;
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 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;
@@ -16,22 +19,32 @@
public RTELinkPopup() {
hp = new HorizontalPanel();
hp.setSpacing(5);
+ KuneUiUtils.setUnselectable(hp.getElement());
+ Image close = new Image();
+ Images.App.getInstance().kuneClose().applyTo(close);
+ close.addClickListener(new ClickListener() {
+ public void onClick(final Widget sender) {
+ hide();
+ }
+ });
+ hp.add(close);
}
public void addAction(final ActionItem<Object> item, final Listener0 onClick) {
Label actionLabel = new Label();
actionLabel.setText(item.getAction().getText());
actionLabel.addStyleName("k-rte-changelink");
+ KuneUiUtils.setUnselectable(actionLabel.getElement());
actionLabel.addClickListener(new ClickListener() {
public void onClick(final Widget arg0) {
onClick.onEvent();
}
});
- hp.add(actionLabel);
+ hp.insert(actionLabel, 0);
}
public void hide() {
- if (popupPalette != null) {
+ if (isVisible()) {
popupPalette.hide();
}
}
@@ -47,10 +60,9 @@
public void show(final int left, final int top) {
popupPalette = new PopupPanel(false, false);
popupPalette.addStyleName("k-rte-changelink-popup");
- popupPalette.setVisible(false);
+ popupPalette.setWidget(hp);
popupPalette.show();
popupPalette.setPopupPosition(left, top);
- popupPalette.setWidget(hp);
popupPalette.setVisible(true);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -39,6 +39,8 @@
ActionToolbar<Object> getTopBar();
+ void reset();
+
void setExtended(boolean extended);
void setFocus(boolean focus);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPanel.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -28,6 +28,7 @@
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;
@@ -87,7 +88,11 @@
public void addCtxAction(final ActionItem<Object> actionItem) {
linkCtxMenu.addAction(actionItem, new Listener0() {
public void onEvent() {
- actionManager.doAction(actionItem);
+ DeferredCommand.addCommand(new Command() {
+ public void execute() {
+ actionManager.doAction(actionItem);
+ }
+ });
}
});
}
@@ -126,15 +131,13 @@
public LinkInfo getLinkInfoIfHref() {
LinkInfo linkinfo = null;
- org.xwiki.gwt.dom.client.Element selectedAnchor = LinkExecutableUtils.getSelectedAnchor(this);
+ org.xwiki.gwt.dom.client.Element selectedAnchor = selectAndGetLink();
if (selectedAnchor != null) {
- Range range = getDocument().createRange();
- range.selectNode(selectedAnchor);
- getSelection().addRange(range);
linkinfo = LinkInfo.parse(selectedAnchor);
} else {
linkinfo = new LinkInfo(getSelectionText());
}
+ Log.debug("Link info: " + linkinfo);
return linkinfo;
}
@@ -156,7 +159,6 @@
public void hideLinkCtxMenu() {
linkCtxMenu.hide();
-
}
public void insertBlockquote() {
@@ -320,6 +322,10 @@
basic.selectAll();
}
+ public void selectLink() {
+ selectAndGetLink();
+ }
+
public void setBackColor(final String color) {
basic.setBackColor(color);
}
@@ -422,6 +428,16 @@
}
}
+ private org.xwiki.gwt.dom.client.Element selectAndGetLink() {
+ org.xwiki.gwt.dom.client.Element selectedAnchor = LinkExecutableUtils.getSelectedAnchor(this);
+ if (selectedAnchor != null) {
+ Range range = getDocument().createRange();
+ range.selectNode(selectedAnchor);
+ getSelection().addRange(range);
+ }
+ return selectedAnchor;
+ }
+
private void updateLinkInfo() {
presenter.updateLinkInfo();
}
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-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -67,7 +67,7 @@
private final DeferredCommandWrapper deferred;
private final ActionAddCondition<Object> canBeBasic;
private final ActionAddCondition<Object> canBeExtended;
- private final Provider<ColorWebSafePalette> palette;
+ private final Provider<ColorWebSafePalette> paletteProvider;
private final Provider<InsertLinkDialog> insertLinkDialog;
private final Provider<EditHtmlDialog> editHtmlDialog;
private final Provider<InsertImageDialog> insertImageDialog;
@@ -81,6 +81,7 @@
private final Provider<InsertSpecialCharDialog> insertSpecialCharDialog;
protected Listener<String> insertSpecialCharListener;
private final Provider<InsertMediaDialog> insertMediaDialog;
+ protected ColorWebSafePalette palette;
public RTEditorPresenter(final I18nTranslationService i18n, final Session session,
final RTEActionTopToolbar topBar, final RTEActionSndToolbar sndBar, final RTEImgResources imgResources,
@@ -93,7 +94,7 @@
this.topBar = topBar;
this.sndBar = sndBar;
this.insertLinkDialog = textEditorInsertElement;
- this.palette = palette;
+ this.paletteProvider = palette;
this.editHtmlDialog = editHtmlDialog;
this.insertImageDialog = insertImageDialog;
this.insertMediaDialog = insertMediaDialog;
@@ -186,12 +187,14 @@
}
public void onEditorFocus() {
- topBar.hideAllMenus();
- sndBar.hideAllMenus();
- palette.get().hide();
+ hideMenus();
}
public void onLostFocus() {
+ }
+
+ public void reset() {
+ hideMenus();
hideLinkCtxMenu();
}
@@ -452,6 +455,7 @@
EditHtmlDialog dialog = editHtmlDialog.get();
dialog.setUpdateListener(updateHtmlListener);
dialog.show();
+ hideLinkCtxMenu();
dialog.setHtml(view.getHTML());
}
});
@@ -619,6 +623,7 @@
dialog.reset();
dialog.setOnCreateImage(insertImageListener);
dialog.show();
+ hideLinkCtxMenu();
}
});
}
@@ -651,6 +656,7 @@
InsertMediaDialog dialog = insertMediaDialog.get();
dialog.setOnCreate(insertMediaListener);
dialog.show();
+ hideLinkCtxMenu();
}
});
}
@@ -659,7 +665,6 @@
insertMedia.setTextDescription(i18n.t("Audio/Video..."));
insertMedia.setAddCondition(canBeExtended);
insertMedia.setParentMenuTitle(i18n.t(INSERT_MENU));
-
ActionToolbarButtonDescriptor<Object> createOrEditLinkBtn = new ActionToolbarButtonDescriptor<Object>(
accessRol, sndbarPosition, new Listener0() {
public void onEvent() {
@@ -681,6 +686,7 @@
dialog.setLinkInfo(linkInfo);
dialog.setOnCreateLink(insertLinkListener);
dialog.show();
+ hideLinkCtxMenu();
String href = linkInfo.getHref();
if (href.length() > 0) {
if (href.startsWith("mailto")) {
@@ -711,13 +717,23 @@
editLinkCtx.setToolTip(null);
editLinkCtx.setShortcut(null);
editLinkCtx.setActionPosition(linkCtxPosition);
- editLinkCtx.setParentMenuTitle(i18n.t(INSERT_MENU));
ActionToolbarButtonDescriptor<Object> removeLink = new ActionToolbarButtonDescriptor<Object>(accessRol,
sndbarPosition, new Listener0() {
public void onEvent() {
- view.unlink();
- fireOnEdit();
+ if (view.isAnythingSelected()) {
+ // we try to unlink the selection
+ } else {
+ // we try to select the complete link
+ view.selectLink();
+ }
+ deferred.addCommand(new Listener0() {
+ public void onEvent() {
+ view.unlink();
+ hideLinkCtxMenu();
+ fireOnEdit();
+ }
+ });
}
});
removeLink.setIconCls(getCssName(imgResources.linkbreak()));
@@ -730,7 +746,6 @@
removeLinkCtx.setToolTip(null);
removeLinkCtx.setShortcut(null);
removeLinkCtx.setActionPosition(linkCtxPosition);
- removeLinkCtx.setParentMenuTitle(i18n.t(INSERT_MENU));
final ActionToolbarMenuDescriptor<Object> removeFormat = new ActionToolbarMenuDescriptor<Object>(accessRol,
topbarPosition, new Listener0() {
@@ -772,6 +787,7 @@
}
insertSpecialCharDialog.get().setOnInsertSpecialChar(insertSpecialCharListener);
insertSpecialCharDialog.get().show();
+ hideLinkCtxMenu();
NotifyUser.hideProgress();
}
});
@@ -805,14 +821,16 @@
final ActionToolbarButtonDescriptor<Object> fontColor = new ActionToolbarButtonDescriptor<Object>(accessRol,
sndbarPosition, new Listener0() {
public void onEvent() {
- palette.get().show(getActionLeftPosition(sndBar, insertTableBtn),
- getActionTopPosition(sndBar, removeFormatBtn), new Listener<String>() {
- public void onEvent(final String color) {
- palette.get().hide();
- view.setForeColor(color);
- fireOnEdit();
- }
- });
+ getPalette();
+ palette.show(getActionLeftPosition(sndBar, insertTableBtn), getActionTopPosition(sndBar,
+ removeFormatBtn), new Listener<String>() {
+ public void onEvent(final String color) {
+ palette.hide();
+ view.setForeColor(color);
+ fireOnEdit();
+ }
+ });
+ hideLinkCtxMenu();
}
});
fontColor.setIconCls(getCssName(imgResources.fontcolor()));
@@ -822,14 +840,16 @@
ActionToolbarButtonDescriptor<Object> backgroundColor = new ActionToolbarButtonDescriptor<Object>(accessRol,
sndbarPosition, new Listener0() {
public void onEvent() {
- palette.get().show(getActionLeftPosition(sndBar, fontColor),
- getActionTopPosition(sndBar, fontColor), new Listener<String>() {
+ getPalette();
+ palette.show(getActionLeftPosition(sndBar, fontColor), getActionTopPosition(sndBar, fontColor),
+ new Listener<String>() {
public void onEvent(final String color) {
- palette.get().hide();
+ palette.hide();
view.setBackColor(color);
fireOnEdit();
}
});
+ hideLinkCtxMenu();
}
});
backgroundColor.setIconCls(getCssName(imgResources.backcolor()));
@@ -904,8 +924,8 @@
actions.add(withNoItem(fontColor));
actions.add(withNoItem(backgroundColor));
+ view.addCtxAction(withNoItem(removeLinkCtx));
view.addCtxAction(withNoItem(editLinkCtx));
- view.addCtxAction(withNoItem(removeLinkCtx));
}
private ActionToolbarMenuDescriptor<Object> createFontNameAction(final ActionAddCondition<Object> canBeBasic,
@@ -954,12 +974,26 @@
return RTEImgResources.SUFFIX + imageResource.getName();
}
+ 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();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorView.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -96,6 +96,8 @@
void selectAll();
+ void selectLink();
+
void setBackColor(String color);
void setFocus(boolean focus);
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-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -39,9 +39,9 @@
ActionToolbarButtonDescriptor<Object> saveBtn;
private RTESavingEditorView view;
- public RTESavingEditorPresenter(RTEditor editor, final boolean autoSave, final I18nTranslationService i18n,
- StateManager stateManager, DeferredCommandWrapper deferredCommandWrapper,
- RTEImgResources imgResources, TimerWrapper timer) {
+ public RTESavingEditorPresenter(final RTEditor editor, final boolean autoSave, final I18nTranslationService i18n,
+ final StateManager stateManager, final DeferredCommandWrapper deferredCommandWrapper,
+ final RTEImgResources imgResources, final TimerWrapper timer) {
this.editor = editor;
this.autoSave = autoSave;
this.i18n = i18n;
@@ -70,7 +70,7 @@
};
}
- public void edit(String html, Listener<String> onSave, Listener0 onEditCancelled) {
+ public void edit(final String html, final Listener<String> onSave, final Listener0 onEditCancelled) {
this.onSave = onSave;
this.onEditCancelled = onEditCancelled;
editor.setHtml(html);
@@ -87,7 +87,7 @@
return beforeStateChangeListener;
}
- public void init(RTESavingEditorView view) {
+ public void init(final RTESavingEditorView view) {
this.view = view;
}
@@ -214,7 +214,7 @@
ActionToolbarMenuDescriptor<Object> close = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
RTEditor.topbarPosition, new Listener<Object>() {
- public void onEvent(Object parameter) {
+ public void onEvent(final Object parameter) {
onCancel();
}
});
@@ -252,7 +252,7 @@
editor.addAction(saveCloseBtn);
}
- private void enableSaveBtn(boolean enable) {
+ private void enableSaveBtn(final boolean enable) {
editor.getSndBar().setButtonEnable(saveBtn, enable);
}
@@ -265,5 +265,6 @@
savePending = false;
saveAndCloseConfirmed = false;
enableSaveBtn(false);
+ editor.reset();
}
}
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-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -108,6 +108,9 @@
@Basic(optional = false)
private final Long createdOn;
+ @Basic
+ private Long lastLogin;
+
public User() {
this(null, null, null, null, null, null, null);
}
@@ -125,6 +128,7 @@
customProperties = new CustomProperties();
buddiesVisibility = UserBuddiesVisibility.anyone;
this.createdOn = System.currentTimeMillis();
+ this.setLastLogin(null);
}
@Finder(query = "from User")
@@ -174,6 +178,10 @@
return language;
}
+ public Long getLastLogin() {
+ return lastLogin;
+ }
+
public String getName() {
return name;
}
@@ -224,6 +232,10 @@
this.language = language;
}
+ public void setLastLogin(final Long lastLogin) {
+ this.lastLogin = lastLogin;
+ }
+
public void setName(final String name) {
this.name = name;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -34,6 +34,7 @@
import org.ourproject.kune.chat.server.managers.ChatConnection;
import org.ourproject.kune.chat.server.managers.XmppManager;
import org.ourproject.kune.platf.client.errors.I18nNotFoundException;
+import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
import org.ourproject.kune.platf.server.domain.I18nCountry;
import org.ourproject.kune.platf.server.domain.I18nLanguage;
import org.ourproject.kune.platf.server.domain.User;
@@ -54,17 +55,19 @@
private final I18nLanguageManager languageManager;
private final XmppManager xmppManager;
private final ChatProperties properties;
+ private final I18nTranslationService i18n;
@Inject
public UserManagerDefault(final Provider<EntityManager> provider, final User finder,
final I18nLanguageManager languageManager, final I18nCountryManager countryManager,
- final XmppManager xmppManager, ChatProperties properties) {
+ final XmppManager xmppManager, final ChatProperties properties, final I18nTranslationService i18n) {
super(provider, User.class);
this.finder = finder;
this.languageManager = languageManager;
this.countryManager = countryManager;
this.xmppManager = xmppManager;
this.properties = properties;
+ this.i18n = i18n;
}
public User createUser(final String shortName, final String longName, final String email, final String passwd,
@@ -85,7 +88,7 @@
return userId != null ? super.find(userId) : User.UNKNOWN_USER;
}
- public User findByShortname(String shortName) {
+ public User findByShortname(final String shortName) {
return finder.getByShortName(shortName);
}
@@ -143,6 +146,15 @@
}
}
if (user.getPassword().equals(passwd)) {
+ if (user.getLastLogin() == null) {
+ xmppManager.sendMessage(
+ user.getShortName(),
+ i18n.t("This is the chat window. \n"
+ + "\n"
+ + "Here you can communicate with other users of this site but also with other users with compatible accounts (like gmail accounts). \n"
+ + "\n" + "Just add some buddie and start to chat."));
+ }
+ user.setLastLogin(System.currentTimeMillis());
return user;
} else {
return null;
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/properties/ChatProperties.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/properties/ChatProperties.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/properties/ChatProperties.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -34,16 +34,23 @@
this.properties = properties;
}
- public String getHttpBase() {
- return properties.get(KuneProperties.CHAT_HTTP_BASE);
+ public String getAdminJID() {
+ return properties.get(KuneProperties.SITE_ADMIN_SHORTNAME);
}
+ public String getAdminPasswd() {
+ return properties.get(KuneProperties.SITE_ADMIN_PASSWD);
+ }
+
public String getDomain() {
return properties.get(KuneProperties.CHAT_DOMAIN);
}
+ public String getHttpBase() {
+ return properties.get(KuneProperties.CHAT_HTTP_BASE);
+ }
+
public String getRoomHost() {
return properties.get(KuneProperties.CHAT_ROOM_HOST);
}
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/properties/DatabaseProperties.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/properties/DatabaseProperties.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/properties/DatabaseProperties.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -34,31 +34,31 @@
this.properties = properties;
}
- public String getDefaultSiteShortName() {
- return properties.get("kune.default.site.shortName");
+ public String getAdminEmail() {
+ return properties.get(KuneProperties.SITE_ADMIN_EMAIL);
}
- public String getDefaultSiteName() {
- return properties.get("kune.default.site.name");
+ public String getAdminPassword() {
+ return properties.get(KuneProperties.SITE_ADMIN_PASSWD);
}
- public String getAdminUserName() {
- return properties.get("kune.admin.name");
+ public String getAdminShortName() {
+ return properties.get(KuneProperties.SITE_ADMIN_SHORTNAME);
}
- public String getAdminShortName() {
- return properties.get("kune.admin.shortName");
+ public String getAdminUserName() {
+ return properties.get(KuneProperties.SITE_ADMIN_NAME);
}
- public String getAdminEmail() {
- return properties.get("kune.admin.email");
+ public String getDefaultLicense() {
+ return properties.get(KuneProperties.SITE_DEF_LICENSE);
}
- public String getAdminPassword() {
- return properties.get("kune.admin.password");
+ public String getDefaultSiteName() {
+ return properties.get(KuneProperties.SITE_NAME);
}
- public String getDefaultLicense() {
- return properties.get("kune.default.license");
+ public String getDefaultSiteShortName() {
+ return properties.get(KuneProperties.SITE_SHORTNAME);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/properties/KuneProperties.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/properties/KuneProperties.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/properties/KuneProperties.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -22,6 +22,14 @@
public interface KuneProperties {
String SITE_URL = "kune.siteurl";
String SITE_DOMAIN = "kune.site.domain";
+ String SITE_NAME = "kune.default.site.name";
+ String SITE_SHORTNAME = "kune.default.site.shortName";
+ String SITE_DEF_LICENSE = "kune.default.license";
+
+ String SITE_ADMIN_NAME = "kune.admin.name";
+ String SITE_ADMIN_SHORTNAME = "kune.admin.shortName";
+ String SITE_ADMIN_EMAIL = "kune.admin.email";
+ String SITE_ADMIN_PASSWD = "kune.admin.password";
String DEFAULT_SITE_SHORT_NAME = "kune.default.site.shortName";
String CURRENT_CC_VERSION = "kune.currentccversion";
String CHAT_HTTP_BASE = "kune.chat.httpbase";
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-07 20:31:39 UTC (rev 1108)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/UserRPC.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -75,18 +75,18 @@
}
@Transactional(type = TransactionType.READ_WRITE, rollbackOn = DefaultException.class)
- public UserInfoDTO createUser(final UserDTO userDTO, boolean wantPersonalHomepage) throws DefaultException {
+ public UserInfoDTO createUser(final UserDTO userDTO, final boolean wantPersonalHomepage) throws DefaultException {
final User user = userManager.createUser(userDTO.getShortName(), userDTO.getName(), userDTO.getEmail(),
userDTO.getPassword(), userDTO.getLanguage().getCode(), userDTO.getCountry().getCode(),
userDTO.getTimezone().getId());
groupManager.createUserGroup(user, wantPersonalHomepage);
- return loginUser(user);
+ return login(userDTO.getShortName(), userDTO.getPassword());
}
@Authenticated
@Transactional(type = TransactionType.READ_ONLY)
@Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
- public String getUserAvatarBaser64(final String userHash, StateToken userToken) throws DefaultException {
+ public String getUserAvatarBaser64(final String userHash, final StateToken userToken) throws DefaultException {
final UserSession userSession = getUserSession();
final User user = userSession.getUser();
Group userGroup = user.getUserGroup();
@@ -133,7 +133,8 @@
@Authenticated(mandatory = true)
@Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
@Transactional(type = TransactionType.READ_WRITE)
- public void setBuddiesVisibility(final String userHash, StateToken groupToken, UserBuddiesVisibilityDTO visibility) {
+ public void setBuddiesVisibility(final String userHash, final StateToken groupToken,
+ final UserBuddiesVisibilityDTO visibility) {
final UserSession userSession = getUserSession();
final User user = userSession.getUser();
if (groupToken.getGroup() != user.getShortName()) {
Modified: trunk/src/test/java/org/ourproject/kune/chat/server/managers/XmppManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/chat/server/managers/XmppManagerTest.java 2009-05-07 20:31:39 UTC (rev 1108)
+++ trunk/src/test/java/org/ourproject/kune/chat/server/managers/XmppManagerTest.java 2009-05-11 20:23:46 UTC (rev 1109)
@@ -13,9 +13,7 @@
import com.google.inject.Inject;
public class XmppManagerTest {
-
public static class OutputListener implements RoomListener {
- Log log = LogFactory.getLog(OutputListener.class);
private final String name;
private int hits;
@@ -36,6 +34,8 @@
}
+ static Log log = LogFactory.getLog(XmppManagerTest.class);
+
@Inject
XmppManager manager;
@@ -81,6 +81,11 @@
assertNotNull(manager.getRoster(handler));
}
+ @Test
+ public void testSendMessage() {
+ manager.sendMessage("admin", "test message");
+ }
+
@Test(expected = ChatException.class)
public void testUserDontExist() {
manager.login("user", "passowrd", "test");
1
0
07 May '09
Author: vjrj
Date: 2009-05-07 22:31:39 +0200 (Thu, 07 May 2009)
New Revision: 1108
Modified:
trunk/pom.xml
trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nLanguage.java
trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java
trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntityWorkspace.java
Log:
Complete - task Languages are not sorted by lang name
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-05-07 15:41:11 UTC (rev 1107)
+++ trunk/pom.xml 2009-05-07 20:31:39 UTC (rev 1108)
@@ -447,7 +447,7 @@
<version>2.0-beta26</version>
<configuration>
<logLevel>INFO</logLevel>
- <style>PRETTY</style>
+ <style>OBF</style>
<!-- <style>OBF PRETTY</style> -->
<runTarget>
org.ourproject.kune.app.Kune/Kune.html
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nLanguage.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nLanguage.java 2009-05-07 15:41:11 UTC (rev 1107)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/I18nLanguage.java 2009-05-07 20:31:39 UTC (rev 1108)
@@ -152,7 +152,7 @@
return null;
}
- @Finder(query = "FROM I18nLanguage")
+ @Finder(query = "FROM I18nLanguage ORDER BY englishName")
public List<I18nLanguage> getAll() {
return null;
}
@@ -234,11 +234,11 @@
this.code = code;
}
- public void setDateFormat(String dateFormat) {
+ public void setDateFormat(final String dateFormat) {
this.dateFormat = dateFormat;
}
- public void setDateFormatShort(String dateFormatShort) {
+ public void setDateFormatShort(final String dateFormatShort) {
this.dateFormatShort = dateFormatShort;
}
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-07 15:41:11 UTC (rev 1107)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java 2009-05-07 20:31:39 UTC (rev 1108)
@@ -45,9 +45,11 @@
public EntityHeaderPanel(final WorkspaceSkeleton ws, final Provider<FileDownloadUtils> downloadProvider,
final Images images) {
+ super.setWidth("100%");
this.downloadProvider = downloadProvider;
this.images = images;
vp = new VerticalPanel();
+ vp.setWidth("100%");
vp.setHorizontalAlignment(ALIGN_RIGHT);
entityTextLogo = new EntityTextLogo();
add(entityTextLogo);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java 2009-05-07 15:41:11 UTC (rev 1107)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java 2009-05-07 20:31:39 UTC (rev 1108)
@@ -93,12 +93,12 @@
// }, "Bla, bla, bla"));
panel.addListener(new ContainerListenerAdapter() {
@Override
- public void onHide(Component component) {
+ public void onHide(final Component component) {
openFirstIfActiveNotVisible();
}
@Override
- public void onShow(Component component) {
+ public void onShow(final Component component) {
openFirstIfActiveNotVisible();
}
@@ -156,12 +156,12 @@
return trayBar;
}
- public void setMaximized(boolean maximized) {
+ public void setMaximized(final boolean maximized) {
entitySummary.setVisible(!maximized);
if (maximized) {
- mainFitPanel.collapse();
+ mainFitPanel.collapse(true);
} else {
- mainFitPanel.expand();
+ mainFitPanel.expand(true);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntityWorkspace.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntityWorkspace.java 2009-05-07 15:41:11 UTC (rev 1107)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntityWorkspace.java 2009-05-07 20:31:39 UTC (rev 1108)
@@ -155,7 +155,7 @@
context.addListener(listener);
}
- public void addListener(ContainerListenerAdapter containerListenerAdapter) {
+ public void addListener(final ContainerListenerAdapter containerListenerAdapter) {
cntCtxBorderLayout.addListener(containerListenerAdapter);
}
@@ -221,11 +221,11 @@
setPanel(context, widget);
}
- public void setMaximized(boolean maximized) {
+ public void setMaximized(final boolean maximized) {
if (maximized) {
- contextWrap.collapse();
+ contextWrap.collapse(true);
} else {
- contextWrap.expand();
+ contextWrap.expand(true);
}
}
@@ -248,7 +248,7 @@
context.addStyleName("k-entity-context-" + newTheme);
}
- private void setPanel(Panel panel, Widget widget) {
+ private void setPanel(final Panel panel, final Widget widget) {
panel.clear();
panel.add(widget);
if (panel.isRendered()) {
1
0
Author: vjrj
Date: 2009-05-07 17:41:11 +0200 (Thu, 07 May 2009)
New Revision: 1107
Added:
trunk/src/main/java/org/ourproject/kune/platf/public/ext-load.gif
Modified:
trunk/CREDITS
trunk/DEV-GUIDE
trunk/TODO
trunk/pom.xml
trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderButton.java
trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/options/tools/EntityOptionsToolsConfPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterForm.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java
Log:
Complete - task Group/user options hide bug
Modified: trunk/CREDITS
===================================================================
--- trunk/CREDITS 2009-05-03 15:08:43 UTC (rev 1106)
+++ trunk/CREDITS 2009-05-07 15:41:11 UTC (rev 1107)
@@ -11,12 +11,13 @@
Contributors
--------------------------------------------------------------------------------
+* Thanks to David Trigo and http://www.esperanto-es.net/ for suggest the name of
+'kune' for our initiative:
+ http://ourproject.org/forum/forum.php?thread_id=500&forum_id=469
* Antonio Martins, Jéferson Assumção, Moacir Gadotti and the Instituto Paulo
Freire staff.
* Daniel Jiménez for the initial help and coordination
* Javier de la Cueva and Leovigildo García-Bobadilla for the legal support
* Jonathan Araña Cruz, Roxu and all the xsto staff for help with the infraestructure
-* Thanks to David Trigo and http://www.esperanto-es.net/ for suggest the name of
-'kune' for our initiative:
- http://ourproject.org/forum/forum.php?thread_id=500&forum_id=469
+* Johnattan Rupire for web contributions.
* and ourproject.org and again xsto.info for sharing with us their resources
Modified: trunk/DEV-GUIDE
===================================================================
--- trunk/DEV-GUIDE 2009-05-03 15:08:43 UTC (rev 1106)
+++ trunk/DEV-GUIDE 2009-05-07 15:41:11 UTC (rev 1107)
@@ -181,7 +181,7 @@
mvn com.totsp.gwt:maven-googlewebtoolkit2-plugin:gwt
-Also, you can generate a hosted mode launch configuration in eclipse. We have a "Run configuration" (Run > Open Run Dialog) in eclipse with Project: "org.ourproject.kune" with Main class: "com.google.gwt.dev.GWTShell", with this program arguments (or similar): "-noserver -out gwt-out /kune/?locale=en&log_level=INFO -port 8080" and in the "Classpath User Entries":
+Also, you can generate a hosted mode launch configuration in eclipse. We have a "Run configuration" (Run > Open Run Dialog) in eclipse with Project: "org.ourproject.kune" with Main class: "com.google.gwt.dev.GWTShell", with this program arguments (or similar): "-noserver -out gwt-out /ws/?locale=en&log_level=INFO -port 8080" and in the "Classpath User Entries":
* gwt-dev-[linux|mac|windows].jar (Add External Jar and choose it from your gwt installation directory)
* java - /kune/src/main
* kune (default classpath)
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2009-05-03 15:08:43 UTC (rev 1106)
+++ trunk/TODO 2009-05-07 15:41:11 UTC (rev 1107)
@@ -119,6 +119,7 @@
** vjrj <v> IconHyperlink.java and IconLabel.java to gwt1.5
* MID-TERM
+** TODO <v> Use of command key ⌘ for Mac shortcuts
** TODO <v,s> harden our privacy policy. Goals:
- permit user/projects/contents how much private or public are
- APIs public only to associated sites (in study) ( http://oauth.net ? )
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-05-03 15:08:43 UTC (rev 1106)
+++ trunk/pom.xml 2009-05-07 15:41:11 UTC (rev 1107)
@@ -447,7 +447,7 @@
<version>2.0-beta26</version>
<configuration>
<logLevel>INFO</logLevel>
- <style>OBF</style>
+ <style>PRETTY</style>
<!-- <style>OBF PRETTY</style> -->
<runTarget>
org.ourproject.kune.app.Kune/Kune.html
Added: trunk/src/main/java/org/ourproject/kune/platf/public/ext-load.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/ext-load.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderButton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderButton.java 2009-05-03 15:08:43 UTC (rev 1106)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderButton.java 2009-05-07 15:41:11 UTC (rev 1107)
@@ -6,12 +6,12 @@
import com.google.gwt.user.client.ui.AbstractImagePrototype;
public class EntityHeaderButton extends IconLabel implements View {
- public EntityHeaderButton(AbstractImagePrototype icon, String text) {
+ public EntityHeaderButton(final AbstractImagePrototype icon, final String text) {
super(icon, text, false);
setDefStyle();
}
- public EntityHeaderButton(String text, AbstractImagePrototype icon) {
+ public EntityHeaderButton(final String text, final AbstractImagePrototype icon) {
super(text, icon, false);
setDefStyle();
}
@@ -19,6 +19,7 @@
private void setDefStyle() {
addStyleName("kune-Margin-Medium-t");
addStyleName("kune-pointer");
+ addStyleName("kune-floatright");
}
}
\ No newline at end of file
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-03 15:08:43 UTC (rev 1106)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java 2009-05-07 15:41:11 UTC (rev 1107)
@@ -44,12 +44,10 @@
private final VerticalPanel vp;
public EntityHeaderPanel(final WorkspaceSkeleton ws, final Provider<FileDownloadUtils> downloadProvider,
- Images images) {
+ final Images images) {
this.downloadProvider = downloadProvider;
this.images = images;
vp = new VerticalPanel();
- vp.setWidth("100%");
- super.setWidth("100%");
vp.setHorizontalAlignment(ALIGN_RIGHT);
entityTextLogo = new EntityTextLogo();
add(entityTextLogo);
@@ -57,13 +55,12 @@
ws.addToEntityMainHeader(this);
}
- public void addWidget(View view) {
+ public void addWidget(final View view) {
Widget widget = (Widget) view;
vp.add(widget);
- vp.setCellWidth(widget, "100%");
}
- public void reloadImage(GroupDTO group) {
+ public void reloadImage(final GroupDTO group) {
entityTextLogo.setLogoImage(downloadProvider.get().getLogoImageUrl(group.getStateToken()) + "&nocache="
+ new Date().getTime());
}
@@ -87,11 +84,11 @@
entityTextLogo.setLargeFont();
}
- public void setLogoImage(StateToken stateToken) {
+ public void setLogoImage(final StateToken stateToken) {
entityTextLogo.setLogoImage(downloadProvider.get().getLogoImageUrl(stateToken));
}
- public void setLogoImageVisible(boolean visible) {
+ public void setLogoImageVisible(final boolean visible) {
entityTextLogo.setLogoVisible(visible);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java 2009-05-03 15:08:43 UTC (rev 1106)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java 2009-05-07 15:41:11 UTC (rev 1107)
@@ -32,7 +32,7 @@
public class EntityOptionsPanel extends AbstractTabbedDialogPanel implements EntityOptionsView {
- public static final String ENTITY_OP_PANEL_ID = "k-eop-diag";
+ public static final String ENTITY_OP_PANEL_ID = "k-eop-diagpan";
public static final String GROUP_OPTIONS_ERROR_ID = "k-eop-err-mess";
public static final String GROUP_OPTIONS_ICON = "k-eop-icon";
private final I18nTranslationService i18n;
@@ -43,7 +43,7 @@
private final EntityOptionsGroup entityPreferencesGroup;
public EntityOptionsPanel(final EntityOptions presenter, final EntityHeader entityHeader,
- I18nTranslationService i18n, Images images, EntityOptionsGroup entityOptionsGroup) {
+ final I18nTranslationService i18n, final Images images, final EntityOptionsGroup entityOptionsGroup) {
super(ENTITY_OP_PANEL_ID, "", 400, HEIGHT + 80, 400, HEIGHT + 80, false, images, GROUP_OPTIONS_ERROR_ID);
this.entityHeader = entityHeader;
this.i18n = i18n;
@@ -60,7 +60,7 @@
super.createAndShow();
}
- public void setButtonVisible(boolean visible) {
+ public void setButtonVisible(final boolean visible) {
optionsButton.setVisible(visible);
}
@@ -77,7 +77,7 @@
private void createOptionsButton() {
optionsButton = new EntityHeaderButton("", images.emblemSystem());
optionsButton.addClickListener(new ClickListener() {
- public void onClick(Widget arg0) {
+ public void onClick(final Widget arg0) {
createAndShow();
}
});
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPresenter.java 2009-05-03 15:08:43 UTC (rev 1106)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPresenter.java 2009-05-07 15:41:11 UTC (rev 1107)
@@ -41,7 +41,7 @@
view.setButtonVisible(true);
} else {
view.setButtonVisible(false);
- view.destroy();
+ view.hide();
}
}
});
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsView.java 2009-05-03 15:08:43 UTC (rev 1106)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsView.java 2009-05-07 15:41:11 UTC (rev 1107)
@@ -19,10 +19,9 @@
*/
package org.ourproject.kune.workspace.client.options;
-import org.ourproject.kune.platf.client.View;
import org.ourproject.kune.platf.client.ui.dialogs.tabbed.AbstractTabbedDialogView;
-public interface EntityOptionsView extends View, AbstractTabbedDialogView {
+public interface EntityOptionsView extends AbstractTabbedDialogView {
int HEIGHT = 270;
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/tools/EntityOptionsToolsConfPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/options/tools/EntityOptionsToolsConfPresenter.java 2009-05-03 15:08:43 UTC (rev 1106)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/tools/EntityOptionsToolsConfPresenter.java 2009-05-07 15:41:11 UTC (rev 1107)
@@ -45,15 +45,16 @@
private final I18nTranslationService i18n;
private final StateManager stateManager;
- public EntityOptionsToolsConfPresenter(StateManager stateManager, Session session, I18nTranslationService i18n,
- EntityOptions entityOptions, Provider<GroupServiceAsync> groupServiceProvider) {
+ public EntityOptionsToolsConfPresenter(final StateManager stateManager, final Session session,
+ final I18nTranslationService i18n, final EntityOptions entityOptions,
+ final Provider<GroupServiceAsync> groupServiceProvider) {
this.stateManager = stateManager;
this.session = session;
this.i18n = i18n;
this.entityOptions = entityOptions;
this.groupServiceProvider = groupServiceProvider;
stateManager.onGroupChanged(new Listener2<String, String>() {
- public void onEvent(String group1, String group2) {
+ public void onEvent(final String group1, final String group2) {
setState();
}
});
@@ -63,13 +64,13 @@
return view;
}
- public void init(EntityOptionsToolsConfView view) {
+ public void init(final EntityOptionsToolsConfView view) {
this.view = view;
setState();
entityOptions.addTab(view);
}
- public void onCheck(ToolSimpleDTO tool, boolean checked) {
+ public void onCheck(final ToolSimpleDTO tool, final boolean checked) {
StateAbstractDTO state = session.getCurrentState();
String toolName = tool.getName();
if (checked) {
@@ -126,12 +127,12 @@
private void setToolCheckedInServer(final boolean checked, final String toolName) {
groupServiceProvider.get().setToolEnabled(session.getUserHash(), session.getCurrentStateToken(), toolName,
checked, new AsyncCallback<Object>() {
- public void onFailure(Throwable caught) {
+ public void onFailure(final Throwable caught) {
view.setChecked(toolName, !checked);
entityOptions.setErrorMessage(i18n.t("Error configuring the tool"), Level.error);
}
- public void onSuccess(Object result) {
+ public void onSuccess(final Object result) {
stateManager.reload();
}
});
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterForm.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterForm.java 2009-05-03 15:08:43 UTC (rev 1106)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterForm.java 2009-05-07 15:41:11 UTC (rev 1107)
@@ -217,7 +217,7 @@
add(timezoneCombo);
final FieldSet personalSpaceFieldSet = new FieldSet(i18n.t("Do you want a personal homepage?"));
- personalSpaceFieldSet.setWidth(DEF_FIELD_WIDTH + DEF_FIELD_LABEL_WITH);
+ personalSpaceFieldSet.setWidth(DEF_FIELD_WIDTH + DEF_FIELD_LABEL_WITH + 65);
wantPersonalHomePage = new Radio();
wantPersonalHomePage.setTabIndex(9);
noPersonalHomePage = new Radio();
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-03 15:08:43 UTC (rev 1106)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java 2009-05-07 15:41:11 UTC (rev 1107)
@@ -47,9 +47,9 @@
public static final String WELCOME_DIALOG = "k-regp-wdiag";
public static final String REGISTER_DIALOG = "k-regp-dialog";
- public RegisterPanel(final RegisterPresenter presenter, I18nTranslationService i18n, final WorkspaceSkeleton ws,
- Session session, Images images) {
- super(REGISTER_DIALOG, i18n, i18n.t(PlatfMessages.REGISTER_TITLE), true, true, 390, 450, "",
+ public RegisterPanel(final RegisterPresenter presenter, final I18nTranslationService i18n,
+ final WorkspaceSkeleton ws, final Session session, final Images images) {
+ super(REGISTER_DIALOG, i18n, i18n.t(PlatfMessages.REGISTER_TITLE), true, true, 400, 420, "",
i18n.t(PlatfMessages.REGISTER_TITLE), REGISTER_BUTTON_ID, i18n.tWithNT("Cancel", "used in button"),
CANCEL_BUTTON_ID, new Listener0() {
public void onEvent() {
@@ -65,17 +65,17 @@
}, images, ERRMSG, 11);
super.addListener(new WindowListenerAdapter() {
@Override
- public void onActivate(Panel panel) {
+ public void onActivate(final Panel panel) {
KuneUiUtils.focusOnField(registerForm.getShortNameField());
}
@Override
- public void onHide(Component component) {
+ public void onHide(final Component component) {
presenter.onClose();
}
@Override
- public void onShow(Component component) {
+ public void onShow(final Component component) {
KuneUiUtils.focusOnField(registerForm.getShortNameField());
}
});
@@ -83,7 +83,7 @@
Panel panel = new Panel();
panel.setBorder(false);
registerForm = new RegisterForm(i18n, session);
- registerForm.setWidth(360);
+ registerForm.setWidth(370);
panel.add(registerForm.getFormPanel());
add(panel);
panel.setId(REGISTER_FORM);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePanel.java 2009-05-03 15:08:43 UTC (rev 1106)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePanel.java 2009-05-07 15:41:11 UTC (rev 1107)
@@ -70,10 +70,4 @@
});
}
}
-
- @Override
- public void setVisible(final boolean visible) {
- super.setVisible(visible);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java 2009-05-03 15:08:43 UTC (rev 1106)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java 2009-05-07 15:41:11 UTC (rev 1107)
@@ -90,11 +90,6 @@
private void setState(final StateAbstractDTO state) {
setTheme(new WsTheme(state.getGroup().getWorkspaceTheme()));
- if (state.getGroupRights().isAdministrable()) {
- view.setVisible(true);
- } else {
- view.setVisible(false);
- }
}
private void setTheme(final WsTheme newTheme) {
1
0