summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/terminal/gwt
diff options
context:
space:
mode:
authorJouni Koivuviita <jouni@vaadin.com>2012-08-07 16:05:49 +0300
committerJouni Koivuviita <jouni@vaadin.com>2012-08-07 16:05:49 +0300
commit8356465b3897fa16233064cfd586b4557f33e8e4 (patch)
treeaa14a1e52e85935486e7a4aec453247939a228fc /src/com/vaadin/terminal/gwt
parent9a83722fde94af949b45d4c091399ba9e1f6ba29 (diff)
parent5813e0e9e5af4f946e5ea9c73d426e95d93b7bc4 (diff)
downloadvaadin-framework-8356465b3897fa16233064cfd586b4557f33e8e4.tar.gz
vaadin-framework-8356465b3897fa16233064cfd586b4557f33e8e4.zip
merge master
Diffstat (limited to 'src/com/vaadin/terminal/gwt')
-rw-r--r--src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml87
-rw-r--r--src/com/vaadin/terminal/gwt/VaadinBrowserSpecificOverrides.gwt.xml (renamed from src/com/vaadin/terminal/gwt/DefaultWidgetSetBrowserSpecificOverrides.gwt.xml)0
-rw-r--r--src/com/vaadin/terminal/gwt/client/AbstractFieldState.java137
-rw-r--r--src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java45
-rw-r--r--src/com/vaadin/terminal/gwt/client/ApplicationConnection.java250
-rw-r--r--src/com/vaadin/terminal/gwt/client/BrowserInfo.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ComponentConnector.java13
-rw-r--r--src/com/vaadin/terminal/gwt/client/ComponentLocator.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ComponentState.java402
-rw-r--r--src/com/vaadin/terminal/gwt/client/Connector.java57
-rw-r--r--src/com/vaadin/terminal/gwt/client/ConnectorMap.java38
-rw-r--r--src/com/vaadin/terminal/gwt/client/EventHelper.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/EventId.java9
-rw-r--r--src/com/vaadin/terminal/gwt/client/JavaScriptConnectorHelper.java39
-rw-r--r--src/com/vaadin/terminal/gwt/client/JavaScriptExtension.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/JavaScriptExtensionState.java36
-rw-r--r--src/com/vaadin/terminal/gwt/client/MouseEventDetails.java159
-rw-r--r--src/com/vaadin/terminal/gwt/client/MouseEventDetailsBuilder.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/NullConsole.java9
-rw-r--r--src/com/vaadin/terminal/gwt/client/ResourceLoader.java540
-rw-r--r--src/com/vaadin/terminal/gwt/client/ServerConnector.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/SimpleTree.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/SuperDevMode.java253
-rw-r--r--src/com/vaadin/terminal/gwt/client/TooltipInfo.java19
-rw-r--r--src/com/vaadin/terminal/gwt/client/UIDL.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/Util.java90
-rw-r--r--src/com/vaadin/terminal/gwt/client/VBrowserDetails.java465
-rw-r--r--src/com/vaadin/terminal/gwt/client/VCaption.java29
-rw-r--r--src/com/vaadin/terminal/gwt/client/VConsole.java30
-rw-r--r--src/com/vaadin/terminal/gwt/client/VDebugConsole.java109
-rw-r--r--src/com/vaadin/terminal/gwt/client/VSchedulerImpl.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/VTooltip.java219
-rw-r--r--src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java158
-rw-r--r--src/com/vaadin/terminal/gwt/client/WidgetLoader.java6
-rw-r--r--src/com/vaadin/terminal/gwt/client/communication/ClientRpc.java23
-rw-r--r--src/com/vaadin/terminal/gwt/client/communication/FieldRpc.java19
-rw-r--r--src/com/vaadin/terminal/gwt/client/communication/InitializableServerRpc.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/communication/JsonDecoder.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/communication/JsonEncoder.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/communication/MethodInvocation.java62
-rw-r--r--src/com/vaadin/terminal/gwt/client/communication/RpcManager.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/communication/RpcMethod.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/communication/RpcProxy.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/communication/ServerRpc.java15
-rw-r--r--src/com/vaadin/terminal/gwt/client/communication/SharedState.java67
-rw-r--r--src/com/vaadin/terminal/gwt/client/communication/URLReference.java31
-rw-r--r--src/com/vaadin/terminal/gwt/client/communication/URLReference_Serializer.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/communication/UidlValue.java25
-rw-r--r--src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/ExecuteJavaScriptRpc.java11
-rw-r--r--src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavaScriptManagerConnector.java7
-rw-r--r--src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavaScriptManagerState.java22
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/AbstractClickEventHandler.java5
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java240
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/AbstractComponentContainerConnector.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/AbstractConnector.java19
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/AbstractFieldConnector.java23
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/AbstractLayoutConnector.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/AbstractLayoutState.java19
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/AbstractMediaState.java82
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/Action.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/AlignmentInfo.java89
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/ClickEventHandler.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/ClickRpc.java18
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/Connect.java93
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/ConnectorClassBasedFactory.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/ConnectorStateFactory.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/ConnectorWidgetFactory.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/FocusableFlexTable.java5
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/FocusableFlowPanel.java5
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/FocusableScrollPanel.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/JavaScriptComponentConnector.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/JavaScriptComponentState.java37
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/LayoutClickEventHandler.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/LayoutClickRpc.java22
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/MediaBaseConnector.java24
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/ShortcutActionHandler.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/SimpleFocusablePanel.java5
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/TabIndexState.java29
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/TreeImages.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/UnknownComponentConnector.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VContextMenu.java10
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VMarginInfo.java81
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VOverlay.java243
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/Vaadin6Connector.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutConnector.java9
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutServerRpc.java11
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutState.java29
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/accordion/AccordionConnector.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/accordion/VAccordion.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/audio/AudioConnector.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/button/ButtonConnector.java13
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/button/ButtonServerRpc.java28
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/button/ButtonState.java118
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/button/VButton.java6
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxConnector.java11
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxServerRpc.java11
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxState.java19
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/checkbox/VCheckBox.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/combobox/ComboBoxConnector.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/combobox/VFilterSelect.java43
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutConnector.java9
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutServerRpc.java11
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutState.java23
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/csslayout/VCssLayout.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/customcomponent/CustomComponentConnector.java5
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/customfield/CustomFieldConnector.java6
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/customlayout/CustomLayoutConnector.java16
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/customlayout/CustomLayoutState.java41
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/datefield/AbstractDateFieldConnector.java21
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/datefield/InlineDateFieldConnector.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/datefield/PopupDateFieldConnector.java38
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/datefield/VCalendarPanel.java12
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/datefield/VDateField.java11
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/datefield/VDateFieldCalendar.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/datefield/VPopupCalendar.java6
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/datefield/VTextualDate.java8
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/AcceptCriterion.java33
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/DDUtil.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/HorizontalDropLocation.java8
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VAbstractDropHandler.java8
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptAll.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VAnd.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VContainsDataFlavor.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java11
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VDragSourceIs.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VIsOverId.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VItemIdIs.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VLazyInitItemIdentifiers.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VNot.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VServerAccept.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VSourceIsTarget.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VTargetDetailIs.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VTargetInSubtree.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VerticalDropLocation.java8
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/VDragAndDropWrapper.java23
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedConnector.java28
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedServerRpc.java10
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/embedded/VEmbedded.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/form/FormConnector.java6
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/form/FormState.java29
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/form/VForm.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/formlayout/FormLayoutConnector.java42
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/formlayout/VFormLayout.java26
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutConnector.java15
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutServerRpc.java11
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutState.java37
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/gridlayout/VGridLayout.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/GreetAgainRpc.java12
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/HelloWorldExtensionConnector.java48
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/HelloWorldRpc.java10
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/HelloWorldState.java18
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/label/ContentMode.java48
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/label/LabelConnector.java5
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/label/LabelState.java28
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/label/VLabel.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/layout/LayoutDependencyTree.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/layout/VLayoutSlot.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/link/LinkConnector.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/link/VLink.java6
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/listselect/ListSelectConnector.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/listselect/TooltipListBox.java41
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/listselect/VListSelect.java16
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBar.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java32
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/menubar/MenuItem.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/menubar/VMenuBar.java99
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/nativebutton/NativeButtonConnector.java10
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/nativebutton/VNativeButton.java11
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/nativeselect/NativeSelectConnector.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/nativeselect/VNativeSelect.java17
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/notification/VNotification.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupBaseConnector.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupConnector.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/optiongroup/VOptionGroup.java7
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/optiongroup/VOptionGroupBase.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java12
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutServerRpc.java12
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutState.java56
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/orderedlayout/HorizontalLayoutConnector.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VMeasuringOrderedLayout.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VerticalLayoutConnector.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/panel/PanelConnector.java11
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/panel/PanelServerRpc.java11
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/panel/PanelState.java36
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/panel/VPanel.java6
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/passwordfield/PasswordFieldConnector.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/popupview/PopupViewConnector.java5
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/popupview/VPopupView.java47
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/progressindicator/ProgressIndicatorConnector.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/richtextarea/RichTextAreaConnector.java6
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextArea.java12
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextToolbar.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/root/PageClientRpc.java13
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java21
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/root/RootServerRpc.java11
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/root/RootState.java20
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java8
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/slider/SliderConnector.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/slider/VSlider.java9
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelConnector.java9
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelRpc.java28
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelState.java124
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/splitpanel/HorizontalSplitPanelConnector.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/splitpanel/VAbstractSplitPanel.java23
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/splitpanel/VerticalSplitPanelConnector.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/table/TableConnector.java50
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java175
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetBaseConnector.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetConnector.java34
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/tabsheet/VTabsheet.java63
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/textarea/TextAreaConnector.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/textarea/TextAreaState.java36
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/textarea/VTextArea.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/textfield/AbstractTextFieldState.java61
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/textfield/TextFieldConnector.java8
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java18
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/tree/TreeConnector.java52
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/tree/VTree.java46
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/treetable/TreeTableConnector.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/treetable/VTreeTable.java45
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/twincolselect/TwinColSelectConnector.java5
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/twincolselect/VTwinColSelect.java6
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/upload/UploadConnector.java5
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/upload/VUpload.java13
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/video/VideoConnector.java5
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/video/VideoState.java20
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java16
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/window/WindowConnector.java13
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/window/WindowServerRpc.java10
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/window/WindowState.java73
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java203
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java250
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java403
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java121
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractStreamingEvent.java4
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java16
-rw-r--r--src/com/vaadin/terminal/gwt/server/ApplicationPortlet2.java6
-rw-r--r--src/com/vaadin/terminal/gwt/server/ApplicationResourceHandler.java1
-rw-r--r--src/com/vaadin/terminal/gwt/server/ApplicationServlet.java10
-rw-r--r--src/com/vaadin/terminal/gwt/server/BootstrapHandler.java54
-rw-r--r--src/com/vaadin/terminal/gwt/server/ChangeVariablesErrorEvent.java1
-rw-r--r--src/com/vaadin/terminal/gwt/server/ClientConnector.java14
-rw-r--r--src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java1
-rw-r--r--src/com/vaadin/terminal/gwt/server/CommunicationManager.java147
-rw-r--r--src/com/vaadin/terminal/gwt/server/Constants.java2
-rw-r--r--src/com/vaadin/terminal/gwt/server/DragAndDropService.java27
-rw-r--r--src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java24
-rw-r--r--src/com/vaadin/terminal/gwt/server/JsonCodec.java45
-rw-r--r--src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java69
-rw-r--r--src/com/vaadin/terminal/gwt/server/LegacyChangeVariablesInvocation.java2
-rw-r--r--src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java33
-rw-r--r--src/com/vaadin/terminal/gwt/server/PortletCommunicationManager.java139
-rw-r--r--src/com/vaadin/terminal/gwt/server/ResourceReference.java18
-rw-r--r--src/com/vaadin/terminal/gwt/server/RestrictedRenderResponse.java25
-rw-r--r--src/com/vaadin/terminal/gwt/server/ServerRpcManager.java3
-rw-r--r--src/com/vaadin/terminal/gwt/server/ServerRpcMethodInvocation.java4
-rw-r--r--src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java52
-rw-r--r--src/com/vaadin/terminal/gwt/server/StreamingErrorEventImpl.java1
-rw-r--r--src/com/vaadin/terminal/gwt/server/StreamingStartEventImpl.java1
-rw-r--r--src/com/vaadin/terminal/gwt/server/UnsupportedBrowserHandler.java1
-rw-r--r--src/com/vaadin/terminal/gwt/server/WebApplicationContext.java1
-rw-r--r--src/com/vaadin/terminal/gwt/server/WebBrowser.java5
-rw-r--r--src/com/vaadin/terminal/gwt/server/WrappedHttpServletRequest.java9
-rw-r--r--src/com/vaadin/terminal/gwt/server/WrappedHttpServletResponse.java2
-rw-r--r--src/com/vaadin/terminal/gwt/server/WrappedPortletRequest.java30
-rw-r--r--src/com/vaadin/terminal/gwt/server/WrappedPortletResponse.java9
-rw-r--r--src/com/vaadin/terminal/gwt/widgetsetutils/AcceptCriteriaFactoryGenerator.java2
-rw-r--r--src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java1
-rw-r--r--src/com/vaadin/terminal/gwt/widgetsetutils/CustomWidgetMapGenerator.java4
-rw-r--r--src/com/vaadin/terminal/gwt/widgetsetutils/EagerWidgetMapGenerator.java2
-rw-r--r--src/com/vaadin/terminal/gwt/widgetsetutils/GeneratedRpcMethodProviderGenerator.java2
-rw-r--r--src/com/vaadin/terminal/gwt/widgetsetutils/LazyWidgetMapGenerator.java2
-rw-r--r--src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyCreatorGenerator.java6
-rw-r--r--src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyGenerator.java4
-rw-r--r--src/com/vaadin/terminal/gwt/widgetsetutils/SerializerMapGenerator.java64
-rw-r--r--src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java6
280 files changed, 3916 insertions, 5075 deletions
diff --git a/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml b/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml
index 697bf992e9..278d92f38f 100644
--- a/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml
+++ b/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml
@@ -6,93 +6,8 @@
<!-- Hint for WidgetSetBuilder not to automatically update the file -->
<!-- WS Compiler: manually edited -->
- <inherits name="com.google.gwt.user.User" />
-
- <inherits name="com.google.gwt.http.HTTP" />
-
- <inherits name="com.google.gwt.json.JSON" />
-
- <inherits
- name="com.vaadin.terminal.gwt.DefaultWidgetSetBrowserSpecificOverrides" />
-
- <source path="client" />
-
- <!-- TODO only for development -->
- <replace-with class="com.vaadin.terminal.gwt.client.ui.VerticalBoxLayoutConnector">
- <when-type-is class="com.vaadin.terminal.gwt.client.ui.orderedlayout.VerticalLayoutConnector" />
- </replace-with>
- <replace-with class="com.vaadin.terminal.gwt.client.ui.HorizontalBoxLayoutConnector">
- <when-type-is class="com.vaadin.terminal.gwt.client.ui.orderedlayout.HorizontalLayoutConnector" />
- </replace-with>
-
- <!-- Use own Scheduler implementation to be able to track if commands are
- running -->
- <replace-with class="com.vaadin.terminal.gwt.client.VSchedulerImpl">
- <when-type-is class="com.google.gwt.core.client.impl.SchedulerImpl" />
- </replace-with>
-
-
- <!-- Generators for serializators for classes used in communication between
- server and client -->
- <generate-with
- class="com.vaadin.terminal.gwt.widgetsetutils.SerializerMapGenerator">
- <when-type-is
- class="com.vaadin.terminal.gwt.client.communication.SerializerMap" />
- </generate-with>
-
- <replace-with class="com.vaadin.terminal.gwt.client.VDebugConsole">
- <when-type-is class="com.vaadin.terminal.gwt.client.Console" />
- </replace-with>
-
- <generate-with
- class="com.vaadin.terminal.gwt.widgetsetutils.EagerWidgetMapGenerator">
- <when-type-is class="com.vaadin.terminal.gwt.client.WidgetMap" />
- </generate-with>
-
- <generate-with
- class="com.vaadin.terminal.gwt.widgetsetutils.AcceptCriteriaFactoryGenerator">
- <when-type-is
- class="com.vaadin.terminal.gwt.client.ui.dd.VAcceptCriterionFactory" />
- </generate-with>
-
- <!-- Generate client side proxies for client to server RPC interfaces -->
- <generate-with
- class="com.vaadin.terminal.gwt.widgetsetutils.RpcProxyGenerator">
- <when-type-assignable
- class="com.vaadin.terminal.gwt.client.communication.ServerRpc" />
- </generate-with>
-
- <!-- Generate client side proxies for client to server RPC interfaces -->
- <generate-with
- class="com.vaadin.terminal.gwt.widgetsetutils.RpcProxyCreatorGenerator">
- <when-type-assignable
- class="com.vaadin.terminal.gwt.client.communication.RpcProxy.RpcProxyCreator" />
- </generate-with>
-
- <!-- Generate client side RPC manager for server to client RPC -->
- <generate-with
- class="com.vaadin.terminal.gwt.widgetsetutils.GeneratedRpcMethodProviderGenerator">
- <when-type-assignable
- class="com.vaadin.terminal.gwt.client.communication.GeneratedRpcMethodProvider" />
- </generate-with>
-
- <generate-with
- class="com.vaadin.terminal.gwt.widgetsetutils.ConnectorWidgetFactoryGenerator">
- <when-type-assignable
- class="com.vaadin.terminal.gwt.client.ui.ConnectorWidgetFactory" />
- </generate-with>
-
- <generate-with
- class="com.vaadin.terminal.gwt.widgetsetutils.ConnectorStateFactoryGenerator">
- <when-type-assignable
- class="com.vaadin.terminal.gwt.client.ui.ConnectorStateFactory" />
- </generate-with>
+ <inherits name="com.vaadin.Vaadin" />
<entry-point class="com.vaadin.terminal.gwt.client.ApplicationConfiguration" />
- <!-- Use the new cross site linker to get a nocache.js without document.write -->
- <add-linker name="xsiframe" />
-
- <set-configuration-property name="devModeRedirectEnabled" value="true" />
-
</module>
diff --git a/src/com/vaadin/terminal/gwt/DefaultWidgetSetBrowserSpecificOverrides.gwt.xml b/src/com/vaadin/terminal/gwt/VaadinBrowserSpecificOverrides.gwt.xml
index b5ab61df64..b5ab61df64 100644
--- a/src/com/vaadin/terminal/gwt/DefaultWidgetSetBrowserSpecificOverrides.gwt.xml
+++ b/src/com/vaadin/terminal/gwt/VaadinBrowserSpecificOverrides.gwt.xml
diff --git a/src/com/vaadin/terminal/gwt/client/AbstractFieldState.java b/src/com/vaadin/terminal/gwt/client/AbstractFieldState.java
deleted file mode 100644
index 3a66a01f23..0000000000
--- a/src/com/vaadin/terminal/gwt/client/AbstractFieldState.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client;
-
-import com.vaadin.terminal.gwt.client.ui.TabIndexState;
-import com.vaadin.ui.AbstractField;
-
-/**
- * Shared state for {@link AbstractField}.
- *
- * @author Vaadin Ltd
- * @version @VERSION@
- * @since 7.0.0
- *
- */
-public class AbstractFieldState extends ComponentState implements TabIndexState {
- private boolean propertyReadOnly = false;
- private boolean hideErrors = false;
- private boolean required = false;
- private boolean modified = false;
-
- /**
- * The tab order number of this field.
- */
- private int tabIndex = 0;
-
- /**
- * Checks if the property data source for the Field is in read only mode.
- * This affects the read only state of the field itself.
- *
- * @return true if there is a property data source and it is set to read
- * only, false otherwise
- */
- public boolean isPropertyReadOnly() {
- return propertyReadOnly;
- }
-
- /**
- * Sets the read only state of the property data source.
- *
- * @param propertyReadOnly
- * true if the property data source if read only, false otherwise
- */
- public void setPropertyReadOnly(boolean propertyReadOnly) {
- this.propertyReadOnly = propertyReadOnly;
- }
-
- /**
- * Returns true if the component will hide any errors even if the error
- * message is set.
- *
- * @return true if error messages are disabled
- */
- public boolean isHideErrors() {
- return hideErrors;
- }
-
- /**
- * Sets whether the component should hide any errors even if the error
- * message is set.
- *
- * This is used e.g. on forms to hide error messages for invalid fields
- * before the first user actions.
- *
- * @param hideErrors
- * true if error messages should be hidden
- */
- public void setHideErrors(boolean hideErrors) {
- this.hideErrors = hideErrors;
- }
-
- /**
- * Is the field required. Required fields must filled by the user.
- *
- * See AbstractField#isRequired() for more information.
- *
- * @return <code>true</code> if the field is required, otherwise
- * <code>false</code>.
- */
- public boolean isRequired() {
- return required;
- }
-
- /**
- * Sets the field required. Required fields must filled by the user.
- *
- * See AbstractField#setRequired(boolean) for more information.
- *
- * @param required
- * Is the field required.
- */
- public void setRequired(boolean required) {
- this.required = required;
- }
-
- /**
- * Has the contents of the field been modified, i.e. has the value been
- * updated after it was read from the data source.
- *
- * @return true if the field has been modified, false otherwise
- */
- public boolean isModified() {
- return modified;
- }
-
- /**
- * Setter for the modified flag, toggled when the contents of the field is
- * modified by the user.
- *
- * @param modified
- * the new modified state
- *
- */
- public void setModified(boolean modified) {
- this.modified = modified;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.vaadin.terminal.gwt.client.ComponentState#getTabIndex()
- */
- public int getTabIndex() {
- return tabIndex;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.vaadin.terminal.gwt.client.ui.TabIndexState#setTabIndex(int)
- */
- public void setTabIndex(int tabIndex) {
- this.tabIndex = tabIndex;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
index 960b0a8b0e..71707e723a 100644
--- a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
+++ b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
@@ -23,6 +23,8 @@ import com.vaadin.terminal.gwt.client.ui.UnknownComponentConnector;
public class ApplicationConfiguration implements EntryPoint {
+ public static final String PORTLET_RESOUCE_URL_BASE = "portletAppURLBase";
+
/**
* Helper class for reading configuration options from the bootstap
* javascript
@@ -205,8 +207,6 @@ public class ApplicationConfiguration implements EntryPoint {
private ErrorMessage communicationError;
private ErrorMessage authorizationError;
private boolean useDebugIdInDom = true;
- private boolean usePortletURLs = false;
- private String portletUidlURLBase;
private HashMap<Integer, String> unknownComponents;
@@ -218,7 +218,7 @@ public class ApplicationConfiguration implements EntryPoint {
static// TODO consider to make this hashmap per application
LinkedList<Command> callbacks = new LinkedList<Command>();
- private static int widgetsLoading;
+ private static int dependenciesLoading;
private static ArrayList<ApplicationConnection> runningApplications = new ArrayList<ApplicationConnection>();
@@ -226,11 +226,12 @@ public class ApplicationConfiguration implements EntryPoint {
private Map<Integer, String> tagToServerSideClassName = new HashMap<Integer, String>();
public boolean usePortletURLs() {
- return usePortletURLs;
+ return getPortletResourceUrl() != null;
}
- public String getPortletUidlURLBase() {
- return portletUidlURLBase;
+ public String getPortletResourceUrl() {
+ return getJsoConfiguration(id)
+ .getConfigString(PORTLET_RESOUCE_URL_BASE);
}
public String getRootPanelId() {
@@ -319,12 +320,6 @@ public class ApplicationConfiguration implements EntryPoint {
useDebugIdInDom = jsoConfiguration.getConfigBoolean("useDebugIdInDom") != Boolean.FALSE;
// null -> false
- usePortletURLs = jsoConfiguration.getConfigBoolean("usePortletURLs") == Boolean.TRUE;
-
- portletUidlURLBase = jsoConfiguration
- .getConfigString("portletUidlURLBase");
-
- // null -> false
standalone = jsoConfiguration.getConfigBoolean("standalone") == Boolean.TRUE;
communicationError = jsoConfiguration.getConfigError("comErrMsg");
@@ -348,6 +343,7 @@ public class ApplicationConfiguration implements EntryPoint {
public static void startApplication(final String applicationId) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ @Override
public void execute() {
ApplicationConfiguration appConf = getConfigFromDOM(applicationId);
ApplicationConnection a = GWT
@@ -454,26 +450,26 @@ public class ApplicationConfiguration implements EntryPoint {
*
* @param c
*/
- static void runWhenWidgetsLoaded(Command c) {
- if (widgetsLoading == 0) {
+ static void runWhenDependenciesLoaded(Command c) {
+ if (dependenciesLoading == 0) {
c.execute();
} else {
callbacks.add(c);
}
}
- static void startWidgetLoading() {
- widgetsLoading++;
+ static void startDependencyLoading() {
+ dependenciesLoading++;
}
- static void endWidgetLoading() {
- widgetsLoading--;
- if (widgetsLoading == 0 && !callbacks.isEmpty()) {
+ static void endDependencyLoading() {
+ dependenciesLoading--;
+ if (dependenciesLoading == 0 && !callbacks.isEmpty()) {
for (Command cmd : callbacks) {
cmd.execute();
}
callbacks.clear();
- } else if (widgetsLoading == 0 && deferredWidgetLoader != null) {
+ } else if (dependenciesLoading == 0 && deferredWidgetLoader != null) {
deferredWidgetLoader.trigger();
}
@@ -534,7 +530,7 @@ public class ApplicationConfiguration implements EntryPoint {
}
private boolean isBusy() {
- if (widgetsLoading > 0) {
+ if (dependenciesLoading > 0) {
communicationFree = 0;
return true;
}
@@ -553,6 +549,7 @@ public class ApplicationConfiguration implements EntryPoint {
private static DeferredWidgetLoader deferredWidgetLoader;
+ @Override
public void onModuleLoad() {
// Prepare VConsole for debugging
@@ -571,6 +568,7 @@ public class ApplicationConfiguration implements EntryPoint {
*/
GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
+ @Override
public void onUncaughtException(Throwable e) {
/*
* Note in case of null console (without ?debug) we eat
@@ -581,6 +579,11 @@ public class ApplicationConfiguration implements EntryPoint {
}
});
+ if (SuperDevMode.enableBasedOnParameter()) {
+ // Do not start any application as super dev mode will refresh the
+ // page once done compiling
+ return;
+ }
registerCallback(GWT.getModuleName());
deferredWidgetLoader = new DeferredWidgetLoader();
}
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
index f0470c8ee8..fb7af1404c 100644
--- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
+++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
@@ -27,6 +27,7 @@ import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
+import com.google.gwt.http.client.URL;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
@@ -35,21 +36,23 @@ import com.google.gwt.regexp.shared.RegExp;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.communication.MethodInvocation;
+import com.vaadin.shared.communication.SharedState;
+import com.vaadin.shared.communication.UidlValue;
import com.vaadin.terminal.gwt.client.ApplicationConfiguration.ErrorMessage;
+import com.vaadin.terminal.gwt.client.ResourceLoader.ResourceLoadEvent;
+import com.vaadin.terminal.gwt.client.ResourceLoader.ResourceLoadListener;
import com.vaadin.terminal.gwt.client.communication.HasJavaScriptConnectorHelper;
import com.vaadin.terminal.gwt.client.communication.JsonDecoder;
import com.vaadin.terminal.gwt.client.communication.JsonEncoder;
-import com.vaadin.terminal.gwt.client.communication.MethodInvocation;
import com.vaadin.terminal.gwt.client.communication.RpcManager;
import com.vaadin.terminal.gwt.client.communication.SerializerMap;
-import com.vaadin.terminal.gwt.client.communication.SharedState;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.communication.Type;
-import com.vaadin.terminal.gwt.client.communication.UidlValue;
import com.vaadin.terminal.gwt.client.extensions.AbstractExtensionConnector;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
import com.vaadin.terminal.gwt.client.ui.VContextMenu;
@@ -75,6 +78,19 @@ import com.vaadin.terminal.gwt.server.AbstractCommunicationManager;
* Entry point classes (widgetsets) define <code>onModuleLoad()</code>.
*/
public class ApplicationConnection {
+ public static final String APP_REQUEST_PATH = "APP/";
+
+ public static final String UIDL_REQUEST_PATH = "UIDL/";
+
+ public static final String APP_PROTOCOL_PREFIX = "app://";
+
+ public static final String V_RESOURCE_PATH = "v-resourcePath";
+
+ public static final String CONNECTOR_PROTOCOL_PREFIX = "connector://";
+
+ public static final String CONNECTOR_RESOURCE_PREFIX = APP_REQUEST_PATH
+ + "CONNECTOR";
+
// This indicates the whole page is generated by us (not embedded)
public static final String GENERATED_BODY_CLASSNAME = "v-generated-body";
@@ -131,7 +147,7 @@ public class ApplicationConnection {
*/
public static final String UIDL_REFRESH_TOKEN = "Vaadin-Refresh";
- private final boolean debugLogging = false;
+ private final boolean debugLogging = true || false;
// will hold the UIDL security key (for XSS protection) once received
private String uidlSecurityKey = "init";
@@ -506,12 +522,7 @@ public class ApplicationConnection {
final String payload = uidlSecurityKey + VAR_BURST_SEPARATOR
+ requestData;
VConsole.log("Making UIDL Request with params: " + payload);
- String uri;
- if (configuration.usePortletURLs()) {
- uri = configuration.getPortletUidlURLBase();
- } else {
- uri = getAppUri() + "UIDL";
- }
+ String uri = translateVaadinUri(APP_PROTOCOL_PREFIX + UIDL_REQUEST_PATH);
if (extraParams != null && extraParams.length() > 0) {
uri = addGetParameters(uri, extraParams);
@@ -538,11 +549,13 @@ public class ApplicationConnection {
final boolean synchronous) {
if (!synchronous) {
RequestCallback requestCallback = new RequestCallback() {
+ @Override
public void onError(Request request, Throwable exception) {
showCommunicationError(exception.getMessage(), -1);
endRequest();
}
+ @Override
public void onResponseReceived(Request request,
Response response) {
VConsole.log("Server visit took "
@@ -868,6 +881,7 @@ public class ApplicationConnection {
}
// deferring to avoid flickering
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
if (!hasActiveRequest()) {
hideLoadingIndicator();
@@ -1067,6 +1081,14 @@ public class ApplicationConnection {
json.getValueMap("typeMappings"), widgetSet);
}
+ VConsole.log("Handling resource dependencies");
+ if (json.containsKey("scriptDependencies")) {
+ loadScriptDependencies(json.getJSStringArray("scriptDependencies"));
+ }
+ if (json.containsKey("styleDependencies")) {
+ loadStyleDependencies(json.getJSStringArray("styleDependencies"));
+ }
+
handleUIDLDuration.logDuration(
" * Handling type mappings from server completed", 10);
/*
@@ -1077,6 +1099,7 @@ public class ApplicationConnection {
}
Command c = new Command() {
+ @Override
public void execute() {
handleUIDLDuration.logDuration(" * Loading widgets completed",
10);
@@ -1608,7 +1631,72 @@ public class ApplicationConnection {
}
};
- ApplicationConfiguration.runWhenWidgetsLoaded(c);
+ ApplicationConfiguration.runWhenDependenciesLoaded(c);
+ }
+
+ private void loadStyleDependencies(JsArrayString dependencies) {
+ // Assuming no reason to interpret in a defined order
+ ResourceLoadListener resourceLoadListener = new ResourceLoadListener() {
+ @Override
+ public void onLoad(ResourceLoadEvent event) {
+ ApplicationConfiguration.endDependencyLoading();
+ }
+
+ @Override
+ public void onError(ResourceLoadEvent event) {
+ VConsole.error(event.getResourceUrl()
+ + " could not be loaded, or the load detection failed because the stylesheet is empty.");
+ // The show must go on
+ onLoad(event);
+ }
+ };
+ ResourceLoader loader = ResourceLoader.get();
+ for (int i = 0; i < dependencies.length(); i++) {
+ String url = translateVaadinUri(dependencies.get(i));
+ ApplicationConfiguration.startDependencyLoading();
+ loader.loadStylesheet(url, resourceLoadListener);
+ }
+ }
+
+ private void loadScriptDependencies(final JsArrayString dependencies) {
+ if (dependencies.length() == 0) {
+ return;
+ }
+
+ // Listener that loads the next when one is completed
+ ResourceLoadListener resourceLoadListener = new ResourceLoadListener() {
+ @Override
+ public void onLoad(ResourceLoadEvent event) {
+ if (dependencies.length() != 0) {
+ String url = translateVaadinUri(dependencies.shift());
+ ApplicationConfiguration.startDependencyLoading();
+ // Load next in chain (hopefully already preloaded)
+ event.getResourceLoader().loadScript(url, this);
+ }
+ // Call start for next before calling end for current
+ ApplicationConfiguration.endDependencyLoading();
+ }
+
+ @Override
+ public void onError(ResourceLoadEvent event) {
+ VConsole.error(event.getResourceUrl() + " could not be loaded.");
+ // The show must go on
+ onLoad(event);
+ }
+ };
+
+ ResourceLoader loader = ResourceLoader.get();
+
+ // Start chain by loading first
+ String url = translateVaadinUri(dependencies.shift());
+ ApplicationConfiguration.startDependencyLoading();
+ loader.loadScript(url, resourceLoadListener);
+
+ // Preload all remaining
+ for (int i = 0; i < dependencies.length(); i++) {
+ String preloadUrl = translateVaadinUri(dependencies.get(i));
+ loader.preloadResource(preloadUrl, null);
+ }
}
// Redirect browser, null reloads current page
@@ -1669,6 +1757,7 @@ public class ApplicationConnection {
}
private final ScheduledCommand sendPendingCommand = new ScheduledCommand() {
+ @Override
public void execute() {
deferedSendPending = false;
doSendPendingVariableChanges();
@@ -2214,8 +2303,42 @@ public class ApplicationConnection {
}
uidlUri = themeUri + uidlUri.substring(7);
}
- if (uidlUri.startsWith("app://")) {
- uidlUri = getAppUri() + uidlUri.substring(6);
+
+ if (uidlUri.startsWith(CONNECTOR_PROTOCOL_PREFIX)) {
+ // getAppUri *should* always end with /
+ // substring *should* always start with / (connector:///foo.bar
+ // without connector://)
+ uidlUri = APP_PROTOCOL_PREFIX + CONNECTOR_RESOURCE_PREFIX
+ + uidlUri.substring(CONNECTOR_PROTOCOL_PREFIX.length());
+ // Let translation of app:// urls take care of the rest
+ }
+ if (uidlUri.startsWith(APP_PROTOCOL_PREFIX)) {
+ String relativeUrl = uidlUri
+ .substring(APP_PROTOCOL_PREFIX.length());
+ if (getConfiguration().usePortletURLs()) {
+ // Should put path in v-resourcePath parameter and append query
+ // params to base portlet url
+ String[] parts = relativeUrl.split("\\?", 2);
+ String path = parts[0];
+
+ String url = getConfiguration().getPortletResourceUrl();
+
+ // If there's a "?" followed by something, append it as a query
+ // string to the base URL
+ if (parts.length > 1) {
+ String appUrlParams = parts[1];
+ url = addGetParameters(url, appUrlParams);
+ }
+ if (!path.startsWith("/")) {
+ path = '/' + path;
+ }
+ String pathParam = V_RESOURCE_PATH + "="
+ + URL.encodeQueryString(path);
+ url = addGetParameters(url, pathParam);
+ uidlUri = url;
+ } else {
+ uidlUri = getAppUri() + relativeUrl;
+ }
}
return uidlUri;
}
@@ -2242,6 +2365,7 @@ public class ApplicationConnection {
this.url = url;
}
+ @Override
public void notificationHidden(HideEvent event) {
redirect(url);
}
@@ -2250,57 +2374,8 @@ public class ApplicationConnection {
/* Extended title handling */
- /**
- * Data showed in tooltips are stored centrilized as it may be needed in
- * varios place: caption, layouts, and in owner components themselves.
- *
- * Updating TooltipInfo is done in updateComponent method.
- *
- */
- public TooltipInfo getTooltipTitleInfo(ComponentConnector titleOwner,
- Object key) {
- if (null == titleOwner) {
- return null;
- }
- return connectorMap.getTooltipInfo(titleOwner, key);
- }
-
private final VTooltip tooltip = new VTooltip(this);
- /**
- * Component may want to delegate Tooltip handling to client. Layouts add
- * Tooltip (description, errors) to caption, but some components may want
- * them to appear one other elements too.
- *
- * Events wanted by this handler are same as in Tooltip.TOOLTIP_EVENTS
- *
- * @param event
- * @param owner
- */
- public void handleTooltipEvent(Event event, ComponentConnector owner) {
- tooltip.handleTooltipEvent(event, owner, null);
-
- }
-
- /**
- * Component may want to delegate Tooltip handling to client. Layouts add
- * Tooltip (description, errors) to caption, but some components may want
- * them to appear one other elements too.
- *
- * Events wanted by this handler are same as in Tooltip.TOOLTIP_EVENTS
- *
- * @param event
- * @param owner
- * @param key
- * the key for tooltip if this is "additional" tooltip, null for
- * components "main tooltip"
- */
- public void handleTooltipEvent(Event event, ComponentConnector owner,
- Object key) {
- tooltip.handleTooltipEvent(event, owner, key);
-
- }
-
private ConnectorMap connectorMap = GWT.create(ConnectorMap.class);
protected String getUidlSecurityKey() {
@@ -2328,34 +2403,6 @@ public class ApplicationConnection {
}
/**
- * If component has several tooltips in addition to the one provided by
- * {@link com.vaadin.ui.AbstractComponent}, component can register them with
- * this method.
- * <p>
- * Component must also pipe events to
- * {@link #handleTooltipEvent(Event, ComponentConnector, Object)} method.
- * <p>
- * This method can also be used to deregister tooltips by using null as
- * tooltip
- *
- * @param paintable
- * Paintable "owning" this tooltip
- * @param key
- * key assosiated with given tooltip. Can be any object. For
- * example a related dom element. Same key must be given for
- * {@link #handleTooltipEvent(Event, ComponentConnector, Object)}
- * method.
- *
- * @param tooltip
- * the TooltipInfo object containing details shown in tooltip,
- * null if deregistering tooltip
- */
- public void registerTooltip(ComponentConnector paintable, Object key,
- TooltipInfo tooltip) {
- connectorMap.registerTooltip(paintable, key, tooltip);
- }
-
- /**
* Gets the {@link ApplicationConfiguration} for the current application.
*
* @see ApplicationConfiguration
@@ -2437,15 +2484,15 @@ public class ApplicationConnection {
// connectorMap.unregisterConnector(p);
}
+ /**
+ * Get VTooltip instance related to application connection
+ *
+ * @return VTooltip instance
+ */
public VTooltip getVTooltip() {
return tooltip;
}
- @Deprecated
- public void handleTooltipEvent(Event event, Widget owner, Object key) {
- handleTooltipEvent(event, getConnectorMap().getConnector(owner), key);
- }
-
/**
* Method provided for backwards compatibility. Duties previously done by
* this method is now handled by the state change event handler in
@@ -2474,17 +2521,6 @@ public class ApplicationConnection {
}
@Deprecated
- public void handleTooltipEvent(Event event, Widget owner) {
- handleTooltipEvent(event, getConnectorMap().getConnector(owner));
-
- }
-
- @Deprecated
- public void registerTooltip(Widget owner, Object key, TooltipInfo info) {
- registerTooltip(getConnectorMap().getConnector(owner), key, info);
- }
-
- @Deprecated
public boolean hasEventListeners(Widget widget, String eventIdentifier) {
return hasEventListeners(getConnectorMap().getConnector(widget),
eventIdentifier);
diff --git a/src/com/vaadin/terminal/gwt/client/BrowserInfo.java b/src/com/vaadin/terminal/gwt/client/BrowserInfo.java
index 82cf925ec1..32bb0b8eed 100644
--- a/src/com/vaadin/terminal/gwt/client/BrowserInfo.java
+++ b/src/com/vaadin/terminal/gwt/client/BrowserInfo.java
@@ -5,6 +5,7 @@
package com.vaadin.terminal.gwt.client;
import com.google.gwt.user.client.ui.RootPanel;
+import com.vaadin.shared.VBrowserDetails;
/**
* Class used to query information about web browser.
diff --git a/src/com/vaadin/terminal/gwt/client/ComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ComponentConnector.java
index 4e6a690a3c..e57a188b47 100644
--- a/src/com/vaadin/terminal/gwt/client/ComponentConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ComponentConnector.java
@@ -4,7 +4,9 @@
package com.vaadin.terminal.gwt.client;
+import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ComponentState;
/**
* An interface used by client-side widgets or paintable parts to receive
@@ -21,6 +23,7 @@ public interface ComponentConnector extends ServerConnector {
*
* @see com.vaadin.terminal.gwt.client.VPaintable#getState()
*/
+ @Override
public ComponentState getState();
/**
@@ -104,4 +107,14 @@ public interface ComponentConnector extends ServerConnector {
*/
public void setWidgetEnabled(boolean widgetEnabled);
+ /**
+ * Gets the tooltip info for the given element.
+ *
+ * @param element
+ * The element to lookup a tooltip for
+ * @return The tooltip for the element or null if no tooltip is defined for
+ * this element.
+ */
+ public TooltipInfo getTooltipInfo(Element element);
+
}
diff --git a/src/com/vaadin/terminal/gwt/client/ComponentLocator.java b/src/com/vaadin/terminal/gwt/client/ComponentLocator.java
index 0e7a0c1d1c..8df9dc41b9 100644
--- a/src/com/vaadin/terminal/gwt/client/ComponentLocator.java
+++ b/src/com/vaadin/terminal/gwt/client/ComponentLocator.java
@@ -12,7 +12,9 @@ import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.communication.SharedState;
+import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.Connector;
+import com.vaadin.shared.communication.SharedState;
import com.vaadin.terminal.gwt.client.ui.SubPartAware;
import com.vaadin.terminal.gwt.client.ui.VBoxLayout;
import com.vaadin.terminal.gwt.client.ui.gridlayout.VGridLayout;
diff --git a/src/com/vaadin/terminal/gwt/client/ComponentState.java b/src/com/vaadin/terminal/gwt/client/ComponentState.java
deleted file mode 100644
index a603368f44..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ComponentState.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import com.vaadin.terminal.gwt.client.communication.SharedState;
-import com.vaadin.terminal.gwt.client.communication.URLReference;
-import com.vaadin.ui.Component;
-
-/**
- * Default shared state implementation for UI components.
- *
- * State classes of concrete components should extend this class.
- *
- * @since 7.0
- */
-public class ComponentState extends SharedState {
- private String height = "";
- private String width = "";
- private boolean readOnly = false;
- private boolean immediate = false;
- private String description = "";
- // Note: for the caption, there is a difference between null and an empty
- // string!
- private String caption = null;
- private boolean visible = true;
- private URLReference icon = null;
- private List<String> styles = null;
- private String debugId = null;
- /**
- * A set of event identifiers with registered listeners.
- */
- private Set<String> registeredEventListeners = null;
-
- // HTML formatted error message for the component
- // TODO this could be an object with more information, but currently the UI
- // only uses the message
- private String errorMessage = null;
-
- /**
- * Returns the component height as set by the server.
- *
- * Can be relative (containing the percent sign) or absolute, or empty
- * string for undefined height.
- *
- * @return component height as defined by the server, not null
- */
- public String getHeight() {
- if (height == null) {
- return "";
- }
- return height;
- }
-
- /**
- * Sets the height of the component in the server format.
- *
- * Can be relative (containing the percent sign) or absolute, or null or
- * empty string for undefined height.
- *
- * @param height
- * component height
- */
- public void setHeight(String height) {
- this.height = height;
- }
-
- /**
- * Returns true if the component height is undefined, false if defined
- * (absolute or relative).
- *
- * @return true if component height is undefined
- */
- public boolean isUndefinedHeight() {
- return "".equals(getHeight());
- }
-
- /**
- * Returns true if the component height is relative to the parent, i.e.
- * percentage, false if it is fixed/auto.
- *
- * @return true if component height is relative (percentage)
- */
- public boolean isRelativeHeight() {
- return getHeight().endsWith("%");
- }
-
- /**
- * Returns the component width as set by the server.
- *
- * Can be relative (containing the percent sign) or absolute, or empty
- * string for undefined height.
- *
- * @return component width as defined by the server, not null
- */
- public String getWidth() {
- if (width == null) {
- return "";
- }
- return width;
- }
-
- /**
- * Sets the width of the component in the server format.
- *
- * Can be relative (containing the percent sign) or absolute, or null or
- * empty string for undefined width.
- *
- * @param width
- * component width
- */
- public void setWidth(String width) {
- this.width = width;
- }
-
- /**
- * Returns true if the component width is undefined, false if defined
- * (absolute or relative).
- *
- * @return true if component width is undefined
- */
- public boolean isUndefinedWidth() {
- return "".equals(getWidth());
- }
-
- /**
- * Returns true if the component width is relative to the parent, i.e.
- * percentage, false if it is fixed/auto.
- *
- * @return true if component width is relative (percentage)
- */
- public boolean isRelativeWidth() {
- return getWidth().endsWith("%");
- }
-
- /**
- * Returns true if the component is in read-only mode.
- *
- * @see com.vaadin.ui.Component#isReadOnly()
- *
- * @return true if the component is in read-only mode
- */
- public boolean isReadOnly() {
- return readOnly;
- }
-
- /**
- * Sets or resets the read-only mode for a component.
- *
- * @see com.vaadin.ui.Component#setReadOnly()
- *
- * @param readOnly
- * new mode for the component
- */
- public void setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
- }
-
- /**
- * Returns true if the component is in immediate mode.
- *
- * @see com.vaadin.terminal.VariableOwner#isImmediate()
- *
- * @return true if the component is in immediate mode
- */
- public boolean isImmediate() {
- return immediate;
- }
-
- /**
- * Sets or resets the immediate mode for a component.
- *
- * @see com.vaadin.terminal.VariableOwner#setImmediate()
- *
- * @param immediate
- * new mode for the component
- */
- public void setImmediate(boolean immediate) {
- this.immediate = immediate;
- }
-
- /**
- * Returns true if the component has user-defined styles.
- *
- * @return true if the component has user-defined styles
- */
- public boolean hasStyles() {
- return styles != null && !styles.isEmpty();
- }
-
- /**
- * Gets the description of the component (typically shown as tooltip).
- *
- * @see com.vaadin.ui.AbstractComponent#getDescription()
- *
- * @return component description (not null, can be empty string)
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description of the component (typically shown as tooltip).
- *
- * @see com.vaadin.ui.AbstractComponent#setDescription(String)
- *
- * @param description
- * new component description (can be null)
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns true if the component has a description.
- *
- * @return true if the component has a description
- */
- public boolean hasDescription() {
- return getDescription() != null && !"".equals(getDescription());
- }
-
- /**
- * Gets the caption of the component (typically shown by the containing
- * layout).
- *
- * @see com.vaadin.ui.Component#getCaption()
- *
- * @return component caption - can be null (no caption) or empty string
- * (reserve space for an empty caption)
- */
- public String getCaption() {
- return caption;
- }
-
- /**
- * Sets the caption of the component (typically shown by the containing
- * layout).
- *
- * @see com.vaadin.ui.Component#setCaption(String)
- *
- * @param caption
- * new component caption - can be null (no caption) or empty
- * string (reserve space for an empty caption)
- */
- public void setCaption(String caption) {
- this.caption = caption;
- }
-
- /**
- * Returns the visibility state of the component. Note that this state is
- * related to the component only, not its parent. This might differ from
- * what {@link Component#isVisible()} returns as this takes the hierarchy
- * into account.
- *
- * @return The visibility state.
- */
- public boolean isVisible() {
- return visible;
- }
-
- /**
- * Sets the visibility state of the component.
- *
- * @param visible
- * The new visibility state.
- */
- public void setVisible(boolean visible) {
- this.visible = visible;
- }
-
- public URLReference getIcon() {
- return icon;
- }
-
- public void setIcon(URLReference icon) {
- this.icon = icon;
- }
-
- /**
- * Gets the style names for the component.
- *
- * @return A List of style names or null if no styles have been set.
- */
- public List<String> getStyles() {
- return styles;
- }
-
- /**
- * Sets the style names for the component.
- *
- * @param styles
- * A list containing style names
- */
- public void setStyles(List<String> styles) {
- this.styles = styles;
- }
-
- /**
- * Gets the debug id for the component. The debugId is added as DOM id for
- * the component.
- *
- * @return The debug id for the component or null if not set
- */
- public String getDebugId() {
- return debugId;
- }
-
- /**
- * Sets the debug id for the component. The debugId is added as DOM id for
- * the component.
- *
- * @param debugId
- * The new debugId for the component or null for no debug id
- *
- */
- public void setDebugId(String debugId) {
- this.debugId = debugId;
- }
-
- /**
- * Gets the identifiers for the event listeners that have been registered
- * for the component (using an event id)
- *
- * @return A set of event identifiers or null if no identifiers have been
- * registered
- */
- public Set<String> getRegisteredEventListeners() {
- return registeredEventListeners;
- }
-
- /**
- * Sets the identifiers for the event listeners that have been registered
- * for the component (using an event id)
- *
- * @param registeredEventListeners
- * The new set of identifiers or null if no identifiers have been
- * registered
- */
- public void setRegisteredEventListeners(Set<String> registeredEventListeners) {
- this.registeredEventListeners = registeredEventListeners;
- }
-
- /**
- * Adds an event listener id.
- *
- * @param eventListenerId
- * The event identifier to add
- */
- public void addRegisteredEventListener(String eventListenerId) {
- if (registeredEventListeners == null) {
- registeredEventListeners = new HashSet<String>();
- }
- registeredEventListeners.add(eventListenerId);
-
- }
-
- /**
- * Removes an event listener id.
- *
- * @param eventListenerId
- * The event identifier to remove
- */
- public void removeRegisteredEventListener(String eventIdentifier) {
- if (registeredEventListeners == null) {
- return;
- }
- registeredEventListeners.remove(eventIdentifier);
- if (registeredEventListeners.size() == 0) {
- registeredEventListeners = null;
- }
- }
-
- /**
- * Returns the current error message for the component.
- *
- * @return HTML formatted error message to show for the component or null if
- * none
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets the current error message for the component.
- *
- * TODO this could use an object with more details about the error
- *
- * @param errorMessage
- * HTML formatted error message to show for the component or null
- * for none
- */
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/Connector.java b/src/com/vaadin/terminal/gwt/client/Connector.java
deleted file mode 100644
index 9b2fcf61f1..0000000000
--- a/src/com/vaadin/terminal/gwt/client/Connector.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client;
-
-import java.io.Serializable;
-
-import com.vaadin.terminal.gwt.client.communication.SharedState;
-import com.vaadin.terminal.gwt.server.ClientConnector;
-
-/**
- * Interface implemented by all classes that are capable of communicating with
- * the server or the client side.
- * <p>
- * A connector consists of a shared state (server sets the state and
- * automatically communicates changes to the client) and the possibility to do
- * RPC calls either from the server to the client or from the client to the
- * server.
- * </p>
- * <p>
- * No classes should implement this interface directly, client side classes
- * wanting to communicate with server side should implement
- * {@link ServerConnector} and server side classes should implement
- * {@link ClientConnector}.
- * </p>
- *
- * @author Vaadin Ltd
- * @version @VERSION@
- * @since 7.0.0
- */
-public interface Connector extends Serializable {
- /**
- * Gets the current shared state of the connector.
- *
- * @since 7.0.
- * @return state The shared state object. Can be any sub type of
- * {@link SharedState}. Never null.
- */
- public SharedState getState();
-
- /**
- * Returns the id for this connector. This is set by the framework and does
- * not change during the lifetime of a connector.
- *
- * @return The id for the connector.
- */
- public String getConnectorId();
-
- /**
- * Gets the parent connector of this connector, or <code>null</code> if the
- * connector is not attached to any parent.
- *
- * @return the parent connector, or <code>null</code> if there is no parent.
- */
- public Connector getParent();
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ConnectorMap.java b/src/com/vaadin/terminal/gwt/client/ConnectorMap.java
index efb50b5e00..8bc4a4aacf 100644
--- a/src/com/vaadin/terminal/gwt/client/ConnectorMap.java
+++ b/src/com/vaadin/terminal/gwt/client/ConnectorMap.java
@@ -200,49 +200,11 @@ public class ConnectorMap {
return idToConnector.size();
}
- /**
- * FIXME: Should be moved to VAbstractPaintableWidget
- *
- * @param paintable
- * @return
- */
- @Deprecated
- public TooltipInfo getTooltipInfo(ComponentConnector paintable, Object key) {
- ComponentDetail componentDetail = getComponentDetail(paintable);
- if (componentDetail == null) {
- return null;
- }
- return componentDetail.getTooltipInfo(key);
- }
-
- @Deprecated
- public TooltipInfo getWidgetTooltipInfo(Widget widget, Object key) {
- ComponentConnector connector = getConnector(widget);
- if (connector == null) {
- return null;
- }
- return getTooltipInfo(connector, key);
- }
-
public Collection<? extends ServerConnector> getConnectors() {
return Collections.unmodifiableCollection(idToConnector.values());
}
/**
- * FIXME: Should not be here
- *
- * @param componentConnector
- * @return
- */
- @Deprecated
- public void registerTooltip(ComponentConnector componentConnector,
- Object key, TooltipInfo tooltip) {
- getComponentDetail(componentConnector).putAdditionalTooltip(key,
- tooltip);
-
- }
-
- /**
* Tests if the widget is the root widget of a {@link ComponentConnector}.
*
* @param widget
diff --git a/src/com/vaadin/terminal/gwt/client/EventHelper.java b/src/com/vaadin/terminal/gwt/client/EventHelper.java
index 95f5125f1b..208768a0c1 100644
--- a/src/com/vaadin/terminal/gwt/client/EventHelper.java
+++ b/src/com/vaadin/terminal/gwt/client/EventHelper.java
@@ -3,8 +3,8 @@
*/
package com.vaadin.terminal.gwt.client;
-import static com.vaadin.terminal.gwt.client.EventId.BLUR;
-import static com.vaadin.terminal.gwt.client.EventId.FOCUS;
+import static com.vaadin.shared.EventId.BLUR;
+import static com.vaadin.shared.EventId.FOCUS;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
diff --git a/src/com/vaadin/terminal/gwt/client/EventId.java b/src/com/vaadin/terminal/gwt/client/EventId.java
deleted file mode 100644
index d3ef2e4e7e..0000000000
--- a/src/com/vaadin/terminal/gwt/client/EventId.java
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client;
-
-public interface EventId {
- public static final String BLUR = "blur";
- public static final String FOCUS = "focus";
-}
diff --git a/src/com/vaadin/terminal/gwt/client/JavaScriptConnectorHelper.java b/src/com/vaadin/terminal/gwt/client/JavaScriptConnectorHelper.java
index bd62a759cb..69b8e00603 100644
--- a/src/com/vaadin/terminal/gwt/client/JavaScriptConnectorHelper.java
+++ b/src/com/vaadin/terminal/gwt/client/JavaScriptConnectorHelper.java
@@ -15,18 +15,13 @@ import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.user.client.Element;
-import com.vaadin.terminal.gwt.client.communication.MethodInvocation;
+import com.vaadin.shared.JavaScriptConnectorState;
+import com.vaadin.shared.communication.MethodInvocation;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent.StateChangeHandler;
public class JavaScriptConnectorHelper {
- public interface JavaScriptConnectorState {
- public Set<String> getCallbackNames();
-
- public Map<String, Set<String>> getRpcInterfaces();
- }
-
private final ServerConnector connector;
private final JavaScriptObject nativeState = JavaScriptObject
.createObject();
@@ -49,6 +44,7 @@ public class JavaScriptConnectorHelper {
public void init() {
connector.addStateChangeHandler(new StateChangeHandler() {
+ @Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
JavaScriptObject wrapper = getConnectorWrapper();
JavaScriptConnectorState state = getConnectorState();
@@ -149,8 +145,9 @@ public class JavaScriptConnectorHelper {
private JavaScriptObject getConnectorWrapper() {
if (connectorWrapper == null) {
- connectorWrapper = createConnectorWrapper(this, nativeState,
- rpcMap, connector.getConnectorId(), rpcObjects);
+ connectorWrapper = createConnectorWrapper(this,
+ connector.getConnection(), nativeState, rpcMap,
+ connector.getConnectorId(), rpcObjects);
}
return connectorWrapper;
@@ -165,9 +162,9 @@ public class JavaScriptConnectorHelper {
}-*/;
private static native JavaScriptObject createConnectorWrapper(
- JavaScriptConnectorHelper h, JavaScriptObject nativeState,
- JavaScriptObject registeredRpc, String connectorId,
- Map<String, JavaScriptObject> rpcObjects)
+ JavaScriptConnectorHelper h, ApplicationConnection c,
+ JavaScriptObject nativeState, JavaScriptObject registeredRpc,
+ String connectorId, Map<String, JavaScriptObject> rpcObjects)
/*-{
return {
'getConnectorId': function() {
@@ -185,7 +182,7 @@ public class JavaScriptConnectorHelper {
}
return rpcObjects.@java.util.Map::get(Ljava/lang/Object;)(iface);
}),
- 'getWidgetElement': $entry(function(connectorId) {
+ 'getElement': $entry(function(connectorId) {
return h.@com.vaadin.terminal.gwt.client.JavaScriptConnectorHelper::getWidgetElement(Ljava/lang/String;)(connectorId);
}),
'registerRpc': function(iface, rpcHandler) {
@@ -199,6 +196,9 @@ public class JavaScriptConnectorHelper {
}
registeredRpc[iface].push(rpcHandler);
},
+ 'translateVaadinUri': $entry(function(uri) {
+ return c.@com.vaadin.terminal.gwt.client.ApplicationConnection::translateVaadinUri(Ljava/lang/String;)(uri);
+ }),
};
}-*/;
@@ -238,8 +238,8 @@ public class JavaScriptConnectorHelper {
return connector;
}
- return ConnectorMap.get(connector.getConnection())
- .getConnector(connectorId);
+ return ConnectorMap.get(connector.getConnection()).getConnector(
+ connectorId);
}
private void fireRpc(String iface, String method,
@@ -331,9 +331,9 @@ public class JavaScriptConnectorHelper {
invokeCallback(getConnectorWrapper(), callbackName, arguments);
} else {
JavaScriptObject arguments = parametersJson.getJavaScriptObject();
- invokeJsRpc(rpcMap, iface, method, arguments);
+ invokeJsRpc(rpcMap, iface, method, arguments, getConnectorWrapper());
// Also invoke wildcard interface
- invokeJsRpc(rpcMap, "", method, arguments);
+ invokeJsRpc(rpcMap, "", method, arguments, getConnectorWrapper());
}
}
@@ -344,7 +344,8 @@ public class JavaScriptConnectorHelper {
}-*/;
private static native void invokeJsRpc(JavaScriptObject rpcMap,
- String interfaceName, String methodName, JavaScriptObject parameters)
+ String interfaceName, String methodName,
+ JavaScriptObject parameters, JavaScriptObject connector)
/*-{
var targets = rpcMap[interfaceName];
if (!targets) {
@@ -352,7 +353,7 @@ public class JavaScriptConnectorHelper {
}
for(var i = 0; i < targets.length; i++) {
var target = targets[i];
- target[methodName].apply(target, parameters);
+ target[methodName].apply(connector, parameters);
}
}-*/;
diff --git a/src/com/vaadin/terminal/gwt/client/JavaScriptExtension.java b/src/com/vaadin/terminal/gwt/client/JavaScriptExtension.java
index 2a97e4a770..a2170b9ab9 100644
--- a/src/com/vaadin/terminal/gwt/client/JavaScriptExtension.java
+++ b/src/com/vaadin/terminal/gwt/client/JavaScriptExtension.java
@@ -4,10 +4,11 @@
package com.vaadin.terminal.gwt.client;
+import com.vaadin.shared.JavaScriptExtensionState;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.AbstractJavaScriptExtension;
import com.vaadin.terminal.gwt.client.communication.HasJavaScriptConnectorHelper;
import com.vaadin.terminal.gwt.client.extensions.AbstractExtensionConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
@Connect(AbstractJavaScriptExtension.class)
public final class JavaScriptExtension extends AbstractExtensionConnector
@@ -21,6 +22,7 @@ public final class JavaScriptExtension extends AbstractExtensionConnector
helper.init();
}
+ @Override
public JavaScriptConnectorHelper getJavascriptConnectorHelper() {
return helper;
}
diff --git a/src/com/vaadin/terminal/gwt/client/JavaScriptExtensionState.java b/src/com/vaadin/terminal/gwt/client/JavaScriptExtensionState.java
deleted file mode 100644
index e7bfbc4bb2..0000000000
--- a/src/com/vaadin/terminal/gwt/client/JavaScriptExtensionState.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import com.vaadin.terminal.gwt.client.JavaScriptConnectorHelper.JavaScriptConnectorState;
-import com.vaadin.terminal.gwt.client.communication.SharedState;
-
-public class JavaScriptExtensionState extends SharedState implements
- JavaScriptConnectorState {
-
- private Set<String> callbackNames = new HashSet<String>();
- private Map<String, Set<String>> rpcInterfaces = new HashMap<String, Set<String>>();
-
- public Set<String> getCallbackNames() {
- return callbackNames;
- }
-
- public void setCallbackNames(Set<String> callbackNames) {
- this.callbackNames = callbackNames;
- }
-
- public Map<String, Set<String>> getRpcInterfaces() {
- return rpcInterfaces;
- }
-
- public void setRpcInterfaces(Map<String, Set<String>> rpcInterfaces) {
- this.rpcInterfaces = rpcInterfaces;
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/MouseEventDetails.java b/src/com/vaadin/terminal/gwt/client/MouseEventDetails.java
deleted file mode 100644
index f5ff707eed..0000000000
--- a/src/com/vaadin/terminal/gwt/client/MouseEventDetails.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client;
-
-import java.io.Serializable;
-
-/**
- * Helper class to store and transfer mouse event details.
- */
-public class MouseEventDetails implements Serializable {
- // From com.google.gwt.dom.client.NativeEvent
- public static final int BUTTON_LEFT = 1;
- public static final int BUTTON_MIDDLE = 4;
- public static final int BUTTON_RIGHT = 2;
-
- private static final char DELIM = ',';
- // From com.google.gwt.user.client.Event
- private static final int ONDBLCLICK = 0x00002;
-
- private int button;
- private int clientX;
- private int clientY;
- private boolean altKey;
- private boolean ctrlKey;
- private boolean metaKey;
- private boolean shiftKey;
- private int type;
- private int relativeX = -1;
- private int relativeY = -1;
-
- public int getButton() {
- return button;
- }
-
- public int getClientX() {
- return clientX;
- }
-
- public int getClientY() {
- return clientY;
- }
-
- public boolean isAltKey() {
- return altKey;
- }
-
- public boolean isCtrlKey() {
- return ctrlKey;
- }
-
- public boolean isMetaKey() {
- return metaKey;
- }
-
- public boolean isShiftKey() {
- return shiftKey;
- }
-
- public int getRelativeX() {
- return relativeX;
- }
-
- public int getRelativeY() {
- return relativeY;
- }
-
- public void setButton(int button) {
- this.button = button;
- }
-
- public void setClientX(int clientX) {
- this.clientX = clientX;
- }
-
- public void setClientY(int clientY) {
- this.clientY = clientY;
- }
-
- public void setAltKey(boolean altKey) {
- this.altKey = altKey;
- }
-
- public void setCtrlKey(boolean ctrlKey) {
- this.ctrlKey = ctrlKey;
- }
-
- public void setMetaKey(boolean metaKey) {
- this.metaKey = metaKey;
- }
-
- public void setShiftKey(boolean shiftKey) {
- this.shiftKey = shiftKey;
- }
-
- public void setType(int type) {
- this.type = type;
- }
-
- public void setRelativeX(int relativeX) {
- this.relativeX = relativeX;
- }
-
- public void setRelativeY(int relativeY) {
- this.relativeY = relativeY;
- }
-
- public MouseEventDetails() {
- }
-
- @Override
- public String toString() {
- return serialize();
- }
-
- public String serialize() {
- return "" + button + DELIM + clientX + DELIM + clientY + DELIM + altKey
- + DELIM + ctrlKey + DELIM + metaKey + DELIM + shiftKey + DELIM
- + type + DELIM + relativeX + DELIM + relativeY;
- }
-
- public static MouseEventDetails deSerialize(String serializedString) {
- MouseEventDetails instance = new MouseEventDetails();
- String[] fields = serializedString.split(",");
-
- instance.button = Integer.parseInt(fields[0]);
- instance.clientX = Integer.parseInt(fields[1]);
- instance.clientY = Integer.parseInt(fields[2]);
- instance.altKey = Boolean.valueOf(fields[3]).booleanValue();
- instance.ctrlKey = Boolean.valueOf(fields[4]).booleanValue();
- instance.metaKey = Boolean.valueOf(fields[5]).booleanValue();
- instance.shiftKey = Boolean.valueOf(fields[6]).booleanValue();
- instance.type = Integer.parseInt(fields[7]);
- instance.relativeX = Integer.parseInt(fields[8]);
- instance.relativeY = Integer.parseInt(fields[9]);
- return instance;
- }
-
- public String getButtonName() {
- if (button == BUTTON_LEFT) {
- return "left";
- } else if (button == BUTTON_RIGHT) {
- return "right";
- } else if (button == BUTTON_MIDDLE) {
- return "middle";
- }
-
- return "";
- }
-
- public int getType() {
- return type;
- }
-
- public boolean isDoubleClick() {
- return type == ONDBLCLICK;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/MouseEventDetailsBuilder.java b/src/com/vaadin/terminal/gwt/client/MouseEventDetailsBuilder.java
index 58dd488351..d39f98a024 100644
--- a/src/com/vaadin/terminal/gwt/client/MouseEventDetailsBuilder.java
+++ b/src/com/vaadin/terminal/gwt/client/MouseEventDetailsBuilder.java
@@ -6,6 +6,7 @@ package com.vaadin.terminal.gwt.client;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.user.client.Event;
+import com.vaadin.shared.MouseEventDetails;
/**
* Helper class for constructing a MouseEventDetails object from a
diff --git a/src/com/vaadin/terminal/gwt/client/NullConsole.java b/src/com/vaadin/terminal/gwt/client/NullConsole.java
index 2d15ffd46c..7db513ca82 100644
--- a/src/com/vaadin/terminal/gwt/client/NullConsole.java
+++ b/src/com/vaadin/terminal/gwt/client/NullConsole.java
@@ -15,39 +15,48 @@ import com.google.gwt.core.client.GWT;
*/
public class NullConsole implements Console {
+ @Override
public void dirUIDL(ValueMap u, ApplicationConfiguration cnf) {
}
+ @Override
public void error(String msg) {
GWT.log(msg);
}
+ @Override
public void log(String msg) {
GWT.log(msg);
}
+ @Override
public void printObject(Object msg) {
GWT.log(msg.toString());
}
+ @Override
public void printLayoutProblems(ValueMap meta,
ApplicationConnection applicationConnection,
Set<ComponentConnector> zeroHeightComponents,
Set<ComponentConnector> zeroWidthComponents) {
}
+ @Override
public void log(Throwable e) {
GWT.log(e.getMessage(), e);
}
+ @Override
public void error(Throwable e) {
// Borrow exception handling from VDebugConsole
VDebugConsole.handleError(e, this);
}
+ @Override
public void setQuietMode(boolean quietDebugMode) {
}
+ @Override
public void init() {
}
diff --git a/src/com/vaadin/terminal/gwt/client/ResourceLoader.java b/src/com/vaadin/terminal/gwt/client/ResourceLoader.java
new file mode 100644
index 0000000000..21577ce87e
--- /dev/null
+++ b/src/com/vaadin/terminal/gwt/client/ResourceLoader.java
@@ -0,0 +1,540 @@
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.terminal.gwt.client;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import com.google.gwt.core.client.Duration;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.core.client.Scheduler.RepeatingCommand;
+import com.google.gwt.dom.client.AnchorElement;
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.LinkElement;
+import com.google.gwt.dom.client.NodeList;
+import com.google.gwt.dom.client.ObjectElement;
+import com.google.gwt.dom.client.ScriptElement;
+import com.google.gwt.user.client.Timer;
+
+/**
+ * ResourceLoader lets you dynamically include external scripts and styles on
+ * the page and lets you know when the resource has been loaded.
+ *
+ * You can also preload resources, allowing them to get cached by the browser
+ * without being evaluated. This enables downloading multiple resources at once
+ * while still controlling in which order e.g. scripts are executed.
+ *
+ * @author Vaadin Ltd
+ * @version @VERSION@
+ * @since 7.0.0
+ */
+public class ResourceLoader {
+ /**
+ * Event fired when a resource has been loaded.
+ */
+ public static class ResourceLoadEvent {
+ private ResourceLoader loader;
+ private String resourceUrl;
+ private final boolean preload;
+
+ /**
+ * Creates a new event.
+ *
+ * @param loader
+ * the resource loader that has loaded the resource
+ * @param resourceUrl
+ * the url of the loaded resource
+ * @param preload
+ * true if the resource has only been preloaded, false if
+ * it's fully loaded
+ */
+ public ResourceLoadEvent(ResourceLoader loader, String resourceUrl,
+ boolean preload) {
+ this.loader = loader;
+ this.resourceUrl = resourceUrl;
+ this.preload = preload;
+ }
+
+ /**
+ * Gets the resource loader that has fired this event
+ *
+ * @return the resource loader
+ */
+ public ResourceLoader getResourceLoader() {
+ return loader;
+ }
+
+ /**
+ * Gets the absolute url of the loaded resource.
+ *
+ * @return the absolute url of the loaded resource
+ */
+ public String getResourceUrl() {
+ return resourceUrl;
+ }
+
+ /**
+ * Returns true if the resource has been preloaded, false if it's fully
+ * loaded
+ *
+ * @see ResourceLoader#preloadResource(String, ResourceLoadListener)
+ *
+ * @return true if the resource has been preloaded, false if it's fully
+ * loaded
+ */
+ public boolean isPreload() {
+ return preload;
+ }
+ }
+
+ /**
+ * Event listener that gets notified when a resource has been loaded
+ */
+ public interface ResourceLoadListener {
+ /**
+ * Notifies this ResourceLoadListener that a resource has been loaded.
+ * Some browsers do not support any way of detecting load errors. In
+ * these cases, onLoad will be called regardless of the status.
+ *
+ * @see ResourceLoadEvent
+ *
+ * @param event
+ * a resource load event with information about the loaded
+ * resource
+ */
+ public void onLoad(ResourceLoadEvent event);
+
+ /**
+ * Notifies this ResourceLoadListener that a resource could not be
+ * loaded, e.g. because the file could not be found or because the
+ * server did not respond. Some browsers do not support any way of
+ * detecting load errors. In these cases, onLoad will be called
+ * regardless of the status.
+ *
+ * @see ResourceLoadEvent
+ *
+ * @param event
+ * a resource load event with information about the resource
+ * that could not be loaded.
+ */
+ public void onError(ResourceLoadEvent event);
+ }
+
+ private static final ResourceLoader INSTANCE = GWT
+ .create(ResourceLoader.class);
+
+ private ApplicationConnection connection;
+
+ private final Set<String> loadedResources = new HashSet<String>();
+ private final Set<String> preloadedResources = new HashSet<String>();
+
+ private final Map<String, Collection<ResourceLoadListener>> loadListeners = new HashMap<String, Collection<ResourceLoadListener>>();
+ private final Map<String, Collection<ResourceLoadListener>> preloadListeners = new HashMap<String, Collection<ResourceLoadListener>>();
+
+ private final Element head;
+
+ /**
+ * Creates a new resource loader. You should generally not create you own
+ * resource loader, but instead use {@link ResourceLoader#get()} to get an
+ * instance.
+ */
+ protected ResourceLoader() {
+ Document document = Document.get();
+ head = document.getElementsByTagName("head").getItem(0);
+
+ // detect already loaded scripts and stylesheets
+ NodeList<Element> scripts = document.getElementsByTagName("script");
+ for (int i = 0; i < scripts.getLength(); i++) {
+ ScriptElement element = ScriptElement.as(scripts.getItem(i));
+ String src = element.getSrc();
+ if (src != null && src.length() != 0) {
+ loadedResources.add(src);
+ }
+ }
+
+ NodeList<Element> links = document.getElementsByTagName("link");
+ for (int i = 0; i < links.getLength(); i++) {
+ LinkElement linkElement = LinkElement.as(links.getItem(i));
+ String rel = linkElement.getRel();
+ String href = linkElement.getHref();
+ if ("stylesheet".equalsIgnoreCase(rel) && href != null
+ && href.length() != 0) {
+ loadedResources.add(href);
+ }
+ }
+ }
+
+ /**
+ * Returns the default ResourceLoader
+ *
+ * @return the default ResourceLoader
+ */
+ public static ResourceLoader get() {
+ return INSTANCE;
+ }
+
+ /**
+ * Load a script and notify a listener when the script is loaded. Calling
+ * this method when the script is currently loading or already loaded
+ * doesn't cause the script to be loaded again, but the listener will still
+ * be notified when appropriate.
+ *
+ *
+ * @param scriptUrl
+ * the url of the script to load
+ * @param resourceLoadListener
+ * the listener that will get notified when the script is loaded
+ */
+ public void loadScript(final String scriptUrl,
+ final ResourceLoadListener resourceLoadListener) {
+ final String url = getAbsoluteUrl(scriptUrl);
+ ResourceLoadEvent event = new ResourceLoadEvent(this, url, false);
+ if (loadedResources.contains(url)) {
+ if (resourceLoadListener != null) {
+ resourceLoadListener.onLoad(event);
+ }
+ return;
+ }
+
+ if (preloadListeners.containsKey(url)) {
+ // Preload going on, continue when preloaded
+ preloadResource(url, new ResourceLoadListener() {
+ @Override
+ public void onLoad(ResourceLoadEvent event) {
+ loadScript(url, resourceLoadListener);
+ }
+
+ @Override
+ public void onError(ResourceLoadEvent event) {
+ // Preload failed -> signal error to own listener
+ if (resourceLoadListener != null) {
+ resourceLoadListener.onError(event);
+ }
+ }
+ });
+ return;
+ }
+
+ if (addListener(url, resourceLoadListener, loadListeners)) {
+ ScriptElement scriptTag = Document.get().createScriptElement();
+ scriptTag.setSrc(url);
+ scriptTag.setType("text/javascript");
+ addOnloadHandler(scriptTag, new ResourceLoadListener() {
+ @Override
+ public void onLoad(ResourceLoadEvent event) {
+ fireLoad(event);
+ }
+
+ @Override
+ public void onError(ResourceLoadEvent event) {
+ fireError(event);
+ }
+ }, event);
+ head.appendChild(scriptTag);
+ }
+ }
+
+ private static String getAbsoluteUrl(String url) {
+ AnchorElement a = Document.get().createAnchorElement();
+ a.setHref(url);
+ return a.getHref();
+ }
+
+ /**
+ * Download a resource and notify a listener when the resource is loaded
+ * without attempting to interpret the resource. When a resource has been
+ * preloaded, it will be present in the browser's cache (provided the HTTP
+ * headers allow caching), making a subsequent load operation complete
+ * without having to wait for the resource to be downloaded again.
+ *
+ * Calling this method when the resource is currently loading, currently
+ * preloading, already preloaded or already loaded doesn't cause the
+ * resource to be preloaded again, but the listener will still be notified
+ * when appropriate.
+ *
+ * @param url
+ * the url of the resource to preload
+ * @param resourceLoadListener
+ * the listener that will get notified when the resource is
+ * preloaded
+ */
+ public void preloadResource(String url,
+ ResourceLoadListener resourceLoadListener) {
+ url = getAbsoluteUrl(url);
+ ResourceLoadEvent event = new ResourceLoadEvent(this, url, true);
+ if (loadedResources.contains(url) || preloadedResources.contains(url)) {
+ // Already loaded or preloaded -> just fire listener
+ if (resourceLoadListener != null) {
+ resourceLoadListener.onLoad(event);
+ }
+ return;
+ }
+
+ if (addListener(url, resourceLoadListener, preloadListeners)
+ && !loadListeners.containsKey(url)) {
+ // Inject loader element if this is the first time this is preloaded
+ // AND the resources isn't already being loaded in the normal way
+
+ Element element = getPreloadElement(url);
+ addOnloadHandler(element, new ResourceLoadListener() {
+ @Override
+ public void onLoad(ResourceLoadEvent event) {
+ fireLoad(event);
+ }
+
+ @Override
+ public void onError(ResourceLoadEvent event) {
+ fireError(event);
+ }
+ }, event);
+
+ // TODO Remove object when loaded (without causing spinner in FF)
+ Document.get().getBody().appendChild(element);
+ }
+ }
+
+ private static Element getPreloadElement(String url) {
+ if (BrowserInfo.get().isIE()) {
+ ScriptElement element = Document.get().createScriptElement();
+ element.setSrc(url);
+ element.setType("text/cache");
+ return element;
+ } else {
+ ObjectElement element = Document.get().createObjectElement();
+ element.setData(url);
+ element.setType("text/plain");
+ element.setHeight("0px");
+ element.setWidth("0px");
+ return element;
+ }
+ }
+
+ private native void addOnloadHandler(Element element,
+ ResourceLoadListener listener, ResourceLoadEvent event)
+ /*-{
+ element.onload = $entry(function() {
+ element.onload = null;
+ element.onerror = null;
+ element.onreadystatechange = null;
+ listener.@com.vaadin.terminal.gwt.client.ResourceLoader.ResourceLoadListener::onLoad(Lcom/vaadin/terminal/gwt/client/ResourceLoader$ResourceLoadEvent;)(event);
+ });
+ element.onerror = $entry(function() {
+ element.onload = null;
+ element.onerror = null;
+ element.onreadystatechange = null;
+ listener.@com.vaadin.terminal.gwt.client.ResourceLoader.ResourceLoadListener::onError(Lcom/vaadin/terminal/gwt/client/ResourceLoader$ResourceLoadEvent;)(event);
+ });
+ element.onreadystatechange = function() {
+ if ("loaded" === element.readyState || "complete" === element.readyState ) {
+ element.onload(arguments[0]);
+ }
+ };
+ }-*/;
+
+ /**
+ * Load a stylesheet and notify a listener when the stylesheet is loaded.
+ * Calling this method when the stylesheet is currently loading or already
+ * loaded doesn't cause the stylesheet to be loaded again, but the listener
+ * will still be notified when appropriate.
+ *
+ * @param stylesheetUrl
+ * the url of the stylesheet to load
+ * @param resourceLoadListener
+ * the listener that will get notified when the stylesheet is
+ * loaded
+ */
+ public void loadStylesheet(final String stylesheetUrl,
+ final ResourceLoadListener resourceLoadListener) {
+ final String url = getAbsoluteUrl(stylesheetUrl);
+ final ResourceLoadEvent event = new ResourceLoadEvent(this, url, false);
+ if (loadedResources.contains(url)) {
+ if (resourceLoadListener != null) {
+ resourceLoadListener.onLoad(event);
+ }
+ return;
+ }
+
+ if (preloadListeners.containsKey(url)) {
+ // Preload going on, continue when preloaded
+ preloadResource(url, new ResourceLoadListener() {
+ @Override
+ public void onLoad(ResourceLoadEvent event) {
+ loadStylesheet(url, resourceLoadListener);
+ }
+
+ @Override
+ public void onError(ResourceLoadEvent event) {
+ // Preload failed -> signal error to own listener
+ if (resourceLoadListener != null) {
+ resourceLoadListener.onError(event);
+ }
+ }
+ });
+ return;
+ }
+
+ if (addListener(url, resourceLoadListener, loadListeners)) {
+ LinkElement linkElement = Document.get().createLinkElement();
+ linkElement.setRel("stylesheet");
+ linkElement.setType("text/css");
+ linkElement.setHref(url);
+
+ if (BrowserInfo.get().isSafari()) {
+ // Safari doesn't fire any events for link elements
+ // See http://www.phpied.com/when-is-a-stylesheet-really-loaded/
+ Scheduler.get().scheduleFixedPeriod(new RepeatingCommand() {
+ private final Duration duration = new Duration();
+
+ @Override
+ public boolean execute() {
+ int styleSheetLength = getStyleSheetLength(url);
+ if (getStyleSheetLength(url) > 0) {
+ fireLoad(event);
+ return false; // Stop repeating
+ } else if (styleSheetLength == 0) {
+ // "Loaded" empty sheet -> most likely 404 error
+ fireError(event);
+ return true;
+ } else if (duration.elapsedMillis() > 60 * 1000) {
+ fireError(event);
+ return false;
+ } else {
+ return true; // Continue repeating
+ }
+ }
+ }, 10);
+ } else {
+ addOnloadHandler(linkElement, new ResourceLoadListener() {
+ @Override
+ public void onLoad(ResourceLoadEvent event) {
+ // Chrome && IE fires load for errors, must check
+ // stylesheet data
+ if (BrowserInfo.get().isChrome()
+ || BrowserInfo.get().isIE()) {
+ int styleSheetLength = getStyleSheetLength(url);
+ // Error if there's an empty stylesheet
+ if (styleSheetLength == 0) {
+ fireError(event);
+ return;
+ }
+ }
+ fireLoad(event);
+ }
+
+ @Override
+ public void onError(ResourceLoadEvent event) {
+ fireError(event);
+ }
+ }, event);
+ if (BrowserInfo.get().isOpera()) {
+ // Opera onerror never fired, assume error if no onload in x
+ // seconds
+ new Timer() {
+ @Override
+ public void run() {
+ if (!loadedResources.contains(url)) {
+ fireError(event);
+ }
+ }
+ }.schedule(5 * 1000);
+ }
+ }
+
+ head.appendChild(linkElement);
+ }
+ }
+
+ private static native int getStyleSheetLength(String url)
+ /*-{
+ for(var i = 0; i < $doc.styleSheets.length; i++) {
+ if ($doc.styleSheets[i].href === url) {
+ var sheet = $doc.styleSheets[i];
+ try {
+ var rules = sheet.cssRules
+ if (rules === undefined) {
+ rules = sheet.rules;
+ }
+
+ if (rules === null) {
+ // Style sheet loaded, but can't access length because of XSS -> assume there's something there
+ return 1;
+ }
+
+ // Return length so we can distinguish 0 (probably 404 error) from normal case.
+ return rules.length;
+ } catch (err) {
+ return 1;
+ }
+ }
+ }
+ // No matching stylesheet found -> not yet loaded
+ return -1;
+ }-*/;
+
+ private static boolean addListener(String url,
+ ResourceLoadListener listener,
+ Map<String, Collection<ResourceLoadListener>> listenerMap) {
+ Collection<ResourceLoadListener> listeners = listenerMap.get(url);
+ if (listeners == null) {
+ listeners = new HashSet<ResourceLoader.ResourceLoadListener>();
+ listeners.add(listener);
+ listenerMap.put(url, listeners);
+ return true;
+ } else {
+ listeners.add(listener);
+ return false;
+ }
+ }
+
+ private void fireError(ResourceLoadEvent event) {
+ String resource = event.getResourceUrl();
+
+ Collection<ResourceLoadListener> listeners;
+ if (event.isPreload()) {
+ // Also fire error for load listeners
+ fireError(new ResourceLoadEvent(this, resource, false));
+ listeners = preloadListeners.remove(resource);
+ } else {
+ listeners = loadListeners.remove(resource);
+ }
+ if (listeners != null && !listeners.isEmpty()) {
+ for (ResourceLoadListener listener : listeners) {
+ if (listener != null) {
+ listener.onError(event);
+ }
+ }
+ }
+ }
+
+ private void fireLoad(ResourceLoadEvent event) {
+ String resource = event.getResourceUrl();
+ Collection<ResourceLoadListener> listeners;
+ if (event.isPreload()) {
+ preloadedResources.add(resource);
+ listeners = preloadListeners.remove(resource);
+ } else {
+ if (preloadListeners.containsKey(resource)) {
+ // Also fire preload events for potential listeners
+ fireLoad(new ResourceLoadEvent(this, resource, true));
+ }
+ preloadedResources.remove(resource);
+ loadedResources.add(resource);
+ listeners = loadListeners.remove(resource);
+ }
+ if (listeners != null && !listeners.isEmpty()) {
+ for (ResourceLoadListener listener : listeners) {
+ if (listener != null) {
+ listener.onLoad(event);
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/com/vaadin/terminal/gwt/client/ServerConnector.java b/src/com/vaadin/terminal/gwt/client/ServerConnector.java
index fcf5100c8e..a0f08b92b9 100644
--- a/src/com/vaadin/terminal/gwt/client/ServerConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ServerConnector.java
@@ -8,7 +8,8 @@ import java.util.List;
import com.google.gwt.event.shared.GwtEvent;
import com.google.web.bindery.event.shared.HandlerRegistration;
-import com.vaadin.terminal.gwt.client.communication.ClientRpc;
+import com.vaadin.shared.Connector;
+import com.vaadin.shared.communication.ClientRpc;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent.StateChangeHandler;
/**
@@ -102,6 +103,7 @@ public interface ServerConnector extends Connector {
* @return The parent of this connector, as set by
* {@link #setParent(ServerConnector)}.
*/
+ @Override
public ServerConnector getParent();
/**
diff --git a/src/com/vaadin/terminal/gwt/client/SimpleTree.java b/src/com/vaadin/terminal/gwt/client/SimpleTree.java
index 350e0d707d..506d990aac 100644
--- a/src/com/vaadin/terminal/gwt/client/SimpleTree.java
+++ b/src/com/vaadin/terminal/gwt/client/SimpleTree.java
@@ -49,6 +49,7 @@ public class SimpleTree extends ComplexPanel {
getElement().appendChild(children);
addDomHandler(new ClickHandler() {
+ @Override
public void onClick(ClickEvent event) {
if (event.getNativeEvent().getEventTarget().cast() == handle) {
if (children.getStyle().getDisplay().intern() == Display.NONE
diff --git a/src/com/vaadin/terminal/gwt/client/SuperDevMode.java b/src/com/vaadin/terminal/gwt/client/SuperDevMode.java
new file mode 100644
index 0000000000..e435b3c6ed
--- /dev/null
+++ b/src/com/vaadin/terminal/gwt/client/SuperDevMode.java
@@ -0,0 +1,253 @@
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+package com.vaadin.terminal.gwt.client;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.http.client.UrlBuilder;
+import com.google.gwt.jsonp.client.JsonpRequestBuilder;
+import com.google.gwt.storage.client.Storage;
+import com.google.gwt.user.client.Window.Location;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.vaadin.terminal.gwt.client.ui.notification.VNotification;
+import com.vaadin.terminal.gwt.client.ui.notification.VNotification.EventListener;
+import com.vaadin.terminal.gwt.client.ui.notification.VNotification.HideEvent;
+
+/**
+ * Class that enables SuperDevMode using a ?superdevmode parameter in the url.
+ *
+ * @author Vaadin Ltd
+ * @version @VERSION@
+ * @since 7.0
+ *
+ */
+public class SuperDevMode {
+
+ private static final int COMPILE_TIMEOUT_IN_SECONDS = 60;
+ protected static final String SKIP_RECOMPILE = "VaadinSuperDevMode_skip_recompile";
+
+ public static class RecompileResult extends JavaScriptObject {
+ protected RecompileResult() {
+
+ }
+
+ public final native boolean ok()
+ /*-{
+ return this.status == "ok";
+ }-*/;
+ }
+
+ private static void recompileWidgetsetAndStartInDevMode(
+ final String serverUrl) {
+ VConsole.log("Recompiling widgetset using<br/>" + serverUrl
+ + "<br/>and then reloading in super dev mode");
+ VNotification n = new VNotification();
+ n.show("<b>Recompiling widgetset, this should not take too long</b>",
+ VNotification.CENTERED, VNotification.STYLE_SYSTEM);
+
+ JsonpRequestBuilder b = new JsonpRequestBuilder();
+ b.setCallbackParam("_callback");
+ b.setTimeout(COMPILE_TIMEOUT_IN_SECONDS * 1000);
+ b.requestObject(serverUrl + "recompile/" + GWT.getModuleName() + "?"
+ + getRecompileParameters(GWT.getModuleName()),
+ new AsyncCallback<RecompileResult>() {
+
+ @Override
+ public void onSuccess(RecompileResult result) {
+ VConsole.log("JSONP compile call successful");
+
+ if (!result.ok()) {
+ VConsole.log("* result: " + result);
+ failed();
+ return;
+ }
+
+ setSession(
+ getSuperDevModeHookKey(),
+ getSuperDevWidgetSetUrl(GWT.getModuleName(),
+ serverUrl));
+ setSession(SKIP_RECOMPILE, "1");
+
+ VConsole.log("* result: OK. Reloading");
+ Location.reload();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ VConsole.error("JSONP compile call failed");
+ // Don't log exception as they are shown as
+ // notifications
+ VConsole.error(Util.getSimpleName(caught) + ": "
+ + caught.getMessage());
+ failed();
+
+ }
+
+ private void failed() {
+ VNotification n = new VNotification();
+ n.addEventListener(new EventListener() {
+
+ @Override
+ public void notificationHidden(HideEvent event) {
+ recompileWidgetsetAndStartInDevMode(serverUrl);
+ }
+ });
+ n.show("Recompilation failed.<br/>"
+ + "Make sure CodeServer is running, "
+ + "check its output and click to retry",
+ VNotification.CENTERED,
+ VNotification.STYLE_SYSTEM);
+ }
+ });
+
+ }
+
+ protected static String getSuperDevWidgetSetUrl(String widgetsetName,
+ String serverUrl) {
+ return serverUrl + GWT.getModuleName() + "/" + GWT.getModuleName()
+ + ".nocache.js";
+ }
+
+ private native static String getRecompileParameters(String moduleName)
+ /*-{
+ var prop_map = $wnd.__gwt_activeModules[moduleName].bindings();
+
+ // convert map to URL parameter string
+ var props = [];
+ for (var key in prop_map) {
+ props.push(encodeURIComponent(key) + '=' + encodeURIComponent(prop_map[key]))
+ }
+
+ return props.join('&') + '&';
+ }-*/;
+
+ private static void setSession(String key, String value) {
+ Storage.getSessionStorageIfSupported().setItem(key, value);
+ }
+
+ private static String getSession(String key) {
+ return Storage.getSessionStorageIfSupported().getItem(key);
+ }
+
+ private static void removeSession(String key) {
+ Storage.getSessionStorageIfSupported().removeItem(key);
+ }
+
+ protected static void disableDevModeAndReload() {
+ removeSession(getSuperDevModeHookKey());
+ redirect(false);
+ }
+
+ protected static void redirect(boolean devModeOn) {
+ UrlBuilder createUrlBuilder = Location.createUrlBuilder();
+ if (!devModeOn) {
+ createUrlBuilder.removeParameter("superdevmode");
+ } else {
+ createUrlBuilder.setParameter("superdevmode", "");
+ }
+
+ Location.assign(createUrlBuilder.buildString());
+
+ }
+
+ private static String getSuperDevModeHookKey() {
+ String widgetsetName = GWT.getModuleName();
+ final String superDevModeKey = "__gwtDevModeHook:" + widgetsetName;
+ return superDevModeKey;
+ }
+
+ private static boolean hasSession(String key) {
+ return getSession(key) != null;
+ }
+
+ /**
+ * The URL of the code server. The default URL (http://localhost:9876/) will
+ * be used if this is empty or null.
+ *
+ * @param serverUrl
+ * The url of the code server or null to use the default
+ * @return true if recompile started, false if we are running in
+ * SuperDevMode
+ */
+ protected static boolean recompileIfNeeded(String serverUrl) {
+ if (serverUrl == null || "".equals(serverUrl)) {
+ serverUrl = "http://localhost:9876/";
+ } else {
+ serverUrl = "http://" + serverUrl + "/";
+ }
+
+ if (hasSession(SKIP_RECOMPILE)) {
+ VConsole.log("Running in SuperDevMode");
+ // When we get here, we are running in super dev mode
+
+ // Remove the flag so next reload will recompile
+ removeSession(SKIP_RECOMPILE);
+
+ // Remove the gwt flag so we will not end up in dev mode if we
+ // remove the url parameter manually
+ removeSession(getSuperDevModeHookKey());
+
+ return false;
+ }
+
+ recompileWidgetsetAndStartInDevMode(serverUrl);
+ return true;
+ }
+
+ protected static boolean isSuperDevModeEnabledInModule() {
+ String moduleName = GWT.getModuleName();
+ return isSuperDevModeEnabledInModule(moduleName);
+ }
+
+ protected native static boolean isSuperDevModeEnabledInModule(
+ String moduleName)
+ /*-{
+ if (!$wnd.__gwt_activeModules)
+ return false;
+ var mod = $wnd.__gwt_activeModules[moduleName];
+ if (!mod)
+ return false;
+
+ if (mod.superdevmode) {
+ // Running in super dev mode already, it is supported
+ return true;
+ }
+
+ return !!mod.canRedirect;
+ }-*/;
+
+ /**
+ * Enables SuperDevMode if the url contains the "superdevmode" parameter.
+ * <p>
+ * The caller should not continue initialization of the application if this
+ * method returns true. The application will be restarted once compilation
+ * is done and then this method will return false.
+ * </p>
+ *
+ * @return true if a recompile operation has started and the page will be
+ * reloaded once it is done, false if no recompilation will be done.
+ */
+ public static boolean enableBasedOnParameter() {
+ String superDevModeParameter = Location.getParameter("superdevmode");
+ if (superDevModeParameter != null) {
+ // Need to check the recompile flag also because if we are running
+ // in super dev mode, as a result of the recompile, the enabled
+ // check will fail...
+ if (!isSuperDevModeEnabledInModule()) {
+ showError("SuperDevMode is not enabled for this module/widgetset.<br/>"
+ + "Ensure that your module definition (.gwt.xml) contains <br/>"
+ + "&lt;add-linker name=&quot;xsiframe&quot;/&gt;<br/>"
+ + "&lt;set-configuration-property name=&quot;devModeRedirectEnabled&quot; value=&quot;true&quot; /&gt;<br/>");
+ return false;
+ }
+ return SuperDevMode.recompileIfNeeded(superDevModeParameter);
+ }
+ return false;
+ }
+
+ private static void showError(String message) {
+ VNotification n = new VNotification();
+ n.show(message, VNotification.CENTERED_TOP, VNotification.STYLE_SYSTEM);
+ }
+}
diff --git a/src/com/vaadin/terminal/gwt/client/TooltipInfo.java b/src/com/vaadin/terminal/gwt/client/TooltipInfo.java
index fb33a56c56..712d263695 100644
--- a/src/com/vaadin/terminal/gwt/client/TooltipInfo.java
+++ b/src/com/vaadin/terminal/gwt/client/TooltipInfo.java
@@ -16,6 +16,11 @@ public class TooltipInfo {
setTitle(tooltip);
}
+ public TooltipInfo(String tooltip, String errorMessage) {
+ setTitle(tooltip);
+ setErrorMessage(errorMessage);
+ }
+
public String getTitle() {
return title;
}
@@ -32,4 +37,18 @@ public class TooltipInfo {
errorMessageHtml = errorMessage;
}
+ /**
+ * Checks is a message has been defined for the tooltip.
+ *
+ * @return true if title or error message is present, false if both are
+ * empty
+ */
+ public boolean hasMessage() {
+ return (title != null && !title.isEmpty())
+ || (errorMessageHtml != null && !errorMessageHtml.isEmpty());
+ }
+
+ public boolean equals(TooltipInfo other) {
+ return (other != null && other.title == title && other.errorMessageHtml == errorMessageHtml);
+ }
}
diff --git a/src/com/vaadin/terminal/gwt/client/UIDL.java b/src/com/vaadin/terminal/gwt/client/UIDL.java
index a523016b60..e662e08b3f 100644
--- a/src/com/vaadin/terminal/gwt/client/UIDL.java
+++ b/src/com/vaadin/terminal/gwt/client/UIDL.java
@@ -283,10 +283,12 @@ public final class UIDL extends JavaScriptObject {
int index = -1;
+ @Override
public void remove() {
throw new UnsupportedOperationException();
}
+ @Override
public Object next() {
if (hasNext()) {
@@ -308,6 +310,7 @@ public final class UIDL extends JavaScriptObject {
return null;
}
+ @Override
public boolean hasNext() {
int count = getChildCount();
return count > index + 1;
diff --git a/src/com/vaadin/terminal/gwt/client/Util.java b/src/com/vaadin/terminal/gwt/client/Util.java
index d3cb54160d..a27c77fa45 100644
--- a/src/com/vaadin/terminal/gwt/client/Util.java
+++ b/src/com/vaadin/terminal/gwt/client/Util.java
@@ -27,8 +27,10 @@ import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.communication.MethodInvocation;
import com.vaadin.terminal.gwt.client.RenderInformation.FloatSize;
-import com.vaadin.terminal.gwt.client.communication.MethodInvocation;
+import com.vaadin.terminal.gwt.client.ui.VOverlay;
public class Util {
@@ -446,6 +448,7 @@ public class Util {
elem.getStyle().setProperty("overflow", "hidden");
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
// Dough, Safari scroll auto means actually just a moped
elem.getStyle().setProperty("overflow", originalOverflow);
@@ -642,34 +645,47 @@ public class Util {
*/
public static ComponentConnector getConnectorForElement(
ApplicationConnection client, Widget parent, Element element) {
+
+ Element browseElement = element;
Element rootElement = parent.getElement();
- while (element != null && element != rootElement) {
- ComponentConnector paintable = ConnectorMap.get(client)
- .getConnector(element);
- if (paintable == null) {
- String ownerPid = VCaption.getCaptionOwnerPid(element);
+
+ while (browseElement != null && browseElement != rootElement) {
+
+ ComponentConnector connector = ConnectorMap.get(client)
+ .getConnector(browseElement);
+
+ if (connector == null) {
+ String ownerPid = VCaption.getCaptionOwnerPid(browseElement);
if (ownerPid != null) {
- paintable = (ComponentConnector) ConnectorMap.get(client)
+ connector = (ComponentConnector) ConnectorMap.get(client)
.getConnector(ownerPid);
}
}
- if (paintable != null) {
+ if (connector != null) {
// check that inside the rootElement
- while (element != null && element != rootElement) {
- element = (Element) element.getParentElement();
+ while (browseElement != null && browseElement != rootElement) {
+ browseElement = (Element) browseElement.getParentElement();
}
- if (element != rootElement) {
+ if (browseElement != rootElement) {
return null;
} else {
- return paintable;
+ return connector;
}
}
- element = (Element) element.getParentElement();
+ browseElement = (Element) browseElement.getParentElement();
}
- return null;
+ // No connector found, element is possibly inside a VOverlay
+ // If the overlay has an owner, try to find the owner's connector
+ VOverlay overlay = findWidget(element, VOverlay.class);
+ if (overlay != null && overlay.getOwner() != null) {
+ return getConnectorForElement(client, RootPanel.get(), overlay
+ .getOwner().getElement());
+ } else {
+ return null;
+ }
}
/**
@@ -818,30 +834,29 @@ public class Util {
ServerConnector connector = ConnectorMap.get(c).getConnector(id);
if (connector != null) {
VConsole.log("\t" + id + " (" + connector.getClass() + ") :");
- for (MethodInvocation invocation : invocations) {
- Object[] parameters = invocation.getParameters();
- String formattedParams = null;
- if (ApplicationConnection.UPDATE_VARIABLE_METHOD
- .equals(invocation.getMethodName())
- && parameters.length == 2) {
- // name, value
- Object value = parameters[1];
- // TODO paintables inside lists/maps get rendered as
- // components in the debug console
- String formattedValue = value instanceof ServerConnector ? ((ServerConnector) value)
- .getConnectorId() : String.valueOf(value);
- formattedParams = parameters[0] + " : " + formattedValue;
- }
- if (null == formattedParams) {
- formattedParams = (null != parameters) ? Arrays
- .toString(parameters) : null;
- }
- VConsole.log("\t\t" + invocation.getInterfaceName() + "."
- + invocation.getMethodName() + "(" + formattedParams
- + ")");
- }
} else {
- VConsole.log("\t" + id + ": Warning: no corresponding connector!");
+ VConsole.log("\t" + id
+ + ": Warning: no corresponding connector for id " + id);
+ }
+ for (MethodInvocation invocation : invocations) {
+ Object[] parameters = invocation.getParameters();
+ String formattedParams = null;
+ if (ApplicationConnection.UPDATE_VARIABLE_METHOD.equals(invocation
+ .getMethodName()) && parameters.length == 2) {
+ // name, value
+ Object value = parameters[1];
+ // TODO paintables inside lists/maps get rendered as
+ // components in the debug console
+ String formattedValue = value instanceof ServerConnector ? ((ServerConnector) value)
+ .getConnectorId() : String.valueOf(value);
+ formattedParams = parameters[0] + " : " + formattedValue;
+ }
+ if (null == formattedParams) {
+ formattedParams = (null != parameters) ? Arrays
+ .toString(parameters) : null;
+ }
+ VConsole.log("\t\t" + invocation.getInterfaceName() + "."
+ + invocation.getMethodName() + "(" + formattedParams + ")");
}
}
@@ -1007,6 +1022,7 @@ public class Util {
}
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ @Override
public void execute() {
try {
target.dispatchEvent(createMouseDownEvent);
diff --git a/src/com/vaadin/terminal/gwt/client/VBrowserDetails.java b/src/com/vaadin/terminal/gwt/client/VBrowserDetails.java
deleted file mode 100644
index 6e0417149c..0000000000
--- a/src/com/vaadin/terminal/gwt/client/VBrowserDetails.java
+++ /dev/null
@@ -1,465 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client;
-
-import java.io.Serializable;
-
-import com.vaadin.terminal.gwt.server.WebBrowser;
-
-/**
- * Class that parses the user agent string from the browser and provides
- * information about the browser. Used internally by {@link BrowserInfo} and
- * {@link WebBrowser}. Should not be used directly.
- *
- * @author Vaadin Ltd.
- * @version @VERSION@
- * @since 6.3
- */
-public class VBrowserDetails implements Serializable {
-
- private boolean isGecko = false;
- private boolean isWebKit = false;
- private boolean isPresto = false;
-
- private boolean isChromeFrameCapable = false;
- private boolean isChromeFrame = false;
-
- private boolean isSafari = false;
- private boolean isChrome = false;
- private boolean isFirefox = false;
- private boolean isOpera = false;
- private boolean isIE = false;
-
- private OperatingSystem os = OperatingSystem.UNKNOWN;
-
- public enum OperatingSystem {
- UNKNOWN, WINDOWS, MACOSX, LINUX, IOS, ANDROID;
- }
-
- private float browserEngineVersion = -1;
- private int browserMajorVersion = -1;
- private int browserMinorVersion = -1;
-
- private int osMajorVersion = -1;
- private int osMinorVersion = -1;
-
- /**
- * Create an instance based on the given user agent.
- *
- * @param userAgent
- * User agent as provided by the browser.
- */
- public VBrowserDetails(String userAgent) {
- userAgent = userAgent.toLowerCase();
-
- // browser engine name
- isGecko = userAgent.indexOf("gecko") != -1
- && userAgent.indexOf("webkit") == -1;
- isWebKit = userAgent.indexOf("applewebkit") != -1;
- isPresto = userAgent.indexOf(" presto/") != -1;
-
- // browser name
- isChrome = userAgent.indexOf(" chrome/") != -1;
- isSafari = !isChrome && userAgent.indexOf("safari") != -1;
- isOpera = userAgent.indexOf("opera") != -1;
- isIE = userAgent.indexOf("msie") != -1 && !isOpera
- && (userAgent.indexOf("webtv") == -1);
- isFirefox = userAgent.indexOf(" firefox/") != -1;
-
- // chromeframe
- isChromeFrameCapable = userAgent.indexOf("chromeframe") != -1;
- isChromeFrame = isChromeFrameCapable && !isChrome;
-
- // Rendering engine version
- try {
- if (isGecko) {
- int rvPos = userAgent.indexOf("rv:");
- if (rvPos >= 0) {
- String tmp = userAgent.substring(rvPos + 3);
- tmp = tmp.replaceFirst("(\\.[0-9]+).+", "$1");
- browserEngineVersion = Float.parseFloat(tmp);
- }
- } else if (isWebKit) {
- String tmp = userAgent
- .substring(userAgent.indexOf("webkit/") + 7);
- tmp = tmp.replaceFirst("([0-9]+)[^0-9].+", "$1");
- browserEngineVersion = Float.parseFloat(tmp);
- }
- } catch (Exception e) {
- // Browser engine version parsing failed
- System.err.println("Browser engine version parsing failed for: "
- + userAgent);
- }
-
- // Browser version
- try {
- if (isIE) {
- String ieVersionString = userAgent.substring(userAgent
- .indexOf("msie ") + 5);
- ieVersionString = safeSubstring(ieVersionString, 0,
- ieVersionString.indexOf(";"));
- parseVersionString(ieVersionString);
- } else if (isFirefox) {
- int i = userAgent.indexOf(" firefox/") + 9;
- parseVersionString(safeSubstring(userAgent, i, i + 5));
- } else if (isChrome) {
- int i = userAgent.indexOf(" chrome/") + 8;
- parseVersionString(safeSubstring(userAgent, i, i + 5));
- } else if (isSafari) {
- int i = userAgent.indexOf(" version/") + 9;
- parseVersionString(safeSubstring(userAgent, i, i + 5));
- } else if (isOpera) {
- int i = userAgent.indexOf(" version/");
- if (i != -1) {
- // Version present in Opera 10 and newer
- i += 9; // " version/".length
- } else {
- i = userAgent.indexOf("opera/") + 6;
- }
- parseVersionString(safeSubstring(userAgent, i, i + 5));
- }
- } catch (Exception e) {
- // Browser version parsing failed
- System.err.println("Browser version parsing failed for: "
- + userAgent);
- }
-
- // Operating system
- if (userAgent.contains("windows ")) {
- os = OperatingSystem.WINDOWS;
- } else if (userAgent.contains("linux")) {
- if (userAgent.contains("android")) {
- os = OperatingSystem.ANDROID;
- parseAndroidVersion(userAgent);
- } else {
- os = OperatingSystem.LINUX;
-
- }
- } else if (userAgent.contains("macintosh")
- || userAgent.contains("mac osx")
- || userAgent.contains("mac os x")) {
- if (userAgent.contains("ipad") || userAgent.contains("ipod")
- || userAgent.contains("iphone")) {
- os = OperatingSystem.IOS;
- parseIOSVersion(userAgent);
- } else {
- os = OperatingSystem.MACOSX;
- }
- }
- }
-
- private void parseAndroidVersion(String userAgent) {
- // Android 5.1;
- if (!userAgent.contains("android")) {
- return;
- }
-
- String osVersionString = safeSubstring(userAgent,
- userAgent.indexOf("android ") + "android ".length(),
- userAgent.length());
- osVersionString = safeSubstring(osVersionString, 0,
- osVersionString.indexOf(";"));
- String[] parts = osVersionString.split("\\.");
- parseOsVersion(parts);
- }
-
- private void parseIOSVersion(String userAgent) {
- // OS 5_1 like Mac OS X
- if (!userAgent.contains("os ") || !userAgent.contains(" like mac")) {
- return;
- }
-
- String osVersionString = safeSubstring(userAgent,
- userAgent.indexOf("os ") + 3, userAgent.indexOf(" like mac"));
- String[] parts = osVersionString.split("_");
- parseOsVersion(parts);
- }
-
- private void parseOsVersion(String[] parts) {
- osMajorVersion = -1;
- osMinorVersion = -1;
-
- if (parts.length >= 1) {
- try {
- osMajorVersion = Integer.parseInt(parts[0]);
- } catch (Exception e) {
- }
- }
- if (parts.length >= 2) {
- try {
- osMinorVersion = Integer.parseInt(parts[1]);
- } catch (Exception e) {
- }
- // Some Androids report version numbers as "2.1-update1"
- if (osMinorVersion == -1 && parts[1].contains("-")) {
- try {
- osMinorVersion = Integer.parseInt(parts[1].substring(0,
- parts[1].indexOf('-')));
- } catch (Exception ee) {
- }
- }
- }
-
- }
-
- private void parseVersionString(String versionString) {
- int idx = versionString.indexOf('.');
- if (idx < 0) {
- idx = versionString.length();
- }
- browserMajorVersion = Integer.parseInt(safeSubstring(versionString, 0,
- idx));
-
- int idx2 = versionString.indexOf('.', idx + 1);
- if (idx2 < 0) {
- idx2 = versionString.length();
- }
- try {
- browserMinorVersion = Integer.parseInt(safeSubstring(versionString,
- idx + 1, idx2).replaceAll("[^0-9].*", ""));
- } catch (NumberFormatException e) {
- // leave the minor version unmodified (-1 = unknown)
- }
- }
-
- private String safeSubstring(String string, int beginIndex, int endIndex) {
- if (beginIndex < 0) {
- beginIndex = 0;
- }
- if (endIndex < 0 || endIndex > string.length()) {
- endIndex = string.length();
- }
- return string.substring(beginIndex, endIndex);
- }
-
- /**
- * Tests if the browser is Firefox.
- *
- * @return true if it is Firefox, false otherwise
- */
- public boolean isFirefox() {
- return isFirefox;
- }
-
- /**
- * Tests if the browser is using the Gecko engine
- *
- * @return true if it is Gecko, false otherwise
- */
- public boolean isGecko() {
- return isGecko;
- }
-
- /**
- * Tests if the browser is using the WebKit engine
- *
- * @return true if it is WebKit, false otherwise
- */
- public boolean isWebKit() {
- return isWebKit;
- }
-
- /**
- * Tests if the browser is using the Presto engine
- *
- * @return true if it is Presto, false otherwise
- */
- public boolean isPresto() {
- return isPresto;
- }
-
- /**
- * Tests if the browser is Safari.
- *
- * @return true if it is Safari, false otherwise
- */
- public boolean isSafari() {
- return isSafari;
- }
-
- /**
- * Tests if the browser is Chrome.
- *
- * @return true if it is Chrome, false otherwise
- */
- public boolean isChrome() {
- return isChrome;
- }
-
- /**
- * Tests if the browser is capable of running ChromeFrame.
- *
- * @return true if it has ChromeFrame, false otherwise
- */
- public boolean isChromeFrameCapable() {
- return isChromeFrameCapable;
- }
-
- /**
- * Tests if the browser is running ChromeFrame.
- *
- * @return true if it is ChromeFrame, false otherwise
- */
- public boolean isChromeFrame() {
- return isChromeFrame;
- }
-
- /**
- * Tests if the browser is Opera.
- *
- * @return true if it is Opera, false otherwise
- */
- public boolean isOpera() {
- return isOpera;
- }
-
- /**
- * Tests if the browser is Internet Explorer.
- *
- * @return true if it is Internet Explorer, false otherwise
- */
- public boolean isIE() {
- return isIE;
- }
-
- /**
- * Returns the version of the browser engine. For WebKit this is an integer
- * e.g., 532.0. For gecko it is a float e.g., 1.8 or 1.9.
- *
- * @return The version of the browser engine
- */
- public float getBrowserEngineVersion() {
- return browserEngineVersion;
- }
-
- /**
- * Returns the browser major version e.g., 3 for Firefox 3.5, 4 for Chrome
- * 4, 8 for Internet Explorer 8.
- * <p>
- * Note that Internet Explorer 8 and newer will return the document mode so
- * IE8 rendering as IE7 will return 7.
- * </p>
- *
- * @return The major version of the browser.
- */
- public final int getBrowserMajorVersion() {
- return browserMajorVersion;
- }
-
- /**
- * Returns the browser minor version e.g., 5 for Firefox 3.5.
- *
- * @see #getBrowserMajorVersion()
- *
- * @return The minor version of the browser, or -1 if not known/parsed.
- */
- public final int getBrowserMinorVersion() {
- return browserMinorVersion;
- }
-
- /**
- * Sets the version for IE based on the documentMode. This is used to return
- * the correct the correct IE version when the version from the user agent
- * string and the value of the documentMode property do not match.
- *
- * @param documentMode
- * The current document mode
- */
- public void setIEMode(int documentMode) {
- browserMajorVersion = documentMode;
- browserMinorVersion = 0;
- }
-
- /**
- * Tests if the browser is run on Windows.
- *
- * @return true if run on Windows, false otherwise
- */
- public boolean isWindows() {
- return os == OperatingSystem.WINDOWS;
- }
-
- /**
- * Tests if the browser is run on Mac OSX.
- *
- * @return true if run on Mac OSX, false otherwise
- */
- public boolean isMacOSX() {
- return os == OperatingSystem.MACOSX;
- }
-
- /**
- * Tests if the browser is run on Linux.
- *
- * @return true if run on Linux, false otherwise
- */
- public boolean isLinux() {
- return os == OperatingSystem.LINUX;
- }
-
- /**
- * Tests if the browser is run on Android.
- *
- * @return true if run on Android, false otherwise
- */
- public boolean isAndroid() {
- return os == OperatingSystem.ANDROID;
- }
-
- /**
- * Tests if the browser is run in iOS.
- *
- * @return true if run in iOS, false otherwise
- */
- public boolean isIOS() {
- return os == OperatingSystem.IOS;
- }
-
- /**
- * Returns the major version of the operating system. Currently only
- * supported for mobile devices (iOS/Android)
- *
- * @return The major version or -1 if unknown
- */
- public int getOperatingSystemMajorVersion() {
- return osMajorVersion;
- }
-
- /**
- * Returns the minor version of the operating system. Currently only
- * supported for mobile devices (iOS/Android)
- *
- * @return The minor version or -1 if unknown
- */
- public int getOperatingSystemMinorVersion() {
- return osMinorVersion;
- }
-
- /**
- * Checks if the browser is so old that it simply won't work with a Vaadin
- * application. NOTE that the browser might still be capable of running
- * Crome Frame, so you might still want to check
- * {@link #isChromeFrameCapable()} if this returns true.
- *
- * @return true if the browser won't work, false if not the browser is
- * supported or might work
- */
- public boolean isTooOldToFunctionProperly() {
- if (isIE() && getBrowserMajorVersion() < 8) {
- return true;
- }
- if (isSafari() && getBrowserMajorVersion() < 5) {
- return true;
- }
- if (isFirefox() && getBrowserMajorVersion() < 4) {
- return true;
- }
- if (isOpera() && getBrowserMajorVersion() < 11) {
- return true;
- }
-
- return false;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/VCaption.java b/src/com/vaadin/terminal/gwt/client/VCaption.java
index 6f3fcf2c3a..85acc215b7 100644
--- a/src/com/vaadin/terminal/gwt/client/VCaption.java
+++ b/src/com/vaadin/terminal/gwt/client/VCaption.java
@@ -8,6 +8,8 @@ import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.HTML;
+import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.ComponentState;
import com.vaadin.terminal.gwt.client.ui.AbstractFieldConnector;
import com.vaadin.terminal.gwt.client.ui.Icon;
@@ -35,6 +37,8 @@ public class VCaption extends HTML {
ICON, CAPTION, REQUIRED, ERROR
}
+ private TooltipInfo tooltipInfo = null;
+
/**
* Creates a caption that is not linked to a {@link ComponentConnector}.
*
@@ -74,8 +78,6 @@ public class VCaption extends HTML {
}
setStyleName(CLASSNAME);
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
-
}
/**
@@ -345,9 +347,6 @@ public class VCaption extends HTML {
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
final Element target = DOM.eventGetTarget(event);
- if (client != null && owner != null && target != getElement()) {
- client.handleTooltipEvent(event, owner);
- }
if (DOM.eventGetType(event) == Event.ONLOAD
&& icon.getElement() == target) {
@@ -555,6 +554,26 @@ public class VCaption extends HTML {
}
}
+ /**
+ * Sets the tooltip that should be shown for the caption
+ *
+ * @param tooltipInfo
+ * The tooltip that should be shown or null if no tooltip should
+ * be shown
+ */
+ public void setTooltipInfo(TooltipInfo tooltipInfo) {
+ this.tooltipInfo = tooltipInfo;
+ }
+
+ /**
+ * Returns the tooltip that should be shown for the caption
+ *
+ * @return The tooltip to show or null if no tooltip should be shown
+ */
+ public TooltipInfo getTooltipInfo() {
+ return tooltipInfo;
+ }
+
protected Element getTextElement() {
return captionText;
}
diff --git a/src/com/vaadin/terminal/gwt/client/VConsole.java b/src/com/vaadin/terminal/gwt/client/VConsole.java
index dee8529a84..a221b42d67 100644
--- a/src/com/vaadin/terminal/gwt/client/VConsole.java
+++ b/src/com/vaadin/terminal/gwt/client/VConsole.java
@@ -57,35 +57,49 @@ public class VConsole {
}
public static void log(String msg) {
- impl.log(msg);
+ if (impl != null) {
+ impl.log(msg);
+ }
}
public static void log(Throwable e) {
- impl.log(e);
+ if (impl != null) {
+ impl.log(e);
+ }
}
public static void error(Throwable e) {
- impl.error(e);
+ if (impl != null) {
+ impl.error(e);
+ }
}
public static void error(String msg) {
- impl.error(msg);
+ if (impl != null) {
+ impl.error(msg);
+ }
}
public static void printObject(Object msg) {
- impl.printObject(msg);
+ if (impl != null) {
+ impl.printObject(msg);
+ }
}
public static void dirUIDL(ValueMap u, ApplicationConfiguration cnf) {
- impl.dirUIDL(u, cnf);
+ if (impl != null) {
+ impl.dirUIDL(u, cnf);
+ }
}
public static void printLayoutProblems(ValueMap meta,
ApplicationConnection applicationConnection,
Set<ComponentConnector> zeroHeightComponents,
Set<ComponentConnector> zeroWidthComponents) {
- impl.printLayoutProblems(meta, applicationConnection,
- zeroHeightComponents, zeroWidthComponents);
+ if (impl != null) {
+ impl.printLayoutProblems(meta, applicationConnection,
+ zeroHeightComponents, zeroWidthComponents);
+ }
}
}
diff --git a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java
index 09e939336e..a7bd943912 100644
--- a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java
+++ b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java
@@ -24,6 +24,8 @@ import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.UmbrellaException;
import com.google.gwt.http.client.Request;
@@ -33,6 +35,7 @@ import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.http.client.UrlBuilder;
import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.storage.client.Storage;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
@@ -81,6 +84,7 @@ public class VDebugConsole extends VOverlay implements Console {
this.label = label;
}
+ @Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (event.getTypeInt() == Event.ONKEYDOWN
&& event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) {
@@ -160,7 +164,8 @@ public class VDebugConsole extends VOverlay implements Console {
private Button savePosition = new Button("S");
private Button highlight = new Button("H");
private Button connectorStats = new Button("CS");
- private CheckBox hostedMode = new CheckBox("GWT");
+ private CheckBox devMode = new CheckBox("Dev");
+ private CheckBox superDevMode = new CheckBox("SDev");
private CheckBox autoScroll = new CheckBox("Autoscroll ");
private HorizontalPanel actions;
private boolean collapsed = false;
@@ -195,6 +200,7 @@ public class VDebugConsole extends VOverlay implements Console {
private EventPreview dragpreview = new EventPreview() {
+ @Override
public boolean onEventPreview(Event event) {
onBrowserEvent(event);
return false;
@@ -342,6 +348,7 @@ public class VDebugConsole extends VOverlay implements Console {
*
* @see com.vaadin.terminal.gwt.client.Console#log(java.lang.String)
*/
+ @Override
public void log(String msg) {
if (msg == null) {
msg = "null";
@@ -358,6 +365,7 @@ public class VDebugConsole extends VOverlay implements Console {
private List<String> msgQueue = new LinkedList<String>();
private ScheduledCommand doSend = new ScheduledCommand() {
+ @Override
public void execute() {
if (!msgQueue.isEmpty()) {
RequestBuilder requestBuilder = new RequestBuilder(
@@ -371,12 +379,14 @@ public class VDebugConsole extends VOverlay implements Console {
requestBuilder.sendRequest(requestData,
new RequestCallback() {
+ @Override
public void onResponseReceived(Request request,
Response response) {
// TODO Auto-generated method stub
}
+ @Override
public void onError(Request request,
Throwable exception) {
// TODO Auto-generated method stub
@@ -434,6 +444,7 @@ public class VDebugConsole extends VOverlay implements Console {
*
* @see com.vaadin.terminal.gwt.client.Console#error(java.lang.String)
*/
+ @Override
public void error(String msg) {
if (msg == null) {
msg = "null";
@@ -462,6 +473,7 @@ public class VDebugConsole extends VOverlay implements Console {
* @see com.vaadin.terminal.gwt.client.Console#printObject(java.lang.
* Object)
*/
+ @Override
public void printObject(Object msg) {
String str;
if (msg == null) {
@@ -479,6 +491,7 @@ public class VDebugConsole extends VOverlay implements Console {
* @see com.vaadin.terminal.gwt.client.Console#dirUIDL(com.vaadin
* .terminal.gwt.client.UIDL)
*/
+ @Override
public void dirUIDL(ValueMap u, ApplicationConfiguration conf) {
if (panel.isAttached()) {
VUIDLBrowser vuidlBrowser = new VUIDLBrowser(u, conf);
@@ -518,6 +531,7 @@ public class VDebugConsole extends VOverlay implements Console {
}
}-*/;
+ @Override
public void printLayoutProblems(ValueMap meta, ApplicationConnection ac,
Set<ComponentConnector> zeroHeightComponents,
Set<ComponentConnector> zeroWidthComponents) {
@@ -572,6 +586,7 @@ public class VDebugConsole extends VOverlay implements Console {
final CheckBox emphasisInUi = new CheckBox(
"Emphasize components parent in UI (the actual component is not visible)");
emphasisInUi.addClickHandler(new ClickHandler() {
+ @Override
public void onClick(ClickEvent event) {
Element element2 = layout.getElement();
Widget.setStyleName(element2, "invalidlayout",
@@ -605,6 +620,7 @@ public class VDebugConsole extends VOverlay implements Console {
}
final CheckBox emphasisInUi = new CheckBox("Emphasize component in UI");
emphasisInUi.addClickHandler(new ClickHandler() {
+ @Override
public void onClick(ClickEvent event) {
if (paintable != null) {
Element element2 = paintable.getWidget().getElement();
@@ -630,6 +646,7 @@ public class VDebugConsole extends VOverlay implements Console {
root.add(errorNode);
}
+ @Override
public void log(Throwable e) {
if (e instanceof UmbrellaException) {
UmbrellaException ue = (UmbrellaException) e;
@@ -642,6 +659,7 @@ public class VDebugConsole extends VOverlay implements Console {
GWT.log(e.getMessage(), e);
}
+ @Override
public void error(Throwable e) {
handleError(e, this);
}
@@ -673,6 +691,7 @@ public class VDebugConsole extends VOverlay implements Console {
}
}
+ @Override
public void init() {
panel = new FlowPanel();
if (!quietMode) {
@@ -717,33 +736,8 @@ public class VDebugConsole extends VOverlay implements Console {
savePosition
.setTitle("Saves the position and size of debug console to a cookie");
actions.add(autoScroll);
- actions.add(hostedMode);
- if (Location.getParameter("gwt.codesvr") != null) {
- hostedMode.setValue(true);
- }
- hostedMode.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
- if (hostedMode.getValue()) {
- addHMParameter();
- } else {
- removeHMParameter();
- }
- }
-
- private void addHMParameter() {
- UrlBuilder createUrlBuilder = Location.createUrlBuilder();
- createUrlBuilder.setParameter("gwt.codesvr",
- "localhost:9997");
- Location.assign(createUrlBuilder.buildString());
- }
-
- private void removeHMParameter() {
- UrlBuilder createUrlBuilder = Location.createUrlBuilder();
- createUrlBuilder.removeParameter("gwt.codesvr");
- Location.assign(createUrlBuilder.buildString());
-
- }
- });
+ addDevMode();
+ addSuperDevMode();
autoScroll
.setTitle("Automatically scroll so that new messages are visible");
@@ -753,6 +747,7 @@ public class VDebugConsole extends VOverlay implements Console {
panel.add(new HTML("<i>" + help + "</i>"));
clear.addClickHandler(new ClickHandler() {
+ @Override
public void onClick(ClickEvent event) {
int width = panel.getOffsetWidth();
int height = panel.getOffsetHeight();
@@ -765,6 +760,7 @@ public class VDebugConsole extends VOverlay implements Console {
});
restart.addClickHandler(new ClickHandler() {
+ @Override
public void onClick(ClickEvent event) {
String queryString = Window.Location.getQueryString();
@@ -792,6 +788,7 @@ public class VDebugConsole extends VOverlay implements Console {
});
forceLayout.addClickHandler(new ClickHandler() {
+ @Override
public void onClick(ClickEvent event) {
for (ApplicationConnection applicationConnection : ApplicationConfiguration
.getRunningApplications()) {
@@ -801,6 +798,7 @@ public class VDebugConsole extends VOverlay implements Console {
});
analyzeLayout.addClickHandler(new ClickHandler() {
+ @Override
public void onClick(ClickEvent event) {
List<ApplicationConnection> runningApplications = ApplicationConfiguration
.getRunningApplications();
@@ -816,6 +814,7 @@ public class VDebugConsole extends VOverlay implements Console {
+ " all non committed variables form client side.");
savePosition.addClickHandler(new ClickHandler() {
+ @Override
public void onClick(ClickEvent event) {
String pos = getAbsoluteLeft() + "," + getAbsoluteTop()
+ "," + getOffsetWidth() + "," + getOffsetHeight()
@@ -826,6 +825,7 @@ public class VDebugConsole extends VOverlay implements Console {
highlight.addClickHandler(new ClickHandler() {
+ @Override
public void onClick(ClickEvent event) {
final Label label = new Label("--");
log("<i>Use mouse to select a component or click ESC to exit highlight mode.</i>");
@@ -840,6 +840,7 @@ public class VDebugConsole extends VOverlay implements Console {
}
connectorStats.addClickHandler(new ClickHandler() {
+ @Override
public void onClick(ClickEvent event) {
for (ApplicationConnection a : ApplicationConfiguration
.getRunningApplications()) {
@@ -861,6 +862,56 @@ public class VDebugConsole extends VOverlay implements Console {
}
+ private void addSuperDevMode() {
+ final Storage sessionStorage = Storage.getSessionStorageIfSupported();
+ if (sessionStorage == null) {
+ return;
+ }
+ actions.add(superDevMode);
+ if (Location.getParameter("superdevmode") != null) {
+ superDevMode.setValue(true);
+ }
+ superDevMode.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
+
+ @Override
+ public void onValueChange(ValueChangeEvent<Boolean> event) {
+ SuperDevMode.redirect(event.getValue());
+ }
+
+ });
+
+ }
+
+ private void addDevMode() {
+ actions.add(devMode);
+ if (Location.getParameter("gwt.codesvr") != null) {
+ devMode.setValue(true);
+ }
+ devMode.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ if (devMode.getValue()) {
+ addHMParameter();
+ } else {
+ removeHMParameter();
+ }
+ }
+
+ private void addHMParameter() {
+ UrlBuilder createUrlBuilder = Location.createUrlBuilder();
+ createUrlBuilder.setParameter("gwt.codesvr", "localhost:9997");
+ Location.assign(createUrlBuilder.buildString());
+ }
+
+ private void removeHMParameter() {
+ UrlBuilder createUrlBuilder = Location.createUrlBuilder();
+ createUrlBuilder.removeParameter("gwt.codesvr");
+ Location.assign(createUrlBuilder.buildString());
+
+ }
+ });
+ }
+
protected void dumpConnectorInfo(ApplicationConnection a) {
RootConnector root = a.getRootConnector();
log("================");
@@ -924,6 +975,7 @@ public class VDebugConsole extends VOverlay implements Console {
}
};
simpleTree.addDomHandler(new MouseOutHandler() {
+ @Override
public void onMouseOut(MouseOutEvent event) {
VUIDLBrowser.deHiglight();
}
@@ -945,6 +997,7 @@ public class VDebugConsole extends VOverlay implements Console {
return Util.getConnectorString(connector);
}
+ @Override
public void setQuietMode(boolean quietDebugMode) {
quietMode = quietDebugMode;
}
diff --git a/src/com/vaadin/terminal/gwt/client/VSchedulerImpl.java b/src/com/vaadin/terminal/gwt/client/VSchedulerImpl.java
index 65d5d6a9a2..6f5e5854b2 100644
--- a/src/com/vaadin/terminal/gwt/client/VSchedulerImpl.java
+++ b/src/com/vaadin/terminal/gwt/client/VSchedulerImpl.java
@@ -19,6 +19,7 @@ public class VSchedulerImpl extends SchedulerImpl {
super.scheduleDeferred(cmd);
super.scheduleDeferred(new ScheduledCommand() {
+ @Override
public void execute() {
deferredCommandTrackers--;
}
diff --git a/src/com/vaadin/terminal/gwt/client/VTooltip.java b/src/com/vaadin/terminal/gwt/client/VTooltip.java
index 70f4a0de0a..a3523c2013 100644
--- a/src/com/vaadin/terminal/gwt/client/VTooltip.java
+++ b/src/com/vaadin/terminal/gwt/client/VTooltip.java
@@ -3,12 +3,20 @@
*/
package com.vaadin.terminal.gwt.client;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.MouseMoveEvent;
+import com.google.gwt.event.dom.client.MouseMoveHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.gwt.client.ui.VOverlay;
/**
@@ -27,15 +35,12 @@ public class VTooltip extends VOverlay {
private static final int QUICK_OPEN_DELAY = 100;
VErrorMessage em = new VErrorMessage();
Element description = DOM.createDiv();
- private ComponentConnector tooltipOwner;
private boolean closing = false;
private boolean opening = false;
private ApplicationConnection ac;
// Open next tooltip faster. Disabled after 2 sec of showTooltip-silence.
private boolean justClosed = false;
- // If this is "additional" tooltip, this field contains the key for it
- private Object tooltipKey;
public VTooltip(ApplicationConnection client) {
super(false, false, true);
@@ -78,6 +83,7 @@ public class VTooltip extends VOverlay {
// first to 0,0 position so that the calculation goes correctly.
setPopupPosition(0, 0);
setPopupPositionAndShow(new PositionCallback() {
+ @Override
public void setPosition(int offsetWidth, int offsetHeight) {
if (offsetWidth > MAX_WIDTH) {
@@ -115,51 +121,30 @@ public class VTooltip extends VOverlay {
}
}
- public void showTooltip(ComponentConnector owner, Event event, Object key) {
- if (closing && tooltipOwner == owner && tooltipKey == key) {
- // return to same tooltip, cancel closing
- closeTimer.cancel();
- closing = false;
- justClosedTimer.cancel();
- justClosed = false;
- return;
- }
+ private void showTooltip() {
- if (closing) {
+ // Close current tooltip
+ if (isShowing()) {
closeNow();
}
- updatePosition(event);
-
- if (opening) {
- showTimer.cancel();
- }
- tooltipOwner = owner;
- tooltipKey = key;
-
// Schedule timer for showing the tooltip according to if it was
// recently closed or not.
- if (justClosed) {
- showTimer.schedule(QUICK_OPEN_DELAY);
- } else {
- showTimer.schedule(OPEN_DELAY);
- }
+ int timeout = justClosed ? QUICK_OPEN_DELAY : OPEN_DELAY;
+ showTimer.schedule(timeout);
opening = true;
}
private void closeNow() {
- if (closing) {
- hide();
- tooltipOwner = null;
- setWidth("");
- closing = false;
- }
+ hide();
+ setWidth("");
+ closing = false;
}
private Timer showTimer = new Timer() {
@Override
public void run() {
- TooltipInfo info = ac.getTooltipTitleInfo(tooltipOwner, tooltipKey);
+ TooltipInfo info = tooltipEventHandler.getTooltipInfo();
if (null != info) {
show(info);
}
@@ -187,7 +172,6 @@ public class VTooltip extends VOverlay {
if (opening) {
showTimer.cancel();
opening = false;
- tooltipOwner = null;
}
if (!isAttached()) {
return;
@@ -209,24 +193,6 @@ public class VTooltip extends VOverlay {
public void updatePosition(Event event) {
tooltipEventMouseX = DOM.eventGetClientX(event);
tooltipEventMouseY = DOM.eventGetClientY(event);
-
- }
-
- public void handleTooltipEvent(Event event, ComponentConnector owner,
- Object key) {
- final int type = DOM.eventGetType(event);
- if ((VTooltip.TOOLTIP_EVENTS & type) == type) {
- if (type == Event.ONMOUSEOVER) {
- showTooltip(owner, event, key);
- } else if (type == Event.ONMOUSEMOVE) {
- updatePosition(event);
- } else {
- hideTooltip();
- }
- } else {
- // non-tooltip event, hide tooltip
- hideTooltip();
- }
}
@Override
@@ -235,17 +201,152 @@ public class VTooltip extends VOverlay {
// cancel closing event if tooltip is mouseovered; the user might want
// to scroll of cut&paste
- switch (type) {
- case Event.ONMOUSEOVER:
+ if (type == Event.ONMOUSEOVER) {
+ // Cancel closing so tooltip stays open and user can copy paste the
+ // tooltip
closeTimer.cancel();
closing = false;
- break;
- case Event.ONMOUSEOUT:
+ }
+ }
+
+ /**
+ * Replace current open tooltip with new content
+ */
+ public void replaceCurrentTooltip() {
+ if (closing) {
+ closeTimer.cancel();
+ closeNow();
+ }
+
+ TooltipInfo info = tooltipEventHandler.getTooltipInfo();
+ if (null != info) {
+ show(info);
+ }
+ opening = false;
+ }
+
+ private class TooltipEventHandler implements MouseMoveHandler,
+ ClickHandler, KeyDownHandler {
+
+ /**
+ * Current element hovered
+ */
+ private com.google.gwt.dom.client.Element currentElement = null;
+
+ /**
+ * Current tooltip active
+ */
+ private TooltipInfo currentTooltipInfo = null;
+
+ /**
+ * Get current active tooltip information
+ *
+ * @return Current active tooltip information or null
+ */
+ public TooltipInfo getTooltipInfo() {
+ return currentTooltipInfo;
+ }
+
+ /**
+ * Locate connector and it's tooltip for given element
+ *
+ * @param element
+ * Element used in search
+ * @return true if connector and tooltip found
+ */
+ private boolean resolveConnector(Element element) {
+
+ ComponentConnector connector = Util.getConnectorForElement(ac,
+ RootPanel.get(), element);
+
+ // Try to find first connector with proper tooltip info
+ TooltipInfo info = null;
+ while (connector != null) {
+
+ info = connector.getTooltipInfo(element);
+
+ if (info != null && info.hasMessage()) {
+ break;
+ }
+
+ if (!(connector.getParent() instanceof ComponentConnector)) {
+ connector = null;
+ info = null;
+ break;
+ }
+ connector = (ComponentConnector) connector.getParent();
+ }
+
+ if (connector != null && info != null) {
+ currentTooltipInfo = info;
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Handle hide event
+ *
+ * @param event
+ * Event causing hide
+ */
+ private void handleHideEvent() {
hideTooltip();
- break;
- default:
- // NOP
+ currentTooltipInfo = null;
+ }
+
+ @Override
+ public void onMouseMove(MouseMoveEvent mme) {
+ Event event = Event.as(mme.getNativeEvent());
+ com.google.gwt.dom.client.Element element = Element.as(event
+ .getEventTarget());
+
+ // We can ignore move event if it's handled by move or over already
+ if (currentElement == element) {
+ return;
+ }
+ currentElement = element;
+
+ boolean connectorAndTooltipFound = resolveConnector((com.google.gwt.user.client.Element) element);
+ if (!connectorAndTooltipFound) {
+ if (isShowing()) {
+ handleHideEvent();
+ } else {
+ currentTooltipInfo = null;
+ }
+ } else {
+ updatePosition(event);
+ if (isShowing()) {
+ replaceCurrentTooltip();
+ } else {
+ showTooltip();
+ }
+ }
+ }
+
+ @Override
+ public void onClick(ClickEvent event) {
+ handleHideEvent();
+ }
+
+ @Override
+ public void onKeyDown(KeyDownEvent event) {
+ handleHideEvent();
}
}
+ private final TooltipEventHandler tooltipEventHandler = new TooltipEventHandler();
+
+ /**
+ * Connects DOM handlers to widget that are needed for tooltip presentation.
+ *
+ * @param widget
+ * Widget which DOM handlers are connected
+ */
+ public void connectHandlersToWidget(Widget widget) {
+ widget.addDomHandler(tooltipEventHandler, MouseMoveEvent.getType());
+ widget.addDomHandler(tooltipEventHandler, ClickEvent.getType());
+ widget.addDomHandler(tooltipEventHandler, KeyDownEvent.getType());
+ }
}
diff --git a/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java b/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java
index 4230eda298..745d66c444 100644
--- a/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java
+++ b/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java
@@ -22,16 +22,29 @@ import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
+import com.google.gwt.json.client.JSONArray;
+import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONValue;
+import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.gwt.client.ui.UnknownComponentConnector;
import com.vaadin.terminal.gwt.client.ui.window.VWindow;
+/**
+ * TODO Rename to something more Vaadin7-ish?
+ */
public class VUIDLBrowser extends SimpleTree {
- private static final String HELP = "Shift click handle to open recursively. Click components to hightlight them on client side. Shift click components to highlight them also on the server side.";
+ private static final String HELP = "Shift click handle to open recursively. "
+ + " Click components to highlight them on client side."
+ + " Shift click components to highlight them also on the server side.";
private ApplicationConfiguration conf;
private String highlightedPid;
+ /**
+ * TODO Should probably take ApplicationConnection instead of
+ * ApplicationConfiguration
+ */
public VUIDLBrowser(final UIDL uidl, ApplicationConfiguration conf) {
this.conf = conf;
final UIDLItem root = new UIDLItem(uidl, conf);
@@ -47,9 +60,18 @@ public class VUIDLBrowser extends SimpleTree {
Set<String> keySet = u.getKeySet();
for (String key : keySet) {
if (key.equals("state")) {
- // TODO print updated shared states
+
+ ValueMap stateJson = u.getValueMap(key);
+ SimpleTree stateChanges = new SimpleTree("Shared state");
+
+ for (String stateKey : stateJson.getKeySet()) {
+ stateChanges.add(new SharedStateItem(stateKey, stateJson
+ .getValueMap(stateKey)));
+ }
+ add(stateChanges);
+
} else if (key.equals("changes")) {
- JsArray<UIDL> jsValueMapArray = u.getJSValueMapArray("changes")
+ JsArray<UIDL> jsValueMapArray = u.getJSValueMapArray(key)
.cast();
for (int i = 0; i < jsValueMapArray.length(); i++) {
UIDL uidl = jsValueMapArray.get(i);
@@ -68,12 +90,107 @@ public class VUIDLBrowser extends SimpleTree {
setTitle(HELP);
}
- class UIDLItem extends SimpleTree {
+ /**
+ * A debug view of a server-originated component state change.
+ */
+ abstract class StateChangeItem extends SimpleTree {
+
+ protected StateChangeItem() {
+ setTitle(HELP);
+
+ addDomHandler(new MouseOutHandler() {
+ @Override
+ public void onMouseOut(MouseOutEvent event) {
+ deHiglight();
+ }
+ }, MouseOutEvent.getType());
+ }
+
+ @Override
+ protected void select(ClickEvent event) {
+ ComponentConnector connector = getConnector();
+ highlight(connector);
+ if (event != null && event.getNativeEvent().getShiftKey()) {
+ connector.getConnection().highlightComponent(connector);
+ }
+ super.select(event);
+ }
+
+ /**
+ * Returns the Connector associated with this state change.
+ */
+ protected ComponentConnector getConnector() {
+ List<ApplicationConnection> runningApplications = ApplicationConfiguration
+ .getRunningApplications();
+
+ // TODO this does not work properly with multiple application on
+ // same host page
+ for (ApplicationConnection applicationConnection : runningApplications) {
+ ServerConnector connector = ConnectorMap.get(
+ applicationConnection).getConnector(getConnectorId());
+ if (connector instanceof ComponentConnector) {
+ return (ComponentConnector) connector;
+ }
+ }
+ return new UnknownComponentConnector();
+ }
+
+ protected abstract String getConnectorId();
+ }
+
+ /**
+ * A debug view of a Vaadin 7 style shared state change.
+ */
+ class SharedStateItem extends StateChangeItem {
+
+ private String connectorId;
+
+ SharedStateItem(String connectorId, ValueMap stateChanges) {
+ this.connectorId = connectorId;
+ setText(connectorId);
+ dir(new JSONObject(stateChanges), this);
+ }
+
+ @Override
+ protected String getConnectorId() {
+ return connectorId;
+ }
+
+ private void dir(String key, JSONValue value, SimpleTree tree) {
+ if (value.isObject() != null) {
+ SimpleTree subtree = new SimpleTree(key + "=object");
+ tree.add(subtree);
+ dir(value.isObject(), subtree);
+ } else if (value.isArray() != null) {
+ SimpleTree subtree = new SimpleTree(key + "=array");
+ dir(value.isArray(), subtree);
+ tree.add(subtree);
+ } else {
+ tree.add(new HTML(key + "=" + value));
+ }
+ }
+
+ private void dir(JSONObject state, SimpleTree tree) {
+ for (String key : state.keySet()) {
+ dir(key, state.get(key), tree);
+ }
+ }
+
+ private void dir(JSONArray array, SimpleTree tree) {
+ for (int i = 0; i < array.size(); ++i) {
+ dir("" + i, array.get(i), tree);
+ }
+ }
+ }
+
+ /**
+ * A debug view of a Vaadin 6 style hierarchical component state change.
+ */
+ class UIDLItem extends StateChangeItem {
private UIDL uidl;
UIDLItem(UIDL uidl, ApplicationConfiguration conf) {
- setTitle(HELP);
this.uidl = uidl;
try {
String name = uidl.getTag();
@@ -87,13 +204,11 @@ public class VUIDLBrowser extends SimpleTree {
} catch (Exception e) {
setText(uidl.toString());
}
+ }
- addDomHandler(new MouseOutHandler() {
- public void onMouseOut(MouseOutEvent event) {
- deHiglight();
- }
- }, MouseOutEvent.getType());
-
+ @Override
+ protected String getConnectorId() {
+ return uidl.getId();
}
private String getNodeName(UIDL uidl, ApplicationConfiguration conf,
@@ -118,26 +233,6 @@ public class VUIDLBrowser extends SimpleTree {
super.open(recursive);
}
- @Override
- protected void select(ClickEvent event) {
- List<ApplicationConnection> runningApplications = ApplicationConfiguration
- .getRunningApplications();
-
- // TODO this does not work properly with multiple application on
- // same
- // host page
- for (ApplicationConnection applicationConnection : runningApplications) {
- ComponentConnector paintable = (ComponentConnector) ConnectorMap
- .get(applicationConnection).getConnector(uidl.getId());
- highlight(paintable);
- if (event != null && event.getNativeEvent().getShiftKey()) {
- applicationConnection.highlightComponent(paintable);
- }
- }
-
- super.select(event);
- }
-
public void dir() {
remove(0);
@@ -218,6 +313,7 @@ public class VUIDLBrowser extends SimpleTree {
if (highlightedPid != null && highlightedPid.equals(uidl.getId())) {
getElement().getStyle().setBackgroundColor("#fdd");
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ @Override
public void execute() {
getElement().scrollIntoView();
}
diff --git a/src/com/vaadin/terminal/gwt/client/WidgetLoader.java b/src/com/vaadin/terminal/gwt/client/WidgetLoader.java
index 16e99716a0..749a8343c8 100644
--- a/src/com/vaadin/terminal/gwt/client/WidgetLoader.java
+++ b/src/com/vaadin/terminal/gwt/client/WidgetLoader.java
@@ -8,13 +8,15 @@ import com.google.gwt.core.client.RunAsyncCallback;
/** A helper class used by WidgetMap implementation. Used by the generated code. */
abstract class WidgetLoader implements RunAsyncCallback {
+ @Override
public void onFailure(Throwable reason) {
- ApplicationConfiguration.endWidgetLoading();
+ ApplicationConfiguration.endDependencyLoading();
}
+ @Override
public void onSuccess() {
addInstantiator();
- ApplicationConfiguration.endWidgetLoading();
+ ApplicationConfiguration.endDependencyLoading();
}
abstract void addInstantiator();
diff --git a/src/com/vaadin/terminal/gwt/client/communication/ClientRpc.java b/src/com/vaadin/terminal/gwt/client/communication/ClientRpc.java
deleted file mode 100644
index 45dbe69454..0000000000
--- a/src/com/vaadin/terminal/gwt/client/communication/ClientRpc.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.communication;
-
-import java.io.Serializable;
-
-/**
- * Interface to be extended by all server to client RPC interfaces.
- *
- * On the server side, proxies of the interface can be obtained from
- * AbstractComponent. On the client, RPC implementations can be registered with
- * AbstractConnector.registerRpc().
- *
- * Note: Currently, each RPC interface may not contain multiple methods with the
- * same name, even if their parameter lists would differ.
- *
- * @since 7.0
- */
-public interface ClientRpc extends Serializable {
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/communication/FieldRpc.java b/src/com/vaadin/terminal/gwt/client/communication/FieldRpc.java
deleted file mode 100644
index de464f1fb9..0000000000
--- a/src/com/vaadin/terminal/gwt/client/communication/FieldRpc.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.communication;
-
-public class FieldRpc {
- public interface FocusServerRpc extends ServerRpc {
- public void focus();
- }
-
- public interface BlurServerRpc extends ServerRpc {
- public void blur();
- }
-
- public interface FocusAndBlurServerRpc extends FocusServerRpc,
- BlurServerRpc {
-
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/communication/InitializableServerRpc.java b/src/com/vaadin/terminal/gwt/client/communication/InitializableServerRpc.java
index 0270de316e..f1b6b44b7d 100644
--- a/src/com/vaadin/terminal/gwt/client/communication/InitializableServerRpc.java
+++ b/src/com/vaadin/terminal/gwt/client/communication/InitializableServerRpc.java
@@ -3,6 +3,7 @@
*/
package com.vaadin.terminal.gwt.client.communication;
+import com.vaadin.shared.communication.ServerRpc;
import com.vaadin.terminal.gwt.client.ServerConnector;
/**
diff --git a/src/com/vaadin/terminal/gwt/client/communication/JsonDecoder.java b/src/com/vaadin/terminal/gwt/client/communication/JsonDecoder.java
index 23a2c30cd0..7268acdfc5 100644
--- a/src/com/vaadin/terminal/gwt/client/communication/JsonDecoder.java
+++ b/src/com/vaadin/terminal/gwt/client/communication/JsonDecoder.java
@@ -16,8 +16,8 @@ import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
+import com.vaadin.shared.Connector;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.Connector;
import com.vaadin.terminal.gwt.client.ConnectorMap;
/**
diff --git a/src/com/vaadin/terminal/gwt/client/communication/JsonEncoder.java b/src/com/vaadin/terminal/gwt/client/communication/JsonEncoder.java
index 925f0b6272..404f1238e0 100644
--- a/src/com/vaadin/terminal/gwt/client/communication/JsonEncoder.java
+++ b/src/com/vaadin/terminal/gwt/client/communication/JsonEncoder.java
@@ -17,8 +17,9 @@ import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
+import com.vaadin.shared.Connector;
+import com.vaadin.shared.communication.UidlValue;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.Connector;
/**
* Encoder for converting RPC parameters and other values to JSON for transfer
diff --git a/src/com/vaadin/terminal/gwt/client/communication/MethodInvocation.java b/src/com/vaadin/terminal/gwt/client/communication/MethodInvocation.java
deleted file mode 100644
index e61775a640..0000000000
--- a/src/com/vaadin/terminal/gwt/client/communication/MethodInvocation.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.communication;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-/**
- * Information needed by the framework to send an RPC method invocation from the
- * client to the server or vice versa.
- *
- * @since 7.0
- */
-public class MethodInvocation implements Serializable {
-
- private final String connectorId;
- private final String interfaceName;
- private final String methodName;
- private Object[] parameters;
-
- public MethodInvocation(String connectorId, String interfaceName,
- String methodName) {
- this.connectorId = connectorId;
- this.interfaceName = interfaceName;
- this.methodName = methodName;
- }
-
- public MethodInvocation(String connectorId, String interfaceName,
- String methodName, Object[] parameters) {
- this(connectorId, interfaceName, methodName);
- setParameters(parameters);
- }
-
- public String getConnectorId() {
- return connectorId;
- }
-
- public String getInterfaceName() {
- return interfaceName;
- }
-
- public String getMethodName() {
- return methodName;
- }
-
- public Object[] getParameters() {
- return parameters;
- }
-
- public void setParameters(Object[] parameters) {
- this.parameters = parameters;
- }
-
- @Override
- public String toString() {
- return connectorId + ":" + interfaceName + "." + methodName + "("
- + Arrays.toString(parameters) + ")";
- }
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/communication/RpcManager.java b/src/com/vaadin/terminal/gwt/client/communication/RpcManager.java
index 07d6292ce2..b1c91fe049 100644
--- a/src/com/vaadin/terminal/gwt/client/communication/RpcManager.java
+++ b/src/com/vaadin/terminal/gwt/client/communication/RpcManager.java
@@ -11,6 +11,8 @@ import java.util.Map;
import com.google.gwt.core.client.GWT;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONString;
+import com.vaadin.shared.communication.ClientRpc;
+import com.vaadin.shared.communication.MethodInvocation;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.ServerConnector;
diff --git a/src/com/vaadin/terminal/gwt/client/communication/RpcMethod.java b/src/com/vaadin/terminal/gwt/client/communication/RpcMethod.java
index abdcf73e2c..ce9c5b468b 100644
--- a/src/com/vaadin/terminal/gwt/client/communication/RpcMethod.java
+++ b/src/com/vaadin/terminal/gwt/client/communication/RpcMethod.java
@@ -3,6 +3,8 @@
*/
package com.vaadin.terminal.gwt.client.communication;
+import com.vaadin.shared.communication.ClientRpc;
+
public abstract class RpcMethod {
private String interfaceName;
private String methodName;
diff --git a/src/com/vaadin/terminal/gwt/client/communication/RpcProxy.java b/src/com/vaadin/terminal/gwt/client/communication/RpcProxy.java
index 113ec1f1b1..996c148f4f 100644
--- a/src/com/vaadin/terminal/gwt/client/communication/RpcProxy.java
+++ b/src/com/vaadin/terminal/gwt/client/communication/RpcProxy.java
@@ -4,6 +4,7 @@
package com.vaadin.terminal.gwt.client.communication;
import com.google.gwt.core.client.GWT;
+import com.vaadin.shared.communication.ServerRpc;
import com.vaadin.terminal.gwt.client.ServerConnector;
/**
diff --git a/src/com/vaadin/terminal/gwt/client/communication/ServerRpc.java b/src/com/vaadin/terminal/gwt/client/communication/ServerRpc.java
deleted file mode 100644
index 664c4a391c..0000000000
--- a/src/com/vaadin/terminal/gwt/client/communication/ServerRpc.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.communication;
-
-import java.io.Serializable;
-
-/**
- * Interface to be extended by all client to server RPC interfaces.
- *
- * @since 7.0
- */
-public interface ServerRpc extends Serializable {
-}
diff --git a/src/com/vaadin/terminal/gwt/client/communication/SharedState.java b/src/com/vaadin/terminal/gwt/client/communication/SharedState.java
deleted file mode 100644
index b087907f9e..0000000000
--- a/src/com/vaadin/terminal/gwt/client/communication/SharedState.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.communication;
-
-import java.io.Serializable;
-
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.client.ServerConnector;
-import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
-
-/**
- * Interface to be implemented by all shared state classes used to communicate
- * basic information about a {@link Connector} from server to client.
- *
- * Shared state classes have to be declared in client side packages to be
- * accessible both for server and client code. They can be static nested classes
- * of a {@link ServerConnector}.
- *
- * Shared state objects are only sent from the server to the client, and any
- * modifications from the client should be performed via an RPC call that
- * modifies the authoritative state on the server.
- *
- * A shared state class should be a bean with getters and setters for each
- * field. Supported data types are simple Java types, other beans and maps and
- * arrays of these.
- *
- * On the client side the connector should override
- * {@link AbstractComponentConnector#createState()} to create the correct state
- * class and {@link AbstractComponentConnector#getState()} override the return
- * type.
- *
- * Subclasses of a {@link Connector} using shared state should also provide a
- * subclass of the shared state class of the parent class to extend the state. A
- * single {@link Connector} can only have one shared state object.
- *
- * @since 7.0
- */
-public class SharedState implements Serializable {
-
- private boolean enabled = true;
-
- /**
- * Returns true if the component is enabled.
- *
- * @see com.vaadin.ui.Component#isEnabled()
- *
- * @return true if the component is enabled
- */
- public boolean isEnabled() {
- return enabled;
- }
-
- /**
- * Enables or disables the component.
- *
- * @see com.vaadin.ui.Component#setEnabled(boolean)
- *
- * @param enabled
- * new mode for the component
- */
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/communication/URLReference.java b/src/com/vaadin/terminal/gwt/client/communication/URLReference.java
deleted file mode 100644
index 569c4eff47..0000000000
--- a/src/com/vaadin/terminal/gwt/client/communication/URLReference.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.communication;
-
-import java.io.Serializable;
-
-public class URLReference implements Serializable {
-
- private String URL;
-
- /**
- * Returns the URL that this object refers to.
- * <p>
- * Note that the URL can use special protocols like theme://
- *
- * @return The URL for this reference or null if unknown.
- */
- public String getURL() {
- return URL;
- }
-
- /**
- * Sets the URL that this object refers to
- *
- * @param URL
- */
- public void setURL(String URL) {
- this.URL = URL;
- }
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/communication/URLReference_Serializer.java b/src/com/vaadin/terminal/gwt/client/communication/URLReference_Serializer.java
index bab0f385ed..f39cad1899 100644
--- a/src/com/vaadin/terminal/gwt/client/communication/URLReference_Serializer.java
+++ b/src/com/vaadin/terminal/gwt/client/communication/URLReference_Serializer.java
@@ -6,6 +6,7 @@ package com.vaadin.terminal.gwt.client.communication;
import com.google.gwt.core.client.GWT;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONValue;
+import com.vaadin.shared.communication.URLReference;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
public class URLReference_Serializer implements JSONSerializer<URLReference> {
@@ -13,6 +14,7 @@ public class URLReference_Serializer implements JSONSerializer<URLReference> {
// setURL() -> uRL as first char becomes lower case...
private static final String URL_FIELD = "uRL";
+ @Override
public URLReference deserialize(Type type, JSONValue jsonValue,
ApplicationConnection connection) {
URLReference reference = GWT.create(URLReference.class);
@@ -27,6 +29,7 @@ public class URLReference_Serializer implements JSONSerializer<URLReference> {
return reference;
}
+ @Override
public JSONValue serialize(URLReference value,
ApplicationConnection connection) {
JSONObject json = new JSONObject();
diff --git a/src/com/vaadin/terminal/gwt/client/communication/UidlValue.java b/src/com/vaadin/terminal/gwt/client/communication/UidlValue.java
deleted file mode 100644
index 2a21074037..0000000000
--- a/src/com/vaadin/terminal/gwt/client/communication/UidlValue.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.communication;
-
-import java.io.Serializable;
-
-public class UidlValue implements Serializable {
- private Object value;
-
- public UidlValue(Object value) {
- this.value = value;
- }
-
- public Object getValue() {
- return value;
- }
-
- @Override
- public String toString() {
- return "" + value;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/ExecuteJavaScriptRpc.java b/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/ExecuteJavaScriptRpc.java
deleted file mode 100644
index f1185586d5..0000000000
--- a/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/ExecuteJavaScriptRpc.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.extensions.javascriptmanager;
-
-import com.vaadin.terminal.gwt.client.communication.ClientRpc;
-
-public interface ExecuteJavaScriptRpc extends ClientRpc {
- public void executeJavaScript(String script);
-}
diff --git a/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavaScriptManagerConnector.java b/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavaScriptManagerConnector.java
index 8656783a86..d5849096fa 100644
--- a/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavaScriptManagerConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavaScriptManagerConnector.java
@@ -10,10 +10,12 @@ import java.util.Set;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.json.client.JSONArray;
-import com.vaadin.terminal.gwt.client.communication.MethodInvocation;
+import com.vaadin.shared.communication.MethodInvocation;
+import com.vaadin.shared.extension.javascriptmanager.ExecuteJavaScriptRpc;
+import com.vaadin.shared.extension.javascriptmanager.JavaScriptManagerState;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.extensions.AbstractExtensionConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.ui.JavaScript;
@Connect(JavaScript.class)
@@ -23,6 +25,7 @@ public class JavaScriptManagerConnector extends AbstractExtensionConnector {
@Override
protected void init() {
registerRpc(ExecuteJavaScriptRpc.class, new ExecuteJavaScriptRpc() {
+ @Override
public void executeJavaScript(String Script) {
eval(Script);
}
diff --git a/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavaScriptManagerState.java b/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavaScriptManagerState.java
deleted file mode 100644
index fc246aff04..0000000000
--- a/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavaScriptManagerState.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.extensions.javascriptmanager;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.vaadin.terminal.gwt.client.communication.SharedState;
-
-public class JavaScriptManagerState extends SharedState {
- private Set<String> names = new HashSet<String>();
-
- public Set<String> getNames() {
- return names;
- }
-
- public void setNames(Set<String> names) {
- this.names = names;
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractClickEventHandler.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractClickEventHandler.java
index e0ca798682..9de465e4a5 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractClickEventHandler.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractClickEventHandler.java
@@ -53,6 +53,7 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler,
*/
private final NativePreviewHandler mouseUpPreviewHandler = new NativePreviewHandler() {
+ @Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (event.getTypeInt() == Event.ONMOUSEUP) {
mouseUpEventPreviewRegistration.removeHandler();
@@ -144,6 +145,7 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler,
* popping up if there is a listener for right clicks.
*/
+ @Override
public void onContextMenu(ContextMenuEvent event) {
if (hasEventListener() && shouldFireEvent(event)) {
// Prevent showing the browser's context menu when there is a right
@@ -152,6 +154,7 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler,
}
}
+ @Override
public void onMouseDown(MouseDownEvent event) {
/*
* When getting a mousedown event, we must detect where the
@@ -163,6 +166,7 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler,
.addNativePreviewHandler(mouseUpPreviewHandler);
}
+ @Override
public void onMouseUp(MouseUpEvent event) {
/*
* Only fire a click if the mouseup hits the same element as the
@@ -208,6 +212,7 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler,
* double click will result in two click events and one double click event.
*/
+ @Override
public void onDoubleClick(DoubleClickEvent event) {
if (hasEventListener() && shouldFireEvent(event)) {
fireClick(event.getNativeEvent());
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java
index a621c488be..ba3a53691a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java
@@ -3,18 +3,20 @@
*/
package com.vaadin.terminal.gwt.client.ui;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.Focusable;
import com.google.gwt.user.client.ui.HasEnabled;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.Connector;
+import com.vaadin.shared.ui.TabIndexState;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ComponentContainerConnector;
-import com.vaadin.terminal.gwt.client.ComponentState;
-import com.vaadin.terminal.gwt.client.Connector;
import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.LayoutManager;
import com.vaadin.terminal.gwt.client.ServerConnector;
@@ -23,6 +25,7 @@ import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VConsole;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
+import com.vaadin.terminal.gwt.client.ui.datefield.PopupDateFieldConnector;
import com.vaadin.terminal.gwt.client.ui.root.RootConnector;
public abstract class AbstractComponentConnector extends AbstractConnector
@@ -33,7 +36,11 @@ public abstract class AbstractComponentConnector extends AbstractConnector
private String lastKnownWidth = "";
private String lastKnownHeight = "";
- List<String> styleNames;
+ /**
+ * The style names from getState().getStyles() which are currently applied
+ * to the widget.
+ */
+ protected List<String> styleNames = new ArrayList<String>();
/**
* Default constructor
@@ -41,6 +48,16 @@ public abstract class AbstractComponentConnector extends AbstractConnector
public AbstractComponentConnector() {
}
+ @Override
+ protected void init() {
+ super.init();
+
+ getConnection().getVTooltip().connectHandlersToWidget(getWidget());
+
+ // Set v-connector style names for the widget
+ getWidget().setStyleName("v-connector", true);
+ }
+
/**
* Creates and returns the widget for this VPaintableWidget. This method
* should only be called once when initializing the paintable.
@@ -57,6 +74,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector
*
* @return The widget associated with this paintable
*/
+ @Override
public Widget getWidget() {
if (widget == null) {
widget = createWidget();
@@ -100,19 +118,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector
super.onStateChanged(stateChangeEvent);
// Style names
- // String styleName = getStyleNames(getWidget().getStylePrimaryName());
- // getWidget().setStyleName(styleName);
- updateStyleNames();
-
- // Update tooltip
- TooltipInfo tooltipInfo = paintableMap.getTooltipInfo(this, null);
- if (getState().hasDescription()) {
- tooltipInfo.setTitle(getState().getDescription());
- } else {
- tooltipInfo.setTitle(null);
- }
- // add error info to tooltip if present
- tooltipInfo.setErrorMessage(getState().getErrorMessage());
+ updateWidgetStyleNames();
// Set captions
if (delegateCaptionHandling()) {
@@ -134,13 +140,16 @@ public abstract class AbstractComponentConnector extends AbstractConnector
updateComponentSize();
}
+ @Override
public void setWidgetEnabled(boolean widgetEnabled) {
+ // add or remove v-disabled style name from the widget
+ setWidgetStyleName(ApplicationConnection.DISABLED_CLASSNAME,
+ !widgetEnabled);
+
if (getWidget() instanceof HasEnabled) {
// set widget specific enabled state
((HasEnabled) getWidget()).setEnabled(widgetEnabled);
- // add or remove v-disabled style name from the widget
- getWidget().setStyleName(ApplicationConnection.DISABLED_CLASSNAME,
- !widgetEnabled);
+
// make sure the caption has or has not v-disabled style
if (delegateCaptionHandling()) {
ServerConnector parent = getParent();
@@ -190,18 +199,22 @@ public abstract class AbstractComponentConnector extends AbstractConnector
widget.setWidth(newWidth);
}
+ @Override
public boolean isRelativeHeight() {
return getState().getHeight().endsWith("%");
}
+ @Override
public boolean isRelativeWidth() {
return getState().getWidth().endsWith("%");
}
+ @Override
public boolean isUndefinedHeight() {
return getState().getHeight().length() == 0;
}
+ @Override
public boolean isUndefinedWidth() {
return getState().getWidth().length() == 0;
}
@@ -213,111 +226,118 @@ public abstract class AbstractComponentConnector extends AbstractConnector
* com.vaadin.terminal.gwt.client.ComponentConnector#delegateCaptionHandling
* ()
*/
+ @Override
public boolean delegateCaptionHandling() {
return true;
}
/**
- * Generates the style name for the widget based on the given primary style
- * name and the shared state.
+ * Updates the user defined, read-only and error style names for the widget
+ * based the shared state. User defined style names are prefixed with the
+ * primary style name of the widget returned by {@link #getWidget()}
* <p>
* This method can be overridden to provide additional style names for the
- * component
+ * component, for example see
+ * {@link AbstractFieldConnector#updateWidgetStyleNames()}
* </p>
- *
- * @param primaryStyleName
- * The primary style name to use when generating the final style
- * names
- * @return The style names, settable using
- * {@link Widget#setStyleName(String)}
*/
- protected String getStyleNames(String primaryStyleName) {
+ protected void updateWidgetStyleNames() {
ComponentState state = getState();
- StringBuilder styleBuf = new StringBuilder();
- styleBuf.append(primaryStyleName);
- styleBuf.append(" v-connector");
+ String primaryStyleName = getWidget().getStylePrimaryName();
- // Uses connector methods to enable connectors to take hierarchy or
- // multiple state variables into account
- if (!isEnabled()) {
- styleBuf.append(" ");
- styleBuf.append(ApplicationConnection.DISABLED_CLASSNAME);
- }
- if (isReadOnly()) {
- styleBuf.append(" ");
- styleBuf.append("v-readonly");
- }
+ // should be in AbstractFieldConnector ?
+ // add / remove read-only style name
+ setWidgetStyleName("v-readonly", isReadOnly());
+
+ // add / remove error style name
+ setWidgetStyleNameWithPrefix(primaryStyleName,
+ ApplicationConnection.ERROR_CLASSNAME_EXT,
+ null != state.getErrorMessage());
- // add additional styles as css classes, prefixed with component default
- // stylename
+ // add additional user defined style names as class names, prefixed with
+ // component default class name. remove nonexistent style names.
if (state.hasStyles()) {
- for (String style : state.getStyles()) {
- styleBuf.append(" ");
- styleBuf.append(primaryStyleName);
- styleBuf.append("-");
- styleBuf.append(style);
- styleBuf.append(" ");
- styleBuf.append(style);
+ // add new style names
+ List<String> newStyles = new ArrayList<String>();
+ newStyles.addAll(state.getStyles());
+ newStyles.removeAll(styleNames);
+ for (String newStyle : newStyles) {
+ setWidgetStyleName(newStyle, true);
+ setWidgetStyleNameWithPrefix(primaryStyleName + "-", newStyle,
+ true);
}
+ // remove nonexistent style names
+ styleNames.removeAll(state.getStyles());
+ for (String oldStyle : styleNames) {
+ setWidgetStyleName(oldStyle, false);
+ setWidgetStyleNameWithPrefix(primaryStyleName + "-", oldStyle,
+ false);
+ }
+ styleNames.clear();
+ styleNames.addAll(state.getStyles());
+ } else {
+ // remove all old style names
+ for (String oldStyle : styleNames) {
+ setWidgetStyleName(oldStyle, false);
+ setWidgetStyleNameWithPrefix(primaryStyleName + "-", oldStyle,
+ false);
+ }
+ styleNames.clear();
}
- // add error classname to components w/ error
- if (null != state.getErrorMessage()) {
- styleBuf.append(" ");
- styleBuf.append(primaryStyleName);
- styleBuf.append(ApplicationConnection.ERROR_CLASSNAME_EXT);
- }
-
- return styleBuf.toString();
}
- protected void updateStyleNames() {
- Widget widget = getWidget();
-
- widget.addStyleName("v");
-
- // Disabled
- if (!isEnabled()) {
- widget.addStyleName(ApplicationConnection.DISABLED_CLASSNAME);
- } else {
- widget.removeStyleName(ApplicationConnection.DISABLED_CLASSNAME);
- }
-
- // Read-only
- if (isReadOnly()) {
- widget.addStyleName("v-readonly");
- } else {
- widget.removeStyleName("v-readonly");
- }
+ /**
+ * This is used to add / remove state related style names from the widget.
+ * <p>
+ * Override this method for example if the style name given here should be
+ * updated in another widget in addition to the one returned by the
+ * {@link #getWidget()}.
+ * </p>
+ *
+ * @param styleName
+ * the style name to be added or removed
+ * @param add
+ * <code>true</code> to add the given style, <code>false</code>
+ * to remove it
+ */
+ protected void setWidgetStyleName(String styleName, boolean add) {
+ getWidget().setStyleName(styleName, add);
+ }
- // Error
- if (null != getState().getErrorMessage()) {
- widget.addStyleDependentName("error");
+ /**
+ * This is used to add / remove state related prefixed style names from the
+ * widget.
+ * <p>
+ * Override this method if the prefixed style name given here should be
+ * updated in another widget in addition to the one returned by the
+ * <code>Connector</code>'s {@link #getWidget()}, or if the prefix should be
+ * different. For example see
+ * {@link PopupDateFieldConnector#setWidgetStyleNameWithPrefix(String, String, boolean)}
+ * </p>
+ *
+ * @param styleName
+ * the style name to be added or removed
+ * @param add
+ * <code>true</code> to add the given style, <code>false</code>
+ * to remove it
+ * @deprecated This will be removed once styles are no longer added with
+ * prefixes.
+ */
+ @Deprecated
+ protected void setWidgetStyleNameWithPrefix(String prefix,
+ String styleName, boolean add) {
+ if (!styleName.startsWith("-")) {
+ if (!prefix.endsWith("-")) {
+ prefix += "-";
+ }
} else {
- widget.removeStyleDependentName("error");
- }
-
- // Additional style names
- List<String> newStyleNames = getState().getStyles();
- if (newStyleNames == null) {
- newStyleNames = new LinkedList<String>();
- }
- if (styleNames != null) {
- // Remove previous styles which are no longer in the current list
- for (String style : styleNames) {
- if (!newStyleNames.contains(style)) {
- widget.removeStyleName(style);
- widget.removeStyleDependentName(style);
- }
+ if (prefix.endsWith("-")) {
+ styleName.replaceFirst("-", "");
}
}
- // Add any new styles
- for (String style : newStyleNames) {
- widget.addStyleName(style);
- widget.addStyleDependentName(style);
- }
- styleNames = newStyleNames;
+ getWidget().setStyleName(prefix + styleName, add);
}
/*
@@ -325,11 +345,13 @@ public abstract class AbstractComponentConnector extends AbstractConnector
*
* @see com.vaadin.terminal.gwt.client.ComponentConnector#isReadOnly()
*/
+ @Override
@Deprecated
public boolean isReadOnly() {
return getState().isReadOnly();
}
+ @Override
public LayoutManager getLayoutManager() {
return LayoutManager.get(getConnection());
}
@@ -343,6 +365,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector
* @return true if an event listener has been registered with the given
* event identifier on the server side, false otherwise
*/
+ @Override
public boolean hasEventListener(String eventIdentifier) {
Set<String> reg = getState().getRegisteredEventListeners();
return (reg != null && reg.contains(eventIdentifier));
@@ -368,4 +391,17 @@ public abstract class AbstractComponentConnector extends AbstractConnector
+ ") has been unregistered. Widget was removed.");
}
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.terminal.gwt.client.ComponentConnector#getTooltipInfo(com.
+ * google.gwt.dom.client.Element)
+ */
+ @Override
+ public TooltipInfo getTooltipInfo(Element element) {
+ return new TooltipInfo(getState().getDescription(), getState()
+ .getErrorMessage());
+ }
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentContainerConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentContainerConnector.java
index c6bfba5023..6b294e65b8 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentContainerConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentContainerConnector.java
@@ -35,6 +35,7 @@ public abstract class AbstractComponentContainerConnector extends
* @see
* com.vaadin.terminal.gwt.client.ComponentContainerConnector#getChildren()
*/
+ @Override
public List<ComponentConnector> getChildComponents() {
if (childComponents == null) {
return Collections.emptyList();
@@ -50,6 +51,7 @@ public abstract class AbstractComponentContainerConnector extends
* com.vaadin.terminal.gwt.client.ComponentContainerConnector#setChildren
* (java.util.Collection)
*/
+ @Override
public void setChildComponents(List<ComponentConnector> childComponents) {
this.childComponents = childComponents;
}
@@ -61,6 +63,7 @@ public abstract class AbstractComponentContainerConnector extends
* connectorHierarchyChanged
* (com.vaadin.terminal.gwt.client.ConnectorHierarchyChangedEvent)
*/
+ @Override
public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
if (debugLogging) {
VConsole.log("Hierarchy changed for "
@@ -79,6 +82,7 @@ public abstract class AbstractComponentContainerConnector extends
}
}
+ @Override
public HandlerRegistration addConnectorHierarchyChangeHandler(
ConnectorHierarchyChangeHandler handler) {
return ensureHandlerManager().addHandler(
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractConnector.java
index d34529ee4e..4efd2f5c2f 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractConnector.java
@@ -13,12 +13,12 @@ import java.util.Map;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerManager;
import com.google.web.bindery.event.shared.HandlerRegistration;
+import com.vaadin.shared.communication.ClientRpc;
+import com.vaadin.shared.communication.SharedState;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ServerConnector;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.communication.ClientRpc;
-import com.vaadin.terminal.gwt.client.communication.SharedState;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent.StateChangeHandler;
@@ -57,6 +57,7 @@ public abstract class AbstractConnector implements ServerConnector,
*
* @see com.vaadin.terminal.gwt.client.VPaintable#getConnection()
*/
+ @Override
public final ApplicationConnection getConnection() {
return connection;
}
@@ -66,6 +67,7 @@ public abstract class AbstractConnector implements ServerConnector,
*
* @see com.vaadin.terminal.gwt.client.Connector#getId()
*/
+ @Override
public String getConnectorId() {
return id;
}
@@ -78,6 +80,7 @@ public abstract class AbstractConnector implements ServerConnector,
* <p>
* Connector classes should override {@link #init()} instead of this method.
*/
+ @Override
public final void doInit(String connectorId,
ApplicationConnection connection) {
this.connection = connection;
@@ -140,6 +143,7 @@ public abstract class AbstractConnector implements ServerConnector,
}
}
+ @Override
public <T extends ClientRpc> Collection<T> getRpcImplementations(
String rpcInterfaceId) {
if (null == rpcImplementations) {
@@ -148,6 +152,7 @@ public abstract class AbstractConnector implements ServerConnector,
return (Collection<T>) rpcImplementations.get(rpcInterfaceId);
}
+ @Override
public void fireEvent(GwtEvent<?> event) {
if (handlerManager != null) {
handlerManager.fireEvent(event);
@@ -162,11 +167,13 @@ public abstract class AbstractConnector implements ServerConnector,
return handlerManager;
}
+ @Override
public HandlerRegistration addStateChangeHandler(StateChangeHandler handler) {
return ensureHandlerManager()
.addHandler(StateChangeEvent.TYPE, handler);
}
+ @Override
public void removeStateChangeHandler(StateChangeHandler handler) {
ensureHandlerManager().removeHandler(StateChangeEvent.TYPE, handler);
}
@@ -186,6 +193,7 @@ public abstract class AbstractConnector implements ServerConnector,
*
* @see com.vaadin.terminal.gwt.client.ServerConnector#onUnregister()
*/
+ @Override
public void onUnregister() {
if (debugLogging) {
VConsole.log("Unregistered connector "
@@ -201,6 +209,7 @@ public abstract class AbstractConnector implements ServerConnector,
*
* @return the current shared state (never null)
*/
+ @Override
public SharedState getState() {
if (state == null) {
state = createState();
@@ -221,14 +230,17 @@ public abstract class AbstractConnector implements ServerConnector,
return ConnectorStateFactory.createState(getClass());
}
+ @Override
public ServerConnector getParent() {
return parent;
}
+ @Override
public void setParent(ServerConnector parent) {
this.parent = parent;
}
+ @Override
public List<ServerConnector> getChildren() {
if (children == null) {
return Collections.emptyList();
@@ -236,10 +248,12 @@ public abstract class AbstractConnector implements ServerConnector,
return children;
}
+ @Override
public void setChildren(List<ServerConnector> children) {
this.children = children;
}
+ @Override
public boolean isEnabled() {
if (!getState().isEnabled()) {
return false;
@@ -252,6 +266,7 @@ public abstract class AbstractConnector implements ServerConnector,
}
}
+ @Override
public void updateEnabledState(boolean enabledState) {
if (lastEnabledState == enabledState) {
return;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractFieldConnector.java
index 4be0f02c2a..4611b5a4ed 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractFieldConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractFieldConnector.java
@@ -3,7 +3,7 @@
*/
package com.vaadin.terminal.gwt.client.ui;
-import com.vaadin.terminal.gwt.client.AbstractFieldState;
+import com.vaadin.shared.AbstractFieldState;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
public abstract class AbstractFieldConnector extends AbstractComponentConnector {
@@ -35,20 +35,15 @@ public abstract class AbstractFieldConnector extends AbstractComponentConnector
}
@Override
- protected String getStyleNames(String primaryStyleName) {
- String styleNames = super.getStyleNames(primaryStyleName);
+ protected void updateWidgetStyleNames() {
+ super.updateWidgetStyleNames();
- if (isModified()) {
- // add modified classname to Fields
- styleNames += " " + ApplicationConnection.MODIFIED_CLASSNAME;
- }
+ // add / remove modified style name to Fields
+ setWidgetStyleName(ApplicationConnection.MODIFIED_CLASSNAME,
+ isModified());
- if (isRequired()) {
- // add required classname to Fields
- styleNames += " " + primaryStyleName
- + ApplicationConnection.REQUIRED_CLASSNAME_EXT;
- }
-
- return styleNames;
+ // add / remove error style name to Fields
+ setWidgetStyleNameWithPrefix(getWidget().getStylePrimaryName(),
+ ApplicationConnection.REQUIRED_CLASSNAME_EXT, isRequired());
}
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractLayoutConnector.java
index 175e67807f..cd059357a8 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractLayoutConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractLayoutConnector.java
@@ -3,6 +3,8 @@
*/
package com.vaadin.terminal.gwt.client.ui;
+import com.vaadin.shared.ui.AbstractLayoutState;
+
public abstract class AbstractLayoutConnector extends
AbstractComponentContainerConnector {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractLayoutState.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractLayoutState.java
deleted file mode 100644
index fee5ea746a..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractLayoutState.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.vaadin.terminal.gwt.client.ComponentState;
-
-public class AbstractLayoutState extends ComponentState {
- private int marginsBitmask;
-
- public int getMarginsBitmask() {
- return marginsBitmask;
- }
-
- public void setMarginsBitmask(int marginsBitmask) {
- this.marginsBitmask = marginsBitmask;
- }
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractMediaState.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractMediaState.java
deleted file mode 100644
index 0ab3851671..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractMediaState.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.vaadin.terminal.gwt.client.ComponentState;
-import com.vaadin.terminal.gwt.client.communication.URLReference;
-
-public class AbstractMediaState extends ComponentState {
- private boolean showControls;
-
- private String altText;
-
- private boolean htmlContentAllowed;
-
- private boolean autoplay;
-
- private boolean muted;
-
- private List<URLReference> sources = new ArrayList<URLReference>();
- private List<String> sourceTypes = new ArrayList<String>();
-
- public boolean isShowControls() {
- return showControls;
- }
-
- public void setShowControls(boolean showControls) {
- this.showControls = showControls;
- }
-
- public String getAltText() {
- return altText;
- }
-
- public void setAltText(String altText) {
- this.altText = altText;
- }
-
- public boolean isHtmlContentAllowed() {
- return htmlContentAllowed;
- }
-
- public void setHtmlContentAllowed(boolean htmlContentAllowed) {
- this.htmlContentAllowed = htmlContentAllowed;
- }
-
- public boolean isAutoplay() {
- return autoplay;
- }
-
- public void setAutoplay(boolean autoplay) {
- this.autoplay = autoplay;
- }
-
- public boolean isMuted() {
- return muted;
- }
-
- public void setMuted(boolean muted) {
- this.muted = muted;
- }
-
- public List<URLReference> getSources() {
- return sources;
- }
-
- public void setSources(List<URLReference> sources) {
- this.sources = sources;
- }
-
- public List<String> getSourceTypes() {
- return sourceTypes;
- }
-
- public void setSourceTypes(List<String> sourceTypes) {
- this.sourceTypes = sourceTypes;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/Action.java b/src/com/vaadin/terminal/gwt/client/ui/Action.java
index ca13cfc7f3..1a92e30f3f 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/Action.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/Action.java
@@ -25,6 +25,7 @@ public abstract class Action implements Command {
/**
* Executed when action fired
*/
+ @Override
public abstract void execute();
public String getHTML() {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AlignmentInfo.java b/src/com/vaadin/terminal/gwt/client/ui/AlignmentInfo.java
deleted file mode 100644
index 041ab6c1ad..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/AlignmentInfo.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.ui;
-
-public final class AlignmentInfo {
- /** Bitmask values for client server communication */
- public static class Bits {
- public static final int ALIGNMENT_LEFT = 1;
- public static final int ALIGNMENT_RIGHT = 2;
- public static final int ALIGNMENT_TOP = 4;
- public static final int ALIGNMENT_BOTTOM = 8;
- public static final int ALIGNMENT_HORIZONTAL_CENTER = 16;
- public static final int ALIGNMENT_VERTICAL_CENTER = 32;
- }
-
- public static final AlignmentInfo LEFT = new AlignmentInfo(
- Bits.ALIGNMENT_LEFT);
- public static final AlignmentInfo RIGHT = new AlignmentInfo(
- Bits.ALIGNMENT_RIGHT);
- public static final AlignmentInfo TOP = new AlignmentInfo(
- Bits.ALIGNMENT_TOP);
- public static final AlignmentInfo BOTTOM = new AlignmentInfo(
- Bits.ALIGNMENT_BOTTOM);
- public static final AlignmentInfo CENTER = new AlignmentInfo(
- Bits.ALIGNMENT_HORIZONTAL_CENTER);
- public static final AlignmentInfo MIDDLE = new AlignmentInfo(
- Bits.ALIGNMENT_VERTICAL_CENTER);
- public static final AlignmentInfo TOP_LEFT = new AlignmentInfo(
- Bits.ALIGNMENT_TOP + Bits.ALIGNMENT_LEFT);
-
- private final int bitMask;
-
- public AlignmentInfo(int bitMask) {
- this.bitMask = bitMask;
- }
-
- public AlignmentInfo(AlignmentInfo horizontal, AlignmentInfo vertical) {
- this(horizontal.getBitMask() + vertical.getBitMask());
- }
-
- public int getBitMask() {
- return bitMask;
- }
-
- public boolean isTop() {
- return (bitMask & Bits.ALIGNMENT_TOP) == Bits.ALIGNMENT_TOP;
- }
-
- public boolean isBottom() {
- return (bitMask & Bits.ALIGNMENT_BOTTOM) == Bits.ALIGNMENT_BOTTOM;
- }
-
- public boolean isLeft() {
- return (bitMask & Bits.ALIGNMENT_LEFT) == Bits.ALIGNMENT_LEFT;
- }
-
- public boolean isRight() {
- return (bitMask & Bits.ALIGNMENT_RIGHT) == Bits.ALIGNMENT_RIGHT;
- }
-
- public boolean isVerticalCenter() {
- return (bitMask & Bits.ALIGNMENT_VERTICAL_CENTER) == Bits.ALIGNMENT_VERTICAL_CENTER;
- }
-
- public boolean isHorizontalCenter() {
- return (bitMask & Bits.ALIGNMENT_HORIZONTAL_CENTER) == Bits.ALIGNMENT_HORIZONTAL_CENTER;
- }
-
- public String getVerticalAlignment() {
- if (isBottom()) {
- return "bottom";
- } else if (isVerticalCenter()) {
- return "middle";
- }
- return "top";
- }
-
- public String getHorizontalAlignment() {
- if (isRight()) {
- return "right";
- } else if (isHorizontalCenter()) {
- return "center";
- }
- return "left";
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/ClickEventHandler.java b/src/com/vaadin/terminal/gwt/client/ui/ClickEventHandler.java
index 758f798ef2..b7b6b13d3c 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/ClickEventHandler.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/ClickEventHandler.java
@@ -4,8 +4,8 @@
package com.vaadin.terminal.gwt.client.ui;
import com.google.gwt.dom.client.NativeEvent;
+import com.vaadin.shared.MouseEventDetails;
import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.MouseEventDetailsBuilder;
public abstract class ClickEventHandler extends AbstractClickEventHandler {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/ClickRpc.java b/src/com/vaadin/terminal/gwt/client/ui/ClickRpc.java
deleted file mode 100644
index 37d6443f55..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/ClickRpc.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-
-public interface ClickRpc extends ServerRpc {
- /**
- * Called when a click event has occurred and there are server side
- * listeners for the event.
- *
- * @param mouseDetails
- * Details about the mouse when the event took place
- */
- public void click(MouseEventDetails mouseDetails);
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/Connect.java b/src/com/vaadin/terminal/gwt/client/ui/Connect.java
deleted file mode 100644
index 0581bdb99c..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/Connect.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.server.ClientConnector;
-import com.vaadin.terminal.gwt.widgetsetutils.CustomWidgetMapGenerator;
-import com.vaadin.terminal.gwt.widgetsetutils.EagerWidgetMapGenerator;
-import com.vaadin.terminal.gwt.widgetsetutils.LazyWidgetMapGenerator;
-import com.vaadin.terminal.gwt.widgetsetutils.WidgetMapGenerator;
-
-/**
- * Annotation defining the server side connector that this ClientSideConnector
- * should connect to. The value must always by a class extending
- * {@link ClientConnector}.
- * <p>
- * With this annotation client side Vaadin connector is marked to have a server
- * side counterpart. The value of the annotation is the class of server side
- * implementation.
- *
- * @since 7.0
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface Connect {
-
- /**
- * @return the server side counterpart for the annotated component connector
- */
- Class<? extends Connector> value();
-
- /**
- * Depending on the used WidgetMap generator, these optional hints may be
- * used to define how the client side components are loaded by the browser.
- * The default is to eagerly load all widgets
- * {@link EagerWidgetMapGenerator}, but if the {@link WidgetMapGenerator} is
- * used by the widgetset, these load style hints are respected.
- * <p>
- * Lazy loading of a widget implementation means the client side component
- * is not included in the initial JavaScript application loaded when the
- * application starts. Instead the implementation is loaded to the client
- * when it is first needed. Lazy loaded widget can be achieved by giving
- * {@link LoadStyle#LAZY} value in {@link Connect} annotation.
- * <p>
- * Lazy loaded widgets don't stress the size and startup time of the client
- * side as much as eagerly loaded widgets. On the other hand there is a
- * slight latency when lazy loaded widgets are first used as the client side
- * needs to visit the server to fetch the client side implementation.
- * <p>
- * The {@link LoadStyle#DEFERRED} will also not stress the initially loaded
- * JavaScript file. If this load style is defined, the widget implementation
- * is preemptively loaded to the browser after the application is started
- * and the communication to server idles. This load style kind of combines
- * the best of both worlds.
- * <p>
- * Fine tunings to widget loading can also be made by overriding
- * {@link WidgetMapGenerator} in the GWT module. Tunings might be helpful if
- * the end users have slow connections and especially if they have high
- * latency in their network. The {@link CustomWidgetMapGenerator} is an
- * abstract generator implementation for easy customization. Vaadin package
- * also includes {@link LazyWidgetMapGenerator} that makes as many widgets
- * lazily loaded as possible.
- *
- * @since 6.4
- *
- * @return the hint for the widget set generator how the client side
- * implementation should be loaded to the browser
- */
- LoadStyle loadStyle() default LoadStyle.DEFERRED;
-
- public enum LoadStyle {
- /**
- * The widget is included in the initial JS sent to the client.
- */
- EAGER,
- /**
- * Not included in the initial set of widgets, but added to queue from
- * which it will be loaded when network is not busy or the
- * implementation is required.
- */
- DEFERRED,
- /**
- * Loaded to the client only if needed.
- */
- LAZY
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/ConnectorClassBasedFactory.java b/src/com/vaadin/terminal/gwt/client/ui/ConnectorClassBasedFactory.java
index 051ebdc6df..79dc138df9 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/ConnectorClassBasedFactory.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/ConnectorClassBasedFactory.java
@@ -6,7 +6,7 @@ package com.vaadin.terminal.gwt.client.ui;
import java.util.HashMap;
import java.util.Map;
-import com.vaadin.terminal.gwt.client.Connector;
+import com.vaadin.shared.Connector;
public abstract class ConnectorClassBasedFactory<T> {
public interface Creator<T> {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/ConnectorStateFactory.java b/src/com/vaadin/terminal/gwt/client/ui/ConnectorStateFactory.java
index 86e651a0a5..535fd29dfe 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/ConnectorStateFactory.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/ConnectorStateFactory.java
@@ -4,8 +4,8 @@
package com.vaadin.terminal.gwt.client.ui;
import com.google.gwt.core.client.GWT;
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.client.communication.SharedState;
+import com.vaadin.shared.Connector;
+import com.vaadin.shared.communication.SharedState;
public abstract class ConnectorStateFactory extends
ConnectorClassBasedFactory<SharedState> {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/ConnectorWidgetFactory.java b/src/com/vaadin/terminal/gwt/client/ui/ConnectorWidgetFactory.java
index 063d9f03a1..03d2069a94 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/ConnectorWidgetFactory.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/ConnectorWidgetFactory.java
@@ -15,6 +15,7 @@ public abstract class ConnectorWidgetFactory extends
// TODO Move to generator
{
addCreator(TextFieldConnector.class, new Creator<Widget>() {
+ @Override
public Widget create() {
return GWT.create(VTextField.class);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/FocusableFlexTable.java b/src/com/vaadin/terminal/gwt/client/ui/FocusableFlexTable.java
index fc97bafc46..2fac234587 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/FocusableFlexTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/FocusableFlexTable.java
@@ -42,6 +42,7 @@ public class FocusableFlexTable extends FlexTable implements HasFocusHandlers,
* com.google.gwt.event.dom.client.HasFocusHandlers#addFocusHandler(com.
* google.gwt.event.dom.client.FocusHandler)
*/
+ @Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
return addDomHandler(handler, FocusEvent.getType());
}
@@ -53,6 +54,7 @@ public class FocusableFlexTable extends FlexTable implements HasFocusHandlers,
* com.google.gwt.event.dom.client.HasBlurHandlers#addBlurHandler(com.google
* .gwt.event.dom.client.BlurHandler)
*/
+ @Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
return addDomHandler(handler, BlurEvent.getType());
}
@@ -64,6 +66,7 @@ public class FocusableFlexTable extends FlexTable implements HasFocusHandlers,
* com.google.gwt.event.dom.client.HasKeyDownHandlers#addKeyDownHandler(
* com.google.gwt.event.dom.client.KeyDownHandler)
*/
+ @Override
public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
return addDomHandler(handler, KeyDownEvent.getType());
}
@@ -75,6 +78,7 @@ public class FocusableFlexTable extends FlexTable implements HasFocusHandlers,
* com.google.gwt.event.dom.client.HasKeyPressHandlers#addKeyPressHandler
* (com.google.gwt.event.dom.client.KeyPressHandler)
*/
+ @Override
public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) {
return addDomHandler(handler, KeyPressEvent.getType());
}
@@ -99,6 +103,7 @@ public class FocusableFlexTable extends FlexTable implements HasFocusHandlers,
*
* @see com.vaadin.terminal.gwt.client.Focusable#focus()
*/
+ @Override
public void focus() {
setFocus(true);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/FocusableFlowPanel.java b/src/com/vaadin/terminal/gwt/client/ui/FocusableFlowPanel.java
index 831add049b..258fe441af 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/FocusableFlowPanel.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/FocusableFlowPanel.java
@@ -39,6 +39,7 @@ public class FocusableFlowPanel extends FlowPanel implements HasFocusHandlers,
* com.google.gwt.event.dom.client.HasFocusHandlers#addFocusHandler(com.
* google.gwt.event.dom.client.FocusHandler)
*/
+ @Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
return addDomHandler(handler, FocusEvent.getType());
}
@@ -50,6 +51,7 @@ public class FocusableFlowPanel extends FlowPanel implements HasFocusHandlers,
* com.google.gwt.event.dom.client.HasBlurHandlers#addBlurHandler(com.google
* .gwt.event.dom.client.BlurHandler)
*/
+ @Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
return addDomHandler(handler, BlurEvent.getType());
}
@@ -61,6 +63,7 @@ public class FocusableFlowPanel extends FlowPanel implements HasFocusHandlers,
* com.google.gwt.event.dom.client.HasKeyDownHandlers#addKeyDownHandler(
* com.google.gwt.event.dom.client.KeyDownHandler)
*/
+ @Override
public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
return addDomHandler(handler, KeyDownEvent.getType());
}
@@ -72,6 +75,7 @@ public class FocusableFlowPanel extends FlowPanel implements HasFocusHandlers,
* com.google.gwt.event.dom.client.HasKeyPressHandlers#addKeyPressHandler
* (com.google.gwt.event.dom.client.KeyPressHandler)
*/
+ @Override
public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) {
return addDomHandler(handler, KeyPressEvent.getType());
}
@@ -94,6 +98,7 @@ public class FocusableFlowPanel extends FlowPanel implements HasFocusHandlers,
/**
* Focus the panel
*/
+ @Override
public void focus() {
setFocus(true);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/FocusableScrollPanel.java b/src/com/vaadin/terminal/gwt/client/ui/FocusableScrollPanel.java
index ef1ea8521b..0ba42eb861 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/FocusableScrollPanel.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/FocusableScrollPanel.java
@@ -110,6 +110,7 @@ public class FocusableScrollPanel extends SimpleFocusablePanel implements
}
}
+ @Override
public HandlerRegistration addScrollHandler(ScrollHandler handler) {
return addDomHandler(handler, ScrollEvent.getType());
}
@@ -168,8 +169,10 @@ public class FocusableScrollPanel extends SimpleFocusablePanel implements
}
}
+ @Override
public void onScroll(ScrollEvent event) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ @Override
public void execute() {
focusElement.getStyle().setTop(getScrollPosition(), Unit.PX);
focusElement.getStyle().setLeft(getHorizontalScrollPosition(),
diff --git a/src/com/vaadin/terminal/gwt/client/ui/JavaScriptComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ui/JavaScriptComponentConnector.java
index bb062a6677..380d96115c 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/JavaScriptComponentConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/JavaScriptComponentConnector.java
@@ -3,6 +3,8 @@
*/
package com.vaadin.terminal.gwt.client.ui;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.JavaScriptComponentState;
import com.vaadin.terminal.gwt.client.JavaScriptConnectorHelper;
import com.vaadin.terminal.gwt.client.communication.HasJavaScriptConnectorHelper;
import com.vaadin.ui.AbstractJavaScriptComponent;
@@ -31,6 +33,7 @@ public final class JavaScriptComponentConnector extends
helper.init();
}
+ @Override
public JavaScriptConnectorHelper getJavascriptConnectorHelper() {
return helper;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/JavaScriptComponentState.java b/src/com/vaadin/terminal/gwt/client/ui/JavaScriptComponentState.java
deleted file mode 100644
index 6728f85ec9..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/JavaScriptComponentState.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import com.vaadin.terminal.gwt.client.ComponentState;
-import com.vaadin.terminal.gwt.client.JavaScriptConnectorHelper.JavaScriptConnectorState;
-
-public class JavaScriptComponentState extends ComponentState implements
- JavaScriptConnectorState {
-
- private Set<String> callbackNames = new HashSet<String>();
- private Map<String, Set<String>> rpcInterfaces = new HashMap<String, Set<String>>();
-
- public Set<String> getCallbackNames() {
- return callbackNames;
- }
-
- public void setCallbackNames(Set<String> callbackNames) {
- this.callbackNames = callbackNames;
- }
-
- public Map<String, Set<String>> getRpcInterfaces() {
- return rpcInterfaces;
- }
-
- public void setRpcInterfaces(Map<String, Set<String>> rpcInterfaces) {
- this.rpcInterfaces = rpcInterfaces;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/LayoutClickEventHandler.java b/src/com/vaadin/terminal/gwt/client/ui/LayoutClickEventHandler.java
index 7a5d85e34b..9aafaa0bbf 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/LayoutClickEventHandler.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/LayoutClickEventHandler.java
@@ -5,8 +5,9 @@ package com.vaadin.terminal.gwt.client.ui;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.user.client.Element;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.LayoutClickRpc;
import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.MouseEventDetailsBuilder;
public abstract class LayoutClickEventHandler extends AbstractClickEventHandler {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/LayoutClickRpc.java b/src/com/vaadin/terminal/gwt/client/ui/LayoutClickRpc.java
deleted file mode 100644
index 5b76f398a9..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/LayoutClickRpc.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-
-public interface LayoutClickRpc extends ServerRpc {
- /**
- * Called when a layout click event has occurred and there are server side
- * listeners for the event.
- *
- * @param mouseDetails
- * Details about the mouse when the event took place
- * @param clickedConnector
- * The child component that was the target of the event
- */
- public void layoutClick(MouseEventDetails mouseDetails,
- Connector clickedConnector);
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/MediaBaseConnector.java b/src/com/vaadin/terminal/gwt/client/ui/MediaBaseConnector.java
index 42027f911b..ccf90b2285 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/MediaBaseConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/MediaBaseConnector.java
@@ -3,39 +3,25 @@
*/
package com.vaadin.terminal.gwt.client.ui;
+import com.vaadin.shared.communication.URLReference;
+import com.vaadin.shared.ui.AbstractMediaState;
+import com.vaadin.shared.ui.MediaControl;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.communication.ClientRpc;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
-import com.vaadin.terminal.gwt.client.communication.URLReference;
public abstract class MediaBaseConnector extends AbstractComponentConnector {
- /**
- * Server to client RPC interface for controlling playback of the media.
- *
- * @since 7.0
- */
- public static interface MediaControl extends ClientRpc {
- /**
- * Start playing the media.
- */
- public void play();
-
- /**
- * Pause playback of the media.
- */
- public void pause();
- }
-
@Override
protected void init() {
super.init();
registerRpc(MediaControl.class, new MediaControl() {
+ @Override
public void play() {
getWidget().play();
}
+ @Override
public void pause() {
getWidget().pause();
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/ShortcutActionHandler.java b/src/com/vaadin/terminal/gwt/client/ui/ShortcutActionHandler.java
index 37e9ab4a69..40454345bc 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/ShortcutActionHandler.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/ShortcutActionHandler.java
@@ -149,6 +149,7 @@ public class ShortcutActionHandler {
} else {
shakeTarget(et);
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
shakeTarget(et);
}
@@ -156,6 +157,7 @@ public class ShortcutActionHandler {
}
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
if (finalTarget != null) {
client.updateVariable(paintableId, "actiontarget",
@@ -187,6 +189,7 @@ public class ShortcutActionHandler {
// deferred. Will cause a small flickering, so not doing it for all
// browsers.
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
focus(e);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/SimpleFocusablePanel.java b/src/com/vaadin/terminal/gwt/client/ui/SimpleFocusablePanel.java
index 9baa1db007..ec62b82ce1 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/SimpleFocusablePanel.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/SimpleFocusablePanel.java
@@ -36,18 +36,22 @@ public class SimpleFocusablePanel extends SimplePanel implements
setTabIndex(0);
}
+ @Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
return addDomHandler(handler, FocusEvent.getType());
}
+ @Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
return addDomHandler(handler, BlurEvent.getType());
}
+ @Override
public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
return addDomHandler(handler, KeyDownEvent.getType());
}
+ @Override
public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) {
return addDomHandler(handler, KeyPressEvent.getType());
}
@@ -64,6 +68,7 @@ public class SimpleFocusablePanel extends SimplePanel implements
}
}
+ @Override
public void focus() {
setFocus(true);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/TabIndexState.java b/src/com/vaadin/terminal/gwt/client/ui/TabIndexState.java
deleted file mode 100644
index 7ffb328add..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/TabIndexState.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-/**
- * Interface implemented by state classes that support tab indexes.
- *
- * @author Vaadin Ltd
- * @version @VERSION@
- * @since 7.0.0
- *
- */
-public interface TabIndexState {
- /**
- * Gets the <i>tabulator index</i> of the field.
- *
- * @return the tab index for the Field
- */
- public int getTabIndex();
-
- /**
- * Sets the <i>tabulator index</i> of the field.
- *
- * @param tabIndex
- * the tab index to set
- */
- public void setTabIndex(int tabIndex);
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java b/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java
index 7302f9f2ac..16c32acecc 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java
@@ -121,6 +121,7 @@ public class TouchScrollDelegate implements NativePreviewHandler {
setElements(scrollables);
}
+ @Override
public void onTouchStart(TouchStartEvent event) {
assert delegate != null;
delegate.onTouchStart(event);
@@ -593,6 +594,7 @@ public class TouchScrollDelegate implements NativePreviewHandler {
- scrolledElement.getClientHeight();
}
+ @Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
int typeInt = event.getTypeInt();
if (transitionOn) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/TreeImages.java b/src/com/vaadin/terminal/gwt/client/ui/TreeImages.java
index 37f8889463..221a409511 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/TreeImages.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/TreeImages.java
@@ -15,6 +15,7 @@ public interface TreeImages extends com.google.gwt.user.client.ui.TreeImages {
* @gwt.resource com/vaadin/terminal/gwt/public/default/tree/img/expanded
* .png
*/
+ @Override
AbstractImagePrototype treeOpen();
/**
@@ -24,6 +25,7 @@ public interface TreeImages extends com.google.gwt.user.client.ui.TreeImages {
* @gwt.resource com/vaadin/terminal/gwt/public/default/tree/img/collapsed
* .png
*/
+ @Override
AbstractImagePrototype treeClosed();
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/UnknownComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ui/UnknownComponentConnector.java
index 0cccec6481..83ac97458e 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/UnknownComponentConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/UnknownComponentConnector.java
@@ -4,7 +4,6 @@
package com.vaadin.terminal.gwt.client.ui;
-
public class UnknownComponentConnector extends AbstractComponentConnector {
@Override
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VContextMenu.java b/src/com/vaadin/terminal/gwt/client/ui/VContextMenu.java
index 692e13bd94..607abe893a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VContextMenu.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VContextMenu.java
@@ -46,6 +46,7 @@ public class VContextMenu extends VOverlay implements SubPartAware {
private VLazyExecutor delayedImageLoadExecutioner = new VLazyExecutor(100,
new ScheduledCommand() {
+ @Override
public void execute() {
imagesLoaded();
}
@@ -103,6 +104,7 @@ public class VContextMenu extends VOverlay implements SubPartAware {
Util.sinkOnloadForImages(menu.getElement());
setPopupPositionAndShow(new PositionCallback() {
+ @Override
public void setPosition(int offsetWidth, int offsetHeight) {
// mac FF gets bad width due GWT popups overflow hacks,
// re-determine width
@@ -129,6 +131,7 @@ public class VContextMenu extends VOverlay implements SubPartAware {
* the positioning has been done.
*/
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
// Focus the menu.
menu.setFocus(true);
@@ -186,18 +189,22 @@ public class VContextMenu extends VOverlay implements SubPartAware {
return super.getItems().get(index);
}
+ @Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
return addDomHandler(handler, FocusEvent.getType());
}
+ @Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
return addDomHandler(handler, BlurEvent.getType());
}
+ @Override
public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
return addDomHandler(handler, KeyDownEvent.getType());
}
+ @Override
public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) {
return addDomHandler(handler, KeyPressEvent.getType());
}
@@ -215,6 +222,7 @@ public class VContextMenu extends VOverlay implements SubPartAware {
setFocus(true);
}
+ @Override
public void onLoad(LoadEvent event) {
// Handle icon onload events to ensure shadow is resized correctly
delayedImageLoadExecutioner.trigger();
@@ -222,6 +230,7 @@ public class VContextMenu extends VOverlay implements SubPartAware {
}
+ @Override
public Element getSubPartElement(String subPart) {
int index = Integer.parseInt(subPart.substring(6));
// ApplicationConnection.getConsole().log(
@@ -232,6 +241,7 @@ public class VContextMenu extends VOverlay implements SubPartAware {
return item.getElement().getFirstChildElement().cast();
}
+ @Override
public String getSubPartName(Element subElement) {
if (getElement().isOrHasChild(subElement)) {
com.google.gwt.dom.client.Element e = subElement;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VMarginInfo.java b/src/com/vaadin/terminal/gwt/client/ui/VMarginInfo.java
deleted file mode 100644
index 7ba1f4708c..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/VMarginInfo.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.io.Serializable;
-
-@SuppressWarnings("serial")
-public class VMarginInfo implements Serializable {
-
- private static final int TOP = 1;
- private static final int RIGHT = 2;
- private static final int BOTTOM = 4;
- private static final int LEFT = 8;
-
- private int bitMask;
-
- public VMarginInfo(int bitMask) {
- this.bitMask = bitMask;
- }
-
- public VMarginInfo(boolean top, boolean right, boolean bottom, boolean left) {
- setMargins(top, right, bottom, left);
- }
-
- public void setMargins(boolean top, boolean right, boolean bottom,
- boolean left) {
- bitMask = top ? TOP : 0;
- bitMask += right ? RIGHT : 0;
- bitMask += bottom ? BOTTOM : 0;
- bitMask += left ? LEFT : 0;
- }
-
- public void setMargins(VMarginInfo marginInfo) {
- bitMask = marginInfo.bitMask;
- }
-
- public boolean hasLeft() {
- return (bitMask & LEFT) == LEFT;
- }
-
- public boolean hasRight() {
- return (bitMask & RIGHT) == RIGHT;
- }
-
- public boolean hasTop() {
- return (bitMask & TOP) == TOP;
- }
-
- public boolean hasBottom() {
- return (bitMask & BOTTOM) == BOTTOM;
- }
-
- public int getBitMask() {
- return bitMask;
- }
-
- public void setMargins(boolean enabled) {
- if (enabled) {
- bitMask = TOP + RIGHT + BOTTOM + LEFT;
- } else {
- bitMask = 0;
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof VMarginInfo)) {
- return false;
- }
-
- return ((VMarginInfo) obj).bitMask == bitMask;
- }
-
- @Override
- public int hashCode() {
- return bitMask;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VOverlay.java b/src/com/vaadin/terminal/gwt/client/ui/VOverlay.java
index df655ef959..f2f13d1f35 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VOverlay.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VOverlay.java
@@ -6,7 +6,10 @@ package com.vaadin.terminal.gwt.client.ui;
import com.google.gwt.animation.client.Animation;
import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.IFrameElement;
import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.Style.BorderStyle;
+import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.logical.shared.CloseEvent;
import com.google.gwt.event.logical.shared.CloseHandler;
@@ -14,6 +17,7 @@ import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.gwt.client.BrowserInfo;
/**
@@ -23,6 +27,49 @@ import com.vaadin.terminal.gwt.client.BrowserInfo;
*/
public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
+ public static class PositionAndSize {
+ private int left, top, width, height;
+
+ public int getLeft() {
+ return left;
+ }
+
+ public void setLeft(int left) {
+ this.left = left;
+ }
+
+ public int getTop() {
+ return top;
+ }
+
+ public void setTop(int top) {
+ this.top = top;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ public void setAnimationFromCenterProgress(double progress) {
+ left += (int) (width * (1.0 - progress) / 2.0);
+ top += (int) (height * (1.0 - progress) / 2.0);
+ width = (int) (width * progress);
+ height = (int) (height * progress);
+ }
+ }
+
/*
* The z-index value from where all overlays live. This can be overridden in
* any extending class.
@@ -45,6 +92,18 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
*/
private Element shadow;
+ /*
+ * Creator of VOverlow (widget that made the instance, not the layout
+ * parent)
+ */
+ private Widget owner;
+
+ /**
+ * The shim iframe behind the overlay, allowing PDFs and applets to be
+ * covered by overlays.
+ */
+ private IFrameElement shimElement;
+
/**
* The HTML snippet that is used to render the actual shadow. In consists of
* nine different DIV-elements with the following class names:
@@ -66,6 +125,11 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
*/
private static final String SHADOW_HTML = "<div class=\"top-left\"></div><div class=\"top\"></div><div class=\"top-right\"></div><div class=\"left\"></div><div class=\"center\"></div><div class=\"right\"></div><div class=\"bottom-left\"></div><div class=\"bottom\"></div><div class=\"bottom-right\"></div>";
+ /**
+ * Matches {@link PopupPanel}.ANIMATION_DURATION
+ */
+ private static final int POPUP_PANEL_ANIMATION_DURATION = 200;
+
private boolean sinkShadowEvents = false;
public VOverlay() {
@@ -116,9 +180,15 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
return shadow != null;
}
+ private void removeShim() {
+ if (shimElement != null) {
+ shimElement.removeFromParent();
+ }
+ }
+
private void removeShadowIfPresent() {
if (isShadowAttached()) {
- shadow.getParentElement().removeChild(shadow);
+ shadow.removeFromParent();
// Remove event listener from the shadow
unsinkShadowEvents();
@@ -129,6 +199,10 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
return isShadowEnabled() && shadow.getParentElement() != null;
}
+ private boolean isShimAttached() {
+ return shimElement != null && shimElement.hasParentElement();
+ }
+
private void adjustZIndex() {
setZIndex(Z_INDEX);
}
@@ -156,7 +230,46 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
style.setMarginLeft(-adjustByRelativeLeftBodyMargin(), Unit.PX);
style.setMarginTop(-adjustByRelativeTopBodyMargin(), Unit.PX);
super.setPopupPosition(left, top);
- updateShadowSizeAndPosition(isAnimationEnabled() ? 0 : 1);
+ sizeOrPositionUpdated(isAnimationEnabled() ? 0 : 1);
+ }
+
+ private IFrameElement getShimElement() {
+ if (shimElement == null) {
+ shimElement = Document.get().createIFrameElement();
+
+ // Insert shim iframe before the main overlay element. It does not
+ // matter if it is in front or behind the shadow as we cannot put a
+ // shim behind the shadow due to its transparency.
+ shimElement.getStyle().setPosition(Position.ABSOLUTE);
+ shimElement.getStyle().setBorderStyle(BorderStyle.NONE);
+ shimElement.setFrameBorder(0);
+ shimElement.setMarginHeight(0);
+ }
+ return shimElement;
+ }
+
+ private int getActualTop() {
+ int y = getAbsoluteTop();
+
+ /* This is needed for IE7 at least */
+ // Account for the difference between absolute position and the
+ // body's positioning context.
+ y -= Document.get().getBodyOffsetTop();
+ y -= adjustByRelativeTopBodyMargin();
+
+ return y;
+ }
+
+ private int getActualLeft() {
+ int x = getAbsoluteLeft();
+
+ /* This is needed for IE7 at least */
+ // Account for the difference between absolute position and the
+ // body's positioning context.
+ x -= Document.get().getBodyOffsetLeft();
+ x -= adjustByRelativeLeftBodyMargin();
+
+ return x;
}
private static int adjustByRelativeTopBodyMargin() {
@@ -189,13 +302,10 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
@Override
public void show() {
super.show();
- if (isShadowEnabled()) {
- if (isAnimationEnabled()) {
- ShadowAnimation sa = new ShadowAnimation();
- sa.run(200);
- } else {
- updateShadowSizeAndPosition(1.0);
- }
+ if (isAnimationEnabled()) {
+ new ResizeAnimation().run(POPUP_PANEL_ANIMATION_DURATION);
+ } else {
+ sizeOrPositionUpdated(1.0);
}
}
@@ -205,6 +315,7 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
// Always ensure shadow is removed when the overlay is removed.
removeShadowIfPresent();
+ removeShim();
}
@Override
@@ -219,13 +330,13 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
@Override
public void setWidth(String width) {
super.setWidth(width);
- updateShadowSizeAndPosition(1.0);
+ sizeOrPositionUpdated(1.0);
}
@Override
public void setHeight(String height) {
super.setHeight(height);
- updateShadowSizeAndPosition(1.0);
+ sizeOrPositionUpdated(1.0);
}
/**
@@ -244,28 +355,29 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
}
}
- /*
+ /**
* Extending classes should always call this method after they change the
* size of overlay without using normal 'setWidth(String)' and
* 'setHeight(String)' methods (if not calling super.setWidth/Height).
+ *
*/
- public void updateShadowSizeAndPosition() {
- updateShadowSizeAndPosition(1.0);
+ public void sizeOrPositionUpdated() {
+ sizeOrPositionUpdated(1.0);
}
/**
- * Recalculates proper position and dimensions for the shadow element. Can
- * be used to animate the shadow, using the 'progress' parameter (used to
- * animate the shadow in sync with GWT PopupPanel's default animation
- * 'PopupPanel.AnimationType.CENTER').
+ * Recalculates proper position and dimensions for the shadow and shim
+ * elements. Can be used to animate the related elements, using the
+ * 'progress' parameter (used to animate the shadow in sync with GWT
+ * PopupPanel's default animation 'PopupPanel.AnimationType.CENTER').
*
* @param progress
* A value between 0.0 and 1.0, indicating the progress of the
* animation (0=start, 1=end).
*/
- private void updateShadowSizeAndPosition(final double progress) {
+ private void sizeOrPositionUpdated(final double progress) {
// Don't do anything if overlay element is not attached
- if (!isAttached() || shadow == null) {
+ if (!isAttached()) {
return;
}
// Calculate proper z-index
@@ -288,37 +400,26 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
getOffsetWidth();
}
- int x = getAbsoluteLeft();
- int y = getAbsoluteTop();
+ PositionAndSize positionAndSize = new PositionAndSize();
+ positionAndSize.left = getActualLeft();
+ positionAndSize.top = getActualTop();
+ positionAndSize.width = getOffsetWidth();
+ positionAndSize.height = getOffsetHeight();
- /* This is needed for IE7 at least */
- // Account for the difference between absolute position and the
- // body's positioning context.
- x -= Document.get().getBodyOffsetLeft();
- y -= Document.get().getBodyOffsetTop();
- x -= adjustByRelativeLeftBodyMargin();
- y -= adjustByRelativeTopBodyMargin();
-
- int width = getOffsetWidth();
- int height = getOffsetHeight();
-
- if (width < 0) {
- width = 0;
+ if (positionAndSize.width < 0) {
+ positionAndSize.width = 0;
}
- if (height < 0) {
- height = 0;
+ if (positionAndSize.height < 0) {
+ positionAndSize.height = 0;
}
- // Animate the shadow size
- x += (int) (width * (1.0 - progress) / 2.0);
- y += (int) (height * (1.0 - progress) / 2.0);
- width = (int) (width * progress);
- height = (int) (height * progress);
+ // Animate the size
+ positionAndSize.setAnimationFromCenterProgress(progress);
// Opera needs some shaking to get parts of the shadow showing
// properly
// (ticket #2704)
- if (BrowserInfo.get().isOpera()) {
+ if (BrowserInfo.get().isOpera() && isShadowEnabled()) {
// Clear the height of all middle elements
DOM.getChild(shadow, 3).getStyle().setProperty("height", "auto");
DOM.getChild(shadow, 4).getStyle().setProperty("height", "auto");
@@ -326,15 +427,17 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
}
// Update correct values
- DOM.setStyleAttribute(shadow, "zIndex", zIndex);
- DOM.setStyleAttribute(shadow, "width", width + "px");
- DOM.setStyleAttribute(shadow, "height", height + "px");
- DOM.setStyleAttribute(shadow, "top", y + "px");
- DOM.setStyleAttribute(shadow, "left", x + "px");
- DOM.setStyleAttribute(shadow, "display", progress < 0.9 ? "none" : "");
+ if (isShadowEnabled()) {
+ updateSizeAndPosition(shadow, positionAndSize);
+ DOM.setStyleAttribute(shadow, "zIndex", zIndex);
+ DOM.setStyleAttribute(shadow, "display", progress < 0.9 ? "none"
+ : "");
+ }
+ updateSizeAndPosition((Element) Element.as(getShimElement()),
+ positionAndSize);
// Opera fix, part 2 (ticket #2704)
- if (BrowserInfo.get().isOpera()) {
+ if (BrowserInfo.get().isOpera() && isShadowEnabled()) {
// We'll fix the height of all the middle elements
DOM.getChild(shadow, 3)
.getStyle()
@@ -351,20 +454,33 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
}
// Attach to dom if not there already
- if (!isShadowAttached()) {
+ if (isShadowEnabled() && !isShadowAttached()) {
RootPanel.get().getElement().insertBefore(shadow, getElement());
sinkShadowEvents();
}
+ if (!isShimAttached()) {
+ RootPanel.get().getElement()
+ .insertBefore(shimElement, getElement());
+ }
+
+ }
+ private void updateSizeAndPosition(Element e,
+ PositionAndSize positionAndSize) {
+ e.getStyle().setLeft(positionAndSize.left, Unit.PX);
+ e.getStyle().setTop(positionAndSize.top, Unit.PX);
+ e.getStyle().setWidth(positionAndSize.width, Unit.PX);
+ e.getStyle().setHeight(positionAndSize.height, Unit.PX);
}
- protected class ShadowAnimation extends Animation {
+ protected class ResizeAnimation extends Animation {
@Override
protected void onUpdate(double progress) {
- updateShadowSizeAndPosition(progress);
+ sizeOrPositionUpdated(progress);
}
}
+ @Override
public void onClose(CloseEvent<PopupPanel> event) {
removeShadowIfPresent();
}
@@ -414,4 +530,25 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> {
protected boolean isSinkShadowEvents() {
return sinkShadowEvents;
}
+
+ /**
+ * Get owner (Widget that made this VOverlay, not the layout parent) of
+ * VOverlay
+ *
+ * @return Owner (creator) or null if not defined
+ */
+ public Widget getOwner() {
+ return owner;
+ }
+
+ /**
+ * Set owner (Widget that made this VOverlay, not the layout parent) of
+ * VOverlay
+ *
+ * @param owner
+ * Owner (creator) of VOverlay
+ */
+ public void setOwner(Widget owner) {
+ this.owner = owner;
+ }
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/Vaadin6Connector.java b/src/com/vaadin/terminal/gwt/client/ui/Vaadin6Connector.java
index 7fccdafd2a..f2f0125c86 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/Vaadin6Connector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/Vaadin6Connector.java
@@ -10,6 +10,7 @@ import com.vaadin.terminal.gwt.client.UIDL;
public abstract class Vaadin6Connector extends AbstractComponentConnector
implements Paintable {
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
((Paintable) getWidget()).updateFromUIDL(uidl, client);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutConnector.java
index 91436f5353..188d464b84 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutConnector.java
@@ -10,6 +10,10 @@ import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.LayoutClickRpc;
+import com.vaadin.shared.ui.absolutelayout.AbsoluteLayoutServerRpc;
+import com.vaadin.shared.ui.absolutelayout.AbsoluteLayoutState;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
import com.vaadin.terminal.gwt.client.DirectionalManagedLayout;
@@ -18,9 +22,7 @@ import com.vaadin.terminal.gwt.client.VCaption;
import com.vaadin.terminal.gwt.client.communication.RpcProxy;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler;
-import com.vaadin.terminal.gwt.client.ui.LayoutClickRpc;
import com.vaadin.terminal.gwt.client.ui.absolutelayout.VAbsoluteLayout.AbsoluteWrapper;
import com.vaadin.ui.AbsoluteLayout;
@@ -68,6 +70,7 @@ public class AbsoluteLayoutConnector extends
element);
}
+ @Override
public void updateCaption(ComponentConnector component) {
VAbsoluteLayout absoluteLayoutWidget = getWidget();
AbsoluteWrapper componentWrapper = getWrapper(component);
@@ -147,6 +150,7 @@ public class AbsoluteLayoutConnector extends
}
}
+ @Override
public void layoutVertically() {
VAbsoluteLayout layout = getWidget();
for (ComponentConnector paintable : getChildComponents()) {
@@ -179,6 +183,7 @@ public class AbsoluteLayoutConnector extends
}
}
+ @Override
public void layoutHorizontally() {
VAbsoluteLayout layout = getWidget();
for (ComponentConnector paintable : getChildComponents()) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutServerRpc.java b/src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutServerRpc.java
deleted file mode 100644
index d626eb5b6c..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutServerRpc.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.absolutelayout;
-
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.ui.LayoutClickRpc;
-
-public interface AbsoluteLayoutServerRpc extends LayoutClickRpc, ServerRpc {
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutState.java b/src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutState.java
deleted file mode 100644
index 4e1a43dd8b..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/absolutelayout/AbsoluteLayoutState.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.absolutelayout;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.client.ui.AbstractLayoutState;
-
-public class AbsoluteLayoutState extends AbstractLayoutState {
- // Maps each component to a position
- private Map<String, String> connectorToCssPosition = new HashMap<String, String>();
-
- public String getConnectorPosition(Connector connector) {
- return connectorToCssPosition.get(connector.getConnectorId());
- }
-
- public Map<String, String> getConnectorToCssPosition() {
- return connectorToCssPosition;
- }
-
- public void setConnectorToCssPosition(
- Map<String, String> componentToCssPosition) {
- connectorToCssPosition = componentToCssPosition;
- }
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/accordion/AccordionConnector.java b/src/com/vaadin/terminal/gwt/client/ui/accordion/AccordionConnector.java
index f022e97973..7ff1257da3 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/accordion/AccordionConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/accordion/AccordionConnector.java
@@ -5,10 +5,10 @@ package com.vaadin.terminal.gwt.client.ui.accordion;
import java.util.Iterator;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout;
import com.vaadin.terminal.gwt.client.ui.accordion.VAccordion.StackItem;
import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren;
@@ -57,10 +57,12 @@ public class AccordionConnector extends TabsheetBaseConnector implements
return (VAccordion) super.getWidget();
}
+ @Override
public void updateCaption(ComponentConnector component) {
/* Accordion does not render its children's captions */
}
+ @Override
public void layout() {
VAccordion accordion = getWidget();
diff --git a/src/com/vaadin/terminal/gwt/client/ui/accordion/VAccordion.java b/src/com/vaadin/terminal/gwt/client/ui/accordion/VAccordion.java
index b83d5afb00..d9320787e8 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/accordion/VAccordion.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/accordion/VAccordion.java
@@ -434,6 +434,7 @@ public class VAccordion extends VTabsheetBase {
}
}
+ @Override
public void onClick(ClickEvent event) {
onSelectTab(this);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/audio/AudioConnector.java b/src/com/vaadin/terminal/gwt/client/ui/audio/AudioConnector.java
index 1c7feb132a..6b713c229c 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/audio/AudioConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/audio/AudioConnector.java
@@ -7,9 +7,9 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.MediaBaseConnector;
import com.vaadin.ui.Audio;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/button/ButtonConnector.java b/src/com/vaadin/terminal/gwt/client/ui/button/ButtonConnector.java
index d79aa96ac6..0cec6ce96b 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/button/ButtonConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/button/ButtonConnector.java
@@ -12,15 +12,17 @@ import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.DOM;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.communication.FieldRpc.FocusAndBlurServerRpc;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
+import com.vaadin.shared.ui.button.ButtonServerRpc;
+import com.vaadin.shared.ui.button.ButtonState;
import com.vaadin.terminal.gwt.client.EventHelper;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.MouseEventDetailsBuilder;
-import com.vaadin.terminal.gwt.client.communication.FieldRpc.FocusAndBlurServerRpc;
import com.vaadin.terminal.gwt.client.communication.RpcProxy;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
import com.vaadin.terminal.gwt.client.ui.Icon;
import com.vaadin.ui.Button;
@@ -103,18 +105,21 @@ public class ButtonConnector extends AbstractComponentConnector implements
return (ButtonState) super.getState();
}
+ @Override
public void onFocus(FocusEvent event) {
// EventHelper.updateFocusHandler ensures that this is called only when
// there is a listener on server side
focusBlurProxy.focus();
}
+ @Override
public void onBlur(BlurEvent event) {
// EventHelper.updateFocusHandler ensures that this is called only when
// there is a listener on server side
focusBlurProxy.blur();
}
+ @Override
public void onClick(ClickEvent event) {
if (getState().isDisableOnClick()) {
getWidget().setEnabled(false);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/button/ButtonServerRpc.java b/src/com/vaadin/terminal/gwt/client/ui/button/ButtonServerRpc.java
deleted file mode 100644
index 4a379c9262..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/button/ButtonServerRpc.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.button;
-
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-
-/**
- * RPC interface for calls from client to server.
- *
- * @since 7.0
- */
-public interface ButtonServerRpc extends ServerRpc {
- /**
- * Button click event.
- *
- * @param mouseEventDetails
- * serialized mouse event details
- */
- public void click(MouseEventDetails mouseEventDetails);
-
- /**
- * Indicate to the server that the client has disabled the button as a
- * result of a click.
- */
- public void disableOnClick();
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/button/ButtonState.java b/src/com/vaadin/terminal/gwt/client/ui/button/ButtonState.java
deleted file mode 100644
index 2daceea0e8..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/button/ButtonState.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.ui.button;
-
-import com.vaadin.terminal.gwt.client.ComponentState;
-import com.vaadin.terminal.gwt.client.ui.TabIndexState;
-import com.vaadin.ui.Button;
-
-/**
- * Shared state for Button and NativeButton.
- *
- * @see ComponentState
- *
- * @since 7.0
- */
-public class ButtonState extends ComponentState implements TabIndexState {
- private boolean disableOnClick = false;
- private int clickShortcutKeyCode = 0;
- /**
- * The tab order number of this field.
- */
- private int tabIndex = 0;
- /**
- * If caption should be rendered in HTML
- */
- private boolean htmlContentAllowed = false;
-
- /**
- * Checks whether the button should be disabled on the client side on next
- * click.
- *
- * @return true if the button should be disabled on click
- */
- public boolean isDisableOnClick() {
- return disableOnClick;
- }
-
- /**
- * Sets whether the button should be disabled on the client side on next
- * click.
- *
- * @param disableOnClick
- * true if the button should be disabled on click
- */
- public void setDisableOnClick(boolean disableOnClick) {
- this.disableOnClick = disableOnClick;
- }
-
- /**
- * Returns the key code for activating the button via a keyboard shortcut.
- *
- * See {@link Button#setClickShortcut(int, int...)} for more information.
- *
- * @return key code or 0 for none
- */
- public int getClickShortcutKeyCode() {
- return clickShortcutKeyCode;
- }
-
- /**
- * Sets the key code for activating the button via a keyboard shortcut.
- *
- * See {@link Button#setClickShortcut(int, int...)} for more information.
- *
- * @param clickShortcutKeyCode
- * key code or 0 for none
- */
- public void setClickShortcutKeyCode(int clickShortcutKeyCode) {
- this.clickShortcutKeyCode = clickShortcutKeyCode;
- }
-
- /**
- * Set whether the caption text is rendered as HTML or not. You might need
- * to retheme button to allow higher content than the original text style.
- *
- * If set to true, the captions are passed to the browser as html and the
- * developer is responsible for ensuring no harmful html is used. If set to
- * false, the content is passed to the browser as plain text.
- *
- * @param htmlContentAllowed
- * <code>true</code> if caption is rendered as HTML,
- * <code>false</code> otherwise
- */
- public void setHtmlContentAllowed(boolean htmlContentAllowed) {
- this.htmlContentAllowed = htmlContentAllowed;
- }
-
- /**
- * Return HTML rendering setting.
- *
- * @return <code>true</code> if the caption text is to be rendered as HTML,
- * <code>false</code> otherwise
- */
- public boolean isHtmlContentAllowed() {
- return htmlContentAllowed;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.vaadin.terminal.gwt.client.ui.TabIndexState#getTabIndex()
- */
- public int getTabIndex() {
- return tabIndex;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.vaadin.terminal.gwt.client.ui.TabIndexState#setTabIndex(int)
- */
- public void setTabIndex(int tabIndex) {
- this.tabIndex = tabIndex;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/button/VButton.java b/src/com/vaadin/terminal/gwt/client/ui/button/VButton.java
index 0cd8bc54f4..3232338f62 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/button/VButton.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/button/VButton.java
@@ -18,7 +18,6 @@ import com.google.gwt.user.client.ui.FocusWidget;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ui.Icon;
public class VButton extends FocusWidget implements ClickHandler {
@@ -90,7 +89,6 @@ public class VButton extends FocusWidget implements ClickHandler {
setTabIndex(0);
sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS | Event.FOCUSEVENTS
| Event.KEYEVENTS);
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
setStyleName(CLASSNAME);
@@ -128,9 +126,6 @@ public class VButton extends FocusWidget implements ClickHandler {
* -onload event handler added (for icon handling)
*/
public void onBrowserEvent(Event event) {
- if (client != null) {
- client.handleTooltipEvent(event, this);
- }
if (DOM.eventGetType(event) == Event.ONLOAD) {
Util.notifyParentOfSizeChange(this, true);
}
@@ -286,6 +281,7 @@ public class VButton extends FocusWidget implements ClickHandler {
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event
* .dom.client.ClickEvent)
*/
+ @Override
public void onClick(ClickEvent event) {
if (BrowserInfo.get().isSafari()) {
VButton.this.setFocus(true);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxConnector.java b/src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxConnector.java
index bc405b793b..c7e827bc74 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxConnector.java
@@ -12,15 +12,17 @@ import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.communication.FieldRpc.FocusAndBlurServerRpc;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.checkbox.CheckBoxServerRpc;
+import com.vaadin.shared.ui.checkbox.CheckBoxState;
import com.vaadin.terminal.gwt.client.EventHelper;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.MouseEventDetailsBuilder;
import com.vaadin.terminal.gwt.client.VTooltip;
-import com.vaadin.terminal.gwt.client.communication.FieldRpc.FocusAndBlurServerRpc;
import com.vaadin.terminal.gwt.client.communication.RpcProxy;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.ui.AbstractFieldConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.Icon;
import com.vaadin.ui.CheckBox;
@@ -114,18 +116,21 @@ public class CheckBoxConnector extends AbstractFieldConnector implements
return (VCheckBox) super.getWidget();
}
+ @Override
public void onFocus(FocusEvent event) {
// EventHelper.updateFocusHandler ensures that this is called only when
// there is a listener on server side
focusBlurRpc.focus();
}
+ @Override
public void onBlur(BlurEvent event) {
// EventHelper.updateFocusHandler ensures that this is called only when
// there is a listener on server side
focusBlurRpc.blur();
}
+ @Override
public void onClick(ClickEvent event) {
if (!isEnabled()) {
return;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxServerRpc.java b/src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxServerRpc.java
deleted file mode 100644
index 05091ff6ed..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxServerRpc.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.checkbox;
-
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-
-public interface CheckBoxServerRpc extends ServerRpc {
- public void setChecked(boolean checked, MouseEventDetails mouseEventDetails);
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxState.java b/src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxState.java
deleted file mode 100644
index d6d51cad36..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/checkbox/CheckBoxState.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.checkbox;
-
-import com.vaadin.terminal.gwt.client.AbstractFieldState;
-
-public class CheckBoxState extends AbstractFieldState {
- private boolean checked = false;
-
- public boolean isChecked() {
- return checked;
- }
-
- public void setChecked(boolean checked) {
- this.checked = checked;
- }
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/checkbox/VCheckBox.java b/src/com/vaadin/terminal/gwt/client/ui/checkbox/VCheckBox.java
index fd90796ea5..a6eec2de8a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/checkbox/VCheckBox.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/checkbox/VCheckBox.java
@@ -31,7 +31,6 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements
public VCheckBox() {
setStyleName(CLASSNAME);
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
Element el = DOM.getFirstChild(getElement());
while (el != null) {
DOM.sinkEvents(el,
@@ -53,9 +52,6 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements
if (event.getTypeInt() == Event.ONLOAD) {
Util.notifyParentOfSizeChange(this, true);
}
- if (client != null) {
- client.handleTooltipEvent(event, this);
- }
}
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/combobox/ComboBoxConnector.java b/src/com/vaadin/terminal/gwt/client/ui/combobox/ComboBoxConnector.java
index ff153d30c9..0fa71bb7a6 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/combobox/ComboBoxConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/combobox/ComboBoxConnector.java
@@ -5,12 +5,12 @@ package com.vaadin.terminal.gwt.client.ui.combobox;
import java.util.Iterator;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.ui.AbstractFieldConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout;
import com.vaadin.terminal.gwt.client.ui.combobox.VFilterSelect.FilterSelectSuggestion;
import com.vaadin.terminal.gwt.client.ui.menubar.MenuItem;
@@ -27,6 +27,7 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
* com.vaadin.terminal.gwt.client.Paintable#updateFromUIDL(com.vaadin.terminal
* .gwt.client.UIDL, com.vaadin.terminal.gwt.client.ApplicationConnection)
*/
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
// Save details
getWidget().client = client;
@@ -230,6 +231,7 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
return (VFilterSelect) super.getWidget();
}
+ @Override
public void layout() {
VFilterSelect widget = getWidget();
if (widget.initDone) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/combobox/VFilterSelect.java b/src/com/vaadin/terminal/gwt/client/ui/combobox/VFilterSelect.java
index 8c5d521445..6e24a74e04 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/combobox/VFilterSelect.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/combobox/VFilterSelect.java
@@ -44,17 +44,16 @@ import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.PopupPanel.PositionCallback;
import com.google.gwt.user.client.ui.SuggestOracle.Suggestion;
import com.google.gwt.user.client.ui.TextBox;
+import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.EventId;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.ComponentState;
import com.vaadin.terminal.gwt.client.ConnectorMap;
-import com.vaadin.terminal.gwt.client.EventId;
import com.vaadin.terminal.gwt.client.Focusable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ui.Field;
import com.vaadin.terminal.gwt.client.ui.SubPartAware;
import com.vaadin.terminal.gwt.client.ui.VLazyExecutor;
@@ -102,6 +101,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* specified) and the caption of the item
*/
+ @Override
public String getDisplayString() {
final StringBuffer sb = new StringBuffer();
if (iconUri != null) {
@@ -125,6 +125,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* Get a string that represents this item. This is used in the text box.
*/
+ @Override
public String getReplacementString() {
return caption;
}
@@ -151,6 +152,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* Executes a selection of this item.
*/
+ @Override
public void execute() {
onSuggestionSelected(this);
}
@@ -455,6 +457,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* (int, int)
*/
+ @Override
public void setPosition(int offsetWidth, int offsetHeight) {
int top = -1;
@@ -592,6 +595,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
private VLazyExecutor delayedImageLoadExecutioner = new VLazyExecutor(
100, new ScheduledCommand() {
+ @Override
public void execute() {
if (suggestionPopup.isVisible()
&& suggestionPopup.isAttached()) {
@@ -749,6 +753,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
private static final String SUBPART_PREFIX = "item";
+ @Override
public Element getSubPartElement(String subPart) {
int index = Integer.parseInt(subPart.substring(SUBPART_PREFIX
.length()));
@@ -758,6 +763,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
return item.getElement();
}
+ @Override
public String getSubPartName(Element subElement) {
if (!getElement().isOrHasChild(subElement)) {
return null;
@@ -780,6 +786,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
return null;
}
+ @Override
public void onLoad(LoadEvent event) {
// Handle icon onload events to ensure shadow is resized
// correctly
@@ -824,21 +831,6 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* The text box where the filter is written
*/
protected final TextBox tb = new TextBox() {
- /*
- * (non-Javadoc)
- *
- * @see
- * com.google.gwt.user.client.ui.TextBoxBase#onBrowserEvent(com.google
- * .gwt.user.client.Event)
- */
-
- @Override
- public void onBrowserEvent(Event event) {
- super.onBrowserEvent(event);
- if (client != null) {
- client.handleTooltipEvent(event, VFilterSelect.this);
- }
- }
// Overridden to avoid selecting text when text input is disabled
@Override
@@ -869,9 +861,6 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
- if (client != null) {
- client.handleTooltipEvent(event, VFilterSelect.this);
- }
/*
* Prevent the keyboard focus from leaving the textfield by
@@ -961,6 +950,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
selectedItemIcon.setStyleName("v-icon");
selectedItemIcon.addLoadHandler(new LoadHandler() {
+ @Override
public void onLoad(LoadEvent event) {
if (BrowserInfo.get().isIE8()) {
// IE8 needs some help to discover it should reposition the
@@ -972,8 +962,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
}
});
- tb.sinkEvents(VTooltip.TOOLTIP_EVENTS);
- popupOpener.sinkEvents(VTooltip.TOOLTIP_EVENTS | Event.ONMOUSEDOWN);
+ popupOpener.sinkEvents(Event.ONMOUSEDOWN);
panel.add(tb);
panel.add(popupOpener);
initWidget(panel);
@@ -1214,6 +1203,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* .event.dom.client.KeyDownEvent)
*/
+ @Override
public void onKeyDown(KeyDownEvent event) {
if (enabled && !readonly) {
int keyCode = event.getNativeKeyCode();
@@ -1376,6 +1366,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* The KeyUpEvent of the key depressed
*/
+ @Override
public void onKeyUp(KeyUpEvent event) {
if (enabled && !readonly) {
switch (event.getNativeKeyCode()) {
@@ -1424,6 +1415,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* Listener for popupopener
*/
+ @Override
public void onClick(ClickEvent event) {
if (textInputEnabled
&& event.getNativeEvent().getEventTarget().cast() == tb
@@ -1488,6 +1480,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* .dom.client.FocusEvent)
*/
+ @Override
public void onFocus(FocusEvent event) {
/*
@@ -1525,6 +1518,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* .dom.client.BlurEvent)
*/
+ @Override
public void onBlur(BlurEvent event) {
if (BrowserInfo.get().isIE() && preventNextBlurEventInIE) {
@@ -1582,6 +1576,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* @see com.vaadin.terminal.gwt.client.Focusable#focus()
*/
+ @Override
public void focus() {
focused = true;
if (prompting && !readonly) {
@@ -1690,6 +1685,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
suggestionPopup.hide();
}
+ @Override
public Element getSubPartElement(String subPart) {
if ("textbox".equals(subPart)) {
return this.tb.getElement();
@@ -1699,6 +1695,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
return null;
}
+ @Override
public String getSubPartName(Element subElement) {
if (tb.getElement().isOrHasChild(subElement)) {
return "textbox";
diff --git a/src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutConnector.java
index 4d341bddfc..7d07172cd1 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutConnector.java
@@ -9,6 +9,11 @@ import java.util.Map;
import com.google.gwt.dom.client.Style;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.LayoutClickRpc;
+import com.vaadin.shared.ui.VMarginInfo;
+import com.vaadin.shared.ui.csslayout.CssLayoutServerRpc;
+import com.vaadin.shared.ui.csslayout.CssLayoutState;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
@@ -17,10 +22,7 @@ import com.vaadin.terminal.gwt.client.VCaption;
import com.vaadin.terminal.gwt.client.communication.RpcProxy;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.ui.AbstractLayoutConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler;
-import com.vaadin.terminal.gwt.client.ui.LayoutClickRpc;
-import com.vaadin.terminal.gwt.client.ui.VMarginInfo;
import com.vaadin.terminal.gwt.client.ui.csslayout.VCssLayout.FlowPane;
import com.vaadin.ui.CssLayout;
@@ -137,6 +139,7 @@ public class CssLayoutConnector extends AbstractLayoutConnector {
return (VCssLayout) super.getWidget();
}
+ @Override
public void updateCaption(ComponentConnector child) {
Widget childWidget = child.getWidget();
FlowPane cssLayoutWidgetContainer = getWidget().panel;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutServerRpc.java b/src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutServerRpc.java
deleted file mode 100644
index 7ba89d4c4c..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutServerRpc.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.csslayout;
-
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.ui.LayoutClickRpc;
-
-public interface CssLayoutServerRpc extends LayoutClickRpc, ServerRpc {
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutState.java b/src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutState.java
deleted file mode 100644
index 07a8c1804a..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/csslayout/CssLayoutState.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.csslayout;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.client.ui.AbstractLayoutState;
-
-public class CssLayoutState extends AbstractLayoutState {
- private Map<Connector, String> childCss = new HashMap<Connector, String>();
-
- public Map<Connector, String> getChildCss() {
- return childCss;
- }
-
- public void setChildCss(Map<Connector, String> childCss) {
- this.childCss = childCss;
- }
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/csslayout/VCssLayout.java b/src/com/vaadin/terminal/gwt/client/ui/csslayout/VCssLayout.java
index 7076120388..53f8ca6c8a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/csslayout/VCssLayout.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/csslayout/VCssLayout.java
@@ -9,8 +9,8 @@ import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.VMarginInfo;
import com.vaadin.terminal.gwt.client.StyleConstants;
-import com.vaadin.terminal.gwt.client.ui.VMarginInfo;
public class VCssLayout extends SimplePanel {
public static final String TAGNAME = "csslayout";
diff --git a/src/com/vaadin/terminal/gwt/client/ui/customcomponent/CustomComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ui/customcomponent/CustomComponentConnector.java
index 5001711d6c..f7740a9205 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/customcomponent/CustomComponentConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/customcomponent/CustomComponentConnector.java
@@ -3,11 +3,11 @@
*/
package com.vaadin.terminal.gwt.client.ui.customcomponent;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
import com.vaadin.ui.CustomComponent;
@Connect(value = CustomComponent.class, loadStyle = LoadStyle.EAGER)
@@ -19,6 +19,7 @@ public class CustomComponentConnector extends
return (VCustomComponent) super.getWidget();
}
+ @Override
public void updateCaption(ComponentConnector component) {
// NOP, custom component dont render composition roots caption
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/customfield/CustomFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/customfield/CustomFieldConnector.java
index 09045df6eb..b4f42c36aa 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/customfield/CustomFieldConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/customfield/CustomFieldConnector.java
@@ -4,9 +4,9 @@
package com.vaadin.terminal.gwt.client.ui.customfield;
import com.google.gwt.core.client.GWT;
-import com.vaadin.terminal.gwt.client.AbstractFieldState;
-import com.vaadin.terminal.gwt.client.communication.SharedState;
-import com.vaadin.terminal.gwt.client.ui.Connect;
+import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.communication.SharedState;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.customcomponent.CustomComponentConnector;
import com.vaadin.ui.CustomField;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/customlayout/CustomLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/customlayout/CustomLayoutConnector.java
index f8861caf92..9d973227d1 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/customlayout/CustomLayoutConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/customlayout/CustomLayoutConnector.java
@@ -5,17 +5,21 @@ package com.vaadin.terminal.gwt.client.ui.customlayout;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.customlayout.CustomLayoutState;
+import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
+import com.vaadin.terminal.gwt.client.Paintable;
+import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.ui.AbstractLayoutConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout;
import com.vaadin.ui.CustomLayout;
@Connect(CustomLayout.class)
public class CustomLayoutConnector extends AbstractLayoutConnector implements
- SimpleManagedLayout {
+ SimpleManagedLayout, Paintable {
@Override
public CustomLayoutState getState() {
@@ -102,11 +106,19 @@ public class CustomLayoutConnector extends AbstractLayoutConnector implements
return (VCustomLayout) super.getWidget();
}
+ @Override
public void updateCaption(ComponentConnector paintable) {
getWidget().updateCaption(paintable);
}
+ @Override
public void layout() {
getWidget().iLayoutJS(DOM.getFirstChild(getWidget().getElement()));
}
+
+ @Override
+ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+ // Not interested in anything from the UIDL - just implementing the
+ // interface to avoid some warning (#8688)
+ }
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/customlayout/CustomLayoutState.java b/src/com/vaadin/terminal/gwt/client/ui/customlayout/CustomLayoutState.java
deleted file mode 100644
index 6b374a8099..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/customlayout/CustomLayoutState.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.customlayout;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.client.ui.AbstractLayoutState;
-
-public class CustomLayoutState extends AbstractLayoutState {
- Map<Connector, String> childLocations = new HashMap<Connector, String>();
- private String templateContents;
- private String templateName;
-
- public String getTemplateContents() {
- return templateContents;
- }
-
- public void setTemplateContents(String templateContents) {
- this.templateContents = templateContents;
- }
-
- public String getTemplateName() {
- return templateName;
- }
-
- public void setTemplateName(String templateName) {
- this.templateName = templateName;
- }
-
- public Map<Connector, String> getChildLocations() {
- return childLocations;
- }
-
- public void setChildLocations(Map<Connector, String> childLocations) {
- this.childLocations = childLocations;
- }
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/datefield/AbstractDateFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/datefield/AbstractDateFieldConnector.java
index b55f480bac..159b5bc414 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/datefield/AbstractDateFieldConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/datefield/AbstractDateFieldConnector.java
@@ -15,6 +15,7 @@ import com.vaadin.terminal.gwt.client.ui.AbstractFieldConnector;
public class AbstractDateFieldConnector extends AbstractFieldConnector
implements Paintable {
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
if (!isRealUpdate(uidl)) {
return;
@@ -63,15 +64,23 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector
newResolution = VDateField.RESOLUTION_YEAR;
}
+ // Remove old stylename that indicates current resolution
+ setWidgetStyleName(
+ VDateField.CLASSNAME
+ + "-"
+ + VDateField
+ .resolutionToString(getWidget().currentResolution),
+ false);
+
getWidget().currentResolution = newResolution;
// Add stylename that indicates current resolution
- getWidget()
- .addStyleName(
- VDateField.CLASSNAME
- + "-"
- + VDateField
- .resolutionToString(getWidget().currentResolution));
+ setWidgetStyleName(
+ VDateField.CLASSNAME
+ + "-"
+ + VDateField
+ .resolutionToString(getWidget().currentResolution),
+ true);
final int year = uidl.getIntVariable("year");
final int month = (getWidget().currentResolution >= VDateField.RESOLUTION_MONTH) ? uidl
diff --git a/src/com/vaadin/terminal/gwt/client/ui/datefield/InlineDateFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/datefield/InlineDateFieldConnector.java
index 7cd9c110ba..304c75322a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/datefield/InlineDateFieldConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/datefield/InlineDateFieldConnector.java
@@ -5,10 +5,10 @@ package com.vaadin.terminal.gwt.client.ui.datefield;
import java.util.Date;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.DateTimeService;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.datefield.VCalendarPanel.FocusChangeListener;
import com.vaadin.terminal.gwt.client.ui.datefield.VCalendarPanel.TimeChangeListener;
import com.vaadin.ui.InlineDateField;
@@ -40,6 +40,7 @@ public class InlineDateFieldConnector extends AbstractDateFieldConnector {
if (getWidget().currentResolution > VDateField.RESOLUTION_DAY) {
getWidget().calendarPanel
.setTimeChangeListener(new TimeChangeListener() {
+ @Override
public void changed(int hour, int min, int sec, int msec) {
Date d = getWidget().getDate();
if (d == null) {
@@ -64,6 +65,7 @@ public class InlineDateFieldConnector extends AbstractDateFieldConnector {
if (getWidget().currentResolution <= VDateField.RESOLUTION_MONTH) {
getWidget().calendarPanel
.setFocusChangeListener(new FocusChangeListener() {
+ @Override
public void focusChanged(Date date) {
Date date2 = new Date();
if (getWidget().calendarPanel.getDate() != null) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/datefield/PopupDateFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/datefield/PopupDateFieldConnector.java
index e169d83b48..a8c8ada1d9 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/datefield/PopupDateFieldConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/datefield/PopupDateFieldConnector.java
@@ -6,10 +6,10 @@ package com.vaadin.terminal.gwt.client.ui.datefield;
import java.util.Date;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.DateTimeService;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.datefield.VCalendarPanel.FocusChangeListener;
import com.vaadin.terminal.gwt.client.ui.datefield.VCalendarPanel.TimeChangeListener;
import com.vaadin.ui.DateField;
@@ -35,14 +35,6 @@ public class PopupDateFieldConnector extends TextualDateConnector {
super.updateFromUIDL(uidl, client);
- String popupStyleNames = getStyleNames(VPopupCalendar.POPUP_PRIMARY_STYLE_NAME);
- popupStyleNames += " "
- + VDateField.CLASSNAME
- + "-"
- + VPopupCalendar
- .resolutionToString(getWidget().currentResolution);
- getWidget().popup.setStyleName(popupStyleNames);
-
getWidget().calendar.setDateTimeService(getWidget()
.getDateTimeService());
getWidget().calendar.setShowISOWeekNumbers(getWidget()
@@ -61,6 +53,7 @@ public class PopupDateFieldConnector extends TextualDateConnector {
if (getWidget().currentResolution <= VPopupCalendar.RESOLUTION_MONTH) {
getWidget().calendar
.setFocusChangeListener(new FocusChangeListener() {
+ @Override
public void focusChanged(Date date) {
getWidget().updateValue(date);
getWidget().buildDate();
@@ -76,6 +69,7 @@ public class PopupDateFieldConnector extends TextualDateConnector {
if (getWidget().currentResolution > VPopupCalendar.RESOLUTION_DAY) {
getWidget().calendar
.setTimeChangeListener(new TimeChangeListener() {
+ @Override
public void changed(int hour, int min, int sec, int msec) {
Date d = getWidget().getDate();
if (d == null) {
@@ -114,4 +108,30 @@ public class PopupDateFieldConnector extends TextualDateConnector {
public VPopupCalendar getWidget() {
return (VPopupCalendar) super.getWidget();
}
+
+ @Override
+ protected void setWidgetStyleName(String styleName, boolean add) {
+ super.setWidgetStyleName(styleName, add);
+
+ // update the style change to popup calendar widget
+ getWidget().popup.setStyleName(styleName, add);
+ }
+
+ @Override
+ protected void setWidgetStyleNameWithPrefix(String prefix,
+ String styleName, boolean add) {
+ super.setWidgetStyleNameWithPrefix(prefix, styleName, add);
+
+ // update the style change to popup calendar widget with the correct
+ // prefix
+ if (!styleName.startsWith("-")) {
+ getWidget().popup.setStyleName(
+ VPopupCalendar.POPUP_PRIMARY_STYLE_NAME + "-" + styleName,
+ add);
+ } else {
+ getWidget().popup.setStyleName(
+ VPopupCalendar.POPUP_PRIMARY_STYLE_NAME + styleName, add);
+ }
+ }
+
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/datefield/VCalendarPanel.java b/src/com/vaadin/terminal/gwt/client/ui/datefield/VCalendarPanel.java
index acfff60d53..e4e25a5a2e 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/datefield/VCalendarPanel.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/datefield/VCalendarPanel.java
@@ -121,6 +121,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt
* .event.dom.client.ClickEvent)
*/
+ @Override
public void onClick(ClickEvent event) {
Day day = (Day) event.getSource();
focusDay(day.getDate());
@@ -718,6 +719,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
* com.google.gwt.event.dom.client.KeyDownHandler#onKeyDown(com.google.gwt
* .event.dom.client.KeyDownEvent)
*/
+ @Override
public void onKeyDown(KeyDownEvent event) {
handleKeyPress(event);
}
@@ -729,6 +731,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
* com.google.gwt.event.dom.client.KeyPressHandler#onKeyPress(com.google
* .gwt.event.dom.client.KeyPressEvent)
*/
+ @Override
public void onKeyPress(KeyPressEvent event) {
handleKeyPress(event);
}
@@ -1124,6 +1127,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
* com.google.gwt.event.dom.client.MouseOutHandler#onMouseOut(com.google
* .gwt.event.dom.client.MouseOutEvent)
*/
+ @Override
public void onMouseOut(MouseOutEvent event) {
if (mouseTimer != null) {
mouseTimer.cancel();
@@ -1137,6 +1141,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
* com.google.gwt.event.dom.client.MouseDownHandler#onMouseDown(com.google
* .gwt.event.dom.client.MouseDownEvent)
*/
+ @Override
public void onMouseDown(MouseDownEvent event) {
// Allow user to click-n-hold for fast-forward or fast-rewind.
// Timer is first used for a 500ms delay after mousedown. After that has
@@ -1169,6 +1174,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
* com.google.gwt.event.dom.client.MouseUpHandler#onMouseUp(com.google.gwt
* .event.dom.client.MouseUpEvent)
*/
+ @Override
public void onMouseUp(MouseUpEvent event) {
if (mouseTimer != null) {
mouseTimer.cancel();
@@ -1354,6 +1360,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
ListBox lastDropDown = getLastDropDown();
lastDropDown.addKeyDownHandler(new KeyDownHandler() {
+ @Override
public void onKeyDown(KeyDownEvent event) {
boolean shiftKey = event.getNativeEvent().getShiftKey();
if (shiftKey) {
@@ -1439,6 +1446,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
* com.google.gwt.event.dom.client.ChangeHandler#onChange(com.google.gwt
* .event.dom.client.ChangeEvent)
*/
+ @Override
public void onChange(ChangeEvent event) {
/*
* Value from dropdowns gets always set for the value. Like year and
@@ -1589,6 +1597,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
* com.google.gwt.event.dom.client.BlurHandler#onBlur(com.google.gwt.event
* .dom.client.BlurEvent)
*/
+ @Override
public void onBlur(final BlurEvent event) {
if (event.getSource() instanceof VCalendarPanel) {
hasFocus = false;
@@ -1603,6 +1612,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
* com.google.gwt.event.dom.client.FocusHandler#onFocus(com.google.gwt.event
* .dom.client.FocusEvent)
*/
+ @Override
public void onFocus(FocusEvent event) {
if (event.getSource() instanceof VCalendarPanel) {
hasFocus = true;
@@ -1627,6 +1637,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
private static final String SUBPART_DAY = "day";
private static final String SUBPART_MONTH_YEAR_HEADER = "header";
+ @Override
public String getSubPartName(Element subElement) {
if (contains(nextMonth, subElement)) {
return SUBPART_NEXT_MONTH;
@@ -1685,6 +1696,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
return w.getElement().isOrHasChild(subElement);
}
+ @Override
public Element getSubPartElement(String subPart) {
if (SUBPART_NEXT_MONTH.equals(subPart)) {
return nextMonth.getElement();
diff --git a/src/com/vaadin/terminal/gwt/client/ui/datefield/VDateField.java b/src/com/vaadin/terminal/gwt/client/ui/datefield/VDateField.java
index d169b1b47e..614c4febdd 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/datefield/VDateField.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/datefield/VDateField.java
@@ -6,11 +6,9 @@ package com.vaadin.terminal.gwt.client.ui.datefield;
import java.util.Date;
-import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.FlowPanel;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.DateTimeService;
-import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ui.Field;
public class VDateField extends FlowPanel implements Field {
@@ -66,15 +64,6 @@ public class VDateField extends FlowPanel implements Field {
public VDateField() {
setStyleName(CLASSNAME);
dts = new DateTimeService();
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
- }
-
- @Override
- public void onBrowserEvent(Event event) {
- super.onBrowserEvent(event);
- if (client != null) {
- client.handleTooltipEvent(event, this);
- }
}
/*
diff --git a/src/com/vaadin/terminal/gwt/client/ui/datefield/VDateFieldCalendar.java b/src/com/vaadin/terminal/gwt/client/ui/datefield/VDateFieldCalendar.java
index 84b3c678eb..e411fb3013 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/datefield/VDateFieldCalendar.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/datefield/VDateFieldCalendar.java
@@ -23,16 +23,19 @@ public class VDateFieldCalendar extends VDateField {
calendarPanel = new VCalendarPanel();
add(calendarPanel);
calendarPanel.setSubmitListener(new SubmitListener() {
+ @Override
public void onSubmit() {
updateValueFromPanel();
}
+ @Override
public void onCancel() {
// TODO Auto-generated method stub
}
});
calendarPanel.setFocusOutListener(new FocusOutListener() {
+ @Override
public boolean onFocusOut(DomEvent<?> event) {
updateValueFromPanel();
return false;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/datefield/VPopupCalendar.java b/src/com/vaadin/terminal/gwt/client/ui/datefield/VPopupCalendar.java
index 7011e5358b..de6ebf29af 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/datefield/VPopupCalendar.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/datefield/VPopupCalendar.java
@@ -66,6 +66,7 @@ public class VPopupCalendar extends VTextualDate implements Field,
calendar = GWT.create(VCalendarPanel.class);
calendar.setFocusOutListener(new FocusOutListener() {
+ @Override
public boolean onFocusOut(DomEvent<?> event) {
event.preventDefault();
closeCalendarPanel();
@@ -74,6 +75,7 @@ public class VPopupCalendar extends VTextualDate implements Field,
});
calendar.setSubmitListener(new SubmitListener() {
+ @Override
public void onSubmit() {
// Update internal value and send valuechange event if immediate
updateValue(calendar.getDate());
@@ -84,6 +86,7 @@ public class VPopupCalendar extends VTextualDate implements Field,
closeCalendarPanel();
}
+ @Override
public void onCancel() {
closeCalendarPanel();
}
@@ -164,6 +167,7 @@ public class VPopupCalendar extends VTextualDate implements Field,
popup.setWidth("");
popup.setHeight("");
popup.setPopupPositionAndShow(new PositionCallback() {
+ @Override
public void setPosition(int offsetWidth, int offsetHeight) {
final int w = offsetWidth;
final int h = offsetHeight;
@@ -232,6 +236,7 @@ public class VPopupCalendar extends VTextualDate implements Field,
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event
* .dom.client.ClickEvent)
*/
+ @Override
public void onClick(ClickEvent event) {
if (event.getSource() == calendarToggle && isEnabled()) {
openCalendarPanel();
@@ -245,6 +250,7 @@ public class VPopupCalendar extends VTextualDate implements Field,
* com.google.gwt.event.logical.shared.CloseHandler#onClose(com.google.gwt
* .event.logical.shared.CloseEvent)
*/
+ @Override
public void onClose(CloseEvent<PopupPanel> event) {
if (event.getSource() == popup) {
buildDate();
diff --git a/src/com/vaadin/terminal/gwt/client/ui/datefield/VTextualDate.java b/src/com/vaadin/terminal/gwt/client/ui/datefield/VTextualDate.java
index db4eca152a..8c252ddc69 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/datefield/VTextualDate.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/datefield/VTextualDate.java
@@ -14,7 +14,7 @@ import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.TextBox;
-import com.vaadin.terminal.gwt.client.EventId;
+import com.vaadin.shared.EventId;
import com.vaadin.terminal.gwt.client.Focusable;
import com.vaadin.terminal.gwt.client.LocaleNotLoadedException;
import com.vaadin.terminal.gwt.client.LocaleService;
@@ -50,6 +50,7 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
text.addStyleName(CLASSNAME + "-textfield");
text.addChangeHandler(this);
text.addFocusHandler(new FocusHandler() {
+ @Override
public void onFocus(FocusEvent event) {
text.addStyleName(VTextField.CLASSNAME + "-"
+ VTextField.CLASSNAME_FOCUS);
@@ -66,6 +67,7 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
}
});
text.addBlurHandler(new BlurHandler() {
+ @Override
public void onBlur(BlurEvent event) {
text.removeStyleName(VTextField.CLASSNAME + "-"
+ VTextField.CLASSNAME_FOCUS);
@@ -168,6 +170,7 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
}
}
+ @Override
@SuppressWarnings("deprecation")
public void onChange(ChangeEvent event) {
if (!text.getText().equals("")) {
@@ -291,6 +294,7 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
return format.trim();
}
+ @Override
public void focus() {
text.setFocus(true);
}
@@ -315,6 +319,7 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
private final String TEXTFIELD_ID = "field";
+ @Override
public Element getSubPartElement(String subPart) {
if (subPart.equals(TEXTFIELD_ID)) {
return text.getElement();
@@ -323,6 +328,7 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
return null;
}
+ @Override
public String getSubPartName(Element subElement) {
if (text.getElement().isOrHasChild(subElement)) {
return TEXTFIELD_ID;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/AcceptCriterion.java b/src/com/vaadin/terminal/gwt/client/ui/dd/AcceptCriterion.java
deleted file mode 100644
index 8a026e4d2e..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/AcceptCriterion.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.ui.dd;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * An annotation type used to point the server side counterpart for client side
- * a {@link VAcceptCriterion} class.
- * <p>
- * Annotations are used at GWT compilation phase, so remember to rebuild your
- * widgetset if you do changes for {@link AcceptCriterion} mappings.
- *
- * Prior to Vaadin 7, the mapping was done with an annotation on server side
- * classes.
- *
- * @since 7.0
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface AcceptCriterion {
- /**
- * @return the class of the server side counterpart for the annotated
- * criterion
- */
- Class<?> value();
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/DDUtil.java b/src/com/vaadin/terminal/gwt/client/ui/dd/DDUtil.java
index 97f5eb86fd..f9ec8a2f48 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/DDUtil.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/DDUtil.java
@@ -6,6 +6,8 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Window;
+import com.vaadin.shared.ui.dd.HorizontalDropLocation;
+import com.vaadin.shared.ui.dd.VerticalDropLocation;
import com.vaadin.terminal.gwt.client.Util;
public class DDUtil {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/HorizontalDropLocation.java b/src/com/vaadin/terminal/gwt/client/ui/dd/HorizontalDropLocation.java
deleted file mode 100644
index 5e90acd6f1..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/HorizontalDropLocation.java
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.dd;
-
-public enum HorizontalDropLocation {
- LEFT, RIGHT, CENTER
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VAbstractDropHandler.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VAbstractDropHandler.java
index ce47c7d13a..ce0533ac1f 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VAbstractDropHandler.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VAbstractDropHandler.java
@@ -47,6 +47,7 @@ public abstract class VAbstractDropHandler implements VDropHandler {
/**
* Default implementation does nothing.
*/
+ @Override
public void dragOver(VDragEvent drag) {
}
@@ -55,6 +56,7 @@ public abstract class VAbstractDropHandler implements VDropHandler {
* Default implementation does nothing. Implementors should clean possible
* emphasis or drag icons here.
*/
+ @Override
public void dragLeave(VDragEvent drag) {
}
@@ -73,8 +75,10 @@ public abstract class VAbstractDropHandler implements VDropHandler {
* implementation.
*
*/
+ @Override
public void dragEnter(final VDragEvent drag) {
validate(new VAcceptCallback() {
+ @Override
public void accepted(VDragEvent event) {
dragAccepted(drag);
}
@@ -94,6 +98,7 @@ public abstract class VAbstractDropHandler implements VDropHandler {
protected void validate(final VAcceptCallback cb, final VDragEvent event) {
Command checkCriteria = new Command() {
+ @Override
public void execute() {
acceptCriteria.accept(event, criterioUIDL, cb);
}
@@ -109,12 +114,14 @@ public abstract class VAbstractDropHandler implements VDropHandler {
* can't be verified on client or if {@link AcceptCriterion} are met on
* client.
*/
+ @Override
public boolean drop(VDragEvent drag) {
if (acceptCriteria.needsServerSideCheck(drag, criterioUIDL)) {
return true;
} else {
validated = false;
acceptCriteria.accept(drag, criterioUIDL, new VAcceptCallback() {
+ @Override
public void accepted(VDragEvent event) {
validated = true;
}
@@ -129,6 +136,7 @@ public abstract class VAbstractDropHandler implements VDropHandler {
* side counterpart of the Paintable is expected to implement
* {@link DropTarget} interface.
*/
+ @Override
public abstract ComponentConnector getConnector();
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptAll.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptAll.java
index a864a93c2a..7ce0d69727 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptAll.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptAll.java
@@ -7,6 +7,7 @@
package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.event.dd.acceptcriteria.AcceptAll;
+import com.vaadin.shared.ui.dd.AcceptCriterion;
import com.vaadin.terminal.gwt.client.UIDL;
@AcceptCriterion(AcceptAll.class)
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java
index 0d71e23903..b1a88166ec 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java
@@ -19,6 +19,7 @@ public abstract class VAcceptCriterion {
final VAcceptCallback callback) {
if (needsServerSideCheck(drag, configuration)) {
VDragEventServerCallback acceptCallback = new VDragEventServerCallback() {
+ @Override
public void handleResponse(boolean accepted, UIDL response) {
if (accepted) {
callback.accepted(drag);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VAnd.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VAnd.java
index 19399d7d4a..2f0cdc2a80 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VAnd.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VAnd.java
@@ -7,6 +7,7 @@
package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.event.dd.acceptcriteria.And;
+import com.vaadin.shared.ui.dd.AcceptCriterion;
import com.vaadin.terminal.gwt.client.UIDL;
@AcceptCriterion(And.class)
@@ -33,6 +34,7 @@ final public class VAnd extends VAcceptCriterion implements VAcceptCallback {
return true;
}
+ @Override
public void accepted(VDragEvent event) {
b1 = true;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VContainsDataFlavor.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VContainsDataFlavor.java
index 3cd341eefd..7c5d9f769a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VContainsDataFlavor.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VContainsDataFlavor.java
@@ -7,6 +7,7 @@
package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.event.dd.acceptcriteria.ContainsDataFlavor;
+import com.vaadin.shared.ui.dd.AcceptCriterion;
import com.vaadin.terminal.gwt.client.UIDL;
@AcceptCriterion(ContainsDataFlavor.class)
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java
index 2f404a3028..bc98860716 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java
@@ -22,9 +22,10 @@ import com.google.gwt.user.client.Event.NativePreviewHandler;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.dd.DragEventType;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.MouseEventDetailsBuilder;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
@@ -48,6 +49,7 @@ public class VDragAndDropManager {
private final class DefaultDragAndDropEventHandler implements
NativePreviewHandler {
+ @Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
NativeEvent nativeEvent = event.getNativeEvent();
@@ -223,10 +225,6 @@ public class VDragAndDropManager {
}
- public enum DragEventType {
- ENTER, LEAVE, OVER, DROP
- }
-
public static final String DD_SERVICE = "DD";
private static VDragAndDropManager instance;
@@ -307,6 +305,7 @@ public class VDragAndDropManager {
final Command startDrag = new Command() {
+ @Override
public void execute() {
isStarted = true;
addActiveDragSourceStyleName();
@@ -352,6 +351,7 @@ public class VDragAndDropManager {
deferredStartRegistration = Event
.addNativePreviewHandler(new NativePreviewHandler() {
+ @Override
public void onPreviewNativeEvent(
NativePreviewEvent event) {
int typeInt = event.getTypeInt();
@@ -509,6 +509,7 @@ public class VDragAndDropManager {
final ApplicationConnection client = currentDropHandler
.getApplicationConnection();
Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
+ @Override
public boolean execute() {
if (!client.hasActiveRequest()) {
removeActiveDragSourceStyleName(dragSource);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragSourceIs.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragSourceIs.java
index b6af81085f..ffb923f3e0 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragSourceIs.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragSourceIs.java
@@ -4,6 +4,7 @@
package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.event.dd.acceptcriteria.SourceIs;
+import com.vaadin.shared.ui.dd.AcceptCriterion;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.UIDL;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VIsOverId.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VIsOverId.java
index 5dad4873ea..d0055d48dd 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VIsOverId.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VIsOverId.java
@@ -6,6 +6,7 @@
*/
package com.vaadin.terminal.gwt.client.ui.dd;
+import com.vaadin.shared.ui.dd.AcceptCriterion;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.UIDL;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VItemIdIs.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VItemIdIs.java
index ca4d0e900d..67f323a950 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VItemIdIs.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VItemIdIs.java
@@ -6,6 +6,7 @@
*/
package com.vaadin.terminal.gwt.client.ui.dd;
+import com.vaadin.shared.ui.dd.AcceptCriterion;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.ui.AbstractSelect;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VLazyInitItemIdentifiers.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VLazyInitItemIdentifiers.java
index e3bed02642..bfda603d58 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VLazyInitItemIdentifiers.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VLazyInitItemIdentifiers.java
@@ -8,6 +8,7 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import java.util.HashSet;
+import com.vaadin.shared.ui.dd.AcceptCriterion;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.ui.Table;
import com.vaadin.ui.Tree;
@@ -48,6 +49,7 @@ public class VLazyInitItemIdentifiers extends VAcceptCriterion {
VDragEventServerCallback acceptCallback = new VDragEventServerCallback() {
+ @Override
public void handleResponse(boolean accepted, UIDL response) {
hashSet = new HashSet<String>();
String[] stringArrayAttribute = response
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VNot.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VNot.java
index e4d2dff606..8355afc625 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VNot.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VNot.java
@@ -7,6 +7,7 @@
package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.event.dd.acceptcriteria.Not;
+import com.vaadin.shared.ui.dd.AcceptCriterion;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.VConsole;
@@ -33,6 +34,7 @@ final public class VNot extends VAcceptCriterion {
b1 = false;
VAcceptCallback accept1cb = new VAcceptCallback() {
+ @Override
public void accepted(VDragEvent event) {
b1 = true;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java
index 91ba4bf0c4..46bf28b42a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java
@@ -7,6 +7,7 @@
package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.event.dd.acceptcriteria.Or;
+import com.vaadin.shared.ui.dd.AcceptCriterion;
import com.vaadin.terminal.gwt.client.UIDL;
/**
@@ -41,6 +42,7 @@ final public class VOr extends VAcceptCriterion implements VAcceptCallback {
return false; // not used here
}
+ @Override
public void accepted(VDragEvent event) {
accepted = true;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VServerAccept.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VServerAccept.java
index 64c2da5320..42d4d90ae4 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VServerAccept.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VServerAccept.java
@@ -7,6 +7,7 @@
package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.event.dd.acceptcriteria.ServerSideCriterion;
+import com.vaadin.shared.ui.dd.AcceptCriterion;
import com.vaadin.terminal.gwt.client.UIDL;
@AcceptCriterion(ServerSideCriterion.class)
@@ -16,6 +17,7 @@ final public class VServerAccept extends VAcceptCriterion {
final VAcceptCallback callback) {
VDragEventServerCallback acceptCallback = new VDragEventServerCallback() {
+ @Override
public void handleResponse(boolean accepted, UIDL response) {
if (accepted) {
callback.accepted(drag);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VSourceIsTarget.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VSourceIsTarget.java
index 2365eabe22..dcb2f405fa 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VSourceIsTarget.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VSourceIsTarget.java
@@ -7,6 +7,7 @@
package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.event.dd.acceptcriteria.SourceIsTarget;
+import com.vaadin.shared.ui.dd.AcceptCriterion;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.UIDL;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetDetailIs.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetDetailIs.java
index 610d555745..e67d81387c 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetDetailIs.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetDetailIs.java
@@ -7,6 +7,7 @@
package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.event.dd.acceptcriteria.TargetDetailIs;
+import com.vaadin.shared.ui.dd.AcceptCriterion;
import com.vaadin.terminal.gwt.client.UIDL;
@AcceptCriterion(TargetDetailIs.class)
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetInSubtree.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetInSubtree.java
index 56478b2b95..14bca0ed91 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetInSubtree.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetInSubtree.java
@@ -7,6 +7,7 @@
package com.vaadin.terminal.gwt.client.ui.dd;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.dd.AcceptCriterion;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.tree.VTree;
import com.vaadin.terminal.gwt.client.ui.tree.VTree.TreeNode;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VerticalDropLocation.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VerticalDropLocation.java
deleted file mode 100644
index de392a0e98..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VerticalDropLocation.java
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.dd;
-
-public enum VerticalDropLocation {
- TOP, BOTTOM, MIDDLE
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java b/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java
index 2a78cc4433..6914b451fa 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java
@@ -6,10 +6,10 @@ package com.vaadin.terminal.gwt.client.ui.draganddropwrapper;
import java.util.HashMap;
import java.util.Set;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.customcomponent.CustomComponentConnector;
import com.vaadin.ui.DragAndDropWrapper;
@@ -17,6 +17,7 @@ import com.vaadin.ui.DragAndDropWrapper;
public class DragAndDropWrapperConnector extends CustomComponentConnector
implements Paintable {
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
getWidget().client = client;
if (isRealUpdate(uidl) && !uidl.hasAttribute("hidden")) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/VDragAndDropWrapper.java b/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/VDragAndDropWrapper.java
index 4c36e92bbb..e77055764e 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/VDragAndDropWrapper.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/draganddropwrapper/VDragAndDropWrapper.java
@@ -22,6 +22,8 @@ import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.xhr.client.ReadyStateChangeHandler;
import com.google.gwt.xhr.client.XMLHttpRequest;
+import com.vaadin.shared.ui.dd.HorizontalDropLocation;
+import com.vaadin.shared.ui.dd.VerticalDropLocation;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorMap;
@@ -29,11 +31,9 @@ import com.vaadin.terminal.gwt.client.LayoutManager;
import com.vaadin.terminal.gwt.client.MouseEventDetailsBuilder;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ValueMap;
import com.vaadin.terminal.gwt.client.ui.customcomponent.VCustomComponent;
import com.vaadin.terminal.gwt.client.ui.dd.DDUtil;
-import com.vaadin.terminal.gwt.client.ui.dd.HorizontalDropLocation;
import com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler;
import com.vaadin.terminal.gwt.client.ui.dd.VAcceptCallback;
import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager;
@@ -43,7 +43,6 @@ import com.vaadin.terminal.gwt.client.ui.dd.VHasDropHandler;
import com.vaadin.terminal.gwt.client.ui.dd.VHtml5DragEvent;
import com.vaadin.terminal.gwt.client.ui.dd.VHtml5File;
import com.vaadin.terminal.gwt.client.ui.dd.VTransferable;
-import com.vaadin.terminal.gwt.client.ui.dd.VerticalDropLocation;
/**
*
@@ -64,12 +63,12 @@ public class VDragAndDropWrapper extends VCustomComponent implements
public VDragAndDropWrapper() {
super();
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
hookHtml5Events(getElement());
setStyleName(CLASSNAME);
addDomHandler(new MouseDownHandler() {
+ @Override
public void onMouseDown(MouseDownEvent event) {
if (startDrag(event.getNativeEvent())) {
event.preventDefault(); // prevent text selection
@@ -79,6 +78,7 @@ public class VDragAndDropWrapper extends VCustomComponent implements
addDomHandler(new TouchStartHandler() {
+ @Override
public void onTouchStart(TouchStartEvent event) {
if (startDrag(event.getNativeEvent())) {
/*
@@ -92,16 +92,6 @@ public class VDragAndDropWrapper extends VCustomComponent implements
sinkEvents(Event.TOUCHEVENTS);
}
- @Override
- public void onBrowserEvent(Event event) {
- super.onBrowserEvent(event);
-
- if (hasTooltip && client != null) {
- // Override child tooltips if the wrapper has a tooltip defined
- client.handleTooltipEvent(event, this);
- }
- }
-
/**
* Starts a drag and drop operation from mousedown or touchstart event if
* required conditions are met.
@@ -178,6 +168,7 @@ public class VDragAndDropWrapper extends VCustomComponent implements
private ReadyStateChangeHandler readyStateChangeHandler = new ReadyStateChangeHandler() {
+ @Override
public void onReadyStateChange(XMLHttpRequest xhr) {
if (xhr.getReadyState() == XMLHttpRequest.DONE) {
// visit server for possible
@@ -194,6 +185,7 @@ public class VDragAndDropWrapper extends VCustomComponent implements
void startNextUpload() {
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
if (!uploading) {
if (fileIds.size() > 0) {
@@ -425,6 +417,7 @@ public class VDragAndDropWrapper extends VCustomComponent implements
files.add(file);
}
+ @Override
public VDropHandler getDropHandler() {
return dropHandler;
}
@@ -463,6 +456,7 @@ public class VDragAndDropWrapper extends VCustomComponent implements
currentlyValid = false;
validate(new VAcceptCallback() {
+ @Override
public void accepted(VDragEvent event) {
dragAccepted(drag);
}
@@ -507,6 +501,7 @@ public class VDragAndDropWrapper extends VCustomComponent implements
VDragAndDropWrapper.this);
}
+ @Override
public ApplicationConnection getApplicationConnection() {
return client;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedConnector.java b/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedConnector.java
index af3ad67db4..a1851d9c84 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedConnector.java
@@ -15,8 +15,10 @@ import com.google.gwt.dom.client.Style;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.embedded.EmbeddedServerRpc;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.VConsole;
@@ -24,7 +26,6 @@ import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.communication.RpcProxy;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
import com.vaadin.terminal.gwt.client.ui.ClickEventHandler;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.ui.Embedded;
@Connect(Embedded.class)
@@ -41,6 +42,7 @@ public class EmbeddedConnector extends AbstractComponentConnector implements
rpc = RpcProxy.create(EmbeddedServerRpc.class, this);
}
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
if (!isRealUpdate(uidl)) {
return;
@@ -54,6 +56,16 @@ public class EmbeddedConnector extends AbstractComponentConnector implements
clickEventHandler.handleEventHandlerRegistration();
if (uidl.hasAttribute("type")) {
+ // remove old style name related to type
+ if (getWidget().type != null) {
+ getWidget().removeStyleName(
+ VEmbedded.CLASSNAME + "-" + getWidget().type);
+ }
+ // remove old style name related to mime type
+ if (getWidget().mimetype != null) {
+ getWidget().removeStyleName(
+ VEmbedded.CLASSNAME + "-" + getWidget().mimetype);
+ }
getWidget().type = uidl.getStringAttribute("type");
if (getWidget().type.equals("image")) {
getWidget().addStyleName(VEmbedded.CLASSNAME + "-image");
@@ -118,13 +130,25 @@ public class EmbeddedConnector extends AbstractComponentConnector implements
VConsole.log("Unknown Embedded type '" + getWidget().type + "'");
}
} else if (uidl.hasAttribute("mimetype")) {
+ // remove old style name related to type
+ if (getWidget().type != null) {
+ getWidget().removeStyleName(
+ VEmbedded.CLASSNAME + "-" + getWidget().type);
+ }
+ // remove old style name related to mime type
+ if (getWidget().mimetype != null) {
+ getWidget().removeStyleName(
+ VEmbedded.CLASSNAME + "-" + getWidget().mimetype);
+ }
final String mime = uidl.getStringAttribute("mimetype");
if (mime.equals("application/x-shockwave-flash")) {
+ getWidget().mimetype = "flash";
// Handle embedding of Flash
getWidget().addStyleName(VEmbedded.CLASSNAME + "-flash");
getWidget().setHTML(getWidget().createFlashEmbed(uidl));
} else if (mime.equals("image/svg+xml")) {
+ getWidget().mimetype = "svg";
getWidget().addStyleName(VEmbedded.CLASSNAME + "-svg");
String data;
Map<String, String> parameters = VEmbedded.getParameters(uidl);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedServerRpc.java b/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedServerRpc.java
deleted file mode 100644
index 7f36c812bc..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/embedded/EmbeddedServerRpc.java
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.embedded;
-
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.ui.ClickRpc;
-
-public interface EmbeddedServerRpc extends ClickRpc, ServerRpc {
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/embedded/VEmbedded.java b/src/com/vaadin/terminal/gwt/client/ui/embedded/VEmbedded.java
index 203e7362f3..1d2a5a156a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/embedded/VEmbedded.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/embedded/VEmbedded.java
@@ -26,6 +26,7 @@ public class VEmbedded extends HTML {
protected Element browserElement;
protected String type;
+ protected String mimetype;
protected ApplicationConnection client;
@@ -232,8 +233,6 @@ public class VEmbedded extends HTML {
VConsole.log("Embeddable onload");
Util.notifyParentOfSizeChange(this, true);
}
-
- client.handleTooltipEvent(event, this);
}
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/form/FormConnector.java b/src/com/vaadin/terminal/gwt/client/ui/form/FormConnector.java
index 981c753dd1..e31de1f85d 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/form/FormConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/form/FormConnector.java
@@ -6,13 +6,14 @@ package com.vaadin.terminal.gwt.client.ui.form;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.form.FormState;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.LayoutManager;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.Icon;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler;
import com.vaadin.terminal.gwt.client.ui.layout.ElementResizeEvent;
@@ -25,6 +26,7 @@ public class FormConnector extends AbstractComponentContainerConnector
implements Paintable, MayScrollChildren {
private final ElementResizeListener footerResizeListener = new ElementResizeListener() {
+ @Override
public void onElementResize(ElementResizeEvent e) {
VForm form = getWidget();
@@ -57,6 +59,7 @@ public class FormConnector extends AbstractComponentContainerConnector
return false;
}
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
getWidget().client = client;
getWidget().id = uidl.getId();
@@ -180,6 +183,7 @@ public class FormConnector extends AbstractComponentContainerConnector
}
}
+ @Override
public void updateCaption(ComponentConnector component) {
// NOP form don't render caption for neither field layout nor footer
// layout
diff --git a/src/com/vaadin/terminal/gwt/client/ui/form/FormState.java b/src/com/vaadin/terminal/gwt/client/ui/form/FormState.java
deleted file mode 100644
index c1acc0971d..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/form/FormState.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.form;
-
-import com.vaadin.terminal.gwt.client.AbstractFieldState;
-import com.vaadin.terminal.gwt.client.Connector;
-
-public class FormState extends AbstractFieldState {
- private Connector layout;
- private Connector footer;
-
- public Connector getLayout() {
- return layout;
- }
-
- public void setLayout(Connector layout) {
- this.layout = layout;
- }
-
- public Connector getFooter() {
- return footer;
- }
-
- public void setFooter(Connector footer) {
- this.footer = footer;
- }
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/form/VForm.java b/src/com/vaadin/terminal/gwt/client/ui/form/VForm.java
index 81f24a8e7e..823b0e83ae 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/form/VForm.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/form/VForm.java
@@ -62,6 +62,7 @@ public class VForm extends ComplexPanel implements KeyDownHandler {
fieldSet.appendChild(footerContainer);
}
+ @Override
public void onKeyDown(KeyDownEvent event) {
shortcutHandler.handleKeyboardEvent(Event.as(event.getNativeEvent()));
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/formlayout/FormLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/formlayout/FormLayoutConnector.java
index ca21947a6c..567513d7fe 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/formlayout/FormLayoutConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/formlayout/FormLayoutConnector.java
@@ -3,18 +3,21 @@
*/
package com.vaadin.terminal.gwt.client.ui.formlayout;
+import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.VMarginInfo;
+import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutState;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
+import com.vaadin.terminal.gwt.client.TooltipInfo;
+import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.ui.AbstractFieldConnector;
import com.vaadin.terminal.gwt.client.ui.AbstractLayoutConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.VMarginInfo;
import com.vaadin.terminal.gwt.client.ui.formlayout.VFormLayout.Caption;
import com.vaadin.terminal.gwt.client.ui.formlayout.VFormLayout.ErrorFlag;
import com.vaadin.terminal.gwt.client.ui.formlayout.VFormLayout.VFormLayoutTable;
-import com.vaadin.terminal.gwt.client.ui.orderedlayout.AbstractOrderedLayoutState;
import com.vaadin.ui.FormLayout;
@Connect(FormLayout.class)
@@ -76,6 +79,7 @@ public class FormLayoutConnector extends AbstractLayoutConnector {
}
+ @Override
public void updateCaption(ComponentConnector component) {
getWidget().table.updateCaption(component.getWidget(),
component.getState(), component.isEnabled());
@@ -96,4 +100,36 @@ public class FormLayoutConnector extends AbstractLayoutConnector {
return (VFormLayout) super.getWidget();
}
+ @Override
+ public TooltipInfo getTooltipInfo(Element element) {
+ TooltipInfo info = null;
+
+ if (element != getWidget().getElement()) {
+ Object node = Util.findWidget(
+ (com.google.gwt.user.client.Element) element,
+ VFormLayout.Caption.class);
+
+ if (node != null) {
+ VFormLayout.Caption caption = (VFormLayout.Caption) node;
+ info = caption.getOwner().getTooltipInfo(element);
+ } else {
+
+ node = Util.findWidget(
+ (com.google.gwt.user.client.Element) element,
+ VFormLayout.ErrorFlag.class);
+
+ if (node != null) {
+ VFormLayout.ErrorFlag flag = (VFormLayout.ErrorFlag) node;
+ info = flag.getOwner().getTooltipInfo(element);
+ }
+ }
+ }
+
+ if (info == null) {
+ info = super.getTooltipInfo(element);
+ }
+
+ return info;
+ }
+
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/formlayout/VFormLayout.java b/src/com/vaadin/terminal/gwt/client/ui/formlayout/VFormLayout.java
index 8a859c409c..9ecab6352c 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/formlayout/VFormLayout.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/formlayout/VFormLayout.java
@@ -12,21 +12,20 @@ import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.ui.VMarginInfo;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.ComponentState;
import com.vaadin.terminal.gwt.client.Focusable;
import com.vaadin.terminal.gwt.client.StyleConstants;
import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ui.AbstractFieldConnector;
import com.vaadin.terminal.gwt.client.ui.Icon;
-import com.vaadin.terminal.gwt.client.ui.VMarginInfo;
/**
* Two col Layout that places caption on left col and field on right col
@@ -88,6 +87,7 @@ public class VFormLayout extends SimplePanel {
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt
* .event.dom.client.ClickEvent)
*/
+ @Override
public void onClick(ClickEvent event) {
Caption caption = (Caption) event.getSource();
if (caption.getOwner() != null) {
@@ -215,8 +215,6 @@ public class VFormLayout extends SimplePanel {
public Caption(ComponentConnector component) {
super();
owner = component;
-
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
}
private void setStyles(String[] styles) {
@@ -324,12 +322,6 @@ public class VFormLayout extends SimplePanel {
public ComponentConnector getOwner() {
return owner;
}
-
- @Override
- public void onBrowserEvent(Event event) {
- super.onBrowserEvent(event);
- owner.getConnection().handleTooltipEvent(event, owner);
- }
}
class ErrorFlag extends HTML {
@@ -345,6 +337,10 @@ public class VFormLayout extends SimplePanel {
this.owner = owner;
}
+ public ComponentConnector getOwner() {
+ return owner;
+ }
+
public void updateError(String errorMessage, boolean hideErrors) {
boolean showError = null != errorMessage;
if (hideErrors) {
@@ -366,13 +362,5 @@ public class VFormLayout extends SimplePanel {
}
}
- @Override
- public void onBrowserEvent(Event event) {
- super.onBrowserEvent(event);
- if (owner != null) {
- owner.getConnection().handleTooltipEvent(event, owner);
- }
- }
-
}
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutConnector.java
index 2cd82313c2..07e481d31d 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutConnector.java
@@ -7,6 +7,12 @@ import java.util.Iterator;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.AlignmentInfo;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.LayoutClickRpc;
+import com.vaadin.shared.ui.VMarginInfo;
+import com.vaadin.shared.ui.gridlayout.GridLayoutServerRpc;
+import com.vaadin.shared.ui.gridlayout.GridLayoutState;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
@@ -18,11 +24,7 @@ import com.vaadin.terminal.gwt.client.VCaption;
import com.vaadin.terminal.gwt.client.communication.RpcProxy;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector;
-import com.vaadin.terminal.gwt.client.ui.AlignmentInfo;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler;
-import com.vaadin.terminal.gwt.client.ui.LayoutClickRpc;
-import com.vaadin.terminal.gwt.client.ui.VMarginInfo;
import com.vaadin.terminal.gwt.client.ui.gridlayout.VGridLayout.Cell;
import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot;
import com.vaadin.ui.GridLayout;
@@ -51,6 +53,7 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector
@Override
public void init() {
+ super.init();
rpc = RpcProxy.create(GridLayoutServerRpc.class, this);
getLayoutManager().registerDependency(this,
getWidget().spacingMeasureElement);
@@ -82,6 +85,7 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector
}
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
VGridLayout layout = getWidget();
layout.client = client;
@@ -185,6 +189,7 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector
}
+ @Override
public void updateCaption(ComponentConnector childConnector) {
if (!childConnector.delegateCaptionHandling()) {
// Check not required by interface but by workarounds in this class
@@ -223,10 +228,12 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector
return (VGridLayout) super.getWidget();
}
+ @Override
public void layoutVertically() {
getWidget().updateHeight();
}
+ @Override
public void layoutHorizontally() {
getWidget().updateWidth();
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutServerRpc.java b/src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutServerRpc.java
deleted file mode 100644
index cd8df297ec..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutServerRpc.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.gridlayout;
-
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.ui.LayoutClickRpc;
-
-public interface GridLayoutServerRpc extends LayoutClickRpc, ServerRpc {
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutState.java b/src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutState.java
deleted file mode 100644
index 109dc7dea6..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/gridlayout/GridLayoutState.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.gridlayout;
-
-import com.vaadin.terminal.gwt.client.ui.AbstractLayoutState;
-
-public class GridLayoutState extends AbstractLayoutState {
- private boolean spacing = false;
- private int rows = 0;
- private int columns = 0;
-
- public boolean isSpacing() {
- return spacing;
- }
-
- public void setSpacing(boolean spacing) {
- this.spacing = spacing;
- }
-
- public int getRows() {
- return rows;
- }
-
- public void setRows(int rows) {
- this.rows = rows;
- }
-
- public int getColumns() {
- return columns;
- }
-
- public void setColumns(int cols) {
- columns = cols;
- }
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/gridlayout/VGridLayout.java b/src/com/vaadin/terminal/gwt/client/ui/gridlayout/VGridLayout.java
index 7629e09cac..1ea84d46cd 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/gridlayout/VGridLayout.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/gridlayout/VGridLayout.java
@@ -16,6 +16,8 @@ import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.AlignmentInfo;
+import com.vaadin.shared.ui.VMarginInfo;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorMap;
@@ -23,8 +25,6 @@ import com.vaadin.terminal.gwt.client.LayoutManager;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VCaption;
-import com.vaadin.terminal.gwt.client.ui.AlignmentInfo;
-import com.vaadin.terminal.gwt.client.ui.VMarginInfo;
import com.vaadin.terminal.gwt.client.ui.layout.ComponentConnectorLayoutSlot;
import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/GreetAgainRpc.java b/src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/GreetAgainRpc.java
deleted file mode 100644
index 0bfb8f3c32..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/GreetAgainRpc.java
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.helloworldfeature;
-
-import com.vaadin.terminal.gwt.client.communication.ClientRpc;
-
-public interface GreetAgainRpc extends ClientRpc {
-
- public void greetAgain();
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/HelloWorldExtensionConnector.java b/src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/HelloWorldExtensionConnector.java
deleted file mode 100644
index ff444fece5..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/HelloWorldExtensionConnector.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.helloworldfeature;
-
-import com.google.gwt.user.client.Window;
-import com.vaadin.terminal.gwt.client.ServerConnector;
-import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.communication.RpcProxy;
-import com.vaadin.terminal.gwt.client.ui.AbstractConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.ui.HelloWorldExtension;
-
-@Connect(HelloWorldExtension.class)
-public class HelloWorldExtensionConnector extends AbstractConnector {
- HelloWorldRpc rpc = RpcProxy.create(HelloWorldRpc.class, this);
-
- @Override
- public HelloWorldState getState() {
- return (HelloWorldState) super.getState();
- }
-
- @Override
- protected void init() {
- registerRpc(GreetAgainRpc.class, new GreetAgainRpc() {
- public void greetAgain() {
- greet();
- }
- });
- }
-
- @Override
- public void setParent(ServerConnector parent) {
- super.setParent(parent);
- greet();
- }
-
- private void greet() {
- String msg = getState().getGreeting() + " from "
- + Util.getConnectorString(this) + " attached to "
- + Util.getConnectorString(getParent());
- VConsole.log(msg);
-
- String response = Window.prompt(msg, "");
- rpc.onMessageSent(response);
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/HelloWorldRpc.java b/src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/HelloWorldRpc.java
deleted file mode 100644
index 0289713390..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/HelloWorldRpc.java
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.helloworldfeature;
-
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-
-public interface HelloWorldRpc extends ServerRpc {
- public void onMessageSent(String message);
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/HelloWorldState.java b/src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/HelloWorldState.java
deleted file mode 100644
index 9524a5e9aa..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/helloworldfeature/HelloWorldState.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.helloworldfeature;
-
-import com.vaadin.terminal.gwt.client.communication.SharedState;
-
-public class HelloWorldState extends SharedState {
- private String greeting = "Hello world";
-
- public String getGreeting() {
- return greeting;
- }
-
- public void setGreeting(String greeting) {
- this.greeting = greeting;
- }
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/label/ContentMode.java b/src/com/vaadin/terminal/gwt/client/ui/label/ContentMode.java
deleted file mode 100644
index 4892c7e6bd..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/label/ContentMode.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.label;
-
-/**
- * Content modes defining how the client should interpret a Label's value.
- *
- * @since 7.0.0
- */
-public enum ContentMode {
- /**
- * Content mode, where the label contains only plain text. The getValue()
- * result is coded to XML when painting.
- */
- TEXT,
-
- /**
- * Content mode, where the label contains preformatted text.
- */
- PREFORMATTED,
-
- /**
- * Content mode, where the label contains XHTML.
- */
- XHTML,
-
- /**
- * Content mode, where the label contains well-formed or well-balanced XML.
- * Each of the root elements must have their default namespace specified.
- *
- * @deprecated Use {@link #XHTML}
- */
- @Deprecated
- XML,
-
- /**
- * Content mode, where the label contains RAW output. Output is not required
- * to comply to with XML. In Web Adapter output is inserted inside the
- * resulting HTML document as-is. This is useful for some specific purposes
- * where possibly broken HTML content needs to be shown, but in most cases
- * XHTML mode should be preferred.
- *
- * @deprecated Use {@link #XHTML}, {@link #TEXT} or {@link #PREFORMATTED}.
- */
- @Deprecated
- RAW;
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/label/LabelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/label/LabelConnector.java
index e64f9fffea..4c6c71e037 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/label/LabelConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/label/LabelConnector.java
@@ -5,11 +5,12 @@ package com.vaadin.terminal.gwt.client.ui.label;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.PreElement;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
+import com.vaadin.shared.ui.label.LabelState;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
import com.vaadin.ui.Label;
@Connect(value = Label.class, loadStyle = LoadStyle.EAGER)
diff --git a/src/com/vaadin/terminal/gwt/client/ui/label/LabelState.java b/src/com/vaadin/terminal/gwt/client/ui/label/LabelState.java
deleted file mode 100644
index 25bbca3c3d..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/label/LabelState.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.label;
-
-import com.vaadin.terminal.gwt.client.ComponentState;
-
-public class LabelState extends ComponentState {
- private ContentMode contentMode = ContentMode.TEXT;
- private String text = "";
-
- public ContentMode getContentMode() {
- return contentMode;
- }
-
- public void setContentMode(ContentMode contentMode) {
- this.contentMode = contentMode;
- }
-
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/label/VLabel.java b/src/com/vaadin/terminal/gwt/client/ui/label/VLabel.java
index f47b8437b7..f0c170c6b0 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/label/VLabel.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/label/VLabel.java
@@ -28,7 +28,6 @@ public class VLabel extends HTML {
public VLabel(String text) {
super(text);
setStyleName(CLASSNAME);
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
}
@Override
@@ -39,9 +38,6 @@ public class VLabel extends HTML {
event.stopPropagation();
return;
}
- if (connection != null) {
- connection.handleTooltipEvent(event, this);
- }
}
@Override
diff --git a/src/com/vaadin/terminal/gwt/client/ui/layout/LayoutDependencyTree.java b/src/com/vaadin/terminal/gwt/client/ui/layout/LayoutDependencyTree.java
index 18843057f3..cb0ed697c9 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/layout/LayoutDependencyTree.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/layout/LayoutDependencyTree.java
@@ -10,9 +10,9 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import com.vaadin.shared.ComponentState;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ComponentContainerConnector;
-import com.vaadin.terminal.gwt.client.ComponentState;
import com.vaadin.terminal.gwt.client.ServerConnector;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VConsole;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/layout/VLayoutSlot.java b/src/com/vaadin/terminal/gwt/client/ui/layout/VLayoutSlot.java
index 034fe35649..5b2b1fc49b 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/layout/VLayoutSlot.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/layout/VLayoutSlot.java
@@ -10,8 +10,8 @@ import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.AlignmentInfo;
import com.vaadin.terminal.gwt.client.VCaption;
-import com.vaadin.terminal.gwt.client.ui.AlignmentInfo;
public abstract class VLayoutSlot {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/link/LinkConnector.java b/src/com/vaadin/terminal/gwt/client/ui/link/LinkConnector.java
index c002d2dd50..5ef641470d 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/link/LinkConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/link/LinkConnector.java
@@ -5,11 +5,11 @@
package com.vaadin.terminal.gwt.client.ui.link;
import com.google.gwt.user.client.DOM;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.Icon;
import com.vaadin.ui.Link;
@@ -22,6 +22,7 @@ public class LinkConnector extends AbstractComponentConnector implements
return false;
}
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
if (!isRealUpdate(uidl)) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/link/VLink.java b/src/com/vaadin/terminal/gwt/client/ui/link/VLink.java
index 68fe5d9292..4df3220ef1 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/link/VLink.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/link/VLink.java
@@ -13,7 +13,6 @@ import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HTML;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ui.Icon;
public class VLink extends HTML implements ClickHandler {
@@ -51,10 +50,10 @@ public class VLink extends HTML implements ClickHandler {
getElement().appendChild(anchor);
anchor.appendChild(captionElement);
addClickHandler(this);
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
setStyleName(CLASSNAME);
}
+ @Override
public void onClick(ClickEvent event) {
if (enabled) {
if (target == null) {
@@ -101,9 +100,6 @@ public class VLink extends HTML implements ClickHandler {
if (event.getTypeInt() == Event.ONLOAD) {
Util.notifyParentOfSizeChange(this, true);
}
- if (client != null) {
- client.handleTooltipEvent(event, this);
- }
if (target == captionElement || target == anchor
|| (icon != null && target == icon.getElement())) {
super.onBrowserEvent(event);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/listselect/ListSelectConnector.java b/src/com/vaadin/terminal/gwt/client/ui/listselect/ListSelectConnector.java
index 8a4553d983..678847226b 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/listselect/ListSelectConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/listselect/ListSelectConnector.java
@@ -4,7 +4,7 @@
package com.vaadin.terminal.gwt.client.ui.listselect;
-import com.vaadin.terminal.gwt.client.ui.Connect;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.optiongroup.OptionGroupBaseConnector;
import com.vaadin.ui.ListSelect;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/listselect/TooltipListBox.java b/src/com/vaadin/terminal/gwt/client/ui/listselect/TooltipListBox.java
deleted file mode 100644
index abecd844da..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/listselect/TooltipListBox.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.listselect;
-
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.VTooltip;
-
-/**
- * Extended ListBox to listen tooltip events and forward them to generic
- * handler.
- */
-public class TooltipListBox extends ListBox {
- private ApplicationConnection client;
- private Widget widget;
-
- public TooltipListBox(boolean isMultiselect) {
- super(isMultiselect);
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
- }
-
- public void setClient(ApplicationConnection client) {
- this.client = client;
- }
-
- public void setSelect(Widget widget) {
- this.widget = widget;
- }
-
- @Override
- public void onBrowserEvent(Event event) {
- super.onBrowserEvent(event);
- if (client != null) {
- client.handleTooltipEvent(event, widget);
- }
- }
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/listselect/VListSelect.java b/src/com/vaadin/terminal/gwt/client/ui/listselect/VListSelect.java
index e338897841..6f3f876fb7 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/listselect/VListSelect.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/listselect/VListSelect.java
@@ -8,6 +8,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.user.client.ui.ListBox;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.optiongroup.VOptionGroupBase;
@@ -17,23 +18,25 @@ public class VListSelect extends VOptionGroupBase {
private static final int VISIBLE_COUNT = 10;
- protected TooltipListBox select;
+ protected ListBox select;
private int lastSelectedIndex = -1;
public VListSelect() {
- super(new TooltipListBox(true), CLASSNAME);
- select = (TooltipListBox) optionsContainer;
- select.setSelect(this);
+ super(new ListBox(true), CLASSNAME);
+ select = getOptionsContainer();
select.addChangeHandler(this);
select.addClickHandler(this);
select.setStyleName(CLASSNAME + "-select");
select.setVisibleItemCount(VISIBLE_COUNT);
}
+ protected ListBox getOptionsContainer() {
+ return (ListBox) optionsContainer;
+ }
+
@Override
protected void buildOptions(UIDL uidl) {
- select.setClient(client);
select.setMultipleSelect(isMultiselect());
select.setEnabled(!isDisabled() && !isReadonly());
select.clear();
@@ -99,9 +102,10 @@ public class VListSelect extends VOptionGroupBase {
@Override
protected void setTabIndex(int tabIndex) {
- ((TooltipListBox) optionsContainer).setTabIndex(tabIndex);
+ getOptionsContainer().setTabIndex(tabIndex);
}
+ @Override
public void focus() {
select.setFocus(true);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBar.java b/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBar.java
index 7bee870387..5cb3fb83b4 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBar.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBar.java
@@ -246,6 +246,7 @@ public class MenuBar extends Widget implements PopupListener {
}
}
+ @Override
public void onPopupClosed(PopupPanel sender, boolean autoClosed) {
// If the menu popup was auto-closed, close all of its parents as well.
if (autoClosed) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java b/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java
index d1f77aa0ff..2a8923bbc0 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuBarConnector.java
@@ -7,14 +7,16 @@ import java.util.Iterator;
import java.util.Stack;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.Command;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
+import com.vaadin.terminal.gwt.client.TooltipInfo;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
import com.vaadin.terminal.gwt.client.ui.Icon;
import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout;
import com.vaadin.terminal.gwt.client.ui.menubar.VMenuBar.CustomMenuItem;
@@ -29,6 +31,7 @@ public class MenuBarConnector extends AbstractComponentConnector implements
* This method is called when the page is loaded for the first time, and
* every time UI changes in the component are received from the server.
*/
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
if (!isRealUpdate(uidl)) {
return;
@@ -105,6 +108,7 @@ public class MenuBarConnector extends AbstractComponentConnector implements
// Construct a command that fires onMenuClick(int) with the
// item's id-number
cmd = new Command() {
+ @Override
public void execute() {
getWidget().hostReference.onMenuClick(itemId);
}
@@ -120,6 +124,7 @@ public class MenuBarConnector extends AbstractComponentConnector implements
iteratorStack.push(itr);
itr = item.getChildIterator();
currentMenu = new VMenuBar(true, currentMenu);
+ client.getVTooltip().connectHandlersToWidget(currentMenu);
// this is the top-level style that also propagates to items -
// any item specific styles are set above in
// currentItem.updateFromUIDL(item, client)
@@ -157,7 +162,30 @@ public class MenuBarConnector extends AbstractComponentConnector implements
return (VMenuBar) super.getWidget();
}
+ @Override
public void layout() {
getWidget().iLayout();
}
+
+ @Override
+ public TooltipInfo getTooltipInfo(Element element) {
+ TooltipInfo info = null;
+
+ // Check content of widget to find tooltip for element
+ if (element != getWidget().getElement()) {
+
+ CustomMenuItem item = getWidget().getMenuItemWithElement(
+ (com.google.gwt.user.client.Element) element);
+ if (item != null) {
+ info = item.getTooltip();
+ }
+ }
+
+ // Use default tooltip if nothing found from DOM three
+ if (info == null) {
+ info = super.getTooltipInfo(element);
+ }
+
+ return info;
+ }
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuItem.java b/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuItem.java
index af79ba7c5e..7f150d9a5f 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuItem.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/menubar/MenuItem.java
@@ -121,6 +121,7 @@ public class MenuItem extends UIObject implements HasHTML {
return command;
}
+ @Override
public String getHTML() {
return DOM.getInnerHTML(getElement());
}
@@ -143,6 +144,7 @@ public class MenuItem extends UIObject implements HasHTML {
return subMenu;
}
+ @Override
public String getText() {
return DOM.getInnerText(getElement());
}
@@ -157,6 +159,7 @@ public class MenuItem extends UIObject implements HasHTML {
command = cmd;
}
+ @Override
public void setHTML(String html) {
DOM.setInnerHTML(getElement(), html);
}
@@ -171,6 +174,7 @@ public class MenuItem extends UIObject implements HasHTML {
this.subMenu = subMenu;
}
+ @Override
public void setText(String text) {
DOM.setInnerText(getElement(), text);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/menubar/VMenuBar.java b/src/com/vaadin/terminal/gwt/client/ui/menubar/VMenuBar.java
index e48483cb02..47bda81362 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/menubar/VMenuBar.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/menubar/VMenuBar.java
@@ -36,7 +36,6 @@ import com.vaadin.terminal.gwt.client.LayoutManager;
import com.vaadin.terminal.gwt.client.TooltipInfo;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ui.Icon;
import com.vaadin.terminal.gwt.client.ui.SimpleFocusablePanel;
import com.vaadin.terminal.gwt.client.ui.SubPartAware;
@@ -89,11 +88,10 @@ public class VMenuBar extends SimpleFocusablePanel implements
boolean enabled = true;
- private String width = "notinited";
-
private VLazyExecutor iconLoadedExecutioner = new VLazyExecutor(100,
new ScheduledCommand() {
+ @Override
public void execute() {
iLayout(true);
}
@@ -140,8 +138,6 @@ public class VMenuBar extends SimpleFocusablePanel implements
sinkEvents(Event.ONCLICK | Event.ONMOUSEOVER | Event.ONMOUSEOUT
| Event.ONLOAD);
-
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
}
@Override
@@ -340,15 +336,6 @@ public class VMenuBar extends SimpleFocusablePanel implements
}
}
- // Handle tooltips
- if (targetItem == null && client != null) {
- // Handle root menubar tooltips
- client.handleTooltipEvent(e, this);
- } else if (targetItem != null) {
- // Handle item tooltips
- targetItem.onBrowserEvent(e);
- }
-
if (targetItem != null) {
switch (DOM.eventGetType(e)) {
@@ -537,6 +524,22 @@ public class VMenuBar extends SimpleFocusablePanel implements
final int shadowSpace = 10;
popup = new VOverlay(true, false, true);
+
+ // Setting owner and handlers to support tooltips. Needed for tooltip
+ // handling of overlay widgets (will direct queries to parent menu)
+ if (parentMenu == null) {
+ popup.setOwner(this);
+ } else {
+ VMenuBar parent = parentMenu;
+ while (parent.getParentMenu() != null) {
+ parent = parent.getParentMenu();
+ }
+ popup.setOwner(parent);
+ }
+ if (client != null) {
+ client.getVTooltip().connectHandlersToWidget(popup);
+ }
+
popup.setStyleName(CLASSNAME + "-popup");
popup.setWidget(item.getSubMenu());
popup.addCloseHandler(this);
@@ -600,7 +603,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
// popup
style.setWidth(contentWidth + Util.getNativeScrollbarSize(),
Unit.PX);
- popup.updateShadowSizeAndPosition();
+ popup.sizeOrPositionUpdated();
}
}
return top;
@@ -633,6 +636,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Listener method, fired when this menu is closed
*/
+ @Override
public void onClose(CloseEvent<PopupPanel> event) {
hideChildren();
if (event.isAutoClosed()) {
@@ -720,9 +724,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
* A class to hold information on menu items
*
*/
- protected static class CustomMenuItem extends Widget implements HasHTML {
-
- private ApplicationConnection client;
+ public static class CustomMenuItem extends Widget implements HasHTML {
protected String html = null;
protected Command command = null;
@@ -732,6 +734,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
protected boolean isSeparator = false;
protected boolean checkable = false;
protected boolean checked = false;
+ protected String description = null;
/**
* Default menu item {@link Widget} constructor for GWT.create().
@@ -761,7 +764,6 @@ public class VMenuBar extends SimpleFocusablePanel implements
setSelected(false);
setStyleName(CLASSNAME + "-menuitem");
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
}
public void setSelected(boolean selected) {
@@ -849,10 +851,12 @@ public class VMenuBar extends SimpleFocusablePanel implements
return command;
}
+ @Override
public String getHTML() {
return html;
}
+ @Override
public void setHTML(String html) {
this.html = html;
DOM.setInnerHTML(getElement(), html);
@@ -862,10 +866,12 @@ public class VMenuBar extends SimpleFocusablePanel implements
Util.sinkOnloadForImages(getElement());
}
+ @Override
public String getText() {
return html;
}
+ @Override
public void setText(String text) {
setHTML(Util.escapeHTML(text));
}
@@ -898,7 +904,6 @@ public class VMenuBar extends SimpleFocusablePanel implements
}
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- this.client = client;
setSeparator(uidl.hasAttribute("separator"));
setEnabled(!uidl.hasAttribute(ATTRIBUTE_ITEM_DISABLED));
@@ -918,32 +923,17 @@ public class VMenuBar extends SimpleFocusablePanel implements
}
if (uidl.hasAttribute(ATTRIBUTE_ITEM_DESCRIPTION)) {
- String description = uidl
+ description = uidl
.getStringAttribute(ATTRIBUTE_ITEM_DESCRIPTION);
- TooltipInfo info = new TooltipInfo(description);
-
- VMenuBar root = findRootMenu();
- client.registerTooltip(root, this, info);
}
}
- @Override
- public void onBrowserEvent(Event event) {
- super.onBrowserEvent(event);
- if (client != null) {
- client.handleTooltipEvent(event, findRootMenu(), this);
+ public TooltipInfo getTooltip() {
+ if (description == null) {
+ return null;
}
- }
- private VMenuBar findRootMenu() {
- VMenuBar menubar = getParentMenu();
-
- // Traverse up until root menu is found
- while (menubar.getParentMenu() != null) {
- menubar = menubar.getParentMenu();
- }
-
- return menubar;
+ return new TooltipInfo(description);
}
/**
@@ -1064,6 +1054,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
* com.google.gwt.event.dom.client.KeyPressHandler#onKeyPress(com.google
* .gwt.event.dom.client.KeyPressEvent)
*/
+ @Override
public void onKeyPress(KeyPressEvent event) {
if (handleNavigation(event.getNativeEvent().getKeyCode(),
event.isControlKeyDown() || event.isMetaKeyDown(),
@@ -1079,6 +1070,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
* com.google.gwt.event.dom.client.KeyDownHandler#onKeyDown(com.google.gwt
* .event.dom.client.KeyDownEvent)
*/
+ @Override
public void onKeyDown(KeyDownEvent event) {
if (handleNavigation(event.getNativeEvent().getKeyCode(),
event.isControlKeyDown() || event.isMetaKeyDown(),
@@ -1399,12 +1391,14 @@ public class VMenuBar extends SimpleFocusablePanel implements
* com.google.gwt.event.dom.client.FocusHandler#onFocus(com.google.gwt.event
* .dom.client.FocusEvent)
*/
+ @Override
public void onFocus(FocusEvent event) {
}
private final String SUBPART_PREFIX = "item";
+ @Override
public Element getSubPartElement(String subPart) {
int index = Integer
.parseInt(subPart.substring(SUBPART_PREFIX.length()));
@@ -1413,6 +1407,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
return item.getElement();
}
+ @Override
public String getSubPartName(Element subElement) {
if (!getElement().isOrHasChild(subElement)) {
return null;
@@ -1435,4 +1430,28 @@ public class VMenuBar extends SimpleFocusablePanel implements
return null;
}
+ /**
+ * Get menu item with given DOM element
+ *
+ * @param element
+ * Element used in search
+ * @return Menu item or null if not found
+ */
+ public CustomMenuItem getMenuItemWithElement(Element element) {
+ for (int i = 0; i < items.size(); i++) {
+ CustomMenuItem item = items.get(i);
+ if (DOM.isOrHasChild(item.getElement(), element)) {
+ return item;
+ }
+
+ if (item.getSubMenu() != null) {
+ item = item.getSubMenu().getMenuItemWithElement(element);
+ if (item != null) {
+ return item;
+ }
+ }
+ }
+
+ return null;
+ }
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/nativebutton/NativeButtonConnector.java b/src/com/vaadin/terminal/gwt/client/ui/nativebutton/NativeButtonConnector.java
index c010fba711..73de87c276 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/nativebutton/NativeButtonConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/nativebutton/NativeButtonConnector.java
@@ -9,15 +9,15 @@ import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.DOM;
+import com.vaadin.shared.communication.FieldRpc.FocusAndBlurServerRpc;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.button.ButtonServerRpc;
+import com.vaadin.shared.ui.button.ButtonState;
import com.vaadin.terminal.gwt.client.EventHelper;
-import com.vaadin.terminal.gwt.client.communication.FieldRpc.FocusAndBlurServerRpc;
import com.vaadin.terminal.gwt.client.communication.RpcProxy;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.Icon;
-import com.vaadin.terminal.gwt.client.ui.button.ButtonServerRpc;
-import com.vaadin.terminal.gwt.client.ui.button.ButtonState;
import com.vaadin.ui.NativeButton;
@Connect(NativeButton.class)
@@ -107,12 +107,14 @@ public class NativeButtonConnector extends AbstractComponentConnector implements
return (ButtonState) super.getState();
}
+ @Override
public void onFocus(FocusEvent event) {
// EventHelper.updateFocusHandler ensures that this is called only when
// there is a listener on server side
focusBlurRpc.focus();
}
+ @Override
public void onBlur(BlurEvent event) {
// EventHelper.updateFocusHandler ensures that this is called only when
// there is a listener on server side
diff --git a/src/com/vaadin/terminal/gwt/client/ui/nativebutton/VNativeButton.java b/src/com/vaadin/terminal/gwt/client/ui/nativebutton/VNativeButton.java
index dd6e741126..d58fd2a995 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/nativebutton/VNativeButton.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/nativebutton/VNativeButton.java
@@ -10,14 +10,13 @@ import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.Button;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.button.ButtonServerRpc;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.MouseEventDetailsBuilder;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ui.Icon;
-import com.vaadin.terminal.gwt.client.ui.button.ButtonServerRpc;
public class VNativeButton extends Button implements ClickHandler {
@@ -54,7 +53,6 @@ public class VNativeButton extends Button implements ClickHandler {
addClickHandler(this);
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
sinkEvents(Event.ONMOUSEDOWN);
sinkEvents(Event.ONMOUSEUP);
}
@@ -87,10 +85,6 @@ public class VNativeButton extends Button implements ClickHandler {
}
clickPending = false;
}
-
- if (client != null) {
- client.handleTooltipEvent(event, this);
- }
}
@Override
@@ -106,6 +100,7 @@ public class VNativeButton extends Button implements ClickHandler {
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event
* .dom.client.ClickEvent)
*/
+ @Override
public void onClick(ClickEvent event) {
if (paintableId == null || client == null) {
return;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/nativeselect/NativeSelectConnector.java b/src/com/vaadin/terminal/gwt/client/ui/nativeselect/NativeSelectConnector.java
index 8f57e0c37f..8a00afa056 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/nativeselect/NativeSelectConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/nativeselect/NativeSelectConnector.java
@@ -4,7 +4,7 @@
package com.vaadin.terminal.gwt.client.ui.nativeselect;
-import com.vaadin.terminal.gwt.client.ui.Connect;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.optiongroup.OptionGroupBaseConnector;
import com.vaadin.ui.NativeSelect;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/nativeselect/VNativeSelect.java b/src/com/vaadin/terminal/gwt/client/ui/nativeselect/VNativeSelect.java
index 54f5e9aff5..ea5292724d 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/nativeselect/VNativeSelect.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/nativeselect/VNativeSelect.java
@@ -8,32 +8,34 @@ import java.util.ArrayList;
import java.util.Iterator;
import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.user.client.ui.ListBox;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.Field;
-import com.vaadin.terminal.gwt.client.ui.listselect.TooltipListBox;
import com.vaadin.terminal.gwt.client.ui.optiongroup.VOptionGroupBase;
public class VNativeSelect extends VOptionGroupBase implements Field {
public static final String CLASSNAME = "v-select";
- protected TooltipListBox select;
+ protected ListBox select;
private boolean firstValueIsTemporaryNullItem = false;
public VNativeSelect() {
- super(new TooltipListBox(false), CLASSNAME);
- select = (TooltipListBox) optionsContainer;
- select.setSelect(this);
+ super(new ListBox(false), CLASSNAME);
+ select = getOptionsContainer();
select.setVisibleItemCount(1);
select.addChangeHandler(this);
select.setStyleName(CLASSNAME + "-select");
}
+ protected ListBox getOptionsContainer() {
+ return (ListBox) optionsContainer;
+ }
+
@Override
protected void buildOptions(UIDL uidl) {
- select.setClient(client);
select.setEnabled(!isDisabled() && !isReadonly());
select.clear();
firstValueIsTemporaryNullItem = false;
@@ -103,9 +105,10 @@ public class VNativeSelect extends VOptionGroupBase implements Field {
@Override
protected void setTabIndex(int tabIndex) {
- ((TooltipListBox) optionsContainer).setTabIndex(tabIndex);
+ getOptionsContainer().setTabIndex(tabIndex);
}
+ @Override
public void focus() {
select.setFocus(true);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/notification/VNotification.java b/src/com/vaadin/terminal/gwt/client/ui/notification/VNotification.java
index fb853b8a55..1309155443 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/notification/VNotification.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/notification/VNotification.java
@@ -163,6 +163,7 @@ public class VNotification extends VOverlay {
super.show();
notifications.add(this);
setPosition(position);
+ sizeOrPositionUpdated();
/**
* Android 4 fails to render notifications correctly without a little
* nudge (#8551)
diff --git a/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupBaseConnector.java b/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupBaseConnector.java
index 3658126a97..a4dd72906d 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupBaseConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupBaseConnector.java
@@ -14,6 +14,7 @@ import com.vaadin.terminal.gwt.client.ui.textfield.VTextField;
public abstract class OptionGroupBaseConnector extends AbstractFieldConnector
implements Paintable {
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
// Save details
diff --git a/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupConnector.java b/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupConnector.java
index e6064bd03f..caf85348d4 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/optiongroup/OptionGroupConnector.java
@@ -9,10 +9,10 @@ import java.util.ArrayList;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.EventId;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.EventId;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.ui.OptionGroup;
@Connect(OptionGroup.class)
diff --git a/src/com/vaadin/terminal/gwt/client/ui/optiongroup/VOptionGroup.java b/src/com/vaadin/terminal/gwt/client/ui/optiongroup/VOptionGroup.java
index d6e6949242..a6cdf7e888 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/optiongroup/VOptionGroup.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/optiongroup/VOptionGroup.java
@@ -25,8 +25,8 @@ import com.google.gwt.user.client.ui.Focusable;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.EventId;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.EventId;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.ui.Icon;
@@ -51,6 +51,7 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler,
protected List<HandlerRegistration> blurHandlers = null;
private final LoadHandler iconLoadHandler = new LoadHandler() {
+ @Override
public void onLoad(LoadEvent event) {
Util.notifyParentOfSizeChange(VOptionGroup.this, true);
}
@@ -154,6 +155,7 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler,
}
}
+ @Override
public void focus() {
Iterator<Widget> iterator = panel.iterator();
if (iterator.hasNext()) {
@@ -161,6 +163,7 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler,
}
}
+ @Override
public void onFocus(FocusEvent arg0) {
if (!blurOccured) {
// no blur occured before this focus event
@@ -178,10 +181,12 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler,
}
}
+ @Override
public void onBlur(BlurEvent arg0) {
blurOccured = true;
if (sendBlurEvents) {
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
// check whether blurOccured still is true and then send the
// event out to the server
diff --git a/src/com/vaadin/terminal/gwt/client/ui/optiongroup/VOptionGroupBase.java b/src/com/vaadin/terminal/gwt/client/ui/optiongroup/VOptionGroupBase.java
index a512f024b8..d128d7deb1 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/optiongroup/VOptionGroupBase.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/optiongroup/VOptionGroupBase.java
@@ -126,6 +126,7 @@ public abstract class VOptionGroupBase extends Composite implements Field,
abstract protected void setTabIndex(int tabIndex);
+ @Override
public void onClick(ClickEvent event) {
if (event.getSource() == newItemButton
&& !newItemField.getText().equals("")) {
@@ -135,6 +136,7 @@ public abstract class VOptionGroupBase extends Composite implements Field,
}
}
+ @Override
public void onChange(ChangeEvent event) {
if (multiselect) {
client.updateVariable(paintableId, "selected", getSelectedItems(),
@@ -145,6 +147,7 @@ public abstract class VOptionGroupBase extends Composite implements Field,
}
}
+ @Override
public void onKeyPress(KeyPressEvent event) {
if (event.getSource() == newItemField
&& event.getCharCode() == KeyCodes.KEY_ENTER) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
index 9a89553fd2..e1bf217691 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
@@ -9,6 +9,11 @@ import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.AlignmentInfo;
+import com.vaadin.shared.ui.LayoutClickRpc;
+import com.vaadin.shared.ui.VMarginInfo;
+import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutServerRpc;
+import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutState;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
import com.vaadin.terminal.gwt.client.DirectionalManagedLayout;
@@ -18,10 +23,7 @@ import com.vaadin.terminal.gwt.client.VCaption;
import com.vaadin.terminal.gwt.client.communication.RpcProxy;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.ui.AbstractLayoutConnector;
-import com.vaadin.terminal.gwt.client.ui.AlignmentInfo;
import com.vaadin.terminal.gwt.client.ui.LayoutClickEventHandler;
-import com.vaadin.terminal.gwt.client.ui.LayoutClickRpc;
-import com.vaadin.terminal.gwt.client.ui.VMarginInfo;
import com.vaadin.terminal.gwt.client.ui.layout.ComponentConnectorLayoutSlot;
import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot;
@@ -48,6 +50,7 @@ public abstract class AbstractOrderedLayoutConnector extends
@Override
public void init() {
+ super.init();
rpc = RpcProxy.create(AbstractOrderedLayoutServerRpc.class, this);
getLayoutManager().registerDependency(this,
getWidget().spacingMeasureElement);
@@ -72,6 +75,7 @@ public abstract class AbstractOrderedLayoutConnector extends
return (AbstractOrderedLayoutState) super.getState();
}
+ @Override
public void updateCaption(ComponentConnector component) {
VMeasuringOrderedLayout layout = getWidget();
if (VCaption.isNeeded(component.getState())) {
@@ -262,6 +266,7 @@ public abstract class AbstractOrderedLayoutConnector extends
}
}
+ @Override
public void layoutHorizontally() {
if (getWidget().isVertical) {
layoutSecondaryDirection();
@@ -270,6 +275,7 @@ public abstract class AbstractOrderedLayoutConnector extends
}
}
+ @Override
public void layoutVertically() {
if (getWidget().isVertical) {
layoutPrimaryDirection();
diff --git a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutServerRpc.java b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutServerRpc.java
deleted file mode 100644
index 5a29eacada..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutServerRpc.java
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.orderedlayout;
-
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.ui.LayoutClickRpc;
-
-public interface AbstractOrderedLayoutServerRpc extends LayoutClickRpc,
- ServerRpc {
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutState.java b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutState.java
deleted file mode 100644
index 1d57358490..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/AbstractOrderedLayoutState.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.orderedlayout;
-
-import java.io.Serializable;
-import java.util.HashMap;
-
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.client.ui.AbstractLayoutState;
-import com.vaadin.terminal.gwt.client.ui.AlignmentInfo;
-
-public class AbstractOrderedLayoutState extends AbstractLayoutState {
- private boolean spacing = false;
-
- public HashMap<Connector, ChildComponentData> childData = new HashMap<Connector, ChildComponentData>();
-
- public static class ChildComponentData implements Serializable {
- private int alignmentBitmask = AlignmentInfo.TOP_LEFT.getBitMask();
- private float expandRatio = 0.0f;
-
- public int getAlignmentBitmask() {
- return alignmentBitmask;
- }
-
- public void setAlignmentBitmask(int alignmentBitmask) {
- this.alignmentBitmask = alignmentBitmask;
- }
-
- public float getExpandRatio() {
- return expandRatio;
- }
-
- public void setExpandRatio(float expandRatio) {
- this.expandRatio = expandRatio;
- }
-
- }
-
- public HashMap<Connector, ChildComponentData> getChildData() {
- return childData;
- }
-
- public void setChildData(HashMap<Connector, ChildComponentData> childData) {
- this.childData = childData;
- }
-
- public boolean isSpacing() {
- return spacing;
- }
-
- public void setSpacing(boolean spacing) {
- this.spacing = spacing;
- }
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/HorizontalLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/HorizontalLayoutConnector.java
index 3b0014c0f0..459bd474d1 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/HorizontalLayoutConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/HorizontalLayoutConnector.java
@@ -3,8 +3,8 @@
*/
package com.vaadin.terminal.gwt.client.ui.orderedlayout;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
import com.vaadin.ui.HorizontalLayout;
@Connect(value = HorizontalLayout.class, loadStyle = LoadStyle.EAGER)
diff --git a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VMeasuringOrderedLayout.java b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VMeasuringOrderedLayout.java
index de55ca98e6..4bb1c66e86 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VMeasuringOrderedLayout.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VMeasuringOrderedLayout.java
@@ -15,8 +15,8 @@ import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.WidgetCollection;
+import com.vaadin.shared.ui.VMarginInfo;
import com.vaadin.terminal.gwt.client.VCaption;
-import com.vaadin.terminal.gwt.client.ui.VMarginInfo;
import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot;
public class VMeasuringOrderedLayout extends ComplexPanel {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VerticalLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VerticalLayoutConnector.java
index 42a762864e..a481283156 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VerticalLayoutConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/orderedlayout/VerticalLayoutConnector.java
@@ -3,8 +3,8 @@
*/
package com.vaadin.terminal.gwt.client.ui.orderedlayout;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
import com.vaadin.ui.VerticalLayout;
@Connect(value = VerticalLayout.class, loadStyle = LoadStyle.EAGER)
diff --git a/src/com/vaadin/terminal/gwt/client/ui/panel/PanelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/panel/PanelConnector.java
index d9096526f3..fd4761de5e 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/panel/PanelConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/panel/PanelConnector.java
@@ -7,17 +7,19 @@ import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.panel.PanelServerRpc;
+import com.vaadin.shared.ui.panel.PanelState;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
import com.vaadin.terminal.gwt.client.LayoutManager;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.communication.RpcProxy;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector;
import com.vaadin.terminal.gwt.client.ui.ClickEventHandler;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.PostLayoutListener;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler;
import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout;
@@ -46,6 +48,7 @@ public class PanelConnector extends AbstractComponentContainerConnector
@Override
public void init() {
+ super.init();
rpc = RpcProxy.create(PanelServerRpc.class, this);
VPanel panel = getWidget();
LayoutManager layoutManager = getLayoutManager();
@@ -70,6 +73,7 @@ public class PanelConnector extends AbstractComponentContainerConnector
return false;
}
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
if (isRealUpdate(uidl)) {
@@ -164,6 +168,7 @@ public class PanelConnector extends AbstractComponentContainerConnector
getWidget().contentNode.setTabIndex(getState().getTabIndex());
}
+ @Override
public void updateCaption(ComponentConnector component) {
// NOP: layouts caption, errors etc not rendered in Panel
}
@@ -173,6 +178,7 @@ public class PanelConnector extends AbstractComponentContainerConnector
return (VPanel) super.getWidget();
}
+ @Override
public void layout() {
updateSizes();
}
@@ -199,6 +205,7 @@ public class PanelConnector extends AbstractComponentContainerConnector
panel.scrollLeft = panel.contentNode.getScrollLeft();
}
+ @Override
public void postLayout() {
VPanel panel = getWidget();
if (uidlScrollTop != null) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/panel/PanelServerRpc.java b/src/com/vaadin/terminal/gwt/client/ui/panel/PanelServerRpc.java
deleted file mode 100644
index 9b59344aec..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/panel/PanelServerRpc.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.panel;
-
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.ui.ClickRpc;
-
-public interface PanelServerRpc extends ClickRpc, ServerRpc {
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/panel/PanelState.java b/src/com/vaadin/terminal/gwt/client/ui/panel/PanelState.java
deleted file mode 100644
index fc7921825f..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/panel/PanelState.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.panel;
-
-import com.vaadin.terminal.gwt.client.ComponentState;
-
-public class PanelState extends ComponentState {
- private int tabIndex;
- private int scrollLeft, scrollTop;
-
- public int getTabIndex() {
- return tabIndex;
- }
-
- public void setTabIndex(int tabIndex) {
- this.tabIndex = tabIndex;
- }
-
- public int getScrollLeft() {
- return scrollLeft;
- }
-
- public void setScrollLeft(int scrollLeft) {
- this.scrollLeft = scrollLeft;
- }
-
- public int getScrollTop() {
- return scrollTop;
- }
-
- public void setScrollTop(int scrollTop) {
- this.scrollTop = scrollTop;
- }
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/panel/VPanel.java b/src/com/vaadin/terminal/gwt/client/ui/panel/VPanel.java
index 6a06367acd..8764d61c3a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/panel/VPanel.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/panel/VPanel.java
@@ -100,6 +100,7 @@ public class VPanel extends SimplePanel implements ShortcutActionHandlerOwner,
* @see com.vaadin.terminal.gwt.client.Focusable#focus()
*/
+ @Override
public void focus() {
setFocus(true);
@@ -167,13 +168,10 @@ public class VPanel extends SimplePanel implements ShortcutActionHandlerOwner,
client.updateVariable(id, "scrollTop", scrollTop, false);
client.updateVariable(id, "scrollLeft", scrollLeft, false);
}
- } else if (captionNode.isOrHasChild(target)) {
- if (client != null) {
- client.handleTooltipEvent(event, this);
- }
}
}
+ @Override
public ShortcutActionHandler getShortcutActionHandler() {
return shortcutHandler;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/passwordfield/PasswordFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/passwordfield/PasswordFieldConnector.java
index c4c5954c33..55d645f12e 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/passwordfield/PasswordFieldConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/passwordfield/PasswordFieldConnector.java
@@ -4,7 +4,7 @@
package com.vaadin.terminal.gwt.client.ui.passwordfield;
-import com.vaadin.terminal.gwt.client.ui.Connect;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.textfield.TextFieldConnector;
import com.vaadin.ui.PasswordField;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/popupview/PopupViewConnector.java b/src/com/vaadin/terminal/gwt/client/ui/popupview/PopupViewConnector.java
index c5117fdddb..19b35821c7 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/popupview/PopupViewConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/popupview/PopupViewConnector.java
@@ -3,6 +3,7 @@
*/
package com.vaadin.terminal.gwt.client.ui.popupview;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.Paintable;
@@ -10,7 +11,6 @@ import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.VCaption;
import com.vaadin.terminal.gwt.client.VCaptionWrapper;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.PostLayoutListener;
import com.vaadin.ui.PopupView;
@@ -31,6 +31,7 @@ public class PopupViewConnector extends AbstractComponentContainerConnector
* @see com.vaadin.terminal.gwt.client.ComponentConnector#updateFromUIDL(com.vaadin.terminal.gwt.client.UIDL,
* com.vaadin.terminal.gwt.client.ApplicationConnection)
*/
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
if (!isRealUpdate(uidl)) {
return;
@@ -81,6 +82,7 @@ public class PopupViewConnector extends AbstractComponentContainerConnector
}
}// updateFromUIDL
+ @Override
public void updateCaption(ComponentConnector component) {
if (VCaption.isNeeded(component.getState())) {
if (getWidget().popup.captionWrapper != null) {
@@ -104,6 +106,7 @@ public class PopupViewConnector extends AbstractComponentContainerConnector
return (VPopupView) super.getWidget();
}
+ @Override
public void postLayout() {
if (centerAfterLayout) {
centerAfterLayout = false;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/popupview/VPopupView.java b/src/com/vaadin/terminal/gwt/client/ui/popupview/VPopupView.java
index da48975726..6efcd8f417 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/popupview/VPopupView.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/popupview/VPopupView.java
@@ -10,6 +10,8 @@ import java.util.Set;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.logical.shared.CloseEvent;
import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.user.client.DOM;
@@ -26,7 +28,9 @@ import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.VCaptionWrapper;
-import com.vaadin.terminal.gwt.client.VTooltip;
+import com.vaadin.terminal.gwt.client.VConsole;
+import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler;
+import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
import com.vaadin.terminal.gwt.client.ui.VOverlay;
import com.vaadin.terminal.gwt.client.ui.richtextarea.VRichTextArea;
@@ -60,6 +64,7 @@ public class VPopupView extends HTML {
// When we click to open the popup...
addClickHandler(new ClickHandler() {
+ @Override
public void onClick(ClickEvent event) {
updateState(true);
}
@@ -67,13 +72,13 @@ public class VPopupView extends HTML {
// ..and when we close it
popup.addCloseHandler(new CloseHandler<PopupPanel>() {
+ @Override
public void onClose(CloseEvent<PopupPanel> event) {
updateState(false);
}
});
popup.setAnimationEnabled(true);
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
}
/**
@@ -183,8 +188,23 @@ public class VPopupView extends HTML {
private final Set<Element> activeChildren = new HashSet<Element>();
private boolean hiding = false;
+ private ShortcutActionHandler shortcutActionHandler;
+
public CustomPopup() {
super(true, false, true); // autoHide, not modal, dropshadow
+
+ // Delegate popup keyboard events to the relevant handler. The
+ // events do not propagate automatically because the popup is
+ // directly attached to the RootPanel.
+ addDomHandler(new KeyDownHandler() {
+ @Override
+ public void onKeyDown(KeyDownEvent event) {
+ if (shortcutActionHandler != null) {
+ shortcutActionHandler.handleKeyboardEvent(Event
+ .as(event.getNativeEvent()));
+ }
+ }
+ }, KeyDownEvent.getType());
}
// For some reason ONMOUSEOUT events are not always received, so we have
@@ -227,18 +247,33 @@ public class VPopupView extends HTML {
@Override
public void hide(boolean autoClosed) {
+ VConsole.log("Hiding popupview");
hiding = true;
syncChildren();
if (popupComponentWidget != null && popupComponentWidget != loading) {
remove(popupComponentWidget);
}
hasHadMouseOver = false;
+ shortcutActionHandler = null;
super.hide(autoClosed);
}
@Override
public void show() {
hiding = false;
+
+ // Find the shortcut action handler that should handle keyboard
+ // events from the popup. The events do not propagate automatically
+ // because the popup is directly attached to the RootPanel.
+ Widget widget = VPopupView.this;
+ while (shortcutActionHandler == null && widget != null) {
+ if (widget instanceof ShortcutActionHandlerOwner) {
+ shortcutActionHandler = ((ShortcutActionHandlerOwner) widget)
+ .getShortcutActionHandler();
+ }
+ widget = widget.getParent();
+ }
+
super.show();
}
@@ -337,12 +372,4 @@ public class VPopupView extends HTML {
}// class CustomPopup
- @Override
- public void onBrowserEvent(Event event) {
- super.onBrowserEvent(event);
- if (client != null) {
- client.handleTooltipEvent(event, this);
- }
- }
-
}// class VPopupView
diff --git a/src/com/vaadin/terminal/gwt/client/ui/progressindicator/ProgressIndicatorConnector.java b/src/com/vaadin/terminal/gwt/client/ui/progressindicator/ProgressIndicatorConnector.java
index 9d0532fae3..cdb0174a49 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/progressindicator/ProgressIndicatorConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/progressindicator/ProgressIndicatorConnector.java
@@ -5,17 +5,18 @@
package com.vaadin.terminal.gwt.client.ui.progressindicator;
import com.google.gwt.user.client.DOM;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.AbstractFieldConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.ui.ProgressIndicator;
@Connect(ProgressIndicator.class)
public class ProgressIndicatorConnector extends AbstractFieldConnector
implements Paintable {
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
if (!isRealUpdate(uidl)) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/richtextarea/RichTextAreaConnector.java b/src/com/vaadin/terminal/gwt/client/ui/richtextarea/RichTextAreaConnector.java
index db52640088..66781eb645 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/richtextarea/RichTextAreaConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/richtextarea/RichTextAreaConnector.java
@@ -4,12 +4,12 @@
package com.vaadin.terminal.gwt.client.ui.richtextarea;
import com.google.gwt.user.client.Event;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.AbstractFieldConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.BeforeShortcutActionListener;
import com.vaadin.ui.RichTextArea;
@@ -17,6 +17,7 @@ import com.vaadin.ui.RichTextArea;
public class RichTextAreaConnector extends AbstractFieldConnector implements
Paintable, BeforeShortcutActionListener {
+ @Override
public void updateFromUIDL(final UIDL uidl, ApplicationConnection client) {
getWidget().client = client;
getWidget().id = uidl.getId();
@@ -59,6 +60,7 @@ public class RichTextAreaConnector extends AbstractFieldConnector implements
}
+ @Override
public void onBeforeShortcutAction(Event e) {
getWidget().synchronizeContentToServer();
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextArea.java b/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextArea.java
index eb062a3799..f9b399caac 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextArea.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextArea.java
@@ -31,6 +31,7 @@ import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.ui.Field;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
+import com.vaadin.terminal.gwt.client.ui.TouchScrollDelegate;
/**
* This class implements a basic client side rich text editor component.
@@ -85,6 +86,7 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler,
initWidget(fp);
setStyleName(CLASSNAME);
+ TouchScrollDelegate.enableTouchScrolling(html, html.getElement());
}
private void createRTAComponents() {
@@ -160,6 +162,7 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler,
}
// TODO is this really used, or does everything go via onBlur() only?
+ @Override
public void onChange(ChangeEvent event) {
synchronizeContentToServer();
}
@@ -177,6 +180,7 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler,
}
}
+ @Override
public void onBlur(BlurEvent event) {
synchronizeContentToServer();
// TODO notify possible server side blur/focus listeners
@@ -242,6 +246,7 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler,
* delay the height setting so the DOM has had time to stabilize.
*/
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
int editorHeight = getOffsetHeight()
- getExtraVerticalPixels()
@@ -281,9 +286,11 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler,
}
}
+ @Override
public void onKeyPress(KeyPressEvent event) {
if (maxLength >= 0) {
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
if (rta.getHTML().length() > maxLength) {
rta.setHTML(rta.getHTML().substring(0, maxLength));
@@ -293,6 +300,7 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler,
}
}
+ @Override
public void onKeyDown(KeyDownEvent event) {
// delegate to closest shortcut action handler
// throw event from the iframe forward to the shortcuthandler
@@ -320,14 +328,17 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler,
return hasShortcutActionHandler;
}
+ @Override
public int getTabIndex() {
return rta.getTabIndex();
}
+ @Override
public void setAccessKey(char key) {
rta.setAccessKey(key);
}
+ @Override
public void setFocus(boolean focused) {
/*
* Similar issue as with selectAll. Focusing must happen before possible
@@ -342,6 +353,7 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler,
}.schedule(300);
}
+ @Override
public void setTabIndex(int index) {
rta.setTabIndex(index);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextToolbar.java b/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextToolbar.java
index 1e1805efdf..d86c7a4bf5 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextToolbar.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextToolbar.java
@@ -172,6 +172,7 @@ public class VRichTextToolbar extends Composite {
private class EventHandler implements ClickHandler, ChangeHandler,
KeyUpHandler {
+ @Override
@SuppressWarnings("deprecation")
public void onChange(ChangeEvent event) {
Object sender = event.getSource();
@@ -193,6 +194,7 @@ public class VRichTextToolbar extends Composite {
}
}
+ @Override
@SuppressWarnings("deprecation")
public void onClick(ClickEvent event) {
Object sender = event.getSource();
@@ -249,6 +251,7 @@ public class VRichTextToolbar extends Composite {
}
}
+ @Override
public void onKeyUp(KeyUpEvent event) {
if (event.getSource() == richText) {
// We use the RichTextArea's onKeyUp event to update the toolbar
diff --git a/src/com/vaadin/terminal/gwt/client/ui/root/PageClientRpc.java b/src/com/vaadin/terminal/gwt/client/ui/root/PageClientRpc.java
deleted file mode 100644
index a02ecc8ded..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/root/PageClientRpc.java
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.terminal.gwt.client.ui.root;
-
-import com.vaadin.terminal.gwt.client.communication.ClientRpc;
-
-public interface PageClientRpc extends ClientRpc {
-
- public void setTitle(String title);
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java b/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java
index 1a62e566ad..7b5097ff77 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java
@@ -19,13 +19,18 @@ import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.web.bindery.event.shared.HandlerRegistration;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
+import com.vaadin.shared.ui.root.PageClientRpc;
+import com.vaadin.shared.ui.root.RootServerRpc;
+import com.vaadin.shared.ui.root.RootState;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.Focusable;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.VConsole;
@@ -34,8 +39,6 @@ import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent.StateChangeHandler;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector;
import com.vaadin.terminal.gwt.client.ui.ClickEventHandler;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler;
import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren;
import com.vaadin.terminal.gwt.client.ui.notification.VNotification;
@@ -51,6 +54,7 @@ public class RootConnector extends AbstractComponentContainerConnector
private HandlerRegistration childStateChangeHandlerRegistration;
private final StateChangeHandler childStateChangeHandler = new StateChangeHandler() {
+ @Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
// TODO Should use a more specific handler that only reacts to
// size changes
@@ -62,12 +66,14 @@ public class RootConnector extends AbstractComponentContainerConnector
protected void init() {
super.init();
registerRpc(PageClientRpc.class, new PageClientRpc() {
+ @Override
public void setTitle(String title) {
com.google.gwt.user.client.Window.setTitle(title);
}
});
}
+ @Override
public void updateFromUIDL(final UIDL uidl, ApplicationConnection client) {
ConnectorMap paintableMap = ConnectorMap.get(getConnection());
getWidget().rendering = true;
@@ -118,6 +124,7 @@ public class RootConnector extends AbstractComponentContainerConnector
// to finish rendering this window in case this is a download
// (and window stays open).
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
VRoot.goTo(url);
}
@@ -182,6 +189,7 @@ public class RootConnector extends AbstractComponentContainerConnector
if (uidl.hasAttribute("focused")) {
// set focused component when render phase is finished
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
ComponentConnector paintable = (ComponentConnector) uidl
.getPaintableAttribute("focused", getConnection());
@@ -246,6 +254,11 @@ public class RootConnector extends AbstractComponentContainerConnector
getWidget().currentFragment, false);
}
+ if (firstPaint) {
+ // Queue the initial window size to be sent with the following
+ // request.
+ getWidget().sendClientResized();
+ }
getWidget().rendering = false;
}
@@ -288,6 +301,7 @@ public class RootConnector extends AbstractComponentContainerConnector
};
+ @Override
public void updateCaption(ComponentConnector component) {
// NOP The main view never draws caption for its layout
}
@@ -407,6 +421,7 @@ public class RootConnector extends AbstractComponentContainerConnector
}
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
componentConnector.getWidget().getElement().scrollIntoView();
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/root/RootServerRpc.java b/src/com/vaadin/terminal/gwt/client/ui/root/RootServerRpc.java
deleted file mode 100644
index 389500949d..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/root/RootServerRpc.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.root;
-
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.ui.ClickRpc;
-
-public interface RootServerRpc extends ClickRpc, ServerRpc {
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/root/RootState.java b/src/com/vaadin/terminal/gwt/client/ui/root/RootState.java
deleted file mode 100644
index 85d5e45022..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/root/RootState.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.root;
-
-import com.vaadin.terminal.gwt.client.ComponentState;
-import com.vaadin.terminal.gwt.client.Connector;
-
-public class RootState extends ComponentState {
- private Connector content;
-
- public Connector getContent() {
- return content;
- }
-
- public void setContent(Connector content) {
- this.content = content;
- }
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java b/src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java
index 0af8919280..fddb76e755 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/root/VRoot.java
@@ -123,6 +123,7 @@ public class VRoot extends SimplePanel implements ResizeHandler,
*/
private final ValueChangeHandler<String> historyChangeHandler = new ValueChangeHandler<String>() {
+ @Override
public void onValueChange(ValueChangeEvent<String> event) {
String newFragment = event.getValue();
@@ -138,6 +139,7 @@ public class VRoot extends SimplePanel implements ResizeHandler,
private VLazyExecutor delayedResizeExecutor = new VLazyExecutor(200,
new ScheduledCommand() {
+ @Override
public void execute() {
performSizeCheck();
}
@@ -361,6 +363,7 @@ public class VRoot extends SimplePanel implements ResizeHandler,
* .gwt.event.logical.shared.ResizeEvent)
*/
+ @Override
public void onResize(ResizeEvent event) {
triggerSizeChangeCheck();
}
@@ -395,7 +398,7 @@ public class VRoot extends SimplePanel implements ResizeHandler,
/**
* Send new dimensions to the server.
*/
- private void sendClientResized() {
+ void sendClientResized() {
Element parentElement = getElement().getParentElement();
int viewHeight = parentElement.getClientHeight();
int viewWidth = parentElement.getClientWidth();
@@ -416,6 +419,7 @@ public class VRoot extends SimplePanel implements ResizeHandler,
$wnd.location = url;
}-*/;
+ @Override
public void onWindowClosing(Window.ClosingEvent event) {
// Change focus on this window in order to ensure that all state is
// collected from textfields
@@ -435,10 +439,12 @@ public class VRoot extends SimplePanel implements ResizeHandler,
}
}-*/;
+ @Override
public ShortcutActionHandler getShortcutActionHandler() {
return actionHandler;
}
+ @Override
public void focus() {
getElement().focus();
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/slider/SliderConnector.java b/src/com/vaadin/terminal/gwt/client/ui/slider/SliderConnector.java
index 6fd7f8b6aa..f8588dbf3f 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/slider/SliderConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/slider/SliderConnector.java
@@ -5,17 +5,18 @@ package com.vaadin.terminal.gwt.client.ui.slider;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.user.client.Command;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.AbstractFieldConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.ui.Slider;
@Connect(Slider.class)
public class SliderConnector extends AbstractFieldConnector implements
Paintable {
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
getWidget().client = client;
@@ -51,6 +52,7 @@ public class SliderConnector extends AbstractFieldConnector implements
if (!getWidget().vertical) {
// Draw handle with a delay to allow base to gain maximum width
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
getWidget().buildHandle();
getWidget().setValue(getWidget().value, false);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/slider/VSlider.java b/src/com/vaadin/terminal/gwt/client/ui/slider/VSlider.java
index 5c7ee7a784..06608c95fe 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/slider/VSlider.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/slider/VSlider.java
@@ -18,7 +18,6 @@ import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.ContainerResizedListener;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ui.Field;
import com.vaadin.terminal.gwt.client.ui.SimpleFocusablePanel;
import com.vaadin.terminal.gwt.client.ui.VLazyExecutor;
@@ -79,6 +78,7 @@ public class VSlider extends SimpleFocusablePanel implements Field,
private VLazyExecutor delayedValueUpdater = new VLazyExecutor(100,
new ScheduledCommand() {
+ @Override
public void execute() {
updateValueToServer();
acceleration = 1;
@@ -114,8 +114,6 @@ public class VSlider extends SimpleFocusablePanel implements Field,
feedbackPopup.addStyleName(CLASSNAME + "-feedback");
feedbackPopup.setWidget(feedback);
-
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
}
void setFeedbackValue(double value) {
@@ -162,6 +160,7 @@ public class VSlider extends SimpleFocusablePanel implements Field,
DOM.setStyleAttribute(base, styleAttribute, MIN_SIZE + "px");
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
final Element p = DOM.getParent(getElement());
if (DOM.getElementPropertyInt(p, domProperty) > (MIN_SIZE + 5)) {
@@ -291,9 +290,6 @@ public class VSlider extends SimpleFocusablePanel implements Field,
event.preventDefault(); // avoid simulated events
event.stopPropagation();
}
- if (client != null) {
- client.handleTooltipEvent(event, this);
- }
}
private void processMouseWheelEvent(final Event event) {
@@ -422,6 +418,7 @@ public class VSlider extends SimpleFocusablePanel implements Field,
}
}
+ @Override
public void iLayout() {
if (vertical) {
setHeight();
diff --git a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelConnector.java
index e33755bc9b..f82718e4ea 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelConnector.java
@@ -14,16 +14,18 @@ import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelRpc;
+import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelState;
+import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelState.SplitterState;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
import com.vaadin.terminal.gwt.client.LayoutManager;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.communication.RpcProxy;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector;
import com.vaadin.terminal.gwt.client.ui.ClickEventHandler;
import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout;
-import com.vaadin.terminal.gwt.client.ui.splitpanel.AbstractSplitPanelState.SplitterState;
import com.vaadin.terminal.gwt.client.ui.splitpanel.VAbstractSplitPanel.SplitterMoveHandler;
import com.vaadin.terminal.gwt.client.ui.splitpanel.VAbstractSplitPanel.SplitterMoveHandler.SplitterMoveEvent;
@@ -41,6 +43,7 @@ public abstract class AbstractSplitPanelConnector extends
getWidget().addHandler(new SplitterMoveHandler() {
+ @Override
public void splitterMoved(SplitterMoveEvent event) {
String position = getWidget().getSplitterPosition();
float pos = 0;
@@ -61,6 +64,7 @@ public abstract class AbstractSplitPanelConnector extends
}, SplitterMoveEvent.TYPE);
}
+ @Override
public void updateCaption(ComponentConnector component) {
// TODO Implement caption handling
}
@@ -145,6 +149,7 @@ public abstract class AbstractSplitPanelConnector extends
getWidget().makeScrollable();
}
+ @Override
public void layout() {
VAbstractSplitPanel splitPanel = getWidget();
splitPanel.setSplitPosition(splitPanel.position);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelRpc.java b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelRpc.java
deleted file mode 100644
index cc043838ff..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelRpc.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.splitpanel;
-
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-
-public interface AbstractSplitPanelRpc extends ServerRpc {
-
- /**
- * Called when the position has been updated by the user.
- *
- * @param position
- * The new position in % if the current unit is %, in px
- * otherwise
- */
- public void setSplitterPosition(float position);
-
- /**
- * Called when a click event has occurred on the splitter.
- *
- * @param mouseDetails
- * Details about the mouse when the event took place
- */
- public void splitterClick(MouseEventDetails mouseDetails);
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelState.java b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelState.java
deleted file mode 100644
index db3a39d3a5..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/AbstractSplitPanelState.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.splitpanel;
-
-import java.io.Serializable;
-
-import com.vaadin.terminal.gwt.client.ComponentState;
-import com.vaadin.terminal.gwt.client.Connector;
-
-public class AbstractSplitPanelState extends ComponentState {
-
- private Connector firstChild = null;
- private Connector secondChild = null;
- private SplitterState splitterState = new SplitterState();
-
- public boolean hasFirstChild() {
- return firstChild != null;
- }
-
- public boolean hasSecondChild() {
- return secondChild != null;
- }
-
- public Connector getFirstChild() {
- return firstChild;
- }
-
- public void setFirstChild(Connector firstChild) {
- this.firstChild = firstChild;
- }
-
- public Connector getSecondChild() {
- return secondChild;
- }
-
- public void setSecondChild(Connector secondChild) {
- this.secondChild = secondChild;
- }
-
- public SplitterState getSplitterState() {
- return splitterState;
- }
-
- public void setSplitterState(SplitterState splitterState) {
- this.splitterState = splitterState;
- }
-
- public static class SplitterState implements Serializable {
- private float position;
- private String positionUnit;
- private float minPosition;
- private String minPositionUnit;
- private float maxPosition;
- private String maxPositionUnit;
- private boolean positionReversed = false;
- private boolean locked = false;
-
- public float getPosition() {
- return position;
- }
-
- public void setPosition(float position) {
- this.position = position;
- }
-
- public String getPositionUnit() {
- return positionUnit;
- }
-
- public void setPositionUnit(String positionUnit) {
- this.positionUnit = positionUnit;
- }
-
- public float getMinPosition() {
- return minPosition;
- }
-
- public void setMinPosition(float minPosition) {
- this.minPosition = minPosition;
- }
-
- public String getMinPositionUnit() {
- return minPositionUnit;
- }
-
- public void setMinPositionUnit(String minPositionUnit) {
- this.minPositionUnit = minPositionUnit;
- }
-
- public float getMaxPosition() {
- return maxPosition;
- }
-
- public void setMaxPosition(float maxPosition) {
- this.maxPosition = maxPosition;
- }
-
- public String getMaxPositionUnit() {
- return maxPositionUnit;
- }
-
- public void setMaxPositionUnit(String maxPositionUnit) {
- this.maxPositionUnit = maxPositionUnit;
- }
-
- public boolean isPositionReversed() {
- return positionReversed;
- }
-
- public void setPositionReversed(boolean positionReversed) {
- this.positionReversed = positionReversed;
- }
-
- public boolean isLocked() {
- return locked;
- }
-
- public void setLocked(boolean locked) {
- this.locked = locked;
- }
-
- }
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/HorizontalSplitPanelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/HorizontalSplitPanelConnector.java
index 92c942e04b..8c2c4d24cd 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/HorizontalSplitPanelConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/HorizontalSplitPanelConnector.java
@@ -3,8 +3,8 @@
*/
package com.vaadin.terminal.gwt.client.ui.splitpanel;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
import com.vaadin.ui.HorizontalSplitPanel;
@Connect(value = HorizontalSplitPanel.class, loadStyle = LoadStyle.EAGER)
diff --git a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VAbstractSplitPanel.java b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VAbstractSplitPanel.java
index e2f30c6676..a20c0476a5 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VAbstractSplitPanel.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VAbstractSplitPanel.java
@@ -125,12 +125,14 @@ public class VAbstractSplitPanel extends ComplexPanel {
makeScrollable();
addDomHandler(new TouchCancelHandler() {
+ @Override
public void onTouchCancel(TouchCancelEvent event) {
// TODO When does this actually happen??
VConsole.log("TOUCH CANCEL");
}
}, TouchCancelEvent.getType());
addDomHandler(new TouchStartHandler() {
+ @Override
public void onTouchStart(TouchStartEvent event) {
Node target = event.getTouches().get(0).getTarget().cast();
if (splitter.isOrHasChild(target)) {
@@ -139,6 +141,7 @@ public class VAbstractSplitPanel extends ComplexPanel {
}
}, TouchStartEvent.getType());
addDomHandler(new TouchMoveHandler() {
+ @Override
public void onTouchMove(TouchMoveEvent event) {
if (resizing) {
onMouseMove(Event.as(event.getNativeEvent()));
@@ -146,6 +149,7 @@ public class VAbstractSplitPanel extends ComplexPanel {
}
}, TouchMoveEvent.getType());
addDomHandler(new TouchEndHandler() {
+ @Override
public void onTouchEnd(TouchEndEvent event) {
if (resizing) {
onMouseUp(Event.as(event.getNativeEvent()));
@@ -251,23 +255,22 @@ public class VAbstractSplitPanel extends ComplexPanel {
* @return
*/
private float convertToPercentage(String pos) {
- float posAsFloat = 0;
-
- if (pos.indexOf("px") > 0) {
- int posAsInt = Integer.parseInt(pos.substring(0, pos.length() - 2));
+ if (pos.endsWith("px")) {
+ float pixelPosition = Float.parseFloat(pos.substring(0,
+ pos.length() - 2));
int offsetLength = orientation == ORIENTATION_HORIZONTAL ? getOffsetWidth()
: getOffsetHeight();
- // 100% needs special handling
- if (posAsInt + getSplitterSize() >= offsetLength) {
- posAsInt = offsetLength;
+ // Take splitter size into account at the edge
+ if (pixelPosition + getSplitterSize() >= offsetLength) {
+ return 100;
}
- posAsFloat = ((float) posAsInt / (float) offsetLength * 100);
+ return pixelPosition / offsetLength * 100;
} else {
- posAsFloat = Float.parseFloat(pos.substring(0, pos.length() - 1));
+ assert pos.endsWith("%");
+ return Float.parseFloat(pos.substring(0, pos.length() - 1));
}
- return posAsFloat;
}
/**
diff --git a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VerticalSplitPanelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VerticalSplitPanelConnector.java
index 5015fcc60c..048136c1c9 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VerticalSplitPanelConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VerticalSplitPanelConnector.java
@@ -4,8 +4,8 @@
package com.vaadin.terminal.gwt.client.ui.splitpanel;
import com.google.gwt.core.client.GWT;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
import com.vaadin.ui.VerticalSplitPanel;
@Connect(value = VerticalSplitPanel.class, loadStyle = LoadStyle.EAGER)
diff --git a/src/com/vaadin/terminal/gwt/client/ui/table/TableConnector.java b/src/com/vaadin/terminal/gwt/client/ui/table/TableConnector.java
index ada0f2424f..7721a3d763 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/table/TableConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/table/TableConnector.java
@@ -7,20 +7,22 @@ import java.util.Iterator;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
+import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.AbstractFieldState;
+import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.DirectionalManagedLayout;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.ServerConnector;
+import com.vaadin.terminal.gwt.client.TooltipInfo;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.PostLayoutListener;
import com.vaadin.terminal.gwt.client.ui.table.VScrollTable.ContextMenuDetails;
import com.vaadin.terminal.gwt.client.ui.table.VScrollTable.VScrollTableBody.VScrollTableRow;
@@ -42,6 +44,7 @@ public class TableConnector extends AbstractComponentContainerConnector
* com.vaadin.terminal.gwt.client.Paintable#updateFromUIDL(com.vaadin.terminal
* .gwt.client.UIDL, com.vaadin.terminal.gwt.client.ApplicationConnection)
*/
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
getWidget().rendering = true;
@@ -178,6 +181,7 @@ public class TableConnector extends AbstractComponentContainerConnector
// *shouldn't* have changed (unless the number of rows
// or the height of the widget has also changed)
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
Util.runWebkitOverflowAutoFix(getWidget().scrollBodyPanel
.getElement());
@@ -244,6 +248,20 @@ public class TableConnector extends AbstractComponentContainerConnector
}
}
+ /*
+ * If the server has (re)initialized the rows, our selectionRangeStart
+ * row will point to an index that the server knows nothing about,
+ * causing problems if doing multi selection with shift. The field will
+ * be cleared a little later when the row focus has been restored.
+ * (#8584)
+ */
+ if (uidl.hasAttribute(VScrollTable.ATTRIBUTE_KEY_MAPPER_RESET)
+ && uidl.getBooleanAttribute(VScrollTable.ATTRIBUTE_KEY_MAPPER_RESET)
+ && getWidget().selectionRangeStart != null) {
+ assert !getWidget().selectionRangeStart.isAttached();
+ getWidget().selectionRangeStart = getWidget().focusedRow;
+ }
+
getWidget().tabIndex = uidl.hasAttribute("tabindex") ? uidl
.getIntAttribute("tabindex") : 0;
getWidget().setProperTabIndex();
@@ -265,23 +283,28 @@ public class TableConnector extends AbstractComponentContainerConnector
return (VScrollTable) super.getWidget();
}
+ @Override
public void updateCaption(ComponentConnector component) {
// NOP, not rendered
}
+ @Override
public void layoutVertically() {
getWidget().updateHeight();
}
+ @Override
public void layoutHorizontally() {
getWidget().updateWidth();
}
+ @Override
public void postLayout() {
VScrollTable table = getWidget();
if (table.sizeNeedsInit) {
table.sizeInit();
Scheduler.get().scheduleFinally(new ScheduledCommand() {
+ @Override
public void execute() {
getLayoutManager().setNeedsMeasure(TableConnector.this);
ServerConnector parent = getParent();
@@ -328,4 +351,27 @@ public class TableConnector extends AbstractComponentContainerConnector
}
}
+ @Override
+ public TooltipInfo getTooltipInfo(Element element) {
+
+ TooltipInfo info = null;
+
+ if (element != getWidget().getElement()) {
+ Object node = Util.findWidget(
+ (com.google.gwt.user.client.Element) element,
+ VScrollTableRow.class);
+
+ if (node != null) {
+ VScrollTableRow row = (VScrollTableRow) node;
+ info = row.getTooltip(element);
+ }
+ }
+
+ if (info == null) {
+ info = super.getTooltipInfo(element);
+ }
+
+ return info;
+ }
+
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java
index c4a57f5c8b..8a58c28c5b 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java
@@ -11,6 +11,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import com.google.gwt.core.client.JavaScriptObject;
@@ -59,13 +60,14 @@ import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.UIObject;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.dd.VerticalDropLocation;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.ComponentState;
import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.Focusable;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.MouseEventDetailsBuilder;
import com.vaadin.terminal.gwt.client.TooltipInfo;
import com.vaadin.terminal.gwt.client.UIDL;
@@ -84,7 +86,6 @@ import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager;
import com.vaadin.terminal.gwt.client.ui.dd.VDragEvent;
import com.vaadin.terminal.gwt.client.ui.dd.VHasDropHandler;
import com.vaadin.terminal.gwt.client.ui.dd.VTransferable;
-import com.vaadin.terminal.gwt.client.ui.dd.VerticalDropLocation;
import com.vaadin.terminal.gwt.client.ui.embedded.VEmbedded;
import com.vaadin.terminal.gwt.client.ui.label.VLabel;
import com.vaadin.terminal.gwt.client.ui.table.VScrollTable.VScrollTableBody.VScrollTableRow;
@@ -130,6 +131,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
}
}
+ /**
+ * Tell the client that old keys are no longer valid because the server has
+ * cleared its key map.
+ */
+ public static final String ATTRIBUTE_KEY_MAPPER_RESET = "clearKeyMap";
+
private static final String ROW_HEADER_COLUMN_KEY = "0";
public static final String CLASSNAME = "v-table";
@@ -215,7 +222,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
/*
* Helper to store selection range start in when using the keyboard
*/
- private VScrollTableRow selectionRangeStart;
+ VScrollTableRow selectionRangeStart;
/*
* Flag for notifying when the selection has changed and should be sent to
@@ -241,6 +248,19 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
private Set<String> noncollapsibleColumns;
/**
+ * The last known row height used to preserve the height of a table with
+ * custom row heights and a fixed page length after removing the last row
+ * from the table.
+ *
+ * A new VScrollTableBody instance is created every time the number of rows
+ * changes causing {@link VScrollTableBody#rowHeight} to be discarded and
+ * the height recalculated by {@link VScrollTableBody#getRowHeight(boolean)}
+ * to avoid some rounding problems, e.g. round(2 * 19.8) / 2 = 20 but
+ * round(3 * 19.8) / 3 = 19.66.
+ */
+ private double lastKnownRowHeight = Double.NaN;
+
+ /**
* Represents a select range of rows
*/
private class SelectionRange {
@@ -327,6 +347,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
private KeyPressHandler navKeyPressHandler = new KeyPressHandler() {
+ @Override
public void onKeyPress(KeyPressEvent keyPressEvent) {
// This is used for Firefox only, since Firefox auto-repeat
// works correctly only if we use a key press handler, other
@@ -364,6 +385,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
private KeyUpHandler navKeyUpHandler = new KeyUpHandler() {
+ @Override
public void onKeyUp(KeyUpEvent keyUpEvent) {
NativeEvent event = keyUpEvent.getNativeEvent();
int keyCode = event.getKeyCode();
@@ -391,6 +413,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
private KeyDownHandler navKeyDownHandler = new KeyDownHandler() {
+ @Override
public void onKeyDown(KeyDownEvent keyDownEvent) {
NativeEvent event = keyDownEvent.getNativeEvent();
// This is not used for Firefox
@@ -519,6 +542,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
scrollBodyPanel.sinkEvents(Event.ONCONTEXTMENU);
scrollBodyPanel.addDomHandler(new ContextMenuHandler() {
+ @Override
public void onContextMenu(ContextMenuEvent event) {
handleBodyContextMenu(event);
}
@@ -539,6 +563,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
// closes. See #8526.
client.getContextMenu().addCloseHandler(new CloseHandler<PopupPanel>() {
+ @Override
public void onClose(CloseEvent<PopupPanel> event) {
contextMenu = null;
}
@@ -1848,6 +1873,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
// Deferred due to some Firefox oddities
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
scrollBodyPanel
.setScrollPosition(measureRowHeightOffset(firstvisible));
@@ -1883,6 +1909,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
scrollBody.reLayoutComponents();
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
Util.runWebkitOverflowAutoFix(scrollBodyPanel.getElement());
}
@@ -2214,6 +2241,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
} else {
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
int tdWidth = width
+ scrollBody.getCellExtraWidth();
@@ -2812,6 +2840,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
Scheduler.get().scheduleDeferred(
new ScheduledCommand() {
+ @Override
public void execute() {
setColWidth(colIx, newWidth, true);
}
@@ -2840,6 +2869,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
// Recalculate the column sizings if any column has changed
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ @Override
public void execute() {
triggerLazyColumnAdjustment(true);
}
@@ -2951,6 +2981,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
visibleCells.add(newIndex, hCell);
}
+ @Override
public Iterator<Widget> iterator() {
return visibleCells.iterator();
}
@@ -3100,6 +3131,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
* Returns columns as Action array for column select popup
*/
+ @Override
public Action[] getActions() {
Object[] cols;
if (columnReordering && columnOrder != null) {
@@ -3138,10 +3170,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
return actions;
}
+ @Override
public ApplicationConnection getClient() {
return client;
}
+ @Override
public String getPaintableId() {
return paintableId;
}
@@ -3287,20 +3321,15 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
DOM.setStyleAttribute(captionContainer, "width", "");
setWidth("");
} else {
-
/*
* Reduce width with one pixel for the right border since the
* footers does not have any spacers between them.
*/
- int borderWidths = 1;
+ final int borderWidths = 1;
// Set the container width (check for negative value)
- if (w - borderWidths >= 0) {
- captionContainer.getStyle().setPropertyPx("width",
- w - borderWidths);
- } else {
- captionContainer.getStyle().setPropertyPx("width", 0);
- }
+ captionContainer.getStyle().setPropertyPx("width",
+ Math.max(w - borderWidths, 0));
/*
* if we already have tBody, set the header width properly, if
@@ -3308,22 +3337,18 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
* unless TD width is not explicitly set.
*/
if (scrollBody != null) {
- /*
- * Reduce with one since footer does not have any spacers,
- * instead a 1 pixel border.
- */
int tdWidth = width + scrollBody.getCellExtraWidth()
- borderWidths;
- setWidth(tdWidth + "px");
+ setWidth(Math.max(tdWidth, 0) + "px");
} else {
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
- int borderWidths = 1;
int tdWidth = width
+ scrollBody.getCellExtraWidth()
- borderWidths;
- setWidth(tdWidth + "px");
+ setWidth(Math.max(tdWidth, 0) + "px");
}
});
}
@@ -3582,6 +3607,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
* @see com.google.gwt.user.client.ui.HasWidgets#iterator()
*/
+ @Override
public Iterator<Widget> iterator() {
return visibleCells.iterator();
}
@@ -4120,6 +4146,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
renderedRows.add(actualIx, row);
}
+ @Override
public Iterator<Widget> iterator() {
return renderedRows.iterator();
}
@@ -4194,14 +4221,6 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
private void unlinkRowAtActualIndex(int index) {
final VScrollTableRow toBeRemoved = (VScrollTableRow) renderedRows
.get(index);
- // Unregister row tooltip
- client.registerTooltip(VScrollTable.this, toBeRemoved.getElement(),
- null);
- for (int i = 0; i < toBeRemoved.getElement().getChildCount(); i++) {
- // Unregister cell tooltips
- Element td = toBeRemoved.getElement().getChild(i).cast();
- client.registerTooltip(VScrollTable.this, td, null);
- }
tBodyElement.removeChild(toBeRemoved.getElement());
orphan(toBeRemoved);
renderedRows.remove(index);
@@ -4244,13 +4263,27 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
if (tBodyMeasurementsDone && !forceUpdate) {
return rowHeight;
} else {
-
if (tBodyElement.getRows().getLength() > 0) {
int tableHeight = getTableHeight();
int rowCount = tBodyElement.getRows().getLength();
rowHeight = tableHeight / (double) rowCount;
} else {
- if (isAttached()) {
+ // Special cases if we can't just measure the current rows
+ if (!Double.isNaN(lastKnownRowHeight)) {
+ // Use previous value if available
+ if (BrowserInfo.get().isIE()) {
+ /*
+ * IE needs to reflow the table element at this
+ * point to work correctly (e.g.
+ * com.vaadin.tests.components.table.
+ * ContainerSizeChange) - the other code paths
+ * already trigger reflows, but here it must be done
+ * explicitly.
+ */
+ getTableHeight();
+ }
+ rowHeight = lastKnownRowHeight;
+ } else if (isAttached()) {
// measure row height by adding a dummy row
VScrollTableRow scrollTableRow = new VScrollTableRow();
tBodyElement.appendChild(scrollTableRow.getElement());
@@ -4261,6 +4294,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
return DEFAULT_ROW_HEIGHT;
}
}
+ lastKnownRowHeight = rowHeight;
tBodyMeasurementsDone = true;
return rowHeight;
}
@@ -4423,6 +4457,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
private Timer dragTouchTimeout;
private int touchStartY;
private int touchStartX;
+ private TooltipInfo tooltipInfo = null;
+ private Map<TableCellElement, TooltipInfo> cellToolTips = new HashMap<TableCellElement, TooltipInfo>();
private boolean isDragging = false;
private VScrollTableRow(int rowKey) {
@@ -4450,11 +4486,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
String rowDescription = uidl.getStringAttribute("rowdescr");
if (rowDescription != null && !rowDescription.equals("")) {
- TooltipInfo info = new TooltipInfo(rowDescription);
- client.registerTooltip(VScrollTable.this, rowElement, info);
+ tooltipInfo = new TooltipInfo(rowDescription);
} else {
- // Remove possibly previously set tooltip
- client.registerTooltip(VScrollTable.this, rowElement, null);
+ tooltipInfo = null;
}
tHead.getColumnAlignments();
@@ -4480,6 +4514,10 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
}
}
+ public TooltipInfo getTooltipInfo() {
+ return tooltipInfo;
+ }
+
/**
* Add a dummy row, used for measurements if Table is empty.
*/
@@ -4665,10 +4703,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
if (description != null && !description.equals("")) {
TooltipInfo info = new TooltipInfo(description);
- client.registerTooltip(VScrollTable.this, td, info);
+ cellToolTips.put(td, info);
} else {
- // Remove possibly previously set tooltip
- client.registerTooltip(VScrollTable.this, td, null);
+ cellToolTips.remove(td);
}
td.appendChild(container);
@@ -4718,6 +4755,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
childWidgets.add(w);
}
+ @Override
public Iterator<Widget> iterator() {
return childWidgets.iterator();
}
@@ -4776,39 +4814,22 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
return true;
}
- private void handleTooltips(final Event event, Element target) {
+ public TooltipInfo getTooltip(
+ com.google.gwt.dom.client.Element target) {
+
+ TooltipInfo info = null;
+
if (target.hasTagName("TD")) {
- // Table cell (td)
- Element container = target.getFirstChildElement().cast();
- Element widget = container.getFirstChildElement().cast();
-
- boolean containsWidget = false;
- for (Widget w : childWidgets) {
- if (widget == w.getElement()) {
- containsWidget = true;
- break;
- }
- }
- if (!containsWidget) {
- // Only text nodes has tooltips
- if (ConnectorMap.get(client).getWidgetTooltipInfo(
- VScrollTable.this, target) != null) {
- // Cell has description, use it
- client.handleTooltipEvent(event, VScrollTable.this,
- target);
- } else {
- // Cell might have row description, use row
- // description
- client.handleTooltipEvent(event, VScrollTable.this,
- target.getParentElement());
- }
- }
+ TableCellElement td = (TableCellElement) target.cast();
+ info = cellToolTips.get(td);
+ }
- } else {
- // Table row (tr)
- client.handleTooltipEvent(event, VScrollTable.this, target);
+ if (info == null) {
+ info = tooltipInfo;
}
+
+ return info;
}
/**
@@ -4953,9 +4974,6 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
}
boolean targetCellOrRowFound = targetTdOrTr != null;
- if (targetCellOrRowFound) {
- handleTooltips(event, targetTdOrTr);
- }
switch (type) {
case Event.ONDBLCLICK:
@@ -5430,6 +5448,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
* @see com.vaadin.terminal.gwt.client.ui.IActionOwner#getActions ()
*/
+ @Override
public Action[] getActions() {
if (actionKeys == null) {
return new Action[] {};
@@ -5453,10 +5472,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
return actions;
}
+ @Override
public ApplicationConnection getClient() {
return client;
}
+ @Override
public String getPaintableId() {
return paintableId;
}
@@ -5507,6 +5528,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
// widths.
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ @Override
public void execute() {
if (showRowHeaders) {
setCellWidth(0, tHead.getHeaderCell(0).getWidth());
@@ -5824,7 +5846,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
if (isDynamicHeight() && totalRows == pageLength) {
// fix body height (may vary if lazy loading is offhorizontal
// scrollbar appears/disappears)
- int bodyHeight = Util.getRequiredHeight(scrollBody);
+ int bodyHeight = scrollBody.getRequiredHeight();
boolean needsSpaceForHorizontalScrollbar = (availW < usedMinimumWidth);
if (needsSpaceForHorizontalScrollbar) {
bodyHeight += Util.getNativeScrollbarSize();
@@ -5838,6 +5860,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
scrollBody.reLayoutComponents();
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
Util.runWebkitOverflowAutoFix(scrollBodyPanel.getElement());
}
@@ -5959,6 +5982,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
// #7607.
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
Util.runWebkitOverflowAutoFix(scrollBodyPanel.getElement());
}
@@ -5989,6 +6013,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
if (visible) {
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
scrollBodyPanel
.setScrollPosition(measureRowHeightOffset(firstRowInViewPort));
@@ -6023,6 +6048,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
* user scrolls
*/
+ @Override
public void onScroll(ScrollEvent event) {
scrollLeft = scrollBodyPanel.getElement().getScrollLeft();
scrollTop = scrollBodyPanel.getScrollPosition();
@@ -6052,6 +6078,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
// value available soon.
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
onScroll(null);
}
@@ -6132,6 +6159,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
return (int) Math.ceil(scrollTop / scrollBody.getRowHeight());
}
+ @Override
public VScrollTableDropHandler getDropHandler() {
return dropHandler;
}
@@ -6212,6 +6240,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
final TableDDDetails newDetails = dropDetails;
VAcceptCallback cb = new VAcceptCallback() {
+ @Override
public void accepted(VDragEvent event) {
if (newDetails.equals(dropDetails)) {
dragAccepted(event);
@@ -6288,6 +6317,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
return ConnectorMap.get(client).getConnector(VScrollTable.this);
}
+ @Override
public ApplicationConnection getApplicationConnection() {
return client;
}
@@ -6619,6 +6649,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
* .dom.client.FocusEvent)
*/
+ @Override
public void onFocus(FocusEvent event) {
if (isFocusable()) {
hasFocus = true;
@@ -6640,6 +6671,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
* .dom.client.BlurEvent)
*/
+ @Override
public void onBlur(BlurEvent event) {
hasFocus = false;
navKeyDown = false;
@@ -6713,6 +6745,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
* @see com.vaadin.terminal.gwt.client.Focusable#focus()
*/
+ @Override
public void focus() {
if (isFocusable()) {
scrollBodyPanel.focus();
@@ -6794,6 +6827,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
public void lazyRevertFocusToRow(final VScrollTableRow currentlyFocusedRow) {
Scheduler.get().scheduleFinally(new ScheduledCommand() {
+ @Override
public void execute() {
if (currentlyFocusedRow != null) {
setRowFocus(currentlyFocusedRow);
@@ -6806,6 +6840,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
});
}
+ @Override
public Action[] getActions() {
if (bodyActionKeys == null) {
return new Action[] {};
@@ -6821,10 +6856,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
return actions;
}
+ @Override
public ApplicationConnection getClient() {
return client;
}
+ @Override
public String getPaintableId() {
return paintableId;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetBaseConnector.java b/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetBaseConnector.java
index e16e84d112..ea0bea6b04 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetBaseConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetBaseConnector.java
@@ -22,6 +22,7 @@ public abstract class TabsheetBaseConnector extends
public static final String ATTRIBUTE_TAB_CAPTION = "caption";
public static final String ATTRIBUTE_TAB_ICON = "icon";
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
getWidget().client = client;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetConnector.java b/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetConnector.java
index 08d4679dc5..ce19f1e02a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/tabsheet/TabsheetConnector.java
@@ -3,13 +3,14 @@
*/
package com.vaadin.terminal.gwt.client.ui.tabsheet;
-import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ComponentConnector;
+import com.vaadin.terminal.gwt.client.TooltipInfo;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.ui.Connect;
+import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.ui.SimpleManagedLayout;
import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren;
import com.vaadin.ui.TabSheet;
@@ -67,10 +68,12 @@ public class TabsheetConnector extends TabsheetBaseConnector implements
return (VTabsheet) super.getWidget();
}
+ @Override
public void updateCaption(ComponentConnector component) {
/* Tabsheet does not render its children's captions */
}
+ @Override
public void layout() {
VTabsheet tabsheet = getWidget();
@@ -97,4 +100,29 @@ public class TabsheetConnector extends TabsheetBaseConnector implements
}
+ @Override
+ public TooltipInfo getTooltipInfo(Element element) {
+
+ TooltipInfo info = null;
+
+ // Find a tooltip for the tab, if the element is a tab
+ if (element != getWidget().getElement()) {
+ Object node = Util.findWidget(
+ (com.google.gwt.user.client.Element) element,
+ VTabsheet.TabCaption.class);
+
+ if (node != null) {
+ VTabsheet.TabCaption caption = (VTabsheet.TabCaption) node;
+ info = caption.getTooltipInfo();
+ }
+ }
+
+ // If not tab tooltip was found, use the default
+ if (info == null) {
+ info = super.getTooltipInfo(element);
+ }
+
+ return info;
+ }
+
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/tabsheet/VTabsheet.java b/src/com/vaadin/terminal/gwt/client/ui/tabsheet/VTabsheet.java
index aba5a41f9a..1f6314050e 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/tabsheet/VTabsheet.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/tabsheet/VTabsheet.java
@@ -34,12 +34,12 @@ import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.impl.FocusImpl;
+import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.EventId;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.ComponentConnector;
-import com.vaadin.terminal.gwt.client.ComponentState;
import com.vaadin.terminal.gwt.client.ConnectorMap;
-import com.vaadin.terminal.gwt.client.EventId;
import com.vaadin.terminal.gwt.client.Focusable;
import com.vaadin.terminal.gwt.client.TooltipInfo;
import com.vaadin.terminal.gwt.client.UIDL;
@@ -212,14 +212,17 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
tabCaption.setWidth(tabCaption.getRequiredWidth() + "px");
}
+ @Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
return addDomHandler(handler, FocusEvent.getType());
}
+ @Override
public HandlerRegistration addBlurHandler(BlurHandler handler) {
return addDomHandler(handler, BlurEvent.getType());
}
+ @Override
public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
return addDomHandler(handler, KeyDownEvent.getType());
}
@@ -233,7 +236,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
}
}
- private static class TabCaption extends VCaption {
+ public static class TabCaption extends VCaption {
private boolean closable = false;
private Element closeButton;
@@ -248,16 +251,11 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
public boolean updateCaption(UIDL uidl) {
if (uidl.hasAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DESCRIPTION)) {
- TooltipInfo tooltipInfo = new TooltipInfo();
- tooltipInfo
- .setTitle(uidl
- .getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DESCRIPTION));
- tooltipInfo
- .setErrorMessage(uidl
- .getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_ERROR_MESSAGE));
- client.registerTooltip(getTabsheet(), getElement(), tooltipInfo);
+ setTooltipInfo(new TooltipInfo(
+ uidl.getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DESCRIPTION),
+ uidl.getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_ERROR_MESSAGE)));
} else {
- client.registerTooltip(getTabsheet(), getElement(), null);
+ setTooltipInfo(null);
}
// TODO need to call this instead of super because the caption does
@@ -292,7 +290,6 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
if (event.getTypeInt() == Event.ONLOAD) {
getTabsheet().tabSizeMightHaveChanged(getTab());
}
- client.handleTooltipEvent(event, getTabsheet(), getElement());
}
public Tab getTab() {
@@ -362,6 +359,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
setElement(el);
}
+ @Override
public void onClose(VCloseEvent event) {
Tab tab = event.getTab();
if (!tab.isEnabledOnServer()) {
@@ -397,6 +395,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
return t;
}
+ @Override
public void onClick(ClickEvent event) {
TabCaption caption = (TabCaption) event.getSource();
Element targetElement = event.getNativeEvent().getEventTarget()
@@ -691,24 +690,27 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
@Override
public void onBrowserEvent(Event event) {
+ if (event.getTypeInt() == Event.ONCLICK) {
+ // Tab scrolling
+ if (isScrolledTabs() && DOM.eventGetTarget(event) == scrollerPrev) {
+ int newFirstIndex = tb.scrollLeft(scrollerIndex);
+ if (newFirstIndex != -1) {
+ scrollerIndex = newFirstIndex;
+ updateTabScroller();
+ }
+ return;
+ } else if (isClippedTabs()
+ && DOM.eventGetTarget(event) == scrollerNext) {
+ int newFirstIndex = tb.scrollRight(scrollerIndex);
- // Tab scrolling
- if (isScrolledTabs() && DOM.eventGetTarget(event) == scrollerPrev) {
- int newFirstIndex = tb.scrollLeft(scrollerIndex);
- if (newFirstIndex != -1) {
- scrollerIndex = newFirstIndex;
- updateTabScroller();
- }
- } else if (isClippedTabs() && DOM.eventGetTarget(event) == scrollerNext) {
- int newFirstIndex = tb.scrollRight(scrollerIndex);
-
- if (newFirstIndex != -1) {
- scrollerIndex = newFirstIndex;
- updateTabScroller();
+ if (newFirstIndex != -1) {
+ scrollerIndex = newFirstIndex;
+ updateTabScroller();
+ }
+ return;
}
- } else {
- super.onBrowserEvent(event);
}
+ super.onBrowserEvent(event);
}
/**
@@ -1034,6 +1036,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
style.setProperty("whiteSpace", "normal");
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
style.setProperty("whiteSpace", "");
}
@@ -1118,6 +1121,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
}
}
+ @Override
public void onBlur(BlurEvent event) {
if (focusedTab != null && event.getSource() instanceof Tab) {
focusedTab = null;
@@ -1127,6 +1131,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
}
}
+ @Override
public void onFocus(FocusEvent event) {
if (focusedTab == null && event.getSource() instanceof Tab) {
focusedTab = (Tab) event.getSource();
@@ -1136,6 +1141,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
}
}
+ @Override
public void focus() {
tb.getTab(activeTabIndex).focus();
}
@@ -1144,6 +1150,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
tb.getTab(activeTabIndex).blur();
}
+ @Override
public void onKeyDown(KeyDownEvent event) {
if (event.getSource() instanceof Tab) {
int keycode = event.getNativeEvent().getKeyCode();
diff --git a/src/com/vaadin/terminal/gwt/client/ui/textarea/TextAreaConnector.java b/src/com/vaadin/terminal/gwt/client/ui/textarea/TextAreaConnector.java
index a235ca5389..cdf648d3ec 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/textarea/TextAreaConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/textarea/TextAreaConnector.java
@@ -4,8 +4,9 @@
package com.vaadin.terminal.gwt.client.ui.textarea;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.textarea.TextAreaState;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.textfield.TextFieldConnector;
import com.vaadin.ui.TextArea;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/textarea/TextAreaState.java b/src/com/vaadin/terminal/gwt/client/ui/textarea/TextAreaState.java
deleted file mode 100644
index 71bdd230b7..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/textarea/TextAreaState.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.textarea;
-
-import com.vaadin.terminal.gwt.client.ui.textfield.AbstractTextFieldState;
-
-public class TextAreaState extends AbstractTextFieldState {
-
- /**
- * Number of visible rows in the text area. The default is 5.
- */
- private int rows = 5;
-
- /**
- * Tells if word-wrapping should be used in the text area.
- */
- private boolean wordwrap = true;
-
- public int getRows() {
- return rows;
- }
-
- public void setRows(int rows) {
- this.rows = rows;
- }
-
- public boolean isWordwrap() {
- return wordwrap;
- }
-
- public void setWordwrap(boolean wordwrap) {
- this.wordwrap = wordwrap;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/textarea/VTextArea.java b/src/com/vaadin/terminal/gwt/client/ui/textarea/VTextArea.java
index aede1ef002..c0f6deab53 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/textarea/VTextArea.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/textarea/VTextArea.java
@@ -57,6 +57,7 @@ public class VTextArea extends VTextField {
public void onBrowserEvent(Event event) {
if (getMaxLength() >= 0 && event.getTypeInt() == Event.ONKEYUP) {
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
if (getText().length() > getMaxLength()) {
setText(getText().substring(0, getMaxLength()));
diff --git a/src/com/vaadin/terminal/gwt/client/ui/textfield/AbstractTextFieldState.java b/src/com/vaadin/terminal/gwt/client/ui/textfield/AbstractTextFieldState.java
deleted file mode 100644
index d11b049f56..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/textfield/AbstractTextFieldState.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.textfield;
-
-import com.vaadin.terminal.gwt.client.AbstractFieldState;
-
-public class AbstractTextFieldState extends AbstractFieldState {
- /**
- * Maximum character count in text field.
- */
- private int maxLength = -1;
-
- /**
- * Number of visible columns in the TextField.
- */
- private int columns = 0;
-
- /**
- * The prompt to display in an empty field. Null when disabled.
- */
- private String inputPrompt = null;
-
- /**
- * The text in the field
- */
- private String text = null;
-
- public int getMaxLength() {
- return maxLength;
- }
-
- public void setMaxLength(int maxLength) {
- this.maxLength = maxLength;
- }
-
- public int getColumns() {
- return columns;
- }
-
- public void setColumns(int columns) {
- this.columns = columns;
- }
-
- public String getInputPrompt() {
- return inputPrompt;
- }
-
- public void setInputPrompt(String inputPrompt) {
- this.inputPrompt = inputPrompt;
- }
-
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/textfield/TextFieldConnector.java b/src/com/vaadin/terminal/gwt/client/ui/textfield/TextFieldConnector.java
index 04bf029b05..d98d27942a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/textfield/TextFieldConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/textfield/TextFieldConnector.java
@@ -7,12 +7,13 @@ package com.vaadin.terminal.gwt.client.ui.textfield;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Event;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
+import com.vaadin.shared.ui.textfield.AbstractTextFieldState;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.AbstractFieldConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.BeforeShortcutActionListener;
import com.vaadin.ui.TextField;
@@ -25,6 +26,7 @@ public class TextFieldConnector extends AbstractFieldConnector implements
return (AbstractTextFieldState) super.getState();
}
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
// Save details
getWidget().client = client;
@@ -83,6 +85,7 @@ public class TextFieldConnector extends AbstractFieldConnector implements
* Gecko defers setting the text so we need to defer the selection.
*/
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
getWidget().setSelectionRange(pos, length);
}
@@ -95,6 +98,7 @@ public class TextFieldConnector extends AbstractFieldConnector implements
return (VTextField) super.getWidget();
}
+ @Override
public void onBeforeShortcutAction(Event e) {
getWidget().valueChange(false);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java b/src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java
index aeae165f60..7f8e549550 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java
@@ -18,11 +18,10 @@ import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.TextBoxBase;
+import com.vaadin.shared.EventId;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
-import com.vaadin.terminal.gwt.client.EventId;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ui.Field;
/**
@@ -88,7 +87,6 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler,
}
addFocusHandler(this);
addBlurHandler(this);
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
}
/*
@@ -107,9 +105,6 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler,
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
- if (client != null) {
- client.handleTooltipEvent(event, this);
- }
if (listenTextChangeEvents
&& (event.getTypeInt() & TEXTCHANGE_EVENTS) == event
@@ -279,6 +274,7 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler,
return maxLength;
}
+ @Override
public void onChange(ChangeEvent event) {
valueChange(false);
}
@@ -305,7 +301,7 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler,
if (!prompting && newText != null
&& !newText.equals(valueBeforeEdit)) {
sendValueChange = immediate;
- client.updateVariable(paintableId, "text", getText(), false);
+ client.updateVariable(paintableId, "text", newText, false);
valueBeforeEdit = newText;
valueBeforeEditIsSynced = true;
}
@@ -354,6 +350,7 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler,
}
}
+ @Override
public void onFocus(FocusEvent event) {
addStyleDependentName(CLASSNAME_FOCUS);
if (prompting) {
@@ -367,7 +364,13 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler,
}
}
+ @Override
public void onBlur(BlurEvent event) {
+ // this is called twice on Chrome when e.g. changing tab while prompting
+ // field focused - do not change settings on the second time
+ if (focusedTextField != this) {
+ return;
+ }
removeStyleDependentName(CLASSNAME_FOCUS);
focusedTextField = null;
String text = getText();
@@ -392,6 +395,7 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler,
setWidth(columns + "em");
}
+ @Override
public void onKeyDown(KeyDownEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
valueChange(false);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/tree/TreeConnector.java b/src/com/vaadin/terminal/gwt/client/ui/tree/TreeConnector.java
index e4afa32143..def63edae9 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/tree/TreeConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/tree/TreeConnector.java
@@ -3,16 +3,20 @@
*/
package com.vaadin.terminal.gwt.client.ui.tree;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
-import com.vaadin.terminal.gwt.client.AbstractFieldState;
+import com.google.gwt.dom.client.Element;
+import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.TooltipInfo;
import com.vaadin.terminal.gwt.client.UIDL;
+import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.tree.VTree.TreeNode;
import com.vaadin.ui.Tree;
@@ -27,6 +31,9 @@ public class TreeConnector extends AbstractComponentConnector implements
public static final String ATTRIBUTE_ACTION_CAPTION = "caption";
public static final String ATTRIBUTE_ACTION_ICON = ATTRIBUTE_NODE_ICON;
+ protected final Map<TreeNode, TooltipInfo> tooltipMap = new HashMap<TreeNode, TooltipInfo>();
+
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
if (!isRealUpdate(uidl)) {
return;
@@ -62,6 +69,8 @@ public class TreeConnector extends AbstractComponentConnector implements
getWidget().body.clear();
// clear out any references to nodes that no longer are attached
getWidget().clearNodeToKeyMap();
+ tooltipMap.clear();
+
TreeNode childTree = null;
UIDL childUidl = null;
for (final Iterator<?> i = uidl.getChildIterator(); i.hasNext();) {
@@ -74,6 +83,7 @@ public class TreeConnector extends AbstractComponentConnector implements
continue;
}
childTree = getWidget().new TreeNode();
+ getConnection().getVTooltip().connectHandlersToWidget(childTree);
updateNodeFromUIDL(childTree, childUidl);
getWidget().body.add(childTree);
childTree.addStyleDependentName("root");
@@ -193,13 +203,8 @@ public class TreeConnector extends AbstractComponentConnector implements
}
String description = uidl.getStringAttribute("descr");
- if (description != null && getConnection() != null) {
- // Set tooltip
- TooltipInfo info = new TooltipInfo(description);
- getConnection().registerTooltip(this, nodeKey, info);
- } else {
- // Remove possible previous tooltip
- getConnection().registerTooltip(this, nodeKey, null);
+ if (description != null) {
+ tooltipMap.put(treeNode, new TooltipInfo(description));
}
if (uidl.getBooleanAttribute("expanded") && !treeNode.getState()) {
@@ -228,6 +233,7 @@ public class TreeConnector extends AbstractComponentConnector implements
continue;
}
final TreeNode childTree = getWidget().new TreeNode();
+ getConnection().getVTooltip().connectHandlersToWidget(childTree);
updateNodeFromUIDL(childTree, childUidl);
containerNode.childNodeContainer.add(childTree);
if (!i.hasNext()) {
@@ -250,4 +256,32 @@ public class TreeConnector extends AbstractComponentConnector implements
return (AbstractFieldState) super.getState();
}
+ @Override
+ public TooltipInfo getTooltipInfo(Element element) {
+
+ TooltipInfo info = null;
+
+ // Try to find a tooltip for a node
+ if (element != getWidget().getElement()) {
+ Object node = Util.findWidget(
+ (com.google.gwt.user.client.Element) element,
+ TreeNode.class);
+
+ if (node != null) {
+ TreeNode tnode = (TreeNode) node;
+ if (tnode.isCaptionElement(element)) {
+ info = tooltipMap.get(tnode);
+ }
+ }
+ }
+
+ // If no tooltip found for the node or if the target was not a node, use
+ // the default tooltip
+ if (info == null) {
+ info = super.getTooltipInfo(element);
+ }
+
+ return info;
+ }
+
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/tree/VTree.java b/src/com/vaadin/terminal/gwt/client/ui/tree/VTree.java
index 6f19cba957..f5fe6bce1a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/tree/VTree.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/tree/VTree.java
@@ -37,15 +37,15 @@ import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.UIObject;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.dd.VerticalDropLocation;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorMap;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.MouseEventDetailsBuilder;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ui.Action;
import com.vaadin.terminal.gwt.client.ui.ActionOwner;
import com.vaadin.terminal.gwt.client.ui.FocusElementPanel;
@@ -61,7 +61,6 @@ import com.vaadin.terminal.gwt.client.ui.dd.VDragEvent;
import com.vaadin.terminal.gwt.client.ui.dd.VDropHandler;
import com.vaadin.terminal.gwt.client.ui.dd.VHasDropHandler;
import com.vaadin.terminal.gwt.client.ui.dd.VTransferable;
-import com.vaadin.terminal.gwt.client.ui.dd.VerticalDropLocation;
/**
*
@@ -127,6 +126,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
public VLazyExecutor iconLoaded = new VLazyExecutor(50,
new ScheduledCommand() {
+ @Override
public void execute() {
Util.notifyParentOfSizeChange(VTree.this, true);
}
@@ -146,6 +146,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
*/
sinkEvents(Event.ONCONTEXTMENU);
addDomHandler(new ContextMenuHandler() {
+ @Override
public void onContextMenu(ContextMenuEvent event) {
handleBodyContextMenu(event);
}
@@ -334,6 +335,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
}
if (newKey != null) {
validate(new VAcceptCallback() {
+ @Override
public void accepted(VDragEvent event) {
VerticalDropLocation curDetail = (VerticalDropLocation) event
.getDropDetails().get("detail");
@@ -377,6 +379,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
return ConnectorMap.get(client).getConnector(VTree.this);
}
+ @Override
public ApplicationConnection getApplicationConnection() {
return client;
}
@@ -420,6 +423,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
*/
private void sendSelectionToServer() {
Command command = new Command() {
+ @Override
public void execute() {
client.updateVariable(paintableId, "selected",
selectedIds.toArray(new String[selectedIds.size()]),
@@ -587,6 +591,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
}
ScheduledCommand command = new ScheduledCommand() {
+ @Override
public void execute() {
if (multiSelectMode == MULTISELECT_MODE_SIMPLE
@@ -656,12 +661,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
return;
}
- if (target == nodeCaptionSpan) {
- client.handleTooltipEvent(event, VTree.this, key);
- }
-
- final boolean inCaption = target == nodeCaptionSpan
- || (icon != null && target == icon.getElement());
+ final boolean inCaption = isCaptionElement(target);
if (inCaption
&& client
.hasEventListeners(VTree.this, ITEM_CLICK_EVENT_ID)
@@ -751,6 +751,18 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
}
}
+ /**
+ * Checks if the given element is the caption or the icon.
+ *
+ * @param target
+ * The element to check
+ * @return true if the element is the caption or the icon
+ */
+ public boolean isCaptionElement(com.google.gwt.dom.client.Element target) {
+ return (target == nodeCaptionSpan || (icon != null && target == icon
+ .getElement()));
+ }
+
private void fireClick(final Event evt) {
/*
* Ensure we have focus in tree before sending variables. Otherwise
@@ -770,6 +782,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
final MouseEventDetails details = MouseEventDetailsBuilder
.buildMouseEventDetails(evt);
ScheduledCommand command = new ScheduledCommand() {
+ @Override
public void execute() {
// Determine if we should send the event immediately to the
// server. We do not want to send the event if there is a
@@ -825,7 +838,6 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
+ "-caption");
Element wrapper = DOM.createDiv();
nodeCaptionSpan = DOM.createSpan();
- DOM.sinkEvents(nodeCaptionSpan, VTooltip.TOOLTIP_EVENTS);
DOM.appendChild(getElement(), nodeCaptionDiv);
DOM.appendChild(nodeCaptionDiv, wrapper);
DOM.appendChild(wrapper, nodeCaptionSpan);
@@ -914,6 +926,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
return nodes;
}
+ @Override
public Action[] getActions() {
if (actionKeys == null) {
return new Action[] {};
@@ -930,10 +943,12 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
return actions;
}
+ @Override
public ApplicationConnection getClient() {
return client;
}
+ @Override
public String getPaintableId() {
return paintableId;
}
@@ -1071,6 +1086,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
}
+ @Override
public VDropHandler getDropHandler() {
return dropHandler;
}
@@ -1480,6 +1496,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
node.scrollIntoView();
} else {
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
focusedNode.scrollIntoView();
}
@@ -1505,6 +1522,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
* com.google.gwt.event.dom.client.FocusHandler#onFocus(com.google.gwt.event
* .dom.client.FocusEvent)
*/
+ @Override
public void onFocus(FocusEvent event) {
treeHasFocus = true;
// If no node has focus, focus the first item in the tree
@@ -1524,6 +1542,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
* com.google.gwt.event.dom.client.BlurHandler#onBlur(com.google.gwt.event
* .dom.client.BlurEvent)
*/
+ @Override
public void onBlur(BlurEvent event) {
treeHasFocus = false;
if (focusedNode != null) {
@@ -1538,6 +1557,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
* com.google.gwt.event.dom.client.KeyPressHandler#onKeyPress(com.google
* .gwt.event.dom.client.KeyPressEvent)
*/
+ @Override
public void onKeyPress(KeyPressEvent event) {
NativeEvent nativeEvent = event.getNativeEvent();
int keyCode = nativeEvent.getKeyCode();
@@ -1561,6 +1581,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
* com.google.gwt.event.dom.client.KeyDownHandler#onKeyDown(com.google.gwt
* .event.dom.client.KeyDownEvent)
*/
+ @Override
public void onKeyDown(KeyDownEvent event) {
if (handleKeyNavigation(event.getNativeEvent().getKeyCode(),
event.isControlKeyDown() || event.isMetaKeyDown(),
@@ -1941,6 +1962,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
* com.vaadin.terminal.gwt.client.ui.SubPartAware#getSubPartElement(java
* .lang.String)
*/
+ @Override
public Element getSubPartElement(String subPart) {
if ("fe".equals(subPart)) {
if (BrowserInfo.get().isOpera() && focusedNode != null) {
@@ -1994,6 +2016,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
* com.vaadin.terminal.gwt.client.ui.SubPartAware#getSubPartName(com.google
* .gwt.user.client.Element)
*/
+ @Override
public String getSubPartName(Element subElement) {
// Supported identifiers:
//
@@ -2044,6 +2067,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
return locator;
}
+ @Override
public Action[] getActions() {
if (bodyActionKeys == null) {
return new Action[] {};
@@ -2059,10 +2083,12 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
return actions;
}
+ @Override
public ApplicationConnection getClient() {
return client;
}
+ @Override
public String getPaintableId() {
return paintableId;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/treetable/TreeTableConnector.java b/src/com/vaadin/terminal/gwt/client/ui/treetable/TreeTableConnector.java
index 59910c1b3e..06e916fbc9 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/treetable/TreeTableConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/treetable/TreeTableConnector.java
@@ -3,9 +3,9 @@
*/
package com.vaadin.terminal.gwt.client.ui.treetable;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.FocusableScrollPanel;
import com.vaadin.terminal.gwt.client.ui.table.TableConnector;
import com.vaadin.terminal.gwt.client.ui.table.VScrollTable.VScrollTableBody.VScrollTableRow;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/treetable/VTreeTable.java b/src/com/vaadin/terminal/gwt/client/ui/treetable/VTreeTable.java
index 9a8e0e9ce1..c03dff9507 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/treetable/VTreeTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/treetable/VTreeTable.java
@@ -97,7 +97,7 @@ public class VTreeTable extends VScrollTable {
}
class VTreeTableScrollBody extends VScrollTable.VScrollTableBody {
- private int identWidth = -1;
+ private int indentWidth = -1;
VTreeTableScrollBody() {
super();
@@ -165,7 +165,7 @@ public class VTreeTable extends VScrollTable {
container.insertFirst(treeSpacer);
depth = rowUidl.hasAttribute("depth") ? rowUidl
.getIntAttribute("depth") : 0;
- setIdent();
+ setIndent();
isTreeCellAdded = true;
return true;
}
@@ -202,18 +202,19 @@ public class VTreeTable extends VScrollTable {
}
- private void setIdent() {
- if (getIdentWidth() > 0 && depth != 0) {
- treeSpacer.getStyle().setWidth(
- (depth + 1) * getIdentWidth(), Unit.PX);
+ private void setIndent() {
+ if (getIndentWidth() > 0) {
+ treeSpacer.getParentElement().getStyle()
+ .setPaddingLeft(getIndent(), Unit.PX);
+ treeSpacer.getStyle().setWidth(getIndent(), Unit.PX);
}
}
@Override
protected void onAttach() {
super.onAttach();
- if (getIdentWidth() < 0) {
- detectIdent(this);
+ if (getIndentWidth() < 0) {
+ detectIndent(this);
}
}
@@ -227,6 +228,19 @@ public class VTreeTable extends VScrollTable {
return consumedSpace;
}
+ @Override
+ protected void setCellWidth(int cellIx, int width) {
+ if (cellIx == colIndexOfHierarchy + (showRowHeaders ? 1 : 0)) {
+ // take indentation padding into account if this is the
+ // hierarchy column
+ width = Math.max(width - getIndent(), 0);
+ }
+ super.setCellWidth(cellIx, width);
+ }
+
+ private int getIndent() {
+ return (depth + 1) * getIndentWidth();
+ }
}
protected class VTreeTableGeneratedRow extends VTreeTableRow {
@@ -257,6 +271,7 @@ public class VTreeTable extends VScrollTable {
// widths.
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ @Override
public void execute() {
if (showRowHeaders) {
setCellWidth(0, tHead.getHeaderCell(0).getWidth());
@@ -353,20 +368,20 @@ public class VTreeTable extends VScrollTable {
}
}
- private int getIdentWidth() {
- return identWidth;
+ private int getIndentWidth() {
+ return indentWidth;
}
- private void detectIdent(VTreeTableRow vTreeTableRow) {
- identWidth = vTreeTableRow.treeSpacer.getOffsetWidth();
- if (identWidth == 0) {
- identWidth = -1;
+ private void detectIndent(VTreeTableRow vTreeTableRow) {
+ indentWidth = vTreeTableRow.treeSpacer.getOffsetWidth();
+ if (indentWidth == 0) {
+ indentWidth = -1;
return;
}
Iterator<Widget> iterator = iterator();
while (iterator.hasNext()) {
VTreeTableRow next = (VTreeTableRow) iterator.next();
- next.setIdent();
+ next.setIndent();
}
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/twincolselect/TwinColSelectConnector.java b/src/com/vaadin/terminal/gwt/client/ui/twincolselect/TwinColSelectConnector.java
index a77319920c..2ce6bf2129 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/twincolselect/TwinColSelectConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/twincolselect/TwinColSelectConnector.java
@@ -4,10 +4,10 @@
package com.vaadin.terminal.gwt.client.ui.twincolselect;
+import com.vaadin.shared.ui.Connect;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.DirectionalManagedLayout;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.optiongroup.OptionGroupBaseConnector;
import com.vaadin.ui.TwinColSelect;
@@ -29,6 +29,7 @@ public class TwinColSelectConnector extends OptionGroupBaseConnector implements
@Override
protected void init() {
+ super.init();
getLayoutManager().registerDependency(this,
getWidget().captionWrapper.getElement());
}
@@ -44,6 +45,7 @@ public class TwinColSelectConnector extends OptionGroupBaseConnector implements
return (VTwinColSelect) super.getWidget();
}
+ @Override
public void layoutVertically() {
if (isUndefinedHeight()) {
getWidget().clearInternalHeights();
@@ -52,6 +54,7 @@ public class TwinColSelectConnector extends OptionGroupBaseConnector implements
}
}
+ @Override
public void layoutHorizontally() {
if (isUndefinedWidth()) {
getWidget().clearInternalWidths();
diff --git a/src/com/vaadin/terminal/gwt/client/ui/twincolselect/VTwinColSelect.java b/src/com/vaadin/terminal/gwt/client/ui/twincolselect/VTwinColSelect.java
index 8f1ea09b8f..1a2deae3b4 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/twincolselect/VTwinColSelect.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/twincolselect/VTwinColSelect.java
@@ -409,6 +409,7 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler,
remove.setTabIndex(tabIndex);
}
+ @Override
public void focus() {
options.setFocus(true);
}
@@ -430,6 +431,7 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler,
* com.google.gwt.event.dom.client.KeyDownHandler#onKeyDown(com.google.gwt
* .event.dom.client.KeyDownEvent)
*/
+ @Override
public void onKeyDown(KeyDownEvent event) {
int keycode = event.getNativeKeyCode();
@@ -493,6 +495,7 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler,
* com.google.gwt.event.dom.client.MouseDownHandler#onMouseDown(com.google
* .gwt.event.dom.client.MouseDownEvent)
*/
+ @Override
public void onMouseDown(MouseDownEvent event) {
// Ensure that items are deselected when selecting
// from a different source. See #3699 for details.
@@ -515,6 +518,7 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler,
* com.google.gwt.event.dom.client.DoubleClickHandler#onDoubleClick(com.
* google.gwt.event.dom.client.DoubleClickEvent)
*/
+ @Override
public void onDoubleClick(DoubleClickEvent event) {
if (event.getSource() == options) {
addItem();
@@ -539,6 +543,7 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler,
private static final String SUBPART_ADD_BUTTON = "add";
private static final String SUBPART_REMOVE_BUTTON = "remove";
+ @Override
public Element getSubPartElement(String subPart) {
if (SUBPART_OPTION_SELECT.equals(subPart)) {
return options.getElement();
@@ -568,6 +573,7 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler,
return null;
}
+ @Override
public String getSubPartName(Element subElement) {
if (optionsCaption != null
&& optionsCaption.getElement().isOrHasChild(subElement)) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/upload/UploadConnector.java b/src/com/vaadin/terminal/gwt/client/ui/upload/UploadConnector.java
index 153d99229b..af31491060 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/upload/UploadConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/upload/UploadConnector.java
@@ -4,18 +4,19 @@
package com.vaadin.terminal.gwt.client.ui.upload;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
import com.vaadin.ui.Upload;
@Connect(value = Upload.class, loadStyle = LoadStyle.LAZY)
public class UploadConnector extends AbstractComponentConnector implements
Paintable {
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
if (!isRealUpdate(uidl)) {
return;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/upload/VUpload.java b/src/com/vaadin/terminal/gwt/client/ui/upload/VUpload.java
index 4fe53fb89c..5cf2f2fe25 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/upload/VUpload.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/upload/VUpload.java
@@ -24,7 +24,6 @@ import com.google.gwt.user.client.ui.SimplePanel;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.VConsole;
-import com.vaadin.terminal.gwt.client.VTooltip;
import com.vaadin.terminal.gwt.client.ui.button.VButton;
/**
@@ -116,6 +115,7 @@ public class VUpload extends SimplePanel {
panel.add(fu);
submitButton = new VButton();
submitButton.addClickHandler(new ClickHandler() {
+ @Override
public void onClick(ClickEvent event) {
if (immediate) {
// fire click on upload (eg. focused button and hit space)
@@ -128,16 +128,6 @@ public class VUpload extends SimplePanel {
panel.add(submitButton);
setStyleName(CLASSNAME);
-
- sinkEvents(VTooltip.TOOLTIP_EVENTS);
- }
-
- @Override
- public void onBrowserEvent(Event event) {
- if ((event.getTypeInt() & VTooltip.TOOLTIP_EVENTS) > 0) {
- client.handleTooltipEvent(event, this);
- }
- super.onBrowserEvent(event);
}
private static native void setEncoding(Element form, String encoding)
@@ -214,6 +204,7 @@ public class VUpload extends SimplePanel {
private void onSubmitComplete() {
/* Needs to be run dereferred to avoid various browser issues. */
Scheduler.get().scheduleDeferred(new Command() {
+ @Override
public void execute() {
if (submitted) {
if (client != null) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/video/VideoConnector.java b/src/com/vaadin/terminal/gwt/client/ui/video/VideoConnector.java
index ddf8df66ff..d0c126832a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/video/VideoConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/video/VideoConnector.java
@@ -3,9 +3,10 @@
*/
package com.vaadin.terminal.gwt.client.ui.video;
+import com.vaadin.shared.communication.URLReference;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.video.VideoState;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
-import com.vaadin.terminal.gwt.client.communication.URLReference;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.MediaBaseConnector;
import com.vaadin.ui.Video;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/video/VideoState.java b/src/com/vaadin/terminal/gwt/client/ui/video/VideoState.java
deleted file mode 100644
index f59d9ccac1..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/video/VideoState.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.video;
-
-import com.vaadin.terminal.gwt.client.communication.URLReference;
-import com.vaadin.terminal.gwt.client.ui.AbstractMediaState;
-
-public class VideoState extends AbstractMediaState {
- private URLReference poster;
-
- public URLReference getPoster() {
- return poster;
- }
-
- public void setPoster(URLReference poster) {
- this.poster = poster;
- }
-
-}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java b/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java
index 8fd84a9ea6..8ac0d0662b 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java
@@ -26,12 +26,12 @@ import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.EventId;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorMap;
import com.vaadin.terminal.gwt.client.Console;
-import com.vaadin.terminal.gwt.client.EventId;
import com.vaadin.terminal.gwt.client.Focusable;
import com.vaadin.terminal.gwt.client.LayoutManager;
import com.vaadin.terminal.gwt.client.Util;
@@ -146,6 +146,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
private VLazyExecutor delayedContentsSizeUpdater = new VLazyExecutor(200,
new ScheduledCommand() {
+ @Override
public void execute() {
updateContentsSize();
}
@@ -266,6 +267,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
orderingDefered = true;
Scheduler.get().scheduleFinally(new Command() {
+ @Override
public void execute() {
doServerSideOrdering();
VNotification.bringNotificationsToFront();
@@ -279,6 +281,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
VWindow[] array = windowOrder.toArray(new VWindow[windowOrder.size()]);
Arrays.sort(array, new Comparator<VWindow>() {
+ @Override
public int compare(VWindow o1, VWindow o2) {
/*
* Order by modality, then by bringtofront sequence.
@@ -552,11 +555,6 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
final Element target = DOM.eventGetTarget(event);
- if (client != null && header.isOrHasChild(target)) {
- // Handle window caption tooltips
- client.handleTooltipEvent(event, this);
- }
-
if (resizing || resizeBox == target) {
onResizeEvent(event);
bubble = false;
@@ -856,10 +854,12 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
true);
}
+ @Override
public ShortcutActionHandler getShortcutActionHandler() {
return shortcutHandler;
}
+ @Override
public void onScroll(ScrollEvent event) {
client.updateVariable(id, "scrollTop",
contentPanel.getScrollPosition(), false);
@@ -868,6 +868,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
}
+ @Override
public void onKeyDown(KeyDownEvent event) {
if (shortcutHandler != null) {
shortcutHandler
@@ -876,18 +877,21 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
}
}
+ @Override
public void onBlur(BlurEvent event) {
if (client.hasEventListeners(this, EventId.BLUR)) {
client.updateVariable(id, EventId.BLUR, "", true);
}
}
+ @Override
public void onFocus(FocusEvent event) {
if (client.hasEventListeners(this, EventId.FOCUS)) {
client.updateVariable(id, EventId.FOCUS, "", true);
}
}
+ @Override
public void focus() {
contentPanel.focus();
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/window/WindowConnector.java b/src/com/vaadin/terminal/gwt/client/ui/window/WindowConnector.java
index 83de039f0b..bae4f804fc 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/window/WindowConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/window/WindowConnector.java
@@ -12,18 +12,20 @@ import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.window.WindowServerRpc;
+import com.vaadin.shared.ui.window.WindowState;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent;
import com.vaadin.terminal.gwt.client.LayoutManager;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.communication.RpcProxy;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentContainerConnector;
import com.vaadin.terminal.gwt.client.ui.ClickEventHandler;
-import com.vaadin.terminal.gwt.client.ui.Connect;
import com.vaadin.terminal.gwt.client.ui.PostLayoutListener;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.BeforeShortcutActionListener;
@@ -72,6 +74,7 @@ public class WindowConnector extends AbstractComponentContainerConnector
lm.unregisterDependency(this, window.footer);
}
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
getWidget().id = getConnectorId();
getWidget().client = client;
@@ -180,10 +183,12 @@ public class WindowConnector extends AbstractComponentContainerConnector
}
}
+ @Override
public void updateCaption(ComponentConnector component) {
// NOP, window has own caption, layout caption not rendered
}
+ @Override
public void onBeforeShortcutAction(Event e) {
// NOP, nothing to update just avoid workaround ( causes excess
// blur/focus )
@@ -210,6 +215,7 @@ public class WindowConnector extends AbstractComponentContainerConnector
getWidget().contentPanel.setWidget(newChildWidget);
}
+ @Override
public void layout() {
LayoutManager lm = getLayoutManager();
VWindow window = getWidget();
@@ -274,13 +280,14 @@ public class WindowConnector extends AbstractComponentContainerConnector
}
}
+ @Override
public void postLayout() {
minWidthChecked = false;
VWindow window = getWidget();
if (window.centered) {
window.center();
}
- window.updateShadowSizeAndPosition();
+ window.sizeOrPositionUpdated();
}
@Override
diff --git a/src/com/vaadin/terminal/gwt/client/ui/window/WindowServerRpc.java b/src/com/vaadin/terminal/gwt/client/ui/window/WindowServerRpc.java
deleted file mode 100644
index 4723c55786..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/window/WindowServerRpc.java
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.window;
-
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.ui.ClickRpc;
-
-public interface WindowServerRpc extends ClickRpc, ServerRpc {
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/window/WindowState.java b/src/com/vaadin/terminal/gwt/client/ui/window/WindowState.java
deleted file mode 100644
index b057d76b16..0000000000
--- a/src/com/vaadin/terminal/gwt/client/ui/window/WindowState.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.window;
-
-import com.vaadin.terminal.gwt.client.ui.panel.PanelState;
-
-public class WindowState extends PanelState {
- private boolean modal = false;
- private boolean resizable = true;
- private boolean resizeLazy = false;
- private boolean draggable = true;
- private boolean centered = false;;
- private int positionX = -1;
- private int positionY = -1;
-
- public boolean isModal() {
- return modal;
- }
-
- public void setModal(boolean modal) {
- this.modal = modal;
- }
-
- public boolean isResizable() {
- return resizable;
- }
-
- public void setResizable(boolean resizable) {
- this.resizable = resizable;
- }
-
- public boolean isResizeLazy() {
- return resizeLazy;
- }
-
- public void setResizeLazy(boolean resizeLazy) {
- this.resizeLazy = resizeLazy;
- }
-
- public boolean isDraggable() {
- return draggable;
- }
-
- public void setDraggable(boolean draggable) {
- this.draggable = draggable;
- }
-
- public boolean isCentered() {
- return centered;
- }
-
- public void setCentered(boolean centered) {
- this.centered = centered;
- }
-
- public int getPositionX() {
- return positionX;
- }
-
- public void setPositionX(int positionX) {
- this.positionX = positionX;
- }
-
- public int getPositionY() {
- return positionY;
- }
-
- public void setPositionY(int positionY) {
- this.positionY = positionY;
- }
-
-} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
index c2f887674a..363f7e4869 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
@@ -25,7 +25,6 @@ import javax.portlet.ActionResponse;
import javax.portlet.EventRequest;
import javax.portlet.EventResponse;
import javax.portlet.GenericPortlet;
-import javax.portlet.MimeResponse;
import javax.portlet.PortletConfig;
import javax.portlet.PortletContext;
import javax.portlet.PortletException;
@@ -64,6 +63,8 @@ import com.vaadin.ui.Root;
public abstract class AbstractApplicationPortlet extends GenericPortlet
implements Constants {
+ public static final String RESOURCE_URL_ID = "APP";
+
public static class WrappedHttpAndPortletRequest extends
WrappedPortletRequest {
@@ -175,15 +176,12 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
this.portlet = portlet;
}
+ @Override
public void criticalNotification(WrappedRequest request,
WrappedResponse response, String cap, String msg,
String details, String outOfSyncURL) throws IOException {
- PortletRequest portletRequest = WrappedPortletRequest.cast(request)
- .getPortletRequest();
- PortletResponse portletResponse = ((WrappedPortletResponse) response)
- .getPortletResponse();
- portlet.criticalNotification(portletRequest,
- (MimeResponse) portletResponse, cap, msg, details,
+ portlet.criticalNotification(WrappedPortletRequest.cast(request),
+ (WrappedPortletResponse) response, cap, msg, details,
outOfSyncURL);
}
}
@@ -207,19 +205,19 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
// TODO Can we close the application when the portlet is removed? Do we know
// when the portlet is removed?
- private Properties applicationProperties;
-
private boolean productionMode = false;
- private DeploymentConfiguration deploymentConfiguration = new DeploymentConfiguration() {
-
+ private DeploymentConfiguration deploymentConfiguration = new AbstractDeploymentConfiguration(
+ getClass()) {
+ @Override
public String getConfiguredWidgetset(WrappedRequest request) {
String widgetset = getApplicationOrSystemProperty(
PARAMETER_WIDGETSET, null);
if (widgetset == null) {
- // If no widgetset defined for the application, check the portal
+ // If no widgetset defined for the application, check the
+ // portal
// property
widgetset = WrappedPortletRequest.cast(request)
.getPortalProperty(PORTAL_PARAMETER_VAADIN_WIDGETSET);
@@ -233,6 +231,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
return widgetset;
}
+ @Override
public String getConfiguredTheme(WrappedRequest request) {
// is the default theme defined by the portal?
@@ -247,12 +246,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
return themeName;
}
- public String getApplicationOrSystemProperty(String propertyName,
- String defaultValue) {
- return AbstractApplicationPortlet.this
- .getApplicationOrSystemProperty(propertyName, defaultValue);
- }
-
+ @Override
public boolean isStandalone(WrappedRequest request) {
return false;
}
@@ -272,6 +266,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
* be a VAADIN directory). Does not end with a slash (/).
*/
+ @Override
public String getStaticFileLocation(WrappedRequest request) {
String staticFileLocation = WrappedPortletRequest.cast(request)
.getPortalProperty(
@@ -289,17 +284,17 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
}
}
- public ClassLoader getClassLoader() {
- // Custom class loaders not currently supported in portlets (see
- // #8574)
- return null;
+ @Override
+ public String getMimeType(String resourceName) {
+ return getPortletContext().getMimeType(resourceName);
}
};
@Override
public void init(PortletConfig config) throws PortletException {
super.init(config);
- applicationProperties = new Properties();
+ Properties applicationProperties = getDeploymentConfiguration()
+ .getInitParameters();
// Read default parameters from the context
final PortletContext context = config.getPortletContext();
@@ -323,7 +318,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
}
private void checkCrossSiteProtection() {
- if (getApplicationOrSystemProperty(
+ if (getDeploymentConfiguration().getApplicationOrSystemProperty(
SERVLET_PARAMETER_DISABLE_XSRF_PROTECTION, "false").equals(
"true")) {
/*
@@ -338,8 +333,8 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
// TODO Identical code in AbstractApplicationServlet -> refactor
// Check if the application is in production mode.
// We are in production mode if productionMode=true
- if (getApplicationOrSystemProperty(SERVLET_PARAMETER_PRODUCTION_MODE,
- "false").equals("true")) {
+ if (getDeploymentConfiguration().getApplicationOrSystemProperty(
+ SERVLET_PARAMETER_PRODUCTION_MODE, "false").equals("true")) {
productionMode = true;
}
@@ -350,101 +345,27 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
}
}
- /**
- * Gets an application property value.
- *
- * @param parameterName
- * the Name or the parameter.
- * @return String value or null if not found
- */
- protected String getApplicationProperty(String parameterName) {
-
- String val = applicationProperties.getProperty(parameterName);
- if (val != null) {
- return val;
- }
-
- // Try lower case application properties for backward compatibility with
- // 3.0.2 and earlier
- val = applicationProperties.getProperty(parameterName.toLowerCase());
-
- return val;
- }
-
- /**
- * Gets an system property value.
- *
- * @param parameterName
- * the Name or the parameter.
- * @return String value or null if not found
- */
- protected String getSystemProperty(String parameterName) {
- String val = null;
-
- String pkgName;
- final Package pkg = getClass().getPackage();
- if (pkg != null) {
- pkgName = pkg.getName();
- } else {
- final String className = getClass().getName();
- pkgName = new String(className.toCharArray(), 0,
- className.lastIndexOf('.'));
- }
- val = System.getProperty(pkgName + "." + parameterName);
- if (val != null) {
- return val;
- }
-
- // Try lowercased system properties
- val = System.getProperty(pkgName + "." + parameterName.toLowerCase());
- return val;
- }
-
- /**
- * Gets an application or system property value.
- *
- * @param parameterName
- * the Name or the parameter.
- * @param defaultValue
- * the Default to be used.
- * @return String value or default if not found
- */
- protected String getApplicationOrSystemProperty(String parameterName,
- String defaultValue) {
-
- String val = null;
-
- // Try application properties
- val = getApplicationProperty(parameterName);
- if (val != null) {
- return val;
- }
-
- // Try system properties
- val = getSystemProperty(parameterName);
- if (val != null) {
- return val;
- }
-
- return defaultValue;
- }
-
protected enum RequestType {
- FILE_UPLOAD, UIDL, RENDER, STATIC_FILE, APPLICATION_RESOURCE, DUMMY, EVENT, ACTION, UNKNOWN, BROWSER_DETAILS;
+ FILE_UPLOAD, UIDL, RENDER, STATIC_FILE, APPLICATION_RESOURCE, DUMMY, EVENT, ACTION, UNKNOWN, BROWSER_DETAILS, CONNECTOR_RESOURCE;
}
- protected RequestType getRequestType(PortletRequest request) {
+ protected RequestType getRequestType(WrappedPortletRequest wrappedRequest) {
+ PortletRequest request = wrappedRequest.getPortletRequest();
if (request instanceof RenderRequest) {
return RequestType.RENDER;
} else if (request instanceof ResourceRequest) {
ResourceRequest resourceRequest = (ResourceRequest) request;
- if (isUIDLRequest(resourceRequest)) {
+ if (ServletPortletHelper.isUIDLRequest(wrappedRequest)) {
return RequestType.UIDL;
- } else if (isBrowserDetailsRequeset(resourceRequest)) {
+ } else if (isBrowserDetailsRequest(resourceRequest)) {
return RequestType.BROWSER_DETAILS;
- } else if (isFileUploadRequest(resourceRequest)) {
+ } else if (ServletPortletHelper.isFileUploadRequest(wrappedRequest)) {
return RequestType.FILE_UPLOAD;
- } else if (isApplicationResourceRequest(resourceRequest)) {
+ } else if (ServletPortletHelper
+ .isConnectorResourceRequest(wrappedRequest)) {
+ return RequestType.CONNECTOR_RESOURCE;
+ } else if (ServletPortletHelper
+ .isApplicationResourceRequest(wrappedRequest)) {
return RequestType.APPLICATION_RESOURCE;
} else if (isDummyRequest(resourceRequest)) {
return RequestType.DUMMY;
@@ -459,30 +380,16 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
return RequestType.UNKNOWN;
}
- private boolean isBrowserDetailsRequeset(ResourceRequest request) {
+ private boolean isBrowserDetailsRequest(ResourceRequest request) {
return request.getResourceID() != null
&& request.getResourceID().equals("browserDetails");
}
- private boolean isApplicationResourceRequest(ResourceRequest request) {
- return request.getResourceID() != null
- && request.getResourceID().startsWith("APP");
- }
-
- private boolean isUIDLRequest(ResourceRequest request) {
- return request.getResourceID() != null
- && request.getResourceID().equals("UIDL");
- }
-
private boolean isDummyRequest(ResourceRequest request) {
return request.getResourceID() != null
&& request.getResourceID().equals("DUMMY");
}
- private boolean isFileUploadRequest(ResourceRequest request) {
- return "UPLOAD".equals(request.getResourceID());
- }
-
/**
* Returns true if the servlet is running in production mode. Production
* mode disables all debug facilities.
@@ -506,7 +413,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
WrappedPortletResponse wrappedResponse = new WrappedPortletResponse(
response, getDeploymentConfiguration());
- RequestType requestType = getRequestType(request);
+ RequestType requestType = getRequestType(wrappedRequest);
if (requestType == RequestType.UNKNOWN) {
handleUnknownRequest(request, response);
@@ -554,6 +461,12 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
PortletCommunicationManager applicationManager = applicationContext
.getApplicationManager(application);
+ if (requestType == RequestType.CONNECTOR_RESOURCE) {
+ applicationManager.serveConnectorResource(wrappedRequest,
+ wrappedResponse);
+ return;
+ }
+
/* Update browser information from request */
applicationContext.getBrowser().updateRequestDetails(
wrappedRequest);
@@ -638,8 +551,10 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
/* Handle the request */
if (requestType == RequestType.FILE_UPLOAD) {
- applicationManager.handleFileUpload(root, wrappedRequest,
- wrappedResponse);
+ // Root is resolved in handleFileUpload by
+ // PortletCommunicationManager
+ applicationManager.handleFileUpload(application,
+ wrappedRequest, wrappedResponse);
return;
} else if (requestType == RequestType.BROWSER_DETAILS) {
applicationManager.handleBrowserDetailsRequest(
@@ -673,7 +588,8 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
getLogger()
.fine("General security exception, the security key was probably incorrect.");
} catch (final Throwable e) {
- handleServiceException(request, response, application, e);
+ handleServiceException(wrappedRequest, wrappedResponse,
+ application, e);
} finally {
// Notifies transaction end
try {
@@ -727,7 +643,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
}
- private DeploymentConfiguration getDeploymentConfiguration() {
+ protected DeploymentConfiguration getDeploymentConfiguration() {
return deploymentConfiguration;
}
@@ -871,7 +787,8 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
application.setLocale(locale);
// No application URL when running inside a portlet
application.start(new ApplicationStartEvent(null,
- applicationProperties, context, isProductionMode()));
+ getDeploymentConfiguration().getInitParameters(),
+ context, isProductionMode()));
}
}
@@ -995,11 +912,6 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
}
}
- protected ClassLoader getClassLoader() throws PortletException {
- // TODO Add support for custom class loader
- return getClass().getClassLoader();
- }
-
/**
* Get system messages from the current application class
*
@@ -1031,16 +943,16 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
return Application.getSystemMessages();
}
- private void handleServiceException(PortletRequest request,
- PortletResponse response, Application application, Throwable e)
- throws IOException, PortletException {
+ private void handleServiceException(WrappedPortletRequest request,
+ WrappedPortletResponse response, Application application,
+ Throwable e) throws IOException, PortletException {
// TODO Check that this error handler is working when running inside a
// portlet
// if this was an UIDL request, response UIDL back to client
if (getRequestType(request) == RequestType.UIDL) {
Application.SystemMessages ci = getSystemMessages();
- criticalNotification(request, (ResourceResponse) response,
+ criticalNotification(request, response,
ci.getInternalErrorCaption(), ci.getInternalErrorMessage(),
null, ci.getInternalErrorURL());
if (application != null) {
@@ -1065,6 +977,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
this.throwable = throwable;
}
+ @Override
public Throwable getThrowable() {
return throwable;
}
@@ -1093,9 +1006,9 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
* @throws IOException
* if the writing failed due to input/output error.
*/
- void criticalNotification(PortletRequest request, MimeResponse response,
- String caption, String message, String details, String url)
- throws IOException {
+ void criticalNotification(WrappedPortletRequest request,
+ WrappedPortletResponse response, String caption, String message,
+ String details, String url) throws IOException {
// clients JS app is still running, but server application either
// no longer exists or it might fail to perform reasonably.
@@ -1121,7 +1034,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
// Set the response type
response.setContentType("application/json; charset=UTF-8");
- final OutputStream out = response.getPortletOutputStream();
+ final OutputStream out = response.getOutputStream();
final PrintWriter outWriter = new PrintWriter(new BufferedWriter(
new OutputStreamWriter(out, "UTF-8")));
outWriter.print("for(;;);[{\"changes\":[], \"meta\" : {"
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
index f7e46a7ca9..a0e807801e 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
@@ -10,7 +10,6 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Serializable;
-import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
@@ -74,6 +73,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
this.servlet = servlet;
}
+ @Override
public void criticalNotification(WrappedRequest request,
WrappedResponse response, String cap, String msg,
String details, String outOfSyncURL) throws IOException {
@@ -87,16 +87,16 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
// TODO Move some (all?) of the constants to a separate interface (shared
// with portlet)
- private Properties applicationProperties;
-
private boolean productionMode = false;
private final String resourcePath = null;
private int resourceCacheTime = 3600;
- private DeploymentConfiguration deploymentConfiguration = new DeploymentConfiguration() {
+ private DeploymentConfiguration deploymentConfiguration = new AbstractDeploymentConfiguration(
+ getClass()) {
+ @Override
public String getStaticFileLocation(WrappedRequest request) {
HttpServletRequest servletRequest = WrappedHttpServletRequest
.cast(request);
@@ -104,38 +104,30 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
.getStaticFilesLocation(servletRequest);
}
+ @Override
public String getConfiguredWidgetset(WrappedRequest request) {
return getApplicationOrSystemProperty(
AbstractApplicationServlet.PARAMETER_WIDGETSET,
AbstractApplicationServlet.DEFAULT_WIDGETSET);
}
+ @Override
public String getConfiguredTheme(WrappedRequest request) {
// Use the default
return AbstractApplicationServlet.getDefaultTheme();
}
- public String getApplicationOrSystemProperty(String propertyName,
- String defaultValue) {
- return AbstractApplicationServlet.this
- .getApplicationOrSystemProperty(propertyName, defaultValue);
- }
-
+ @Override
public boolean isStandalone(WrappedRequest request) {
return true;
}
- public ClassLoader getClassLoader() {
- try {
- return AbstractApplicationServlet.this.getClassLoader();
- } catch (ServletException e) {
- throw new RuntimeException(e);
- }
+ @Override
+ public String getMimeType(String resourceName) {
+ return getServletContext().getMimeType(resourceName);
}
};
- static final String UPLOAD_URL_PREFIX = "APP/UPLOAD/";
-
/**
* Called by the servlet container to indicate to a servlet that the servlet
* is being placed into service.
@@ -148,11 +140,11 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
* servlet's normal operation.
*/
@Override
- @SuppressWarnings("unchecked")
public void init(javax.servlet.ServletConfig servletConfig)
throws javax.servlet.ServletException {
super.init(servletConfig);
- applicationProperties = new Properties();
+ Properties applicationProperties = getDeploymentConfiguration()
+ .getInitParameters();
// Read default parameters from server.xml
final ServletContext context = servletConfig.getServletContext();
@@ -177,7 +169,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
}
private void checkCrossSiteProtection() {
- if (getApplicationOrSystemProperty(
+ if (getDeploymentConfiguration().getApplicationOrSystemProperty(
SERVLET_PARAMETER_DISABLE_XSRF_PROTECTION, "false").equals(
"true")) {
/*
@@ -191,8 +183,8 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
private void checkProductionMode() {
// Check if the application is in production mode.
// We are in production mode if productionMode=true
- if (getApplicationOrSystemProperty(SERVLET_PARAMETER_PRODUCTION_MODE,
- "false").equals("true")) {
+ if (getDeploymentConfiguration().getApplicationOrSystemProperty(
+ SERVLET_PARAMETER_PRODUCTION_MODE, "false").equals("true")) {
productionMode = true;
}
@@ -206,8 +198,9 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
private void checkResourceCacheTime() {
// Check if the browser caching time has been set in web.xml
try {
- String rct = getApplicationOrSystemProperty(
- SERVLET_PARAMETER_RESOURCE_CACHE_TIME, "3600");
+ String rct = getDeploymentConfiguration()
+ .getApplicationOrSystemProperty(
+ SERVLET_PARAMETER_RESOURCE_CACHE_TIME, "3600");
resourceCacheTime = Integer.parseInt(rct);
} catch (NumberFormatException nfe) {
// Default is 1h
@@ -217,85 +210,6 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
}
/**
- * Gets an application property value.
- *
- * @param parameterName
- * the Name or the parameter.
- * @return String value or null if not found
- */
- protected String getApplicationProperty(String parameterName) {
-
- String val = applicationProperties.getProperty(parameterName);
- if (val != null) {
- return val;
- }
-
- // Try lower case application properties for backward compatibility with
- // 3.0.2 and earlier
- val = applicationProperties.getProperty(parameterName.toLowerCase());
-
- return val;
- }
-
- /**
- * Gets an system property value.
- *
- * @param parameterName
- * the Name or the parameter.
- * @return String value or null if not found
- */
- protected String getSystemProperty(String parameterName) {
- String val = null;
-
- String pkgName;
- final Package pkg = getClass().getPackage();
- if (pkg != null) {
- pkgName = pkg.getName();
- } else {
- final String className = getClass().getName();
- pkgName = new String(className.toCharArray(), 0,
- className.lastIndexOf('.'));
- }
- val = System.getProperty(pkgName + "." + parameterName);
- if (val != null) {
- return val;
- }
-
- // Try lowercased system properties
- val = System.getProperty(pkgName + "." + parameterName.toLowerCase());
- return val;
- }
-
- /**
- * Gets an application or system property value.
- *
- * @param parameterName
- * the Name or the parameter.
- * @param defaultValue
- * the Default to be used.
- * @return String value or default if not found
- */
- String getApplicationOrSystemProperty(String parameterName,
- String defaultValue) {
-
- String val = null;
-
- // Try application properties
- val = getApplicationProperty(parameterName);
- if (val != null) {
- return val;
- }
-
- // Try system properties
- val = getSystemProperty(parameterName);
- if (val != null) {
- return val;
- }
-
- return defaultValue;
- }
-
- /**
* Returns true if the servlet is running in production mode. Production
* mode disables all debug facilities.
*
@@ -396,6 +310,11 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
CommunicationManager applicationManager = webApplicationContext
.getApplicationManager(application, this);
+ if (requestType == RequestType.CONNECTOR_RESOURCE) {
+ applicationManager.serveConnectorResource(request, response);
+ return;
+ }
+
/* Update browser information from the request */
webApplicationContext.getBrowser().updateRequestDetails(request);
@@ -421,11 +340,9 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
/* Handle the request */
if (requestType == RequestType.FILE_UPLOAD) {
- Root root = application.getRootForRequest(request);
- if (root == null) {
- throw new ServletException(ERROR_NO_ROOT_FOUND);
- }
- applicationManager.handleFileUpload(root, request, response);
+ // Root is resolved in communication manager
+ applicationManager.handleFileUpload(application, request,
+ response);
return;
} else if (requestType == RequestType.UIDL) {
Root root = application.getRootForRequest(request);
@@ -536,8 +453,8 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
* @throws IOException
*/
private boolean ensureCookiesEnabled(RequestType requestType,
- HttpServletRequest request, HttpServletResponse response)
- throws IOException {
+ WrappedHttpServletRequest request,
+ WrappedHttpServletResponse response) throws IOException {
if (requestType == RequestType.UIDL && !isRepaintAll(request)) {
// In all other but the first UIDL request a cookie should be
// returned by the browser.
@@ -554,30 +471,6 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
return true;
}
- protected ClassLoader getClassLoader() throws ServletException {
- // Gets custom class loader
- final String classLoaderName = getApplicationOrSystemProperty(
- "ClassLoader", null);
- ClassLoader classLoader;
- if (classLoaderName == null) {
- classLoader = getClass().getClassLoader();
- } else {
- try {
- final Class<?> classLoaderClass = getClass().getClassLoader()
- .loadClass(classLoaderName);
- final Constructor<?> c = classLoaderClass
- .getConstructor(new Class[] { ClassLoader.class });
- classLoader = (ClassLoader) c
- .newInstance(new Object[] { getClass().getClassLoader() });
- } catch (final Exception e) {
- throw new ServletException(
- "Could not find specified class loader: "
- + classLoaderName, e);
- }
- }
- return classLoader;
- }
-
/**
* Send a notification to client's application. Used to notify client of
* critical errors, session expiration and more. Server has no knowledge of
@@ -602,11 +495,11 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
* @throws IOException
* if the writing failed due to input/output error.
*/
- protected void criticalNotification(HttpServletRequest request,
+ protected void criticalNotification(WrappedHttpServletRequest request,
HttpServletResponse response, String caption, String message,
String details, String url) throws IOException {
- if (isUIDLRequest(request)) {
+ if (ServletPortletHelper.isUIDLRequest(request)) {
if (caption != null) {
caption = "\"" + JsonPaintTarget.escapeJSON(caption) + "\"";
@@ -828,9 +721,9 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
return newApplication;
}
- private void handleServiceException(HttpServletRequest request,
- HttpServletResponse response, Application application, Throwable e)
- throws IOException, ServletException {
+ private void handleServiceException(WrappedHttpServletRequest request,
+ WrappedHttpServletResponse response, Application application,
+ Throwable e) throws IOException, ServletException {
// if this was an UIDL request, response UIDL back to client
if (getRequestType(request) == RequestType.UIDL) {
Application.SystemMessages ci = getSystemMessages();
@@ -883,8 +776,9 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
return DEFAULT_THEME_NAME;
}
- void handleServiceSessionExpired(HttpServletRequest request,
- HttpServletResponse response) throws IOException, ServletException {
+ void handleServiceSessionExpired(WrappedHttpServletRequest request,
+ WrappedHttpServletResponse response) throws IOException,
+ ServletException {
if (isOnUnloadRequest(request)) {
/*
@@ -924,8 +818,10 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
}
- private void handleServiceSecurityException(HttpServletRequest request,
- HttpServletResponse response) throws IOException, ServletException {
+ private void handleServiceSecurityException(
+ WrappedHttpServletRequest request,
+ WrappedHttpServletResponse response) throws IOException,
+ ServletException {
if (isOnUnloadRequest(request)) {
/*
* Request was an unload request (e.g. window close event) and the
@@ -991,8 +887,8 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
Locale locale = request.getLocale();
application.setLocale(locale);
application.start(new ApplicationStartEvent(applicationUrl,
- applicationProperties, webApplicationContext,
- isProductionMode()));
+ getDeploymentConfiguration().getInitParameters(),
+ webApplicationContext, isProductionMode()));
}
}
@@ -1054,7 +950,8 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
// strip leading "/" otherwise stream from JAR wont work
filename = filename.substring(1);
- resourceUrl = getClassLoader().getResource(filename);
+ resourceUrl = getDeploymentConfiguration().getClassLoader()
+ .getResource(filename);
if (resourceUrl == null) {
// cannot serve requested file
@@ -1250,22 +1147,22 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
}
protected enum RequestType {
- FILE_UPLOAD, BROWSER_DETAILS, UIDL, OTHER, STATIC_FILE, APPLICATION_RESOURCE;
+ FILE_UPLOAD, BROWSER_DETAILS, UIDL, OTHER, STATIC_FILE, APPLICATION_RESOURCE, CONNECTOR_RESOURCE;
}
- protected RequestType getRequestType(HttpServletRequest request) {
- if (isFileUploadRequest(request)) {
+ protected RequestType getRequestType(WrappedHttpServletRequest request) {
+ if (ServletPortletHelper.isFileUploadRequest(request)) {
return RequestType.FILE_UPLOAD;
+ } else if (ServletPortletHelper.isConnectorResourceRequest(request)) {
+ return RequestType.CONNECTOR_RESOURCE;
} else if (isBrowserDetailsRequest(request)) {
return RequestType.BROWSER_DETAILS;
- } else if (isUIDLRequest(request)) {
+ } else if (ServletPortletHelper.isUIDLRequest(request)) {
return RequestType.UIDL;
} else if (isStaticResourceRequest(request)) {
return RequestType.STATIC_FILE;
- } else if (isApplicationRequest(request)) {
+ } else if (ServletPortletHelper.isApplicationResourceRequest(request)) {
return RequestType.APPLICATION_RESOURCE;
- } else if (request.getHeader("FileId") != null) {
- return RequestType.FILE_UPLOAD;
}
return RequestType.OTHER;
@@ -1276,14 +1173,6 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
&& request.getParameter("browserDetails") != null;
}
- private boolean isApplicationRequest(HttpServletRequest request) {
- String path = getRequestPathInfo(request);
- if (path != null && path.startsWith("/APP/")) {
- return true;
- }
- return false;
- }
-
private boolean isStaticResourceRequest(HttpServletRequest request) {
String pathInfo = request.getPathInfo();
if (pathInfo == null || pathInfo.length() <= 10) {
@@ -1301,37 +1190,6 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
return false;
}
- private boolean isUIDLRequest(HttpServletRequest request) {
- String pathInfo = getRequestPathInfo(request);
-
- if (pathInfo == null) {
- return false;
- }
-
- String compare = AJAX_UIDL_URI;
-
- if (pathInfo.startsWith(compare + "/") || pathInfo.endsWith(compare)) {
- return true;
- }
-
- return false;
- }
-
- private boolean isFileUploadRequest(HttpServletRequest request) {
- String pathInfo = getRequestPathInfo(request);
-
- if (pathInfo == null) {
- return false;
- }
-
- if (pathInfo.startsWith("/" + UPLOAD_URL_PREFIX)) {
- return true;
- }
-
- return false;
-
- }
-
private boolean isOnUnloadRequest(HttpServletRequest request) {
return request.getParameter(ApplicationConnection.PARAM_UNLOADBURST) != null;
}
@@ -1410,8 +1268,9 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
HttpServletRequest request) {
String staticFileLocation;
// if property is defined in configurations, use that
- staticFileLocation = getApplicationOrSystemProperty(
- PARAMETER_VAADIN_RESOURCES, null);
+ staticFileLocation = getDeploymentConfiguration()
+ .getApplicationOrSystemProperty(PARAMETER_VAADIN_RESOURCES,
+ null);
if (staticFileLocation != null) {
return staticFileLocation;
}
@@ -1682,6 +1541,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
this.throwable = throwable;
}
+ @Override
public Throwable getThrowable() {
return throwable;
}
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
index 7cad8e3a33..ba1b3cadb6 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
@@ -18,6 +18,8 @@ import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.security.GeneralSecurityException;
import java.text.CharacterIterator;
import java.text.DateFormat;
@@ -42,13 +44,21 @@ import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
+import javax.servlet.http.HttpServletResponse;
+
import com.vaadin.Application;
import com.vaadin.Application.SystemMessages;
import com.vaadin.RootRequiresMoreInformationException;
import com.vaadin.Version;
+import com.vaadin.annotations.JavaScript;
+import com.vaadin.annotations.StyleSheet;
import com.vaadin.external.json.JSONArray;
import com.vaadin.external.json.JSONException;
import com.vaadin.external.json.JSONObject;
+import com.vaadin.shared.Connector;
+import com.vaadin.shared.communication.MethodInvocation;
+import com.vaadin.shared.communication.SharedState;
+import com.vaadin.shared.communication.UidlValue;
import com.vaadin.terminal.AbstractClientConnector;
import com.vaadin.terminal.CombinedRequest;
import com.vaadin.terminal.LegacyPaint;
@@ -65,10 +75,6 @@ import com.vaadin.terminal.VariableOwner;
import com.vaadin.terminal.WrappedRequest;
import com.vaadin.terminal.WrappedResponse;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.client.communication.MethodInvocation;
-import com.vaadin.terminal.gwt.client.communication.SharedState;
-import com.vaadin.terminal.gwt.client.communication.UidlValue;
import com.vaadin.terminal.gwt.server.BootstrapHandler.BootstrapContext;
import com.vaadin.terminal.gwt.server.ComponentSizeValidator.InvalidLayout;
import com.vaadin.terminal.gwt.server.RpcManager.RpcInvocationException;
@@ -154,6 +160,12 @@ public abstract class AbstractCommunicationManager implements Serializable {
private Connector highlightedConnector;
+ private Map<String, Class<?>> connectorResourceContexts = new HashMap<String, Class<?>>();
+
+ private Map<String, Map<String, StreamVariable>> pidToNameToStreamVariable;
+
+ private Map<StreamVariable, String> streamVariableToSeckey;
+
/**
* TODO New constructor - document me!
*
@@ -204,7 +216,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
*/
protected void doHandleSimpleMultipartFileUpload(WrappedRequest request,
WrappedResponse response, StreamVariable streamVariable,
- String variableName, Connector owner, String boundary)
+ String variableName, ClientConnector owner, String boundary)
throws IOException {
// multipart parsing, supports only one file for request, but that is
// fine for our current terminal
@@ -267,14 +279,16 @@ public abstract class AbstractCommunicationManager implements Serializable {
final String mimeType = rawMimeType;
try {
- /*
- * safe cast as in GWT terminal all variable owners are expected to
- * be components.
- */
- Component component = (Component) owner;
- if (component.isReadOnly()) {
+ // TODO Shouldn't this check connectorEnabled?
+ if (owner == null) {
throw new UploadException(
- "Warning: file upload ignored because the componente was read-only");
+ "File upload ignored because the connector for the stream variable was not found");
+ }
+ if (owner instanceof Component) {
+ if (((Component) owner).isReadOnly()) {
+ throw new UploadException(
+ "Warning: file upload ignored because the componente was read-only");
+ }
}
boolean forgetVariable = streamToReceiver(simpleMultiPartReader,
streamVariable, filename, mimeType, contentLength);
@@ -303,7 +317,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
*/
protected void doHandleXhrFilePost(WrappedRequest request,
WrappedResponse response, StreamVariable streamVariable,
- String variableName, Connector owner, int contentLength)
+ String variableName, ClientConnector owner, int contentLength)
throws IOException {
// These are unknown in filexhr ATM, maybe add to Accept header that
@@ -497,10 +511,11 @@ public abstract class AbstractCommunicationManager implements Serializable {
* found
* @throws IOException
* @throws InvalidUIDLSecurityKeyException
+ * @throws JSONException
*/
public void handleUidlRequest(WrappedRequest request,
WrappedResponse response, Callback callback, Root root)
- throws IOException, InvalidUIDLSecurityKeyException {
+ throws IOException, InvalidUIDLSecurityKeyException, JSONException {
checkWidgetsetVersion(request);
requestThemeName = request.getParameter("theme");
@@ -623,6 +638,23 @@ public abstract class AbstractCommunicationManager implements Serializable {
// Remove connectors that have been detached from the application during
// handling of the request
root.getConnectorTracker().cleanConnectorMap();
+
+ if (pidToNameToStreamVariable != null) {
+ Iterator<String> iterator = pidToNameToStreamVariable.keySet()
+ .iterator();
+ while (iterator.hasNext()) {
+ String connectorId = iterator.next();
+ if (root.getConnectorTracker().getConnector(connectorId) == null) {
+ // Owner is no longer attached to the application
+ Map<String, StreamVariable> removed = pidToNameToStreamVariable
+ .get(connectorId);
+ for (String key : removed.keySet()) {
+ streamVariableToSeckey.remove(removed.get(key));
+ }
+ iterator.remove();
+ }
+ }
+ }
}
protected void highlightConnector(Connector highlightedConnector) {
@@ -696,11 +728,12 @@ public abstract class AbstractCommunicationManager implements Serializable {
* @param analyzeLayouts
* @throws PaintException
* @throws IOException
+ * @throws JSONException
*/
private void paintAfterVariableChanges(WrappedRequest request,
WrappedResponse response, Callback callback, boolean repaintAll,
final PrintWriter outWriter, Root root, boolean analyzeLayouts)
- throws PaintException, IOException {
+ throws PaintException, IOException, JSONException {
// Removes application if it has stopped during variable changes
if (!application.isRunning()) {
@@ -764,7 +797,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
@SuppressWarnings("unchecked")
public void writeUidlResponse(WrappedRequest request, boolean repaintAll,
final PrintWriter outWriter, Root root, boolean analyzeLayouts)
- throws PaintException {
+ throws PaintException, JSONException {
ArrayList<ClientConnector> dirtyVisibleConnectors = new ArrayList<ClientConnector>();
Application application = root.getApplication();
// Paints components
@@ -1095,10 +1128,14 @@ public abstract class AbstractCommunicationManager implements Serializable {
boolean typeMappingsOpen = false;
ClientCache clientCache = getClientCache(root);
+ List<Class<? extends ClientConnector>> newConnectorTypes = new ArrayList<Class<? extends ClientConnector>>();
+
for (Class<? extends ClientConnector> class1 : usedClientConnectors) {
if (clientCache.cache(class1)) {
// client does not know the mapping key for this type, send
// mapping to client
+ newConnectorTypes.add(class1);
+
if (!typeMappingsOpen) {
typeMappingsOpen = true;
outWriter.print(", \"typeMappings\" : { ");
@@ -1142,6 +1179,58 @@ public abstract class AbstractCommunicationManager implements Serializable {
}
}
+ /*
+ * Ensure super classes come before sub classes to get script dependency
+ * order right. Sub class @JavaScript might assume that @JavaScript
+ * defined by super class is already loaded.
+ */
+ Collections.sort(newConnectorTypes, new Comparator<Class<?>>() {
+ @Override
+ public int compare(Class<?> o1, Class<?> o2) {
+ // TODO optimize using Class.isAssignableFrom?
+ return hierarchyDepth(o1) - hierarchyDepth(o2);
+ }
+
+ private int hierarchyDepth(Class<?> type) {
+ if (type == Object.class) {
+ return 0;
+ } else {
+ return hierarchyDepth(type.getSuperclass()) + 1;
+ }
+ }
+ });
+
+ List<String> scriptDependencies = new ArrayList<String>();
+ List<String> styleDependencies = new ArrayList<String>();
+
+ for (Class<? extends ClientConnector> class1 : newConnectorTypes) {
+ JavaScript jsAnnotation = class1.getAnnotation(JavaScript.class);
+ if (jsAnnotation != null) {
+ for (String resource : jsAnnotation.value()) {
+ scriptDependencies.add(registerResource(resource, class1));
+ }
+ }
+
+ StyleSheet styleAnnotation = class1.getAnnotation(StyleSheet.class);
+ if (styleAnnotation != null) {
+ for (String resource : styleAnnotation.value()) {
+ styleDependencies.add(registerResource(resource, class1));
+ }
+ }
+ }
+
+ // Include script dependencies in output if there are any
+ if (!scriptDependencies.isEmpty()) {
+ outWriter.print(", \"scriptDependencies\": "
+ + new JSONArray(scriptDependencies).toString());
+ }
+
+ // Include style dependencies in output if there are any
+ if (!styleDependencies.isEmpty()) {
+ outWriter.print(", \"styleDependencies\": "
+ + new JSONArray(styleDependencies).toString());
+ }
+
// add any pending locale definitions requested by the client
printLocaleDeclarations(outWriter);
@@ -1153,6 +1242,54 @@ public abstract class AbstractCommunicationManager implements Serializable {
}
/**
+ * Resolves a resource URI, registering the URI with this
+ * {@code AbstractCommunicationManager} if needed and returns a fully
+ * qualified URI.
+ */
+ private String registerResource(String resourceUri, Class<?> context) {
+ try {
+ URI uri = new URI(resourceUri);
+ String protocol = uri.getScheme();
+
+ if ("connector".equals(protocol)) {
+ // Strip initial slash
+ String resourceName = uri.getPath().substring(1);
+ return registerConnectorResource(resourceName, context);
+ }
+
+ if (protocol != null || uri.getHost() != null) {
+ return resourceUri;
+ }
+
+ // Bare path interpreted as connector resource
+ return registerConnectorResource(resourceUri, context);
+ } catch (URISyntaxException e) {
+ getLogger().log(Level.WARNING,
+ "Could not parse resource url " + resourceUri, e);
+ return resourceUri;
+ }
+ }
+
+ private String registerConnectorResource(String name, Class<?> context) {
+ synchronized (connectorResourceContexts) {
+ // Add to map of names accepted by serveConnectorResource
+ if (connectorResourceContexts.containsKey(name)) {
+ Class<?> oldContext = connectorResourceContexts.get(name);
+ if (oldContext != context) {
+ getLogger().warning(
+ "Resource " + name + " defined by both " + context
+ + " and " + oldContext + ". Resource from "
+ + oldContext + " will be used.");
+ }
+ } else {
+ connectorResourceContexts.put(name, context);
+ }
+ }
+
+ return ApplicationConnection.CONNECTOR_PROTOCOL_PREFIX + "/" + name;
+ }
+
+ /**
* Adds the performance timing data (used by TestBench 3) to the UIDL
* response.
*/
@@ -1194,6 +1331,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
// before children start calling e.g. updateCaption
Collections.sort(paintables, new Comparator<Component>() {
+ @Override
public int compare(Component c1, Component c2) {
int depth1 = 0;
while (c1.getParent() != null) {
@@ -1280,14 +1418,17 @@ public abstract class AbstractCommunicationManager implements Serializable {
private static class NullIterator<E> implements Iterator<E> {
+ @Override
public boolean hasNext() {
return false;
}
+ @Override
public E next() {
return null;
}
+ @Override
public void remove() {
}
@@ -1380,7 +1521,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
private boolean handleVariables(WrappedRequest request,
WrappedResponse response, Callback callback,
Application application2, Root root) throws IOException,
- InvalidUIDLSecurityKeyException {
+ InvalidUIDLSecurityKeyException, JSONException {
boolean success = true;
String changes = getRequestPayload(request);
@@ -1761,6 +1902,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
this.throwable = throwable;
}
+ @Override
public Throwable getThrowable() {
return throwable;
}
@@ -2162,10 +2304,57 @@ public abstract class AbstractCommunicationManager implements Serializable {
}
- abstract String getStreamVariableTargetUrl(Connector owner, String name,
- StreamVariable value);
+ public String getStreamVariableTargetUrl(ClientConnector owner,
+ String name, StreamVariable value) {
+ /*
+ * We will use the same APP/* URI space as ApplicationResources but
+ * prefix url with UPLOAD
+ *
+ * eg. APP/UPLOAD/[ROOTID]/[PID]/[NAME]/[SECKEY]
+ *
+ * SECKEY is created on each paint to make URL's unpredictable (to
+ * prevent CSRF attacks).
+ *
+ * NAME and PID from URI forms a key to fetch StreamVariable when
+ * handling post
+ */
+ String paintableId = owner.getConnectorId();
+ int rootId = owner.getRoot().getRootId();
+ String key = rootId + "/" + paintableId + "/" + name;
+
+ if (pidToNameToStreamVariable == null) {
+ pidToNameToStreamVariable = new HashMap<String, Map<String, StreamVariable>>();
+ }
+ Map<String, StreamVariable> nameToStreamVariable = pidToNameToStreamVariable
+ .get(paintableId);
+ if (nameToStreamVariable == null) {
+ nameToStreamVariable = new HashMap<String, StreamVariable>();
+ pidToNameToStreamVariable.put(paintableId, nameToStreamVariable);
+ }
+ nameToStreamVariable.put(name, value);
+
+ if (streamVariableToSeckey == null) {
+ streamVariableToSeckey = new HashMap<StreamVariable, String>();
+ }
+ String seckey = streamVariableToSeckey.get(value);
+ if (seckey == null) {
+ seckey = UUID.randomUUID().toString();
+ streamVariableToSeckey.put(value, seckey);
+ }
+
+ return ApplicationConnection.APP_PROTOCOL_PREFIX
+ + ServletPortletHelper.UPLOAD_URL_PREFIX + key + "/" + seckey;
+
+ }
- abstract protected void cleanStreamVariable(Connector owner, String name);
+ public void cleanStreamVariable(ClientConnector owner, String name) {
+ Map<String, StreamVariable> nameToStreamVar = pidToNameToStreamVariable
+ .get(owner.getConnectorId());
+ nameToStreamVar.remove(name);
+ if (nameToStreamVar.isEmpty()) {
+ pidToNameToStreamVariable.remove(owner.getConnectorId());
+ }
+ }
/**
* Gets the bootstrap handler that should be used for generating the pages
@@ -2256,9 +2445,11 @@ public abstract class AbstractCommunicationManager implements Serializable {
* @return a string with the initial UIDL message
* @throws PaintException
* if an exception occurs while painting
+ * @throws JSONException
+ * if an exception occurs while encoding output
*/
protected String getInitialUIDL(WrappedRequest request, Root root)
- throws PaintException {
+ throws PaintException, JSONException {
// TODO maybe unify writeUidlResponse()?
StringWriter sWriter = new StringWriter();
PrintWriter pWriter = new PrintWriter(sWriter);
@@ -2274,6 +2465,176 @@ public abstract class AbstractCommunicationManager implements Serializable {
}
/**
+ * Serve a connector resource from the classpath if the resource has
+ * previously been registered by calling
+ * {@link #registerResource(String, Class)}. Sending arbitrary files from
+ * the classpath is prevented by only accepting resource names that have
+ * explicitly been registered. Resources can currently only be registered by
+ * including a {@link JavaScript} or {@link StyleSheet} annotation on a
+ * Connector class.
+ *
+ * @param request
+ * @param response
+ *
+ * @throws IOException
+ */
+ public void serveConnectorResource(WrappedRequest request,
+ WrappedResponse response) throws IOException {
+
+ String pathInfo = request.getRequestPathInfo();
+ // + 2 to also remove beginning and ending slashes
+ String resourceName = pathInfo
+ .substring(ApplicationConnection.CONNECTOR_RESOURCE_PREFIX
+ .length() + 2);
+
+ final String mimetype = response.getDeploymentConfiguration()
+ .getMimeType(resourceName);
+
+ // Security check: avoid accidentally serving from the root of the
+ // classpath instead of relative to the context class
+ if (resourceName.startsWith("/")) {
+ getLogger().warning(
+ "Connector resource request starting with / rejected: "
+ + resourceName);
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, resourceName);
+ return;
+ }
+
+ // Check that the resource name has been registered
+ Class<?> context;
+ synchronized (connectorResourceContexts) {
+ context = connectorResourceContexts.get(resourceName);
+ }
+
+ // Security check: don't serve resource if the name hasn't been
+ // registered in the map
+ if (context == null) {
+ getLogger().warning(
+ "Connector resource request for unknown resource rejected: "
+ + resourceName);
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, resourceName);
+ return;
+ }
+
+ // Resolve file relative to the location of the context class
+ InputStream in = context.getResourceAsStream(resourceName);
+ if (in == null) {
+ getLogger().warning(
+ resourceName + " defined by " + context.getName()
+ + " not found. Verify that the file "
+ + context.getPackage().getName().replace('.', '/')
+ + '/' + resourceName
+ + " is available on the classpath.");
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, resourceName);
+ return;
+ }
+
+ // TODO Check and set cache headers
+
+ OutputStream out = null;
+ try {
+ if (mimetype != null) {
+ response.setContentType(mimetype);
+ }
+
+ out = response.getOutputStream();
+
+ final byte[] buffer = new byte[Constants.DEFAULT_BUFFER_SIZE];
+
+ int bytesRead = 0;
+ while ((bytesRead = in.read(buffer)) > 0) {
+ out.write(buffer, 0, bytesRead);
+ }
+ out.flush();
+ } finally {
+ try {
+ in.close();
+ } catch (Exception e) {
+ // Do nothing
+ }
+ if (out != null) {
+ try {
+ out.close();
+ } catch (Exception e) {
+ // Do nothing
+ }
+ }
+ }
+ }
+
+ /**
+ * Handles file upload request submitted via Upload component.
+ *
+ * @param root
+ * The root for this request
+ *
+ * @see #getStreamVariableTargetUrl(ReceiverOwner, String, StreamVariable)
+ *
+ * @param request
+ * @param response
+ * @throws IOException
+ * @throws InvalidUIDLSecurityKeyException
+ */
+ public void handleFileUpload(Application application,
+ WrappedRequest request, WrappedResponse response)
+ throws IOException, InvalidUIDLSecurityKeyException {
+
+ /*
+ * URI pattern: APP/UPLOAD/[ROOTID]/[PID]/[NAME]/[SECKEY] See
+ * #createReceiverUrl
+ */
+
+ String pathInfo = request.getRequestPathInfo();
+ // strip away part until the data we are interested starts
+ int startOfData = pathInfo
+ .indexOf(ServletPortletHelper.UPLOAD_URL_PREFIX)
+ + ServletPortletHelper.UPLOAD_URL_PREFIX.length();
+ String uppUri = pathInfo.substring(startOfData);
+ String[] parts = uppUri.split("/", 4); // 0= rootid, 1 = cid, 2= name, 3
+ // = sec key
+ String rootId = parts[0];
+ String connectorId = parts[1];
+ String variableName = parts[2];
+ Root root = application.getRootById(Integer.parseInt(rootId));
+ Root.setCurrent(root);
+
+ StreamVariable streamVariable = getStreamVariable(connectorId,
+ variableName);
+ String secKey = streamVariableToSeckey.get(streamVariable);
+ if (secKey.equals(parts[3])) {
+
+ ClientConnector source = getConnector(root, connectorId);
+ String contentType = request.getContentType();
+ if (contentType.contains("boundary")) {
+ // Multipart requests contain boundary string
+ doHandleSimpleMultipartFileUpload(request, response,
+ streamVariable, variableName, source,
+ contentType.split("boundary=")[1]);
+ } else {
+ // if boundary string does not exist, the posted file is from
+ // XHR2.post(File)
+ doHandleXhrFilePost(request, response, streamVariable,
+ variableName, source, request.getContentLength());
+ }
+ } else {
+ throw new InvalidUIDLSecurityKeyException(
+ "Security key in upload post did not match!");
+ }
+
+ }
+
+ public StreamVariable getStreamVariable(String connectorId,
+ String variableName) {
+ Map<String, StreamVariable> map = pidToNameToStreamVariable
+ .get(connectorId);
+ if (map == null) {
+ return null;
+ }
+ StreamVariable streamVariable = map.get(variableName);
+ return streamVariable;
+ }
+
+ /**
* Stream that extracts content from another stream until the boundary
* string is encountered.
*
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java b/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java
new file mode 100644
index 0000000000..1ac090ad76
--- /dev/null
+++ b/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java
@@ -0,0 +1,121 @@
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.terminal.gwt.server;
+
+import java.lang.reflect.Constructor;
+import java.util.Properties;
+
+import com.vaadin.terminal.DeploymentConfiguration;
+
+public abstract class AbstractDeploymentConfiguration implements
+ DeploymentConfiguration {
+
+ private final Class<?> systemPropertyBaseClass;
+ private final Properties applicationProperties = new Properties();
+
+ public AbstractDeploymentConfiguration(Class<?> systemPropertyBaseClass) {
+ this.systemPropertyBaseClass = systemPropertyBaseClass;
+ }
+
+ @Override
+ public String getApplicationOrSystemProperty(String propertyName,
+ String defaultValue) {
+
+ String val = null;
+
+ // Try application properties
+ val = getApplicationProperty(propertyName);
+ if (val != null) {
+ return val;
+ }
+
+ // Try system properties
+ val = getSystemProperty(propertyName);
+ if (val != null) {
+ return val;
+ }
+
+ return defaultValue;
+ }
+
+ /**
+ * Gets an system property value.
+ *
+ * @param parameterName
+ * the Name or the parameter.
+ * @return String value or null if not found
+ */
+ protected String getSystemProperty(String parameterName) {
+ String val = null;
+
+ String pkgName;
+ final Package pkg = systemPropertyBaseClass.getPackage();
+ if (pkg != null) {
+ pkgName = pkg.getName();
+ } else {
+ final String className = systemPropertyBaseClass.getName();
+ pkgName = new String(className.toCharArray(), 0,
+ className.lastIndexOf('.'));
+ }
+ val = System.getProperty(pkgName + "." + parameterName);
+ if (val != null) {
+ return val;
+ }
+
+ // Try lowercased system properties
+ val = System.getProperty(pkgName + "." + parameterName.toLowerCase());
+ return val;
+ }
+
+ @Override
+ public ClassLoader getClassLoader() {
+ final String classLoaderName = getApplicationOrSystemProperty(
+ "ClassLoader", null);
+ ClassLoader classLoader;
+ if (classLoaderName == null) {
+ classLoader = getClass().getClassLoader();
+ } else {
+ try {
+ final Class<?> classLoaderClass = getClass().getClassLoader()
+ .loadClass(classLoaderName);
+ final Constructor<?> c = classLoaderClass
+ .getConstructor(new Class[] { ClassLoader.class });
+ classLoader = (ClassLoader) c
+ .newInstance(new Object[] { getClass().getClassLoader() });
+ } catch (final Exception e) {
+ throw new RuntimeException(
+ "Could not find specified class loader: "
+ + classLoaderName, e);
+ }
+ }
+ return classLoader;
+ }
+
+ /**
+ * Gets an application property value.
+ *
+ * @param parameterName
+ * the Name or the parameter.
+ * @return String value or null if not found
+ */
+ protected String getApplicationProperty(String parameterName) {
+
+ String val = applicationProperties.getProperty(parameterName);
+ if (val != null) {
+ return val;
+ }
+
+ // Try lower case application properties for backward compatibility with
+ // 3.0.2 and earlier
+ val = applicationProperties.getProperty(parameterName.toLowerCase());
+
+ return val;
+ }
+
+ @Override
+ public Properties getInitParameters() {
+ return applicationProperties;
+ }
+}
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractStreamingEvent.java b/src/com/vaadin/terminal/gwt/server/AbstractStreamingEvent.java
index 43b175cc36..d3474e736e 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractStreamingEvent.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractStreamingEvent.java
@@ -15,10 +15,12 @@ abstract class AbstractStreamingEvent implements StreamingEvent {
private final long contentLength;
private final long bytesReceived;
+ @Override
public final String getFileName() {
return filename;
}
+ @Override
public final String getMimeType() {
return type;
}
@@ -31,10 +33,12 @@ abstract class AbstractStreamingEvent implements StreamingEvent {
this.bytesReceived = bytesReceived;
}
+ @Override
public final long getContentLength() {
return contentLength;
}
+ @Override
public final long getBytesReceived() {
return bytesReceived;
}
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java b/src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java
index bf4ea860a8..3a33621d10 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java
@@ -24,6 +24,7 @@ import javax.servlet.http.HttpSessionBindingListener;
import com.vaadin.Application;
import com.vaadin.service.ApplicationContext;
import com.vaadin.terminal.ApplicationResource;
+import com.vaadin.terminal.gwt.client.ApplicationConnection;
/**
* Base class for web application contexts (including portlet contexts) that
@@ -45,12 +46,14 @@ public abstract class AbstractWebApplicationContext implements
private long lastRequestTime = -1;
+ @Override
public void addTransactionListener(TransactionListener listener) {
if (listener != null) {
listeners.add(listener);
}
}
+ @Override
public void removeTransactionListener(TransactionListener listener) {
listeners.remove(listener);
}
@@ -119,6 +122,7 @@ public abstract class AbstractWebApplicationContext implements
/**
* @see javax.servlet.http.HttpSessionBindingListener#valueBound(HttpSessionBindingEvent)
*/
+ @Override
public void valueBound(HttpSessionBindingEvent arg0) {
// We are not interested in bindings
}
@@ -126,6 +130,7 @@ public abstract class AbstractWebApplicationContext implements
/**
* @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(HttpSessionBindingEvent)
*/
+ @Override
public void valueUnbound(HttpSessionBindingEvent event) {
// If we are going to be unbound from the session, the session must be
// closing
@@ -160,6 +165,7 @@ public abstract class AbstractWebApplicationContext implements
return browser;
}
+ @Override
public Collection<Application> getApplications() {
return Collections.unmodifiableCollection(applications);
}
@@ -169,12 +175,14 @@ public abstract class AbstractWebApplicationContext implements
applicationToAjaxAppMgrMap.remove(application);
}
+ @Override
public String generateApplicationResourceURL(ApplicationResource resource,
String mapKey) {
final String filename = resource.getFilename();
if (filename == null) {
- return "app://APP/" + mapKey + "/";
+ return ApplicationConnection.APP_PROTOCOL_PREFIX
+ + ApplicationConnection.APP_REQUEST_PATH + mapKey + "/";
} else {
// #7738 At least Tomcat and JBoss refuses requests containing
// encoded slashes or backslashes in URLs. Application resource URLs
@@ -182,7 +190,9 @@ public abstract class AbstractWebApplicationContext implements
// in the future.
String encodedFileName = urlEncode(filename).replace("%2F", "/")
.replace("%5C", "\\");
- return "app://APP/" + mapKey + "/" + encodedFileName;
+ return ApplicationConnection.APP_PROTOCOL_PREFIX
+ + ApplicationConnection.APP_REQUEST_PATH + mapKey + "/"
+ + encodedFileName;
}
}
@@ -197,6 +207,7 @@ public abstract class AbstractWebApplicationContext implements
}
}
+ @Override
public boolean isApplicationResourceURL(URL context, String relativeUri) {
// If the relative uri is null, we are ready
if (relativeUri == null) {
@@ -214,6 +225,7 @@ public abstract class AbstractWebApplicationContext implements
return (prefix.equals("APP"));
}
+ @Override
public String getURLKey(URL context, String relativeUri) {
final int index = relativeUri.indexOf('/');
final int next = relativeUri.indexOf('/', index + 1);
diff --git a/src/com/vaadin/terminal/gwt/server/ApplicationPortlet2.java b/src/com/vaadin/terminal/gwt/server/ApplicationPortlet2.java
index 7a46a07e6c..788c48267e 100644
--- a/src/com/vaadin/terminal/gwt/server/ApplicationPortlet2.java
+++ b/src/com/vaadin/terminal/gwt/server/ApplicationPortlet2.java
@@ -23,10 +23,8 @@ public class ApplicationPortlet2 extends AbstractApplicationPortlet {
public void init(PortletConfig config) throws PortletException {
super.init(config);
try {
- applicationClass = ServletPortletHelper.getApplicationClass(
- config.getInitParameter("application"),
- config.getInitParameter(Application.ROOT_PARAMETER),
- getClassLoader());
+ applicationClass = ServletPortletHelper
+ .getApplicationClass(getDeploymentConfiguration());
} catch (ApplicationClassException e) {
throw new PortletException(e);
}
diff --git a/src/com/vaadin/terminal/gwt/server/ApplicationResourceHandler.java b/src/com/vaadin/terminal/gwt/server/ApplicationResourceHandler.java
index 7cf66d5fcf..42726c933e 100644
--- a/src/com/vaadin/terminal/gwt/server/ApplicationResourceHandler.java
+++ b/src/com/vaadin/terminal/gwt/server/ApplicationResourceHandler.java
@@ -21,6 +21,7 @@ public class ApplicationResourceHandler implements RequestHandler {
private static final Pattern APP_RESOURCE_PATTERN = Pattern
.compile("^/?APP/(\\d+)/.*");
+ @Override
public boolean handleRequest(Application application,
WrappedRequest request, WrappedResponse response)
throws IOException {
diff --git a/src/com/vaadin/terminal/gwt/server/ApplicationServlet.java b/src/com/vaadin/terminal/gwt/server/ApplicationServlet.java
index 2c4d38ef24..1af49e0da0 100644
--- a/src/com/vaadin/terminal/gwt/server/ApplicationServlet.java
+++ b/src/com/vaadin/terminal/gwt/server/ApplicationServlet.java
@@ -41,14 +41,12 @@ public class ApplicationServlet extends AbstractApplicationServlet {
throws javax.servlet.ServletException {
super.init(servletConfig);
- // Loads the application class using the same class loader
- // as the servlet itself
+ // Loads the application class using the classloader defined in the
+ // deployment configuration
try {
- applicationClass = ServletPortletHelper.getApplicationClass(
- servletConfig.getInitParameter("application"),
- servletConfig.getInitParameter(Application.ROOT_PARAMETER),
- getClassLoader());
+ applicationClass = ServletPortletHelper
+ .getApplicationClass(getDeploymentConfiguration());
} catch (ApplicationClassException e) {
throw new ServletException(e);
}
diff --git a/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java b/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java
index 69f033c8cd..4038b8f1bc 100644
--- a/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java
+++ b/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java
@@ -9,10 +9,6 @@ import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Serializable;
import java.io.Writer;
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
@@ -20,7 +16,6 @@ import javax.servlet.http.HttpServletResponse;
import com.vaadin.Application;
import com.vaadin.RootRequiresMoreInformationException;
import com.vaadin.Version;
-import com.vaadin.annotations.LoadScripts;
import com.vaadin.external.json.JSONException;
import com.vaadin.external.json.JSONObject;
import com.vaadin.terminal.DeploymentConfiguration;
@@ -118,6 +113,7 @@ public abstract class BootstrapHandler implements RequestHandler {
}
+ @Override
public boolean handleRequest(Application application,
WrappedRequest request, WrappedResponse response)
throws IOException {
@@ -490,50 +486,6 @@ public abstract class BootstrapHandler implements RequestHandler {
page.write("<title>"
+ AbstractApplicationServlet.safeEscapeForHtml(title)
+ "</title>\n");
-
- if (root != null) {
- List<LoadScripts> loadScriptsAnnotations = getAnnotationsFor(
- root.getClass(), LoadScripts.class);
- Collections.reverse(loadScriptsAnnotations);
- // Begin from the end as a class might requests scripts that depend
- // on script loaded by a super class
- for (int i = loadScriptsAnnotations.size() - 1; i >= 0; i--) {
- LoadScripts loadScripts = loadScriptsAnnotations.get(i);
- String[] value = loadScripts.value();
- if (value != null) {
- for (String script : value) {
- page.write("<script type='text/javascript' src='");
- page.write(script);
- page.write("'></script>\n");
- }
- }
- }
-
- }
- }
-
- private static <T extends Annotation> List<T> getAnnotationsFor(
- Class<?> type, Class<T> annotationType) {
- List<T> list = new ArrayList<T>();
- // Find from the class hierarchy
- Class<?> currentType = type;
- while (currentType != Object.class) {
- T annotation = currentType.getAnnotation(annotationType);
- if (annotation != null) {
- list.add(annotation);
- }
- currentType = currentType.getSuperclass();
- }
-
- // Find from an implemented interface
- for (Class<?> iface : type.getInterfaces()) {
- T annotation = iface.getAnnotation(annotationType);
- if (annotation != null) {
- list.add(annotation);
- }
- }
-
- return list;
}
/**
@@ -645,8 +597,10 @@ public abstract class BootstrapHandler implements RequestHandler {
* @return a string with the initial UIDL message
* @throws PaintException
* if an exception occurs while painting the components
+ * @throws JSONException
+ * if an exception occurs while formatting the output
*/
protected abstract String getInitialUIDL(WrappedRequest request, Root root)
- throws PaintException;
+ throws PaintException, JSONException;
}
diff --git a/src/com/vaadin/terminal/gwt/server/ChangeVariablesErrorEvent.java b/src/com/vaadin/terminal/gwt/server/ChangeVariablesErrorEvent.java
index b6576dce9f..8f0c80332f 100644
--- a/src/com/vaadin/terminal/gwt/server/ChangeVariablesErrorEvent.java
+++ b/src/com/vaadin/terminal/gwt/server/ChangeVariablesErrorEvent.java
@@ -23,6 +23,7 @@ public class ChangeVariablesErrorEvent implements ComponentErrorEvent {
this.variableChanges = variableChanges;
}
+ @Override
public Throwable getThrowable() {
return throwable;
}
diff --git a/src/com/vaadin/terminal/gwt/server/ClientConnector.java b/src/com/vaadin/terminal/gwt/server/ClientConnector.java
index dfdd58879d..4f74cfe4bb 100644
--- a/src/com/vaadin/terminal/gwt/server/ClientConnector.java
+++ b/src/com/vaadin/terminal/gwt/server/ClientConnector.java
@@ -6,12 +6,13 @@ package com.vaadin.terminal.gwt.server;
import java.util.Collection;
import java.util.List;
+import com.vaadin.shared.Connector;
+import com.vaadin.shared.communication.SharedState;
import com.vaadin.terminal.AbstractClientConnector;
import com.vaadin.terminal.Extension;
-import com.vaadin.terminal.gwt.client.Connector;
-import com.vaadin.terminal.gwt.client.communication.SharedState;
import com.vaadin.ui.Component;
import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Root;
/**
* Interface implemented by all connectors that are capable of communicating
@@ -47,6 +48,7 @@ public interface ClientConnector extends Connector, RpcTarget {
*/
public Class<? extends SharedState> getStateType();
+ @Override
public ClientConnector getParent();
/**
@@ -136,4 +138,12 @@ public interface ClientConnector extends Connector, RpcTarget {
* the extension to remove.
*/
public void removeExtension(Extension extension);
+
+ /**
+ * Returns the root this connector is attached to
+ *
+ * @return The Root this connector is attached to or null if it is not
+ * attached to any Root
+ */
+ public Root getRoot();
}
diff --git a/src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java b/src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java
index ad9484723b..64ea288665 100644
--- a/src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java
+++ b/src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java
@@ -61,6 +61,7 @@ public class ClientMethodInvocation implements Serializable,
return sequenceNumber;
}
+ @Override
public int compareTo(ClientMethodInvocation o) {
if (null == o) {
return 0;
diff --git a/src/com/vaadin/terminal/gwt/server/CommunicationManager.java b/src/com/vaadin/terminal/gwt/server/CommunicationManager.java
index cc2981dc45..3cc3a8cb64 100644
--- a/src/com/vaadin/terminal/gwt/server/CommunicationManager.java
+++ b/src/com/vaadin/terminal/gwt/server/CommunicationManager.java
@@ -4,22 +4,15 @@
package com.vaadin.terminal.gwt.server;
-import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.UUID;
import javax.servlet.ServletContext;
import com.vaadin.Application;
+import com.vaadin.external.json.JSONException;
import com.vaadin.terminal.PaintException;
-import com.vaadin.terminal.StreamVariable;
import com.vaadin.terminal.WrappedRequest;
-import com.vaadin.terminal.WrappedResponse;
-import com.vaadin.terminal.gwt.client.Connector;
import com.vaadin.ui.Root;
/**
@@ -58,142 +51,6 @@ public class CommunicationManager extends AbstractCommunicationManager {
super(application);
}
- /**
- * Handles file upload request submitted via Upload component.
- *
- * @param root
- * The root for this request
- *
- * @see #getStreamVariableTargetUrl(ReceiverOwner, String, StreamVariable)
- *
- * @param request
- * @param response
- * @throws IOException
- * @throws InvalidUIDLSecurityKeyException
- */
- public void handleFileUpload(Root root, WrappedRequest request,
- WrappedResponse response) throws IOException,
- InvalidUIDLSecurityKeyException {
-
- /*
- * URI pattern: APP/UPLOAD/[PID]/[NAME]/[SECKEY] See #createReceiverUrl
- */
-
- String pathInfo = request.getRequestPathInfo();
- // strip away part until the data we are interested starts
- int startOfData = pathInfo
- .indexOf(AbstractApplicationServlet.UPLOAD_URL_PREFIX)
- + AbstractApplicationServlet.UPLOAD_URL_PREFIX.length();
- String uppUri = pathInfo.substring(startOfData);
- String[] parts = uppUri.split("/", 3); // 0 = pid, 1= name, 2 = sec key
- String variableName = parts[1];
- String connectorId = parts[0];
-
- StreamVariable streamVariable = pidToNameToStreamVariable.get(
- connectorId).get(variableName);
- String secKey = streamVariableToSeckey.get(streamVariable);
- if (secKey.equals(parts[2])) {
-
- Connector source = getConnector(root, connectorId);
- String contentType = request.getContentType();
- if (contentType.contains("boundary")) {
- // Multipart requests contain boundary string
- doHandleSimpleMultipartFileUpload(request, response,
- streamVariable, variableName, source,
- contentType.split("boundary=")[1]);
- } else {
- // if boundary string does not exist, the posted file is from
- // XHR2.post(File)
- doHandleXhrFilePost(request, response, streamVariable,
- variableName, source, request.getContentLength());
- }
- } else {
- throw new InvalidUIDLSecurityKeyException(
- "Security key in upload post did not match!");
- }
-
- }
-
- @Override
- protected void postPaint(Root root) {
- super.postPaint(root);
-
- if (pidToNameToStreamVariable != null) {
- Iterator<String> iterator = pidToNameToStreamVariable.keySet()
- .iterator();
- while (iterator.hasNext()) {
- String connectorId = iterator.next();
- if (root.getConnectorTracker().getConnector(connectorId) == null) {
- // Owner is no longer attached to the application
- Map<String, StreamVariable> removed = pidToNameToStreamVariable
- .get(connectorId);
- for (String key : removed.keySet()) {
- streamVariableToSeckey.remove(removed.get(key));
- }
- iterator.remove();
- }
- }
- }
-
- }
-
- private Map<String, Map<String, StreamVariable>> pidToNameToStreamVariable;
-
- private Map<StreamVariable, String> streamVariableToSeckey;
-
- @Override
- String getStreamVariableTargetUrl(Connector owner, String name,
- StreamVariable value) {
- /*
- * We will use the same APP/* URI space as ApplicationResources but
- * prefix url with UPLOAD
- *
- * eg. APP/UPLOAD/[PID]/[NAME]/[SECKEY]
- *
- * SECKEY is created on each paint to make URL's unpredictable (to
- * prevent CSRF attacks).
- *
- * NAME and PID from URI forms a key to fetch StreamVariable when
- * handling post
- */
- String paintableId = owner.getConnectorId();
- String key = paintableId + "/" + name;
-
- if (pidToNameToStreamVariable == null) {
- pidToNameToStreamVariable = new HashMap<String, Map<String, StreamVariable>>();
- }
- Map<String, StreamVariable> nameToStreamVariable = pidToNameToStreamVariable
- .get(paintableId);
- if (nameToStreamVariable == null) {
- nameToStreamVariable = new HashMap<String, StreamVariable>();
- pidToNameToStreamVariable.put(paintableId, nameToStreamVariable);
- }
- nameToStreamVariable.put(name, value);
-
- if (streamVariableToSeckey == null) {
- streamVariableToSeckey = new HashMap<StreamVariable, String>();
- }
- String seckey = streamVariableToSeckey.get(value);
- if (seckey == null) {
- seckey = UUID.randomUUID().toString();
- streamVariableToSeckey.put(value, seckey);
- }
-
- return "app://" + AbstractApplicationServlet.UPLOAD_URL_PREFIX + key
- + "/" + seckey;
-
- }
-
- @Override
- protected void cleanStreamVariable(Connector owner, String name) {
- Map<String, StreamVariable> nameToStreamVar = pidToNameToStreamVariable
- .get(owner.getConnectorId());
- nameToStreamVar.remove("name");
- if (nameToStreamVar.isEmpty()) {
- pidToNameToStreamVariable.remove(owner.getConnectorId());
- }
- }
-
@Override
protected BootstrapHandler createBootstrapHandler() {
return new BootstrapHandler() {
@@ -245,7 +102,7 @@ public class CommunicationManager extends AbstractCommunicationManager {
@Override
protected String getInitialUIDL(WrappedRequest request, Root root)
- throws PaintException {
+ throws PaintException, JSONException {
return CommunicationManager.this.getInitialUIDL(request, root);
}
};
diff --git a/src/com/vaadin/terminal/gwt/server/Constants.java b/src/com/vaadin/terminal/gwt/server/Constants.java
index 9e6b2c775b..7efb0205ac 100644
--- a/src/com/vaadin/terminal/gwt/server/Constants.java
+++ b/src/com/vaadin/terminal/gwt/server/Constants.java
@@ -54,8 +54,6 @@ public interface Constants {
static final int MAX_BUFFER_SIZE = 64 * 1024;
- static final String AJAX_UIDL_URI = "/UIDL";
-
final String THEME_DIRECTORY_PATH = "VAADIN/themes/";
static final int DEFAULT_THEME_CACHETIME = 1000 * 60 * 60 * 24;
diff --git a/src/com/vaadin/terminal/gwt/server/DragAndDropService.java b/src/com/vaadin/terminal/gwt/server/DragAndDropService.java
index 0e8d1c0152..efb5666efa 100644
--- a/src/com/vaadin/terminal/gwt/server/DragAndDropService.java
+++ b/src/com/vaadin/terminal/gwt/server/DragAndDropService.java
@@ -19,13 +19,14 @@ import com.vaadin.event.dd.DropTarget;
import com.vaadin.event.dd.TargetDetails;
import com.vaadin.event.dd.TargetDetailsImpl;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
+import com.vaadin.shared.communication.SharedState;
+import com.vaadin.shared.ui.dd.DragEventType;
import com.vaadin.terminal.Extension;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.VariableOwner;
-import com.vaadin.terminal.gwt.client.communication.SharedState;
import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager;
-import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager.DragEventType;
import com.vaadin.ui.Component;
+import com.vaadin.ui.Root;
public class DragAndDropService implements VariableOwner, ClientConnector {
@@ -43,6 +44,7 @@ public class DragAndDropService implements VariableOwner, ClientConnector {
this.manager = manager;
}
+ @Override
public void changeVariables(Object source, Map<String, Object> variables) {
Object owner = variables.get("dhowner");
@@ -181,10 +183,12 @@ public class DragAndDropService implements VariableOwner, ClientConnector {
return transferable;
}
+ @Override
public boolean isEnabled() {
return isConnectorEnabled();
}
+ @Override
public boolean isImmediate() {
return true;
}
@@ -218,68 +222,82 @@ public class DragAndDropService implements VariableOwner, ClientConnector {
return false;
}
+ @Override
public SharedState getState() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getConnectorId() {
return VDragAndDropManager.DD_SERVICE;
}
+ @Override
public boolean isConnectorEnabled() {
// Drag'n'drop can't be disabled
return true;
}
+ @Override
public List<ClientMethodInvocation> retrievePendingRpcCalls() {
return null;
}
+ @Override
public RpcManager getRpcManager(Class<?> rpcInterface) {
// TODO Use rpc for drag'n'drop
return null;
}
+ @Override
public Class<? extends SharedState> getStateType() {
return SharedState.class;
}
+ @Override
public void requestRepaint() {
// TODO Auto-generated method stub
}
+ @Override
public ClientConnector getParent() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public void requestRepaintAll() {
// TODO Auto-generated method stub
}
+ @Override
public void setParent(ClientConnector parent) {
// TODO Auto-generated method stub
}
+ @Override
public void attach() {
// TODO Auto-generated method stub
}
+ @Override
public void detach() {
// TODO Auto-generated method stub
}
+ @Override
public Collection<Extension> getExtensions() {
// TODO Auto-generated method stub
return Collections.emptySet();
}
+ @Override
public void removeExtension(Extension extension) {
// TODO Auto-generated method stub
}
@@ -287,4 +305,9 @@ public class DragAndDropService implements VariableOwner, ClientConnector {
private Logger getLogger() {
return Logger.getLogger(DragAndDropService.class.getName());
}
+
+ @Override
+ public Root getRoot() {
+ return null;
+ }
}
diff --git a/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java b/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java
index a6032fa98d..cc12c9cc43 100644
--- a/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java
+++ b/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java
@@ -121,8 +121,9 @@ public class GAEApplicationServlet extends ApplicationServlet {
// appengine session expires-parameter
private static final String PROPERTY_APPENGINE_EXPIRES = "_expires";
- protected void sendDeadlineExceededNotification(HttpServletRequest request,
- HttpServletResponse response) throws IOException {
+ protected void sendDeadlineExceededNotification(
+ WrappedHttpServletRequest request,
+ WrappedHttpServletResponse response) throws IOException {
criticalNotification(
request,
response,
@@ -131,8 +132,9 @@ public class GAEApplicationServlet extends ApplicationServlet {
"", null);
}
- protected void sendNotSerializableNotification(HttpServletRequest request,
- HttpServletResponse response) throws IOException {
+ protected void sendNotSerializableNotification(
+ WrappedHttpServletRequest request,
+ WrappedHttpServletResponse response) throws IOException {
criticalNotification(
request,
response,
@@ -142,8 +144,9 @@ public class GAEApplicationServlet extends ApplicationServlet {
+ "?restartApplication");
}
- protected void sendCriticalErrorNotification(HttpServletRequest request,
- HttpServletResponse response) throws IOException {
+ protected void sendCriticalErrorNotification(
+ WrappedHttpServletRequest request,
+ WrappedHttpServletResponse response) throws IOException {
criticalNotification(
request,
response,
@@ -154,8 +157,13 @@ public class GAEApplicationServlet extends ApplicationServlet {
}
@Override
- protected void service(HttpServletRequest request,
- HttpServletResponse response) throws ServletException, IOException {
+ protected void service(HttpServletRequest unwrappedRequest,
+ HttpServletResponse unwrappedResponse) throws ServletException,
+ IOException {
+ WrappedHttpServletRequest request = new WrappedHttpServletRequest(
+ unwrappedRequest, getDeploymentConfiguration());
+ WrappedHttpServletResponse response = new WrappedHttpServletResponse(
+ unwrappedResponse, getDeploymentConfiguration());
if (isCleanupRequest(request)) {
cleanDatastore();
diff --git a/src/com/vaadin/terminal/gwt/server/JsonCodec.java b/src/com/vaadin/terminal/gwt/server/JsonCodec.java
index d3a2ef56f8..8199bc6ada 100644
--- a/src/com/vaadin/terminal/gwt/server/JsonCodec.java
+++ b/src/com/vaadin/terminal/gwt/server/JsonCodec.java
@@ -9,10 +9,12 @@ import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.Serializable;
import java.lang.reflect.Array;
+import java.lang.reflect.GenericArrayType;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
+import java.lang.reflect.WildcardType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -27,9 +29,9 @@ import java.util.Set;
import com.vaadin.external.json.JSONArray;
import com.vaadin.external.json.JSONException;
import com.vaadin.external.json.JSONObject;
-import com.vaadin.terminal.gwt.client.Connector;
+import com.vaadin.shared.Connector;
+import com.vaadin.shared.communication.UidlValue;
import com.vaadin.terminal.gwt.client.communication.JsonEncoder;
-import com.vaadin.terminal.gwt.client.communication.UidlValue;
import com.vaadin.ui.Component;
import com.vaadin.ui.ConnectorTracker;
@@ -100,8 +102,10 @@ public class JsonCodec implements Serializable {
private static Class<?> getClassForType(Type type) {
if (type instanceof ParameterizedType) {
return (Class<?>) (((ParameterizedType) type).getRawType());
- } else {
+ } else if (type instanceof Class<?>) {
return (Class<?>) type;
+ } else {
+ return null;
}
}
@@ -138,7 +142,13 @@ public class JsonCodec implements Serializable {
&& ((Class<?>) targetType).isArray()) {
// Legacy Object[] and String[] handled elsewhere, this takes care
// of generic arrays
- return decodeArray((Class<?>) targetType, (JSONArray) value,
+ Class<?> componentType = ((Class<?>) targetType).getComponentType();
+ return decodeArray(componentType, (JSONArray) value,
+ connectorTracker);
+ } else if (targetType instanceof GenericArrayType) {
+ Type componentType = ((GenericArrayType) targetType)
+ .getGenericComponentType();
+ return decodeArray(componentType, (JSONArray) value,
connectorTracker);
} else if (targetType == JSONObject.class
|| targetType == JSONArray.class) {
@@ -149,10 +159,10 @@ public class JsonCodec implements Serializable {
}
}
- private static Object decodeArray(Class<?> targetType, JSONArray value,
+ private static Object decodeArray(Type componentType, JSONArray value,
ConnectorTracker connectorTracker) throws JSONException {
- Class<?> componentType = targetType.getComponentType();
- Object array = Array.newInstance(componentType, value.length());
+ Class<?> componentClass = getClassForType(componentType);
+ Object array = Array.newInstance(componentClass, value.length());
for (int i = 0; i < value.length(); i++) {
Object decodedValue = decodeInternalOrCustomType(componentType,
value.get(i), connectorTracker);
@@ -513,6 +523,11 @@ public class JsonCodec implements Serializable {
throw new IllegalArgumentException("type must be defined");
}
+ if (valueType instanceof WildcardType) {
+ throw new IllegalStateException(
+ "Can not serialize type with wildcard: " + valueType);
+ }
+
if (null == value) {
return encodeNull();
}
@@ -540,7 +555,15 @@ public class JsonCodec implements Serializable {
return jsonArray;
} else if (valueType instanceof Class<?>
&& ((Class<?>) valueType).isArray()) {
- JSONArray jsonArray = encodeArrayContents(value, connectorTracker);
+ JSONArray jsonArray = encodeArrayContents(
+ ((Class<?>) valueType).getComponentType(), value,
+ connectorTracker);
+ return jsonArray;
+ } else if (valueType instanceof GenericArrayType) {
+ Type componentType = ((GenericArrayType) valueType)
+ .getGenericComponentType();
+ JSONArray jsonArray = encodeArrayContents(componentType, value,
+ connectorTracker);
return jsonArray;
} else if (value instanceof Map) {
Object jsonMap = encodeMap(valueType, (Map<?, ?>) value,
@@ -643,10 +666,10 @@ public class JsonCodec implements Serializable {
return e.name();
}
- private static JSONArray encodeArrayContents(Object array,
- ConnectorTracker connectorTracker) throws JSONException {
+ private static JSONArray encodeArrayContents(Type componentType,
+ Object array, ConnectorTracker connectorTracker)
+ throws JSONException {
JSONArray jsonArray = new JSONArray();
- Class<?> componentType = array.getClass().getComponentType();
for (int i = 0; i < Array.getLength(array); i++) {
jsonArray.put(encode(Array.get(array, i), null, componentType,
connectorTracker));
diff --git a/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java b/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java
index 70ab452e4e..5a830ddb63 100644
--- a/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java
+++ b/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java
@@ -15,16 +15,11 @@ import java.util.Stack;
import java.util.Vector;
import java.util.logging.Logger;
-import com.vaadin.Application;
-import com.vaadin.terminal.ApplicationResource;
-import com.vaadin.terminal.ExternalResource;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Resource;
import com.vaadin.terminal.StreamVariable;
-import com.vaadin.terminal.ThemeResource;
import com.vaadin.terminal.VariableOwner;
-import com.vaadin.terminal.gwt.client.Connector;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Component;
import com.vaadin.ui.CustomLayout;
@@ -104,6 +99,7 @@ public class JsonPaintTarget implements PaintTarget {
cacheEnabled = cachingRequired;
}
+ @Override
public void startTag(String tagName) throws PaintException {
startTag(tagName, false);
}
@@ -160,6 +156,7 @@ public class JsonPaintTarget implements PaintTarget {
* if the paint operation failed.
*/
+ @Override
public void endTag(String tagName) throws PaintException {
// In case of null data output nothing:
if (tagName == null) {
@@ -327,59 +324,46 @@ public class JsonPaintTarget implements PaintTarget {
*
*/
+ @Override
public void addText(String str) throws PaintException {
tag.addData("\"" + escapeJSON(str) + "\"");
}
+ @Override
public void addAttribute(String name, boolean value) throws PaintException {
tag.addAttribute("\"" + name + "\":" + (value ? "true" : "false"));
}
- @SuppressWarnings("deprecation")
+ @Override
public void addAttribute(String name, Resource value) throws PaintException {
-
- if (value instanceof ExternalResource) {
- addAttribute(name, ((ExternalResource) value).getURL());
-
- } else if (value instanceof ApplicationResource) {
- final ApplicationResource r = (ApplicationResource) value;
- final Application a = r.getApplication();
- if (a == null) {
- throw new PaintException(
- "Application not specified for resorce "
- + value.getClass().getName());
- }
- final String uri = a.getRelativeLocation(r);
- addAttribute(name, uri);
-
- } else if (value instanceof ThemeResource) {
- final String uri = "theme://"
- + ((ThemeResource) value).getResourceId();
- addAttribute(name, uri);
- } else {
- throw new PaintException("Ajax adapter does not "
- + "support resources of type: "
- + value.getClass().getName());
+ if (value == null) {
+ throw new NullPointerException();
}
-
+ ResourceReference reference = ResourceReference.create(value);
+ addAttribute(name, reference.getURL());
}
+ @Override
public void addAttribute(String name, int value) throws PaintException {
tag.addAttribute("\"" + name + "\":" + String.valueOf(value));
}
+ @Override
public void addAttribute(String name, long value) throws PaintException {
tag.addAttribute("\"" + name + "\":" + String.valueOf(value));
}
+ @Override
public void addAttribute(String name, float value) throws PaintException {
tag.addAttribute("\"" + name + "\":" + String.valueOf(value));
}
+ @Override
public void addAttribute(String name, double value) throws PaintException {
tag.addAttribute("\"" + name + "\":" + String.valueOf(value));
}
+ @Override
public void addAttribute(String name, String value) throws PaintException {
// In case of null data output nothing:
if ((value == null) || (name == null)) {
@@ -399,12 +383,14 @@ public class JsonPaintTarget implements PaintTarget {
}
+ @Override
public void addAttribute(String name, Component value)
throws PaintException {
final String id = value.getConnectorId();
addAttribute(name, id);
}
+ @Override
public void addAttribute(String name, Map<?, ?> value)
throws PaintException {
@@ -442,6 +428,7 @@ public class JsonPaintTarget implements PaintTarget {
tag.addAttribute(sb.toString());
}
+ @Override
public void addAttribute(String name, Object[] values) {
// In case of null data output nothing:
if ((values == null) || (name == null)) {
@@ -462,41 +449,49 @@ public class JsonPaintTarget implements PaintTarget {
tag.addAttribute(buf.toString());
}
+ @Override
public void addVariable(VariableOwner owner, String name, String value)
throws PaintException {
tag.addVariable(new StringVariable(owner, name, escapeJSON(value)));
}
+ @Override
public void addVariable(VariableOwner owner, String name, Component value)
throws PaintException {
tag.addVariable(new StringVariable(owner, name, value.getConnectorId()));
}
+ @Override
public void addVariable(VariableOwner owner, String name, int value)
throws PaintException {
tag.addVariable(new IntVariable(owner, name, value));
}
+ @Override
public void addVariable(VariableOwner owner, String name, long value)
throws PaintException {
tag.addVariable(new LongVariable(owner, name, value));
}
+ @Override
public void addVariable(VariableOwner owner, String name, float value)
throws PaintException {
tag.addVariable(new FloatVariable(owner, name, value));
}
+ @Override
public void addVariable(VariableOwner owner, String name, double value)
throws PaintException {
tag.addVariable(new DoubleVariable(owner, name, value));
}
+ @Override
public void addVariable(VariableOwner owner, String name, boolean value)
throws PaintException {
tag.addVariable(new BooleanVariable(owner, name, value));
}
+ @Override
public void addVariable(VariableOwner owner, String name, String[] value)
throws PaintException {
tag.addVariable(new ArrayVariable(owner, name, value));
@@ -516,6 +511,7 @@ public class JsonPaintTarget implements PaintTarget {
* if the paint operation failed.
*/
+ @Override
public void addUploadStreamVariable(VariableOwner owner, String name)
throws PaintException {
startTag("uploadstream");
@@ -536,6 +532,7 @@ public class JsonPaintTarget implements PaintTarget {
* if the paint operation failed.
*/
+ @Override
public void addSection(String sectionTagName, String sectionData)
throws PaintException {
tag.addData("{\"" + sectionTagName + "\":\"" + escapeJSON(sectionData)
@@ -551,6 +548,7 @@ public class JsonPaintTarget implements PaintTarget {
* if the paint operation failed.
*/
+ @Override
public void addUIDL(String xml) throws PaintException {
// Ensure that the target is open
@@ -585,6 +583,7 @@ public class JsonPaintTarget implements PaintTarget {
* String)
*/
+ @Override
public void addXMLSection(String sectionTagName, String sectionData,
String namespace) throws PaintException {
@@ -650,6 +649,7 @@ public class JsonPaintTarget implements PaintTarget {
* .Paintable, java.lang.String)
*/
+ @Override
public PaintStatus startPaintable(Component connector, String tagName)
throws PaintException {
boolean topLevelPaintable = openPaintables.isEmpty();
@@ -676,6 +676,7 @@ public class JsonPaintTarget implements PaintTarget {
return PaintStatus.PAINTING;
}
+ @Override
public void endPaintable(Component paintable) throws PaintException {
getLogger().fine(
"endPaintable for " + paintable.getClass().getName() + "@"
@@ -699,6 +700,7 @@ public class JsonPaintTarget implements PaintTarget {
* @see com.vaadin.terminal.PaintTarget#addCharacterData(java.lang.String )
*/
+ @Override
public void addCharacterData(String text) throws PaintException {
if (text != null) {
tag.addData(text);
@@ -968,6 +970,7 @@ public class JsonPaintTarget implements PaintTarget {
return usedResources;
}
+ @Override
@SuppressWarnings("unchecked")
public String getTag(ClientConnector clientConnector) {
Class<? extends ClientConnector> clientConnectorClass = clientConnector
@@ -990,10 +993,11 @@ public class JsonPaintTarget implements PaintTarget {
return usedClientConnectors;
}
+ @Override
public void addVariable(VariableOwner owner, String name,
StreamVariable value) throws PaintException {
- String url = manager.getStreamVariableTargetUrl((Connector) owner,
- name, value);
+ String url = manager.getStreamVariableTargetUrl(
+ (ClientConnector) owner, name, value);
if (url != null) {
addVariable(owner, name, url);
} // else { //NOP this was just a cleanup by component }
@@ -1006,6 +1010,7 @@ public class JsonPaintTarget implements PaintTarget {
* @see com.vaadin.terminal.PaintTarget#isFullRepaint()
*/
+ @Override
public boolean isFullRepaint() {
return !cacheEnabled;
}
diff --git a/src/com/vaadin/terminal/gwt/server/LegacyChangeVariablesInvocation.java b/src/com/vaadin/terminal/gwt/server/LegacyChangeVariablesInvocation.java
index 42fa3ab5a5..9dba05d2c1 100644
--- a/src/com/vaadin/terminal/gwt/server/LegacyChangeVariablesInvocation.java
+++ b/src/com/vaadin/terminal/gwt/server/LegacyChangeVariablesInvocation.java
@@ -6,8 +6,8 @@ package com.vaadin.terminal.gwt.server;
import java.util.HashMap;
import java.util.Map;
+import com.vaadin.shared.communication.MethodInvocation;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.communication.MethodInvocation;
public class LegacyChangeVariablesInvocation extends MethodInvocation {
private Map<String, Object> variableChanges = new HashMap<String, Object>();
diff --git a/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java b/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java
index de4f918b75..70505ab5f9 100644
--- a/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java
+++ b/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java
@@ -28,13 +28,12 @@ import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.ResourceRequest;
import javax.portlet.ResourceResponse;
-import javax.portlet.ResourceURL;
import javax.portlet.StateAwareResponse;
import javax.servlet.http.HttpSessionBindingListener;
import javax.xml.namespace.QName;
import com.vaadin.Application;
-import com.vaadin.terminal.ApplicationResource;
+import com.vaadin.terminal.ExternalResource;
import com.vaadin.ui.Root;
/**
@@ -63,6 +62,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext {
private final Map<String, String> sharedParameterActionNameMap = new HashMap<String, String>();
private final Map<String, String> sharedParameterActionValueMap = new HashMap<String, String>();
+ @Override
public File getBaseDirectory() {
String resultPath = session.getPortletContext().getRealPath("/");
if (resultPath != null) {
@@ -253,27 +253,6 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext {
this.response = response;
}
- @Override
- public String generateApplicationResourceURL(ApplicationResource resource,
- String mapKey) {
- if (response instanceof MimeResponse) {
- ResourceURL resourceURL = ((MimeResponse) response)
- .createResourceURL();
- final String filename = resource.getFilename();
- if (filename == null) {
- resourceURL.setResourceID("APP/" + mapKey + "/");
- } else {
- resourceURL.setResourceID("APP/" + mapKey + "/"
- + urlEncode(filename));
- }
- return resourceURL.toString();
- } else {
- // in a background thread or otherwise outside a request
- // TODO exception ??
- return null;
- }
- }
-
/**
* Creates a new action URL.
*
@@ -324,9 +303,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext {
if (actionUrl != null) {
eventActionDestinationMap.put(actionKey, name);
eventActionValueMap.put(actionKey, value);
- throw new RuntimeException(
- "Root.open has not yet been implemented");
- // root.open(new ExternalResource(actionUrl.toString()));
+ root.getPage().open(new ExternalResource(actionUrl.toString()));
} else {
// this should never happen as we already know the response is a
// MimeResponse
@@ -372,9 +349,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext {
if (actionUrl != null) {
sharedParameterActionNameMap.put(actionKey, name);
sharedParameterActionValueMap.put(actionKey, value);
- throw new RuntimeException(
- "Root.open has not yet been implemented");
- // root.open(new ExternalResource(actionUrl.toString()));
+ root.getPage().open(new ExternalResource(actionUrl.toString()));
} else {
// this should never happen as we already know the response is a
// MimeResponse
diff --git a/src/com/vaadin/terminal/gwt/server/PortletCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/PortletCommunicationManager.java
index d3fbf4d988..edd970a31f 100644
--- a/src/com/vaadin/terminal/gwt/server/PortletCommunicationManager.java
+++ b/src/com/vaadin/terminal/gwt/server/PortletCommunicationManager.java
@@ -5,9 +5,6 @@ package com.vaadin.terminal.gwt.server;
import java.io.IOException;
import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
import javax.portlet.MimeResponse;
import javax.portlet.PortletContext;
@@ -22,10 +19,9 @@ import com.vaadin.external.json.JSONException;
import com.vaadin.external.json.JSONObject;
import com.vaadin.terminal.DeploymentConfiguration;
import com.vaadin.terminal.PaintException;
-import com.vaadin.terminal.StreamVariable;
import com.vaadin.terminal.WrappedRequest;
import com.vaadin.terminal.WrappedResponse;
-import com.vaadin.terminal.gwt.client.Connector;
+import com.vaadin.terminal.gwt.client.ApplicationConfiguration;
import com.vaadin.ui.Root;
/**
@@ -37,131 +33,10 @@ import com.vaadin.ui.Root;
@SuppressWarnings("serial")
public class PortletCommunicationManager extends AbstractCommunicationManager {
- private transient MimeResponse currentMimeResponse;
-
public PortletCommunicationManager(Application application) {
super(application);
}
- public void handleFileUpload(Root root, WrappedRequest request,
- WrappedResponse response) throws IOException {
- String contentType = request.getContentType();
- String name = request.getParameter("name");
- String ownerId = request.getParameter("rec-owner");
- Connector owner = getConnector(root, ownerId);
- StreamVariable streamVariable = ownerToNameToStreamVariable.get(owner)
- .get(name);
-
- if (contentType.contains("boundary")) {
- doHandleSimpleMultipartFileUpload(request, response,
- streamVariable, name, owner,
- contentType.split("boundary=")[1]);
- } else {
- doHandleXhrFilePost(request, response, streamVariable, name, owner,
- request.getContentLength());
- }
-
- }
-
- @Override
- protected void postPaint(Root root) {
- super.postPaint(root);
-
- Application application = root.getApplication();
- if (ownerToNameToStreamVariable != null) {
- Iterator<Connector> iterator = ownerToNameToStreamVariable.keySet()
- .iterator();
- while (iterator.hasNext()) {
- Connector owner = iterator.next();
- if (getConnector(root, owner.getConnectorId()) == null) {
- // Owner is no longer attached to the application
- iterator.remove();
- }
- }
- }
- }
-
- @Override
- protected boolean handleApplicationRequest(WrappedRequest request,
- WrappedResponse response) throws IOException {
- setCurrentMimeReponse(response);
- try {
- return super.handleApplicationRequest(request, response);
- } finally {
- currentMimeResponse = null;
- }
- }
-
- private void setCurrentMimeReponse(WrappedResponse response) {
- PortletResponse portletResponse = ((WrappedPortletResponse) response)
- .getPortletResponse();
- if (portletResponse instanceof MimeResponse) {
- currentMimeResponse = (MimeResponse) portletResponse;
- }
-
- }
-
- @Override
- public void handleUidlRequest(WrappedRequest request,
- WrappedResponse response, Callback callback, Root root)
- throws IOException, InvalidUIDLSecurityKeyException {
- setCurrentMimeReponse(response);
- super.handleUidlRequest(request, response, callback, root);
- currentMimeResponse = null;
- }
-
- @Override
- public void handleBrowserDetailsRequest(WrappedRequest request,
- WrappedResponse response, Application application)
- throws IOException {
- setCurrentMimeReponse(response);
- super.handleBrowserDetailsRequest(request, response, application);
- currentMimeResponse = null;
-
- }
-
- private Map<Connector, Map<String, StreamVariable>> ownerToNameToStreamVariable;
-
- @Override
- String getStreamVariableTargetUrl(Connector owner, String name,
- StreamVariable value) {
- if (ownerToNameToStreamVariable == null) {
- ownerToNameToStreamVariable = new HashMap<Connector, Map<String, StreamVariable>>();
- }
- Map<String, StreamVariable> nameToReceiver = ownerToNameToStreamVariable
- .get(owner);
- if (nameToReceiver == null) {
- nameToReceiver = new HashMap<String, StreamVariable>();
- ownerToNameToStreamVariable.put(owner, nameToReceiver);
- }
- nameToReceiver.put(name, value);
- ResourceURL resurl = createResourceURL();
- resurl.setResourceID("UPLOAD");
- resurl.setParameter("name", name);
- resurl.setParameter("rec-owner", owner.getConnectorId());
- resurl.setProperty("name", name);
- resurl.setProperty("rec-owner", owner.getConnectorId());
- return resurl.toString();
- }
-
- private ResourceURL createResourceURL() {
- if (currentMimeResponse == null) {
- throw new RuntimeException(
- "No reponse object available. Cannot create a resource URL");
- }
- return currentMimeResponse.createResourceURL();
- }
-
- @Override
- protected void cleanStreamVariable(Connector owner, String name) {
- Map<String, StreamVariable> map = ownerToNameToStreamVariable
- .get(owner);
- map.remove(name);
- if (map.isEmpty()) {
- ownerToNameToStreamVariable.remove(owner);
- }
- }
-
@Override
protected BootstrapHandler createBootstrapHandler() {
return new BootstrapHandler() {
@@ -211,12 +86,14 @@ public class PortletCommunicationManager extends AbstractCommunicationManager {
* some other things
*/
JSONObject defaults = super.getDefaultParameters(context);
- defaults.put("usePortletURLs", true);
- ResourceURL uidlUrlBase = getRenderResponse(context)
+ ResourceURL portletResourceUrl = getRenderResponse(context)
.createResourceURL();
- uidlUrlBase.setResourceID("UIDL");
- defaults.put("portletUidlURLBase", uidlUrlBase.toString());
+ portletResourceUrl
+ .setResourceID(AbstractApplicationPortlet.RESOURCE_URL_ID);
+ defaults.put(ApplicationConfiguration.PORTLET_RESOUCE_URL_BASE,
+ portletResourceUrl.toString());
+
defaults.put("pathInfo", "");
return defaults;
@@ -253,7 +130,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager {
@Override
protected String getInitialUIDL(WrappedRequest request, Root root)
- throws PaintException {
+ throws PaintException, JSONException {
return PortletCommunicationManager.this.getInitialUIDL(request,
root);
}
diff --git a/src/com/vaadin/terminal/gwt/server/ResourceReference.java b/src/com/vaadin/terminal/gwt/server/ResourceReference.java
index 56f2bed896..2104ad4b87 100644
--- a/src/com/vaadin/terminal/gwt/server/ResourceReference.java
+++ b/src/com/vaadin/terminal/gwt/server/ResourceReference.java
@@ -4,11 +4,11 @@
package com.vaadin.terminal.gwt.server;
import com.vaadin.Application;
+import com.vaadin.shared.communication.URLReference;
import com.vaadin.terminal.ApplicationResource;
import com.vaadin.terminal.ExternalResource;
import com.vaadin.terminal.Resource;
import com.vaadin.terminal.ThemeResource;
-import com.vaadin.terminal.gwt.client.communication.URLReference;
public class ResourceReference extends URLReference {
@@ -48,4 +48,20 @@ public class ResourceReference extends URLReference {
}
}
+
+ public static ResourceReference create(Resource resource) {
+ if (resource == null) {
+ return null;
+ } else {
+ return new ResourceReference(resource);
+ }
+ }
+
+ public static Resource getResource(URLReference reference) {
+ if (reference == null) {
+ return null;
+ }
+ assert reference instanceof ResourceReference;
+ return ((ResourceReference) reference).getResource();
+ }
}
diff --git a/src/com/vaadin/terminal/gwt/server/RestrictedRenderResponse.java b/src/com/vaadin/terminal/gwt/server/RestrictedRenderResponse.java
index c4ef3fc8e5..9fdffbf9a5 100644
--- a/src/com/vaadin/terminal/gwt/server/RestrictedRenderResponse.java
+++ b/src/com/vaadin/terminal/gwt/server/RestrictedRenderResponse.java
@@ -34,112 +34,137 @@ class RestrictedRenderResponse implements RenderResponse, Serializable {
this.response = response;
}
+ @Override
public void addProperty(String key, String value) {
response.addProperty(key, value);
}
+ @Override
public PortletURL createActionURL() {
return response.createActionURL();
}
+ @Override
public PortletURL createRenderURL() {
return response.createRenderURL();
}
+ @Override
public String encodeURL(String path) {
return response.encodeURL(path);
}
+ @Override
public void flushBuffer() throws IOException {
// NOP
// TODO throw?
}
+ @Override
public int getBufferSize() {
return response.getBufferSize();
}
+ @Override
public String getCharacterEncoding() {
return response.getCharacterEncoding();
}
+ @Override
public String getContentType() {
return response.getContentType();
}
+ @Override
public Locale getLocale() {
return response.getLocale();
}
+ @Override
public String getNamespace() {
return response.getNamespace();
}
+ @Override
public OutputStream getPortletOutputStream() throws IOException {
// write forbidden
return null;
}
+ @Override
public PrintWriter getWriter() throws IOException {
// write forbidden
return null;
}
+ @Override
public boolean isCommitted() {
return response.isCommitted();
}
+ @Override
public void reset() {
// NOP
// TODO throw?
}
+ @Override
public void resetBuffer() {
// NOP
// TODO throw?
}
+ @Override
public void setBufferSize(int size) {
// NOP
// TODO throw?
}
+ @Override
public void setContentType(String type) {
// NOP
// TODO throw?
}
+ @Override
public void setProperty(String key, String value) {
response.setProperty(key, value);
}
+ @Override
public void setTitle(String title) {
response.setTitle(title);
}
+ @Override
public void setNextPossiblePortletModes(Collection<PortletMode> portletModes) {
// NOP
// TODO throw?
}
+ @Override
public ResourceURL createResourceURL() {
return response.createResourceURL();
}
+ @Override
public CacheControl getCacheControl() {
return response.getCacheControl();
}
+ @Override
public void addProperty(Cookie cookie) {
// NOP
// TODO throw?
}
+ @Override
public void addProperty(String key, Element element) {
// NOP
// TODO throw?
}
+ @Override
public Element createElement(String tagName) throws DOMException {
// NOP
return null;
diff --git a/src/com/vaadin/terminal/gwt/server/ServerRpcManager.java b/src/com/vaadin/terminal/gwt/server/ServerRpcManager.java
index d9931a9610..1c7af82a36 100644
--- a/src/com/vaadin/terminal/gwt/server/ServerRpcManager.java
+++ b/src/com/vaadin/terminal/gwt/server/ServerRpcManager.java
@@ -12,7 +12,7 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
-import com.vaadin.terminal.gwt.client.Connector;
+import com.vaadin.shared.Connector;
/**
* Server side RPC manager that handles RPC calls coming from the client.
@@ -111,6 +111,7 @@ public class ServerRpcManager<T> implements RpcManager {
* @param invocation
* method invocation to perform
*/
+ @Override
public void applyInvocation(ServerRpcMethodInvocation invocation)
throws RpcInvocationException {
Method method = invocation.getMethod();
diff --git a/src/com/vaadin/terminal/gwt/server/ServerRpcMethodInvocation.java b/src/com/vaadin/terminal/gwt/server/ServerRpcMethodInvocation.java
index 95565c4379..ff81a27596 100644
--- a/src/com/vaadin/terminal/gwt/server/ServerRpcMethodInvocation.java
+++ b/src/com/vaadin/terminal/gwt/server/ServerRpcMethodInvocation.java
@@ -7,8 +7,8 @@ import java.lang.reflect.Method;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import com.vaadin.terminal.gwt.client.communication.MethodInvocation;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
+import com.vaadin.shared.communication.MethodInvocation;
+import com.vaadin.shared.communication.ServerRpc;
public class ServerRpcMethodInvocation extends MethodInvocation {
diff --git a/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java b/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java
index 9b1e60e621..b2b962b0fd 100644
--- a/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java
+++ b/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java
@@ -3,6 +3,9 @@ package com.vaadin.terminal.gwt.server;
import java.io.Serializable;
import com.vaadin.Application;
+import com.vaadin.terminal.DeploymentConfiguration;
+import com.vaadin.terminal.WrappedRequest;
+import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.ui.Root;
/*
@@ -10,6 +13,8 @@ import com.vaadin.ui.Root;
*/
class ServletPortletHelper implements Serializable {
+ public static final String UPLOAD_URL_PREFIX = "APP/UPLOAD/";
+
public static class ApplicationClassException extends Exception {
public ApplicationClassException(String message, Throwable cause) {
@@ -22,8 +27,15 @@ class ServletPortletHelper implements Serializable {
}
static Class<? extends Application> getApplicationClass(
- String applicationParameter, String rootParameter,
- ClassLoader classLoader) throws ApplicationClassException {
+ DeploymentConfiguration deploymentConfiguration)
+ throws ApplicationClassException {
+ String applicationParameter = deploymentConfiguration
+ .getInitParameters().getProperty("application");
+ String rootParameter = deploymentConfiguration
+ .getInitParameters().getProperty(
+ Application.ROOT_PARAMETER);
+ ClassLoader classLoader = deploymentConfiguration.getClassLoader();
+
if (applicationParameter == null) {
// Validate the parameter value
@@ -70,4 +82,40 @@ class ServletPortletHelper implements Serializable {
+ " doesn't have a public no-args constructor");
}
}
+
+ private static boolean hasPathPrefix(WrappedRequest request, String prefix) {
+ String pathInfo = request.getRequestPathInfo();
+
+ if (pathInfo == null) {
+ return false;
+ }
+
+ if (!prefix.startsWith("/")) {
+ prefix = '/' + prefix;
+ }
+
+ if (pathInfo.startsWith(prefix)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public static boolean isFileUploadRequest(WrappedRequest request) {
+ return hasPathPrefix(request, UPLOAD_URL_PREFIX);
+ }
+
+ public static boolean isConnectorResourceRequest(WrappedRequest request) {
+ return hasPathPrefix(request,
+ ApplicationConnection.CONNECTOR_RESOURCE_PREFIX + "/");
+ }
+
+ public static boolean isUIDLRequest(WrappedRequest request) {
+ return hasPathPrefix(request, ApplicationConnection.UIDL_REQUEST_PATH);
+ }
+
+ public static boolean isApplicationResourceRequest(WrappedRequest request) {
+ return hasPathPrefix(request, ApplicationConnection.APP_REQUEST_PATH);
+ }
+
}
diff --git a/src/com/vaadin/terminal/gwt/server/StreamingErrorEventImpl.java b/src/com/vaadin/terminal/gwt/server/StreamingErrorEventImpl.java
index 7418867fc8..6ab3df2789 100644
--- a/src/com/vaadin/terminal/gwt/server/StreamingErrorEventImpl.java
+++ b/src/com/vaadin/terminal/gwt/server/StreamingErrorEventImpl.java
@@ -17,6 +17,7 @@ final class StreamingErrorEventImpl extends AbstractStreamingEvent implements
this.exception = exception;
}
+ @Override
public final Exception getException() {
return exception;
}
diff --git a/src/com/vaadin/terminal/gwt/server/StreamingStartEventImpl.java b/src/com/vaadin/terminal/gwt/server/StreamingStartEventImpl.java
index 6a7844abd0..274d05e111 100644
--- a/src/com/vaadin/terminal/gwt/server/StreamingStartEventImpl.java
+++ b/src/com/vaadin/terminal/gwt/server/StreamingStartEventImpl.java
@@ -16,6 +16,7 @@ final class StreamingStartEventImpl extends AbstractStreamingEvent implements
super(filename, type, contentLength, 0);
}
+ @Override
public void disposeStreamVariable() {
disposed = true;
}
diff --git a/src/com/vaadin/terminal/gwt/server/UnsupportedBrowserHandler.java b/src/com/vaadin/terminal/gwt/server/UnsupportedBrowserHandler.java
index 334a7acf8d..5248af595e 100644
--- a/src/com/vaadin/terminal/gwt/server/UnsupportedBrowserHandler.java
+++ b/src/com/vaadin/terminal/gwt/server/UnsupportedBrowserHandler.java
@@ -26,6 +26,7 @@ public class UnsupportedBrowserHandler implements RequestHandler {
/** Cookie used to ignore browser checks */
public static final String FORCE_LOAD_COOKIE = "vaadinforceload=1";
+ @Override
public boolean handleRequest(Application application,
WrappedRequest request, WrappedResponse response)
throws IOException {
diff --git a/src/com/vaadin/terminal/gwt/server/WebApplicationContext.java b/src/com/vaadin/terminal/gwt/server/WebApplicationContext.java
index 8a1ea792f5..36c08b2ed9 100644
--- a/src/com/vaadin/terminal/gwt/server/WebApplicationContext.java
+++ b/src/com/vaadin/terminal/gwt/server/WebApplicationContext.java
@@ -111,6 +111,7 @@ public class WebApplicationContext extends AbstractWebApplicationContext {
*
* @see com.vaadin.service.ApplicationContext#getBaseDirectory()
*/
+ @Override
public File getBaseDirectory() {
final String realPath = ApplicationServlet.getResourcePath(
session.getServletContext(), "/");
diff --git a/src/com/vaadin/terminal/gwt/server/WebBrowser.java b/src/com/vaadin/terminal/gwt/server/WebBrowser.java
index 38b5409594..4b92b12b66 100644
--- a/src/com/vaadin/terminal/gwt/server/WebBrowser.java
+++ b/src/com/vaadin/terminal/gwt/server/WebBrowser.java
@@ -7,9 +7,9 @@ package com.vaadin.terminal.gwt.server;
import java.util.Date;
import java.util.Locale;
+import com.vaadin.shared.VBrowserDetails;
import com.vaadin.terminal.Terminal;
import com.vaadin.terminal.WrappedRequest;
-import com.vaadin.terminal.gwt.client.VBrowserDetails;
/**
* Class that provides information about the web browser the user is using.
@@ -42,6 +42,7 @@ public class WebBrowser implements Terminal {
* @return Always returns null.
*/
+ @Override
public String getDefaultTheme() {
return null;
}
@@ -52,6 +53,7 @@ public class WebBrowser implements Terminal {
* @see com.vaadin.terminal.Terminal#getScreenHeight()
*/
+ @Override
public int getScreenHeight() {
return screenHeight;
}
@@ -62,6 +64,7 @@ public class WebBrowser implements Terminal {
* @see com.vaadin.terminal.Terminal#getScreenWidth()
*/
+ @Override
public int getScreenWidth() {
return screenWidth;
}
diff --git a/src/com/vaadin/terminal/gwt/server/WrappedHttpServletRequest.java b/src/com/vaadin/terminal/gwt/server/WrappedHttpServletRequest.java
index 0774a79990..cf58f398af 100644
--- a/src/com/vaadin/terminal/gwt/server/WrappedHttpServletRequest.java
+++ b/src/com/vaadin/terminal/gwt/server/WrappedHttpServletRequest.java
@@ -41,18 +41,22 @@ public class WrappedHttpServletRequest extends HttpServletRequestWrapper
this.deploymentConfiguration = deploymentConfiguration;
}
+ @Override
public String getRequestPathInfo() {
return getPathInfo();
}
+ @Override
public int getSessionMaxInactiveInterval() {
return getSession().getMaxInactiveInterval();
}
+ @Override
public Object getSessionAttribute(String name) {
return getSession().getAttribute(name);
}
+ @Override
public void setSessionAttribute(String name, Object attribute) {
getSession().setAttribute(name, attribute);
}
@@ -66,20 +70,25 @@ public class WrappedHttpServletRequest extends HttpServletRequestWrapper
return this;
}
+ @Override
public DeploymentConfiguration getDeploymentConfiguration() {
return deploymentConfiguration;
}
+ @Override
public BrowserDetails getBrowserDetails() {
return new BrowserDetails() {
+ @Override
public String getUriFragment() {
return null;
}
+ @Override
public String getWindowName() {
return null;
}
+ @Override
public WebBrowser getWebBrowser() {
WebApplicationContext context = (WebApplicationContext) Application
.getCurrent().getContext();
diff --git a/src/com/vaadin/terminal/gwt/server/WrappedHttpServletResponse.java b/src/com/vaadin/terminal/gwt/server/WrappedHttpServletResponse.java
index 14a391b21f..32b2f352a8 100644
--- a/src/com/vaadin/terminal/gwt/server/WrappedHttpServletResponse.java
+++ b/src/com/vaadin/terminal/gwt/server/WrappedHttpServletResponse.java
@@ -47,6 +47,7 @@ public class WrappedHttpServletResponse extends HttpServletResponseWrapper
return this;
}
+ @Override
public void setCacheTime(long milliseconds) {
doSetCacheTime(this, milliseconds);
}
@@ -67,6 +68,7 @@ public class WrappedHttpServletResponse extends HttpServletResponseWrapper
}
}
+ @Override
public DeploymentConfiguration getDeploymentConfiguration() {
return deploymentConfiguration;
}
diff --git a/src/com/vaadin/terminal/gwt/server/WrappedPortletRequest.java b/src/com/vaadin/terminal/gwt/server/WrappedPortletRequest.java
index 85d8d5c69c..a3fa172034 100644
--- a/src/com/vaadin/terminal/gwt/server/WrappedPortletRequest.java
+++ b/src/com/vaadin/terminal/gwt/server/WrappedPortletRequest.java
@@ -17,6 +17,7 @@ import com.vaadin.Application;
import com.vaadin.terminal.CombinedRequest;
import com.vaadin.terminal.DeploymentConfiguration;
import com.vaadin.terminal.WrappedRequest;
+import com.vaadin.terminal.gwt.client.ApplicationConnection;
/**
* Wrapper for {@link PortletRequest} and its subclasses.
@@ -46,10 +47,12 @@ public class WrappedPortletRequest implements WrappedRequest {
this.deploymentConfiguration = deploymentConfiguration;
}
+ @Override
public Object getAttribute(String name) {
return request.getAttribute(name);
}
+ @Override
public int getContentLength() {
try {
return ((ClientDataRequest) request).getContentLength();
@@ -59,6 +62,7 @@ public class WrappedPortletRequest implements WrappedRequest {
}
}
+ @Override
public InputStream getInputStream() throws IOException {
try {
return ((ClientDataRequest) request).getPortletInputStream();
@@ -68,34 +72,48 @@ public class WrappedPortletRequest implements WrappedRequest {
}
}
+ @Override
public String getParameter(String name) {
return request.getParameter(name);
}
+ @Override
public Map<String, String[]> getParameterMap() {
return request.getParameterMap();
}
+ @Override
public void setAttribute(String name, Object o) {
request.setAttribute(name, o);
}
+ @Override
public String getRequestPathInfo() {
if (request instanceof ResourceRequest) {
- return ((ResourceRequest) request).getResourceID();
+ ResourceRequest resourceRequest = (ResourceRequest) request;
+ String resourceID = resourceRequest.getResourceID();
+ if (AbstractApplicationPortlet.RESOURCE_URL_ID.equals(resourceID)) {
+ String resourcePath = resourceRequest
+ .getParameter(ApplicationConnection.V_RESOURCE_PATH);
+ return resourcePath;
+ }
+ return resourceID;
} else {
return null;
}
}
+ @Override
public int getSessionMaxInactiveInterval() {
return request.getPortletSession().getMaxInactiveInterval();
}
+ @Override
public Object getSessionAttribute(String name) {
return request.getPortletSession().getAttribute(name);
}
+ @Override
public void setSessionAttribute(String name, Object attribute) {
request.getPortletSession().setAttribute(name, attribute);
}
@@ -109,6 +127,7 @@ public class WrappedPortletRequest implements WrappedRequest {
return request;
}
+ @Override
public String getContentType() {
try {
return ((ResourceRequest) request).getContentType();
@@ -118,16 +137,20 @@ public class WrappedPortletRequest implements WrappedRequest {
}
}
+ @Override
public BrowserDetails getBrowserDetails() {
return new BrowserDetails() {
+ @Override
public String getUriFragment() {
return null;
}
+ @Override
public String getWindowName() {
return null;
}
+ @Override
public WebBrowser getWebBrowser() {
PortletApplicationContext2 context = (PortletApplicationContext2) Application
.getCurrent().getContext();
@@ -136,18 +159,22 @@ public class WrappedPortletRequest implements WrappedRequest {
};
}
+ @Override
public Locale getLocale() {
return request.getLocale();
}
+ @Override
public String getRemoteAddr() {
return null;
}
+ @Override
public boolean isSecure() {
return request.isSecure();
}
+ @Override
public String getHeader(String string) {
return null;
}
@@ -164,6 +191,7 @@ public class WrappedPortletRequest implements WrappedRequest {
return request.getPortalContext().getProperty(name);
}
+ @Override
public DeploymentConfiguration getDeploymentConfiguration() {
return deploymentConfiguration;
}
diff --git a/src/com/vaadin/terminal/gwt/server/WrappedPortletResponse.java b/src/com/vaadin/terminal/gwt/server/WrappedPortletResponse.java
index 8824396352..f7ecf26f3c 100644
--- a/src/com/vaadin/terminal/gwt/server/WrappedPortletResponse.java
+++ b/src/com/vaadin/terminal/gwt/server/WrappedPortletResponse.java
@@ -53,6 +53,7 @@ public class WrappedPortletResponse implements WrappedResponse {
this.deploymentConfiguration = deploymentConfiguration;
}
+ @Override
public OutputStream getOutputStream() throws IOException {
return ((MimeResponse) response).getPortletOutputStream();
}
@@ -66,36 +67,44 @@ public class WrappedPortletResponse implements WrappedResponse {
return response;
}
+ @Override
public void setContentType(String type) {
((MimeResponse) response).setContentType(type);
}
+ @Override
public PrintWriter getWriter() throws IOException {
return ((MimeResponse) response).getWriter();
}
+ @Override
public void setStatus(int responseStatus) {
response.setProperty(ResourceResponse.HTTP_STATUS_CODE,
Integer.toString(responseStatus));
}
+ @Override
public void setHeader(String name, String value) {
response.setProperty(name, value);
}
+ @Override
public void setDateHeader(String name, long timestamp) {
response.setProperty(name, HTTP_DATE_FORMAT.format(new Date(timestamp)));
}
+ @Override
public void setCacheTime(long milliseconds) {
WrappedHttpServletResponse.doSetCacheTime(this, milliseconds);
}
+ @Override
public void sendError(int errorCode, String message) throws IOException {
setStatus(errorCode);
getWriter().write(message);
}
+ @Override
public DeploymentConfiguration getDeploymentConfiguration() {
return deploymentConfiguration;
}
diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/AcceptCriteriaFactoryGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/AcceptCriteriaFactoryGenerator.java
index 6d90a51761..e5e2ee1f2c 100644
--- a/src/com/vaadin/terminal/gwt/widgetsetutils/AcceptCriteriaFactoryGenerator.java
+++ b/src/com/vaadin/terminal/gwt/widgetsetutils/AcceptCriteriaFactoryGenerator.java
@@ -15,7 +15,7 @@ import com.google.gwt.core.ext.typeinfo.JClassType;
import com.google.gwt.core.ext.typeinfo.TypeOracle;
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
import com.google.gwt.user.rebind.SourceWriter;
-import com.vaadin.terminal.gwt.client.ui.dd.AcceptCriterion;
+import com.vaadin.shared.ui.dd.AcceptCriterion;
import com.vaadin.terminal.gwt.client.ui.dd.VAcceptCriterion;
import com.vaadin.terminal.gwt.client.ui.dd.VAcceptCriterionFactory;
diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java b/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java
index 1c5b736492..6ee30183c1 100644
--- a/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java
+++ b/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java
@@ -49,6 +49,7 @@ public class ClassPathExplorer {
* File filter that only accepts directories.
*/
private final static FileFilter DIRECTORIES_ONLY = new FileFilter() {
+ @Override
public boolean accept(File f) {
if (f.exists() && f.isDirectory()) {
return true;
diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/CustomWidgetMapGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/CustomWidgetMapGenerator.java
index f0f3df20b0..89045c63b2 100644
--- a/src/com/vaadin/terminal/gwt/widgetsetutils/CustomWidgetMapGenerator.java
+++ b/src/com/vaadin/terminal/gwt/widgetsetutils/CustomWidgetMapGenerator.java
@@ -6,10 +6,10 @@ package com.vaadin.terminal.gwt.widgetsetutils;
import java.util.Collection;
import java.util.HashSet;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ServerConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
/**
* An abstract helper class that can be used to easily build a widgetset with
diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/EagerWidgetMapGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/EagerWidgetMapGenerator.java
index 084e1c3857..4ff0592ede 100644
--- a/src/com/vaadin/terminal/gwt/widgetsetutils/EagerWidgetMapGenerator.java
+++ b/src/com/vaadin/terminal/gwt/widgetsetutils/EagerWidgetMapGenerator.java
@@ -3,8 +3,8 @@
*/
package com.vaadin.terminal.gwt.widgetsetutils;
+import com.vaadin.shared.ui.Connect.LoadStyle;
import com.vaadin.terminal.gwt.client.ServerConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
/**
* WidgetMap generator that builds a widgetset that packs all included widgets
diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/GeneratedRpcMethodProviderGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/GeneratedRpcMethodProviderGenerator.java
index b1d69b178b..e11a12a3b5 100644
--- a/src/com/vaadin/terminal/gwt/widgetsetutils/GeneratedRpcMethodProviderGenerator.java
+++ b/src/com/vaadin/terminal/gwt/widgetsetutils/GeneratedRpcMethodProviderGenerator.java
@@ -21,7 +21,7 @@ import com.google.gwt.core.ext.typeinfo.JType;
import com.google.gwt.core.ext.typeinfo.TypeOracle;
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
import com.google.gwt.user.rebind.SourceWriter;
-import com.vaadin.terminal.gwt.client.communication.ClientRpc;
+import com.vaadin.shared.communication.ClientRpc;
import com.vaadin.terminal.gwt.client.communication.GeneratedRpcMethodProvider;
import com.vaadin.terminal.gwt.client.communication.RpcManager;
import com.vaadin.terminal.gwt.client.communication.RpcMethod;
diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/LazyWidgetMapGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/LazyWidgetMapGenerator.java
index f8366beb46..28f3dab482 100644
--- a/src/com/vaadin/terminal/gwt/widgetsetutils/LazyWidgetMapGenerator.java
+++ b/src/com/vaadin/terminal/gwt/widgetsetutils/LazyWidgetMapGenerator.java
@@ -3,8 +3,8 @@
*/
package com.vaadin.terminal.gwt.widgetsetutils;
+import com.vaadin.shared.ui.Connect.LoadStyle;
import com.vaadin.terminal.gwt.client.ServerConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
/**
* WidgetMap generator that builds a widgetset that optimizes the transferred
diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyCreatorGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyCreatorGenerator.java
index 040715fccf..8a6c374187 100644
--- a/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyCreatorGenerator.java
+++ b/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyCreatorGenerator.java
@@ -16,10 +16,10 @@ import com.google.gwt.core.ext.typeinfo.JClassType;
import com.google.gwt.core.ext.typeinfo.TypeOracle;
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
import com.google.gwt.user.rebind.SourceWriter;
+import com.vaadin.shared.communication.ServerRpc;
import com.vaadin.terminal.gwt.client.ServerConnector;
import com.vaadin.terminal.gwt.client.communication.InitializableServerRpc;
import com.vaadin.terminal.gwt.client.communication.RpcProxy.RpcProxyCreator;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
public class RpcProxyCreatorGenerator extends Generator {
@@ -31,13 +31,13 @@ public class RpcProxyCreatorGenerator extends Generator {
assert (typeOracle != null);
JClassType requestedType = typeOracle.findType(requestedClassName);
- String packageName = requestedType.getPackage().getName();
- String className = requestedType.getSimpleSourceName() + "Impl";
if (requestedType == null) {
logger.log(TreeLogger.ERROR, "Unable to find metadata for type '"
+ requestedClassName + "'", null);
throw new UnableToCompleteException();
}
+ String packageName = requestedType.getPackage().getName();
+ String className = requestedType.getSimpleSourceName() + "Impl";
createType(logger, ctx, packageName, className);
return packageName + "." + className;
diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyGenerator.java
index d9bc8bc832..7a908e5b4d 100644
--- a/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyGenerator.java
+++ b/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyGenerator.java
@@ -17,11 +17,11 @@ import com.google.gwt.core.ext.typeinfo.JParameter;
import com.google.gwt.core.ext.typeinfo.TypeOracle;
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
import com.google.gwt.user.rebind.SourceWriter;
+import com.vaadin.shared.communication.MethodInvocation;
+import com.vaadin.shared.communication.ServerRpc;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ServerConnector;
import com.vaadin.terminal.gwt.client.communication.InitializableServerRpc;
-import com.vaadin.terminal.gwt.client.communication.MethodInvocation;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
/**
* GWT generator that creates client side proxy classes for making RPC calls
diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerMapGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerMapGenerator.java
index 5e151323a0..3f1ad24066 100644
--- a/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerMapGenerator.java
+++ b/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerMapGenerator.java
@@ -22,17 +22,17 @@ import com.google.gwt.core.ext.typeinfo.JClassType;
import com.google.gwt.core.ext.typeinfo.JMethod;
import com.google.gwt.core.ext.typeinfo.JParameterizedType;
import com.google.gwt.core.ext.typeinfo.JType;
+import com.google.gwt.core.ext.typeinfo.NotFoundException;
import com.google.gwt.core.ext.typeinfo.TypeOracle;
-import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
import com.google.gwt.user.rebind.SourceWriter;
+import com.vaadin.shared.communication.ClientRpc;
+import com.vaadin.shared.communication.ServerRpc;
+import com.vaadin.shared.communication.SharedState;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.ConnectorMap;
-import com.vaadin.terminal.gwt.client.communication.ClientRpc;
import com.vaadin.terminal.gwt.client.communication.JSONSerializer;
import com.vaadin.terminal.gwt.client.communication.SerializerMap;
-import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.communication.SharedState;
/**
* GWT generator that creates a {@link SerializerMap} implementation (mapper
@@ -43,6 +43,7 @@ import com.vaadin.terminal.gwt.client.communication.SharedState;
*/
public class SerializerMapGenerator extends Generator {
+ private static final String FAIL_IF_NOT_SERIALIZABLE = "vFailIfNotSerializable";
private String packageName;
private String className;
@@ -54,7 +55,7 @@ public class SerializerMapGenerator extends Generator {
TypeOracle typeOracle = context.getTypeOracle();
Set<JClassType> typesNeedingSerializers = findTypesNeedingSerializers(
typeOracle, logger);
- warnIfNotJavaSerializable(typesNeedingSerializers, typeOracle,
+ checkForUnserializableTypes(typesNeedingSerializers, typeOracle,
logger);
Set<JClassType> typesWithExistingSerializers = findTypesWithExistingSerializers(
typeOracle, logger);
@@ -90,10 +91,11 @@ public class SerializerMapGenerator extends Generator {
* @param typesNeedingSerializers
* @param typeOracle
* @param logger
+ * @throws UnableToCompleteException
*/
- private void warnIfNotJavaSerializable(
+ private void checkForUnserializableTypes(
Set<JClassType> typesNeedingSerializers, TypeOracle typeOracle,
- TreeLogger logger) {
+ TreeLogger logger) throws UnableToCompleteException {
JClassType javaSerializable = typeOracle.findType(Serializable.class
.getName());
for (JClassType type : typesNeedingSerializers) {
@@ -103,33 +105,59 @@ public class SerializerMapGenerator extends Generator {
}
boolean serializable = type.isAssignableTo(javaSerializable);
if (!serializable) {
+ boolean abortCompile = "true".equals(System
+ .getProperty(FAIL_IF_NOT_SERIALIZABLE));
logger.log(
- Type.ERROR,
+ abortCompile ? Type.ERROR : Type.WARN,
type
+ " is used in RPC or shared state but does not implement "
+ Serializable.class.getName()
- + ". Communication will work but the Application on server side cannot be serialized if it refers to objects of this type.");
+ + ". Communication will work but the Application on server side cannot be serialized if it refers to objects of this type. "
+ + "If the system property "
+ + FAIL_IF_NOT_SERIALIZABLE
+ + " is set to \"true\", this causes the compilation to fail instead of just emitting a warning.");
+ if (abortCompile) {
+ throw new UnableToCompleteException();
+ }
}
}
}
private Set<JClassType> findTypesWithExistingSerializers(
- TypeOracle typeOracle, TreeLogger logger) {
+ TypeOracle typeOracle, TreeLogger logger)
+ throws UnableToCompleteException {
JClassType serializerInterface = typeOracle
.findType(JSONSerializer.class.getName());
+ JType[] deserializeParamTypes = new JType[] {
+ typeOracle
+ .findType(com.vaadin.terminal.gwt.client.communication.Type.class
+ .getName()),
+ typeOracle.findType(JSONValue.class.getName()),
+ typeOracle.findType(ApplicationConnection.class.getName()) };
+ String deserializeMethodName = "deserialize";
+ try {
+ serializerInterface.getMethod(deserializeMethodName,
+ deserializeParamTypes);
+ } catch (NotFoundException e) {
+ logger.log(Type.ERROR, "Could not find " + deserializeMethodName
+ + " in " + serializerInterface);
+ throw new UnableToCompleteException();
+ }
+
Set<JClassType> types = new HashSet<JClassType>();
for (JClassType serializer : serializerInterface.getSubtypes()) {
- JType[] deserializeParamTypes = new JType[] {
- typeOracle.findType(JSONObject.class.getName()),
- typeOracle.findType(ConnectorMap.class.getName()),
- typeOracle.findType(ApplicationConnection.class.getName()) };
- JMethod deserializeMethod = serializer.findMethod("deserialize",
- deserializeParamTypes);
+ JMethod deserializeMethod = serializer.findMethod(
+ deserializeMethodName, deserializeParamTypes);
if (deserializeMethod == null) {
+ logger.log(Type.DEBUG, "Could not find "
+ + deserializeMethodName + " in " + serializer);
continue;
}
+ JType returnType = deserializeMethod.getReturnType();
+ logger.log(Type.DEBUG, "Found " + deserializeMethodName
+ + " with return type " + returnType + " in " + serializer);
- types.add(deserializeMethod.getReturnType().isClass());
+ types.add(returnType.isClass());
}
return types;
}
diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java
index b264a9c7fe..0d062ec4ff 100644
--- a/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java
+++ b/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java
@@ -22,10 +22,10 @@ import com.google.gwt.core.ext.typeinfo.JClassType;
import com.google.gwt.core.ext.typeinfo.TypeOracle;
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
import com.google.gwt.user.rebind.SourceWriter;
-import com.vaadin.terminal.gwt.client.Connector;
+import com.vaadin.shared.Connector;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
import com.vaadin.terminal.gwt.client.ServerConnector;
-import com.vaadin.terminal.gwt.client.ui.Connect;
-import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
import com.vaadin.terminal.gwt.client.ui.UnknownComponentConnector;
import com.vaadin.terminal.gwt.client.ui.root.RootConnector;
import com.vaadin.terminal.gwt.server.ClientConnector;