Author: vjrj_ Date: 2011-09-24 20:46:13 +0200 (Sat, 24 Sep 2011) New Revision: 1531 Added: trunk/src/test/java/cc/kune/selenium/CustomWebDriverEventListener.java trunk/src/test/java/cc/kune/selenium/PageObjectModule.java trunk/src/test/java/cc/kune/selenium/SeleniumModule.java trunk/src/test/java/cc/kune/selenium/login/AbstractLoginObject.java trunk/src/test/java/cc/kune/selenium/login/EntityHeaderPageObject.java trunk/src/test/java/cc/kune/selenium/login/RegisterPageObject.java trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java Removed: trunk/src/main/java/org/ourproject/kune/app/public/ trunk/src/main/java/org/ourproject/kune/chat/ trunk/src/main/java/org/ourproject/kune/gallery/KuneGallery.gwt.xml trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryMessages.java trunk/src/main/java/org/ourproject/kune/gallery/client/cnt/ trunk/src/main/java/org/ourproject/kune/gallery/client/ctx/ trunk/src/main/java/org/ourproject/kune/gallery/public/ trunk/src/main/java/org/ourproject/kune/gallery/server/ trunk/src/main/java/org/ourproject/kune/platf/KunePlatform.gwt.xml trunk/src/main/java/org/ourproject/kune/platf/RichText.gwt.xml trunk/src/main/java/org/ourproject/kune/platf/client/View.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractExtendedAction.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/Action.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionAddCondition.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCheckedCondition.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollection.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEnableCondition.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEvent.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionItem.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionItemCollection.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionListener.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionManager.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionPressedCondition.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.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/ActionToolbarButtonSeparator.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/ActionToolbarPosition.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPushButtonDescriptor.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ChangebleObject.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/MenuItemsContainer.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/OldAbstractAction.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/RadioMustBeChecked.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/Shortcut.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/common/ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/ trunk/src/main/java/org/ourproject/kune/platf/client/app/ trunk/src/main/java/org/ourproject/kune/platf/client/i18n/ trunk/src/main/java/org/ourproject/kune/platf/client/services/ trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractLabel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractSearcherPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractToolbar.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/ContextPropertyPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultGrid.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableClickListener.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/FlowToolbar.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/HasColor.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/HorizontalLine.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/KuneStringUtils.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/MenuItem.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItemCollection.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/QuickTipsHelper.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/RoundedPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/SimpleToolbar.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/AbstractPopupPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/BasicDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/BasicPopupPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultForm.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultFormUtils.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultTabbedForm.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/ExtendedDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/InfoDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialogView.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardListener.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/tabbed/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/form/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/imgchooser/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/noti/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RichTextArea.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/TestRTEDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplIE6.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplMozilla.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplOpera.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplSafari.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlAgent.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPresenter.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/edithtml/EditHtmlGroup.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/editor/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/preview/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/img/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/ 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/InsertImageDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogView.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageGroup.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ext/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogView.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkGroup.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/LinkExecutableUtils.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/insertlink/abstractlink/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/email/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/ext/ 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/InsertMediaDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogView.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaGroup.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ext/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialogPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialogPresenter.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/InsertSpecialCharGroup.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/asian/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/occidental/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/inserttable/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/ trunk/src/main/java/org/ourproject/kune/platf/public/ trunk/src/main/java/org/ourproject/kune/wiki/ trunk/src/main/java/org/ourproject/kune/workspace/client/ActionsModule.java trunk/src/main/java/org/ourproject/kune/workspace/client/OldAbstractFoldableContentActions.java trunk/src/main/java/org/ourproject/kune/workspace/client/RegistryModule.java trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceMessages.java trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorView.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocallink/ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalmedia/ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeader.java 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/entityheader/EntityHeaderPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderView.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/maxmin/ trunk/src/main/java/org/ourproject/kune/workspace/client/hello/ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/ trunk/src/main/java/org/ourproject/kune/workspace/client/search/ trunk/src/main/java/org/ourproject/kune/workspace/client/site/ trunk/src/main/java/org/ourproject/kune/workspace/client/skel/ trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ trunk/src/main/java/org/ourproject/kune/workspace/client/upload/ trunk/src/test/java/cc/kune/selenium/tools/AbstractWebDriver.java trunk/src/test/java/cc/kune/selenium/tools/GenericWebDriver.java trunk/src/test/java/cc/kune/selenium/tools/PageObjectModule.java trunk/src/test/java/cc/kune/selenium/tools/SeleniumModule.java trunk/src/test/java/org/ourproject/kune/gallery/server/ trunk/src/test/java/org/ourproject/kune/platf/client/actions/ trunk/src/test/java/org/ourproject/kune/platf/client/dto/ trunk/src/test/java/org/ourproject/kune/platf/client/ui/KuneStringUtilsTest.java trunk/src/test/java/org/ourproject/kune/platf/client/ui/TextUtilsTest.java trunk/src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload/ trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/saving/ trunk/src/test/java/org/ourproject/kune/platf/client/utils/ trunk/src/test/java/org/ourproject/kune/workspace/client/entityheader/ trunk/src/test/java/org/ourproject/kune/workspace/client/socialnet/ Modified: trunk/.classpath trunk/pom.xml trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java trunk/src/main/java/cc/kune/common/client/actions/AbstractExtendedAction.java trunk/src/main/java/cc/kune/common/client/actions/Action.java trunk/src/main/java/cc/kune/common/client/actions/BaseAction.java trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java trunk/src/main/java/cc/kune/core/client/auth/AnonUsersManager.java trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java trunk/src/main/java/cc/kune/msgs/client/UserMessage.java trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java trunk/src/test/java/cc/kune/selenium/PageObject.java trunk/src/test/java/cc/kune/selenium/login/LoginPageObject.java trunk/src/test/java/cc/kune/selenium/login/LoginSeleniumTests.java trunk/src/test/java/cc/kune/selenium/tools/SeleniumConstants.java Log: NEW - # 53: Add Selenium Framework testing http://kune.ourproject.org/issues/ticket/53 And some clean-up of org.ourproject package Modified: trunk/.classpath =================================================================== --- trunk/.classpath 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/.classpath 2011-09-24 18:46:13 UTC (rev 1531) @@ -154,5 +154,6 @@ <classpathentry kind="var" path="M2_REPO/com/thoughtworks/xstream/xstream/1.2.2/xstream-1.2.2.jar" sourcepath="M2_REPO/com/thoughtworks/xstream/xstream/1.2.2/xstream-1.2.2-sources.jar"/> <classpathentry kind="var" path="M2_REPO/org/xwiki/platform/xwiki-web-gwt-dom/2.3-rc-1/xwiki-web-gwt-dom-2.3-rc-1.jar" sourcepath="M2_REPO/org/xwiki/platform/xwiki-web-gwt-dom/2.3-rc-1/xwiki-web-gwt-dom-2.3-rc-1-sources.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="src" path=".apt_generated" including="**/*.java"/> <classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/> </classpath> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/pom.xml 2011-09-24 18:46:13 UTC (rev 1531) @@ -562,17 +562,17 @@ <dependency> <groupId>org.waveprotocol</groupId> <artifactId>waveinabox-server-0.3</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>org.waveprotocol</groupId> <artifactId>proto-msg</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>org.waveprotocol</groupId> <artifactId>gwt-util-src</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>com.google.guava</groupId> @@ -582,67 +582,67 @@ <dependency> <groupId>org.waveprotocol</groupId> <artifactId>box</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>org.waveprotocol</groupId> <artifactId>box-src</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>org.waveprotocol</groupId> <artifactId>model-src</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>org.waveprotocol</groupId> <artifactId>client</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>org.waveprotocol</groupId> <artifactId>client-src</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>org.waveprotocol</groupId> <artifactId>client-common</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>org.waveprotocol</groupId> <artifactId>client-common-src</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>org.waveprotocol</groupId> <artifactId>common-src</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>org.waveprotocol</groupId> <artifactId>util-src</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>org.waveprotocol</groupId> <artifactId>concurrencycontrol-src</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>org.waveprotocol</groupId> <artifactId>client-scheduler-src</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>org.waveprotocol</groupId> <artifactId>media-src</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>org.waveprotocol</groupId> <artifactId>communication-src</artifactId> - <version>0.3.2-SNAPSHOT</version> + <version>0.3.2</version> </dependency> <dependency> <groupId>net.sourceforge.findbugs</groupId> Modified: trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java =================================================================== --- trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -255,7 +255,7 @@ chatIcon.setId(CHAT_CLIENT_ICON_ID); chatIcon.setStyles("k-no-backimage, k-btn-sitebar, k-chat-icon"); chatIcon.putValue(Action.NAME, i18n.t(CHAT_TITLE)); - chatIcon.putValue(Action.SHORT_DESCRIPTION, i18n.t("Show/hide the chat window")); + chatIcon.putValue(Action.TOOLTIP, i18n.t("Show/hide the chat window")); final KeyStroke shortcut = Shortcut.getShortcut(false, true, false, false, Character.valueOf('C')); shorcutRegister.put(shortcut, action); action.setShortcut(shortcut); Modified: trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java =================================================================== --- trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -71,7 +71,7 @@ } }); putValue(Action.NAME, i18n.t("Group's public room")); - putValue(Action.SHORT_DESCRIPTION, i18n.t("Enter to this group public chat room")); + putValue(Action.TOOLTIP, i18n.t("Enter to this group public chat room")); putValue(Action.SMALL_ICON, res.groupChat()); setInviteMembersImpl(false); } Modified: trunk/src/main/java/cc/kune/common/client/actions/AbstractExtendedAction.java =================================================================== --- trunk/src/main/java/cc/kune/common/client/actions/AbstractExtendedAction.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/common/client/actions/AbstractExtendedAction.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -40,17 +40,17 @@ public AbstractExtendedAction(final String text, final String tooltip, final String iconCls) { super(); super.putValue(Action.NAME, text); - super.putValue(Action.SHORT_DESCRIPTION, tooltip); + super.putValue(Action.TOOLTIP, tooltip); super.putValue(Action.SMALL_ICON, iconCls); } public AbstractExtendedAction withIcon(final ImageResource icon) { - super.putValue(Action.SHORT_DESCRIPTION, icon); + super.putValue(Action.TOOLTIP, icon); return this; } public AbstractExtendedAction withIconCls(final String icon) { - super.putValue(Action.SHORT_DESCRIPTION, icon); + super.putValue(Action.TOOLTIP, icon); return this; } @@ -60,7 +60,7 @@ } public AbstractExtendedAction withToolTip(final String tooltip) { - super.putValue(Action.SHORT_DESCRIPTION, tooltip); + super.putValue(Action.TOOLTIP, tooltip); return this; } } \ No newline at end of file Modified: trunk/src/main/java/cc/kune/common/client/actions/Action.java =================================================================== --- trunk/src/main/java/cc/kune/common/client/actions/Action.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/common/client/actions/Action.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -87,7 +87,7 @@ * 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"; + String TOOLTIP = "ShortDescription"; /** * A key to access the icon for the action. @@ -129,7 +129,7 @@ /** * 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}, + * are defined in this interface: {@link #NAME}, {@link #TOOLTIP}, * {@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. Modified: trunk/src/main/java/cc/kune/common/client/actions/BaseAction.java =================================================================== --- trunk/src/main/java/cc/kune/common/client/actions/BaseAction.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/common/client/actions/BaseAction.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -25,20 +25,20 @@ public BaseAction(final String text, final String tooltip) { super(); super.putValue(Action.NAME, text); - super.putValue(Action.SHORT_DESCRIPTION, tooltip); + super.putValue(Action.TOOLTIP, tooltip); } 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.TOOLTIP, tooltip); super.putValue(Action.SMALL_ICON, icon); } public BaseAction(final String text, final String tooltip, final String icon) { super(); super.putValue(Action.NAME, text); - super.putValue(Action.SHORT_DESCRIPTION, tooltip); + super.putValue(Action.TOOLTIP, tooltip); super.putValue(Action.SMALL_ICON, icon); } Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java =================================================================== --- trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -75,7 +75,7 @@ private void configureProperties() { setText((String) (descriptor.getValue(Action.NAME))); - setToolTipText((String) (descriptor.getValue(Action.SHORT_DESCRIPTION))); + setToolTipText((String) (descriptor.getValue(Action.TOOLTIP))); setIcon(descriptor.getValue(Action.SMALL_ICON)); setEnabled((Boolean) descriptor.getValue(AbstractAction.ENABLED)); setVisible((Boolean) descriptor.getValue(GuiActionDescrip.VISIBLE)); @@ -97,7 +97,7 @@ setText((String) newValue); } else if (event.getPropertyName().equals(Action.SMALL_ICON)) { setIcon(newValue); - } else if (event.getPropertyName().equals(Action.SHORT_DESCRIPTION)) { + } else if (event.getPropertyName().equals(Action.TOOLTIP)) { setToolTipText((String) newValue); } else if (event.getPropertyName().equals(GuiActionDescrip.VISIBLE)) { setVisible((Boolean) newValue); Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java =================================================================== --- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -253,7 +253,7 @@ @Override public String toString() { final String name = (String) getValue(Action.NAME); - final String tooltip = (String) getValue(Action.SHORT_DESCRIPTION); + final String tooltip = (String) getValue(Action.TOOLTIP); return "[GuiActionDescrip: " + getClass().getName() + (name == null ? "" : " " + name) + (tooltip == null ? "" : " " + tooltip) + "]"; } @@ -308,7 +308,7 @@ @Override public GuiActionDescrip withToolTip(final String tooltip) { - putValue(Action.SHORT_DESCRIPTION, tooltip); + putValue(Action.TOOLTIP, tooltip); return this; } } Modified: trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java =================================================================== --- trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -61,11 +61,9 @@ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error, message, title, closeable)); } - public static void error(final String message, final String title, final String id, + public static void error(final String title, final String message, final String id, final boolean closeable) { - final UserNotifyEvent event = new UserNotifyEvent(NotifyLevel.error, message, id, closeable); - event.setId(id); - eventBus.fireEvent(event); + sendEventImpl(title, message, id, closeable, NotifyLevel.error); } public static void hideProgress() { @@ -84,6 +82,11 @@ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.info, message, closeable)); } + public static void info(final String title, final String message, final String id, + final boolean closeable) { + sendEventImpl(title, message, id, closeable, NotifyLevel.info); + } + public static void init(final EventBus eventBus, final I18nTranslationService i18n) { NotifyUser.eventBus = eventBus; NotifyUser.i18n = i18n; @@ -106,6 +109,13 @@ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.log, message)); } + private static void sendEventImpl(final String title, final String message, final String id, + final boolean closeable, final NotifyLevel level) { + final UserNotifyEvent event = new UserNotifyEvent(level, title, message, closeable); + event.setId(id); + eventBus.fireEvent(event); + } + public static void showAlertMessage(final String title, final String message) { showAlertMessage(title, message, onOk); } Modified: trunk/src/main/java/cc/kune/core/client/auth/AnonUsersManager.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/auth/AnonUsersManager.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/core/client/auth/AnonUsersManager.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -15,6 +15,8 @@ public class AnonUsersManager { + public static final String ANON_MESSAGE_CLOSE_ICON = "k-anon-um-close-btn"; + @Inject public AnonUsersManager(final Session session, final CookiesManager cookiesManager, final I18nTranslationService i18n) { @@ -31,11 +33,12 @@ final String signin = TextUtils.generateHtmlLink("#" + SiteTokens.SIGNIN, i18n.tWithNT("sign in", "register, in lowercase"), false); NotifyUser.info( + "", i18n.tWithNT( "You did not sign-in, so you can just see some public contents in this website, " + "but not edit or collaborate with others. Please [%s] or [%s] in order to get full access to this site tools and contents", "This will be something like 'Please register or sign in', but instead of %s some links", - register, signin), true); + register, signin), ANON_MESSAGE_CLOSE_ICON, true); } else { if (Boolean.valueOf(anonCookie)) { // Registered already: we set the cookie for some big period again Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -40,6 +40,9 @@ super(); this.stateManager = stateManager; putValue(Action.NAME, i18n.t("Create New Group")); + putValue(Action.TOOLTIP, + i18n.t("Create a new group for your initiative or organization " + + "(NGO, collective, academic group...)")); } @Override Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -46,6 +46,8 @@ super(); this.stateManager = stateManager; putValue(Action.NAME, i18n.t("Sign in to collaborate")); + putValue(Action.TOOLTIP, + i18n.t("Please sign in or register to get full access to this site tools and contents")); } @Override Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -53,7 +53,7 @@ false, true, false); this.signIn = signIn; putValue(NAME, i18n.t("Participate")); - putValue(SHORT_DESCRIPTION, i18n.t("Request to participate in this group")); + putValue(TOOLTIP, i18n.t("Request to participate in this group")); putValue(Action.SMALL_ICON, res.addGreen()); putValue(Action.STYLES, "k-sn-join"); } Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -45,7 +45,7 @@ super(stateManager, session, i18n, res, snServiceProvider, rightsClientManager, AccessRolDTO.Editor, true, false, true); putValue(NAME, i18n.t("Leave this group")); - putValue(SHORT_DESCRIPTION, i18n.t("Do not participate anymore in this group")); + putValue(TOOLTIP, i18n.t("Do not participate anymore in this group")); putValue(Action.SMALL_ICON, res.del()); putValue(Action.STYLES, "k-sn-join"); } Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -55,7 +55,7 @@ this.i18n = i18n; this.snServiceProvider = snServiceProvider; putValue(NAME, i18n.t("Leave this group")); - putValue(SHORT_DESCRIPTION, i18n.t("Do not participate anymore in this group")); + putValue(TOOLTIP, i18n.t("Do not participate anymore in this group")); putValue(Action.SMALL_ICON, res.del()); putValue(Action.STYLES, "k-sn-join"); } Modified: trunk/src/main/java/cc/kune/msgs/client/UserMessage.java =================================================================== --- trunk/src/main/java/cc/kune/msgs/client/UserMessage.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/cc/kune/msgs/client/UserMessage.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -93,7 +93,7 @@ this.closeCallback = closeCallback; initWidget(uiBinder.createAndBindUi(this)); if (TextUtils.notEmpty(id)) { - super.ensureDebugId(id); + close.ensureDebugId(id); } if (TextUtils.notEmpty(message)) { if (TextUtils.notEmpty(title)) { Deleted: trunk/src/main/java/org/ourproject/kune/gallery/KuneGallery.gwt.xml =================================================================== --- trunk/src/main/java/org/ourproject/kune/gallery/KuneGallery.gwt.xml 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/gallery/KuneGallery.gwt.xml 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,7 +0,0 @@ -<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.1.0/distro-source/core/src/gwt-module.dtd"> -<module> - <inherits name="cc.kune.core.Core" /> - <inherits name='org.ourproject.kune.platf.KunePlatform' /> - <inherits name='org.ourproject.kune.workspace.KuneWorkspace' /> - <source path="client" /> -</module> \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientActions.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,111 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.gallery.client; - -import static org.ourproject.kune.gallery.client.GalleryClientTool.TYPE_ALBUM; -import static org.ourproject.kune.gallery.client.GalleryClientTool.TYPE_ROOT; -import static org.ourproject.kune.gallery.client.GalleryClientTool.TYPE_UPLOADEDFILE; - -import org.ourproject.kune.gallery.client.cnt.GalleryViewer; -import org.ourproject.kune.workspace.client.OldAbstractFoldableContentActions; -import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator; -import org.ourproject.kune.workspace.client.editor.ContentEditor; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; -import org.ourproject.kune.workspace.client.upload.FileUploader; - -import cc.kune.common.client.utils.SchedulerManager; -import cc.kune.core.client.cnt.ContentActionRegistry; -import cc.kune.core.client.errors.ErrorHandler; -import cc.kune.core.client.i18n.I18nUITranslationService; -import cc.kune.core.client.rpcservices.ContentServiceAsync; -import cc.kune.core.client.rpcservices.GroupServiceAsync; -import cc.kune.core.client.services.FileDownloadUtils; -import cc.kune.core.client.state.Session; -import cc.kune.core.client.state.StateManager; -import cc.kune.gspace.client.style.GSpaceBackManager; - -import com.calclab.suco.client.ioc.Provider; - -public class GalleryClientActions extends OldAbstractFoldableContentActions { - public GalleryClientActions(final I18nUITranslationService i18n, - final ContextNavigator contextNavigator, final Session session, final StateManager stateManager, - final SchedulerManager deferredCommandWrapper, - final Provider<ContentServiceAsync> contentServiceProvider, - final Provider<GroupServiceAsync> groupServiceProvider, - final Provider<FileUploader> fileUploaderProvider, - final ContentActionRegistry contentActionRegistry, - final Provider<FileDownloadUtils> fileDownloadProvider, final EntityHeader entityLogo, - final Provider<ContentEditor> textEditorProvider, final ErrorHandler errorHandler, - final GalleryViewer documentViewer, final GSpaceBackManager wsBackManager) { - super(session, stateManager, i18n, errorHandler, deferredCommandWrapper, groupServiceProvider, - contentServiceProvider, fileUploaderProvider, contextNavigator, contentActionRegistry, - fileDownloadProvider, textEditorProvider, documentViewer, entityLogo, wsBackManager); - } - - @Override - protected void createActions() { - final String[] all = { TYPE_ROOT, TYPE_ALBUM, TYPE_UPLOADEDFILE }; - final String[] containers = { TYPE_ROOT, TYPE_ALBUM }; - final String[] contentsModerated = { TYPE_UPLOADEDFILE }; - final String[] containersNoRoot = { TYPE_ALBUM }; - final String[] contents = { TYPE_UPLOADEDFILE }; - - final String parentMenuTitle = i18n.t("File"); - final String parentMenuTitleCtx = i18n.t("Album"); - - createNewContainerAction(TYPE_ALBUM, "images/nav/gallery_add.png", i18n.t("New sub-album"), - parentMenuTitleCtx, i18n.t("New"), i18n.t("New sub-album"), Position.ctx, TYPE_ALBUM); - createNewContainerAction(TYPE_ALBUM, "images/nav/gallery_add.png", i18n.t("New album"), - parentMenuTitleCtx, i18n.t("New"), i18n.t("New album"), Position.ctx, TYPE_ROOT); - - createContentRenameAction(parentMenuTitle, i18n.t("Rename"), contents); - createContentModeratedActions(parentMenuTitle, contentsModerated); - createRenameContentInCtxAction(parentMenuTitleCtx, i18n.t("Rename"), containersNoRoot); - - // final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupCxt = - // createSetAsDefContent(parentMenuTitleCtx); - - createRefreshCntAction(parentMenuTitle, contents); - createRefreshCxtAction(parentMenuTitleCtx, containers); - - createSetAsDefContent(parentMenuTitle, contents); - // createSetGroupBackImageAction(parentMenuTitle, TYPE_UPLOADEDFILE); - - // createUploadAction(i18n.t("Upload file"), "images/nav/upload.png", - // i18n.t("Upload some files (images, PDFs, ...)"), null, containers); - - createDownloadActions(TYPE_UPLOADEDFILE); - - createGoAction(all); - - createGoHomeAction(containers); - - // createTranslateAction(TYPE_ALBUM, TYPE_UPLOADEDFILE); - - createDelContainerAction("Delete folder", parentMenuTitleCtx, containersNoRoot); - createDelContentAction(parentMenuTitle, i18n.t("Delete"), contents); - createShowDeletedItems(parentMenuTitleCtx, all); - } - - @Override - protected void createPostSessionInitActions() { - super.createUploadMediaAction(TYPE_ALBUM); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,63 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.gallery.client; - -import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; -import org.ourproject.kune.workspace.client.tool.OldFoldableAbstractClientTool; - -import cc.kune.core.client.i18n.I18nUITranslationService; -import cc.kune.core.client.registry.ContentCapabilitiesRegistry; -import cc.kune.gspace.client.themes.GSpaceThemeManager; -import cc.kune.gspace.client.tool.selector.ToolSelector; - -public class GalleryClientTool extends OldFoldableAbstractClientTool { - public static final String NAME = "gallery"; - public static final String TYPE_ROOT = NAME + "." + "root"; - public static final String TYPE_ALBUM = NAME + "." + "album"; - public static final String TYPE_UPLOADEDFILE = NAME + "." + OldFoldableAbstractClientTool.UPLOADEDFILE_SUFFIX; - - public GalleryClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector, - final GSpaceThemeManager wsThemePresenter, final WorkspaceSkeleton ws, - final ContentCapabilitiesRegistry cntCapabReg) { - super(NAME, i18n.t("gallery"), toolSelector, wsThemePresenter, ws, cntCapabReg); - - // registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE); - registerAuthorableTypes(TYPE_UPLOADEDFILE); - registerDragableTypes(TYPE_ALBUM, TYPE_UPLOADEDFILE); - registerDropableTypes(TYPE_ROOT, TYPE_ALBUM); - registerPublishModerableTypes(TYPE_UPLOADEDFILE); - registerRateableTypes(TYPE_UPLOADEDFILE); - registerRenamableTypes(TYPE_ALBUM, TYPE_UPLOADEDFILE); - registerTageableTypes(TYPE_UPLOADEDFILE); - // registerTranslatableTypes(); - - registerIcons(); - } - - public String getName() { - return NAME; - } - - private void registerIcons() { - registerContentTypeIcon(TYPE_ALBUM, "images/nav/gallery.png"); - registerUploadTypesAndMimes(TYPE_UPLOADEDFILE); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryMessages.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryMessages.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryMessages.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,23 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.gallery.client; - -public interface GalleryMessages { -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/KunePlatform.gwt.xml =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/KunePlatform.gwt.xml 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/KunePlatform.gwt.xml 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,63 +0,0 @@ -<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.1.0/distro-source/core/src/gwt-module.dtd"> -<module> - <!-- Inherit the core Web Toolkit stuff. --> - <inherits name="cc.kune.core.Core" /> - <inherits name='com.google.gwt.user.User' /> - <inherits name='com.google.gwt.i18n.I18N' /> - <inherits name="com.google.gwt.user.UserAgent" /> - <inherits name="org.ourproject.kune.platf.RichText" /> - <inherits name="org.ourproject.kune.workspace.KuneWorkspace" /> - <inherits name="com.google.gwt.resources.Resources" /> - <public path="public" /> - <inherits name="com.google.gwt.user.UserAgent" /> - <!-- RTE css inject --> - <!-- See gwt-user: com/google/gwt/user/RichText.gwt.xml --> - <!-- IE-specific implementation --> - <replace-with - class="org.ourproject.kune.platf.client.ui.rte.WrappedRichTextAreaImplIE6"> - <when-type-is - class="org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl" /> - <any> - <when-property-is name="user.agent" value="ie6" /> - <when-property-is name="user.agent" value="ie8" /> - </any> - </replace-with> - <!-- Mozilla-specific implementation --> - <replace-with - class="org.ourproject.kune.platf.client.ui.rte.WrappedRichTextAreaImplMozilla"> - <when-type-is - class="org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl" /> - <when-property-is name="user.agent" value="gecko1_8" /> - </replace-with> - <!-- Old Mozilla-specific implementation --> - <replace-with - class="org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplOldMozilla"> - <when-type-is - class="org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl" /> - <when-property-is name="user.agent" value="gecko" /> - </replace-with> - <!-- Safari-specific implementation --> - <replace-with - class="org.ourproject.kune.platf.client.ui.rte.WrappedRichTextAreaImplSafari"> - <when-type-is - class="org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl" /> - <any> - <when-property-is name="user.agent" value="safari" /> - </any> - </replace-with> - <!-- Opera-specific implementation --> - <replace-with - class="org.ourproject.kune.platf.client.ui.rte.WrappedRichTextAreaImplOpera"> - <when-type-is - class="org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl" /> - <any> - <when-property-is name="user.agent" value="opera" /> - </any> - </replace-with> - <inherits name="com.calclab.suco.Suco" /> - <inherits name="com.gwtext.GwtExt" /> -<!-- <inherits name="com.calclab.emiteuimodule.EmiteUIModule" />--> - <inherits name="org.xwiki.gwt.dom.DOM" /> - <inherits name="com.calclab.suco.Suco"/> - <source path='client' excludes="**/*Test.java,**/*Tests.java,**/*MockProvider.java"/> -</module> \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/platf/RichText.gwt.xml =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/RichText.gwt.xml 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/RichText.gwt.xml 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,60 +0,0 @@ -<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.1.0/distro-source/core/src/gwt-module.dtd"> -<!-- Copyright 2008 Google Inc. --> -<!-- Licensed under the Apache License, Version 2.0 (the "License"); you --> -<!-- may not use this file except in compliance with the License. You may --> -<!-- may obtain a copy of the License at --> -<!-- --> -<!-- http://www.apache.org/licenses/LICENSE-2.0 --> -<!-- --> -<!-- Unless required by applicable law or agreed to in writing, software --> -<!-- distributed under the License is distributed on an "AS IS" BASIS, --> -<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or --> -<!-- implied. License for the specific language governing permissions and --> -<!-- limitations under the License. --> - -<!-- Deferred binding rules for browser selection. --> -<!-- --> -<module> - <inherits name="com.google.gwt.core.Core" /> - <inherits name="com.google.gwt.user.UserAgent" /> - - <!-- IE-specific implementation --> - <replace-with - class="org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplIE6"> - <when-type-is - class="org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl" /> - <when-property-is name="user.agent" value="ie6" /> - <when-property-is name="user.agent" value="ie8" /> - </replace-with> - - <!-- Mozilla-specific implementation --> - <replace-with - class="org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplMozilla"> - <when-type-is - class="org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl" /> - <any> - <when-property-is name="user.agent" value="gecko1_8" /> - <when-property-is name="user.agent" value="gecko" /> - </any> - </replace-with> - - <!-- Safari-specific implementation --> - <replace-with - class="org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplSafari"> - <when-type-is - class="org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl" /> - <any> - <when-property-is name="user.agent" value="safari" /> - </any> - </replace-with> - - <!-- Opera-specific implementation --> - <replace-with - class="org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplOpera"> - <when-type-is - class="org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl" /> - <any> - <when-property-is name="user.agent" value="opera" /> - </any> - </replace-with> -</module> Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/View.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/View.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/View.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,31 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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; - -import com.google.gwt.user.client.ui.IsWidget; - -/** - * For make tests without dependencies to gwt. Use casting to use the widget. - * Use #{@link com.gwtplatform.mvp.client.View} 0r #{@link IsWidget} - */ -@Deprecated -public interface View { - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractExtendedAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractExtendedAction.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractExtendedAction.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,46 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -import com.google.gwt.resources.client.ImageResource; - -public abstract class AbstractExtendedAction extends OldAbstractAction { - public static final String NO_TEXT = null; - public static final ImageResource NO_ICON = null; - - public AbstractExtendedAction() { - super(); - } - - public AbstractExtendedAction(final String text) { - this(text, null, null); - } - - public AbstractExtendedAction(final String text, final ImageResource icon) { - this(text, null, icon); - } - - public AbstractExtendedAction(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); - } -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/Action.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/Action.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/Action.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,159 +0,0 @@ -/* 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 ([email protected]) - * @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 Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionAddCondition.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionAddCondition.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionAddCondition.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,24 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -public interface ActionAddCondition<T> { - boolean mustBeAdded(T param); -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCheckedCondition.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCheckedCondition.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCheckedCondition.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,24 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -public interface ActionCheckedCondition { - boolean mustBeChecked(); -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollection.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollection.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionCollection.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,29 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -import java.util.ArrayList; - -@Deprecated -public class ActionCollection<T> extends ArrayList<ActionDescriptor<T>> { - - private static final long serialVersionUID = -3308296009308246636L; - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,501 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor; - -import cc.kune.core.client.services.ImageDescriptor; -import cc.kune.core.shared.dto.AccessRolDTO; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; - -/** - * The Class ActionDescriptor. - */ -@Deprecated -public class ActionDescriptor<T> { - - public static final int NO_POSITION = -1; - - /** The access rol. */ - private AccessRolDTO accessRol; - - /** The must be added condition. */ - private ActionAddCondition<T> addCondition; - - /** The confirmation text. */ - private String confirmationText; - - /** The confirmation title. */ - private String confirmationTitle; - - /** The enable condition. */ - private ActionEnableCondition<T> enableCondition; - - /** The icon cls. */ - private String iconCls; - - /** The icon descriptor. */ - private ImageDescriptor iconDescriptor; - - /** The icon url. */ - private String iconUrl; - - /** The id. */ - private String id; - - /** The must be authenticated. */ - private boolean mustBeAuthenticated; - - /** The must be confirmed. */ - private boolean mustBeConfirmed; - - /** The on not confirmed. */ - private Listener<T> onNotConfirmed; - - /** The on perform call. */ - private final Listener<T> onPerformCall; - - private int position = NO_POSITION; - - private ShortcutDescriptor shortcut; - - /** The text description. */ - private String textDescription; - - /** The tool tip. */ - private String toolTip; - - public ActionDescriptor(final AccessRolDTO accessRolDTO, final Listener<T> onPerformCall) { - this.accessRol = accessRolDTO; - this.onPerformCall = onPerformCall; - this.mustBeConfirmed = false; - this.onNotConfirmed = null; - this.mustBeAuthenticated = true; - } - - public ActionDescriptor(final AccessRolDTO accessRolDTO, final Listener<T> onPerformCall, - final ActionAddCondition<T> addCondition) { - this(accessRolDTO, onPerformCall); - this.addCondition = addCondition; - } - - /** - * Instantiates a new action descriptor. - * - * @param accessRolDTO - * the access rol dto - * @param onPerformCall - * the on perform call - * @param enableCondition - * the enable condition - */ - public ActionDescriptor(final AccessRolDTO accessRolDTO, final Listener<T> onPerformCall, - final ActionEnableCondition<T> enableCondition) { - this(accessRolDTO, onPerformCall); - this.enableCondition = enableCondition; - } - - /** - * Instantiates a new action descriptor. - * - * @param accessRolDTO - * the access rol dto - * @param onPerformCall - * the on perform call - */ - - public ActionDescriptor(final AccessRolDTO accessRolDTO, final Listener0 onPerformCall) { - this(accessRolDTO, new Listener<T>() { - @Override - public void onEvent(final T parameter) { - onPerformCall.onEvent(); - } - }); - } - - public ActionDescriptor(final AccessRolDTO accessRolDTO, final Listener0 onPerformCall, - final ActionAddCondition<T> addCondition) { - this(accessRolDTO, onPerformCall); - this.addCondition = addCondition; - } - - public ActionDescriptor(final AccessRolDTO accessRolDTO, final Listener0 onPerformCall, - final ActionEnableCondition<T> enableCondition) { - this(accessRolDTO, onPerformCall); - this.enableCondition = enableCondition; - } - - 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()); - } - - /** - * Fire on not confirmed. - * - * @param parameter - * the parameter - */ - @SuppressWarnings("unchecked") - public void fireOnNotConfirmed(final Object parameter) { - if (onNotConfirmed != null) { - onNotConfirmed.onEvent((T) parameter); - } - } - - /** - * Fire on perform call. - * - * @param parameter - * the parameter - */ - @SuppressWarnings("unchecked") - public void fireOnPerformCall(final Object parameter) { - onPerformCall.onEvent((T) parameter); - } - - /** - * Gets the access rol. - * - * @return the access rol - */ - public AccessRolDTO getAccessRol() { - return accessRol; - } - - private ActionAddCondition<T> getAddCondition() { - return addCondition; - } - - /** - * Gets the confirmation text. - * - * @return the confirmation text - */ - public String getConfirmationText() { - return confirmationText; - } - - /** - * Gets the confirmation title. - * - * @return the confirmation title - */ - public String getConfirmationTitle() { - return confirmationTitle; - } - - private ActionEnableCondition<T> getEnableCondition() { - return enableCondition; - } - - public String getIconCls() { - return iconCls; - } - - /** - * Gets the icon descriptor. - * - * @return the icon descriptor - */ - public ImageDescriptor getIconDescriptor() { - return iconDescriptor; - } - - /** - * Gets the icon url. - * - * @return the icon url - */ - public String getIconUrl() { - return iconUrl; - } - - /** - * Gets the DOM unique id (used for debug) - * - * @return the id - */ - public String getId() { - return id; - } - - private Listener<T> getOnNotConfirmed() { - return onNotConfirmed; - } - - private Listener<T> getOnPerformCall() { - return onPerformCall; - } - - /** - * Get the index position where this action will be inserted - * - * @param position - */ - public int getPosition() { - return position; - } - - public ShortcutDescriptor getShortcut() { - return shortcut; - } - - public String getShortcutToS() { - return shortcut == null ? "" : shortcut.toString(); - } - - /** - * Gets the text. - * - * @return the text - */ - public String getText() { - return textDescription; - } - - private String getTextDescription() { - return textDescription; - } - - /** - * Gets the tool tip. - * - * @return the tool tip - */ - public String getToolTip() { - return toolTip; - } - - public boolean hasShortcut() { - return shortcut != null; - } - - public boolean mustBeAdded(final T item) { - return addCondition != null ? addCondition.mustBeAdded(item) : true; - } - - /** - * Must be authenticated. - * - * @return true, if successful - */ - public boolean mustBeAuthenticated() { - return mustBeAuthenticated; - } - - /** - * Checks if is must be confirmed. - * - * @return true, if is must be confirmed - */ - public boolean mustBeConfirmed() { - return mustBeConfirmed; - } - - public boolean mustBeEnabled(final T item) { - return enableCondition != null ? enableCondition.mustBeEnabled(item) : true; - } - - /** - * Sets the access rol. - * - * @param accessRol - * the new access rol - */ - public void setAccessRol(final AccessRolDTO accessRol) { - this.accessRol = accessRol; - } - - /** - * Sets the add condition. - * - * @param addCondition - * the new add condition - */ - public void setAddCondition(final ActionAddCondition<T> 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 enable condition. - * - * @param enableCondition - * the new enable condition - */ - public void setEnableCondition(final ActionEnableCondition<T> enableCondition) { - this.enableCondition = enableCondition; - } - - public void setIconCls(final String iconCls) { - this.iconCls = iconCls; - } - - /** - * Sets the icon descriptor. - * - * @param iconDescriptor - * the new icon descriptor - */ - public void setIconDescriptor(final ImageDescriptor iconDescriptor) { - this.iconDescriptor = iconDescriptor; - } - - /** - * Sets the icon url. - * - * @param iconUrl - * the new icon url - */ - public void setIconUrl(final String iconUrl) { - this.iconUrl = iconUrl; - } - - /** - * Sets the DOM unique id (used for debug) - * - * @param id - * the new id - */ - public void setId(final String id) { - this.id = id; - } - - /** - * Sets the must be authenticated. - * - * @param mustBeAuthenticated - * the new must be authenticated - */ - public void setMustBeAuthenticated(final boolean mustBeAuthenticated) { - this.mustBeAuthenticated = mustBeAuthenticated; - } - - /** - * Sets the must be confirmed. - * - * @param mustBeConfirmed - * the new must be confirmed - */ - public void setMustBeConfirmed(final boolean mustBeConfirmed) { - this.mustBeConfirmed = mustBeConfirmed; - } - - private void setOnNotConfirmed(final Listener<T> onNotConfirmed) { - this.onNotConfirmed = onNotConfirmed; - } - - /** - * Index position where this action will be inserted - * - * @param position - */ - public void setPosition(final int position) { - this.position = position; - } - - public void setShortcut(final ShortcutDescriptor shortcut) { - this.shortcut = shortcut; - } - - /** - * Sets the text description. - * - * @param textDescription - * the new text description - */ - public void setTextDescription(final String textDescription) { - this.textDescription = textDescription; - } - - /** - * Sets the tool tip. - * - * @param toolTip - * the new tool tip - */ - public void setToolTip(final String toolTip) { - this.toolTip = toolTip; - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEnableCondition.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEnableCondition.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEnableCondition.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,24 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -public interface ActionEnableCondition<T> { - boolean mustBeEnabled(T param); -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEvent.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEvent.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionEvent.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,69 +0,0 @@ -/* 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.Event; - -/** - * This event is generated when an action on a component (such as a button - * press) occurs. - * - * @author Aaron M. Renn ([email protected]) - * @author Adapted version for GWT (C) The kune development team - * @see ActionListener - * @since 1.1 - * @status updated to 1.4 - */ -public class ActionEvent { - - private final Event event; - private final Object source; - - public ActionEvent(final Object source, final Event event) { - this.source = source; - this.event = event; - } - - public Event getEvent() { - return event; - } - - public Object getSource() { - return source; - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionItem.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionItem.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionItem.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,66 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - - -import com.allen_sauer.gwt.log.client.Log; - -/** - * And action description and a item (for instance a StateToken, a XmmpURI) over - * the action takes place - * - * @param <T> - */ -public class ActionItem<T> { - - ActionDescriptor<T> action; - T item; - - public ActionItem(final ActionDescriptor<T> action, final T item) { - this.action = action; - this.item = item; - } - - public ActionDescriptor<T> getAction() { - return action; - } - - public T getItem() { - return item; - } - - public boolean mustBeAdded() { - return action.mustBeAdded(getItem()); - } - - public boolean mustBeEnabled() { - return action.mustBeEnabled(getItem()); - } - - public boolean mustBePressed() { - if (action instanceof ActionToolbarPushButtonDescriptor<?>) { - final ActionPressedCondition<T> mustIniPressed = ((ActionToolbarPushButtonDescriptor<T>) action).getMustInitialyPressed(); - return mustIniPressed == null ? false : mustIniPressed.mustBePressed(getItem()); - } else { - Log.error("This action is not a push button"); - return false; - } - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionItemCollection.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionItemCollection.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionItemCollection.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,56 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -import java.util.ArrayList; -import java.util.Collection; - -import com.allen_sauer.gwt.log.client.Log; - -public class ActionItemCollection<T> extends ArrayList<ActionItem<T>> { - - private static final long serialVersionUID = 1127359948648860754L; - - @Override - public boolean add(final ActionItem<T> actionItem) { - ActionDescriptor<T> action = actionItem.getAction(); - int position = action.getPosition(); - if (position == ActionDescriptor.NO_POSITION) { - super.add(actionItem); - } else { - try { - super.add(position, actionItem); - return true; - } catch (IndexOutOfBoundsException e) { - Log.error("Trying to add an action in a position out of bounds"); - super.add(actionItem); - } - } - return false; - } - - @Override - public boolean addAll(final Collection<? extends ActionItem<T>> actionItems) { - for (ActionItem<T> actionItem : actionItems) { - add(actionItem); - } - return true; - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionListener.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionListener.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionListener.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,57 +0,0 @@ -/* 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 ([email protected]) - * @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); -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionManager.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionManager.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionManager.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,53 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -import org.ourproject.kune.platf.client.ui.noti.OldNotifyUser; - -import com.calclab.suco.client.events.Listener0; - -public class ActionManager { - - public ActionManager() { - } - - public void doAction(final ActionItem<?> actionItem) { - final ActionDescriptor<?> action = actionItem.getAction(); - final Object item = actionItem.getItem(); - if (action.mustBeConfirmed()) { - OldNotifyUser.askConfirmation(action.getConfirmationTitle(), action.getConfirmationText(), new Listener0() { - public void onEvent() { - fire(action, item); - } - }, new Listener0() { - public void onEvent() { - action.fireOnNotConfirmed(item); - } - }); - } else { - fire(action, item); - } - } - - private void fire(final ActionDescriptor<?> action, final Object parameter) { - action.fireOnPerformCall(parameter); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,33 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - - -import cc.kune.core.shared.dto.AccessRolDTO; - -import com.calclab.suco.client.events.Listener; - -public class ActionMenuItemDescriptor<T> extends ActionDescriptor<T> { - - public ActionMenuItemDescriptor(final AccessRolDTO accessRolDTO, final Listener<T> onPerformCall) { - super(accessRolDTO, onPerformCall); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionPressedCondition.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionPressedCondition.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionPressedCondition.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,24 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -public interface ActionPressedCondition<T> { - boolean mustBePressed(T param); -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionRegistry.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,116 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -import java.util.HashMap; - -import cc.kune.core.shared.domain.utils.AccessRights; - -import com.allen_sauer.gwt.log.client.Log; - -public class ActionRegistry<T> { - private static final String GENERIC = "kgenacts"; - - private final HashMap<String, ActionCollection<T>> actions; - - public ActionRegistry() { - actions = new HashMap<String, ActionCollection<T>>(); - } - - public void addAction(final ActionDescriptor<T> action) { - addAction(action, GENERIC); - } - - public void addAction(final ActionDescriptor<T> action, final String... typeIds) { - assert action != null; - for (final String typeId : typeIds) { - String text = action.getText(); - Log.debug("Registering action " + (text == null ? "with icon" : "'" + text + "'") + " for " + typeId); - final ActionCollection<T> actionColl = getActions(typeId); - actionColl.add(action); - } - } - - public ActionItemCollection<T> getCurrentActions(final T item, final boolean isLogged, final AccessRights rights, - final boolean toolbarItems) { - return getCurrentActions(item, GENERIC, isLogged, rights, toolbarItems); - } - - public ActionItemCollection<T> getCurrentActions(final T item, final String typeId, final boolean isLogged, - final AccessRights rights, final boolean toolbarItems) { - final ActionItemCollection<T> collection = new ActionItemCollection<T>(); - - for (final ActionDescriptor<T> action : getActions(typeId)) { - if (mustAdd(isLogged, rights, action)) { - if (toolbarItems) { - if (action instanceof ActionToolbarButtonDescriptor<?> - || action instanceof ActionToolbarMenuDescriptor<?>) { - collection.add(new ActionItem<T>(action, item)); - } - } else { - if (action instanceof ActionMenuItemDescriptor<?> - || action instanceof ActionToolbarMenuAndItemDescriptor<?> - || action instanceof ActionToolbarButtonAndItemDescriptor<?>) { - collection.add(new ActionItem<T>(action, item)); - } - } - } - } - return collection; - } - - public void removeAction(final ActionDescriptor<T> action) { - removeAction(GENERIC, action); - } - - public void removeAction(final String typeId, final ActionDescriptor<T> action) { - actions.get(typeId).remove(action); - } - - public int size() { - return actions.size(); - } - - private ActionCollection<T> getActions(final String typeId) { - ActionCollection<T> actionColl = actions.get(typeId); - if (actionColl == null) { - actionColl = new ActionCollection<T>(); - actions.put(typeId, actionColl); - } - return actionColl; - } - - private boolean mustAdd(final boolean isLogged, final AccessRights rights, final ActionDescriptor<T> action) { - if (action.mustBeAuthenticated()) { - if (!isLogged) { - return false; - } - } - switch (action.getAccessRol()) { - case Administrator: - return rights.isAdministrable(); - case Editor: - return rights.isEditable(); - case Viewer: - default: - return rights.isVisible(); - } - } -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,40 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - - -import cc.kune.core.shared.dto.AccessRolDTO; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; - -public class ActionToolbarButtonAndItemDescriptor<T> extends ActionToolbarButtonDescriptor<T> { - - public ActionToolbarButtonAndItemDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall) { - super(accessRolDTO, actionToolbarPosition, onPerformCall); - } - - public ActionToolbarButtonAndItemDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall) { - super(accessRolDTO, actionToolbarPosition, onPerformCall); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,91 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - - -import cc.kune.core.shared.dto.AccessRolDTO; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; - -public class ActionToolbarButtonDescriptor<T> extends ActionToolbarDescriptor<T> { - - private ActionToolbarButtonSeparator leftSeparator; - private ActionToolbarButtonSeparator rightSeparator; - - public ActionToolbarButtonDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall) { - super(accessRolDTO, actionToolbarPosition, onPerformCall); - } - - public ActionToolbarButtonDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall, - final ActionAddCondition<T> addCondition) { - super(accessRolDTO, actionToolbarPosition, onPerformCall, addCondition); - } - - public ActionToolbarButtonDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall, - final ActionEnableCondition<T> enableCondition) { - super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition); - } - - public ActionToolbarButtonDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall) { - super(accessRolDTO, actionToolbarPosition, onPerformCall); - } - - public ActionToolbarButtonDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall, - final ActionAddCondition<T> addCondition) { - super(accessRolDTO, actionToolbarPosition, onPerformCall, addCondition); - } - - public ActionToolbarButtonDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall, - final ActionEnableCondition<T> enableCondition) { - super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition); - } - - public ActionToolbarButtonSeparator getLeftSeparator() { - return leftSeparator; - } - - public ActionToolbarButtonSeparator getRightSeparator() { - return rightSeparator; - } - - public boolean hasLeftSeparator() { - return leftSeparator != null; - } - - public boolean hasRightSeparator() { - return rightSeparator != null; - } - - public void setLeftSeparator(final ActionToolbarButtonSeparator leftSeparator) { - this.leftSeparator = leftSeparator; - } - - public void setRightSeparator(final ActionToolbarButtonSeparator rightSeparator) { - this.rightSeparator = rightSeparator; - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonSeparator.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonSeparator.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonSeparator.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,24 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -public enum ActionToolbarButtonSeparator { - spacer, separator, fill -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,85 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - - -import cc.kune.core.shared.dto.AccessRolDTO; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; - -public abstract class ActionToolbarDescriptor<T> extends ActionDescriptor<T> { - - private ActionToolbarPosition actionToolbarPosition; - - public ActionToolbarDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition, - final Listener<T> onPerformCall) { - super(accessRolDTO, onPerformCall); - this.actionToolbarPosition = actionToolbarPosition; - } - - public ActionToolbarDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition, - final Listener<T> onPerformCall, final ActionAddCondition<T> addCondition) { - super(accessRolDTO, onPerformCall, addCondition); - this.actionToolbarPosition = actionToolbarPosition; - } - - public ActionToolbarDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition, - final Listener<T> onPerformCall, final ActionEnableCondition<T> enableCondition) { - super(accessRolDTO, onPerformCall, enableCondition); - this.actionToolbarPosition = actionToolbarPosition; - } - - public ActionToolbarDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition, - final Listener0 onPerformCall) { - super(accessRolDTO, onPerformCall); - this.actionToolbarPosition = actionToolbarPosition; - } - - public ActionToolbarDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition, - final Listener0 onPerformCall, final ActionAddCondition<T> addCondition) { - super(accessRolDTO, onPerformCall, addCondition); - this.actionToolbarPosition = actionToolbarPosition; - } - - public ActionToolbarDescriptor(final AccessRolDTO accessRolDTO, final ActionToolbarPosition actionToolbarPosition, - final Listener0 onPerformCall, final ActionEnableCondition<T> enableCondition) { - super(accessRolDTO, onPerformCall, enableCondition); - this.actionToolbarPosition = actionToolbarPosition; - } - - public ActionToolbarDescriptor(final ActionDescriptor<T> copy) { - super(copy); - } - - public ActionToolbarDescriptor(final ActionToolbarDescriptor<T> copy) { - super(copy); - this.actionToolbarPosition = copy.getActionPosition(); - } - - public ActionToolbarPosition getActionPosition() { - return actionToolbarPosition; - } - - public void setActionPosition(final ActionToolbarPosition actionToolbarPosition) { - this.actionToolbarPosition = actionToolbarPosition; - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,40 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - - -import cc.kune.core.shared.dto.AccessRolDTO; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; - -public class ActionToolbarMenuAndItemDescriptor<T> extends ActionToolbarMenuDescriptor<T> { - - public ActionToolbarMenuAndItemDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall) { - super(accessRolDTO, actionToolbarPosition, onPerformCall); - } - - public ActionToolbarMenuAndItemDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall) { - super(accessRolDTO, actionToolbarPosition, onPerformCall); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuCheckItemDescriptor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuCheckItemDescriptor.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuCheckItemDescriptor.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,42 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - - -import cc.kune.core.shared.dto.AccessRolDTO; - -import com.calclab.suco.client.events.Listener0; - -public class ActionToolbarMenuCheckItemDescriptor<T> extends ActionToolbarMenuDescriptor<T> { - - private final ActionCheckedCondition mustBeChecked; - - public ActionToolbarMenuCheckItemDescriptor(final AccessRolDTO accessRol, - final ActionToolbarPosition toolbarPosition, final Listener0 onPerformCall, - final ActionCheckedCondition mustBeChecked) { - super(accessRol, toolbarPosition, onPerformCall); - this.mustBeChecked = mustBeChecked; - } - - public ActionCheckedCondition getMustBeChecked() { - return mustBeChecked; - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,123 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - - -import cc.kune.core.shared.dto.AccessRolDTO; - -import com.allen_sauer.gwt.log.client.Log; -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; - -public class ActionToolbarMenuDescriptor<T> extends ActionToolbarDescriptor<T> { - - private String parentMenuTitle; - private String parentMenuIconUrl; - private String parentMenuIconCls; - private String parentSubMenuTitle; - private String parentMenuTooltip; - private boolean topSeparator = false; - private boolean bottomSeparator = false; - - public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall) { - super(accessRolDTO, actionToolbarPosition, onPerformCall); - } - - public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall, - final ActionEnableCondition<T> enableCondition) { - super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition); - } - - public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall) { - super(accessRolDTO, actionToolbarPosition, onPerformCall); - } - - public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall, - final ActionEnableCondition<T> enableCondition) { - super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition); - } - - public ActionToolbarMenuDescriptor(final ActionDescriptor<T> copy) { - super(copy); - } - - public String getParentMenuIconCls() { - return parentMenuIconCls; - } - - public String getParentMenuIconUrl() { - return parentMenuIconUrl; - } - - public String getParentMenuTitle() { - return parentMenuTitle; - } - - public String getParentMenuTooltip() { - return parentMenuTooltip; - } - - public String getParentSubMenuTitle() { - return parentSubMenuTitle; - } - - public boolean hasBottomSeparator() { - return bottomSeparator; - } - - public boolean hasTopSeparator() { - return topSeparator; - } - - public void setBottomSeparator(final boolean bottomSeparator) { - this.bottomSeparator = bottomSeparator; - } - - public void setParentMenuIconCls(final String parentMenuIconCls) { - this.parentMenuIconCls = parentMenuIconCls; - } - - public void setParentMenuIconUrl(final String parentMenuIconUrl) { - this.parentMenuIconUrl = parentMenuIconUrl; - } - - public void setParentMenuTitle(final String parentMenuTitle) { - this.parentMenuTitle = parentMenuTitle; - } - - public void setParentMenuTooltip(final String parentMenuTooltip) { - this.parentMenuTooltip = parentMenuTooltip; - } - - public void setParentSubMenuTitle(final String parentSubMenuTitle) { - if (parentMenuTitle == null) { - Log.warn("Please set parentMenuTitle before"); - } - this.parentSubMenuTitle = parentSubMenuTitle; - } - - public void setTopSeparator(final boolean topSeparator) { - this.topSeparator = topSeparator; - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuRadioDescriptor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuRadioDescriptor.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuRadioDescriptor.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,45 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - - -import cc.kune.core.shared.dto.AccessRolDTO; - -import com.calclab.suco.client.events.Listener; - -public class ActionToolbarMenuRadioDescriptor<T> extends ActionToolbarMenuDescriptor<T> { - private final String group; - private final 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 String getGroup() { - return group; - } - - public boolean mustBeChecked() { - return mustBeChecked.mustBeChecked(); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPosition.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPosition.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPosition.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,63 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -public class ActionToolbarPosition { - - private final String id; - - public ActionToolbarPosition(final String id) { - this.id = id; - } - - @Override - 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) { - return false; - } - } else if (!id.equals(other.id)) { - return false; - } - return true; - } - - public String getId() { - return id; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - return result; - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPushButtonDescriptor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPushButtonDescriptor.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPushButtonDescriptor.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,45 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - - - -import cc.kune.core.shared.dto.AccessRolDTO; - -import com.calclab.suco.client.events.Listener0; - -public class ActionToolbarPushButtonDescriptor<T> extends ActionToolbarButtonDescriptor<T> { - - private ActionPressedCondition<T> mustInitialyPressed; - - public ActionToolbarPushButtonDescriptor(final AccessRolDTO accessRolDTO, - final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall) { - super(accessRolDTO, actionToolbarPosition, onPerformCall); - } - - public ActionPressedCondition<T> getMustInitialyPressed() { - return mustInitialyPressed; - } - - public void setMustInitialyPressed(final ActionPressedCondition<T> mustInitialyPressed) { - this.mustInitialyPressed = mustInitialyPressed; - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ChangebleObject.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ChangebleObject.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ChangebleObject.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,135 +0,0 @@ -package org.ourproject.kune.platf.client.actions; - -import java.util.HashMap; - -/** - * A base class for implementing the {@link Action} interface. - * - * @author Andrew Selkirk - * @author Adapted version for GWT (C) The kune development team - */ -public class ChangebleObject { - - /** - * Provides support for property change event notification. - */ - protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(this); - /** - * store - */ - protected HashMap<String, Object> store = new HashMap<String, Object>(); - - /** - * 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); - } - - /** - * Sets the value associated with the specified key and sends a - * {@link java.beans.PropertyChangeEvent} to all registered listeners. - * - * 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) { - final 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); - } - - /** - * 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. - */ - protected void firePropertyChange(final String propertyName, final boolean oldValue, final boolean newValue) { - changeSupport.firePropertyChange(propertyName, oldValue, newValue); - } - - /** - * 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); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/EventListener.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/EventListener.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/EventListener.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,53 +0,0 @@ -/* 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 ([email protected]) - * @author Adapted version for GWT (C) The kune development team - * @see EventObject - * @status updated to 1.4 - */ -public interface EventListener { -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/EventListenerProxy.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/EventListenerProxy.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/EventListenerProxy.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,74 +0,0 @@ -/* 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 ([email protected]) - * @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 Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,235 +0,0 @@ -/* 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 ActionMaps. - * - * 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, OldAbstractAction> 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() { - final Set<KeyStroke> set = new HashSet<KeyStroke>(); - - if (parent != null) { - final KeyStroke[] parentKeys = parent.allKeys(); - if (parentKeys != null) { - set.addAll(Arrays.asList(parentKeys)); - } - } - if (inputMap != null) { - set.addAll(inputMap.keySet()); - } - if (set.isEmpty()) { - return null; - } - final 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 OldAbstractAction get(final KeyStroke keystroke) { - OldAbstractAction 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). - */ - // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:33 - public KeyStroke[] keys() { - if (inputMap != null) { - final 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 OldAbstractAction actionMapKey) { - if (keystroke == null) { - return; - } - if (inputMap == null) { - inputMap = new HashMap<KeyStroke, OldAbstractAction>(); - } - 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; - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,535 +0,0 @@ -/* 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 java.util.Map; - -import org.ourproject.kune.platf.client.i18n.Resources; -import org.ourproject.kune.platf.client.shortcuts.Keyboard; - -import com.google.gwt.dom.client.NativeEvent; -import com.google.gwt.event.dom.client.KeyCodes; -import com.google.gwt.event.dom.client.KeyEvent; -import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.Event; - -/** - * 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 ([email protected]) - * @author Andrew John Hughes ([email protected]) - * @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 Map<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 Map<String, Object> VKTABLE = new HashMap<String, Object>(); - - private static final int VK_UNDEFINED = 0; - private static final char CHAR_UNDEFINED = '\uffff'; - - public static int getKeyboardModifiers(final NativeEvent event) { - return (event.getShiftKey() ? Keyboard.MODIFIER_SHIFT : 0) | (event.getMetaKey() ? Keyboard.MODIFIER_META : 0) - | (event.getCtrlKey() ? Keyboard.MODIFIER_CTRL : 0) | (event.getAltKey() ? Keyboard.MODIFIER_ALT : 0); - } - - /** - * 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) { - final int eventModif = getKeyboardModifiers(event); - final int eventKeyCode = event.getKeyCode(); - // Log.info("key: " + eventKeyCode + " modifier: " + eventModif); - switch (DOM.eventGetType(event)) { - case Event.ONKEYDOWN: - return getKeyStroke(CHAR_UNDEFINED, eventKeyCode, eventModif, false); - case Event.ONKEYPRESS: - final char charac = (char) eventKeyCode; - return getKeyStroke(Character.isLowerCase(charac) ? Character.toUpperCase(charac) : charac, VK_UNDEFINED, - eventModif, false); - case Event.ONKEYUP: - return getKeyStroke(CHAR_UNDEFINED, eventKeyCode, eventModif, false); - 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. - final 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 obj - * the object to test - * @return true if it is equal - */ - @Override - public final boolean equals(final Object obj) { - if (!(obj instanceof KeyStroke)) { - return false; - } - final KeyStroke stroke = (KeyStroke) obj; - return this == obj - || (keyChar == stroke.keyChar && keyCode == stroke.keyCode && modifiers == stroke.modifiers && onKeyRelease == stroke.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() { - switch (keyCode) { - case KeyCodes.KEY_BACKSPACE: - return translateKey("Backspace"); - // case KeyCodes.KEY_DELETE: - // return translateKey("Delete"); - case KeyCodes.KEY_DOWN: - return translateKey("Down"); - case KeyCodes.KEY_END: - return translateKey("End"); - case KeyCodes.KEY_ENTER: - return translateKey("Enter"); - case KeyCodes.KEY_ESCAPE: - return translateKey("Escape"); - case KeyCodes.KEY_HOME: - return translateKey("Home"); - case KeyCodes.KEY_LEFT: - return translateKey("Left"); - case KeyCodes.KEY_PAGEDOWN: - return translateKey("Page Down"); - case KeyCodes.KEY_PAGEUP: - return translateKey("Page Up"); - case KeyCodes.KEY_RIGHT: - return translateKey("Right"); - case KeyCodes.KEY_TAB: - return translateKey("Tab"); - case KeyCodes.KEY_UP: - return translateKey("Up"); - case Keyboard.KEY_SPACE: - return translateKey("Space"); - 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 String.valueOf(keyCode).toUpperCase(); - default: - final String charS = String.valueOf(keyChar); - if (charS == null) { - return "Unknown keyCode: 0x" + (keyCode < 0 ? "-" : "") + Integer.toHexString(Math.abs(keyCode)); - } else { - if (" ".equals(charS)) { - return translateKey("Space"); - } else { - return charS; - } - } - } - } - - /** - * 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 & Keyboard.MODIFIER_META) != 0) { - s += translateKey("Meta") + "+"; - } - if ((modifiers & Keyboard.MODIFIER_CTRL) != 0) { - s += translateKey("Ctrl") + "+"; - } - if ((modifiers & Keyboard.MODIFIER_ALT) != 0) { - s += translateKey("Alt") + "+"; - } - if ((modifiers & Keyboard.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() + ")"; - return s; - } - - /** - * Returns a cached version of the deserialized keystroke, if available. - * - * @return a cached replacement if something goes wrong - */ - protected Object readResolve() { - final 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 Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/MenuItemsContainer.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/MenuItemsContainer.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/MenuItemsContainer.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,75 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -import java.util.HashMap; - -import com.calclab.suco.client.events.Listener; -import com.google.gwt.core.client.Scheduler; -import com.google.gwt.core.client.Scheduler.ScheduledCommand; -import com.gwtext.client.core.EventObject; -import com.gwtext.client.widgets.menu.BaseItem; -import com.gwtext.client.widgets.menu.Item; -import com.gwtext.client.widgets.menu.Menu; -import com.gwtext.client.widgets.menu.event.BaseItemListenerAdapter; - -public class MenuItemsContainer<T> { - private final HashMap<String, Menu> contextMenus; - - public MenuItemsContainer() { - contextMenus = new HashMap<String, Menu>(); - } - - public void clear() { - contextMenus.clear(); - } - - public void createItemMenu(final String id, final ActionItemCollection<T> actionCollection, - final Listener<ActionItem<T>> listener) { - Scheduler.get().scheduleDeferred(new ScheduledCommand() { - public void execute() { - Menu menu = null; - if (actionCollection != null) { - menu = new Menu(); - // Remove if when retrieved rights of siblings - for (final ActionItem<T> actionItem : actionCollection) { - final ActionDescriptor<T> action = actionItem.getAction(); - if (actionItem.mustBeEnabled()) { - final Item item = new Item(action.getText()); - item.setIcon(action.getIconUrl()); - menu.addItem(item); - item.addListener(new BaseItemListenerAdapter() { - @Override - public void onClick(final BaseItem item, final EventObject e) { - listener.onEvent(actionItem); - } - }); - } - } - } - contextMenus.put(id, menu); - } - }); - } - - public Menu get(final String id) { - return contextMenus.get(id); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/OldAbstractAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/OldAbstractAction.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/OldAbstractAction.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,168 +0,0 @@ -/* 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.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 - */ -@Deprecated -public abstract class OldAbstractAction extends ChangebleObject implements Action { - - /** - * A flag that indicates whether or not the action is enabled. - */ - protected boolean enabled = true; - - /** - * Creates a new action with no properties set. - */ - public OldAbstractAction() { - // Nothing to do. - } - - /** - * Copy constructor used as a substitute of clone - */ - @SuppressWarnings("unchecked") - public OldAbstractAction(final OldAbstractAction 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. - * - * @param name - * the name (<code>null</code> permitted). - */ - public OldAbstractAction(final String name) { - // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09 - // 15:19 - 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 OldAbstractAction(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); - } - - /** - * Returns the flag that indicates whether or not the action is enabled. - * - * @return The flag. - * - * @see #setEnabled(boolean) - */ - @Override - public boolean isEnabled() { - return enabled; - } - - @Override - /** - * 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) { - // TODO Auto-generated method stub - super.putValue(key, value); - } - - /** - * 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() - */ - @Override - public void setEnabled(final boolean enabled) { - if (enabled != this.enabled) { - this.enabled = enabled; - firePropertyChange(ENABLED, !this.enabled, this.enabled); - } - } - - public void setShortcut(final KeyStroke key) { - putValue(Action.ACCELERATOR_KEY, key); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeEvent.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeEvent.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeEvent.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,185 +0,0 @@ -/* 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 ([email protected]) - * @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 Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeListener.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeListener.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeListener.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,58 +0,0 @@ -/* 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 Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeListenerProxy.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeListenerProxy.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeListenerProxy.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,99 +0,0 @@ -/* 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 ([email protected]) - * @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 Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,440 +0,0 @@ -/* 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.Map.Entry; -import java.util.Vector; - -/** - * 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 ([email protected]) - * @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) { - // @PMD:REVIEWED:AvoidThrowingNullPointerException: by vjrj on - // 21/05/09 14:12 - 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) { - final 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 - */ - // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:12 - public void addPropertyChangeListener(final String propertyName, PropertyChangeListener l) { - if (l == null) { - return; - } - - while (l instanceof PropertyChangeListenerProxy) { - final 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); - } - } - final HashMap<String, PropertyChangeSupport> h = children; // Be - // thread-safe. - if (h != null && event.propertyName != null) { - final 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() { - final ArrayList<PropertyChangeListener> list = new ArrayList<PropertyChangeListener>(); - if (listeners != null) { - list.addAll(listeners); - } - if (children != null) { - int i = children.size(); - final Iterator<Entry<String, PropertyChangeSupport>> iter = children.entrySet().iterator(); - while (--i >= 0) { - final Entry<String, PropertyChangeSupport> e = iter.next(); - final String name = e.getKey(); - final 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]; - } - final 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) { - final 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 - */ - // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:12 - public void removePropertyChangeListener(final String propertyName, PropertyChangeListener l) { - if (children == null) { - return; - } - final PropertyChangeSupport s = children.get(propertyName); - if (s == null) { - return; - } - while (l instanceof PropertyChangeListenerProxy) { - final 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 Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/RadioMustBeChecked.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/RadioMustBeChecked.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/RadioMustBeChecked.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,24 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -public interface RadioMustBeChecked { - boolean mustBeChecked(); -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/Shortcut.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/Shortcut.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/Shortcut.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,44 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.actions; - -import org.ourproject.kune.platf.client.shortcuts.Keyboard; - -public final class Shortcut { - - public static KeyStroke getShortcut(final boolean ctrl, final boolean alt, final boolean shift, final boolean meta, - final Character character) { - return KeyStroke.getKeyStroke(character, (ctrl ? Keyboard.MODIFIER_CTRL : 0) - + (alt ? Keyboard.MODIFIER_ALT : 0) + (shift ? Keyboard.MODIFIER_SHIFT : 0) - + (meta ? Keyboard.MODIFIER_META : 0)); - } - - public static KeyStroke getShortcut(final boolean ctrl, final boolean shift, final Character character) { - return getShortcut(ctrl, false, shift, false, character); - } - - public static KeyStroke getShortcut(final boolean ctrl, final Character character) { - return getShortcut(ctrl, false, false, false, character); - } - - private Shortcut() { - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractLabel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractLabel.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractLabel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,72 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.DoubleClickHandler; -import com.google.gwt.event.dom.client.MouseDownHandler; -import com.google.gwt.event.dom.client.MouseMoveHandler; -import com.google.gwt.event.dom.client.MouseOutHandler; -import com.google.gwt.event.dom.client.MouseOverHandler; -import com.google.gwt.event.dom.client.MouseUpHandler; -import com.google.gwt.event.dom.client.MouseWheelHandler; -import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.user.client.Element; -import com.google.gwt.user.client.Event; - -public interface AbstractLabel { - - HandlerRegistration addClickHandler(final ClickHandler handler); - - HandlerRegistration addDoubleClickHandler(final DoubleClickHandler handler); - - HandlerRegistration addMouseDownHandler(final MouseDownHandler handler); - - HandlerRegistration addMouseMoveHandler(final MouseMoveHandler handler); - - HandlerRegistration addMouseOutHandler(final MouseOutHandler handler); - - HandlerRegistration addMouseOverHandler(final MouseOverHandler handler); - - HandlerRegistration addMouseUpHandler(final MouseUpHandler handler); - - HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler); - - void addStyleDependentName(String string); - - Element getElement(); - - String getText(); - - void onBrowserEvent(final Event event); - - void removeStyleDependentName(String string); - - void setColor(final String color); - - void setStylePrimaryName(String string); - - void setText(final String text); - - void setTitle(final String title); - - void setVisible(boolean visible); - -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractSearcherPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractSearcherPanel.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractSearcherPanel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,147 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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 java.util.Map; - -import cc.kune.core.shared.i18n.I18nTranslationService; - -import com.extjs.gxt.ui.client.data.BaseListLoader; -import com.extjs.gxt.ui.client.data.BasePagingLoadConfig; -import com.extjs.gxt.ui.client.data.HttpProxy; -import com.extjs.gxt.ui.client.data.JsonLoadResultReader; -import com.extjs.gxt.ui.client.data.ListLoadResult; -import com.extjs.gxt.ui.client.data.ModelData; -import com.extjs.gxt.ui.client.data.ModelType; -import com.extjs.gxt.ui.client.data.PagingLoadConfig; -import com.extjs.gxt.ui.client.event.Events; -import com.extjs.gxt.ui.client.event.GridEvent; -import com.extjs.gxt.ui.client.event.Listener; -import com.extjs.gxt.ui.client.store.ListStore; -import com.extjs.gxt.ui.client.store.Store; -import com.extjs.gxt.ui.client.store.StoreFilter; -import com.extjs.gxt.ui.client.widget.grid.Grid; -import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel; -import com.extjs.gxt.ui.client.widget.toolbar.PagingToolBar; -import com.extjs.gxt.ui.client.widget.toolbar.PagingToolBar.PagingToolBarMessages; -import com.google.gwt.core.client.GWT; -import com.google.gwt.http.client.RequestBuilder; - -public class AbstractSearcherPanel { - - protected static final int PAGINATION_SIZE = 10; - protected final I18nTranslationService i18n; - - public AbstractSearcherPanel(final I18nTranslationService i18n) { - this.i18n = i18n; - } - - protected void createPagingToolbar(final Store store, final Grid grid) { - final PagingToolBar pag = new PagingToolBar(PAGINATION_SIZE); - final PagingToolBarMessages msgs = new PagingToolBarMessages(); - - msgs.setDisplayMsg(i18n.tWithNT("Displaying results {0} - {1} of {2}", - "Respect {} values in translations. " - + "This will produce: 'Displaying results 1 - 25 of 95465' for instance")); - msgs.setEmptyMsg(i18n.t("No results to display")); - msgs.setFirstText(i18n.t("First Page")); - msgs.setAfterPageText(i18n.tWithNT("of {0}", "Used to show multiple results: '1 of 30'")); - msgs.setBeforePageText(i18n.t("Page")); - msgs.setLastText(i18n.t("Last Page")); - msgs.setNextText(i18n.t("Next Page")); - msgs.setPrevText(i18n.t("Previous Page")); - msgs.setRefreshText(i18n.t("Refresh")); - pag.setMessages(msgs); - // pag.setStore(store); - // pag.setDisplayInfo(true); - // grid.setBottomToolbar(pag); - grid.setLoadMask(true); - // grid.setLoadMask(i18n.t("Searching")); - grid.setSelectionModel(new GridSelectionModel()); - grid.setBorders(false); - // grid.setFrame(true); - grid.setStripeRows(true); - } - - protected Store createStore(final ModelType type, final String url, final String id, final Grid grid) { - final String path = GWT.getHostPageBaseURL() + url; - - // use a http proxy to get the data - final RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, path); - final HttpProxy<String> proxy = new HttpProxy<String>(builder); - - // need a loader, proxy, and reader - final JsonLoadResultReader<ListLoadResult<ModelData>> reader = new JsonLoadResultReader<ListLoadResult<ModelData>>( - type); - - final BaseListLoader<ListLoadResult<ModelData>> loader = new BaseListLoader<ListLoadResult<ModelData>>( - proxy, reader); - loader.setRemoteSort(true); - - final ListStore<ModelData> store = new ListStore<ModelData>(loader); - grid.addListener(Events.Attach, new Listener<GridEvent<ModelData>>() { - @Override - public void handleEvent(final GridEvent<ModelData> be) { - final PagingLoadConfig config = new BasePagingLoadConfig(); - config.setOffset(0); - config.setLimit(PAGINATION_SIZE); - - final Map<String, Object> state = grid.getState(); - if (state.containsKey("offset")) { - final int offset = (Integer) state.get("offset"); - final int limit = (Integer) state.get("limit"); - config.setOffset(offset); - config.setLimit(limit); - } - // if (state.containsKey("sortField")) { - // config.setSortField((String) state.get("sortField")); - // config.setSortDir(SortDir.valueOf((String) state.get("sortDir"))); - // } - loader.load(config); - } - }); - - // this goes to Model... - // reader.setRoot("list"); - // reader.setTotalProperty("size"); - // reader.setId(id); - // final HttpProxy proxy = new HttpProxy(url, Connection.POST); - // return new Store(proxy, reader, true); - - return store; - } - - protected void query(final Store store, final Grid grid, final String query) { - // final UrlParam[] newParams = new UrlParam[] { new UrlParam("query", - // query) }; - // store.setBaseParams(newParams); - // store.load(0, PAGINATION_SIZE); - store.clearFilters(); - store.addFilter(new StoreFilter<ModelData>() { - @Override - public boolean select(final Store<ModelData> store, final ModelData parent, final ModelData item, - final String property) { - // TODO Auto-generated method stub - return false; - } - }); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractToolbar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractToolbar.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractToolbar.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,53 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.HasVerticalAlignment.VerticalAlignmentConstant; -import com.google.gwt.user.client.ui.Widget; - -public interface AbstractToolbar { - - void add(final Widget widget); - - void add(final Widget widget, VerticalAlignmentConstant valign); - - Widget addFill(); - - Widget addSeparator(); - - Widget addSpacer(); - - int getOffsetHeight(); - - void insert(final Widget widget, int position); - - boolean isAttached(); - - void remove(final Widget widget); - - void removeAll(); - - void setBlankStyle(); - - void setHeight(String height); - - void setNormalStyle(); - -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/ContextPropertyPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/ContextPropertyPanel.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/ContextPropertyPanel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,63 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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 org.ourproject.kune.platf.client.services.Images; - -import com.google.gwt.user.client.ui.AbstractImagePrototype; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.DisclosurePanel; -import com.google.gwt.user.client.ui.DisclosurePanelImages; -import com.google.gwt.user.client.ui.Widget; - -public class ContextPropertyPanel extends Composite { - - public ContextPropertyPanel(AbstractImagePrototype headerIcon, String tooltip, String headerText, boolean isOpen, - String debugId, Widget content) { - this(new IconLabel(headerIcon, headerText), tooltip, isOpen, debugId, content); - } - - public ContextPropertyPanel(String headerText, String tooltip, boolean isOpen, String debugId, Widget content) { - DisclosurePanelImages images = new DisclosurePanelImages() { - public AbstractImagePrototype disclosurePanelClosed() { - return Images.App.getInstance().arrowRightWhite(); - } - - public AbstractImagePrototype disclosurePanelOpen() { - return Images.App.getInstance().arrowDownWhite(); - } - }; - DisclosurePanel disclosure = new DisclosurePanel(images, headerText, isOpen); - init(disclosure, tooltip, content, debugId); - } - - public ContextPropertyPanel(Widget header, String tooltip, boolean isOpen, String debugId, Widget content) { - DisclosurePanel disclosure = new DisclosurePanel(header, isOpen); - init(disclosure, tooltip, content, debugId); - } - - private void init(DisclosurePanel disclosure, String tooltip, Widget content, String debugId) { - disclosure.setAnimationEnabled(true); - disclosure.ensureDebugId(debugId); - disclosure.setContent(content); - KuneUiUtils.setQuickTip(disclosure, tooltip); - initWidget(disclosure); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultGrid.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultGrid.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultGrid.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,26 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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; - -public class DefaultGrid { - public DefaultGrid() { - - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,172 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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 org.ourproject.kune.platf.client.services.Images; - -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.user.client.ui.Composite; -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.SimplePanel; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; - -/** - * <p> - * This panel opens when you click on the arrow or the title (gmail style) - * </p> - * - */ -public class DropDownPanel extends Composite implements ClickHandler { - private final VerticalPanel vpanel; - 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; - - public DropDownPanel(final Images img) { - super(); - this.img = img; - vpanel = new VerticalPanel(); - outerBorder = new RoundedPanel(vpanel, RoundedPanel.ALL); - titleHP = new HorizontalPanel(); - arrowImage = new Image(); - titleLabel = new Label(); - contentPanel = new SimplePanel(); - - initWidget(outerBorder); - vpanel.add(titleHP); - vpanel.add(contentPanel); - titleHP.add(arrowImage); - titleHP.add(titleLabel); - - this.stylePrimaryName = "k-dropdownouter"; - outerBorder.setCornerStyleName(stylePrimaryName); - 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"); - - setContentVisibleImpl(false); - arrowImage.addClickHandler(this); - titleLabel.addClickHandler(this); - } - - public DropDownPanel(final Images img, final boolean visible) { - this(img); - setContentVisibleImpl(visible); - } - - public DropDownPanel(final Images img, final String headerText, final boolean visible) { - this(img); - setContentVisibleImpl(visible); - setHeaderTextImpl(headerText); - } - - public boolean isContentVisible() { - return contentPanel.isVisible(); - } - - public void onClick(final ClickEvent event) { - setContentVisible(!isContentVisible()); - } - - public void setBorderStylePrimaryName(final String stylePrimaryName) { - this.stylePrimaryName = stylePrimaryName; - outerBorder.setCornerStyleName(stylePrimaryName); - vpanel.setStylePrimaryName(stylePrimaryName); - } - - public void setContent(final Widget widget) { - contentPanel.setWidget(widget); - // refresh panel - setContentVisible(isContentVisible()); - } - - public void setContentHeight(final String height) { - contentPanel.setHeight(height); - } - - public void setContentVisible(final boolean visible) { - setContentVisibleImpl(visible); - } - - public void setHeaderText(final String text) { - setHeaderTextImpl(text); - } - - public void setHeaderTitle(final String title) { - // QuickTips size problems with images - KuneUiUtils.setQuickTip(arrowImage, title); - KuneUiUtils.setQuickTip(titleLabel, title); - } - - @Override - public void setHeight(final String height) { - super.setHeight(height); - outerBorder.setHeight(height); - } - - public void setTheme(final String oldTheme, final String newTheme) { - if (oldTheme != null) { - // outerBorder.removeStyleDependentName(oldThemeS); - vpanel.removeStyleDependentName(oldTheme); - titleHP.removeStyleDependentName(oldTheme); - contentPanel.removeStyleDependentName(oldTheme); - } - outerBorder.setCornerStyleName(stylePrimaryName + "-" + newTheme); - // outerBorder.addStyleDependentName(newThemeS); - vpanel.addStyleDependentName(newTheme); - titleHP.addStyleDependentName(newTheme); - contentPanel.addStyleDependentName(newTheme); - } - - @Override - public void setWidth(final String width) { - super.setWidth(width); - 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/EditableClickListener.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableClickListener.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableClickListener.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,27 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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; - -public interface EditableClickListener { - - @Deprecated - void onEdited(String text); - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/FlowToolbar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/FlowToolbar.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/FlowToolbar.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,120 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.Composite; -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.HasVerticalAlignment.VerticalAlignmentConstant; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.Widget; - -public class FlowToolbar extends Composite implements AbstractToolbar { - - private final HorizontalPanel mainPanel; - private final FlowPanel childPanel; - - public FlowToolbar() { - super(); - mainPanel = new HorizontalPanel(); - childPanel = new FlowPanel(); - mainPanel.add(childPanel); - initWidget(mainPanel); - } - - public void add(final Widget widget) { - childPanel.add(widget); - } - - public void add(final Widget widget, final VerticalAlignmentConstant valign) { - childPanel.add(widget); - } - - public Widget addFill() { - final Label emptyLabel = new Label(""); - emptyLabel.addStyleName("kune-floatleft"); - this.add(emptyLabel); - return emptyLabel; - } - - public Widget addSeparator() { - final Label emptyLabel = new Label(""); - emptyLabel.setStyleName("ytb-sep"); - emptyLabel.addStyleName("k-toolbar-sep"); - emptyLabel.addStyleName("kune-floatleft"); - this.add(emptyLabel); - return emptyLabel; - } - - public Widget addSpacer() { - final Label emptyLabel = new Label(""); - emptyLabel.setStyleName("ytb-spacer"); - emptyLabel.addStyleName("kune-floatleft"); - this.add(emptyLabel); - return emptyLabel; - } - - public void insert(final Widget widget, final int position) { - childPanel.insert(widget, position); - } - - public void remove(final Widget widget) { - childPanel.remove(widget); - } - - public void removeAll() { - childPanel.clear(); - } - - /** - * Set the blank style - */ - public void setBlankStyle() { - setBasicStyle(); - addStyleName("k-blank-toolbar"); - } - - @Override - public void setHeight(final String height) { - mainPanel.setHeight(height); - childPanel.setHeight(height); - } - - /** - * Set the normal grey style - */ - public void setNormalStyle() { - setBasicStyle(); - addStyleName("k-toolbar-bottom-line"); - } - - /** - * Set the transparent style - */ - public void setTranspStyle() { - setBasicStyle(); - addStyleName("k-transp"); - } - - private void setBasicStyle() { - setStyleName("x-toolbar"); - addStyleName("x-panel"); - } -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/HasColor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/HasColor.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/HasColor.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,26 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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; - -public interface HasColor { - void setColor(String color); - - String getColor(); -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/HorizontalLine.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/HorizontalLine.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/HorizontalLine.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,29 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.HTML; - -final public class HorizontalLine extends HTML { - - public HorizontalLine() { - this.setHTML("<hr noshadow size='1'>"); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,165 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.DoubleClickEvent; -import com.google.gwt.event.dom.client.DoubleClickHandler; -import com.google.gwt.event.dom.client.HasAllMouseHandlers; -import com.google.gwt.event.dom.client.HasClickHandlers; -import com.google.gwt.event.dom.client.HasDoubleClickHandlers; -import com.google.gwt.event.dom.client.MouseDownEvent; -import com.google.gwt.event.dom.client.MouseDownHandler; -import com.google.gwt.event.dom.client.MouseMoveEvent; -import com.google.gwt.event.dom.client.MouseMoveHandler; -import com.google.gwt.event.dom.client.MouseOutEvent; -import com.google.gwt.event.dom.client.MouseOutHandler; -import com.google.gwt.event.dom.client.MouseOverEvent; -import com.google.gwt.event.dom.client.MouseOverHandler; -import com.google.gwt.event.dom.client.MouseUpEvent; -import com.google.gwt.event.dom.client.MouseUpHandler; -import com.google.gwt.event.dom.client.MouseWheelEvent; -import com.google.gwt.event.dom.client.MouseWheelHandler; -import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.Element; -import com.google.gwt.user.client.ui.AbstractImagePrototype; -import com.google.gwt.user.client.ui.Widget; - -public class IconHyperlink extends Widget implements AbstractLabel, HasClickHandlers, HasDoubleClickHandlers, - HasAllMouseHandlers { - - private Element anchorElem; - - private String targetHistoryToken; - private final Element link; - private final Element icon; - - public IconHyperlink(final AbstractImagePrototype image) { - setElement(DOM.createDiv()); - DOM.appendChild(getElement(), anchorElem = DOM.createAnchor()); - setStyleName("kune-IconHyperlink"); - icon = image.createImage().getElement(); - link = DOM.createSpan(); - DOM.appendChild(anchorElem, icon); - DOM.appendChild(anchorElem, link); - } - - public IconHyperlink(final AbstractImagePrototype image, final String text, final boolean asHTML, - final String targetHistoryToken) { - this(image); - if (asHTML) { - setLabelHtmlImpl(text); - } else { - setLabelTextImpl(text); - } - setTargetHistoryTokenImpl(targetHistoryToken); - } - - public IconHyperlink(final AbstractImagePrototype image, final String text, final String targetHistoryToken) { - this(image); - setLabelTextImpl(text); - setTargetHistoryTokenImpl(targetHistoryToken); - } - - public HandlerRegistration addClickHandler(final ClickHandler handler) { - return addDomHandler(handler, ClickEvent.getType()); - } - - public HandlerRegistration addDoubleClickHandler(final DoubleClickHandler handler) { - return addDomHandler(handler, DoubleClickEvent.getType()); - } - - public HandlerRegistration addMouseDownHandler(final MouseDownHandler handler) { - return addDomHandler(handler, MouseDownEvent.getType()); - } - - public HandlerRegistration addMouseMoveHandler(final MouseMoveHandler handler) { - return addDomHandler(handler, MouseMoveEvent.getType()); - } - - public HandlerRegistration addMouseOutHandler(final MouseOutHandler handler) { - return addDomHandler(handler, MouseOutEvent.getType()); - } - - public HandlerRegistration addMouseOverHandler(final MouseOverHandler handler) { - return addDomHandler(handler, MouseOverEvent.getType()); - } - - public HandlerRegistration addMouseUpHandler(final MouseUpHandler handler) { - return addDomHandler(handler, MouseUpEvent.getType()); - } - - public HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler) { - return addDomHandler(handler, MouseWheelEvent.getType()); - } - - public String getTargetHistoryToken() { - return targetHistoryToken; - } - - public String getText() { - return DOM.getInnerText(link); - } - - public void setColor(final String color) { - DOM.setStyleAttribute(link, "color", color); - } - - public void setImage(final AbstractImagePrototype image) { - DOM.setInnerHTML(icon, image.getHTML()); - } - - public void setLabelHTML(final String html) { - setLabelHtmlImpl(html); - } - - public void setLabelText(final String text) { - setLabelTextImpl(text); - } - - public void setTargetHistoryToken(final String targetHistoryToken) { - setTargetHistoryTokenImpl(targetHistoryToken); - } - - public void setText(final String text) { - setLabelText(text); - } - - @Override - public void setTitle(final String title) { - 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 Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,237 +0,0 @@ -/* - * Copyright 2007 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - * - * Adapted by Vicente J. Ruiz Jurado for kune - \*/ -package org.ourproject.kune.platf.client.ui; - -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.DoubleClickEvent; -import com.google.gwt.event.dom.client.DoubleClickHandler; -import com.google.gwt.event.dom.client.HasAllMouseHandlers; -import com.google.gwt.event.dom.client.HasClickHandlers; -import com.google.gwt.event.dom.client.HasDoubleClickHandlers; -import com.google.gwt.event.dom.client.MouseDownEvent; -import com.google.gwt.event.dom.client.MouseDownHandler; -import com.google.gwt.event.dom.client.MouseMoveEvent; -import com.google.gwt.event.dom.client.MouseMoveHandler; -import com.google.gwt.event.dom.client.MouseOutEvent; -import com.google.gwt.event.dom.client.MouseOutHandler; -import com.google.gwt.event.dom.client.MouseOverEvent; -import com.google.gwt.event.dom.client.MouseOverHandler; -import com.google.gwt.event.dom.client.MouseUpEvent; -import com.google.gwt.event.dom.client.MouseUpHandler; -import com.google.gwt.event.dom.client.MouseWheelEvent; -import com.google.gwt.event.dom.client.MouseWheelHandler; -import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.Element; -import com.google.gwt.user.client.ui.AbstractImagePrototype; -import com.google.gwt.user.client.ui.HasHorizontalAlignment; -import com.google.gwt.user.client.ui.HasText; -import com.google.gwt.user.client.ui.HasWordWrap; -import com.google.gwt.user.client.ui.Widget; - -/** - * A widget that contains a icon and arbitrary text, <i>not</i> interpreted as - * HTML. - * - * <h3>CSS Style Rules</h3> <ul class='css'> <li>.kune-IconLabel { }</li> </ul> - * - * <p> - * <h3>Example</h3> - * {@example com.google.gwt.examples.HTMLExample} - * </p> - */ - -public class IconLabel extends Widget implements HasClickHandlers, HasDoubleClickHandlers, HasAllMouseHandlers, - HasHorizontalAlignment, HasText, HasWordWrap, AbstractLabel { - - private HorizontalAlignmentConstant horzAlign; - - private Element icon; - - 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()); - 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 - * the icon to add - * @param text - * the new label's text - */ - public IconLabel(final AbstractImagePrototype image, final String text) { - this(image, true); - setTextImpl(text); - } - - /** - * Creates a label with the specified text and a icon in the left. - * - * @param image - * the icon to add - * @param text - * the new label's text - * @param wordWrap - * <code>false</code> to disable word wrapping - */ - public IconLabel(final AbstractImagePrototype image, final String text, final boolean wordWrap) { - this(image, text); - setWordWrapImpl(wordWrap); - } - - /** - * Creates a label with the specified text and a icon in the right. - * - * @param image - * the icon to add - * @param text - * the new label's text - */ - public IconLabel(final String text, final AbstractImagePrototype image) { - this(image, false); - setTextImpl(text); - } - - /** - * Creates a label with the specified text and a icon in the right. - * - * @param image - * the icon to add - * @param text - * the new label's text - * @param wordWrap - * <code>false</code> to disable word wrapping - */ - public IconLabel(final String text, final AbstractImagePrototype image, final boolean wordWrap) { - this(text, image); - setWordWrapImpl(wordWrap); - } - - public HandlerRegistration addClickHandler(final ClickHandler handler) { - return addDomHandler(handler, ClickEvent.getType()); - } - - public HandlerRegistration addDoubleClickHandler(final DoubleClickHandler handler) { - return addDomHandler(handler, DoubleClickEvent.getType()); - } - - public HandlerRegistration addMouseDownHandler(final MouseDownHandler handler) { - return addDomHandler(handler, MouseDownEvent.getType()); - } - - public HandlerRegistration addMouseMoveHandler(final MouseMoveHandler handler) { - return addDomHandler(handler, MouseMoveEvent.getType()); - } - - public HandlerRegistration addMouseOutHandler(final MouseOutHandler handler) { - return addDomHandler(handler, MouseOutEvent.getType()); - } - - public HandlerRegistration addMouseOverHandler(final MouseOverHandler handler) { - return addDomHandler(handler, MouseOverEvent.getType()); - } - - public HandlerRegistration addMouseUpHandler(final MouseUpHandler handler) { - return addDomHandler(handler, MouseUpEvent.getType()); - } - - public HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler) { - return addDomHandler(handler, MouseWheelEvent.getType()); - } - - public HorizontalAlignmentConstant getHorizontalAlignment() { - return horzAlign; - } - - public String getText() { - return DOM.getInnerText(textLabel); - } - - public boolean getWordWrap() { - return !DOM.getStyleAttribute(textLabel, "whiteSpace").equals("nowrap"); - } - - public void setColor(final String color) { - DOM.setStyleAttribute(textLabel, "color", color); - } - - public void setHorizontalAlignment(final HorizontalAlignmentConstant align) { - horzAlign = align; - DOM.setStyleAttribute(textLabel, "textAlign", align.getTextAlignString()); - } - - public void setIcon(final AbstractImagePrototype image) { - setIconImpl(image); - } - - public void setStyleNameToText(final String styleName) { - DOM.setElementProperty(textLabel.<com.google.gwt.user.client.Element> cast(), "className", styleName); - } - - public void setText(final String text) { - setTextImpl(text); - } - - @Override - public void setTitle(final String title) { - KuneUiUtils.setQuickTip(icon, title); - KuneUiUtils.setQuickTip(textLabel, title); - } - - public void setWordWrap(final boolean wrap) { - 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 Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,245 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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 java.util.ArrayList; -import java.util.List; - -import com.calclab.suco.client.events.Listener2; -import com.google.gwt.event.dom.client.BlurEvent; -import com.google.gwt.event.dom.client.BlurHandler; -import com.google.gwt.event.dom.client.ChangeEvent; -import com.google.gwt.event.dom.client.ChangeHandler; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.DoubleClickEvent; -import com.google.gwt.event.dom.client.DoubleClickHandler; -import com.google.gwt.event.dom.client.MouseOutEvent; -import com.google.gwt.event.dom.client.MouseOutHandler; -import com.google.gwt.event.dom.client.MouseOverEvent; -import com.google.gwt.event.dom.client.MouseOverHandler; -import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.user.client.ui.AbstractImagePrototype; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.TextBox; -import com.google.gwt.user.client.ui.Widget; - -/** - * @author vjrj - * - */ -public class IconLabelEditable extends Composite { - - private ClickHandler clickHandler; - private String clickLabel; - private String currentText; - private String dblClickLabel; - private DoubleClickHandler doubleClickHandler; - // private Event2<String, String> onEditEvent; - private TextBox editor; - private HorizontalPanel hpanel; - private final AbstractLabel label; - private MouseOutHandler mouseOutHandler; - private MouseOverHandler mouseOverHandler; - private List<HandlerRegistration> registrations; - private boolean useDoubleClick; - - public IconLabelEditable() { - this(""); - } - - 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 targetToken, // NO_UCD - final boolean useDoubleClick) { - super(); - label = new IconHyperlink(icon, text, targetToken); - init(text, useDoubleClick); - } - - public IconLabelEditable(final String text) { - this(text, 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) { // NO_UCD - super(); - label = new LabelWrapper(text, wordWrap); - init(text, useDoubleClick); - } - - private void afterEdit() { - final String text = editor.getText(); - // onEditEvent.fire(currentText, text); - setTextImpl(text); - editor.setVisible(false); - editor.setReadOnly(true); - label.setVisible(true); - label.removeStyleDependentName("high"); - } - - public void edit() { - showEditor(); - editor.setFocus(true); - } - - public String getText() { - return label.getText(); - } - - private void init(final String text, final boolean useDoubleClick) { - // this.onEditEvent = new Event2<String, String>("onLabelEdit"); - registrations = new ArrayList<HandlerRegistration>(); - dblClickLabel = "Double click to rename"; - clickLabel = "Click to rename"; - hpanel = new HorizontalPanel(); - hpanel.add((Widget) label); - initWidget(hpanel); - this.currentText = text; - this.useDoubleClick = useDoubleClick; - label.setStylePrimaryName("kune-EditableLabel"); - doubleClickHandler = new DoubleClickHandler() { - @Override - public void onDoubleClick(final DoubleClickEvent event) { - showEditor(); - } - }; - clickHandler = new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - showEditor(); - } - }; - mouseOverHandler = new MouseOverHandler() { - @Override - public void onMouseOver(final MouseOverEvent event) { - label.addStyleDependentName("high"); - } - }; - mouseOutHandler = new MouseOutHandler() { - @Override - public void onMouseOut(final MouseOutEvent event) { - label.removeStyleDependentName("high"); - } - }; - setEditableImpl(false); - } - - public void onEdit(final Listener2<String, String> slot) { - // onEditEvent.add(slot); - } - - private void reset() { - label.removeStyleDependentName("noneditable"); - label.removeStyleDependentName("editable"); - for (final HandlerRegistration reg : registrations) { - reg.removeHandler(); - } - registrations.clear(); - } - - /** - * 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; - } - - /** - * 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) { - setEditableImpl(editable); - } - - private void setEditableImpl(final boolean editable) { - reset(); - if (editable) { - if (useDoubleClick) { - label.setTitle(dblClickLabel); - registrations.add(label.addDoubleClickHandler(doubleClickHandler)); - } else { - label.setTitle(clickLabel); - registrations.add(label.addClickHandler(clickHandler)); - } - registrations.add(label.addMouseOverHandler(mouseOverHandler)); - registrations.add(label.addMouseOutHandler(mouseOutHandler)); - label.addStyleDependentName("editable"); - } else { - label.setTitle(null); - label.addStyleDependentName("noneditable"); - } - } - - public void setText(final String text) { - setTextImpl(text); - } - - private void setTextImpl(final String text) { - this.currentText = text; - label.setText(text); - } - - private void showEditor() { - final int hpWidth = hpanel.getParent().getOffsetWidth(); - label.setVisible(false); - if (editor == null) { - editor = new TextBox(); - editor.setStyleName("k-eil-edit"); - hpanel.add(editor); - editor.addBlurHandler(new BlurHandler() { - @Override - public void onBlur(final BlurEvent event) { - afterEdit(); - } - }); - editor.addChangeHandler(new ChangeHandler() { - @Override - public void onChange(final ChangeEvent event) { - editor.setFocus(false); - } - }); - } - editor.setReadOnly(false); - editor.setPixelSize(hpWidth < 100 ? 100 : hpWidth - 3, 21); - editor.setText(currentText); - editor.setVisible(true); - editor.setFocus(true); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneStringUtils.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneStringUtils.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneStringUtils.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,31 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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 cc.kune.common.client.utils.TextUtils; - -/** - * Use TextUtils - * - */ -@Deprecated -public class KuneStringUtils extends TextUtils { - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,144 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.DOM; -import com.google.gwt.user.client.Element; -import com.google.gwt.user.client.Timer; -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; - -@Deprecated -public final class KuneUiUtils { - - public enum IconPosition { - left, right - } - - public static void focusOnField(final Field field) { - new Timer() { - @Override - public void run() { - field.focus(true); - } - }.schedule(50); - } - - public static String genQuickTipLabel(final String labelText, final String tipTitle, final String tipText) { - String tipHtml = "<span style=\"vertical-align: middle;\" ext:qtip=\"" + tipText + "\""; - if (tipTitle != null && tipTitle.length() > 0) { - tipHtml += " ext:qtitle=\"" + tipTitle + "\""; - } - tipHtml += ">"; - tipHtml += labelText; - tipHtml += "</span>"; - return tipHtml; - } - - public static String genQuickTipLabel(final String labelText, final String tipTitle, final String tipText, - 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 + "\""; - } - tipHtml += ">"; - final Image iconImg = new Image(); - icon.applyTo(iconImg); - iconImg.setStyleName("vamiddle"); - // setQuickTip(iconImg, tipText, tipTitle); - - final ToolTip tooltip = new ToolTip(); - tooltip.setHtml(tipText); - tooltip.setWidth(250); - tooltip.applyTo(iconImg.getElement()); - - if (iconPosition.equals(IconPosition.left)) { - tipHtml += iconImg.toString(); - tipHtml += " "; - tipHtml += labelText; - } else if (iconPosition.equals(IconPosition.right)) { - tipHtml += labelText; - tipHtml += " "; - tipHtml += iconImg.toString(); - } - tipHtml += "</span>"; - return tipHtml; - } - - public static String genQuickTipWithImage(final String imageResizedUrl, final int size) { - return new Image(imageResizedUrl).toString(); - } - - /** - * Use widget.setTitle if you don't want to use extjs (but remember that - * title is limited to 64chars). - * - * Bug: extjs quicktips don't work with images or span inside divs (like - * pushbutton). See: http://extjs.com/forum/showthread.php?t=22293 - * http://extjs.com/forum/showthread.php?t=5200 - * - * @param element - * @param tip - */ - public static void setQuickTip(final Element element, final String tipText) { - setQuickTip(element, tipText, null); - } - - public static void setQuickTip(final Element element, final String tipText, final String tipTitle) { - // If we don't want to use ext, use 'title' instead (limited to 64 - // chars) - if (tipText == null || tipText.length() == 0) { - DOM.removeElementAttribute(element, "ext:qtip"); - } else { - final ToolTip tip = new ToolTip(); - tip.setHtml(tipText); - if (tipTitle != null) { - tip.setTitle(tipTitle); - } - tip.applyTo(element); - // check size here? - // String newTip = "<div style='min-width: 35px'>" + tip + "</div>"; - } - } - - public static void setQuickTip(final Widget widget, final String tip) { - setQuickTip(widget.getElement(), tip); - } - - 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(); - } - - private KuneUiUtils() { - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/LabelWrapper.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/LabelWrapper.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/LabelWrapper.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,50 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.event.dom.client.DoubleClickEvent; -import com.google.gwt.event.dom.client.DoubleClickHandler; -import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.ui.Label; - -public class LabelWrapper extends Label implements AbstractLabel { - - public LabelWrapper() { - super(); - } - - public LabelWrapper(final String text) { - super(text); - } - - public LabelWrapper(final String text, final boolean wordWrap) { - super(text, wordWrap); - } - - public HandlerRegistration addDoubleClickHandler(final DoubleClickHandler handler) { - return addDomHandler(handler, DoubleClickEvent.getType()); - } - - public void setColor(final String color) { - DOM.setStyleAttribute(super.getElement(), "color", color); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItem.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItem.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItem.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,48 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.calclab.suco.client.events.Listener; - -public class MenuItem<T> { - - final String icon; - final String title; - private final Listener<T> listener; - - public MenuItem(final String icon, final String title, final Listener<T> listener) { - this.icon = icon; - this.title = title; - this.listener = listener; - - } - - public void fire(final T id) { - listener.onEvent(id); - } - - public String getIcon() { - return icon; - } - - public String getTitle() { - return title; - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItemCollection.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItemCollection.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/MenuItemCollection.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,49 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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/>. - * - */ -/* - * - * ((e)) emite: A pure gwt (Google Web Toolkit) xmpp (jabber) library - * - * (c) 2008-2009 The emite development team (see CREDITS for details) - * This file is part of emite. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.platf.client.ui; - -import java.util.ArrayList; - -public class MenuItemCollection<T> extends ArrayList<MenuItem<T>> { - - private static final long serialVersionUID = -4719030300216601947L; - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/QuickTipsHelper.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/QuickTipsHelper.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/QuickTipsHelper.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,36 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.gwtext.client.widgets.QuickTip; -import com.gwtext.client.widgets.QuickTips; - -public class QuickTipsHelper { - - public QuickTipsHelper() { - QuickTips.init(); - final QuickTip quickTipInstance = QuickTips.getQuickTip(); - quickTipInstance.setInterceptTitles(true); - quickTipInstance.setDismissDelay(7000); - quickTipInstance.setHideDelay(400); - quickTipInstance.setMinWidth(100); - quickTipInstance.setShowDelay(1500); - } -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/RoundedPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/RoundedPanel.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/RoundedPanel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,512 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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/>. - * - */ -/* - * Copyright 2007 Hilbrand Bouwkamp, [email protected] - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - \*/ -package org.ourproject.kune.platf.client.ui; - -import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.Element; -import com.google.gwt.user.client.ui.SimplePanel; -import com.google.gwt.user.client.ui.Widget; - -/** - * The <code>RoundedPanel</code> class adds similar rounded corners, as seen in - * other Google applications, to a widget. This is done by adding several - * <code>div</code> Elements around a Widget. The HTML code roughly for a corner - * height 2 looks as follows: - * - * <pre> - * <div> - * <div style="margin:0 2px"></div> - * <div style="margin:0 1px"></div> - * <div>your widget</div> - * <div style="margin:0 1px"></div> - * <div style="margin:0 2px"></div> - * </div> - * </pre> - * - * To add the rounded corners to a widget start simply wrap your own widget in - * the <code>RoundedPanel</code> class, for example with all corners rounded: - * - * <pre> - * // all 4 corners are rounded. - * RoundedPanel rp = new RoundedPanel(yourWidget); - * // use rp where you would use 'yourWidget' otherwise - * </pre> - * - * Or with custom set corners, like only on the left: - * - * <pre> - * // custom set corners - * RoundedPanel rp = new RoundedPanel(yourWidget, RoundedPanel.LEFT); - * // use rp where you would use 'yourWidget' otherwise - * </pre> - * - * By default the height of the corners is 2px. It is possible to set a - * different height at construction time. The height can be a value between and - * including 1 and 9. This value doesn't correspond exactly with the height, - * e.g. 9 is 12px heigh. - * - * <pre> - * // all 4 corners are rounded and height index 5 - * RoundedPanel rp = new RoundedPanel(yourWidget, ALL, 5); - * // use rp where you would use 'yourWidget' otherwise - * </pre> - * - * Programmatically set the color of the corners with - * {@link #setCornerColor(String)}: - * - * <pre> - * // all 4 corners are rounded. - * RoundedPanel rp = new RoundedPanel(yourWidget); - * rp.setCornerColor("red"); - * </pre> - * - * Default the css style name of the rounded corner divs is <code>cbg-RP</code>. - * Use it to set the colors of the corner. For example: - * - * <pre> - * .cbg-RP { background-color:#c3d9ff; } - * </pre> - * - * A custom style might be needed when the corners are visible only when a panel - * is selected (see the KitchenSink example modification below). Use the - * <code>setCornerStyleName</code> method to set the custom style name. For - * example set a custom style <code>my-RP</code> and add something like the - * following to the stylesheet: - * - * <pre> - * .selected .my-RP { background-color:#c3d9ff; } - * </pre> - * - * <h3>Adding rounded corners to DialogBox widgets</h3> Adding rounded corners - * to a <code>DialogBox</code> is somewhat more complicated. The problem with - * <code>DialogBox</code> is that it uses a private panel and the - * <code>RoundedPanel</code> should be applied to this private - * <code>Panel</code>. To add the rounded corners to a <code>DialogBox</code> - * you have to rewrite the implementation of the <code>DialogBox</code>. For the - * <code>DialogBox</code> widget this can be done as follows. First create a new - * class like <code>RoundedDialogBox</code> and copy the code from the original - * <code>DialogBox</code> (Please take the copyright of this class into - * account). Next make the following changes to the code: - * - * <pre> - * // Private variable for RoundedPanel - * private RoundedPanel rp; - * </pre> - * - * In the constructor change: - * - * <pre> - * super.add(panel); - * </pre> - * - * into: - * - * <pre> - * rp = new RoundedPanel(panel); - * super.add(rp); - * </pre> - * - * Next change the style, otherwise the style of the dialog box is applied to - * the rounded lines too. Do this by changing the following line: - * - * <pre> - * setStyleName("gwt-DialogBox"); - * </pre> - * - * into: - * - * <pre> - * panel.setStyleName("gwt-DialogBox"); - * </pre> - * - * In your css add the color of the border, something like: - * - * <pre> - * .cbg-RP { background-color:#AAAAAA; } - * </pre> - * - * There seems to be a problem with the width under IE. The RoundedPanel divs - * don't follow the width of the dialog. To fix this change the - * <code>show</code> method as follows: - * - * <pre> - * public void show() { - * super.show(); - * // (The width must be set after the super.show() otherwise it will be 0). - * // NOTE: As of GWT 1.1 the .getOffsetWidth() returns 0 at this point. - * // This is different with earlier versions of GWT. Disable the line will make - * // the rounded corners work in at least Firefox 1.5, but not in IE. - * // I'm looking into this issue. - * rp.setWidth(panel.getOffsetWidth() + "px"); - * } - * </pre> - * - * Now by extending your own dialog class on this <code>RoundedDialogBox</code> - * instead of the original <code>DialogBox</code> you will have rounded corners - * around your dialog. - * - * - * @author Hilbrand Bouwkamp([email protected]) - * @version 1.3 - */ -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 - */ - public final static int TOPLEFT = 1; - - /** - * <code>TOPRIGHT</code> top right rounded corner - */ - public final static int TOPRIGHT = 2; - - /** - * <code>BOTTOMLEFT</code> bottom left rounded corner - */ - public final static int BOTTOMLEFT = 4; - - /** - * <code>BOTTOMRIGHT</code> bottom right rounded corner - */ - public final static int BOTTOMRIGHT = 8; - - /** - * <code>BOTTOM</code> rounded corners at the top - */ - public final static int TOP = TOPLEFT | TOPRIGHT; - - /** - * <code>TOP</code> rounded corners at the bottom - */ - public final static int BOTTOM = BOTTOMLEFT | BOTTOMRIGHT; - - /** - * <code>LEFT</code> rounded corners on the left side - */ - public final static int LEFT = TOPLEFT | BOTTOMLEFT; - - /** - * <code>RIGHT</code> rounded corners on the right side - */ - public final static int RIGHT = TOPRIGHT | BOTTOMRIGHT; - - /** - * <code>ALL</code> rounded corners on all sides - */ - public final static int ALL = TOP | BOTTOM; - - /** - * Default border style - */ - private final static String RPSTYLE = "cbg-RP"; - - /** - * 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 } }; - - /** - * 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 } }; - - /** - * 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" }, }; - - /** - * Element array containing all div elements of the top corner div's. - */ - protected final Element[] divt; - - /** - * Element array containing all div elements of the bottom corner div's. - */ - protected final Element[] divb; - - /** - * Index of the corner height. - */ - protected final int cornerHeight; - - /** - * Index of which corners are set. - */ - protected final int corners; - - private final Element body; // body of widget - private final Element divElement; // div element containing widget - - /** - * Creates a new <code>RoundedPanel</code> with all corners rounded and - * height of corners 2px. Use <code>setWidget</code> to add the widget. - */ - public RoundedPanel() { - this(ALL, 2); - } - - /** - * Creates a new <code>RoundedPanel</code> with custom rounding and height - * of corners 2px but with no widget set. Use <code>setWidget</code> to add - * widget. - * - * Every combination of corners can be set via <code>corners</code>. Use the - * static constants to set the corners. For example, to create a panel with - * only rounded corners at the left, use: - * - * <code>new RoundedPanel(yourWidget, RoundedPanel.LEFT);</code> - * - * @param corners - * set custom rounded corners - */ - public RoundedPanel(final int corners) { - this(corners, 2); - } - - /** - * Creates a new <code>RoundedPanel</code> with custom rounding and custom - * height of the corners but with no widget set. Height can be value from 1 - * to 9. The height for a value 5 or higher is actually larger, e.g. for 5 - * the height is 6px. Use {@link #setWidget(Widget)} to add widget. - * - * @param corners - * set custom rounded corners - * @param cornerHeight - * height index between and including 1 and 9 - * @throws IndexOutOfBoundsException - * when cornerHeight below 1 or above 9 - */ - public RoundedPanel(final int corners, final int cornerHeight) { - super(DOM.createDiv()); - body = getElement(); - if (cornerHeight < 1 || cornerHeight > 9) { - throw new IndexOutOfBoundsException("RoundedPanel height range between and including 1 and 9"); - } - this.cornerHeight = cornerHeight; - divt = new Element[cornerHeight]; - divb = new Element[cornerHeight]; - this.corners = corners; - if (inMask(corners, TOP)) { - final int ct = corners & TOP; - - for (int i = 0; i < cornerHeight; ++i) { - divt[i] = addLine(ct, cornerHeight - (i + 1)); - } - } - divElement = DOM.createDiv(); - DOM.appendChild(body, divElement); - if (inMask(corners, BOTTOM)) { - final int cb = corners & BOTTOM; - - for (int i = cornerHeight - 1; i >= 0; --i) { - divb[i] = addLine(cb, cornerHeight - (i + 1)); - } - } - // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09 - // 14:17 - setCornerStyleName(RPSTYLE); - } - - /** - * Creates a new <code>RoundedPanel</code> with all corners rounded and - * height 2px on the widget <code>w</code>. - * - * @param w - * widget to add corners to - */ - public RoundedPanel(final Widget w) { - this(w, ALL); - } - - /** - * Creates a new <code>RoundedPanel</code> with custom rounded corners and - * height 2px on the widget <code>w</code>. - * - * @param w - * widget to add corners to - * @param corners - * set custom rounded corners - */ - public RoundedPanel(final Widget w, final int corners) { - this(w, corners, 2); - } - - /** - * Creates a new <code>RoundedPanel</code> with custom rounded corners and - * custom height on widget <code>w</code>. - * - * @param w - * widget to add corners to - * @param corners - * set custom rounded corners - * @param cornerHeight - * height index between and including 1 and 9 - */ - public RoundedPanel(final Widget w, final int corners, final int cornerHeight) { - this(corners, cornerHeight); - setWidget(w); - } - - /** - * <p> - * Set the bolder color of the rounded corner by setting the background - * color of the div's. - * </p> - * - * @param borderColor - * border color - */ - public void setCornerColor(final String borderColor) { - if (null != divt[0]) { - for (int i = 0; i < cornerHeight; ++i) { - DOM.setStyleAttribute(divt[i], "backgroundColor", borderColor); - } - } - if (null != divb[0]) { - for (int i = 0; i < cornerHeight; ++i) { - DOM.setStyleAttribute(divb[i], "backgroundColor", borderColor); - } - } - } - - /** - * Set the css style name of the rounded corners div's. Default the css - * stylename is <code>cbg-RP</code>. Use it to set the colors of the corner. - * For example: <code>.cbg-RP { background-color:#c3d9ff; }</code>. - * - * A custom style might be needed when the corners are visible only when a - * panel is selected. Use this method to set the custom style name and add - * something like the following to the stylesheet: - * - * <code>.selected .cbg-RP { background-color:#c3d9ff; }</code> Setting the - * color is also possible via the method {@link #setCornerColor(String)}. - * - * @param style - * css style name - */ - public void setCornerStyleName(final String style) { - if (null != divt[0]) { - for (int i = 0; i < cornerHeight; ++i) { - DOM.setElementProperty(divt[i], "className", style); - } - } - if (null != divb[0]) { - for (int i = 0; i < cornerHeight; ++i) { - DOM.setElementProperty(divb[i], "className", style); - } - } - } - - /** - * Set the style of the RoundedPanel. In most cases this is not necessary - * and setting the style on the widget to which the - * <code>RoundedPanel</code> is applied should be set, as is done when not - * using the <code>RoundedPanel</code> - * - * @param style - * css style name - */ - @Override - public void setStyleName(final String style) { - DOM.setElementProperty(body, "className", style); - } - - /** - * Overwrite of parent getContainerElement() - */ - @Override - protected Element getContainerElement() { - return divElement; - } - - /** - * Creates div element representing part of the rounded corner. - * - * @param corner - * corner mask to set rounded corner - * @param heightIndex - * margin width for line - */ - private Element addLine(final int corner, final int heightIndex) { - // margin 2 fields : top/bottom right/left => "0 <width>px" - // margin 4 fields : top right bottom left => "0 <width>px 0 <width>px" - final String margin = corner == TOP || corner == BOTTOM ? "0 " - + RoundedPanel.CORNERMARGIN[cornerHeight - 1][heightIndex] : inMask(corner, LEFT) ? "0 0 0 " - + RoundedPanel.CORNERMARGIN[cornerHeight - 1][heightIndex] : "0 " - + RoundedPanel.CORNERMARGIN[cornerHeight - 1][heightIndex] + " 0 0"; - final Element div = DOM.createDiv(); - - DOM.setStyleAttribute(div, "fontSize", "0px"); - DOM.setStyleAttribute(div, "height", RoundedPanel.CORNERHEIGHT[cornerHeight - 1][heightIndex]); - DOM.setStyleAttribute(div, "borderWidth", "0 " + RoundedPanel.CORNERBORDER[cornerHeight - 1][heightIndex]); - DOM.setStyleAttribute(div, "lineHeight", RoundedPanel.CORNERHEIGHT[cornerHeight - 1][heightIndex]); - DOM.setStyleAttribute(div, "margin", margin); - DOM.setInnerHTML(div, " "); - 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 Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/SimpleToolbar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/SimpleToolbar.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/SimpleToolbar.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,107 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.Composite; -import com.google.gwt.user.client.ui.HasVerticalAlignment.VerticalAlignmentConstant; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; - -public class SimpleToolbar extends Composite implements AbstractToolbar { - - private final HorizontalPanel childPanel; - private final HorizontalPanel mainPanel; - - public SimpleToolbar() { - mainPanel = new HorizontalPanel(); - childPanel = new HorizontalPanel(); - mainPanel.add(childPanel); - initWidget(mainPanel); - mainPanel.setWidth("100%"); - } - - public void add(final Widget widget) { - childPanel.add(widget); - childPanel.setCellVerticalAlignment(widget, VerticalPanel.ALIGN_MIDDLE); - } - - public void add(final Widget widget, VerticalAlignmentConstant valign) { - childPanel.add(widget); - childPanel.setCellVerticalAlignment(widget, valign); - } - - public Widget addFill() { - final Label emptyLabel = new Label(""); - this.add(emptyLabel); - childPanel.setCellWidth(emptyLabel, "100%"); - return emptyLabel; - } - - public Widget addSeparator() { - final Label emptyLabel = new Label(""); - emptyLabel.setStyleName("ytb-sep"); - emptyLabel.addStyleName("k-toolbar-sep"); - this.add(emptyLabel); - return emptyLabel; - } - - public Widget addSpacer() { - final Label emptyLabel = new Label(""); - emptyLabel.setStyleName("ytb-spacer"); - this.add(emptyLabel); - return emptyLabel; - } - - public void insert(final Widget widget, int position) { - childPanel.insert(widget, position); - childPanel.setCellVerticalAlignment(widget, VerticalPanel.ALIGN_MIDDLE); - } - - public void remove(final Widget widget) { - childPanel.remove(widget); - } - - public void removeAll() { - childPanel.clear(); - } - - public void setBlankStyle() { - setBasicStyle(); - addStyleName("k-blank-toolbar"); - } - - @Override - public void setHeight(String height) { - mainPanel.setHeight(height); - mainPanel.setCellHeight(childPanel, height); - } - - public void setNormalStyle() { - setBasicStyle(); - addStyleName("k-toolbar-bottom-line"); - } - - private void setBasicStyle() { - setStyleName("x-toolbar"); - addStyleName("x-panel"); - } -} \ No newline at end of file Deleted: 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 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/AbstractPopupPanel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,83 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.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 PopupPanel popupPalette; - protected Widget widget; - - private final boolean autoHide; - private final boolean modal; - - public AbstractPopupPanel() { - this(true, true); - } - - public AbstractPopupPanel(final boolean autohide) { - this(autohide, false); - } - - 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; - } - 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(); - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/BasicDialog.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/BasicDialog.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/BasicDialog.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,100 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.dialogs; - -import com.gwtext.client.core.Ext; -import com.gwtext.client.core.Position; -import com.gwtext.client.widgets.BoxComponent; -import com.gwtext.client.widgets.Component; -import com.gwtext.client.widgets.Window; -import com.gwtext.client.widgets.event.WindowListenerAdapter; - -public class BasicDialog extends Window { - - public BasicDialog(final String caption, final boolean modal) { - this(Ext.generateId(), caption, modal, false); - } - - public BasicDialog(final String caption, final boolean modal, final boolean autoScroll, final int width, - final int height) { - this(Ext.generateId(), caption, modal, autoScroll, width, height, width, height); - } - - public BasicDialog(final String caption, final boolean modal, final boolean autoScroll, final int width, - final int height, final int minWidth, final int minHeight) { - this(Ext.generateId(), caption, modal, autoScroll, width, height, minWidth, minHeight); - } - - public BasicDialog(final String id, final String caption, final boolean modal) { - this(id, caption, modal, false); - } - - public BasicDialog(final String id, final String caption, final boolean modal, final boolean autoScroll) { - setId(id); - setBorder(false); - setAutoWidth(true); - // Param values - setTitle(caption); - setModal(modal); - setAutoScroll(autoScroll); - // Def values - setShadow(true); - setPlain(true); - setClosable(true); - setCollapsible(true); - setResizable(true); - setCloseAction(Window.HIDE); - setButtonAlign(Position.RIGHT); - addListener(new WindowListenerAdapter() { - @Override - public void onMove(final BoxComponent component, final int x, final int y) { - checkPosition(component, x, y); - } - - @Override - public void onShow(final Component component) { - checkPosition(BasicDialog.this, component.getAbsoluteLeft(), component.getAbsoluteTop()); - } - - private void checkPosition(final BoxComponent component, final int x, final int y) { - if (y < 0) { - component.setPagePosition(x, 0); - } - } - }); - } - - public BasicDialog(final String id, final String caption, final boolean modal, final boolean autoScroll, - final int width, final int height) { - this(id, caption, modal, autoScroll, width, height, width, height); - } - - public BasicDialog(final String id, final String caption, final boolean modal, final boolean autoScroll, - final int width, final int height, final int minWidth, final int minHeight) { - this(id, caption, modal, autoScroll); - setAutoWidth(false); - // Param values - setWidth(width); - setHeight(height); - setMinWidth(minWidth); - setMinHeight(minHeight); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/BasicPopupPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/BasicPopupPanel.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/BasicPopupPanel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,46 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.dialogs; - -import com.google.gwt.user.client.ui.Widget; - -public class BasicPopupPanel extends AbstractPopupPanel { - - public BasicPopupPanel() { - super(); - } - - public BasicPopupPanel(final boolean autohide) { - super(autohide); - } - - public BasicPopupPanel(final boolean autohide, final boolean modal) { - super(autohide, modal); - } - - public void setWidget(final Widget widget) { - this.widget = widget; - } - - @Override - protected void createWidget() { - // Nothing - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultForm.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultForm.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultForm.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,156 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.dialogs; - -import com.gwtext.client.core.Position; -import com.gwtext.client.widgets.Button; -import com.gwtext.client.widgets.Component; -import com.gwtext.client.widgets.PaddedPanel; -import com.gwtext.client.widgets.form.Field; -import com.gwtext.client.widgets.form.FieldSet; -import com.gwtext.client.widgets.form.FormPanel; -import com.gwtext.client.widgets.form.Label; -import com.gwtext.client.widgets.form.event.FormPanelListener; - -public class DefaultForm { - - public static final int DEF_FIELD_WIDTH = 200; - public static final int DEF_SMALL_FIELD_WIDTH = 100; - public static final int DEF_XSMALL_FIELD_WIDTH = 50; - public static final int DEF_MEDIUM_FIELD_WIDTH = 150; - public static final int DEF_FIELD_LABEL_WITH = 75; - - private final FormPanel form; - - public DefaultForm() { - this(Position.RIGHT); - } - - public DefaultForm(Position buttonAlign) { - form = new FormPanel(); - form.setFrame(true); - form.setPaddings(10); - form.setBorder(false); - form.setLabelWidth(DEF_FIELD_LABEL_WITH); - form.setLabelAlign(Position.RIGHT); - form.setButtonAlign(buttonAlign); - form.setHeader(false); - } - - public DefaultForm(String title) { - this(title, Position.RIGHT); - } - - public DefaultForm(String title, Position buttonAlign) { - this(buttonAlign); - form.setTitle(title); - } - - public void add(final Field field) { - form.add(field); - } - - public void add(final FieldSet fieldset) { - form.add(fieldset); - } - - public void add(Label label) { - form.add(label); - } - - public void add(PaddedPanel paddedPanel) { - form.add(paddedPanel); - } - - public void addButton(final Button button) { - form.addButton(button); - } - - public void addListener(FormPanelListener listener) { - form.addListener(listener); - } - - public void addStyleName(final String cls) { - form.addStyleName(cls); - } - - public Field findField(String id) { - return form.getForm().findField(id); - } - - public FormPanel getFormPanel() { - return form; - } - - public void insert(int index, Component component) { - form.insert(index, component); - } - - public boolean isValid() { - return form.getForm().isValid(); - } - - public void removeStyleName(final String cls) { - form.removeStyleName(cls); - } - - public void reset() { - form.getForm().reset(); - } - - public void setAutoHeight(final boolean autoHeight) { - form.setAutoHeight(autoHeight); - } - - public void setAutoWidth(final boolean autoWidth) { - form.setAutoWidth(autoWidth); - } - - public void setFrame(boolean frame) { - form.setFrame(frame); - } - - public void setHeight(int height) { - form.setHeight(height); - } - - public void setHideLabels(boolean hide) { - form.setHideLabels(hide); - } - - public void setIconCls(String iconCls) { - form.setIconCls(iconCls); - } - - public void setPaddings(int padding) { - form.setPaddings(padding); - } - - public void setWidth(int width) { - form.setWidth(width); - } - - public void validate() { - final Field[] fields = form.getFields(); - for (Field field : fields) { - field.validate(); - } - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultFormUtils.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultFormUtils.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultFormUtils.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,58 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.dialogs; - -import org.ourproject.kune.platf.client.ui.KuneUiUtils; - -import com.gwtext.client.widgets.ToolTip; -import com.gwtext.client.widgets.form.FieldSet; -import com.gwtext.client.widgets.form.Radio; - -public class DefaultFormUtils { - - public static String br() { - return "<br/>"; - } - - public static String brbr() { - return "<br/><br/>"; - } - - public static Radio createRadio(final FieldSet fieldSet, final String radioLabel, final String radioFieldName, - final String radioTip, final String id) { - Radio radio = new Radio(); - radio.setName(radioFieldName); - radio.setAutoCreate(true); - radio.setHideLabel(true); - radio.setId(id); - fieldSet.add(radio); - - if (radioTip != null) { - radio.setBoxLabel(KuneUiUtils.genQuickTipLabel(radioLabel, null, radioTip)); - ToolTip tooltip = new ToolTip(); - tooltip.setHtml(radioTip); - tooltip.setWidth(250); - tooltip.applyTo(radio); - } else { - radio.setBoxLabel(radioLabel); - } - return radio; - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultTabbedForm.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultTabbedForm.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/DefaultTabbedForm.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,71 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.dialogs; - -import com.gwtext.client.core.Position; -import com.gwtext.client.widgets.Button; -import com.gwtext.client.widgets.Component; -import com.gwtext.client.widgets.Panel; -import com.gwtext.client.widgets.TabPanel; -import com.gwtext.client.widgets.form.Form; -import com.gwtext.client.widgets.form.FormPanel; -import com.gwtext.client.widgets.layout.FormLayout; - -public class DefaultTabbedForm { - private final FormPanel formPanel; - private final TabPanel tabPanel; - - public DefaultTabbedForm(final int width, final int labelWidth) { - formPanel = new FormPanel(); - formPanel.setFrame(true); - formPanel.setLabelWidth(labelWidth); - formPanel.setBorder(false); - formPanel.setWidth(width); - formPanel.setButtonAlign(Position.RIGHT); - - tabPanel = new TabPanel(); - tabPanel.setActiveTab(0); - formPanel.add(tabPanel); - } - - public void addButton(final Button button) { - formPanel.addButton(button); - } - - public void addTab(final String title, final Panel tab) { - tab.setTitle(title); - tab.setLayout(new FormLayout()); - tab.setAutoHeight(true); - tab.setPaddings(10); - tabPanel.add(tab); - if (formPanel.isRendered()) { - formPanel.doLayout(); - } - } - - public Form getForm() { - return formPanel.getForm(); - } - - public Component getPanel() { - return formPanel; - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/ExtendedDialog.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/ExtendedDialog.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/ExtendedDialog.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,93 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.dialogs; - -import com.calclab.suco.client.events.Listener0; -import com.gwtext.client.core.EventObject; -import com.gwtext.client.core.Ext; -import com.gwtext.client.core.Position; -import com.gwtext.client.widgets.Button; -import com.gwtext.client.widgets.event.ButtonListenerAdapter; -import com.gwtext.client.widgets.layout.FitLayout; - -public class ExtendedDialog extends BasicDialog { - - private final Button cancel; - private final Button firstButton; - - public ExtendedDialog(final String dialogId, final String title, final boolean modal, - final boolean autoscroll, final int width, final int heigth, final String icon, - final String firstButtonTitle, final String cancelButtonTitle, final Listener0 onFirstButtonClick, - final Listener0 onCancelButtonClick, final int tabIndexStart) { - this(dialogId, title, modal, autoscroll, width, heigth, icon, firstButtonTitle, Ext.generateId(), - cancelButtonTitle, Ext.generateId(), onFirstButtonClick, onCancelButtonClick, tabIndexStart); - } - - public ExtendedDialog(final String dialogId, final String title, final boolean modal, - final boolean autoscroll, final int width, final int heigth, final String icon, - final String firstButtonTitle, final String firstButtonId, final String cancelButtonTitle, - final String cancelButtonId, final Listener0 onFirstButtonClick, final Listener0 onCancelButtonClick, - final int tabIndexStart) { - super(dialogId, title, modal, autoscroll, width, heigth); - setLayout(new FitLayout()); - setCollapsible(false); - setButtonAlign(Position.RIGHT); - setIconCls(icon); - - firstButton = new Button(firstButtonTitle); - firstButton.setId(firstButtonId); - firstButton.addListener(new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject event) { - onFirstButtonClick.onEvent(); - } - }); - - firstButton.setTabIndex(tabIndexStart); - - cancel = new Button(cancelButtonTitle); - cancel.setId(cancelButtonId); - cancel.addListener(new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject event) { - onCancelButtonClick.onEvent(); - } - }); - cancel.setTabIndex(tabIndexStart + 1); - addButton(firstButton); - addButton(cancel); - } - - public Button getCancel() { - return cancel; - } - - public Button getFirstButton() { - return firstButton; - } - - public void mask(final String message) { - getEl().mask(message, "x-mask-loading"); - } - - public void unMask() { - getEl().unmask(); - } -} Deleted: 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 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/InfoDialog.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,86 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.dialogs; - -import com.google.gwt.user.client.ui.HTML; -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.Button; -import com.gwtext.client.widgets.Panel; -import com.gwtext.client.widgets.event.ButtonListenerAdapter; - -@Deprecated -public class InfoDialog extends BasicDialog { - - private final Panel mainPanel; - - public InfoDialog(final String dialogId, final String title, 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); - okButton.setId(okButtonId); - okButton.addListener(new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject e) { - destroy(); - } - }); - mainPanel = new Panel(); - mainPanel.setBorder(false); - mainPanel.setHeader(false); - mainPanel.setPaddings(20); - super.add(mainPanel); - addButton(okButton); - } - - public InfoDialog(final String dialogId, final String title, final String header, final String text, - final String okButtonText, final String okButtonId, final boolean modal, final boolean autoScroll, - final int width, final int height) { - this(dialogId, title, header, text, okButtonText, okButtonId, modal, autoScroll, width, height, false); - } - - public InfoDialog(final String dialogId, final String title, final String header, final String text, - final String okButtonText, final String okButtonId, final boolean modal, final boolean autoScroll, - final int width, final int height, final boolean isHtml) { - this(dialogId, title, okButtonText, okButtonId, modal, autoScroll, width, height); - - final Label headerLabel = new Label(header); - Widget textLabel; - if (isHtml) { - textLabel = new HTML(text); - } else { - textLabel = new Label(text); - } - - mainPanel.add(headerLabel); - mainPanel.add(textLabel); - - headerLabel.addStyleName("k-infod-head"); - } - - public void add(final Panel panel) { - mainPanel.add(panel); - } - - public void setMainPanelPaddings(final int padding) { - mainPanel.setPaddings(padding); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,305 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.dialogs; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.ui.noti.OldNotifyUser; - -import cc.kune.core.shared.i18n.I18nTranslationService; - -import com.google.gwt.user.client.ui.DeckPanel; -import com.google.gwt.user.client.ui.Widget; -import com.gwtext.client.core.EventObject; -import com.gwtext.client.widgets.Button; -import com.gwtext.client.widgets.Component; -import com.gwtext.client.widgets.Panel; -import com.gwtext.client.widgets.Toolbar; -import com.gwtext.client.widgets.event.ButtonListenerAdapter; -import com.gwtext.client.widgets.event.WindowListenerAdapter; -import com.gwtext.client.widgets.layout.FitLayout; - -public class WizardDialog implements WizardDialogView { - - private final Button backButton; - private final Button cancelButton; - private final DeckPanel deck; - private final BasicDialog dialog; - private final Button finishButton; - private final I18nTranslationService i18n; - private final Panel mainPanel; - private final Button nextButton; - - public WizardDialog(final String dialogId, final String caption, final boolean modal, - final boolean minimizable, final int width, final int height, final int minWidth, - final int minHeight, final String backId, final String nextId, final String finishId, - final String cancelId, final String closeId, final I18nTranslationService i18n, - final WizardListener listener) { - dialog = new BasicDialog(dialogId, caption, modal, false, width, height, minWidth, minHeight); - this.i18n = i18n; - dialog.setCollapsible(minimizable); - dialog.setShadow(true); - dialog.setPlain(true); - dialog.setCollapsible(false); - dialog.setResizable(false); - dialog.setId(dialogId); - - backButton = new Button(i18n.tWithNT("« Back", "used in button"), new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject e) { - listener.onBack(); - } - }); - backButton.setId(backId); - dialog.addButton(backButton); - - nextButton = new Button(i18n.tWithNT("Next »", "used in button"), new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject e) { - listener.onNext(); - } - }); - nextButton.setId(nextId); - dialog.addButton(nextButton); - - cancelButton = new Button(i18n.tWithNT("Cancel", "used in button"), new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject e) { - listener.onCancel(); - } - }); - cancelButton.setId(cancelId); - dialog.addButton(cancelButton); - - finishButton = new Button(i18n.tWithNT("Finish", "used in button"), new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject e) { - listener.onFinish(); - } - }); - finishButton.setId(finishId); - dialog.addButton(finishButton); - - dialog.addListener(new WindowListenerAdapter() { - @Override - public void onHide(final Component component) { - listener.onClose(); - } - }); - mainPanel = new Panel(); - mainPanel.setLayout(new FitLayout()); - deck = new DeckPanel(); - mainPanel.add(deck); - } - - public WizardDialog(final String dialogId, final String caption, final boolean modal, - final boolean minimizable, final int width, final int height, final WizardListener listener, - final I18nTranslationService i18n, final String backId, final String nextId, - final String finishId, final String cancelId, final String closeId) { - this(dialogId, caption, modal, minimizable, width, height, width, height, backId, nextId, finishId, - cancelId, closeId, i18n, listener); - } - - @Override - public void add(final View view) { - deck.add(toWidget(view)); - doLayoutIfNeeded(); - } - - @Override - public void center() { - dialog.center(); - } - - @Override - public void clear() { - dialog.clear(); - } - - private void doLayoutIfNeeded() { - if (dialog.isRendered()) { - dialog.doLayout(); - mainPanel.syncSize(); - mainPanel.doLayout(); - } - } - - private int getWidgetCount(final View view) { - if (view instanceof Widget) { - return deck.getWidgetIndex((Widget) view); - } else if (view instanceof DefaultForm) { - return deck.getWidgetIndex(((DefaultForm) view).getFormPanel()); - } - return -1; - } - - @Override - public void hide() { - dialog.hide(); - } - - @Override - public boolean isCurrentPage(final View view) { - final int visibleWidgetIndex = deck.getVisibleWidget(); - if (visibleWidgetIndex == -1) { - return false; - } else { - return deck.getWidget(visibleWidgetIndex).equals(toWidget(view)); - } - } - - @Override - public void mask(final String message) { - dialog.getEl().mask(message, "x-mask-loading"); - } - - @Override - public void maskProcessing() { - mask(i18n.t("Processing")); - } - - @Override - public void remove(final View view) { - final int count = getWidgetCount(view); - if (count != -1) { - deck.remove(count); - } - } - - public void setBottomToolbar1(final Toolbar toolbar) { - dialog.setBottomToolbar(toolbar); - } - - @Override - public void setEnabled(final boolean back, final boolean next, final boolean cancel, - final boolean finish) { - setEnabledBackButton(back); - setEnabledNextButton(next); - setEnabledCancelButton(cancel); - setEnabledFinishButton(finish); - } - - @Override - public void setEnabledBackButton(final boolean enabled) { - if (enabled) { - backButton.enable(); - } else { - backButton.disable(); - } - } - - @Override - public void setEnabledCancelButton(final boolean enabled) { - if (enabled) { - cancelButton.enable(); - } else { - cancelButton.disable(); - } - } - - @Override - public void setEnabledFinishButton(final boolean enabled) { - if (enabled) { - finishButton.enable(); - } else { - finishButton.disable(); - } - } - - @Override - public void setEnabledNextButton(final boolean enabled) { - if (enabled) { - nextButton.enable(); - } else { - nextButton.disable(); - } - } - - @Override - public void setFinishText(final String text) { - finishButton.setText(text); - } - - public void setIconCls(final String iconCls) { - dialog.setIconCls(iconCls); - } - - @Override - public void setVisible(final boolean back, final boolean next, final boolean cancel, - final boolean finish) { - setVisibleBackButton(back); - setVisibleNextButton(next); - setVisibleCancelButton(cancel); - setVisibleFinishButton(finish); - } - - @Override - public void setVisibleBackButton(final boolean visible) { - backButton.setVisible(visible); - } - - @Override - public void setVisibleCancelButton(final boolean visible) { - cancelButton.setVisible(visible); - } - - @Override - public void setVisibleFinishButton(final boolean visible) { - finishButton.setVisible(visible); - } - - @Override - public void setVisibleNextButton(final boolean visible) { - nextButton.setVisible(visible); - } - - @Override - public void show() { - dialog.show(); - } - - @Override - public void show(final View view) { - final int count = getWidgetCount(view); - if (count != -1) { - deck.showWidget(count); - dialog.add(mainPanel); - doLayoutIfNeeded(); - } else { - OldNotifyUser.error("Widget not found in deck of WizardDialog"); - } - - } - - private Widget toWidget(final View view) { - if (view instanceof Widget) { - return (Widget) view; - } else if (view instanceof DefaultForm) { - return ((DefaultForm) view).getFormPanel(); - } else { - OldNotifyUser.error("Trying to add a unknown element in WizardDialog"); - return null; - } - } - - @Override - public void unMask() { - dialog.getEl().unmask(); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialogView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialogView.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialogView.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,70 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.dialogs; - -import org.ourproject.kune.platf.client.View; - -public interface WizardDialogView extends View { - - void add(View view); - - void center(); - - void clear(); - - void hide(); - - boolean isCurrentPage(View view); - - void mask(final String message); - - void maskProcessing(); - - void remove(View view); - - void setEnabled(boolean back, boolean next, boolean cancel, boolean finish); - - void setEnabledBackButton(final boolean enabled); - - void setEnabledCancelButton(final boolean enabled); - - void setEnabledFinishButton(final boolean enabled); - - void setEnabledNextButton(final boolean enabled); - - void setFinishText(final String text); - - void setVisible(boolean back, boolean next, boolean cancel, boolean finish); - - void setVisibleBackButton(final boolean visible); - - void setVisibleCancelButton(final boolean visible); - - void setVisibleFinishButton(final boolean visible); - - void setVisibleNextButton(final boolean visible); - - void show(); - - void show(View view); - - void unMask(); - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardListener.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardListener.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardListener.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,34 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.dialogs; - -public interface WizardListener { - - void onBack(); - - void onNext(); - - void onFinish(); - - void onCancel(); - - void onClose(); - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RichTextArea.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RichTextArea.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RichTextArea.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,733 +0,0 @@ -/* - * Copyright 2007 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.ourproject.kune.platf.client.ui.rte; - -import org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl; -import org.xwiki.gwt.dom.client.Document; -import org.xwiki.gwt.dom.client.IFrameElement; - -import com.allen_sauer.gwt.log.client.Log; -import com.google.gwt.core.client.GWT; -import com.google.gwt.event.logical.shared.HasInitializeHandlers; -import com.google.gwt.event.logical.shared.InitializeEvent; -import com.google.gwt.event.logical.shared.InitializeHandler; -import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.user.client.ui.FocusWidget; -import com.google.gwt.user.client.ui.HasHTML; - -/** - * A rich text editor that allows complex styling and formatting. - * - * Because some browsers do not support rich text editing, and others support - * only a limited subset of functionality, there are two formatter interfaces, - * accessed via {@link #getBasicFormatter()} and {@link #getExtendedFormatter()} - * . A browser that does not support rich text editing at all will return - * <code>null</code> for both of these, while one that supports only the basic - * functionality will return <code>null</code> for the latter. - * - * <p> - * <img class='gallery' src='doc-files/RichTextArea.png'/> - * </p> - * - * <h3>CSS Style Rules</h3> - * <dl> - * <dt>.gwt-RichTextArea</dt> - * <dd>Applied to the rich text element.</dd> - * </dl> - */ -public class RichTextArea extends FocusWidget implements HasHTML, HasInitializeHandlers { - - /** - * <p> - * This interface is used to access basic formatting options, when - * available. If the implementation supports basic formatting, then - * {@link RichTextArea#getBasicFormatter()} will return an instance of this - * class. - * </p> - * <p> - * The formatter will format the user selected text in the - * {@link RichTextArea}. As a result, it will only work reliably if the - * {@link RichTextArea} is attached, visible to on the page, and has been - * focused at least once. If you just want to initialize the content of the - * {@link RichTextArea}, use {@link RichTextArea#setHTML(String)} instead. - * </p> - * - * @deprecated use {@link RichTextArea.Formatter} instead - */ - @Deprecated - public interface BasicFormatter { - - /** - * Gets the background color. - * - * @return the background color - */ - String getBackColor(); - - /** - * Gets the foreground color. - * - * @return the foreground color - */ - String getForeColor(); - - /** - * Is the current region bold? - * - * @return true if the current region is bold - */ - boolean isBold(); - - /** - * Is the current region italic? - * - * @return true if the current region is italic - */ - boolean isItalic(); - - /** - * Is the current region subscript? - * - * @return true if the current region is subscript - */ - boolean isSubscript(); - - /** - * Is the current region superscript? - * - * @return true if the current region is superscript - */ - boolean isSuperscript(); - - /** - * Is the current region underlined? - * - * @return true if the current region is underlined - */ - boolean isUnderlined(); - - /** - * Selects all the text. - */ - void selectAll(); - - /** - * Sets the background color. - * - * @param color - * the new background color - */ - void setBackColor(String color); - - /** - * Sets the font name. - * - * @param name - * the new font name - */ - void setFontName(String name); - - /** - * Sets the font size. - * - * @param fontSize - * the new font size - */ - void setFontSize(FontSize fontSize); - - /** - * Sets the foreground color. - * - * @param color - * the new foreground color - */ - void setForeColor(String color); - - /** - * Sets the justification. - * - * @param justification - * the new justification - */ - void setJustification(Justification justification); - - /** - * Toggles bold. - */ - void toggleBold(); - - /** - * Toggles italic. - */ - void toggleItalic(); - - /** - * Toggles subscript. - */ - void toggleSubscript(); - - /** - * Toggles superscript. - */ - void toggleSuperscript(); - - /** - * Toggles underline. - */ - void toggleUnderline(); - } - - /** - * <p> - * This interface is used to access full formatting options, when available. - * If the implementation supports full formatting, then - * {@link RichTextArea#getExtendedFormatter()} will return an instance of - * this class. - * </p> - * <p> - * The formatter will format the user selected text in the - * {@link RichTextArea}. As a result, it will only work reliably if the - * {@link RichTextArea} is attached, visible to on the page, and has been - * focused at least once. If you just want to initialize the content of the - * {@link RichTextArea}, use {@link RichTextArea#setHTML(String)} instead. - * </p> - * - * @deprecated use {@link RichTextArea.Formatter} instead - */ - @Deprecated - public interface ExtendedFormatter extends BasicFormatter { - - void copy(); - - /** - * Creates a link to the supplied URL. - * - * @param url - * the URL to be linked to - */ - void createLink(String url); - - void cut(); - - /* - * delete all text and objects that are selected. - */ - void delete(); - - /** - * Inserts a horizontal rule. - */ - void insertHorizontalRule(); - - /** - * Inserts an image element. - * - * @param url - * the url of the image to be inserted - */ - void insertImage(String url); - - /** - * Starts an numbered list. Indentation will create nested items. - */ - void insertOrderedList(); - - /** - * Starts an bulleted list. Indentation will create nested items. - */ - void insertUnorderedList(); - - /** - * Is the current region strikethrough? - * - * @return true if the current region is strikethrough - */ - boolean isStrikethrough(); - - /** - * Left indent. - */ - void leftIndent(); - - void paste(); - - void redo(); - - /** - * Removes all formatting on the selected text. - */ - void removeFormat(); - - /** - * Removes any link from the selected text. - */ - void removeLink(); - - /** - * Right indent. - */ - void rightIndent(); - - /** - * Toggles strikethrough. - */ - void toggleStrikethrough(); - - void undo(); - } - - /** - * Font size enumeration. Represents the seven basic HTML font sizes, as - * defined in CSS. - */ - public static class FontSize { - - /** - * Represents a Large font. - */ - public static final FontSize LARGE = new FontSize(5); - - /** - * Represents a Medium font. - */ - public static final FontSize MEDIUM = new FontSize(4); - - /** - * Represents a Small font. - */ - public static final FontSize SMALL = new FontSize(3); - - /** - * Represents an X-Large font. - */ - public static final FontSize X_LARGE = new FontSize(6); - - /** - * Represents an X-Small font. - */ - public static final FontSize X_SMALL = new FontSize(2); - - /** - * Represents an XX-Large font. - */ - public static final FontSize XX_LARGE = new FontSize(7); - - /** - * Represents an XX-Small font. - */ - public static final FontSize XX_SMALL = new FontSize(1); - - private final int number; - - private FontSize(final int number) { - this.number = number; - } - - /** - * Gets the HTML font number associated with this font size. - * - * @return an integer from 1 to 7 inclusive - */ - public int getNumber() { - return number; - } - - @Override - public String toString() { - return Integer.toString(number); - } - } - - /** - * <p> - * This interface is used to access full formatting options, when available. - * If the implementation supports full formatting, then - * {@link RichTextArea#getFormatter()} will return an instance of this - * class. - * </p> - * <p> - * The formatter will format the user selected text in the - * {@link RichTextArea}. As a result, it will only work reliably if the - * {@link RichTextArea} is attached, visible to on the page, and has been - * focused at least once. If you just want to initialize the content of the - * {@link RichTextArea}, use {@link RichTextArea#setHTML(String)} instead. - * </p> - */ - public interface Formatter extends ExtendedFormatter { - /** - * Creates a link to the supplied URL. - * - * @param url - * the URL to be linked to - */ - void createLink(String url); - - /** - * Gets the background color. - * - * @return the background color - */ - String getBackColor(); - - /** - * Gets the foreground color. - * - * @return the foreground color - */ - String getForeColor(); - - /** - * Inserts a horizontal rule. - */ - void insertHorizontalRule(); - - /** - * Inserts generic html. - * - * @param html - * the HTML to insert - */ - void insertHTML(String html); - - /** - * Inserts an image element. - * - * @param url - * the url of the image to be inserted - */ - void insertImage(String url); - - /** - * Starts an numbered list. Indentation will create nested items. - */ - void insertOrderedList(); - - /** - * Starts an bulleted list. Indentation will create nested items. - */ - void insertUnorderedList(); - - /** - * Is the current region bold? - * - * @return true if the current region is bold - */ - boolean isBold(); - - /** - * Is the current region italic? - * - * @return true if the current region is italic - */ - boolean isItalic(); - - /** - * Is the current region strikethrough? - * - * @return true if the current region is strikethrough - */ - boolean isStrikethrough(); - - /** - * Is the current region subscript? - * - * @return true if the current region is subscript - */ - boolean isSubscript(); - - /** - * Is the current region superscript? - * - * @return true if the current region is superscript - */ - boolean isSuperscript(); - - /** - * Is the current region underlined? - * - * @return true if the current region is underlined - */ - boolean isUnderlined(); - - /** - * Left indent. - */ - void leftIndent(); - - /** - * Redo an action that was just undone. - */ - void redo(); - - /** - * Removes all formatting on the selected text. - */ - void removeFormat(); - - /** - * Removes any link from the selected text. - */ - void removeLink(); - - /** - * Right indent. - */ - void rightIndent(); - - /** - * Selects all the text. - */ - void selectAll(); - - /** - * Sets the background color. - * - * @param color - * the new background color - */ - void setBackColor(String color); - - /** - * Sets the font name. - * - * @param name - * the new font name - */ - void setFontName(String name); - - /** - * Sets the font size. - * - * @param fontSize - * the new font size - */ - void setFontSize(FontSize fontSize); - - /** - * Sets the foreground color. - * - * @param color - * the new foreground color - */ - void setForeColor(String color); - - /** - * Sets the justification. - * - * @param justification - * the new justification - */ - void setJustification(Justification justification); - - /** - * Toggles bold. - */ - void toggleBold(); - - /** - * Toggles italic. - */ - void toggleItalic(); - - /** - * Toggles strikethrough. - */ - void toggleStrikethrough(); - - /** - * Toggles subscript. - */ - void toggleSubscript(); - - /** - * Toggles superscript. - */ - void toggleSuperscript(); - - /** - * Toggles underline. - */ - void toggleUnderline(); - - /** - * Undo the last action. - */ - void undo(); - } - - /** - * Justification enumeration. The three values are <code>left</code>, - * <code>right</code>, <code>center</code>. - */ - public static class Justification { - - /** - * Center justification. - */ - public static final Justification CENTER = new Justification("Center"); - - /** - * Full justification. - */ - public static final Justification FULL = new Justification("Full"); - - /** - * Left justification. - */ - public static final Justification LEFT = new Justification("Left"); - - /** - * Right justification. - */ - public static final Justification RIGHT = new Justification("Right"); - - private final String tag; - - private Justification(final String tag) { - this.tag = tag; - } - - @Override - public String toString() { - return "Justify " + tag; - } - } - - private final RichTextAreaImpl impl = GWT.create(RichTextAreaImpl.class); - - /** - * Creates a new, blank {@link RichTextArea} object with no stylesheet. - */ - public RichTextArea() { - setElement(impl.getElement()); - setStyleName("gwt-RichTextArea"); - impl.setOwner(this); - } - - public HandlerRegistration addInitializeHandler(final InitializeHandler handler) { - return addHandler(handler, InitializeEvent.getType()); - } - - /** - * Gets the basic rich text formatting interface. Note that formatting can - * only be done when the {@link RichTextArea} is attached, visible on the - * page, and has been focused by the user. - * - * @return <code>null</code> if basic formatting is not supported - * @deprecated use {@link #getFormatter()} instead - */ - @Deprecated - public BasicFormatter getBasicFormatter() { - return getFormatter(); - } - - /** - * NOTE: If the current browser doesn't support rich text editing this - * method returns <code>null</code>. You should test the returned value and - * fail save to an appropriate behavior!<br/> - * The appropriate test would be: <code><pre> - * if (rta.isAttached() && rta.getDocument() == null) { - * // The current browser doesn't support rich text editing. - * } - * </pre></code> - * - * @return The DOM document being edited with this rich text area. - * - * copied from xwiki - */ - public Document getDocument() { - if (getElement().getTagName().equalsIgnoreCase("iframe")) { - return IFrameElement.as(getElement()).getContentDocument().cast(); - } else { - return null; - } - } - - /** - * Gets the full rich text formatting interface. Note that formatting can - * only be done when the {@link RichTextArea} is attached, visible on the - * page, and has been focused by the user. - * - * @return <code>null</code> if full formatting is not supported - * @deprecated use {@link #getFormatter()} instead - */ - @Deprecated - public ExtendedFormatter getExtendedFormatter() { - return getFormatter(); - } - - /** - * Gets the rich text formatting interface. Note that formatting can only be - * done when the {@link RichTextArea} is attached, visible on the page, and - * has been focused by the user. - * - * @return <code>null</code> if full formatting is not supported - */ - public Formatter getFormatter() { - if (impl instanceof Formatter) { - return (Formatter) impl; - } - return null; - } - - public String getHTML() { - return impl.getHTML(); - } - - public String getText() { - return impl.getText(); - } - - @Override - public boolean isEnabled() { - return impl.isEnabled(); - } - - @Override - public void setEnabled(final boolean enabled) { - impl.setEnabled(enabled); - } - - @Override - public void setFocus(final boolean focused) { - // There are different problems on each browser when you try to focus an - // unattached rich text iframe, so just cut it off early. - Log.debug("Focus setted: " + focused); - if (isAttached()) { - impl.setFocus(focused); - } - } - - public void setHTML(final String html) { - impl.setHTML(html); - } - - public void setText(final String text) { - impl.setText(text); - } - - @Override - protected void onAttach() { - super.onAttach(); - impl.initElement(); - } - - @Override - protected void onDetach() { - super.onDetach(); - impl.uninitElement(); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/TestRTEDialog.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/TestRTEDialog.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/TestRTEDialog.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,65 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte; - -import org.ourproject.kune.platf.client.actions.ui.ComplexToolbar; -import org.ourproject.kune.platf.client.ui.dialogs.BasicDialog; -import org.ourproject.kune.platf.client.ui.rte.basic.RTEditorPanel; -import org.ourproject.kune.platf.client.ui.rte.saving.RTESavingEditor; - -import com.google.gwt.user.client.ui.VerticalPanel; -import com.gwtext.client.widgets.Window; -import com.gwtext.client.widgets.event.WindowListenerAdapter; - -public class TestRTEDialog { - - private final RTESavingEditor editor; - private final BasicDialog dialog; - - public TestRTEDialog(final RTESavingEditor editor) { - this.editor = editor; - dialog = new BasicDialog("Testing RTE", false, false, 650, 200); - final VerticalPanel vp = new VerticalPanel(); - - vp.add((ComplexToolbar) editor.getTopBar()); - vp.add((ComplexToolbar) editor.getSndBar()); - final RTEditorPanel editorPanel = (RTEditorPanel) editor.getEditorArea(); - vp.add(editorPanel); - vp.setWidth("100%"); - dialog.add(vp); - dialog.addListener(new WindowListenerAdapter() { - @Override - public void onResize(final Window source, final int width, final int height) { - final int newHeight = height - 26 * 2 - 40; - editorPanel.adjustSize(newHeight); - vp.setCellHeight(editorPanel, "" + newHeight); - } - }); - } - - public void setExtended(final boolean extended) { - editor.setExtended(extended); - } - - public void show() { - editor.attach(); - dialog.show(); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplIE6.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplIE6.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplIE6.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,67 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte; - -import org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplIE6; - -/** - * A wrapper used to inject css into RTA. As published in: - * - * http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/ - * f64c0024d8676a66 - * /d5f26a54145fc5d4?lnk=st&q=richtextarea+style#d5f26a54145fc5d4 - * - * FIXME: Only for IE and Mozilla - * - */ -public class WrappedRichTextAreaImplIE6 extends RichTextAreaImplIE6 { - - @Override - public native void initElement() /*-{ - var _this = this; - _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplStandard::initializing = true; - - setTimeout($entry(function() { - if (_this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplStandard::initializing == false) { - return; - } - - // Attempt to set the iframe document's body to 'contentEditable' mode. - // There's no way to know when the body will actually be available, so - // keep trying every so often until it is. - // Note: The body seems to be missing only rarely, so please don't remove - // this retry loop just because it's hard to reproduce. - var elem = _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl::elem; - var doc = elem.contentWindow.document; - if (!doc.body) { - // Retry in 50 ms. Faster would run the risk of pegging the CPU. Slower - // would increase the probability of a user-visible delay. - setTimeout(arguments.callee, 50); - return; - } - var ct = "<html><head><style>@import url('" + $wnd.location.protocol + "//" + $wnd.location.host + $wnd.location.pathname + "css/richtext.css" + "');</style></head><body CONTENTEDITABLE='true'></body></html>" ; - doc.write( ct ); - doc.body.contentEditable = true; - - // Send notification that the iframe has reached design mode. - _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplStandard::onElementInitialized()(); - }, 1)); - }-*/; -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplMozilla.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplMozilla.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplMozilla.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,86 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte; - -import org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplMozilla; - -/** - * A wrapper used to inject css into RTA. As published in: - * - * http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/ - * f64c0024d8676a66 - * /d5f26a54145fc5d4?lnk=st&q=richtextarea+style#d5f26a54145fc5d4 - * - * FIXME: Only for IE and Mozilla - * - */ -public class WrappedRichTextAreaImplMozilla extends RichTextAreaImplMozilla { - boolean isFirstFocus; - - @Override - public native void initElement() /*-{ - // Mozilla doesn't allow designMode to be set reliably until the iframe is - // fully loaded. - var _this = this; - var iframe = _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl::elem; - _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplStandard::onElementInitializing()(); - _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplMozilla::isFirstFocus = true; - - iframe.onload = $entry(function() { - // Some Mozillae have the nasty habit of calling onload again when you set - // designMode, so let's avoid doing it more than once. - iframe.onload = null; - - // patch ccs inject: - - var doc = _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl::elem.contentWindow.document; - head=doc.getElementsByTagName('head')[0]; - link=document.createElement('link'); - link.setAttribute('rel',"stylesheet"); - link.setAttribute('type',"text/css"); - link.setAttribute('href',$wnd.location.protocol + "//" + $wnd.location.host + $wnd.location.pathname + "css/richtext.css" ); - head.appendChild(link); - - // -- patch - - // Don't set designMode until the RTA is targeted by an event. This is - // necessary because editing won't work on Mozilla if the iframe is - // *hidden, but attached*. Waiting for an event gets around this issue. - // - // Note: These events will not conflict with the - // addEventListener('oneventtype', ...) in RichTextAreaImplStandard. - iframe.contentWindow.onfocus = function() { - iframe.contentWindow.onfocus = null; - iframe.contentWindow.onmouseover = null; - iframe.contentWindow.document.designMode = 'On'; - }; - - // Issue 1441: we also need to catch the onmouseover event because focus - // occurs after mouse down, so the cursor will not appear until the user - // clicks twice, making the RichTextArea look uneditable. Catching the - // mouseover event allows us to set design mode earlier. The focus event - // is still needed to handle tab selection. - iframe.contentWindow.onmouseover = iframe.contentWindow.onfocus; - - // Send notification that the iframe has finished loading. - _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplStandard::onElementInitialized()(); - }); - }-*/; -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplOpera.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplOpera.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplOpera.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,46 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte; - -import org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplOpera; - -public class WrappedRichTextAreaImplOpera extends RichTextAreaImplOpera { - public native void initElement() /*-{ - // Most browsers don't like setting designMode until slightly _after_ - // the iframe becomes attached to the DOM. Any non-zero timeout will do - // just fine. - var _this = this; - _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplStandard::onElementInitializing()(); - setTimeout($entry(function() { - // Turn on design mode. - _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl::elem.contentWindow.document.designMode = 'On'; - - // patch css inject: - var elem = _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl::elem; - var doc = elem.contentWindow.document; - var ct = "<html><head><style>@import url('" +$wnd.location.protocol+ "//" + $wnd.location.host + $wnd.location.pathname + "css/richtext.css" + "');</style></head><body CONTENTEDITABLE='true'></body></html>" ; - doc.write( ct ); - // -- patch - - // Send notification that the iframe has reached design mode. - _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplStandard::onElementInitialized()(); - }), 1); - }-*/; -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplSafari.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplSafari.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/WrappedRichTextAreaImplSafari.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,49 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte; - -import org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplSafari; - -public class WrappedRichTextAreaImplSafari extends RichTextAreaImplSafari { - - @Override - public native void initElement() /*-{ - // Most browsers don't like setting designMode until slightly _after_ - // the iframe becomes attached to the DOM. Any non-zero timeout will do - // just fine. - var _this = this; - _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplStandard::onElementInitializing()(); - setTimeout($entry(function() { - // Turn on design mode. - _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl::elem.contentWindow.document.designMode = 'On'; - - // patch css inject: - var elem = _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImpl::elem; - var doc = elem.contentWindow.document; - var ct = "<html><head><style>@import url('" +$wnd.location.protocol+ "//" + $wnd.location.host + $wnd.location.pathname + "css/richtext.css" + "');</style></head><body CONTENTEDITABLE='true'></body></html>" ; - doc.write( ct ); - // -- patch - - // Send notification that the iframe has reached design mode. - _this.@org.ourproject.kune.platf.client.ui.rte.impl.RichTextAreaImplStandard::onElementInitialized()(); - }), 1); - }-*/; - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlAgent.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlAgent.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlAgent.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,27 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.edithtml; - -public interface EditHtmlAgent { - - String getHtml(); - - void setHtml(String html); -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialog.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialog.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialog.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,39 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.edithtml; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialog; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; - -public interface EditHtmlDialog extends OldAbstractTabbedDialog { - - String getHtml(); - - void setAgent(EditHtmlAgent agent); - - void setCancelListener(Listener0 cancelListener); - - void setHtml(String html); - - void setUpdateListener(Listener<String> updateListener); - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPanel.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPanel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,80 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.edithtml; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogPanel; -import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources; - -import cc.kune.common.client.notify.NotifyLevel; -import cc.kune.common.client.notify.NotifyLevelImages; -import cc.kune.core.shared.i18n.I18nTranslationService; - -import com.google.gwt.user.client.Window; -import com.gwtext.client.core.EventObject; -import com.gwtext.client.widgets.Button; -import com.gwtext.client.widgets.event.ButtonListenerAdapter; - -public class EditHtmlDialogPanel extends OldAbstractTabbedDialogPanel implements EditHtmlDialogView { - - public static final String EDIG_HTML_DIALOG_ERROR_ID = "ehtml-dialgo-error"; - public static final String EDIT_HTML_DIALOG = "ehtml-dialog"; - private Button cancel; - private final EditHtmlGroup editHtmlGroup; - private final I18nTranslationService i18n; - private final EditHtmlDialogPresenter presenter; - - public EditHtmlDialogPanel(final EditHtmlDialogPresenter presenter, final I18nTranslationService i18n, - final RTEImgResources resources, final NotifyLevelImages images, final EditHtmlGroup editHtmlGroup) { - super(EDIT_HTML_DIALOG, i18n.tWithNT("Edit the HTML", - "Option in a content editor to edit the html internal code (for advance users)"), - Window.getClientWidth() - 100, HEIGHT + 80, Window.getClientWidth() - 100, HEIGHT + 80, true, images, - EDIG_HTML_DIALOG_ERROR_ID); - this.presenter = presenter; - this.i18n = i18n; - this.editHtmlGroup = editHtmlGroup; - // super.setIconCls(RTEImgResources.SUFFIX + - // resources.edithtml().getName()); - } - - @Override - public void createAndShow() { - if (cancel == null) { - cancel = new Button(i18n.t("Cancel")); - final Button update = new Button(i18n.t("Update")); - cancel.addListener(new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject e) { - presenter.onCancel(); - } - }); - update.addListener(new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject e) { - presenter.onUpdate(); - } - }); - super.addButton(update); - super.addButton(cancel); - } - editHtmlGroup.createAll(); - super.createAndShow(); - super.setErrorMessage(i18n.t("This option is only for advanced users"), NotifyLevel.info); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPresenter.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogPresenter.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,70 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.edithtml; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogPresenter; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; - -public class EditHtmlDialogPresenter extends OldAbstractTabbedDialogPresenter implements EditHtmlDialog { - - private Listener<String> updateListener; - private Listener0 cancelListener; - private EditHtmlAgent agent; - - public EditHtmlDialogPresenter() { - } - - public String getHtml() { - return agent.getHtml(); - } - - public void onCancel() { - if (cancelListener != null) { - cancelListener.onEvent(); - } - hide(); - } - - public void onUpdate() { - if (updateListener != null) { - // FIXME - updateListener.onEvent(agent.getHtml()); - } - hide(); - } - - public void setAgent(EditHtmlAgent agent) { - this.agent = agent; - } - - public void setCancelListener(Listener0 cancelListener) { - this.cancelListener = cancelListener; - } - - public void setHtml(String html) { - agent.setHtml(html); - } - - public void setUpdateListener(Listener<String> updateListener) { - this.updateListener = updateListener; - } -} Deleted: 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 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlDialogView.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,29 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.edithtml; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogView; - -public interface EditHtmlDialogView extends OldAbstractTabbedDialogView, View { - - int HEIGHT = 225; - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlGroup.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlGroup.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/edithtml/EditHtmlGroup.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,38 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.edithtml; - -import com.calclab.suco.client.ioc.Container; -import com.calclab.suco.client.ioc.Provider; -import com.calclab.suco.client.ioc.decorator.ProviderCollection; -import com.calclab.suco.client.ioc.decorator.Singleton; - -public class EditHtmlGroup extends ProviderCollection { - - public EditHtmlGroup(final Container container) { - super(container, Singleton.instance); - } - - public void createAll() { - for (final Provider<?> p : getProviders()) { - p.get(); - } - } -} Deleted: 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 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,148 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertimg; - -import org.cobogw.gwt.user.client.CSS; -import org.ourproject.kune.platf.client.ui.rte.insertlink.LinkInfo; - -import cc.kune.core.client.ui.ContentPosition; - -import com.google.gwt.dom.client.Element; -import com.google.gwt.user.client.DOM; - -public class ImageInfo { - - public static final boolean DEF_WRAP_VALUE = true; - public static final boolean DEF_CLICK_ORIGINAL_VALUE = false; - - public static final String SIZE_ORIGINAL = "original"; - public static final String SIZE_FIT = "fit"; - public static final String SIZE_XS = "xs"; - public static final String SIZE_S = "s"; - public static final String SIZE_M = "m"; - public static final String SIZE_L = "l"; - public static final String SIZE_XL = "xl"; - - public static String[][] sizes = { new String[] { SIZE_ORIGINAL, "Original image size", "" }, - new String[] { SIZE_FIT, "Fit page width", "100%" }, - new String[] { SIZE_XS, "Thumbnail, up to 160 pixels wide", "160px" }, - new String[] { SIZE_S, "Small, up to 320 pixels wide", "320px" }, - new String[] { SIZE_M, "Medium, up to 640 pixels wide", "640px" }, - new String[] { SIZE_L, "Large, up to 1024 pixels wide", "1024px" }, - new String[] { SIZE_XL, "Extra large, up to 1600 pixels wide", "1600px" } }; - - private String src; - private boolean wraptext; - private boolean clickOriginal; - private String position; - private String size; - - public ImageInfo(final String src, final boolean wraptext, final boolean clickOriginal, final String position, - final String size) { - this.src = src; - this.wraptext = wraptext; - this.clickOriginal = clickOriginal; - setPositionImpl(position); - setSizeImpl(size); - } - - public boolean getClickOriginal() { - return clickOriginal; - } - - public Element getElement() { - Element imgElement = getImageElement(); - if (clickOriginal) { - com.google.gwt.user.client.Element anchor = DOM.createAnchor(); - DOM.setElementProperty(anchor, LinkInfo.HREF, src); - DOM.setElementProperty(anchor, LinkInfo.TARGET, LinkInfo._BLANK); - anchor.setInnerHTML(imgElement.getString()); - return anchor; - } else { - return imgElement; - } - } - - public String getPosition() { - return position; - } - - public String getSize() { - return size; - } - - public String getSrc() { - return src; - } - - public boolean isWraptext() { - return wraptext; - } - - public void setClickOriginal(final boolean clickOriginal) { - this.clickOriginal = clickOriginal; - } - - public void setPosition(final String position) { - setPositionImpl(position); - } - - public void setSize(final String size) { - setSizeImpl(size); - } - - public void setSrc(final String src) { - this.src = src; - } - - public void setWraptext(final boolean wraptext) { - this.wraptext = wraptext; - } - - @Override - public String toString() { - Element element = getElement(); - return element.getString(); - } - - private Element getImageElement() { - com.google.gwt.user.client.Element img = DOM.createImg(); - DOM.setElementProperty(img, "src", src); - CSS.setProperty(img, CSS.A.WIDTH, getStyleSize()); - return ContentPosition.setPosition(img, wraptext, position); - } - - private String getStyleSize() { - for (String[] current : sizes) { - if (current[0].equals(size)) { - return current[2]; - } - } - return ""; - } - - private void setPositionImpl(final String position) { - this.position = position; - } - - private void setSizeImpl(final String size) { - this.size = size; - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialog.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialog.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialog.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,39 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertimg; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialog; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; - -public interface InsertImageDialog extends OldAbstractTabbedDialog { - - void fireOnInsertImage(ImageInfo imageInfo); - - ImageInfo getImageInfo(); - - void reset(); - - void setOnCreateImage(Listener<ImageInfo> listener); - - void setOnInsertImagePressed(Listener0 onInsertLinkPressed); - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPanel.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPanel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,76 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertimg; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogPanel; - -import cc.kune.common.client.notify.NotifyLevelImages; -import cc.kune.core.shared.i18n.I18nTranslationService; - -import com.calclab.suco.client.events.Listener0; -import com.gwtext.client.core.EventObject; -import com.gwtext.client.widgets.Button; -import com.gwtext.client.widgets.event.ButtonListenerAdapter; - -public class InsertImageDialogPanel extends OldAbstractTabbedDialogPanel implements InsertImageDialogView { - - private static final String INSERT_IMG_DIALOG = "k-iip-dial"; - private static final String INSERT_IMG_DIALOG_ERROR_ID = "k-iip-err"; - private final InsertImageGroup insertImageGroup; - - public InsertImageDialogPanel(final InsertImageDialogPresenter presenter, final I18nTranslationService i18n, - final NotifyLevelImages images, final InsertImageGroup insertImageGroup) { - super(INSERT_IMG_DIALOG, i18n.t("Insert Image"), 390, HEIGHT + 100, 390, HEIGHT + 100, true, images, - INSERT_IMG_DIALOG_ERROR_ID); - super.setIconCls("k-picture-icon"); - this.insertImageGroup = insertImageGroup; - - super.addHideListener(new Listener0() { - @Override - public void onEvent() { - insertImageGroup.resetAll(); - } - }); - - final Button insert = new Button(i18n.t("Insert")); - insert.addListener(new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject e) { - presenter.onInsert(); - } - }); - - final Button cancel = new Button(i18n.t("Cancel")); - cancel.addListener(new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject e) { - presenter.onCancel(); - } - }); - addButton(insert); - addButton(cancel); - } - - @Override - public void createAndShow() { - insertImageGroup.createAll(); - super.createAndShow(); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,72 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertimg; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogPresenter; - -import cc.kune.core.client.ui.ContentPosition; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; - -public class InsertImageDialogPresenter extends OldAbstractTabbedDialogPresenter implements InsertImageDialog { - - private Listener<ImageInfo> onCreateListener; - private ImageInfo imageInfo; - private Listener0 onInsertPressed; - - public InsertImageDialogPresenter() { - initImageInfo(); - } - - public void fireOnInsertImage(final ImageInfo imageInfo) { - onCreateListener.onEvent(imageInfo); - super.hide(); - } - - public ImageInfo getImageInfo() { - return imageInfo; - } - - public void reset() { - initImageInfo(); - } - - public void setOnCreateImage(final Listener<ImageInfo> listener) { - onCreateListener = listener; - } - - public void setOnInsertImagePressed(final Listener0 onInsertPressed) { - this.onInsertPressed = onInsertPressed; - } - - protected void onCancel() { - super.hide(); - } - - protected void onInsert() { - onInsertPressed.onEvent(); - } - - private void initImageInfo() { - imageInfo = new ImageInfo("", ImageInfo.DEF_WRAP_VALUE, ImageInfo.DEF_CLICK_ORIGINAL_VALUE, - ContentPosition.LEFT, ImageInfo.SIZE_ORIGINAL); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogView.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogView.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,28 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertimg; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogView; - -public interface InsertImageDialogView extends OldAbstractTabbedDialogView { - - int HEIGHT = 350; - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageGroup.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageGroup.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageGroup.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,46 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertimg; - -import org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg.InsertImageAbstract; - -import com.calclab.suco.client.ioc.Container; -import com.calclab.suco.client.ioc.Provider; -import com.calclab.suco.client.ioc.decorator.ProviderCollection; -import com.calclab.suco.client.ioc.decorator.Singleton; - -public class InsertImageGroup extends ProviderCollection { - - public InsertImageGroup(final Container container) { - super(container, Singleton.instance); - } - - public void createAll() { - for (final Provider<?> p : getProviders()) { - p.get(); - } - } - - public void resetAll() { - for (final Provider<?> p : getProviders()) { - ((InsertImageAbstract) p.get()).reset(); - } - } -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialog.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialog.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialog.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,39 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertlink; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialog; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; - -public interface InsertLinkDialog extends OldAbstractTabbedDialog { - - void fireOnInsertLink(LinkInfo linkInfo); - - LinkInfo getLinkInfo(); - - void setLinkInfo(LinkInfo linkInfo); - - void setOnCreateLink(Listener<LinkInfo> listener); - - void setOnInsertLinkPressed(Listener0 onInsertLinkPressed); - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPanel.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPanel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,76 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertlink; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogPanel; - -import cc.kune.common.client.notify.NotifyLevelImages; -import cc.kune.core.shared.i18n.I18nTranslationService; - -import com.calclab.suco.client.events.Listener0; -import com.gwtext.client.core.EventObject; -import com.gwtext.client.widgets.Button; -import com.gwtext.client.widgets.event.ButtonListenerAdapter; - -public class InsertLinkDialogPanel extends OldAbstractTabbedDialogPanel implements InsertLinkDialogView { - public static final String TEXT_EDT_INSERT_DIALOG = "k-ted-iep-dialog"; - public static final String TEXT_EDT_INSERT_DIALOG_ERROR_ID = "k-ted-iep-dialog-err"; - private final InsertLinkGroup textEditorInsertElementGroup; - - public InsertLinkDialogPanel(final InsertLinkDialogPresenter presenter, final NotifyLevelImages images, - final I18nTranslationService i18n, final InsertLinkGroup textEditorInsertElementGroup) { - super(TEXT_EDT_INSERT_DIALOG, i18n.tWithNT("Insert a link", - "Option in a text editor to insert links and other elements"), 380, HEIGHT + 100, 380, HEIGHT + 100, - true, images, TEXT_EDT_INSERT_DIALOG_ERROR_ID); - super.setIconCls("k-link-icon"); - this.textEditorInsertElementGroup = textEditorInsertElementGroup; - super.addHideListener(new Listener0() { - @Override - public void onEvent() { - textEditorInsertElementGroup.resetAll(); - } - }); - - final Button insert = new Button(i18n.t("Insert")); - insert.addListener(new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject e) { - presenter.onInsert(); - } - }); - - final Button cancel = new Button(i18n.t("Cancel")); - cancel.addListener(new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject e) { - presenter.onCancel(); - } - }); - addButton(insert); - addButton(cancel); - - } - - @Override - public void createAndShow() { - textEditorInsertElementGroup.createAll(); - super.createAndShow(); - } -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPresenter.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogPresenter.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,66 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertlink; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogPresenter; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; - -public class InsertLinkDialogPresenter extends OldAbstractTabbedDialogPresenter implements InsertLinkDialog { - - private Listener<LinkInfo> onCreateListener; - private LinkInfo linkInfo; - private Listener0 onInsertLinkPressed; - - public InsertLinkDialogPresenter() { - linkInfo = new LinkInfo(""); - } - - public void fireOnInsertLink(final LinkInfo linkInfo) { - onCreateListener.onEvent(linkInfo); - super.hide(); - } - - public LinkInfo getLinkInfo() { - return linkInfo; - } - - public void onCancel() { - super.hide(); - } - - public void setLinkInfo(final LinkInfo linkInfo) { - this.linkInfo = linkInfo; - } - - public void setOnCreateLink(final Listener<LinkInfo> listener) { - this.onCreateListener = listener; - } - - public void setOnInsertLinkPressed(final Listener0 onInsertLinkPressed) { - this.onInsertLinkPressed = onInsertLinkPressed; - } - - protected void onInsert() { - onInsertLinkPressed.onEvent(); - } - -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogView.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkDialogView.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,29 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertlink; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogView; - -public interface InsertLinkDialogView extends OldAbstractTabbedDialogView, View { - - int HEIGHT = 350; - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkGroup.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkGroup.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/InsertLinkGroup.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,46 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertlink; - -import org.ourproject.kune.platf.client.ui.rte.insertlink.abstractlink.InsertLinkAbstract; - -import com.calclab.suco.client.ioc.Container; -import com.calclab.suco.client.ioc.Provider; -import com.calclab.suco.client.ioc.decorator.ProviderCollection; -import com.calclab.suco.client.ioc.decorator.Singleton; - -public class InsertLinkGroup extends ProviderCollection { - - public InsertLinkGroup(final Container container) { - super(container, Singleton.instance); - } - - public void createAll() { - for (final Provider<?> p : getProviders()) { - p.get(); - } - } - - public void resetAll() { - for (final Provider<?> p : getProviders()) { - ((InsertLinkAbstract) p.get()).reset(); - } - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/LinkExecutableUtils.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/LinkExecutableUtils.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/LinkExecutableUtils.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,125 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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/>. - * - */ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.ourproject.kune.platf.client.ui.rte.insertlink; - -import org.ourproject.kune.platf.client.ui.rte.RichTextArea; -import org.xwiki.gwt.dom.client.DOMUtils; -import org.xwiki.gwt.dom.client.Element; -import org.xwiki.gwt.dom.client.Range; - -import com.google.gwt.dom.client.Node; - -/** - * Utility class to perform functions associated to link executables, such as - * detecting the selected anchor. We have this as static function in a distinct - * class since there is no way to insert this on both the - * {@link CreateLinkExecutable} and {@link UnlinkExecutable} hierarchies. - * - * @version $Id$ - */ -public class LinkExecutableUtils { - /** - * The tag name of the anchor element. - */ - public static final String ANCHOR_TAG_NAME = "a"; - - /** - * Returns the currently selected anchor element in the passed - * {@link RichTextArea}, as the user perceives the selection. The algorithm - * used is as follows: - * <ul> - * <li>find anchor ancestor of the first leaf of the selection. If the first - * leaf is the selection start container and the offset is at the end, then - * eliminate this first leaf and analyze the second</li> - * <li>find anchor ancestor of the last leaf of the selection. If the last - * leaf is the end container and the selection starts at its very beginning, - * skip this and analyze the previous leaf</li> - * <li>is the two ancestor anchors are not null and are the same, this - * anchor is the selected anchor</li> - * </ul> - * - * @param rta - * the rich text area whose selection to test - * @return the anchor in which the current selection is found - */ - public static Element getSelectedAnchor(final RichTextArea rta) { - // there is no wrapping anchor if there is no selection - if (rta.getDocument().getSelection().getRangeCount() == 0) { - return null; - } - // Find the selected anchor by the following algorithm: - final Range range = rta.getDocument().getSelection().getRangeAt(0); - // if the selection is collapsed, we have our answer already - if (range.isCollapsed()) { - return (Element) DOMUtils.getInstance().getFirstAncestor(range.getStartContainer(), ANCHOR_TAG_NAME); - } - Element foundAncestorStart = null; - Element foundAncestorEnd = null; - // get the first leaf of the selection and check it out - Node firstLeaf = DOMUtils.getInstance().getFirstLeaf(range); - if (firstLeaf == range.getStartContainer() - && range.getStartOffset() == DOMUtils.getInstance().getLength(firstLeaf)) { - firstLeaf = DOMUtils.getInstance().getNextLeaf(firstLeaf); - } - foundAncestorStart = (Element) DOMUtils.getInstance().getFirstAncestor(firstLeaf, ANCHOR_TAG_NAME); - // if no anchor found for start, it's pointless to keep looking, won't - // find anything - if (foundAncestorStart == null) { - return null; - } - // check the other end - Node lastLeaf = DOMUtils.getInstance().getLastLeaf(range); - if (lastLeaf == range.getEndContainer() && range.getEndOffset() == 0) { - lastLeaf = DOMUtils.getInstance().getPreviousLeaf(lastLeaf); - } - foundAncestorEnd = (Element) DOMUtils.getInstance().getFirstAncestor(lastLeaf, ANCHOR_TAG_NAME); - - if (foundAncestorStart == foundAncestorEnd && foundAncestorStart != null) { - return foundAncestorStart; - } - - return null; - } - - /** - * Protected constructor. - */ - protected LinkExecutableUtils() { - } -} Deleted: 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 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/LinkInfo.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,141 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertlink; - -import com.google.gwt.dom.client.Element; -import com.google.gwt.user.client.DOM; - -public class LinkInfo { - public static final String HREF = "href"; - public static final String TITLE = "title"; - public static final String TARGET = "target"; - public static final String _BLANK = "_blank"; - private static final String NO_TARGET = null; - - public static LinkInfo parse(final Element element) { - 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) { - final String target = element.getAttribute(TARGET); - return new LinkInfo(element.getInnerText(), element.getTitle(), element.getAttribute(HREF), target != null - && target.equals(_BLANK)); - } - - private String text; - private String title; - private String href; - private String target; - - public LinkInfo(final String text) { - this(text, null, "", false); - } - - public LinkInfo(final String text, final String href) { - this.text = text; - this.href = href; - } - - public LinkInfo(final String text, final String title, final String href, final boolean inNewWindow) { - this.text = text; - this.href = href; - this.title = title; - setInNewWindowImpl(inNewWindow); - } - - public Element getElement() { - 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()); - } - if (title != null) { - DOM.setElementAttribute(element, TITLE, title); - } - DOM.setInnerText(element, text); - return anchor; - } - - public String getHref() { - return href; - } - - public String getTarget() { - return target; - } - - public String getText() { - return text; - } - - public String getTitle() { - return title; - } - - public boolean inSameWindow() { - if (target.equals(NO_TARGET)) { - return false; - } else { - return target.equals(_BLANK); - } - } - - public void setHref(final String href) { - this.href = href; - } - - public void setInNewWindow(final boolean inNewWindow) { - setInNewWindowImpl(inNewWindow); - } - - public void setTarget(final String target) { - setTargetImpl(target); - } - - public void setText(final String text) { - this.text = text; - } - - public void setTitle(final String title) { - this.title = title; - } - - @Override - public String toString() { - 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; - } - -} Deleted: 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 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaRegistry.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,59 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertmedia; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import cc.kune.common.client.utils.TextUtils; -import cc.kune.core.shared.dto.ExtMediaDescripDTO; - -public class ExternalMediaRegistry extends ArrayList<ExtMediaDescripDTO> { - - 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) { - super(extMediaDescrips); - } - - public ExtMediaDescripDTO get(final String url) { - for (ExtMediaDescripDTO media : this) { - if (media.is(url)) { - return media; - } - - } - return NO_MEDIA; - } - - public String getNames() { - String names = ""; - for (Iterator<ExtMediaDescripDTO> iterator = this.iterator(); iterator.hasNext();) { - ExtMediaDescripDTO elem = iterator.next(); - names += TextUtils.generateHtmlLink(elem.getSiteurl(), elem.getName()); - if (iterator.hasNext()) { - names += ", "; - } - } - return names; - } -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialog.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialog.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialog.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,35 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertmedia; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialog; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; - -public interface InsertMediaDialog extends OldAbstractTabbedDialog { - - void fireOnInsertMedia(String html); - - void setOnCreate(Listener<String> listener); - - void setOnInsertPressed(Listener0 onInsertPressed); - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogPanel.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogPanel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,76 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertmedia; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogPanel; - -import cc.kune.common.client.notify.NotifyLevelImages; -import cc.kune.core.shared.i18n.I18nTranslationService; - -import com.calclab.suco.client.events.Listener0; -import com.gwtext.client.core.EventObject; -import com.gwtext.client.widgets.Button; -import com.gwtext.client.widgets.event.ButtonListenerAdapter; - -public class InsertMediaDialogPanel extends OldAbstractTabbedDialogPanel implements InsertMediaDialogView { - - private static final String INSERT_MEDIA_DIALOG = "k-imdp-dialog"; - private static final String INSERT_MEDIA_DIALOG_ERROR_ID = "k-imdp-dialog-err"; - private final InsertMediaGroup insertMediaGroup; - - public InsertMediaDialogPanel(final InsertMediaDialogPresenter presenter, final I18nTranslationService i18n, - final NotifyLevelImages images, final InsertMediaGroup insertMediaGroup) { - super(INSERT_MEDIA_DIALOG, i18n.t("Insert Media (audio/video)"), 390, HEIGHT + 100, 390, HEIGHT + 100, true, - images, INSERT_MEDIA_DIALOG_ERROR_ID); - super.setIconCls("k-film-icon"); - this.insertMediaGroup = insertMediaGroup; - - super.addHideListener(new Listener0() { - @Override - public void onEvent() { - insertMediaGroup.resetAll(); - } - }); - - final Button insert = new Button(i18n.t("Insert")); - insert.addListener(new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject e) { - presenter.onInsert(); - } - }); - - final Button cancel = new Button(i18n.t("Cancel")); - cancel.addListener(new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject e) { - presenter.onCancel(); - } - }); - addButton(insert); - addButton(cancel); - } - - @Override - public void createAndShow() { - insertMediaGroup.createAll(); - super.createAndShow(); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogPresenter.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogPresenter.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,52 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertmedia; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogPresenter; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener0; - -public class InsertMediaDialogPresenter extends OldAbstractTabbedDialogPresenter implements InsertMediaDialog { - - private Listener0 onInsertPressed; - Listener<String> onCreateListener; - - public void fireOnInsertMedia(String html) { - onCreateListener.onEvent(html); - super.hide(); - } - - public void setOnCreate(Listener<String> listener) { - onCreateListener = listener; - } - - public void setOnInsertPressed(Listener0 onInsertPressed) { - this.onInsertPressed = onInsertPressed; - } - - protected void onCancel() { - super.hide(); - } - - protected void onInsert() { - onInsertPressed.onEvent(); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogView.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogView.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,28 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertmedia; - -import org.ourproject.kune.platf.client.View; - -public interface InsertMediaDialogView extends View { - - int HEIGHT = 250; - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaGroup.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaGroup.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaGroup.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,46 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertmedia; - -import org.ourproject.kune.platf.client.ui.rte.insertmedia.abstractmedia.InsertMediaAbstract; - -import com.calclab.suco.client.ioc.Container; -import com.calclab.suco.client.ioc.Provider; -import com.calclab.suco.client.ioc.decorator.ProviderCollection; -import com.calclab.suco.client.ioc.decorator.Singleton; - -public class InsertMediaGroup extends ProviderCollection { - - public InsertMediaGroup(final Container container) { - super(container, Singleton.instance); - } - - public void createAll() { - for (final Provider<?> p : getProviders()) { - p.get(); - } - } - - public void resetAll() { - for (final Provider<?> p : getProviders()) { - ((InsertMediaAbstract) p.get()).reset(); - } - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialog.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialog.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialog.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,37 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertspecialchar; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialog; - -import com.calclab.suco.client.events.Listener; - -public interface InsertSpecialCharDialog extends OldAbstractTabbedDialog { - - String DEF_LABEL = "Click on a character below to insert it into the document."; - - void hide(); - - void onInsert(char character); - - void setOnInsertSpecialChar(Listener<String> listener); - - void show(); -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialogPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialogPanel.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialogPanel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,60 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertspecialchar; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogPanel; -import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources; - -import cc.kune.common.client.notify.NotifyLevelImages; -import cc.kune.core.shared.i18n.I18nTranslationService; - -import com.gwtext.client.core.EventObject; -import com.gwtext.client.widgets.Button; -import com.gwtext.client.widgets.event.ButtonListenerAdapter; - -public class InsertSpecialCharDialogPanel extends OldAbstractTabbedDialogPanel implements InsertSpecialCharDialogView { - - private static final String INSERT_SPECIAL_CHAR_DIALOG = "iscdp-dial"; - private static final String INSERT_SPECIAL_CHAR_DIALOG_ERROR_ID = "iscdp-err"; - private final InsertSpecialCharGroup insertSpecialCharGroup; - - public InsertSpecialCharDialogPanel(final InsertSpecialCharDialogPresenter presenter, - final NotifyLevelImages images, final I18nTranslationService i18n, - final InsertSpecialCharGroup insertSpecialCharGroup, final RTEImgResources imgResources) { - super(INSERT_SPECIAL_CHAR_DIALOG, i18n.t("Insert Special Character"), 495, HEIGHT + 90, 495, HEIGHT + 90, true, - images, INSERT_SPECIAL_CHAR_DIALOG_ERROR_ID); - super.setIconCls("k-specialchars-icon"); - this.insertSpecialCharGroup = insertSpecialCharGroup; - final Button close = new Button(i18n.t("Close")); - close.addListener(new ButtonListenerAdapter() { - @Override - public void onClick(final Button button, final EventObject e) { - hide(); - } - }); - addButton(close); - } - - @Override - public void createAndShow() { - insertSpecialCharGroup.createAll(); - super.createAndShow(); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialogPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialogPresenter.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialogPresenter.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,40 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertspecialchar; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogPresenter; - -import com.calclab.suco.client.events.Listener; - -public class InsertSpecialCharDialogPresenter extends OldAbstractTabbedDialogPresenter implements InsertSpecialCharDialog { - - private Listener<String> onInsertSpecialChar; - - public void onInsert(char character) { - hide(); - if (onInsertSpecialChar != null) { - onInsertSpecialChar.onEvent("" + character); - } - } - - public void setOnInsertSpecialChar(Listener<String> listener) { - this.onInsertSpecialChar = listener; - } -} Deleted: 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 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharDialogView.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,28 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertspecialchar; - -import org.ourproject.kune.platf.client.ui.dialogs.tabbed.OldAbstractTabbedDialogView; - -public interface InsertSpecialCharDialogView extends OldAbstractTabbedDialogView { - - int HEIGHT = 315; - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharGroup.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharGroup.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/InsertSpecialCharGroup.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,38 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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.rte.insertspecialchar; - -import com.calclab.suco.client.ioc.Container; -import com.calclab.suco.client.ioc.Provider; -import com.calclab.suco.client.ioc.decorator.ProviderCollection; -import com.calclab.suco.client.ioc.decorator.Singleton; - -public class InsertSpecialCharGroup extends ProviderCollection { - - public InsertSpecialCharGroup(final Container container) { - super(container, Singleton.instance); - } - - public void createAll() { - for (final Provider<?> p : getProviders()) { - p.get(); - } - } -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ActionsModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ActionsModule.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ActionsModule.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,51 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client; - -import org.ourproject.kune.platf.client.services.AbstractExtendedModule; - -public class ActionsModule extends AbstractExtendedModule { - @Override - protected void onInstall() { - // register(NoDecoration.class, new - // Factory<ParticipateAction>(ParticipateAction.class) { - // @Override - // public ParticipateAction create() { - // return new ParticipateAction(i(Session.class), - // p(SocialNetworkServiceAsync.class), - // i(StateManager.class), i(AccessRightsClientManager.class), - // i(I18nTranslationService.class), - // i(IconResources.class)); - // } - // }); - // - // register(NoDecoration.class, new - // Factory<UnjoinAction>(UnjoinAction.class) { - // @Override - // public UnjoinAction create() { - // return new UnjoinAction(i(Session.class), - // p(SocialNetworkServiceAsync.class), i(StateManager.class), - // i(AccessRightsClientManager.class), i(I18nTranslationService.class), - // i(IconResources.class)); - // } - // }); - - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/OldAbstractFoldableContentActions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/OldAbstractFoldableContentActions.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/OldAbstractFoldableContentActions.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,683 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client; - -import org.ourproject.kune.platf.client.actions.ActionCheckedCondition; -import org.ourproject.kune.platf.client.actions.ActionEnableCondition; -import org.ourproject.kune.platf.client.actions.ActionMenuItemDescriptor; -import org.ourproject.kune.platf.client.actions.ActionToolbarButtonAndItemDescriptor; -import org.ourproject.kune.platf.client.actions.ActionToolbarButtonDescriptor; -import org.ourproject.kune.platf.client.actions.ActionToolbarButtonSeparator; -import org.ourproject.kune.platf.client.actions.ActionToolbarMenuAndItemDescriptor; -import org.ourproject.kune.platf.client.actions.ActionToolbarMenuCheckItemDescriptor; -import org.ourproject.kune.platf.client.actions.ActionToolbarMenuDescriptor; -import org.ourproject.kune.platf.client.actions.ActionToolbarMenuRadioDescriptor; -import org.ourproject.kune.platf.client.actions.ActionToolbarPosition; -import org.ourproject.kune.platf.client.actions.RadioMustBeChecked; -import org.ourproject.kune.platf.client.ui.noti.OldNotifyUser; -import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator; -import org.ourproject.kune.workspace.client.editor.ContentEditor; -import org.ourproject.kune.workspace.client.entityheader.EntityHeader; -import org.ourproject.kune.workspace.client.upload.FileUploader; - -import cc.kune.common.client.utils.SchedulerManager; -import cc.kune.core.client.cnt.ContentActionRegistry; -import cc.kune.core.client.cnt.FoldableContent; -import cc.kune.core.client.errors.ErrorHandler; -import cc.kune.core.client.errors.SessionExpiredException; -import cc.kune.core.client.i18n.I18nUITranslationService; -import cc.kune.core.client.rpcservices.AsyncCallbackSimple; -import cc.kune.core.client.rpcservices.ContentServiceAsync; -import cc.kune.core.client.rpcservices.GroupServiceAsync; -import cc.kune.core.client.services.FileDownloadUtils; -import cc.kune.core.client.state.Session; -import cc.kune.core.client.state.StateManager; -import cc.kune.core.shared.domain.ContentStatus; -import cc.kune.core.shared.domain.utils.StateToken; -import cc.kune.core.shared.dto.AccessRolDTO; -import cc.kune.core.shared.dto.ContentSimpleDTO; -import cc.kune.core.shared.dto.InitDataDTO; -import cc.kune.core.shared.dto.StateAbstractDTO; -import cc.kune.core.shared.dto.StateContainerDTO; -import cc.kune.core.shared.dto.StateContentDTO; -import cc.kune.gspace.client.style.GSpaceBackManager; - -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.Scheduler.ScheduledCommand; -import com.google.gwt.user.client.rpc.AsyncCallback; - -public abstract class OldAbstractFoldableContentActions { - - protected enum Position { - cnt, ctx - } - - public static final ActionToolbarPosition CONTENT_BOTTOMBAR = new ActionToolbarPosition( - "afca-ctn-bottom"); - - public static final ActionToolbarPosition CONTENT_TOPBAR = new ActionToolbarPosition("afca-ctn-top"); - public static final ActionToolbarPosition CONTEXT_BOTTOMBAR = new ActionToolbarPosition( - "afca-ctx-bottom"); - public static final ActionToolbarPosition CONTEXT_TOPBAR = new ActionToolbarPosition("afca-ctx-top"); - private static final String PUBLICATION_MENU = "Publication"; - - protected final ContentActionRegistry contentActionRegistry; - protected final Provider<ContentServiceAsync> contentServiceProvider; - // protected final ContextActionRegistry contextActionRegistry; - protected final ContextNavigator contextNavigator; - // protected final Provider<ContextPropEditor> contextPropEditorProvider; - protected final SchedulerManager deferredCommandWrapper; - protected final EntityHeader entityLogo; - protected final ErrorHandler errorHandler; - protected final Provider<FileDownloadUtils> fileDownloadProvider; - protected final Provider<FileUploader> fileUploaderProvider; - protected final FoldableContent foldableContent; - protected final Provider<GroupServiceAsync> groupServiceProvider; - protected final I18nUITranslationService i18n; - - protected final Session session; - protected final StateManager stateManager; - protected final Provider<ContentEditor> textEditorProvider; - - private final GSpaceBackManager wsBackManager; - - public OldAbstractFoldableContentActions(final Session session, final StateManager stateManager, - final I18nUITranslationService i18n, final ErrorHandler errorHandler, - final SchedulerManager deferredCommandWrapper, - final Provider<GroupServiceAsync> groupServiceProvider, - final Provider<ContentServiceAsync> contentServiceProvider, - final Provider<FileUploader> fileUploaderProvider, - final ContextNavigator contextNavigator, - final ContentActionRegistry contentActionRegistry, - // final ContextActionRegistry contextActionRegistry, - final Provider<FileDownloadUtils> fileDownloadProvider, - final Provider<ContentEditor> textEditorProvider, - // final Provider<ContextPropEditor> contextPropEditorProvider, - final FoldableContent foldableContent, final EntityHeader entityLogo, - final GSpaceBackManager wsBackManager) { - this.session = session; - this.stateManager = stateManager; - this.i18n = i18n; - this.errorHandler = errorHandler; - this.deferredCommandWrapper = deferredCommandWrapper; - this.groupServiceProvider = groupServiceProvider; - this.contentServiceProvider = contentServiceProvider; - this.fileUploaderProvider = fileUploaderProvider; - this.contextNavigator = contextNavigator; - this.contentActionRegistry = contentActionRegistry; - // this.contextActionRegistry = contextActionRegistry; - this.fileDownloadProvider = fileDownloadProvider; - this.textEditorProvider = textEditorProvider; - // this.contextPropEditorProvider = contextPropEditorProvider; - this.foldableContent = foldableContent; - this.entityLogo = entityLogo; - this.wsBackManager = wsBackManager; - createActions(); - session.onInitDataReceived(new Listener<InitDataDTO>() { - @Override - public void onEvent(final InitDataDTO parameter) { - createPostSessionInitActions(); - } - }); - } - - protected abstract void createActions(); - - protected void createContentModeratedActions(final String parentMenuTitle, - final String... contentsModerated) { - createSetStatusAction(AccessRolDTO.Administrator, i18n.t("Published online"), - ContentStatus.publishedOnline, contentsModerated); - createSetStatusAction(AccessRolDTO.Editor, i18n.t("Editing in progress"), - ContentStatus.editingInProgress, contentsModerated); - createSetStatusAction(AccessRolDTO.Administrator, i18n.t("Rejected"), ContentStatus.rejected, - contentsModerated); - createSetStatusAction(AccessRolDTO.Editor, i18n.t("Submitted for publish"), - ContentStatus.submittedForEvaluation, contentsModerated); - createSetStatusAction(AccessRolDTO.Administrator, i18n.t("In the rubbish bin"), - ContentStatus.inTheDustbin, contentsModerated); - } - - protected void createContentRenameAction(final String parentMenuTitle, final String textDescription, - final String... registerInTypes) { - final ActionToolbarMenuAndItemDescriptor<StateToken> renameCtn = new ActionToolbarMenuAndItemDescriptor<StateToken>( - AccessRolDTO.Editor, CONTENT_TOPBAR, new Listener<StateToken>() { - @Override - public void onEvent(final StateToken stateToken) { - contextNavigator.editItem(stateToken); - } - }); - renameCtn.setTextDescription(textDescription); - renameCtn.setParentMenuTitle(parentMenuTitle); - renameCtn.setEnableCondition(notDeleted()); - - // contentActionRegistry.addAction(renameCtn, registerInTypes); - } - - protected void createDelContainerAction(final String text, final String parentMenuTitle, - final String... registerInTypes) { - final ActionToolbarMenuAndItemDescriptor<StateToken> delContainer = new ActionToolbarMenuAndItemDescriptor<StateToken>( - AccessRolDTO.Administrator, CONTENT_TOPBAR, new Listener<StateToken>() { - @Override - public void onEvent(final StateToken token) { - OldNotifyUser.info("Sorry, in development"); - } - }); - delContainer.setParentMenuTitle(parentMenuTitle); - delContainer.setTextDescription(i18n.t(text)); - delContainer.setMustBeConfirmed(true); - delContainer.setConfirmationTitle(i18n.t("Please confirm")); - delContainer.setConfirmationText(i18n.t("You will delete it with all its contents. Are you sure?")); - // contextActionRegistry.addAction(delContainer, registerInTypes); - } - - protected void createDelContentAction(final String parentMenuTitle, final String textDescription, - final String... registerInTypes) { - final ActionToolbarMenuAndItemDescriptor<StateToken> delContent = new ActionToolbarMenuAndItemDescriptor<StateToken>( - AccessRolDTO.Administrator, CONTENT_TOPBAR, new Listener<StateToken>() { - @Override - public void onEvent(final StateToken token) { - contentServiceProvider.get().delContent(session.getUserHash(), token, - new AsyncCallbackSimple<StateContentDTO>() { - @Override - public void onSuccess(final StateContentDTO state) { - session.setCurrentState(state); - final StateToken parent = token.copy().clearDocument(); - stateManager.gotoStateToken(parent); - contextNavigator.clear(); - contextNavigator.refreshState(); - } - }); - } - }); - delContent.setParentMenuTitle(parentMenuTitle); - delContent.setTextDescription(textDescription); - delContent.setMustBeConfirmed(true); - delContent.setConfirmationTitle(i18n.t("Please confirm")); - delContent.setConfirmationText(i18n.t("Are you sure?")); - delContent.setEnableCondition(notDefAndNotDeleted()); - // contentActionRegistry.addAction(delContent, registerInTypes); - } - - protected void createDownloadActions(final String typeUploadedfile) { - final ActionToolbarButtonDescriptor<StateToken> download = new ActionToolbarButtonDescriptor<StateToken>( - AccessRolDTO.Viewer, CONTENT_TOPBAR, new Listener<StateToken>() { - @Override - public void onEvent(final StateToken token) { - downloadContent(token); - } - }); - download.setMustBeAuthenticated(false); - download.setTextDescription(i18n.t("Download")); - download.setToolTip(i18n.t("Download this file")); - download.setIconUrl("images/nav/download.png"); - - final ActionMenuItemDescriptor<StateToken> downloadCtx = new ActionMenuItemDescriptor<StateToken>( - AccessRolDTO.Viewer, new Listener<StateToken>() { - @Override - public void onEvent(final StateToken token) { - downloadContent(token); - } - }); - downloadCtx.setMustBeAuthenticated(false); - downloadCtx.setTextDescription(i18n.t("Download")); - downloadCtx.setIconUrl("images/nav/download.png"); - - // contentActionRegistry.addAction(download, typeUploadedfile); - // contextActionRegistry.addAction(downloadCtx, typeUploadedfile); - } - - protected ActionToolbarButtonDescriptor<StateToken> createEditAction(final String fileMenuTitle, - final String... registerInTypes) { - final ActionToolbarButtonDescriptor<StateToken> editContent = new ActionToolbarButtonDescriptor<StateToken>( - AccessRolDTO.Editor, CONTENT_TOPBAR, new Listener<StateToken>() { - @Override - public void onEvent(final StateToken stateToken) { - OldNotifyUser.showProgressProcessing(); - session.check(new AsyncCallbackSimple<Void>() { - @Override - public void onSuccess(final Void result) { - final ContentEditor editor = textEditorProvider.get(); - foldableContent.detach(); - contextNavigator.detach(); - // contextPropEditorProvider.get().attach(); - editor.edit(session.getContentState().getContent(), new Listener<String>() { - @Override - public void onEvent(final String html) { - OldNotifyUser.showProgressSaving(); - contentServiceProvider.get().save(session.getUserHash(), stateToken, html, - new AsyncCallback<Void>() { - @Override - public void onFailure(final Throwable caught) { - OldNotifyUser.hideProgress(); - if (caught instanceof SessionExpiredException) { - errorHandler.doSessionExpired(); - } else { - OldNotifyUser.error(i18n.t("Error saving document. Retrying...")); - errorHandler.process(caught); - editor.onSaveFailed(); - } - } - - @Override - public void onSuccess(final Void param) { - OldNotifyUser.hideProgress(); - session.getContentState().setContent(html); - editor.onSavedSuccessful(); - } - }); - } - }, new Listener0() { - @Override - public void onEvent() { - // onClose - deferredCommandWrapper.addCommand(new ScheduledCommand() { - @Override - public void execute() { - foldableContent.attach(); - // contextPropEditorProvider.get().detach(); - contextNavigator.attach(); - if (session.inSameToken(stateToken)) { - contextNavigator.refreshState(); - foldableContent.refreshState(); - } - } - }); - } - }); - editor.setFileMenuTitle(fileMenuTitle); - OldNotifyUser.hideProgress(); - } - }); - } - }); - editContent.setTextDescription(i18n.tWithNT("Edit", "used in button")); - editContent.setIconUrl("images/content_edit.png"); - editContent.setLeftSeparator(ActionToolbarButtonSeparator.spacer); - editContent.setEnableCondition(notDeleted()); - // contentActionRegistry.addAction(editContent, registerInTypes); - return editContent; - } - - protected ActionMenuItemDescriptor<StateToken> createGoAction(final String... registerInTypes) { - final ActionMenuItemDescriptor<StateToken> go = new ActionMenuItemDescriptor<StateToken>( - AccessRolDTO.Viewer, new Listener<StateToken>() { - @Override - public void onEvent(final StateToken token) { - stateManager.gotoStateToken(token); - } - }); - go.setMustBeAuthenticated(false); - go.setTextDescription(i18n.t("Open")); - go.setIconUrl("images/nav/go.png"); - // contextActionRegistry.addAction(go, registerInTypes); - return go; - } - - protected ActionToolbarButtonDescriptor<StateToken> createGoHomeAction(final String... registerInTypes) { - final ActionToolbarButtonDescriptor<StateToken> goGroupHome = new ActionToolbarButtonDescriptor<StateToken>( - AccessRolDTO.Viewer, CONTEXT_TOPBAR, new Listener<StateToken>() { - @Override - public void onEvent(final StateToken token) { - stateManager.gotoHistoryToken(token.getGroup()); - } - }); - goGroupHome.setMustBeAuthenticated(false); - goGroupHome.setIconUrl("images/group-home.png"); - goGroupHome.setEnableCondition(new ActionEnableCondition<StateToken>() { - @Override - public boolean mustBeEnabled(final StateToken token) { - final StateToken defContentToken = session.getCurrentState().getGroup().getDefaultContent().getStateToken(); - return !session.getCurrentStateToken().equals(defContentToken); - } - }); - goGroupHome.setLeftSeparator(ActionToolbarButtonSeparator.fill); - // contextActionRegistry.addAction(goGroupHome, registerInTypes); - return goGroupHome; - } - - protected void createNewContainerAction(final String contentTypeId, final String iconUrl, - final String textDescription, final String parentMenuTitle, final String parentMenuSubtitle, - final String defaultName, final Position position, final String... registerInTypes) { - final ActionToolbarMenuAndItemDescriptor<StateToken> addFolder; - addFolder = new ActionToolbarMenuAndItemDescriptor<StateToken>(AccessRolDTO.Editor, CONTEXT_TOPBAR, - new Listener<StateToken>() { - @Override - public void onEvent(final StateToken stateToken) { - OldNotifyUser.showProgressProcessing(); - contentServiceProvider.get().addFolder(session.getUserHash(), stateToken, defaultName, - contentTypeId, new AsyncCallbackSimple<StateContainerDTO>() { - @Override - public void onSuccess(final StateContainerDTO state) { - contextNavigator.setEditOnNextStateChange(true); - stateManager.setRetrievedStateAndGo(state); - } - }); - } - }); - addFolder.setTextDescription(textDescription); - addFolder.setParentMenuTitle(parentMenuTitle); - addFolder.setParentSubMenuTitle(parentMenuSubtitle); - addFolder.setIconUrl(iconUrl); - register(addFolder, position, registerInTypes); - } - - protected ActionToolbarMenuAndItemDescriptor<StateToken> createNewContentAction(final String typeId, - final String iconUrl, final String description, final String parentMenuTitle, - final Position position, final String... registerInTypes) { - final ActionToolbarMenuAndItemDescriptor<StateToken> addContent = new ActionToolbarMenuAndItemDescriptor<StateToken>( - AccessRolDTO.Editor, CONTEXT_TOPBAR, new Listener0() { - @Override - public void onEvent() { - OldNotifyUser.showProgressProcessing(); - contentServiceProvider.get().addContent(session.getUserHash(), - session.getCurrentState().getStateToken(), description, typeId, - new AsyncCallbackSimple<StateContentDTO>() { - @Override - public void onSuccess(final StateContentDTO state) { - contextNavigator.setEditOnNextStateChange(true); - stateManager.setRetrievedStateAndGo(state); - } - }); - } - }); - addContent.setTextDescription(description); - addContent.setParentMenuTitle(parentMenuTitle); - addContent.setParentSubMenuTitle(i18n.t("New")); - addContent.setIconUrl(iconUrl); - register(addContent, position, registerInTypes); - return addContent; - } - - protected abstract void createPostSessionInitActions(); - - protected ActionToolbarMenuDescriptor<StateToken> createRefreshCntAction(final String parentMenuTitle, - final String... registerInTypes) { - final ActionToolbarMenuDescriptor<StateToken> refreshCnt = new ActionToolbarMenuDescriptor<StateToken>( - AccessRolDTO.Editor, CONTENT_TOPBAR, new Listener<StateToken>() { - @Override - public void onEvent(final StateToken stateToken) { - stateManager.refreshCurrentState(); - contextNavigator.selectItem(stateToken); - } - }); - refreshCnt.setMustBeAuthenticated(false); - refreshCnt.setParentMenuTitle(parentMenuTitle); - refreshCnt.setTextDescription(i18n.t("Refresh")); - refreshCnt.setIconUrl("images/nav/refresh.png"); - // contentActionRegistry.addAction(refreshCnt, registerInTypes); - return refreshCnt; - } - - protected ActionToolbarMenuDescriptor<StateToken> createRefreshCxtAction( - final String parentMenuTitleCtx, final String... registerInTypes) { - final ActionToolbarMenuDescriptor<StateToken> refreshCtx = new ActionToolbarMenuDescriptor<StateToken>( - AccessRolDTO.Editor, CONTEXT_TOPBAR, new Listener<StateToken>() { - @Override - public void onEvent(final StateToken stateToken) { - stateManager.refreshCurrentState(); - contextNavigator.selectItem(stateToken); - } - }); - refreshCtx.setMustBeAuthenticated(false); - refreshCtx.setParentMenuTitle(parentMenuTitleCtx); - refreshCtx.setTextDescription(i18n.t("Refresh")); - refreshCtx.setIconUrl("images/nav/refresh.png"); - // contextActionRegistry.addAction(refreshCtx, registerInTypes); - return refreshCtx; - } - - protected ActionToolbarMenuAndItemDescriptor<StateToken> createRenameContentInCtxAction( - final String parentMenuTitleCtx, final String textDescription, final String... registerInTypes) { - final ActionToolbarMenuAndItemDescriptor<StateToken> renameCtx = new ActionToolbarMenuAndItemDescriptor<StateToken>( - AccessRolDTO.Editor, CONTEXT_TOPBAR, new Listener<StateToken>() { - @Override - public void onEvent(final StateToken stateToken) { - contextNavigator.editItem(stateToken); - } - }); - renameCtx.setTextDescription(textDescription); - renameCtx.setParentMenuTitle(parentMenuTitleCtx); - // contextActionRegistry.addAction(renameCtx, registerInTypes); - return renameCtx; - } - - protected ActionToolbarMenuDescriptor<StateToken> createSetAsDefContent(final String parentMenuTitle, - final String... registerInTypes) { - final ActionToolbarMenuDescriptor<StateToken> setAsDefGroupContent; - setAsDefGroupContent = new ActionToolbarMenuDescriptor<StateToken>(AccessRolDTO.Administrator, - CONTENT_TOPBAR, new Listener<StateToken>() { - @Override - public void onEvent(final StateToken token) { - OldNotifyUser.showProgressProcessing(); - contentServiceProvider.get().setAsDefaultContent(session.getUserHash(), token, - new AsyncCallbackSimple<ContentSimpleDTO>() { - @Override - public void onSuccess(final ContentSimpleDTO defContent) { - session.getCurrentState().getGroup().setDefaultContent(defContent); - OldNotifyUser.hideProgress(); - OldNotifyUser.info(i18n.t("Content selected as the group homepage")); - } - }); - } - }); - setAsDefGroupContent.setTextDescription(i18n.t("Set this as the default group page")); - setAsDefGroupContent.setIconUrl("images/group-home.png"); - setAsDefGroupContent.setEnableCondition(notDefAndNotDeleted()); - setAsDefGroupContent.setParentMenuTitle(parentMenuTitle); - // contentActionRegistry.addAction(setAsDefGroupContent, - // registerInTypes); - return setAsDefGroupContent; - } - - // - // protected void createSetGroupBackImageAction(final String parentMenuTitle, - // final String... registerInTypes) { - // final ActionToolbarMenuAndItemDescriptor<StateToken> setGroupBackImage = - // new ActionToolbarMenuAndItemDescriptor<StateToken>( - // AccessRolDTO.Administrator, CONTENT_TOPBAR, new Listener<StateToken>() { - // @Override - // public void onEvent(final StateToken token) { - // groupServiceProvider.get().setGroupBackImage(session.getUserHash(), token, - // new AsyncCallbackSimple<GroupDTO>() { - // @Override - // public void onSuccess(final GroupDTO newGroup) { - // if (session.getCurrentState().getGroup().getShortName().equals( - // newGroup.getShortName())) { - // session.getCurrentState().setGroup(newGroup); - // wsBackManager.clearBackImage(); - // wsBackManager.setBackImage(newGroup.getGroupBackImage().getStateToken()); - // } - // } - // }); - // } - // }); - // setGroupBackImage.setParentMenuTitle(parentMenuTitle); - // setGroupBackImage.setTextDescription(i18n.t("Set this as the group background image")); - // setGroupBackImage.setIconUrl("images/nav/picture.png"); - // setGroupBackImage.setEnableCondition(new - // ActionEnableCondition<StateToken>() { - // @Override - // public boolean mustBeEnabled(final StateToken token) { - // return session.getContentState().getMimeType().isImage(); - // } - // }); - // // contentActionRegistry.addAction(setGroupBackImage, registerInTypes); - // } - - protected void createSetStatusAction(final AccessRolDTO rol, final String textDescription, - final ContentStatus status, final String[] contentsModerated) { - final ActionToolbarMenuRadioDescriptor<StateToken> action = new ActionToolbarMenuRadioDescriptor<StateToken>( - rol, CONTENT_TOPBAR, new Listener<StateToken>() { - @Override - public void onEvent(final StateToken stateToken) { - setContentStatus(status, stateToken); - } - }, "ContentRadioStatus", new RadioMustBeChecked() { - @Override - public boolean mustBeChecked() { - if (session.getContainerState() instanceof StateContentDTO) { - final ContentStatus currentStatus = session.getContentState().getStatus(); - return status.equals(currentStatus); - } - return false; - } - }); - action.setTextDescription(textDescription); - action.setParentMenuTitle(PUBLICATION_MENU); - action.setParentMenuIconUrl("images/anybody.png"); - // contentActionRegistry.addAction(action, contentsModerated); - } - - protected void createShowDeletedItems(final String parentMenuTitle, final String... registerInTypes) { - final ActionToolbarMenuCheckItemDescriptor<StateToken> showDeletedItems = new ActionToolbarMenuCheckItemDescriptor<StateToken>( - AccessRolDTO.Editor, CONTEXT_TOPBAR, new Listener0() { - @Override - public void onEvent() { - final boolean mustShow = !session.getCurrentUserInfo().getShowDeletedContent(); - session.getCurrentUserInfo().setShowDeletedContent(mustShow); - if (!mustShow && session.isCurrentStateAContent() - && session.getContentState().getStatus().equals(ContentStatus.inTheDustbin)) { - stateManager.gotoHistoryToken(session.getCurrentStateToken().getGroup()); - } - contextNavigator.clear(); - contextNavigator.refreshState(); - } - }, new ActionCheckedCondition() { - @Override - public boolean mustBeChecked() { - return session.getShowDeletedContent(); - } - }); - showDeletedItems.setParentMenuTitle(parentMenuTitle); - showDeletedItems.setTextDescription("Show deleted items"); - showDeletedItems.setMustBeAuthenticated(true); - // contextActionRegistry.addAction(showDeletedItems, registerInTypes); - } - - protected ActionToolbarMenuDescriptor<StateToken> createTranslateAction(final String fileMenuTitle, - final String... registerInTypes) { - final ActionToolbarMenuDescriptor<StateToken> translateContent = new ActionToolbarMenuDescriptor<StateToken>( - AccessRolDTO.Editor, CONTENT_TOPBAR, new Listener<StateToken>() { - @Override - public void onEvent(final StateToken stateToken) { - OldNotifyUser.important(i18n.t("Sorry, this functionality is currently in development")); - } - }); - translateContent.setParentMenuTitle(fileMenuTitle); - translateContent.setTextDescription(i18n.tWithNT("Translate", "used in button")); - translateContent.setToolTip(i18n.t("Translate this document to other languages")); - translateContent.setIconUrl("images/language.gif"); - translateContent.setEnableCondition(notDeleted()); - // contentActionRegistry.addAction(translateContent, registerInTypes); - return translateContent; - } - - protected ActionToolbarButtonAndItemDescriptor<StateToken> createUploadAction( - final String textDescription, final String iconUrl, final String toolTip, - final String permitedExtensions, final String... registerInTypes) { - final ActionToolbarButtonAndItemDescriptor<StateToken> uploadFile; - uploadFile = new ActionToolbarButtonAndItemDescriptor<StateToken>(AccessRolDTO.Editor, - CONTEXT_BOTTOMBAR, new Listener0() { - @Override - public void onEvent() { - if (permitedExtensions != null) { - // FIXME: can't be reset ... - // fileUploaderProvider.get().setPermittedExtensions(permitedExtensions); - } else { - // FIXME: can't be reset ... - // fileUploaderProvider.get().resetPermittedExtensions(); - } - fileUploaderProvider.get().show(); - } - }); - uploadFile.setTextDescription(textDescription); - uploadFile.setIconUrl(iconUrl); - uploadFile.setToolTip(toolTip); - // contextActionRegistry.addAction(uploadFile, registerInTypes); - return uploadFile; - } - - protected ActionToolbarButtonAndItemDescriptor<StateToken> createUploadMediaAction( - final String... registerInTypes) { - final ActionToolbarButtonAndItemDescriptor<StateToken> uploadMedia = createUploadAction( - i18n.t("Upload media"), "images/nav/upload.png", - i18n.t("Upload some media (images, videos...)"), session.getGalleryPermittedExtensions()); - // contextActionRegistry.addAction(uploadMedia, registerInTypes); - return uploadMedia; - } - - protected void downloadContent(final StateToken token) { - fileDownloadProvider.get().downloadFile(token); - } - - private ActionEnableCondition<StateToken> notDefAndNotDeleted() { - return new ActionEnableCondition<StateToken>() { - @Override - public boolean mustBeEnabled(final StateToken token) { - final boolean isNotDefContentToken = !session.getCurrentState().getGroup().getDefaultContent().getStateToken().equals( - session.getCurrentStateToken()); - return isNotDefContentToken && notDeleted().mustBeEnabled(token); - } - }; - } - - private ActionEnableCondition<StateToken> notDeleted() { - return new ActionEnableCondition<StateToken>() { - @Override - public boolean mustBeEnabled(final StateToken token) { - final boolean isNotDeleted = !(session.isCurrentStateAContent() && session.getContentState().getStatus().equals( - ContentStatus.inTheDustbin)); - return isNotDeleted; - } - }; - } - - private void register(final ActionToolbarMenuAndItemDescriptor<StateToken> action, - final Position position, final String... registerInTypes) { - if (position.equals(Position.ctx)) { - // contextActionRegistry.addAction(action, registerInTypes); - } else if (position.equals(Position.cnt)) { - // contentActionRegistry.addAction(action, registerInTypes); - } - } - - private void setContentStatus(final ContentStatus status, final StateToken stateToken) { - final AsyncCallbackSimple<StateAbstractDTO> callback = new AsyncCallbackSimple<StateAbstractDTO>() { - @Override - public void onSuccess(final StateAbstractDTO state) { - if (session.inSameToken(stateToken)) { - session.setCurrentState(state); - // publicLink.setState(state); - foldableContent.refreshState(); - } - contextNavigator.setItemStatus(stateToken, status); - } - }; - if (status.equals(ContentStatus.publishedOnline) || status.equals(ContentStatus.rejected) - || status.equals(ContentStatus.inTheDustbin)) { - contentServiceProvider.get().setStatusAsAdmin(session.getUserHash(), stateToken, status, callback); - } else { - contentServiceProvider.get().setStatus(session.getUserHash(), stateToken, status, callback); - } - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/RegistryModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/RegistryModule.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/RegistryModule.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,219 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client; - -import org.ourproject.kune.platf.client.services.AbstractExtendedModule; - -import cc.kune.core.client.registry.AclEditableRegistry; -import cc.kune.core.client.registry.AuthorableRegistry; -import cc.kune.core.client.registry.CanBeHomepageRegistry; -import cc.kune.core.client.registry.ComentableRegistry; -import cc.kune.core.client.registry.DragableRegistry; -import cc.kune.core.client.registry.DropableRegistry; -import cc.kune.core.client.registry.EmailSubscribeAbleRegistry; -import cc.kune.core.client.registry.LicensableRegistry; -import cc.kune.core.client.registry.PublishModerableRegistry; -import cc.kune.core.client.registry.RateableRegistry; -import cc.kune.core.client.registry.RenamableRegistry; -import cc.kune.core.client.registry.TageableRegistry; -import cc.kune.core.client.registry.TranslatableRegistry; -import cc.kune.core.client.registry.VersionableRegistry; -import cc.kune.core.client.registry.XmppComentableRegistry; -import cc.kune.core.client.registry.XmppNotifyCapableRegistry; - -import com.calclab.suco.client.ioc.decorator.Singleton; -import com.calclab.suco.client.ioc.module.Factory; - -public class RegistryModule extends AbstractExtendedModule { - - @Override - protected void onInstall() { - - register(Singleton.class, new Factory<AclEditableRegistry>(AclEditableRegistry.class) { - @Override - public AclEditableRegistry create() { - return new AclEditableRegistry(); - } - }); - register(Singleton.class, new Factory<AuthorableRegistry>(AuthorableRegistry.class) { - @Override - public AuthorableRegistry create() { - return new AuthorableRegistry(); - } - }); - register(Singleton.class, new Factory<CanBeHomepageRegistry>(CanBeHomepageRegistry.class) { - @Override - public CanBeHomepageRegistry create() { - return new CanBeHomepageRegistry(); - } - }); - - register(Singleton.class, new Factory<ComentableRegistry>(ComentableRegistry.class) { - @Override - public ComentableRegistry create() { - return new ComentableRegistry(); - } - }); - - register(Singleton.class, new Factory<DragableRegistry>(DragableRegistry.class) { - @Override - public DragableRegistry create() { - return new DragableRegistry(); - } - }); - - register(Singleton.class, new Factory<DropableRegistry>(DropableRegistry.class) { - @Override - public DropableRegistry create() { - return new DropableRegistry(); - } - }); - - register(Singleton.class, new Factory<EmailSubscribeAbleRegistry>(EmailSubscribeAbleRegistry.class) { - @Override - public EmailSubscribeAbleRegistry create() { - return new EmailSubscribeAbleRegistry(); - } - }); - - register(Singleton.class, new Factory<LicensableRegistry>(LicensableRegistry.class) { - @Override - public LicensableRegistry create() { - return new LicensableRegistry(); - } - }); - - register(Singleton.class, new Factory<PublishModerableRegistry>(PublishModerableRegistry.class) { - @Override - public PublishModerableRegistry create() { - return new PublishModerableRegistry(); - } - }); - - register(Singleton.class, new Factory<RateableRegistry>(RateableRegistry.class) { - @Override - public RateableRegistry create() { - return new RateableRegistry(); - } - }); - - register(Singleton.class, new Factory<TageableRegistry>(TageableRegistry.class) { - @Override - public TageableRegistry create() { - return new TageableRegistry(); - } - }); - - register(Singleton.class, new Factory<RenamableRegistry>(RenamableRegistry.class) { - @Override - public RenamableRegistry create() { - return new RenamableRegistry(); - } - }); - - register(Singleton.class, new Factory<TranslatableRegistry>(TranslatableRegistry.class) { - @Override - public TranslatableRegistry create() { - return new TranslatableRegistry(); - } - }); - - register(Singleton.class, new Factory<VersionableRegistry>(VersionableRegistry.class) { - @Override - public VersionableRegistry create() { - return new VersionableRegistry(); - } - }); - - register(Singleton.class, new Factory<XmppComentableRegistry>(XmppComentableRegistry.class) { - @Override - public XmppComentableRegistry create() { - return new XmppComentableRegistry(); - } - }); - - register(Singleton.class, new Factory<XmppNotifyCapableRegistry>(XmppNotifyCapableRegistry.class) { - @Override - public XmppNotifyCapableRegistry create() { - return new XmppNotifyCapableRegistry(); - } - }); - - // register(Singleton.class, new - // Factory<IconsRegistry>(IconsRegistry.class) { - // @Override - // public IconsRegistry create() { - // return new IconsRegistry(); - // } - // }); - - // register(Singleton.class, new - // Factory<ContentCapabilitiesRegistry>(ContentCapabilitiesRegistry.class) - // { - // @Override - // public ContentCapabilitiesRegistry create() { - // return new ContentCapabilitiesRegistry(i(AuthorableRegistry.class), - // i(AclEditableRegistry.class), - // i(OldIconsRegistry.class), i(CanBeHomepageRegistry.class), - // i(ComentableRegistry.class), - // i(DragableRegistry.class), i(DropableRegistry.class), - // i(EmailSubscribeAbleRegistry.class), - // i(LicensableRegistry.class), i(PublishModerableRegistry.class), - // i(RateableRegistry.class), - // i(TageableRegistry.class), i(RenamableRegistry.class), - // i(TranslatableRegistry.class), - // i(VersionableRegistry.class), i(XmppComentableRegistry.class), - // i(XmppNotifyCapableRegistry.class)); - // } - // }); - // - // register(Singleton.class, new - // Factory<ContextActionRegistry>(ContextActionRegistry.class) { - // @Override - // public ContextActionRegistry create() { - // return new ContextActionRegistry(); - // } - // }); - // - // register(Singleton.class, new - // Factory<ContentActionRegistry>(ContentActionRegistry.class) { - // @Override - // public ContentActionRegistry create() { - // return new ContentActionRegistry(); - // } - // }); - // - // register(Singleton.class, new - // Factory<GroupActionRegistry>(GroupActionRegistry.class) { - // @Override - // public GroupActionRegistry create() { - // return new GroupActionRegistry(); - // } - // }); - // - // register(Singleton.class, new - // Factory<UserActionRegistry>(UserActionRegistry.class) { - // @Override - // public UserActionRegistry create() { - // return new UserActionRegistry(); - // } - // }); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceMessages.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceMessages.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceMessages.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,26 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client; - -public final class WorkspaceMessages { - - private WorkspaceMessages() { - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceModule.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,1113 +0,0 @@ -/* - * -// * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - \*/ -package org.ourproject.kune.workspace.client; - -import org.ourproject.kune.platf.client.services.AbstractExtendedModule; - -public class WorkspaceModule extends AbstractExtendedModule { - @Override - protected void onInstall() { - // - // register(Singleton.class, new - // Factory<SocialNetworkServiceAsync>(SocialNetworkServiceAsync.class) { - // @Override - // public SocialNetworkServiceAsync create() { - // final SocialNetworkServiceAsync snServiceAsync = - // (SocialNetworkServiceAsync) GWT.create(SocialNetworkService.class); - // ((ServiceDefTarget) - // snServiceAsync).setServiceEntryPoint(GWT.getModuleBaseURL() - // + "SocialNetworkService"); - // return snServiceAsync; - // } - // }, new Factory<GroupServiceAsync>(GroupServiceAsync.class) { - // @Override - // public GroupServiceAsync create() { - // final GroupServiceAsync groupServiceAsync = (GroupServiceAsync) - // GWT.create(GroupService.class); - // ((ServiceDefTarget) - // groupServiceAsync).setServiceEntryPoint(GWT.getModuleBaseURL() + - // "GroupService"); - // return groupServiceAsync; - // } - // }, new Factory<ContentServiceAsync>(ContentServiceAsync.class) { - // @Override - // public ContentServiceAsync create() { - // final ContentServiceAsync contentServiceAsync = (ContentServiceAsync) - // GWT.create(ContentService.class); - // ((ServiceDefTarget) - // contentServiceAsync).setServiceEntryPoint(GWT.getModuleBaseURL() + - // "ContentService"); - // return contentServiceAsync; - // } - // }); - // - // register(ApplicationComponentGroup.class, new - // Factory<WorkspaceSkeleton>(WorkspaceSkeleton.class) { - // @Override - // public WorkspaceSkeleton create() { - // return new WorkspaceSkeleton(); - // } - // }); - // - // // register(ApplicationComponentGroup.class, new - // // Factory<SiteProgress>(SiteProgress.class) { - // // @Override - // // public SiteProgress create() { - // // final SiteProgressPresenter presenter = new - // SiteProgressPresenter(); - // // final SiteProgressPanel panel = new SiteProgressPanel(presenter, - // // p(SitePublicSpaceLink.class)); - // // presenter.init(panel); - // // return presenter; - // // } - // // }); - // - // // register(ApplicationComponentGroup.class, new - // Factory<WorkspaceNotifyUser>(WorkspaceNotifyUser.class) { - // // @Override - // // public WorkspaceNotifyUser create() { - // // return new WorkspaceNotifyUser(i(NotifyUser.class), - // i(I18nUITranslationService.class), - // // i(SiteProgress.class), p(ToastMessage.class), - // p(WorkspaceSkeleton.class)); - // // } - // // }); - // // - // // register(ApplicationComponentGroup.class, new - // // Factory<SitePublicSpaceLink>(SitePublicSpaceLink.class) { - // // @Override - // // public SitePublicSpaceLink create() { - // // final SitePublicSpaceLinkPresenter presenter = new - // // SitePublicSpaceLinkPresenter(i(StateManager.class), - // // i(StateTokenUtils.class)); - // // final SitePublicSpaceLinkPanel panel = new - // // SitePublicSpaceLinkPanel(presenter, - // // i(WorkspaceSkeleton.class), i(I18nUITranslationService.class), - // // i(Images.class)); - // // presenter.init(panel); - // // return presenter; - // // } - // // }); - // - // register(Singleton.class, new - // Factory<StateTokenUtils>(StateTokenUtils.class) { - // @Override - // public StateTokenUtils create() { - // return new StateTokenUtils(i(Session.class)); - // } - // }); - // - // register(NoDecoration.class, new - // Factory<ToastMessage>(ToastMessage.class) { - // @Override - // public ToastMessage create() { - // final ToastMessagePresenter presenter = new ToastMessagePresenter(); - // final ToastMessagePanel panel = new ToastMessagePanel(); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // // register(ApplicationComponentGroup.class, new - // // Factory<SiteUserOptions>(SiteUserOptions.class) { - // // @Override - // // public SiteUserOptions create() { - // // final SiteUserOptionsPresenter presenter = new - // // SiteUserOptionsPresenter(i(Session.class), - // // i(StateManager.class), p(FileDownloadUtils.class), - // // $(I18nTranslationService.class), - // // $(IconResources.class)); - // // final SiteUserOptionsPanel panel = new - // // SiteUserOptionsPanel(presenter, i(WorkspaceSkeleton.class), - // // $(GuiBindingsRegister.class)); - // // presenter.init(panel); - // // return presenter; - // // } - // // }); - // // - // // register(ApplicationComponentGroup.class, new - // // Factory<SiteSignInLink>(SiteSignInLink.class) { - // // @Override - // // public SiteSignInLink create() { - // // final SiteSignInLinkPresenter presenter = new - // // SiteSignInLinkPresenter(i(Session.class)); - // // final SiteSignInLinkPanel panel = new - // SiteSignInLinkPanel(presenter, - // // i(I18nUITranslationService.class), - // // i(WorkspaceSkeleton.class)); - // // presenter.init(panel); - // // return presenter; - // // } - // // }); - // - // // register(ApplicationComponentGroup.class, new - // // Factory<SiteSignOutLink>(SiteSignOutLink.class) { - // // @Override - // // public SiteSignOutLink create() { - // // final SiteSignOutLinkPresenter presenter = new - // // SiteSignOutLinkPresenter(i(Session.class), - // // p(UserServiceAsync.class), p(ErrorHandler.class)); - // // final SiteSignOutLinkPanel panel = new - // // SiteSignOutLinkPanel(presenter, - // // i(I18nUITranslationService.class), i(WorkspaceSkeleton.class)); - // // presenter.init(panel); - // // return presenter; - // // } - // // }); - // // - // // register(ApplicationComponentGroup.class, new - // // Factory<SiteOptions>(SiteOptions.class) { - // // @Override - // // public SiteOptions create() { - // // final SiteOptionsPresenter presenter = new - // // SiteOptionsPresenter(i(I18nUITranslationService.class), - // // i(IconResources.class)); - // // final SiteOptionsPanel panel = new - // // SiteOptionsPanel(i(WorkspaceSkeleton.class), - // // i(I18nUITranslationService.class), i(GuiBindingsRegister.class)); - // // presenter.init(panel); - // // return presenter; - // // } - // // }); - // - // register(ApplicationComponentGroup.class, new - // Factory<SiteSearch>(SiteSearch.class) { - // @Override - // public SiteSearch create() { - // final SiteSearchPresenter presenter = new - // SiteSearchPresenter(p(SiteSearcher.class), - // i(I18nTranslationService.class)); - // final SiteSearchPanel panel = new SiteSearchPanel(presenter, - // i(WorkspaceSkeleton.class), - // i(Images.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(ApplicationComponentGroup.class, new - // Factory<SiteLogo>(SiteLogo.class) { - // @Override - // public SiteLogo create() { - // // final SiteLogoPresenter presenter = new - // // SiteLogoPresenter(i(Session.class)); - // // final SiteLogoPanel panel = new SiteLogoPanel(presenter, - // // i(WorkspaceSkeleton.class)); - // // presenter.init(panel); - // return null; - // } - // }); - // - // register(ApplicationComponentGroup.class, new - // Factory<EntityHeader>(EntityHeader.class) { - // @Override - // public EntityHeader create() { - // final EntityHeaderPresenter presenter = new - // EntityHeaderPresenter(i(StateManager.class), - // i(WsThemeManager.class), i(Session.class)); - // final EntityHeaderPanel panel = new - // EntityHeaderPanel(i(WorkspaceSkeleton.class), - // p(FileDownloadUtils.class), i(Images.class), - // i(GuiBindingsRegister.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(Singleton.class, new - // Factory<WsBackManager>(WsBackManager.class) { - // @Override - // public WsBackManager create() { - // return new WsBackManagerImpl(i(FileDownloadUtils.class)); - // } - // }); - // - // register(ApplicationComponentGroup.class, new - // Factory<WsThemeManager>(WsThemeManager.class) { - // @Override - // public WsThemeManager create() { - // final WsThemeManager presenter = new WsThemeManager(i(Session.class), - // p(GroupServiceAsync.class), - // i(StateManager.class), i(WsBackManager.class)); - // new WsThemeManagerPanel(presenter, i(WorkspaceSkeleton.class)); - // return presenter; - // } - // }); - // - // register(NoDecoration.class, new - // Factory<WsThemeSelector>(WsThemeSelector.class) { - // @Override - // public WsThemeSelector create() { - // final WsThemeSelectorPresenter presenter = new - // WsThemeSelectorPresenter(i(Session.class), - // i(I18nTranslationService.class)); - // presenter.init(new SimpleGuiItem(i(GuiBindingsRegister.class))); - // return presenter; - // } - // }); - // - // register(ApplicationComponentGroup.class, new - // Factory<EntityTitle>(EntityTitle.class) { - // @Override - // public EntityTitle create() { - // final EntityTitlePresenter presenter = new - // EntityTitlePresenter(i(StateManager.class), - // i(Session.class), i(ContentIconsRegistry.class), - // i(RenamableRegistry.class), - // i(RenameAction.class)); - // final EntityTitlePanel panel = new - // EntityTitlePanel(i(WorkspaceSkeleton.class), presenter); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(ApplicationComponentGroup.class, new - // Factory<EntitySubTitle>(EntitySubTitle.class) { - // @Override - // public EntitySubTitle create() { - // final EntitySubTitlePresenter presenter = new - // EntitySubTitlePresenter( - // i(I18nUITranslationService.class), i(StateManager.class), false, - // i(AuthorableRegistry.class)); - // final EntitySubTitlePanel panel = new EntitySubTitlePanel(presenter, - // i(WorkspaceSkeleton.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // // register(ApplicationComponentGroup.class, new - // // Factory<EntityLicensePresenter>(EntityLicensePresenter.class) { - // // @Override - // // public EntityLicensePresenter create() { - // // final EntityLicensePresenter presenter = new - // // EntityLicensePresenter(i(StateManager.class)); - // // final EntityLicensePanel panel = new EntityLicensePanel(presenter, - // // i(I18nUITranslationService.class), - // // i(WorkspaceSkeleton.class)); - // // presenter.init(panel); - // // return presenter; - // // } - // // }); - // - // register(ApplicationComponentGroup.class, new - // Factory<RateIt>(RateIt.class) { - // @Override - // public RateIt create() { - // final RateItPresenter presenter = new - // RateItPresenter(i(I18nUITranslationService.class), - // i(Session.class), p(ContentServiceAsync.class), - // i(StateManager.class), p(RatePresenter.class), - // i(ContentCapabilitiesRegistry.class)); - // final RateItPanel panel = new RateItPanel(presenter, - // i(I18nUITranslationService.class), - // i(WorkspaceSkeleton.class), i(Images.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(ApplicationComponentGroup.class, new - // Factory<RatePresenter>(RatePresenter.class) { - // @Override - // public RatePresenter create() { - // final RatePresenter presenter = new - // RatePresenter(i(StateManager.class), - // i(ContentCapabilitiesRegistry.class)); - // final RatePanel panel = new RatePanel(null, null, - // i(I18nUITranslationService.class), - // i(WorkspaceSkeleton.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(Singleton.class, new - // Factory<ActionManager>(ActionManager.class) { - // @Override - // public ActionManager create() { - // return new ActionManager(); - // } - // }); - // - // register(Singleton.class, new - // Factory<ActionGroupSummaryToolbar>(ActionGroupSummaryToolbar.class) { - // @Override - // public ActionGroupSummaryToolbar create() { - // final ActionToolbarPanel<StateToken> panel = new - // ActionToolbarPanel<StateToken>(p(ActionManager.class)); - // final ActionGroupSummaryToolbarPresenter toolbar = new - // ActionGroupSummaryToolbarPresenter(panel); - // return toolbar; - // } - // }, new - // Factory<ActionParticipationToolbar>(ActionParticipationToolbar.class) - // { - // @Override - // public ActionParticipationToolbar create() { - // final ActionToolbarPanel<StateToken> panel = new - // ActionToolbarPanel<StateToken>(p(ActionManager.class)); - // final ActionParticipationSummaryToolbarPresenter toolbar = new - // ActionParticipationSummaryToolbarPresenter( - // panel); - // return toolbar; - // } - // }, new - // Factory<ActionBuddiesSummaryToolbar>(ActionBuddiesSummaryToolbar.class) - // { - // @Override - // public ActionBuddiesSummaryToolbar create() { - // final ActionToolbarPanel<UserSimpleDTO> panel = new - // ActionToolbarPanel<UserSimpleDTO>( - // p(ActionManager.class)); - // final ActionBuddiesSummaryToolbarPresenter toolbar = new - // ActionBuddiesSummaryToolbarPresenter(panel); - // return toolbar; - // } - // }); - // - // // register(ApplicationComponentGroup.class, new - // // Factory<GroupMembersSummary>(GroupMembersSummary.class) { - // // @Override - // // public GroupMembersSummary create() { - // // final GroupMembersSummaryPresenter presenter = new - // // GroupMembersSummaryPresenter( - // // i(I18nUITranslationService.class), i(StateManager.class), - // // i(ImageUtils.class), - // // i(Session.class), p(SocialNetworkServiceAsync.class), - // // p(GroupServiceAsync.class), - // // p(GroupLiveSearcher.class), p(ChatEngine.class), - // // i(GroupActionRegistry.class), - // // i(ActionGroupSummaryToolbar.class), p(FileDownloadUtils.class), - // // i(AccessRightsClientManager.class), i(IconResources.class)); - // // final GroupMembersSummaryView view = new - // // GroupMembersSummaryPanel(presenter, - // // i(I18nUITranslationService.class), i(WorkspaceSkeleton.class), i( - // // ActionGroupSummaryToolbar.class).getView()); - // // presenter.init(view); - // // return presenter; - // // } - // // }); - // - // register(ApplicationComponentGroup.class, new - // Factory<AddAsBuddieHeaderButton>(AddAsBuddieHeaderButton.class) { - // @Override - // public AddAsBuddieHeaderButton create() { - // return new AddAsBuddieHeaderButton(p(ChatEngine.class), - // i(Session.class), i(StateManager.class), - // i(I18nTranslationService.class), i(IconResources.class), - // i(EntityHeader.class)); - // } - // }); - // - // // register(ApplicationComponentGroup.class, new - // // Factory<BuddiesSummary>(BuddiesSummary.class) { - // // @Override - // // public BuddiesSummary create() { - // // final BuddiesSummaryPresenter presenter = new - // // BuddiesSummaryPresenter(i(StateManager.class), - // // i(Session.class), p(UserServiceAsync.class), - // // i(UserActionRegistry.class), - // // i(I18nTranslationService.class), p(ChatEngine.class), - // // i(ActionBuddiesSummaryToolbar.class), - // // p(FileDownloadUtils.class), i(ImageUtils.class), - // // p(SocialNetworkServiceAsync.class), - // // i(GroupActionRegistry.class), i(AccessRightsClientManager.class), - // // i(IconResources.class)); - // // final BuddiesSummaryPanel panel = new - // BuddiesSummaryPanel(presenter, - // // i(WorkspaceSkeleton.class), - // // i(I18nTranslationService.class), i(ActionManager.class), - // // i(ActionBuddiesSummaryToolbar.class).getView()); - // // presenter.init(panel); - // // return presenter; - // // } - // // }); - // - // // register(ApplicationComponentGroup.class, new - // // Factory<ParticipationSummary>(ParticipationSummary.class) { - // // @Override - // // public ParticipationSummary create() { - // // final ParticipationSummaryPresenter presenter = new - // // ParticipationSummaryPresenter( - // // i(I18nUITranslationService.class), i(StateManager.class), - // // i(ImageUtils.class), - // // i(Session.class), p(SocialNetworkServiceAsync.class), - // // i(GroupActionRegistry.class), - // // i(ActionParticipationToolbar.class), p(FileDownloadUtils.class), - // // i(AccessRightsClientManager.class), i(IconResources.class)); - // // final ParticipationSummaryView view = new - // // ParticipationSummaryPanel(presenter, - // // i(I18nUITranslationService.class), i(WorkspaceSkeleton.class), i( - // // ActionParticipationToolbar.class).getView()); - // // presenter.init(view); - // // return presenter; - // // } - // // }); - // - // // register(ApplicationComponentGroup.class, new - // // Factory<TagsSummary>(TagsSummary.class) { - // // @Override - // // public TagsSummary create() { - // // final TagsSummaryPresenter presenter = new - // // TagsSummaryPresenter(i(Session.class), - // // p(SiteSearcher.class), i(StateManager.class)); - // // final TagsSummaryPanel panel = new TagsSummaryPanel(presenter, - // // i(I18nUITranslationService.class), - // // i(WorkspaceSkeleton.class)); - // // presenter.init(panel); - // // return presenter; - // // } - // // }); - // - // register(ApplicationComponentGroup.class, new - // Factory<NoHomePage>(NoHomePage.class) { - // @Override - // public NoHomePage create() { - // final NoHomePagePresenter presenter = new - // NoHomePagePresenter(i(StateManager.class), - // p(EntityHeader.class)); - // final NoHomePagePanel panel = new NoHomePagePanel(presenter, - // i(WorkspaceSkeleton.class), - // i(I18nTranslationService.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(ApplicationComponentGroup.class, new - // Factory<GroupOptions>(GroupOptions.class) { - // @Override - // public GroupOptions create() { - // final GroupOptionsPresenter presenter = new - // GroupOptionsPresenter(i(StateManager.class), - // i(I18nTranslationService.class), i(IconResources.class)); - // final GroupOptionsPanel panel = new GroupOptionsPanel(presenter, - // i(EntityHeader.class), - // i(I18nTranslationService.class), i(NotifyLevelImages.class), - // i(GroupOptionsCollection.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // // - // // register(ApplicationComponentGroup.class, new - // // Factory<UserOptions>(UserOptions.class) { - // // @Override - // // public UserOptions create() { - // // final UserOptionsPresenter presenter = new - // // UserOptionsPresenter(i(Session.class), - // // i(StateManager.class), i(I18nTranslationService.class), - // // i(IconResources.class), - // // i(SiteUserOptions.class)); - // // final UserOptionsPanel panel = new UserOptionsPanel(presenter, - // // i(EntityHeader.class), - // // i(I18nTranslationService.class), i(NotifyLevelImages.class), - // // i(UserOptionsCollection.class)); - // // presenter.init(panel); - // // return presenter; - // // } - // // }); - // - // register(GroupOptionsCollection.class, new - // Factory<EntityOptionsToolsConf>(EntityOptionsToolsConf.class) { - // @Override - // public EntityOptionsToolsConf create() { - // final GroupOptionsToolsConfPresenter presenter = new - // GroupOptionsToolsConfPresenter( - // i(StateManager.class), i(Session.class), - // i(I18nTranslationService.class), - // i(GroupOptions.class), p(GroupServiceAsync.class)); - // final EntityOptionsToolsConfPanel panel = new - // EntityOptionsToolsConfPanel(presenter, - // i(WorkspaceSkeleton.class), i(I18nTranslationService.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(UserOptionsCollection.class, new - // Factory<UserOptionsToolsConf>(UserOptionsToolsConf.class) { - // @Override - // public UserOptionsToolsConf create() { - // final UserOptionsToolsConfPresenter presenter = new - // UserOptionsToolsConfPresenter(i(Session.class), - // i(StateManager.class), i(I18nTranslationService.class), - // i(UserOptions.class), - // p(GroupServiceAsync.class)); - // final EntityOptionsToolsConfPanel panel = new - // EntityOptionsToolsConfPanel(presenter, - // i(WorkspaceSkeleton.class), i(I18nTranslationService.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(GroupOptionsCollection.class, new - // Factory<GroupOptionsLogo>(GroupOptionsLogo.class) { - // @Override - // public GroupOptionsLogo create() { - // final EntityOptionsLogoPresenter presenter = new - // GroupOptionsLogoPresenter(i(Session.class), - // i(EntityHeader.class), i(GroupOptions.class), i(StateManager.class), - // p(UserServiceAsync.class), - // p(ChatEngine.class)); - // final GroupOptionsLogoPanel panel = new - // GroupOptionsLogoPanel(presenter, i(WorkspaceSkeleton.class), - // i(I18nTranslationService.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(UserOptionsCollection.class, new - // Factory<UserOptionsLogo>(UserOptionsLogo.class) { - // @Override - // public UserOptionsLogo create() { - // final EntityOptionsLogoPresenter presenter = new - // UserOptionsLogoPresenter(i(Session.class), - // i(EntityHeader.class), i(UserOptions.class), i(StateManager.class), - // p(UserServiceAsync.class), - // p(ChatEngine.class)); - // final UserOptionsLogoPanel panel = new - // UserOptionsLogoPanel(presenter, i(WorkspaceSkeleton.class), - // i(I18nTranslationService.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(GroupOptionsCollection.class, new - // Factory<GroupOptionsDefLicense>(GroupOptionsDefLicense.class) { - // @Override - // public GroupOptionsDefLicense create() { - // final GroupOptionsDefLicensePresenter presenter = new - // GroupOptionsDefLicensePresenter( - // i(GroupOptions.class), i(StateManager.class), i(Session.class), - // p(LicenseWizard.class), - // p(LicenseChangeAction.class)); - // final EntityOptionsDefLicensePanel panel = new - // EntityOptionsDefLicensePanel(presenter, - // i(WorkspaceSkeleton.class), i(I18nTranslationService.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(UserOptionsCollection.class, new - // Factory<UserOptionsDefLicense>(UserOptionsDefLicense.class) { - // @Override - // public UserOptionsDefLicense create() { - // final UserOptionsDefLicensePresenter presenter = new - // UserOptionsDefLicensePresenter( - // i(UserOptions.class), i(Session.class), p(LicenseWizard.class), - // p(LicenseChangeAction.class)); - // final EntityOptionsDefLicensePanel panel = new - // EntityOptionsDefLicensePanel(presenter, - // i(WorkspaceSkeleton.class), i(I18nTranslationService.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(GroupOptionsCollection.class, new - // Factory<GroupOptionsPublicSpaceConf>( - // GroupOptionsPublicSpaceConf.class) { - // @Override - // public GroupOptionsPublicSpaceConf create() { - // final WsThemeSelector themeSelector = i(WsThemeSelector.class); - // final GroupOptionsPublicSpaceConfPresenter presenter = new - // GroupOptionsPublicSpaceConfPresenter( - // i(Session.class), i(StateManager.class), i(GroupOptions.class), - // i(WsThemeManager.class), - // themeSelector, p(GroupServiceAsync.class), i(WsBackManager.class)); - // final EntityOptionsPublicSpaceConfPanel panel = new - // EntityOptionsPublicSpaceConfPanel(presenter, - // i(WorkspaceSkeleton.class), i(I18nTranslationService.class), - // themeSelector, - // i(FileDownloadUtils.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(UserOptionsCollection.class, - // new - // Factory<UserOptionsPublicSpaceConf>(UserOptionsPublicSpaceConf.class) - // { - // @Override - // public UserOptionsPublicSpaceConf create() { - // final WsThemeSelector themeSelector = i(WsThemeSelector.class); - // final UserOptionsPublicSpaceConfPresenter presenter = new - // UserOptionsPublicSpaceConfPresenter( - // i(Session.class), i(StateManager.class), i(UserOptions.class), - // i(WsThemeManager.class), - // themeSelector, p(GroupServiceAsync.class), i(WsBackManager.class)); - // final EntityOptionsPublicSpaceConfPanel panel = new - // EntityOptionsPublicSpaceConfPanel( - // presenter, i(WorkspaceSkeleton.class), - // i(I18nTranslationService.class), themeSelector, - // i(FileDownloadUtils.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(Singleton.class, new - // Factory<LicenseChangeAction>(LicenseChangeAction.class) { - // @Override - // public LicenseChangeAction create() { - // return new LicenseChangeAction(p(GroupServiceAsync.class), - // i(Session.class), - // i(I18nTranslationService.class), i(StateManager.class)); - // } - // }); - // - // register(Singleton.class, new - // Factory<RenameAction>(RenameAction.class) { - // @Override - // public RenameAction create() { - // return new RenameAction(i(I18nTranslationService.class), - // i(Session.class), p(ContentServiceAsync.class)); - // } - // }); - // - // register(Singleton.class, new - // Factory<LicenseWizard>(LicenseWizard.class) { - // @Override - // public LicenseWizard create() { - // final LicenseWizardPresenter presenter = new LicenseWizardPresenter( - // i(LicenseWizardFirstFormView.class), - // i(LicenseWizardSndFormView.class), - // i(LicenseWizardTrdFormView.class), i(LicenseWizardFrdFormView.class), - // i(Session.class)); - // final LicenseWizardPanel panel = new LicenseWizardPanel(presenter, - // i(WorkspaceSkeleton.class), - // i(I18nTranslationService.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(Singleton.class, new - // Factory<LicenseWizardFirstFormView>(LicenseWizardFirstFormView.class) - // { - // @Override - // public LicenseWizardFirstFormView create() { - // return new LicenseWizardFirstForm(i(I18nTranslationService.class)); - // } - // }); - // - // register(Singleton.class, new - // Factory<LicenseWizardSndFormView>(LicenseWizardSndFormView.class) { - // @Override - // public LicenseWizardSndFormView create() { - // return new LicenseWizardSndForm(i(I18nTranslationService.class)); - // } - // }); - // - // register(Singleton.class, new - // Factory<LicenseWizardTrdFormView>(LicenseWizardTrdFormView.class) { - // @Override - // public LicenseWizardTrdFormView create() { - // return new LicenseWizardTrdForm(i(Images.class), - // i(I18nTranslationService.class)); - // } - // }); - // - // register(Singleton.class, new - // Factory<LicenseWizardFrdFormView>(LicenseWizardFrdFormView.class) { - // @Override - // public LicenseWizardFrdFormView create() { - // return new LicenseWizardFrdForm(i(I18nTranslationService.class), - // i(Session.class)); - // } - // }); - // - // register(Singleton.class, new - // Factory<FileUploader>(FileUploader.class) { - // @Override - // public FileUploader create() { - // final FileUploaderPresenter presenter = new - // FileUploaderPresenter(i(Session.class)); - // final FileUploaderDialog panel = new FileUploaderDialog(presenter, - // i(I18nUITranslationService.class), - // i(WorkspaceSkeleton.class)); - // presenter.init(panel); - // return presenter; - // } - // - // @Override - // public void onAfterCreated(final FileUploader uploader) { - // i(ContextNavigator.class).addFileUploaderListener(uploader); - // } - // }); - // - // register(Singleton.class, new - // Factory<SiteSearcher>(SiteSearcher.class) { - // @Override - // public SiteSearcher create() { - // final SiteSearcherPresenter presenter = new - // SiteSearcherPresenter(p(StateManager.class)); - // final SiteSearcherView view = new SiteSearcherPanel(presenter, - // i(I18nTranslationService.class), - // i(WorkspaceSkeleton.class)); - // presenter.init(view); - // return presenter; - // } - // }); - // - // register(Singleton.class, new - // Factory<I18nTranslator>(I18nTranslator.class) { - // @Override - // public I18nTranslator create() { - // final I18nTranslatorPresenter presenter = new - // I18nTranslatorPresenter(i(Session.class), - // i(I18nServiceAsync.class), i(I18nUITranslationService.class)); - // final I18nTranslatorView view = new I18nTranslatorPanel(presenter, - // i(I18nTranslationService.class), - // i(LanguageSelector.class), i(WorkspaceSkeleton.class), - // i(Images.class)); - // presenter.init(view); - // return presenter; - // } - // }); - // - // // register(ApplicationComponentGroup.class, new - // // Factory<SiteOptionsI18nTranslatorAction>( - // // SiteOptionsI18nTranslatorAction.class) { - // // @Override - // // public SiteOptionsI18nTranslatorAction create() { - // // return new SiteOptionsI18nTranslatorAction(i(SiteOptions.class), - // // i(I18nTranslationService.class), - // // i(IconResources.class), p(I18nTranslator.class)); - // // } - // // }); - // - // // register(Singleton.class, new Factory<SignIn>(SignIn.class) { - // // @Override - // // public SignIn create() { - // // final SignInPresenter presenter = new - // // SignInPresenter(i(Session.class), i(StateManager.class), - // // i(I18nUITranslationService.class), p(UserServiceAsync.class), - // // p(Register.class)); - // // final SignInView panel = new SignInPanel(presenter, - // // i(I18nTranslationService.class), - // // i(WorkspaceSkeleton.class), i(NotifyLevelImages.class)); - // // presenter.init(panel); - // // return presenter; - // // } - // // }); - // // - // // register(Singleton.class, new Factory<Register>(Register.class) { - // // @Override - // // public Register create() { - // // final RegisterPresenter presenter = new - // // RegisterPresenter(i(Session.class), i(StateManager.class), - // // i(I18nUITranslationService.class), p(UserServiceAsync.class), - // // p(SignIn.class)); - // // final RegisterView panel = new RegisterPanel(presenter, - // // i(I18nTranslationService.class), - // // i(WorkspaceSkeleton.class), i(Session.class), - // // i(NotifyLevelImages.class)); - // // presenter.init(panel); - // // return presenter; - // // } - // // }); - // - // // register(Singleton.class, new Factory<NewGroup>(NewGroup.class) { - // // @Override - // // public NewGroup create() { - // // final NewGroupPresenter presenter = new - // // NewGroupPresenter(i(I18nTranslationService.class), - // // i(Session.class), i(StateManager.class), - // // p(GroupServiceAsync.class)); - // // final NewGroupPanel view = new NewGroupPanel(presenter, - // // i(I18nTranslationService.class), - // // p(LicenseWizard.class), i(NotifyLevelImages.class)); - // // presenter.init(view); - // // return presenter; - // // } - // // }); - // - // register(Singleton.class, new - // Factory<UserLiveSearcher>(UserLiveSearcher.class) { - // @Override - // public UserLiveSearcher create() { - // final UserLiveSearcherPresenter presenter = new - // UserLiveSearcherPresenter(); - // final EntityLiveSearcherView view = new - // UserLiveSearcherPanel(presenter, - // i(I18nTranslationService.class), i(FileDownloadUtils.class)); - // presenter.init(view); - // return presenter; - // } - // }); - // - // register(Singleton.class, new - // Factory<GroupLiveSearcher>(GroupLiveSearcher.class) { - // @Override - // public GroupLiveSearcher create() { - // final GroupLiveSearcherPresenter presenter = new - // GroupLiveSearcherPresenter(); - // final EntityLiveSearcherView view = new - // GroupLiveSearchPanel(presenter, - // i(I18nTranslationService.class), i(FileDownloadUtils.class)); - // presenter.init(view); - // return presenter; - // } - // }); - // - // // register(Singleton.class, new - // // Factory<ToolSelector>(ToolSelector.class) { - // // @Override - // // public ToolSelector create() { - // // final ToolSelectorPresenter presenter = new - // // ToolSelectorPresenter(i(StateManager.class), - // // i(WsThemeManager.class)); - // // return presenter; - // // } - // // }); - // - // register(Singleton.class, new - // Factory<LanguageSelector>(LanguageSelector.class) { - // @Override - // public LanguageSelector create() { - // final LanguageSelectorPresenter presenter = new - // LanguageSelectorPresenter(i(Session.class)); - // final LanguageSelectorView view = new - // LanguageSelectorPanel(presenter, i(I18nTranslationService.class)); - // presenter.init(view); - // return presenter; - // } - // }); - // - // // Register of tokens like "signin", "newgroup", "translate" etcetera - // i(StateManager.class).addSiteToken(SiteTokens.SIGNIN, new - // HistoryTokenCallback() { - // - // @Override - // public void onHistoryToken() { - // i(SignIn.class).showSignInDialog(); - // } - // }); - // - // i(StateManager.class).addSiteToken(SiteTokens.REGISTER, new - // HistoryTokenCallback() { - // - // @Override - // public void onHistoryToken() { - // i(Register.class).doRegister(); - // } - // }); - // - // i(StateManager.class).addSiteToken(SiteTokens.NEWGROUP, new - // HistoryTokenCallback() { - // - // @Override - // public void onHistoryToken() { - // i(NewGroup.class).doNewGroup(); - // } - // }); - // - // i(StateManager.class).addSiteToken(SiteTokens.TRANSLATE, new - // HistoryTokenCallback() { - // - // @Override - // public void onHistoryToken() { - // i(I18nTranslator.class).doShowTranslator(); - // } - // }); - // - // // register(NoDecoration.class, new - // // Factory<ActionContentToolbar>(ActionContentToolbar.class) { - // // @Override - // // public ActionContentToolbar create() { - // // final ActionCntCtxToolbarPanel<StateToken> tbar = new - // // ActionCntCtxToolbarPanel<StateToken>( - // // AbstractFoldableContentActions.CONTENT_TOPBAR, - // // p(ActionManager.class), - // // i(WorkspaceSkeleton.class)); - // // final ActionContentToolbar toolbar = new - // // ActionContentToolbarPresenter(tbar); - // // return toolbar; - // // } - // // }); - // - // // register(Singleton.class, new - // // Factory<ContentEditor>(ContentEditor.class) { - // // @Override - // // public ContentEditor create() { - // // final ContentEditorPresenter presenter = new - // // ContentEditorPresenter(i(I18nTranslationService.class), - // // i(Session.class), i(RTEImgResources.class), - // // p(InsertLinkDialog.class), - // // p(ColorWebSafePalette.class), p(EditHtmlDialog.class), - // // p(InsertImageDialog.class), - // // p(InsertMediaDialog.class), p(InsertTableDialog.class), - // // p(InsertSpecialCharDialog.class), - // // i(SchedulerManager.class), true, i(StateManager.class), - // // i(SiteSignOutLink.class), - // // i(WorkspaceSkeleton.class), i(TimerWrapper.class), - // // i(EntityTitle.class)); - // // final ContentEditorPanel panel = new ContentEditorPanel(presenter, - // // i(I18nUITranslationService.class), - // // i(GlobalShortcutRegister.class), i(GuiBindingsRegister.class)); - // // presenter.init(panel); - // // return presenter; - // // } - // // }); - // register(NoDecoration.class, new - // Factory<ActionContextTopToolbar>(ActionContextTopToolbar.class) { - // @Override - // public ActionContextTopToolbar create() { - // final ActionCntCtxToolbarPanel<StateToken> panel = new - // ActionCntCtxToolbarPanel<StateToken>( - // OldAbstractFoldableContentActions.CONTEXT_TOPBAR, - // p(ActionManager.class), - // i(WorkspaceSkeleton.class)); - // final ActionContextTopToolbar toolbar = new - // ActionContextTopToolbar(panel); - // return toolbar; - // } - // }); - // - // register(NoDecoration.class, new - // Factory<ActionContextBottomToolbar>(ActionContextBottomToolbar.class) - // { - // @Override - // public ActionContextBottomToolbar create() { - // final ActionCntCtxToolbarPanel<StateToken> panel = new - // ActionCntCtxToolbarPanel<StateToken>( - // OldAbstractFoldableContentActions.CONTEXT_BOTTOMBAR, - // p(ActionManager.class), - // i(WorkspaceSkeleton.class)); - // final ActionContextBottomToolbar toolbar = new - // ActionContextBottomToolbar(panel); - // return toolbar; - // } - // }); - // - // register(Singleton.class, new - // Factory<ContextNavigator>(ContextNavigator.class) { - // @Override - // public ContextNavigator create() { - // final ContextNavigatorPresenter presenter = new - // ContextNavigatorPresenter(i(StateManager.class), - // i(Session.class), i(I18nTranslationService.class), - // i(ContentIconsRegistry.class), - // i(ContentCapabilitiesRegistry.class), - // i(ActionContextTopToolbar.class), - // i(ActionContextBottomToolbar.class), i(ContextActionRegistry.class), - // p(FileDownloadUtils.class), true, i(RenameAction.class)); - // final ContextNavigatorPanel panel = new - // ContextNavigatorPanel(presenter, - // i(I18nTranslationService.class), i(WorkspaceSkeleton.class), - // i(ActionManager.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(Singleton.class, new - // Factory<ContextPropEditor>(ContextPropEditor.class) { - // @Override - // public ContextPropEditor create() { - // final ContextPropEditorPresenter presenter = new - // ContextPropEditorPresenter(i(Session.class), - // i(StateManager.class), i(ContentCapabilitiesRegistry.class), - // p(TagsSummary.class), - // p(ContentServiceAsync.class), i(EntitySubTitle.class)); - // final ContextPropEditorView view = new - // ContextPropEditorPanel(presenter, - // i(I18nUITranslationService.class), i(WorkspaceSkeleton.class), - // p(LanguageSelector.class), - // i(Images.class)); - // presenter.init(view); - // return presenter; - // } - // }); - // - // register(InsertImageGroup.class, new - // Factory<InsertImageLocal>(InsertImageLocal.class) { - // @Override - // public InsertImageLocal create() { - // final InsertImageLocalPresenter presenter = new - // InsertImageLocalPresenter(i(InsertImageDialog.class), - // i(Session.class)); - // final InsertImageLocalPanel panel = new - // InsertImageLocalPanel(presenter, - // i(I18nTranslationService.class), i(FileDownloadUtils.class), - // i(Session.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // // register(ApplicationComponentGroup.class, new - // // Factory<MaxMinWorkspace>(MaxMinWorkspace.class) { - // // @Override - // // public MaxMinWorkspace create() { - // // final MaxMinWorkspacePresenter presenter = new - // // MaxMinWorkspacePresenter( - // // i(GlobalShortcutRegister.class), i(IconResources.class), - // // i(I18nTranslationService.class), - // // i(SiteOptions.class)); - // // final MaxMinWorkspacePanel panel = new - // // MaxMinWorkspacePanel(i(WorkspaceSkeleton.class)); - // // presenter.init(panel); - // // return presenter; - // // } - // // }); - // - // register(InsertLinkGroup.class, new - // Factory<InsertLinkLocal>(InsertLinkLocal.class) { - // @Override - // public InsertLinkLocal create() { - // final InsertLinkLocalPresenter presenter = new - // InsertLinkLocalPresenter(i(InsertLinkDialog.class)); - // final InsertLinkLocalPanel panel = new - // InsertLinkLocalPanel(presenter, i(WorkspaceSkeleton.class), - // i(I18nTranslationService.class), i(FileDownloadUtils.class), - // i(StateTokenUtils.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // - // register(InsertMediaGroup.class, new - // Factory<InsertMediaLocal>(InsertMediaLocal.class) { - // @Override - // public InsertMediaLocal create() { - // final InsertMediaLocalPresenter presenter = new - // InsertMediaLocalPresenter(i(InsertMediaDialog.class), - // i(Session.class), p(MediaUtils.class)); - // final InsertMediaLocalPanel panel = new - // InsertMediaLocalPanel(presenter, - // i(I18nTranslationService.class), i(FileDownloadUtils.class)); - // presenter.init(panel); - // return presenter; - // } - // }); - // i(GlobalShortcutRegister.class).enable(); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,35 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.editor; - -import org.ourproject.kune.platf.client.ui.rte.saving.RTESavingEditor; - -public interface ContentEditor extends RTESavingEditor { - - /** - * Sets the "File" menu title (some times you want a "Post" or "Wikipage" - * menu instead of a "File" menu). - * - * @param title - * the new file menu title - */ - void setFileMenuTitle(String title); - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorPanel.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorPanel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,35 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.editor; - -import org.ourproject.kune.platf.client.actions.ui.GuiBindingsRegister; -import org.ourproject.kune.platf.client.shortcuts.GlobalShortcutRegister; -import org.ourproject.kune.platf.client.ui.rte.saving.RTESavingEditorPanel; - -import cc.kune.core.client.i18n.I18nUITranslationService; - -public class ContentEditorPanel extends RTESavingEditorPanel implements ContentEditorView { - - public ContentEditorPanel(final ContentEditorPresenter presenter, final I18nUITranslationService i18n, - final GlobalShortcutRegister globalShortcutReg, final GuiBindingsRegister bindReg) { - super(presenter, i18n, globalShortcutReg, bindReg); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorPresenter.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorPresenter.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,174 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.editor; - -import static org.ourproject.kune.platf.client.actions.AbstractExtendedAction.NO_ICON; -import static org.ourproject.kune.platf.client.actions.AbstractExtendedAction.NO_TEXT; - -import org.ourproject.kune.platf.client.actions.AbstractExtendedAction; -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.actions.ui.ComplexToolbar; -import org.ourproject.kune.platf.client.actions.ui.OldMenuItemDescriptor; -import org.ourproject.kune.platf.client.shortcuts.Keyboard; -import org.ourproject.kune.platf.client.ui.palette.ColorWebSafePalette; -import org.ourproject.kune.platf.client.ui.rte.basic.RTEditor; -import org.ourproject.kune.platf.client.ui.rte.basic.RTEditorPanel; -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.InsertImageDialog; -import org.ourproject.kune.platf.client.ui.rte.insertlink.InsertLinkDialog; -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.ui.rte.saving.RTESavingEditorPresenter; -import org.ourproject.kune.workspace.client.skel.Toolbar; -import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; - -import cc.kune.common.client.utils.SchedulerManager; -import cc.kune.common.client.utils.TimerWrapper; -import cc.kune.core.client.state.Session; -import cc.kune.core.client.state.StateManager; -import cc.kune.core.shared.i18n.I18nTranslationService; - -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.resources.client.ImageResource; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.Window.ClosingEvent; -import com.google.gwt.user.client.Window.ClosingHandler; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.gwtext.client.widgets.BoxComponent; -import com.gwtext.client.widgets.event.ContainerListenerAdapter; - -public class ContentEditorPresenter extends RTESavingEditorPresenter implements ContentEditor { - - public class RenameAction extends AbstractExtendedAction { - public RenameAction(final String text, final String tooltip, final ImageResource icon) { - super(text, tooltip, icon); - } - - @Override - public void actionPerformed(final ActionEvent actionEvent) { - // entityTitle.edit(); - } - } - - private RTEditorPanel editorPanel; - // private final EntityTitle entityTitle; - // private final SiteSignOutLink siteSignOutLink; - private final I18nTranslationService i18n; - private ComplexToolbar sndbar; - private ComplexToolbar topbar; - private VerticalPanel vpanel; - private final WorkspaceSkeleton wspace; - - public ContentEditorPresenter(final I18nTranslationService i18n, final Session session, - 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 SchedulerManager deferred, - final boolean autoSave, final StateManager stateManager, final WorkspaceSkeleton wspace, - final TimerWrapper timer) { - super(i18n, session, imgResources, insLinkDialog, palette, editHtmlDialog, insertImageDialog, - insertMediaDialog, insertTableDialog, insCharDialog, deferred, autoSave, stateManager, timer); - super.setExtended(true); - this.i18n = i18n; - - // this.entityTitle = entityTitle; - this.wspace = wspace; - Window.addWindowClosingHandler(new ClosingHandler() { - @Override - public void onWindowClosing(final ClosingEvent event) { - if (isSavePending()) { - event.setMessage(i18n.t("You have changes without save. Are you sure?")); - } - // onDoSaveAndClose(); - } - }); - wspace.getEntityWorkspace().addContentListener(new ContainerListenerAdapter() { - @Override - public void onResize(final BoxComponent component, final int adjWidth, final int adjHeight, - final int rawWidth, final int rawHeight) { - adjHeight(adjHeight); - } - }); - - } - - private void addContentActions() { - final RenameAction renameAction = new RenameAction(i18n.t("Rename"), NO_TEXT, NO_ICON); - final OldMenuItemDescriptor renameItem = new OldMenuItemDescriptor(super.getFileMenu(), renameAction); - renameItem.setLocation(RTEditor.TOPBAR); - final KeyStroke key = KeyStroke.getKeyStroke(Keyboard.KEY_F2, 0); - renameAction.putValue(Action.ACCELERATOR_KEY, key); - super.setActionShortcut(key, renameAction); - addAction(renameItem); - } - - private void adjHeight(final int height) { - final int barHeight = sndbar.getOffsetHeight(); - final int newHeight = height - 20 - barHeight; - // Log.debug("Sndbar height: " + barHeight + " new height: " + - // newHeight); - editorPanel.adjustSize(newHeight); - vpanel.setCellHeight(editorPanel, String.valueOf(newHeight)); - } - - @Override - public void edit(final String html, final Listener<String> onSave, final Listener0 onEditCancelled) { - super.edit(html, onSave, onEditCancelled); - final Toolbar contentTopBar = wspace.getEntityWorkspace().getContentTopBar(); - contentTopBar.removeAll(); - contentTopBar.add(topbar); - wspace.getEntityWorkspace().setContent(vpanel); - adjHeight(wspace.getEntityWorkspace().getContentHeight()); - // siteSignOutLink.addBeforeSignOut(getBeforeSavingListener()); - } - - public void init(final ContentEditorView view) { - super.init(view); - addContentActions(); - vpanel = new VerticalPanel(); - editorPanel = (RTEditorPanel) super.getEditorArea(); - topbar = ((ComplexToolbar) super.getTopBar()); - sndbar = ((ComplexToolbar) super.getSndBar()); - vpanel.add(sndbar); - vpanel.add(editorPanel); - vpanel.setWidth("100%"); - } - - @Override - protected void onCancelConfirmed() { - wspace.getEntityWorkspace().clearContent(); - super.onCancelConfirmed(); - // siteSignOutLink.addBeforeSignOut(getBeforeSavingListener()); - } - - @Override - public void setFileMenuTitle(final String fileMenuTitleNew) { - super.getFileMenu().setText(fileMenuTitleNew); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorView.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditorView.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,26 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.editor; - -import org.ourproject.kune.platf.client.ui.rte.saving.RTESavingEditorView; - -public interface ContentEditorView extends RTESavingEditorView { - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeader.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeader.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeader.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,41 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - \*/ -package org.ourproject.kune.workspace.client.entityheader; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.actions.ui.OldGuiActionDescrip; - -public interface EntityHeader { - - void addAction(OldGuiActionDescrip descriptor); - - void addWidget(View widget); - - /** - * Refresh the logo from the group info in the client session - */ - void refreshGroupLogo(); - - /** - * Reload the logo from the group reloaded from the server - */ - void reloadGroupLogoImage(); - -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderButton.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderButton.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderButton.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,44 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.entityheader; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.ui.IconLabel; - -import com.google.gwt.user.client.ui.AbstractImagePrototype; - -public class EntityHeaderButton extends IconLabel implements View { - public EntityHeaderButton(final AbstractImagePrototype icon, final String text) { - super(icon, text, false); - setDefStyle(); - } - - public EntityHeaderButton(final String text, final AbstractImagePrototype icon) { - super(text, icon, false); - setDefStyle(); - } - - private void setDefStyle() { - addStyleName("kune-Margin-Medium-t"); - addStyleName("kune-pointer"); - addStyleName("kune-floatright"); - } - -} \ No newline at end of file Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,132 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.entityheader; - -import java.util.Date; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.actions.ui.ComplexToolbar; -import org.ourproject.kune.platf.client.actions.ui.OldGuiActionDescrip; -import org.ourproject.kune.platf.client.actions.ui.GuiBindingsRegister; -import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; - -import cc.kune.core.client.services.FileConstants; -import cc.kune.core.client.services.FileDownloadUtils; -import cc.kune.core.shared.domain.utils.StateToken; -import cc.kune.core.shared.dto.GSpaceTheme; -import cc.kune.core.shared.dto.GroupDTO; - -import com.calclab.suco.client.ioc.Provider; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; - -public class EntityHeaderPanel extends HorizontalPanel implements EntityHeaderView { - - private final Provider<FileDownloadUtils> downloadProvider; - private final EntityTextLogo entityTextLogo; - private final Images images; - private final VerticalPanel vpanel; - private final ComplexToolbar toolbar; - - public EntityHeaderPanel(final WorkspaceSkeleton wskel, final Provider<FileDownloadUtils> downloadProvider, - final Images images, final GuiBindingsRegister bindings) { - super(); - super.setWidth("100%"); - this.downloadProvider = downloadProvider; - this.images = images; - vpanel = new VerticalPanel(); - vpanel.setWidth("100%"); - vpanel.setHorizontalAlignment(ALIGN_RIGHT); - entityTextLogo = new EntityTextLogo(); - add(entityTextLogo); - toolbar = new ComplexToolbar(bindings); - toolbar.setTranspStyle(); - vpanel.add(toolbar); - add(vpanel); - wskel.addToEntityMainHeader(this); - } - - public void addAction(final OldGuiActionDescrip descriptor) { - toolbar.add(descriptor); - } - - public void addWidget(final View view) { - final Widget widget = (Widget) view; - vpanel.add(widget); - } - - public void reloadImage(final GroupDTO group) { - entityTextLogo.setLogoImage(downloadProvider.get().getLogoImageUrl(group.getStateToken()) + "&nocache=" - + new Date().getTime()); - } - - @Deprecated - public void setFullLogo(final StateToken stateToken, final boolean clipped) { - clear(); - final String imageUrl = downloadProvider.get().getImageUrl(stateToken); - Image logo; - if (clipped) { - logo = new Image(imageUrl, 0, 0, FileConstants.LOGO_DEF_WIDTH, FileConstants.LOGO_DEF_HEIGHT); - } else { - logo = new Image(imageUrl); - logo.setWidth(String.valueOf(FileConstants.LOGO_DEF_WIDTH)); - logo.setHeight(String.valueOf(FileConstants.LOGO_DEF_HEIGHT)); - } - add(logo); - } - - public void setLargeFont() { - entityTextLogo.setLargeFont(); - } - - public void setLogoImage(final StateToken stateToken) { - entityTextLogo.setLogoImage(downloadProvider.get().getLogoImageUrl(stateToken)); - } - - public void setLogoImageVisible(final boolean visible) { - entityTextLogo.setLogoVisible(visible); - } - - public void setLogoText(final String groupName) { - entityTextLogo.setLogoText(groupName); - } - - public void setMediumFont() { - entityTextLogo.setMediumFont(); - } - - public void setSmallFont() { - entityTextLogo.setSmallFont(); - } - - public void setTheme(final GSpaceTheme oldTheme, final GSpaceTheme newTheme) { - if (oldTheme != null) { - entityTextLogo.removeStyleDependentName(oldTheme.toString()); - } - entityTextLogo.addStyleDependentName(newTheme.toString()); - } - - public void showDefUserLogo() { - entityTextLogo.setLogoImage(images.personAvatarDef()); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,108 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - \*/ -package org.ourproject.kune.workspace.client.entityheader; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.actions.ui.OldGuiActionDescrip; - -import cc.kune.core.client.state.Session; -import cc.kune.core.client.state.StateManager; -import cc.kune.core.shared.dto.GroupDTO; -import cc.kune.gspace.client.themes.GSpaceThemeManager; - -import com.calclab.suco.client.events.Listener2; - -public class EntityHeaderPresenter implements EntityHeader { - private static final int LARGE_NAME_LIMIT = 20; - private static final int MEDIUM_NAME_LIMIT = 90; - - private final Session session; - private EntityHeaderView view; - - public EntityHeaderPresenter(final StateManager stateManager, final GSpaceThemeManager theme, - final Session session) { - this.session = session; - - stateManager.onGroupChanged(new Listener2<String, String>() { - @Override - public void onEvent(final String oldGroup, final String newGroup) { - setGroupLogo(session.getCurrentState().getGroup()); - } - }); - // theme.addOnThemeChanged(new Listener2<GSpaceTheme, GSpaceTheme>() { - // public void onEvent(final GSpaceTheme oldTheme, final GSpaceTheme - // newTheme) { - // view.setTheme(oldTheme, newTheme); - // } - // }); - } - - @Override - public void addAction(final OldGuiActionDescrip descriptor) { - view.addAction(descriptor); - } - - @Override - public void addWidget(final View widget) { - view.addWidget(widget); - } - - public void init(final EntityHeaderView view) { - this.view = view; - } - - @Override - public void refreshGroupLogo() { - setGroupLogo(session.getCurrentState().getGroup()); - } - - @Override - public void reloadGroupLogoImage() { - view.reloadImage(session.getCurrentState().getGroup()); - } - - void setGroupLogo(final GroupDTO group) { - if (group.hasLogo()) { - setLogoText(group.getLongName()); - view.setLogoImage(group.getStateToken()); - view.setLogoImageVisible(true); - } else { - setLogoText(group.getLongName()); - if (group.isPersonal()) { - view.showDefUserLogo(); - view.setLogoImageVisible(true); - } else { - view.setLogoImageVisible(false); - } - } - } - - void setLogoText(final String name) { - final int length = name.length(); - if (length <= LARGE_NAME_LIMIT) { - view.setLargeFont(); - } else if (length <= MEDIUM_NAME_LIMIT) { - view.setMediumFont(); - } else { - view.setSmallFont(); - } - view.setLogoText(name); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderView.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderView.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,52 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - \*/ -package org.ourproject.kune.workspace.client.entityheader; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.actions.ui.OldGuiActionDescrip; - -import cc.kune.core.shared.domain.utils.StateToken; -import cc.kune.core.shared.dto.GSpaceTheme; -import cc.kune.core.shared.dto.GroupDTO; - -public interface EntityHeaderView { - - void addAction(OldGuiActionDescrip descriptor); - - void addWidget(View view); - - void reloadImage(GroupDTO group); - - void setLargeFont(); - - void setLogoImage(StateToken stateToken); - - void setLogoImageVisible(boolean visible); - - void setLogoText(final String groupName); - - void setMediumFont(); - - void setSmallFont(); - - void setTheme(final GSpaceTheme oldTheme, GSpaceTheme newTheme); - - void showDefUserLogo(); -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,117 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.ourproject.kune.workspace.client.entityheader; - -import com.google.gwt.user.client.ui.AbstractImagePrototype; -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.VerticalPanel; - -public class EntityTextLogo extends VerticalPanel { - - public static final String LOGO_NAME = "k-elogop-ln"; - public static final String LOGO_IMAGE = "k-elogop-image"; - - private static final String _100 = "100%"; - private static final String LOGO_MEDIUM_FONT_STYLE = "k-elogo-l-m"; - private static final String LOGO_SMALL_FONT_STYLE = "k-elogo-l-s"; - private static final String LOGO_LARGE_FONT_STYLE = "k-elogo-l-l"; - private final Label logoLabel; - private final Image logoImage; - - public EntityTextLogo() { - // Initialize - super(); - final HorizontalPanel generalHP = new HorizontalPanel(); - final VerticalPanel logoTextVP = new VerticalPanel(); - logoImage = new Image(); - logoLabel = new Label(); - final Label expandCell = new Label(""); - - logoImage.ensureDebugId(LOGO_IMAGE); - logoLabel.ensureDebugId(LOGO_NAME); - - // Layout - add(generalHP); - generalHP.add(logoImage); - generalHP.add(logoTextVP); - logoTextVP.add(logoLabel); - - // Set properties - - expandCell.setStyleName("k-elogop-expand"); - generalHP.setWidth(_100); - generalHP.setHeight(_100); - generalHP.setCellWidth(logoTextVP, _100); - generalHP.setCellHeight(logoTextVP, _100); - logoTextVP.setWidth(_100); - logoTextVP.setCellWidth(logoLabel, _100); - super.setVerticalAlignment(ALIGN_MIDDLE); - logoTextVP.setVerticalAlignment(ALIGN_MIDDLE); - generalHP.setVerticalAlignment(ALIGN_MIDDLE); - setStylePrimaryName("k-entitytextlogo"); - addStyleName("k-entitytextlogo-no-border"); - logoImage.setVisible(false); - setLogoTextImpl(""); - } - - public void setLargeFont() { - resetFontSize(); - logoLabel.addStyleName(LOGO_LARGE_FONT_STYLE); - } - - public void setLogoImage(final AbstractImagePrototype imageProto) { - imageProto.applyTo(logoImage); - } - - public void setLogoImage(final String url) { - Image.prefetch(url); - logoImage.setUrl(url); - } - - public void setLogoText(final String text) { - setLogoTextImpl(text); - } - - public void setLogoVisible(final boolean visible) { - logoImage.setVisible(visible); - } - - public void setMediumFont() { - resetFontSize(); - logoLabel.addStyleName(LOGO_MEDIUM_FONT_STYLE); - } - - public void setSmallFont() { - resetFontSize(); - logoLabel.addStyleName(LOGO_SMALL_FONT_STYLE); - } - - private void resetFontSize() { - logoLabel.removeStyleName(LOGO_LARGE_FONT_STYLE); - 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 Added: trunk/src/test/java/cc/kune/selenium/CustomWebDriverEventListener.java =================================================================== --- trunk/src/test/java/cc/kune/selenium/CustomWebDriverEventListener.java (rev 0) +++ trunk/src/test/java/cc/kune/selenium/CustomWebDriverEventListener.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -0,0 +1,88 @@ +package cc.kune.selenium; + +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.events.WebDriverEventListener; +import org.testng.Assert; + +public class CustomWebDriverEventListener implements WebDriverEventListener { + + @Override + public void afterChangeValueOf(final WebElement element, final WebDriver driver) { + } + + @Override + public void afterClickOn(final WebElement element, final WebDriver driver) { + slow(); + } + + @Override + public void afterFindBy(final By by, final WebElement element, final WebDriver driver) { + } + + @Override + public void afterNavigateBack(final WebDriver driver) { + slow(); + } + + @Override + public void afterNavigateForward(final WebDriver driver) { + slow(); + } + + @Override + public void afterNavigateTo(final String url, final WebDriver driver) { + slow(); + } + + @Override + public void afterScript(final String script, final WebDriver driver) { + } + + @Override + public void beforeChangeValueOf(final WebElement element, final WebDriver driver) { + } + + @Override + public void beforeClickOn(final WebElement element, final WebDriver driver) { + slow(); + } + + @Override + public void beforeFindBy(final By by, final WebElement element, final WebDriver driver) { + } + + @Override + public void beforeNavigateBack(final WebDriver driver) { + ; + } + + @Override + public void beforeNavigateForward(final WebDriver driver) { + } + + @Override + public void beforeNavigateTo(final String url, final WebDriver driver) { + } + + @Override + public void beforeScript(final String script, final WebDriver driver) { + } + + @Override + public void onException(final Throwable throwable, final WebDriver driver) { + } + + public void sleep(final int milliseconds) { + try { + Thread.sleep(milliseconds); + } catch (final InterruptedException e) { + Assert.fail("Exception in sleep method", e); + } + } + + private void slow() { + sleep(500); + } +} \ No newline at end of file Modified: trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java =================================================================== --- trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -22,22 +22,23 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; import org.openqa.selenium.support.PageFactory; -import org.openqa.selenium.support.events.EventFiringWebDriver; -import org.openqa.selenium.support.events.WebDriverEventListener; import org.openqa.selenium.support.pagefactory.ElementLocatorFactory; import org.testng.Assert; import org.testng.ITestContext; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeMethod; +import org.testng.annotations.BeforeSuite; import org.testng.annotations.DataProvider; +import cc.kune.core.client.auth.AnonUsersManager; +import cc.kune.core.shared.domain.utils.StateToken; +import cc.kune.selenium.login.EntityHeaderPageObject; import cc.kune.selenium.login.LoginPageObject; -import cc.kune.selenium.tools.GenericWebDriver; +import cc.kune.selenium.login.RegisterPageObject; import cc.kune.selenium.tools.SeleniumConstants; -import cc.kune.selenium.tools.SeleniumModule; import com.google.inject.Guice; import com.google.inject.Injector; @@ -45,127 +46,63 @@ public class KuneSeleniumDefaults { private static final Log LOG = LogFactory.getLog(KuneSeleniumDefaults.class); public static boolean mustCloseFinally = true; - protected EventFiringWebDriver eventFiring; + private final String baseUrl; + protected final EntityHeaderPageObject entityHeader; private final Injector injector; protected LoginPageObject login; - protected GenericWebDriver webdriver; + protected RegisterPageObject register; + private final WebDriver webdriver; public KuneSeleniumDefaults() { + // baseUrl = "http://kune.beta.iepala.es/ws/?locale=en#"; + baseUrl = "http://127.0.0.1:8888/ws/?locale=es&log_level=INFO&gwt.codesvr=127.0.0.1:999..."; injector = Guice.createInjector(new SeleniumModule()); - webdriver = injector.getInstance(GenericWebDriver.class); + webdriver = injector.getInstance(WebDriver.class); login = injector.getInstance(LoginPageObject.class); - eventFiring = injector.getInstance(EventFiringWebDriver.class); - eventFiring.register(new WebDriverEventListener() { + register = injector.getInstance(RegisterPageObject.class); + entityHeader = injector.getInstance(EntityHeaderPageObject.class); + final ElementLocatorFactory locator = injector.getInstance(ElementLocatorFactory.class); + PageFactory.initElements(locator, login); + PageFactory.initElements(locator, register); + PageFactory.initElements(locator, entityHeader); + } - @Override - public void afterChangeValueOf(final WebElement element, final WebDriver driver) { - // TODO Auto-generated method stub - sleep(500); - } + @BeforeSuite + public void beforeClass() { + resize(); + LOG.info("Going home"); + home(); + webdriver.findElement(By.id(SeleniumConstants.GWTDEV + AnonUsersManager.ANON_MESSAGE_CLOSE_ICON)).click(); + } - @Override - public void afterClickOn(final WebElement element, final WebDriver driver) { - sleep(500); - } + @BeforeMethod + public void beforeMethods(final ITestContext context) { + } - @Override - public void afterFindBy(final By by, final WebElement element, final WebDriver driver) { - // TODO Auto-generated method stub - sleep(500); - } - - @Override - public void afterNavigateBack(final WebDriver driver) { - // TODO Auto-generated method stub - sleep(500); - } - - @Override - public void afterNavigateForward(final WebDriver driver) { - // TODO Auto-generated method stub - sleep(500); - } - - @Override - public void afterNavigateTo(final String url, final WebDriver driver) { - // TODO Auto-generated method stub - sleep(500); - } - - @Override - public void afterScript(final String script, final WebDriver driver) { - // TODO Auto-generated method stub - sleep(500); - } - - @Override - public void beforeChangeValueOf(final WebElement element, final WebDriver driver) { - // TODO Auto-generated method stub - sleep(500); - } - - @Override - public void beforeClickOn(final WebElement element, final WebDriver driver) { - sleep(500); - } - - @Override - public void beforeFindBy(final By by, final WebElement element, final WebDriver driver) { - // TODO Auto-generated method stub - sleep(500); - } - - @Override - public void beforeNavigateBack(final WebDriver driver) { - // TODO Auto-generated method stub - sleep(500); - } - - @Override - public void beforeNavigateForward(final WebDriver driver) { - // TODO Auto-generated method stub - sleep(500); - } - - @Override - public void beforeNavigateTo(final String url, final WebDriver driver) { - // TODO Auto-generated method stub - sleep(500); - } - - @Override - public void beforeScript(final String script, final WebDriver driver) { - // TODO Auto-generated method stub - - } - - @Override - public void onException(final Throwable throwable, final WebDriver driver) { - // TODO Auto-generated method stub - - } - }); - final ElementLocatorFactory locator = injector.getInstance(ElementLocatorFactory.class); - PageFactory.initElements(locator, login); + public void close() { + webdriver.close(); } @AfterSuite public void closeBrowser() { // We try to only open one window for all our selenium tests if (mustCloseFinally) { - webdriver.close(); + close(); } } @DataProvider(name = "correctlogin") public Object[][] createCorrectLogin() { // The default correct user/password used in tests - return new Object[][] { { SeleniumConstants.USERNAME, SeleniumConstants.PASSWD }, }; + return new Object[][] { { SeleniumConstants.USER_SHORNAME, SeleniumConstants.USER_PASSWD } }; } - // public void moveMouseAt(final Point point) { - // webtester.moveMouseAt(point); - // } + @DataProvider(name = "correctregister") + public Object[][] createCorrectRegister() { + // The default correct user/password used in tests + return new Object[][] { { SeleniumConstants.USER_SHORNAME, SeleniumConstants.USER_LONGNAME, + SeleniumConstants.USER_PASSWD, SeleniumConstants.USER_EMAIL } }; + } @DataProvider(name = "incorrectlogin") public Object[][] createIncorrectLogin() { @@ -174,46 +111,37 @@ { "test1@localhost", "test" }, { "", "" } }; } - @BeforeMethod - public void setupSeleniumModule(final ITestContext context) { + public void get(final String url) { + webdriver.get(url); + } - // if (!Suco.getComponents().hasProvider(WebDriver.class)) { - // Suco.install(new SeleniumModule()); - // } - if (webdriver == null) { - // final ChromeDriver driver = new ChromeDriver(); - // // final HtmlUnitDriver driver = new HtmlUnitDriver(true); - // - // // final ProfilesIni allProfiles = new ProfilesIni(); - // // final FirefoxProfile profile = - // // allProfiles.getProfile(SeleniumConstants.FIREFOX_PROFILE_NAME); - // // final FirefoxDriver driver = new FirefoxDriver(profile); - // - // locator = new AjaxElementLocatorFactory(driver, - // SeleniumConstants.TIMEOUT); - // webtester = new GenericWebTester(driver, - // "http://kune.beta.iepala.es/ws/?locale=en#"); - // // webtester = Suco.get(GenericWebTester.class); - // // login = Suco.get(LoginPageObject.class); - // login = new LoginPageObject(); - // PageFactory.initElements(locator, login); - // driver.get("http://kune.beta.iepala.es/ws/?locale=en#"); - // roster = Suco.get(RosterPageObject.class); - // openChat = Suco.get(OpenChatPageObject.class); - // search = Suco.get(SearchPageObject.class); - // chat = Suco.get(ChatPageObject.class); - // editBuddy = Suco.get(EditBuddyPageObject.class); - // groupChat = Suco.get(GroupChatPageObject.class); - // userPage = Suco.get(UserPageObject.class); - // otherVCardPage = Suco.get(OtherVCardPageObject.class); - // copyToClipboard = Suco.get(CopyToClipboardPageObject.class); - // openGroupChat = Suco.get(OpenGroupChatPageObject.class); - } - LOG.info("Going home"); + public String getPageSource() { + return webdriver.getPageSource(); + } - webdriver.home(); + public void gotoToken(final StateToken token) { + get(baseUrl + token); } + public void gotoToken(final String token) { + get(baseUrl + token); + } + + public void home() { + assert baseUrl != null; + webdriver.get(baseUrl); + } + + public void open(final String url) { + webdriver.get(url); + } + + public void resize() { + final JavascriptExecutor js = (JavascriptExecutor) webdriver; + // 1024,769 + js.executeScript("window.resizeTo(840,770); window.moveTo(0,0);"); + } + public void sleep(final int milliseconds) { try { Thread.sleep(milliseconds); Modified: trunk/src/test/java/cc/kune/selenium/PageObject.java =================================================================== --- trunk/src/test/java/cc/kune/selenium/PageObject.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/test/java/cc/kune/selenium/PageObject.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -19,33 +19,78 @@ */ package cc.kune.selenium; +import java.util.List; +import java.util.Set; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.openqa.selenium.By; +import org.openqa.selenium.Keys; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebDriver.Navigation; +import org.openqa.selenium.WebDriver.Options; +import org.openqa.selenium.WebDriver.TargetLocator; import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ByIdOrName; +import org.openqa.selenium.support.ui.ExpectedCondition; +import org.openqa.selenium.support.ui.Wait; +import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; +import com.google.gwt.user.client.ui.UIObject; import com.google.inject.Inject; public abstract class PageObject { - protected static final String GWTDEV = "gwt-debug-"; private static final Log LOG = LogFactory.getLog(PageObject.class.getName()); private static final long[] POLL_INTERVALS = { 10, 20, 30, 40, 50, 50, 50, 50, 100 }; @Inject private WebDriver webdriver; - protected WebElement findElement(final By by) { - return getWebDriver().findElement(by); + protected void clearField(final WebElement elem) { + elem.sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.DELETE); } - private WebDriver getWebDriver() { + public WebElement findElement(final By by) { + return webdriver.findElement(by); + } + + public List<WebElement> findElements(final By by) { + return webdriver.findElements(by); + } + + public WebElement getById(final String id) { + return webdriver.findElement(By.id(UIObject.DEBUG_ID_PREFIX + id)); + } + + public String getCurrentUrl() { + return webdriver.getCurrentUrl(); + } + + public String getTitle() { + return webdriver.getTitle(); + } + + protected WebDriver getWebDriver() { return webdriver; } + public String getWindowHandle() { + return webdriver.getWindowHandle(); + } + + public Set<String> getWindowHandles() { + return webdriver.getWindowHandles(); + } + + public boolean isElementPresent(final String id) { + final Wait<WebDriver> wait = new WebDriverWait(webdriver, 5); + final WebElement element = wait.until(visibilityOfElementLocated(By.id(id))); + return element != null; + } + public boolean isPresent(final WebElement element) { // FIXME: find a better way to do this try { @@ -56,6 +101,44 @@ } } + public boolean isTextPresent(final String text) { + return webdriver.findElement(By.tagName("body")).getText().contains(text); + } + + public Options manage() { + return webdriver.manage(); + } + + public void moveMouseTo(final WebElement element) { + final Actions actions = new Actions(webdriver); + actions.moveToElement(element); + } + + public Navigation navigate() { + return webdriver.navigate(); + } + + public void quit() { + webdriver.quit(); + } + + public TargetLocator switchTo() { + return webdriver.switchTo(); + } + + public ExpectedCondition<WebElement> visibilityOfElementLocated(final By locator) { + return new ExpectedCondition<WebElement>() { + @Override + public WebElement apply(final WebDriver driver) { + final WebElement toReturn = driver.findElement(locator); + if (toReturn.isDisplayed()) { + return toReturn; + } + return null; + } + }; + } + /** * Thanks to: * http://groups.google.com/group/webdriver/browse_frm/thread/6e705242 Copied: trunk/src/test/java/cc/kune/selenium/PageObjectModule.java (from rev 1528, trunk/src/test/java/cc/kune/selenium/tools/PageObjectModule.java) =================================================================== --- trunk/src/test/java/cc/kune/selenium/PageObjectModule.java (rev 0) +++ trunk/src/test/java/cc/kune/selenium/PageObjectModule.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -0,0 +1,34 @@ +/* + * + * Copyright (C) 2007-2011 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 cc.kune.selenium; + +import org.openqa.selenium.support.PageFactory; +import org.openqa.selenium.support.pagefactory.ElementLocatorFactory; + +import com.google.inject.AbstractModule; + +public abstract class PageObjectModule extends AbstractModule { + protected <T> void registerPageObject(final Class<T> componentType, final T object, + final ElementLocatorFactory locator) { + bind(componentType).toInstance(object); + PageFactory.initElements(locator, object); + + } +} Copied: trunk/src/test/java/cc/kune/selenium/SeleniumModule.java (from rev 1528, trunk/src/test/java/cc/kune/selenium/tools/SeleniumModule.java) =================================================================== --- trunk/src/test/java/cc/kune/selenium/SeleniumModule.java (rev 0) +++ trunk/src/test/java/cc/kune/selenium/SeleniumModule.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -0,0 +1,87 @@ +/* + * + * Copyright (C) 2007-2011 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 cc.kune.selenium; + +import java.util.Arrays; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.firefox.FirefoxProfile; +import org.openqa.selenium.firefox.internal.ProfilesIni; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.remote.RemoteWebDriver; +import org.openqa.selenium.support.events.EventFiringWebDriver; +import org.openqa.selenium.support.pagefactory.AjaxElementLocatorFactory; +import org.openqa.selenium.support.pagefactory.ElementLocatorFactory; + +import cc.kune.selenium.login.EntityHeaderPageObject; +import cc.kune.selenium.login.LoginPageObject; +import cc.kune.selenium.login.RegisterPageObject; +import cc.kune.selenium.tools.SeleniumConstants; + +import com.google.inject.Singleton; + +public class SeleniumModule extends PageObjectModule { + + public SeleniumModule() { + } + + @Override + protected void configure() { + + // final RemoteWebDriver driver = createChromeDriver(); + final WebDriver driver = creatFirefoxDriver(); + final EventFiringWebDriver wrap = new EventFiringWebDriver(driver); + wrap.register(new CustomWebDriverEventListener()); + + bind(WebDriver.class).toInstance(wrap); + + bind(ElementLocatorFactory.class).toInstance( + new AjaxElementLocatorFactory(wrap, SeleniumConstants.TIMEOUT)); + + // Page Objects here! + bind(LoginPageObject.class).in(Singleton.class); + bind(RegisterPageObject.class).in(Singleton.class); + bind(EntityHeaderPageObject.class).in(Singleton.class); + } + + @SuppressWarnings("unused") + private RemoteWebDriver createChromeDriver() { + // http://code.google.com/p/selenium/wiki/ChromeDriver + System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver"); + final DesiredCapabilities capabilities = DesiredCapabilities.chrome(); + // http://peter.sh/experiments/chromium-command-line-switches/ + capabilities.setCapability("chrome.switches", Arrays.asList("--disable-translate")); + capabilities.setCapability("chrome.binary", "/usr/bin/chromium-browser"); + final ChromeDriver driver = new ChromeDriver(capabilities); + return driver; + } + + private FirefoxDriver creatFirefoxDriver() { + // http://code.google.com/p/selenium/wiki/FirefoxDriver + final ProfilesIni allProfiles = new ProfilesIni(); + final FirefoxProfile profile = allProfiles.getProfile(SeleniumConstants.FIREFOX_PROFILE_NAME); + // System.setProperty("webdriver.firefox.useExisting", "true"); + // final FirefoxProfile profile = allProfiles.getProfile("76tp2vh0.ff5"); + final FirefoxDriver driver = new FirefoxDriver(profile); + return driver; + } +} Added: trunk/src/test/java/cc/kune/selenium/login/AbstractLoginObject.java =================================================================== --- trunk/src/test/java/cc/kune/selenium/login/AbstractLoginObject.java (rev 0) +++ trunk/src/test/java/cc/kune/selenium/login/AbstractLoginObject.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -0,0 +1,41 @@ +package cc.kune.selenium.login; + +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +import cc.kune.core.client.sitebar.SiteUserOptionsPresenter; +import cc.kune.core.client.sitebar.SitebarSignInLink; +import cc.kune.core.client.sitebar.SitebarSignOutLink; +import cc.kune.selenium.PageObject; +import cc.kune.selenium.tools.SeleniumConstants; + +public class AbstractLoginObject extends PageObject { + @FindBy(id = SeleniumConstants.GWTDEV + SitebarSignInLink.SITE_SIGN_IN) + protected WebElement signInLink; + @FindBy(id = SeleniumConstants.GWTDEV + SitebarSignOutLink.SITE_SIGN_OUT) + protected WebElement signOutLink; + @FindBy(id = SeleniumConstants.GWTDEV + SiteUserOptionsPresenter.LOGGED_USER_MENU_ID) + protected WebElement userMenu; + + public void assertIsConnectedAs(final String user) { + waitFor(userMenu, user); + } + + public void assertIsDisconnected() { + try { + signOutLink.click(); + } catch (final Exception e) { + } + waitFor(signInLink); + } + + public void logout() { + signOutLink.click(); + assertIsDisconnected(); + } + + public void signOut() { + logout(); + } + +} Added: trunk/src/test/java/cc/kune/selenium/login/EntityHeaderPageObject.java =================================================================== --- trunk/src/test/java/cc/kune/selenium/login/EntityHeaderPageObject.java (rev 0) +++ trunk/src/test/java/cc/kune/selenium/login/EntityHeaderPageObject.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -0,0 +1,42 @@ +/* + * + * Copyright (C) 2007-2011 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 cc.kune.selenium.login; + +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +import cc.kune.core.client.ws.entheader.EntityTextLogo; +import cc.kune.selenium.PageObject; +import cc.kune.selenium.tools.SeleniumConstants; + +public class EntityHeaderPageObject extends PageObject { + + @FindBy(id = SeleniumConstants.GWTDEV + EntityTextLogo.LOGO_IMAGE) + protected WebElement logoImage; + @FindBy(id = SeleniumConstants.GWTDEV + EntityTextLogo.LOGO_NAME) + protected WebElement logoName; + + public EntityHeaderPageObject() { + } + + public void waitForEntityTitle(final String text) { + waitFor(logoName, text); + } +} Modified: trunk/src/test/java/cc/kune/selenium/login/LoginPageObject.java =================================================================== --- trunk/src/test/java/cc/kune/selenium/login/LoginPageObject.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/test/java/cc/kune/selenium/login/LoginPageObject.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -25,53 +25,27 @@ import cc.kune.core.client.auth.SignInForm; import cc.kune.core.client.auth.SignInPanel; -import cc.kune.core.client.sitebar.SiteUserOptionsPresenter; -import cc.kune.core.client.sitebar.SitebarSignInLink; -import cc.kune.core.client.sitebar.SitebarSignOutLink; -import cc.kune.selenium.PageObject; -import cc.kune.selenium.tools.I18nHelper; import cc.kune.selenium.tools.SeleniumConstants; -import com.calclab.hablar.login.client.LoginMessages; +public class LoginPageObject extends AbstractLoginObject { -public class LoginPageObject extends PageObject { - - private final I18nHelper i18n; - @FindBy(id = SignInForm.PASSWORD_FIELD_ID + "-input") + @FindBy(id = SeleniumConstants.GWTDEV + SignInPanel.CREATE_ONE) + protected WebElement createOneLink; + @FindBy(id = SignInForm.PASSWORD_FIELD_ID + SeleniumConstants.INPUT) private WebElement passwd; - @FindBy(id = GWTDEV + SignInPanel.SIGN_IN_BUTTON_ID) + @FindBy(id = SeleniumConstants.GWTDEV + SignInPanel.SIGN_IN_BUTTON_ID) private WebElement signInButton; - @FindBy(id = GWTDEV + SitebarSignInLink.SITE_SIGN_IN) - private WebElement signInLink; - @FindBy(id = GWTDEV + SitebarSignOutLink.SITE_SIGN_OUT) - private WebElement signOutLink; - @FindBy(id = SignInForm.USER_FIELD_ID + "-input") + @FindBy(id = SignInForm.USER_FIELD_ID + SeleniumConstants.INPUT) private WebElement user; - @FindBy(id = GWTDEV + SiteUserOptionsPresenter.LOGGED_USER_MENU_ID) - private WebElement userMenu; public LoginPageObject() { - i18n = new I18nHelper(LoginMessages.class); + // i18n = new I18nHelper(LoginMessages.class); } - public void assertIsConnectedAs(final String user) { - waitFor(userMenu, user); - } - - public void assertIsDisconnected() { - try { - signOutLink.click(); - } catch (final Exception e) { - } - waitFor(signInLink); - } - public void fillSigInInForm(final String username, final String password, final boolean withReturn) { - user.clear(); - passwd.clear(); - user.clear(); - passwd.clear(); + clearField(user); user.sendKeys(username); + clearField(passwd); passwd.sendKeys(password); if (withReturn) { passwd.sendKeys(Keys.RETURN); @@ -88,27 +62,19 @@ return getHeader(); } - public void logout() { - signOutLink.click(); - assertIsDisconnected(); - } - public void signIn(final String username, final String password) { signIn(username, password, true); } public void signIn(final String username, final String password, final boolean withReturn) { assertIsDisconnected(); + moveMouseTo(signInLink); signInLink.click(); fillSigInInForm(username, password, withReturn); } public void signInDefUser() { - signIn(SeleniumConstants.USERNAME, SeleniumConstants.PASSWD, false); + signIn(SeleniumConstants.USER_SHORNAME, SeleniumConstants.USER_PASSWD, false); } - public void signOut() { - logout(); - } - } Modified: trunk/src/test/java/cc/kune/selenium/login/LoginSeleniumTests.java =================================================================== --- trunk/src/test/java/cc/kune/selenium/login/LoginSeleniumTests.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/test/java/cc/kune/selenium/login/LoginSeleniumTests.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -59,7 +59,7 @@ @Test(dataProvider = "correctlogin") public void signInWithToken(final String user, final String passwd) { login.assertIsDisconnected(); - webdriver.gotoToken(SiteTokens.SIGNIN); + gotoToken(SiteTokens.SIGNIN); login.fillSigInInForm(user, passwd, true); login.assertIsConnectedAs(user); login.logout(); Added: trunk/src/test/java/cc/kune/selenium/login/RegisterPageObject.java =================================================================== --- trunk/src/test/java/cc/kune/selenium/login/RegisterPageObject.java (rev 0) +++ trunk/src/test/java/cc/kune/selenium/login/RegisterPageObject.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -0,0 +1,64 @@ +/* + * + * Copyright (C) 2007-2011 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 cc.kune.selenium.login; + +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +import cc.kune.core.client.auth.RegisterForm; +import cc.kune.core.client.auth.RegisterPanel; +import cc.kune.selenium.tools.SeleniumConstants; + +public class RegisterPageObject extends AbstractLoginObject { + + @FindBy(id = RegisterForm.EMAIL_FIELD + SeleniumConstants.INPUT) + private WebElement email; + @FindBy(id = RegisterForm.LONGNAME_FIELD + SeleniumConstants.INPUT) + private WebElement longName; + @FindBy(id = RegisterForm.PASSWORD_FIELD + SeleniumConstants.INPUT) + private WebElement passwd; + @FindBy(id = SeleniumConstants.GWTDEV + RegisterPanel.REGISTER_BUTTON_ID) + private WebElement registerButton; + @FindBy(id = RegisterForm.NICK_FIELD + SeleniumConstants.INPUT) + private WebElement shortName; + + public RegisterPageObject() { + // i18n = new I18nHelper(LoginMessages.class); + } + + public void fillRegisterForm(final String nick, final String name, final String pass, final String em, + final boolean withReturn) { + clearField(shortName); + shortName.sendKeys(nick); + clearField(longName); + longName.sendKeys(name); + clearField(passwd); + passwd.sendKeys(pass); + clearField(email); + email.sendKeys(em); + if (withReturn) { + email.sendKeys(Keys.RETURN); + } else { + registerButton.click(); + } + } + +} Added: trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java =================================================================== --- trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java (rev 0) +++ trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -0,0 +1,68 @@ +/* + * + * Copyright (C) 2007-2011 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 cc.kune.selenium.login; + +import org.testng.annotations.Test; + +import cc.kune.selenium.KuneSeleniumTest; + +public class RegisterSeleniumTests extends KuneSeleniumTest { + + @Test(dataProvider = "correctregister") + public void severalsSignInSingOut(final String shortName, final String longName, final String passwd, + final String email) { + // 15 chars, the limit, so we don't use shortName + final String prefix = getTempString(); + login.assertIsDisconnected(); + login.signInLink.click(); + login.createOneLink.click(); + register.fillRegisterForm(prefix, prefix + longName, passwd, prefix + email, false); + login.assertIsConnectedAs(prefix); + sleep(1000); + entityHeader.waitForEntityTitle(prefix + longName); + login.logout(); + } + + // @Test(dataProvider = "correctlogin") + // public void signIn(final String user, final String passwd) { + // login.assertIsDisconnected(); + // login.signIn(user, passwd); + // login.assertIsConnectedAs(user); + // login.logout(); + // login.assertIsDisconnected(); + // } + // + // @Test + // public void signInIncorrectPasswd() { + // login.assertIsDisconnected(); + // login.signIn("nouser", "nopassword"); + // login.assertIsDisconnected(); + // } + // + // @Test(dataProvider = "correctlogin") + // public void signInWithToken(final String user, final String passwd) { + // login.assertIsDisconnected(); + // webdriver.gotoToken(SiteTokens.SIGNIN); + // login.fillSigInInForm(user, passwd, true); + // login.assertIsConnectedAs(user); + // login.logout(); + // login.assertIsDisconnected(); + // } +} Deleted: trunk/src/test/java/cc/kune/selenium/tools/AbstractWebDriver.java =================================================================== --- trunk/src/test/java/cc/kune/selenium/tools/AbstractWebDriver.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/test/java/cc/kune/selenium/tools/AbstractWebDriver.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,150 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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 cc.kune.selenium.tools; - -import java.util.List; -import java.util.Set; - -import org.openqa.selenium.By; -import org.openqa.selenium.Point; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebDriverBackedSelenium; -import org.openqa.selenium.WebElement; - -import cc.kune.core.shared.domain.utils.StateToken; - -import com.google.gwt.user.client.ui.UIObject; -import com.thoughtworks.selenium.Selenium; - -public abstract class AbstractWebDriver implements WebDriver { - private final String baseUrl; - private final WebDriver driver; - private final Selenium selenium; - - public AbstractWebDriver(final WebDriver driver, final String baseUrl) { - this.driver = driver; - this.baseUrl = baseUrl; - selenium = new WebDriverBackedSelenium(driver, baseUrl); - selenium.setSpeed("500"); - // driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); - - // selenium.setTimeout("5000"); - } - - @Override - public void close() { - driver.close(); - } - - @Override - public WebElement findElement(final By by) { - return driver.findElement(by); - } - - @Override - public List<WebElement> findElements(final By by) { - return driver.findElements(by); - } - - @Override - public void get(final String url) { - driver.get(url); - } - - public WebElement getById(final String id) { - return driver.findElement(By.id(UIObject.DEBUG_ID_PREFIX + id)); - } - - @Override - public String getCurrentUrl() { - return driver.getCurrentUrl(); - } - - @Override - public String getPageSource() { - return driver.getPageSource(); - } - - @Override - public String getTitle() { - return driver.getTitle(); - } - - @Override - public String getWindowHandle() { - return driver.getWindowHandle(); - } - - @Override - public Set<String> getWindowHandles() { - return driver.getWindowHandles(); - } - - public void gotoToken(final StateToken token) { - get(baseUrl + token); - } - - public void gotoToken(final String token) { - get(baseUrl + token); - } - - public void home() { - assert baseUrl != null; - driver.get(baseUrl); - } - - public boolean isElementPresent(final String id) { - // http://stackoverflow.com/questions/5922930/iselementpresent-in-selenium-2-0 - return selenium.isElementPresent(id); - } - - public boolean isTextPresent(final String text) { - return selenium.isTextPresent(text); - } - - @Override - public Options manage() { - return driver.manage(); - } - - public void moveMouseAt(final Point point) { - selenium.mouseMoveAt(String.valueOf(point.getX()), String.valueOf(point.getY())); - } - - @Override - public Navigation navigate() { - return driver.navigate(); - } - - public void open(final String url) { - get(url); - } - - @Override - public void quit() { - driver.quit(); - } - - @Override - public TargetLocator switchTo() { - return driver.switchTo(); - } - -} \ No newline at end of file Deleted: trunk/src/test/java/cc/kune/selenium/tools/GenericWebDriver.java =================================================================== --- trunk/src/test/java/cc/kune/selenium/tools/GenericWebDriver.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/test/java/cc/kune/selenium/tools/GenericWebDriver.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,33 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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 cc.kune.selenium.tools; - -import org.openqa.selenium.WebDriver; - -import com.google.inject.Inject; - -public class GenericWebDriver extends AbstractWebDriver { - - @Inject - public GenericWebDriver(final WebDriver driver) { - super(driver, "http://kune.beta.iepala.es/ws/?locale=en#"); - } - -} Deleted: trunk/src/test/java/cc/kune/selenium/tools/PageObjectModule.java =================================================================== --- trunk/src/test/java/cc/kune/selenium/tools/PageObjectModule.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/test/java/cc/kune/selenium/tools/PageObjectModule.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,34 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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 cc.kune.selenium.tools; - -import org.openqa.selenium.support.PageFactory; -import org.openqa.selenium.support.pagefactory.ElementLocatorFactory; - -import com.google.inject.AbstractModule; - -public abstract class PageObjectModule extends AbstractModule { - protected <T> void registerPageObject(final Class<T> componentType, final T object, - final ElementLocatorFactory locator) { - bind(componentType).toInstance(object); - PageFactory.initElements(locator, object); - - } -} Modified: trunk/src/test/java/cc/kune/selenium/tools/SeleniumConstants.java =================================================================== --- trunk/src/test/java/cc/kune/selenium/tools/SeleniumConstants.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/test/java/cc/kune/selenium/tools/SeleniumConstants.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -21,9 +21,13 @@ public final class SeleniumConstants { public static final String FIREFOX_PROFILE_NAME = "selenium"; - public static final String PASSWD = "easyeasy"; + public static final String GWTDEV = "gwt-debug-"; + public static final String INPUT = "-input"; public static final int TIMEOUT = 15; - public static final String USERNAME = "admin"; + public static final String USER_EMAIL = "[email protected]"; + public static final String USER_LONGNAME = "Administrator"; + public static final String USER_PASSWD = "easyeasy"; + public static final String USER_SHORNAME = "admin"; SeleniumConstants() { // Final class Deleted: trunk/src/test/java/cc/kune/selenium/tools/SeleniumModule.java =================================================================== --- trunk/src/test/java/cc/kune/selenium/tools/SeleniumModule.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/test/java/cc/kune/selenium/tools/SeleniumModule.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,87 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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 cc.kune.selenium.tools; - -import java.util.Arrays; - -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.chrome.ChromeDriver; -import org.openqa.selenium.firefox.FirefoxDriver; -import org.openqa.selenium.firefox.FirefoxProfile; -import org.openqa.selenium.firefox.internal.ProfilesIni; -import org.openqa.selenium.remote.DesiredCapabilities; -import org.openqa.selenium.support.events.EventFiringWebDriver; -import org.openqa.selenium.support.pagefactory.AjaxElementLocatorFactory; -import org.openqa.selenium.support.pagefactory.ElementLocatorFactory; - -import cc.kune.selenium.login.LoginPageObject; - -import com.google.inject.Singleton; - -public class SeleniumModule extends PageObjectModule { - - public SeleniumModule() { - } - - @Override - protected void configure() { - - // bind(WebDriver.class).toInstance(creatFirefoxDriver()); - final WebDriver driver = createChromeDriver(); - bind(WebDriver.class).toInstance(driver); - bind(GenericWebDriver.class).in(Singleton.class); - - // "http://127.0.0.1:8888/ws/?locale=en&log_level=INFO&gwt.codesvr=127.0.0.1:999..."); - - bind(ElementLocatorFactory.class).toInstance( - new AjaxElementLocatorFactory(driver, SeleniumConstants.TIMEOUT)); - - final EventFiringWebDriver eventFiring = new EventFiringWebDriver(driver); - bind(EventFiringWebDriver.class).toInstance(eventFiring); - - // Page Objects here! - bind(LoginPageObject.class).in(Singleton.class); - } - - private WebDriver createChromeDriver() { - // http://code.google.com/p/selenium/wiki/ChromeDriver - System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver"); - final DesiredCapabilities capabilities = DesiredCapabilities.chrome(); - // http://peter.sh/experiments/chromium-command-line-switches/ - capabilities.setCapability("chrome.switches", Arrays.asList("--disable-translate")); - capabilities.setCapability("chrome.binary", "/usr/bin/chromium-browser"); - final WebDriver driver = new ChromeDriver(capabilities); - return driver; - } - - @SuppressWarnings("unused") - private FirefoxDriver creatFirefoxDriver() { - // final FirefoxProfile profile = new FirefoxProfile(); - // profile.setPreference("webdriver.firefox.profile", - // SeleniumConstants.FIREFOX_PROFILE_NAME); - // profile.setPreference("webdriver.firefox.useExisting",true); - - final ProfilesIni allProfiles = new ProfilesIni(); - final FirefoxProfile profile = allProfiles.getProfile(SeleniumConstants.FIREFOX_PROFILE_NAME); - // profile.setPreferences("foo.bar", 23); - final FirefoxDriver driver = new FirefoxDriver(profile); - return driver; - } -} Deleted: trunk/src/test/java/org/ourproject/kune/platf/client/ui/KuneStringUtilsTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/client/ui/KuneStringUtilsTest.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/test/java/org/ourproject/kune/platf/client/ui/KuneStringUtilsTest.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,79 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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 static org.junit.Assert.assertEquals; - -import java.util.ArrayList; - -import org.junit.Test; - -import cc.kune.common.client.utils.TextUtils; - -public class KuneStringUtilsTest { - - @Test - public void testTagNull() { - final String tagsString = null; - final ArrayList<String> tags = TextUtils.splitTags(tagsString); - assertEquals(0, tags.size()); - } - - @Test - public void testTagStripsSimple() { - final String tagsString = "ab cd"; - final ArrayList<String> tags = TextUtils.splitTags(tagsString); - assertEquals("ab", tags.get(0)); - assertEquals("cd", tags.get(1)); - } - - @Test - public void testTagStripsWithCommas() { - final String tagsString = "ab,cd"; - final ArrayList<String> tags = TextUtils.splitTags(tagsString); - assertEquals("ab", tags.get(0)); - assertEquals("cd", tags.get(1)); - } - - @Test - public void testTagStripsWithCommasAndSpaces() { - final String tagsString = "ab, cd"; - final ArrayList<String> tags = TextUtils.splitTags(tagsString); - assertEquals("ab", tags.get(0)); - assertEquals("cd", tags.get(1)); - } - - @Test - public void testTagStripsWithQuotes() { - final String tagsString = "ab \"cd\""; - final ArrayList<String> tags = TextUtils.splitTags(tagsString); - assertEquals("ab", tags.get(0)); - assertEquals("cd", tags.get(1)); - } - - @Test - public void testTagStripsWithSpaces() { - final String tagsString = " ab cd "; - final ArrayList<String> tags = TextUtils.splitTags(tagsString); - assertEquals("ab", tags.get(0)); - assertEquals("cd", tags.get(1)); - } - -} Deleted: trunk/src/test/java/org/ourproject/kune/platf/client/ui/TextUtilsTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/client/ui/TextUtilsTest.java 2011-09-23 21:10:32 UTC (rev 1530) +++ trunk/src/test/java/org/ourproject/kune/platf/client/ui/TextUtilsTest.java 2011-09-24 18:46:13 UTC (rev 1531) @@ -1,89 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 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 static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -import cc.kune.common.client.utils.TextUtils; - -public class TextUtilsTest { - @Test - public void dontRemoveLastSlashIfNoExists() { - final String text = "ab"; - assertEquals("ab", TextUtils.removeLastSlash(text)); - } - - @Test - public void dontRemoveOtherSlashIfExists() { - final String text = "/ab"; - assertEquals("/ab", TextUtils.removeLastSlash(text)); - } - - @Test - public void matchDemoEmail() { - final String email = "[email protected]"; - assertTrue(email.matches(TextUtils.EMAIL_REGEXP)); - } - - @Test - public void matchLocalhostEmail() { - final String email = "me@localhost"; - assertTrue(email.matches(TextUtils.EMAIL_REGEXP)); - } - - @Test - public void matchSimpleEmail() { - final String email = "[email protected]"; - assertTrue(email.matches(TextUtils.EMAIL_REGEXP)); - } - - @Test - public void matchUrlWithHttp() { - final String gnuUrl = "http://gnu.org"; - assertTrue(gnuUrl.matches(TextUtils.URL_REGEXP)); - } - - @Test - public void matchUrlWithoutHttp() { - final String gnuUrl = "gnu.org"; - assertTrue(!gnuUrl.matches(TextUtils.URL_REGEXP)); - } - - @Test - public void notMatchWrongUrl() { - final String someWrong = "[email protected]"; - assertTrue(!someWrong.matches(TextUtils.URL_REGEXP)); - } - - @Test - public void removeLastSlashIfExists() { - final String text = "/"; - assertEquals("", TextUtils.removeLastSlash(text)); - } - - @Test - public void removeOnlytLastSlashIfExists() { - final String text = "/ab/cd/"; - assertEquals("/ab/cd", TextUtils.removeLastSlash(text)); - } -}