]> source.dussan.org Git - vaadin-framework.git/commitdiff
License header parametrized
authorJani Laakso <jani.laakso@itmill.com>
Tue, 4 Dec 2007 19:51:22 +0000 (19:51 +0000)
committerJani Laakso <jani.laakso@itmill.com>
Tue, 4 Dec 2007 19:51:22 +0000 (19:51 +0000)
Cleanup performed
Organized imports
Format

svn changeset:3162/svn branch:trunk

331 files changed:
src/com/itmill/toolkit/Application.java
src/com/itmill/toolkit/data/Buffered.java
src/com/itmill/toolkit/data/BufferedValidatable.java
src/com/itmill/toolkit/data/Container.java
src/com/itmill/toolkit/data/Item.java
src/com/itmill/toolkit/data/Property.java
src/com/itmill/toolkit/data/Validatable.java
src/com/itmill/toolkit/data/Validator.java
src/com/itmill/toolkit/data/util/BeanItem.java
src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java
src/com/itmill/toolkit/data/util/ContainerOrderedWrapper.java
src/com/itmill/toolkit/data/util/FilesystemContainer.java
src/com/itmill/toolkit/data/util/HierarchicalContainer.java
src/com/itmill/toolkit/data/util/IndexedContainer.java
src/com/itmill/toolkit/data/util/MethodProperty.java
src/com/itmill/toolkit/data/util/ObjectProperty.java
src/com/itmill/toolkit/data/util/PropertysetItem.java
src/com/itmill/toolkit/data/util/QueryContainer.java
src/com/itmill/toolkit/data/validator/CompositeValidator.java
src/com/itmill/toolkit/data/validator/NullValidator.java
src/com/itmill/toolkit/data/validator/StringLengthValidator.java
src/com/itmill/toolkit/demo/BrowserDemo.java
src/com/itmill/toolkit/demo/BufferedComponents.java
src/com/itmill/toolkit/demo/CachingDemo.java
src/com/itmill/toolkit/demo/Calc.java
src/com/itmill/toolkit/demo/CustomLayoutDemo.java
src/com/itmill/toolkit/demo/FilterSelect.java
src/com/itmill/toolkit/demo/HelloWorld.java
src/com/itmill/toolkit/demo/KeyboardShortcut.java
src/com/itmill/toolkit/demo/LayoutDemo.java
src/com/itmill/toolkit/demo/ModalWindow.java
src/com/itmill/toolkit/demo/NativeWindowing.java
src/com/itmill/toolkit/demo/NotificationDemo.java
src/com/itmill/toolkit/demo/Parameters.java
src/com/itmill/toolkit/demo/QueryContainerDemo.java
src/com/itmill/toolkit/demo/SelectDemo.java
src/com/itmill/toolkit/demo/TableDemo.java
src/com/itmill/toolkit/demo/TreeFilesystem.java
src/com/itmill/toolkit/demo/TreeFilesystemContainer.java
src/com/itmill/toolkit/demo/UpgradingSample.java
src/com/itmill/toolkit/demo/WindowedDemos.java
src/com/itmill/toolkit/demo/colorpicker/ColorPicker.java
src/com/itmill/toolkit/demo/colorpicker/ColorPickerApplication.java
src/com/itmill/toolkit/demo/colorpicker/gwt/client/ColorPickerWidgetSet.java
src/com/itmill/toolkit/demo/colorpicker/gwt/client/ui/GwtColorPicker.java
src/com/itmill/toolkit/demo/colorpicker/gwt/client/ui/IColorPicker.java
src/com/itmill/toolkit/demo/featurebrowser/ButtonExample.java
src/com/itmill/toolkit/demo/featurebrowser/ClientCachingExample.java
src/com/itmill/toolkit/demo/featurebrowser/ComboBoxExample.java
src/com/itmill/toolkit/demo/featurebrowser/EmbeddedBrowserExample.java
src/com/itmill/toolkit/demo/featurebrowser/FeatureBrowser.java
src/com/itmill/toolkit/demo/featurebrowser/LabelExample.java
src/com/itmill/toolkit/demo/featurebrowser/LayoutExample.java
src/com/itmill/toolkit/demo/featurebrowser/NotificationExample.java
src/com/itmill/toolkit/demo/featurebrowser/RichTextExample.java
src/com/itmill/toolkit/demo/featurebrowser/SelectExample.java
src/com/itmill/toolkit/demo/featurebrowser/TableExample.java
src/com/itmill/toolkit/demo/featurebrowser/TreeExample.java
src/com/itmill/toolkit/demo/featurebrowser/ValueInputExample.java
src/com/itmill/toolkit/demo/featurebrowser/WindowingExample.java
src/com/itmill/toolkit/demo/reservation/CalendarDemo.java
src/com/itmill/toolkit/demo/reservation/CalendarField.java
src/com/itmill/toolkit/demo/reservation/GoogleMap.java
src/com/itmill/toolkit/demo/reservation/ReservationApplication.java
src/com/itmill/toolkit/demo/reservation/ResourceNotAvailableException.java
src/com/itmill/toolkit/demo/reservation/ResourceSelectorPanel.java
src/com/itmill/toolkit/demo/reservation/SampleDB.java
src/com/itmill/toolkit/demo/reservation/gwt/client/ReservationWidgetSet.java
src/com/itmill/toolkit/demo/reservation/gwt/client/ui/ICalendarField.java
src/com/itmill/toolkit/demo/reservation/gwt/client/ui/IGoogleMap.java
src/com/itmill/toolkit/demo/util/SampleCalendarDatabase.java
src/com/itmill/toolkit/demo/util/SampleDatabase.java
src/com/itmill/toolkit/demo/util/SampleDirectory.java
src/com/itmill/toolkit/event/Action.java
src/com/itmill/toolkit/event/EventRouter.java
src/com/itmill/toolkit/event/ListenerMethod.java
src/com/itmill/toolkit/event/MethodEventSource.java
src/com/itmill/toolkit/event/ShortcutAction.java
src/com/itmill/toolkit/launcher/ITMillToolkitDesktopMode.java
src/com/itmill/toolkit/launcher/ITMillToolkitWebMode.java
src/com/itmill/toolkit/launcher/util/BrowserLauncher.java
src/com/itmill/toolkit/service/ApplicationContext.java
src/com/itmill/toolkit/service/FileTypeResolver.java
src/com/itmill/toolkit/terminal/ApplicationResource.java
src/com/itmill/toolkit/terminal/ClassResource.java
src/com/itmill/toolkit/terminal/CompositeErrorMessage.java
src/com/itmill/toolkit/terminal/DownloadStream.java
src/com/itmill/toolkit/terminal/ErrorMessage.java
src/com/itmill/toolkit/terminal/ExternalResource.java
src/com/itmill/toolkit/terminal/FileResource.java
src/com/itmill/toolkit/terminal/KeyMapper.java
src/com/itmill/toolkit/terminal/PaintException.java
src/com/itmill/toolkit/terminal/PaintTarget.java
src/com/itmill/toolkit/terminal/Paintable.java
src/com/itmill/toolkit/terminal/ParameterHandler.java
src/com/itmill/toolkit/terminal/Resource.java
src/com/itmill/toolkit/terminal/Scrollable.java
src/com/itmill/toolkit/terminal/Sizeable.java
src/com/itmill/toolkit/terminal/StreamResource.java
src/com/itmill/toolkit/terminal/SystemError.java
src/com/itmill/toolkit/terminal/Terminal.java
src/com/itmill/toolkit/terminal/ThemeResource.java
src/com/itmill/toolkit/terminal/URIHandler.java
src/com/itmill/toolkit/terminal/UploadStream.java
src/com/itmill/toolkit/terminal/UserError.java
src/com/itmill/toolkit/terminal/VariableOwner.java
src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java
src/com/itmill/toolkit/terminal/gwt/client/Caption.java
src/com/itmill/toolkit/terminal/gwt/client/CaptionWrapper.java
src/com/itmill/toolkit/terminal/gwt/client/Console.java
src/com/itmill/toolkit/terminal/gwt/client/Container.java
src/com/itmill/toolkit/terminal/gwt/client/ContainerResizedListener.java
src/com/itmill/toolkit/terminal/gwt/client/DateLocale.java
src/com/itmill/toolkit/terminal/gwt/client/DateTimeService.java
src/com/itmill/toolkit/terminal/gwt/client/DebugConsole.java
src/com/itmill/toolkit/terminal/gwt/client/DefaultWidgetSet.java
src/com/itmill/toolkit/terminal/gwt/client/ErrorMessage.java
src/com/itmill/toolkit/terminal/gwt/client/LocaleNotLoadedException.java
src/com/itmill/toolkit/terminal/gwt/client/LocaleService.java
src/com/itmill/toolkit/terminal/gwt/client/NullConsole.java
src/com/itmill/toolkit/terminal/gwt/client/Paintable.java
src/com/itmill/toolkit/terminal/gwt/client/StyleConstants.java
src/com/itmill/toolkit/terminal/gwt/client/UIDL.java
src/com/itmill/toolkit/terminal/gwt/client/Util.java
src/com/itmill/toolkit/terminal/gwt/client/WidgetSet.java
src/com/itmill/toolkit/terminal/gwt/client/ui/Action.java
src/com/itmill/toolkit/terminal/gwt/client/ui/AlignmentInfo.java
src/com/itmill/toolkit/terminal/gwt/client/ui/CalendarEntry.java
src/com/itmill/toolkit/terminal/gwt/client/ui/CalendarPanel.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ContextMenu.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IButton.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ICheckBox.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomComponent.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomLayout.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IDateField.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IDateFieldCalendar.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IEmbedded.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IExpandLayout.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IForm.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IFormLayout.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IHorizontalExpandLayout.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ILabel.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ILink.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IListSelect.java
src/com/itmill/toolkit/terminal/gwt/client/ui/INativeSelect.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IOptionGroup.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IOptionGroupBase.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IOrderedLayout.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IOrderedLayoutHorizontal.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IOrderedLayoutVertical.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IPanel.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IPasswordField.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupCalendar.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IProgressIndicator.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ISlider.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ISplitPanel.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ISplitPanelHorizontal.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ISplitPanelVertical.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ITablePaging.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ITabsheet.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ITabsheetPanel.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ITextArea.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ITextField.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ITextualDate.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ITree.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ITwinColSelect.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IUnknownComponent.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IUpload.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IView.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java
src/com/itmill/toolkit/terminal/gwt/client/ui/Icon.java
src/com/itmill/toolkit/terminal/gwt/client/ui/MarginInfo.java
src/com/itmill/toolkit/terminal/gwt/client/ui/MenuBar.java
src/com/itmill/toolkit/terminal/gwt/client/ui/MenuItem.java
src/com/itmill/toolkit/terminal/gwt/client/ui/Notification.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ShortcutActionHandler.java
src/com/itmill/toolkit/terminal/gwt/client/ui/Table.java
src/com/itmill/toolkit/terminal/gwt/client/ui/Time.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ToolkitOverlay.java
src/com/itmill/toolkit/terminal/gwt/client/ui/TreeAction.java
src/com/itmill/toolkit/terminal/gwt/client/ui/TreeImages.java
src/com/itmill/toolkit/terminal/gwt/client/ui/richtextarea/IRichTextArea.java
src/com/itmill/toolkit/terminal/gwt/client/ui/richtextarea/RichTextToolbar.java
src/com/itmill/toolkit/terminal/gwt/client/util/DateLocale.java
src/com/itmill/toolkit/terminal/gwt/client/util/Pattern.java
src/com/itmill/toolkit/terminal/gwt/client/util/SimpleDateFormat.java
src/com/itmill/toolkit/terminal/gwt/client/util/SimpleDateParser.java
src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java
src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java
src/com/itmill/toolkit/terminal/gwt/server/HttpUploadStream.java
src/com/itmill/toolkit/terminal/gwt/server/JsonPaintTarget.java
src/com/itmill/toolkit/terminal/gwt/server/WebApplicationContext.java
src/com/itmill/toolkit/terminal/gwt/server/WebBrowser.java
src/com/itmill/toolkit/terminal/web/ApplicationServlet.java
src/com/itmill/toolkit/tests/BasicRandomTest.java
src/com/itmill/toolkit/tests/PerformanceTestSubTreeCaching.java
src/com/itmill/toolkit/tests/RandomLayoutStress.java
src/com/itmill/toolkit/tests/TableSelectTest.java
src/com/itmill/toolkit/tests/TestBench.java
src/com/itmill/toolkit/tests/TestCaptionWrapper.java
src/com/itmill/toolkit/tests/TestComponentsAndLayouts.java
src/com/itmill/toolkit/tests/TestDateField.java
src/com/itmill/toolkit/tests/TestForAlignments.java
src/com/itmill/toolkit/tests/TestForApplicationLayoutThatUsesWholeBrosersSpace.java
src/com/itmill/toolkit/tests/TestForBasicApplicationLayout.java
src/com/itmill/toolkit/tests/TestForChildComponentRendering.java
src/com/itmill/toolkit/tests/TestForContainerFilterable.java
src/com/itmill/toolkit/tests/TestForExpandLayout.java
src/com/itmill/toolkit/tests/TestForGridLayoutChildComponentRendering.java
src/com/itmill/toolkit/tests/TestForMultipleStyleNames.java
src/com/itmill/toolkit/tests/TestForNativeWindowing.java
src/com/itmill/toolkit/tests/TestForPreconfiguredComponents.java
src/com/itmill/toolkit/tests/TestForRichTextEditor.java
src/com/itmill/toolkit/tests/TestForTablesInitialColumnWidthLogicRendering.java
src/com/itmill/toolkit/tests/TestForTrees.java
src/com/itmill/toolkit/tests/TestForUpload.java
src/com/itmill/toolkit/tests/TestForWindowOpen.java
src/com/itmill/toolkit/tests/TestForWindowing.java
src/com/itmill/toolkit/tests/TestIFrames.java
src/com/itmill/toolkit/tests/TestSelectAndDatefieldInDeepLayouts.java
src/com/itmill/toolkit/tests/TestSetVisibleAndCaching.java
src/com/itmill/toolkit/tests/TestSplitPanel.java
src/com/itmill/toolkit/tests/UsingObjectsInSelect.java
src/com/itmill/toolkit/tests/featurebrowser/Feature.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureBrowser.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureBuffering.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureButton.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureContainers.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureCustomLayout.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureDateField.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureEmbedded.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureForm.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureGridLayout.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureItems.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureLabel.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureLink.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureOrderedLayout.java
src/com/itmill/toolkit/tests/featurebrowser/FeaturePanel.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureParameters.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureProperties.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureSelect.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureTabSheet.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureTable.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureTextField.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureTree.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureUpload.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureUtil.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureValidators.java
src/com/itmill/toolkit/tests/featurebrowser/FeatureWindow.java
src/com/itmill/toolkit/tests/featurebrowser/FeaturesApplication.java
src/com/itmill/toolkit/tests/featurebrowser/IntroBasic.java
src/com/itmill/toolkit/tests/featurebrowser/IntroComponents.java
src/com/itmill/toolkit/tests/featurebrowser/IntroDataHandling.java
src/com/itmill/toolkit/tests/featurebrowser/IntroDataModel.java
src/com/itmill/toolkit/tests/featurebrowser/IntroItemContainers.java
src/com/itmill/toolkit/tests/featurebrowser/IntroLayouts.java
src/com/itmill/toolkit/tests/featurebrowser/IntroTerminal.java
src/com/itmill/toolkit/tests/featurebrowser/IntroWelcome.java
src/com/itmill/toolkit/tests/featurebrowser/PropertyPanel.java
src/com/itmill/toolkit/tests/magi/DefaultButtonExample.java
src/com/itmill/toolkit/tests/magi/EmbeddedButton.java
src/com/itmill/toolkit/tests/magi/MagiTestApplication.java
src/com/itmill/toolkit/tests/magi/MyUploader.java
src/com/itmill/toolkit/tests/magi/SSNField.java
src/com/itmill/toolkit/tests/magi/SelectExample.java
src/com/itmill/toolkit/tests/magi/TabSheetExample.java
src/com/itmill/toolkit/tests/magi/TableExample.java
src/com/itmill/toolkit/tests/magi/TheButton.java
src/com/itmill/toolkit/tests/magi/TheButtons.java
src/com/itmill/toolkit/tests/magi/TheButtons2.java
src/com/itmill/toolkit/tests/magi/TheButtons3.java
src/com/itmill/toolkit/tests/magi/WindowOpener.java
src/com/itmill/toolkit/tests/testbench/TestBench.java
src/com/itmill/toolkit/tests/testbench/TestForAlignments.java
src/com/itmill/toolkit/tests/testbench/TestForBasicApplicationLayout.java
src/com/itmill/toolkit/tests/testbench/TestForContainerFilterable.java
src/com/itmill/toolkit/tests/testbench/TestForMultipleStyleNames.java
src/com/itmill/toolkit/tests/testbench/TestForPreconfiguredComponents.java
src/com/itmill/toolkit/tests/testbench/TestForRichTextEditor.java
src/com/itmill/toolkit/tests/testbench/TestForTrees.java
src/com/itmill/toolkit/tests/testbench/TestForUpload.java
src/com/itmill/toolkit/tests/testbench/TestForWindowOpen.java
src/com/itmill/toolkit/tests/testbench/TestForWindowing.java
src/com/itmill/toolkit/tests/testbench/TestSetVisibleAndCaching.java
src/com/itmill/toolkit/tests/testbench/TestSplitPanel.java
src/com/itmill/toolkit/ui/AbstractComponent.java
src/com/itmill/toolkit/ui/AbstractComponentContainer.java
src/com/itmill/toolkit/ui/AbstractField.java
src/com/itmill/toolkit/ui/AbstractLayout.java
src/com/itmill/toolkit/ui/AbstractSelect.java
src/com/itmill/toolkit/ui/BaseFieldFactory.java
src/com/itmill/toolkit/ui/Button.java
src/com/itmill/toolkit/ui/CheckBox.java
src/com/itmill/toolkit/ui/ComboBox.java
src/com/itmill/toolkit/ui/Component.java
src/com/itmill/toolkit/ui/ComponentContainer.java
src/com/itmill/toolkit/ui/CustomComponent.java
src/com/itmill/toolkit/ui/CustomLayout.java
src/com/itmill/toolkit/ui/DateField.java
src/com/itmill/toolkit/ui/Embedded.java
src/com/itmill/toolkit/ui/ExpandLayout.java
src/com/itmill/toolkit/ui/Field.java
src/com/itmill/toolkit/ui/FieldFactory.java
src/com/itmill/toolkit/ui/Form.java
src/com/itmill/toolkit/ui/FormLayout.java
src/com/itmill/toolkit/ui/GridLayout.java
src/com/itmill/toolkit/ui/InlineDateField.java
src/com/itmill/toolkit/ui/Label.java
src/com/itmill/toolkit/ui/Layout.java
src/com/itmill/toolkit/ui/Link.java
src/com/itmill/toolkit/ui/ListSelect.java
src/com/itmill/toolkit/ui/NativeSelect.java
src/com/itmill/toolkit/ui/OptionGroup.java
src/com/itmill/toolkit/ui/OrderedLayout.java
src/com/itmill/toolkit/ui/Panel.java
src/com/itmill/toolkit/ui/PopupDateField.java
src/com/itmill/toolkit/ui/ProgressIndicator.java
src/com/itmill/toolkit/ui/RichTextArea.java
src/com/itmill/toolkit/ui/Select.java
src/com/itmill/toolkit/ui/Slider.java
src/com/itmill/toolkit/ui/SplitPanel.java
src/com/itmill/toolkit/ui/TabSheet.java
src/com/itmill/toolkit/ui/Table.java
src/com/itmill/toolkit/ui/TextField.java
src/com/itmill/toolkit/ui/Tree.java
src/com/itmill/toolkit/ui/TwinColSelect.java
src/com/itmill/toolkit/ui/Upload.java
src/com/itmill/toolkit/ui/Window.java

index 1ae6dd98d7085445914a87b8037daee71c0cc630..28355b98474767b20e57468a0dd9f00abd5670aa 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit;
 
@@ -130,7 +106,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
     /**
      * Mapping from window name to window instance.
      */
-    private Hashtable windows = new Hashtable();
+    private final Hashtable windows = new Hashtable();
 
     /**
      * Main window of the application.
@@ -180,9 +156,9 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
     /**
      * Application resource mapping: key <-> resource.
      */
-    private Hashtable resourceKeyMap = new Hashtable();
+    private final Hashtable resourceKeyMap = new Hashtable();
 
-    private Hashtable keyResourceMap = new Hashtable();
+    private final Hashtable keyResourceMap = new Hashtable();
 
     private long lastResourceKeyNumber = 0;
 
@@ -230,7 +206,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
         }
 
         // Gets the window by name
-        Window window = (Window) windows.get(name);
+        final Window window = (Window) windows.get(name);
 
         return window;
     }
@@ -324,8 +300,8 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
     private void fireWindowAttachEvent(Window window) {
         // Fires the window attach event
         if (windowAttachListeners != null) {
-            Object[] listeners = windowAttachListeners.toArray();
-            WindowAttachEvent event = new WindowAttachEvent(window);
+            final Object[] listeners = windowAttachListeners.toArray();
+            final WindowAttachEvent event = new WindowAttachEvent(window);
             for (int i = 0; i < listeners.length; i++) {
                 ((WindowAttachListener) listeners[i]).windowAttached(event);
             }
@@ -361,8 +337,8 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
     private void fireWindowDetachEvent(Window window) {
         // Fires the window detach event
         if (windowDetachListeners != null) {
-            Object[] listeners = windowDetachListeners.toArray();
-            WindowDetachEvent event = new WindowDetachEvent(window);
+            final Object[] listeners = windowDetachListeners.toArray();
+            final WindowDetachEvent event = new WindowDetachEvent(window);
             for (int i = 0; i < listeners.length; i++) {
                 ((WindowDetachListener) listeners[i]).windowDetached(event);
             }
@@ -394,12 +370,12 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
      *                the new user.
      */
     public void setUser(Object user) {
-        Object prevUser = this.user;
+        final Object prevUser = this.user;
         if (user != prevUser && (user == null || !user.equals(prevUser))) {
             this.user = user;
             if (userChangeListeners != null) {
-                Object[] listeners = userChangeListeners.toArray();
-                UserChangeEvent event = new UserChangeEvent(this, user,
+                final Object[] listeners = userChangeListeners.toArray();
+                final UserChangeEvent event = new UserChangeEvent(this, user,
                         prevUser);
                 for (int i = 0; i < listeners.length; i++) {
                     ((UserChangeListener) listeners[i])
@@ -502,11 +478,11 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
     public void setTheme(String theme) {
 
         // Collect list of windows not having the current or future theme
-        LinkedList toBeUpdated = new LinkedList();
-        String myTheme = getTheme();
-        for (Iterator i = getWindows().iterator(); i.hasNext();) {
-            Window w = (Window) i.next();
-            String windowTheme = w.getTheme();
+        final LinkedList toBeUpdated = new LinkedList();
+        final String myTheme = getTheme();
+        for (final Iterator i = getWindows().iterator(); i.hasNext();) {
+            final Window w = (Window) i.next();
+            final String windowTheme = w.getTheme();
             if ((windowTheme == null)
                     || (!theme.equals(windowTheme) && windowTheme
                             .equals(myTheme))) {
@@ -518,7 +494,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
         this.theme = theme;
 
         // Ask windows to update themselves
-        for (Iterator i = toBeUpdated.iterator(); i.hasNext();) {
+        for (final Iterator i = toBeUpdated.iterator(); i.hasNext();) {
             ((Window) i.next()).requestRepaint();
         }
     }
@@ -586,7 +562,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
         }
 
         // Generate key
-        String key = String.valueOf(++lastResourceKeyNumber);
+        final String key = String.valueOf(++lastResourceKeyNumber);
 
         // Add the resource to mappings
         resourceKeyMap.put(resource, key);
@@ -600,7 +576,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
      *                the resource to remove.
      */
     public void removeResource(ApplicationResource resource) {
-        Object key = resourceKeyMap.get(resource);
+        final Object key = resourceKeyMap.get(resource);
         if (key != null) {
             resourceKeyMap.remove(resource);
             keyResourceMap.remove(key);
@@ -617,14 +593,14 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
     public String getRelativeLocation(ApplicationResource resource) {
 
         // Gets the key
-        String key = (String) resourceKeyMap.get(resource);
+        final String key = (String) resourceKeyMap.get(resource);
 
         // If the resource is not registered, return null
         if (key == null) {
             return null;
         }
 
-        String filename = resource.getFilename();
+        final String filename = resource.getFilename();
         if (filename == null) {
             return "APP/" + key + "/";
         } else {
@@ -644,7 +620,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
 
         // Resolves the prefix
         String prefix = relativeUri;
-        int index = relativeUri.indexOf('/');
+        final int index = relativeUri.indexOf('/');
         if (index >= 0) {
             prefix = relativeUri.substring(0, index);
         }
@@ -653,12 +629,12 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
         if (prefix.equals("APP")) {
 
             // Handles the resource request
-            int next = relativeUri.indexOf('/', index + 1);
+            final int next = relativeUri.indexOf('/', index + 1);
             if (next < 0) {
                 return null;
             }
-            String key = relativeUri.substring(index + 1, next);
-            ApplicationResource resource = (ApplicationResource) keyResourceMap
+            final String key = relativeUri.substring(index + 1, next);
+            final ApplicationResource resource = (ApplicationResource) keyResourceMap
                     .get(key);
             if (resource != null) {
                 return resource.getStream();
@@ -674,11 +650,11 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
             URL windowContext;
             try {
                 windowContext = new URL(context, prefix + "/");
-                String windowUri = relativeUri.length() > prefix.length() + 1 ? relativeUri
+                final String windowUri = relativeUri.length() > prefix.length() + 1 ? relativeUri
                         .substring(prefix.length() + 1)
                         : "";
                 return window.handleURI(windowContext, windowUri);
-            } catch (MalformedURLException e) {
+            } catch (final MalformedURLException e) {
                 return null;
             }
         }
@@ -737,12 +713,12 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
         /**
          * New user of the application.
          */
-        private Object newUser;
+        private final Object newUser;
 
         /**
          * Previous user of the application.
          */
-        private Object prevUser;
+        private final Object prevUser;
 
         /**
          * Constructor for user change event.
@@ -849,7 +825,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
          */
         private static final long serialVersionUID = 3544669568644691769L;
 
-        private Window window;
+        private final Window window;
 
         /**
          * Creates a event.
@@ -891,7 +867,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
          */
         private static final long serialVersionUID = 3977578104367822392L;
 
-        private Window window;
+        private final Window window;
 
         /**
          * Creates a event.
@@ -1066,7 +1042,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
 
         // Shows the error in AbstractComponent
         if (owner instanceof AbstractComponent) {
-            Throwable e = event.getThrowable();
+            final Throwable e = event.getThrowable();
             if (e instanceof ErrorMessage) {
                 ((AbstractComponent) owner).setComponentError((ErrorMessage) e);
             } else {
@@ -1099,7 +1075,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
      * @return Focused component or null if none is focused.
      */
     public Component.Focusable consumeFocus() {
-        Component.Focusable f = pendingFocus;
+        final Component.Focusable f = pendingFocus;
         pendingFocus = null;
         return f;
     }
index 94f7c3649e7301df6f821788218d8803a5620cf1..bddcb8489e3a1daf0f2d89fd6df1030b22fd91b7 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data;
 
@@ -175,7 +151,7 @@ public interface Buffered {
         private static final long serialVersionUID = 3256720671781630518L;
 
         /** Source class implementing the buffered interface */
-        private Buffered source;
+        private final Buffered source;
 
         /** Original cause of the source exception */
         private Throwable[] causes = {};
@@ -266,7 +242,7 @@ public interface Buffered {
             int level = Integer.MIN_VALUE;
 
             for (int i = 0; i < causes.length; i++) {
-                int causeLevel = (causes[i] instanceof ErrorMessage) ? ((ErrorMessage) causes[i])
+                final int causeLevel = (causes[i] instanceof ErrorMessage) ? ((ErrorMessage) causes[i])
                         .getErrorLevel()
                         : ErrorMessage.ERROR;
                 if (causeLevel > level) {
@@ -280,7 +256,7 @@ public interface Buffered {
         /* Documented in super interface */
         public void paint(PaintTarget target) throws PaintException {
             target.startTag("error");
-            int level = getErrorLevel();
+            final int level = getErrorLevel();
             if (level > 0 && level <= ErrorMessage.INFORMATION) {
                 target.addAttribute("level", "info");
             } else if (level <= ErrorMessage.WARNING) {
index f5fd3566df1b8ea243f69819f30af5d8d3e41e63..756936710ad23620b5b4db9c62b517c6eea0ab01 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data;
 
index d57ae6af30e12c4c15fcbe0a626f08a983589988..46cedf8e25719e8b27e55c6350033ef0255ad427 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data;
 
index a06a9dd72da9b47a7de8ed72e9a03c6f548d91b2..4645dbae980ae3ad5d9a3aed8df0a806bba00e96 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data;
 
index aa9a79b6d09784f2513b9abf4e538b8c249adc69..2b5543c4d34a3b94b4e2603907f646199cf9de57 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data;
 
index 9219dc8b8541a9caa3fe848e82bf4157b144100e..a80ed776b8d877b12ae0e90335bc08512e1233fb 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data;
 
index 2dcbb5bb4357b501cdd5efbe3925cc718ae17977..b56186bf694a15a40a80e3b32880f81e1fd5cc5b 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data;
 
@@ -157,7 +133,7 @@ public interface Validator {
             target.addAttribute("level", "error");
 
             // Error message
-            String message = getLocalizedMessage();
+            final String message = getLocalizedMessage();
             if (message != null) {
                 target.addText(message);
             }
index d5cb263274f7ca7433a1c5a1b97e694a1beb3b0d..330b59263405ed6e0502da3fd1d885efd0604ac3 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data.util;
 
@@ -50,7 +26,7 @@ public class BeanItem extends PropertysetItem {
     /**
      * The bean which this Item is based on.
      */
-    private Object bean;
+    private final Object bean;
 
     /**
      * <p>
@@ -76,23 +52,23 @@ public class BeanItem extends PropertysetItem {
         // Try to introspect, if it fails, we just have an empty Item
         try {
             // Create bean information
-            BeanInfo info = Introspector.getBeanInfo(bean.getClass());
-            PropertyDescriptor[] pd = info.getPropertyDescriptors();
+            final BeanInfo info = Introspector.getBeanInfo(bean.getClass());
+            final PropertyDescriptor[] pd = info.getPropertyDescriptors();
 
             // Add all the bean properties as MethodProperties to this Item
             for (int i = 0; i < pd.length; i++) {
-                Method getMethod = pd[i].getReadMethod();
-                Method setMethod = pd[i].getWriteMethod();
-                Class type = pd[i].getPropertyType();
-                String name = pd[i].getName();
+                final Method getMethod = pd[i].getReadMethod();
+                final Method setMethod = pd[i].getWriteMethod();
+                final Class type = pd[i].getPropertyType();
+                final String name = pd[i].getName();
 
                 if ((getMethod != null) && (setMethod != null)) {
-                    Property p = new MethodProperty(type, bean, getMethod,
-                            setMethod);
+                    final Property p = new MethodProperty(type, bean,
+                            getMethod, setMethod);
                     addItemProperty(name, p);
                 }
             }
-        } catch (java.beans.IntrospectionException ignored) {
+        } catch (final java.beans.IntrospectionException ignored) {
         }
     }
 
@@ -121,27 +97,27 @@ public class BeanItem extends PropertysetItem {
         // Try to introspect, if it fails, we just have an empty Item
         try {
             // Create bean information
-            BeanInfo info = Introspector.getBeanInfo(bean.getClass());
-            PropertyDescriptor[] pd = info.getPropertyDescriptors();
+            final BeanInfo info = Introspector.getBeanInfo(bean.getClass());
+            final PropertyDescriptor[] pd = info.getPropertyDescriptors();
 
             // Add all the bean properties as MethodProperties to this Item
-            for (Iterator iter = propertyIds.iterator(); iter.hasNext();) {
-                Object id = iter.next();
+            for (final Iterator iter = propertyIds.iterator(); iter.hasNext();) {
+                final Object id = iter.next();
                 for (int i = 0; i < pd.length; i++) {
-                    String name = pd[i].getName();
+                    final String name = pd[i].getName();
                     if (name.equals(id)) {
-                        Method getMethod = pd[i].getReadMethod();
-                        Method setMethod = pd[i].getWriteMethod();
-                        Class type = pd[i].getPropertyType();
+                        final Method getMethod = pd[i].getReadMethod();
+                        final Method setMethod = pd[i].getWriteMethod();
+                        final Class type = pd[i].getPropertyType();
 
-                        Property p = new MethodProperty(type, bean, getMethod,
-                                setMethod);
+                        final Property p = new MethodProperty(type, bean,
+                                getMethod, setMethod);
                         addItemProperty(name, p);
                     }
                 }
             }
 
-        } catch (java.beans.IntrospectionException ignored) {
+        } catch (final java.beans.IntrospectionException ignored) {
         }
 
     }
index 6246775f1f1f654169a2bc182c7f3f4033a6fb6f..62858548734794f722f1a12113b3e10cef586103 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data.util;
 
@@ -60,7 +36,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
         Container.ItemSetChangeNotifier, Container.PropertySetChangeNotifier {
 
     /** The wrapped container */
-    private Container container;
+    private final Container container;
 
     /** Set of IDs of those contained Items that can't have children. */
     private HashSet noChildrenAllowed = null;
@@ -130,23 +106,23 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
             else {
 
                 // Calculate the set of all items in the hierarchy
-                HashSet s = new HashSet();
+                final HashSet s = new HashSet();
                 s.add(parent.keySet());
                 s.add(children.keySet());
                 s.addAll(roots);
 
                 // Remove unnecessary items
-                for (Iterator i = s.iterator(); i.hasNext();) {
-                    Object id = i.next();
+                for (final Iterator i = s.iterator(); i.hasNext();) {
+                    final Object id = i.next();
                     if (!container.containsId(id)) {
                         removeFromHierarchyWrapper(id);
                     }
                 }
 
                 // Add all the missing items
-                Collection ids = container.getItemIds();
-                for (Iterator i = ids.iterator(); i.hasNext();) {
-                    Object id = i.next();
+                final Collection ids = container.getItemIds();
+                for (final Iterator i = ids.iterator(); i.hasNext();) {
+                    final Object id = i.next();
                     if (!s.contains(id)) {
                         addToHierarchyWrapper(id);
                         s.add(id);
@@ -171,9 +147,9 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
         if (isRoot(itemId)) {
             roots.remove(itemId);
         }
-        Object p = parent.get(itemId);
+        final Object p = parent.get(itemId);
         if (p != null) {
-            LinkedList c = (LinkedList) children.get(p);
+            final LinkedList c = (LinkedList) children.get(p);
             if (c != null) {
                 c.remove(itemId);
             }
@@ -221,7 +197,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
             return ((Container.Hierarchical) container).getChildren(itemId);
         }
 
-        Collection c = (Collection) children.get(itemId);
+        final Collection c = (Collection) children.get(itemId);
         if (c == null) {
             return null;
         }
@@ -361,7 +337,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
         }
 
         // Get the old parent
-        Object oldParentId = parent.get(itemId);
+        final Object oldParentId = parent.get(itemId);
 
         // Check if no change is necessary
         if ((newParentId == null && oldParentId == null)
@@ -373,7 +349,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
         if (newParentId == null) {
 
             // Remove from old parents children list
-            LinkedList l = (LinkedList) children.get(itemId);
+            final LinkedList l = (LinkedList) children.get(itemId);
             if (l != null) {
                 l.remove(itemId);
                 if (l.isEmpty()) {
@@ -418,7 +394,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
         if (oldParentId == null) {
             roots.remove(itemId);
         } else {
-            LinkedList l = (LinkedList) children.get(oldParentId);
+            final LinkedList l = (LinkedList) children.get(oldParentId);
             if (l != null) {
                 l.remove(itemId);
                 if (l.isEmpty()) {
@@ -441,7 +417,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
      */
     public Object addItem() throws UnsupportedOperationException {
 
-        Object id = container.addItem();
+        final Object id = container.addItem();
         if (id != null) {
             addToHierarchyWrapper(id);
         }
@@ -460,7 +436,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
      */
     public Item addItem(Object itemId) throws UnsupportedOperationException {
 
-        Item item = container.addItem(itemId);
+        final Item item = container.addItem(itemId);
         if (item != null) {
             addToHierarchyWrapper(itemId);
         }
@@ -477,7 +453,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
      */
     public boolean removeAllItems() throws UnsupportedOperationException {
 
-        boolean success = container.removeAllItems();
+        final boolean success = container.removeAllItems();
 
         if (success) {
             roots.clear();
@@ -502,7 +478,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
     public boolean removeItem(Object itemId)
             throws UnsupportedOperationException {
 
-        boolean success = container.removeItem(itemId);
+        final boolean success = container.removeItem(itemId);
 
         if (success) {
             removeFromHierarchyWrapper(itemId);
index b2fc22e8f8e6dfd5d1772f9c6893e9ce56c5c810..c5d8ee1e8cba11357df02b7d6c56b2374793f314 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data.util;
 
@@ -60,7 +36,7 @@ public class ContainerOrderedWrapper implements Container.Ordered,
     /**
      * The wrapped container
      */
-    private Container container;
+    private final Container container;
 
     /**
      * Ordering information, ie. the mapping from Item ID to the next item ID
@@ -123,8 +99,8 @@ public class ContainerOrderedWrapper implements Container.Ordered,
      */
     private void removeFromOrderWrapper(Object id) {
         if (id != null) {
-            Object pid = prev.get(id);
-            Object nid = next.get(id);
+            final Object pid = prev.get(id);
+            final Object nid = next.get(id);
             if (first.equals(id)) {
                 first = nid;
             }
@@ -202,7 +178,7 @@ public class ContainerOrderedWrapper implements Container.Ordered,
 
         if (!ordered) {
 
-            Collection ids = container.getItemIds();
+            final Collection ids = container.getItemIds();
 
             // Recreates ordering if some parts of it are missing
             if (next == null || first == null || last == null || prev != null) {
@@ -213,17 +189,17 @@ public class ContainerOrderedWrapper implements Container.Ordered,
             }
 
             // Filter out all the missing items
-            LinkedList l = new LinkedList(next.keySet());
-            for (Iterator i = l.iterator(); i.hasNext();) {
-                Object id = i.next();
+            final LinkedList l = new LinkedList(next.keySet());
+            for (final Iterator i = l.iterator(); i.hasNext();) {
+                final Object id = i.next();
                 if (!container.containsId(id)) {
                     removeFromOrderWrapper(id);
                 }
             }
 
             // Adds missing items
-            for (Iterator i = ids.iterator(); i.hasNext();) {
-                Object id = i.next();
+            for (final Iterator i = ids.iterator(); i.hasNext();) {
+                final Object id = i.next();
                 if (!next.containsKey(id)) {
                     addToOrderWrapper(id);
                 }
@@ -332,7 +308,7 @@ public class ContainerOrderedWrapper implements Container.Ordered,
      */
     public Object addItem() throws UnsupportedOperationException {
 
-        Object id = container.addItem();
+        final Object id = container.addItem();
         if (id != null) {
             addToOrderWrapper(id);
         }
@@ -350,7 +326,7 @@ public class ContainerOrderedWrapper implements Container.Ordered,
      *                 if the addItem is not supported.
      */
     public Item addItem(Object itemId) throws UnsupportedOperationException {
-        Item item = container.addItem(itemId);
+        final Item item = container.addItem(itemId);
         if (item != null) {
             addToOrderWrapper(itemId);
         }
@@ -366,7 +342,7 @@ public class ContainerOrderedWrapper implements Container.Ordered,
      *                 if the removeAllItems is not supported.
      */
     public boolean removeAllItems() throws UnsupportedOperationException {
-        boolean success = container.removeAllItems();
+        final boolean success = container.removeAllItems();
         if (success) {
             first = last = null;
             next.clear();
@@ -389,7 +365,7 @@ public class ContainerOrderedWrapper implements Container.Ordered,
     public boolean removeItem(Object itemId)
             throws UnsupportedOperationException {
 
-        boolean success = container.removeItem(itemId);
+        final boolean success = container.removeItem(itemId);
         if (success) {
             removeFromOrderWrapper(itemId);
         }
@@ -536,7 +512,7 @@ public class ContainerOrderedWrapper implements Container.Ordered,
         }
 
         // Adds the item to container
-        Item item = container.addItem(newItemId);
+        final Item item = container.addItem(newItemId);
 
         // Puts the new item to its correct place
         if (item != null) {
@@ -558,7 +534,7 @@ public class ContainerOrderedWrapper implements Container.Ordered,
         }
 
         // Adds the item to container
-        Object id = container.addItem();
+        final Object id = container.addItem();
 
         // Puts the new item to its correct place
         if (id != null) {
index 789dd110aa720a3f507ac60d742c5b0f76bb2dc3..9493533223e6af4f0a179dcdd3b99e498ff2135e 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data.util;
 
@@ -104,7 +80,7 @@ public class FilesystemContainer implements Container.Hierarchical {
             FILEITEM_NAME = FileItem.class.getMethod("getName", new Class[] {});
             FILEITEM_ICON = FileItem.class.getMethod("getIcon", new Class[] {});
             FILEITEM_SIZE = FileItem.class.getMethod("getSize", new Class[] {});
-        } catch (NoSuchMethodException e) {
+        } catch (final NoSuchMethodException e) {
 
         }
     }
@@ -189,7 +165,7 @@ public class FilesystemContainer implements Container.Hierarchical {
      */
     public void addRoot(File root) {
         if (root != null) {
-            File[] newRoots = new File[roots.length + 1];
+            final File[] newRoots = new File[roots.length + 1];
             for (int i = 0; i < roots.length; i++) {
                 newRoots[i] = roots[i];
             }
@@ -234,7 +210,7 @@ public class FilesystemContainer implements Container.Hierarchical {
             return Collections.unmodifiableCollection(new LinkedList());
         }
 
-        List l = Arrays.asList(f);
+        final List l = Arrays.asList(f);
         Collections.sort(l);
 
         return Collections.unmodifiableCollection(l);
@@ -312,7 +288,7 @@ public class FilesystemContainer implements Container.Hierarchical {
             return Collections.unmodifiableCollection(new LinkedList());
         }
 
-        List l = Arrays.asList(f);
+        final List l = Arrays.asList(f);
         Collections.sort(l);
 
         return Collections.unmodifiableCollection(l);
@@ -376,7 +352,7 @@ public class FilesystemContainer implements Container.Hierarchical {
             try {
                 val |= ((File) itemId).getCanonicalPath().startsWith(
                         roots[i].getCanonicalPath());
-            } catch (IOException e) {
+            } catch (final IOException e) {
                 // Exception ignored
             }
 
@@ -416,11 +392,11 @@ public class FilesystemContainer implements Container.Hierarchical {
         } else {
             l = f.listFiles();
         }
-        List ll = Arrays.asList(l);
+        final List ll = Arrays.asList(l);
         Collections.sort(ll);
 
-        for (Iterator i = ll.iterator(); i.hasNext();) {
-            File lf = (File) i.next();
+        for (final Iterator i = ll.iterator(); i.hasNext();) {
+            final File lf = (File) i.next();
             if (lf.isDirectory()) {
                 addItemIds(col, lf);
             } else {
@@ -436,7 +412,7 @@ public class FilesystemContainer implements Container.Hierarchical {
     public Collection getItemIds() {
 
         if (recursive) {
-            Collection col = new ArrayList();
+            final Collection col = new ArrayList();
             for (int i = 0; i < roots.length; i++) {
                 addItemIds(col, roots[i]);
             }
@@ -457,7 +433,7 @@ public class FilesystemContainer implements Container.Hierarchical {
                 return Collections.unmodifiableCollection(new LinkedList());
             }
 
-            List l = Arrays.asList(f);
+            final List l = Arrays.asList(f);
             Collections.sort(l);
             return Collections.unmodifiableCollection(l);
         }
@@ -612,7 +588,7 @@ public class FilesystemContainer implements Container.Hierarchical {
         /**
          * The wrapped file.
          */
-        private File file;
+        private final File file;
 
         /**
          * Constructs a FileItem from a existing file.
@@ -664,7 +640,7 @@ public class FilesystemContainer implements Container.Hierarchical {
             if (obj == null || !(obj instanceof FileItem)) {
                 return false;
             }
-            FileItem fi = (FileItem) obj;
+            final FileItem fi = (FileItem) obj;
             return fi.getHost() == getHost() && fi.file.equals(file);
         }
 
@@ -759,7 +735,7 @@ public class FilesystemContainer implements Container.Hierarchical {
      */
     public class FileExtensionFilter implements FilenameFilter {
 
-        private String filter;
+        private final String filter;
 
         /**
          * Constructs a new FileExtensionFilter using given extension.
index 81ff28546ebaff20ca68803ec19a07a433531281..096c83f45534532b0799712215471f4d51d8e51e 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data.util;
 
@@ -52,22 +28,22 @@ public class HierarchicalContainer extends IndexedContainer implements
     /**
      * Set of IDs of those contained Items that can't have children.
      */
-    private HashSet noChildrenAllowed = new HashSet();
+    private final HashSet noChildrenAllowed = new HashSet();
 
     /**
      * Mapping from Item ID to parent Item.
      */
-    private Hashtable parent = new Hashtable();
+    private final Hashtable parent = new Hashtable();
 
     /**
      * Mapping from Item ID to a list of child IDs.
      */
-    private Hashtable children = new Hashtable();
+    private final Hashtable children = new Hashtable();
 
     /**
      * List that contains all root elements of the container.
      */
-    private LinkedList roots = new LinkedList();
+    private final LinkedList roots = new LinkedList();
 
     /*
      * Can the specified Item have any children? Don't add a JavaDoc comment
@@ -83,7 +59,7 @@ public class HierarchicalContainer extends IndexedContainer implements
      * interface.
      */
     public Collection getChildren(Object itemId) {
-        Collection c = (Collection) children.get(itemId);
+        final Collection c = (Collection) children.get(itemId);
         if (c == null) {
             return null;
         }
@@ -187,7 +163,7 @@ public class HierarchicalContainer extends IndexedContainer implements
         }
 
         // Gets the old parent
-        Object oldParentId = parent.get(itemId);
+        final Object oldParentId = parent.get(itemId);
 
         // Checks if no change is necessary
         if ((newParentId == null && oldParentId == null)
@@ -199,7 +175,7 @@ public class HierarchicalContainer extends IndexedContainer implements
         if (newParentId == null) {
 
             // Removes from old parents children list
-            LinkedList l = (LinkedList) children.get(itemId);
+            final LinkedList l = (LinkedList) children.get(itemId);
             if (l != null) {
                 l.remove(itemId);
                 if (l.isEmpty()) {
@@ -244,7 +220,7 @@ public class HierarchicalContainer extends IndexedContainer implements
         if (oldParentId == null) {
             roots.remove(itemId);
         } else {
-            LinkedList l = (LinkedList) children.get(oldParentId);
+            final LinkedList l = (LinkedList) children.get(oldParentId);
             if (l != null) {
                 l.remove(itemId);
                 if (l.isEmpty()) {
@@ -260,7 +236,7 @@ public class HierarchicalContainer extends IndexedContainer implements
      * @see com.itmill.toolkit.data.Container#addItem()
      */
     public Object addItem() {
-        Object id = super.addItem();
+        final Object id = super.addItem();
         if (id != null && !roots.contains(id)) {
             roots.add(id);
         }
@@ -272,7 +248,7 @@ public class HierarchicalContainer extends IndexedContainer implements
      * @see com.itmill.toolkit.data.Container#addItem(Object)
      */
     public Item addItem(Object itemId) {
-        Item item = super.addItem(itemId);
+        final Item item = super.addItem(itemId);
         if (item != null) {
             roots.add(itemId);
         }
@@ -283,7 +259,7 @@ public class HierarchicalContainer extends IndexedContainer implements
      * @see com.itmill.toolkit.data.Container#removeAllItems()
      */
     public boolean removeAllItems() {
-        boolean success = super.removeAllItems();
+        final boolean success = super.removeAllItems();
 
         if (success) {
             roots.clear();
@@ -298,16 +274,16 @@ public class HierarchicalContainer extends IndexedContainer implements
      * @see com.itmill.toolkit.data.Container#removeItem(Object)
      */
     public boolean removeItem(Object itemId) {
-        boolean success = super.removeItem(itemId);
+        final boolean success = super.removeItem(itemId);
 
         if (success) {
             if (isRoot(itemId)) {
                 roots.remove(itemId);
             }
             children.remove(itemId);
-            Object p = parent.get(itemId);
+            final Object p = parent.get(itemId);
             if (p != null) {
-                LinkedList c = (LinkedList) children.get(p);
+                final LinkedList c = (LinkedList) children.get(p);
                 if (c != null) {
                     c.remove(itemId);
                 }
index 00bd0985485b8ec04fd4c280831a8e0f2871568d..cf8d81ccaf3aa5a65a0f3ce8ee41599dfc496d4d 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data.util;
 
@@ -145,7 +121,7 @@ public class IndexedContainer implements Container, Container.Indexed,
 
     public IndexedContainer(Collection itemIds) {
         if (items != null) {
-            for (Iterator i = itemIds.iterator(); i.hasNext();) {
+            for (final Iterator i = itemIds.iterator(); i.hasNext();) {
                 this.addItem(i.next());
             }
         }
@@ -290,7 +266,7 @@ public class IndexedContainer implements Container, Container.Indexed,
 
         // If default value is given, set it
         if (defaultValue != null) {
-            for (Iterator i = itemIds.iterator(); i.hasNext();) {
+            for (final Iterator i = itemIds.iterator(); i.hasNext();) {
                 getItem(i.next()).getItemProperty(propertyId).setValue(
                         defaultValue);
             }
@@ -339,7 +315,7 @@ public class IndexedContainer implements Container, Container.Indexed,
     public Object addItem() {
 
         // Creates a new id
-        Object id = new Object();
+        final Object id = new Object();
 
         // Adds the Item into container
         addItem(id);
@@ -367,7 +343,7 @@ public class IndexedContainer implements Container, Container.Indexed,
         // Adds the Item to container
         itemIds.add(itemId);
         items.put(itemId, new Hashtable());
-        Item item = getItem(itemId);
+        final Item item = getItem(itemId);
         if (filteredItemIds != null) {
             if (passesFilters(item)) {
                 filteredItemIds.add(itemId);
@@ -424,7 +400,7 @@ public class IndexedContainer implements Container, Container.Indexed,
         types.remove(propertyId);
 
         // If remove the Property from all Items
-        for (Iterator i = itemIds.iterator(); i.hasNext();) {
+        for (final Iterator i = itemIds.iterator(); i.hasNext();) {
             ((Hashtable) items.get(i.next())).remove(propertyId);
         }
 
@@ -447,8 +423,8 @@ public class IndexedContainer implements Container, Container.Indexed,
                 return filteredItemIds.iterator().next();
             }
             return itemIds.get(0);
-        } catch (IndexOutOfBoundsException e) {
-        } catch (NoSuchElementException e) {
+        } catch (final IndexOutOfBoundsException e) {
+        } catch (final NoSuchElementException e) {
         }
         return null;
     }
@@ -461,7 +437,7 @@ public class IndexedContainer implements Container, Container.Indexed,
     public Object lastItemId() {
         try {
             if (filteredItemIds != null) {
-                Iterator i = filteredItemIds.iterator();
+                final Iterator i = filteredItemIds.iterator();
                 Object last = null;
                 while (i.hasNext()) {
                     last = i.next();
@@ -469,7 +445,7 @@ public class IndexedContainer implements Container, Container.Indexed,
                 return last;
             }
             return itemIds.get(itemIds.size() - 1);
-        } catch (IndexOutOfBoundsException e) {
+        } catch (final IndexOutOfBoundsException e) {
         }
         return null;
     }
@@ -488,7 +464,7 @@ public class IndexedContainer implements Container, Container.Indexed,
             if (!filteredItemIds.contains(itemId)) {
                 return null;
             }
-            Iterator i = filteredItemIds.iterator();
+            final Iterator i = filteredItemIds.iterator();
             if (itemId == null) {
                 return null;
             }
@@ -502,7 +478,7 @@ public class IndexedContainer implements Container, Container.Indexed,
         }
         try {
             return itemIds.get(itemIds.indexOf(itemId) + 1);
-        } catch (IndexOutOfBoundsException e) {
+        } catch (final IndexOutOfBoundsException e) {
             return null;
         }
     }
@@ -521,7 +497,7 @@ public class IndexedContainer implements Container, Container.Indexed,
             if (!filteredItemIds.contains(itemId)) {
                 return null;
             }
-            Iterator i = filteredItemIds.iterator();
+            final Iterator i = filteredItemIds.iterator();
             if (itemId == null) {
                 return null;
             }
@@ -534,7 +510,7 @@ public class IndexedContainer implements Container, Container.Indexed,
         }
         try {
             return itemIds.get(itemIds.indexOf(itemId) - 1);
-        } catch (IndexOutOfBoundsException e) {
+        } catch (final IndexOutOfBoundsException e) {
             return null;
         }
     }
@@ -551,9 +527,9 @@ public class IndexedContainer implements Container, Container.Indexed,
     public boolean isFirstId(Object itemId) {
         if (filteredItemIds != null) {
             try {
-                Object first = filteredItemIds.iterator().next();
+                final Object first = filteredItemIds.iterator().next();
                 return (itemId != null && itemId.equals(first));
-            } catch (NoSuchElementException e) {
+            } catch (final NoSuchElementException e) {
                 return false;
             }
         }
@@ -573,15 +549,15 @@ public class IndexedContainer implements Container, Container.Indexed,
         if (filteredItemIds != null) {
             try {
                 Object last = null;
-                for (Iterator i = filteredItemIds.iterator(); i.hasNext();) {
+                for (final Iterator i = filteredItemIds.iterator(); i.hasNext();) {
                     last = i.next();
                 }
                 return (itemId != null && itemId.equals(last));
-            } catch (NoSuchElementException e) {
+            } catch (final NoSuchElementException e) {
                 return false;
             }
         }
-        int s = size();
+        final int s = size();
         return (s >= 1 && itemIds.get(s - 1).equals(itemId));
     }
 
@@ -635,12 +611,12 @@ public class IndexedContainer implements Container, Container.Indexed,
                 throw new IndexOutOfBoundsException();
             }
             try {
-                Iterator i = filteredItemIds.iterator();
+                final Iterator i = filteredItemIds.iterator();
                 while (index-- > 0) {
                     i.next();
                 }
                 return i.next();
-            } catch (NoSuchElementException e) {
+            } catch (final NoSuchElementException e) {
                 throw new IndexOutOfBoundsException();
             }
         }
@@ -663,12 +639,12 @@ public class IndexedContainer implements Container, Container.Indexed,
                 return -1;
             }
             try {
-                for (Iterator i = filteredItemIds.iterator(); itemId.equals(i
-                        .next());) {
+                for (final Iterator i = filteredItemIds.iterator(); itemId
+                        .equals(i.next());) {
                     index++;
                 }
                 return index;
-            } catch (NoSuchElementException e) {
+            } catch (final NoSuchElementException e) {
                 return -1;
             }
         }
@@ -704,7 +680,7 @@ public class IndexedContainer implements Container, Container.Indexed,
     public Object addItemAt(int index) {
 
         // Creates a new id
-        Object id = new Object();
+        final Object id = new Object();
 
         // Adds the Item into container
         addItemAt(index, id);
@@ -894,8 +870,8 @@ public class IndexedContainer implements Container, Container.Indexed,
 
         // Sends event to listeners listening all value changes
         if (propertyValueChangeListeners != null) {
-            Object[] l = propertyValueChangeListeners.toArray();
-            Property.ValueChangeEvent event = new IndexedContainer.PropertyValueChangeEvent(
+            final Object[] l = propertyValueChangeListeners.toArray();
+            final Property.ValueChangeEvent event = new IndexedContainer.PropertyValueChangeEvent(
                     source);
             for (int i = 0; i < l.length; i++) {
                 ((Property.ValueChangeListener) l[i]).valueChange(event);
@@ -904,15 +880,16 @@ public class IndexedContainer implements Container, Container.Indexed,
 
         // Sends event to single property value change listeners
         if (singlePropertyValueChangeListeners != null) {
-            Hashtable propertySetToListenerListMap = (Hashtable) singlePropertyValueChangeListeners
+            final Hashtable propertySetToListenerListMap = (Hashtable) singlePropertyValueChangeListeners
                     .get(source.propertyId);
             if (propertySetToListenerListMap != null) {
-                LinkedList listenerList = (LinkedList) propertySetToListenerListMap
+                final LinkedList listenerList = (LinkedList) propertySetToListenerListMap
                         .get(source.itemId);
                 if (listenerList != null) {
-                    Property.ValueChangeEvent event = new IndexedContainer.PropertyValueChangeEvent(
+                    final Property.ValueChangeEvent event = new IndexedContainer.PropertyValueChangeEvent(
                             source);
-                    for (Iterator i = listenerList.iterator(); i.hasNext();) {
+                    for (final Iterator i = listenerList.iterator(); i
+                            .hasNext();) {
                         ((Property.ValueChangeListener) i.next())
                                 .valueChange(event);
                     }
@@ -927,8 +904,8 @@ public class IndexedContainer implements Container, Container.Indexed,
      */
     private void fireContainerPropertySetChange() {
         if (propertySetChangeListeners != null) {
-            Object[] l = propertySetChangeListeners.toArray();
-            Container.PropertySetChangeEvent event = new IndexedContainer.PropertySetChangeEvent(
+            final Object[] l = propertySetChangeListeners.toArray();
+            final Container.PropertySetChangeEvent event = new IndexedContainer.PropertySetChangeEvent(
                     this);
             for (int i = 0; i < l.length; i++) {
                 ((Container.PropertySetChangeListener) l[i])
@@ -942,8 +919,8 @@ public class IndexedContainer implements Container, Container.Indexed,
      */
     private void fireContentsChange() {
         if (itemSetChangeListeners != null) {
-            Object[] l = itemSetChangeListeners.toArray();
-            Container.ItemSetChangeEvent event = new IndexedContainer.ItemSetChangeEvent(
+            final Object[] l = itemSetChangeListeners.toArray();
+            final Container.ItemSetChangeEvent event = new IndexedContainer.ItemSetChangeEvent(
                     this);
             for (int i = 0; i < l.length; i++) {
                 ((Container.ItemSetChangeListener) l[i])
@@ -998,10 +975,10 @@ public class IndexedContainer implements Container, Container.Indexed,
     private void removeSinglePropertyChangeListener(Object propertyId,
             Object itemId, Property.ValueChangeListener listener) {
         if (listener != null && singlePropertyValueChangeListeners != null) {
-            Hashtable propertySetToListenerListMap = (Hashtable) singlePropertyValueChangeListeners
+            final Hashtable propertySetToListenerListMap = (Hashtable) singlePropertyValueChangeListeners
                     .get(propertyId);
             if (propertySetToListenerListMap != null) {
-                LinkedList listenerList = (LinkedList) propertySetToListenerListMap
+                final LinkedList listenerList = (LinkedList) propertySetToListenerListMap
                         .get(itemId);
                 if (listenerList != null) {
                     listenerList.remove(listener);
@@ -1033,7 +1010,7 @@ public class IndexedContainer implements Container, Container.Indexed,
         /**
          * Item ID in the host container for this Item.
          */
-        private Object itemId;
+        private final Object itemId;
 
         /**
          * Constructs a new ListItem instance and connects it to a host
@@ -1086,8 +1063,8 @@ public class IndexedContainer implements Container, Container.Indexed,
         public String toString() {
             String retValue = "";
 
-            for (Iterator i = propertyIds.iterator(); i.hasNext();) {
-                Object propertyId = i.next();
+            for (final Iterator i = propertyIds.iterator(); i.hasNext();) {
+                final Object propertyId = i.next();
                 retValue += getItemProperty(propertyId).toString();
                 if (i.hasNext()) {
                     retValue += " ";
@@ -1123,7 +1100,7 @@ public class IndexedContainer implements Container, Container.Indexed,
                     || !obj.getClass().equals(IndexedContainerItem.class)) {
                 return false;
             }
-            IndexedContainerItem li = (IndexedContainerItem) obj;
+            final IndexedContainerItem li = (IndexedContainerItem) obj;
             return getHost() == li.getHost() && itemId.equals(li.itemId);
         }
 
@@ -1175,12 +1152,12 @@ public class IndexedContainer implements Container, Container.Indexed,
         /**
          * ID of the Item, where the Property resides.
          */
-        private Object itemId;
+        private final Object itemId;
 
         /**
          * Id of the Property.
          */
-        private Object propertyId;
+        private final Object propertyId;
 
         /**
          * Constructs a new ListProperty object and connect it to a ListItem and
@@ -1275,7 +1252,7 @@ public class IndexedContainer implements Container, Container.Indexed,
                 throws Property.ReadOnlyException, Property.ConversionException {
 
             // Gets the Property set
-            Hashtable propertySet = (Hashtable) items.get(itemId);
+            final Hashtable propertySet = (Hashtable) items.get(itemId);
 
             // Support null values on all types
             if (newValue == null) {
@@ -1286,14 +1263,14 @@ public class IndexedContainer implements Container, Container.Indexed,
                 try {
 
                     // Gets the string constructor
-                    Constructor constr = getType().getConstructor(
+                    final Constructor constr = getType().getConstructor(
                             new Class[] { String.class });
 
                     // Creates new object from the string
                     propertySet.put(propertyId, constr
                             .newInstance(new Object[] { newValue.toString() }));
 
-                } catch (java.lang.Exception e) {
+                } catch (final java.lang.Exception e) {
                     throw new Property.ConversionException(
                             "Conversion for value '" + newValue + "' of class "
                                     + newValue.getClass().getName() + " to "
@@ -1313,7 +1290,7 @@ public class IndexedContainer implements Container, Container.Indexed,
          *         the Property
          */
         public String toString() {
-            Object value = getValue();
+            final Object value = getValue();
             if (value == null) {
                 return null;
             }
@@ -1348,7 +1325,7 @@ public class IndexedContainer implements Container, Container.Indexed,
                     || !obj.getClass().equals(IndexedContainerProperty.class)) {
                 return false;
             }
-            IndexedContainerProperty lp = (IndexedContainerProperty) obj;
+            final IndexedContainerProperty lp = (IndexedContainerProperty) obj;
             return lp.getHost() == getHost()
                     && lp.propertyId.equals(propertyId)
                     && lp.itemId.equals(itemId);
@@ -1389,9 +1366,9 @@ public class IndexedContainer implements Container, Container.Indexed,
     public synchronized void sort(Object[] propertyId, boolean[] ascending) {
 
         // Removes any non-sortable property ids
-        ArrayList ids = new ArrayList();
-        ArrayList orders = new ArrayList();
-        Collection sortable = getSortableContainerPropertyIds();
+        final ArrayList ids = new ArrayList();
+        final ArrayList orders = new ArrayList();
+        final Collection sortable = getSortableContainerPropertyIds();
         for (int i = 0; i < propertyId.length; i++) {
             if (sortable.contains(propertyId[i])) {
                 ids.add(propertyId[i]);
@@ -1428,10 +1405,10 @@ public class IndexedContainer implements Container, Container.Indexed,
      */
     public Collection getSortableContainerPropertyIds() {
 
-        LinkedList list = new LinkedList();
-        for (Iterator i = propertyIds.iterator(); i.hasNext();) {
-            Object id = i.next();
-            Class type = getType(id);
+        final LinkedList list = new LinkedList();
+        for (final Iterator i = propertyIds.iterator(); i.hasNext();) {
+            final Object id = i.next();
+            final Class type = getType(id);
             if (type != null && Comparable.class.isAssignableFrom(type)) {
                 list.add(id);
             }
@@ -1451,12 +1428,12 @@ public class IndexedContainer implements Container, Container.Indexed,
         for (int i = 0; i < sortPropertyId.length; i++) {
 
             // Get the compared properties
-            Property pp1 = getContainerProperty(o1, sortPropertyId[i]);
-            Property pp2 = getContainerProperty(o2, sortPropertyId[i]);
+            final Property pp1 = getContainerProperty(o1, sortPropertyId[i]);
+            final Property pp2 = getContainerProperty(o2, sortPropertyId[i]);
 
             // Get the compared values
-            Object p1 = pp1 == null ? null : pp1.getValue();
-            Object p2 = pp2 == null ? null : pp2.getValue();
+            final Object p1 = pp1 == null ? null : pp1.getValue();
+            final Object p2 = pp2 == null ? null : pp2.getValue();
 
             // Result of the comparison
             int r = 0;
@@ -1498,7 +1475,7 @@ public class IndexedContainer implements Container, Container.Indexed,
     public Object clone() throws CloneNotSupportedException {
 
         // Creates the clone
-        IndexedContainer nc = new IndexedContainer();
+        final IndexedContainer nc = new IndexedContainer();
 
         // Clone the shallow properties
         nc.itemIds = itemIds != null ? (ArrayList) itemIds.clone() : null;
@@ -1535,9 +1512,9 @@ public class IndexedContainer implements Container, Container.Indexed,
             nc.items = null;
         } else {
             nc.items = new Hashtable();
-            for (Iterator i = items.keySet().iterator(); i.hasNext();) {
-                Object id = i.next();
-                Hashtable it = (Hashtable) items.get(id);
+            for (final Iterator i = items.keySet().iterator(); i.hasNext();) {
+                final Object id = i.next();
+                final Hashtable it = (Hashtable) items.get(id);
                 nc.items.put(id, it.clone());
             }
         }
@@ -1554,7 +1531,7 @@ public class IndexedContainer implements Container, Container.Indexed,
         if (!(obj instanceof IndexedContainer)) {
             return false;
         }
-        IndexedContainer o = (IndexedContainer) obj;
+        final IndexedContainer o = (IndexedContainer) obj;
 
         // Checks the properties one by one
         if (itemIds != o.itemIds && o.itemIds != null
@@ -1664,7 +1641,7 @@ public class IndexedContainer implements Container, Container.Indexed,
             if (!(obj instanceof Filter)) {
                 return false;
             }
-            Filter o = (Filter) obj;
+            final Filter o = (Filter) obj;
 
             // Checks the properties one by one
             if (propertyId != o.propertyId && o.propertyId != null
@@ -1714,8 +1691,8 @@ public class IndexedContainer implements Container, Container.Indexed,
         if (filters == null || propertyId == null) {
             return;
         }
-        for (Iterator i = filters.iterator(); i.hasNext();) {
-            Filter f = (Filter) i.next();
+        for (final Iterator i = filters.iterator(); i.hasNext();) {
+            final Filter f = (Filter) i.next();
             if (propertyId.equals(f.propertyId)) {
                 i.remove();
             }
@@ -1743,8 +1720,8 @@ public class IndexedContainer implements Container, Container.Indexed,
         }
 
         // Filter
-        for (Iterator i = itemIds.iterator(); i.hasNext();) {
-            Object id = i.next();
+        for (final Iterator i = itemIds.iterator(); i.hasNext();) {
+            final Object id = i.next();
             if (passesFilters(new IndexedContainerItem(id))) {
                 filteredItemIds.add(id);
             }
@@ -1760,15 +1737,15 @@ public class IndexedContainer implements Container, Container.Indexed,
         if (item == null) {
             return false;
         }
-        for (Iterator i = filters.iterator(); i.hasNext();) {
-            Filter f = (Filter) i.next();
-            String s1 = f.ignoreCase ? f.filterString.toLowerCase()
+        for (final Iterator i = filters.iterator(); i.hasNext();) {
+            final Filter f = (Filter) i.next();
+            final String s1 = f.ignoreCase ? f.filterString.toLowerCase()
                     : f.filterString;
-            Property p = item.getItemProperty(f.propertyId);
+            final Property p = item.getItemProperty(f.propertyId);
             if (p == null || p.toString() == null) {
                 return false;
             }
-            String s2 = f.ignoreCase ? p.toString().toLowerCase() : p
+            final String s2 = f.ignoreCase ? p.toString().toLowerCase() : p
                     .toString();
             if (f.onlyMatchPrefix) {
                 if (s2.indexOf(s1) != 0) {
index e28ce8f3850c13b4a06dcf3548af19046e9f4293..04ed811b63d8121f7d70f0b69a225dac8b22a70d 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data.util;
 
@@ -65,7 +41,7 @@ public class MethodProperty implements Property {
     /**
      * The object that includes the property the MethodProperty is bound to.
      */
-    private Object instance;
+    private final Object instance;
 
     /**
      * Argument arrays for the getter and setter methods.
@@ -132,12 +108,12 @@ public class MethodProperty implements Property {
      */
     public MethodProperty(Object instance, String beanPropertyName) {
 
-        Class beanClass = instance.getClass();
+        final Class beanClass = instance.getClass();
 
         // Assure that the first letter is upper cased (it is a common
         // mistake to write firstName, not FirstName).
         if (Character.isLowerCase(beanPropertyName.charAt(0))) {
-            char[] buf = beanPropertyName.toCharArray();
+            final char[] buf = beanPropertyName.toCharArray();
             buf[0] = Character.toUpperCase(buf[0]);
             beanPropertyName = new String(buf);
         }
@@ -147,15 +123,15 @@ public class MethodProperty implements Property {
         try {
             getMethod = beanClass.getMethod("get" + beanPropertyName,
                     new Class[] {});
-        } catch (java.lang.NoSuchMethodException ignored) {
+        } catch (final java.lang.NoSuchMethodException ignored) {
             try {
                 getMethod = beanClass.getMethod("is" + beanPropertyName,
                         new Class[] {});
-            } catch (java.lang.NoSuchMethodException ignoredAsWell) {
+            } catch (final java.lang.NoSuchMethodException ignoredAsWell) {
                 try {
                     getMethod = beanClass.getMethod("are" + beanPropertyName,
                             new Class[] {});
-                } catch (java.lang.NoSuchMethodException e) {
+                } catch (final java.lang.NoSuchMethodException e) {
                     throw new MethodProperty.MethodException("Bean property "
                             + beanPropertyName + " can not be found");
                 }
@@ -170,7 +146,7 @@ public class MethodProperty implements Property {
         try {
             setMethod = beanClass.getMethod("set" + beanPropertyName,
                     new Class[] { type });
-        } catch (java.lang.NoSuchMethodException skipped) {
+        } catch (final java.lang.NoSuchMethodException skipped) {
         }
 
         // Gets the return type from get method
@@ -313,7 +289,7 @@ public class MethodProperty implements Property {
         this.type = type;
 
         // Find set and get -methods
-        Method[] m = instance.getClass().getMethods();
+        final Method[] m = instance.getClass().getMethods();
 
         // Finds get method
         boolean found = false;
@@ -332,7 +308,7 @@ public class MethodProperty implements Property {
             }
 
             // Tests the parameter types
-            Class[] c = m[i].getParameterTypes();
+            final Class[] c = m[i].getParameterTypes();
             if (c.length != getArgs.length) {
 
                 // not the right amount of parameters, try next method
@@ -381,7 +357,7 @@ public class MethodProperty implements Property {
                 }
 
                 // Checks parameter compatibility
-                Class[] c = m[i].getParameterTypes();
+                final Class[] c = m[i].getParameterTypes();
                 if (c.length != setArgs.length) {
 
                     // not the right amount of parameters, try next method
@@ -554,7 +530,7 @@ public class MethodProperty implements Property {
     public Object getValue() {
         try {
             return getMethod.invoke(instance, getArgs);
-        } catch (Throwable e) {
+        } catch (final Throwable e) {
             throw new MethodProperty.MethodException(e);
         }
     }
@@ -567,7 +543,7 @@ public class MethodProperty implements Property {
      * @return String representation of the value stored in the Property
      */
     public String toString() {
-        Object value = getValue();
+        final Object value = getValue();
         if (value == null) {
             return null;
         }
@@ -634,13 +610,13 @@ public class MethodProperty implements Property {
             try {
 
                 // Gets the string constructor
-                Constructor constr = getType().getConstructor(
+                final Constructor constr = getType().getConstructor(
                         new Class[] { String.class });
 
                 value = constr
                         .newInstance(new Object[] { newValue.toString() });
 
-            } catch (java.lang.Exception e) {
+            } catch (final java.lang.Exception e) {
                 throw new Property.ConversionException(e);
             }
 
@@ -664,16 +640,16 @@ public class MethodProperty implements Property {
             } else {
 
                 // Sets the value to argument array
-                Object[] args = new Object[setArgs.length];
+                final Object[] args = new Object[setArgs.length];
                 for (int i = 0; i < setArgs.length; i++) {
                     args[i] = (i == setArgumentIndex) ? value : setArgs[i];
                 }
                 setMethod.invoke(instance, args);
             }
-        } catch (InvocationTargetException e) {
-            Throwable targetException = e.getTargetException();
+        } catch (final InvocationTargetException e) {
+            final Throwable targetException = e.getTargetException();
             throw new MethodProperty.MethodException(targetException);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new MethodProperty.MethodException(e);
         }
     }
@@ -685,7 +661,7 @@ public class MethodProperty implements Property {
      *                the new read-only status of the Property.
      */
     public void setReadOnly(boolean newStatus) {
-        boolean prevStatus = readOnly;
+        final boolean prevStatus = readOnly;
         if (newStatus) {
             readOnly = true;
         } else {
@@ -825,8 +801,8 @@ public class MethodProperty implements Property {
      */
     private void fireReadOnlyStatusChange() {
         if (readOnlyStatusChangeListeners != null) {
-            Object[] l = readOnlyStatusChangeListeners.toArray();
-            Property.ReadOnlyStatusChangeEvent event = new MethodProperty.ReadOnlyStatusChangeEvent(
+            final Object[] l = readOnlyStatusChangeListeners.toArray();
+            final Property.ReadOnlyStatusChangeEvent event = new MethodProperty.ReadOnlyStatusChangeEvent(
                     this);
             for (int i = 0; i < l.length; i++) {
                 ((Property.ReadOnlyStatusChangeListener) l[i])
index eddb87097393f99660cd795b67fc1cbdc719ac96..503eabeffe0099ff60bcf1eee9fe1c68f163dc90 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data.util;
 
@@ -59,7 +35,7 @@ public class ObjectProperty implements Property, Property.ValueChangeNotifier,
     /**
      * Data type of the Property's value.
      */
-    private Class type;
+    private final Class type;
 
     /**
      * Internal list of registered value change listeners.
@@ -147,7 +123,7 @@ public class ObjectProperty implements Property, Property.ValueChangeNotifier,
      *         ObjectProperty
      */
     public String toString() {
-        Object value = getValue();
+        final Object value = getValue();
         if (value != null) {
             return value.toString();
         } else {
@@ -210,14 +186,14 @@ public class ObjectProperty implements Property, Property.ValueChangeNotifier,
             try {
 
                 // Gets the string constructor
-                Constructor constr = getType().getConstructor(
+                final Constructor constr = getType().getConstructor(
                         new Class[] { String.class });
 
                 // Creates new object from the string
                 value = constr
                         .newInstance(new Object[] { newValue.toString() });
 
-            } catch (java.lang.Exception e) {
+            } catch (final java.lang.Exception e) {
                 throw new Property.ConversionException(e);
             }
         }
@@ -356,8 +332,8 @@ public class ObjectProperty implements Property, Property.ValueChangeNotifier,
      */
     private void fireValueChange() {
         if (valueChangeListeners != null) {
-            Object[] l = valueChangeListeners.toArray();
-            Property.ValueChangeEvent event = new ObjectProperty.ValueChangeEvent(
+            final Object[] l = valueChangeListeners.toArray();
+            final Property.ValueChangeEvent event = new ObjectProperty.ValueChangeEvent(
                     this);
             for (int i = 0; i < l.length; i++) {
                 ((Property.ValueChangeListener) l[i]).valueChange(event);
@@ -370,8 +346,8 @@ public class ObjectProperty implements Property, Property.ValueChangeNotifier,
      */
     private void fireReadOnlyStatusChange() {
         if (readOnlyStatusChangeListeners != null) {
-            Object[] l = readOnlyStatusChangeListeners.toArray();
-            Property.ReadOnlyStatusChangeEvent event = new ObjectProperty.ReadOnlyStatusChangeEvent(
+            final Object[] l = readOnlyStatusChangeListeners.toArray();
+            final Property.ReadOnlyStatusChangeEvent event = new ObjectProperty.ReadOnlyStatusChangeEvent(
                     this);
             for (int i = 0; i < l.length; i++) {
                 ((Property.ReadOnlyStatusChangeListener) l[i])
index 355538326da43a379b60df637bc6c53c89b16e95..457a51321ff62532356a8d90fa78850d7ba18688 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data.util;
 
@@ -158,8 +134,8 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
     public String toString() {
         String retValue = "";
 
-        for (Iterator i = getItemPropertyIds().iterator(); i.hasNext();) {
-            Object propertyId = i.next();
+        for (final Iterator i = getItemPropertyIds().iterator(); i.hasNext();) {
+            final Object propertyId = i.next();
             retValue += getItemProperty(propertyId).toString();
             if (i.hasNext()) {
                 retValue += " ";
@@ -232,8 +208,8 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
      */
     private void fireItemPropertySetChange() {
         if (propertySetChangeListeners != null) {
-            Object[] l = propertySetChangeListeners.toArray();
-            Item.PropertySetChangeEvent event = new PropertysetItem.PropertySetChangeEvent(
+            final Object[] l = propertySetChangeListeners.toArray();
+            final Item.PropertySetChangeEvent event = new PropertysetItem.PropertySetChangeEvent(
                     this);
             for (int i = 0; i < l.length; i++) {
                 ((Item.PropertySetChangeListener) l[i])
@@ -265,7 +241,7 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
      */
     public Object clone() throws CloneNotSupportedException {
 
-        PropertysetItem npsi = new PropertysetItem();
+        final PropertysetItem npsi = new PropertysetItem();
 
         npsi.list = list != null ? (LinkedList) list.clone() : null;
         npsi.propertySetChangeListeners = propertySetChangeListeners != null ? (LinkedList) propertySetChangeListeners
@@ -293,7 +269,7 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
             return false;
         }
 
-        PropertysetItem other = (PropertysetItem) obj;
+        final PropertysetItem other = (PropertysetItem) obj;
 
         if (other.list != list) {
             if (other.list == null) {
index a3ab78e5c0632087157c6a424060328205a96ccd..9f8704e9339b9955385af4b18b296e106c2055d2 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data.util;
 
@@ -83,15 +59,15 @@ public class QueryContainer implements Container, Container.Ordered,
 
     private int resultSetConcurrency = DEFAULT_RESULTSET_CONCURRENCY;
 
-    private String queryStatement;
+    private final String queryStatement;
 
-    private Connection connection;
+    private final Connection connection;
 
     private ResultSet result;
 
     private Collection propertyIds;
 
-    private HashMap propertyTypes = new HashMap();
+    private final HashMap propertyTypes = new HashMap();
 
     private int size = -1;
 
@@ -151,12 +127,12 @@ public class QueryContainer implements Container, Container.Ordered,
         refresh();
         ResultSetMetaData metadata;
         metadata = result.getMetaData();
-        int count = metadata.getColumnCount();
-        ArrayList list = new ArrayList(count);
+        final int count = metadata.getColumnCount();
+        final ArrayList list = new ArrayList(count);
         for (int i = 1; i <= count; i++) {
-            String columnName = metadata.getColumnName(i);
+            final String columnName = metadata.getColumnName(i);
             list.add(columnName);
-            Property p = getContainerProperty(new Integer(1), columnName);
+            final Property p = getContainerProperty(new Integer(1), columnName);
             propertyTypes.put(columnName, p == null ? Object.class : p
                     .getType());
         }
@@ -227,7 +203,7 @@ public class QueryContainer implements Container, Container.Ordered,
      * @return collection of Item IDs
      */
     public Collection getItemIds() {
-        Collection c = new ArrayList(size);
+        final Collection c = new ArrayList(size);
         for (int i = 1; i <= size; i++) {
             c.add(new Integer(i));
         }
@@ -257,7 +233,7 @@ public class QueryContainer implements Container, Container.Ordered,
         try {
             result.absolute(((Integer) itemId).intValue());
             value = result.getObject((String) propertyId);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             return null;
         }
 
@@ -299,7 +275,7 @@ public class QueryContainer implements Container, Container.Ordered,
         if (!(id instanceof Integer)) {
             return false;
         }
-        int i = ((Integer) id).intValue();
+        final int i = ((Integer) id).intValue();
         if (i < 1) {
             return false;
         }
@@ -485,7 +461,7 @@ public class QueryContainer implements Container, Container.Ordered,
         if (size < 1 || !(id instanceof Integer)) {
             return null;
         }
-        int i = ((Integer) id).intValue();
+        final int i = ((Integer) id).intValue();
         if (i >= size) {
             return null;
         }
@@ -503,7 +479,7 @@ public class QueryContainer implements Container, Container.Ordered,
         if (size < 1 || !(id instanceof Integer)) {
             return null;
         }
-        int i = ((Integer) id).intValue();
+        final int i = ((Integer) id).intValue();
         if (i <= 1) {
             return null;
         }
@@ -589,7 +565,7 @@ public class QueryContainer implements Container, Container.Ordered,
     public void finalize() {
         try {
             close();
-        } catch (SQLException ignored) {
+        } catch (final SQLException ignored) {
 
         }
     }
@@ -653,7 +629,7 @@ public class QueryContainer implements Container, Container.Ordered,
         if (size < 1 || !(id instanceof Integer)) {
             return -1;
         }
-        int i = ((Integer) id).intValue();
+        final int i = ((Integer) id).intValue();
         if (i >= size || i < 1) {
             return -1;
         }
index 3abe1d40d9d9e40ba2a0ec54715ad4cd2ef290bc..be16c2633ed651d0d33087da6ae89628c1618fd7 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data.validator;
 
@@ -77,7 +53,7 @@ public class CompositeValidator implements Validator {
     /**
      * List of contained validators.
      */
-    private LinkedList validators = new LinkedList();
+    private final LinkedList validators = new LinkedList();
 
     /**
      * Error message.
@@ -121,18 +97,18 @@ public class CompositeValidator implements Validator {
     public void validate(Object value) throws Validator.InvalidValueException {
         switch (mode) {
         case MODE_AND:
-            for (Iterator i = validators.iterator(); i.hasNext();) {
+            for (final Iterator i = validators.iterator(); i.hasNext();) {
                 ((Validator) i.next()).validate(value);
             }
             return;
 
         case MODE_OR:
             Validator.InvalidValueException first = null;
-            for (Iterator i = validators.iterator(); i.hasNext();) {
+            for (final Iterator i = validators.iterator(); i.hasNext();) {
                 try {
                     ((Validator) i.next()).validate(value);
                     return;
-                } catch (Validator.InvalidValueException e) {
+                } catch (final Validator.InvalidValueException e) {
                     if (first == null) {
                         first = e;
                     }
@@ -141,7 +117,7 @@ public class CompositeValidator implements Validator {
             if (first == null) {
                 return;
             }
-            String em = getErrorMessage();
+            final String em = getErrorMessage();
             if (em != null) {
                 throw new Validator.InvalidValueException(em);
             } else {
@@ -165,8 +141,8 @@ public class CompositeValidator implements Validator {
     public boolean isValid(Object value) {
         switch (mode) {
         case MODE_AND:
-            for (Iterator i = validators.iterator(); i.hasNext();) {
-                Validator v = (Validator) i.next();
+            for (final Iterator i = validators.iterator(); i.hasNext();) {
+                final Validator v = (Validator) i.next();
                 if (!v.isValid(value)) {
                     return false;
                 }
@@ -174,8 +150,8 @@ public class CompositeValidator implements Validator {
             return true;
 
         case MODE_OR:
-            for (Iterator i = validators.iterator(); i.hasNext();) {
-                Validator v = (Validator) i.next();
+            for (final Iterator i = validators.iterator(); i.hasNext();) {
+                final Validator v = (Validator) i.next();
                 if (v.isValid(value)) {
                     return true;
                 }
@@ -286,15 +262,15 @@ public class CompositeValidator implements Validator {
             return null;
         }
 
-        HashSet found = new HashSet();
-        for (Iterator i = validators.iterator(); i.hasNext();) {
-            Validator v = (Validator) i.next();
+        final HashSet found = new HashSet();
+        for (final Iterator i = validators.iterator(); i.hasNext();) {
+            final Validator v = (Validator) i.next();
             if (validatorType.isAssignableFrom(v.getClass())) {
                 found.add(v);
             }
             if (v instanceof CompositeValidator
                     && ((CompositeValidator) v).getMode() == MODE_AND) {
-                Collection c = ((CompositeValidator) v)
+                final Collection c = ((CompositeValidator) v)
                         .getSubValidators(validatorType);
                 if (c != null) {
                     found.addAll(c);
index 24cb25b3394c720a4d4df581f8e7636ac389af0a..ad627f88c1c8eafdeacc68976b4e06812130a1a5 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data.validator;
 
index 68ddfe46fb199b7ed1f517de640e2249bbac12ff..b622ea08eda0f64ade676033045f12b0c5ec165a 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.data.validator;
 
@@ -94,11 +70,11 @@ public class StringLengthValidator implements Validator {
         if (value == null && !allowNull) {
             throw new Validator.InvalidValueException(errorMessage);
         }
-        String s = value.toString();
+        final String s = value.toString();
         if (s == null && !allowNull) {
             throw new Validator.InvalidValueException(errorMessage);
         }
-        int len = s.length();
+        final int len = s.length();
         if ((minLength >= 0 && len < minLength)
                 || (maxLength >= 0 && len > maxLength)) {
             throw new Validator.InvalidValueException(errorMessage);
@@ -116,11 +92,11 @@ public class StringLengthValidator implements Validator {
         if (value == null && !allowNull) {
             return true;
         }
-        String s = value.toString();
+        final String s = value.toString();
         if (s == null && !allowNull) {
             return true;
         }
-        int len = s.length();
+        final int len = s.length();
         if ((minLength >= 0 && len < minLength)
                 || (maxLength >= 0 && len > maxLength)) {
             return false;
index 5a03dce9d97f5cb152d251edfc619cd0229de007..13d4bc5d0c005f97ff959e1d7758acff822cb6e0 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import com.itmill.toolkit.data.Property.ValueChangeEvent;
@@ -25,18 +29,18 @@ public class BrowserDemo extends com.itmill.toolkit.Application implements
 
     public void init() {
         // Create and set main window
-        Window browser = new Window("IT Mill Browser");
+        final Window browser = new Window("IT Mill Browser");
         setMainWindow(browser);
 
         // Use the expand layout to allow one component to use as much
         // space as
         // possible.
-        ExpandLayout exl = new ExpandLayout();
+        final ExpandLayout exl = new ExpandLayout();
         browser.setLayout(exl);
         exl.setSizeFull();
 
         // create the address combobox
-        Select select = new Select();
+        final Select select = new Select();
         // allow input
         select.setNewItemsAllowed(true);
         // no empty selection
@@ -62,7 +66,7 @@ public class BrowserDemo extends com.itmill.toolkit.Application implements
     }
 
     public void valueChange(ValueChangeEvent event) {
-        String url = (String) event.getProperty().getValue();
+        final String url = (String) event.getProperty().getValue();
         if (url != null) {
             // the selected url has changed, let's go there
             emb.setSource(new ExternalResource(url));
index 8f4a39df5d4945920867f4a480fe3356a8eaa006..752ac007888419e8500918df35f6d10d3e1f7935 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import com.itmill.toolkit.Application;
@@ -17,11 +21,11 @@ public class BufferedComponents extends Application {
 
     public void init() {
 
-        Window w = new Window("Buffered UI components demo");
+        final Window w = new Window("Buffered UI components demo");
         addWindow(w);
 
         // Create property
-        Float floatValue = new Float(1.0f);
+        final Float floatValue = new Float(1.0f);
         property = new ObjectProperty(floatValue);
 
         // Textfield
@@ -32,12 +36,12 @@ public class BufferedComponents extends Application {
         w.addComponent(text);
 
         // Property state
-        Label propertyState = new Label(property);
+        final Label propertyState = new Label(property);
         propertyState.setCaption("Property (data source) state");
         w.addComponent(propertyState);
 
         // Button state
-        Label textState = new Label(text);
+        final Label textState = new Label(text);
         textState.setCaption("TextField state");
         w.addComponent(textState);
 
@@ -45,7 +49,7 @@ public class BufferedComponents extends Application {
         w.addComponent(new Button("increase property value",
                 new Button.ClickListener() {
                     public void buttonClick(ClickEvent event) {
-                        Float currentValue = (Float) property.getValue();
+                        final Float currentValue = (Float) property.getValue();
                         property.setValue(new Float(
                                 currentValue.floatValue() + 1.0));
                     }
@@ -69,7 +73,7 @@ public class BufferedComponents extends Application {
         // (easier debugging when you dont have to restart the server to
         // make
         // code changes)
-        Button restart = new Button("restart", this, "close");
+        final Button restart = new Button("restart", this, "close");
         restart.addStyleName(Button.STYLE_LINK);
         w.addComponent(restart);
     }
index 4cc47719f5871298a63080f9645354ec74108b92..8b44aa01195a9ad3026e950cf59bf910c6c58fe4 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo;\r
 \r
 import com.itmill.toolkit.terminal.PaintException;\r
@@ -21,12 +25,12 @@ public class CachingDemo extends com.itmill.toolkit.Application {
 \r
     public void init() {\r
 \r
-        Window main = new Window("Client-side caching example");\r
+        final Window main = new Window("Client-side caching example");\r
         setMainWindow(main);\r
 \r
         setTheme("example");\r
 \r
-        TabSheet ts = new TabSheet();\r
+        final TabSheet ts = new TabSheet();\r
         main.addComponent(ts);\r
 \r
         Layout layout = new OrderedLayout();\r
@@ -46,7 +50,7 @@ public class CachingDemo extends com.itmill.toolkit.Application {
             public void paintContent(PaintTarget target) throws PaintException {\r
                 try {\r
                     Thread.sleep(3000);\r
-                } catch (Exception e) {\r
+                } catch (final Exception e) {\r
                     // IGNORED\r
                 }\r
                 super.paintContent(target);\r
index 5a3788ac52d6f1fed31e3b3ed3fb91a799fbb40f..e3655239f2718e86a7a5d612b14c12b38049b7f6 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import com.itmill.toolkit.ui.Button;
@@ -57,7 +61,7 @@ public class Calc extends com.itmill.toolkit.Application implements
     public void init() {
 
         // Create a new layout for the components used by the calculator
-        GridLayout layout = new GridLayout(4, 5);
+        final GridLayout layout = new GridLayout(4, 5);
 
         // Create a new label component for displaying the result
         display = new Label(Double.toString(current));
@@ -68,7 +72,7 @@ public class Calc extends com.itmill.toolkit.Application implements
 
         // Create the buttons and place them in the grid
         for (int i = 0; i < captions.length; i++) {
-            Button button = new Button(captions[i], this);
+            final Button button = new Button(captions[i], this);
             layout.addComponent(button);
         }
 
@@ -102,7 +106,7 @@ public class Calc extends com.itmill.toolkit.Application implements
             current = current * 10
                     + Double.parseDouble(event.getButton().getCaption());
             display.setValue(Double.toString(current));
-        } catch (java.lang.NumberFormatException e) {
+        } catch (final java.lang.NumberFormatException e) {
 
             // Operation button pressed
             if (operation.equals("+")) {
index 0bf256b409d1186ef782959ad804baaab5596eb1..b683fc763ad7382840486b0ca46324c48f7a9d7d 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import com.itmill.toolkit.ui.Button;
@@ -29,21 +33,21 @@ public class CustomLayoutDemo extends com.itmill.toolkit.Application implements
 
     private CustomLayout mainLayout = null;
 
-    private Panel bodyPanel = new Panel();
+    private final Panel bodyPanel = new Panel();
 
-    private TextField username = new TextField("Username");
+    private final TextField username = new TextField("Username");
 
-    private TextField loginPwd = new TextField("Password");
+    private final TextField loginPwd = new TextField("Password");
 
-    private Button loginButton = new Button("Login", this, "loginClicked");
+    private final Button loginButton = new Button("Login", this, "loginClicked");
 
-    private Tree menu = new Tree();
+    private final Tree menu = new Tree();
 
     /**
      * Initialize Application. Demo components are added to main window.
      */
     public void init() {
-        Window mainWindow = new Window("CustomLayout demo");
+        final Window mainWindow = new Window("CustomLayout demo");
         setMainWindow(mainWindow);
 
         // set the application to use example -theme
@@ -52,7 +56,7 @@ public class CustomLayoutDemo extends com.itmill.toolkit.Application implements
         // Create custom layout, themes/example/layout/mainLayout.html
         mainLayout = new CustomLayout("mainLayout");
         // wrap custom layout inside a panel
-        Panel customLayoutPanel = new Panel(
+        final Panel customLayoutPanel = new Panel(
                 "Panel containing custom layout (mainLayout.html)");
         customLayoutPanel.addComponent(mainLayout);
 
index d2bd119897514685e2939075e9b349b667fab9b1..25a12b38b1207b560211b6d028002876a4305e51 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import com.itmill.toolkit.ui.OrderedLayout;
@@ -39,11 +43,11 @@ public class FilterSelect extends com.itmill.toolkit.Application {
          * - Create new window for the application - Give the window a visible
          * title - Set the window to be the main window of the application
          */
-        Window main = new Window("Filter select demo");
+        final Window main = new Window("Filter select demo");
         setMainWindow(main);
 
         // default filterin (Starts with)
-        Select s1 = new Select();
+        final Select s1 = new Select();
         for (int i = 0; i < 105; i++) {
             s1
                     .addItem(firstnames[(int) (Math.random() * (firstnames.length - 1))]
@@ -53,7 +57,7 @@ public class FilterSelect extends com.itmill.toolkit.Application {
         s1.setImmediate(true);
 
         // contains filter
-        Select s2 = new Select();
+        final Select s2 = new Select();
         for (int i = 0; i < 500; i++) {
             s2
                     .addItem(firstnames[(int) (Math.random() * (firstnames.length - 1))]
@@ -63,11 +67,11 @@ public class FilterSelect extends com.itmill.toolkit.Application {
         s2.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS);
 
         // Add selects to UI using ordered layout and panels
-        OrderedLayout orderedLayout = new OrderedLayout(
+        final OrderedLayout orderedLayout = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
 
-        Panel panel1 = new Panel("Select with default filter");
-        Panel panel2 = new Panel("Select with contains filter");
+        final Panel panel1 = new Panel("Select with default filter");
+        final Panel panel2 = new Panel("Select with contains filter");
 
         panel1.addComponent(s1);
         panel2.addComponent(s2);
index ace0e95913fff24daa28af7c54ebec7a85529728..35ac5fcf311c1f19ee93b9d3b57506f1c3f1daad 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import com.itmill.toolkit.ui.Label;
@@ -26,7 +30,7 @@ public class HelloWorld extends com.itmill.toolkit.Application {
          * - Create new window for the application - Give the window a visible
          * title - Set the window to be the main window of the application
          */
-        Window main = new Window("Hello window");
+        final Window main = new Window("Hello window");
         setMainWindow(main);
 
         /*
index bfc6532805ca3a671e8d804692ae53dfba982b56..3dd157ea8c9f1e03e041750b465c541b2ffb8bad 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import java.util.Date;
@@ -57,31 +61,31 @@ public class KeyboardShortcut extends Application implements Handler {
     private final Action ACTION_RESTART = new ShortcutAction("Restart ",
             ShortcutAction.KeyCode.ESCAPE, null);
 
-    private Action[] actions = new Action[] { ACTION_A, ACTION_Z, ACTION_X,
-            ACTION_RESTART };
+    private final Action[] actions = new Action[] { ACTION_A, ACTION_Z,
+            ACTION_X, ACTION_RESTART };
 
     private TextField f;
 
     public void init() {
 
-        Window w = new Window("Keyboard shortcuts demo");
-        ExpandLayout main = new ExpandLayout();
+        final Window w = new Window("Keyboard shortcuts demo");
+        final ExpandLayout main = new ExpandLayout();
         main.setMargin(true);
         main.setSpacing(true);
         setMainWindow(w);
         w.setLayout(main);
 
-        Panel p = new Panel("Test application for shortcut actions");
+        final Panel p = new Panel("Test application for shortcut actions");
         p.addComponent(instructions);
 
-        OrderedLayout buttons = new OrderedLayout(
+        final OrderedLayout buttons = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
 
         // Restart button
-        Button close = new Button("restart", this, "close");
-        Button a = new Button("Button A", this, "actionAHandler");
-        Button z = new Button("Button Z", this, "actionZHandler");
-        Button x = new Button("Button X", this, "actionXHandler");
+        final Button close = new Button("restart", this, "close");
+        final Button a = new Button("Button A", this, "actionAHandler");
+        final Button z = new Button("Button Z", this, "actionZHandler");
+        final Button x = new Button("Button X", this, "actionXHandler");
         f = new TextField();
 
         buttons.addComponent(close);
index 60b6c02aefd21e856760cc5d9b36c5a80ee841ae..a3a671dffe3eb6aee20be4e4075252674cedeea9 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import com.itmill.toolkit.terminal.ClassResource;
@@ -25,13 +29,13 @@ public class LayoutDemo extends com.itmill.toolkit.Application {
      * Initialize Application. Demo components are added to main window.
      */
     public void init() {
-        Window mainWindow = new Window("Layout demo");
+        final Window mainWindow = new Window("Layout demo");
         setMainWindow(mainWindow);
 
         //
         // Create horizontal ordered layout
         //
-        OrderedLayout layoutA = new OrderedLayout(
+        final OrderedLayout layoutA = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
         // Add 4 panels
         fillLayout(layoutA, 4);
@@ -39,7 +43,7 @@ public class LayoutDemo extends com.itmill.toolkit.Application {
         //
         // Create vertical ordered layout
         //
-        OrderedLayout layoutB = new OrderedLayout(
+        final OrderedLayout layoutB = new OrderedLayout(
                 OrderedLayout.ORIENTATION_VERTICAL);
         // Add 4 panels
         fillLayout(layoutB, 4);
@@ -47,14 +51,14 @@ public class LayoutDemo extends com.itmill.toolkit.Application {
         //
         // Create grid layout
         //
-        GridLayout layoutG = new GridLayout(4, 4);
+        final GridLayout layoutG = new GridLayout(4, 4);
         // Add 16 panels components
         fillLayout(layoutG, 16);
 
         //
         // Create grid layout
         //
-        GridLayout layoutG2 = new GridLayout(4, 4);
+        final GridLayout layoutG2 = new GridLayout(4, 4);
         // Add 4 panels with absolute coordinates (diagonally)
         layoutG2.addComponent(getExampleComponent("x=0, y=0"), 0, 0);
         layoutG2.addComponent(getExampleComponent("x=1, y=1"), 1, 1);
@@ -69,7 +73,7 @@ public class LayoutDemo extends com.itmill.toolkit.Application {
         //
         // Create TabSheet
         //
-        TabSheet tabsheet = new TabSheet();
+        final TabSheet tabsheet = new TabSheet();
         tabsheet
                 .setCaption("Tabsheet, above layouts are added to this component");
         tabsheet.addTab(layoutA, "Horizontal ordered layout", null);
@@ -106,14 +110,15 @@ public class LayoutDemo extends com.itmill.toolkit.Application {
     }
 
     private Component getExamplePicture(String caption) {
-        ClassResource cr = new ClassResource("features/m-bullet-blue.gif", this);
-        Embedded em = new Embedded("Embedded " + caption, cr);
+        final ClassResource cr = new ClassResource(
+                "features/m-bullet-blue.gif", this);
+        final Embedded em = new Embedded("Embedded " + caption, cr);
         em.setWidth(170);
         return em;
     }
 
     private Component getExampleComponent(String caption) {
-        Panel panel = new Panel();
+        final Panel panel = new Panel();
         panel.setCaption("Panel component " + caption);
         panel
                 .addComponent(new Label(
index fa0a6a44a3f5da24728b0f37385a823bbaf6c7bb..c394c1ec629e3927196a4114b8bc4723bba91bcc 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import com.itmill.toolkit.ui.Button;
@@ -26,17 +30,17 @@ public class ModalWindow extends com.itmill.toolkit.Application implements
     public void init() {
 
         // Create main window
-        Window main = new Window("ModalWindow demo");
+        final Window main = new Window("ModalWindow demo");
         setMainWindow(main);
         main.addComponent(new Label("ModalWindow demo"));
 
         // Main window textfield
-        TextField f = new TextField();
+        final TextField f = new TextField();
         f.setTabIndex(1);
         main.addComponent(f);
 
         // Main window button
-        Button b = new Button("Test Button in main window");
+        final Button b = new Button("Test Button in main window");
         b.addListener(this);
         b.setTabIndex(2);
         main.addComponent(b);
@@ -65,13 +69,13 @@ public class ModalWindow extends com.itmill.toolkit.Application implements
                 "You have to close this window before accessing others."));
 
         // Textfield for modal window
-        TextField f = new TextField();
+        final TextField f = new TextField();
         f.setTabIndex(4);
         test.addComponent(f);
         f.focus();
 
         // Modal window button
-        Button b = new Button("Test Button in modal window");
+        final Button b = new Button("Test Button in modal window");
         b.setTabIndex(5);
         b.addListener(this);
         test.addComponent(b);
index 9b4429262b5953c7c5a634d5261ba26ccde74025..7dadd7c4bb0aea0062810de62fd213d701258c3a 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import java.net.MalformedURLException;
@@ -31,7 +35,7 @@ public class NativeWindowing extends Application {
                         w.setWidth(100);
                         w.setHeight(400);
 
-                        Button closebutton = new Button("Close "
+                        final Button closebutton = new Button("Close "
                                 + w.getCaption(), new Button.ClickListener() {
                             public void buttonClick(ClickEvent event) {
                                 main.removeWindow(w);
@@ -83,7 +87,7 @@ public class NativeWindowing extends Application {
                                                                             .currentTimeMillis()
                                                                     + "/")),
                                             null);
-                        } catch (MalformedURLException e) {
+                        } catch (final MalformedURLException e) {
                         }
                     }
                 }));
@@ -94,13 +98,13 @@ public class NativeWindowing extends Application {
 
     public Window getWindow(String name) {
 
-        Window w = super.getWindow(name);
+        final Window w = super.getWindow(name);
         if (w != null) {
             return w;
         }
 
         if (name != null && name.startsWith("mainwin-")) {
-            String postfix = name.substring("mainwin-".length());
+            final String postfix = name.substring("mainwin-".length());
             final Window ww = new Window("Window: " + postfix);
             ww.setName(name);
             ww.addComponent(new Label(
index e7a0dcb7e44ad09ed9757615e6fc2e4f94fd3e7c..860b54f243e6b0e1916b19f37afdfd3d712dfa21 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import com.itmill.toolkit.data.Item;
@@ -33,7 +37,7 @@ public class NotificationDemo extends com.itmill.toolkit.Application {
     public void init() {
 
         // Create new window for the application and give the window a visible.
-        Window main = new Window("Notification demo");
+        final Window main = new Window("Notification demo");
         // set as main window
         setMainWindow(main);
 
@@ -73,7 +77,7 @@ public class NotificationDemo extends com.itmill.toolkit.Application {
         main.addComponent(message); // add to layout
 
         // Button to show the notification
-        Button b = new Button("Show notification", new ClickListener() {
+        final Button b = new Button("Show notification", new ClickListener() {
             // this is an inline ClickListener
             public void buttonClick(ClickEvent event) {
                 // show the notification
index 14142c96cdd0298ed14f32b8daebb7de963c3e66..204860e44b08305c4bc544b15a80595131e2e7a1 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import java.net.URL;
@@ -7,6 +11,7 @@ import java.util.Map;
 import com.itmill.toolkit.terminal.DownloadStream;
 import com.itmill.toolkit.terminal.ExternalResource;
 import com.itmill.toolkit.terminal.ParameterHandler;
+import com.itmill.toolkit.terminal.Sizeable;
 import com.itmill.toolkit.terminal.URIHandler;
 import com.itmill.toolkit.ui.ExpandLayout;
 import com.itmill.toolkit.ui.Label;
@@ -25,41 +30,41 @@ import com.itmill.toolkit.ui.Window;
 public class Parameters extends com.itmill.toolkit.Application implements
         URIHandler, ParameterHandler {
 
-    private Label context = new Label();
+    private final Label context = new Label();
 
-    private Label relative = new Label();
+    private final Label relative = new Label();
 
-    private Table params = new Table();
+    private final Table params = new Table();
 
     public void init() {
-        Window main = new Window("Parameters demo");
+        final Window main = new Window("Parameters demo");
         setMainWindow(main);
 
         // This class acts both as URI handler and parameter handler
         main.addURIHandler(this);
         main.addParameterHandler(this);
 
-        ExpandLayout layout = new ExpandLayout();
-        Label info = new Label("To test URI and Parameter Handlers, "
+        final ExpandLayout layout = new ExpandLayout();
+        final Label info = new Label("To test URI and Parameter Handlers, "
                 + "add get parameters to URL. For example try examples below: ");
         info.setCaption("Usage info");
         layout.addComponent(info);
         try {
-            URL u1 = new URL(getURL(), "test/uri?test=1&test=2");
-            URL u2 = new URL(getURL(), "foo/bar?mary=john&count=3");
+            final URL u1 = new URL(getURL(), "test/uri?test=1&test=2");
+            final URL u2 = new URL(getURL(), "foo/bar?mary=john&count=3");
             layout.addComponent(new Link(u1.toString(),
                     new ExternalResource(u1)));
             layout.addComponent(new Label("Or this: "));
             layout.addComponent(new Link(u2.toString(),
                     new ExternalResource(u2)));
-        } catch (Exception e) {
+        } catch (final Exception e) {
             System.out.println("Couldn't get hostname for this machine: "
                     + e.toString());
             e.printStackTrace();
         }
 
         // URI
-        Panel panel1 = new Panel("URI Handler");
+        final Panel panel1 = new Panel("URI Handler");
         context.setCaption("Last URI handler context");
         panel1.addComponent(context);
         relative.setCaption("Last relative URI");
@@ -68,11 +73,11 @@ public class Parameters extends com.itmill.toolkit.Application implements
 
         params.addContainerProperty("Key", String.class, "");
         params.addContainerProperty("Value", String.class, "");
-        Panel panel2 = new Panel("Parameter Handler");
+        final Panel panel2 = new Panel("Parameter Handler");
         params.setHeight(100);
-        params.setHeightUnits(Table.UNITS_PERCENTAGE);
+        params.setHeightUnits(Sizeable.UNITS_PERCENTAGE);
         panel2.setHeight(100);
-        panel2.setHeightUnits(Panel.UNITS_PERCENTAGE);
+        panel2.setHeightUnits(Sizeable.UNITS_PERCENTAGE);
         panel2.setLayout(new ExpandLayout());
         panel2.getLayout().setMargin(true);
 
@@ -106,9 +111,9 @@ public class Parameters extends com.itmill.toolkit.Application implements
      */
     public void handleParameters(Map parameters) {
         params.removeAllItems();
-        for (Iterator i = parameters.keySet().iterator(); i.hasNext();) {
-            String name = (String) i.next();
-            String[] values = (String[]) parameters.get(name);
+        for (final Iterator i = parameters.keySet().iterator(); i.hasNext();) {
+            final String name = (String) i.next();
+            final String[] values = (String[]) parameters.get(name);
             String v = "";
             for (int j = 0; j < values.length; j++) {
                 if (v.length() > 0) {
index 746057ee608a94cf3fecb5c0f787700a09c1dd1a..c378375cfce3745987774ddb8bfe94f2429216d0 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import java.sql.SQLException;
@@ -37,35 +41,37 @@ public class QueryContainerDemo extends com.itmill.toolkit.Application
             + " dynamically loaded rows from example SQL table";
 
     // Table component where SQL rows are attached (using QueryContainer)
-    private Table table = new Table();
+    private final Table table = new Table();
 
-    private Label tableLastAction = new Label("No action selected for table.");
+    private final Label tableLastAction = new Label(
+            "No action selected for table.");
 
     // Select component where SQL rows are attached (using QueryContainer)
-    private Select select = new Select();
+    private final Select select = new Select();
 
     // Tree component that uses select as datasource
-    private Tree tree = new Tree();
+    private final Tree tree = new Tree();
 
-    private Label treeLastAction = new Label("No action selected for tree.");
+    private final Label treeLastAction = new Label(
+            "No action selected for tree.");
 
     // Database provided with sample data
     private SampleDatabase sampleDatabase;
 
     // Example Actions for table
-    private Action ACTION1 = new Action("Upload");
+    private final Action ACTION1 = new Action("Upload");
 
-    private Action ACTION2 = new Action("Download");
+    private final Action ACTION2 = new Action("Download");
 
-    private Action ACTION3 = new Action("Show history");
+    private final Action ACTION3 = new Action("Show history");
 
-    private Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 };
+    private final Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 };
 
     /**
      * Initialize Application. Demo components are added to main window.
      */
     public void init() {
-        Window main = new Window("QueryContainer demo");
+        final Window main = new Window("QueryContainer demo");
         setMainWindow(main);
 
         // Main window contains heading, table, select and tree
@@ -111,10 +117,10 @@ public class QueryContainerDemo extends com.itmill.toolkit.Application
 
         // populate Toolkit table component with test SQL table rows
         try {
-            QueryContainer qc = new QueryContainer("SELECT * FROM employee",
-                    sampleDatabase.getConnection());
+            final QueryContainer qc = new QueryContainer(
+                    "SELECT * FROM employee", sampleDatabase.getConnection());
             table.setContainerDataSource(qc);
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             e.printStackTrace();
         }
         // define which columns should be visible on Table component
@@ -134,11 +140,11 @@ public class QueryContainerDemo extends com.itmill.toolkit.Application
 
         // populate Toolkit select component with test SQL table rows
         try {
-            QueryContainer qc = new QueryContainer(
+            final QueryContainer qc = new QueryContainer(
                     "SELECT DISTINCT UNIT FROM employee", sampleDatabase
                             .getConnection());
             select.setContainerDataSource(qc);
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             e.printStackTrace();
         }
     }
index cc6816206d18a8f33f24093ef954f15f869ec0c7..c3569012959eba86d207c5282980b6fc842a6cd8 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import java.sql.SQLException;
@@ -32,11 +36,11 @@ public class SelectDemo extends com.itmill.toolkit.Application {
      * Initialize Application. Demo components are added to main window.
      */
     public void init() {
-        Window main = new Window("Select demo");
+        final Window main = new Window("Select demo");
         setMainWindow(main);
 
         // Main window contains heading, table, select and tree
-        Panel panel = new Panel("Select demo (a.k.a Google Suggests)");
+        final Panel panel = new Panel("Select demo (a.k.a Google Suggests)");
         panel.addComponent(lazySelect);
         panel.addComponent(new Label("<hr />", Label.CONTENT_XHTML));
         panel.addComponent(select);
@@ -54,12 +58,12 @@ public class SelectDemo extends com.itmill.toolkit.Application {
         select.setItemCaptionPropertyId("WORKER");
         // populate Toolkit select component with test SQL table rows
         try {
-            QueryContainer qc = new QueryContainer(
+            final QueryContainer qc = new QueryContainer(
                     "SELECT ID, UNIT||', '||LASTNAME||' '||FIRSTNAME"
                             + " AS WORKER FROM employee ORDER BY WORKER",
                     sampleDatabase.getConnection());
             select.setContainerDataSource(qc);
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             e.printStackTrace();
         }
 
index df7572e1b0de51d043e1d0d7df269703a35916a6..263b322d18b05776582b3a010d21c392f98f0c97 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import java.sql.SQLException;
@@ -29,43 +33,44 @@ public class TableDemo extends com.itmill.toolkit.Application implements
             + " dynamically loaded rows from example SQL table";
 
     // Table component where SQL rows are attached (using QueryContainer)
-    private Table table = new Table();
+    private final Table table = new Table();
 
     // Label which displays last performed action against table row
-    private Label tableLastAction = new Label("No action selected for table.");
+    private final Label tableLastAction = new Label(
+            "No action selected for table.");
 
     // Database provided with sample data
     private SampleDatabase sampleDatabase;
 
     // Example Actions for table
-    private Action ACTION1 = new Action("Upload");
+    private final Action ACTION1 = new Action("Upload");
 
-    private Action ACTION2 = new Action("Download");
+    private final Action ACTION2 = new Action("Download");
 
-    private Action ACTION3 = new Action("Show history");
+    private final Action ACTION3 = new Action("Show history");
 
-    private Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 };
+    private final Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 };
 
     // Button which is used to disable or enable table
     // note: when button click event occurs, tableEnabler() method is called
-    private Button tableEnabler = new Button("Disable table", this,
+    private final Button tableEnabler = new Button("Disable table", this,
             "tableEnabler");
 
     // Button which is used to hide or show table
     // note: when button click event occurs, tableVisibility() method is called
-    private Button tableVisibility = new Button("Hide table", this,
+    private final Button tableVisibility = new Button("Hide table", this,
             "tableVisibility");
 
     // Button which is used to hide or show table
     // note: when button click event occurs, tableVisibility() method is called
-    private Button tableCaption = new Button("Hide caption", this,
+    private final Button tableCaption = new Button("Hide caption", this,
             "tableCaption");
 
     /**
      * Initialize Application. Demo components are added to main window.
      */
     public void init() {
-        Window main = new Window("Table demo");
+        final Window main = new Window("Table demo");
         setMainWindow(main);
 
         // create demo database
@@ -78,7 +83,7 @@ public class TableDemo extends com.itmill.toolkit.Application implements
                                 + "<b>Rows are loaded from the server as they are needed.<br />"
                                 + "Try scrolling the table to see it in action.</b><br />"
                                 + ACTION_DESCRIPTION, Label.CONTENT_XHTML));
-        OrderedLayout layout = new OrderedLayout(
+        final OrderedLayout layout = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
         // TODO: disabled until #655 fixed
         // layout.addComponent(tableVisibility);
@@ -111,10 +116,10 @@ public class TableDemo extends com.itmill.toolkit.Application implements
 
         // populate Toolkit table component with test SQL table rows
         try {
-            QueryContainer qc = new QueryContainer("SELECT * FROM employee",
-                    sampleDatabase.getConnection());
+            final QueryContainer qc = new QueryContainer(
+                    "SELECT * FROM employee", sampleDatabase.getConnection());
             table.setContainerDataSource(qc);
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             e.printStackTrace();
         }
         // define which columns should be visible on Table component
index fc729f970a99285888a222f57413190b7317d82c..7fa1f3a1f4f8c0636bfb4f3972cfdba1e5171297 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import java.io.File;
@@ -24,12 +28,12 @@ public class TreeFilesystem extends com.itmill.toolkit.Application implements
         Tree.ExpandListener {
 
     // Filesystem explorer panel and it's components
-    private Panel explorerPanel = new Panel("Filesystem explorer");
+    private final Panel explorerPanel = new Panel("Filesystem explorer");
 
-    private Tree tree = new Tree();
+    private final Tree tree = new Tree();
 
     public void init() {
-        Window main = new Window("Tree filesystem demo");
+        final Window main = new Window("Tree filesystem demo");
         setMainWindow(main);
 
         // Main window contains heading and panel
@@ -44,7 +48,7 @@ public class TreeFilesystem extends com.itmill.toolkit.Application implements
         tree.addListener(this);
 
         // Get sample directory
-        File sampleDir = SampleDirectory.getDirectory(this);
+        final File sampleDir = SampleDirectory.getDirectory(this);
         // populate tree's root node with example directory
         if (sampleDir != null) {
             populateNode(sampleDir.getAbsolutePath(), null);
@@ -56,7 +60,7 @@ public class TreeFilesystem extends com.itmill.toolkit.Application implements
      * and directories.
      */
     public void nodeExpand(ExpandEvent event) {
-        Item i = tree.getItem(event.getItemId());
+        final Item i = tree.getItem(event.getItemId());
         if (!tree.hasChildren(i)) {
             // populate tree's node which was expanded
             populateNode(event.getItemId().toString(), event.getItemId());
@@ -75,12 +79,12 @@ public class TreeFilesystem extends com.itmill.toolkit.Application implements
      *                node
      */
     private void populateNode(String file, Object parent) {
-        File subdir = new File(file);
-        File[] files = subdir.listFiles();
+        final File subdir = new File(file);
+        final File[] files = subdir.listFiles();
         for (int x = 0; x < files.length; x++) {
             try {
                 // add new item (String) to tree
-                String path = files[x].getCanonicalPath().toString();
+                final String path = files[x].getCanonicalPath().toString();
                 tree.addItem(path);
                 // set parent if this item has one
                 if (parent != null) {
@@ -94,7 +98,7 @@ public class TreeFilesystem extends com.itmill.toolkit.Application implements
                     // no, childrens therefore do not exists
                     tree.setChildrenAllowed(path, false);
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new RuntimeException(e);
             }
         }
index 4606b3797a9a9290ced2466c7f8312fff11337db..6ccc7522eccd960653888cdc555cb483728858ef 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import java.io.File;
@@ -5,6 +9,7 @@ import java.io.File;
 import com.itmill.toolkit.data.util.FilesystemContainer;
 import com.itmill.toolkit.data.util.FilesystemContainer.FileItem;
 import com.itmill.toolkit.demo.util.SampleDirectory;
+import com.itmill.toolkit.terminal.Sizeable;
 import com.itmill.toolkit.ui.ExpandLayout;
 import com.itmill.toolkit.ui.Field;
 import com.itmill.toolkit.ui.Label;
@@ -29,19 +34,19 @@ public class TreeFilesystemContainer extends com.itmill.toolkit.Application
         implements Listener {
 
     // Filesystem explorer panel and it's components
-    private Panel explorerPanel = new Panel("Filesystem explorer");
+    private final Panel explorerPanel = new Panel("Filesystem explorer");
 
-    private Tree filesystem = new Tree();
+    private final Tree filesystem = new Tree();
 
     // File properties panel and it's components
-    private Panel propertyPanel = new Panel("File properties");
+    private final Panel propertyPanel = new Panel("File properties");
 
-    private Label fileProperties = new Label();
+    private final Label fileProperties = new Label();
 
     public void init() {
-        Window w = new Window("Tree FilesystemContainer demo");
+        final Window w = new Window("Tree FilesystemContainer demo");
         setMainWindow(w);
-        ExpandLayout main = new ExpandLayout();
+        final ExpandLayout main = new ExpandLayout();
         w.setLayout(main);
         main.setMargin(true);
         main.setSpacing(true);
@@ -49,7 +54,7 @@ public class TreeFilesystemContainer extends com.itmill.toolkit.Application
         propertyPanel.setHeight(120);
         main.addComponent(propertyPanel);
         explorerPanel.setHeight(100);
-        explorerPanel.setHeightUnits(Panel.UNITS_PERCENTAGE);
+        explorerPanel.setHeightUnits(Sizeable.UNITS_PERCENTAGE);
         main.addComponent(explorerPanel);
         main.expand(explorerPanel);
 
@@ -62,9 +67,9 @@ public class TreeFilesystemContainer extends com.itmill.toolkit.Application
         propertyPanel.setEnabled(false);
 
         // Get sample directory
-        File sampleDir = SampleDirectory.getDirectory(this);
+        final File sampleDir = SampleDirectory.getDirectory(this);
         // Populate tree with FilesystemContainer
-        FilesystemContainer fsc = new FilesystemContainer(sampleDir, true);
+        final FilesystemContainer fsc = new FilesystemContainer(sampleDir, true);
         filesystem.setContainerDataSource(fsc);
         // "this" handles all filesystem events
         // e.g. node clicked, expanded etc.
@@ -83,8 +88,8 @@ public class TreeFilesystemContainer extends com.itmill.toolkit.Application
             // Check if event is about changing value
             if (event.getClass() == Field.ValueChangeEvent.class) {
                 // Update property panel contents
-                FileItem fileItem = (FileItem) filesystem.getItem(filesystem
-                        .getValue());
+                final FileItem fileItem = (FileItem) filesystem
+                        .getItem(filesystem.getValue());
                 fileProperties.setIcon(fileItem.getIcon());
                 fileProperties.setCaption(fileItem.getName() + ", size "
                         + fileItem.getSize() + " bytes.");
index 922c129932d7b84a9648c126a40eca608c91ab4e..a2a2c31f66fa204b727365bc7a1b2a4db11584eb 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 //
@@ -34,27 +38,28 @@ public class UpgradingSample extends Application implements
         Property.ValueChangeListener {
 
     /* Menu for navigating inside the application. */
-    private Tree menu = new Tree();
+    private final Tree menu = new Tree();
 
     /* Contents of the website */
-    private String[][] pages = { { "Welcome", "Welcome to our website..." },
+    private final String[][] pages = {
+            { "Welcome", "Welcome to our website..." },
             { "Products", "Public product information." },
             { "Contact", "Public contact information." },
             { "CRM", "CRM Database requiring login." },
             { "Intranet", "Internal information database." } };
 
     /* Application layout */
-    private GridLayout layout = new GridLayout(2, 1);
+    private final GridLayout layout = new GridLayout(2, 1);
 
     /* Initialize the application */
     public void init() {
 
         // Create the main window of the application
-        Window main = new Window("Login example", layout);
+        final Window main = new Window("Login example", layout);
         setMainWindow(main);
 
         // Add menu and loginbox to the application
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
         layout.addComponent(l, 0, 0);
         l.addComponent(menu);
         l.addComponent(new LoginBox());
@@ -88,10 +93,10 @@ public class UpgradingSample extends Application implements
     // Handle menu selection and update visible page
     public void valueChange(Property.ValueChangeEvent event) {
         layout.removeComponent(1, 0);
-        String title = (String) menu.getValue();
+        final String title = (String) menu.getValue();
         for (int i = 0; i < pages.length; i++) {
             if (pages[i][0].equals(title)) {
-                Panel p = new Panel(pages[i][0]);
+                final Panel p = new Panel(pages[i][0]);
                 p.addComponent(new Label(pages[i][1]));
                 p.setStyle("strong");
                 layout.addComponent(p, 1, 0);
@@ -104,18 +109,18 @@ public class UpgradingSample extends Application implements
             Application.UserChangeListener {
 
         // The components this loginbox is composed of
-        private TextField loginName = new TextField("Name");
+        private final TextField loginName = new TextField("Name");
 
-        private Button loginButton = new Button("Enter", this, "login");
+        private final Button loginButton = new Button("Enter", this, "login");
 
-        private Panel loginPanel = new Panel("Login");
+        private final Panel loginPanel = new Panel("Login");
 
-        private Panel statusPanel = new Panel();
+        private final Panel statusPanel = new Panel();
 
-        private Button logoutButton = new Button("Logout",
+        private final Button logoutButton = new Button("Logout",
                 UpgradingSample.this, "close");
 
-        private Label statusLabel = new Label();
+        private final Label statusLabel = new Label();
 
         // Initialize login component
         public LoginBox() {
@@ -138,7 +143,7 @@ public class UpgradingSample extends Application implements
 
         // Login into application
         public void login() {
-            String name = (String) loginName.getValue();
+            final String name = (String) loginName.getValue();
             if (name != null && name.length() > 0) {
                 setUser(name);
             }
index 840f153ed2e95762b70288cbf82dc3f9dd74ea90..6ec59bf629aae336cacf2830c06cf11d9d599978 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo;
 
 import java.util.HashMap;
@@ -35,20 +39,20 @@ public class WindowedDemos extends com.itmill.toolkit.Application {
     public void init() {
 
         // Create new window for the application and give the window a visible.
-        Window main = new Window("IT Mill Toolkit 5 Windowed Demos");
+        final Window main = new Window("IT Mill Toolkit 5 Windowed Demos");
         // set as main window
         setMainWindow(main);
 
         // Create menu window.
-        Window menu = new Window("Select demo");
+        final Window menu = new Window("Select demo");
         menu.setWidth(200);
         menu.setHeight(400);
         main.addWindow(menu); // add to layout
 
         // Create a menu button for each demo
-        for (Iterator it = servlets.keySet().iterator(); it.hasNext();) {
-            String name = (String) it.next();
-            Button b = new Button(name, new Button.ClickListener() {
+        for (final Iterator it = servlets.keySet().iterator(); it.hasNext();) {
+            final String name = (String) it.next();
+            final Button b = new Button(name, new Button.ClickListener() {
                 public void buttonClick(ClickEvent event) {
                     show(event.getButton().getCaption());
                 }
index 12ecb24dbf74eee832b5d6957347f086eff44f51..a6a6ff249e70487e8a6770c3b506bb663eecb81a 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo.colorpicker;
 
 import java.util.Map;
@@ -50,7 +54,7 @@ public class ColorPicker extends AbstractField {
     public void changeVariables(Object source, Map variables) {
         // Sets the currently selected color
         if (variables.containsKey("colorname") && !isReadOnly()) {
-            String newValue = (String) variables.get("colorname");
+            final String newValue = (String) variables.get("colorname");
             // Changing the property of the component will
             // trigger a ValueChangeEvent
             setValue(newValue, true);
index 248b4a5af266b3e767ac423bd9b52e34975ca2a1..e1fd2a1a8ccf4232c0cbff1aa769c9e6ee8a7191 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo.colorpicker;
 
 import com.itmill.toolkit.data.Property.ValueChangeEvent;
@@ -39,7 +43,7 @@ public class ColorPickerApplication extends com.itmill.toolkit.Application {
         main.addComponent(colorname);
 
         // Server-side manipulation of the component state
-        Button button = new Button("Set to white");
+        final Button button = new Button("Set to white");
         button.addListener(new Button.ClickListener() {
             public void buttonClick(ClickEvent event) {
                 colorselector.setColor("white");
index f6d43e5f0b576b42fe091f7ef425d0bf41b6b120..77409e56861223c2646895e5f52f36e2558fb3bc 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.colorpicker.gwt.client;\r
 \r
 import com.google.gwt.user.client.ui.Widget;\r
@@ -8,7 +12,7 @@ import com.itmill.toolkit.terminal.gwt.client.UIDL;
 public class ColorPickerWidgetSet extends DefaultWidgetSet {\r
     /** Creates a widget according to its class name. */\r
     public Widget createWidget(UIDL uidl) {\r
-        String className = resolveWidgetTypeName(uidl);\r
+        final String className = resolveWidgetTypeName(uidl);\r
         if ("com.itmill.toolkit.demo.colorpicker.gwt.client.ui.IColorPicker"\r
                 .equals(className)) {\r
             return new IColorPicker();\r
@@ -20,7 +24,7 @@ public class ColorPickerWidgetSet extends DefaultWidgetSet {
 \r
     /** Resolves UIDL tag name to class name. */\r
     protected String resolveWidgetTypeName(UIDL uidl) {\r
-        String tag = uidl.getTag();\r
+        final String tag = uidl.getTag();\r
         if ("colorpicker".equals(tag)) {\r
             return "com.itmill.toolkit.demo.colorpicker.gwt.client.ui.IColorPicker";\r
         }\r
index 38b83f196198156f54cffbecd54601b1e7c93d89..b4d060d52845ede1802873831ed03ec579e12c06 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo.colorpicker.gwt.client.ui;
 
 import com.google.gwt.user.client.DOM;
@@ -20,15 +24,15 @@ public class GwtColorPicker extends Composite implements ClickListener {
 
     public GwtColorPicker() {
         // Create a 4x4 grid of buttons with names for 16 colors
-        Grid grid = new Grid(4, 4);
-        String[] colors = new String[] { "aqua", "black", "blue", "fuchsia",
-                "gray", "green", "lime", "maroon", "navy", "olive", "purple",
-                "red", "silver", "teal", "white", "yellow" };
+        final Grid grid = new Grid(4, 4);
+        final String[] colors = new String[] { "aqua", "black", "blue",
+                "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive",
+                "purple", "red", "silver", "teal", "white", "yellow" };
         int colornum = 0;
         for (int i = 0; i < 4; i++) {
             for (int j = 0; j < 4; j++, colornum++) {
                 // Create a button for each color
-                Button button = new Button(colors[colornum]);
+                final Button button = new Button(colors[colornum]);
                 button.addClickListener(this);
 
                 // Put the button in the Grid layout
@@ -49,7 +53,7 @@ public class GwtColorPicker extends Composite implements ClickListener {
 
         // Create a panel with the color grid and currently selected color
         // indicator
-        HorizontalPanel panel = new HorizontalPanel();
+        final HorizontalPanel panel = new HorizontalPanel();
         panel.add(grid);
         panel.add(currentcolor);
 
@@ -60,7 +64,7 @@ public class GwtColorPicker extends Composite implements ClickListener {
         // the parent of the label element. Notice that the element has no
         // parent
         // before the widget has been added to the horizontal panel.
-        Element panelcell = DOM.getParent(currentcolor.getElement());
+        final Element panelcell = DOM.getParent(currentcolor.getElement());
         DOM.setElementProperty(panelcell, "className",
                 "colorpicker-currentcolorbox");
 
@@ -85,8 +89,8 @@ public class GwtColorPicker extends Composite implements ClickListener {
 
         // Obtain the DOM elements. This assumes that the <td> element
         // of the HorizontalPanel is the parent of the label element.
-        Element nameelement = currentcolor.getElement();
-        Element cell = DOM.getParent(nameelement);
+        final Element nameelement = currentcolor.getElement();
+        final Element cell = DOM.getParent(nameelement);
 
         // Give feedback by changing the background color
         DOM.setStyleAttribute(cell, "background", newcolor);
index 434c4f05304d683616d67ad99d071fb7c1ddf578..bab75f85f57b62b92563ef27ae2f8f505488d09f 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo.colorpicker.gwt.client.ui;
 
 import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
index b4406da7b4f7962ebbb94deebbf8a154c948cf32..a352fe99ff9d3add963c29a98b08662c43c7319b 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.featurebrowser;\r
 \r
 import com.itmill.toolkit.terminal.ExternalResource;\r
@@ -21,18 +25,18 @@ public class ButtonExample extends CustomComponent implements
 \r
     public ButtonExample() {\r
 \r
-        OrderedLayout main = new OrderedLayout();\r
+        final OrderedLayout main = new OrderedLayout();\r
         main.setMargin(true);\r
         setCompositionRoot(main);\r
 \r
-        OrderedLayout horiz = new OrderedLayout(\r
+        final OrderedLayout horiz = new OrderedLayout(\r
                 OrderedLayout.ORIENTATION_HORIZONTAL);\r
         main.addComponent(horiz);\r
-        Panel basic = new Panel("Basic buttons");\r
+        final Panel basic = new Panel("Basic buttons");\r
         basic.setStyleName(Panel.STYLE_LIGHT);\r
         horiz.addComponent(basic);\r
 \r
-        Panel bells = new Panel("w/ bells & whistles");\r
+        final Panel bells = new Panel("w/ bells & whistles");\r
         bells.setStyleName(Panel.STYLE_LIGHT);\r
         horiz.addComponent(bells);\r
 \r
@@ -77,10 +81,10 @@ public class ButtonExample extends CustomComponent implements
         b.setDescription("Link-style, icon+tootip, no caption");\r
         basic.addComponent(b);\r
 \r
-        Panel links = new Panel("Links");\r
+        final Panel links = new Panel("Links");\r
         links.setStyleName(Panel.STYLE_LIGHT);\r
         main.addComponent(links);\r
-        Label desc = new Label(\r
+        final Label desc = new Label(\r
                 "The main difference between a Link and"\r
                         + " a link-styled Button is that the Link works client-"\r
                         + " side, whereas the Button works server side.<br/> This means"\r
@@ -123,7 +127,7 @@ public class ButtonExample extends CustomComponent implements
     }\r
 \r
     public void buttonClick(ClickEvent event) {\r
-        Button b = event.getButton();\r
+        final Button b = event.getButton();\r
         getWindow().showNotification(\r
                 "Clicked"\r
                         + (b instanceof CheckBox ? ", value: "\r
index 235fe9c466da7e1c21c9c268be105e963f9a5d5e..7f6e6d38f5030d40f8e06186281b680bae5a0b2b 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.featurebrowser;\r
 \r
 import com.itmill.toolkit.terminal.PaintException;\r
@@ -28,13 +32,13 @@ public class ClientCachingExample extends CustomComponent {
 \r
     public ClientCachingExample() {\r
 \r
-        OrderedLayout main = new OrderedLayout();\r
+        final OrderedLayout main = new OrderedLayout();\r
         main.setMargin(true);\r
         setCompositionRoot(main);\r
 \r
         main.addComponent(new Label(msg));\r
 \r
-        TabSheet ts = new TabSheet();\r
+        final TabSheet ts = new TabSheet();\r
         main.addComponent(ts);\r
 \r
         Layout layout = new OrderedLayout();\r
@@ -51,7 +55,7 @@ public class ClientCachingExample extends CustomComponent {
             public void paintContent(PaintTarget target) throws PaintException {\r
                 try {\r
                     Thread.sleep(3000);\r
-                } catch (Exception e) {\r
+                } catch (final Exception e) {\r
                     // IGNORED\r
                 }\r
                 super.paintContent(target);\r
index c83db8b2a0144d644b478cdaeb6ba7e837bb7db1..b7a02f3161d6fbf2bcd1eeb9adf75276fede4aba 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo.featurebrowser;
 
 import com.itmill.toolkit.ui.ComboBox;
@@ -21,12 +25,12 @@ public class ComboBoxExample extends CustomComponent {
             "Fielding", "Einstein" };
 
     public ComboBoxExample() {
-        OrderedLayout main = new OrderedLayout();
+        final OrderedLayout main = new OrderedLayout();
         main.setMargin(true);
         setCompositionRoot(main);
 
         // starts-with filter
-        ComboBox s1 = new ComboBox("Select with starts-with filter");
+        final ComboBox s1 = new ComboBox("Select with starts-with filter");
         s1.setFilteringMode(Filtering.FILTERINGMODE_STARTSWITH);
         s1.setColumns(20);
         for (int i = 0; i < 105; i++) {
@@ -39,7 +43,7 @@ public class ComboBoxExample extends CustomComponent {
         main.addComponent(s1);
 
         // contains filter
-        ComboBox s2 = new ComboBox("Select with contains filter");
+        final ComboBox s2 = new ComboBox("Select with contains filter");
         s2.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS);
         s2.setColumns(20);
         for (int i = 0; i < 500; i++) {
@@ -52,7 +56,7 @@ public class ComboBoxExample extends CustomComponent {
         main.addComponent(s2);
 
         // initially empty
-        ComboBox s3 = new ComboBox("Initially empty; enter your own");
+        final ComboBox s3 = new ComboBox("Initially empty; enter your own");
         s3.setColumns(20);
         s3.setImmediate(true);
         main.addComponent(s3);
index 5ff1a9d79e7cb76b1fbed10d0f9944fab79332cf..7391fc135ecdf4db9a4632a9562e30a591f0128a 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo.featurebrowser;
 
 import com.itmill.toolkit.data.Property.ValueChangeEvent;
@@ -33,7 +37,7 @@ public class EmbeddedBrowserExample extends ExpandLayout implements
         setSizeFull();
 
         // create the address combobox
-        Select select = new Select();
+        final Select select = new Select();
         // allow input
         select.setNewItemsAllowed(true);
         // no empty selection
@@ -59,7 +63,7 @@ public class EmbeddedBrowserExample extends ExpandLayout implements
     }
 
     public void valueChange(ValueChangeEvent event) {
-        String url = (String) event.getProperty().getValue();
+        final String url = (String) event.getProperty().getValue();
         if (url != null) {
             // the selected url has changed, let's go there
             emb.setSource(new ExternalResource(url));
index a15547472b7317f6e8d3a0125f6e06c58614c987..0e80eba006f1758cf44c9f64d001534ecb055eb7 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo.featurebrowser;
 
 import java.util.HashMap;
@@ -10,6 +14,7 @@ import com.itmill.toolkit.data.util.IndexedContainer;
 import com.itmill.toolkit.terminal.ExternalResource;
 import com.itmill.toolkit.terminal.Sizeable;
 import com.itmill.toolkit.terminal.ThemeResource;
+import com.itmill.toolkit.ui.AbstractSelect;
 import com.itmill.toolkit.ui.Button;
 import com.itmill.toolkit.ui.Component;
 import com.itmill.toolkit.ui.Embedded;
@@ -46,7 +51,7 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
     private TabSheet ts;
 
     // Example "cache"
-    private HashMap exampleInstances = new HashMap();
+    private final HashMap exampleInstances = new HashMap();
 
     // List of examples
     private static final Object[][] demos = new Object[][] {
@@ -99,23 +104,24 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
         setTheme("example");
 
         // Create new window for the application and give the window a visible.
-        Window main = new Window("IT Mill Toolkit 5");
+        final Window main = new Window("IT Mill Toolkit 5");
         // set as main window
         setMainWindow(main);
 
-        SplitPanel split = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
+        final SplitPanel split = new SplitPanel(
+                SplitPanel.ORIENTATION_HORIZONTAL);
         split.setSplitPosition(200, Sizeable.UNITS_PIXELS);
         main.setLayout(split);
 
-        HashMap sectionIds = new HashMap();
-        HierarchicalContainer container = createContainer();
-        Object rootId = container.addItem();
+        final HashMap sectionIds = new HashMap();
+        final HierarchicalContainer container = createContainer();
+        final Object rootId = container.addItem();
         Item item = container.getItem(rootId);
         Property p = item.getItemProperty(PROPERTY_ID_NAME);
         p.setValue("All examples");
         for (int i = 0; i < demos.length; i++) {
-            Object[] demo = demos[i];
-            String section = (String) demo[0];
+            final Object[] demo = demos[i];
+            final String section = (String) demo[0];
             Object sectionId;
             if (sectionIds.containsKey(section)) {
                 sectionId = sectionIds.get(section);
@@ -127,7 +133,7 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
                 p = item.getItemProperty(PROPERTY_ID_NAME);
                 p.setValue(section);
             }
-            Object id = container.addItem();
+            final Object id = container.addItem();
             container.setParent(id, sectionId);
             initItem(container.getItem(id), demo);
 
@@ -138,7 +144,7 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
         tree.setMultiSelect(false);
         tree.setNullSelectionAllowed(false);
         tree.setContainerDataSource(container);
-        tree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_PROPERTY);
+        tree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
         tree.setItemCaptionPropertyId(PROPERTY_ID_NAME);
         tree.addListener(this);
         tree.setImmediate(true);
@@ -146,7 +152,7 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
 
         split.addComponent(tree);
 
-        SplitPanel split2 = new SplitPanel();
+        final SplitPanel split2 = new SplitPanel();
         split2.setSplitPosition(200, Sizeable.UNITS_PIXELS);
         split.addComponent(split2);
 
@@ -159,7 +165,7 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
         table.setNullSelectionAllowed(false);
         try {
             table.setContainerDataSource((IndexedContainer) container.clone());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             e.printStackTrace(System.err);
         }
         // Hide some columns
@@ -169,11 +175,11 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
         table.setImmediate(true);
         split2.addComponent(table);
 
-        ExpandLayout exp = new ExpandLayout();
+        final ExpandLayout exp = new ExpandLayout();
         exp.setMargin(true);
         split2.addComponent(exp);
 
-        OrderedLayout wbLayout = new OrderedLayout(
+        final OrderedLayout wbLayout = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
         Button b = new Button("Open in sub-window", new Button.ClickListener() {
             public void buttonClick(ClickEvent event) {
@@ -203,13 +209,13 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
             public void buttonClick(ClickEvent event) {
                 Component component = (Component) ts.getComponentIterator()
                         .next();
-                String caption = ts.getTabCaption(component);
+                final String caption = ts.getTabCaption(component);
                 Window w = getWindow(caption);
                 if (w == null) {
                     try {
                         component = (Component) component.getClass()
                                 .newInstance();
-                    } catch (Exception e) {
+                    } catch (final Exception e) {
                         // Could not create
                         return;
                     }
@@ -230,8 +236,8 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
         wbLayout.addComponent(b);
 
         exp.addComponent(wbLayout);
-        exp.setComponentAlignment(wbLayout, ExpandLayout.ALIGNMENT_RIGHT,
-                ExpandLayout.ALIGNMENT_TOP);
+        exp.setComponentAlignment(wbLayout, OrderedLayout.ALIGNMENT_RIGHT,
+                OrderedLayout.ALIGNMENT_TOP);
 
         ts = new TabSheet();
         ts.setSizeFull();
@@ -239,13 +245,13 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
         exp.addComponent(ts);
         exp.expand(ts);
 
-        Label status = new Label(
+        final Label status = new Label(
                 "<a href=\"http://www.itmill.com/index_developers.htm\">Developer Area</a>"
                         + " | <a href=\"http://www.itmill.com/developers_documentation.htm\">Documentation</a>");
         status.setContentMode(Label.CONTENT_XHTML);
         exp.addComponent(status);
-        exp.setComponentAlignment(status, ExpandLayout.ALIGNMENT_RIGHT,
-                ExpandLayout.ALIGNMENT_VERTICAL_CENTER);
+        exp.setComponentAlignment(status, OrderedLayout.ALIGNMENT_RIGHT,
+                OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
 
         // select initial section ("All")
         tree.setValue(rootId);
@@ -270,7 +276,7 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
     }
 
     private HierarchicalContainer createContainer() {
-        HierarchicalContainer c = new HierarchicalContainer();
+        final HierarchicalContainer c = new HierarchicalContainer();
         c.addContainerProperty(PROPERTY_ID_CATEGORY, String.class, null);
         c.addContainerProperty(PROPERTY_ID_NAME, String.class, "");
         c.addContainerProperty(PROPERTY_ID_DESC, String.class, "");
@@ -281,8 +287,8 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
 
     public void valueChange(ValueChangeEvent event) {
         if (event.getProperty() == tree) {
-            Object id = tree.getValue();
-            Item item = tree.getItem(id);
+            final Object id = tree.getValue();
+            final Item item = tree.getItem(id);
             //
             String section;
             if (tree.isRoot(id)) {
@@ -296,7 +302,7 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
             }
 
             table.setValue(null);
-            IndexedContainer c = (IndexedContainer) table
+            final IndexedContainer c = (IndexedContainer) table
                     .getContainerDataSource();
             c.removeAllContainerFilters();
             if (section != null) {
@@ -315,18 +321,18 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
                 table.removeListener(this);
                 tree.setValue(table.getValue());
                 table.addListener(this);
-                Item item = table.getItem(table.getValue());
-                Class c = (Class) item.getItemProperty(PROPERTY_ID_CLASS)
+                final Item item = table.getItem(table.getValue());
+                final Class c = (Class) item.getItemProperty(PROPERTY_ID_CLASS)
                         .getValue();
-                Component component = getComponent(c);
+                final Component component = getComponent(c);
                 if (component != null) {
-                    String caption = (String) item.getItemProperty(
+                    final String caption = (String) item.getItemProperty(
                             PROPERTY_ID_NAME).getValue();
                     ts.removeAllComponents();
                     ts.addTab(component, caption, null);
                 }
                 // update "viewed" state
-                Property p = item.getItemProperty(PROPERTY_ID_VIEWED);
+                final Property p = item.getItemProperty(PROPERTY_ID_VIEWED);
                 if (p.getValue() == null) {
                     p.setValue(new Embedded("", new ThemeResource(
                             "icons/ok.png")));
@@ -340,9 +346,9 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
     private Component getComponent(Class componentClass) {
         if (!exampleInstances.containsKey(componentClass)) {
             try {
-                Component c = (Component) componentClass.newInstance();
+                final Component c = (Component) componentClass.newInstance();
                 exampleInstances.put(componentClass, c);
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 return null;
             }
         }
index 41e14b8841b40c57cb798249ada297dba3d11413..c465b14845a998e1dcfd7689ea3facdc890d5386 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.featurebrowser;\r
 \r
 import com.itmill.toolkit.ui.CustomComponent;\r
@@ -25,11 +29,11 @@ public class LabelExample extends CustomComponent {
 \r
     public LabelExample() {\r
 \r
-        OrderedLayout main = new OrderedLayout();\r
+        final OrderedLayout main = new OrderedLayout();\r
         main.setMargin(true);\r
         setCompositionRoot(main);\r
 \r
-        GridLayout g = new GridLayout(2, 4);\r
+        final GridLayout g = new GridLayout(2, 4);\r
         main.addComponent(g);\r
 \r
         // plain w/o caption\r
index 14510597ca2927ed774f03a0d40222745410c9cd..d33710b0517954e7a0db2ddc3ec6436445ea9b3e 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.featurebrowser;\r
 \r
 import com.itmill.toolkit.ui.CustomComponent;\r
@@ -17,11 +21,11 @@ public class LayoutExample extends CustomComponent {
 \r
     public LayoutExample() {\r
 \r
-        OrderedLayout main = new OrderedLayout();\r
+        final OrderedLayout main = new OrderedLayout();\r
         main.setMargin(true);\r
         setCompositionRoot(main);\r
 \r
-        GridLayout g = new GridLayout(2, 5);\r
+        final GridLayout g = new GridLayout(2, 5);\r
         main.addComponent(g);\r
 \r
         // panel\r
@@ -53,7 +57,7 @@ public class LayoutExample extends CustomComponent {
         ol.addComponent(new Label("Component 3"));\r
         ts.addTab(ol, "Horizontal OrderedLayout", null);\r
 \r
-        GridLayout gl = new GridLayout(3, 3);\r
+        final GridLayout gl = new GridLayout(3, 3);\r
         gl.setMargin(true);\r
         gl.addComponent(new Label("Component 1.1"));\r
         gl.addComponent(new Label("Component 1.2"));\r
index f0f8e2ac548d4457544eb6ee86df5fc5e9b10f71..925474f1f549963e1cd804a931ec0829763f6be8 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo.featurebrowser;
 
 import java.util.Date;
@@ -35,7 +39,7 @@ public class NotificationExample extends CustomComponent {
      */
     public NotificationExample() {
         // Main layout
-        OrderedLayout main = new OrderedLayout();
+        final OrderedLayout main = new OrderedLayout();
         main.setMargin(true); // use theme-specific margin
         setCompositionRoot(main);
 
@@ -75,7 +79,7 @@ public class NotificationExample extends CustomComponent {
         message.setValue("A quick one jumped over the lazy dog.");
 
         // Button to show the notification
-        Button b = new Button("Show notification", new ClickListener() {
+        final Button b = new Button("Show notification", new ClickListener() {
             // this is an inline ClickListener
             public void buttonClick(ClickEvent event) {
                 // show the notification
index 6450940b0b90ecb4826fa345b8362a7fe9db6282..9410c8558bb73ee6aef5fb51a397defd5c6f411d 100644 (file)
@@ -1,6 +1,7 @@
-/**\r
- * \r
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
  */\r
+\r
 package com.itmill.toolkit.demo.featurebrowser;\r
 \r
 import com.itmill.toolkit.ui.Button;\r
@@ -22,10 +23,10 @@ public class RichTextExample extends CustomComponent {
             + "See the <A href=\"http://www.itmill.com/manual/\">manual</a> "\r
             + "for more information.";\r
 \r
-    private OrderedLayout main;\r
-    private Label l;\r
-    private RichTextArea editor = new RichTextArea();\r
-    private Button b;\r
+    private final OrderedLayout main;\r
+    private final Label l;\r
+    private final RichTextArea editor = new RichTextArea();\r
+    private final Button b;\r
 \r
     public RichTextExample() {\r
         // main layout\r
index 46baf23fd7195e0c85b5751044fa03877944ad26..084d14f149a1eafc5d47ebb4c2e73b524cec974c 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.featurebrowser;\r
 \r
 import com.itmill.toolkit.data.Property.ValueChangeEvent;\r
@@ -20,24 +24,24 @@ import com.itmill.toolkit.ui.TwinColSelect;
 public class SelectExample extends CustomComponent {\r
 \r
     // listener that shows a value change notification\r
-    private Field.ValueChangeListener listener = new Field.ValueChangeListener() {\r
+    private final Field.ValueChangeListener listener = new Field.ValueChangeListener() {\r
         public void valueChange(ValueChangeEvent event) {\r
             getWindow().showNotification("" + event.getProperty().getValue());\r
         }\r
     };\r
 \r
     public SelectExample() {\r
-        OrderedLayout main = new OrderedLayout();\r
+        final OrderedLayout main = new OrderedLayout();\r
         main.setMargin(true);\r
         setCompositionRoot(main);\r
 \r
-        OrderedLayout horiz = new OrderedLayout(\r
+        final OrderedLayout horiz = new OrderedLayout(\r
                 OrderedLayout.ORIENTATION_HORIZONTAL);\r
         main.addComponent(horiz);\r
-        Panel single = new Panel("Single selects");\r
+        final Panel single = new Panel("Single selects");\r
         single.setStyleName(Panel.STYLE_LIGHT);\r
         horiz.addComponent(single);\r
-        Panel multi = new Panel("Multi selects");\r
+        final Panel multi = new Panel("Multi selects");\r
         multi.setStyleName(Panel.STYLE_LIGHT);\r
         horiz.addComponent(multi);\r
 \r
index 5d181212efd563ddb6997c849addd72977826d25..29c55f224d02996675e85e4811648dc3b1d92783 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.featurebrowser;\r
 \r
 import java.util.Iterator;\r
@@ -46,7 +50,7 @@ public class TableExample extends CustomComponent implements Action.Handler,
 \r
     public TableExample() {\r
         // main layout\r
-        OrderedLayout main = new OrderedLayout();\r
+        final OrderedLayout main = new OrderedLayout();\r
         main.setMargin(true);\r
         setCompositionRoot(main);\r
 \r
@@ -64,7 +68,7 @@ public class TableExample extends CustomComponent implements Action.Handler,
         main.addComponent(source);\r
 \r
         // x-selected button row\r
-        OrderedLayout horiz = new OrderedLayout(\r
+        final OrderedLayout horiz = new OrderedLayout(\r
                 OrderedLayout.ORIENTATION_HORIZONTAL);\r
         horiz.setMargin(false, false, true, false);\r
         main.addComponent(horiz);\r
@@ -96,7 +100,7 @@ public class TableExample extends CustomComponent implements Action.Handler,
         saved.addActionHandler(this);\r
         main.addComponent(saved);\r
 \r
-        CheckBox b = new CheckBox("Modify saved creatures");\r
+        final CheckBox b = new CheckBox("Modify saved creatures");\r
         b.addListener(new CheckBox.ClickListener() {\r
             public void buttonClick(ClickEvent event) {\r
                 saved.setEditable(((Boolean) event.getButton().getValue())\r
@@ -122,17 +126,17 @@ public class TableExample extends CustomComponent implements Action.Handler,
     private void fillTable(Table table) {\r
         initProperties(table);\r
 \r
-        String[] sp = new String[] { "Fox", "Dog", "Cat", "Moose", "Penguin",\r
-                "Cow" };\r
-        String[] ty = new String[] { "Quick", "Lazy", "Sleepy", "Fidgety",\r
-                "Crazy", "Kewl" };\r
-        String[] ki = new String[] { "Jumping", "Walking", "Sleeping",\r
+        final String[] sp = new String[] { "Fox", "Dog", "Cat", "Moose",\r
+                "Penguin", "Cow" };\r
+        final String[] ty = new String[] { "Quick", "Lazy", "Sleepy",\r
+                "Fidgety", "Crazy", "Kewl" };\r
+        final String[] ki = new String[] { "Jumping", "Walking", "Sleeping",\r
                 "Skipping", "Dancing" };\r
 \r
         for (int i = 0; i < 100; i++) {\r
-            String s = sp[(int) (Math.random() * sp.length)];\r
-            String t = ty[(int) (Math.random() * ty.length)];\r
-            String k = ki[(int) (Math.random() * ki.length)];\r
+            final String s = sp[(int) (Math.random() * sp.length)];\r
+            final String t = ty[(int) (Math.random() * ty.length)];\r
+            final String k = ki[(int) (Math.random() * ki.length)];\r
             table.addItem(new Object[] { s, t, k, Boolean.FALSE }, new Integer(\r
                     i));\r
         }\r
@@ -142,7 +146,7 @@ public class TableExample extends CustomComponent implements Action.Handler,
     // Called for each item (row), returns valid actions for that item\r
     public Action[] getActions(Object target, Object sender) {\r
         if (sender == source) {\r
-            Item item = source.getItem(target);\r
+            final Item item = source.getItem(target);\r
             // save, delete, and hire if not already hired\r
             if (item != null\r
                     && item.getItemProperty(PROPERTY_HIRED).getValue() == Boolean.FALSE) {\r
@@ -178,7 +182,7 @@ public class TableExample extends CustomComponent implements Action.Handler,
                     return;\r
                 }\r
                 // "manual" copy of the item properties we want\r
-                Item added = saved.addItem(target);\r
+                final Item added = saved.addItem(target);\r
                 Property p = added.getItemProperty(PROPERTY_SPECIES);\r
                 p.setValue(item.getItemProperty(PROPERTY_SPECIES).getValue());\r
                 p = added.getItemProperty(PROPERTY_TYPE);\r
@@ -197,7 +201,7 @@ public class TableExample extends CustomComponent implements Action.Handler,
         } else {\r
             // sender==saved\r
             if (action == ACTION_DELETE) {\r
-                Item item = saved.getItem(target);\r
+                final Item item = saved.getItem(target);\r
                 getWindow().showNotification("Deleted", "" + item);\r
                 saved.removeItem(target);\r
             }\r
@@ -205,18 +209,18 @@ public class TableExample extends CustomComponent implements Action.Handler,
     }\r
 \r
     public void buttonClick(ClickEvent event) {\r
-        Button b = event.getButton();\r
+        final Button b = event.getButton();\r
         if (b == deselect) {\r
             source.setValue(null);\r
         } else if (b == saveSelected) {\r
             // loop each selected and copy to "saved" table\r
-            Set selected = (Set) source.getValue();\r
+            final Set selected = (Set) source.getValue();\r
             int s = 0;\r
-            for (Iterator it = selected.iterator(); it.hasNext();) {\r
-                Object id = it.next();\r
+            for (final Iterator it = selected.iterator(); it.hasNext();) {\r
+                final Object id = it.next();\r
                 if (!saved.containsId(id)) {\r
-                    Item item = source.getItem(id);\r
-                    Item added = saved.addItem(id);\r
+                    final Item item = source.getItem(id);\r
+                    final Item added = saved.addItem(id);\r
                     // "manual" copy of the properties we want\r
                     Property p = added.getItemProperty(PROPERTY_SPECIES);\r
                     p.setValue(item.getItemProperty(PROPERTY_SPECIES)\r
@@ -236,11 +240,11 @@ public class TableExample extends CustomComponent implements Action.Handler,
         } else if (b == hireSelected) {\r
             // loop each selected and set property HIRED to true\r
             int s = 0;\r
-            Set selected = (Set) source.getValue();\r
-            for (Iterator it = selected.iterator(); it.hasNext();) {\r
-                Object id = it.next();\r
+            final Set selected = (Set) source.getValue();\r
+            for (final Iterator it = selected.iterator(); it.hasNext();) {\r
+                final Object id = it.next();\r
                 Item item = source.getItem(id);\r
-                Property p = item.getItemProperty(PROPERTY_HIRED);\r
+                final Property p = item.getItemProperty(PROPERTY_HIRED);\r
                 if (p.getValue() == Boolean.FALSE) {\r
                     p.setValue(Boolean.TRUE);\r
                     source.requestRepaint();\r
@@ -258,9 +262,9 @@ public class TableExample extends CustomComponent implements Action.Handler,
         } else {\r
             // loop trough selected and delete\r
             int s = 0;\r
-            Set selected = (Set) source.getValue();\r
-            for (Iterator it = selected.iterator(); it.hasNext();) {\r
-                Object id = it.next();\r
+            final Set selected = (Set) source.getValue();\r
+            for (final Iterator it = selected.iterator(); it.hasNext();) {\r
+                final Object id = it.next();\r
                 if (source.containsId(id)) {\r
                     s++;\r
                     source.removeItem(id);\r
index ce62c7bf23cd422b66ee95bcfae4565568138c11..694c839fb46b7b7a61b84a597fefd7ada3732de4 100644 (file)
@@ -1,9 +1,14 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo.featurebrowser;
 
 import com.itmill.toolkit.data.Item;
 import com.itmill.toolkit.data.Property;
 import com.itmill.toolkit.data.Property.ValueChangeEvent;
 import com.itmill.toolkit.event.Action;
+import com.itmill.toolkit.ui.AbstractSelect;
 import com.itmill.toolkit.ui.CustomComponent;
 import com.itmill.toolkit.ui.Label;
 import com.itmill.toolkit.ui.OrderedLayout;
@@ -32,7 +37,7 @@ public class TreeExample extends CustomComponent implements Action.Handler,
     TextField editor;
 
     public TreeExample() {
-        OrderedLayout main = new OrderedLayout(
+        final OrderedLayout main = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
         main.setMargin(true);
         setCompositionRoot(main);
@@ -49,10 +54,10 @@ public class TreeExample extends CustomComponent implements Action.Handler,
         // we'll use a property for caption instead of the item id ("value"),
         // so that multiple items can have the same caption
         tree.addContainerProperty(CAPTION_PROPERTY, String.class, "");
-        tree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_PROPERTY);
+        tree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
         tree.setItemCaptionPropertyId(CAPTION_PROPERTY);
         for (int i = 1; i <= 3; i++) {
-            Object id = addCaptionedItem("Section " + i, null);
+            final Object id = addCaptionedItem("Section " + i, null);
             tree.expandItem(id);
             addCaptionedItem("Team A", id);
             addCaptionedItem("Team B", id);
@@ -87,7 +92,7 @@ public class TreeExample extends CustomComponent implements Action.Handler,
             tree.removeItem(target);
         } else {
             // Add
-            Object id = addCaptionedItem("New Item", target);
+            final Object id = addCaptionedItem("New Item", target);
             tree.expandItem(target);
             tree.setValue(id);
             editor.focus();
@@ -95,7 +100,7 @@ public class TreeExample extends CustomComponent implements Action.Handler,
     }
 
     public void valueChange(ValueChangeEvent event) {
-        Object id = tree.getValue(); // selected item id
+        final Object id = tree.getValue(); // selected item id
         if (event.getProperty() == tree) {
             // a Tree item was (un) selected
             if (id == null) {
@@ -109,7 +114,7 @@ public class TreeExample extends CustomComponent implements Action.Handler,
                 editor.removeListener(this);
                 // enable TextField and update value
                 editor.setEnabled(true);
-                Item item = tree.getItem(id);
+                final Item item = tree.getItem(id);
                 editor.setValue(item.getItemProperty(CAPTION_PROPERTY)
                         .getValue());
                 // listen for TextField changes
@@ -119,8 +124,8 @@ public class TreeExample extends CustomComponent implements Action.Handler,
         } else {
             // TextField
             if (id != null) {
-                Item item = tree.getItem(id);
-                Property p = item.getItemProperty(CAPTION_PROPERTY);
+                final Item item = tree.getItem(id);
+                final Property p = item.getItemProperty(CAPTION_PROPERTY);
                 p.setValue(editor.getValue());
                 tree.requestRepaint();
             }
@@ -139,11 +144,11 @@ public class TreeExample extends CustomComponent implements Action.Handler,
      */
     private Object addCaptionedItem(String caption, Object parent) {
         // add item, let tree decide id
-        Object id = tree.addItem();
+        final Object id = tree.addItem();
         // get the created item
-        Item item = tree.getItem(id);
+        final Item item = tree.getItem(id);
         // set our "caption" property
-        Property p = item.getItemProperty(CAPTION_PROPERTY);
+        final Property p = item.getItemProperty(CAPTION_PROPERTY);
         p.setValue(caption);
         if (parent != null) {
             tree.setParent(id, parent);
index cc07d4c0d59c1954e481582f27c1539ae6cd96a8..6bbd8759177c3a6783973292cdbdec295175aa3d 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.featurebrowser;\r
 \r
 import com.itmill.toolkit.data.Property.ValueChangeEvent;\r
@@ -19,12 +23,12 @@ import com.itmill.toolkit.ui.Window.Notification;
 public class ValueInputExample extends CustomComponent {\r
 \r
     public ValueInputExample() {\r
-        OrderedLayout main = new OrderedLayout();\r
+        final OrderedLayout main = new OrderedLayout();\r
         main.setMargin(true);\r
         setCompositionRoot(main);\r
 \r
         // listener that shows a value change notification\r
-        Field.ValueChangeListener listener = new Field.ValueChangeListener() {\r
+        final Field.ValueChangeListener listener = new Field.ValueChangeListener() {\r
             public void valueChange(ValueChangeEvent event) {\r
                 getWindow().showNotification("Received",\r
                         "<pre>" + event.getProperty().getValue() + "</pre>",\r
@@ -106,13 +110,13 @@ public class ValueInputExample extends CustomComponent {
         slider.addListener(new Slider.ValueChangeListener() {\r
             public void valueChange(ValueChangeEvent event) {\r
                 // update caption when value changes\r
-                Slider s = (Slider) event.getProperty();\r
+                final Slider s = (Slider) event.getProperty();\r
                 s.setCaption("Value: " + s.getValue());\r
             }\r
         });\r
         try {\r
             slider.setValue(20);\r
-        } catch (Exception e) {\r
+        } catch (final Exception e) {\r
             e.printStackTrace(System.err);\r
         }\r
         left.addComponent(slider);\r
@@ -122,13 +126,13 @@ public class ValueInputExample extends CustomComponent {
         slider.addListener(new Slider.ValueChangeListener() {\r
             public void valueChange(ValueChangeEvent event) {\r
                 // update caption when value changes\r
-                Slider s = (Slider) event.getProperty();\r
+                final Slider s = (Slider) event.getProperty();\r
                 s.setCaption("Value: " + s.getValue());\r
             }\r
         });\r
         try {\r
             slider.setValue(0.5);\r
-        } catch (Exception e) {\r
+        } catch (final Exception e) {\r
             e.printStackTrace(System.err);\r
         }\r
         left.addComponent(slider);\r
index 8ae6021db128210d817ba3e20dd6634d7fec1973..c13d96d2eea4f2d81e0a7aad0f3f63546c1a8fb7 100644 (file)
@@ -1,6 +1,7 @@
-/**\r
- * \r
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
  */\r
+\r
 package com.itmill.toolkit.demo.featurebrowser;\r
 \r
 import java.net.URL;\r
@@ -37,19 +38,19 @@ public class WindowingExample extends CustomComponent {
     private URL windowUrl = null;\r
 \r
     public WindowingExample() {\r
-        OrderedLayout main = new OrderedLayout();\r
+        final OrderedLayout main = new OrderedLayout();\r
         main.setMargin(true);\r
         setCompositionRoot(main);\r
 \r
-        Label l = new Label(txt);\r
+        final Label l = new Label(txt);\r
         l.setContentMode(Label.CONTENT_XHTML);\r
         main.addComponent(l);\r
 \r
         main.addComponent(new Button("Create a new subwindow",\r
                 new Button.ClickListener() {\r
                     public void buttonClick(ClickEvent event) {\r
-                        Window w = new Window("Subwindow");\r
-                        Label l = new Label(txt);\r
+                        final Window w = new Window("Subwindow");\r
+                        final Label l = new Label(txt);\r
                         l.setContentMode(Label.CONTENT_XHTML);\r
                         w.addComponent(l);\r
                         getApplication().getMainWindow().addWindow(w);\r
@@ -58,9 +59,9 @@ public class WindowingExample extends CustomComponent {
         main.addComponent(new Button("Create a new modal window",\r
                 new Button.ClickListener() {\r
                     public void buttonClick(ClickEvent event) {\r
-                        Window w = new Window("Modal window");\r
+                        final Window w = new Window("Modal window");\r
                         w.setModal(true);\r
-                        Label l = new Label(txt);\r
+                        final Label l = new Label(txt);\r
                         l.setContentMode(Label.CONTENT_XHTML);\r
                         w.addComponent(l);\r
                         getApplication().getMainWindow().addWindow(w);\r
@@ -71,8 +72,8 @@ public class WindowingExample extends CustomComponent {
                 new Button.ClickListener() {\r
                     public void buttonClick(ClickEvent event) {\r
                         if (windowUrl == null) {\r
-                            Window w = new Window("Subwindow");\r
-                            Label l = new Label(txt);\r
+                            final Window w = new Window("Subwindow");\r
+                            final Label l = new Label(txt);\r
                             l.setContentMode(Label.CONTENT_XHTML);\r
                             w.addComponent(l);\r
                             getApplication().addWindow(w);\r
@@ -86,10 +87,11 @@ public class WindowingExample extends CustomComponent {
                 "Create a new application-level window, with it's own state",\r
                 new Button.ClickListener() {\r
                     public void buttonClick(ClickEvent event) {\r
-                        Window w = new Window("Subwindow");\r
+                        final Window w = new Window("Subwindow");\r
                         getApplication().addWindow(w);\r
-                        Label l = new Label("Each opened window has its own"\r
-                                + " name, and is accessed trough its own uri.");\r
+                        final Label l = new Label(\r
+                                "Each opened window has its own"\r
+                                        + " name, and is accessed trough its own uri.");\r
                         l.setCaption("Window " + w.getName());\r
                         w.addComponent(l);\r
                         getApplication().getMainWindow().open(\r
index bbe5ef877824d8ce197d2a9434d1f81cdf6ee498..4a2be6c878d81934dc0de72e828738edb396d43a 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo.reservation;
 
 import java.sql.SQLException;
@@ -35,7 +39,7 @@ public class CalendarDemo extends com.itmill.toolkit.Application {
      * Initialize Application. Demo components are added to main window.
      */
     public void init() {
-        Window main = new Window("Calendar demo");
+        final Window main = new Window("Calendar demo");
         setMainWindow(main);
 
         main.setLayout(new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL));
@@ -54,8 +58,8 @@ public class CalendarDemo extends com.itmill.toolkit.Application {
 
         from.addListener(new ValueChangeListener() {
             public void valueChange(ValueChangeEvent event) {
-                Date fd = (Date) from.getValue();
-                Date td = (Date) to.getValue();
+                final Date fd = (Date) from.getValue();
+                final Date td = (Date) to.getValue();
                 if (fd == null) {
                     to.setValue(null);
                     to.setEnabled(false);
@@ -85,12 +89,12 @@ public class CalendarDemo extends com.itmill.toolkit.Application {
      */
     private void initCalendars() {
         try {
-            QueryContainer qc = new QueryContainer("SELECT * FROM "
+            final QueryContainer qc = new QueryContainer("SELECT * FROM "
                     + SampleCalendarDatabase.DB_TABLE_NAME, sampleDatabase
                     .getConnection());
             from.setContainerDataSource(qc);
             to.setContainerDataSource(qc);
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             e.printStackTrace();
         }
         /*
index a746685c4f03bcc4ae3f2c6d5d1d7dc531e3232d..565d78a97b20e1b96d6ee391bd953a9d7869535f 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.reservation;\r
 \r
 import java.util.Collection;\r
@@ -118,19 +122,19 @@ public class CalendarField extends DateField implements Container.Viewer {
 \r
         // Check old propertyIds\r
         if (itemEndPropertyId != null) {\r
-            Class c = dataSource.getType(itemEndPropertyId);\r
+            final Class c = dataSource.getType(itemEndPropertyId);\r
             if (!Date.class.isAssignableFrom(c)) {\r
                 itemEndPropertyId = null;\r
             }\r
         }\r
         if (itemNotimePropertyId != null) {\r
-            Class c = dataSource.getType(itemNotimePropertyId);\r
+            final Class c = dataSource.getType(itemNotimePropertyId);\r
             if (!Boolean.class.isAssignableFrom(c)) {\r
                 itemNotimePropertyId = null;\r
             }\r
         }\r
         if (itemStartPropertyId != null) {\r
-            Class c = dataSource.getType(itemStartPropertyId);\r
+            final Class c = dataSource.getType(itemStartPropertyId);\r
             if (Date.class.isAssignableFrom(c)) {\r
                 // All we _really_ need is one date\r
                 return true;\r
@@ -139,10 +143,10 @@ public class CalendarField extends DateField implements Container.Viewer {
             }\r
         }\r
         // We need at least one Date\r
-        Collection ids = dataSource.getContainerPropertyIds();\r
-        for (Iterator it = ids.iterator(); it.hasNext();) {\r
-            Object id = it.next();\r
-            Class c = dataSource.getType(id);\r
+        final Collection ids = dataSource.getContainerPropertyIds();\r
+        for (final Iterator it = ids.iterator(); it.hasNext();) {\r
+            final Object id = it.next();\r
+            final Class c = dataSource.getType(id);\r
             if (Date.class.isAssignableFrom(c)) {\r
                 itemStartPropertyId = id;\r
                 return true;\r
@@ -242,14 +246,15 @@ public class CalendarField extends DateField implements Container.Viewer {
 \r
             // TODO send one month now, the rest via lazyloading\r
             int month = new Date().getMonth();\r
-            Object value = getValue();\r
+            final Object value = getValue();\r
             if (value != null && value instanceof Date) {\r
                 month = ((Date) value).getMonth();\r
             }\r
 \r
-            for (Iterator it = dataSource.getItemIds().iterator(); it.hasNext();) {\r
-                Object itemId = it.next();\r
-                Item item = dataSource.getItem(itemId);\r
+            for (final Iterator it = dataSource.getItemIds().iterator(); it\r
+                    .hasNext();) {\r
+                final Object itemId = it.next();\r
+                final Item item = dataSource.getItem(itemId);\r
                 Property p = item.getItemProperty(itemStartPropertyId);\r
                 Date start = (Date) p.getValue();\r
                 Date end = start; // assume same day\r
@@ -259,7 +264,7 @@ public class CalendarField extends DateField implements Container.Viewer {
                     if (end == null) {\r
                         end = start;\r
                     } else if (end.before(start)) {\r
-                        Date tmp = start;\r
+                        final Date tmp = start;\r
                         start = end;\r
                         end = tmp;\r
                     }\r
@@ -274,7 +279,7 @@ public class CalendarField extends DateField implements Container.Viewer {
                         target.addAttribute("id", itemId.hashCode());\r
                         if (itemStyleNamePropertyId != null) {\r
                             p = item.getItemProperty(itemStyleNamePropertyId);\r
-                            String styleName = (String) p.getValue();\r
+                            final String styleName = (String) p.getValue();\r
                             target.addAttribute("styleName", styleName);\r
                         }\r
                         target.addAttribute("start", "" + start.getTime());\r
@@ -283,14 +288,14 @@ public class CalendarField extends DateField implements Container.Viewer {
                         }\r
                         if (itemTitlePropertyId != null) {\r
                             p = item.getItemProperty(itemTitlePropertyId);\r
-                            Object val = p.getValue();\r
+                            final Object val = p.getValue();\r
                             if (val != null) {\r
                                 target.addAttribute("title", val.toString());\r
                             }\r
                         }\r
                         if (itemDescriptionPropertyId != null) {\r
                             p = item.getItemProperty(itemDescriptionPropertyId);\r
-                            Object val = p.getValue();\r
+                            final Object val = p.getValue();\r
                             if (val != null) {\r
                                 target.addAttribute("description", val\r
                                         .toString());\r
@@ -298,7 +303,7 @@ public class CalendarField extends DateField implements Container.Viewer {
                         }\r
                         if (itemNotimePropertyId != null) {\r
                             p = item.getItemProperty(itemNotimePropertyId);\r
-                            Object val = p.getValue();\r
+                            final Object val = p.getValue();\r
                             if (val != null) {\r
                                 target.addAttribute("notime", ((Boolean) val)\r
                                         .booleanValue());\r
index 5355b9eea32673ef68e059a9c067315cc916bf48..b2a20bdae57ca2c7be97db7e16d44de08bcf466f 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.reservation;\r
 \r
 import java.awt.geom.Point2D;\r
@@ -15,8 +19,8 @@ import com.itmill.toolkit.ui.AbstractComponent;
 \r
 public class GoogleMap extends AbstractComponent implements Sizeable,\r
         Container.Viewer {\r
-    private String TAG_MARKERS = "markers";\r
-    private String TAG_MARKER = "marker";\r
+    private final String TAG_MARKERS = "markers";\r
+    private final String TAG_MARKER = "marker";\r
     private int width = 400;\r
     private int height = 300;\r
     private int zoomLevel = 15;\r
@@ -43,14 +47,14 @@ public class GoogleMap extends AbstractComponent implements Sizeable,
 \r
         if (dataSource != null) {\r
             target.startTag(TAG_MARKERS);\r
-            Collection itemIds = dataSource.getItemIds();\r
-            for (Iterator it = itemIds.iterator(); it.hasNext();) {\r
-                Object itemId = it.next();\r
-                Item item = dataSource.getItem(itemId);\r
+            final Collection itemIds = dataSource.getItemIds();\r
+            for (final Iterator it = itemIds.iterator(); it.hasNext();) {\r
+                final Object itemId = it.next();\r
+                final Item item = dataSource.getItem(itemId);\r
                 Property p = item.getItemProperty(getItemMarkerXPropertyId());\r
-                Double x = (Double) (p != null ? p.getValue() : null);\r
+                final Double x = (Double) (p != null ? p.getValue() : null);\r
                 p = item.getItemProperty(getItemMarkerYPropertyId());\r
-                Double y = (Double) (p != null ? p.getValue() : null);\r
+                final Double y = (Double) (p != null ? p.getValue() : null);\r
                 if (x == null || y == null) {\r
                     continue;\r
                 }\r
@@ -58,7 +62,7 @@ public class GoogleMap extends AbstractComponent implements Sizeable,
                 target.addAttribute("x", x.doubleValue());\r
                 target.addAttribute("y", y.doubleValue());\r
                 p = item.getItemProperty(getItemMarkerHtmlPropertyId());\r
-                String h = (String) (p != null ? p.getValue() : null);\r
+                final String h = (String) (p != null ? p.getValue() : null);\r
                 target.addAttribute("html", h);\r
                 target.endTag(TAG_MARKER);\r
             }\r
@@ -170,11 +174,11 @@ public class GoogleMap extends AbstractComponent implements Sizeable,
         if (dataSource == null) {\r
             initDataSource();\r
         }\r
-        Object markerId = dataSource.addItem();\r
+        final Object markerId = dataSource.addItem();\r
         if (markerId == null) {\r
             return null;\r
         }\r
-        Item marker = dataSource.getItem(markerId);\r
+        final Item marker = dataSource.getItem(markerId);\r
         Property p = marker.getItemProperty(getItemMarkerXPropertyId());\r
         p.setValue(new Double(location.x));\r
         p = marker.getItemProperty(getItemMarkerYPropertyId());\r
index c95ca3857cbdceda0e355b124a281013839bea93..130768aa7f41117d8ddad0c3bad4592bad1e737f 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.reservation;\r
 \r
 import java.awt.geom.Point2D;\r
@@ -59,14 +63,14 @@ public class ReservationApplication extends Application {
         db.generateDemoUser();\r
         db.generateReservations();\r
 \r
-        Window mainWindow = new Window("Reservr");\r
+        final Window mainWindow = new Window("Reservr");\r
         setMainWindow(mainWindow);\r
         setTheme("reservr");\r
 \r
-        TabSheet mainTabs = new TabSheet();\r
+        final TabSheet mainTabs = new TabSheet();\r
         mainWindow.addComponent(mainTabs);\r
 \r
-        OrderedLayout reservationTab = new OrderedLayout();\r
+        final OrderedLayout reservationTab = new OrderedLayout();\r
         mainTabs.addTab(reservationTab, "Make reservation", null);\r
 \r
         resourcePanel = new ResourceSelectorPanel("Resources");\r
@@ -76,13 +80,13 @@ public class ReservationApplication extends Application {
                 this, "selectedResourcesChanged");\r
         reservationTab.addComponent(resourcePanel);\r
 \r
-        Panel reservationPanel = new Panel("Reservation", new OrderedLayout(\r
-                OrderedLayout.ORIENTATION_HORIZONTAL));\r
+        final Panel reservationPanel = new Panel("Reservation",\r
+                new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL));\r
         reservationPanel.addStyleName(Panel.STYLE_LIGHT);\r
         reservationPanel.getLayout().setMargin(true);\r
         reservationTab.addComponent(reservationPanel);\r
 \r
-        OrderedLayout infoLayout = new OrderedLayout();\r
+        final OrderedLayout infoLayout = new OrderedLayout();\r
         infoLayout.setMargin(false, true, false, false);\r
         reservationPanel.addComponent(infoLayout);\r
         resourceName = new Label("From the list above");\r
@@ -107,7 +111,7 @@ public class ReservationApplication extends Application {
         map.setContainerDataSource(db.getResources(null));\r
         infoLayout.addComponent(map);\r
 \r
-        Calendar from = Calendar.getInstance();\r
+        final Calendar from = Calendar.getInstance();\r
         from.add(Calendar.HOUR, 1);\r
         from.set(Calendar.MINUTE, 0);\r
         from.set(Calendar.SECOND, 0);\r
@@ -119,12 +123,12 @@ public class ReservationApplication extends Application {
         initCalendarFieldPropertyIds(reservedFrom);\r
         reservationPanel.addComponent(reservedFrom);\r
 \r
-        Label arrowLabel = new Label("&raquo;");\r
+        final Label arrowLabel = new Label("&raquo;");\r
         arrowLabel.setContentMode(Label.CONTENT_XHTML);\r
         arrowLabel.setStyleName("arrow");\r
         reservationPanel.addComponent(arrowLabel);\r
 \r
-        Calendar to = Calendar.getInstance();\r
+        final Calendar to = Calendar.getInstance();\r
         to.setTime(from.getTime());\r
         to.add(Calendar.MILLISECOND, (int) DEFAULT_GAP_MILLIS);\r
         reservedTo = new CalendarField("To");\r
@@ -136,7 +140,7 @@ public class ReservationApplication extends Application {
 \r
         reservedFrom.addListener(new ValueChangeListener() {\r
             public void valueChange(ValueChangeEvent event) {\r
-                Date fd = (Date) reservedFrom.getValue();\r
+                final Date fd = (Date) reservedFrom.getValue();\r
                 if (fd == null) {\r
                     reservedTo.setValue(null);\r
                     reservedTo.setEnabled(false);\r
@@ -147,7 +151,7 @@ public class ReservationApplication extends Application {
                 }\r
                 reservedTo.setMinimumDate(new Date(fd.getTime()\r
                         + DEFAULT_GAP_MILLIS));\r
-                Calendar to = Calendar.getInstance();\r
+                final Calendar to = Calendar.getInstance();\r
                 to.setTime(fd);\r
                 to.add(Calendar.MILLISECOND, (int) currentGapMillis);\r
                 reservedTo.setValue(to.getTime());\r
@@ -156,11 +160,11 @@ public class ReservationApplication extends Application {
         });\r
         reservedTo.addListener(new ValueChangeListener() {\r
             public void valueChange(ValueChangeEvent event) {\r
-                Date from = (Date) reservedFrom.getValue();\r
-                Date to = (Date) reservedTo.getValue();\r
+                final Date from = (Date) reservedFrom.getValue();\r
+                final Date to = (Date) reservedTo.getValue();\r
                 currentGapMillis = to.getTime() - from.getTime();\r
                 if (currentGapMillis <= 0) {\r
-                    Calendar t = Calendar.getInstance();\r
+                    final Calendar t = Calendar.getInstance();\r
                     t.setTime(from);\r
                     t.add(Calendar.MILLISECOND, (int) DEFAULT_GAP_MILLIS);\r
                     reservedTo.setValue(t.getTime());\r
@@ -169,7 +173,7 @@ public class ReservationApplication extends Application {
             }\r
         });\r
 \r
-        OrderedLayout allLayout = new OrderedLayout(\r
+        final OrderedLayout allLayout = new OrderedLayout(\r
                 OrderedLayout.ORIENTATION_HORIZONTAL);\r
         allLayout.addStyleName(Panel.STYLE_LIGHT);\r
         allLayout.setMargin(true);\r
@@ -193,7 +197,7 @@ public class ReservationApplication extends Application {
 \r
     public void makeReservation() {\r
         try {\r
-            Item resource = getActiveResource();\r
+            final Item resource = getActiveResource();\r
             if (resource != null) {\r
                 db.addReservation(resource, 0, (Date) reservedFrom.getValue(),\r
                         (Date) reservedTo.getValue(), (String) description\r
@@ -209,7 +213,7 @@ public class ReservationApplication extends Application {
                         "Please select a resource (or category) to reserve.",\r
                         Notification.TYPE_WARNING_MESSAGE);\r
             }\r
-        } catch (ResourceNotAvailableException e) {\r
+        } catch (final ResourceNotAvailableException e) {\r
             getMainWindow()\r
                     .showNotification(\r
                             "Not available!",\r
@@ -220,11 +224,11 @@ public class ReservationApplication extends Application {
     }\r
 \r
     private Item getActiveResource() throws ResourceNotAvailableException {\r
-        List rids = resourcePanel.getSelectedResources();\r
+        final List rids = resourcePanel.getSelectedResources();\r
         if (rids != null && rids.size() > 0) {\r
-            for (Iterator it = rids.iterator(); it.hasNext();) {\r
-                Item resource = (Item) it.next();\r
-                int id = ((Integer) resource.getItemProperty(\r
+            for (final Iterator it = rids.iterator(); it.hasNext();) {\r
+                final Item resource = (Item) it.next();\r
+                final int id = ((Integer) resource.getItemProperty(\r
                         SampleDB.Resource.PROPERTY_ID_ID).getValue())\r
                         .intValue();\r
                 if (db.isAvailableResource(id, (Date) reservedFrom.getValue(),\r
@@ -239,14 +243,14 @@ public class ReservationApplication extends Application {
     }\r
 \r
     private void refreshReservations(boolean alsoResources) {\r
-        Container reservations = db.getReservations(resourcePanel\r
+        final Container reservations = db.getReservations(resourcePanel\r
                 .getSelectedResources());\r
         reservedFrom.setContainerDataSource(reservations);\r
         reservedTo.setContainerDataSource(reservations);\r
         if (alsoResources) {\r
             refreshSelectedResources();\r
         }\r
-        Container allReservations = db.getReservations(null);\r
+        final Container allReservations = db.getReservations(null);\r
         allTable.setContainerDataSource(allReservations);\r
         if (allReservations != null && allReservations.size() > 0) {\r
             allTable.setVisibleColumns(new Object[] {\r
@@ -264,7 +268,7 @@ public class ReservationApplication extends Application {
         Item resource = null;\r
         try {\r
             resource = getActiveResource();\r
-        } catch (ResourceNotAvailableException e) {\r
+        } catch (final ResourceNotAvailableException e) {\r
             getMainWindow().showNotification("Not available",\r
                     "Please choose another resource or time period.",\r
                     Notification.TYPE_HUMANIZED_MESSAGE);\r
@@ -287,16 +291,16 @@ public class ReservationApplication extends Application {
             resourceName.setCaption(name);\r
             resourceName.setValue(desc);\r
             // Put all resources on map (may be many if category was selected)\r
-            LinkedList srs = resourcePanel.getSelectedResources();\r
-            for (Iterator it = srs.iterator(); it.hasNext();) {\r
+            final LinkedList srs = resourcePanel.getSelectedResources();\r
+            for (final Iterator it = srs.iterator(); it.hasNext();) {\r
                 resource = (Item) it.next();\r
                 name = (String) resource.getItemProperty(\r
                         SampleDB.Resource.PROPERTY_ID_NAME).getValue();\r
                 desc = (String) resource.getItemProperty(\r
                         SampleDB.Resource.PROPERTY_ID_DESCRIPTION).getValue();\r
-                Double x = (Double) resource.getItemProperty(\r
+                final Double x = (Double) resource.getItemProperty(\r
                         SampleDB.Resource.PROPERTY_ID_LOCATIONX).getValue();\r
-                Double y = (Double) resource.getItemProperty(\r
+                final Double y = (Double) resource.getItemProperty(\r
                         SampleDB.Resource.PROPERTY_ID_LOCATIONY).getValue();\r
                 if (x != null && y != null) {\r
                     map.addMarker(name + "<br/>" + desc, new Point2D.Double(x\r
index 673d6e91908a5f5b9ed91f6dfc9453aa4641c91a..4ae388d0e42ac2c37b017ee3250aa439ff9c0be1 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.reservation;\r
 \r
 public class ResourceNotAvailableException extends Exception {\r
index a34bdd66ad9c42eb6430717cccd3b1129154099e..8d0efd881d40b945630bd2d5eba652410ba6b8ec 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.reservation;\r
 \r
 import java.util.HashMap;\r
@@ -14,8 +18,8 @@ import com.itmill.toolkit.ui.Button.ClickEvent;
 \r
 public class ResourceSelectorPanel extends Panel implements\r
         Button.ClickListener {\r
-    private HashMap categoryLayouts = new HashMap();\r
-    private HashMap categoryResources = new HashMap();\r
+    private final HashMap categoryLayouts = new HashMap();\r
+    private final HashMap categoryResources = new HashMap();\r
 \r
     private Container allResources;\r
     private LinkedList selectedResources = null;\r
@@ -30,17 +34,18 @@ public class ResourceSelectorPanel extends Panel implements
         categoryLayouts.clear();\r
         categoryResources.clear();\r
         if (resources != null && resources.size() > 0) {\r
-            for (Iterator it = resources.getItemIds().iterator(); it.hasNext();) {\r
-                Item resource = resources.getItem(it.next());\r
-                Integer id = (Integer) resource.getItemProperty(\r
+            for (final Iterator it = resources.getItemIds().iterator(); it\r
+                    .hasNext();) {\r
+                final Item resource = resources.getItem(it.next());\r
+                final Integer id = (Integer) resource.getItemProperty(\r
                         SampleDB.Resource.PROPERTY_ID_ID).getValue();\r
-                String category = (String) resource.getItemProperty(\r
+                final String category = (String) resource.getItemProperty(\r
                         SampleDB.Resource.PROPERTY_ID_CATEGORY).getValue();\r
-                String name = (String) resource.getItemProperty(\r
+                final String name = (String) resource.getItemProperty(\r
                         SampleDB.Resource.PROPERTY_ID_NAME).getValue();\r
-                String description = (String) resource.getItemProperty(\r
+                final String description = (String) resource.getItemProperty(\r
                         SampleDB.Resource.PROPERTY_ID_DESCRIPTION).getValue();\r
-                Button rButton = new Button(name, this);\r
+                final Button rButton = new Button(name, this);\r
                 rButton.setStyleName("link");\r
                 rButton.setDescription(description);\r
                 rButton.setData(resource);\r
@@ -54,7 +59,7 @@ public class ResourceSelectorPanel extends Panel implements
                     categoryLayouts.put(category, resourceLayout);\r
                     resourceList = new LinkedList();\r
                     categoryResources.put(category, resourceList);\r
-                    Button cButton = new Button(category + " (any)", this);\r
+                    final Button cButton = new Button(category + " (any)", this);\r
                     cButton.setStyleName("important-link");\r
                     cButton.setData(category);\r
                     resourceLayout.addComponent(cButton);\r
@@ -68,13 +73,13 @@ public class ResourceSelectorPanel extends Panel implements
     // Selects one initial categore, inpractice randomly\r
     public void selectFirstCategory() {\r
         try {\r
-            Object catId = categoryResources.keySet().iterator().next();\r
-            LinkedList res = (LinkedList) categoryResources.get(catId);\r
-            Layout l = (Layout) categoryLayouts.get(catId);\r
-            Button catB = (Button) l.getComponentIterator().next();\r
+            final Object catId = categoryResources.keySet().iterator().next();\r
+            final LinkedList res = (LinkedList) categoryResources.get(catId);\r
+            final Layout l = (Layout) categoryLayouts.get(catId);\r
+            final Button catB = (Button) l.getComponentIterator().next();\r
             setSelectedResources(res);\r
             catB.setStyleName("selected-link");\r
-        } catch (Exception e) {\r
+        } catch (final Exception e) {\r
             e.printStackTrace(System.err);\r
         }\r
     }\r
@@ -89,18 +94,18 @@ public class ResourceSelectorPanel extends Panel implements
     }\r
 \r
     public void buttonClick(ClickEvent event) {\r
-        Object source = event.getSource();\r
+        final Object source = event.getSource();\r
         if (source instanceof Button) {\r
-            Object data = ((Button) source).getData();\r
-            String name = ((Button) source).getCaption();\r
+            final Object data = ((Button) source).getData();\r
+            final String name = ((Button) source).getCaption();\r
             resetStyles();\r
             if (data instanceof Item) {\r
-                LinkedList rlist = new LinkedList();\r
+                final LinkedList rlist = new LinkedList();\r
                 rlist.add(data);\r
                 setSelectedResources(rlist);\r
             } else {\r
-                String category = (String) data;\r
-                LinkedList resources = (LinkedList) categoryResources\r
+                final String category = (String) data;\r
+                final LinkedList resources = (LinkedList) categoryResources\r
                         .get(category);\r
                 setSelectedResources(resources);\r
             }\r
@@ -110,10 +115,11 @@ public class ResourceSelectorPanel extends Panel implements
     }\r
 \r
     private void resetStyles() {\r
-        for (Iterator it = categoryLayouts.values().iterator(); it.hasNext();) {\r
-            Layout lo = (Layout) it.next();\r
-            for (Iterator bit = lo.getComponentIterator(); bit.hasNext();) {\r
-                Button b = (Button) bit.next();\r
+        for (final Iterator it = categoryLayouts.values().iterator(); it\r
+                .hasNext();) {\r
+            final Layout lo = (Layout) it.next();\r
+            for (final Iterator bit = lo.getComponentIterator(); bit.hasNext();) {\r
+                final Button b = (Button) bit.next();\r
                 if (b.getData() instanceof Item) {\r
                     b.setStyleName("link");\r
                 } else {\r
index 05741f63fb3b67bfec34c76ed8f9cb96d5efcef5..0f3163c147c457f56eb278e7649a6bddfadbea1a 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo.reservation;
 
 import java.sql.Connection;
@@ -118,17 +122,17 @@ public class SampleDB {
     private void dropTables() {
         try {
             update("DROP TABLE " + Reservation.TABLE);
-        } catch (SQLException IGNORED) {
+        } catch (final SQLException IGNORED) {
             // IGNORED, assuming it was not there
         }
         try {
             update("DROP TABLE " + Resource.TABLE);
-        } catch (SQLException IGNORED) {
+        } catch (final SQLException IGNORED) {
             // IGNORED, assuming it was not there
         }
         try {
             update("DROP TABLE " + User.TABLE);
-        } catch (SQLException IGNORED) {
+        } catch (final SQLException IGNORED) {
             // IGNORED, assuming it was not there
         }
     }
@@ -142,7 +146,7 @@ public class SampleDB {
         try {
             Class.forName("org.hsqldb.jdbcDriver").newInstance();
             connection = DriverManager.getConnection(DB_URL);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new RuntimeException(e);
         }
     }
@@ -156,7 +160,7 @@ public class SampleDB {
     private void update(String expression) throws SQLException {
         Statement st = null;
         st = connection.createStatement();
-        int i = st.executeUpdate(expression);
+        final int i = st.executeUpdate(expression);
         if (i == -1) {
             System.out.println("SampleDatabase error : " + expression);
         }
@@ -173,7 +177,7 @@ public class SampleDB {
             String stmt = null;
             stmt = CREATE_TABLE_RESOURCE;
             update(stmt);
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             if (e.toString().indexOf("Table already exists") == -1) {
                 throw new RuntimeException(e);
             }
@@ -182,7 +186,7 @@ public class SampleDB {
             String stmt = null;
             stmt = CREATE_TABLE_USER;
             update(stmt);
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             if (e.toString().indexOf("Table already exists") == -1) {
                 throw new RuntimeException(e);
             }
@@ -191,7 +195,7 @@ public class SampleDB {
             String stmt = null;
             stmt = CREATE_TABLE_RESERVATION;
             update(stmt);
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             if (e.toString().indexOf("Table already exists") == -1) {
                 throw new RuntimeException(e);
             }
@@ -205,15 +209,15 @@ public class SampleDB {
     private String testDatabase() {
         String result = null;
         try {
-            Statement stmt = connection.createStatement(
+            final Statement stmt = connection.createStatement(
                     ResultSet.TYPE_SCROLL_INSENSITIVE,
                     ResultSet.CONCUR_UPDATABLE);
-            ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM "
+            final ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM "
                     + Resource.TABLE);
             rs.next();
             result = "rowcount for table test is " + rs.getObject(1).toString();
             stmt.close();
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             throw new RuntimeException(e);
         }
         return result;
@@ -225,14 +229,14 @@ public class SampleDB {
 
     public Container getCategories() {
         // TODO where deleted=?
-        String q = "SELECT DISTINCT(" + Resource.PROPERTY_ID_CATEGORY
+        final String q = "SELECT DISTINCT(" + Resource.PROPERTY_ID_CATEGORY
                 + ") FROM " + Resource.TABLE + " ORDER BY "
                 + Resource.PROPERTY_ID_CATEGORY;
         try {
             return new QueryContainer(q, connection,
                     ResultSet.TYPE_SCROLL_INSENSITIVE,
                     ResultSet.CONCUR_READ_ONLY);
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             throw new RuntimeException(e);
         }
 
@@ -251,7 +255,7 @@ public class SampleDB {
             return new QueryContainer(q, connection,
                     ResultSet.TYPE_SCROLL_INSENSITIVE,
                     ResultSet.CONCUR_READ_ONLY);
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             throw new RuntimeException(e);
         }
 
@@ -266,8 +270,8 @@ public class SampleDB {
         q += " WHERE " + Reservation.PROPERTY_ID_RESOURCE_ID + "="
                 + Resource.PROPERTY_ID_ID;
         if (resources != null && resources.size() > 0) {
-            StringBuffer s = new StringBuffer();
-            for (Iterator it = resources.iterator(); it.hasNext();) {
+            final StringBuffer s = new StringBuffer();
+            for (final Iterator it = resources.iterator(); it.hasNext();) {
                 if (s.length() > 0) {
                     s.append(",");
                 }
@@ -279,7 +283,7 @@ public class SampleDB {
         }
         q += " ORDER BY " + Reservation.PROPERTY_ID_RESERVED_FROM;
         try {
-            QueryContainer qc = new QueryContainer(q, connection,
+            final QueryContainer qc = new QueryContainer(q, connection,
                     ResultSet.TYPE_SCROLL_INSENSITIVE,
                     ResultSet.CONCUR_READ_ONLY);
             if (qc.size() < 1) {
@@ -287,7 +291,7 @@ public class SampleDB {
             } else {
                 return qc;
             }
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             throw new RuntimeException(e);
         }
     }
@@ -295,13 +299,13 @@ public class SampleDB {
     public void addReservation(Item resource, int reservedById,
             Date reservedFrom, Date reservedTo, String description) {
         if (reservedFrom.after(reservedTo)) {
-            Date tmp = reservedTo;
+            final Date tmp = reservedTo;
             reservedTo = reservedFrom;
             reservedFrom = tmp;
         }
-        int resourceId = ((Integer) resource.getItemProperty(
+        final int resourceId = ((Integer) resource.getItemProperty(
                 Resource.PROPERTY_ID_ID).getValue()).intValue();
-        String q = "INSERT INTO " + Reservation.TABLE + " ("
+        final String q = "INSERT INTO " + Reservation.TABLE + " ("
                 + Reservation.PROPERTY_ID_RESOURCE_ID + ","
                 + Reservation.PROPERTY_ID_RESERVED_BY_ID + ","
                 + Reservation.PROPERTY_ID_RESERVED_FROM + ","
@@ -314,7 +318,7 @@ public class SampleDB {
                     throw new ResourceNotAvailableException(
                             "The resource is not available at that time.");
                 }
-                PreparedStatement p = connection.prepareStatement(q);
+                final PreparedStatement p = connection.prepareStatement(q);
                 p.setInt(1, resourceId);
                 p.setInt(2, reservedById);
                 p.setTimestamp(3,
@@ -322,7 +326,7 @@ public class SampleDB {
                 p.setTimestamp(4, new java.sql.Timestamp(reservedTo.getTime()));
                 p.setString(5, description);
                 p.execute();
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new RuntimeException(e);
             }
         }
@@ -332,12 +336,12 @@ public class SampleDB {
             Date reservedTo) {
         // TODO where deleted=?
         if (reservedFrom.after(reservedTo)) {
-            Date tmp = reservedTo;
+            final Date tmp = reservedTo;
             reservedTo = reservedFrom;
             reservedFrom = tmp;
         }
-        String checkQ = "SELECT count(*) FROM " + Reservation.TABLE + " WHERE "
-                + Reservation.PROPERTY_ID_RESOURCE_ID + "=? AND (("
+        final String checkQ = "SELECT count(*) FROM " + Reservation.TABLE
+                + " WHERE " + Reservation.PROPERTY_ID_RESOURCE_ID + "=? AND (("
                 + Reservation.PROPERTY_ID_RESERVED_FROM + ">=? AND "
                 + Reservation.PROPERTY_ID_RESERVED_FROM + "<?) OR ("
                 + Reservation.PROPERTY_ID_RESERVED_TO + ">? AND "
@@ -345,7 +349,7 @@ public class SampleDB {
                 + Reservation.PROPERTY_ID_RESERVED_FROM + "<=? AND "
                 + Reservation.PROPERTY_ID_RESERVED_TO + ">=?)" + ")";
         try {
-            PreparedStatement p = connection.prepareStatement(checkQ);
+            final PreparedStatement p = connection.prepareStatement(checkQ);
             p.setInt(1, resourceId);
             p.setTimestamp(2, new java.sql.Timestamp(reservedFrom.getTime()));
             p.setTimestamp(3, new java.sql.Timestamp(reservedTo.getTime()));
@@ -354,11 +358,11 @@ public class SampleDB {
             p.setTimestamp(6, new java.sql.Timestamp(reservedFrom.getTime()));
             p.setTimestamp(7, new java.sql.Timestamp(reservedTo.getTime()));
             p.execute();
-            ResultSet rs = p.getResultSet();
+            final ResultSet rs = p.getResultSet();
             if (rs.next() && rs.getInt(1) > 0) {
                 return false;
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new RuntimeException(e);
         }
         return true;
@@ -366,50 +370,52 @@ public class SampleDB {
 
     public Container getUsers() {
         // TODO where deleted=?
-        String q = "SELECT * FROM " + User.TABLE + " ORDER BY "
+        final String q = "SELECT * FROM " + User.TABLE + " ORDER BY "
                 + User.PROPERTY_ID_FULLNAME;
         try {
-            QueryContainer qc = new QueryContainer(q, connection,
+            final QueryContainer qc = new QueryContainer(q, connection,
                     ResultSet.TYPE_SCROLL_INSENSITIVE,
                     ResultSet.CONCUR_READ_ONLY);
             return qc;
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             throw new RuntimeException(e);
         }
     }
 
     public void generateReservations() {
-        int days = 30;
-        String descriptions[] = { "Picking up guests from airport",
+        final int days = 30;
+        final String descriptions[] = { "Picking up guests from airport",
                 "Sightseeing with the guests",
                 "Moving new servers from A to B", "Shopping",
                 "Customer meeting", "Guests arriving at harbour",
                 "Moving furniture", "Taking guests to see town" };
-        Container cat = getCategories();
-        Collection cIds = cat.getItemIds();
-        for (Iterator it = cIds.iterator(); it.hasNext();) {
-            Object id = it.next();
-            Item ci = cat.getItem(id);
-            String c = (String) ci.getItemProperty(
+        final Container cat = getCategories();
+        final Collection cIds = cat.getItemIds();
+        for (final Iterator it = cIds.iterator(); it.hasNext();) {
+            final Object id = it.next();
+            final Item ci = cat.getItem(id);
+            final String c = (String) ci.getItemProperty(
                     Resource.PROPERTY_ID_CATEGORY).getValue();
-            Container resources = getResources(c);
-            Collection rIds = resources.getItemIds();
-            Calendar cal = Calendar.getInstance();
+            final Container resources = getResources(c);
+            final Collection rIds = resources.getItemIds();
+            final Calendar cal = Calendar.getInstance();
             cal.set(Calendar.MINUTE, 0);
             cal.set(Calendar.SECOND, 0);
             cal.set(Calendar.MILLISECOND, 0);
-            int hourNow = new Date().getHours();
+            final int hourNow = new Date().getHours();
             // cal.add(Calendar.DAY_OF_MONTH, -days);
             for (int i = 0; i < days; i++) {
                 int r = 3;
-                for (Iterator rit = rIds.iterator(); rit.hasNext() && r > 0; r--) {
-                    Object rid = rit.next();
-                    Item resource = resources.getItem(rid);
-                    int s = hourNow - 6 + (int) Math.round(Math.random() * 6.0);
-                    int e = s + 1 + (int) Math.round(Math.random() * 4.0);
-                    Date start = new Date(cal.getTimeInMillis());
+                for (final Iterator rit = rIds.iterator(); rit.hasNext()
+                        && r > 0; r--) {
+                    final Object rid = rit.next();
+                    final Item resource = resources.getItem(rid);
+                    final int s = hourNow - 6
+                            + (int) Math.round(Math.random() * 6.0);
+                    final int e = s + 1 + (int) Math.round(Math.random() * 4.0);
+                    final Date start = new Date(cal.getTimeInMillis());
                     start.setHours(s);
-                    Date end = new Date(cal.getTimeInMillis());
+                    final Date end = new Date(cal.getTimeInMillis());
                     end.setHours(e);
                     addReservation(resource, 0, start, end,
                             descriptions[(int) Math.floor(Math.random()
@@ -423,7 +429,7 @@ public class SampleDB {
 
     public void generateResources() {
 
-        Object[][] resources = {
+        final Object[][] resources = {
                 // Turku
                 { "01", "01 Ford Mondeo", "w/ company logo", "Turku",
                         new Double(60.510857), new Double(22.275424) },
@@ -500,7 +506,7 @@ public class SampleDB {
 
         };
 
-        String q = "INSERT INTO " + Resource.TABLE + "("
+        final String q = "INSERT INTO " + Resource.TABLE + "("
                 + Resource.PROPERTY_ID_STYLENAME + ","
                 + Resource.PROPERTY_ID_NAME + ","
                 + Resource.PROPERTY_ID_DESCRIPTION + ","
@@ -509,7 +515,7 @@ public class SampleDB {
                 + Resource.PROPERTY_ID_LOCATIONY + ")"
                 + " VALUES (?,?,?,?,?,?)";
         try {
-            PreparedStatement stmt = connection.prepareStatement(q);
+            final PreparedStatement stmt = connection.prepareStatement(q);
             for (int i = 0; i < resources.length; i++) {
                 int j = 0;
                 stmt.setString(j + 1, (String) resources[i][j++]);
@@ -522,22 +528,22 @@ public class SampleDB {
                         .doubleValue());
                 stmt.execute();
             }
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             throw new RuntimeException(e);
         }
     }
 
     public void generateDemoUser() {
-        String q = "INSERT INTO USER (" + User.PROPERTY_ID_FULLNAME + ","
+        final String q = "INSERT INTO USER (" + User.PROPERTY_ID_FULLNAME + ","
                 + User.PROPERTY_ID_EMAIL + "," + User.PROPERTY_ID_PASSWORD
                 + ") VALUES (?,?,?)";
         try {
-            PreparedStatement stmt = connection.prepareStatement(q);
+            final PreparedStatement stmt = connection.prepareStatement(q);
             stmt.setString(1, "Demo User");
             stmt.setString(2, "demo.user@itmill.com");
             stmt.setString(3, "demo");
             stmt.execute();
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             throw new RuntimeException(e);
         }
 
index e8333f3ea467a657f4447d08347ef9305edf2f8a..8171a0df232b095947be98bdffba5a5936f24eb4 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.reservation.gwt.client;\r
 \r
 import com.google.gwt.core.client.GWT;\r
@@ -9,7 +13,7 @@ import com.itmill.toolkit.terminal.gwt.client.UIDL;
 \r
 public class ReservationWidgetSet extends DefaultWidgetSet {\r
     public Widget createWidget(UIDL uidl) {\r
-        String className = resolveWidgetTypeName(uidl);\r
+        final String className = resolveWidgetTypeName(uidl);\r
         if ("com.itmill.toolkit.terminal.gwt.client.ui.IGoogleMap"\r
                 .equals(className)) {\r
             return new IGoogleMap();\r
@@ -23,7 +27,7 @@ public class ReservationWidgetSet extends DefaultWidgetSet {
 \r
     protected String resolveWidgetTypeName(UIDL uidl) {\r
 \r
-        String tag = uidl.getTag();\r
+        final String tag = uidl.getTag();\r
         if ("googlemap".equals(tag)) {\r
             return "com.itmill.toolkit.terminal.gwt.client.ui.IGoogleMap";\r
         } else if ("calendarfield".equals(tag)) {\r
index 735b773849527f1cd2990e9afcacdc438d544197..c6619acca9e06f5786be4aa76ecba2bf5bbf45c1 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.reservation.gwt.client.ui;\r
 \r
 import java.util.ArrayList;\r
@@ -21,15 +25,15 @@ import com.itmill.toolkit.terminal.gwt.client.ui.IDateField;
 \r
 public class ICalendarField extends IDateField {\r
 \r
-    private CalendarPanel calPanel;\r
+    private final CalendarPanel calPanel;\r
 \r
     private SimplePanel hourPanel;\r
 \r
     private FlexTable hourTable;\r
 \r
-    private EntrySource entrySource;\r
+    private final EntrySource entrySource;\r
 \r
-    private TableListener ftListener = new HourTableListener();\r
+    private final TableListener ftListener = new HourTableListener();\r
 \r
     private int realResolution = RESOLUTION_DAY;\r
 \r
@@ -57,20 +61,21 @@ public class ICalendarField extends IDateField {
         realResolution = currentResolution;\r
         currentResolution = RESOLUTION_DAY;\r
         if (uidl.hasAttribute("min")) {\r
-            String mins = uidl.getStringAttribute("min");\r
-            long min = (mins != null ? Long.parseLong(mins) : 0);\r
-            String maxs = uidl.getStringAttribute("max");\r
-            long max = (maxs != null ? Long.parseLong(maxs) : 0);\r
-            Date minDate = (min > 0 ? new Date(min) : null);\r
-            Date maxDate = (max > 0 ? new Date(max) : null);\r
+            final String mins = uidl.getStringAttribute("min");\r
+            final long min = (mins != null ? Long.parseLong(mins) : 0);\r
+            final String maxs = uidl.getStringAttribute("max");\r
+            final long max = (maxs != null ? Long.parseLong(maxs) : 0);\r
+            final Date minDate = (min > 0 ? new Date(min) : null);\r
+            final Date maxDate = (max > 0 ? new Date(max) : null);\r
             calPanel.setLimits(minDate, maxDate);\r
         }\r
         entrySource.clear();\r
-        for (Iterator cit = uidl.getChildIterator(); cit.hasNext();) {\r
-            UIDL child = (UIDL) cit.next();\r
+        for (final Iterator cit = uidl.getChildIterator(); cit.hasNext();) {\r
+            final UIDL child = (UIDL) cit.next();\r
             if (child.getTag().equals("items")) {\r
-                for (Iterator iit = child.getChildIterator(); iit.hasNext();) {\r
-                    UIDL item = (UIDL) iit.next();\r
+                for (final Iterator iit = child.getChildIterator(); iit\r
+                        .hasNext();) {\r
+                    final UIDL item = (UIDL) iit.next();\r
                     entrySource.addItem(item);\r
                 }\r
                 break;\r
@@ -107,7 +112,7 @@ public class ICalendarField extends IDateField {
                     CLASSNAME + "-row-" + style);\r
             String hstr = (i < 10 ? "0" : "") + i + ":00";\r
             if (dts.isTwelveHourClock()) {\r
-                String ampm = (i < 12 ? "am" : "pm");\r
+                final String ampm = (i < 12 ? "am" : "pm");\r
                 hstr = (i <= 12 ? i : i - 12) + ":00 " + ampm;\r
             }\r
             hourTable.setHTML(i, 0, "<span>" + hstr + "</span>");\r
@@ -115,11 +120,11 @@ public class ICalendarField extends IDateField {
                     .setStyleName(i, 0, CLASSNAME + "-time");\r
         }\r
 \r
-        List entries = entrySource.getEntries(date,\r
+        final List entries = entrySource.getEntries(date,\r
                 DateTimeService.RESOLUTION_DAY);\r
         int currentCol = 1;\r
-        for (Iterator it = entries.iterator(); it.hasNext();) {\r
-            CalendarEntry entry = (CalendarEntry) it.next();\r
+        for (final Iterator it = entries.iterator(); it.hasNext();) {\r
+            final CalendarEntry entry = (CalendarEntry) it.next();\r
             int start = 0;\r
             int hours = 24;\r
             if (!entry.isNotime()) {\r
@@ -147,19 +152,19 @@ public class ICalendarField extends IDateField {
             hourTable.getFlexCellFormatter().setRowSpan(start, col, hours);\r
             hourTable.getFlexCellFormatter().setStyleName(start, col,\r
                     CLASSNAME + "-entry");\r
-            String sn = entry.getStyleName();\r
+            final String sn = entry.getStyleName();\r
             if (sn != null && !sn.equals("")) {\r
                 hourTable.getFlexCellFormatter().addStyleName(start, col,\r
                         CLASSNAME + "-" + entry.getStyleName());\r
             }\r
-            Element el = hourTable.getFlexCellFormatter()\r
-                    .getElement(start, col);\r
+            final Element el = hourTable.getFlexCellFormatter().getElement(\r
+                    start, col);\r
 \r
             String tooltip;\r
             if (DateTimeService.isSameDay(entry.getStart(), entry.getEnd())) {\r
                 tooltip = (start < 10 ? "0" : "") + start + ":00";\r
                 if (dts.isTwelveHourClock()) {\r
-                    String ampm = (start < 12 ? "am" : "pm");\r
+                    final String ampm = (start < 12 ? "am" : "pm");\r
                     tooltip = (start <= 12 ? start : start - 12) + ":00 "\r
                             + ampm;\r
 \r
@@ -180,20 +185,20 @@ public class ICalendarField extends IDateField {
         }\r
 \r
         // int hour = new Date().getHours()+1; // scroll to current hour\r
-        int hour = this.date.getHours() + 1; // scroll to selected\r
+        final int hour = this.date.getHours() + 1; // scroll to selected\r
         // hour\r
-        int h1 = hourPanel.getOffsetHeight() / 2;\r
-        int oh = hourTable.getOffsetHeight();\r
-        int h2 = (int) (hour / 24.0 * oh);\r
-        int scrollTop = h2 - h1;\r
-        Element el = hourPanel.getElement();\r
+        final int h1 = hourPanel.getOffsetHeight() / 2;\r
+        final int oh = hourTable.getOffsetHeight();\r
+        final int h2 = (int) (hour / 24.0 * oh);\r
+        final int scrollTop = h2 - h1;\r
+        final Element el = hourPanel.getElement();\r
         setScrollTop(el, scrollTop);\r
 \r
     }\r
 \r
     private native void setScrollTop(Element el, int scrollTop) /*-{\r
-                       el.scrollTop = scrollTop;\r
-                     }-*/;\r
+                             el.scrollTop = scrollTop;\r
+                           }-*/;\r
 \r
     private class HourTableListener implements TableListener {\r
 \r
@@ -209,36 +214,37 @@ public class ICalendarField extends IDateField {
 \r
     private class EntrySource implements CalendarPanel.CalendarEntrySource {\r
 \r
-        private HashMap dates = new HashMap();\r
+        private final HashMap dates = new HashMap();\r
 \r
         public void addItem(UIDL item) {\r
-            String styleName = item.getStringAttribute("styleName");\r
-            Integer id = new Integer(item.getIntAttribute("id"));\r
-            long start = Long.parseLong(item.getStringAttribute("start"));\r
-            Date startDate = new Date(start);\r
+            final String styleName = item.getStringAttribute("styleName");\r
+            final Integer id = new Integer(item.getIntAttribute("id"));\r
+            final long start = Long.parseLong(item.getStringAttribute("start"));\r
+            final Date startDate = new Date(start);\r
             long end = -1;\r
             try {\r
                 end = Long.parseLong(item.getStringAttribute("end"));\r
-            } catch (Exception IGNORED) {\r
+            } catch (final Exception IGNORED) {\r
                 // IGNORED attribute not required\r
             }\r
-            Date endDate = (end > 0 && end != start ? new Date(end) : new Date(\r
-                    start));\r
-            String title = item.getStringAttribute("title");\r
-            String desc = item.getStringAttribute("description");\r
-            boolean notime = item.getBooleanAttribute("notime");\r
-            CalendarEntry entry = new CalendarEntry(styleName, startDate,\r
+            final Date endDate = (end > 0 && end != start ? new Date(end)\r
+                    : new Date(start));\r
+            final String title = item.getStringAttribute("title");\r
+            final String desc = item.getStringAttribute("description");\r
+            final boolean notime = item.getBooleanAttribute("notime");\r
+            final CalendarEntry entry = new CalendarEntry(styleName, startDate,\r
                     endDate, title, desc, notime);\r
 \r
             // TODO should remove+readd if the same entry (id) is\r
             // added again\r
 \r
-            for (Date d = entry.getStart(); d.getYear() <= entry.getEnd()\r
+            for (final Date d = entry.getStart(); d.getYear() <= entry.getEnd()\r
                     .getYear()\r
                     && d.getMonth() <= entry.getEnd().getYear()\r
                     && d.getDate() <= entry.getEnd().getDate(); d.setTime(d\r
                     .getTime() + 86400000)) {\r
-                String key = d.getYear() + "" + d.getMonth() + "" + d.getDate();\r
+                final String key = d.getYear() + "" + d.getMonth() + ""\r
+                        + d.getDate();\r
                 ArrayList l = (ArrayList) dates.get(key);\r
                 if (l == null) {\r
                     l = new ArrayList();\r
@@ -249,14 +255,14 @@ public class ICalendarField extends IDateField {
         }\r
 \r
         public List getEntries(Date date, int resolution) {\r
-            List entries = (List) dates.get(date.getYear() + ""\r
+            final List entries = (List) dates.get(date.getYear() + ""\r
                     + date.getMonth() + "" + date.getDate());\r
-            ArrayList res = new ArrayList();\r
+            final ArrayList res = new ArrayList();\r
             if (entries == null) {\r
                 return res;\r
             }\r
-            for (Iterator it = entries.iterator(); it.hasNext();) {\r
-                CalendarEntry item = (CalendarEntry) it.next();\r
+            for (final Iterator it = entries.iterator(); it.hasNext();) {\r
+                final CalendarEntry item = (CalendarEntry) it.next();\r
                 if (DateTimeService.isInRange(date, item.getStart(), item\r
                         .getEnd(), resolution)) {\r
                     res.add(item);\r
index 1517f071a015d99731cbf4f9cff1d6ca35801119..8dbdab11b0d332f0d1d40de78837a5d03d2cdc65 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.demo.reservation.gwt.client.ui;\r
 \r
 import java.util.Iterator;\r
@@ -32,18 +36,18 @@ public class IGoogleMap extends GMap2Widget implements Paintable {
     public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {\r
         map.clearOverlays();\r
         GLatLng pos = null;\r
-        for (Iterator it = uidl.getChildIterator(); it.hasNext();) {\r
-            UIDL u = (UIDL) it.next();\r
+        for (final Iterator it = uidl.getChildIterator(); it.hasNext();) {\r
+            final UIDL u = (UIDL) it.next();\r
             if (u.getTag().equals("markers")) {\r
 \r
-                for (Iterator m = u.getChildIterator(); m.hasNext();) {\r
-                    UIDL umarker = (UIDL) m.next();\r
-                    String html = "<span>" + umarker.getStringAttribute("html")\r
-                            + "</span>";\r
-                    double x = umarker.getDoubleAttribute("x");\r
-                    double y = umarker.getDoubleAttribute("y");\r
+                for (final Iterator m = u.getChildIterator(); m.hasNext();) {\r
+                    final UIDL umarker = (UIDL) m.next();\r
+                    final String html = "<span>"\r
+                            + umarker.getStringAttribute("html") + "</span>";\r
+                    final double x = umarker.getDoubleAttribute("x");\r
+                    final double y = umarker.getDoubleAttribute("y");\r
                     pos = new GLatLng(x, y);\r
-                    GMarker marker = new GMarker(pos);\r
+                    final GMarker marker = new GMarker(pos);\r
                     map.addOverlay(marker);\r
                     if (html != null) {\r
                         addMarkerPopup(marker, html);\r
@@ -61,8 +65,9 @@ public class IGoogleMap extends GMap2Widget implements Paintable {
             map.setZoom(uidl.getIntAttribute("zoom"));\r
         }\r
         if (uidl.hasAttribute("centerX") && uidl.hasAttribute("centerY")) {\r
-            GLatLng center = new GLatLng(uidl.getDoubleAttribute("centerX"),\r
-                    uidl.getDoubleAttribute("centerY"));\r
+            final GLatLng center = new GLatLng(uidl\r
+                    .getDoubleAttribute("centerX"), uidl\r
+                    .getDoubleAttribute("centerY"));\r
             map.setCenter(center);\r
         } else if (pos != null) {\r
             // use last marker position\r
index 3147c8bed1d66a0444564a71935cd94f52472f0b..4797fdfc606f6afa9cfa3bfa5553e6eac4e1d978 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo.util;
 
 import java.sql.Connection;
@@ -68,11 +72,11 @@ public class SampleCalendarDatabase {
      */
     private void connect() {
         // use memory-Only Database
-        String url = "jdbc:hsqldb:mem:toolkit";
+        final String url = "jdbc:hsqldb:mem:toolkit";
         try {
             Class.forName("org.hsqldb.jdbcDriver").newInstance();
             connection = DriverManager.getConnection(url, "sa", "");
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new RuntimeException(e);
         }
     }
@@ -86,7 +90,7 @@ public class SampleCalendarDatabase {
     public void update(String expression) throws SQLException {
         Statement st = null;
         st = connection.createStatement();
-        int i = st.executeUpdate(expression);
+        final int i = st.executeUpdate(expression);
         if (i == -1) {
             System.out.println("SampleDatabase error : " + expression);
         }
@@ -107,14 +111,15 @@ public class SampleCalendarDatabase {
                     + "EVENTSTART DATETIME, EVENTEND DATETIME, NOTIME BOOLEAN  )";
             update(stmt);
             for (int j = 0; j < ENTRYCOUNT; j++) {
-                Timestamp start = new Timestamp(new java.util.Date().getTime());
+                final Timestamp start = new Timestamp(new java.util.Date()
+                        .getTime());
                 start.setDate((int) ((Math.random() - 0.4) * 200));
                 start.setMinutes(0);
                 start.setHours(8 + (int) Math.random() * 12);
-                Timestamp end = new Timestamp(start.getTime());
+                final Timestamp end = new Timestamp(start.getTime());
                 if (Math.random() < 0.7) {
                     long t = end.getTime();
-                    long hour = 60 * 60 * 1000;
+                    final long hour = 60 * 60 * 1000;
                     t = t + hour + (Math.round(Math.random() * 3 * hour));
                     end.setTime(t);
                 }
@@ -128,7 +133,7 @@ public class SampleCalendarDatabase {
                         + "','" + end + "'," + (Math.random() > 0.7) + ")";
                 update(stmt);
             }
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             if (e.toString().indexOf("Table already exists") == -1) {
                 throw new RuntimeException(e);
             }
@@ -142,15 +147,15 @@ public class SampleCalendarDatabase {
     private String testDatabase() {
         String result = null;
         try {
-            Statement stmt = connection.createStatement(
+            final Statement stmt = connection.createStatement(
                     ResultSet.TYPE_SCROLL_INSENSITIVE,
                     ResultSet.CONCUR_UPDATABLE);
-            ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM "
+            final ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM "
                     + DB_TABLE_NAME);
             rs.next();
             result = "rowcount for table test is " + rs.getObject(1).toString();
             stmt.close();
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             throw new RuntimeException(e);
         }
         return result;
index 6c6d555667deeb3c92d4854bebce5de2a1a67eaa..7bdebb250222207c7d5bcd1ed143aa30408eae9f 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo.util;
 
 import java.sql.Connection;
@@ -82,11 +86,11 @@ public class SampleDatabase {
      */
     private void connect() {
         // use memory-Only Database
-        String url = "jdbc:hsqldb:mem:toolkit";
+        final String url = "jdbc:hsqldb:mem:toolkit";
         try {
             Class.forName("org.hsqldb.jdbcDriver").newInstance();
             connection = DriverManager.getConnection(url, "sa", "");
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new RuntimeException(e);
         }
     }
@@ -100,7 +104,7 @@ public class SampleDatabase {
     public void update(String expression) throws SQLException {
         Statement st = null;
         st = connection.createStatement();
-        int i = st.executeUpdate(expression);
+        final int i = st.executeUpdate(expression);
         if (i == -1) {
             throw new SQLException("Database error : " + expression);
         }
@@ -134,7 +138,7 @@ public class SampleDatabase {
                         + "'" + ")";
                 update(stmt);
             }
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             if (e.toString().indexOf("Table already exists") == -1) {
                 throw new RuntimeException(e);
             }
@@ -148,14 +152,15 @@ public class SampleDatabase {
     private String testDatabase() {
         String result = null;
         try {
-            Statement stmt = connection.createStatement(
+            final Statement stmt = connection.createStatement(
                     ResultSet.TYPE_SCROLL_INSENSITIVE,
                     ResultSet.CONCUR_UPDATABLE);
-            ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM employee");
+            final ResultSet rs = stmt
+                    .executeQuery("SELECT COUNT(*) FROM employee");
             rs.next();
             result = "rowcount for table test is " + rs.getObject(1).toString();
             stmt.close();
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             throw new RuntimeException(e);
         }
         return result;
index 15cdf87dadf0639ab69d6a5f1cc2ea033298a597..2c90f18d3fdbdf6ba8567a2f2de58a8413f308e2 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.demo.util;
 
 import java.io.File;
@@ -55,7 +59,7 @@ public class SampleDirectory {
             return file;
         }
         // Add failure notification as an Panel to main window
-        Panel errorPanel = new Panel("Demo application error");
+        final Panel errorPanel = new Panel("Demo application error");
         errorPanel.setStyle("strong");
         errorPanel.setComponentError(new SystemError(
                 "Cannot provide sample directory"));
index f2551f2b7beae447181596f8c538677e3d8d0a58..6e80e504b623ce5dee068ad533f5de93103679a9 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.event;
 
index a71a3e187415c1c743078082bd34ea112303e799..c6f04c51ad37aca4933fa306a174e144aa7e99e5 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.event;
 
@@ -86,14 +62,14 @@ public class EventRouter implements MethodEventSource {
     public void removeListener(Class eventType, Object target) {
 
         if (listenerList != null) {
-            Iterator i = listenerList.iterator();
+            final Iterator i = listenerList.iterator();
             while (i.hasNext()) {
                 try {
-                    ListenerMethod lm = (ListenerMethod) i.next();
+                    final ListenerMethod lm = (ListenerMethod) i.next();
                     if (lm.matches(eventType, target)) {
                         i.remove();
                     }
-                } catch (java.lang.ClassCastException e) {
+                } catch (final java.lang.ClassCastException e) {
                     // Class cast exceptions are ignored
                 }
             }
@@ -108,14 +84,14 @@ public class EventRouter implements MethodEventSource {
     public void removeListener(Class eventType, Object target, Method method) {
 
         if (listenerList != null) {
-            Iterator i = listenerList.iterator();
+            final Iterator i = listenerList.iterator();
             while (i.hasNext()) {
                 try {
-                    ListenerMethod lm = (ListenerMethod) i.next();
+                    final ListenerMethod lm = (ListenerMethod) i.next();
                     if (lm.matches(eventType, target, method)) {
                         i.remove();
                     }
-                } catch (java.lang.ClassCastException e) {
+                } catch (final java.lang.ClassCastException e) {
                     // Class cast exceptions are ignored
                 }
             }
@@ -130,7 +106,7 @@ public class EventRouter implements MethodEventSource {
     public void removeListener(Class eventType, Object target, String methodName) {
 
         // Find the correct method
-        Method[] methods = target.getClass().getMethods();
+        final Method[] methods = target.getClass().getMethods();
         Method method = null;
         for (int i = 0; i < methods.length; i++) {
             if (methods[i].getName().equals(methodName)) {
@@ -143,14 +119,14 @@ public class EventRouter implements MethodEventSource {
 
         // Remove the listeners
         if (listenerList != null) {
-            Iterator i = listenerList.iterator();
+            final Iterator i = listenerList.iterator();
             while (i.hasNext()) {
                 try {
-                    ListenerMethod lm = (ListenerMethod) i.next();
+                    final ListenerMethod lm = (ListenerMethod) i.next();
                     if (lm.matches(eventType, target, method)) {
                         i.remove();
                     }
-                } catch (java.lang.ClassCastException e) {
+                } catch (final java.lang.ClassCastException e) {
                     // Class cast exceptions are ignored
                 }
             }
@@ -178,7 +154,7 @@ public class EventRouter implements MethodEventSource {
 
             // Send the event to all listeners. The listeners themselves
             // will filter out unwanted events.
-            Iterator i = new LinkedList(listenerList).iterator();
+            final Iterator i = new LinkedList(listenerList).iterator();
             while (i.hasNext()) {
                 ((ListenerMethod) i.next()).receiveEvent(event);
             }
index 07c9866e37c28314bcc6bf38a0da67b4e89bb023..0b0d51cf5815dcf0781993146c223949c2b0d861 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.event;
 
@@ -64,18 +40,18 @@ public class ListenerMethod implements EventListener {
      * Type of the event that should trigger this listener. Also the subclasses
      * of this class are accepted to trigger the listener.
      */
-    private Class eventType;
+    private final Class eventType;
 
     /**
      * The object containing the trigger method.
      */
-    private Object object;
+    private final Object object;
 
     /**
      * The trigger method to call when an event passing the given criteria
      * fires.
      */
-    private Method method;
+    private final Method method;
 
     /**
      * Optional argument set to pass to the trigger method.
@@ -189,7 +165,7 @@ public class ListenerMethod implements EventListener {
             throws java.lang.IllegalArgumentException {
 
         // Finds the correct method
-        Method[] methods = object.getClass().getMethods();
+        final Method[] methods = object.getClass().getMethods();
         Method method = null;
         for (int i = 0; i < methods.length; i++) {
             if (methods[i].getName().equals(methodName)) {
@@ -296,7 +272,7 @@ public class ListenerMethod implements EventListener {
             Object[] arguments) throws java.lang.IllegalArgumentException {
 
         // Find the correct method
-        Method[] methods = object.getClass().getMethods();
+        final Method[] methods = object.getClass().getMethods();
         Method method = null;
         for (int i = 0; i < methods.length; i++) {
             if (methods[i].getName().equals(methodName)) {
@@ -351,7 +327,7 @@ public class ListenerMethod implements EventListener {
         this.method = method;
         eventArgumentIndex = -1;
 
-        Class[] params = method.getParameterTypes();
+        final Class[] params = method.getParameterTypes();
 
         if (params.length == 0) {
             arguments = new Object[0];
@@ -395,7 +371,7 @@ public class ListenerMethod implements EventListener {
             throws java.lang.IllegalArgumentException {
 
         // Finds the correct method
-        Method[] methods = object.getClass().getMethods();
+        final Method[] methods = object.getClass().getMethods();
         Method method = null;
         for (int i = 0; i < methods.length; i++) {
             if (methods[i].getName().equals(methodName)) {
@@ -411,7 +387,7 @@ public class ListenerMethod implements EventListener {
         this.method = method;
         eventArgumentIndex = -1;
 
-        Class[] params = method.getParameterTypes();
+        final Class[] params = method.getParameterTypes();
 
         if (params.length == 0) {
             arguments = new Object[0];
@@ -443,7 +419,7 @@ public class ListenerMethod implements EventListener {
                     if (eventArgumentIndex == 0 && arguments.length == 1) {
                         method.invoke(object, new Object[] { event });
                     } else {
-                        Object[] arg = new Object[arguments.length];
+                        final Object[] arg = new Object[arguments.length];
                         for (int i = 0; i < arg.length; i++) {
                             arg[i] = arguments[i];
                         }
@@ -454,11 +430,11 @@ public class ListenerMethod implements EventListener {
                     method.invoke(object, arguments);
                 }
 
-            } catch (java.lang.IllegalAccessException e) {
+            } catch (final java.lang.IllegalAccessException e) {
                 // This should never happen
                 throw new java.lang.RuntimeException(
                         "Internal error - please report: " + e.toString());
-            } catch (java.lang.reflect.InvocationTargetException e) {
+            } catch (final java.lang.reflect.InvocationTargetException e) {
                 // This should never happen
                 throw new MethodException("Invocation if method " + method
                         + " failed.", e.getTargetException());
@@ -526,7 +502,7 @@ public class ListenerMethod implements EventListener {
          */
         private static final long serialVersionUID = 3257005445242894135L;
 
-        private Throwable cause;
+        private final Throwable cause;
 
         private String message;
 
index 8e80ea604e968b8dd8f95f973999b935ac1daaab..9718bfcd6806b6f4e2a66cf568093d5643300cbe 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.event;
 
index da03d867642f5b02ba8aa90f9d3a7b18c20f2a6b..4b4cca83b5a415330f7410e471df5692e47312bc 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.event;
 
 import com.itmill.toolkit.terminal.Resource;
@@ -11,9 +15,9 @@ import com.itmill.toolkit.terminal.Resource;
  */
 public class ShortcutAction extends Action {
 
-    private int keyCode;
+    private final int keyCode;
 
-    private int[] modifiers;
+    private final int[] modifiers;
 
     public ShortcutAction(String caption, int kc, int[] m) {
         super(caption);
index 6bc8b50b18f66121a0ab2a195b26ac82fce499b3..5641975d4ab713004bc8b9bc67d20a895ea50917 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.launcher;
 
 import java.awt.FlowLayout;
@@ -31,12 +35,12 @@ public class ITMillToolkitDesktopMode {
 
     public static void main(String[] args) {
 
-        Map serverArgs = ITMillToolkitWebMode.parseArguments(args);
+        final Map serverArgs = ITMillToolkitWebMode.parseArguments(args);
         boolean deployed = false;
         try {
             // Default deployment: embedded.war
             deployed = deployEmbeddedWarfile(serverArgs);
-        } catch (IOException e1) {
+        } catch (final IOException e1) {
             e1.printStackTrace();
             deployed = false;
         }
@@ -55,7 +59,8 @@ public class ITMillToolkitDesktopMode {
         }
 
         // Start the Winstone servlet container
-        String url = ITMillToolkitWebMode.runServer(serverArgs, "Desktop Mode");
+        final String url = ITMillToolkitWebMode.runServer(serverArgs,
+                "Desktop Mode");
 
         // Open browser into application URL
         if (url != null) {
@@ -106,7 +111,7 @@ public class ITMillToolkitDesktopMode {
         final JButton cancelButton = new JButton("Cancel");
 
         // List for close verify buttons
-        ActionListener buttonListener = new ActionListener() {
+        final ActionListener buttonListener = new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 if (e.getSource() == okButton) {
                     System.exit(0);
@@ -127,7 +132,7 @@ public class ITMillToolkitDesktopMode {
 
         frame.addWindowListener(new WindowAdapter() {
             public void windowClosing(WindowEvent e) {
-                Rectangle bounds = frame.getBounds();
+                final Rectangle bounds = frame.getBounds();
                 frame.setTitle("Confirm close");
                 contentPane.removeAll();
                 contentPane.add(question);
@@ -140,11 +145,11 @@ public class ITMillToolkitDesktopMode {
         });
 
         // Position the window nicely
-        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit()
-                .getScreenSize();
-        int w = 270;
-        int h = 95;
-        int margin = 20;
+        final java.awt.Dimension screenSize = java.awt.Toolkit
+                .getDefaultToolkit().getScreenSize();
+        final int w = 270;
+        final int h = 95;
+        final int margin = 20;
         frame.setBounds(new Rectangle(screenSize.width - w - margin,
                 screenSize.height - h - margin * 2, w, h));
         frame.toFront();
@@ -159,23 +164,23 @@ public class ITMillToolkitDesktopMode {
      * @throws IOException
      */
     protected static boolean deployEmbeddedWarfile(Map args) throws IOException {
-        String embeddedWarfileName = "/embedded.war";
-        InputStream embeddedWarfile = ITMillToolkitDesktopMode.class
+        final String embeddedWarfileName = "/embedded.war";
+        final InputStream embeddedWarfile = ITMillToolkitDesktopMode.class
                 .getResourceAsStream(embeddedWarfileName);
         if (embeddedWarfile != null) {
-            File tempWarfile = File.createTempFile("embedded", ".war")
+            final File tempWarfile = File.createTempFile("embedded", ".war")
                     .getAbsoluteFile();
             tempWarfile.getParentFile().mkdirs();
             tempWarfile.deleteOnExit();
 
-            String embeddedWebroot = "winstoneEmbeddedWAR";
-            File tempWebroot = new File(tempWarfile.getParentFile(),
+            final String embeddedWebroot = "winstoneEmbeddedWAR";
+            final File tempWebroot = new File(tempWarfile.getParentFile(),
                     embeddedWebroot);
             tempWebroot.mkdirs();
 
-            OutputStream out = new FileOutputStream(tempWarfile, true);
+            final OutputStream out = new FileOutputStream(tempWarfile, true);
             int read = 0;
-            byte buffer[] = new byte[2048];
+            final byte buffer[] = new byte[2048];
             while ((read = embeddedWarfile.read(buffer)) != -1) {
                 out.write(buffer, 0, read);
             }
index 206174b3d5c273b15105670df154d86b40c44b76..02a9f9305df25f7668351107a2cbaf11513451a9 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.launcher;\r
 \r
 import java.util.HashMap;\r
@@ -29,11 +33,11 @@ public class ITMillToolkitWebMode {
     public static void main(String[] args) {\r
 \r
         // Pass-through of arguments for Jetty\r
-        Map serverArgs = parseArguments(args);\r
+        final Map serverArgs = parseArguments(args);\r
 \r
         // Start Jetty\r
         System.out.println("Starting Jetty servlet container.");\r
-        String url = runServer(serverArgs, "Web Mode");\r
+        final String url = runServer(serverArgs, "Web Mode");\r
 \r
         // Start Browser\r
         System.out.println("Starting Web Browser.");\r
@@ -66,9 +70,9 @@ public class ITMillToolkitWebMode {
         assignDefault(serverArgs, "httpPort", serverPort);\r
 \r
         try {\r
-            long started = System.currentTimeMillis();\r
+            final long started = System.currentTimeMillis();\r
 \r
-            Server server = new Server();\r
+            final Server server = new Server();\r
 \r
             // String threadPoolName =\r
             // System.getProperty("jetty.threadpool.name",\r
@@ -91,14 +95,14 @@ public class ITMillToolkitWebMode {
             // threadPool.setLowThreads(lowThreads);\r
             // server.setThreadPool(threadPool);\r
 \r
-            Connector connector = new SelectChannelConnector();\r
+            final Connector connector = new SelectChannelConnector();\r
             // FIXME httpPort hardcoded to 8888\r
             // connector.setPort(Integer.valueOf(serverArgs.get("httpPort")\r
             // .toString()));\r
             connector.setPort(8888);\r
             server.setConnectors(new Connector[] { connector });\r
 \r
-            WebAppContext webappcontext = new WebAppContext();\r
+            final WebAppContext webappcontext = new WebAppContext();\r
             webappcontext.setContextPath("");\r
             webappcontext.setWar(serverArgs.get("webroot").toString());\r
             // enable hot code replace\r
@@ -109,7 +113,7 @@ public class ITMillToolkitWebMode {
             server.start();\r
             // System.err.println("Started Jetty in "\r
             // + (System.currentTimeMillis() - started) + "ms.");\r
-        } catch (Exception e) {\r
+        } catch (final Exception e) {\r
             e.printStackTrace();\r
             return null;\r
         }\r
@@ -139,12 +143,12 @@ public class ITMillToolkitWebMode {
      * @return map of arguments key value pairs.\r
      */\r
     protected static Map parseArguments(String[] args) {\r
-        Map map = new HashMap();\r
+        final Map map = new HashMap();\r
         for (int i = 0; i < args.length; i++) {\r
-            int d = args[i].indexOf("=");\r
+            final int d = args[i].indexOf("=");\r
             if (d > 0 && d < args[i].length() && args[i].startsWith("--")) {\r
-                String name = args[i].substring(2, d);\r
-                String value = args[i].substring(d + 1);\r
+                final String name = args[i].substring(2, d);\r
+                final String value = args[i].substring(d + 1);\r
                 map.put(name, value);\r
             }\r
         }\r
index 86c48556a5677248de39d9acd8a02fd585cb7433..135ce79b71c6a64ba409fffe35493e4bee20f525 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.launcher.util;\r
 \r
 import java.io.IOException;\r
@@ -16,10 +20,11 @@ public class BrowserLauncher {
      */\r
     public static void openBrowser(String url) {\r
 \r
-        Runtime runtime = Runtime.getRuntime();\r
+        final Runtime runtime = Runtime.getRuntime();\r
         boolean started = false;\r
 \r
-        String os = System.getProperty("os.name", "windows").toLowerCase();\r
+        final String os = System.getProperty("os.name", "windows")\r
+                .toLowerCase();\r
 \r
         // Linux\r
         if (os.indexOf("linux") >= 0) {\r
@@ -29,7 +34,7 @@ public class BrowserLauncher {
                 try {\r
                     runtime.exec("x-www-browser " + url);\r
                     started = true;\r
-                } catch (IOException e) {\r
+                } catch (final IOException e) {\r
                 }\r
             }\r
 \r
@@ -38,7 +43,7 @@ public class BrowserLauncher {
                 try {\r
                     runtime.exec("firefox " + url);\r
                     started = true;\r
-                } catch (IOException e) {\r
+                } catch (final IOException e) {\r
                 }\r
             }\r
 \r
@@ -47,7 +52,7 @@ public class BrowserLauncher {
                 try {\r
                     runtime.exec("mozilla " + url);\r
                     started = true;\r
-                } catch (IOException e) {\r
+                } catch (final IOException e) {\r
                 }\r
             }\r
 \r
@@ -56,7 +61,7 @@ public class BrowserLauncher {
                 try {\r
                     runtime.exec("konqueror " + url);\r
                     started = true;\r
-                } catch (IOException e) {\r
+                } catch (final IOException e) {\r
                 }\r
             }\r
         }\r
@@ -69,7 +74,7 @@ public class BrowserLauncher {
                 try {\r
                     runtime.exec("open " + url);\r
                     started = true;\r
-                } catch (IOException e) {\r
+                } catch (final IOException e) {\r
                 }\r
             }\r
         }\r
@@ -80,7 +85,7 @@ public class BrowserLauncher {
                 try {\r
                     runtime.exec("cmd /c start " + url);\r
                     started = true;\r
-                } catch (IOException e) {\r
+                } catch (final IOException e) {\r
                 }\r
             }\r
         }\r
index 7c092c484d92add30ff3b8fd1f9ed7a0178e3901..fea221416d31dc9a77eff6e9cf63cd069f71efdf 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.service;
 
index 7bdadc8b05c895a55dde0ccb8df1751e38521c5e..79aadf899ff0d64e797dc159c0806c701ebaf338 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.service;
 
@@ -226,13 +202,14 @@ public class FileTypeResolver {
     static {
 
         // Initialize extension to MIME map
-        StringTokenizer lines = new StringTokenizer(initialExtToMIMEMap, ",");
+        final StringTokenizer lines = new StringTokenizer(initialExtToMIMEMap,
+                ",");
         while (lines.hasMoreTokens()) {
-            String line = lines.nextToken();
-            StringTokenizer exts = new StringTokenizer(line);
-            String type = exts.nextToken();
+            final String line = lines.nextToken();
+            final StringTokenizer exts = new StringTokenizer(line);
+            final String type = exts.nextToken();
             while (exts.hasMoreTokens()) {
-                String ext = exts.nextToken();
+                final String ext = exts.nextToken();
                 addExtension(ext, type);
             }
         }
@@ -265,10 +242,10 @@ public class FileTypeResolver {
         dotIndex++;
 
         if (fileName.length() > dotIndex) {
-            String ext = fileName.substring(dotIndex);
+            final String ext = fileName.substring(dotIndex);
 
             // Return type from extension map, if found
-            String type = (String) extToMIMEMap.get(ext);
+            final String type = (String) extToMIMEMap.get(ext);
             if (type != null) {
                 return type;
             }
@@ -289,8 +266,8 @@ public class FileTypeResolver {
      */
     public static Resource getIcon(String fileName) {
 
-        String mimeType = getMIMEType(fileName);
-        Resource icon = (Resource) MIMEToIconMap.get(mimeType);
+        final String mimeType = getMIMEType(fileName);
+        final Resource icon = (Resource) MIMEToIconMap.get(mimeType);
         if (icon != null) {
             return icon;
         }
@@ -312,8 +289,8 @@ public class FileTypeResolver {
      */
     public static Resource getIcon(File file) {
 
-        String mimeType = getMIMEType(file);
-        Resource icon = (Resource) MIMEToIconMap.get(mimeType);
+        final String mimeType = getMIMEType(file);
+        final Resource icon = (Resource) MIMEToIconMap.get(mimeType);
         if (icon != null) {
             return icon;
         }
index 17093f8907b65424e0fed3b7a35bba95070b2b90..94f3a21a2eecd0c1e5ecb23858039eb72a0d820d 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index afb596f5c34ab833302aab19e0907445af505b25..cd8498bc1d91e9bcbba78270d6407dd956ba13a9 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
@@ -59,17 +35,17 @@ public class ClassResource implements ApplicationResource {
     /**
      * Associated class used for indetifying the source of the resource.
      */
-    private Class associatedClass;
+    private final Class associatedClass;
 
     /**
      * Name of the resource is relative to the associated class.
      */
-    private String resourceName;
+    private final String resourceName;
 
     /**
      * Application used for serving the class.
      */
-    private Application application;
+    private final Application application;
 
     /**
      * Creates a new application resource instance. The resource id is relative
@@ -153,7 +129,7 @@ public class ClassResource implements ApplicationResource {
      * @see com.itmill.toolkit.terminal.ApplicationResource#getStream()
      */
     public DownloadStream getStream() {
-        DownloadStream ds = new DownloadStream(associatedClass
+        final DownloadStream ds = new DownloadStream(associatedClass
                 .getResourceAsStream(resourceName), getMIMEType(),
                 getFilename());
         ds.setBufferSize(getBufferSize());
index 8916e6291b6dce99f3c151e83d6780375d4e5454..ba3616466c9a8b30548168e2c32213397265e8e1 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
@@ -46,7 +22,7 @@ public class CompositeErrorMessage implements ErrorMessage {
     /**
      * Array of all the errors.
      */
-    private List errors;
+    private final List errors;
 
     /**
      * Level of the error.
@@ -86,7 +62,7 @@ public class CompositeErrorMessage implements ErrorMessage {
         errors = new ArrayList(errorMessages.size());
         level = Integer.MIN_VALUE;
 
-        for (Iterator i = errorMessages.iterator(); i.hasNext();) {
+        for (final Iterator i = errorMessages.iterator(); i.hasNext();) {
             addErrorMessage((ErrorMessage) i.next());
         }
 
@@ -116,7 +92,7 @@ public class CompositeErrorMessage implements ErrorMessage {
     private void addErrorMessage(ErrorMessage error) {
         if (error != null && !errors.contains(error)) {
             errors.add(error);
-            int l = error.getErrorLevel();
+            final int l = error.getErrorLevel();
             if (l > level) {
                 level = l;
             }
@@ -155,7 +131,7 @@ public class CompositeErrorMessage implements ErrorMessage {
             }
 
             // Paint all the exceptions
-            for (Iterator i = errors.iterator(); i.hasNext();) {
+            for (final Iterator i = errors.iterator(); i.hasNext();) {
                 ((ErrorMessage) i.next()).paint(target);
             }
 
@@ -187,7 +163,7 @@ public class CompositeErrorMessage implements ErrorMessage {
     public String toString() {
         String retval = "[";
         int pos = 0;
-        for (Iterator i = errors.iterator(); i.hasNext();) {
+        for (final Iterator i = errors.iterator(); i.hasNext();) {
             if (pos > 0) {
                 retval += ",";
             }
index 4ec51c848deca2941ff2cb915f1167f884ff6064..e8eaef8f5f781ae7dbb51d403ae5bfd695247dde 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index 4153ca220a4a2405b8f1548334c741897c7b5757..8c3a256dabc519a6d443d723b6d34756b44d1eef 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index 005e97217ba2e5b37e83be8500775ea5bee7eb52..356d3f14a1829ddbf043fec400739bc327365f82 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index 800e63582bcbdc99229cfa4b772ff67159d46e0b..eaa7061caa7e524d8e34789cb92e46fd9ddb4f50 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
@@ -61,7 +37,7 @@ public class FileResource implements ApplicationResource {
     /**
      * Application.
      */
-    private Application application;
+    private final Application application;
 
     /**
      * Default cache time for this stream resource.
@@ -85,11 +61,11 @@ public class FileResource implements ApplicationResource {
      */
     public DownloadStream getStream() {
         try {
-            DownloadStream ds = new DownloadStream(new FileInputStream(
+            final DownloadStream ds = new DownloadStream(new FileInputStream(
                     sourceFile), getMIMEType(), getFilename());
             ds.setCacheTime(cacheTime);
             return ds;
-        } catch (FileNotFoundException e) {
+        } catch (final FileNotFoundException e) {
             // No logging for non-existing files at this level.
             return null;
         }
index 16460de64cabc81d7144f7c06e66f1f52e43549f..0617f0ba76d90514b9d8bd684aa569a50ef7c0c8 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
@@ -43,9 +19,9 @@ public class KeyMapper {
 
     private int lastKey = 0;
 
-    private Hashtable objectKeyMap = new Hashtable();
+    private final Hashtable objectKeyMap = new Hashtable();
 
-    private Hashtable keyObjectMap = new Hashtable();
+    private final Hashtable keyObjectMap = new Hashtable();
 
     /**
      * Gets key for an object.
@@ -107,7 +83,7 @@ public class KeyMapper {
      *                the object to be removed.
      */
     public void remove(Object removeobj) {
-        String key = (String) objectKeyMap.get(removeobj);
+        final String key = (String) objectKeyMap.get(removeobj);
 
         if (key != null) {
             objectKeyMap.remove(key);
index 2830e762a579007309ef477b050a3c526ffd1cf2..1c0287e026afe190f2dae75f46b474c4cd11ffa8 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index e7760c9e7ffa2903b5410f3c21bc0f9466f64a26..f2a29401adcba23b5cde5125e59c8d2ac98b9320 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index 3c89923632b472f0068e44af4649142f80d76549..aad66cdaf2af5bc4977c515336146592ee89cc50 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index 8d8ab0ca17923b0dbcfd20bf8412ca6c48e7e816..fb8c86ec72bb0079ff7633f8b2ce1c8fec2c0469 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index 8dc86e2d86cf5ed84fc47a0ad348c5b160e67a13..5cf07729aa98c8a6962bdeb6fa181c4356e7e334 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index f320a4d2a855b13a47d43c3bad45c4d1d3dcac97..a874d2fd1b29148b6768916ae9d657b8e27e7eb8 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index decacf3fa4a6386ce2dbeb093543dcd5da6810b3..649be802f8b60a00c413aa8a908490d794de3fa5 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2007 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index 523741089d81c862a1bf52efbf404723528af0a4..08a39f41cd6bd9160e986785ddc946ba01082a5d 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
@@ -64,7 +40,7 @@ public class StreamResource implements ApplicationResource {
     /**
      * Application.
      */
-    private Application application;
+    private final Application application;
 
     /**
      * Default buffer size for this stream resource.
@@ -170,12 +146,12 @@ public class StreamResource implements ApplicationResource {
      * @see com.itmill.toolkit.terminal.ApplicationResource#getStream()
      */
     public DownloadStream getStream() {
-        StreamSource ss = getStreamSource();
+        final StreamSource ss = getStreamSource();
         if (ss == null) {
             return null;
         }
-        DownloadStream ds = new DownloadStream(ss.getStream(), getMIMEType(),
-                getFilename());
+        final DownloadStream ds = new DownloadStream(ss.getStream(),
+                getMIMEType(), getFilename());
         ds.setBufferSize(getBufferSize());
         ds.setCacheTime(cacheTime);
         return ds;
index 0fbace43375e3cb9e0819900dcac40dc1b91bb87..f5f3623ef592c6d8d1bd5585177f0095f67376c9 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
@@ -104,7 +80,7 @@ public class SystemError extends RuntimeException implements ErrorMessage {
         target.addAttribute("level", "system");
 
         // Paint the error message
-        String message = getLocalizedMessage();
+        final String message = getLocalizedMessage();
         if (message != null) {
             target.addSection("h2", message);
         }
@@ -112,7 +88,7 @@ public class SystemError extends RuntimeException implements ErrorMessage {
         // Paint the exception
         if (cause != null) {
             target.addSection("h3", "Exception");
-            StringWriter buffer = new StringWriter();
+            final StringWriter buffer = new StringWriter();
             cause.printStackTrace(new PrintWriter(buffer));
             target.addSection("pre", buffer.toString());
         }
index a31e31c6dbcc37e240f92eb6ccdcb0cf420be86c..573130dee43a3d40ba5e4463c592aec102e8010a 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index c8f80ba56a3b4f747730b09b2ff4093911d6e03e..1b9995dc7c119fc28c67354003f6ae50809a09c5 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index 5b4bf67d58346ffb705a2285a94e0123becff7f4..ef1fc76e069efc20a49ba14657371caf541e9c28 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index b0a9cf85c94f9db5a860df053aa9270c20d7c22e..b15bb1db15a0c6555c598825452da8aa5dd07005 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index 6915f07378c25d0fb00dbbdd4444c66d4268985a..8d13b3c15565132398d97a7893ca20b2e481ef46 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
@@ -63,7 +39,7 @@ public class UserError implements ErrorMessage {
     /**
      * Message in content mode.
      */
-    private String msg;
+    private final String msg;
 
     /**
      * Error level.
index 93bdb7d78062c9286e1721747814f5858b4eb099..b14c83d1ef4ac1702c122455dac888935a94bb54 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal;
 
index 54f5885b37eff1fe25530431266ab8adc5d502da..f7e72d13625f4f5bb5a2cf5fe0247caab6bacd1c 100755 (executable)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 import java.util.Date;
@@ -30,17 +34,17 @@ import com.itmill.toolkit.terminal.gwt.client.ui.IView;
  */
 public class ApplicationConnection {
 
-    private String appUri;
+    private final String appUri;
 
-    private HashMap resourcesMap = new HashMap();
+    private final HashMap resourcesMap = new HashMap();
 
     private static Console console;
 
-    private Vector pendingVariables = new Vector();
+    private final Vector pendingVariables = new Vector();
 
-    private HashMap idToPaintable = new HashMap();
+    private final HashMap idToPaintable = new HashMap();
 
-    private HashMap paintableToId = new HashMap();
+    private final HashMap paintableToId = new HashMap();
 
     private final WidgetSet widgetSet;
 
@@ -49,7 +53,7 @@ public class ApplicationConnection {
     private Timer loadTimer;
     private Element loadElement;
 
-    private IView view;
+    private final IView view;
 
     public ApplicationConnection(WidgetSet widgetSet) {
         this.widgetSet = widgetSet;
@@ -108,8 +112,8 @@ public class ApplicationConnection {
         showLoadingIndicator();
 
         console.log("Making UIDL Request with params: " + requestData);
-        String uri = appUri + "/UIDL" + getPathInfo();
-        RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, uri);
+        final String uri = appUri + "/UIDL" + getPathInfo();
+        final RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, uri);
         rb.setHeader("Content-Type",
                 "application/x-www-form-urlencoded; charset=utf-8");
         try {
@@ -126,7 +130,7 @@ public class ApplicationConnection {
 
             });
 
-        } catch (RequestException e) {
+        } catch (final RequestException e) {
             // TODO Better reporting to user
             console.error(e.getMessage());
         }
@@ -156,7 +160,7 @@ public class ApplicationConnection {
                                 + "px");
 
                 // Initialize other timers
-                Timer delay = new Timer() {
+                final Timer delay = new Timer() {
                     public void run() {
                         DOM.setElementProperty(loadElement, "className",
                                 "i-loading-indicator-delay");
@@ -165,7 +169,7 @@ public class ApplicationConnection {
                 // Second one kicks in at 1500ms
                 delay.schedule(1200);
 
-                Timer wait = new Timer() {
+                final Timer wait = new Timer() {
                     public void run() {
                         DOM.setElementProperty(loadElement, "className",
                                 "i-loading-indicator-wait");
@@ -191,20 +195,21 @@ public class ApplicationConnection {
     private void handleReceivedJSONMessage(Response response) {
         hideLoadingIndicator();
 
-        Date start = new Date();
-        String jsonText = response.getText().substring(3) + "}";
+        final Date start = new Date();
+        final String jsonText = response.getText().substring(3) + "}";
         JSONValue json;
         try {
             json = JSONParser.parse(jsonText);
-        } catch (com.google.gwt.json.client.JSONException e) {
+        } catch (final com.google.gwt.json.client.JSONException e) {
             console.log(e.getMessage() + " - Original JSON-text:");
             console.log(jsonText);
             return;
         }
         // Handle redirect
-        JSONObject redirect = (JSONObject) ((JSONObject) json).get("redirect");
+        final JSONObject redirect = (JSONObject) ((JSONObject) json)
+                .get("redirect");
         if (redirect != null) {
-            JSONString url = (JSONString) redirect.get("url");
+            final JSONString url = (JSONString) redirect.get("url");
             if (url != null) {
                 console.log("redirecting to " + url.stringValue());
                 redirect(url.stringValue());
@@ -213,37 +218,38 @@ public class ApplicationConnection {
         }
 
         // Store resources
-        JSONObject resources = (JSONObject) ((JSONObject) json)
+        final JSONObject resources = (JSONObject) ((JSONObject) json)
                 .get("resources");
-        for (Iterator i = resources.keySet().iterator(); i.hasNext();) {
-            String key = (String) i.next();
+        for (final Iterator i = resources.keySet().iterator(); i.hasNext();) {
+            final String key = (String) i.next();
             resourcesMap.put(key, ((JSONString) resources.get(key))
                     .stringValue());
         }
 
         // Store locale data
         if (((JSONObject) json).containsKey("locales")) {
-            JSONArray l = (JSONArray) ((JSONObject) json).get("locales");
+            final JSONArray l = (JSONArray) ((JSONObject) json).get("locales");
             for (int i = 0; i < l.size(); i++) {
                 LocaleService.addLocale((JSONObject) l.get(i));
             }
         }
 
         // Process changes
-        JSONArray changes = (JSONArray) ((JSONObject) json).get("changes");
+        final JSONArray changes = (JSONArray) ((JSONObject) json)
+                .get("changes");
         for (int i = 0; i < changes.size(); i++) {
             try {
-                UIDL change = new UIDL((JSONArray) changes.get(i));
+                final UIDL change = new UIDL((JSONArray) changes.get(i));
                 try {
                     console.dirUIDL(change);
-                } catch (Exception e) {
+                } catch (final Exception e) {
                     console.log(e.getMessage());
                     // TODO: dir doesn't work in any browser although it should
                     // work (works in hosted mode)
                     // it partially did at some part but now broken.
                 }
-                UIDL uidl = change.getChildUIDL(0);
-                Paintable paintable = getPaintable(uidl.getId());
+                final UIDL uidl = change.getChildUIDL(0);
+                final Paintable paintable = getPaintable(uidl.getId());
                 if (paintable != null) {
                     paintable.updateFromUIDL(uidl, this);
                 } else {
@@ -256,24 +262,25 @@ public class ApplicationConnection {
                         view.updateFromUIDL(uidl, this);
                     }
                 }
-            } catch (Throwable e) {
+            } catch (final Throwable e) {
                 e.printStackTrace();
             }
         }
 
         if (((JSONObject) json).containsKey("meta")) {
-            JSONObject meta = ((JSONObject) json).get("meta").isObject();
+            final JSONObject meta = ((JSONObject) json).get("meta").isObject();
             if (meta.containsKey("focus")) {
-                String focusPid = meta.get("focus").isString().stringValue();
-                Paintable toBeFocused = getPaintable(focusPid);
+                final String focusPid = meta.get("focus").isString()
+                        .stringValue();
+                final Paintable toBeFocused = getPaintable(focusPid);
                 if (toBeFocused instanceof HasFocus) {
-                    HasFocus toBeFocusedWidget = (HasFocus) toBeFocused;
+                    final HasFocus toBeFocusedWidget = (HasFocus) toBeFocused;
                     toBeFocusedWidget.setFocus(true);
                 }
             }
         }
 
-        long prosessingTime = (new Date().getTime()) - start.getTime();
+        final long prosessingTime = (new Date().getTime()) - start.getTime();
         console.log(" Processing time was " + String.valueOf(prosessingTime)
                 + "ms for " + jsonText.length() + " characters of JSON");
         console.log("Referenced paintables: " + idToPaintable.size());
@@ -301,9 +308,9 @@ public class ApplicationConnection {
     }
 
     public void unregisterChildPaintables(HasWidgets container) {
-        Iterator it = container.iterator();
+        final Iterator it = container.iterator();
         while (it.hasNext()) {
-            Widget w = (Widget) it.next();
+            final Widget w = (Widget) it.next();
             if (w instanceof Paintable) {
                 unregisterPaintable((Paintable) w);
             }
@@ -325,7 +332,7 @@ public class ApplicationConnection {
 
     private void addVariableToQueue(String paintableId, String variableName,
             String encodedValue, boolean immediate, char type) {
-        String id = paintableId + "_" + variableName + "_" + type;
+        final String id = paintableId + "_" + variableName + "_" + type;
         for (int i = 0; i < pendingVariables.size(); i += 2) {
             if ((pendingVariables.get(i)).equals(id)) {
                 pendingVariables.remove(i);
@@ -341,7 +348,7 @@ public class ApplicationConnection {
     }
 
     public void sendPendingVariableChanges() {
-        StringBuffer req = new StringBuffer();
+        final StringBuffer req = new StringBuffer();
 
         req.append("changes=");
         for (int i = 0; i < pendingVariables.size(); i++) {
@@ -398,7 +405,7 @@ public class ApplicationConnection {
 
     public void updateVariable(String paintableId, String variableName,
             Object[] values, boolean immediate) {
-        StringBuffer buf = new StringBuffer();
+        final StringBuffer buf = new StringBuffer();
         for (int i = 0; i < values.length; i++) {
             if (i > 0) {
                 buf.append(",");
@@ -471,7 +478,7 @@ public class ApplicationConnection {
         component.setVisible(visible);
         // Set captions
         if (manageCaption) {
-            Container parent = getParentLayout(component);
+            final Container parent = getParentLayout(component);
             if (parent != null) {
                 parent.updateCaption((Paintable) component, uidl);
             }
@@ -483,9 +490,9 @@ public class ApplicationConnection {
 
         // Switch to correct implementation if needed
         if (!widgetSet.isCorrectImplementation(component, uidl)) {
-            Container parent = getParentLayout(component);
+            final Container parent = getParentLayout(component);
             if (parent != null) {
-                Widget w = widgetSet.createWidget(uidl);
+                final Widget w = widgetSet.createWidget(uidl);
                 parent.replaceChildComponent(component, w);
                 registerPaintable(uidl.getId(), (Paintable) w);
                 ((Paintable) w).updateFromUIDL(uidl, this);
@@ -513,7 +520,7 @@ public class ApplicationConnection {
         // add additional styles as css classes, prefixed with component default
         // stylename
         if (uidl.hasAttribute("style")) {
-            String[] styles = uidl.getStringAttribute("style").split(" ");
+            final String[] styles = uidl.getStringAttribute("style").split(" ");
             for (int i = 0; i < styles.length; i++) {
                 component.addStyleDependentName(styles[i]);
             }
@@ -534,7 +541,7 @@ public class ApplicationConnection {
      * @return Either existing or new widget corresponding to UIDL.
      */
     public Widget getWidget(UIDL uidl) {
-        String id = uidl.getId();
+        final String id = uidl.getId();
         Widget w = (Widget) getPaintable(id);
         if (w != null) {
             return w;
@@ -571,7 +578,7 @@ public class ApplicationConnection {
      */
     public String translateToolkitUri(String toolkitUri) {
         if (toolkitUri.startsWith("theme://")) {
-            String themeUri = getThemeUri();
+            final String themeUri = getThemeUri();
             if (themeUri == null) {
                 console
                         .error("Theme not set: ThemeResource will not be found. ("
index d097ca482927e5f5338b670f68169379921bb7d5..8cd81ae889f5f36cd595840576aee0b293ea6536 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 import com.google.gwt.user.client.DOM;
@@ -10,7 +14,7 @@ public class Caption extends HTML {
 
     public static final String CLASSNAME = "i-caption";
 
-    private Paintable owner;
+    private final Paintable owner;
 
     private Element errorIndicatorElement;
 
@@ -20,7 +24,7 @@ public class Caption extends HTML {
 
     private ErrorMessage errorMessage;
 
-    private ApplicationConnection client;
+    private final ApplicationConnection client;
 
     public Caption(Paintable component, ApplicationConnection client) {
         super();
@@ -35,7 +39,7 @@ public class Caption extends HTML {
         setStyleName(getElement(), "i-disabled", uidl.hasAttribute("disabled"));
 
         if (uidl.hasAttribute("error")) {
-            UIDL errorUidl = uidl.getErrors();
+            final UIDL errorUidl = uidl.getErrors();
 
             if (errorIndicatorElement == null) {
                 errorIndicatorElement = DOM.createDiv();
@@ -89,7 +93,7 @@ public class Caption extends HTML {
     }
 
     public void onBrowserEvent(Event event) {
-        Element target = DOM.eventGetTarget(event);
+        final Element target = DOM.eventGetTarget(event);
         if (errorIndicatorElement != null
                 && DOM.compare(target, errorIndicatorElement)) {
             switch (DOM.eventGetType(event)) {
index 5b61a40ecd8ddb6b218fd8b3e1b8bd082eff97bf..ec5a585998fcfb1c2225591df15d628d9c25b792 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 import com.google.gwt.user.client.ui.FlowPanel;
index 37c911032df080c5d013b5e7bf186f5f5896b6ef..51cc9311f4046ee064d096352ddd2cf1eca93488 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 public interface Console {
index 5e0fe8df31c32dd3bdf7f820a8faab85a13a89db..b73ad05f0378d48d2e2986c69a3bdb0f2101fd79 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 import com.google.gwt.user.client.ui.Widget;
index 22d92355d1d024d1528eafbeec3d071c184801ca..f299c985dd7adc6a8106ddfabdd6dbef8e5484ee 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 /**
index 7cc4ace944b4d8b180d905955248efc8ec568478..481f3ecdec2df8e702394fa78df3ae51e9a5d9dd 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client;\r
 \r
 public class DateLocale extends\r
@@ -22,7 +26,7 @@ public class DateLocale extends
     public static String getAM() {\r
         try {\r
             return LocaleService.getAmPmStrings(locale)[0];\r
-        } catch (LocaleNotLoadedException e) {\r
+        } catch (final LocaleNotLoadedException e) {\r
             // TODO redirect to console\r
             System.out.println("Tried to use an unloaded locale \"" + locale\r
                     + "\".");\r
@@ -33,7 +37,7 @@ public class DateLocale extends
     public static String getPM() {\r
         try {\r
             return LocaleService.getAmPmStrings(locale)[1];\r
-        } catch (LocaleNotLoadedException e) {\r
+        } catch (final LocaleNotLoadedException e) {\r
             // TODO redirect to console\r
             System.out.println("Tried to use an unloaded locale \"" + locale\r
                     + "\".");\r
@@ -44,7 +48,7 @@ public class DateLocale extends
     public String[] getWEEKDAY_LONG() {\r
         try {\r
             return LocaleService.getDayNames(locale);\r
-        } catch (LocaleNotLoadedException e) {\r
+        } catch (final LocaleNotLoadedException e) {\r
             // TODO redirect to console\r
             System.out.println("Tried to use an unloaded locale \"" + locale\r
                     + "\".");\r
@@ -55,7 +59,7 @@ public class DateLocale extends
     public String[] getWEEKDAY_SHORT() {\r
         try {\r
             return LocaleService.getShortDayNames(locale);\r
-        } catch (LocaleNotLoadedException e) {\r
+        } catch (final LocaleNotLoadedException e) {\r
             // TODO redirect to console\r
             System.out.println("Tried to use an unloaded locale \"" + locale\r
                     + "\".");\r
index 02d77730f95afcac71d70575c40a4cf316c50d13..1138412fcdeda94e801ceff9ca43e58efbce0985 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client;\r
 \r
 import java.util.Date;\r
@@ -56,7 +60,7 @@ public class DateTimeService {
     public String getMonth(int month) {\r
         try {\r
             return LocaleService.getMonthNames(currentLocale)[month];\r
-        } catch (LocaleNotLoadedException e) {\r
+        } catch (final LocaleNotLoadedException e) {\r
             // TODO redirect to console\r
             System.out.println(e + ":" + e.getMessage());\r
         }\r
@@ -66,7 +70,7 @@ public class DateTimeService {
     public String getShortMonth(int month) {\r
         try {\r
             return LocaleService.getShortMonthNames(currentLocale)[month];\r
-        } catch (LocaleNotLoadedException e) {\r
+        } catch (final LocaleNotLoadedException e) {\r
             // TODO redirect to console\r
             System.out.println(e + ":" + e.getMessage());\r
         }\r
@@ -76,7 +80,7 @@ public class DateTimeService {
     public String getDay(int day) {\r
         try {\r
             return LocaleService.getDayNames(currentLocale)[day];\r
-        } catch (LocaleNotLoadedException e) {\r
+        } catch (final LocaleNotLoadedException e) {\r
             // TODO redirect to console\r
             System.out.println(e + ":" + e.getMessage());\r
         }\r
@@ -86,7 +90,7 @@ public class DateTimeService {
     public String getShortDay(int day) {\r
         try {\r
             return LocaleService.getShortDayNames(currentLocale)[day];\r
-        } catch (LocaleNotLoadedException e) {\r
+        } catch (final LocaleNotLoadedException e) {\r
             // TODO redirect to console\r
             System.out.println(e + ":" + e.getMessage());\r
         }\r
@@ -96,7 +100,7 @@ public class DateTimeService {
     public int getFirstDayOfWeek() {\r
         try {\r
             return LocaleService.getFirstDayOfWeek(currentLocale);\r
-        } catch (LocaleNotLoadedException e) {\r
+        } catch (final LocaleNotLoadedException e) {\r
             // TODO redirect to console\r
             System.out.println(e + ":" + e.getMessage());\r
         }\r
@@ -106,7 +110,7 @@ public class DateTimeService {
     public boolean isTwelveHourClock() {\r
         try {\r
             return LocaleService.isTwelveHourClock(currentLocale);\r
-        } catch (LocaleNotLoadedException e) {\r
+        } catch (final LocaleNotLoadedException e) {\r
             // TODO redirect to console\r
             System.out.println(e + ":" + e.getMessage());\r
         }\r
@@ -116,7 +120,7 @@ public class DateTimeService {
     public String getClockDelimeter() {\r
         try {\r
             return LocaleService.getClockDelimiter(currentLocale);\r
-        } catch (LocaleNotLoadedException e) {\r
+        } catch (final LocaleNotLoadedException e) {\r
             // TODO redirect to console\r
             System.out.println(e + ":" + e.getMessage());\r
         }\r
@@ -126,23 +130,23 @@ public class DateTimeService {
     public String[] getAmPmStrings() {\r
         try {\r
             return LocaleService.getAmPmStrings(currentLocale);\r
-        } catch (LocaleNotLoadedException e) {\r
+        } catch (final LocaleNotLoadedException e) {\r
             // TODO redirect to console\r
             System.out.println(e + ":" + e.getMessage());\r
         }\r
-        String[] temp = new String[2];\r
+        final String[] temp = new String[2];\r
         temp[0] = "AM";\r
         temp[1] = "PM";\r
         return temp;\r
     }\r
 \r
     public int getStartWeekDay(Date date) {\r
-        Date dateForFirstOfThisMonth = new Date(date.getYear(),\r
-                date.getMonth(), 1);\r
+        final Date dateForFirstOfThisMonth = new Date(date.getYear(), date\r
+                .getMonth(), 1);\r
         int firstDay;\r
         try {\r
             firstDay = LocaleService.getFirstDayOfWeek(currentLocale);\r
-        } catch (LocaleNotLoadedException e) {\r
+        } catch (final LocaleNotLoadedException e) {\r
             firstDay = 0;\r
             // TODO redirect to console\r
             System.out.println(e + ":" + e.getMessage());\r
@@ -157,7 +161,7 @@ public class DateTimeService {
     public String getDateFormat() {\r
         try {\r
             return LocaleService.getDateFormat(currentLocale);\r
-        } catch (LocaleNotLoadedException e) {\r
+        } catch (final LocaleNotLoadedException e) {\r
             // TODO redirect to console\r
             System.out.println(e + ":" + e.getMessage());\r
         }\r
@@ -165,7 +169,7 @@ public class DateTimeService {
     }\r
 \r
     public static int getNumberOfDaysInMonth(Date date) {\r
-        int month = date.getMonth();\r
+        final int month = date.getMonth();\r
         if (month == 1 && true == isLeapYear(date)) {\r
             return 29;\r
         }\r
@@ -174,14 +178,14 @@ public class DateTimeService {
 \r
     public static boolean isLeapYear(Date date) {\r
         // Instantiate the date for 1st March of that year\r
-        Date firstMarch = new Date(date.getYear(), 2, 1);\r
+        final Date firstMarch = new Date(date.getYear(), 2, 1);\r
 \r
         // Go back 1 day\r
-        long firstMarchTime = firstMarch.getTime();\r
-        long lastDayTimeFeb = firstMarchTime - (24 * 60 * 60 * 1000); // NUM_MILLISECS_A_DAY\r
+        final long firstMarchTime = firstMarch.getTime();\r
+        final long lastDayTimeFeb = firstMarchTime - (24 * 60 * 60 * 1000); // NUM_MILLISECS_A_DAY\r
 \r
         // Instantiate new Date with this time\r
-        Date febLastDay = new Date(lastDayTimeFeb);\r
+        final Date febLastDay = new Date(lastDayTimeFeb);\r
 \r
         // Check for date in this new instance\r
         return (29 == febLastDay.getDate()) ? true : false;\r
@@ -241,9 +245,9 @@ public class DateTimeService {
     }\r
 \r
     private static int getDayInt(Date date) {\r
-        int y = date.getYear();\r
-        int m = date.getMonth();\r
-        int d = date.getDate();\r
+        final int y = date.getYear();\r
+        final int m = date.getMonth();\r
+        final int d = date.getDate();\r
 \r
         return ((y + 1900) * 10000 + m * 100 + d) * 1000000000;\r
     }\r
index 4b9d2b799a495f6ea15db4a26bd0cd456634179f..34a0452a677db2f7f2c526d8b071cccc71a365d2 100755 (executable)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 import com.google.gwt.user.client.Event;
@@ -11,13 +15,13 @@ import com.itmill.toolkit.terminal.gwt.client.ui.IWindow;
 
 public final class DebugConsole extends IWindow implements Console {
 
-    private Panel panel;
+    private final Panel panel;
 
     public DebugConsole(ApplicationConnection client) {
         super();
         this.client = client;
         panel = new FlowPanel();
-        ScrollPanel p = new ScrollPanel();
+        final ScrollPanel p = new ScrollPanel();
         p.add(panel);
         setWidget(p);
         setCaption("Debug window");
index 82ec62b81332449b79c08488a65f6569e6c4bb11..b846a50c17afd6462d5dde4ca9cf5a40bafdbeca 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 import com.google.gwt.core.client.GWT;
@@ -53,7 +57,7 @@ public class DefaultWidgetSet implements WidgetSet {
 
     public Widget createWidget(UIDL uidl) {
 
-        String className = resolveWidgetTypeName(uidl);
+        final String className = resolveWidgetTypeName(uidl);
         if ("com.itmill.toolkit.terminal.gwt.client.ui.ICheckBox"
                 .equals(className)) {
             return new ICheckBox();
@@ -174,7 +178,7 @@ public class DefaultWidgetSet implements WidgetSet {
 
     protected String resolveWidgetTypeName(UIDL uidl) {
 
-        String tag = uidl.getTag();
+        final String tag = uidl.getTag();
         if ("button".equals(tag)) {
             if ("switch".equals(uidl.getStringAttribute("type"))) {
                 return "com.itmill.toolkit.terminal.gwt.client.ui.ICheckBox";
@@ -199,7 +203,7 @@ public class DefaultWidgetSet implements WidgetSet {
             return "com.itmill.toolkit.terminal.gwt.client.ui.ITree";
         } else if ("select".equals(tag)) {
             if (uidl.hasAttribute("type")) {
-                String type = uidl.getStringAttribute("type");
+                final String type = uidl.getStringAttribute("type");
                 if (type.equals("twincol")) {
                     return "com.itmill.toolkit.terminal.gwt.client.ui.ITwinColSelect";
                 }
index 9df6900397cab71efa1f5bcdd75cf2aef9a72eb0..a90a00807dcb67315521474c95f43ed0f8df8e14 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 import java.util.Iterator;
@@ -18,16 +22,16 @@ public class ErrorMessage extends FlowPanel {
 
     public void updateFromUIDL(UIDL uidl) {
         clear();
-        for (Iterator it = uidl.getChildIterator(); it.hasNext();) {
-            Object child = it.next();
+        for (final Iterator it = uidl.getChildIterator(); it.hasNext();) {
+            final Object child = it.next();
             if (child instanceof String) {
-                String errorMessage = (String) child;
+                final String errorMessage = (String) child;
                 add(new HTML(errorMessage));
             } else if (child instanceof UIDL.XML) {
-                UIDL.XML xml = (UIDL.XML) child;
+                final UIDL.XML xml = (UIDL.XML) child;
                 add(new HTML(xml.getXMLAsString()));
             } else {
-                ErrorMessage childError = new ErrorMessage();
+                final ErrorMessage childError = new ErrorMessage();
                 add(childError);
                 childError.updateFromUIDL((UIDL) child);
             }
@@ -57,7 +61,7 @@ public class ErrorMessage extends FlowPanel {
     }
 
     public void hide() {
-        ToolkitOverlay errorContainer = (ToolkitOverlay) getParent();
+        final ToolkitOverlay errorContainer = (ToolkitOverlay) getParent();
         if (errorContainer != null) {
             errorContainer.hide();
         }
index 2ff8e09948d193f0828c39a20ddb49b91bf749a5..39c38bdd49b0b108167f0cea0404724842b4e6cb 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client;\r
 \r
 public class LocaleNotLoadedException extends Exception {\r
index 5a266aed91f4906a06b9bc8f3b754c7d2dc4e362..6b74b2c186ccb7ea52f95ed1fcb03ab5b4f31b76 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client;\r
 \r
 import java.util.HashMap;\r
@@ -23,7 +27,7 @@ public class LocaleService {
     private static String defaultLocale;\r
 \r
     public static void addLocale(JSONObject json) {\r
-        String key = ((JSONString) json.get("name")).stringValue();\r
+        final String key = ((JSONString) json.get("name")).stringValue();\r
         if (cache.containsKey(key)) {\r
             cache.remove(key);\r
         }\r
@@ -48,9 +52,9 @@ public class LocaleService {
     public static String[] getMonthNames(String locale)\r
             throws LocaleNotLoadedException {\r
         if (cache.containsKey(locale)) {\r
-            JSONObject l = (JSONObject) cache.get(locale);\r
-            JSONArray mn = (JSONArray) l.get("mn");\r
-            String[] temp = new String[12];\r
+            final JSONObject l = (JSONObject) cache.get(locale);\r
+            final JSONArray mn = (JSONArray) l.get("mn");\r
+            final String[] temp = new String[12];\r
             temp[0] = ((JSONString) mn.get(0)).stringValue();\r
             temp[1] = ((JSONString) mn.get(1)).stringValue();\r
             temp[2] = ((JSONString) mn.get(2)).stringValue();\r
@@ -72,9 +76,9 @@ public class LocaleService {
     public static String[] getShortMonthNames(String locale)\r
             throws LocaleNotLoadedException {\r
         if (cache.containsKey(locale)) {\r
-            JSONObject l = (JSONObject) cache.get(locale);\r
-            JSONArray smn = (JSONArray) l.get("smn");\r
-            String[] temp = new String[12];\r
+            final JSONObject l = (JSONObject) cache.get(locale);\r
+            final JSONArray smn = (JSONArray) l.get("smn");\r
+            final String[] temp = new String[12];\r
             temp[0] = ((JSONString) smn.get(0)).stringValue();\r
             temp[1] = ((JSONString) smn.get(1)).stringValue();\r
             temp[2] = ((JSONString) smn.get(2)).stringValue();\r
@@ -96,9 +100,9 @@ public class LocaleService {
     public static String[] getDayNames(String locale)\r
             throws LocaleNotLoadedException {\r
         if (cache.containsKey(locale)) {\r
-            JSONObject l = (JSONObject) cache.get(locale);\r
-            JSONArray dn = (JSONArray) l.get("dn");\r
-            String[] temp = new String[7];\r
+            final JSONObject l = (JSONObject) cache.get(locale);\r
+            final JSONArray dn = (JSONArray) l.get("dn");\r
+            final String[] temp = new String[7];\r
             temp[0] = ((JSONString) dn.get(0)).stringValue();\r
             temp[1] = ((JSONString) dn.get(1)).stringValue();\r
             temp[2] = ((JSONString) dn.get(2)).stringValue();\r
@@ -115,9 +119,9 @@ public class LocaleService {
     public static String[] getShortDayNames(String locale)\r
             throws LocaleNotLoadedException {\r
         if (cache.containsKey(locale)) {\r
-            JSONObject l = (JSONObject) cache.get(locale);\r
-            JSONArray sdn = (JSONArray) l.get("sdn");\r
-            String[] temp = new String[7];\r
+            final JSONObject l = (JSONObject) cache.get(locale);\r
+            final JSONArray sdn = (JSONArray) l.get("sdn");\r
+            final String[] temp = new String[7];\r
             temp[0] = ((JSONString) sdn.get(0)).stringValue();\r
             temp[1] = ((JSONString) sdn.get(1)).stringValue();\r
             temp[2] = ((JSONString) sdn.get(2)).stringValue();\r
@@ -134,8 +138,8 @@ public class LocaleService {
     public static int getFirstDayOfWeek(String locale)\r
             throws LocaleNotLoadedException {\r
         if (cache.containsKey(locale)) {\r
-            JSONObject l = (JSONObject) cache.get(locale);\r
-            JSONNumber fdow = (JSONNumber) l.get("fdow");\r
+            final JSONObject l = (JSONObject) cache.get(locale);\r
+            final JSONNumber fdow = (JSONNumber) l.get("fdow");\r
             return (int) fdow.getValue();\r
         } else {\r
             throw new LocaleNotLoadedException(locale);\r
@@ -145,8 +149,8 @@ public class LocaleService {
     public static String getDateFormat(String locale)\r
             throws LocaleNotLoadedException {\r
         if (cache.containsKey(locale)) {\r
-            JSONObject l = (JSONObject) cache.get(locale);\r
-            JSONString df = (JSONString) l.get("df");\r
+            final JSONObject l = (JSONObject) cache.get(locale);\r
+            final JSONString df = (JSONString) l.get("df");\r
             return df.stringValue();\r
         } else {\r
             throw new LocaleNotLoadedException(locale);\r
@@ -156,8 +160,8 @@ public class LocaleService {
     public static boolean isTwelveHourClock(String locale)\r
             throws LocaleNotLoadedException {\r
         if (cache.containsKey(locale)) {\r
-            JSONObject l = (JSONObject) cache.get(locale);\r
-            JSONBoolean thc = (JSONBoolean) l.get("thc");\r
+            final JSONObject l = (JSONObject) cache.get(locale);\r
+            final JSONBoolean thc = (JSONBoolean) l.get("thc");\r
             return thc.booleanValue();\r
         } else {\r
             throw new LocaleNotLoadedException(locale);\r
@@ -167,8 +171,8 @@ public class LocaleService {
     public static String getClockDelimiter(String locale)\r
             throws LocaleNotLoadedException {\r
         if (cache.containsKey(locale)) {\r
-            JSONObject l = (JSONObject) cache.get(locale);\r
-            JSONString hmd = (JSONString) l.get("hmd");\r
+            final JSONObject l = (JSONObject) cache.get(locale);\r
+            final JSONString hmd = (JSONString) l.get("hmd");\r
             return hmd.stringValue();\r
         } else {\r
             throw new LocaleNotLoadedException(locale);\r
@@ -178,9 +182,9 @@ public class LocaleService {
     public static String[] getAmPmStrings(String locale)\r
             throws LocaleNotLoadedException {\r
         if (cache.containsKey(locale)) {\r
-            JSONObject l = (JSONObject) cache.get(locale);\r
-            JSONArray ampm = (JSONArray) l.get("ampm");\r
-            String[] temp = new String[2];\r
+            final JSONObject l = (JSONObject) cache.get(locale);\r
+            final JSONArray ampm = (JSONArray) l.get("ampm");\r
+            final String[] temp = new String[2];\r
             temp[0] = ((JSONString) ampm.get(0)).stringValue();\r
             temp[1] = ((JSONString) ampm.get(1)).stringValue();\r
             return temp;\r
index ec81a7b11f028f6c79b4cbd55ad26950e0635fe1..2c158b6ab7dcc207bb39111ceb7698c14f04f82b 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 /**
index bfe73243dcd3e98815b535e71d93cda6eeb02f65..81c024be4cd390dfb9230e62f81c6873b6fc16cd 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 public interface Paintable {
index c7a752e5ff9a7c7a26cf246ea8052835ec1d15ba..35f1b5818ff8cc9ae569c8c2c393ebae48cb4a84 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 public class StyleConstants {
index 14ad0c6a318ae23fb1d88d49bfcbf56a13a5d6b6..1dffe8c3b2be2033056c966c9e4e09f95d9ece1f 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 import java.util.HashSet;
@@ -24,7 +28,7 @@ public class UIDL {
     }
 
     public String getId() {
-        JSONValue val = ((JSONObject) json.get(1)).get("id");
+        final JSONValue val = ((JSONObject) json.get(1)).get("id");
         if (val == null) {
             return null;
         }
@@ -36,7 +40,7 @@ public class UIDL {
     }
 
     public String getStringAttribute(String name) {
-        JSONValue val = ((JSONObject) json.get(1)).get(name);
+        final JSONValue val = ((JSONObject) json.get(1)).get(name);
         if (val == null) {
             return null;
         }
@@ -44,49 +48,49 @@ public class UIDL {
     }
 
     public Set getAttributeNames() {
-        HashSet attrs = new HashSet(((JSONObject) json.get(1)).keySet());
+        final HashSet attrs = new HashSet(((JSONObject) json.get(1)).keySet());
         attrs.remove("v");
         return attrs;
     }
 
     public int getIntAttribute(String name) {
-        JSONValue val = ((JSONObject) json.get(1)).get(name);
+        final JSONValue val = ((JSONObject) json.get(1)).get(name);
         if (val == null) {
             return 0;
         }
-        double num = ((JSONNumber) val).getValue();
+        final double num = ((JSONNumber) val).getValue();
         return (int) num;
     }
 
     public long getLongAttribute(String name) {
-        JSONValue val = ((JSONObject) json.get(1)).get(name);
+        final JSONValue val = ((JSONObject) json.get(1)).get(name);
         if (val == null) {
             return 0;
         }
-        double num = ((JSONNumber) val).getValue();
+        final double num = ((JSONNumber) val).getValue();
         return (long) num;
     }
 
     public float getFloatAttribute(String name) {
-        JSONValue val = ((JSONObject) json.get(1)).get(name);
+        final JSONValue val = ((JSONObject) json.get(1)).get(name);
         if (val == null) {
             return 0;
         }
-        double num = ((JSONNumber) val).getValue();
+        final double num = ((JSONNumber) val).getValue();
         return (float) num;
     }
 
     public double getDoubleAttribute(String name) {
-        JSONValue val = ((JSONObject) json.get(1)).get(name);
+        final JSONValue val = ((JSONObject) json.get(1)).get(name);
         if (val == null) {
             return 0;
         }
-        double num = ((JSONNumber) val).getValue();
+        final double num = ((JSONNumber) val).getValue();
         return num;
     }
 
     public boolean getBooleanAttribute(String name) {
-        JSONValue val = ((JSONObject) json.get(1)).get(name);
+        final JSONValue val = ((JSONObject) json.get(1)).get(name);
         if (val == null) {
             return false;
         }
@@ -94,8 +98,8 @@ public class UIDL {
     }
 
     public String[] getStringArrayAttribute(String name) {
-        JSONArray a = (JSONArray) ((JSONObject) json.get(1)).get(name);
-        String[] s = new String[a.size()];
+        final JSONArray a = (JSONArray) ((JSONObject) json.get(1)).get(name);
+        final String[] s = new String[a.size()];
         for (int i = 0; i < a.size(); i++) {
             s[i] = ((JSONString) a.get(i)).stringValue();
         }
@@ -103,8 +107,8 @@ public class UIDL {
     }
 
     public int[] getIntArrayAttribute(String name) {
-        JSONArray a = (JSONArray) ((JSONObject) json.get(1)).get(name);
-        int[] s = new int[a.size()];
+        final JSONArray a = (JSONArray) ((JSONObject) json.get(1)).get(name);
+        final int[] s = new int[a.size()];
         for (int i = 0; i < a.size(); i++) {
             s[i] = Integer.parseInt(((JSONString) a.get(i)).stringValue());
         }
@@ -112,8 +116,8 @@ public class UIDL {
     }
 
     public HashSet getStringArrayAttributeAsSet(String string) {
-        JSONArray a = getArrayVariable(string);
-        HashSet s = new HashSet();
+        final JSONArray a = getArrayVariable(string);
+        final HashSet s = new HashSet();
         for (int i = 0; i < a.size(); i++) {
             s.add(((JSONString) a.get(i)).stringValue());
         }
@@ -136,7 +140,7 @@ public class UIDL {
 
     public UIDL getChildUIDL(int i) {
 
-        JSONValue c = json.get(i + 2);
+        final JSONValue c = json.get(i + 2);
         if (c == null) {
             return null;
         }
@@ -149,7 +153,7 @@ public class UIDL {
 
     public String getChildString(int i) {
 
-        JSONValue c = json.get(i + 2);
+        final JSONValue c = json.get(i + 2);
         if (c.isString() != null) {
             return ((JSONString) c).stringValue();
         }
@@ -170,7 +174,7 @@ public class UIDL {
             public Object next() {
 
                 if (json.size() > index) {
-                    JSONValue c = json.get(index++);
+                    final JSONValue c = json.get(index++);
                     if (c.isString() != null) {
                         return c.isString().stringValue();
                     } else if (c.isArray() != null) {
@@ -199,10 +203,10 @@ public class UIDL {
     public String toString() {
         String s = "<" + getTag();
 
-        for (Iterator i = getAttributeNames().iterator(); i.hasNext();) {
-            String name = i.next().toString();
+        for (final Iterator i = getAttributeNames().iterator(); i.hasNext();) {
+            final String name = i.next().toString();
             s += " " + name + "=";
-            JSONValue v = ((JSONObject) json.get(1)).get(name);
+            final JSONValue v = ((JSONObject) json.get(1)).get(name);
             if (v.isString() != null) {
                 s += v;
             } else {
@@ -212,9 +216,9 @@ public class UIDL {
 
         s += ">\n";
 
-        Iterator i = getChildIterator();
+        final Iterator i = getChildIterator();
         while (i.hasNext()) {
-            Object c = i.next();
+            final Object c = i.next();
             s += c.toString();
         }
 
@@ -225,9 +229,9 @@ public class UIDL {
 
     public String getChildrenAsXML() {
         String s = "";
-        Iterator i = getChildIterator();
+        final Iterator i = getChildIterator();
         while (i.hasNext()) {
-            Object c = i.next();
+            final Object c = i.next();
             s += c.toString();
         }
         return s;
@@ -252,7 +256,7 @@ public class UIDL {
                         removeItem(root);
                         UIDLBrowser.this.removeTreeListener(this);
                         addItem(dir());
-                        Iterator it = treeItemIterator();
+                        final Iterator it = treeItemIterator();
                         while (it.hasNext()) {
                             ((TreeItem) it.next()).setState(true);
                         }
@@ -275,30 +279,30 @@ public class UIDL {
     public TreeItem dir() {
 
         String nodeName = getTag();
-        for (Iterator i = getAttributeNames().iterator(); i.hasNext();) {
-            String name = i.next().toString();
-            String value = getAttribute(name);
+        for (final Iterator i = getAttributeNames().iterator(); i.hasNext();) {
+            final String name = i.next().toString();
+            final String value = getAttribute(name);
             nodeName += " " + name + "=" + value;
         }
-        TreeItem item = new TreeItem(nodeName);
+        final TreeItem item = new TreeItem(nodeName);
 
         try {
             TreeItem tmp = null;
-            for (Iterator i = getVariableHash().keySet().iterator(); i
+            for (final Iterator i = getVariableHash().keySet().iterator(); i
                     .hasNext();) {
-                String name = i.next().toString();
+                final String name = i.next().toString();
                 String value = "";
                 try {
                     value = getStringVariable(name);
-                } catch (Exception e) {
+                } catch (final Exception e) {
                     try {
-                        JSONArray a = getArrayVariable(name);
+                        final JSONArray a = getArrayVariable(name);
                         value = a.toString();
-                    } catch (Exception e2) {
+                    } catch (final Exception e2) {
                         try {
-                            int intVal = getIntVariable(name);
+                            final int intVal = getIntVariable(name);
                             value = String.valueOf(intVal);
-                        } catch (Exception e3) {
+                        } catch (final Exception e3) {
                             value = "unknown";
                         }
                     }
@@ -311,18 +315,18 @@ public class UIDL {
             if (tmp != null) {
                 item.addItem(tmp);
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             // Ingonered, no variables
         }
 
-        Iterator i = getChildIterator();
+        final Iterator i = getChildIterator();
         while (i.hasNext()) {
-            Object child = i.next();
+            final Object child = i.next();
             try {
-                UIDL c = (UIDL) child;
+                final UIDL c = (UIDL) child;
                 item.addItem(c.dir());
 
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 item.addItem(child.toString());
             }
         }
@@ -330,7 +334,7 @@ public class UIDL {
     }
 
     private JSONObject getVariableHash() {
-        JSONObject v = (JSONObject) ((JSONObject) json.get(1)).get("v");
+        final JSONObject v = (JSONObject) ((JSONObject) json.get(1)).get("v");
         if (v == null) {
             throw new IllegalArgumentException("No variables defined in tag.");
         }
@@ -341,13 +345,13 @@ public class UIDL {
         Object v = null;
         try {
             v = getVariableHash().get(name);
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
         }
         return v != null;
     }
 
     public String getStringVariable(String name) {
-        JSONString t = (JSONString) getVariableHash().get(name);
+        final JSONString t = (JSONString) getVariableHash().get(name);
         if (t == null) {
             throw new IllegalArgumentException("No such variable: " + name);
         }
@@ -355,7 +359,7 @@ public class UIDL {
     }
 
     public int getIntVariable(String name) {
-        JSONNumber t = (JSONNumber) getVariableHash().get(name);
+        final JSONNumber t = (JSONNumber) getVariableHash().get(name);
         if (t == null) {
             throw new IllegalArgumentException("No such variable: " + name);
         }
@@ -363,7 +367,7 @@ public class UIDL {
     }
 
     public long getLongVariable(String name) {
-        JSONNumber t = (JSONNumber) getVariableHash().get(name);
+        final JSONNumber t = (JSONNumber) getVariableHash().get(name);
         if (t == null) {
             throw new IllegalArgumentException("No such variable: " + name);
         }
@@ -371,7 +375,7 @@ public class UIDL {
     }
 
     public float getFloatVariable(String name) {
-        JSONNumber t = (JSONNumber) getVariableHash().get(name);
+        final JSONNumber t = (JSONNumber) getVariableHash().get(name);
         if (t == null) {
             throw new IllegalArgumentException("No such variable: " + name);
         }
@@ -379,7 +383,7 @@ public class UIDL {
     }
 
     public double getDoubleVariable(String name) {
-        JSONNumber t = (JSONNumber) getVariableHash().get(name);
+        final JSONNumber t = (JSONNumber) getVariableHash().get(name);
         if (t == null) {
             throw new IllegalArgumentException("No such variable: " + name);
         }
@@ -387,7 +391,7 @@ public class UIDL {
     }
 
     public boolean getBooleanVariable(String name) {
-        JSONBoolean t = (JSONBoolean) getVariableHash().get(name);
+        final JSONBoolean t = (JSONBoolean) getVariableHash().get(name);
         if (t == null) {
             throw new IllegalArgumentException("No such variable: " + name);
         }
@@ -395,7 +399,7 @@ public class UIDL {
     }
 
     private JSONArray getArrayVariable(String name) {
-        JSONArray t = (JSONArray) getVariableHash().get(name);
+        final JSONArray t = (JSONArray) getVariableHash().get(name);
         if (t == null) {
             throw new IllegalArgumentException("No such variable: " + name);
         }
@@ -403,8 +407,8 @@ public class UIDL {
     }
 
     public String[] getStringArrayVariable(String name) {
-        JSONArray a = getArrayVariable(name);
-        String[] s = new String[a.size()];
+        final JSONArray a = getArrayVariable(name);
+        final String[] s = new String[a.size()];
         for (int i = 0; i < a.size(); i++) {
             s[i] = ((JSONString) a.get(i)).stringValue();
         }
@@ -412,8 +416,8 @@ public class UIDL {
     }
 
     public Set getStringArrayVariableAsSet(String name) {
-        JSONArray a = getArrayVariable(name);
-        HashSet s = new HashSet();
+        final JSONArray a = getArrayVariable(name);
+        final HashSet s = new HashSet();
         for (int i = 0; i < a.size(); i++) {
             s.add(((JSONString) a.get(i)).stringValue());
         }
@@ -421,10 +425,10 @@ public class UIDL {
     }
 
     public int[] getIntArrayVariable(String name) {
-        JSONArray a = getArrayVariable(name);
-        int[] s = new int[a.size()];
+        final JSONArray a = getArrayVariable(name);
+        final int[] s = new int[a.size()];
         for (int i = 0; i < a.size(); i++) {
-            JSONValue v = a.get(i);
+            final JSONValue v = a.get(i);
             s[i] = v.isNumber() != null ? (int) ((JSONNumber) v).getValue()
                     : Integer.parseInt(v.toString());
         }
@@ -439,9 +443,9 @@ public class UIDL {
         }
 
         public String getXMLAsString() {
-            StringBuffer sb = new StringBuffer();
-            for (Iterator it = x.keySet().iterator(); it.hasNext();) {
-                String tag = (String) it.next();
+            final StringBuffer sb = new StringBuffer();
+            for (final Iterator it = x.keySet().iterator(); it.hasNext();) {
+                final String tag = (String) it.next();
                 sb.append("<");
                 sb.append(tag);
                 sb.append(">");
@@ -459,7 +463,7 @@ public class UIDL {
     }
 
     public UIDL getErrors() {
-        JSONArray a = (JSONArray) ((JSONObject) json.get(1)).get("error");
+        final JSONArray a = (JSONArray) ((JSONObject) json.get(1)).get("error");
         return new UIDL(a);
     }
 
index a1fad8258d653bd9f2393f6ecbbe7c7394b082e3..be75d449b6bf4df7e1211d35087b0a3f816c2170 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 import java.util.Iterator;
@@ -15,9 +19,9 @@ public class Util {
      * 
      */
     public static native void browserDebugger() /*-{
-                       if(window.console)
-                               debugger;
-                   }-*/;
+                               if(window.console)
+                                       debugger;
+                         }-*/;
 
     /**
      * Detects if current browser is IE.
@@ -25,12 +29,12 @@ public class Util {
      * @return true if IE
      */
     public static native boolean isIE() /*-{
-                       var browser=$wnd.navigator.appName;
-                       if (browser=="Microsoft Internet Explorer") {
-                               return true;
-                       }
-                       return false;
-                   }-*/;
+                               var browser=$wnd.navigator.appName;
+                               if (browser=="Microsoft Internet Explorer") {
+                                       return true;
+                               }
+                               return false;
+                         }-*/;
 
     /**
      * Detects if current browser is IE6.
@@ -38,16 +42,16 @@ public class Util {
      * @return true if IE6
      */
     public static native boolean isIE6() /*-{
-                       var browser=$wnd.navigator.appName;
-                       if (browser=="Microsoft Internet Explorer") {
-                               var ua = navigator.userAgent;
-                               var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
-                               if (re.exec(ua) != null)
-                                       rv = parseFloat(RegExp.$1);
-                                       if(rv == 6) return true;
-                       }
-                       return false;
-                   }-*/;
+                               var browser=$wnd.navigator.appName;
+                               if (browser=="Microsoft Internet Explorer") {
+                                       var ua = navigator.userAgent;
+                                       var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
+                                       if (re.exec(ua) != null)
+                                       rv = parseFloat(RegExp.$1);
+                                       if(rv == 6) return true;
+                               }
+                               return false;
+                         }-*/;
 
     /**
      * Nulls oncontextmenu function on given element. We need to manually clear
@@ -57,8 +61,8 @@ public class Util {
      * @param el
      */
     public native static void removeContextMenuEvent(Element el) /*-{
-                       el.oncontextmenu = null;
-                   }-*/;
+                               el.oncontextmenu = null;
+                         }-*/;
 
     /**
      * Traverses recursively ancestors until ContainerResizedListener child
@@ -67,13 +71,13 @@ public class Util {
      * @param container
      */
     public static void runDescendentsLayout(HasWidgets container) {
-        Iterator childWidgets = container.iterator();
+        final Iterator childWidgets = container.iterator();
         while (childWidgets.hasNext()) {
-            Widget child = (Widget) childWidgets.next();
+            final Widget child = (Widget) childWidgets.next();
             if (child instanceof ContainerResizedListener) {
                 ((ContainerResizedListener) child).iLayout();
             } else if (child instanceof HasWidgets) {
-                HasWidgets childContainer = (HasWidgets) child;
+                final HasWidgets childContainer = (HasWidgets) child;
                 runDescendentsLayout(childContainer);
             }
         }
index c975830252884ae8f4d3504b6194f774bc6dbee7..e55da2c33df87adda060896a5551d9704c7c852e 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client;
 
 import com.google.gwt.core.client.EntryPoint;
index 58d7d679c08655767d5cebed2c8b64a4a638ae50..4c1cf2626d101b1021a0c23c8d0722a8ebc32a3a 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.Command;
@@ -24,7 +28,7 @@ public abstract class Action implements Command {
     public abstract void execute();
 
     public String getHTML() {
-        StringBuffer sb = new StringBuffer();
+        final StringBuffer sb = new StringBuffer();
         sb.append("<div>");
         if (getIconUrl() != null) {
             sb.append("<img src=\"" + getIconUrl() + "\" alt=\"icon\" />");
index 0a2f48ab005b3841af5bcceb09072f9568b1aade..68024d849a74751a7ff0dd0c3204df01f6d5a17e 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 public class AlignmentInfo {
index edf0de98bd10f6258512925ea1123a4f6a444c3c..551c458ed6a919b90800a9e12188c99a36850456 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import java.util.Date;\r
@@ -5,7 +9,7 @@ import java.util.Date;
 import com.itmill.toolkit.terminal.gwt.client.DateTimeService;\r
 \r
 public class CalendarEntry {\r
-    private String styleName;\r
+    private final String styleName;\r
     private Date start;\r
     private Date end;\r
     private String title;\r
index 216bf95a3a3975b70893c829e25888f4e2a37807..5173831811873d3661376b80d780e976b795b244 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import java.util.Date;\r
@@ -21,7 +25,7 @@ import com.itmill.toolkit.terminal.gwt.client.LocaleService;
 public class CalendarPanel extends FlexTable implements MouseListener,\r
         ClickListener {\r
 \r
-    private IDateField datefield;\r
+    private final IDateField datefield;\r
 \r
     private IEventButton prevYear;\r
 \r
@@ -60,9 +64,9 @@ public class CalendarPanel extends FlexTable implements MouseListener,
     }\r
 \r
     private void buildCalendar(boolean forceRedraw) {\r
-        boolean needsMonth = datefield.getCurrentResolution() > IDateField.RESOLUTION_YEAR;\r
+        final boolean needsMonth = datefield.getCurrentResolution() > IDateField.RESOLUTION_YEAR;\r
         boolean needsBody = datefield.getCurrentResolution() >= IDateField.RESOLUTION_DAY;\r
-        boolean needsTime = datefield.getCurrentResolution() >= IDateField.RESOLUTION_HOUR;\r
+        final boolean needsTime = datefield.getCurrentResolution() >= IDateField.RESOLUTION_HOUR;\r
         buildCalendarHeader(forceRedraw, needsMonth);\r
         clearCalendarBody(!needsBody);\r
         if (needsBody) {\r
@@ -142,7 +146,8 @@ public class CalendarPanel extends FlexTable implements MouseListener,
             }\r
 \r
             // Print weekday names\r
-            int firstDay = datefield.getDateTimeService().getFirstDayOfWeek();\r
+            final int firstDay = datefield.getDateTimeService()\r
+                    .getFirstDayOfWeek();\r
             for (int i = 0; i < 7; i++) {\r
                 int day = i + firstDay;\r
                 if (day > 6) {\r
@@ -158,9 +163,9 @@ public class CalendarPanel extends FlexTable implements MouseListener,
             }\r
         }\r
 \r
-        String monthName = needsMonth ? datefield.getDateTimeService()\r
+        final String monthName = needsMonth ? datefield.getDateTimeService()\r
                 .getMonth(datefield.getCurrentDate().getMonth()) : "";\r
-        int year = datefield.getCurrentDate().getYear() + 1900;\r
+        final int year = datefield.getCurrentDate().getYear() + 1900;\r
         setHTML(0, 2, "<span class=\"" + IDateField.CLASSNAME\r
                 + "-calendarpanel-month\">" + monthName + " " + year\r
                 + "</span>");\r
@@ -171,32 +176,33 @@ public class CalendarPanel extends FlexTable implements MouseListener,
         if (date == null) {\r
             date = new Date();\r
         }\r
-        int startWeekDay = datefield.getDateTimeService().getStartWeekDay(date);\r
-        int numDays = DateTimeService.getNumberOfDaysInMonth(date);\r
+        final int startWeekDay = datefield.getDateTimeService()\r
+                .getStartWeekDay(date);\r
+        final int numDays = DateTimeService.getNumberOfDaysInMonth(date);\r
         int dayCount = 0;\r
-        Date today = new Date();\r
-        Date curr = new Date(date.getTime());\r
+        final Date today = new Date();\r
+        final Date curr = new Date(date.getTime());\r
         for (int row = 2; row < 8; row++) {\r
             for (int col = 0; col < 7; col++) {\r
                 if (!(row == 2 && col < startWeekDay)) {\r
                     if (dayCount < numDays) {\r
-                        int selectedDate = ++dayCount;\r
+                        final int selectedDate = ++dayCount;\r
                         String title = "";\r
                         if (entrySource != null) {\r
                             curr.setDate(dayCount);\r
-                            List entries = entrySource.getEntries(curr,\r
+                            final List entries = entrySource.getEntries(curr,\r
                                     IDateField.RESOLUTION_DAY);\r
                             if (entries != null) {\r
-                                for (Iterator it = entries.iterator(); it\r
+                                for (final Iterator it = entries.iterator(); it\r
                                         .hasNext();) {\r
-                                    CalendarEntry entry = (CalendarEntry) it\r
+                                    final CalendarEntry entry = (CalendarEntry) it\r
                                             .next();\r
                                     title += (title.length() > 0 ? ", " : "")\r
                                             + entry.getStringForDate(curr);\r
                                 }\r
                             }\r
                         }\r
-                        String baseclass = IDateField.CLASSNAME\r
+                        final String baseclass = IDateField.CLASSNAME\r
                                 + "-calendarpanel-day";\r
                         String cssClass = baseclass;\r
                         if (!isEnabledDate(curr)) {\r
@@ -371,7 +377,7 @@ public class CalendarPanel extends FlexTable implements MouseListener,
 \r
     private class DateClickListener implements TableListener {\r
 \r
-        private CalendarPanel cal;\r
+        private final CalendarPanel cal;\r
 \r
         public DateClickListener(CalendarPanel panel) {\r
             cal = panel;\r
@@ -383,14 +389,14 @@ public class CalendarPanel extends FlexTable implements MouseListener,
                 return;\r
             }\r
 \r
-            String text = cal.getText(row, col);\r
+            final String text = cal.getText(row, col);\r
             if (text.equals(" ")) {\r
                 return;\r
             }\r
 \r
             try {\r
-                Integer day = new Integer(text);\r
-                Date newDate = new Date(cal.datefield.getCurrentDate()\r
+                final Integer day = new Integer(text);\r
+                final Date newDate = new Date(cal.datefield.getCurrentDate()\r
                         .getTime());\r
                 newDate.setDate(day.intValue());\r
                 if (!isEnabledDate(newDate)) {\r
@@ -402,7 +408,7 @@ public class CalendarPanel extends FlexTable implements MouseListener,
                         cal.datefield.isImmediate());\r
 \r
                 updateCalendar();\r
-            } catch (NumberFormatException e) {\r
+            } catch (final NumberFormatException e) {\r
                 // Not a number, ignore and stop here\r
                 return;\r
             }\r
@@ -412,7 +418,7 @@ public class CalendarPanel extends FlexTable implements MouseListener,
 \r
     public void setLimits(Date min, Date max) {\r
         if (min != null) {\r
-            Date d = new Date(min.getTime());\r
+            final Date d = new Date(min.getTime());\r
             d.setHours(0);\r
             d.setMinutes(0);\r
             d.setSeconds(1);\r
@@ -421,7 +427,7 @@ public class CalendarPanel extends FlexTable implements MouseListener,
             minDate = null;\r
         }\r
         if (max != null) {\r
-            Date d = new Date(max.getTime());\r
+            final Date d = new Date(max.getTime());\r
             d.setHours(24);\r
             d.setMinutes(59);\r
             d.setSeconds(59);\r
index 000c6a095f6b84db0745018b237d4efa8dcbf30e..b3c14ba321e21e5281d7b82102e9f1d56dc89062 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.Window;
@@ -9,7 +13,7 @@ public class ContextMenu extends ToolkitOverlay {
 
     private ActionOwner actionOwner;
 
-    private CMenuBar menu = new CMenuBar();
+    private final CMenuBar menu = new CMenuBar();
 
     private int left;
 
@@ -47,9 +51,9 @@ public class ContextMenu extends ToolkitOverlay {
         this.left = left;
         this.top = top;
         menu.clearItems();
-        Action[] actions = actionOwner.getActions();
+        final Action[] actions = actionOwner.getActions();
         for (int i = 0; i < actions.length; i++) {
-            Action a = actions[i];
+            final Action a = actions[i];
             menu.addItem(new MenuItem(a.getHTML(), true, a));
         }
 
index 74b211bb0b01043c222484eb74c72f2ad1a1683c..b69cb0761ae952510cb46009eb42e5916c3ba3f1 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.DOM;
@@ -21,7 +25,7 @@ public class IButton extends Button implements Paintable {
 
     private Element errorIndicatorElement;
 
-    private Element captionElement = DOM.createSpan();
+    private final Element captionElement = DOM.createSpan();
 
     private ErrorMessage errorMessage;
 
@@ -64,7 +68,7 @@ public class IButton extends Button implements Paintable {
 
         // handle error
         if (uidl.hasAttribute("error")) {
-            UIDL errorUidl = uidl.getErrors();
+            final UIDL errorUidl = uidl.getErrors();
             if (errorIndicatorElement == null) {
                 errorIndicatorElement = DOM.createDiv();
                 DOM.setElementProperty(errorIndicatorElement, "className",
@@ -110,7 +114,7 @@ public class IButton extends Button implements Paintable {
     }
 
     public void onBrowserEvent(Event event) {
-        Element target = DOM.eventGetTarget(event);
+        final Element target = DOM.eventGetTarget(event);
         if (errorIndicatorElement != null
                 && DOM.compare(target, errorIndicatorElement)) {
             switch (DOM.eventGetType(event)) {
index 8fb87ae06b5f57aa7b7abcdaa662b19430f694c6..d2edbd3a2810370a329b519326f9aa729cc9e9b5 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.DOM;
@@ -53,7 +57,7 @@ public class ICheckBox extends com.google.gwt.user.client.ui.CheckBox implements
         }
 
         if (uidl.hasAttribute("error")) {
-            UIDL errorUidl = uidl.getErrors();
+            final UIDL errorUidl = uidl.getErrors();
 
             if (errorIndicatorElement == null) {
                 errorIndicatorElement = DOM.createDiv();
@@ -95,7 +99,7 @@ public class ICheckBox extends com.google.gwt.user.client.ui.CheckBox implements
 
     public void onBrowserEvent(Event event) {
         super.onBrowserEvent(event);
-        Element target = DOM.eventGetTarget(event);
+        final Element target = DOM.eventGetTarget(event);
         if (errorIndicatorElement != null
                 && DOM.compare(target, errorIndicatorElement)) {
             switch (DOM.eventGetType(event)) {
index 73deb42e184a47abc77c498cbe06f171a8c9f702..ba79476fe3aeabb5ef94d1cbcb31920556732716 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.ui.SimplePanel;
@@ -17,9 +21,9 @@ public class ICustomComponent extends SimplePanel implements Paintable {
 
     public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
 
-        UIDL child = uidl.getChildUIDL(0);
+        final UIDL child = uidl.getChildUIDL(0);
         if (child != null) {
-            Paintable p = (Paintable) client.getWidget(child);
+            final Paintable p = (Paintable) client.getWidget(child);
             if (p != getWidget()) {
                 if (getWidget() != null) {
                     client.unregisterPaintable((Paintable) getWidget());
index 62d7cb7fcf4c26c3d1c4e84c5c77f02eb7388219..0bd60001f77d55dbd16eb19fd4a5a9486bec7ef6 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.HashMap;
@@ -28,13 +32,13 @@ public class ICustomLayout extends ComplexPanel implements Paintable,
     public static final String CLASSNAME = "i-customlayout";
 
     /** Location-name to containing element in DOM map */
-    private HashMap locationToElement = new HashMap();
+    private final HashMap locationToElement = new HashMap();
 
     /** Location-name to contained widget map */
-    private HashMap locationToWidget = new HashMap();
+    private final HashMap locationToWidget = new HashMap();
 
     /** Widget to captionwrapper map */
-    private HashMap widgetToCaptionWrapper = new HashMap();
+    private final HashMap widgetToCaptionWrapper = new HashMap();
 
     /** Currently rendered style */
     String currentTemplate;
@@ -84,7 +88,7 @@ public class ICustomLayout extends ComplexPanel implements Paintable,
         }
 
         // Get previous widget
-        Widget previous = (Widget) locationToWidget.get(location);
+        final Widget previous = (Widget) locationToWidget.get(location);
         // NOP if given widget already exists in this location
         if (previous == widget) {
             return;
@@ -135,16 +139,17 @@ public class ICustomLayout extends ComplexPanel implements Paintable,
         iLayout();
 
         // For all contained widgets
-        for (Iterator i = uidl.getChildIterator(); i.hasNext();) {
-            UIDL uidlForChild = (UIDL) i.next();
+        for (final Iterator i = uidl.getChildIterator(); i.hasNext();) {
+            final UIDL uidlForChild = (UIDL) i.next();
             if (uidlForChild.getTag().equals("location")) {
-                String location = uidlForChild.getStringAttribute("name");
-                Widget child = client.getWidget(uidlForChild.getChildUIDL(0));
+                final String location = uidlForChild.getStringAttribute("name");
+                final Widget child = client.getWidget(uidlForChild
+                        .getChildUIDL(0));
                 try {
                     setWidget(child, location);
                     ((Paintable) child).updateFromUIDL(uidlForChild
                             .getChildUIDL(0), client);
-                } catch (IllegalArgumentException e) {
+                } catch (final IllegalArgumentException e) {
                     // If no location is found, this component is not visible
                 }
             }
@@ -156,7 +161,7 @@ public class ICustomLayout extends ComplexPanel implements Paintable,
     /** Initialize HTML-layout. */
     private void initializeHTML(UIDL uidl, ApplicationConnection client) {
 
-        String newTemplate = uidl.getStringAttribute("template");
+        final String newTemplate = uidl.getStringAttribute("template");
 
         // Get the HTML-template from client
         String template = client
@@ -219,12 +224,12 @@ public class ICustomLayout extends ComplexPanel implements Paintable,
     /** Collect locations from template */
     private void scanForLocations(Element elem) {
 
-        String location = getLocation(elem);
+        final String location = getLocation(elem);
         if (location != null) {
             locationToElement.put(location, elem);
             DOM.setInnerHTML(elem, "");
         } else {
-            int len = DOM.getChildCount(elem);
+            final int len = DOM.getChildCount(elem);
             for (int i = 0; i < len; i++) {
                 scanForLocations(DOM.getChild(elem, i));
             }
@@ -291,7 +296,7 @@ public class ICustomLayout extends ComplexPanel implements Paintable,
         while (scriptStart > 0) {
             res += html.substring(endOfPrevScript, scriptStart);
             scriptStart = lc.indexOf(">", scriptStart);
-            int j = lc.indexOf("</script>", scriptStart);
+            final int j = lc.indexOf("</script>", scriptStart);
             scripts += html.substring(scriptStart + 1, j) + ";";
             nextPosToCheck = endOfPrevScript = j + "</script>".length();
             scriptStart = lc.indexOf("<script", nextPosToCheck);
@@ -307,7 +312,7 @@ public class ICustomLayout extends ComplexPanel implements Paintable,
         } else {
             res = "";
             startOfBody = lc.indexOf(">", startOfBody) + 1;
-            int endOfBody = lc.indexOf("</body>", startOfBody);
+            final int endOfBody = lc.indexOf("</body>", startOfBody);
             if (endOfBody > startOfBody) {
                 res = html.substring(startOfBody, endOfBody);
             } else {
@@ -320,7 +325,7 @@ public class ICustomLayout extends ComplexPanel implements Paintable,
 
     /** Replace child components */
     public void replaceChildComponent(Widget from, Widget to) {
-        String location = getLocation(from);
+        final String location = getLocation(from);
         if (location == null) {
             throw new IllegalArgumentException();
         }
@@ -338,7 +343,7 @@ public class ICustomLayout extends ComplexPanel implements Paintable,
                 .get(component);
         if (Caption.isNeeded(uidl)) {
             if (wrapper == null) {
-                String loc = getLocation((Widget) component);
+                final String loc = getLocation((Widget) component);
                 super.remove((Widget) component);
                 wrapper = new CaptionWrapper(component, client);
                 super.add(wrapper, (Element) locationToElement.get(loc));
@@ -347,7 +352,7 @@ public class ICustomLayout extends ComplexPanel implements Paintable,
             wrapper.updateCaption(uidl);
         } else {
             if (wrapper != null) {
-                String loc = getLocation((Widget) component);
+                final String loc = getLocation((Widget) component);
                 super.remove(wrapper);
                 super.add((Widget) wrapper.getPaintable(),
                         (Element) locationToElement.get(loc));
@@ -358,8 +363,9 @@ public class ICustomLayout extends ComplexPanel implements Paintable,
 
     /** Get the location of an widget */
     public String getLocation(Widget w) {
-        for (Iterator i = locationToWidget.keySet().iterator(); i.hasNext();) {
-            String location = (String) i.next();
+        for (final Iterator i = locationToWidget.keySet().iterator(); i
+                .hasNext();) {
+            final String location = (String) i.next();
             if (locationToWidget.get(location) == w) {
                 return location;
             }
@@ -370,11 +376,12 @@ public class ICustomLayout extends ComplexPanel implements Paintable,
     /** Removes given widget from the layout */
     public boolean remove(Widget w) {
         client.unregisterPaintable((Paintable) w);
-        String location = getLocation(w);
+        final String location = getLocation(w);
         if (location != null) {
             locationToWidget.remove(location);
         }
-        CaptionWrapper cw = (CaptionWrapper) widgetToCaptionWrapper.get(w);
+        final CaptionWrapper cw = (CaptionWrapper) widgetToCaptionWrapper
+                .get(w);
         if (cw != null) {
             widgetToCaptionWrapper.remove(w);
             return super.remove(cw);
index b039ab22f7215ebf0dace1e629dfc40e6b10f589..069cd821b4b3bd6c3dfb82f093c833616b83c170 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import java.util.Date;\r
@@ -59,11 +63,11 @@ public class IDateField extends FlowPanel implements Paintable {
         enabled = !uidl.getBooleanAttribute("disabled");\r
 \r
         if (uidl.hasAttribute("locale")) {\r
-            String locale = uidl.getStringAttribute("locale");\r
+            final String locale = uidl.getStringAttribute("locale");\r
             try {\r
                 dts.setLocale(locale);\r
                 currentLocale = locale;\r
-            } catch (LocaleNotLoadedException e) {\r
+            } catch (final LocaleNotLoadedException e) {\r
                 currentLocale = dts.getLocale();\r
                 // TODO redirect this to console\r
                 System.out.println("Tried to use an unloaded locale \""\r
@@ -91,18 +95,18 @@ public class IDateField extends FlowPanel implements Paintable {
 \r
         currentResolution = newResolution;\r
 \r
-        int year = uidl.getIntVariable("year");\r
-        int month = (currentResolution >= RESOLUTION_MONTH) ? uidl\r
+        final int year = uidl.getIntVariable("year");\r
+        final int month = (currentResolution >= RESOLUTION_MONTH) ? uidl\r
                 .getIntVariable("month") : -1;\r
-        int day = (currentResolution >= RESOLUTION_DAY) ? uidl\r
+        final int day = (currentResolution >= RESOLUTION_DAY) ? uidl\r
                 .getIntVariable("day") : -1;\r
-        int hour = (currentResolution >= RESOLUTION_HOUR) ? uidl\r
+        final int hour = (currentResolution >= RESOLUTION_HOUR) ? uidl\r
                 .getIntVariable("hour") : -1;\r
-        int min = (currentResolution >= RESOLUTION_MIN) ? uidl\r
+        final int min = (currentResolution >= RESOLUTION_MIN) ? uidl\r
                 .getIntVariable("min") : -1;\r
-        int sec = (currentResolution >= RESOLUTION_SEC) ? uidl\r
+        final int sec = (currentResolution >= RESOLUTION_SEC) ? uidl\r
                 .getIntVariable("sec") : -1;\r
-        int msec = (currentResolution >= RESOLUTION_MSEC) ? uidl\r
+        final int msec = (currentResolution >= RESOLUTION_MSEC) ? uidl\r
                 .getIntVariable("msec") : -1;\r
 \r
         // Construct new date for this datefield (only if not null)\r
@@ -119,22 +123,22 @@ public class IDateField extends FlowPanel implements Paintable {
      */\r
     private static native double getTime(int y, int m, int d, int h, int mi,\r
             int s, int ms) /*-{\r
-                   try {\r
-                       var date = new Date();\r
-                       if(y && y >= 0) date.setFullYear(y);\r
-                       if(m && m >= 1) date.setMonth(m-1);\r
-                       if(d && d >= 0) date.setDate(d);\r
-                       if(h && h >= 0) date.setHours(h);\r
-                       if(mi && mi >= 0) date.setMinutes(mi);\r
-                       if(s && s >= 0) date.setSeconds(s);\r
-                       if(ms && ms >= 0) date.setMilliseconds(ms);\r
-                       return date.getTime();\r
-                   } catch (e) {\r
-                       // TODO print some error message on the console\r
-                       //console.log(e);\r
-                       return (new Date()).getTime();\r
-                   }\r
-                   }-*/;\r
+                         try {\r
+                               var date = new Date();\r
+                               if(y && y >= 0) date.setFullYear(y);\r
+                               if(m && m >= 1) date.setMonth(m-1);\r
+                               if(d && d >= 0) date.setDate(d);\r
+                               if(h && h >= 0) date.setHours(h);\r
+                               if(mi && mi >= 0) date.setMinutes(mi);\r
+                               if(s && s >= 0) date.setSeconds(s);\r
+                               if(ms && ms >= 0) date.setMilliseconds(ms);\r
+                               return date.getTime();\r
+                         } catch (e) {\r
+                               // TODO print some error message on the console\r
+                               //console.log(e);\r
+                               return (new Date()).getTime();\r
+                         }\r
+                         }-*/;\r
 \r
     public int getMilliseconds() {\r
         return (int) (date.getTime() - date.getTime() / 1000 * 1000);\r
index 80d4bfde635bd29fd3affcc1f17168361227f180..895b2c78584f8ad7a88a4927981086da07153136 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;\r
@@ -5,7 +9,7 @@ import com.itmill.toolkit.terminal.gwt.client.UIDL;
 \r
 public class IDateFieldCalendar extends IDateField {\r
 \r
-    private CalendarPanel date;\r
+    private final CalendarPanel date;\r
 \r
     public IDateFieldCalendar() {\r
         super();\r
index 3b4134ba20a81394c571566fb464b812559388a7..97491aafdc0cb8e69ae0495deb46d3449eb6f7ba 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.DOM;
@@ -12,15 +16,15 @@ public class IEmbedded extends HTML implements Paintable {
         if (client.updateComponent(this, uidl, true)) {
             return;
         }
-        String w = uidl.hasAttribute("width") ? uidl
+        final String w = uidl.hasAttribute("width") ? uidl
                 .getStringAttribute("width") : "100%";
-        String h = uidl.hasAttribute("height") ? uidl
+        final String h = uidl.hasAttribute("height") ? uidl
                 .getStringAttribute("height") : "100%";
         DOM.setStyleAttribute(getElement(), "width", w);
         DOM.setStyleAttribute(getElement(), "height", h);
 
         if (uidl.hasAttribute("type")) {
-            String type = uidl.getStringAttribute("type");
+            final String type = uidl.getStringAttribute("type");
             if (type.equals("image")) {
                 setHTML("<img src=\"" + getSrc(uidl, client) + "\"/>");
             } else if (type.equals("browser")) {
@@ -31,7 +35,7 @@ public class IEmbedded extends HTML implements Paintable {
                         "Unknown Embedded type '" + type + "'");
             }
         } else if (uidl.hasAttribute("mimetype")) {
-            String mime = uidl.getStringAttribute("mimetype");
+            final String mime = uidl.getStringAttribute("mimetype");
             if (mime.equals("application/x-shockwave-flash")) {
                 setHTML("<object width=\"" + w + "\" height=\"" + h
                         + "\"><param name=\"movie\" value=\""
index 1d53cf5eb876b98822513b52a96f336138cf95cb..fd8fa7a65e8d548b042c428fa6ee3058ebca24ca 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.ArrayList;
@@ -73,7 +77,7 @@ public class IExpandLayout extends ComplexPanel implements
     }
 
     public void add(Widget w) {
-        WidgetWrapper wrapper = createWidgetWrappper();
+        final WidgetWrapper wrapper = createWidgetWrappper();
         DOM.appendChild(childContainer, wrapper.getElement());
         super.add(w, wrapper.getContainerElement());
     }
@@ -124,7 +128,7 @@ public class IExpandLayout extends ComplexPanel implements
      * @return
      */
     public WidgetWrapper getWidgetWrapperFor(Widget child) {
-        Element containerElement = DOM.getParent(child.getElement());
+        final Element containerElement = DOM.getParent(child.getElement());
         if (orientationMode == ORIENTATION_HORIZONTAL) {
             return new HorizontalWidgetWrapper(containerElement);
         } else {
@@ -161,7 +165,7 @@ public class IExpandLayout extends ComplexPanel implements
         }
 
         void setExpandedSize(int pixels) {
-            int spaceForMarginsAndSpacings = getOffsetHeight()
+            final int spaceForMarginsAndSpacings = getOffsetHeight()
                     - DOM.getElementPropertyInt(getElement(), "clientHeight");
             int fixedInnerSize = pixels - spaceForMarginsAndSpacings;
             if (fixedInnerSize < 0) {
@@ -220,9 +224,9 @@ public class IExpandLayout extends ComplexPanel implements
                 } else {
                     if (td == null) {
                         // build one cell table
-                        Element table = DOM.createTable();
-                        Element tBody = DOM.createTBody();
-                        Element tr = DOM.createTR();
+                        final Element table = DOM.createTable();
+                        final Element tBody = DOM.createTBody();
+                        final Element tr = DOM.createTR();
                         td = DOM.createTD();
                         DOM.appendChild(table, tBody);
                         DOM.appendChild(tBody, tr);
@@ -234,7 +238,7 @@ public class IExpandLayout extends ComplexPanel implements
                         DOM.setElementProperty(td, "className", CLASSNAME
                                 + "-valign");
                         // move possible content to cell
-                        Element content = DOM.getFirstChild(getElement());
+                        final Element content = DOM.getFirstChild(getElement());
                         if (content != null) {
                             DOM.removeChild(getElement(), content);
                             DOM.appendChild(td, content);
@@ -263,10 +267,10 @@ public class IExpandLayout extends ComplexPanel implements
     }
 
     protected ArrayList getPaintables() {
-        ArrayList al = new ArrayList();
-        Iterator it = iterator();
+        final ArrayList al = new ArrayList();
+        final Iterator it = iterator();
         while (it.hasNext()) {
-            Widget w = (Widget) it.next();
+            final Widget w = (Widget) it.next();
             if (w instanceof Paintable) {
                 al.add(w);
             }
@@ -290,15 +294,16 @@ public class IExpandLayout extends ComplexPanel implements
         // Component alignments as a comma separated list.
         // See com.itmill.toolkit.terminal.gwt.client.ui.AlignmentInfo.java for
         // possible values.
-        int[] alignments = uidl.getIntArrayAttribute("alignments");
+        final int[] alignments = uidl.getIntArrayAttribute("alignments");
         int alignmentIndex = 0;
         // Set alignment attributes
-        Iterator it = getPaintables().iterator();
+        final Iterator it = getPaintables().iterator();
         boolean first = true;
         while (it.hasNext()) {
             // Calculate alignment info
-            AlignmentInfo ai = new AlignmentInfo(alignments[alignmentIndex++]);
-            WidgetWrapper wr = getWidgetWrapperFor((Widget) it.next());
+            final AlignmentInfo ai = new AlignmentInfo(
+                    alignments[alignmentIndex++]);
+            final WidgetWrapper wr = getWidgetWrapperFor((Widget) it.next());
             wr.setAlignment(ai.getVerticalAlignment(), ai
                     .getHorizontalAlignment());
             if (first) {
@@ -312,7 +317,8 @@ public class IExpandLayout extends ComplexPanel implements
     }
 
     protected void handleMargins(UIDL uidl) {
-        MarginInfo margins = new MarginInfo(uidl.getIntAttribute("margins"));
+        final MarginInfo margins = new MarginInfo(uidl
+                .getIntAttribute("margins"));
         setStyleName(me, CLASSNAME + "-" + StyleConstants.LAYOUT_MARGIN_TOP,
                 margins.hasTop());
         setStyleName(me, StyleConstants.LAYOUT_MARGIN_RIGHT, margins.hasRight());
@@ -338,9 +344,9 @@ public class IExpandLayout extends ComplexPanel implements
             return;
         }
 
-        int availableSpace = getAvailableSpace();
+        final int availableSpace = getAvailableSpace();
 
-        int usedSpace = getUsedSpace();
+        final int usedSpace = getUsedSpace();
 
         int spaceForExpandedWidget = availableSpace - usedSpace;
 
@@ -349,7 +355,7 @@ public class IExpandLayout extends ComplexPanel implements
             spaceForExpandedWidget = EXPANDED_ELEMENTS_MIN_WIDTH;
         }
 
-        WidgetWrapper wr = getWidgetWrapperFor(expandedWidget);
+        final WidgetWrapper wr = getWidgetWrapperFor(expandedWidget);
         wr.setExpandedSize(spaceForExpandedWidget);
 
         // TODO save previous size and only propagate if really changed
@@ -373,12 +379,12 @@ public class IExpandLayout extends ComplexPanel implements
 
     private int getUsedSpace() {
         int total = 0;
-        int widgetCount = getWidgetCount();
-        Iterator it = iterator();
+        final int widgetCount = getWidgetCount();
+        final Iterator it = iterator();
         while (it.hasNext()) {
-            Widget w = (Widget) it.next();
+            final Widget w = (Widget) it.next();
             if (w != expandedWidget) {
-                WidgetWrapper wr = getWidgetWrapperFor(w);
+                final WidgetWrapper wr = getWidgetWrapperFor(w);
                 if (orientationMode == ORIENTATION_VERTICAL) {
                     total += wr.getOffsetHeight();
                 } else {
@@ -393,8 +399,8 @@ public class IExpandLayout extends ComplexPanel implements
     private int getSpacingSize() {
         if (hasComponentSpacing) {
             if (spacingSize < 0) {
-                Element temp = DOM.createDiv();
-                WidgetWrapper wr = createWidgetWrappper();
+                final Element temp = DOM.createDiv();
+                final WidgetWrapper wr = createWidgetWrappper();
                 wr.setSpacingEnabled(true);
                 DOM.appendChild(temp, wr.getElement());
                 DOM.setStyleAttribute(temp, "position", "absolute");
@@ -427,12 +433,14 @@ public class IExpandLayout extends ComplexPanel implements
                 DOM.setStyleAttribute(getElement(), "overflow", "visible");
             }
 
-            int marginTop = DOM.getElementPropertyInt(DOM.getFirstChild(me),
-                    "offsetTop")
+            final int marginTop = DOM.getElementPropertyInt(DOM
+                    .getFirstChild(me), "offsetTop")
                     - DOM.getElementPropertyInt(element, "offsetTop");
 
-            Element lastElement = DOM.getChild(me, (DOM.getChildCount(me) - 1));
-            int marginBottom = DOM.getElementPropertyInt(me, "offsetHeight")
+            final Element lastElement = DOM.getChild(me,
+                    (DOM.getChildCount(me) - 1));
+            final int marginBottom = DOM.getElementPropertyInt(me,
+                    "offsetHeight")
                     + DOM.getElementPropertyInt(me, "offsetTop")
                     - (DOM.getElementPropertyInt(lastElement, "offsetTop") + DOM
                             .getElementPropertyInt(lastElement, "offsetHeight"));
@@ -446,16 +454,16 @@ public class IExpandLayout extends ComplexPanel implements
 
     protected void insert(Widget w, int beforeIndex) {
         if (w instanceof Caption) {
-            Caption c = (Caption) w;
+            final Caption c = (Caption) w;
             // captions go into same container element as their
             // owners
-            Element container = DOM.getParent(((UIObject) c.getOwner())
+            final Element container = DOM.getParent(((UIObject) c.getOwner())
                     .getElement());
-            Element captionContainer = DOM.createDiv();
+            final Element captionContainer = DOM.createDiv();
             DOM.insertChild(container, captionContainer, 0);
             insert(w, captionContainer, beforeIndex, false);
         } else {
-            WidgetWrapper wrapper = createWidgetWrappper();
+            final WidgetWrapper wrapper = createWidgetWrappper();
             DOM.insertChild(childContainer, wrapper.getElement(), beforeIndex);
             insert(w, wrapper.getContainerElement(), beforeIndex, false);
         }
@@ -466,8 +474,8 @@ public class IExpandLayout extends ComplexPanel implements
     }
 
     public boolean remove(Widget w) {
-        WidgetWrapper ww = getWidgetWrapperFor(w);
-        boolean removed = super.remove(w);
+        final WidgetWrapper ww = getWidgetWrapperFor(w);
+        final boolean removed = super.remove(w);
         if (removed) {
             if (!(w instanceof Caption)) {
                 DOM.removeChild(childContainer, ww.getElement());
@@ -478,7 +486,7 @@ public class IExpandLayout extends ComplexPanel implements
     }
 
     public void removeCaption(Widget w) {
-        Caption c = (Caption) componentToCaption.get(w);
+        final Caption c = (Caption) componentToCaption.get(w);
         if (c != null) {
             this.remove(c);
             componentToCaption.remove(w);
@@ -486,7 +494,7 @@ public class IExpandLayout extends ComplexPanel implements
     }
 
     public boolean removePaintable(Paintable p) {
-        Caption c = (Caption) componentToCaption.get(p);
+        final Caption c = (Caption) componentToCaption.get(p);
         if (c != null) {
             componentToCaption.remove(c);
             remove(c);
@@ -500,12 +508,12 @@ public class IExpandLayout extends ComplexPanel implements
 
     public void replaceChildComponent(Widget from, Widget to) {
         client.unregisterPaintable((Paintable) from);
-        Caption c = (Caption) componentToCaption.get(from);
+        final Caption c = (Caption) componentToCaption.get(from);
         if (c != null) {
             remove(c);
             componentToCaption.remove(c);
         }
-        int index = getWidgetIndex(from);
+        final int index = getWidgetIndex(from);
         if (index >= 0) {
             remove(index);
             insert(to, index);
@@ -518,7 +526,7 @@ public class IExpandLayout extends ComplexPanel implements
 
         if (Caption.isNeeded(uidl)) {
             if (c == null) {
-                int index = getWidgetIndex((Widget) component);
+                final int index = getWidgetIndex((Widget) component);
                 c = new Caption(component, client);
                 insert(c, index);
                 componentToCaption.put(component, c);
@@ -571,10 +579,10 @@ public class IExpandLayout extends ComplexPanel implements
 
         hasComponentSpacing = uidl.getBooleanAttribute("spacing");
 
-        ArrayList uidlWidgets = new ArrayList();
-        for (Iterator it = uidl.getChildIterator(); it.hasNext();) {
-            UIDL cellUidl = (UIDL) it.next();
-            Widget child = client.getWidget(cellUidl.getChildUIDL(0));
+        final ArrayList uidlWidgets = new ArrayList();
+        for (final Iterator it = uidl.getChildIterator(); it.hasNext();) {
+            final UIDL cellUidl = (UIDL) it.next();
+            final Widget child = client.getWidget(cellUidl.getChildUIDL(0));
             uidlWidgets.add(child);
             if (cellUidl.hasAttribute("expanded")) {
                 expandedWidget = child;
@@ -582,16 +590,16 @@ public class IExpandLayout extends ComplexPanel implements
             }
         }
 
-        ArrayList oldWidgets = getPaintables();
+        final ArrayList oldWidgets = getPaintables();
 
-        Iterator oldIt = oldWidgets.iterator();
-        Iterator newIt = uidlWidgets.iterator();
-        Iterator newUidl = uidl.getChildIterator();
+        final Iterator oldIt = oldWidgets.iterator();
+        final Iterator newIt = uidlWidgets.iterator();
+        final Iterator newUidl = uidl.getChildIterator();
 
         Widget oldChild = null;
         while (newIt.hasNext()) {
-            Widget child = (Widget) newIt.next();
-            UIDL childUidl = ((UIDL) newUidl.next()).getChildUIDL(0);
+            final Widget child = (Widget) newIt.next();
+            final UIDL childUidl = ((UIDL) newUidl.next()).getChildUIDL(0);
             if (oldChild == null && oldIt.hasNext()) {
                 // search for next old Paintable which still exists in layout
                 // and delete others
@@ -626,7 +634,7 @@ public class IExpandLayout extends ComplexPanel implements
                 insert(child, index);
             } else {
                 // insert new child before old one
-                int index = getWidgetIndex(oldChild);
+                final int index = getWidgetIndex(oldChild);
                 insert(child, index);
             }
             if (child != expandedWidget) {
@@ -636,7 +644,7 @@ public class IExpandLayout extends ComplexPanel implements
         // remove possibly remaining old Paintable object which were not updated
         while (oldIt.hasNext()) {
             oldChild = (Widget) oldIt.next();
-            Paintable p = (Paintable) oldChild;
+            final Paintable p = (Paintable) oldChild;
             if (!uidlWidgets.contains(p)) {
                 removePaintable(p);
             }
index 48991eec3b9f42ab7ee3ffc28c680d4d28e4913d..4a1a617f5c31621679dbbb81c30ec86f855452cf 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.ArrayList;
@@ -37,8 +41,8 @@ public class IFilterSelect extends Composite implements Paintable,
 
     public class FilterSelectSuggestion implements Suggestion, Command {
 
-        private String key;
-        private String caption;
+        private final String key;
+        private final String caption;
         private String iconUri;
 
         public FilterSelectSuggestion(UIDL uidl) {
@@ -51,7 +55,7 @@ public class IFilterSelect extends Composite implements Paintable,
         }
 
         public String getDisplayString() {
-            StringBuffer sb = new StringBuffer();
+            final StringBuffer sb = new StringBuffer();
             if (iconUri != null) {
                 sb.append("<img src=\"");
                 sb.append(iconUri);
@@ -88,11 +92,11 @@ public class IFilterSelect extends Composite implements Paintable,
 
         private static final String Z_INDEX = "30000";
 
-        private SuggestionMenu menu;
+        private final SuggestionMenu menu;
 
-        private Element up = DOM.createDiv();
-        private Element down = DOM.createDiv();
-        private Element status = DOM.createDiv();
+        private final Element up = DOM.createDiv();
+        private final Element down = DOM.createDiv();
+        private final Element status = DOM.createDiv();
 
         private boolean isPagingEnabled = true;
 
@@ -105,7 +109,7 @@ public class IFilterSelect extends Composite implements Paintable,
             setStyleName(CLASSNAME + "-suggestpopup");
             DOM.setStyleAttribute(getElement(), "zIndex", Z_INDEX);
 
-            Element root = getContainerElement();
+            final Element root = getContainerElement();
 
             DOM.setInnerHTML(up, "<span>Prev</span>");
             DOM.sinkEvents(up, Event.ONCLICK);
@@ -122,12 +126,12 @@ public class IFilterSelect extends Composite implements Paintable,
         public void showSuggestions(Collection currentSuggestions,
                 int currentPage, int totalSuggestions) {
             menu.setSuggestions(currentSuggestions);
-            int x = IFilterSelect.this.getAbsoluteLeft();
+            final int x = IFilterSelect.this.getAbsoluteLeft();
             int y = tb.getAbsoluteTop();
             y += tb.getOffsetHeight();
             setPopupPosition(x, y);
-            int first = currentPage * PAGELENTH + 1;
-            int last = first + currentSuggestions.size() - 1;
+            final int first = currentPage * PAGELENTH + 1;
+            final int last = first + currentSuggestions.size() - 1;
             DOM.setInnerText(status, (totalSuggestions == 0 ? 0 : first) + "-"
                     + last + "/" + totalSuggestions);
             setPrevButtonActive(first > 1);
@@ -168,10 +172,10 @@ public class IFilterSelect extends Composite implements Paintable,
         }
 
         public void selectNextItem() {
-            MenuItem cur = menu.getSelectedItem();
-            int index = 1 + menu.getItems().indexOf(cur);
+            final MenuItem cur = menu.getSelectedItem();
+            final int index = 1 + menu.getItems().indexOf(cur);
             if (menu.getItems().size() > index) {
-                MenuItem newSelectedItem = (MenuItem) menu.getItems()
+                final MenuItem newSelectedItem = (MenuItem) menu.getItems()
                         .get(index);
                 menu.selectItem(newSelectedItem);
                 tb.setText(newSelectedItem.getText());
@@ -185,10 +189,10 @@ public class IFilterSelect extends Composite implements Paintable,
         }
 
         public void selectPrevItem() {
-            MenuItem cur = menu.getSelectedItem();
-            int index = -1 + menu.getItems().indexOf(cur);
+            final MenuItem cur = menu.getSelectedItem();
+            final int index = -1 + menu.getItems().indexOf(cur);
             if (index > -1) {
-                MenuItem newSelectedItem = (MenuItem) menu.getItems()
+                final MenuItem newSelectedItem = (MenuItem) menu.getItems()
                         .get(index);
                 menu.selectItem(newSelectedItem);
                 tb.setText(newSelectedItem.getText());
@@ -200,8 +204,8 @@ public class IFilterSelect extends Composite implements Paintable,
                     filterOptions(currentPage - 1);
                 }
             } else {
-                MenuItem newSelectedItem = (MenuItem) menu.getItems().get(
-                        menu.getItems().size() - 1);
+                final MenuItem newSelectedItem = (MenuItem) menu.getItems()
+                        .get(menu.getItems().size() - 1);
                 menu.selectItem(newSelectedItem);
                 tb.setText(newSelectedItem.getText());
                 tb.setSelectionRange(lastFilter.length(), newSelectedItem
@@ -211,7 +215,7 @@ public class IFilterSelect extends Composite implements Paintable,
         }
 
         public void onBrowserEvent(Event event) {
-            Element target = DOM.eventGetTarget(event);
+            final Element target = DOM.eventGetTarget(event);
             if (DOM.compare(target, up)
                     || DOM.compare(target, DOM.getChild(up, 0))) {
                 filterOptions(currentPage - 1, lastFilter);
@@ -257,7 +261,7 @@ public class IFilterSelect extends Composite implements Paintable,
             }
             offsetHeight = getOffsetHeight();
 
-            int desiredWidth = IFilterSelect.this.getOffsetWidth();
+            final int desiredWidth = IFilterSelect.this.getOffsetWidth();
             int naturalMenuWidth = DOM.getElementPropertyInt(DOM
                     .getFirstChild(menu.getElement()), "offsetWidth");
             if (naturalMenuWidth < desiredWidth) {
@@ -305,7 +309,7 @@ public class IFilterSelect extends Composite implements Paintable,
          * @return true if popup was just closed
          */
         public boolean isJustClosed() {
-            long now = (new Date()).getTime();
+            final long now = (new Date()).getTime();
             return (lastAutoClosed > 0 && (now - lastAutoClosed) < 200);
         }
 
@@ -329,17 +333,18 @@ public class IFilterSelect extends Composite implements Paintable,
          * to avoid height changes when quickly "scrolling" to last page
          */
         public void fixHeightTo(int pagelenth) {
-            int pixels = pagelenth * (getOffsetHeight() - 2)
+            final int pixels = pagelenth * (getOffsetHeight() - 2)
                     / currentSuggestions.size();
             setHeight((pixels + 2) + "px");
         }
 
         public void setSuggestions(Collection suggestions) {
             clearItems();
-            Iterator it = suggestions.iterator();
+            final Iterator it = suggestions.iterator();
             while (it.hasNext()) {
-                FilterSelectSuggestion s = (FilterSelectSuggestion) it.next();
-                MenuItem mi = new MenuItem(s.getDisplayString(), true, s);
+                final FilterSelectSuggestion s = (FilterSelectSuggestion) it
+                        .next();
+                final MenuItem mi = new MenuItem(s.getDisplayString(), true, s);
                 this.addItem(mi);
                 if (s == currentSuggestion) {
                     selectItem(mi);
@@ -348,16 +353,17 @@ public class IFilterSelect extends Composite implements Paintable,
         }
 
         public void doSelectedItemAction() {
-            MenuItem item = getSelectedItem();
+            final MenuItem item = getSelectedItem();
             if (item != null
                     && item.getText().toLowerCase().startsWith(
                             lastFilter.toLowerCase())) {
                 doItemAction(item, true);
             } else if (allowNewItem) {
-                String newItemValue = tb.getText();
+                final String newItemValue = tb.getText();
                 // check for exact match in menu
                 if (getItems().size() == 1) {
-                    MenuItem potentialExactMatch = (MenuItem) getItems().get(0);
+                    final MenuItem potentialExactMatch = (MenuItem) getItems()
+                            .get(0);
                     if (potentialExactMatch.getText().equals(newItemValue)) {
                         selectItem(potentialExactMatch);
                         doSelectedItemAction();
@@ -399,7 +405,7 @@ public class IFilterSelect extends Composite implements Paintable,
 
     private int currentPage;
 
-    private Collection currentSuggestions = new ArrayList();
+    private final Collection currentSuggestions = new ArrayList();
 
     private boolean immediate;
 
@@ -461,9 +467,10 @@ public class IFilterSelect extends Composite implements Paintable,
         }
         if (clientSideFiltering) {
             currentSuggestions.clear();
-            for (Iterator it = allSuggestions.iterator(); it.hasNext();) {
-                FilterSelectSuggestion s = (FilterSelectSuggestion) it.next();
-                String string = s.getDisplayString().toLowerCase();
+            for (final Iterator it = allSuggestions.iterator(); it.hasNext();) {
+                final FilterSelectSuggestion s = (FilterSelectSuggestion) it
+                        .next();
+                final String string = s.getDisplayString().toLowerCase();
                 if (string.startsWith(filter.toLowerCase())) {
                     currentSuggestions.add(s);
                 }
@@ -512,7 +519,7 @@ public class IFilterSelect extends Composite implements Paintable,
         allowNewItem = uidl.hasAttribute("allownewitem");
 
         currentSuggestions.clear();
-        UIDL options = uidl.getChildUIDL(0);
+        final UIDL options = uidl.getChildUIDL(0);
         totalSuggestions = uidl.getIntAttribute("totalitems");
         totalMatches = uidl.getIntAttribute("totalMatches");
 
@@ -520,9 +527,9 @@ public class IFilterSelect extends Composite implements Paintable,
         if (clientSideFiltering) {
             allSuggestions = new ArrayList();
         }
-        for (Iterator i = options.getChildIterator(); i.hasNext();) {
-            UIDL optionUidl = (UIDL) i.next();
-            FilterSelectSuggestion suggestion = new FilterSelectSuggestion(
+        for (final Iterator i = options.getChildIterator(); i.hasNext();) {
+            final UIDL optionUidl = (UIDL) i.next();
+            final FilterSelectSuggestion suggestion = new FilterSelectSuggestion(
                     optionUidl);
             currentSuggestions.add(suggestion);
             if (clientSideFiltering) {
@@ -547,8 +554,8 @@ public class IFilterSelect extends Composite implements Paintable,
         }
 
         // Calculate minumum textarea width
-        int minw = minWidth(captions);
-        Element spacer = DOM.createDiv();
+        final int minw = minWidth(captions);
+        final Element spacer = DOM.createDiv();
         DOM.setStyleAttribute(spacer, "width", minw + "px");
         DOM.setStyleAttribute(spacer, "height", "0");
         DOM.setStyleAttribute(spacer, "overflow", "hidden");
@@ -674,25 +681,25 @@ public class IFilterSelect extends Composite implements Paintable,
      * Calculate minumum width for FilterSelect textarea
      */
     private native int minWidth(String captions) /*-{
-                                                                       if(!captions || captions.length <= 0)
-                                                                               return 0;
-                                                                       captions = captions.split("|");
-                                                                       var d = $wnd.document.createElement("div");
-                                                                       var html = "";
-                                                                       for(var i=0; i < captions.length; i++) {
-                                                                               html += "<div>" + captions[i] + "</div>";
-                                                                               // TODO apply same CSS classname as in suggestionmenu
-                                                                       }
-                                                                       d.style.position = "absolute";
-                                                                       d.style.top = "0";
-                                                                       d.style.left = "0";
-                                                                       d.style.visibility = "hidden";
-                                                                       d.innerHTML = html;
-                                                                       $wnd.document.body.appendChild(d);
-                                                                       var w = d.offsetWidth;
-                                                                       $wnd.document.body.removeChild(d);
-                                                                       return w;
-                                                                   }-*/;
+                                                                               if(!captions || captions.length <= 0)
+                                                                                       return 0;
+                                                                               captions = captions.split("|");
+                                                                               var d = $wnd.document.createElement("div");
+                                                                               var html = "";
+                                                                               for(var i=0; i < captions.length; i++) {
+                                                                                       html += "<div>" + captions[i] + "</div>";
+                                                                                       // TODO apply same CSS classname as in suggestionmenu
+                                                                               }
+                                                                               d.style.position = "absolute";
+                                                                               d.style.top = "0";
+                                                                               d.style.left = "0";
+                                                                               d.style.visibility = "hidden";
+                                                                               d.innerHTML = html;
+                                                                               $wnd.document.body.appendChild(d);
+                                                                               var w = d.offsetWidth;
+                                                                               $wnd.document.body.removeChild(d);
+                                                                               return w;
+                                                                         }-*/;
 
     public void onFocus(Widget sender) {
         // NOP
index df883927fbcb61ef335515d4acf3528b190206d9..1ae36d5cc82860f96ce70b0c49faeb4130eaa255 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import com.google.gwt.user.client.ui.SimplePanel;\r
@@ -27,7 +31,7 @@ public class IForm extends SimplePanel implements Paintable {
             return;\r
         }\r
 \r
-        UIDL layoutUidl = uidl.getChildUIDL(0);\r
+        final UIDL layoutUidl = uidl.getChildUIDL(0);\r
         if (lo == null) {\r
             lo = (Container) client.getWidget(layoutUidl);\r
             setWidget((Widget) lo);\r
index 7aa87bfc1eac674a874342b73dbba36795a880f6..fd273174e35c10fba21aa8cc067f83a66e8687ad 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.HashMap;
@@ -27,16 +31,16 @@ public class IFormLayout extends FlexTable implements Container {
         }
 
         int i = 0;
-        for (Iterator it = uidl.getChildIterator(); it.hasNext(); i++) {
+        for (final Iterator it = uidl.getChildIterator(); it.hasNext(); i++) {
             prepareCell(i, 1);
-            UIDL childUidl = (UIDL) it.next();
-            Paintable p = (Paintable) client.getWidget(childUidl);
+            final UIDL childUidl = (UIDL) it.next();
+            final Paintable p = (Paintable) client.getWidget(childUidl);
             Caption c = (Caption) componentToCaption.get(p);
             if (c == null) {
                 c = new Caption(p, client);
                 componentToCaption.put(p, c);
             }
-            Paintable oldComponent = (Paintable) getWidget(i, 1);
+            final Paintable oldComponent = (Paintable) getWidget(i, 1);
             if (oldComponent == null) {
                 setWidget(i, 1, (Widget) p);
             } else if (oldComponent != p) {
@@ -48,7 +52,7 @@ public class IFormLayout extends FlexTable implements Container {
         }
         i++;
         while (getRowCount() > i) {
-            Paintable p = (Paintable) getWidget(i, 1);
+            final Paintable p = (Paintable) getWidget(i, 1);
             client.unregisterPaintable(p);
             componentToCaption.remove(p);
             removeRow(i);
@@ -63,7 +67,8 @@ public class IFormLayout extends FlexTable implements Container {
         int i;
         for (i = 0; i < getRowCount(); i++) {
             if (oldComponent == getWidget(i, 1)) {
-                Caption newCap = new Caption((Paintable) newComponent, client);
+                final Caption newCap = new Caption((Paintable) newComponent,
+                        client);
                 setWidget(i, 0, newCap);
                 setWidget(i, 1, newComponent);
                 client.unregisterPaintable((Paintable) oldComponent);
@@ -73,7 +78,7 @@ public class IFormLayout extends FlexTable implements Container {
     }
 
     public void updateCaption(Paintable component, UIDL uidl) {
-        Caption c = (Caption) componentToCaption.get(component);
+        final Caption c = (Caption) componentToCaption.get(component);
         if (c != null) {
             c.updateCaption(uidl);
         }
index 0cac2d7f9d54eabd466ff09d9612fa9993bdda8d..074917c2f0edacc1bb8f6d1858e2d81fabf424b9 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.ArrayList;
@@ -18,7 +22,7 @@ public class IGridLayout extends FlexTable implements Paintable, Container {
     public static final String CLASSNAME = "i-gridlayout";
 
     /** Widget to captionwrapper map */
-    private HashMap widgetToCaptionWrapper = new HashMap();
+    private final HashMap widgetToCaptionWrapper = new HashMap();
 
     public IGridLayout() {
         super();
@@ -36,18 +40,18 @@ public class IGridLayout extends FlexTable implements Paintable, Container {
         }
         int row = 0, column = 0;
 
-        ArrayList oldWidgetWrappers = new ArrayList();
-        for (Iterator iterator = iterator(); iterator.hasNext();) {
+        final ArrayList oldWidgetWrappers = new ArrayList();
+        for (final Iterator iterator = iterator(); iterator.hasNext();) {
             oldWidgetWrappers.add(iterator.next());
         }
         clear();
 
-        for (Iterator i = uidl.getChildIterator(); i.hasNext();) {
-            UIDL r = (UIDL) i.next();
+        for (final Iterator i = uidl.getChildIterator(); i.hasNext();) {
+            final UIDL r = (UIDL) i.next();
             if ("gr".equals(r.getTag())) {
                 column = 0;
-                for (Iterator j = r.getChildIterator(); j.hasNext();) {
-                    UIDL c = (UIDL) j.next();
+                for (final Iterator j = r.getChildIterator(); j.hasNext();) {
+                    final UIDL c = (UIDL) j.next();
                     if ("gc".equals(c.getTag())) {
                         prepareCell(row, column);
 
@@ -76,9 +80,9 @@ public class IGridLayout extends FlexTable implements Paintable, Container {
                         ((FlexCellFormatter) getCellFormatter()).setRowSpan(
                                 row, column, h);
 
-                        UIDL u = c.getChildUIDL(0);
+                        final UIDL u = c.getChildUIDL(0);
                         if (u != null) {
-                            Widget child = client.getWidget(u);
+                            final Widget child = client.getWidget(u);
                             CaptionWrapper wr;
                             if (widgetToCaptionWrapper.containsKey(child)) {
                                 wr = (CaptionWrapper) widgetToCaptionWrapper
@@ -104,8 +108,8 @@ public class IGridLayout extends FlexTable implements Paintable, Container {
         }
 
         // loop oldWidgetWrappers that where not re-attached and unregister them
-        for (Iterator it = oldWidgetWrappers.iterator(); it.hasNext();) {
-            CaptionWrapper w = (CaptionWrapper) it.next();
+        for (final Iterator it = oldWidgetWrappers.iterator(); it.hasNext();) {
+            final CaptionWrapper w = (CaptionWrapper) it.next();
             client.unregisterPaintable(w.getPaintable());
             widgetToCaptionWrapper.remove(w.getPaintable());
         }
@@ -124,7 +128,7 @@ public class IGridLayout extends FlexTable implements Paintable, Container {
     }
 
     public void updateCaption(Paintable component, UIDL uidl) {
-        CaptionWrapper wrapper = (CaptionWrapper) widgetToCaptionWrapper
+        final CaptionWrapper wrapper = (CaptionWrapper) widgetToCaptionWrapper
                 .get(component);
         wrapper.updateCaption(uidl);
     }
index f3dc055b2930e0d4194cd6fb48290a29e24320a4..80ea9b945c0b7bcc88eda8ceb34e8054acdb0cab 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 public class IHorizontalExpandLayout extends IExpandLayout {
index 588e6f21a6218ef3bcb1a5c58bea7a8c964d3557..15e1eab9ef4f6e870334de8a834ab2a91a7bdec5 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.ui.HTML;
@@ -25,7 +29,7 @@ public class ILabel extends HTML implements Paintable {
             return;
         }
 
-        String mode = uidl.getStringAttribute("mode");
+        final String mode = uidl.getStringAttribute("mode");
         if (mode == null || "text".equals(mode)) {
             setText(uidl.getChildString(0));
         } else if ("pre".equals(mode)) {
index 3cc0e61fb02cbd13fa12e39413f710265eff1bef..690321f55bcf344ed70704dbcb345d854b270009 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.DOM;
@@ -36,7 +40,7 @@ public class ILink extends HTML implements Paintable, ClickListener {
 
     private Element errorIndicatorElement;
 
-    private Element captionElement = DOM.createSpan();
+    private final Element captionElement = DOM.createSpan();
 
     private ErrorMessage errorMessage;
 
@@ -86,7 +90,7 @@ public class ILink extends HTML implements Paintable, ClickListener {
 
         // handle error
         if (uidl.hasAttribute("error")) {
-            UIDL errorUidl = uidl.getErrors();
+            final UIDL errorUidl = uidl.getErrors();
             if (errorIndicatorElement == null) {
                 errorIndicatorElement = DOM.createDiv();
                 DOM.setElementProperty(errorIndicatorElement, "className",
@@ -151,7 +155,7 @@ public class ILink extends HTML implements Paintable, ClickListener {
     }
 
     public void onBrowserEvent(Event event) {
-        Element target = DOM.eventGetTarget(event);
+        final Element target = DOM.eventGetTarget(event);
         if (errorIndicatorElement != null
                 && DOM.compare(target, errorIndicatorElement)) {
             switch (DOM.eventGetType(event)) {
index 43dfb3fa21f7d8348072e3e06a7abeaa798e8e26..18bd6e15a2999170b89048cc126449e2a499039e 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.Iterator;
@@ -35,8 +39,8 @@ public class IListSelect extends IOptionGroupBase {
             // can't unselect last item in singleselect mode
             select.addItem("", null);
         }
-        for (Iterator i = uidl.getChildIterator(); i.hasNext();) {
-            UIDL optionUidl = (UIDL) i.next();
+        for (final Iterator i = uidl.getChildIterator(); i.hasNext();) {
+            final UIDL optionUidl = (UIDL) i.next();
             select.addItem(optionUidl.getStringAttribute("caption"), optionUidl
                     .getStringAttribute("key"));
             if (optionUidl.hasAttribute("selected")) {
@@ -49,7 +53,7 @@ public class IListSelect extends IOptionGroupBase {
     }
 
     protected Object[] getSelectedItems() {
-        Vector selectedItemKeys = new Vector();
+        final Vector selectedItemKeys = new Vector();
         for (int i = 0; i < select.getItemCount(); i++) {
             if (select.isItemSelected(i)) {
                 selectedItemKeys.add(select.getValue(i));
@@ -59,7 +63,7 @@ public class IListSelect extends IOptionGroupBase {
     }
 
     public void onChange(Widget sender) {
-        int si = select.getSelectedIndex();
+        final int si = select.getSelectedIndex();
         if (si == -1 && !isNullSelectionAllowed()) {
             select.setSelectedIndex(lastSelectedIndex);
         } else {
index 95c954a4c0fda27ac88b772616d15d3fcedc7525..d9081097951d3c078dec66651224640f3e97e736 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.Iterator;
@@ -29,8 +33,8 @@ public class INativeSelect extends IOptionGroupBase {
             // can't unselect last item in singleselect mode
             select.addItem("", null);
         }
-        for (Iterator i = uidl.getChildIterator(); i.hasNext();) {
-            UIDL optionUidl = (UIDL) i.next();
+        for (final Iterator i = uidl.getChildIterator(); i.hasNext();) {
+            final UIDL optionUidl = (UIDL) i.next();
             select.addItem(optionUidl.getStringAttribute("caption"), optionUidl
                     .getStringAttribute("key"));
             if (optionUidl.hasAttribute("selected")) {
@@ -40,7 +44,7 @@ public class INativeSelect extends IOptionGroupBase {
     }
 
     protected Object[] getSelectedItems() {
-        Vector selectedItemKeys = new Vector();
+        final Vector selectedItemKeys = new Vector();
         for (int i = 0; i < select.getItemCount(); i++) {
             if (select.isItemSelected(i)) {
                 selectedItemKeys.add(select.getValue(i));
index b10ff673c9c5a3a5afad9833d98278c507a7bd86..5120d913ec41933529a64a01708d693d1f028916 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import java.util.HashMap;\r
@@ -14,9 +18,9 @@ public class IOptionGroup extends IOptionGroupBase {
 \r
     public static final String CLASSNAME = "i-select-optiongroup";\r
 \r
-    private Panel panel;\r
+    private final Panel panel;\r
 \r
-    private Map optionsToKeys;\r
+    private final Map optionsToKeys;\r
 \r
     public IOptionGroup() {\r
         super(CLASSNAME);\r
@@ -29,8 +33,8 @@ public class IOptionGroup extends IOptionGroupBase {
      */\r
     protected void buildOptions(UIDL uidl) {\r
         panel.clear();\r
-        for (Iterator it = uidl.getChildIterator(); it.hasNext();) {\r
-            UIDL opUidl = (UIDL) it.next();\r
+        for (final Iterator it = uidl.getChildIterator(); it.hasNext();) {\r
+            final UIDL opUidl = (UIDL) it.next();\r
             CheckBox op;\r
             if (isMultiselect()) {\r
                 op = new ICheckBox();\r
@@ -56,8 +60,8 @@ public class IOptionGroup extends IOptionGroupBase {
     public void onClick(Widget sender) {\r
         super.onClick(sender);\r
         if (sender instanceof CheckBox) {\r
-            boolean selected = ((CheckBox) sender).isChecked();\r
-            String key = (String) optionsToKeys.get(sender);\r
+            final boolean selected = ((CheckBox) sender).isChecked();\r
+            final String key = (String) optionsToKeys.get(sender);\r
             if (!isMultiselect()) {\r
                 selectedKeys.clear();\r
             }\r
index baedab7f1ae986acd10676bea910be7acaac2e0c..5c77ac33c4f4dfe499a0a1883622c31e973cc05f 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import java.util.Set;\r
@@ -49,7 +53,7 @@ abstract class IOptionGroupBase extends Composite implements Paintable,
     /**\r
      * Panel containing the component\r
      */\r
-    private Panel container;\r
+    private final Panel container;\r
 \r
     private ITextField newItemField;\r
 \r
@@ -133,7 +137,7 @@ abstract class IOptionGroupBase extends Composite implements Paintable,
         cols = uidl.getIntAttribute("cols");\r
         rows = uidl.getIntAttribute("rows");\r
 \r
-        UIDL ops = uidl.getChildUIDL(0);\r
+        final UIDL ops = uidl.getChildUIDL(0);\r
 \r
         if (getColumns() > 0) {\r
             container.setWidth(getColumns() + "em");\r
@@ -208,7 +212,7 @@ abstract class IOptionGroupBase extends Composite implements Paintable,
     protected abstract Object[] getSelectedItems();\r
 \r
     protected Object getSelectedItem() {\r
-        Object[] sel = getSelectedItems();\r
+        final Object[] sel = getSelectedItems();\r
         if (sel.length > 0) {\r
             return sel[0];\r
         } else {\r
index 0110f517a3db1db956b4c67e0fc8fd275451cde1..6d7edeaf74e3eed8251aa778b3b69d9e73bdaf7b 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.ArrayList;
@@ -63,7 +67,7 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
         size = DOM.createDiv();
         DOM.setInnerHTML(size, structure);
         margin = DOM.getFirstChild(size);
-        Element tBody = DOM.getFirstChild(DOM.getFirstChild(margin));
+        final Element tBody = DOM.getFirstChild(DOM.getFirstChild(margin));
         if (orientationMode == ORIENTATION_HORIZONTAL) {
             childContainer = DOM.createTR();
             DOM.appendChild(tBody, childContainer);
@@ -103,23 +107,23 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
 
         // Update contained components
 
-        ArrayList uidlWidgets = new ArrayList();
-        for (Iterator it = uidl.getChildIterator(); it.hasNext();) {
-            UIDL uidlForChild = (UIDL) it.next();
-            Widget child = client.getWidget(uidlForChild);
+        final ArrayList uidlWidgets = new ArrayList();
+        for (final Iterator it = uidl.getChildIterator(); it.hasNext();) {
+            final UIDL uidlForChild = (UIDL) it.next();
+            final Widget child = client.getWidget(uidlForChild);
             uidlWidgets.add(child);
         }
 
-        ArrayList oldWidgets = getPaintables();
+        final ArrayList oldWidgets = getPaintables();
 
-        Iterator oldIt = oldWidgets.iterator();
-        Iterator newIt = uidlWidgets.iterator();
-        Iterator newUidl = uidl.getChildIterator();
+        final Iterator oldIt = oldWidgets.iterator();
+        final Iterator newIt = uidlWidgets.iterator();
+        final Iterator newUidl = uidl.getChildIterator();
 
         Widget oldChild = null;
         while (newIt.hasNext()) {
-            Widget child = (Widget) newIt.next();
-            UIDL childUidl = (UIDL) newUidl.next();
+            final Widget child = (Widget) newIt.next();
+            final UIDL childUidl = (UIDL) newUidl.next();
 
             if (oldChild == null && oldIt.hasNext()) {
                 // search for next old Paintable which still exists in layout
@@ -155,7 +159,7 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
                 this.insert(child, index);
             } else {
                 // insert new child before old one
-                int index = getWidgetIndex(oldChild);
+                final int index = getWidgetIndex(oldChild);
                 insert(child, index);
             }
             ((Paintable) child).updateFromUIDL(childUidl, client);
@@ -163,7 +167,7 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
         // remove possibly remaining old Paintable object which were not updated
         while (oldIt.hasNext()) {
             oldChild = (Widget) oldIt.next();
-            Paintable p = (Paintable) oldChild;
+            final Paintable p = (Paintable) oldChild;
             if (!uidlWidgets.contains(p)) {
                 removePaintable(p);
             }
@@ -183,10 +187,10 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
      * @return list of Paintable objects
      */
     protected ArrayList getPaintables() {
-        ArrayList al = new ArrayList();
-        Iterator it = iterator();
+        final ArrayList al = new ArrayList();
+        final Iterator it = iterator();
         while (it.hasNext()) {
-            Widget w = (Widget) it.next();
+            final Widget w = (Widget) it.next();
             if (w instanceof Paintable) {
                 al.add(w);
             }
@@ -203,7 +207,7 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
      *                Paintable to be removed
      */
     public boolean removePaintable(Paintable p) {
-        Caption c = (Caption) componentToCaption.get(p);
+        final Caption c = (Caption) componentToCaption.get(p);
         if (c != null) {
             componentToCaption.remove(c);
             remove(c);
@@ -220,12 +224,12 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
      */
     public void replaceChildComponent(Widget from, Widget to) {
         client.unregisterPaintable((Paintable) from);
-        Caption c = (Caption) componentToCaption.get(from);
+        final Caption c = (Caption) componentToCaption.get(from);
         if (c != null) {
             remove(c);
             componentToCaption.remove(c);
         }
-        int index = getWidgetIndex(from);
+        final int index = getWidgetIndex(from);
         if (index >= 0) {
             remove(index);
             insert(to, index);
@@ -234,16 +238,16 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
 
     protected void insert(Widget w, int beforeIndex) {
         if (w instanceof Caption) {
-            Caption c = (Caption) w;
+            final Caption c = (Caption) w;
             // captions go into same container element as their
             // owners
-            Element container = DOM.getParent(((UIObject) c.getOwner())
+            final Element container = DOM.getParent(((UIObject) c.getOwner())
                     .getElement());
-            Element captionContainer = DOM.createDiv();
+            final Element captionContainer = DOM.createDiv();
             DOM.insertChild(container, captionContainer, 0);
             insert(w, captionContainer, beforeIndex, false);
         } else {
-            Element wrapper = createWidgetWrappper();
+            final Element wrapper = createWidgetWrappper();
             DOM.insertChild(childContainer, wrapper, beforeIndex);
             insert(w, getWidgetContainerFromWrapper(wrapper), beforeIndex,
                     false);
@@ -263,7 +267,7 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
      * creates an Element which will contain child widget
      */
     protected Element createWidgetWrappper() {
-        Element td = DOM.createTD();
+        final Element td = DOM.createTD();
         // We need this overflow:hidden, because it's the default rendering of
         // IE (although it can be overridden with overflow:visible).
         DOM.setStyleAttribute(td, "overflow", "hidden");
@@ -271,7 +275,7 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
         case ORIENTATION_HORIZONTAL:
             return td;
         default:
-            Element tr = DOM.createTR();
+            final Element tr = DOM.createTR();
             DOM.appendChild(tr, td);
             return tr;
         }
@@ -287,7 +291,7 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
 
         if (Caption.isNeeded(uidl)) {
             if (c == null) {
-                int index = getWidgetIndex((Widget) component);
+                final int index = getWidgetIndex((Widget) component);
                 c = new Caption(component, client);
                 insert(c, index);
                 componentToCaption.put(component, c);
@@ -302,7 +306,7 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
     }
 
     public void removeCaption(Widget w) {
-        Caption c = (Caption) componentToCaption.get(w);
+        final Caption c = (Caption) componentToCaption.get(w);
         if (c != null) {
             this.remove(c);
             componentToCaption.remove(w);
@@ -310,7 +314,7 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
     }
 
     public void add(Widget w) {
-        Element wrapper = createWidgetWrappper();
+        final Element wrapper = createWidgetWrappper();
         DOM.appendChild(childContainer, wrapper);
         super.add(w, orientationMode == ORIENTATION_HORIZONTAL ? wrapper : DOM
                 .getFirstChild(wrapper));
@@ -321,8 +325,8 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
     }
 
     public boolean remove(Widget w) {
-        Element wrapper = DOM.getParent(w.getElement());
-        boolean removed = super.remove(w);
+        final Element wrapper = DOM.getParent(w.getElement());
+        final boolean removed = super.remove(w);
         if (removed) {
             if (!(w instanceof Caption)) {
                 DOM.removeChild(childContainer,
@@ -349,8 +353,9 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
     protected void handleMargins(UIDL uidl) {
         // Modify layout margins
         String marginClasses = "";
-        MarginInfo margins = new MarginInfo(uidl.getIntAttribute("margins"));
-        Element topBottomMarginContainer = orientationMode == ORIENTATION_HORIZONTAL ? DOM
+        final MarginInfo margins = new MarginInfo(uidl
+                .getIntAttribute("margins"));
+        final Element topBottomMarginContainer = orientationMode == ORIENTATION_HORIZONTAL ? DOM
                 .getParent(childContainer)
                 : childContainer;
         // Top margin
@@ -418,16 +423,17 @@ public abstract class IOrderedLayout extends ComplexPanel implements Container {
         // Component alignments as a comma separated list.
         // See com.itmill.toolkit.terminal.gwt.client.ui.AlignmentInfo.java for
         // possible values.
-        int[] alignments = uidl.getIntArrayAttribute("alignments");
+        final int[] alignments = uidl.getIntArrayAttribute("alignments");
         int alignmentIndex = 0;
         // Insert alignment attributes
-        Iterator it = getPaintables().iterator();
+        final Iterator it = getPaintables().iterator();
         while (it.hasNext()) {
 
             // Calculate alignment info
-            AlignmentInfo ai = new AlignmentInfo(alignments[alignmentIndex++]);
+            final AlignmentInfo ai = new AlignmentInfo(
+                    alignments[alignmentIndex++]);
 
-            Element td = DOM.getParent(((Widget) it.next()).getElement());
+            final Element td = DOM.getParent(((Widget) it.next()).getElement());
             if (Util.isIE()) {
                 DOM
                         .setElementAttribute(td, "vAlign", ai
index 34979948ccbabf21e734192c2c5634260a5641f4..340b001f2013e89f2a06a575b9602c837e4f07c5 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 public class IOrderedLayoutHorizontal extends IOrderedLayout {\r
index 6f73b3283006eb67d62576565eb26d7492a27f3d..1214c8542111cd43cbe000c16ff487ff5dfe8af0 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 public class IOrderedLayoutVertical extends IOrderedLayout {\r
index 82db2235b4c6da094c91d38e8597bd075e8f47ac..6d5520ec0612bdfaa5160298e25ce247516153bb 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.DOM;
@@ -21,15 +25,15 @@ public class IPanel extends SimplePanel implements Paintable,
 
     String id;
 
-    private Element captionNode = DOM.createDiv();
+    private final Element captionNode = DOM.createDiv();
 
-    private Element captionText = DOM.createSpan();
+    private final Element captionText = DOM.createSpan();
 
     private Icon icon;
 
-    private Element bottomDecoration = DOM.createDiv();
+    private final Element bottomDecoration = DOM.createDiv();
 
-    private Element contentNode = DOM.createDiv();
+    private final Element contentNode = DOM.createDiv();
 
     private Element errorIndicatorElement;
 
@@ -74,8 +78,8 @@ public class IPanel extends SimplePanel implements Paintable,
         id = uidl.getId();
 
         // Panel size. Height needs to be saved for later use
-        String w = uidl.hasVariable("width") ? uidl.getStringVariable("width")
-                : null;
+        final String w = uidl.hasVariable("width") ? uidl
+                .getStringVariable("width") : null;
         height = uidl.hasVariable("height") ? uidl.getStringVariable("height")
                 : null;
         setWidth(w != null ? w : "");
@@ -111,11 +115,11 @@ public class IPanel extends SimplePanel implements Paintable,
         // Add proper stylenames for all elements. This way we can prevent
         // unwanted CSS selector inheritance.
         if (uidl.hasAttribute("style")) {
-            String[] styles = uidl.getStringAttribute("style").split(" ");
-            String captionBaseClass = CLASSNAME
+            final String[] styles = uidl.getStringAttribute("style").split(" ");
+            final String captionBaseClass = CLASSNAME
                     + (hasCaption ? "-caption" : "-nocaption");
-            String contentBaseClass = CLASSNAME + "-content";
-            String decoBaseClass = CLASSNAME + "-deco";
+            final String contentBaseClass = CLASSNAME + "-content";
+            final String decoBaseClass = CLASSNAME + "-deco";
             String captionClass = captionBaseClass;
             String contentClass = contentBaseClass;
             String decoClass = decoBaseClass;
@@ -133,8 +137,8 @@ public class IPanel extends SimplePanel implements Paintable,
         iLayout();
 
         // Render content
-        UIDL layoutUidl = uidl.getChildUIDL(0);
-        Widget newLayout = client.getWidget(layoutUidl);
+        final UIDL layoutUidl = uidl.getChildUIDL(0);
+        final Widget newLayout = client.getWidget(layoutUidl);
         if (newLayout != layout) {
             if (layout != null) {
                 client.unregisterPaintable((Paintable) layout);
@@ -148,7 +152,7 @@ public class IPanel extends SimplePanel implements Paintable,
 
     private void handleError(UIDL uidl) {
         if (uidl.hasAttribute("error")) {
-            UIDL errorUidl = uidl.getErrors();
+            final UIDL errorUidl = uidl.getErrors();
             if (errorIndicatorElement == null) {
                 errorIndicatorElement = DOM.createDiv();
                 DOM.setElementProperty(errorIndicatorElement, "className",
@@ -175,7 +179,7 @@ public class IPanel extends SimplePanel implements Paintable,
     }
 
     private void setIconUri(UIDL uidl, ApplicationConnection client) {
-        String iconUri = uidl.hasAttribute("icon") ? uidl
+        final String iconUri = uidl.hasAttribute("icon") ? uidl
                 .getStringAttribute("icon") : null;
         if (iconUri == null) {
             if (icon != null) {
@@ -193,7 +197,7 @@ public class IPanel extends SimplePanel implements Paintable,
 
     public void iLayout() {
         if (height != null && height != "") {
-            boolean hasChildren = getWidget() != null;
+            final boolean hasChildren = getWidget() != null;
             Element contentEl = null;
             String origPositioning = null;
             if (hasChildren) {
@@ -209,11 +213,11 @@ public class IPanel extends SimplePanel implements Paintable,
 
             // Calculate target height
             super.setHeight(height);
-            int targetHeight = getOffsetHeight();
+            final int targetHeight = getOffsetHeight();
 
             // Calculate used height
             super.setHeight("");
-            int usedHeight = DOM.getElementPropertyInt(bottomDecoration,
+            final int usedHeight = DOM.getElementPropertyInt(bottomDecoration,
                     "offsetTop")
                     + DOM.getElementPropertyInt(bottomDecoration,
                             "offsetHeight")
@@ -242,7 +246,7 @@ public class IPanel extends SimplePanel implements Paintable,
     }
 
     public void onBrowserEvent(Event event) {
-        Element target = DOM.eventGetTarget(event);
+        final Element target = DOM.eventGetTarget(event);
         if (errorIndicatorElement != null
                 && DOM.compare(target, errorIndicatorElement)) {
             switch (DOM.eventGetType(event)) {
index c5576f70907eaf33d7f1188356f0f96228ace0bd..0690edff94b34cecf094a614d87cee0f8318ee74 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import com.google.gwt.user.client.DOM;\r
index abc1ae8199e1f2e714db50f5fd76fd9db03511c3..a2113012b18e991cff480a8c45c6d51e58bdbae7 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import com.google.gwt.user.client.Window;\r
@@ -12,11 +16,11 @@ import com.itmill.toolkit.terminal.gwt.client.UIDL;
 public class IPopupCalendar extends ITextualDate implements Paintable,\r
         ClickListener, PopupListener {\r
 \r
-    private IButton calendarToggle;\r
+    private final IButton calendarToggle;\r
 \r
-    private CalendarPanel calendar;\r
+    private final CalendarPanel calendar;\r
 \r
-    private ToolkitOverlay popup;\r
+    private final ToolkitOverlay popup;\r
     private boolean open = false;\r
 \r
     public IPopupCalendar() {\r
@@ -49,8 +53,8 @@ public class IPopupCalendar extends ITextualDate implements Paintable,
             // clear previous values\r
             popup.setWidth("");\r
             popup.setHeight("");\r
-            int w = calendar.getOffsetWidth();\r
-            int h = calendar.getOffsetHeight();\r
+            final int w = calendar.getOffsetWidth();\r
+            final int h = calendar.getOffsetHeight();\r
             int t = calendarToggle.getAbsoluteTop();\r
             int l = calendarToggle.getAbsoluteLeft();\r
             if (l + w > Window.getClientWidth() + Window.getScrollLeft()) {\r
index d77b792750956cf85e8d9f24c3074c01dbf3f486..a0672e8623b7b8e1c2a2c5725990eb3d451c201d 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.DOM;
@@ -14,7 +18,7 @@ public class IProgressIndicator extends Widget implements Paintable {
     Element wrapper = DOM.createDiv();
     Element indicator = DOM.createDiv();
     private ApplicationConnection client;
-    private Poller poller;
+    private final Poller poller;
 
     public IProgressIndicator() {
         setElement(wrapper);
@@ -33,16 +37,17 @@ public class IProgressIndicator extends Widget implements Paintable {
         if (client.updateComponent(this, uidl, true)) {
             return;
         }
-        boolean indeterminate = uidl.getBooleanAttribute("indeterminate");
+        final boolean indeterminate = uidl.getBooleanAttribute("indeterminate");
 
         if (indeterminate) {
             // TODO put up some image or something
         } else {
             try {
-                float f = Float.parseFloat(uidl.getStringAttribute("state"));
-                int size = Math.round(100 * f);
+                final float f = Float.parseFloat(uidl
+                        .getStringAttribute("state"));
+                final int size = Math.round(100 * f);
                 DOM.setStyleAttribute(indicator, "width", size + "%");
-            } catch (Exception e) {
+            } catch (final Exception e) {
             }
         }
         poller.scheduleRepeating(uidl.getIntAttribute("pollinginterval"));
index aea371ce024fa92c6ce553d6528d656df5dd2d58..750cf34d2cde591df218bfde001a4c0b4d9442a9 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.HashMap;
@@ -82,19 +86,19 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
 
     private int selectMode = Table.SELECT_MODE_NONE;
 
-    private HashSet selectedRowKeys = new HashSet();
+    private final HashSet selectedRowKeys = new HashSet();
 
     private boolean initializedAndAttached = false;
 
-    private TableHead tHead = new TableHead();
+    private final TableHead tHead = new TableHead();
 
-    private ScrollPanel bodyContainer = new ScrollPanel();
+    private final ScrollPanel bodyContainer = new ScrollPanel();
 
     private int totalRows;
 
     private Set collapsedColumns;
 
-    private RowRequestHandler rowRequestHandler;
+    private final RowRequestHandler rowRequestHandler;
     private IScrollTableBody tBody;
     private String width;
     private String height;
@@ -107,11 +111,11 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
      * This map contains captions and icon urls for actions like: * "33_c" ->
      * "Edit" * "33_i" -> "http://dom.com/edit.png"
      */
-    private HashMap actionMap = new HashMap();
+    private final HashMap actionMap = new HashMap();
     private String[] visibleColOrder;
     private boolean initialContentReceived = false;
     private Element scrollPositionElement;
-    private FlowPanel panel;
+    private final FlowPanel panel;
     private boolean enabled;
     private boolean showColHeaders;
 
@@ -140,7 +144,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         this.client = client;
         paintableId = uidl.getStringAttribute("id");
         immediate = uidl.getBooleanAttribute("immediate");
-        int newTotalRows = uidl.getIntAttribute("totalrows");
+        final int newTotalRows = uidl.getIntAttribute("totalrows");
         if (newTotalRows != totalRows) {
             totalRows = newTotalRows;
             if (initializedAndAttached) {
@@ -171,9 +175,10 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         }
 
         if (uidl.hasVariable("selected")) {
-            Set selectedKeys = uidl.getStringArrayVariableAsSet("selected");
+            final Set selectedKeys = uidl
+                    .getStringArrayVariableAsSet("selected");
             selectedRowKeys.clear();
-            for (Iterator it = selectedKeys.iterator(); it.hasNext();) {
+            for (final Iterator it = selectedKeys.iterator(); it.hasNext();) {
                 selectedRowKeys.add(it.next());
             }
         }
@@ -200,8 +205,8 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         }
 
         UIDL rowData = null;
-        for (Iterator it = uidl.getChildIterator(); it.hasNext();) {
-            UIDL c = (UIDL) it.next();
+        for (final Iterator it = uidl.getChildIterator(); it.hasNext();) {
+            final UIDL c = (UIDL) it.next();
             if (c.getTag().equals("rows")) {
                 rowData = c;
             } else if (c.getTag().equals("actions")) {
@@ -230,19 +235,19 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
     }
 
     private void updateVisibleColumns(UIDL uidl) {
-        Iterator it = uidl.getChildIterator();
+        final Iterator it = uidl.getChildIterator();
         while (it.hasNext()) {
-            UIDL col = (UIDL) it.next();
+            final UIDL col = (UIDL) it.next();
             tHead.updateCellFromUIDL(col);
         }
     }
 
     private void updateActionMap(UIDL c) {
-        Iterator it = c.getChildIterator();
+        final Iterator it = c.getChildIterator();
         while (it.hasNext()) {
-            UIDL action = (UIDL) it.next();
-            String key = action.getStringAttribute("key");
-            String caption = action.getStringAttribute("caption");
+            final UIDL action = (UIDL) it.next();
+            final String key = action.getStringAttribute("key");
+            final String caption = action.getStringAttribute("caption");
             actionMap.put(key + "_c", caption);
             if (action.hasAttribute("icon")) {
                 // TODO need some uri handling ??
@@ -280,7 +285,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         }
 
         for (int i = 0; i < strings.length; i++) {
-            String cid = strings[i];
+            final String cid = strings[i];
             visibleColOrder[colIndex] = cid;
             tHead.enableColumn(cid, colIndex);
             colIndex++;
@@ -312,13 +317,13 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
 
         tBody.renderRows(uidl, firstRow, reqRows);
 
-        int optimalFirstRow = (int) (firstRowInViewPort - pageLength
+        final int optimalFirstRow = (int) (firstRowInViewPort - pageLength
                 * CACHE_RATE);
         while (tBody.getFirstRendered() < optimalFirstRow) {
             // client.console.log("removing row from start");
             tBody.unlinkRow(true);
         }
-        int optimalLastRow = (int) (firstRowInViewPort + pageLength + pageLength
+        final int optimalLastRow = (int) (firstRowInViewPort + pageLength + pageLength
                 * CACHE_RATE);
         while (tBody.getLastRendered() > optimalLastRow) {
             // client.console.log("removing row from the end");
@@ -362,7 +367,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
     }
 
     private void setColWidth(int colIndex, int w) {
-        HeaderCell cell = tHead.getHeaderCell(colIndex);
+        final HeaderCell cell = tHead.getHeaderCell(colIndex);
         cell.setWidth(w);
         tBody.setColWidth(colIndex, w);
     }
@@ -372,7 +377,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
     }
 
     private IScrollTableRow getRenderedRowByKey(String key) {
-        Iterator it = tBody.iterator();
+        final Iterator it = tBody.iterator();
         IScrollTableRow r = null;
         while (it.hasNext()) {
             r = (IScrollTableRow) it.next();
@@ -385,7 +390,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
 
     private void reOrderColumn(String columnKey, int newIndex) {
 
-        int oldIndex = getColIndexByKey(columnKey);
+        final int oldIndex = getColIndexByKey(columnKey);
 
         // Change header order
         tHead.moveCell(oldIndex, newIndex);
@@ -400,7 +405,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
          * array unless on moved columnKey. On new index also put the moved key
          * i == index on columnOrder, j == index on newOrder
          */
-        String oldKeyOnNewIndex = visibleColOrder[newIndex];
+        final String oldKeyOnNewIndex = visibleColOrder[newIndex];
         if (showRowHeaders) {
             newIndex--; // columnOrder don't have rowHeader
         }
@@ -414,7 +419,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
             }
         }
         // finally we can build the new columnOrder for server
-        String[] newOrder = new String[columnOrder.length];
+        final String[] newOrder = new String[columnOrder.length];
         for (int i = 0, j = 0; j < newOrder.length; i++) {
             if (j == newIndex) {
                 newOrder[j] = columnKey;
@@ -433,7 +438,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         // also update visibleColumnOrder
         int i = showRowHeaders ? 1 : 0;
         for (int j = 0; j < newOrder.length; j++) {
-            String cid = newOrder[j];
+            final String cid = newOrder[j];
             if (!isCollapsedColumn(cid)) {
                 visibleColOrder[i++] = cid;
             }
@@ -453,7 +458,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         super.onDetach();
         // ensure that scrollPosElement will be detached
         if (scrollPositionElement != null) {
-            Element parent = DOM.getParent(scrollPositionElement);
+            final Element parent = DOM.getParent(scrollPositionElement);
             if (parent != null) {
                 DOM.removeChild(parent, scrollPositionElement);
             }
@@ -481,20 +486,20 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         int totalExplicitColumnsWidths = 0;
         int total = 0;
 
-        int[] widths = new int[tHead.visibleCells.size()];
+        final int[] widths = new int[tHead.visibleCells.size()];
 
         // first loop: collect natural widths
         while (headCells.hasNext()) {
-            HeaderCell hCell = (HeaderCell) headCells.next();
+            final HeaderCell hCell = (HeaderCell) headCells.next();
             int w;
             if (hCell.getWidth() > 0) {
                 // server has defined column width explicitly
                 w = hCell.getWidth();
                 totalExplicitColumnsWidths += w;
             } else {
-                int hw = DOM.getElementPropertyInt(hCell.getElement(),
+                final int hw = DOM.getElementPropertyInt(hCell.getElement(),
                         "offsetWidth");
-                int cw = tBody.getColWidth(i);
+                final int cw = tBody.getColWidth(i);
                 w = (hw > cw ? hw : cw) + IScrollTableBody.CELL_EXTRA_WIDTH;
             }
             widths[i] = w;
@@ -539,8 +544,8 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
 
         if (availW > total) {
             // natural size is smaller than available space
-            int extraSpace = availW - total;
-            int totalWidthR = total - totalExplicitColumnsWidths;
+            final int extraSpace = availW - total;
+            final int totalWidthR = total - totalExplicitColumnsWidths;
             if (totalWidthR > 0) {
                 // now we will share this sum relatively to those without
                 // explicit width
@@ -551,7 +556,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
                     hCell = (HeaderCell) headCells.next();
                     if (hCell.getWidth() == -1) {
                         int w = widths[i];
-                        int newSpace = extraSpace * w / totalWidthR;
+                        final int newSpace = extraSpace * w / totalWidthR;
                         w += newSpace;
                         widths[i] = w;
                     }
@@ -566,9 +571,9 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         i = 0;
         headCells = tHead.iterator();
         while (headCells.hasNext()) {
-            HeaderCell hCell = (HeaderCell) headCells.next();
+            final HeaderCell hCell = (HeaderCell) headCells.next();
             if (hCell.getWidth() == -1) {
-                int w = widths[i];
+                final int w = widths[i];
                 setColWidth(i, w);
             }
             i++;
@@ -655,8 +660,8 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         if (preLimit < 0) {
             preLimit = 0;
         }
-        int lastRendered = tBody.getLastRendered();
-        int firstRendered = tBody.getFirstRendered();
+        final int lastRendered = tBody.getLastRendered();
+        final int firstRendered = tBody.getFirstRendered();
 
         if (postLimit <= lastRendered && preLimit >= firstRendered) {
             client.updateVariable(paintableId, "firstvisible",
@@ -822,7 +827,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         Element floatingCopyOfHeaderCell;
 
         private boolean sortable = false;
-        private String cid;
+        private final String cid;
         private boolean dragging;
 
         private int dragStartX;
@@ -1016,7 +1021,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
                         createFloatingCopy();
                         moved = true;
                     }
-                    int x = DOM.eventGetClientX(event)
+                    final int x = DOM.eventGetClientX(event)
                             + DOM.getElementPropertyInt(tHead.hTableWrapper,
                                     "scrollLeft");
                     int slotX = headerX;
@@ -1026,13 +1031,13 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
                     if (showRowHeaders) {
                         start++;
                     }
-                    int visibleCellCount = tHead.getVisibleCellCount();
+                    final int visibleCellCount = tHead.getVisibleCellCount();
                     for (int i = start; i <= visibleCellCount; i++) {
                         if (i > 0) {
-                            String colKey = getColKeyByIndex(i - 1);
+                            final String colKey = getColKeyByIndex(i - 1);
                             slotX += getColWidth(colKey);
                         }
-                        int dist = Math.abs(x - slotX);
+                        final int dist = Math.abs(x - slotX);
                         if (closestDistance == -1 || dist < closestDistance) {
                             closestDistance = dist;
                             closestSlot = i;
@@ -1065,7 +1070,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
                 break;
             case Event.ONMOUSEMOVE:
                 if (isResizing) {
-                    int deltaX = DOM.eventGetClientX(event) - dragStartX;
+                    final int deltaX = DOM.eventGetClientX(event) - dragStartX;
                     if (deltaX == 0) {
                         return;
                     }
@@ -1147,7 +1152,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         Element headerTableBody = DOM.createTBody();
         Element tr = DOM.createTR();
 
-        private Element columnSelector = DOM.createDiv();
+        private final Element columnSelector = DOM.createDiv();
 
         private int focusedSlot = -1;
 
@@ -1179,7 +1184,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         }
 
         public void updateCellFromUIDL(UIDL col) {
-            String cid = col.getStringAttribute("cid");
+            final String cid = col.getStringAttribute("cid");
             HeaderCell c = getHeaderCell(cid);
             if (c == null) {
                 c = new HeaderCell(cid, col.getStringAttribute("caption"));
@@ -1200,14 +1205,14 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
                 c.setAlign(col.getStringAttribute("align").charAt(0));
             }
             if (col.hasAttribute("width")) {
-                String width = col.getStringAttribute("width");
+                final String width = col.getStringAttribute("width");
                 c.setWidth(Integer.parseInt(width));
             }
             // TODO icon
         }
 
         public void enableColumn(String cid, int index) {
-            HeaderCell c = getHeaderCell(cid);
+            final HeaderCell c = getHeaderCell(cid);
             if (!c.isEnabled()) {
                 setHeaderCell(index, c);
             }
@@ -1275,8 +1280,8 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         }
 
         public void moveCell(int oldIndex, int newIndex) {
-            HeaderCell hCell = getHeaderCell(oldIndex);
-            Element cell = hCell.getElement();
+            final HeaderCell hCell = getHeaderCell(oldIndex);
+            final Element cell = hCell.getElement();
 
             visibleCells.remove(oldIndex);
             DOM.removeChild(tr, cell);
@@ -1300,7 +1305,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         }
 
         public void removeCell(String colKey) {
-            HeaderCell c = getHeaderCell(colKey);
+            final HeaderCell c = getHeaderCell(colKey);
             remove(c);
         }
 
@@ -1335,8 +1340,8 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         public void onBrowserEvent(Event event) {
             if (enabled) {
                 if (DOM.compare(DOM.eventGetTarget(event), columnSelector)) {
-                    int left = DOM.getAbsoluteLeft(columnSelector);
-                    int top = DOM.getAbsoluteTop(columnSelector)
+                    final int left = DOM.getAbsoluteLeft(columnSelector);
+                    final int top = DOM.getAbsoluteTop(columnSelector)
                             + DOM.getElementPropertyInt(columnSelector,
                                     "offsetHeight");
                     client.getContextMenu().showAt(this, left, top);
@@ -1380,7 +1385,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
              * Override default method to distinguish on/off columns
              */
             public String getHTML() {
-                StringBuffer buf = new StringBuffer();
+                final StringBuffer buf = new StringBuffer();
                 if (collapsed) {
                     buf.append("<span class=\"i-off\">");
                 }
@@ -1410,16 +1415,18 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
                 for (i = 0; i < visibleColOrder.length; i++) {
                     cols[i] = visibleColOrder[i];
                 }
-                for (Iterator it = collapsedColumns.iterator(); it.hasNext();) {
+                for (final Iterator it = collapsedColumns.iterator(); it
+                        .hasNext();) {
                     cols[i++] = it.next();
                 }
             }
-            Action[] actions = new Action[cols.length];
+            final Action[] actions = new Action[cols.length];
 
             for (int i = 0; i < cols.length; i++) {
-                String cid = (String) cols[i];
-                HeaderCell c = getHeaderCell(cid);
-                VisibleColumnAction a = new VisibleColumnAction(c.getColKey());
+                final String cid = (String) cols[i];
+                final HeaderCell c = getHeaderCell(cid);
+                final VisibleColumnAction a = new VisibleColumnAction(c
+                        .getColKey());
                 a.setCaption(c.getCaption());
                 if (!c.isEnabled()) {
                     a.setCollapsed(true);
@@ -1441,8 +1448,8 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
          * Returns column alignments for visible columns
          */
         public char[] getColumnAlignments() {
-            Iterator it = visibleCells.iterator();
-            char[] aligns = new char[visibleCells.size()];
+            final Iterator it = visibleCells.iterator();
+            final char[] aligns = new char[visibleCells.size()];
             int colIndex = 0;
             while (it.hasNext()) {
                 aligns[colIndex++] = ((HeaderCell) it.next()).getAlign();
@@ -1468,7 +1475,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
 
         private int rowHeight = -1;
 
-        private List renderedRows = new Vector();
+        private final List renderedRows = new Vector();
 
         private boolean initDone = false;
 
@@ -1512,11 +1519,11 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         public void renderInitialRows(UIDL rowData, int firstIndex, int rows) {
             firstRendered = firstIndex;
             lastRendered = firstIndex + rows - 1;
-            Iterator it = rowData.getChildIterator();
+            final Iterator it = rowData.getChildIterator();
             aligns = tHead.getColumnAlignments();
             while (it.hasNext()) {
-                IScrollTableRow row = new IScrollTableRow((UIDL) it.next(),
-                        aligns);
+                final IScrollTableRow row = new IScrollTableRow((UIDL) it
+                        .next(), aligns);
                 addRow(row);
             }
             if (isAttached()) {
@@ -1526,16 +1533,16 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
 
         public void renderRows(UIDL rowData, int firstIndex, int rows) {
             aligns = tHead.getColumnAlignments();
-            Iterator it = rowData.getChildIterator();
+            final Iterator it = rowData.getChildIterator();
             if (firstIndex == lastRendered + 1) {
                 while (it.hasNext()) {
-                    IScrollTableRow row = createRow((UIDL) it.next());
+                    final IScrollTableRow row = createRow((UIDL) it.next());
                     addRow(row);
                     lastRendered++;
                 }
                 fixSpacers();
             } else if (firstIndex + rows == firstRendered) {
-                IScrollTableRow[] rowArray = new IScrollTableRow[rows];
+                final IScrollTableRow[] rowArray = new IScrollTableRow[rows];
                 int i = rows;
                 while (it.hasNext()) {
                     i--;
@@ -1552,7 +1559,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
                 while (lastRendered + 1 > firstRendered) {
                     unlinkRow(false);
                 }
-                IScrollTableRow row = createRow((UIDL) it.next());
+                final IScrollTableRow row = createRow((UIDL) it.next());
                 firstRendered = firstIndex;
                 lastRendered = firstIndex - 1;
                 addRow(row);
@@ -1581,11 +1588,12 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
          * @param uidl
          */
         private IScrollTableRow createRow(UIDL uidl) {
-            IScrollTableRow row = new IScrollTableRow(uidl, aligns);
-            int cells = DOM.getChildCount(row.getElement());
+            final IScrollTableRow row = new IScrollTableRow(uidl, aligns);
+            final int cells = DOM.getChildCount(row.getElement());
             for (int i = 0; i < cells; i++) {
-                Element cell = DOM.getChild(row.getElement(), i);
-                int w = IScrollTable.this.getColWidth(getColKeyByIndex(i));
+                final Element cell = DOM.getChild(row.getElement(), i);
+                final int w = IScrollTable.this
+                        .getColWidth(getColKeyByIndex(i));
                 DOM.setStyleAttribute(DOM.getFirstChild(cell), "width",
                         (w - CELL_CONTENT_PADDING) + "px");
                 DOM.setStyleAttribute(cell, "width", w + "px");
@@ -1642,7 +1650,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
                 index = renderedRows.size() - 1;
                 lastRendered--;
             }
-            IScrollTableRow toBeRemoved = (IScrollTableRow) renderedRows
+            final IScrollTableRow toBeRemoved = (IScrollTableRow) renderedRows
                     .get(index);
             client.unregisterChildPaintables(toBeRemoved);
             DOM.removeChild(tBody, toBeRemoved.getElement());
@@ -1698,7 +1706,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
 
         public int getColWidth(int i) {
             if (initDone) {
-                Element e = DOM.getChild(DOM.getChild(tBody, 0), i);
+                final Element e = DOM.getChild(DOM.getChild(tBody, 0), i);
                 return DOM.getElementPropertyInt(e, "offsetWidth");
             } else {
                 return 0;
@@ -1706,9 +1714,10 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         }
 
         public void setColWidth(int colIndex, int w) {
-            int rows = DOM.getChildCount(tBody);
+            final int rows = DOM.getChildCount(tBody);
             for (int i = 0; i < rows; i++) {
-                Element cell = DOM.getChild(DOM.getChild(tBody, i), colIndex);
+                final Element cell = DOM.getChild(DOM.getChild(tBody, i),
+                        colIndex);
                 DOM.setStyleAttribute(DOM.getFirstChild(cell), "width",
                         (w - CELL_CONTENT_PADDING) + "px");
                 DOM.setStyleAttribute(cell, "width", w + "px");
@@ -1726,11 +1735,11 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         public void moveCol(int oldIndex, int newIndex) {
 
             // loop all rows and move given index to its new place
-            Iterator rows = iterator();
+            final Iterator rows = iterator();
             while (rows.hasNext()) {
-                IScrollTableRow row = (IScrollTableRow) rows.next();
+                final IScrollTableRow row = (IScrollTableRow) rows.next();
 
-                Element td = DOM.getChild(row.getElement(), oldIndex);
+                final Element td = DOM.getChild(row.getElement(), oldIndex);
                 DOM.removeChild(row.getElement(), td);
 
                 DOM.insertChild(row.getElement(), td, newIndex);
@@ -1743,7 +1752,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
 
             Vector childWidgets = new Vector();
             private boolean selected = false;
-            private int rowKey;
+            private final int rowKey;
 
             private String[] actionKeys = null;
 
@@ -1796,13 +1805,14 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
                     actionKeys = uidl.getStringArrayAttribute("al");
                 }
 
-                Iterator cells = uidl.getChildIterator();
+                final Iterator cells = uidl.getChildIterator();
                 while (cells.hasNext()) {
-                    Object cell = cells.next();
+                    final Object cell = cells.next();
                     if (cell instanceof String) {
                         addCell(cell.toString(), aligns[col++]);
                     } else {
-                        Widget cellContent = client.getWidget((UIDL) cell);
+                        final Widget cellContent = client
+                                .getWidget((UIDL) cell);
                         ((Paintable) cellContent).updateFromUIDL((UIDL) cell,
                                 client);
                         addCell(cellContent, aligns[col++]);
@@ -1815,8 +1825,8 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
 
             public void addCell(String text, char align) {
                 // String only content is optimized by not using Label widget
-                Element td = DOM.createTD();
-                Element container = DOM.createDiv();
+                final Element td = DOM.createTD();
+                final Element container = DOM.createDiv();
                 DOM.setElementProperty(container, "className", CLASSNAME
                         + "-cell-content");
                 DOM.setInnerHTML(container, text);
@@ -1836,8 +1846,8 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
             }
 
             public void addCell(Widget w, char align) {
-                Element td = DOM.createTD();
-                Element container = DOM.createDiv();
+                final Element td = DOM.createTD();
+                final Element container = DOM.createDiv();
                 DOM.setElementProperty(container, "className", CLASSNAME
                         + "-cell-content");
                 // TODO make widget cells respect align. text-align:center for
@@ -1864,7 +1874,8 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
             public void onBrowserEvent(Event event) {
                 switch (DOM.eventGetType(event)) {
                 case Event.ONCLICK:
-                    Element tdOrTr = DOM.getParent(DOM.eventGetTarget(event));
+                    final Element tdOrTr = DOM.getParent(DOM
+                            .eventGetTarget(event));
                     if (DOM.compare(getElement(), tdOrTr)
                             || DOM.compare(getElement(), DOM.getParent(tdOrTr))) {
                         if (selectMode > Table.SELECT_MODE_NONE) {
@@ -1919,11 +1930,11 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
                 if (actionKeys == null) {
                     return new Action[] {};
                 }
-                Action[] actions = new Action[actionKeys.length];
+                final Action[] actions = new Action[actionKeys.length];
                 for (int i = 0; i < actions.length; i++) {
-                    String actionKey = actionKeys[i];
-                    TreeAction a = new TreeAction(this, String.valueOf(rowKey),
-                            actionKey);
+                    final String actionKey = actionKeys[i];
+                    final TreeAction a = new TreeAction(this, String
+                            .valueOf(rowKey), actionKey);
                     a.setCaption(getActionCaption(actionKey));
                     a.setIconUrl(getActionIcon(actionKey));
                     actions[i] = a;
@@ -1942,9 +1953,9 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
     }
 
     public void deselectAll() {
-        Object[] keys = selectedRowKeys.toArray();
+        final Object[] keys = selectedRowKeys.toArray();
         for (int i = 0; i < keys.length; i++) {
-            IScrollTableRow row = getRenderedRowByKey((String) keys[i]);
+            final IScrollTableRow row = getRenderedRowByKey((String) keys[i]);
             if (row != null && row.isSelected()) {
                 row.toggleSelection();
             }
@@ -1975,13 +1986,13 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
         // workaround very common 100% height problem - extract borders
         if (height.equals("100%")) {
             final int borders = getBorderSpace();
-            Element elem = getElement();
-            Element parentElem = DOM.getParent(elem);
+            final Element elem = getElement();
+            final Element parentElem = DOM.getParent(elem);
 
             // put table away from flow for a moment
             DOM.setStyleAttribute(getElement(), "position", "absolute");
             // get containers natural space for table
-            int availPixels = DOM.getElementPropertyInt(parentElem,
+            final int availPixels = DOM.getElementPropertyInt(parentElem,
                     "offsetHeight");
             // put table back to flow
             DOM.setStyleAttribute(getElement(), "position", "static");
@@ -1998,7 +2009,7 @@ public class IScrollTable extends Composite implements Table, ScrollListener,
     }
 
     private int getBorderSpace() {
-        Element el = getElement();
+        final Element el = getElement();
         return DOM.getElementPropertyInt(el, "offsetHeight")
                 - DOM.getElementPropertyInt(el, "clientHeight");
     }
index 35608fdb9107244b2b8302da79943afecf413a26..f24ddf686fc7b3a0060bcc13388d2450bef371f8 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import com.google.gwt.user.client.Command;\r
@@ -43,16 +47,16 @@ public class ISlider extends Widget implements Paintable,
     private boolean arrows;\r
 \r
     /* DOM element for slider's base */\r
-    private Element base;\r
+    private final Element base;\r
 \r
     /* DOM element for slider's handle */\r
-    private Element handle;\r
+    private final Element handle;\r
 \r
     /* DOM element for decrement arrow */\r
-    private Element smaller;\r
+    private final Element smaller;\r
 \r
     /* DOM element for increment arrow */\r
-    private Element bigger;\r
+    private final Element bigger;\r
 \r
     /* Temporary dragging/animation variables */\r
     private boolean dragging = false;\r
@@ -159,7 +163,7 @@ public class ISlider extends Widget implements Paintable,
         final String domProperty = vertical ? "offsetHeight" : "offsetWidth";\r
 \r
         if (size == -1) {\r
-            Element p = DOM.getParent(getElement());\r
+            final Element p = DOM.getParent(getElement());\r
             if (DOM.getElementPropertyInt(p, domProperty) > 50) {\r
                 if (vertical) {\r
                     setHeight();\r
@@ -172,7 +176,7 @@ public class ISlider extends Widget implements Paintable,
                 DOM.setStyleAttribute(base, styleAttribute, MIN_SIZE + "px");\r
                 DeferredCommand.addCommand(new Command() {\r
                     public void execute() {\r
-                        Element p = DOM.getParent(getElement());\r
+                        final Element p = DOM.getParent(getElement());\r
                         if (DOM.getElementPropertyInt(p, domProperty) > (MIN_SIZE + 5)) {\r
                             if (vertical) {\r
                                 setHeight();\r
@@ -193,9 +197,9 @@ public class ISlider extends Widget implements Paintable,
     }\r
 \r
     private void buildHandle() {\r
-        String styleAttribute = vertical ? "height" : "width";\r
-        String handleAttribute = vertical ? "marginTop" : "marginLeft";\r
-        String domProperty = vertical ? "offsetHeight" : "offsetWidth";\r
+        final String styleAttribute = vertical ? "height" : "width";\r
+        final String handleAttribute = vertical ? "marginTop" : "marginLeft";\r
+        final String domProperty = vertical ? "offsetHeight" : "offsetWidth";\r
 \r
         DOM.setStyleAttribute(handle, handleAttribute, "0");\r
 \r
@@ -204,9 +208,9 @@ public class ISlider extends Widget implements Paintable,
             int s = (int) (Double.parseDouble(DOM.getElementProperty(base,\r
                     domProperty)) / 100 * handleSize);\r
             if (handleSize == -1) {\r
-                int baseS = Integer.parseInt(DOM.getElementProperty(base,\r
+                final int baseS = Integer.parseInt(DOM.getElementProperty(base,\r
                         domProperty));\r
-                double range = (max - min) * (resolution + 1) * 3;\r
+                final double range = (max - min) * (resolution + 1) * 3;\r
                 s = (int) (baseS - range);\r
             }\r
             if (s < 3) {\r
@@ -231,14 +235,14 @@ public class ISlider extends Widget implements Paintable,
 \r
         // Update handle position\r
         final String styleAttribute = vertical ? "marginTop" : "marginLeft";\r
-        String domProperty = vertical ? "offsetHeight" : "offsetWidth";\r
-        int handleSize = Integer.parseInt(DOM.getElementProperty(handle,\r
+        final String domProperty = vertical ? "offsetHeight" : "offsetWidth";\r
+        final int handleSize = Integer.parseInt(DOM.getElementProperty(handle,\r
                 domProperty));\r
-        int baseSize = Integer.parseInt(DOM.getElementProperty(base,\r
+        final int baseSize = Integer.parseInt(DOM.getElementProperty(base,\r
                 domProperty));\r
-        int range = baseSize - handleSize;\r
+        final int range = baseSize - handleSize;\r
         double v = value.doubleValue();\r
-        double valueRange = max - min;\r
+        final double valueRange = max - min;\r
         double p = 0;\r
         if (valueRange > 0) {\r
             p = range * ((v - min) / valueRange);\r
@@ -253,7 +257,7 @@ public class ISlider extends Widget implements Paintable,
         }\r
         final double pos = p;\r
 \r
-        int current = DOM.getIntStyleAttribute(handle, styleAttribute);\r
+        final int current = DOM.getIntStyleAttribute(handle, styleAttribute);\r
 \r
         if ((int) (Math.round(pos)) != current && animate) {\r
             if (anim != null) {\r
@@ -261,7 +265,7 @@ public class ISlider extends Widget implements Paintable,
             }\r
             anim = new Timer() {\r
                 private int current;\r
-                private int goal = (int) Math.round(pos);\r
+                private final int goal = (int) Math.round(pos);\r
                 private int dir = 0;\r
 \r
                 public void run() {\r
@@ -277,7 +281,7 @@ public class ISlider extends Widget implements Paintable,
                         cancel();\r
                         return;\r
                     }\r
-                    int increment = (goal - current) / 2;\r
+                    final int increment = (goal - current) / 2;\r
                     DOM.setStyleAttribute(handle, styleAttribute,\r
                             (current + increment) + "px");\r
                 }\r
@@ -311,7 +315,7 @@ public class ISlider extends Widget implements Paintable,
         if (disabled || readonly) {\r
             return;\r
         }\r
-        Element targ = DOM.eventGetTarget(event);\r
+        final Element targ = DOM.eventGetTarget(event);\r
 \r
         if (DOM.eventGetType(event) == Event.ONMOUSEWHEEL) {\r
             processMouseWheelEvent(event);\r
@@ -327,7 +331,7 @@ public class ISlider extends Widget implements Paintable,
     }\r
 \r
     private void processMouseWheelEvent(Event event) {\r
-        int dir = DOM.eventGetMouseWheelVelocityY(event);\r
+        final int dir = DOM.eventGetMouseWheelVelocityY(event);\r
         if (dir < 0) {\r
             increaseValue(event, false);\r
         } else {\r
@@ -426,16 +430,16 @@ public class ISlider extends Widget implements Paintable,
     private void setValueByEvent(Event event, boolean animate, boolean roundup) {\r
         double v = min; // Fallback to min\r
 \r
-        int coord = vertical ? DOM.eventGetClientY(event) : DOM\r
+        final int coord = vertical ? DOM.eventGetClientY(event) : DOM\r
                 .eventGetClientX(event);\r
-        String domProperty = vertical ? "offsetHeight" : "offsetWidth";\r
+        final String domProperty = vertical ? "offsetHeight" : "offsetWidth";\r
 \r
-        double handleSize = Integer.parseInt(DOM.getElementProperty(handle,\r
-                domProperty));\r
-        double baseSize = Integer.parseInt(DOM.getElementProperty(base,\r
+        final double handleSize = Integer.parseInt(DOM.getElementProperty(\r
+                handle, domProperty));\r
+        final double baseSize = Integer.parseInt(DOM.getElementProperty(base,\r
                 domProperty));\r
-        double baseOffset = vertical ? DOM.getAbsoluteTop(base) - handleSize\r
-                / 2 : DOM.getAbsoluteLeft(base) + handleSize / 2;\r
+        final double baseOffset = vertical ? DOM.getAbsoluteTop(base)\r
+                - handleSize / 2 : DOM.getAbsoluteLeft(base) + handleSize / 2;\r
 \r
         if (vertical) {\r
             v = ((baseSize - (coord - baseOffset)) / (baseSize - handleSize))\r
@@ -467,10 +471,10 @@ public class ISlider extends Widget implements Paintable,
             // Calculate decoration size\r
             DOM.setStyleAttribute(base, "height", "0");\r
             DOM.setStyleAttribute(base, "overflow", "hidden");\r
-            int decoHeight = DOM.getElementPropertyInt(getElement(),\r
+            final int decoHeight = DOM.getElementPropertyInt(getElement(),\r
                     "offsetHeight");\r
             // Get available space size\r
-            int availableHeight = DOM.getElementPropertyInt(DOM\r
+            final int availableHeight = DOM.getElementPropertyInt(DOM\r
                     .getParent(getElement()), "offsetHeight");\r
             int h = availableHeight - decoHeight;\r
             if (h < MIN_SIZE) {\r
index 00eb3f932b2480972bffe298b26bd4f6b968b3f7..7a067488db350ee1edceab0eb0ff84c65b0a7c8d 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.DOM;
@@ -27,13 +31,13 @@ public class ISplitPanel extends ComplexPanel implements Paintable,
 
     private Widget secondChild;
 
-    private Element wrapper = DOM.createDiv();
+    private final Element wrapper = DOM.createDiv();
 
-    private Element firstContainer = DOM.createDiv();
+    private final Element firstContainer = DOM.createDiv();
 
-    private Element secondContainer = DOM.createDiv();
+    private final Element secondContainer = DOM.createDiv();
 
-    private Element splitter = DOM.createDiv();
+    private final Element splitter = DOM.createDiv();
 
     private boolean resizing;
 
@@ -116,9 +120,9 @@ public class ISplitPanel extends ComplexPanel implements Paintable,
 
         setSplitPosition(uidl.getStringAttribute("position"));
 
-        Paintable newFirstChild = (Paintable) client.getWidget(uidl
+        final Paintable newFirstChild = (Paintable) client.getWidget(uidl
                 .getChildUIDL(0));
-        Paintable newSecondChild = (Paintable) client.getWidget(uidl
+        final Paintable newSecondChild = (Paintable) client.getWidget(uidl
                 .getChildUIDL(1));
         if (firstChild != newFirstChild) {
             if (firstChild != null) {
@@ -277,7 +281,7 @@ public class ISplitPanel extends ComplexPanel implements Paintable,
     }
 
     public void onMouseDown(Event event) {
-        Element trg = DOM.eventGetTarget(event);
+        final Element trg = DOM.eventGetTarget(event);
         if (DOM.compare(trg, splitter)
                 || DOM.compare(trg, DOM.getChild(splitter, 0))) {
             resizing = true;
@@ -294,12 +298,12 @@ public class ISplitPanel extends ComplexPanel implements Paintable,
     public void onMouseMove(Event event) {
         switch (orientation) {
         case ORIENTATION_HORIZONTAL:
-            int x = DOM.eventGetClientX(event);
+            final int x = DOM.eventGetClientX(event);
             onHorizontalMouseMove(x);
             break;
         case ORIENTATION_VERTICAL:
         default:
-            int y = DOM.eventGetClientY(event);
+            final int y = DOM.eventGetClientY(event);
             onVerticalMouseMove(y);
             break;
         }
index 77f08a256484edd344eb1abe21898d2779ca6abe..cfc686b7c2ebbe242682fba80051af641106f883 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 public class ISplitPanelHorizontal extends ISplitPanel {
index cdcd8d0c6559f35cae03d96e7292d35c669570fa..d6e72385e3335836ca67973e368e271b46a7be95 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 public class ISplitPanelVertical extends ISplitPanel {
index d10b62ba43ca79652c54c91d4369bd3f22582fce..1798f52783de6f9fd556b83f2589c1d9e14af832 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.HashMap;
@@ -30,17 +34,17 @@ import com.itmill.toolkit.terminal.gwt.client.UIDL;
 public class ITablePaging extends Composite implements Table, Paintable,
         ClickListener {
 
-    private Grid tBody = new Grid();
-    private Button nextPage = new Button("&gt;");
-    private Button prevPage = new Button("&lt;");
-    private Button firstPage = new Button("&lt;&lt;");
-    private Button lastPage = new Button("&gt;&gt;");
+    private final Grid tBody = new Grid();
+    private final Button nextPage = new Button("&gt;");
+    private final Button prevPage = new Button("&lt;");
+    private final Button firstPage = new Button("&lt;&lt;");
+    private final Button lastPage = new Button("&gt;&gt;");
 
     private int pageLength = 15;
 
     private boolean rowHeaders = false;
 
-    private Map columnOrder = new HashMap();
+    private final Map columnOrder = new HashMap();
 
     private ApplicationConnection client;
     private String id;
@@ -49,19 +53,19 @@ public class ITablePaging extends Composite implements Table, Paintable,
 
     private int selectMode = Table.SELECT_MODE_NONE;
 
-    private Vector selectedRowKeys = new Vector();
+    private final Vector selectedRowKeys = new Vector();
 
     private int totalRows;
 
-    private HashMap columnWidths = new HashMap();
+    private final HashMap columnWidths = new HashMap();
 
-    private HashMap visibleColumns = new HashMap();
+    private final HashMap visibleColumns = new HashMap();
 
     private int rows;
 
     private int firstRow;
     private boolean sortAscending = true;
-    private HorizontalPanel pager;
+    private final HorizontalPanel pager;
 
     public HashMap rowKeysToTableRows = new HashMap();
 
@@ -69,7 +73,7 @@ public class ITablePaging extends Composite implements Table, Paintable,
 
         tBody.setStyleName("itable-tbody");
 
-        VerticalPanel panel = new VerticalPanel();
+        final VerticalPanel panel = new VerticalPanel();
 
         pager = new HorizontalPanel();
         pager.add(firstPage);
@@ -108,9 +112,10 @@ public class ITablePaging extends Composite implements Table, Paintable,
             }
 
             if (uidl.hasAttribute("selected")) {
-                Set selectedKeys = uidl.getStringArrayVariableAsSet("selected");
+                final Set selectedKeys = uidl
+                        .getStringArrayVariableAsSet("selected");
                 selectedRowKeys.clear();
-                for (Iterator it = selectedKeys.iterator(); it.hasNext();) {
+                for (final Iterator it = selectedKeys.iterator(); it.hasNext();) {
                     selectedRowKeys.add(it.next());
                 }
             }
@@ -126,8 +131,8 @@ public class ITablePaging extends Composite implements Table, Paintable,
 
         UIDL rowData = null;
         UIDL visibleColumns = null;
-        for (Iterator it = uidl.getChildIterator(); it.hasNext();) {
-            UIDL c = (UIDL) it.next();
+        for (final Iterator it = uidl.getChildIterator(); it.hasNext();) {
+            final UIDL c = (UIDL) it.next();
             if (c.getTag().equals("rows")) {
                 rowData = c;
             } else if (c.getTag().equals("actions")) {
@@ -145,12 +150,12 @@ public class ITablePaging extends Composite implements Table, Paintable,
     }
 
     private void updateHeader(UIDL c) {
-        Iterator it = c.getChildIterator();
+        final Iterator it = c.getChildIterator();
         visibleColumns.clear();
         int colIndex = (rowHeaders ? 1 : 0);
         while (it.hasNext()) {
-            UIDL col = (UIDL) it.next();
-            String cid = col.getStringAttribute("cid");
+            final UIDL col = (UIDL) it.next();
+            final String cid = col.getStringAttribute("cid");
             if (!col.hasAttribute("collapsed")) {
                 tBody.setWidget(0, colIndex, new HeaderCell(cid, col
                         .getStringAttribute("caption")));
@@ -176,28 +181,29 @@ public class ITablePaging extends Composite implements Table, Paintable,
      *                which contains row data
      */
     private void updateBody(UIDL uidl) {
-        Iterator it = uidl.getChildIterator();
+        final Iterator it = uidl.getChildIterator();
 
         int curRowIndex = 1;
         while (it.hasNext()) {
-            UIDL rowUidl = (UIDL) it.next();
-            TableRow row = new TableRow(curRowIndex, String.valueOf(rowUidl
-                    .getIntAttribute("key")), rowUidl.hasAttribute("selected"));
+            final UIDL rowUidl = (UIDL) it.next();
+            final TableRow row = new TableRow(curRowIndex, String
+                    .valueOf(rowUidl.getIntAttribute("key")), rowUidl
+                    .hasAttribute("selected"));
             int colIndex = 0;
             if (rowHeaders) {
                 tBody.setWidget(curRowIndex, colIndex, new BodyCell(row,
                         rowUidl.getStringAttribute("caption")));
                 colIndex++;
             }
-            Iterator cells = rowUidl.getChildIterator();
+            final Iterator cells = rowUidl.getChildIterator();
             while (cells.hasNext()) {
-                Object cell = cells.next();
+                final Object cell = cells.next();
                 if (cell instanceof String) {
                     tBody.setWidget(curRowIndex, colIndex, new BodyCell(row,
                             (String) cell));
                 } else {
-                    Widget cellContent = client.getWidget((UIDL) cell);
-                    BodyCell bodyCell = new BodyCell(row);
+                    final Widget cellContent = client.getWidget((UIDL) cell);
+                    final BodyCell bodyCell = new BodyCell(row);
                     bodyCell.setWidget(cellContent);
                     tBody.setWidget(curRowIndex, colIndex, bodyCell);
                 }
@@ -262,7 +268,7 @@ public class ITablePaging extends Composite implements Table, Paintable,
             }
         }
         if (sender instanceof HeaderCell) {
-            HeaderCell hCell = (HeaderCell) sender;
+            final HeaderCell hCell = (HeaderCell) sender;
             client.updateVariable(id, "sortcolumn", hCell.getCid(), false);
             client.updateVariable(id, "sortascending", (sortAscending ? false
                     : true), true);
@@ -299,7 +305,7 @@ public class ITablePaging extends Composite implements Table, Paintable,
      * @author mattitahvonen
      */
     public class BodyCell extends SimplePanel {
-        private TableRow row;
+        private final TableRow row;
 
         public BodyCell(TableRow row) {
             super();
@@ -336,8 +342,8 @@ public class ITablePaging extends Composite implements Table, Paintable,
 
     private class TableRow {
 
-        private String key;
-        private int rowIndex;
+        private final String key;
+        private final int rowIndex;
         private boolean selected = false;
 
         public TableRow(int rowIndex, String rowKey, boolean selected) {
@@ -402,9 +408,10 @@ public class ITablePaging extends Composite implements Table, Paintable,
     }
 
     public void deselectAll() {
-        Object[] keys = selectedRowKeys.toArray();
+        final Object[] keys = selectedRowKeys.toArray();
         for (int i = 0; i < keys.length; i++) {
-            TableRow tableRow = (TableRow) rowKeysToTableRows.get(keys[i]);
+            final TableRow tableRow = (TableRow) rowKeysToTableRows
+                    .get(keys[i]);
             if (tableRow != null) {
                 tableRow.setSelected(false);
             }
index 5c775f7d4541fc29a2cf8d48da9fbf9442545059..e3a8404aa125abab81c2d26ac2bc51fe3df4bd6f 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.ArrayList;
@@ -26,8 +30,8 @@ public class ITabsheet extends FlowPanel implements Paintable,
     String id;
     ApplicationConnection client;
 
-    private ArrayList tabKeys = new ArrayList();
-    private ArrayList captions = new ArrayList();
+    private final ArrayList tabKeys = new ArrayList();
+    private final ArrayList captions = new ArrayList();
     int activeTabIndex = 0;
     private final TabBar tb;
     private final ITabsheetPanel tp;
@@ -37,17 +41,14 @@ public class ITabsheet extends FlowPanel implements Paintable,
     private final TabListener tl = new TabListener() {
 
         public void onTabSelected(SourcesTabEvents sender, final int tabIndex) {
-            if (ITabsheet.this.client != null
-                    && ITabsheet.this.activeTabIndex != tabIndex) {
+            if (client != null && activeTabIndex != tabIndex) {
                 addStyleDependentName("loading");
                 // run updating variables in deferred command to bypass some FF
                 // optimization issues
                 DeferredCommand.addCommand(new Command() {
                     public void execute() {
-                        ITabsheet.this.client.updateVariable(ITabsheet.this.id,
-                                "selected", ""
-                                        + ITabsheet.this.tabKeys.get(tabIndex),
-                                true);
+                        client.updateVariable(id, "selected", ""
+                                + tabKeys.get(tabIndex), true);
                     }
                 });
             }
@@ -82,9 +83,9 @@ public class ITabsheet extends FlowPanel implements Paintable,
         add(tb);
         DOM.appendChild(getElement(), contentNode);
         insert(tp, contentNode, 0, true);
-        DOM.appendChild(getElement(), this.deco);
+        DOM.appendChild(getElement(), deco);
 
-        this.tb.addTabListener(this.tl);
+        tb.addTabListener(tl);
 
         clearTabs();
 
@@ -95,7 +96,7 @@ public class ITabsheet extends FlowPanel implements Paintable,
 
     public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
         this.client = client;
-        this.id = uidl.getId();
+        id = uidl.getId();
 
         if (client.updateComponent(this, uidl, false)) {
             return;
@@ -105,10 +106,10 @@ public class ITabsheet extends FlowPanel implements Paintable,
 
         // Add proper stylenames for all elements
         if (uidl.hasAttribute("style")) {
-            String[] styles = uidl.getStringAttribute("style").split(" ");
-            String contentBaseClass = "CLASSNAME" + "-content";
+            final String[] styles = uidl.getStringAttribute("style").split(" ");
+            final String contentBaseClass = "CLASSNAME" + "-content";
             String contentClass = contentBaseClass;
-            String decoBaseClass = CLASSNAME + "-deco";
+            final String decoBaseClass = CLASSNAME + "-deco";
             String decoClass = decoBaseClass;
             for (int i = 0; i < styles.length; i++) {
                 tb.addStyleDependentName(styles[i]);
@@ -137,7 +138,7 @@ public class ITabsheet extends FlowPanel implements Paintable,
         }
 
         // Render content
-        UIDL tabs = uidl.getChildUIDL(0);
+        final UIDL tabs = uidl.getChildUIDL(0);
         boolean keepCurrentTabs = tabKeys.size() == tabs.getNumberOfChildren();
         for (int i = 0; keepCurrentTabs && i < tabKeys.size(); i++) {
             keepCurrentTabs = tabKeys.get(i).equals(
@@ -147,8 +148,8 @@ public class ITabsheet extends FlowPanel implements Paintable,
         }
         if (keepCurrentTabs) {
             int index = 0;
-            for (Iterator it = tabs.getChildIterator(); it.hasNext();) {
-                UIDL tab = (UIDL) it.next();
+            for (final Iterator it = tabs.getChildIterator(); it.hasNext();) {
+                final UIDL tab = (UIDL) it.next();
                 if (tab.getBooleanAttribute("selected")) {
                     activeTabIndex = index;
                     renderContent(tab.getChildUIDL(0));
@@ -161,9 +162,9 @@ public class ITabsheet extends FlowPanel implements Paintable,
             clearTabs();
 
             int index = 0;
-            for (Iterator it = tabs.getChildIterator(); it.hasNext();) {
-                UIDL tab = (UIDL) it.next();
-                String key = tab.getStringAttribute("key");
+            for (final Iterator it = tabs.getChildIterator(); it.hasNext();) {
+                final UIDL tab = (UIDL) it.next();
+                final String key = tab.getStringAttribute("key");
                 String caption = tab.getStringAttribute("caption");
                 if (caption == null) {
                     caption = "&nbsp;";
@@ -188,21 +189,20 @@ public class ITabsheet extends FlowPanel implements Paintable,
         }
 
         // Open selected tab, if there's something to show
-        if (tabKeys.size() > 0)
+        if (tabKeys.size() > 0) {
             tb.selectTab(activeTabIndex);
+        }
 
     }
 
     private void renderContent(final UIDL contentUIDL) {
         DeferredCommand.addCommand(new Command() {
             public void execute() {
-                Widget content = ITabsheet.this.client.getWidget(contentUIDL);
-                ITabsheet.this.tp.remove(ITabsheet.this.activeTabIndex);
-                ITabsheet.this.tp
-                        .insert(content, ITabsheet.this.activeTabIndex);
-                ITabsheet.this.tp.showWidget(ITabsheet.this.activeTabIndex);
-                ((Paintable) content).updateFromUIDL(contentUIDL,
-                        ITabsheet.this.client);
+                final Widget content = client.getWidget(contentUIDL);
+                tp.remove(activeTabIndex);
+                tp.insert(content, activeTabIndex);
+                tp.showWidget(activeTabIndex);
+                ((Paintable) content).updateFromUIDL(contentUIDL, client);
                 ITabsheet.this.removeStyleDependentName("loading");
                 ITabsheet.this.iLayout();
             }
@@ -218,9 +218,9 @@ public class ITabsheet extends FlowPanel implements Paintable,
         tp.clear();
 
         // Get rid of unnecessary 100% cell heights in TabBar (really ugly hack)
-        Element tr = DOM.getChild(DOM.getChild(tb.getElement(), 0), 0);
-        Element rest = DOM.getChild(
-                DOM.getChild(tr, DOM.getChildCount(tr) - 1), 0);
+        final Element tr = DOM.getChild(DOM.getChild(tb.getElement(), 0), 0);
+        final Element rest = DOM.getChild(DOM.getChild(tr, DOM
+                .getChildCount(tr) - 1), 0);
         DOM.removeElementAttribute(rest, "style");
     }
 
@@ -241,18 +241,18 @@ public class ITabsheet extends FlowPanel implements Paintable,
     public void iLayout() {
         if (height != null && height != "") {
             // Take content out of flow for a while
-            String originalPositioning = DOM.getStyleAttribute(tp.getElement(),
-                    "position");
+            final String originalPositioning = DOM.getStyleAttribute(tp
+                    .getElement(), "position");
             DOM.setStyleAttribute(tp.getElement(), "position", "absolute");
             DOM.setStyleAttribute(contentNode, "overflow", "hidden");
 
             // Calculate target height
             super.setHeight(height);
-            int targetHeight = getOffsetHeight();
+            final int targetHeight = getOffsetHeight();
 
             // Calculate used height
             super.setHeight("");
-            int usedHeight = DOM.getElementPropertyInt(deco, "offsetTop")
+            final int usedHeight = DOM.getElementPropertyInt(deco, "offsetTop")
                     + DOM.getElementPropertyInt(deco, "offsetHeight")
                     - DOM.getElementPropertyInt(getElement(), "offsetTop");
 
index e1f8ce3b7ac23cb6b2320c6cf769a20e9230a2a9..8211ed6362e6b67b220760a523dfefc8c6ef1a36 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import com.google.gwt.user.client.DOM;\r
@@ -60,7 +64,7 @@ public class ITabsheetPanel extends ComplexPanel {
     }\r
 \r
     public boolean remove(Widget w) {\r
-        boolean removed = super.remove(w);\r
+        final boolean removed = super.remove(w);\r
         if (removed) {\r
             resetChildWidget(w);\r
 \r
index 1ac103593c9cf963838351076ce97f4142a6d621..deb92869154b5771399b38d99f80307ca0a88027 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import com.google.gwt.user.client.DOM;\r
index 3195954ffcf82e5a3666abddac21bb6ee95e67de..7152d32c0881a7627312bfb91fdeb60077ff5f2a 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.DOM;
@@ -87,25 +91,25 @@ public class ITextField extends TextBoxBase implements Paintable,
     }
 
     private native void setColumns(Element e, int c) /*-{
-                      try {
-                       switch(e.tagName.toLowerCase()) {
-                               case "input":
-                                       //e.size = c;
-                                       e.style.width = c+"em";
-                                       break;
-                               case "textarea":
-                                       //e.cols = c;
-                                       e.style.width = c+"em";
-                                       break;
-                               default:;
-                       }
-                      } catch (e) {}
-                      }-*/;
+                            try {
+                               switch(e.tagName.toLowerCase()) {
+                                       case "input":
+                                               //e.size = c;
+                                               e.style.width = c+"em";
+                                               break;
+                                       case "textarea":
+                                               //e.cols = c;
+                                               e.style.width = c+"em";
+                                               break;
+                                       default:;
+                               }
+                            } catch (e) {}
+                            }-*/;
 
     private native void setRows(Element e, int r) /*-{
-                      try {
-                       if(e.tagName.toLowerCase() == "textarea")
-                               e.rows = r;
-                      } catch (e) {}
-                      }-*/;
+                            try {
+                               if(e.tagName.toLowerCase() == "textarea")
+                                       e.rows = r;
+                            } catch (e) {}
+                            }-*/;
 }
index e5ed1bccbe99d688c08f70fccc5b7744e4236801..fa72f8d6efdf42727a4e318660cc3d4f5d6272e7 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import com.google.gwt.user.client.Timer;\r
@@ -12,7 +16,7 @@ import com.itmill.toolkit.terminal.gwt.client.util.SimpleDateFormat;
 public class ITextualDate extends IDateField implements Paintable,\r
         ChangeListener {\r
 \r
-    private ITextField text;\r
+    private final ITextField text;\r
 \r
     private SimpleDateFormat format;\r
 \r
@@ -60,18 +64,19 @@ public class ITextualDate extends IDateField implements Paintable,
                 if (h > 11 && dts.isTwelveHourClock()) {\r
                     h -= 12;\r
                 }\r
-                int m = currentResolution > IDateField.RESOLUTION_HOUR ? date\r
-                        .getMinutes() : 0;\r
+                final int m = currentResolution > IDateField.RESOLUTION_HOUR ? date\r
+                        .getMinutes()\r
+                        : 0;\r
                 dateText += " " + (h < 10 ? "0" + h : "" + h)\r
                         + dts.getClockDelimeter() + (m < 10 ? "0" + m : "" + m);\r
             }\r
             if (currentResolution >= IDateField.RESOLUTION_SEC) {\r
-                int s = date.getSeconds();\r
+                final int s = date.getSeconds();\r
                 dateText += dts.getClockDelimeter()\r
                         + (s < 10 ? "0" + s : "" + s);\r
             }\r
             if (currentResolution == IDateField.RESOLUTION_MSEC) {\r
-                int ms = getMilliseconds();\r
+                final int ms = getMilliseconds();\r
                 String text = "" + ms;\r
                 if (ms < 10) {\r
                     text = "00" + text;\r
@@ -145,10 +150,10 @@ public class ITextualDate extends IDateField implements Paintable,
 \r
                 try {\r
                     date = format.parse(text.getText());\r
-                } catch (Exception e) {\r
+                } catch (final Exception e) {\r
                     ApplicationConnection.getConsole().log(e.getMessage());\r
                     text.addStyleName(ITextField.CLASSNAME + "-error");\r
-                    Timer t = new Timer() {\r
+                    final Timer t = new Timer() {\r
                         public void run() {\r
                             text.removeStyleName(ITextField.CLASSNAME\r
                                     + "-error");\r
index 826d696fd4c1e58346595959228edd804381dab8..ec49ee969cf1f09af79ec0c0ef5e295f7301268d 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.HashMap;
@@ -29,13 +33,13 @@ public class ITree extends FlowPanel implements Paintable {
     private boolean selectable;
     private boolean isMultiselect;
 
-    private HashMap keyToNode = new HashMap();
+    private final HashMap keyToNode = new HashMap();
 
     /**
      * This map contains captions and icon urls for actions like: * "33_c" ->
      * "Edit" * "33_i" -> "http://dom.com/edit.png"
      */
-    private HashMap actionMap = new HashMap();
+    private final HashMap actionMap = new HashMap();
 
     private boolean immediate;
 
@@ -51,11 +55,11 @@ public class ITree extends FlowPanel implements Paintable {
     }
 
     private void updateActionMap(UIDL c) {
-        Iterator it = c.getChildIterator();
+        final Iterator it = c.getChildIterator();
         while (it.hasNext()) {
-            UIDL action = (UIDL) it.next();
-            String key = action.getStringAttribute("key");
-            String caption = action.getStringAttribute("caption");
+            final UIDL action = (UIDL) it.next();
+            final String key = action.getStringAttribute("key");
+            final String caption = action.getStringAttribute("caption");
             actionMap.put(key + "_c", caption);
             if (action.hasAttribute("icon")) {
                 // TODO need some uri handling ??
@@ -97,17 +101,17 @@ public class ITree extends FlowPanel implements Paintable {
         isNullSelectionAllowed = uidl.getBooleanAttribute("nullselect");
 
         clear();
-        for (Iterator i = uidl.getChildIterator(); i.hasNext();) {
-            UIDL childUidl = (UIDL) i.next();
+        for (final Iterator i = uidl.getChildIterator(); i.hasNext();) {
+            final UIDL childUidl = (UIDL) i.next();
             if ("actions".equals(childUidl.getTag())) {
                 updateActionMap(childUidl);
                 continue;
             }
-            TreeNode childTree = new TreeNode();
+            final TreeNode childTree = new TreeNode();
             this.add(childTree);
             childTree.updateFromUIDL(childUidl, client);
         }
-        String selectMode = uidl.getStringAttribute("selectmode");
+        final String selectMode = uidl.getStringAttribute("selectmode");
         selectable = selectMode != null;
         isMultiselect = "multi".equals(selectMode);
 
@@ -116,7 +120,7 @@ public class ITree extends FlowPanel implements Paintable {
     }
 
     private void handleUpdate(UIDL uidl) {
-        TreeNode rootNode = (TreeNode) keyToNode.get(uidl
+        final TreeNode rootNode = (TreeNode) keyToNode.get(uidl
                 .getStringAttribute("rootKey"));
         if (rootNode != null) {
             if (!rootNode.getState()) {
@@ -132,8 +136,8 @@ public class ITree extends FlowPanel implements Paintable {
         if (selected) {
             if (!isMultiselect) {
                 while (selectedIds.size() > 0) {
-                    String id = (String) selectedIds.iterator().next();
-                    TreeNode oldSelection = (TreeNode) keyToNode.get(id);
+                    final String id = (String) selectedIds.iterator().next();
+                    final TreeNode oldSelection = (TreeNode) keyToNode.get(id);
                     oldSelection.setSelected(false);
                     selectedIds.remove(id);
                 }
@@ -186,7 +190,7 @@ public class ITree extends FlowPanel implements Paintable {
             if (disabled) {
                 return;
             }
-            Element target = DOM.eventGetTarget(event);
+            final Element target = DOM.eventGetTarget(event);
             if (DOM.compare(getElement(), target)) {
                 // state change
                 toggleState();
@@ -208,7 +212,7 @@ public class ITree extends FlowPanel implements Paintable {
         }
 
         protected void constructDom() {
-            Element root = DOM.createDiv();
+            final Element root = DOM.createDiv();
             nodeCaptionDiv = DOM.createDiv();
             DOM.setElementProperty(nodeCaptionDiv, "className", CLASSNAME
                     + "-caption");
@@ -301,14 +305,14 @@ public class ITree extends FlowPanel implements Paintable {
             childNodeContainer.clear();
             childNodeContainer.setVisible(true);
             while (i.hasNext()) {
-                UIDL childUidl = (UIDL) i.next();
+                final UIDL childUidl = (UIDL) i.next();
                 // actions are in bit weird place, don't mix them with children,
                 // but current node's actions
                 if ("actions".equals(childUidl.getTag())) {
                     updateActionMap(childUidl);
                     continue;
                 }
-                TreeNode childTree = new TreeNode();
+                final TreeNode childTree = new TreeNode();
                 childNodeContainer.add(childTree);
                 childTree.updateFromUIDL(childUidl, client);
             }
@@ -323,10 +327,10 @@ public class ITree extends FlowPanel implements Paintable {
             if (actionKeys == null) {
                 return new Action[] {};
             }
-            Action[] actions = new Action[actionKeys.length];
+            final Action[] actions = new Action[actionKeys.length];
             for (int i = 0; i < actions.length; i++) {
-                String actionKey = actionKeys[i];
-                TreeAction a = new TreeAction(this, String.valueOf(key),
+                final String actionKey = actionKeys[i];
+                final TreeAction a = new TreeAction(this, String.valueOf(key),
                         actionKey);
                 a.setCaption(getActionCaption(actionKey));
                 a.setIconUrl(getActionIcon(actionKey));
index 4e354d26fa480a05aa9c464c87c837a8960606d0..31ec923f162c98f2b1b99c35135731cf8abb9167 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import java.util.Iterator;\r
@@ -18,13 +22,13 @@ public class ITwinColSelect extends IOptionGroupBase {
 \r
     private static final String DEFAULT_WIDTH = "10em";\r
 \r
-    private ListBox options;\r
+    private final ListBox options;\r
 \r
-    private ListBox selections;\r
+    private final ListBox selections;\r
 \r
-    private IButton add;\r
+    private final IButton add;\r
 \r
-    private IButton remove;\r
+    private final IButton remove;\r
 \r
     public ITwinColSelect() {\r
         super(CLASSNAME);\r
@@ -36,7 +40,7 @@ public class ITwinColSelect extends IOptionGroupBase {
         selections.setVisibleItemCount(VISIBLE_COUNT);\r
         options.setStyleName(CLASSNAME + "-options");\r
         selections.setStyleName(CLASSNAME + "-selections");\r
-        Panel buttons = new FlowPanel();\r
+        final Panel buttons = new FlowPanel();\r
         buttons.setStyleName(CLASSNAME + "-buttons");\r
         add = new IButton();\r
         add.setText(">>");\r
@@ -44,10 +48,10 @@ public class ITwinColSelect extends IOptionGroupBase {
         remove = new IButton();\r
         remove.setText("<<");\r
         remove.addClickListener(this);\r
-        Panel p = ((Panel) optionsContainer);\r
+        final Panel p = ((Panel) optionsContainer);\r
         p.add(options);\r
         buttons.add(add);\r
-        HTML br = new HTML("<span/>");\r
+        final HTML br = new HTML("<span/>");\r
         br.setStyleName(CLASSNAME + "-deco");\r
         buttons.add(br);\r
         buttons.add(remove);\r
@@ -56,7 +60,7 @@ public class ITwinColSelect extends IOptionGroupBase {
     }\r
 \r
     protected void buildOptions(UIDL uidl) {\r
-        boolean enabled = !isDisabled() && !isReadonly();\r
+        final boolean enabled = !isDisabled() && !isReadonly();\r
         options.setMultipleSelect(isMultiselect());\r
         selections.setMultipleSelect(isMultiselect());\r
         options.setEnabled(enabled);\r
@@ -65,8 +69,8 @@ public class ITwinColSelect extends IOptionGroupBase {
         remove.setEnabled(enabled);\r
         options.clear();\r
         selections.clear();\r
-        for (Iterator i = uidl.getChildIterator(); i.hasNext();) {\r
-            UIDL optionUidl = (UIDL) i.next();\r
+        for (final Iterator i = uidl.getChildIterator(); i.hasNext();) {\r
+            final UIDL optionUidl = (UIDL) i.next();\r
             if (optionUidl.hasAttribute("selected")) {\r
                 selections.addItem(optionUidl.getStringAttribute("caption"),\r
                         optionUidl.getStringAttribute("key"));\r
@@ -90,7 +94,7 @@ public class ITwinColSelect extends IOptionGroupBase {
     }\r
 \r
     protected Object[] getSelectedItems() {\r
-        Vector selectedItemKeys = new Vector();\r
+        final Vector selectedItemKeys = new Vector();\r
         for (int i = 0; i < selections.getItemCount(); i++) {\r
             selectedItemKeys.add(selections.getValue(i));\r
         }\r
@@ -98,7 +102,7 @@ public class ITwinColSelect extends IOptionGroupBase {
     }\r
 \r
     private boolean[] getItemsToAdd() {\r
-        boolean[] selectedIndexes = new boolean[options.getItemCount()];\r
+        final boolean[] selectedIndexes = new boolean[options.getItemCount()];\r
         for (int i = 0; i < options.getItemCount(); i++) {\r
             if (options.isItemSelected(i)) {\r
                 selectedIndexes[i] = true;\r
@@ -110,7 +114,7 @@ public class ITwinColSelect extends IOptionGroupBase {
     }\r
 \r
     private boolean[] getItemsToRemove() {\r
-        boolean[] selectedIndexes = new boolean[selections.getItemCount()];\r
+        final boolean[] selectedIndexes = new boolean[selections.getItemCount()];\r
         for (int i = 0; i < selections.getItemCount(); i++) {\r
             if (selections.isItemSelected(i)) {\r
                 selectedIndexes[i] = true;\r
@@ -124,15 +128,16 @@ public class ITwinColSelect extends IOptionGroupBase {
     public void onClick(Widget sender) {\r
         super.onClick(sender);\r
         if (sender == add) {\r
-            boolean[] sel = getItemsToAdd();\r
+            final boolean[] sel = getItemsToAdd();\r
             for (int i = 0; i < sel.length; i++) {\r
                 if (sel[i]) {\r
-                    int optionIndex = i - (sel.length - options.getItemCount());\r
+                    final int optionIndex = i\r
+                            - (sel.length - options.getItemCount());\r
                     selectedKeys.add(options.getValue(optionIndex));\r
 \r
                     // Move selection to another column\r
-                    String text = options.getItemText(optionIndex);\r
-                    String value = options.getValue(optionIndex);\r
+                    final String text = options.getItemText(optionIndex);\r
+                    final String value = options.getValue(optionIndex);\r
                     selections.addItem(text, value);\r
                     selections.setItemSelected(selections.getItemCount() - 1,\r
                             true);\r
@@ -143,16 +148,16 @@ public class ITwinColSelect extends IOptionGroupBase {
                     isImmediate());\r
 \r
         } else if (sender == remove) {\r
-            boolean[] sel = getItemsToRemove();\r
+            final boolean[] sel = getItemsToRemove();\r
             for (int i = 0; i < sel.length; i++) {\r
                 if (sel[i]) {\r
-                    int selectionIndex = i\r
+                    final int selectionIndex = i\r
                             - (sel.length - selections.getItemCount());\r
                     selectedKeys.remove(selections.getValue(selectionIndex));\r
 \r
                     // Move selection to another column\r
-                    String text = selections.getItemText(selectionIndex);\r
-                    String value = selections.getValue(selectionIndex);\r
+                    final String text = selections.getItemText(selectionIndex);\r
+                    final String value = selections.getValue(selectionIndex);\r
                     options.addItem(text, value);\r
                     options.setItemSelected(options.getItemCount() - 1, true);\r
                     selections.removeItem(selectionIndex);\r
@@ -162,13 +167,13 @@ public class ITwinColSelect extends IOptionGroupBase {
                     isImmediate());\r
         } else if (sender == options) {\r
             // unselect all in other list, to avoid mistakes (i.e wrong button)\r
-            int c = selections.getItemCount();\r
+            final int c = selections.getItemCount();\r
             for (int i = 0; i < c; i++) {\r
                 selections.setItemSelected(i, false);\r
             }\r
         } else if (sender == selections) {\r
             // unselect all in other list, to avoid mistakes (i.e wrong button)\r
-            int c = options.getItemCount();\r
+            final int c = options.getItemCount();\r
             for (int i = 0; i < c; i++) {\r
                 options.setItemSelected(i, false);\r
             }\r
index 73d8be8a18abe0febee616240951212640c4ae8b..e90de5cb2d35a499c8b1fc5bc20d1db5e22f96f8 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.ui.Composite;
@@ -13,7 +17,7 @@ public class IUnknownComponent extends Composite implements Paintable {
     Tree uidlTree = new Tree();
 
     public IUnknownComponent() {
-        VerticalPanel panel = new VerticalPanel();
+        final VerticalPanel panel = new VerticalPanel();
         panel.add(caption);
         panel.add(uidlTree);
         initWidget(panel);
index 60fd35cc37e827d6f27a4c22496543abadd1535d..ef3718d4a150b21ca185e007a14384753cde9beb 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.Timer;
@@ -34,7 +38,7 @@ public class IUpload extends FormPanel implements Paintable, ClickListener,
     /**
      * Button that initiates uploading
      */
-    private Button submitButton;
+    private final Button submitButton;
 
     /**
      * When expecting big files, programmer may initiate some UI changes when
index 56ad40dc0ddf93ae05e806d809eea110f77385e7..bf7910870e20bc308c95269b2bb2f287117bdaf1 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.HashSet;
@@ -63,9 +67,9 @@ public class IView extends SimplePanel implements Paintable,
         // Open URL:s
         while (childIndex < uidl.getChidlCount()
                 && "open".equals(uidl.getChildUIDL(childIndex).getTag())) {
-            UIDL open = uidl.getChildUIDL(childIndex);
-            String url = open.getStringAttribute("src");
-            String target = open.getStringAttribute("name");
+            final UIDL open = uidl.getChildUIDL(childIndex);
+            final String url = open.getStringAttribute("src");
+            final String target = open.getStringAttribute("name");
             if (target == null) {
                 goTo(url);
             } else {
@@ -77,7 +81,7 @@ public class IView extends SimplePanel implements Paintable,
 
         // Draw this application level window
         UIDL childUidl = uidl.getChildUIDL(childIndex);
-        Paintable lo = (Paintable) client.getWidget(childUidl);
+        final Paintable lo = (Paintable) client.getWidget(childUidl);
 
         if (layout != null) {
             if (layout != lo) {
@@ -94,12 +98,12 @@ public class IView extends SimplePanel implements Paintable,
         layout.updateFromUIDL(childUidl, client);
 
         // Update subwindows
-        HashSet removedSubWindows = new HashSet(subWindows);
+        final HashSet removedSubWindows = new HashSet(subWindows);
 
         // Open new windows
         while ((childUidl = uidl.getChildUIDL(childIndex++)) != null) {
             if ("window".equals(childUidl.getTag())) {
-                Widget w = client.getWidget(childUidl);
+                final Widget w = client.getWidget(childUidl);
                 if (subWindows.contains(w)) {
                     removedSubWindows.remove(w);
                 } else {
@@ -112,8 +116,9 @@ public class IView extends SimplePanel implements Paintable,
                 }
                 actionHandler.updateActionMap(childUidl);
             } else if (childUidl.getTag().equals("notifications")) {
-                for (Iterator it = childUidl.getChildIterator(); it.hasNext();) {
-                    UIDL notification = (UIDL) it.next();
+                for (final Iterator it = childUidl.getChildIterator(); it
+                        .hasNext();) {
+                    final UIDL notification = (UIDL) it.next();
                     String html = "";
                     if (notification.hasAttribute("caption")) {
                         html += "<H1>"
@@ -126,19 +131,20 @@ public class IView extends SimplePanel implements Paintable,
                                 + "</p>";
                     }
 
-                    String style = notification.hasAttribute("style") ? notification
+                    final String style = notification.hasAttribute("style") ? notification
                             .getStringAttribute("style")
                             : null;
-                    int position = notification.getIntAttribute("position");
-                    int delay = notification.getIntAttribute("delay");
+                    final int position = notification
+                            .getIntAttribute("position");
+                    final int delay = notification.getIntAttribute("delay");
                     new Notification(delay).show(html, position, style);
                 }
             }
         }
 
         // Close old windows
-        for (Iterator rem = removedSubWindows.iterator(); rem.hasNext();) {
-            IWindow w = (IWindow) rem.next();
+        for (final Iterator rem = removedSubWindows.iterator(); rem.hasNext();) {
+            final IWindow w = (IWindow) rem.next();
             client.unregisterPaintable(w);
             subWindows.remove(w);
             RootPanel.get().remove(w);
@@ -155,7 +161,7 @@ public class IView extends SimplePanel implements Paintable,
     public void onBrowserEvent(Event event) {
         super.onBrowserEvent(event);
         if (DOM.eventGetType(event) == Event.ONKEYDOWN && actionHandler != null) {
-            int modifiers = KeyboardListenerCollection
+            final int modifiers = KeyboardListenerCollection
                     .getKeyboardModifiers(event);
             actionHandler.handleKeyboardEvent(
                     (char) DOM.eventGetKeyCode(event), modifiers);
index abf4e2d3ea905911ffff8ef6b53fe50a09fe05a3..f32b3a2f3bd4a76a9cbbe8ab5b22afa88a8e4a5d 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.Iterator;
@@ -86,10 +90,10 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
     ShortcutActionHandler shortcutHandler;
 
     /** Last known width read from UIDL or updated to application connection */
-    private int uidlWidth = -1;
+    private final int uidlWidth = -1;
 
     /** Last known height read from UIDL or updated to application connection */
-    private int uidlHeight = -1;
+    private final int uidlHeight = -1;
 
     /** Last known positionx read from UIDL or updated to application connection */
     private int uidlPositionX = -1;
@@ -103,7 +107,7 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
 
     public IWindow() {
         super();
-        int order = windowOrder.size();
+        final int order = windowOrder.size();
         setWindowOrder(order);
         windowOrder.add(this);
         setStyleName(CLASSNAME);
@@ -160,9 +164,9 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
         DOM.sinkEvents(closeBox, Event.ONCLICK);
         DOM.sinkEvents(contents, Event.ONCLICK);
 
-        Element wrapper = DOM.createDiv();
+        final Element wrapper = DOM.createDiv();
         DOM.setElementProperty(wrapper, "className", CLASSNAME + "-wrap");
-        Element wrapper2 = DOM.createDiv();
+        final Element wrapper2 = DOM.createDiv();
         DOM.setElementProperty(wrapper2, "className", CLASSNAME + "-wrap2");
 
         DOM.sinkEvents(wrapper, Event.ONKEYDOWN);
@@ -200,22 +204,22 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
 
         // Initialize the width from UIDL
         if (uidl.hasVariable("width")) {
-            String width = uidl.getStringVariable("width");
+            final String width = uidl.getStringVariable("width");
             setWidth(width);
         }
         if (uidl.hasVariable("height")) {
-            String height = uidl.getStringVariable("height");
+            final String height = uidl.getStringVariable("height");
             setHeight(height);
         }
 
         // Initialize the position form UIDL
         try {
-            int positionx = uidl.getIntVariable("positionx");
-            int positiony = uidl.getIntVariable("positiony");
+            final int positionx = uidl.getIntVariable("positionx");
+            final int positiony = uidl.getIntVariable("positiony");
             if (positionx >= 0 && positiony >= 0) {
                 setPopupPosition(positionx, positiony);
             }
-        } catch (IllegalArgumentException e) {
+        } catch (final IllegalArgumentException e) {
             // Silently ignored as positionx and positiony are not required
             // parameters
         }
@@ -230,22 +234,22 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
 
         UIDL childUidl = uidl.getChildUIDL(0);
         if ("open".equals(childUidl.getTag())) {
-            String parsedUri = client.translateToolkitUri(childUidl
+            final String parsedUri = client.translateToolkitUri(childUidl
                     .getStringAttribute("src"));
             // TODO this should be a while-loop for multiple opens
             if (!childUidl.hasAttribute("name")) {
-                Frame frame = new Frame();
+                final Frame frame = new Frame();
                 DOM.setStyleAttribute(frame.getElement(), "width", "100%");
                 DOM.setStyleAttribute(frame.getElement(), "height", "100%");
                 DOM.setStyleAttribute(frame.getElement(), "border", "0px");
                 frame.setUrl(parsedUri);
                 contentPanel.setWidget(frame);
             } else {
-                String target = childUidl.getStringAttribute("name");
+                final String target = childUidl.getStringAttribute("name");
                 Window.open(parsedUri, target, "");
             }
         } else {
-            Paintable lo = (Paintable) client.getWidget(childUidl);
+            final Paintable lo = (Paintable) client.getWidget(childUidl);
             if (layout != null) {
                 if (layout != lo) {
                     // remove old
@@ -263,7 +267,7 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
 
         // we may have actions and notifications
         if (uidl.getChidlCount() > 1) {
-            int cnt = uidl.getChidlCount();
+            final int cnt = uidl.getChidlCount();
             for (int i = 1; i < cnt; i++) {
                 childUidl = uidl.getChildUIDL(i);
                 if (childUidl.getTag().equals("actions")) {
@@ -273,9 +277,9 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
                     shortcutHandler.updateActionMap(childUidl);
                 } else if (childUidl.getTag().equals("notifications")) {
                     // TODO needed? move ->
-                    for (Iterator it = childUidl.getChildIterator(); it
+                    for (final Iterator it = childUidl.getChildIterator(); it
                             .hasNext();) {
-                        UIDL notification = (UIDL) it.next();
+                        final UIDL notification = (UIDL) it.next();
                         String html = "";
                         if (notification.hasAttribute("caption")) {
                             html += "<H1>"
@@ -290,11 +294,12 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
                                     + "</p>";
                         }
 
-                        String style = notification.hasAttribute("style") ? notification
+                        final String style = notification.hasAttribute("style") ? notification
                                 .getStringAttribute("style")
                                 : null;
-                        int position = notification.getIntAttribute("position");
-                        int delay = notification.getIntAttribute("delay");
+                        final int position = notification
+                                .getIntAttribute("position");
+                        final int delay = notification.getIntAttribute("delay");
                         new Notification(delay).show(html, position, style);
                     }
                 }
@@ -336,16 +341,16 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
     }
 
     public void onBrowserEvent(Event event) {
-        int type = DOM.eventGetType(event);
+        final int type = DOM.eventGetType(event);
         if (type == Event.ONKEYDOWN && shortcutHandler != null) {
-            int modifiers = KeyboardListenerCollection
+            final int modifiers = KeyboardListenerCollection
                     .getKeyboardModifiers(event);
             shortcutHandler.handleKeyboardEvent((char) DOM
                     .eventGetKeyCode(event), modifiers);
             return;
         }
 
-        Element target = DOM.eventGetTarget(event);
+        final Element target = DOM.eventGetTarget(event);
         if (dragging || DOM.isOrHasChild(header, target)) {
             onHeaderEvent(event);
             DOM.eventCancelBubble(event, true);
@@ -445,8 +450,8 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
             break;
         case Event.ONMOUSEMOVE:
             if (dragging) {
-                int x = DOM.eventGetScreenX(event) - startX + origX;
-                int y = DOM.eventGetScreenY(event) - startY + origY;
+                final int x = DOM.eventGetScreenX(event) - startX + origX;
+                final int y = DOM.eventGetScreenY(event) - startY + origY;
                 setPopupPosition(x, y);
                 DOM.eventPreventDefault(event);
             }
@@ -465,7 +470,7 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
             return false;
         } else if (modal) {
             // return false when modal and outside window
-            Element target = DOM.eventGetTarget(event);
+            final Element target = DOM.eventGetTarget(event);
             if (!DOM.isOrHasChild(getElement(), target)) {
                 return false;
             }
index c960057df80e7cb3cda07064b032e5abbad9892d..bc14d553eff2394d6dce861834ef40138bcf1842 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.DOM;
@@ -5,7 +9,7 @@ import com.google.gwt.user.client.ui.UIObject;
 import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
 
 public class Icon extends UIObject {
-    private ApplicationConnection client;
+    private final ApplicationConnection client;
     private String myUri;
 
     public Icon(ApplicationConnection client) {
index 038954d4f2385d85120f73ec525c167992c91d22..60584335a0eab6cd6ad8296a264057afffd87452 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 public class MarginInfo {
index 4d524b1237e9f5e2a14f780977caa9e6c57d6188..251ec8fd498fae8d120959969c32c90a2c15cdd3 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 /*
@@ -16,7 +20,7 @@ package com.itmill.toolkit.terminal.gwt.client.ui;
  * the License.
  */
 
-//COPIED HERE DUE package privates in GWT
+// COPIED HERE DUE package privates in GWT
 import java.util.ArrayList;
 import java.util.List;
 
@@ -52,13 +56,14 @@ import com.google.gwt.user.client.ui.Widget;
  */
 public class MenuBar extends Widget implements PopupListener {
 
-    private Element body;
-    private ArrayList items = new ArrayList();
+    private final Element body;
+    private final ArrayList items = new ArrayList();
     private MenuBar parentMenu;
     private PopupPanel popup;
     private MenuItem selectedItem;
     private MenuBar shownChildMenu;
-    private boolean vertical, autoOpen;
+    private final boolean vertical;
+    private boolean autoOpen;
 
     /**
      * Creates an empty horizontal menu bar.
@@ -76,18 +81,18 @@ public class MenuBar extends Widget implements PopupListener {
     public MenuBar(boolean vertical) {
         super();
 
-        Element table = DOM.createTable();
+        final Element table = DOM.createTable();
         body = DOM.createTBody();
         DOM.appendChild(table, body);
 
         if (!vertical) {
-            Element tr = DOM.createTR();
+            final Element tr = DOM.createTR();
             DOM.appendChild(body, tr);
         }
 
         this.vertical = vertical;
 
-        Element outer = DOM.createDiv();
+        final Element outer = DOM.createDiv();
         DOM.appendChild(outer, table);
         setElement(outer);
 
@@ -130,7 +135,7 @@ public class MenuBar extends Widget implements PopupListener {
      * @return the {@link MenuItem} object created
      */
     public MenuItem addItem(String text, boolean asHTML, Command cmd) {
-        MenuItem item = new MenuItem(text, asHTML, cmd);
+        final MenuItem item = new MenuItem(text, asHTML, cmd);
         addItem(item);
         return item;
     }
@@ -148,7 +153,7 @@ public class MenuBar extends Widget implements PopupListener {
      * @return the {@link MenuItem} object created
      */
     public MenuItem addItem(String text, boolean asHTML, MenuBar popup) {
-        MenuItem item = new MenuItem(text, asHTML, popup);
+        final MenuItem item = new MenuItem(text, asHTML, popup);
         addItem(item);
         return item;
     }
@@ -164,7 +169,7 @@ public class MenuBar extends Widget implements PopupListener {
      * @return the {@link MenuItem} object created
      */
     public MenuItem addItem(String text, Command cmd) {
-        MenuItem item = new MenuItem(text, cmd);
+        final MenuItem item = new MenuItem(text, cmd);
         addItem(item);
         return item;
     }
@@ -180,7 +185,7 @@ public class MenuBar extends Widget implements PopupListener {
      * @return the {@link MenuItem} object created
      */
     public MenuItem addItem(String text, MenuBar popup) {
-        MenuItem item = new MenuItem(text, popup);
+        final MenuItem item = new MenuItem(text, popup);
         addItem(item);
         return item;
     }
@@ -189,7 +194,7 @@ public class MenuBar extends Widget implements PopupListener {
      * Removes all menu items from this menu bar.
      */
     public void clearItems() {
-        Element container = getItemContainerElement();
+        final Element container = getItemContainerElement();
         while (DOM.getChildCount(container) > 0) {
             DOM.removeChild(container, DOM.getChild(container, 0));
         }
@@ -209,7 +214,7 @@ public class MenuBar extends Widget implements PopupListener {
     public void onBrowserEvent(Event event) {
         super.onBrowserEvent(event);
 
-        MenuItem item = findItem(DOM.eventGetTarget(event));
+        final MenuItem item = findItem(DOM.eventGetTarget(event));
         switch (DOM.eventGetType(event)) {
         case Event.ONCLICK: {
             // Fire an item's command when the user clicks on it.
@@ -255,12 +260,12 @@ public class MenuBar extends Widget implements PopupListener {
      *                the item to be removed
      */
     public void removeItem(MenuItem item) {
-        int idx = items.indexOf(item);
+        final int idx = items.indexOf(item);
         if (idx == -1) {
             return;
         }
 
-        Element container = getItemContainerElement();
+        final Element container = getItemContainerElement();
         DOM.removeChild(container, DOM.getChild(container, idx));
         items.remove(idx);
     }
@@ -355,7 +360,7 @@ public class MenuBar extends Widget implements PopupListener {
                 closeAllParents();
 
                 // Fire the item's command.
-                Command cmd = item.getCommand();
+                final Command cmd = item.getCommand();
                 if (cmd != null) {
                     DeferredCommand.addCommand(cmd);
                 }
@@ -384,8 +389,8 @@ public class MenuBar extends Widget implements PopupListener {
                     // If the event target is part of the parent menu, suppress
                     // the
                     // event altogether.
-                    Element target = DOM.eventGetTarget(event);
-                    Element parentMenuElement = item.getParentMenu()
+                    final Element target = DOM.eventGetTarget(event);
+                    final Element parentMenuElement = item.getParentMenu()
                             .getElement();
                     if (DOM.isOrHasChild(parentMenuElement, target)) {
                         return false;
@@ -466,7 +471,7 @@ public class MenuBar extends Widget implements PopupListener {
 
     private MenuItem findItem(Element hItem) {
         for (int i = 0; i < items.size(); ++i) {
-            MenuItem item = (MenuItem) items.get(i);
+            final MenuItem item = (MenuItem) items.get(i);
             if (DOM.isOrHasChild(item.getElement(), hItem)) {
                 return item;
             }
index 6767864a6e4ce4eed20de5fa2917a6987dfaf917..184e3bf8d639637960664aca4a6683266ecf435b 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 /*
@@ -16,7 +20,7 @@ package com.itmill.toolkit.terminal.gwt.client.ui;
  * the License.
  */
 
-//COPIED HERE DUE package privates in GWT
+// COPIED HERE DUE package privates in GWT
 import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.ui.HasHTML;
index 130ac370ee3749dd6f652159b8696226f0b8e3f8..447230367eda221726a16044bc066226e80cd669 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import com.google.gwt.user.client.DOM;\r
@@ -154,12 +158,12 @@ public class Notification extends ToolkitOverlay {
                 }\r
             }\r
         };\r
-        int msec = fadeMsec / (startOpacity / 5);\r
+        final int msec = fadeMsec / (startOpacity / 5);\r
         fader.scheduleRepeating(msec);\r
     }\r
 \r
     public void setPosition(int position) {\r
-        Element el = getElement();\r
+        final Element el = getElement();\r
         DOM.setStyleAttribute(el, "top", null);\r
         DOM.setStyleAttribute(el, "left", null);\r
         DOM.setStyleAttribute(el, "bottom", null);\r
index 1cc99be0f0385bc316a952465d9bd646478e2f39..561f5a57c3a5f57d08a81d7f601d364b40da5b92 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.ArrayList;
@@ -15,7 +19,7 @@ import com.itmill.toolkit.terminal.gwt.client.UIDL;
  * @author IT Mill ltd
  */
 public class ShortcutActionHandler {
-    private ArrayList actions = new ArrayList();
+    private final ArrayList actions = new ArrayList();
     private ApplicationConnection client;
     private String paintableId;
 
@@ -42,19 +46,19 @@ public class ShortcutActionHandler {
      */
     public void updateActionMap(UIDL c) {
         actions.clear();
-        Iterator it = c.getChildIterator();
+        final Iterator it = c.getChildIterator();
         while (it.hasNext()) {
-            UIDL action = (UIDL) it.next();
+            final UIDL action = (UIDL) it.next();
 
             int[] modifiers = null;
             if (action.hasAttribute("mk")) {
                 modifiers = action.getIntArrayAttribute("mk");
             }
 
-            ShortcutKeyCombination kc = new ShortcutKeyCombination(action
+            final ShortcutKeyCombination kc = new ShortcutKeyCombination(action
                     .getIntAttribute("kc"), modifiers);
-            String key = action.getStringAttribute("key");
-            String caption = action.getStringAttribute("caption");
+            final String key = action.getStringAttribute("key");
+            final String caption = action.getStringAttribute("caption");
             actions.add(new ShortcutAction(key, kc, caption));
         }
     }
@@ -69,11 +73,11 @@ public class ShortcutActionHandler {
      *                modifier keys (bitmask like in {@link KeyboardListener})
      */
     public void handleKeyboardEvent(char keyCode, int modifiers) {
-        ShortcutKeyCombination kc = new ShortcutKeyCombination(keyCode,
+        final ShortcutKeyCombination kc = new ShortcutKeyCombination(keyCode,
                 modifiers);
-        Iterator it = actions.iterator();
+        final Iterator it = actions.iterator();
         while (it.hasNext()) {
-            ShortcutAction a = (ShortcutAction) it.next();
+            final ShortcutAction a = (ShortcutAction) it.next();
             if (a.getShortcutCombination().equals(kc)) {
                 client.updateVariable(paintableId, "action", a.getKey(), true);
                 break;
@@ -137,9 +141,9 @@ class ShortcutKeyCombination {
 
 class ShortcutAction {
 
-    private ShortcutKeyCombination sc;
-    private String caption;
-    private String key;
+    private final ShortcutKeyCombination sc;
+    private final String caption;
+    private final String key;
 
     public ShortcutAction(String key, ShortcutKeyCombination sc, String caption) {
         this.sc = sc;
index eb955137f054a81697c4ecf00f6c40792052e0dd..40cccf00ac804eba7f33c2fbd1f283b5e9fda80e 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.ui.HasWidgets;
index 0ff537c54210e4fe7598c1db5815f9f42493f4d8..f45b58c3c0aef06752713c3961305f8c59f59647 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import com.google.gwt.user.client.ui.ChangeListener;\r
@@ -7,7 +11,7 @@ import com.google.gwt.user.client.ui.Widget;
 \r
 public class Time extends FlowPanel implements ChangeListener {\r
 \r
-    private IDateField datefield;\r
+    private final IDateField datefield;\r
 \r
     private ListBox hours;\r
 \r
@@ -30,10 +34,10 @@ public class Time extends FlowPanel implements ChangeListener {
     }\r
 \r
     private void buildTime(boolean redraw) {\r
-        boolean thc = datefield.getDateTimeService().isTwelveHourClock();\r
+        final boolean thc = datefield.getDateTimeService().isTwelveHourClock();\r
         if (redraw) {\r
             clear();\r
-            int numHours = thc ? 12 : 24;\r
+            final int numHours = thc ? 12 : 24;\r
             hours = new ListBox();\r
             hours.setStyleName(INativeSelect.CLASSNAME);\r
             for (int i = 0; i < numHours; i++) {\r
@@ -43,7 +47,7 @@ public class Time extends FlowPanel implements ChangeListener {
             if (thc) {\r
                 ampm = new ListBox();\r
                 ampm.setStyleName(INativeSelect.CLASSNAME);\r
-                String[] ampmText = datefield.getDateTimeService()\r
+                final String[] ampmText = datefield.getDateTimeService()\r
                         .getAmPmStrings();\r
                 ampm.addItem(ampmText[0]);\r
                 ampm.addItem(ampmText[1]);\r
@@ -81,9 +85,9 @@ public class Time extends FlowPanel implements ChangeListener {
                 msec.addChangeListener(this);\r
             }\r
 \r
-            String delimiter = datefield.getDateTimeService()\r
+            final String delimiter = datefield.getDateTimeService()\r
                     .getClockDelimeter();\r
-            boolean ro = datefield.isReadonly();\r
+            final boolean ro = datefield.isReadonly();\r
 \r
             if (ro) {\r
                 int h = 0;\r
@@ -101,7 +105,7 @@ public class Time extends FlowPanel implements ChangeListener {
             if (datefield.getCurrentResolution() >= IDateField.RESOLUTION_MIN) {\r
                 add(new ILabel(delimiter));\r
                 if (ro) {\r
-                    int m = mins.getSelectedIndex();\r
+                    final int m = mins.getSelectedIndex();\r
                     add(new ILabel(m < 10 ? "0" + m : "" + m));\r
                 } else {\r
                     add(mins);\r
@@ -110,7 +114,7 @@ public class Time extends FlowPanel implements ChangeListener {
             if (datefield.getCurrentResolution() >= IDateField.RESOLUTION_SEC) {\r
                 add(new ILabel(delimiter));\r
                 if (ro) {\r
-                    int s = sec.getSelectedIndex();\r
+                    final int s = sec.getSelectedIndex();\r
                     add(new ILabel(s < 10 ? "0" + s : "" + s));\r
                 } else {\r
                     add(sec);\r
@@ -119,8 +123,8 @@ public class Time extends FlowPanel implements ChangeListener {
             if (datefield.getCurrentResolution() == IDateField.RESOLUTION_MSEC) {\r
                 add(new ILabel("."));\r
                 if (ro) {\r
-                    int m = datefield.getMilliseconds();\r
-                    String ms = m < 100 ? "0" + m : "" + m;\r
+                    final int m = datefield.getMilliseconds();\r
+                    final String ms = m < 100 ? "0" + m : "" + m;\r
                     add(new ILabel(m < 10 ? "0" + ms : ms));\r
                 } else {\r
                     add(msec);\r
@@ -171,7 +175,7 @@ public class Time extends FlowPanel implements ChangeListener {
         if (datefield.isReadonly() && !redraw) {\r
             // Do complete redraw when in read-only status\r
             clear();\r
-            String delimiter = datefield.getDateTimeService()\r
+            final String delimiter = datefield.getDateTimeService()\r
                     .getClockDelimeter();\r
 \r
             int h = datefield.getCurrentDate().getHours();\r
@@ -182,18 +186,18 @@ public class Time extends FlowPanel implements ChangeListener {
 \r
             if (datefield.getCurrentResolution() >= IDateField.RESOLUTION_MIN) {\r
                 add(new ILabel(delimiter));\r
-                int m = mins.getSelectedIndex();\r
+                final int m = mins.getSelectedIndex();\r
                 add(new ILabel(m < 10 ? "0" + m : "" + m));\r
             }\r
             if (datefield.getCurrentResolution() >= IDateField.RESOLUTION_SEC) {\r
                 add(new ILabel(delimiter));\r
-                int s = sec.getSelectedIndex();\r
+                final int s = sec.getSelectedIndex();\r
                 add(new ILabel(s < 10 ? "0" + s : "" + s));\r
             }\r
             if (datefield.getCurrentResolution() == IDateField.RESOLUTION_MSEC) {\r
                 add(new ILabel("."));\r
-                int m = datefield.getMilliseconds();\r
-                String ms = m < 100 ? "0" + m : "" + m;\r
+                final int m = datefield.getMilliseconds();\r
+                final String ms = m < 100 ? "0" + m : "" + m;\r
                 add(new ILabel(m < 10 ? "0" + ms : ms));\r
             }\r
             if (datefield.getCurrentResolution() == IDateField.RESOLUTION_HOUR) {\r
@@ -206,7 +210,7 @@ public class Time extends FlowPanel implements ChangeListener {
             }\r
         }\r
 \r
-        boolean enabled = datefield.isEnabled();\r
+        final boolean enabled = datefield.isEnabled();\r
         hours.setEnabled(enabled);\r
         if (mins != null) {\r
             mins.setEnabled(enabled);\r
@@ -244,25 +248,26 @@ public class Time extends FlowPanel implements ChangeListener {
                     datefield.isImmediate());\r
             updateTime(false);\r
         } else if (sender == mins) {\r
-            int m = mins.getSelectedIndex();\r
+            final int m = mins.getSelectedIndex();\r
             datefield.getCurrentDate().setMinutes(m);\r
             datefield.getClient().updateVariable(datefield.getId(), "min", m,\r
                     datefield.isImmediate());\r
             updateTime(false);\r
         } else if (sender == sec) {\r
-            int s = sec.getSelectedIndex();\r
+            final int s = sec.getSelectedIndex();\r
             datefield.getCurrentDate().setSeconds(s);\r
             datefield.getClient().updateVariable(datefield.getId(), "sec", s,\r
                     datefield.isImmediate());\r
             updateTime(false);\r
         } else if (sender == msec) {\r
-            int ms = msec.getSelectedIndex();\r
+            final int ms = msec.getSelectedIndex();\r
             datefield.setMilliseconds(ms);\r
             datefield.getClient().updateVariable(datefield.getId(), "msec", ms,\r
                     datefield.isImmediate());\r
             updateTime(false);\r
         } else if (sender == ampm) {\r
-            int h = hours.getSelectedIndex() + ampm.getSelectedIndex() * 12;\r
+            final int h = hours.getSelectedIndex() + ampm.getSelectedIndex()\r
+                    * 12;\r
             datefield.getCurrentDate().setHours(h);\r
             datefield.getClient().updateVariable(datefield.getId(), "hour", h,\r
                     datefield.isImmediate());\r
index a3045b287b9d7ff95b1f992c55c022f5c53be633..a56cd245b08abdd40d2a0cd4bc1ebebbec27a830 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import com.google.gwt.user.client.DOM;
index 39cd91753666cc76b1cc2bf31406c995462cebd6..4ecc477a3e5446a29e54c6930277ff388bac42d5 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
 /**
index 1797cef581d66efe30f03b23caa1958442f9e3b2..83e0e4c57ffce8103ef76add45eaa08162dfebb9 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.ui;\r
 \r
 import com.google.gwt.user.client.ui.AbstractImagePrototype;\r
index dd733eb6d02cc0bb7e9629279ba18acda66ef122..5b5a1bfba369200c1d0787e7a9d78b90817a93a1 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.client.ui.richtextarea;
 
 import com.google.gwt.user.client.ui.ChangeListener;
@@ -35,7 +39,7 @@ public class IRichTextArea extends Composite implements Paintable,
     RichTextToolbar formatter = new RichTextToolbar(rta);
 
     public IRichTextArea() {
-        FlowPanel fp = new FlowPanel();
+        final FlowPanel fp = new FlowPanel();
         fp.add(formatter);
 
         rta.setWidth("100%");
@@ -79,7 +83,7 @@ public class IRichTextArea extends Composite implements Paintable,
     }
 
     public void onLostFocus(Widget sender) {
-        String html = rta.getHTML();
+        final String html = rta.getHTML();
         client.updateVariable(id, "text", html, immediate);
 
     }
index fcffa51328b2f93a6d4c1fe68dbcd1a362dc93e7..4d3d11d6c903dbc69ee8b43883807f372f06d35e 100644 (file)
@@ -264,12 +264,14 @@ public class RichTextToolbar extends Composite {
             } else if (sender == justifyRight) {
                 basic.setJustification(RichTextArea.Justification.RIGHT);
             } else if (sender == insertImage) {
-                String url = Window.prompt("Enter an image URL:", "http://");
+                final String url = Window.prompt("Enter an image URL:",
+                        "http://");
                 if (url != null) {
                     extended.insertImage(url);
                 }
             } else if (sender == createLink) {
-                String url = Window.prompt("Enter a link URL:", "http://");
+                final String url = Window
+                        .prompt("Enter a link URL:", "http://");
                 if (url != null) {
                     extended.createLink(url);
                 }
@@ -319,17 +321,17 @@ public class RichTextToolbar extends Composite {
             RichTextArea.FontSize.LARGE, RichTextArea.FontSize.X_LARGE,
             RichTextArea.FontSize.XX_LARGE };
 
-    private Images images = (Images) GWT.create(Images.class);
-    private Strings strings = (Strings) GWT.create(Strings.class);
-    private EventListener listener = new EventListener();
+    private final Images images = (Images) GWT.create(Images.class);
+    private final Strings strings = (Strings) GWT.create(Strings.class);
+    private final EventListener listener = new EventListener();
 
-    private RichTextArea richText;
-    private RichTextArea.BasicFormatter basic;
-    private RichTextArea.ExtendedFormatter extended;
+    private final RichTextArea richText;
+    private final RichTextArea.BasicFormatter basic;
+    private final RichTextArea.ExtendedFormatter extended;
 
-    private VerticalPanel outer = new VerticalPanel();
-    private HorizontalPanel topPanel = new HorizontalPanel();
-    private HorizontalPanel bottomPanel = new HorizontalPanel();
+    private final VerticalPanel outer = new VerticalPanel();
+    private final HorizontalPanel topPanel = new HorizontalPanel();
+    private final HorizontalPanel bottomPanel = new HorizontalPanel();
     private ToggleButton bold;
     private ToggleButton italic;
     private ToggleButton underline;
@@ -427,7 +429,7 @@ public class RichTextToolbar extends Composite {
     }
 
     private ListBox createColorList(String caption) {
-        ListBox lb = new ListBox();
+        final ListBox lb = new ListBox();
         lb.addChangeListener(listener);
         lb.setVisibleItemCount(1);
 
@@ -442,7 +444,7 @@ public class RichTextToolbar extends Composite {
     }
 
     private ListBox createFontList() {
-        ListBox lb = new ListBox();
+        final ListBox lb = new ListBox();
         lb.addChangeListener(listener);
         lb.setVisibleItemCount(1);
 
@@ -458,7 +460,7 @@ public class RichTextToolbar extends Composite {
     }
 
     private ListBox createFontSizes() {
-        ListBox lb = new ListBox();
+        final ListBox lb = new ListBox();
         lb.addChangeListener(listener);
         lb.setVisibleItemCount(1);
 
@@ -474,7 +476,7 @@ public class RichTextToolbar extends Composite {
     }
 
     private PushButton createPushButton(AbstractImagePrototype img, String tip) {
-        PushButton pb = new PushButton(img.createImage());
+        final PushButton pb = new PushButton(img.createImage());
         pb.addClickListener(listener);
         pb.setTitle(tip);
         return pb;
@@ -482,7 +484,7 @@ public class RichTextToolbar extends Composite {
 
     private ToggleButton createToggleButton(AbstractImagePrototype img,
             String tip) {
-        ToggleButton tb = new ToggleButton(img.createImage());
+        final ToggleButton tb = new ToggleButton(img.createImage());
         tb.addClickListener(listener);
         tb.setTitle(tip);
         return tb;
index 43e40adfd0b1f00cee1b7139ece46dd7e715271a..6b8ba5022b20b4b3635af26f206405e7ef481777 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.util;\r
 \r
 import java.util.Arrays;\r
index 55a24cb5d0843492ed31338471d2f0834263c487..3a1ccfc2a277b82855ea2d9f4a5a27a44a271512 100644 (file)
@@ -50,7 +50,7 @@ public class Pattern {
      */\r
     public final static int CASE_INSENSITIVE = 2;\r
 \r
-    private JavaScriptObject regExp;\r
+    private final JavaScriptObject regExp;\r
 \r
     private static JavaScriptObject createExpression(String pattern, int flags) {\r
         String sFlags = "";\r
@@ -65,16 +65,16 @@ public class Pattern {
 \r
     private static native JavaScriptObject _createExpression(String pattern,\r
             String flags)/*-{\r
-                                                        return new RegExp(pattern, flags);\r
-                                                        }-*/;\r
+                                                                return new RegExp(pattern, flags);\r
+                                                                }-*/;\r
 \r
     private native void _match(String text, List matches)/*-{\r
-                                                        var regExp = this.@com.itmill.toolkit.terminal.gwt.client.util.Pattern::regExp;\r
-                                                        var result = text.match(regExp);\r
-                                                        if (result == null) return;\r
-                                                        for (var i=0;i<result.length;i++)\r
-                                                        matches.@java.util.ArrayList::add(Ljava/lang/Object;)(result[i]);\r
-                                                        }-*/;\r
+                                                                var regExp = this.@com.itmill.toolkit.terminal.gwt.client.util.Pattern::regExp;\r
+                                                                var result = text.match(regExp);\r
+                                                                if (result == null) return;\r
+                                                                for (var i=0;i<result.length;i++)\r
+                                                                matches.@java.util.ArrayList::add(Ljava/lang/Object;)(result[i]);\r
+                                                                }-*/;\r
 \r
     /**\r
      * Determines wether the specified regular expression is validated by the\r
@@ -139,9 +139,9 @@ public class Pattern {
      *         array is returned.\r
      */\r
     public String[] match(String text) {\r
-        List matches = new ArrayList();\r
+        final List matches = new ArrayList();\r
         _match(text, matches);\r
-        String arr[] = new String[matches.size()];\r
+        final String arr[] = new String[matches.size()];\r
         for (int i = 0; i < matches.size(); i++) {\r
             arr[i] = matches.get(i).toString();\r
         }\r
@@ -155,9 +155,9 @@ public class Pattern {
      * @return\r
      */\r
     public native boolean matches(String text)/*-{\r
-                                                        var regExp = this.@com.itmill.toolkit.terminal.gwt.client.util.Pattern::regExp;\r
-                                                        return regExp.test(text);\r
-                                                        }-*/;\r
+                                                                var regExp = this.@com.itmill.toolkit.terminal.gwt.client.util.Pattern::regExp;\r
+                                                                return regExp.test(text);\r
+                                                                }-*/;\r
 \r
     /**\r
      * Returns the regular expression for this pattern\r
@@ -165,16 +165,16 @@ public class Pattern {
      * @return\r
      */\r
     public native String pattern()/*-{\r
-                                                        var regExp = this.@com.itmill.toolkit.terminal.gwt.client.util.Pattern::regExp;\r
-                                                        return regExp.source;\r
-                                                        }-*/;\r
+                                                                var regExp = this.@com.itmill.toolkit.terminal.gwt.client.util.Pattern::regExp;\r
+                                                                return regExp.source;\r
+                                                                }-*/;\r
 \r
     private native void _split(String input, List results)/*-{\r
-                                                        var regExp = this.@com.itmill.toolkit.terminal.gwt.client.util.Pattern::regExp;\r
-                                                        var parts = input.split(regExp);\r
-                                                        for (var i=0;i<parts.length;i++)\r
-                                                        results.@java.util.ArrayList::add(Ljava/lang/Object;)(parts[i] );\r
-                                                        }-*/;\r
+                                                                var regExp = this.@com.itmill.toolkit.terminal.gwt.client.util.Pattern::regExp;\r
+                                                                var parts = input.split(regExp);\r
+                                                                for (var i=0;i<parts.length;i++)\r
+                                                                results.@java.util.ArrayList::add(Ljava/lang/Object;)(parts[i] );\r
+                                                                }-*/;\r
 \r
     /**\r
      * Split an input string by the pattern's regular expression\r
@@ -183,9 +183,9 @@ public class Pattern {
      * @return Array of strings\r
      */\r
     public String[] split(String input) {\r
-        List results = new ArrayList();\r
+        final List results = new ArrayList();\r
         _split(input, results);\r
-        String[] parts = new String[results.size()];\r
+        final String[] parts = new String[results.size()];\r
         for (int i = 0; i < results.size(); i++) {\r
             parts[i] = (String) results.get(i);\r
         }\r
index dfff067ec7216d714e446037843a7ce92139e988..08a3ed2f1876d7252e0b03a5a199a8a6b5555302 100644 (file)
@@ -63,7 +63,7 @@ import java.util.Date;
  * @version $Revision: 0.0 $
  */
 public class SimpleDateFormat {
-    private String format;
+    private final String format;
     private DateLocale locale = new DateLocale();
 
     /**
@@ -89,8 +89,8 @@ public class SimpleDateFormat {
             String lastTokenType = null;
             String currentToken = "";
             for (int i = 0; i < format.length(); i++) {
-                String thisChar = format.substring(i, i + 1);
-                String currentTokenType = DateLocale.SUPPORTED_DF_TOKENS
+                final String thisChar = format.substring(i, i + 1);
+                final String currentTokenType = DateLocale.SUPPORTED_DF_TOKENS
                         .contains(thisChar) ? thisChar : "";
                 if (currentTokenType.equals(lastTokenType) || i == 0) {
                     currentToken += thisChar;
@@ -126,7 +126,7 @@ public class SimpleDateFormat {
      */
     private String handleToken(String token, Date date) {
         String response = token;
-        String tc = token.substring(0, 1);
+        final String tc = token.substring(0, 1);
         if (DateLocale.TOKEN_DAY_OF_WEEK.equals(tc)) {
             if (token.length() > 3) {
                 response = locale.getWEEKDAY_LONG()[date.getDay()];
@@ -187,7 +187,7 @@ public class SimpleDateFormat {
             // else
             // response = Integer.toString(date.getSeconds());
         } else if (DateLocale.TOKEN_AM_PM.equals(tc)) {
-            int hour = date.getHours();
+            final int hour = date.getHours();
             if (hour > 11) {
                 response = DateLocale.getPM();
             } else {
index 9e1e316045f3fd241bb916982141b3c9c05c93f6..82fa24148763378c402482f179434e27a9307d14 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.terminal.gwt.client.util;\r
 \r
 import java.util.Date;\r
@@ -57,7 +61,7 @@ public class SimpleDateParser {
             { "y", "(\\d{1,2})", DateLocale.TOKEN_YEAR },\r
             { "a", "(\\S{1,4})", DateLocale.TOKEN_AM_PM } };\r
 \r
-    private Pattern regularExpression;\r
+    private final Pattern regularExpression;\r
 \r
     private String instructions = "";\r
 \r
@@ -67,7 +71,7 @@ public class SimpleDateParser {
         }\r
         if (format.startsWith("'")) {\r
             format = format.substring(1);\r
-            int end = format.indexOf("'");\r
+            final int end = format.indexOf("'");\r
             if (end == -1) {\r
                 throw new IllegalArgumentException("Unmatched single quotes.");\r
             }\r
@@ -75,8 +79,8 @@ public class SimpleDateParser {
             format = format.substring(end + 1);\r
         }\r
         for (int i = 0; i < TOKENS.length; i++) {\r
-            String[] row = TOKENS[i];\r
-            String datePattern = row[DATE_PATTERN];\r
+            final String[] row = TOKENS[i];\r
+            final String datePattern = row[DATE_PATTERN];\r
             if (!format.startsWith(datePattern)) {\r
                 continue;\r
             }\r
@@ -111,9 +115,10 @@ public class SimpleDateParser {
 \r
         if (component.equals(DateLocale.TOKEN_HOUR_12)) {\r
             int h = Integer.parseInt(text);\r
-            String token = com.itmill.toolkit.terminal.gwt.client.DateLocale\r
+            final String token = com.itmill.toolkit.terminal.gwt.client.DateLocale\r
                     .getPM();\r
-            String which = input.substring(input.length() - token.length()); // Assumes\r
+            final String which = input.substring(input.length()\r
+                    - token.length()); // Assumes\r
             // both\r
             // AM\r
             // and\r
@@ -142,15 +147,15 @@ public class SimpleDateParser {
     }\r
 \r
     public SimpleDateParser(String format) {\r
-        String[] args = new String[] { "", "" };\r
+        final String[] args = new String[] { "", "" };\r
         _parse(format, args);\r
         regularExpression = new Pattern(args[REGEX]);\r
         instructions = args[INSTRUCTION];\r
     }\r
 \r
     public Date parse(String input) {\r
-        Date date = new Date(0, 0, 0, 0, 0, 0);\r
-        String matches[] = regularExpression.match(input);\r
+        final Date date = new Date(0, 0, 0, 0, 0, 0);\r
+        final String matches[] = regularExpression.match(input);\r
         if (matches == null) {\r
             throw new IllegalArgumentException(input + " does not match "\r
                     + regularExpression.pattern());\r
@@ -160,7 +165,7 @@ public class SimpleDateParser {
                     + input + " does not match " + regularExpression.pattern());\r
         }\r
         for (int group = 0; group < instructions.length(); group++) {\r
-            String match = matches[group + 1];\r
+            final String match = matches[group + 1];\r
             load(date, match, "" + instructions.charAt(group), input,\r
                     regularExpression);\r
         }\r
index c7d9f8357d7453131d72fb51bc3daa6e2320960e..4a43d22d2ddbc7375a6f213fa0ddcc8e9d6b87f5 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal.gwt.server;
 
@@ -102,7 +78,7 @@ public class ApplicationServlet extends HttpServlet {
         } else {
             VERSION = "@VERSION@";
         }
-        String[] digits = VERSION.split("\\.");
+        final String[] digits = VERSION.split("\\.");
         VERSION_MAJOR = Integer.parseInt(digits[0]);
         VERSION_MINOR = Integer.parseInt(digits[1]);
         VERSION_BUILD = digits[2];
@@ -166,38 +142,39 @@ public class ApplicationServlet extends HttpServlet {
         super.init(servletConfig);
 
         // Get applicationRunner
-        String applicationRunner = servletConfig
+        final String applicationRunner = servletConfig
                 .getInitParameter("applicationRunner");
         if (applicationRunner != null) {
-            if ("true".equals(applicationRunner))
+            if ("true".equals(applicationRunner)) {
                 applicationRunnerMode = true;
-            else if ("false".equals(applicationRunner))
+            } else if ("false".equals(applicationRunner)) {
                 applicationRunnerMode = false;
-            else
+            } else {
                 throw new ServletException(
                         "If applicationRunner parameter is given for an application, it must be 'true' or 'false'");
+            }
         }
 
         // Stores the application parameters into Properties object
         applicationProperties = new Properties();
-        for (Enumeration e = servletConfig.getInitParameterNames(); e
+        for (final Enumeration e = servletConfig.getInitParameterNames(); e
                 .hasMoreElements();) {
-            String name = (String) e.nextElement();
+            final String name = (String) e.nextElement();
             applicationProperties.setProperty(name, servletConfig
                     .getInitParameter(name));
         }
 
         // Overrides with server.xml parameters
-        ServletContext context = servletConfig.getServletContext();
-        for (Enumeration e = context.getInitParameterNames(); e
+        final ServletContext context = servletConfig.getServletContext();
+        for (final Enumeration e = context.getInitParameterNames(); e
                 .hasMoreElements();) {
-            String name = (String) e.nextElement();
+            final String name = (String) e.nextElement();
             applicationProperties.setProperty(name, context
                     .getInitParameter(name));
         }
 
         // Gets the debug window parameter
-        String debug = getApplicationOrSystemProperty(PARAMETER_DEBUG, "")
+        final String debug = getApplicationOrSystemProperty(PARAMETER_DEBUG, "")
                 .toLowerCase();
 
         // Enables application specific debug
@@ -209,20 +186,20 @@ public class ApplicationServlet extends HttpServlet {
         debugMode = debug;
 
         // Gets custom class loader
-        String classLoaderName = getApplicationOrSystemProperty("ClassLoader",
-                null);
+        final String classLoaderName = getApplicationOrSystemProperty(
+                "ClassLoader", null);
         ClassLoader classLoader;
         if (classLoaderName == null) {
             classLoader = getClass().getClassLoader();
         } else {
             try {
-                Class classLoaderClass = getClass().getClassLoader().loadClass(
-                        classLoaderName);
-                Constructor c = classLoaderClass
+                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 (Exception e) {
+            } catch (final Exception e) {
                 System.err.println("Could not find specified class loader: "
                         + classLoaderName);
                 throw new ServletException(e);
@@ -234,14 +211,15 @@ public class ApplicationServlet extends HttpServlet {
         // as the servlet itself
         if (!applicationRunnerMode) {
             // Gets the application class name
-            String applicationClassName = servletConfig
+            final String applicationClassName = servletConfig
                     .getInitParameter("application");
-            if (applicationClassName == null)
+            if (applicationClassName == null) {
                 throw new ServletException(
                         "Application not specified in servlet parameters");
+            }
             try {
                 applicationClass = classLoader.loadClass(applicationClassName);
-            } catch (ClassNotFoundException e) {
+            } catch (final ClassNotFoundException e) {
                 throw new ServletException("Failed to load application class: "
                         + applicationClassName);
             }
@@ -278,11 +256,11 @@ public class ApplicationServlet extends HttpServlet {
 
         // Try system properties
         String pkgName;
-        Package pkg = getClass().getPackage();
+        final Package pkg = getClass().getPackage();
         if (pkg != null) {
             pkgName = pkg.getName();
         } else {
-            String className = getClass().getName();
+            final String className = getClass().getName();
             pkgName = new String(className.toCharArray(), 0, className
                     .lastIndexOf('.'));
         }
@@ -322,7 +300,7 @@ public class ApplicationServlet extends HttpServlet {
         if (request.getPathInfo() != null) {
             if (applicationRunnerMode
                     && (request.getPathInfo().indexOf("/", 1) != -1)) {
-                String resourceUrl = request.getPathInfo().substring(
+                final String resourceUrl = request.getPathInfo().substring(
                         request.getPathInfo().indexOf('/', 1));
                 if (resourceUrl.startsWith("/ITMILL/")) {
                     serveStaticResourcesInITMILL(resourceUrl, response);
@@ -346,8 +324,8 @@ public class ApplicationServlet extends HttpServlet {
             }
 
             // Update browser details
-            WebBrowser browser = WebApplicationContext.getApplicationContext(
-                    request.getSession()).getBrowser();
+            final WebBrowser browser = WebApplicationContext
+                    .getApplicationContext(request.getSession()).getBrowser();
             browser.updateBrowserProperties(request);
             // TODO Add screen height and width to the GWT client
 
@@ -367,12 +345,12 @@ public class ApplicationServlet extends HttpServlet {
             DownloadStream download = null;
 
             // Handles AJAX UIDL requests
-            String resourceId = request.getPathInfo();
+            final String resourceId = request.getPathInfo();
             if (resourceId != null) {
                 if (applicationRunnerMode) {
                     if (resourceId.indexOf("/", 1) != -1) {
-                        String resourceUrl = resourceId.substring(resourceId
-                                .indexOf('/', 1));
+                        final String resourceUrl = resourceId
+                                .substring(resourceId.indexOf('/', 1));
                         if (resourceId != null
                                 && (resourceUrl.startsWith(AJAX_UIDL_URI))) {
                             getApplicationManager(application)
@@ -433,7 +411,7 @@ public class ApplicationServlet extends HttpServlet {
                 }
 
                 // Handle parameters
-                Map parameters = request.getParameterMap();
+                final Map parameters = request.getParameterMap();
                 if (window != null && parameters != null) {
                     window.handleParameters(parameters);
                 }
@@ -446,7 +424,7 @@ public class ApplicationServlet extends HttpServlet {
                 handleDownload(download, request, response);
             }
 
-        } catch (Throwable e) {
+        } catch (final Throwable e) {
             // Print stacktrace
             e.printStackTrace();
             // Re-throw other exceptions
@@ -470,7 +448,7 @@ public class ApplicationServlet extends HttpServlet {
      */
     private void serveStaticResourcesInITMILL(String filename,
             HttpServletResponse response) throws IOException {
-        ServletContext sc = getServletContext();
+        final ServletContext sc = getServletContext();
         InputStream is = sc.getResourceAsStream(filename);
         if (is == null) {
             // try if requested file is found from classloader
@@ -478,7 +456,7 @@ public class ApplicationServlet extends HttpServlet {
                 // strip leading "/" otherwise stream from JAR wont work
                 filename = filename.substring(1);
                 is = classLoader.getResourceAsStream(filename);
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 e.printStackTrace();
             }
             if (is == null) {
@@ -492,12 +470,12 @@ public class ApplicationServlet extends HttpServlet {
                 return;
             }
         }
-        String mimetype = sc.getMimeType(filename);
+        final String mimetype = sc.getMimeType(filename);
         if (mimetype != null) {
             response.setContentType(mimetype);
         }
-        OutputStream os = response.getOutputStream();
-        byte buffer[] = new byte[20000];
+        final OutputStream os = response.getOutputStream();
+        final byte buffer[] = new byte[20000];
         int bytes;
         while ((bytes = is.read(buffer)) >= 0) {
             os.write(buffer, 0, bytes);
@@ -525,9 +503,9 @@ public class ApplicationServlet extends HttpServlet {
             HttpServletResponse response, Window window, String themeName)
             throws IOException, MalformedURLException {
         response.setContentType("text/html");
-        BufferedWriter page = new BufferedWriter(new OutputStreamWriter(
+        final BufferedWriter page = new BufferedWriter(new OutputStreamWriter(
                 response.getOutputStream()));
-        String pathInfo = request.getPathInfo() == null ? "/" : request
+        final String pathInfo = request.getPathInfo() == null ? "/" : request
                 .getPathInfo();
         page
                 .write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" "
@@ -545,11 +523,12 @@ public class ApplicationServlet extends HttpServlet {
         if (applicationRunnerMode) {
             String servletPath = request.getContextPath()
                     + request.getServletPath();
-            if (request.getPathInfo().indexOf('/', 1) == -1)
+            if (request.getPathInfo().indexOf('/', 1) == -1) {
                 servletPath += request.getPathInfo();
-            else
+            } else {
                 servletPath += request.getPathInfo().substring(1,
                         request.getPathInfo().indexOf('/', 1));
+            }
             appUrl = servletPath;
         } else {
             urlParts = getApplicationUrl(request).toString().split("\\/");
@@ -568,7 +547,7 @@ public class ApplicationServlet extends HttpServlet {
             widgetset = DEFAULT_WIDGETSET;
         }
 
-        String staticFilePath = getApplicationOrSystemProperty(
+        final String staticFilePath = getApplicationOrSystemProperty(
                 PARAMETER_ITMILL_RESOURCES, appUrl);
 
         // Default theme does not use theme URI
@@ -635,7 +614,7 @@ public class ApplicationServlet extends HttpServlet {
         DownloadStream stream = null;
         try {
             stream = application.handleURI(application.getURL(), uri);
-        } catch (Throwable t) {
+        } catch (final Throwable t) {
             application.terminalError(new URIHandlerErrorImpl(application, t));
         }
 
@@ -662,14 +641,14 @@ public class ApplicationServlet extends HttpServlet {
             HttpServletRequest request, HttpServletResponse response) {
 
         // Download from given stream
-        InputStream data = stream.getStream();
+        final InputStream data = stream.getStream();
         if (data != null) {
 
             // Sets content type
             response.setContentType(stream.getContentType());
 
             // Sets cache headers
-            long cacheTime = stream.getCacheTime();
+            final long cacheTime = stream.getCacheTime();
             if (cacheTime <= 0) {
                 response.setHeader("Cache-Control", "no-cache");
                 response.setHeader("Pragma", "no-cache");
@@ -686,10 +665,10 @@ public class ApplicationServlet extends HttpServlet {
 
             // Copy download stream parameters directly
             // to HTTP headers.
-            Iterator i = stream.getParameterNames();
+            final Iterator i = stream.getParameterNames();
             if (i != null) {
                 while (i.hasNext()) {
-                    String param = (String) i.next();
+                    final String param = (String) i.next();
                     response.setHeader(param, stream.getParameter(param));
                 }
             }
@@ -698,18 +677,18 @@ public class ApplicationServlet extends HttpServlet {
             if (bufferSize <= 0 || bufferSize > MAX_BUFFER_SIZE) {
                 bufferSize = DEFAULT_BUFFER_SIZE;
             }
-            byte[] buffer = new byte[bufferSize];
+            final byte[] buffer = new byte[bufferSize];
             int bytesRead = 0;
 
             try {
-                OutputStream out = response.getOutputStream();
+                final OutputStream out = response.getOutputStream();
 
                 while ((bytesRead = data.read(buffer)) > 0) {
                     out.write(buffer, 0, bytesRead);
                     out.flush();
                 }
                 out.close();
-            } catch (IOException ignored) {
+            } catch (final IOException ignored) {
             }
 
         }
@@ -758,7 +737,7 @@ public class ApplicationServlet extends HttpServlet {
         try {
             data = getServletContext().getResourceAsStream(
                     THEME_DIRECTORY_PATH + themeName + "/" + resourceId);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             e.printStackTrace();
             data = null;
         }
@@ -779,9 +758,9 @@ public class ApplicationServlet extends HttpServlet {
                 // Tomcats
 
                 // Writes the data to client
-                byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
+                final byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
                 int bytesRead = 0;
-                OutputStream out = response.getOutputStream();
+                final OutputStream out = response.getOutputStream();
                 while ((bytesRead = data.read(buffer)) > 0) {
                     out.write(buffer, 0, bytesRead);
                 }
@@ -791,7 +770,7 @@ public class ApplicationServlet extends HttpServlet {
                 response.sendError(HttpServletResponse.SC_NOT_FOUND);
             }
 
-        } catch (java.io.IOException e) {
+        } catch (final java.io.IOException e) {
             System.err.println("Resource transfer failed:  "
                     + request.getRequestURI() + ". (" + e.getMessage() + ")");
         }
@@ -813,7 +792,7 @@ public class ApplicationServlet extends HttpServlet {
 
         URL applicationUrl;
         try {
-            URL reqURL = new URL(
+            final URL reqURL = new URL(
                     (request.isSecure() ? "https://" : "http://")
                             + request.getServerName()
                             + ((request.isSecure() && request.getServerPort() == 443)
@@ -821,8 +800,9 @@ public class ApplicationServlet extends HttpServlet {
                                             .getServerPort() == 80) ? "" : ":"
                                     + request.getServerPort())
                             + request.getRequestURI());
-            if (applicationRunnerMode)
+            if (applicationRunnerMode) {
                 return reqURL;
+            }
             String servletPath = request.getContextPath()
                     + request.getServletPath();
             if (servletPath.length() == 0
@@ -830,7 +810,7 @@ public class ApplicationServlet extends HttpServlet {
                 servletPath = servletPath + "/";
             }
             applicationUrl = new URL(reqURL, servletPath);
-        } catch (MalformedURLException e) {
+        } catch (final MalformedURLException e) {
             System.err.println("Error constructing application url "
                     + request.getRequestURI() + " (" + e + ")");
             throw e;
@@ -863,27 +843,28 @@ public class ApplicationServlet extends HttpServlet {
             InstantiationException {
 
         // Ensures that the session is still valid
-        HttpSession session = request.getSession(true);
+        final HttpSession session = request.getSession(true);
 
         // Gets application list for the session.
-        Collection applications = WebApplicationContext.getApplicationContext(
-                session).getApplications();
+        final Collection applications = WebApplicationContext
+                .getApplicationContext(session).getApplications();
 
         // Search for the application (using the application URI) from the list
-        for (Iterator i = applications.iterator(); i.hasNext();) {
-            Application a = (Application) i.next();
-            String aPath = a.getURL().getPath();
+        for (final Iterator i = applications.iterator(); i.hasNext();) {
+            final Application a = (Application) i.next();
+            final String aPath = a.getURL().getPath();
             String servletPath = request.getContextPath()
                     + request.getServletPath();
             if (servletPath.length() < aPath.length()) {
                 servletPath += "/";
             }
             if (applicationRunnerMode) {
-                if (request.getPathInfo().indexOf('/', 1) == -1)
+                if (request.getPathInfo().indexOf('/', 1) == -1) {
                     servletPath += request.getPathInfo();
-                else
+                } else {
                     servletPath += request.getPathInfo().substring(1,
                             request.getPathInfo().indexOf('/', 1));
+                }
 
             }
             if (servletPath.equals(aPath)) {
@@ -899,16 +880,16 @@ public class ApplicationServlet extends HttpServlet {
             }
         }
         // Creates application, because a running one was not found
-        WebApplicationContext context = WebApplicationContext
+        final WebApplicationContext context = WebApplicationContext
                 .getApplicationContext(request.getSession());
-        URL applicationUrl = getApplicationUrl(request);
+        final URL applicationUrl = getApplicationUrl(request);
 
         if (applicationRunnerMode) {
-            String applicationClassName = applicationUrl.getPath().substring(
-                    applicationUrl.getPath().lastIndexOf('/') + 1);
+            final String applicationClassName = applicationUrl.getPath()
+                    .substring(applicationUrl.getPath().lastIndexOf('/') + 1);
             try {
                 applicationClass = classLoader.loadClass(applicationClassName);
-            } catch (ClassNotFoundException e) {
+            } catch (final ClassNotFoundException e) {
                 throw new InstantiationException(
                         "Failed to load application class: "
                                 + applicationClassName);
@@ -917,7 +898,7 @@ public class ApplicationServlet extends HttpServlet {
 
         // Creates new application and start it
         try {
-            Application application = (Application) applicationClass
+            final Application application = (Application) applicationClass
                     .newInstance();
             context.addApplication(application);
 
@@ -928,11 +909,11 @@ public class ApplicationServlet extends HttpServlet {
             application.start(applicationUrl, applicationProperties, context);
             return application;
 
-        } catch (IllegalAccessException e) {
+        } catch (final IllegalAccessException e) {
             System.err.println("Illegal access to application class "
                     + applicationClass.getName());
             throw e;
-        } catch (InstantiationException e) {
+        } catch (final InstantiationException e) {
             System.err.println("Failed to instantiate application class: "
                     + applicationClass.getName());
             throw e;
@@ -960,7 +941,7 @@ public class ApplicationServlet extends HttpServlet {
             logoutUrl = application.getURL().toString();
         }
 
-        HttpSession session = request.getSession();
+        final HttpSession session = request.getSession();
         if (session != null) {
             WebApplicationContext.getApplicationContext(session)
                     .removeApplication(application);
@@ -998,7 +979,7 @@ public class ApplicationServlet extends HttpServlet {
             if (path.charAt(0) == '/') {
                 path = path.substring(1);
             }
-            int index = path.indexOf('/');
+            final int index = path.indexOf('/');
             if (index < 0) {
                 windowName = path;
                 path = "";
@@ -1050,7 +1031,7 @@ public class ApplicationServlet extends HttpServlet {
      */
     public boolean isDebugMode(Map parameters) {
         if (parameters != null) {
-            Object[] debug = (Object[]) parameters.get("debug");
+            final Object[] debug = (Object[]) parameters.get("debug");
             if (debug != null && !"false".equals(debug[0].toString())
                     && !"false".equals(debugMode)) {
                 return true;
@@ -1171,9 +1152,9 @@ public class ApplicationServlet extends HttpServlet {
             return resultPath;
         } else {
             try {
-                URL url = servletContext.getResource(path);
+                final URL url = servletContext.getResource(path);
                 resultPath = url.getFile();
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 // ignored
             }
         }
index 6ecdb543f26311e3c1ccf710074687ad7216ff4b..591e3e19d03e7752d3075781448682074efd8d64 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal.gwt.server;
 
@@ -96,17 +72,17 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
 
     private static int MAX_BUFFER_SIZE = 64 * 1024;
 
-    private HashSet dirtyPaintabletSet = new HashSet();
+    private final HashSet dirtyPaintabletSet = new HashSet();
 
-    private WeakHashMap paintableIdMap = new WeakHashMap();
+    private final WeakHashMap paintableIdMap = new WeakHashMap();
 
-    private WeakHashMap idPaintableMap = new WeakHashMap();
+    private final WeakHashMap idPaintableMap = new WeakHashMap();
 
     private int idSequence = 0;
 
-    private Application application;
+    private final Application application;
 
-    private Set removedWindows = new HashSet();
+    private final Set removedWindows = new HashSet();
 
     private JsonPaintTarget paintTarget;
 
@@ -114,7 +90,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
 
     private int pendingLocalesIndex;
 
-    private ApplicationServlet applicationServlet;
+    private final ApplicationServlet applicationServlet;
 
     public CommunicationManager(Application application,
             ApplicationServlet applicationServlet) {
@@ -152,9 +128,9 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
     public void handleFileUpload(HttpServletRequest request,
             HttpServletResponse response) throws IOException {
         // Create a new file upload handler
-        ServletFileUpload upload = new ServletFileUpload();
+        final ServletFileUpload upload = new ServletFileUpload();
 
-        UploadProgressListener pl = new UploadProgressListener();
+        final UploadProgressListener pl = new UploadProgressListener();
 
         upload.setProgressListener(pl);
 
@@ -168,16 +144,17 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
              * request.
              */
             while (iter.hasNext()) {
-                FileItemStream item = iter.next();
-                String name = item.getFieldName();
+                final FileItemStream item = iter.next();
+                final String name = item.getFieldName();
                 final String filename = item.getName();
                 final String mimeType = item.getContentType();
                 final InputStream stream = item.openStream();
                 if (item.isFormField()) {
                     // ignored, upload requests contian only files
                 } else {
-                    String pid = name.split("_")[0];
-                    Upload uploadComponent = (Upload) idPaintableMap.get(pid);
+                    final String pid = name.split("_")[0];
+                    final Upload uploadComponent = (Upload) idPaintableMap
+                            .get(pid);
                     if (uploadComponent == null) {
                         throw new FileUploadException(
                                 "Upload component not found");
@@ -186,7 +163,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
                         // put upload component into receiving state
                         uploadComponent.startUpload();
                     }
-                    UploadStream upstream = new UploadStream() {
+                    final UploadStream upstream = new UploadStream() {
 
                         public String getContentName() {
                             return filename;
@@ -213,14 +190,14 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
                     uploadComponent.receiveUpload(upstream);
                 }
             }
-        } catch (FileUploadException e) {
+        } catch (final FileUploadException e) {
             e.printStackTrace();
         }
 
         // Send short response to acknowledge client that request was done
         response.setContentType("text/html");
-        OutputStream out = response.getOutputStream();
-        PrintWriter outWriter = new PrintWriter(new BufferedWriter(
+        final OutputStream out = response.getOutputStream();
+        final PrintWriter outWriter = new PrintWriter(new BufferedWriter(
                 new OutputStreamWriter(out, "UTF-8")));
         outWriter.print("<html><body>download handled</body></html>");
         outWriter.flush();
@@ -241,8 +218,8 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
         boolean repaintAll = (request.getParameter(GET_PARAM_REPAINT_ALL) != null)
                 || request.getSession().isNew();
 
-        OutputStream out = response.getOutputStream();
-        PrintWriter outWriter = new PrintWriter(new BufferedWriter(
+        final OutputStream out = response.getOutputStream();
+        final PrintWriter outWriter = new PrintWriter(new BufferedWriter(
                 new OutputStreamWriter(out, "UTF-8")));
 
         try {
@@ -266,9 +243,10 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
 
                 // If repaint is requested, clean all ids in this root window
                 if (repaintAll) {
-                    for (Iterator it = idPaintableMap.keySet().iterator(); it
+                    for (final Iterator it = idPaintableMap.keySet().iterator(); it
                             .hasNext();) {
-                        Component c = (Component) idPaintableMap.get(it.next());
+                        final Component c = (Component) idPaintableMap.get(it
+                                .next());
                         if (isChildOf(window, c)) {
                             it.remove();
                             paintableIdMap.remove(c);
@@ -310,14 +288,14 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
                 if (paintables != null) {
 
                     // Creates "working copy" of the current state.
-                    List currentPaintables = new ArrayList(paintables);
+                    final List currentPaintables = new ArrayList(paintables);
 
                     // Sorts the Paintable list so that parents
                     // are always painted before children
                     Collections.sort(currentPaintables, new Comparator() {
                         public int compare(Object o1, Object o2) {
-                            Component c1 = (Component) o1;
-                            Component c2 = (Component) o2;
+                            final Component c1 = (Component) o1;
+                            final Component c2 = (Component) o2;
                             if (isChildOf(c1, c2)) {
                                 return -1;
                             }
@@ -328,12 +306,13 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
                         }
                     });
 
-                    for (Iterator i = currentPaintables.iterator(); i.hasNext();) {
-                        Paintable p = (Paintable) i.next();
+                    for (final Iterator i = currentPaintables.iterator(); i
+                            .hasNext();) {
+                        final Paintable p = (Paintable) i.next();
 
                         // TODO CLEAN
                         if (p instanceof Window) {
-                            Window w = (Window) p;
+                            final Window w = (Window) p;
                             if (w.getTerminal() == null) {
                                 w.setTerminal(application.getMainWindow()
                                         .getTerminal());
@@ -352,7 +331,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
                         // rendered already (changes with only cached flag)
                         paintTarget.startTag("change");
                         paintTarget.addAttribute("format", "uidl");
-                        String pid = getPaintableId(p);
+                        final String pid = getPaintableId(p);
                         paintTarget.addAttribute("pid", pid);
 
                         // Track paints to identify empty paints
@@ -372,10 +351,10 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
                 outWriter.print("]"); // close changes
 
                 outWriter.print(", \"meta\" : {");
-                boolean metaOpen = false;
+                final boolean metaOpen = false;
 
                 // add meta instruction for client to set focus if it is set
-                Paintable f = (Paintable) application.consumeFocus();
+                final Paintable f = (Paintable) application.consumeFocus();
                 if (f != null) {
                     if (metaOpen) {
                         outWriter.write(",");
@@ -397,9 +376,9 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
                 // TODO We should only precache the layouts that are not
                 // cached already
                 int resourceIndex = 0;
-                for (Iterator i = paintTarget.getPreCachedResources()
+                for (final Iterator i = paintTarget.getPreCachedResources()
                         .iterator(); i.hasNext();) {
-                    String resource = (String) i.next();
+                    final String resource = (String) i.next();
                     InputStream is = null;
                     try {
                         is = applicationServlet
@@ -408,24 +387,25 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
                                         "/"
                                                 + ApplicationServlet.THEME_DIRECTORY_PATH
                                                 + themeName + "/" + resource);
-                    } catch (Exception e) {
+                    } catch (final Exception e) {
                         e.printStackTrace();
                     }
                     if (is != null) {
 
                         outWriter.print((resourceIndex++ > 0 ? ", " : "")
                                 + "\"" + resource + "\" : ");
-                        StringBuffer layout = new StringBuffer();
+                        final StringBuffer layout = new StringBuffer();
 
                         try {
-                            InputStreamReader r = new InputStreamReader(is);
-                            char[] buffer = new char[20000];
+                            final InputStreamReader r = new InputStreamReader(
+                                    is);
+                            final char[] buffer = new char[20000];
                             int charsRead = 0;
                             while ((charsRead = r.read(buffer)) > 0) {
                                 layout.append(buffer, 0, charsRead);
                             }
                             r.close();
-                        } catch (java.io.IOException e) {
+                        } catch (final java.io.IOException e) {
                             System.err.println("Resource transfer failed:  "
                                     + request.getRequestURI() + ". ("
                                     + e.getMessage() + ")");
@@ -447,13 +427,13 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
             out.flush();
             out.close();
 
-        } catch (Throwable e) {
+        } catch (final Throwable e) {
             e.printStackTrace();
             // Writes the error report to client
             // FIXME breaks UIDL response, security shouldn't reveal stack trace
             // to client side
-            OutputStreamWriter w = new OutputStreamWriter(out);
-            PrintWriter err = new PrintWriter(w);
+            final OutputStreamWriter w = new OutputStreamWriter(out);
+            final PrintWriter err = new PrintWriter(w);
             err
                     .write("<html><head><title>Application Internal Error</title></head><body>");
             err.write("<h1>" + e.toString() + "</h1><pre>\n");
@@ -469,16 +449,16 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
     private Map handleVariables(HttpServletRequest request,
             Application application2) {
 
-        Map params = new HashMap(request.getParameterMap());
-        String changes = (String) ((params.get("changes") instanceof String[]) ? ((String[]) params
+        final Map params = new HashMap(request.getParameterMap());
+        final String changes = (String) ((params.get("changes") instanceof String[]) ? ((String[]) params
                 .get("changes"))[0]
                 : params.get("changes"));
         params.remove("changes");
         if (changes != null) {
-            String[] ca = changes.split("\u0001");
+            final String[] ca = changes.split("\u0001");
             for (int i = 0; i < ca.length; i++) {
                 String[] vid = ca[i].split("_");
-                VariableOwner owner = (VariableOwner) idPaintableMap
+                final VariableOwner owner = (VariableOwner) idPaintableMap
                         .get(vid[0]);
                 if (owner != null) {
                     Map m;
@@ -547,22 +527,23 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
 
         // Store JVM default locale for later restoration
         // (we'll have to change the default locale for a while)
-        Locale jvmDefault = Locale.getDefault();
+        final Locale jvmDefault = Locale.getDefault();
 
         // Send locale informations to client
         outWriter.print(", \"locales\":[");
         for (; pendingLocalesIndex < locales.size(); pendingLocalesIndex++) {
 
-            Locale l = generateLocale((String) locales.get(pendingLocalesIndex));
+            final Locale l = generateLocale((String) locales
+                    .get(pendingLocalesIndex));
             // Locale name
             outWriter.print("{\"name\":\"" + l.toString() + "\",");
 
             /*
              * Month names (both short and full)
              */
-            DateFormatSymbols dfs = new DateFormatSymbols(l);
-            String[] short_months = dfs.getShortMonths();
-            String[] months = dfs.getMonths();
+            final DateFormatSymbols dfs = new DateFormatSymbols(l);
+            final String[] short_months = dfs.getShortMonths();
+            final String[] months = dfs.getMonths();
             outWriter.print("\"smn\":[\""
                     + // ShortMonthNames
                     short_months[0] + "\",\"" + short_months[1] + "\",\""
@@ -583,8 +564,8 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
             /*
              * Weekday names (both short and full)
              */
-            String[] short_days = dfs.getShortWeekdays();
-            String[] days = dfs.getWeekdays();
+            final String[] short_days = dfs.getShortWeekdays();
+            final String[] days = dfs.getWeekdays();
             outWriter.print("\"sdn\":[\""
                     + // ShortDayNames
                     short_days[1] + "\",\"" + short_days[2] + "\",\""
@@ -600,7 +581,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
             /*
              * First day of week (0 = sunday, 1 = monday)
              */
-            Calendar cal = new GregorianCalendar(l);
+            final Calendar cal = new GregorianCalendar(l);
             outWriter.print("\"fdow\":" + (cal.getFirstDayOfWeek() - 1) + ",");
 
             /*
@@ -609,41 +590,41 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
             // Force our locale as JVM default for a while (SimpleDateFormat
             // uses JVM default)
             Locale.setDefault(l);
-            String df = new SimpleDateFormat().toPattern();
+            final String df = new SimpleDateFormat().toPattern();
             int timeStart = df.indexOf("H");
             if (timeStart < 0) {
                 timeStart = df.indexOf("h");
             }
-            int ampm_first = df.indexOf("a");
+            final int ampm_first = df.indexOf("a");
             // E.g. in Korean locale AM/PM is before h:mm
             // TODO should take that into consideration on client-side as well,
             // now always h:mm a
             if (ampm_first > 0 && ampm_first < timeStart) {
                 timeStart = ampm_first;
             }
-            String dateformat = df.substring(0, timeStart - 1);
+            final String dateformat = df.substring(0, timeStart - 1);
 
             outWriter.print("\"df\":\"" + dateformat.trim() + "\",");
 
             /*
              * Time formatting (24 or 12 hour clock and AM/PM suffixes)
              */
-            String timeformat = df.substring(timeStart, df.length()); // Doesn't
+            final String timeformat = df.substring(timeStart, df.length()); // Doesn't
             // return
             // second
             // or
             // milliseconds
             // We use timeformat to determine 12/24-hour clock
-            boolean twelve_hour_clock = timeformat.indexOf("a") > -1;
+            final boolean twelve_hour_clock = timeformat.indexOf("a") > -1;
             // TODO there are other possibilities as well, like 'h' in french
             // (ignore them, too complicated)
-            String hour_min_delimiter = timeformat.indexOf(".") > -1 ? "."
+            final String hour_min_delimiter = timeformat.indexOf(".") > -1 ? "."
                     : ":";
             // outWriter.print("\"tf\":\"" + timeformat + "\",");
             outWriter.print("\"thc\":" + twelve_hour_clock + ",");
             outWriter.print("\"hmd\":\"" + hour_min_delimiter + "\"");
             if (twelve_hour_clock) {
-                String[] ampm = dfs.getAmPmStrings();
+                final String[] ampm = dfs.getAmPmStrings();
                 outWriter.print(",\"ampm\":[\"" + ampm[0] + "\",\"" + ampm[1]
                         + "\"]");
             }
@@ -690,7 +671,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
             if (path.charAt(0) == '/') {
                 path = path.substring(1);
             }
-            int index = path.indexOf('/');
+            final int index = path.indexOf('/');
             if (index < 0) {
                 windowName = path;
                 path = "";
@@ -729,14 +710,14 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
             HttpServletRequest request, HttpServletResponse response) {
 
         // Download from given stream
-        InputStream data = stream.getStream();
+        final InputStream data = stream.getStream();
         if (data != null) {
 
             // Sets content type
             response.setContentType(stream.getContentType());
 
             // Sets cache headers
-            long cacheTime = stream.getCacheTime();
+            final long cacheTime = stream.getCacheTime();
             if (cacheTime <= 0) {
                 response.setHeader("Cache-Control", "no-cache");
                 response.setHeader("Pragma", "no-cache");
@@ -753,10 +734,10 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
 
             // Copy download stream parameters directly
             // to HTTP headers.
-            Iterator i = stream.getParameterNames();
+            final Iterator i = stream.getParameterNames();
             if (i != null) {
                 while (i.hasNext()) {
-                    String param = (String) i.next();
+                    final String param = (String) i.next();
                     response.setHeader(param, stream.getParameter(param));
                 }
             }
@@ -765,18 +746,18 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
             if (bufferSize <= 0 || bufferSize > MAX_BUFFER_SIZE) {
                 bufferSize = DEFAULT_BUFFER_SIZE;
             }
-            byte[] buffer = new byte[bufferSize];
+            final byte[] buffer = new byte[bufferSize];
             int bytesRead = 0;
 
             try {
-                OutputStream out = response.getOutputStream();
+                final OutputStream out = response.getOutputStream();
 
                 while ((bytesRead = data.read(buffer)) > 0) {
                     out.write(buffer, 0, bytesRead);
                     out.flush();
                 }
                 out.close();
-            } catch (IOException ignored) {
+            } catch (final IOException ignored) {
             }
 
         }
@@ -807,8 +788,8 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
         // tell client that application has quit and where to point browser now
         // Set the response type
         response.setContentType("application/json; charset=UTF-8");
-        ServletOutputStream out = response.getOutputStream();
-        PrintWriter outWriter = new PrintWriter(new BufferedWriter(
+        final ServletOutputStream out = response.getOutputStream();
+        final PrintWriter outWriter = new PrintWriter(new BufferedWriter(
                 new OutputStreamWriter(out, "UTF-8")));
         outWriter.print(")/*{");
         outWriter.print("\"redirect\":{");
@@ -847,7 +828,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
      * @return
      */
     public synchronized Set getDirtyComponents(Window w) {
-        HashSet resultset = new HashSet(dirtyPaintabletSet);
+        final HashSet resultset = new HashSet(dirtyPaintabletSet);
 
         // The following algorithm removes any components that would be painted
         // as
@@ -856,10 +837,10 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
         // The result is that each component should be painted exactly once and
         // any unmodified components will be painted as "cached=true".
 
-        for (Iterator i = dirtyPaintabletSet.iterator(); i.hasNext();) {
-            Paintable p = (Paintable) i.next();
+        for (final Iterator i = dirtyPaintabletSet.iterator(); i.hasNext();) {
+            final Paintable p = (Paintable) i.next();
             if (p instanceof Component) {
-                Component component = (Component) p;
+                final Component component = (Component) p;
                 if (component.getApplication() == null) {
                     // component is detached after requestRepaint is called
                     resultset.remove(p);
@@ -886,7 +867,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
      * @see com.itmill.toolkit.terminal.Paintable.RepaintRequestListener#repaintRequested(com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent)
      */
     public void repaintRequested(RepaintRequestEvent event) {
-        Paintable p = event.getPaintable();
+        final Paintable p = event.getPaintable();
         dirtyPaintabletSet.add(p);
 
     }
@@ -963,7 +944,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
         }
 
         public Set entrySet() {
-            Set s = new HashSet();
+            final Set s = new HashSet();
             s.add(new Map.Entry() {
 
                 public Object getKey() {
@@ -993,7 +974,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
         }
 
         public Set keySet() {
-            Set s = new HashSet();
+            final Set s = new HashSet();
             s.add(name);
             return s;
         }
@@ -1015,7 +996,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
         }
 
         public Collection values() {
-            LinkedList s = new LinkedList();
+            final LinkedList s = new LinkedList();
             s.add(value);
             return s;
 
@@ -1027,9 +1008,9 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
      */
     public class URIHandlerErrorImpl implements URIHandler.ErrorEvent {
 
-        private URIHandler owner;
+        private final URIHandler owner;
 
-        private Throwable throwable;
+        private final Throwable throwable;
 
         /**
          * 
@@ -1068,7 +1049,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
     }
 
     private Locale generateLocale(String value) {
-        String[] temp = value.split("_");
+        final String[] temp = value.split("_");
         if (temp.length == 1) {
             return new Locale(temp[0]);
         } else if (temp.length == 2) {
index 2593addef757cf988ebb6bedc150311e8b68be4f..2888907c90757512a92936cd59f860645e17ae70 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal.gwt.server;
 
@@ -44,16 +20,16 @@ public class HttpUploadStream implements
     /**
      * Holds value of property variableName.
      */
-    private String streamName;
+    private final String streamName;
 
-    private String contentName;
+    private final String contentName;
 
-    private String contentType;
+    private final String contentType;
 
     /**
      * Holds value of property variableValue.
      */
-    private InputStream stream;
+    private final InputStream stream;
 
     /**
      * Creates a new instance of UploadStreamImpl.
index 3c8f413e359510fdf1aef5f593f2eaaa85726e32..1de91128b616c7793e2b69d414ac9d5f61600b4d 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal.gwt.server;
 
@@ -63,17 +39,17 @@ public class JsonPaintTarget implements PaintTarget {
 
     private final static String UIDL_ARG_ID = "id";
 
-    private Stack mOpenTags;
+    private final Stack mOpenTags;
 
-    private Stack openJsonTags;
+    private final Stack openJsonTags;
 
     private boolean mTagArgumentListOpen;
 
-    private PrintWriter uidlBuffer;
+    private final PrintWriter uidlBuffer;
 
     private boolean closed = false;
 
-    private CommunicationManager manager;
+    private final CommunicationManager manager;
 
     private boolean trackPaints = false;
 
@@ -199,7 +175,7 @@ public class JsonPaintTarget implements PaintTarget {
         }
 
         if (openJsonTags.size() > 0) {
-            JsonTag parent = (JsonTag) openJsonTags.pop();
+            final JsonTag parent = (JsonTag) openJsonTags.pop();
 
             String lastTag = "";
 
@@ -260,11 +236,11 @@ public class JsonPaintTarget implements PaintTarget {
             return new StringBuffer("");
         }
 
-        StringBuffer result = new StringBuffer(xml.length() * 2);
+        final StringBuffer result = new StringBuffer(xml.length() * 2);
 
         for (int i = 0; i < xml.length(); i++) {
-            char c = xml.charAt(i);
-            String s = toXmlChar(c);
+            final char c = xml.charAt(i);
+            final String s = toXmlChar(c);
             if (s != null) {
                 result.append(s);
             } else {
@@ -278,9 +254,9 @@ public class JsonPaintTarget implements PaintTarget {
         if (s == null) {
             return "";
         }
-        StringBuffer sb = new StringBuffer();
+        final StringBuffer sb = new StringBuffer();
         for (int i = 0; i < s.length(); i++) {
-            char ch = s.charAt(i);
+            final char ch = s.charAt(i);
             switch (ch) {
             case '"':
                 sb.append("\\\"");
@@ -308,7 +284,7 @@ public class JsonPaintTarget implements PaintTarget {
                 break;
             default:
                 if (ch >= '\u0000' && ch <= '\u001F') {
-                    String ss = Integer.toHexString(ch);
+                    final String ss = Integer.toHexString(ch);
                     sb.append("\\u");
                     for (int k = 0; k < 4 - ss.length(); k++) {
                         sb.append('0');
@@ -392,8 +368,8 @@ public class JsonPaintTarget implements PaintTarget {
             addAttribute(name, ((ExternalResource) value).getURL());
 
         } else if (value instanceof ApplicationResource) {
-            ApplicationResource r = (ApplicationResource) value;
-            Application a = r.getApplication();
+            final ApplicationResource r = (ApplicationResource) value;
+            final Application a = r.getApplication();
             if (a == null) {
                 throw new PaintException(
                         "Application not specified for resorce "
@@ -412,7 +388,8 @@ public class JsonPaintTarget implements PaintTarget {
             addAttribute(name, uri);
 
         } else if (value instanceof ThemeResource) {
-            String uri = "theme://" + ((ThemeResource) value).getResourceId();
+            final String uri = "theme://"
+                    + ((ThemeResource) value).getResourceId();
             addAttribute(name, uri);
         } else {
             throw new PaintException("Ajax adapter does not "
@@ -523,7 +500,7 @@ public class JsonPaintTarget implements PaintTarget {
             throw new NullPointerException(
                     "Parameters must be non-null strings");
         }
-        StringBuffer buf = new StringBuffer();
+        final StringBuffer buf = new StringBuffer();
         buf.append("\"" + name + "\":[");
         for (int i = 0; i < values.length; i++) {
             if (i > 0) {
@@ -809,8 +786,8 @@ public class JsonPaintTarget implements PaintTarget {
     public boolean startTag(Paintable paintable, String tagName)
             throws PaintException {
         startTag(tagName, true);
-        boolean isPreviouslyPainted = manager.hasPaintableId(paintable);
-        String id = manager.getPaintableId(paintable);
+        final boolean isPreviouslyPainted = manager.hasPaintableId(paintable);
+        final String id = manager.getPaintableId(paintable);
         paintable.addListener(manager);
         addAttribute("id", id);
         return cacheEnabled && isPreviouslyPainted;
@@ -941,8 +918,8 @@ public class JsonPaintTarget implements PaintTarget {
         }
 
         public String getData() {
-            StringBuffer buf = new StringBuffer();
-            Iterator it = children.iterator();
+            final StringBuffer buf = new StringBuffer();
+            final Iterator it = children.iterator();
             while (it.hasNext()) {
                 buf.append(startField());
                 buf.append(it.next());
@@ -955,11 +932,11 @@ public class JsonPaintTarget implements PaintTarget {
         }
 
         private String attributesAsJsonObject() {
-            StringBuffer buf = new StringBuffer();
+            final StringBuffer buf = new StringBuffer();
             buf.append(startField());
             buf.append("{");
-            for (Iterator iter = attr.iterator(); iter.hasNext();) {
-                String element = (String) iter.next();
+            for (final Iterator iter = attr.iterator(); iter.hasNext();) {
+                final String element = (String) iter.next();
                 buf.append(element);
                 if (iter.hasNext()) {
                     buf.append(",");
@@ -978,12 +955,12 @@ public class JsonPaintTarget implements PaintTarget {
             if (variables.size() == 0) {
                 return "";
             }
-            StringBuffer buf = new StringBuffer();
+            final StringBuffer buf = new StringBuffer();
             buf.append(startField());
             buf.append("\"v\":{");
-            Iterator iter = variables.iterator();
+            final Iterator iter = variables.iterator();
             while (iter.hasNext()) {
-                Variable element = (Variable) iter.next();
+                final Variable element = (Variable) iter.next();
                 buf.append(element.getJsonPresentation());
                 if (iter.hasNext()) {
                     buf.append(",");
index 73a43e0858d058e6750c343c927a383397f4d932..fe9230390186bb103b39c006824ce4ffd51e28a7 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.terminal.gwt.server;
 
@@ -61,13 +37,13 @@ public class WebApplicationContext implements ApplicationContext,
 
     private List listeners;
 
-    private HttpSession session;
+    private final HttpSession session;
 
-    private WeakHashMap formActions = new WeakHashMap();
+    private final WeakHashMap formActions = new WeakHashMap();
 
-    private HashSet applications = new HashSet();
+    private final HashSet applications = new HashSet();
 
-    private WebBrowser browser = new WebBrowser();
+    private final WebBrowser browser = new WebBrowser();
 
     /**
      * Creates a new Web Application Context.
@@ -93,7 +69,7 @@ public class WebApplicationContext implements ApplicationContext,
      * @return the Action to be set into Form action attribute.
      */
     public String getWindowFormAction(Window window) {
-        String action = (String) formActions.get(window);
+        final String action = (String) formActions.get(window);
         return action == null ? "" : action;
     }
 
@@ -125,7 +101,7 @@ public class WebApplicationContext implements ApplicationContext,
      * @see com.itmill.toolkit.service.ApplicationContext#getBaseDirectory()
      */
     public File getBaseDirectory() {
-        String realPath = ApplicationServlet.getResourcePath(session
+        final String realPath = ApplicationServlet.getResourcePath(session
                 .getServletContext(), "/");
         if (realPath == null) {
             return null;
@@ -228,7 +204,7 @@ public class WebApplicationContext implements ApplicationContext,
         if (listeners == null) {
             return;
         }
-        for (Iterator i = listeners.iterator(); i.hasNext();) {
+        for (final Iterator i = listeners.iterator(); i.hasNext();) {
             ((ApplicationContext.TransactionListener) i.next())
                     .transactionStart(application, request);
         }
@@ -248,11 +224,11 @@ public class WebApplicationContext implements ApplicationContext,
         }
 
         LinkedList exceptions = null;
-        for (Iterator i = listeners.iterator(); i.hasNext();) {
+        for (final Iterator i = listeners.iterator(); i.hasNext();) {
             try {
                 ((ApplicationContext.TransactionListener) i.next())
                         .transactionEnd(application, request);
-            } catch (RuntimeException t) {
+            } catch (final RuntimeException t) {
                 if (exceptions == null) {
                     exceptions = new LinkedList();
                 }
@@ -262,14 +238,14 @@ public class WebApplicationContext implements ApplicationContext,
 
         // If any runtime exceptions occurred, throw a combined exception
         if (exceptions != null) {
-            StringBuffer msg = new StringBuffer();
-            for (Iterator i = listeners.iterator(); i.hasNext();) {
-                RuntimeException e = (RuntimeException) i.next();
+            final StringBuffer msg = new StringBuffer();
+            for (final Iterator i = listeners.iterator(); i.hasNext();) {
+                final RuntimeException e = (RuntimeException) i.next();
                 if (msg.length() == 0) {
                     msg.append("\n\n--------------------------\n\n");
                 }
                 msg.append(e.getMessage() + "\n");
-                StringWriter trace = new StringWriter();
+                final StringWriter trace = new StringWriter();
                 e.printStackTrace(new PrintWriter(trace, true));
                 msg.append(trace.toString());
             }
@@ -300,7 +276,8 @@ public class WebApplicationContext implements ApplicationContext,
         // closing
 
         while (!applications.isEmpty()) {
-            Application app = (Application) applications.iterator().next();
+            final Application app = (Application) applications.iterator()
+                    .next();
             app.close();
             removeApplication(app);
         }
index a5c94cbd29c14f0f072e8d0c242255a11fe14f48..027a8361deb51d68cd441972f0ec09a3b7f46ad8 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.gwt.server;
 
 import java.util.Locale;
@@ -54,18 +58,18 @@ public class WebBrowser implements Terminal {
         address = request.getRemoteAddr();
         secureConnection = request.isSecure();
 
-        String agent = request.getHeader("user-agent");
+        final String agent = request.getHeader("user-agent");
         if (agent != null) {
             browserApplication = agent;
         }
 
-        String sw = request.getParameter("screenWidth");
-        String sh = request.getParameter("screenHeight");
+        final String sw = request.getParameter("screenWidth");
+        final String sh = request.getParameter("screenHeight");
         if (sw != null && sh != null) {
             try {
                 screenHeight = Integer.parseInt(sh);
                 screenWidth = Integer.parseInt(sw);
-            } catch (NumberFormatException e) {
+            } catch (final NumberFormatException e) {
                 screenHeight = screenWidth = 0;
             }
         }
index ff9dcefe5c8221596ffdfb9fabc764df0df159fd..9a7f93c3780af7fbd756e87485c2dc993e38cbdf 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.terminal.web;
 
 import javax.servlet.ServletConfig;
index 6e248f1177b5849080d8f649c6e61035119a6fa4..fe3811657e2220b9e6649b6dd8ec2ae92570f96b 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import java.util.ArrayList;
@@ -57,17 +61,17 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
 
     private static int COMPONENT_MAX_GROUPED_NUMBER = 5;
 
-    private OrderedLayout mainLayout = new OrderedLayout();
+    private final OrderedLayout mainLayout = new OrderedLayout();
 
     private Layout testingLayout;
 
-    private TextField randomSeedValue = new TextField("Seed for random");
+    private final TextField randomSeedValue = new TextField("Seed for random");
 
-    private Button seedShuffle = new Button("Shuffle with seed", this,
+    private final Button seedShuffle = new Button("Shuffle with seed", this,
             "seedShuffle");
 
-    private Button randomShuffle = new Button("Seed randomly and shuffle",
-            this, "randomShuffle");
+    private final Button randomShuffle = new Button(
+            "Seed randomly and shuffle", this, "randomShuffle");
 
     private Label display = null;
 
@@ -83,7 +87,7 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
 
     private long eventCounter = 0;
 
-    private Label statusLabel = new Label();
+    private final Label statusLabel = new Label();
 
     // Store button object => real value map
     // needed because button captions are randomized
@@ -91,7 +95,7 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
 
     public void init() {
         // addWindow(new Window("ATFTest", create()));
-        Window mainWindow = new Window("Testing", create());
+        final Window mainWindow = new Window("Testing", create());
         setMainWindow(mainWindow);
 
         setUser(new Long(System.currentTimeMillis()).toString());
@@ -120,9 +124,9 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
                         + "through X buttons and ensure that Result label "
                         + "contains correct value.", Label.CONTENT_XHTML));
 
-        OrderedLayout setupLayout = new OrderedLayout(
+        final OrderedLayout setupLayout = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
-        Panel statusPanel = new Panel("Status");
+        final Panel statusPanel = new Panel("Status");
         statusPanel.setWidth(200);
         setupLayout.addComponent(statusPanel);
         statusPanel.addComponent(statusLabel);
@@ -155,7 +159,7 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
             // randomize using user given value
             rand = new Random(Long.parseLong((String) randomSeedValue
                     .getValue()));
-        } catch (Exception e) {
+        } catch (final Exception e) {
             randomize();
         }
         testingLayout = new GridLayout(5, 5);
@@ -176,7 +180,7 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
     }
 
     private void randomize() {
-        long newSeed = System.currentTimeMillis();
+        final long newSeed = System.currentTimeMillis();
         rand = new Random(newSeed);
         randomSeedValue.setValue(String.valueOf(newSeed));
     }
@@ -189,7 +193,7 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
         components = new ArrayList();
 
         // create label
-        Label userLabel = new Label("user");
+        final Label userLabel = new Label("user");
         userLabel.setValue(getUser());
         // userLabel.setUIID("Label_user");
         components.add(userLabel);
@@ -201,16 +205,16 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
         components.add(display);
 
         // create calculator buttonsStatus:
-        String[][] calcValues = {
+        final String[][] calcValues = {
                 { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "-",
                         "*", "/", "=", "C" },
                 { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "plus",
                         "minus", "multiple", "divisor", "equals", "clear" } };
-        String[] randomizedCaptions = { "a", "b", "c", "y", "8", "3" };
+        final String[] randomizedCaptions = { "a", "b", "c", "y", "8", "3" };
         // String[] randomizedCaptions = { "X" };
         buttonValues = new HashMap();
         for (int i = 0; i > calcValues[0].length; i++) {
-            Button button = new Button("", this);
+            final Button button = new Button("", this);
             // Test requirement: ATF must not rely on caption
             // button.setCaption(randomizedCaptions[rand
             // .nextInt(randomizedCaptions.length)]);
@@ -238,8 +242,8 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
     private Component getComponent() {
         if (components.size() > 0) {
             // components found, return any
-            int i = rand.nextInt(components.size());
-            Component c = (Component) components.get(i);
+            final int i = rand.nextInt(components.size());
+            final Component c = (Component) components.get(i);
             components.remove(i);
             return c;
         } else {
@@ -251,23 +255,23 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
     private void addComponents(Layout layout) {
         while (components.size() > 0) {
             // Get random container
-            ComponentContainer container = getRandomComponentContainer(""
+            final ComponentContainer container = getRandomComponentContainer(""
                     + captionCounter++);
             layout.addComponent(container);
             // Get random amount of components for above container
-            int groupsize = rand.nextInt(COMPONENT_MAX_GROUPED_NUMBER) + 1;
+            final int groupsize = rand.nextInt(COMPONENT_MAX_GROUPED_NUMBER) + 1;
             for (int j = 0; j < groupsize; j++) {
-                Component c = getComponent();
+                final Component c = getComponent();
                 if (c != null) {
                     if (container instanceof TabSheet) {
-                        ComponentContainer tab = (ComponentContainer) ((TabSheet) container)
+                        final ComponentContainer tab = (ComponentContainer) ((TabSheet) container)
                                 .getSelectedTab();
                         tab.addComponent(c);
                     } else if (container instanceof GridLayout) {
-                        GridLayout gl = (GridLayout) container;
+                        final GridLayout gl = (GridLayout) container;
                         if (j == 0) {
-                            int x = rand.nextInt(gl.getWidth());
-                            int y = rand.nextInt(gl.getHeight());
+                            final int x = rand.nextInt(gl.getWidth());
+                            final int y = rand.nextInt(gl.getHeight());
                             gl.removeComponent(x, y);
                             gl.addComponent(c, x, y);
                         } else {
@@ -282,7 +286,7 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
     }
 
     public void buttonClick(Button.ClickEvent event) {
-        String value = (String) buttonValues.get(event.getButton());
+        final String value = (String) buttonValues.get(event.getButton());
         eventCounter++;
         try {
             // Number button pressed
@@ -292,7 +296,7 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
                     + ", value " + Double.toString(current));
             System.out.println("#" + eventCounter + ": button " + value
                     + ", value " + Double.toString(current));
-        } catch (java.lang.NumberFormatException e) {
+        } catch (final java.lang.NumberFormatException e) {
             // Operation button pressed
             if (operation.equals("+")) {
                 stored += current;
@@ -330,7 +334,7 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
      */
     private ComponentContainer getRandomComponentContainer(String caption) {
         ComponentContainer result = null;
-        int randint = rand.nextInt(5);
+        final int randint = rand.nextInt(5);
         switch (randint) {
         case 0:
             result = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
@@ -364,11 +368,11 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
             ((Panel) result).setCaption("Panel_" + caption);
             break;
         case 4:
-            TabSheet ts = new TabSheet();
+            final TabSheet ts = new TabSheet();
             ts.setCaption("TabSheet_" + caption);
             // randomly select one of the tabs
-            int selectedTab = rand.nextInt(3);
-            ArrayList tabs = new ArrayList();
+            final int selectedTab = rand.nextInt(3);
+            final ArrayList tabs = new ArrayList();
             for (int i = 0; i < 3; i++) {
                 String tabCaption = "tab" + i;
                 if (selectedTab == i) {
@@ -394,7 +398,7 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
      */
     private AbstractComponent getRandomComponent(String caption) {
         AbstractComponent result = null;
-        int randint = rand.nextInt(7); // calendar disabled
+        final int randint = rand.nextInt(7); // calendar disabled
         switch (randint) {
         case 0:
             // Label
@@ -446,8 +450,8 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
     }
 
     private AbstractComponent getExamplePicture(String caption) {
-        ClassResource cr = new ClassResource("icon_demo.png", this);
-        Embedded em = new Embedded("Embedded " + caption, cr);
+        final ClassResource cr = new ClassResource("icon_demo.png", this);
+        final Embedded em = new Embedded("Embedded " + caption, cr);
         return em;
     }
 
@@ -466,7 +470,7 @@ public class BasicRandomTest extends com.itmill.toolkit.Application implements
      */
     public void terminalError(
             com.itmill.toolkit.terminal.Terminal.ErrorEvent event) {
-        Throwable e = event.getThrowable();
+        final Throwable e = event.getThrowable();
         System.err.println(getUser().toString() + " terminalError: "
                 + e.toString());
         e.printStackTrace();
index c866243c28288e130520d340be4c1acfab0f940a..5fecaece1ba039ce3433cbc16df6c7f241861c72 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import java.util.Date;
@@ -10,13 +14,13 @@ import com.itmill.toolkit.ui.Table;
 
 public class PerformanceTestSubTreeCaching extends CustomComponent {
 
-    private OrderedLayout main;
+    private final OrderedLayout main;
 
-    private OrderedLayout testContainer;
+    private final OrderedLayout testContainer;
 
     private Date startTime;
 
-    private Label result;
+    private final Label result;
 
     private static final String DESCRIPTION = "Hyphothesis: Toolkit 4 has major architechtural problem when adding "
             + "small incrementall updates to a container which has either a lot or "
@@ -55,8 +59,8 @@ public class PerformanceTestSubTreeCaching extends CustomComponent {
     }
 
     public void endTest() {
-        long millis = (new Date()).getTime() - startTime.getTime();
-        Float f = new Float(millis / 1000.0);
+        final long millis = (new Date()).getTime() - startTime.getTime();
+        final Float f = new Float(millis / 1000.0);
         result.setValue("Test completed in " + f + " seconds");
     }
 
@@ -68,7 +72,7 @@ public class PerformanceTestSubTreeCaching extends CustomComponent {
     private void populateContainer(OrderedLayout container, int n) {
         for (int i = 0; i < n; i++) {
             // array_type array_element = [i];
-            Table t = TestForTablesInitialColumnWidthLogicRendering
+            final Table t = TestForTablesInitialColumnWidthLogicRendering
                     .getTestTable(5, 100);
             container.addComponent(t);
         }
index 5267f658e665fb627f2662e0b4c1c3cdcf412e24..02a04f9860d4e38b9b018632e1e663139edf2cfb 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import java.util.Random;
@@ -27,7 +31,7 @@ import com.itmill.toolkit.ui.Window;
  */
 public class RandomLayoutStress extends com.itmill.toolkit.Application {
 
-    private Random seededRandom = new Random(1);
+    private final Random seededRandom = new Random(1);
 
     // FIXME increasing these settings brings out interesting client-side issues
     // (DOM errors)
@@ -42,11 +46,12 @@ public class RandomLayoutStress extends com.itmill.toolkit.Application {
      * Initialize Application. Demo components are added to main window.
      */
     public void init() {
-        Window mainWindow = new Window("Layout demo");
+        final Window mainWindow = new Window("Layout demo");
         setMainWindow(mainWindow);
 
         // Create horizontal ordered layout
-        Panel panelA = new Panel("Panel containing horizontal ordered layout");
+        final Panel panelA = new Panel(
+                "Panel containing horizontal ordered layout");
         OrderedLayout layoutA = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
         // Add 4 random components
@@ -55,7 +60,8 @@ public class RandomLayoutStress extends com.itmill.toolkit.Application {
         panelA.addComponent(layoutA);
 
         // Create vertical ordered layout
-        Panel panelB = new Panel("Panel containing vertical ordered layout");
+        final Panel panelB = new Panel(
+                "Panel containing vertical ordered layout");
         OrderedLayout layoutB = new OrderedLayout(
                 OrderedLayout.ORIENTATION_VERTICAL);
         // Add 4 random components
@@ -64,9 +70,9 @@ public class RandomLayoutStress extends com.itmill.toolkit.Application {
         panelB.addComponent(layoutB);
 
         // Create grid layout
-        int gridSize = (int) java.lang.Math.sqrt(componentCountC);
-        Panel panelG = new Panel("Panel containing grid layout (" + gridSize
-                + " x " + gridSize + ")");
+        final int gridSize = (int) java.lang.Math.sqrt(componentCountC);
+        final Panel panelG = new Panel("Panel containing grid layout ("
+                + gridSize + " x " + gridSize + ")");
         GridLayout layoutG = new GridLayout(gridSize, gridSize);
         // Add 12 random components
         fillLayout(layoutG, componentCountC);
@@ -74,7 +80,7 @@ public class RandomLayoutStress extends com.itmill.toolkit.Application {
         panelG.addComponent(layoutG);
 
         // Create TabSheet
-        TabSheet tabsheet = new TabSheet();
+        final TabSheet tabsheet = new TabSheet();
         tabsheet
                 .setCaption("Tabsheet, above layouts are added to this component");
         layoutA = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
@@ -91,8 +97,8 @@ public class RandomLayoutStress extends com.itmill.toolkit.Application {
         tabsheet.addTab(layoutG, "Grid layout (4 x 2)", null);
 
         // Create custom layout
-        Panel panelC = new Panel("Custom layout with style exampleStyle");
-        CustomLayout layoutC = new CustomLayout("exampleStyle");
+        final Panel panelC = new Panel("Custom layout with style exampleStyle");
+        final CustomLayout layoutC = new CustomLayout("exampleStyle");
         // Add 4 random components
         fillLayout(layoutC, componentCountD);
         // Add layout to panel
@@ -108,7 +114,7 @@ public class RandomLayoutStress extends com.itmill.toolkit.Application {
 
     private AbstractComponent getRandomComponent(int caption) {
         AbstractComponent result = null;
-        int randint = seededRandom.nextInt(7);
+        final int randint = seededRandom.nextInt(7);
         switch (randint) {
         case 0:
             // Label
index eb53f5cbf148ab0c32a74d4c7d57ec6fbf1cd914..4307eb6b7f1ba93167c21c890ea184ead45b6f07 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.tests;\r
 \r
 import com.itmill.toolkit.data.Property.ValueChangeEvent;\r
@@ -10,7 +14,7 @@ public class TableSelectTest extends CustomComponent implements
         Table.ValueChangeListener {\r
 \r
     public TableSelectTest() {\r
-        OrderedLayout main = new OrderedLayout();\r
+        final OrderedLayout main = new OrderedLayout();\r
         setCompositionRoot(main);\r
         main.addComponent(new Label("Hello World!"));\r
 \r
@@ -68,7 +72,7 @@ public class TableSelectTest extends CustomComponent implements
         try {\r
             t.setMultiSelect(true);\r
             t.setCaption("multi(SHOLD FAIL BUT DID NOT) nullsel nullselid");\r
-        } catch (Exception e) {\r
+        } catch (final Exception e) {\r
             System.err.println("failed ok");\r
         }\r
         t.setNullSelectionAllowed(true);\r
@@ -81,7 +85,7 @@ public class TableSelectTest extends CustomComponent implements
         try {\r
             t.setMultiSelect(true);\r
             t.setCaption("multi(SHOLD FAIL BUT DID NOT) NO-nullsel nullselid");\r
-        } catch (Exception e) {\r
+        } catch (final Exception e) {\r
             System.err.println("failed ok");\r
         }\r
         t.setNullSelectionAllowed(false);\r
@@ -110,7 +114,7 @@ public class TableSelectTest extends CustomComponent implements
     }\r
 \r
     public void valueChange(ValueChangeEvent event) {\r
-        Object val = event.getProperty().getValue();\r
+        final Object val = event.getProperty().getValue();\r
 \r
         System.err.println("Value: " + val);\r
 \r
index d94548becf25b6b219edb0cd44516885305d99ed..48787515dc096ca78d1933c59416c202c003ad3d 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import java.io.File;
@@ -59,9 +63,10 @@ public class TestBench extends com.itmill.toolkit.Application implements
         for (int p = 0; p < testablePackages.length; p++) {
             testables.addItem(testablePackages[p]);
             try {
-                List testableClasses = getTestableClassesForPackage(testablePackages[p]);
-                for (Iterator it = testableClasses.iterator(); it.hasNext();) {
-                    Class t = (Class) it.next();
+                final List testableClasses = getTestableClassesForPackage(testablePackages[p]);
+                for (final Iterator it = testableClasses.iterator(); it
+                        .hasNext();) {
+                    final Class t = (Class) it.next();
                     // ignore TestBench itself
                     if (t.equals(TestBench.class)) {
                         continue;
@@ -71,33 +76,33 @@ public class TestBench extends com.itmill.toolkit.Application implements
                         itemCaptions.put(t, t.getName());
                         testables.setParent(t, testablePackages[p]);
                         continue;
-                    } catch (Exception e) {
+                    } catch (final Exception e) {
                         try {
                             testables.addItem(t);
                             itemCaptions.put(t, t.getName());
                             testables.setParent(t, testablePackages[p]);
                             continue;
-                        } catch (Exception e1) {
+                        } catch (final Exception e1) {
                             e1.printStackTrace();
                         }
                     }
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 e.printStackTrace();
             }
         }
 
         menu = new Tree("Testables", testables);
 
-        for (Iterator i = itemCaptions.keySet().iterator(); i.hasNext();) {
-            Class testable = (Class) i.next();
+        for (final Iterator i = itemCaptions.keySet().iterator(); i.hasNext();) {
+            final Class testable = (Class) i.next();
             // simplify captions
-            String name = testable.getName().substring(
+            final String name = testable.getName().substring(
                     testable.getName().lastIndexOf('.') + 1);
             menu.setItemCaption(testable, name);
         }
         // expand all root items
-        for (Iterator i = menu.rootItemIds().iterator(); i.hasNext();) {
+        for (final Iterator i = menu.rootItemIds().iterator(); i.hasNext();) {
             menu.expandItemsRecursively(i.next());
         }
 
@@ -122,14 +127,14 @@ public class TestBench extends com.itmill.toolkit.Application implements
 
     private Component createTestable(Class c) {
         try {
-            Application app = (Application) c.newInstance();
+            final Application app = (Application) c.newInstance();
             app.init();
             return app.getMainWindow().getLayout();
-        } catch (Exception e) {
+        } catch (final Exception e) {
             try {
-                CustomComponent cc = (CustomComponent) c.newInstance();
+                final CustomComponent cc = (CustomComponent) c.newInstance();
                 return cc;
-            } catch (Exception e1) {
+            } catch (final Exception e1) {
                 e1.printStackTrace();
                 return new Label(
                         "Cannot create application / custom component: "
@@ -143,10 +148,10 @@ public class TestBench extends com.itmill.toolkit.Application implements
         bodyLayout.removeAllComponents();
         bodyLayout.setCaption(null);
 
-        Object o = menu.getValue();
+        final Object o = menu.getValue();
         if (o != null && o instanceof Class) {
-            Class c = (Class) o;
-            String title = c.getName();
+            final Class c = (Class) o;
+            final String title = c.getName();
             bodyLayout.setCaption(title);
             bodyLayout.addComponent(createTestable(c));
         } else {
@@ -164,38 +169,39 @@ public class TestBench extends com.itmill.toolkit.Application implements
      */
     public static List getTestableClassesForPackage(String packageName)
             throws Exception {
-        ArrayList directories = new ArrayList();
+        final ArrayList directories = new ArrayList();
         try {
-            ClassLoader cld = Thread.currentThread().getContextClassLoader();
+            final ClassLoader cld = Thread.currentThread()
+                    .getContextClassLoader();
             if (cld == null) {
                 throw new ClassNotFoundException("Can't get class loader.");
             }
-            String path = packageName.replace('.', '/');
+            final String path = packageName.replace('.', '/');
             // Ask for all resources for the path
-            Enumeration resources = cld.getResources(path);
+            final Enumeration resources = cld.getResources(path);
             while (resources.hasMoreElements()) {
-                URL url = (URL) resources.nextElement();
+                final URL url = (URL) resources.nextElement();
                 directories.add(new File(url.getFile()));
             }
-        } catch (Exception x) {
+        } catch (final Exception x) {
             throw new Exception(packageName
                     + " does not appear to be a valid package.");
         }
 
-        ArrayList classes = new ArrayList();
+        final ArrayList classes = new ArrayList();
         // For every directory identified capture all the .class files
-        for (Iterator it = directories.iterator(); it.hasNext();) {
-            File directory = (File) it.next();
+        for (final Iterator it = directories.iterator(); it.hasNext();) {
+            final File directory = (File) it.next();
             if (directory.exists()) {
                 // Get the list of the files contained in the package
-                String[] files = directory.list();
+                final String[] files = directory.list();
                 for (int j = 0; j < files.length; j++) {
                     // we are only interested in .class files
                     if (files[j].endsWith(".class")) {
                         // removes the .class extension
-                        String p = packageName + '.'
+                        final String p = packageName + '.'
                                 + files[j].substring(0, files[j].length() - 6);
-                        Class c = Class.forName(p);
+                        final Class c = Class.forName(p);
                         if (c.getSuperclass() != null) {
                             if ((c.getSuperclass()
                                     .equals(com.itmill.toolkit.Application.class))) {
index 567d9eb877edf016e86216aa1d72e4b129e7c3e4..ae8c886c59f3e4712b8625b61d624bc2e840c11e 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import com.itmill.toolkit.terminal.ClassResource;
@@ -65,15 +69,15 @@ public class TestCaptionWrapper extends CustomComponent implements Listener {
         test(main);
         populateLayout(main);
 
-        Panel panel = new Panel("Panel");
+        final Panel panel = new Panel("Panel");
         test(panel);
         populateLayout(panel.getLayout());
 
-        TabSheet tabsheet = new TabSheet();
+        final TabSheet tabsheet = new TabSheet();
         test(tabsheet);
-        OrderedLayout tab1 = new OrderedLayout();
+        final OrderedLayout tab1 = new OrderedLayout();
         tab1.addComponent(new Label("try tab2"));
-        OrderedLayout tab2 = new OrderedLayout();
+        final OrderedLayout tab2 = new OrderedLayout();
         test(tab2);
         populateLayout(tab2);
         tabsheet.addTab(tab1, "TabSheet tab1", new ClassResource("m.gif",
@@ -81,15 +85,15 @@ public class TestCaptionWrapper extends CustomComponent implements Listener {
         tabsheet.addTab(tab2, "TabSheet tab2", new ClassResource("m.gif",
                 getApplication()));
 
-        ExpandLayout expandLayout = new ExpandLayout();
+        final ExpandLayout expandLayout = new ExpandLayout();
         test(expandLayout);
         populateLayout(expandLayout);
 
-        GridLayout gridLayout = new GridLayout();
+        final GridLayout gridLayout = new GridLayout();
         test(gridLayout);
         populateLayout(gridLayout);
 
-        Window window = new Window("TEST: Window");
+        final Window window = new Window("TEST: Window");
         test(window);
         populateLayout(window.getLayout());
 
@@ -97,67 +101,69 @@ public class TestCaptionWrapper extends CustomComponent implements Listener {
 
     void populateLayout(Layout layout) {
 
-        Button button = new Button("Button " + count++);
+        final Button button = new Button("Button " + count++);
         test(layout, button);
         button.addListener(this);
 
-        DateField df = new DateField("DateField " + count++);
+        final DateField df = new DateField("DateField " + count++);
         test(layout, df);
 
-        CheckBox cb = new CheckBox("Checkbox " + count++);
+        final CheckBox cb = new CheckBox("Checkbox " + count++);
         test(layout, cb);
 
-        Embedded emb = new Embedded("Embedded " + count++);
+        final Embedded emb = new Embedded("Embedded " + count++);
         test(layout, emb);
 
-        Panel panel = new Panel("Panel " + count++);
+        final Panel panel = new Panel("Panel " + count++);
         test(layout, panel);
 
-        Label label = new Label("Label " + count++);
+        final Label label = new Label("Label " + count++);
         test(layout, label);
 
-        Link link = new Link("Link " + count++, new ExternalResource(
+        final Link link = new Link("Link " + count++, new ExternalResource(
                 "www.itmill.com"));
         test(layout, link);
 
-        NativeSelect nativeSelect = new NativeSelect("NativeSelect " + count++);
+        final NativeSelect nativeSelect = new NativeSelect("NativeSelect "
+                + count++);
         test(layout, nativeSelect);
 
-        OptionGroup optionGroup = new OptionGroup("OptionGroup " + count++);
+        final OptionGroup optionGroup = new OptionGroup("OptionGroup "
+                + count++);
         test(layout, optionGroup);
 
-        ProgressIndicator pi = new ProgressIndicator();
+        final ProgressIndicator pi = new ProgressIndicator();
         test(layout, pi);
 
-        RichTextArea rta = new RichTextArea();
+        final RichTextArea rta = new RichTextArea();
         test(layout, rta);
 
-        Select select = new Select("Select " + count++);
+        final Select select = new Select("Select " + count++);
         test(layout, select);
 
-        Slider slider = new Slider("Slider " + count++);
+        final Slider slider = new Slider("Slider " + count++);
         test(layout, slider);
 
-        Table table = new Table("Table " + count++);
+        final Table table = new Table("Table " + count++);
         test(layout, table);
 
-        TextField tf = new TextField("Textfield " + count++);
+        final TextField tf = new TextField("Textfield " + count++);
         test(layout, tf);
 
-        Tree tree = new Tree("Tree " + count++);
+        final Tree tree = new Tree("Tree " + count++);
         test(layout, tree);
 
-        TwinColSelect twinColSelect = new TwinColSelect("TwinColSelect "
+        final TwinColSelect twinColSelect = new TwinColSelect("TwinColSelect "
                 + count++);
         test(layout, twinColSelect);
 
-        Upload upload = new Upload("Upload (non-functional)", null);
+        final Upload upload = new Upload("Upload (non-functional)", null);
         test(layout, upload);
 
         // Custom components
         layout.addComponent(new Label("<B>Below are few custom components</B>",
                 Label.CONTENT_XHTML));
-        TestForUpload tfu = new TestForUpload();
+        final TestForUpload tfu = new TestForUpload();
         layout.addComponent(tfu);
 
     }
@@ -168,8 +174,8 @@ public class TestCaptionWrapper extends CustomComponent implements Listener {
      * @param c
      */
     void test(AbstractComponent c) {
-        ClassResource res = new ClassResource("m.gif", getApplication());
-        ErrorMessage errorMsg = new UserError("User error " + c);
+        final ClassResource res = new ClassResource("m.gif", getApplication());
+        final ErrorMessage errorMsg = new UserError("User error " + c);
 
         if ((c.getCaption() == null) || (c.getCaption().length() <= 0)) {
             c.setCaption("Caption " + c);
@@ -190,8 +196,8 @@ public class TestCaptionWrapper extends CustomComponent implements Listener {
     }
 
     public void componentEvent(Event event) {
-        String feedback = eventListenerString + " source=" + event.getSource()
-                + ", toString()=" + event.toString();
+        final String feedback = eventListenerString + " source="
+                + event.getSource() + ", toString()=" + event.toString();
         System.out.println("eventListenerFeedback: " + feedback);
         eventListenerFeedback.setValue(feedback);
     }
index f0509be390a461c5eeb7e870c6527fa07432b5f0..8183216757b5fbe8a2d1e3c18a4ab869487f850f 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import java.io.File;
@@ -78,7 +82,7 @@ public class TestComponentsAndLayouts extends Application implements Listener,
     }
 
     public void createNewView() {
-        Window main = new Window("Main window");
+        final Window main = new Window("Main window");
         setMainWindow(main);
 
         // By default push all containers inside main window
@@ -112,7 +116,7 @@ public class TestComponentsAndLayouts extends Application implements Listener,
                     .addComponent(new Label(
                             "<hr /><h1>Components inside horizontal OrderedLayout</h3>",
                             Label.CONTENT_XHTML));
-            OrderedLayout ol = new OrderedLayout(
+            final OrderedLayout ol = new OrderedLayout(
                     OrderedLayout.ORIENTATION_HORIZONTAL);
             populateLayout(ol);
             target.addComponent(ol);
@@ -124,7 +128,7 @@ public class TestComponentsAndLayouts extends Application implements Listener,
                     .addComponent(new Label(
                             "<br/><br/><br/><hr /><h1>Components inside vertical OrderedLayout</h3>",
                             Label.CONTENT_XHTML));
-            OrderedLayout ol2 = new OrderedLayout(
+            final OrderedLayout ol2 = new OrderedLayout(
                     OrderedLayout.ORIENTATION_VERTICAL);
             populateLayout(ol2);
             target.addComponent(ol2);
@@ -136,7 +140,7 @@ public class TestComponentsAndLayouts extends Application implements Listener,
                     .addComponent(new Label(
                             "<hr /><h1>Components inside ExpandLayout (height 250px)</h3>",
                             Label.CONTENT_XHTML));
-            ExpandLayout el = new ExpandLayout();
+            final ExpandLayout el = new ExpandLayout();
             el.setHeight(250);
             el.setHeightUnits(Sizeable.UNITS_PIXELS);
             populateLayout(el);
@@ -148,7 +152,7 @@ public class TestComponentsAndLayouts extends Application implements Listener,
             target.addComponent(new Label(
                     "<hr /><h1>Components inside Panel</h3>",
                     Label.CONTENT_XHTML));
-            Panel panel = new Panel("Panel");
+            final Panel panel = new Panel("Panel");
             populateLayout(panel.getLayout());
             target.addComponent(panel);
         }
@@ -159,13 +163,14 @@ public class TestComponentsAndLayouts extends Application implements Listener,
                     .addComponent(new Label(
                             "<hr /><h1>Components inside vertical SplitPanel (splitpanel is under 250height ExpandLayout)</h3>",
                             Label.CONTENT_XHTML));
-            ExpandLayout sp1l = new ExpandLayout();
+            final ExpandLayout sp1l = new ExpandLayout();
             sp1l.setHeight(250);
             sp1l.setHeightUnits(Sizeable.UNITS_PIXELS);
-            SplitPanel sp1 = new SplitPanel(SplitPanel.ORIENTATION_VERTICAL);
+            final SplitPanel sp1 = new SplitPanel(
+                    SplitPanel.ORIENTATION_VERTICAL);
             sp1l.addComponent(sp1);
-            OrderedLayout sp1first = new OrderedLayout();
-            OrderedLayout sp1second = new OrderedLayout();
+            final OrderedLayout sp1first = new OrderedLayout();
+            final OrderedLayout sp1second = new OrderedLayout();
             sp1.setFirstComponent(sp1first);
             populateLayout(sp1first);
             populateLayout(sp1second);
@@ -179,13 +184,14 @@ public class TestComponentsAndLayouts extends Application implements Listener,
                     .addComponent(new Label(
                             "<hr /><h1>Components inside horizontal SplitPanel (splitpanel is under 250px height ExpandLayout)</h3>",
                             Label.CONTENT_XHTML));
-            ExpandLayout sp2l = new ExpandLayout();
+            final ExpandLayout sp2l = new ExpandLayout();
             sp2l.setHeight(250);
             sp2l.setHeightUnits(Sizeable.UNITS_PIXELS);
-            SplitPanel sp2 = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
+            final SplitPanel sp2 = new SplitPanel(
+                    SplitPanel.ORIENTATION_HORIZONTAL);
             sp2l.addComponent(sp2);
-            OrderedLayout sp2first = new OrderedLayout();
-            OrderedLayout sp2second = new OrderedLayout();
+            final OrderedLayout sp2first = new OrderedLayout();
+            final OrderedLayout sp2second = new OrderedLayout();
             sp2.setFirstComponent(sp2first);
             populateLayout(sp2first);
             populateLayout(sp2second);
@@ -198,10 +204,10 @@ public class TestComponentsAndLayouts extends Application implements Listener,
             target.addComponent(new Label(
                     "<hr /><h1>Components inside TabSheet</h3>",
                     Label.CONTENT_XHTML));
-            TabSheet tabsheet = new TabSheet();
-            OrderedLayout tab1 = new OrderedLayout();
+            final TabSheet tabsheet = new TabSheet();
+            final OrderedLayout tab1 = new OrderedLayout();
             tab1.addComponent(new Label("try tab2"));
-            OrderedLayout tab2 = new OrderedLayout();
+            final OrderedLayout tab2 = new OrderedLayout();
             populateLayout(tab2);
             tabsheet.addTab(tab1, "TabSheet tab1", new ClassResource("m.gif",
                     this));
@@ -219,7 +225,7 @@ public class TestComponentsAndLayouts extends Application implements Listener,
             target.addComponent(new Label(
                     "<hr /><h1>Components inside GridLayout</h3>",
                     Label.CONTENT_XHTML));
-            GridLayout gridLayout = new GridLayout(4, 100);
+            final GridLayout gridLayout = new GridLayout(4, 100);
             populateLayout(gridLayout);
             target.addComponent(gridLayout);
             // test(gridLayout);
@@ -228,58 +234,61 @@ public class TestComponentsAndLayouts extends Application implements Listener,
     }
 
     void populateLayout(Layout layout) {
-        Button button = new Button("Button " + count++);
+        final Button button = new Button("Button " + count++);
         test(layout, button);
 
-        DateField df = new DateField("DateField " + count++);
+        final DateField df = new DateField("DateField " + count++);
         test(layout, df);
 
-        CheckBox cb = new CheckBox("Checkbox " + count++);
+        final CheckBox cb = new CheckBox("Checkbox " + count++);
         test(layout, cb);
 
-        ClassResource flashResource = new ClassResource("itmill_spin.swf", this);
-        Embedded emb = new Embedded("Embedded " + count++, flashResource);
+        final ClassResource flashResource = new ClassResource(
+                "itmill_spin.swf", this);
+        final Embedded emb = new Embedded("Embedded " + count++, flashResource);
         emb.setType(Embedded.TYPE_OBJECT);
         emb.setMimeType("application/x-shockwave-flash");
         emb.setWidth(250);
         emb.setHeight(100);
         test(layout, emb);
 
-        Panel panel = new Panel("Panel " + count++);
+        final Panel panel = new Panel("Panel " + count++);
         test(layout, panel);
 
-        Label label = new Label("Label " + count++);
+        final Label label = new Label("Label " + count++);
         test(layout, label);
 
-        Link link = new Link("Link " + count++, new ExternalResource(
+        final Link link = new Link("Link " + count++, new ExternalResource(
                 "www.itmill.com"));
         test(layout, link);
 
-        NativeSelect nativeSelect = new NativeSelect("NativeSelect " + count++);
+        final NativeSelect nativeSelect = new NativeSelect("NativeSelect "
+                + count++);
         nativeSelect.setContainerDataSource(getContainer());
         test(layout, nativeSelect);
 
-        OptionGroup optionGroup = new OptionGroup("OptionGroup " + count++);
+        final OptionGroup optionGroup = new OptionGroup("OptionGroup "
+                + count++);
         optionGroup.setContainerDataSource(getSmallContainer());
         optionGroup.setItemCaptionPropertyId("UNIT");
         test(layout, optionGroup);
 
-        ProgressIndicator pi = new ProgressIndicator();
+        final ProgressIndicator pi = new ProgressIndicator();
         pi.setCaption("ProgressIndicator");
         test(layout, pi);
 
-        RichTextArea rta = new RichTextArea();
+        final RichTextArea rta = new RichTextArea();
         test(layout, rta);
 
-        Select select = new Select("Select " + count++);
+        final Select select = new Select("Select " + count++);
         select.setContainerDataSource(getSmallContainer());
         select.setItemCaptionPropertyId("UNIT");
         test(layout, select);
 
-        Slider slider = new Slider("Slider " + count++);
+        final Slider slider = new Slider("Slider " + count++);
         test(layout, slider);
 
-        Table table = new Table("Table " + count++);
+        final Table table = new Table("Table " + count++);
         table.setPageLength(10);
         table.setSelectable(true);
         table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
@@ -293,10 +302,10 @@ public class TestComponentsAndLayouts extends Application implements Listener,
         table.setItemCaptionPropertyId("ID");
         test(layout, table);
 
-        TabSheet tabsheet = new TabSheet();
-        OrderedLayout tab1 = new OrderedLayout();
+        final TabSheet tabsheet = new TabSheet();
+        final OrderedLayout tab1 = new OrderedLayout();
         tab1.addComponent(new Label("tab1 " + count++));
-        OrderedLayout tab2 = new OrderedLayout();
+        final OrderedLayout tab2 = new OrderedLayout();
         tab2.addComponent(new Label("tab2 " + count++));
         tabsheet.addTab(tab1, "Default (not configured) TabSheet tab1",
                 new ClassResource("m.gif", this));
@@ -304,31 +313,31 @@ public class TestComponentsAndLayouts extends Application implements Listener,
                 "m.gif", this));
         test(layout, tabsheet);
 
-        TextField tf = new TextField("Textfield " + count++);
+        final TextField tf = new TextField("Textfield " + count++);
         test(layout, tf);
         // do not configure tab1
         // test(tab1);
         test(tab2);
 
-        Tree tree = new Tree("Tree " + count++);
-        File sampleDir = SampleDirectory.getDirectory(this);
-        FilesystemContainer fsc = new FilesystemContainer(sampleDir, true);
+        final Tree tree = new Tree("Tree " + count++);
+        final File sampleDir = SampleDirectory.getDirectory(this);
+        final FilesystemContainer fsc = new FilesystemContainer(sampleDir, true);
         tree.setContainerDataSource(fsc);
         test(layout, tree);
 
-        TwinColSelect twinColSelect = new TwinColSelect("TwinColSelect "
+        final TwinColSelect twinColSelect = new TwinColSelect("TwinColSelect "
                 + count++);
         twinColSelect.setContainerDataSource(getSmallContainer());
         twinColSelect.setItemCaptionPropertyId("UNIT");
         test(layout, twinColSelect);
 
-        Upload upload = new Upload("Upload (non-functional)", null);
+        final Upload upload = new Upload("Upload (non-functional)", null);
         test(layout, upload);
 
         // Custom components
         layout.addComponent(new Label("<B>Below are few custom components</B>",
                 Label.CONTENT_XHTML));
-        TestForUpload tfu = new TestForUpload();
+        final TestForUpload tfu = new TestForUpload();
         layout.addComponent(tfu);
         layout.addComponent(new Label("<br/><b>----------<br/></p>",
                 Label.CONTENT_XHTML));
@@ -347,7 +356,7 @@ public class TestComponentsAndLayouts extends Application implements Listener,
         try {
             return new QueryContainer("SELECT * FROM employee", sampleDatabase
                     .getConnection());
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             e.printStackTrace();
         }
         return null;
@@ -359,7 +368,7 @@ public class TestComponentsAndLayouts extends Application implements Listener,
             return new QueryContainer(
                     "SELECT DISTINCT UNIT AS UNIT FROM employee",
                     sampleDatabase.getConnection());
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             e.printStackTrace();
         }
         return null;
@@ -376,7 +385,7 @@ public class TestComponentsAndLayouts extends Application implements Listener,
         // try to add listener
         try {
             c.addListener(this);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             System.err.println("Could not add listener for component " + c
                     + ", count was " + count);
         }
@@ -392,8 +401,8 @@ public class TestComponentsAndLayouts extends Application implements Listener,
         setComponentProperties(c);
 
         // AbstractComponent specific configuration
-        ClassResource res = new ClassResource("m.gif", this);
-        ErrorMessage errorMsg = new UserError("User error " + c);
+        final ClassResource res = new ClassResource("m.gif", this);
+        final ErrorMessage errorMsg = new UserError("User error " + c);
         if ((c.getCaption() == null) || (c.getCaption().length() <= 0)) {
             c.setCaption("Caption " + c);
         }
@@ -434,7 +443,7 @@ public class TestComponentsAndLayouts extends Application implements Listener,
 
     public void componentEvent(Event event) {
         eventCount++;
-        String feedback = "eventCount=" + eventCount + ", class="
+        final String feedback = "eventCount=" + eventCount + ", class="
                 + event.getClass() + ", source=" + event.getSource()
                 + ", toString()=" + event.toString();
         System.out.println("eventListenerFeedback: " + feedback);
index 44daf959fe705437e6ad21cd8239b97b36edbd7a..7ebe7189237fbb5c4dd12853488bf295b9400bd4 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.tests;\r
 \r
 import java.util.Locale;\r
@@ -32,7 +36,7 @@ public class TestDateField extends CustomComponent {
         df = new DateField();\r
         main.addComponent(df);\r
 \r
-        ErrorMessage errorMsg = new UserError("User error " + df);\r
+        final ErrorMessage errorMsg = new UserError("User error " + df);\r
         df.setCaption("DateField caption " + df);\r
         df.setDescription("DateField description " + df);\r
         df.setComponentError(errorMsg);\r
@@ -42,21 +46,22 @@ public class TestDateField extends CustomComponent {
         df.addStyleName("thisShouldBeHarmless");\r
 \r
         // Another test: locale\r
-        DateField df1 = new DateField();\r
+        final DateField df1 = new DateField();\r
         main.addComponent(df1);\r
         df1.setLocale(new Locale("en", "US"));\r
 \r
-        DateField df2 = new DateField();\r
+        final DateField df2 = new DateField();\r
         main.addComponent(df2);\r
         df2.setLocale(new Locale("de", "DE"));\r
 \r
-        DateField df3 = new DateField();\r
+        final DateField df3 = new DateField();\r
         main.addComponent(df3);\r
         df3.setLocale(new Locale("ru", "RU"));\r
     }\r
 \r
     public void attach() {\r
-        ClassResource res = new ClassResource("m.gif", super.getApplication());\r
+        final ClassResource res = new ClassResource("m.gif", super\r
+                .getApplication());\r
         df.setIcon(res);\r
         super.attach();\r
     }\r
index 5140478fc428788aa51c7c928fea1c77328c889b..42cd5b874a4f1cdbe362f0429a120435f943bcb0 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import com.itmill.toolkit.ui.Button;
@@ -10,18 +14,18 @@ public class TestForAlignments extends CustomComponent {
 
     public TestForAlignments() {
 
-        OrderedLayout main = new OrderedLayout();
+        final OrderedLayout main = new OrderedLayout();
 
-        Button b1 = new Button("Right");
-        Button b2 = new Button("Left");
-        Button b3 = new Button("Bottom");
-        Button b4 = new Button("Top");
-        TextField t1 = new TextField("Right aligned");
-        TextField t2 = new TextField("Bottom aligned");
-        DateField d1 = new DateField("Center aligned");
-        DateField d2 = new DateField("Center aligned");
+        final Button b1 = new Button("Right");
+        final Button b2 = new Button("Left");
+        final Button b3 = new Button("Bottom");
+        final Button b4 = new Button("Top");
+        final TextField t1 = new TextField("Right aligned");
+        final TextField t2 = new TextField("Bottom aligned");
+        final DateField d1 = new DateField("Center aligned");
+        final DateField d2 = new DateField("Center aligned");
 
-        OrderedLayout vert = new OrderedLayout();
+        final OrderedLayout vert = new OrderedLayout();
         vert.addComponent(b1);
         vert.addComponent(b2);
         vert.addComponent(t1);
@@ -36,7 +40,7 @@ public class TestForAlignments extends CustomComponent {
         vert.setComponentAlignment(d1,
                 OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER,
                 OrderedLayout.ALIGNMENT_TOP);
-        OrderedLayout hori = new OrderedLayout(
+        final OrderedLayout hori = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
         hori.addComponent(b3);
         hori.addComponent(b4);
index f41230f463370c9b63ab7cfe9abfde931e40749b..74a1e0e9ee63e5d0ee9882ab69c02f4abfac725b 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import com.itmill.toolkit.Application;
@@ -27,15 +31,15 @@ public class TestForApplicationLayoutThatUsesWholeBrosersSpace extends
 
         firstLevelSplit = new SplitPanel();
 
-        SplitPanel secondSplitPanel = new SplitPanel(
+        final SplitPanel secondSplitPanel = new SplitPanel(
                 SplitPanel.ORIENTATION_HORIZONTAL);
         secondSplitPanel.setFirstComponent(new Label("left"));
 
-        ExpandLayout topRight = new ExpandLayout();
+        final ExpandLayout topRight = new ExpandLayout();
         topRight.addComponent(new Label("topright header"));
 
-        Table t = TestForTablesInitialColumnWidthLogicRendering.getTestTable(4,
-                100);
+        final Table t = TestForTablesInitialColumnWidthLogicRendering
+                .getTestTable(4, 100);
         t.setWidth(100);
         t.setWidthUnits(Sizeable.UNITS_PERCENTAGE);
         t.setHeight(100);
@@ -47,7 +51,7 @@ public class TestForApplicationLayoutThatUsesWholeBrosersSpace extends
 
         secondSplitPanel.setSecondComponent(topRight);
 
-        ExpandLayout el = new ExpandLayout();
+        final ExpandLayout el = new ExpandLayout();
         el.addComponent(new Label("B��"));
 
         firstLevelSplit.setFirstComponent(secondSplitPanel);
index c4c2bb76c0b2e492ad3bc2e02d26101227765b19..8b0f6b5ca2b6483a9edf549c78b6a9d77f833ec5 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.tests;\r
 \r
 import java.util.Locale;\r
@@ -18,9 +22,9 @@ import com.itmill.toolkit.ui.Button.ClickListener;
 \r
 public class TestForBasicApplicationLayout extends CustomComponent {\r
 \r
-    private Button click;\r
-    private Button click2;\r
-    private TabSheet tab;\r
+    private final Button click;\r
+    private final Button click2;\r
+    private final TabSheet tab;\r
 \r
     public TestForBasicApplicationLayout() {\r
 \r
@@ -41,26 +45,27 @@ public class TestForBasicApplicationLayout extends CustomComponent {
 \r
         });\r
 \r
-        SplitPanel sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);\r
+        final SplitPanel sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);\r
         sp.setSplitPosition(290, Sizeable.UNITS_PIXELS);\r
 \r
-        SplitPanel sp2 = new SplitPanel(SplitPanel.ORIENTATION_VERTICAL);\r
+        final SplitPanel sp2 = new SplitPanel(SplitPanel.ORIENTATION_VERTICAL);\r
         sp2.setSplitPosition(255, Sizeable.UNITS_PIXELS);\r
 \r
-        Panel p = new Panel("Accordion Panel");\r
+        final Panel p = new Panel("Accordion Panel");\r
         p.setSizeFull();\r
 \r
         tab = new TabSheet();\r
         tab.setSizeFull();\r
 \r
-        Panel report = new Panel("Monthly Program Runs", new ExpandLayout());\r
-        OrderedLayout controls = new OrderedLayout();\r
+        final Panel report = new Panel("Monthly Program Runs",\r
+                new ExpandLayout());\r
+        final OrderedLayout controls = new OrderedLayout();\r
         controls.setMargin(true);\r
         controls.addComponent(new Label("Report tab"));\r
         controls.addComponent(click);\r
         controls.addComponent(click2);\r
         report.addComponent(controls);\r
-        DateField cal = new DateField();\r
+        final DateField cal = new DateField();\r
         cal.setResolution(DateField.RESOLUTION_DAY);\r
         cal.setLocale(new Locale("en", "US"));\r
         report.addComponent(cal);\r
@@ -71,7 +76,7 @@ public class TestForBasicApplicationLayout extends CustomComponent {
 \r
         sp2.setFirstComponent(report);\r
 \r
-        Table table = TestForTablesInitialColumnWidthLogicRendering\r
+        final Table table = TestForTablesInitialColumnWidthLogicRendering\r
                 .getTestTable(5, 200);\r
         table.setPageLength(15);\r
         table.setSelectable(true);\r
index d5021a835f4d3df81a32adbe8f1eaa0fb6a18a26..15782ca12c7269d5da2015492b3b2d0f84b656f7 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import java.util.ArrayList;
@@ -21,7 +25,7 @@ import com.itmill.toolkit.ui.Select;
  */
 public class TestForChildComponentRendering extends CustomComponent {
 
-    private OrderedLayout main;
+    private final OrderedLayout main;
 
     public TestForChildComponentRendering() {
 
@@ -34,7 +38,7 @@ public class TestForChildComponentRendering extends CustomComponent {
         main.removeAllComponents();
         main.addComponent(new Label("SDFGFHFHGJGFDSDSSSGFDD"));
 
-        Link l = new Link();
+        final Link l = new Link();
         l.setCaption("Siirry ITMILLIIN");
         l.setResource(new ExternalResource("http://www.itmill.com/"));
         l.setTargetHeight(200);
@@ -42,7 +46,7 @@ public class TestForChildComponentRendering extends CustomComponent {
         l.setTargetBorder(Link.TARGET_BORDER_MINIMAL);
         main.addComponent(l);
 
-        Select se = new Select();
+        final Select se = new Select();
         se.setCaption("VALITSET TÄSTÄ");
         se.addItem("valinta1");
         se.addItem("Valinta 2");
@@ -60,30 +64,30 @@ public class TestForChildComponentRendering extends CustomComponent {
     }
 
     public void randomReorder() {
-        Iterator it = main.getComponentIterator();
-        ArrayList components = new ArrayList();
+        final Iterator it = main.getComponentIterator();
+        final ArrayList components = new ArrayList();
         while (it.hasNext()) {
             components.add(it.next());
         }
 
-        OrderedLayout v = main;
+        final OrderedLayout v = main;
         v.removeAllComponents();
 
         for (int i = components.size(); i > 0; i--) {
-            int index = (int) (Math.random() * i);
+            final int index = (int) (Math.random() * i);
             v.addComponent((Component) components.get(index));
             components.remove(index);
         }
     }
 
     public void removeRandomComponent() {
-        Iterator it = main.getComponentIterator();
-        ArrayList components = new ArrayList();
+        final Iterator it = main.getComponentIterator();
+        final ArrayList components = new ArrayList();
         while (it.hasNext()) {
             components.add(it.next());
         }
-        int size = components.size();
-        int index = (int) (Math.random() * size);
+        final int size = components.size();
+        final int index = (int) (Math.random() * size);
         main.removeComponent((Component) components.get(index));
 
     }
index e567f4f34daa3dc0eddbc0a3e3bd89a2913a119c..165abe503b23f14f0fd35de6194a92ff7236ff90 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import com.itmill.toolkit.data.util.IndexedContainer;
@@ -30,13 +34,13 @@ public class TestForContainerFilterable extends CustomComponent {
         ic.addContainerProperty("foo", String.class, "");
         ic.addContainerProperty("bar", String.class, "");
         for (int i = 0; i < 1000; i++) {
-            Object id = ic.addItem();
+            final Object id = ic.addItem();
             ic.getContainerProperty(id, "foo").setValue(randomWord());
             ic.getContainerProperty(id, "bar").setValue(randomWord());
         }
 
         // Init filtering view
-        Panel filterPanel = new Panel("Filter", new OrderedLayout(
+        final Panel filterPanel = new Panel("Filter", new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL));
         filterPanel.setWidth(100);
         filterPanel.setWidthUnits(Sizeable.UNITS_PERCENTAGE);
@@ -84,7 +88,7 @@ public class TestForContainerFilterable extends CustomComponent {
 
     private String randomWord() {
         int len = (int) (Math.random() * 4);
-        StringBuffer buf = new StringBuffer();
+        final StringBuffer buf = new StringBuffer();
         while (len-- >= 0) {
             buf.append(parts[(int) (Math.random() * parts.length)]);
         }
index 38f2445581b87c5d93ec62c8c2eaec96fc980d8a..7ce61ed53599fd2461082a56fca894e18f4252bc 100644 (file)
@@ -1,9 +1,15 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.tests;\r
 \r
+import com.itmill.toolkit.terminal.Sizeable;\r
 import com.itmill.toolkit.ui.CustomComponent;\r
 import com.itmill.toolkit.ui.DateField;\r
 import com.itmill.toolkit.ui.ExpandLayout;\r
 import com.itmill.toolkit.ui.Label;\r
+import com.itmill.toolkit.ui.OrderedLayout;\r
 \r
 /**\r
  * \r
@@ -23,15 +29,15 @@ public class TestForExpandLayout extends CustomComponent {
     public void createNewView() {\r
         main.removeAllComponents();\r
         for (int i = 0; i < 10; i++) {\r
-            ExpandLayout el = new ExpandLayout(\r
-                    ExpandLayout.ORIENTATION_HORIZONTAL);\r
+            final ExpandLayout el = new ExpandLayout(\r
+                    OrderedLayout.ORIENTATION_HORIZONTAL);\r
             for (int j = 0; j < 10; j++) {\r
-                Label l = new Label("label" + i + ":" + j);\r
+                final Label l = new Label("label" + i + ":" + j);\r
                 el.addComponent(l);\r
             }\r
             if (i > 0) {\r
                 el.setHeight(1);\r
-                el.setHeightUnits(ExpandLayout.UNITS_EM);\r
+                el.setHeightUnits(Sizeable.UNITS_EM);\r
             }\r
             main.addComponent(el);\r
         }\r
index 2f0c70889c9b115a7b10c72c8d6f3c4fbf8a410b..06889476f58287b29afa81384ad52e45d0347fea 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import java.util.ArrayList;
@@ -21,7 +25,7 @@ import com.itmill.toolkit.ui.Select;
  */
 public class TestForGridLayoutChildComponentRendering extends CustomComponent {
 
-    private GridLayout main = new GridLayout(2, 3);
+    private final GridLayout main = new GridLayout(2, 3);
 
     public TestForGridLayoutChildComponentRendering() {
 
@@ -33,7 +37,7 @@ public class TestForGridLayoutChildComponentRendering extends CustomComponent {
         main.removeAllComponents();
         main.addComponent(new Label("SDFGFHFHGJGFDSDSSSGFDD"));
 
-        Link l = new Link();
+        final Link l = new Link();
         l.setCaption("Siirry ITMILLIIN");
         l.setResource(new ExternalResource("http://www.itmill.com/"));
         l.setTargetHeight(200);
@@ -41,7 +45,7 @@ public class TestForGridLayoutChildComponentRendering extends CustomComponent {
         l.setTargetBorder(Link.TARGET_BORDER_MINIMAL);
         main.addComponent(l);
 
-        Select se = new Select("Tästä valitaan");
+        final Select se = new Select("Tästä valitaan");
         se.setCaption("Whattaa select");
         se.addItem("valinta1");
         se.addItem("Valinta 2");
@@ -61,19 +65,19 @@ public class TestForGridLayoutChildComponentRendering extends CustomComponent {
     }
 
     public void randomReorder() {
-        Iterator it = main.getComponentIterator();
-        ArrayList components = new ArrayList();
+        final Iterator it = main.getComponentIterator();
+        final ArrayList components = new ArrayList();
         while (it.hasNext()) {
             components.add(it.next());
         }
 
         main.removeAllComponents();
 
-        int size = components.size();
-        int colspanIndex = ((int) (Math.random() * size) / 2) * 2 + 2;
+        final int size = components.size();
+        final int colspanIndex = ((int) (Math.random() * size) / 2) * 2 + 2;
 
         for (int i = components.size(); i > 0; i--) {
-            int index = (int) (Math.random() * i);
+            final int index = (int) (Math.random() * i);
             if (i == colspanIndex) {
                 main.addComponent((Component) components.get(index), 0,
                         (size - i) / 2, 1, (size - i) / 2);
@@ -85,13 +89,13 @@ public class TestForGridLayoutChildComponentRendering extends CustomComponent {
     }
 
     public void removeRandomComponent() {
-        Iterator it = main.getComponentIterator();
-        ArrayList components = new ArrayList();
+        final Iterator it = main.getComponentIterator();
+        final ArrayList components = new ArrayList();
         while (it.hasNext()) {
             components.add(it.next());
         }
-        int size = components.size();
-        int index = (int) (Math.random() * size);
+        final int size = components.size();
+        final int index = (int) (Math.random() * size);
         main.removeComponent((Component) components.get(index));
 
     }
index 232cefc381b71b23a15c68be2189f03625bbe0b4..5400ca828c0404d8ce1b9eee6e766b035f97e080 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import java.util.ArrayList;
@@ -63,19 +67,19 @@ public class TestForMultipleStyleNames extends CustomComponent implements
 
     public void valueChange(ValueChangeEvent event) {
 
-        String currentStyle = l.getStyle();
-        String[] tmp = currentStyle.split(" ");
-        ArrayList curStyles = new ArrayList();
+        final String currentStyle = l.getStyle();
+        final String[] tmp = currentStyle.split(" ");
+        final ArrayList curStyles = new ArrayList();
         for (int i = 0; i < tmp.length; i++) {
             if (tmp[i] != "") {
                 curStyles.add(tmp[i]);
             }
         }
 
-        Collection styles = (Collection) s.getValue();
+        final Collection styles = (Collection) s.getValue();
 
-        for (Iterator iterator = styles.iterator(); iterator.hasNext();) {
-            String styleName = (String) iterator.next();
+        for (final Iterator iterator = styles.iterator(); iterator.hasNext();) {
+            final String styleName = (String) iterator.next();
             if (curStyles.contains(styleName)) {
                 // already added
                 curStyles.remove(styleName);
@@ -83,8 +87,9 @@ public class TestForMultipleStyleNames extends CustomComponent implements
                 l.addStyleName(styleName);
             }
         }
-        for (Iterator iterator2 = curStyles.iterator(); iterator2.hasNext();) {
-            String object = (String) iterator2.next();
+        for (final Iterator iterator2 = curStyles.iterator(); iterator2
+                .hasNext();) {
+            final String object = (String) iterator2.next();
             l.removeStyleName(object);
         }
     }
index 7fa373d8d25060c6255fa8716ff9a5c60c211373..5e7216101b801763401ec7f3a2030dab5952a634 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import java.net.MalformedURLException;
@@ -31,7 +35,7 @@ public class TestForNativeWindowing extends Application {
                         w.setWidth(100);
                         w.setHeight(400);
 
-                        Button closebutton = new Button("Close "
+                        final Button closebutton = new Button("Close "
                                 + w.getCaption(), new Button.ClickListener() {
                             public void buttonClick(ClickEvent event) {
                                 main.removeWindow(w);
@@ -83,7 +87,7 @@ public class TestForNativeWindowing extends Application {
                                                                             .currentTimeMillis()
                                                                     + "/")),
                                             null);
-                        } catch (MalformedURLException e) {
+                        } catch (final MalformedURLException e) {
                         }
                     }
                 }));
@@ -94,13 +98,13 @@ public class TestForNativeWindowing extends Application {
 
     public Window getWindow(String name) {
 
-        Window w = super.getWindow(name);
+        final Window w = super.getWindow(name);
         if (w != null) {
             return w;
         }
 
         if (name != null && name.startsWith("mainwin-")) {
-            String postfix = name.substring("mainwin-".length());
+            final String postfix = name.substring("mainwin-".length());
             final Window ww = new Window("Window: " + postfix);
             ww.setName(name);
             ww.addComponent(new Label(
index 27809adff162a51811231b2b97be1c2f1dfd2985..47c435ad82a9aa8eb111d42b8ae023d2ccc4db9a 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import com.itmill.toolkit.event.Action;
@@ -87,14 +91,14 @@ public class TestForPreconfiguredComponents extends CustomComponent implements
                 .setCaption("OptionGroup + multiselect manually (configured from select)");
         main.addComponent(test);
 
-        Button b = new Button("refresh view", this, "createNewView");
+        final Button b = new Button("refresh view", this, "createNewView");
         main.addComponent(b);
 
     }
 
     public static void fillSelect(AbstractSelect s, int items) {
         for (int i = 0; i < items; i++) {
-            String name = firstnames[(int) (Math.random() * (firstnames.length - 1))]
+            final String name = firstnames[(int) (Math.random() * (firstnames.length - 1))]
                     + " "
                     + lastnames[(int) (Math.random() * (lastnames.length - 1))];
             s.addItem(name);
@@ -103,7 +107,7 @@ public class TestForPreconfiguredComponents extends CustomComponent implements
 
     public Tree createTestTree() {
         Tree t = new Tree("Tree");
-        String[] names = new String[100];
+        final String[] names = new String[100];
         for (int i = 0; i < names.length; i++) {
             names[i] = firstnames[(int) (Math.random() * (firstnames.length - 1))]
                     + " "
@@ -114,7 +118,7 @@ public class TestForPreconfiguredComponents extends CustomComponent implements
         t = new Tree("Organization Structure");
         for (int i = 0; i < 100; i++) {
             t.addItem(names[i]);
-            String parent = names[(int) (Math.random() * (names.length - 1))];
+            final String parent = names[(int) (Math.random() * (names.length - 1))];
             if (t.containsId(parent)) {
                 t.setParent(names[i], parent);
             }
@@ -130,7 +134,7 @@ public class TestForPreconfiguredComponents extends CustomComponent implements
     }
 
     public Panel createTestBench(Component t) {
-        Panel ol = new Panel();
+        final Panel ol = new Panel();
         ol.setLayout(new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL));
 
         ol.addComponent(t);
index 407dbd819479a81dd8bb4dc63d5ecf0fd9e006fc..9adc4b4838b1eef23830673fb00cb24f7f2212f0 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import com.itmill.toolkit.data.Property.ValueChangeEvent;
@@ -15,7 +19,7 @@ import com.itmill.toolkit.ui.RichTextArea;
 public class TestForRichTextEditor extends CustomComponent implements
         ValueChangeListener {
 
-    private OrderedLayout main = new OrderedLayout();
+    private final OrderedLayout main = new OrderedLayout();
 
     private Label l;
 
index 3c1b298c66f009d67a8a4e6a12854b867f8375ab..1304ef92980b032e4408121f1db3690d2bf91ae3 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import java.util.Vector;
@@ -19,7 +23,7 @@ import com.itmill.toolkit.ui.Table;
 public class TestForTablesInitialColumnWidthLogicRendering extends
         CustomComponent {
 
-    private OrderedLayout main = new OrderedLayout();
+    private final OrderedLayout main = new OrderedLayout();
 
     public TestForTablesInitialColumnWidthLogicRendering() {
 
@@ -79,19 +83,19 @@ public class TestForTablesInitialColumnWidthLogicRendering extends
         t.setWidth(200);
         main.addComponent(t);
 
-        Button b = new Button("refresh view", this, "createNewView");
+        final Button b = new Button("refresh view", this, "createNewView");
         main.addComponent(b);
 
     }
 
     public static Table getTestTable(int cols, int rows) {
-        Table t = new Table();
+        final Table t = new Table();
         t.setColumnCollapsingAllowed(true);
         for (int i = 0; i < cols; i++) {
             t.addContainerProperty(testString[i], String.class, "");
         }
         for (int i = 0; i < rows; i++) {
-            Vector content = new Vector();
+            final Vector content = new Vector();
             for (int j = 0; j < cols; j++) {
                 content.add(rndString());
             }
index 331ec4065d346e0f5b6eca7dad4d7a289f42352b..fd7624fce4d872a72d79e3e0b521adc93204cbd3 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import com.itmill.toolkit.event.Action;
@@ -26,9 +30,9 @@ public class TestForTrees extends CustomComponent implements Handler {
             "Smith", "Jones", "Beck", "Sheridan", "Picard", "Hill", "Fielding",
             "Einstein" };
 
-    private OrderedLayout main = new OrderedLayout();
+    private final OrderedLayout main = new OrderedLayout();
 
-    private Action[] actions = new Action[] { new Action("edit"),
+    private final Action[] actions = new Action[] { new Action("edit"),
             new Action("delete") };
 
     private Panel al;
@@ -75,20 +79,20 @@ public class TestForTrees extends CustomComponent implements Handler {
         t.setCaption("with actions");
         t.setImmediate(true);
         t.addActionHandler(this);
-        OrderedLayout ol = (OrderedLayout) createTestBench(t);
+        final OrderedLayout ol = (OrderedLayout) createTestBench(t);
         al = new Panel("action log");
         ol.addComponent(al);
         main.addComponent(ol);
         contextTree = t;
 
-        Button b = new Button("refresh view", this, "createNewView");
+        final Button b = new Button("refresh view", this, "createNewView");
         main.addComponent(b);
 
     }
 
     public Tree createTestTree() {
         Tree t = new Tree("Tree");
-        String[] names = new String[100];
+        final String[] names = new String[100];
         for (int i = 0; i < names.length; i++) {
             names[i] = firstnames[(int) (Math.random() * (firstnames.length - 1))]
                     + " "
@@ -99,7 +103,7 @@ public class TestForTrees extends CustomComponent implements Handler {
         t = new Tree("Organization Structure");
         for (int i = 0; i < 100; i++) {
             t.addItem(names[i]);
-            String parent = names[(int) (Math.random() * (names.length - 1))];
+            final String parent = names[(int) (Math.random() * (names.length - 1))];
             if (t.containsId(parent)) {
                 t.setParent(names[i], parent);
             }
@@ -115,7 +119,7 @@ public class TestForTrees extends CustomComponent implements Handler {
     }
 
     public Component createTestBench(Tree t) {
-        OrderedLayout ol = new OrderedLayout();
+        final OrderedLayout ol = new OrderedLayout();
         ol.setOrientation(OrderedLayout.ORIENTATION_HORIZONTAL);
 
         ol.addComponent(t);
index 5817a35af6a7921a5dc8e4c86d57a4e32382f748..0d8cbb52a25ea7ffc99caa628ae314c5027e2940 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import java.io.ByteArrayInputStream;
@@ -78,9 +82,9 @@ public class TestForUpload extends CustomComponent implements
 
         up.setProgressListener(this);
 
-        Button b = new Button("b", this, "readState");
+        final Button b = new Button("b", this, "readState");
 
-        Button c = new Button("b with gc", this, "gc");
+        final Button c = new Button("b with gc", this, "gc");
 
         main.addComponent(b);
         main.addComponent(c);
@@ -112,7 +116,7 @@ public class TestForUpload extends CustomComponent implements
         status.setVisible(false);
         main.addComponent(status);
 
-        Button restart = new Button("R");
+        final Button restart = new Button("R");
         restart.addListener(new Button.ClickListener() {
 
             public void buttonClick(ClickEvent event) {
@@ -124,7 +128,7 @@ public class TestForUpload extends CustomComponent implements
     }
 
     private void setBuffer() {
-        String id = (String) uploadBufferSelector.getValue();
+        final String id = (String) uploadBufferSelector.getValue();
         if ("memory".equals(id)) {
             buffer = new MemoryBuffer();
         } else if ("tempfile".equals(id)) {
@@ -139,7 +143,7 @@ public class TestForUpload extends CustomComponent implements
     }
 
     public void readState() {
-        StringBuffer sb = new StringBuffer();
+        final StringBuffer sb = new StringBuffer();
 
         if (up.isUploading()) {
             sb.append("Uploading...");
@@ -159,7 +163,7 @@ public class TestForUpload extends CustomComponent implements
 
     public void uploadFinished(FinishedEvent event) {
         status.removeAllComponents();
-        InputStream stream = buffer.getStream();
+        final InputStream stream = buffer.getStream();
         if (stream == null) {
             status.addComponent(new Label(
                     "Upload finished, but output buffer is null!!"));
@@ -245,11 +249,11 @@ public class TestForUpload extends CustomComponent implements
         private FileInputStream stream;
 
         public TmpFileBuffer() {
-            String tempFileName = "upload_tmpfile_"
+            final String tempFileName = "upload_tmpfile_"
                     + System.currentTimeMillis();
             try {
                 file = File.createTempFile(tempFileName, null);
-            } catch (IOException e) {
+            } catch (final IOException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
             }
@@ -262,7 +266,7 @@ public class TestForUpload extends CustomComponent implements
             }
             try {
                 return new FileInputStream(file);
-            } catch (FileNotFoundException e) {
+            } catch (final FileNotFoundException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
             }
@@ -278,7 +282,7 @@ public class TestForUpload extends CustomComponent implements
             mimeType = MIMEType;
             try {
                 return new FileOutputStream(file);
-            } catch (FileNotFoundException e) {
+            } catch (final FileNotFoundException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
             }
index 63a15f6aeedb7cc59a3a983e8771bb7b8826c48f..3db7c5c7702fc43897ce1b11f8f3fc6da156b590 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import com.itmill.toolkit.terminal.ExternalResource;
@@ -10,14 +14,14 @@ public class TestForWindowOpen extends CustomComponent {
 
     public TestForWindowOpen() {
 
-        OrderedLayout main = new OrderedLayout();
+        final OrderedLayout main = new OrderedLayout();
         setCompositionRoot(main);
 
         main.addComponent(new Button("Open in this window",
                 new Button.ClickListener() {
 
                     public void buttonClick(ClickEvent event) {
-                        ExternalResource r = new ExternalResource(
+                        final ExternalResource r = new ExternalResource(
                                 "http://www.google.com");
                         getApplication().getMainWindow().open(r);
 
@@ -29,7 +33,7 @@ public class TestForWindowOpen extends CustomComponent {
                 new Button.ClickListener() {
 
                     public void buttonClick(ClickEvent event) {
-                        ExternalResource r = new ExternalResource(
+                        final ExternalResource r = new ExternalResource(
                                 "http://www.google.com");
                         getApplication().getMainWindow().open(r, "mytarget");
 
@@ -41,7 +45,7 @@ public class TestForWindowOpen extends CustomComponent {
                 new Button.ClickListener() {
 
                     public void buttonClick(ClickEvent event) {
-                        ExternalResource r = new ExternalResource(
+                        final ExternalResource r = new ExternalResource(
                                 "http://www.google.com");
                         getApplication().getMainWindow()
                                 .open(r, "secondtarget");
index 972cdb674793989ef79fee526087f1d0f81b1089..92e860450c7ffce727d91bf57439e6c633c059ec 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import com.itmill.toolkit.data.Property.ValueChangeEvent;
@@ -20,60 +24,62 @@ public class TestForWindowing extends CustomComponent {
 
     public TestForWindowing() {
 
-        OrderedLayout main = new OrderedLayout();
+        final OrderedLayout main = new OrderedLayout();
 
         main.addComponent(new Label(
                 "Click the button to create a new inline window."));
 
-        Button create = new Button("Create a new window", new ClickListener() {
+        final Button create = new Button("Create a new window",
+                new ClickListener() {
 
-            public void buttonClick(ClickEvent event) {
-                Window w = new Window("Testing Window");
+                    public void buttonClick(ClickEvent event) {
+                        Window w = new Window("Testing Window");
 
-                AbstractSelect s1 = new OptionGroup();
-                s1.setCaption("1. Select output format");
-                s1.addItem("Excel sheet");
-                s1.addItem("CSV plain text");
-                s1.setValue("Excel sheet");
+                        AbstractSelect s1 = new OptionGroup();
+                        s1.setCaption("1. Select output format");
+                        s1.addItem("Excel sheet");
+                        s1.addItem("CSV plain text");
+                        s1.setValue("Excel sheet");
 
-                s2 = new Select();
-                s2.addItem("Separate by comma (,)");
-                s2.addItem("Separate by colon (:)");
-                s2.addItem("Separate by semicolon (;)");
-                s2.setEnabled(false);
+                        s2 = new Select();
+                        s2.addItem("Separate by comma (,)");
+                        s2.addItem("Separate by colon (:)");
+                        s2.addItem("Separate by semicolon (;)");
+                        s2.setEnabled(false);
 
-                s1.addListener(new ValueChangeListener() {
+                        s1.addListener(new ValueChangeListener() {
 
-                    public void valueChange(ValueChangeEvent event) {
-                        String v = (String) event.getProperty().getValue();
-                        if (v.equals("CSV plain text")) {
-                            s2.setEnabled(true);
-                        } else {
-                            s2.setEnabled(false);
-                        }
-                    }
+                            public void valueChange(ValueChangeEvent event) {
+                                String v = (String) event.getProperty()
+                                        .getValue();
+                                if (v.equals("CSV plain text")) {
+                                    s2.setEnabled(true);
+                                } else {
+                                    s2.setEnabled(false);
+                                }
+                            }
 
-                });
+                        });
 
-                w.addComponent(s1);
-                w.addComponent(s2);
+                        w.addComponent(s1);
+                        w.addComponent(s2);
 
-                Slider s = new Slider();
-                s.setCaption("Volume");
-                s.setMax(13);
-                s.setMin(12);
-                s.setResolution(2);
-                s.setImmediate(true);
-                // s.setOrientation(Slider.ORIENTATION_VERTICAL);
-                // s.setArrows(false);
+                        Slider s = new Slider();
+                        s.setCaption("Volume");
+                        s.setMax(13);
+                        s.setMin(12);
+                        s.setResolution(2);
+                        s.setImmediate(true);
+                        // s.setOrientation(Slider.ORIENTATION_VERTICAL);
+                        // s.setArrows(false);
 
-                w.addComponent(s);
+                        w.addComponent(s);
 
-                getApplication().getMainWindow().addWindow(w);
+                        getApplication().getMainWindow().addWindow(w);
 
-            }
+                    }
 
-        });
+                });
 
         main.addComponent(create);
 
index 67b0ca42b3c10129a2e660e6dd6b684ac5c83584..97dc5a05d4de73912a57c01fc4839a3004ed460c 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import com.itmill.toolkit.ui.CustomComponent;
@@ -25,10 +29,10 @@ public class TestIFrames extends CustomComponent {
     }
 
     private Label createEmbedded(String URL) {
-        int width = 600;
-        int height = 250;
-        String iFrame = "<iframe height=\"" + height + "\" width=\"" + width
-                + "\" src=\"" + URL + "\" />";
+        final int width = 600;
+        final int height = 250;
+        final String iFrame = "<iframe height=\"" + height + "\" width=\""
+                + width + "\" src=\"" + URL + "\" />";
         return new Label(iFrame, Label.CONTENT_XHTML);
     }
 
index ea09e5d6ba8ddd0abf0e0ff6c5ff23f213061ef7..7dc419f96f3865f0d746da16a523e0902c004b17 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import java.util.Collection;
@@ -23,7 +27,7 @@ import com.itmill.toolkit.ui.Select;
 public class TestSelectAndDatefieldInDeepLayouts extends CustomComponent {
 
     public TestSelectAndDatefieldInDeepLayouts() {
-        OrderedLayout root = (OrderedLayout) getOrderedLayout();
+        final OrderedLayout root = (OrderedLayout) getOrderedLayout();
         setCompositionRoot(root);
 
         root.addComponent(getSelect());
@@ -31,7 +35,7 @@ public class TestSelectAndDatefieldInDeepLayouts extends CustomComponent {
         root.addComponent(getSelect());
         root.addComponent(getDateField());
 
-        Panel p1 = getPanel();
+        final Panel p1 = getPanel();
         root.addComponent(p1);
 
         p1.addComponent(getSelect());
@@ -39,7 +43,7 @@ public class TestSelectAndDatefieldInDeepLayouts extends CustomComponent {
         p1.addComponent(getSelect());
         p1.addComponent(getDateField());
 
-        OrderedLayout l1 = (OrderedLayout) getOrderedLayout();
+        final OrderedLayout l1 = (OrderedLayout) getOrderedLayout();
         p1.addComponent(l1);
 
         l1.addComponent(getSelect());
@@ -47,7 +51,7 @@ public class TestSelectAndDatefieldInDeepLayouts extends CustomComponent {
         l1.addComponent(getSelect());
         l1.addComponent(getDateField());
 
-        Panel p2 = getPanel();
+        final Panel p2 = getPanel();
         l1.addComponent(p2);
 
         p2.addComponent(getSelect());
@@ -58,13 +62,13 @@ public class TestSelectAndDatefieldInDeepLayouts extends CustomComponent {
     }
 
     AbstractLayout getOrderedLayout() {
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
         l.setCaption(getCaption("orderedlayout"));
         return l;
     }
 
     Panel getPanel() {
-        Panel panel = new Panel();
+        final Panel panel = new Panel();
         panel.setCaption(getCaption("panel"));
         return panel;
     }
@@ -78,7 +82,7 @@ public class TestSelectAndDatefieldInDeepLayouts extends CustomComponent {
     }
 
     private Collection getSelectOptions() {
-        Collection opts = new Vector(3);
+        final Collection opts = new Vector(3);
         opts.add(getCaption("opt 1"));
         opts.add(getCaption("opt 2"));
         opts.add(getCaption("opt 3"));
index 009cd20067de07ad5cf490680b60fceaa513781e..4f4d2dc0996917abc1d32f0316db331354955e73 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import com.itmill.toolkit.ui.Button;
@@ -18,7 +22,7 @@ public class TestSetVisibleAndCaching extends com.itmill.toolkit.Application {
     int selectedPanel = 0;
 
     public void init() {
-        Window mainWindow = new Window("TestSetVisibleAndCaching");
+        final Window mainWindow = new Window("TestSetVisibleAndCaching");
         setMainWindow(mainWindow);
 
         panelA.addComponent(new Label(
index 9945fc966feba7ae1a6925ad0ed059798fd793a5..fffd1ffb5a28ed80782899366f98c89345244437 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import com.itmill.toolkit.ui.Label;
@@ -11,7 +15,7 @@ public class TestSplitPanel extends com.itmill.toolkit.Application {
     SplitPanel verticalSplit = new SplitPanel(SplitPanel.ORIENTATION_VERTICAL);
 
     public void init() {
-        Window mainWindow = new Window("Feature Browser");
+        final Window mainWindow = new Window("Feature Browser");
         setMainWindow(mainWindow);
 
         verticalSplit.setFirstComponent(new Label("vertical first"));
index da29b7ee7c61f5308a6e0bd37c599a2d165255b2..76c06ad130550fc606146d34b29d37dcbe33eace 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests;
 
 import java.util.LinkedList;
@@ -13,20 +17,21 @@ import com.itmill.toolkit.ui.Window;
 public class UsingObjectsInSelect extends com.itmill.toolkit.Application
         implements ValueChangeListener {
 
-    private Select select = new Select();
-    private Label selectedTask = new Label("Selected task", Label.CONTENT_XHTML);
+    private final Select select = new Select();
+    private final Label selectedTask = new Label("Selected task",
+            Label.CONTENT_XHTML);
 
     public LinkedList exampleTasks = new LinkedList();
 
     public static Random random = new Random(1);
 
     public void init() {
-        Window main = new Window("Select demo");
+        final Window main = new Window("Select demo");
         setMainWindow(main);
 
-        Panel panel = new Panel("Select demo");
+        final Panel panel = new Panel("Select demo");
         panel.addComponent(select);
-        Panel panel2 = new Panel("Selection");
+        final Panel panel2 = new Panel("Selection");
         panel2.addComponent(selectedTask);
 
         select.setCaption("Select component");
@@ -40,12 +45,12 @@ public class UsingObjectsInSelect extends com.itmill.toolkit.Application
     }
 
     public void createExampleTasks() {
-        String[] assignedTo = new String[] { "John", "Mary", "Joe", "Sarah",
-                "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" };
-        String[] type = new String[] { "Enhancement", "Bugfix", "Testing",
-                "Task" };
+        final String[] assignedTo = new String[] { "John", "Mary", "Joe",
+                "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" };
+        final String[] type = new String[] { "Enhancement", "Bugfix",
+                "Testing", "Task" };
         for (int j = 0; j < 100; j++) {
-            Task task = new Task(
+            final Task task = new Task(
                     type[(int) (random.nextDouble() * (type.length - 1))],
                     assignedTo[(int) (random.nextDouble() * (assignedTo.length - 1))],
                     random.nextInt(100));
@@ -54,7 +59,7 @@ public class UsingObjectsInSelect extends com.itmill.toolkit.Application
     }
 
     public void valueChange(ValueChangeEvent event) {
-        Task task = (Task) select.getValue();
+        final Task task = (Task) select.getValue();
         selectedTask.setValue("<b>Type:</b> " + task.getType()
                 + "<br /><b>Assigned to:</b> " + task.getAssignedTo()
                 + "<br /><b>Estimated hours: </b>" + task.getEstimatedHours());
index 058cff97aaf9e6f278052e09ced0b1fb828337a5..3bd9d8e44ec57f394ec570ec0835ce11d7bcc9b5 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -47,7 +23,7 @@ public abstract class Feature extends CustomComponent {
 
     private boolean propsReminder = true;
 
-    private OrderedLayout layout;
+    private final OrderedLayout layout;
 
     private TabSheet ts;
 
@@ -96,7 +72,7 @@ public abstract class Feature extends CustomComponent {
         javadoc.setContentMode(Label.CONTENT_XHTML);
 
         // Demo
-        Component demo = getDemoComponent();
+        final Component demo = getDemoComponent();
         if (demo != null) {
             layout.addComponent(demo);
         }
@@ -109,11 +85,11 @@ public abstract class Feature extends CustomComponent {
         ts.setHeightUnits(Sizeable.UNITS_PERCENTAGE);
 
         // Description tab
-        String title = getTitle();
+        final String title = getTitle();
         if (getDescriptionXHTML() != null) {
-            OrderedLayout mainLayout = new OrderedLayout(
+            final OrderedLayout mainLayout = new OrderedLayout(
                     OrderedLayout.ORIENTATION_VERTICAL);
-            OrderedLayout layout = new OrderedLayout(
+            final OrderedLayout layout = new OrderedLayout(
                     OrderedLayout.ORIENTATION_HORIZONTAL);
             mainLayout.addComponent(layout);
             if (getImage() != null) {
@@ -131,7 +107,7 @@ public abstract class Feature extends CustomComponent {
             }
             description = new Label(label, Label.CONTENT_XHTML);
             mainLayout.addComponent(description);
-                       mainLayout.setMargin(true);
+            mainLayout.setMargin(true);
 
             ts.addTab(mainLayout, "Description", null);
         }
@@ -145,9 +121,9 @@ public abstract class Feature extends CustomComponent {
         }
 
         // Code Sample tab
-        String example = getExampleSrc();
+        final String example = getExampleSrc();
         if (example != null) {
-            OrderedLayout l = new OrderedLayout();
+            final OrderedLayout l = new OrderedLayout();
             if (getTitle() != null) {
                 l.addComponent(new Label(
                         "<b>// " + getTitle() + " example</b>",
index 2aaefecc5a29abc543d282db0af89ab1c66dd9f5..1aecfc6d45f60075bce48d500c1f777df4d74b14 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -57,7 +33,7 @@ public class FeatureBrowser extends CustomComponent implements
 
     private boolean initialized = false;
 
-    private Select themeSelector = new Select();
+    private final Select themeSelector = new Select();
 
     public void attach() {
 
@@ -89,7 +65,7 @@ public class FeatureBrowser extends CustomComponent implements
         themeSelector.setImmediate(true);
 
         // Restart button
-        Button close = new Button("restart", getApplication(), "close");
+        final Button close = new Button("restart", getApplication(), "close");
         close.setStyle("link");
         mainlayout.addComponent(close, "restart");
 
@@ -143,7 +119,7 @@ public class FeatureBrowser extends CustomComponent implements
         // new FeatureParameters());
 
         // Pre-open all menus
-        for (Iterator i = features.getItemIds().iterator(); i.hasNext();) {
+        for (final Iterator i = features.getItemIds().iterator(); i.hasNext();) {
             features.expandItem(i.next());
         }
 
@@ -158,11 +134,11 @@ public class FeatureBrowser extends CustomComponent implements
     }
 
     public void registerFeature(String path, Feature feature) {
-        StringTokenizer st = new StringTokenizer(path, "/");
+        final StringTokenizer st = new StringTokenizer(path, "/");
         String id = "";
         String parentId = null;
         while (st.hasMoreTokens()) {
-            String token = st.nextToken();
+            final String token = st.nextToken();
             id += "/" + token;
             if (!features.containsId(id)) {
                 features.addItem(id);
@@ -194,19 +170,20 @@ public class FeatureBrowser extends CustomComponent implements
                                 + ((AbstractComponent) event.getProperty())
                                         .getTag() + ", " + event.getProperty());
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             // ignored, should never happen
         }
 
         // Change feature
         if (event.getProperty() == features) {
-            Object id = features.getValue();
+            final Object id = features.getValue();
             if (id != null) {
                 if (features.areChildrenAllowed(id)) {
                     features.expandItem(id);
                 }
-                Property p = features.getContainerProperty(id, "feature");
-                Feature feature = p != null ? ((Feature) p.getValue()) : null;
+                final Property p = features.getContainerProperty(id, "feature");
+                final Feature feature = p != null ? ((Feature) p.getValue())
+                        : null;
                 if (feature != null) {
                     mainlayout.removeComponent(currentFeature);
                     mainlayout.removeComponent(currentFeature.getTabSheet());
@@ -236,7 +213,7 @@ public class FeatureBrowser extends CustomComponent implements
                     "buttonClick " + event.getButton().getTag() + ", "
                             + event.getButton().getCaption() + ", "
                             + event.getButton().getValue());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             // ignored, should never happen
         }
 
index 2711f7fd5871a831232b9512ad7af905fe0164d1..be2aac0d30dd86f8206d94e3f8e45f60c93984e8 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -61,12 +37,12 @@ public class FeatureBuffering extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
-        Panel panel = new Panel();
+        final OrderedLayout l = new OrderedLayout();
+        final Panel panel = new Panel();
         panel.setCaption("Buffering");
         l.addComponent(panel);
 
-        Label label = new Label();
+        final Label label = new Label();
         panel.addComponent(label);
 
         label.setContentMode(Label.CONTENT_XHTML);
@@ -74,9 +50,9 @@ public class FeatureBuffering extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(panel);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
index b3038a76ef9a3b73da76852aac93d5d0046d8041..05f35cd7d59e21785710efdf04bd5d42974ff2ca 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -42,17 +18,17 @@ public class FeatureButton extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Button b = new Button("Caption");
+        final Button b = new Button("Caption");
         l.addComponent(b);
 
         // Properties
         propertyPanel = new PropertyPanel(b);
-        Select themes = (Select) propertyPanel.getField("style");
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("link").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("link");
-        Form ap = propertyPanel
+        final Form ap = propertyPanel
                 .createBeanPropertySet(new String[] { "switchMode" });
         propertyPanel.addProperties("Button Properties", ap);
 
index 62d2a5753f7970bbdabe1cc38afa1d0b0c50e247..37c94d7a4c2ed818aaf2a244e762d226182de11d 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -66,13 +42,13 @@ public class FeatureContainers extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Panel panel = new Panel();
+        final Panel panel = new Panel();
         panel.setCaption("Containers");
         l.addComponent(panel);
 
-        Label label = new Label();
+        final Label label = new Label();
         panel.addComponent(label);
 
         label.setContentMode(Label.CONTENT_XHTML);
@@ -80,9 +56,9 @@ public class FeatureContainers extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(panel);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
index 1cac66516bdc9a904983339870b3dd5d81e74693..395328dbb1238facedf905381494fed0e23925eb 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -52,13 +28,13 @@ public class FeatureCustomLayout extends Feature {
             + "the subcomponents with flowlayout.";
 
     protected Component getDemoComponent() {
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Panel panel = new Panel();
+        final Panel panel = new Panel();
         panel.setCaption("Custom Layout");
         l.addComponent(panel);
 
-        Label label = new Label();
+        final Label label = new Label();
         panel.addComponent(label);
 
         label.setContentMode(Label.CONTENT_XHTML);
@@ -66,9 +42,9 @@ public class FeatureCustomLayout extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(panel);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
index 28530ecca81c3c97955ed6da52470a9cc0e88462..562d47d40324d86c341ea40c932719315c27c269 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -41,7 +17,7 @@ public class FeatureDateField extends Feature {
 
     static private String[] localeNames;
     static {
-        Locale[] locales = Locale.getAvailableLocales();
+        final Locale[] locales = Locale.getAvailableLocales();
         localeNames = new String[locales.length];
         for (int i = 0; i < locales.length; i++) {
             localeNames[i] = locales[i].getDisplayName();
@@ -54,18 +30,18 @@ public class FeatureDateField extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
         l.addComponent(new Label("Your default locale is: "
                 + getApplication().getLocale().toString().replace('_', '-')));
 
-        DateField df = new DateField();
+        final DateField df = new DateField();
         df.setValue(new java.util.Date());
         l.addComponent(df);
 
         // Properties
         propertyPanel = new PropertyPanel(df);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] {
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
                 "resolution", "locale" });
         ap.replaceWithSelect("resolution", new Object[] {
                 new Integer(DateField.RESOLUTION_YEAR),
@@ -82,7 +58,7 @@ public class FeatureDateField extends Feature {
         ap.getField("resolution").setValue(
                 new Integer(DateField.RESOLUTION_DAY));
         ap.getField("locale").setValue(Locale.getDefault());
-        Select themes = (Select) propertyPanel.getField("style");
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("text").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("text");
         themes.addItem("calendar").getItemProperty(
index ba0f2eca3a86d8597c24a227bbf0553ebb3248e6..0cf915a0fe356137a54db30335ebb51eb1fd29ed 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -43,11 +19,11 @@ public class FeatureEmbedded extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        ClassResource flashResource = new ClassResource("itmill_spin.swf",
-                getApplication());
-        Embedded emb = new Embedded("Embedded Caption", flashResource);
+        final ClassResource flashResource = new ClassResource(
+                "itmill_spin.swf", getApplication());
+        final Embedded emb = new Embedded("Embedded Caption", flashResource);
         emb.setType(Embedded.TYPE_OBJECT);
         emb.setMimeType("application/x-shockwave-flash");
         emb.setWidth(250);
@@ -56,16 +32,16 @@ public class FeatureEmbedded extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(emb);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "type",
-                "source", "width", "height", "widthUnits", "heightUnits",
-                "codebase", "codetype", "archive", "mimeType", "standby",
-                "classId" });
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "type", "source", "width", "height", "widthUnits",
+                "heightUnits", "codebase", "codetype", "archive", "mimeType",
+                "standby", "classId" });
         ap.replaceWithSelect("type", new Object[] {
                 new Integer(Embedded.TYPE_IMAGE),
                 new Integer(Embedded.TYPE_OBJECT) }, new Object[] { "Image",
                 "Object" });
-        Object[] units = new Object[Sizeable.UNIT_SYMBOLS.length];
-        Object[] symbols = new Object[Sizeable.UNIT_SYMBOLS.length];
+        final Object[] units = new Object[Sizeable.UNIT_SYMBOLS.length];
+        final Object[] symbols = new Object[Sizeable.UNIT_SYMBOLS.length];
         for (int i = 0; i < units.length; i++) {
             units[i] = new Integer(i);
             symbols[i] = Sizeable.UNIT_SYMBOLS[i];
index 7b185552488bc97f6804c7bf3bb73d69c21abdd0..94da491433f67d5f609145069f438e1ce6282a1e 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -77,7 +53,7 @@ public class FeatureForm extends Feature implements
         }
 
         demo.addComponent(test);
-        OrderedLayout actions = new OrderedLayout(
+        final OrderedLayout actions = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
         demo.addComponent(actions);
 
@@ -111,7 +87,7 @@ public class FeatureForm extends Feature implements
 
         if (event.getProperty() == resetLayout) {
 
-            String value = (String) resetLayout.getValue();
+            final String value = (String) resetLayout.getValue();
 
             if (value != null) {
                 formLayout = null;
@@ -131,14 +107,14 @@ public class FeatureForm extends Feature implements
 
         if (event.getProperty() == addField) {
 
-            String value = (String) addField.getValue();
+            final String value = (String) addField.getValue();
 
             if (value != null) {
                 if (value.equals("Text field")) {
                     test.addField(new Object(), new TextField("Test field"));
                 }
                 if (value.equals("Time")) {
-                    DateField d = new DateField("Time", new Date());
+                    final DateField d = new DateField("Time", new Date());
                     d
                             .setDescription("This is a DateField-component with text-style");
                     d.setResolution(DateField.RESOLUTION_MIN);
@@ -146,7 +122,7 @@ public class FeatureForm extends Feature implements
                     test.addField(new Object(), d);
                 }
                 if (value.equals("Calendar")) {
-                    DateField c = new DateField("Calendar", new Date());
+                    final DateField c = new DateField("Calendar", new Date());
                     c
                             .setDescription("DateField-component with calendar-style and day-resolution");
                     c.setStyle("calendar");
@@ -154,7 +130,7 @@ public class FeatureForm extends Feature implements
                     test.addField(new Object(), c);
                 }
                 if (value.equals("Option group")) {
-                    Select s = new Select("Options");
+                    final Select s = new Select("Options");
                     s.setDescription("Select-component with optiongroup-style");
                     s.addItem("Linux");
                     s.addItem("Windows");
index 63b8235543755c41d50b16b85e95b79cc8183737..e9db50b6ec319efabcd715a5787a972e261da6c8 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -46,10 +22,10 @@ public class FeatureGridLayout extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        GridLayout gl = new GridLayout(3, 3);
-        DateField cal = new DateField("Test component 1", new Date());
+        final GridLayout gl = new GridLayout(3, 3);
+        final DateField cal = new DateField("Test component 1", new Date());
         cal.setStyle("calendar");
         gl.addComponent(cal, 1, 0, 2, 1);
         for (int i = 2; i < 7; i++) {
@@ -59,8 +35,8 @@ public class FeatureGridLayout extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(gl);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
         ap.addField("new line", new Button("New Line", gl, "newLine"));
         ap.addField("space", new Button("Space", gl, "space"));
         propertyPanel.addProperties("GridLayout Features", ap);
index a723b201f0eef6844f858765ce6f233fe35a680d..bd880969d97c06b70d5b7ee2820448ca355fcc3f 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -56,13 +32,13 @@ public class FeatureItems extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Panel panel = new Panel();
+        final Panel panel = new Panel();
         panel.setCaption("Items");
         l.addComponent(panel);
 
-        Label label = new Label();
+        final Label label = new Label();
         panel.addComponent(label);
 
         label.setContentMode(Label.CONTENT_XHTML);
@@ -70,9 +46,9 @@ public class FeatureItems extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(panel);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
index 4f1febb7833eebe19cb6f968db927745ac7ba77d..fc059452ed5b8d2b34626bef4dcb0514897bf5ab 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -41,14 +17,14 @@ public class FeatureLabel extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Label lab = new Label("Label text");
+        final Label lab = new Label("Label text");
         l.addComponent(lab);
 
         // Properties
         propertyPanel = new PropertyPanel(lab);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] {
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
                 "contentMode", "value" });
         ap.replaceWithSelect("contentMode", new Object[] {
                 new Integer(Label.CONTENT_PREFORMATTED),
index 3eb2434bfcd292b326db0f39d90ca30cd8b9dc42..2b91a4262b6328f633d5c82e730baaf75f009246 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -42,15 +18,15 @@ public class FeatureLink extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Link lnk = new Link("Link caption", new ExternalResource(
+        final Link lnk = new Link("Link caption", new ExternalResource(
                 "http://www.itmill.com"));
         l.addComponent(lnk);
 
         // Properties
         propertyPanel = new PropertyPanel(lnk);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] {
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
                 "targetName", "targetWidth", "targetHeight", "targetBorder" });
         ap.replaceWithSelect("targetBorder", new Object[] {
                 new Integer(Link.TARGET_BORDER_DEFAULT),
index 4792baaed9309f440c7de5c8d378220b85a2ce3b..295eedc21b653d5c7dc7f1feb1b19498c39eae03 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -42,9 +18,9 @@ public class FeatureOrderedLayout extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        OrderedLayout ol = new OrderedLayout();
+        final OrderedLayout ol = new OrderedLayout();
         for (int i = 1; i < 5; i++) {
             ol.addComponent(new TextField("Test component " + i));
         }
@@ -52,13 +28,13 @@ public class FeatureOrderedLayout extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(ol);
-        Form ap = propertyPanel
+        final Form ap = propertyPanel
                 .createBeanPropertySet(new String[] { "orientation" });
         ap.replaceWithSelect("orientation", new Object[] {
                 new Integer(OrderedLayout.ORIENTATION_HORIZONTAL),
                 new Integer(OrderedLayout.ORIENTATION_VERTICAL) },
                 new Object[] { "Horizontal", "Vertical" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("form").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("form");
         propertyPanel.addProperties("OrderedLayout Properties", ap);
index 74cfa90ad1ba841a97aaed3adb3a593c4b13e872..1aa4510d875a42a0193b718df6f0ce76af3570a5 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -43,10 +19,10 @@ public class FeaturePanel extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
         // Example panel
-        Panel show = new Panel("Panel caption");
+        final Panel show = new Panel("Panel caption");
         show
                 .addComponent(new Label(
                         "This is an example Label component that is added into Panel."));
@@ -54,9 +30,9 @@ public class FeaturePanel extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(show);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
index 30f9194d066215f9ea519e763e0b46ed12fc8f9e..1107bb5148d409655be63f4db28b502a0dd1c71e 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -48,11 +24,11 @@ import com.itmill.toolkit.ui.Table;
 public class FeatureParameters extends Feature implements URIHandler,
         ParameterHandler {
 
-    private Label context = new Label();
+    private final Label context = new Label();
 
-    private Label relative = new Label();
+    private final Label relative = new Label();
 
-    private Table params = new Table();
+    private final Table params = new Table();
 
     public FeatureParameters() {
         super();
@@ -61,30 +37,30 @@ public class FeatureParameters extends Feature implements URIHandler,
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Label info = new Label("To test this feature, try to "
+        final Label info = new Label("To test this feature, try to "
                 + "add some get parameters to URL. For example if you have "
                 + "the feature browser installed in your local host, try url: ");
         info.setCaption("Usage info");
         l.addComponent(info);
         try {
-            URL u1 = new URL(getApplication().getURL(),
+            final URL u1 = new URL(getApplication().getURL(),
                     "test/uri?test=1&test=2");
-            URL u2 = new URL(getApplication().getURL(),
+            final URL u2 = new URL(getApplication().getURL(),
                     "foo/bar?mary=john&count=3");
 
             l.addComponent(new Link(u1.toString(), new ExternalResource(u1)));
             l.addComponent(new Label("Or this: "));
             l.addComponent(new Link(u2.toString(), new ExternalResource(u2)));
-        } catch (Exception e) {
+        } catch (final Exception e) {
             System.out.println("Couldn't get hostname for this machine: "
                     + e.toString());
             e.printStackTrace();
         }
 
         // URI
-        Panel p1 = new Panel("URI Handler");
+        final Panel p1 = new Panel("URI Handler");
         context.setCaption("Last URI handler context");
         p1.addComponent(context);
         relative.setCaption("Last relative URI");
@@ -92,7 +68,7 @@ public class FeatureParameters extends Feature implements URIHandler,
         l.addComponent(p1);
 
         // Parameters
-        Panel p2 = new Panel("Parameter Handler");
+        final Panel p2 = new Panel("Parameter Handler");
         params.setCaption("Last parameters");
         params.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_ID);
         params.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);
@@ -101,9 +77,9 @@ public class FeatureParameters extends Feature implements URIHandler,
 
         // Properties
         propertyPanel = new PropertyPanel(p1);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
@@ -169,9 +145,9 @@ public class FeatureParameters extends Feature implements URIHandler,
      */
     public void handleParameters(Map parameters) {
         params.removeAllItems();
-        for (Iterator i = parameters.keySet().iterator(); i.hasNext();) {
-            String name = (String) i.next();
-            String[] values = (String[]) parameters.get(name);
+        for (final Iterator i = parameters.keySet().iterator(); i.hasNext();) {
+            final String name = (String) i.next();
+            final String[] values = (String[]) parameters.get(name);
             String v = "";
             for (int j = 0; j < values.length; j++) {
                 if (v.length() > 0) {
index 8e2db9ed7dc59722e054af0bf4a9d343ffe0611c..34d8c3efa8633a6c96d25b8a2fc3a2c248be7852 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -64,13 +40,13 @@ public class FeatureProperties extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Panel panel = new Panel();
+        final Panel panel = new Panel();
         panel.setCaption("Data Model");
         l.addComponent(panel);
 
-        Label label = new Label();
+        final Label label = new Label();
         panel.addComponent(label);
 
         label.setContentMode(Label.CONTENT_XHTML);
@@ -78,9 +54,9 @@ public class FeatureProperties extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(panel);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
index 9d292093e42096c487777d45bce8df1d45dfbf96..80f6d9cc9d7ad327d31972aa60eae497df53a6aa 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -50,9 +26,9 @@ public class FeatureSelect extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Select s = new Select("Select employee");
+        final Select s = new Select("Select employee");
         for (int i = 0; i < 50; i++) {
             s
                     .addItem(firstnames[(int) (Math.random() * (firstnames.length - 1))]
@@ -63,7 +39,7 @@ public class FeatureSelect extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(s);
-        Select themes = (Select) propertyPanel.getField("style");
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("optiongroup").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("optiongroup");
         themes.addItem("twincol").getItemProperty(
index 53fc4c5def8d5d69f9b79366dddbc17770e647f9..056d5d5d5e477573308dc6745b0425702aadf4c4 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -41,9 +17,9 @@ public class FeatureTabSheet extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        TabSheet ts = new TabSheet();
+        final TabSheet ts = new TabSheet();
         ts
                 .addTab(
                         new Label(
index 37c9c18059346a7f5397b22f4e6a9712cc1e3323..3404c05c44698225cac09b6ad55ecb1b17ef2d3b 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -59,8 +35,8 @@ public class FeatureTable extends Feature implements Action.Handler {
 
     private boolean actionsActive = false;
 
-    private Button actionHandlerSwitch = new Button("Activate actions", this,
-            "toggleActions");
+    private final Button actionHandlerSwitch = new Button("Activate actions",
+            this, "toggleActions");
 
     public void toggleActions() {
         if (actionsActive) {
@@ -76,7 +52,7 @@ public class FeatureTable extends Feature implements Action.Handler {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
         // Sample table
         t = new Table("Corporate Employees");
@@ -110,7 +86,7 @@ public class FeatureTable extends Feature implements Action.Handler {
 
         // Properties
         propertyPanel = new PropertyPanel(t);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] {
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
                 "pageLength", "rowHeaderMode", "selectable",
                 "columnHeaderMode", "columnCollapsingAllowed",
                 "columnReorderingAllowed", "width", "height" });
@@ -132,7 +108,7 @@ public class FeatureTable extends Feature implements Action.Handler {
                 "Explicit", "Explicit defaults ID", "Hidden", "Icon only",
                 "ID", "Index", "Item", "Property" });
 
-        Select themes = (Select) propertyPanel.getField("style");
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("list").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("list");
         themes.addItem("paging").getItemProperty(
@@ -199,13 +175,13 @@ public class FeatureTable extends Feature implements Action.Handler {
         return "Table";
     }
 
-    private Action ACTION1 = new Action("Action 1");
+    private final Action ACTION1 = new Action("Action 1");
 
-    private Action ACTION2 = new Action("Action 2");
+    private final Action ACTION2 = new Action("Action 2");
 
-    private Action ACTION3 = new Action("Action 3");
+    private final Action ACTION3 = new Action("Action 3");
 
-    private Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 };
+    private final Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 };
 
     public Action[] getActions(Object target, Object sender) {
         return actions;
index 8bdcdd34f089e65f79c88568db382abe31b5cfc5..e937a12577093950f43194cb3c33844b4cbd904f 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -41,17 +17,17 @@ public class FeatureTextField extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout(
+        final OrderedLayout l = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
 
         // Test component
-        TextField tf = new TextField("Caption");
+        final TextField tf = new TextField("Caption");
         l.addComponent(tf);
 
         // Properties
         propertyPanel = new PropertyPanel(tf);
-        Form f = propertyPanel.createBeanPropertySet(new String[] { "columns",
-                "rows", "wordwrap", "writeThrough", "readThrough",
+        final Form f = propertyPanel.createBeanPropertySet(new String[] {
+                "columns", "rows", "wordwrap", "writeThrough", "readThrough",
                 "nullRepresentation", "nullSettingAllowed", "secret" });
         propertyPanel.addProperties("Text field properties", f);
 
index cbe3781194980d96c463a24a0dbb288d8d9dc486..a403b680040fe4844a379feef350ff123b3a8f7d 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -51,8 +27,8 @@ public class FeatureTree extends Feature implements Action.Handler {
 
     private boolean actionsActive = false;
 
-    private Button actionHandlerSwitch = new Button("Activate actions", this,
-            "toggleActions");
+    private final Button actionHandlerSwitch = new Button("Activate actions",
+            this, "toggleActions");
 
     public FeatureTree() {
         super();
@@ -71,22 +47,22 @@ public class FeatureTree extends Feature implements Action.Handler {
     }
 
     public void expandAll() {
-        for (Iterator i = t.rootItemIds().iterator(); i.hasNext();) {
+        for (final Iterator i = t.rootItemIds().iterator(); i.hasNext();) {
             t.expandItemsRecursively(i.next());
         }
     }
 
     public void collapseAll() {
-        for (Iterator i = t.rootItemIds().iterator(); i.hasNext();) {
+        for (final Iterator i = t.rootItemIds().iterator(); i.hasNext();) {
             t.collapseItemsRecursively(i.next());
         }
     }
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        String[] names = new String[100];
+        final String[] names = new String[100];
         for (int i = 0; i < names.length; i++) {
             names[i] = firstnames[(int) (Math.random() * (firstnames.length - 1))]
                     + " "
@@ -97,7 +73,7 @@ public class FeatureTree extends Feature implements Action.Handler {
         t = new Tree("Organization Structure");
         for (int i = 0; i < 100; i++) {
             t.addItem(names[i]);
-            String parent = names[(int) (Math.random() * (names.length - 1))];
+            final String parent = names[(int) (Math.random() * (names.length - 1))];
             if (t.containsId(parent)) {
                 t.setParent(names[i], parent);
             }
@@ -121,9 +97,9 @@ public class FeatureTree extends Feature implements Action.Handler {
 
         // Properties
         propertyPanel = new PropertyPanel(t);
-        Form ap = propertyPanel
+        final Form ap = propertyPanel
                 .createBeanPropertySet(new String[] { "selectable" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("menu").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("menu");
         propertyPanel.addProperties("Tree Properties", ap);
@@ -174,13 +150,13 @@ public class FeatureTree extends Feature implements Action.Handler {
         return "Tree";
     }
 
-    private Action ACTION1 = new Action("Action 1");
+    private final Action ACTION1 = new Action("Action 1");
 
-    private Action ACTION2 = new Action("Action 2");
+    private final Action ACTION2 = new Action("Action 2");
 
-    private Action ACTION3 = new Action("Action 3");
+    private final Action ACTION3 = new Action("Action 3");
 
-    private Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 };
+    private final Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 };
 
     public Action[] getActions(Object target, Object sender) {
         return actions;
index 4c5a418c9408bb051c9bae367fbb91172662d64a..2b400f138e255bf896762ac58f1eb51b99033c97 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -53,9 +29,9 @@ public class FeatureUpload extends Feature implements Upload.FinishedListener {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Upload up = new Upload("Upload", buffer);
+        final Upload up = new Upload("Upload", buffer);
         up.setImmediate(true);
         up.addListener(this);
 
index cf51e7756b36ff22056fbab26b0b85db496beaaa..6ff7e9d4475658f8e32ab000abde31432c6e2cff 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.featurebrowser;
 
 import java.text.SimpleDateFormat;
@@ -20,7 +24,7 @@ public class FeatureUtil {
         if (statistics) {
             try {
                 return format.format(new Date());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 // ignored, should never happen
             }
         }
index 49b59f528926576126c08b80543ef2698528452b..0f33ec5ad91f854ce179a08ef66aebdd7abfff43 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -56,13 +32,13 @@ public class FeatureValidators extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Panel panel = new Panel();
+        final Panel panel = new Panel();
         panel.setCaption("Validators");
         l.addComponent(panel);
 
-        Label label = new Label();
+        final Label label = new Label();
         panel.addComponent(label);
 
         label.setContentMode(Label.CONTENT_XHTML);
@@ -70,9 +46,9 @@ public class FeatureValidators extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(panel);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
index 9784e6e1ce6c87e3868abb0185522ffd13559322..7e357e0e003e5dbcfe55f219962654fb3bebedd2 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -38,9 +14,10 @@ import com.itmill.toolkit.ui.Window.CloseEvent;
 
 public class FeatureWindow extends Feature implements Window.CloseListener {
 
-    private Button addButton = new Button("Add window", this, "addWin");
+    private final Button addButton = new Button("Add window", this, "addWin");
 
-    private Button removeButton = new Button("Remove window", this, "delWin");
+    private final Button removeButton = new Button("Remove window", this,
+            "delWin");
 
     private Window demoWindow;
 
@@ -52,9 +29,9 @@ public class FeatureWindow extends Feature implements Window.CloseListener {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout layoutRoot = new OrderedLayout();
-        OrderedLayout layoutUpper = new OrderedLayout();
-        OrderedLayout layoutLower = new OrderedLayout();
+        final OrderedLayout layoutRoot = new OrderedLayout();
+        final OrderedLayout layoutUpper = new OrderedLayout();
+        final OrderedLayout layoutLower = new OrderedLayout();
 
         demoWindow = new Window("Feature Test Window");
         demoWindow.addListener(this);
index c27a2c1d607c5c16919da38bb1b1a8c9ba80ddfe..912cd2b92ed17ec66c4bdb6c30e95387fa5a2bac 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -37,7 +13,7 @@ public class FeaturesApplication extends com.itmill.toolkit.Application {
             FeatureUtil.setStatistics(true);
         }
         setUser(new Long(System.currentTimeMillis()).toString());
-        Window main = new Window("IT Mill Toolkit Features Tour");
+        final Window main = new Window("IT Mill Toolkit Features Tour");
         setMainWindow(main);
 
         main.setLayout(new FeatureBrowser());
@@ -48,7 +24,7 @@ public class FeaturesApplication extends com.itmill.toolkit.Application {
      */
     public void terminalError(
             com.itmill.toolkit.terminal.Terminal.ErrorEvent event) {
-        Throwable e = event.getThrowable();
+        final Throwable e = event.getThrowable();
         FeatureUtil.debug(getUser().toString(), "terminalError: "
                 + e.toString());
         e.printStackTrace();
index 4d29a768df9490e75c1c8a6917d9cc73de550f75..f2a42f63e3f5624b895bf01dacdab6b998f91329 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -48,13 +24,13 @@ public class IntroBasic extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Panel panel = new Panel();
+        final Panel panel = new Panel();
         panel.setCaption("Basic UI components");
         l.addComponent(panel);
 
-        Label label = new Label();
+        final Label label = new Label();
         panel.addComponent(label);
 
         label.setContentMode(Label.CONTENT_XHTML);
@@ -62,9 +38,9 @@ public class IntroBasic extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(panel);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
index dd9d9773f318e9dfa01c861c65991516a0f22b52..6a316cabc725809fa1f249db845de02c8f3645b0 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -49,13 +25,13 @@ public class IntroComponents extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Panel panel = new Panel();
+        final Panel panel = new Panel();
         panel.setCaption("UI component diagram");
         l.addComponent(panel);
 
-        Label label = new Label();
+        final Label label = new Label();
         panel.addComponent(label);
 
         label.setContentMode(Label.CONTENT_XHTML);
@@ -66,9 +42,9 @@ public class IntroComponents extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(panel);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
index 2f0321884f5f4ccc1d147b10a1e07f331f4ce970..18b7d90731c1491d6b880d1ec8958a212fa171ad 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -48,13 +24,13 @@ public class IntroDataHandling extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Panel panel = new Panel();
+        final Panel panel = new Panel();
         panel.setCaption("Data Handling");
         l.addComponent(panel);
 
-        Label label = new Label();
+        final Label label = new Label();
         panel.addComponent(label);
 
         label.setContentMode(Label.CONTENT_XHTML);
@@ -62,9 +38,9 @@ public class IntroDataHandling extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(panel);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
index 089ae73f767e7a8a5dcd9f4421de4608e023ccf1..346e23dab2afae84a78614298a8f7f2532e0a03c 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -49,13 +25,13 @@ public class IntroDataModel extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Panel panel = new Panel();
+        final Panel panel = new Panel();
         panel.setCaption("Data Model");
         l.addComponent(panel);
 
-        Label label = new Label();
+        final Label label = new Label();
         panel.addComponent(label);
 
         label.setContentMode(Label.CONTENT_XHTML);
@@ -63,9 +39,9 @@ public class IntroDataModel extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(panel);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
index 3e584120b700ef28d3f165af20e0f45fe4942ac7..368d743d9baafda062dcdc8c5e726a3d3eface6b 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -48,13 +24,13 @@ public class IntroItemContainers extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Panel panel = new Panel();
+        final Panel panel = new Panel();
         panel.setCaption("Item Containers");
         l.addComponent(panel);
 
-        Label label = new Label();
+        final Label label = new Label();
         panel.addComponent(label);
 
         label.setContentMode(Label.CONTENT_XHTML);
@@ -62,9 +38,9 @@ public class IntroItemContainers extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(panel);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
index 3c57a3c3e5f5820cfe026cf6c7b028eed5bebcba..2921a3c75a4e6727772e795ee667aa6ff1b4e6f7 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -50,13 +26,13 @@ public class IntroLayouts extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Panel panel = new Panel();
+        final Panel panel = new Panel();
         panel.setCaption("Layouts");
         l.addComponent(panel);
 
-        Label label = new Label();
+        final Label label = new Label();
         panel.addComponent(label);
 
         label.setContentMode(Label.CONTENT_XHTML);
@@ -64,9 +40,9 @@ public class IntroLayouts extends Feature {
 
         // Properties
         propertyPanel = new PropertyPanel(panel);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
index f7cad07245db3be06eb5cb9db5bdb1a2b0e84494..9e3a256c14ece17ce7803cbc1005fad8b90815eb 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -40,9 +16,9 @@ public class IntroTerminal extends Feature {
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
-        Label lab = new Label();
+        final Label lab = new Label();
         lab.setStyle("featurebrowser-none");
         l.addComponent(lab);
 
index 5421f9dc573508aef1d50b1133fcef528258825d..278ba73af1611c005b81099bd3cbb1f13c9ce56d 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -48,7 +24,7 @@ import com.itmill.toolkit.ui.Select;
 public class IntroWelcome extends Feature implements URIHandler,
         ParameterHandler {
 
-    private WebBrowser webBrowser = null;
+    private final WebBrowser webBrowser = null;
 
     Panel panel = new Panel();
 
@@ -79,7 +55,7 @@ public class IntroWelcome extends Feature implements URIHandler,
             + " located at the top right corner area.";
 
     // TODO Add browser agent string
-    private String description = WELCOME_TEXT_LOWER
+    private final String description = WELCOME_TEXT_LOWER
             + "<br /><br />IT Mill Toolkit version: "
             + ApplicationServlet.VERSION;
 
@@ -89,21 +65,21 @@ public class IntroWelcome extends Feature implements URIHandler,
 
     protected Component getDemoComponent() {
 
-        OrderedLayout l = new OrderedLayout();
+        final OrderedLayout l = new OrderedLayout();
 
         panel.setCaption("Welcome to the IT Mill Toolkit feature tour!");
         l.addComponent(panel);
 
-        Label label = new Label();
+        final Label label = new Label();
         panel.addComponent(label);
 
         label.setContentMode(Label.CONTENT_XHTML);
         label.setValue(WELCOME_TEXT_UPPER);
 
         propertyPanel = new PropertyPanel(panel);
-        Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
-                "height" });
-        Select themes = (Select) propertyPanel.getField("style");
+        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
+                "width", "height" });
+        final Select themes = (Select) propertyPanel.getField("style");
         themes.addItem("light").getItemProperty(
                 themes.getItemCaptionPropertyId()).setValue("light");
         themes.addItem("strong").getItemProperty(
@@ -179,8 +155,8 @@ public class IntroWelcome extends Feature implements URIHandler,
      * @see com.itmill.toolkit.terminal.ParameterHandler#handleParameters(Map)
      */
     public void handleParameters(Map parameters) {
-        for (Iterator i = parameters.keySet().iterator(); i.hasNext();) {
-            String name = (String) i.next();
+        for (final Iterator i = parameters.keySet().iterator(); i.hasNext();) {
+            final String name = (String) i.next();
             if (name.equals("systemStatus")) {
                 String status = "";
                 status += "timestamp=" + new Date() + " ";
index 365e34868f5c108fb2107e6e1b4ad1446e3bec01..29fb7ab02f649c210d7a147ac08502c7a436ea78 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.tests.featurebrowser;
 
@@ -65,19 +41,19 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
 
     private Select addComponent;
 
-    private OrderedLayout formsLayout = new OrderedLayout();
+    private final OrderedLayout formsLayout = new OrderedLayout();
 
-    private LinkedList forms = new LinkedList();
+    private final LinkedList forms = new LinkedList();
 
-    private Button setButton = new Button("Set", this);
+    private final Button setButton = new Button("Set", this);
 
-    private Button discardButton = new Button("Discard changes", this);
+    private final Button discardButton = new Button("Discard changes", this);
 
-    private Table allProperties = new Table();
+    private final Table allProperties = new Table();
 
-    private Object objectToConfigure;
+    private final Object objectToConfigure;
 
-    private BeanItem config;
+    private final BeanItem config;
 
     protected static final int COLUMNS = 3;
 
@@ -100,7 +76,7 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
         config = new BeanItem(objectToConfigure);
 
         // Control buttons
-        OrderedLayout buttons = new OrderedLayout(
+        final OrderedLayout buttons = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
         buttons.setMargin(false, true, true, true);
         buttons.addComponent(setButton);
@@ -141,7 +117,7 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
     public void addProperties(String propertySetCaption, Form properties) {
 
         // Create new panel containing the form
-        Panel p = new Panel();
+        final Panel p = new Panel();
         p.setCaption(propertySetCaption);
         p.setStyle("light");
         p.addComponent(properties);
@@ -166,8 +142,8 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
         allProperties.removeAllItems();
 
         // Collect demoed properties
-        HashSet listed = new HashSet();
-        for (Iterator i = forms.iterator(); i.hasNext();) {
+        final HashSet listed = new HashSet();
+        for (final Iterator i = forms.iterator(); i.hasNext();) {
             listed.addAll(((Form) i.next()).getItemPropertyIds());
         }
 
@@ -175,10 +151,10 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
         BeanInfo info;
         try {
             info = Introspector.getBeanInfo(objectToConfigure.getClass());
-        } catch (IntrospectionException e) {
+        } catch (final IntrospectionException e) {
             throw new RuntimeException(e.toString());
         }
-        PropertyDescriptor[] pd = info.getPropertyDescriptors();
+        final PropertyDescriptor[] pd = info.getPropertyDescriptors();
 
         // Fill the table
         for (int i = 0; i < pd.length; i++) {
@@ -193,9 +169,9 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
     private void addBasicComponentProperties() {
 
         // Set of properties
-        Form set = createBeanPropertySet(new String[] { "caption", "icon",
-                "componentError", "description", "enabled", "visible", "style",
-                "readOnly", "immediate" });
+        final Form set = createBeanPropertySet(new String[] { "caption",
+                "icon", "componentError", "description", "enabled", "visible",
+                "style", "readOnly", "immediate" });
 
         // Icon
         set.replaceWithSelect("icon", new Object[] { null,
@@ -206,7 +182,7 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
         Throwable sampleException;
         try {
             throw new NullPointerException("sample exception");
-        } catch (NullPointerException e) {
+        } catch (final NullPointerException e) {
             sampleException = e;
         }
         set
@@ -228,7 +204,8 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
                                 "Sample Formatted error", "Sample System Error" });
 
         // Style
-        String currentStyle = ((Component) objectToConfigure).getStyleName();
+        final String currentStyle = ((Component) objectToConfigure)
+                .getStyleName();
         if (currentStyle == null) {
             set.replaceWithSelect("style", new Object[] { null },
                     new Object[] { "Default" }).setNewItemsAllowed(true);
@@ -312,8 +289,8 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
 
     /** Add properties for selecting */
     private void addSelectProperties() {
-        Form set = createBeanPropertySet(new String[] { "newItemsAllowed",
-                "lazyLoading", "multiSelect" });
+        final Form set = createBeanPropertySet(new String[] {
+                "newItemsAllowed", "lazyLoading", "multiSelect" });
         addProperties("Select Properties", set);
 
         set.getField("multiSelect").setDescription(
@@ -344,7 +321,7 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
     private void addFieldProperties() {
         // TODO bug #211 states that setFocus works only for Button and
         // Textfield UI components
-        Form set = new Form(new GridLayout(COLUMNS, 1));
+        final Form set = new Form(new GridLayout(COLUMNS, 1));
         set.addField("focus", new Button("Focus", objectToConfigure, "focus"));
         set.getField("focus").setDescription(
                 "Focus the cursor to this field. Not all "
@@ -357,7 +334,7 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
      * container
      */
     private void addComponentContainerProperties() {
-        Form set = new Form(new OrderedLayout(
+        final Form set = new Form(new OrderedLayout(
                 OrderedLayout.ORIENTATION_VERTICAL));
 
         addComponent = new Select();
@@ -385,13 +362,13 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
                     "valueChange "
                             + ((AbstractComponent) event.getProperty())
                                     .getTag() + ", " + event.getProperty());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             // ignored, should never happen
         }
 
         // Adding components to component container
         if (event.getProperty() == addComponent) {
-            String value = (String) addComponent.getValue();
+            final String value = (String) addComponent.getValue();
 
             if (value != null) {
                 // TextField component
@@ -402,7 +379,7 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
 
                 // DateField time style
                 if (value.equals("Time")) {
-                    DateField d = new DateField("Time", new Date());
+                    final DateField d = new DateField("Time", new Date());
                     d
                             .setDescription("This is a DateField-component with text-style");
                     d.setResolution(DateField.RESOLUTION_MIN);
@@ -413,7 +390,7 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
 
                 // Date field calendar style
                 if (value.equals("Calendar")) {
-                    DateField c = new DateField("Calendar", new Date());
+                    final DateField c = new DateField("Calendar", new Date());
                     c
                             .setDescription("DateField-component with calendar-style and day-resolution");
                     c.setStyle("calendar");
@@ -424,7 +401,7 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
 
                 // Select option group style
                 if (value.equals("Option group")) {
-                    Select s = new Select("Options");
+                    final Select s = new Select("Options");
                     s.setDescription("Select-component with optiongroup-style");
                     s.addItem("Linux");
                     s.addItem("Windows");
@@ -439,10 +416,10 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
                 addComponent.setValue(null);
             }
         } else if (event.getProperty() == getField("lazyLoading")) {
-            boolean newValue = ((Boolean) event.getProperty().getValue())
+            final boolean newValue = ((Boolean) event.getProperty().getValue())
                     .booleanValue();
-            Field multiselect = getField("multiSelect");
-            Field newitems = getField("newItemsAllowed");
+            final Field multiselect = getField("multiSelect");
+            final Field newitems = getField("newItemsAllowed");
             if (newValue) {
                 newitems.setValue(Boolean.FALSE);
                 newitems.setVisible(false);
@@ -463,7 +440,7 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
                     "buttonClick " + event.getButton().getTag() + ", "
                             + event.getButton().getCaption() + ", "
                             + event.getButton().getValue());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             // ignored, should never happen
         }
         // Commit all changed on all forms
@@ -473,7 +450,7 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
 
         // Discard all changed on all forms
         if (event.getButton() == discardButton) {
-            for (Iterator i = forms.iterator(); i.hasNext();) {
+            for (final Iterator i = forms.iterator(); i.hasNext();) {
                 ((Form) i.next()).discard();
             }
         }
@@ -485,14 +462,14 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
      */
     protected Form createBeanPropertySet(String names[]) {
 
-        Form set = new Form(new OrderedLayout(
+        final Form set = new Form(new OrderedLayout(
                 OrderedLayout.ORIENTATION_VERTICAL));
 
         for (int i = 0; i < names.length; i++) {
-            Property p = config.getItemProperty(names[i]);
+            final Property p = config.getItemProperty(names[i]);
             if (p != null) {
                 set.addItemProperty(names[i], p);
-                Field f = set.getField(names[i]);
+                final Field f = set.getField(names[i]);
                 if (f instanceof TextField) {
                     if (Integer.class.equals(p.getType())) {
                         ((TextField) f).setColumns(4);
@@ -509,9 +486,9 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
 
     /** Find a field from all forms */
     public Field getField(Object propertyId) {
-        for (Iterator i = forms.iterator(); i.hasNext();) {
-            Form f = (Form) i.next();
-            Field af = f.getField(propertyId);
+        for (final Iterator i = forms.iterator(); i.hasNext();) {
+            final Form f = (Form) i.next();
+            final Field af = f.getField(propertyId);
             if (af != null) {
                 return af;
             }
@@ -524,7 +501,7 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
     }
 
     protected void commit() {
-        for (Iterator i = forms.iterator(); i.hasNext();) {
+        for (final Iterator i = forms.iterator(); i.hasNext();) {
             ((Form) i.next()).commit();
         }
     }
index a91493eb79d5515f203b8f7983a02b5498584e0b..c41bbfdc5c5f221b77e8b816d8c54eb6c676ff34 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.magi;
 
 import com.itmill.toolkit.event.Action;
@@ -55,7 +59,7 @@ public class DefaultButtonExample extends CustomComponent implements Handler {
      * buttons.
      */
     public Action[] getActions(Object target, Object sender) {
-        Action[] actions = new Action[1];
+        final Action[] actions = new Action[1];
 
         // Set the action for the requested component
         if (sender == ok) {
index 0f323043319a97e5b5119401d688d35adbd1d6ff..8400ba43b62f070491e126f239e0349ea4b5ae49 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.magi;
 
 import com.itmill.toolkit.terminal.Resource;
index 67ddb832adf19f26744b151346313c7c8ef3ef0a..fafd7ce63c76f16370eb238026879fb2873f47a7 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.magi;
 
 import java.net.URL;
@@ -63,7 +67,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
         String example;
         String param = null;
 
-        int slashPos = relativeUri.indexOf("/");
+        final int slashPos = relativeUri.indexOf("/");
         if (slashPos > 0) {
             example = relativeUri.substring(0, slashPos);
             param = relativeUri.substring(slashPos + 1);
@@ -73,22 +77,23 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
 
         /* Remove existing components and windows. */
         main.removeAllComponents();
-        Set childwindows = main.getChildWindows();
-        for (Iterator cwi = childwindows.iterator(); cwi.hasNext();) {
-            Window child = (Window) cwi.next();
+        final Set childwindows = main.getChildWindows();
+        for (final Iterator cwi = childwindows.iterator(); cwi.hasNext();) {
+            final Window child = (Window) cwi.next();
             main.removeWindow(child);
         }
         main.setLayout(new OrderedLayout());
 
         if (example.equals("index")) {
-            Object examples[] = { "defaultbutton", "label", "labelcontent",
-                    "tree", "embedded", "textfield", "textfieldvalidation",
-                    "datefield", "button", "select/select", "select/native",
-                    "select/optiongroup", "select/twincol", "filterselect",
-                    "validator", "table", "upload", "link", "gridlayout",
-                    "orderedlayout", "formlayout", "panel", "expandlayout",
-                    "tabsheet", "alignment", "alignment/grid", "window",
-                    "window/opener", "window/multiple", "classresource" };
+            final Object examples[] = { "defaultbutton", "label",
+                    "labelcontent", "tree", "embedded", "textfield",
+                    "textfieldvalidation", "datefield", "button",
+                    "select/select", "select/native", "select/optiongroup",
+                    "select/twincol", "filterselect", "validator", "table",
+                    "upload", "link", "gridlayout", "orderedlayout",
+                    "formlayout", "panel", "expandlayout", "tabsheet",
+                    "alignment", "alignment/grid", "window", "window/opener",
+                    "window/multiple", "classresource" };
             for (int i = 0; i < examples.length; i++) {
                 main.addComponent(new Label("<a href='/tk/testbench2/"
                         + examples[i] + "'>" + examples[i] + "</a>",
@@ -173,7 +178,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
 
     void example_Label(Window main, String param) {
         /* Some container for the Label. */
-        Panel panel = new Panel("Panel Containing a Label");
+        final Panel panel = new Panel("Panel Containing a Label");
         main.addComponent(panel);
 
         panel.addComponent(new Label(
@@ -183,7 +188,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
     }
 
     void example_LabelContent(Window main, String param) {
-        GridLayout labelgrid = new GridLayout(2, 1);
+        final GridLayout labelgrid = new GridLayout(2, 1);
         labelgrid.addStyleName("labelgrid");
         labelgrid.addComponent(new Label("CONTENT_DEFAULT"));
         labelgrid.addComponent(new Label(
@@ -212,7 +217,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
                 Label.CONTENT_XML));
         main.addComponent(labelgrid);
 
-        ClassResource labelimage = new ClassResource("smiley.jpg", this);
+        final ClassResource labelimage = new ClassResource("smiley.jpg", this);
         main.addComponent(new Label("Here we have an image <img src=\""
                 + getRelativeLocation(labelimage) + "\"/> within some text.",
                 Label.CONTENT_XHTML));
@@ -233,11 +238,11 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
                 new Object[] { "Neptune", "Triton", "Proteus", "Nereid",
                         "Larissa" } };
 
-        Tree tree = new Tree("The Planets and Major Moons");
+        final Tree tree = new Tree("The Planets and Major Moons");
 
         /* Add planets as root items in the tree. */
         for (int i = 0; i < planets.length; i++) {
-            String planet = (String) (planets[i][0]);
+            final String planet = (String) (planets[i][0]);
             tree.addItem(planet);
 
             if (planets[i].length == 1) {
@@ -246,7 +251,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
             } else {
                 /* Add children (moons) under the planets. */
                 for (int j = 1; j < planets[i].length; j++) {
-                    String moon = (String) planets[i][j];
+                    final String moon = (String) planets[i][j];
 
                     /* Add the item as a regular item. */
                     tree.addItem(moon);
@@ -267,22 +272,22 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
     }
 
     void example_Select(Window main, String param) {
-        OrderedLayout layout = new OrderedLayout(
+        final OrderedLayout layout = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
         layout.addStyleName("aligntop");
 
         if (param.equals("twincol")) {
-            SelectExample select1 = new SelectExample(this, param,
+            final SelectExample select1 = new SelectExample(this, param,
                     "Select some items", true);
             layout.addComponent(select1);
         } else if (param.equals("filter")) {
-            SelectExample select1 = new SelectExample(this, param,
+            final SelectExample select1 = new SelectExample(this, param,
                     "Enter containing substring", false);
             layout.addComponent(select1);
         } else {
-            SelectExample select1 = new SelectExample(this, param,
+            final SelectExample select1 = new SelectExample(this, param,
                     "Single Selection Mode", false);
-            SelectExample select2 = new SelectExample(this, param,
+            final SelectExample select2 = new SelectExample(this, param,
                     "Multiple Selection Mode", true);
             layout.addComponent(select1);
             layout.addComponent(select2);
@@ -291,7 +296,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
     }
 
     void example_FilterSelect(Window main, String param) {
-        Select select = new Select("Enter containing substring");
+        final Select select = new Select("Enter containing substring");
         main.addComponent(select);
 
         select
@@ -310,12 +315,12 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
 
     void example_TextField(Window main, String param) {
         /* Add a single-line text field. */
-        TextField subject = new TextField("Subject");
+        final TextField subject = new TextField("Subject");
         subject.setColumns(40);
         main.addComponent(subject);
 
         /* Add a multi-line text field. */
-        TextField message = new TextField("Message");
+        final TextField message = new TextField("Message");
         message.setRows(7);
         message.setColumns(40);
         main.addComponent(message);
@@ -323,7 +328,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
 
     void example_TextFieldValidation(Window main, String param) {
         // Create a text field with a label
-        TextField username = new TextField("Username");
+        final TextField username = new TextField("Username");
         main.addComponent(username);
 
         // Set visible length to 16 characters
@@ -342,7 +347,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
         username.addListener(new ValueChangeListener() {
             public void valueChange(ValueChangeEvent event) {
                 // Get the source of the event
-                TextField username = (TextField) (event.getProperty());
+                final TextField username = (TextField) (event.getProperty());
 
                 try {
                     // Validate the field value.
@@ -350,7 +355,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
 
                     // The value was ok, reset a possible error
                     username.setComponentError(null);
-                } catch (Validator.InvalidValueException e) {
+                } catch (final Validator.InvalidValueException e) {
                     // The value was not ok. Set the error.
                     username.setComponentError(new UserError(e.getMessage()));
                 }
@@ -360,7 +365,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
 
     void example_DateField(Window main, String param) {
         /* Create a DateField with the calendar style. */
-        DateField date = new DateField("Here is a calendar field");
+        final DateField date = new DateField("Here is a calendar field");
         date.setStyle("calendar");
 
         /* Set the date and time to present. */
@@ -386,14 +391,15 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
     void example_Link(Window main, String param) {
 
         /* Create a link that opens the popup window. */
-        Link alink = new Link();
+        final Link alink = new Link();
 
         /* Set the resource to be opened in the window. */
         alink.setResource(new ExternalResource("http://www.itmill.com/"));
 
         main.addComponent(alink);
 
-        ClassResource mydocument = new ClassResource("mydocument.pdf", this);
+        final ClassResource mydocument = new ClassResource("mydocument.pdf",
+                this);
         main.addComponent(new Link("The document (pdf)", mydocument));
         main.addComponent(new Link("link to a resource", new ExternalResource(
                 "http://www.itmill.com/")));
@@ -416,7 +422,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
         // Button checkbox = new Button ("This is a checkbox");
 
         // main.addComponent(checkbox);
-        Button button = new Button("My Button");
+        final Button button = new Button("My Button");
         main.addComponent(button);
     }
 
@@ -452,12 +458,12 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
     }
 
     void example_Panel(Window main, String param) {
-        Panel panel = new Panel("Contact Information");
-        OrderedLayout form = new FormLayout();
+        final Panel panel = new Panel("Contact Information");
+        final OrderedLayout form = new FormLayout();
         form.addComponent(new TextField("Name"));
         form.addComponent(new TextField("Email"));
 
-        ClassResource icon = new ClassResource("smiley.jpg", main
+        final ClassResource icon = new ClassResource("smiley.jpg", main
                 .getApplication());
         form.addComponent(new Embedded("Image", icon));
         panel.setIcon(icon);
@@ -467,7 +473,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
 
     void example_GridLayout(Window main, String param) {
         /* Create a 4 by 4 grid layout. */
-        GridLayout grid = new GridLayout(4, 4);
+        final GridLayout grid = new GridLayout(4, 4);
         grid.addStyleName("example-gridlayout");
 
         /* Fill out the first row using the cursor. */
@@ -484,7 +490,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
         /* Add some components of various shapes. */
         grid.addComponent(new Button("3x1 button"), 1, 1, 3, 1);
         grid.addComponent(new Label("1x2 cell"), 1, 2, 1, 3);
-        DateField date = new DateField("A 2x2 date field");
+        final DateField date = new DateField("A 2x2 date field");
         date.setStyle("calendar");
         grid.addComponent(date, 2, 2, 3, 3);
 
@@ -494,7 +500,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
     void example_Alignment(Window main, String param) {
         if (param.equals("grid")) {
             /* Create a 3 by 3 grid layout. */
-            GridLayout layout = new GridLayout(3, 3);
+            final GridLayout layout = new GridLayout(3, 3);
             // OrderedLayout layout = new
             // OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
             main.setLayout(layout);
@@ -530,7 +536,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
              * layout.addComponent(celllayout); }
              */
         } else {
-            Panel panel = new Panel("A Panel with a Layout");
+            final Panel panel = new Panel("A Panel with a Layout");
             main.addComponent(panel);
 
             // panel.addComponent(new )
@@ -538,7 +544,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
     }
 
     void example_OrderedLayout(Window main, String param) {
-        OrderedLayout layout = new OrderedLayout(
+        final OrderedLayout layout = new OrderedLayout(
                 OrderedLayout.ORIENTATION_VERTICAL);
         layout.addComponent(new TextField("Name"));
         layout.addComponent(new TextField("Street address"));
@@ -547,7 +553,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
     }
 
     void example_FormLayout(Window main, String param) {
-        FormLayout layout = new FormLayout();
+        final FormLayout layout = new FormLayout();
         layout.addComponent(new TextField("Name"));
         layout.addComponent(new TextField("Street address"));
         layout.addComponent(new TextField("Postal code"));
@@ -556,18 +562,18 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
 
     void example_ExpandLayout(Window main, String param) {
         for (int w = 0; w < 2; w++) {
-            ExpandLayout layout = new ExpandLayout(
+            final ExpandLayout layout = new ExpandLayout(
                     OrderedLayout.ORIENTATION_VERTICAL);
 
             /* Set the expanding layout as the root layout of a child window. */
-            Window window = new Window("A Child Window", layout);
+            final Window window = new Window("A Child Window", layout);
             main.addWindow(window);
 
             /* Add some component above the expanding one. */
             layout.addComponent(new Label("Here be some component."));
 
             /* Create the expanding component. */
-            Table table = new Table("My Ever-Expanding Table");
+            final Table table = new Table("My Ever-Expanding Table");
             /*
              * FIXME Java 5 -> 1.4 for (int i=0; i<5; i++)
              * table.addContainerProperty("col "+(i+1), Integer.class, 0); for
@@ -586,7 +592,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
             table.setWidthUnits(Table.UNITS_PERCENTAGE);
 
             /* Add some component below the expanding one. */
-            Button button2 = new Button("Ok");
+            final Button button2 = new Button("Ok");
             layout.addComponent(button2);
             layout.setComponentAlignment(button2,
                     OrderedLayout.ALIGNMENT_RIGHT, 0);
@@ -595,7 +601,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
 
     void example_TabSheet(Window main, String param) {
         if (param.equals("icon")) {
-            TabSheet tabsheet = new TabSheet();
+            final TabSheet tabsheet = new TabSheet();
 
             tabsheet.addTab(new Label("Contents of the first tab"),
                     "First Tab", new ClassResource("images/Mercury_small.png",
@@ -617,11 +623,12 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
     }
 
     void example_Embedded(Window main, String param) {
-        Embedded image = new Embedded("", new ClassResource("smiley.jpg", this));
+        final Embedded image = new Embedded("", new ClassResource("smiley.jpg",
+                this));
         image.addStyleName("omaimage");
         main.addComponent(image);
 
-        EmbeddedButton button = new EmbeddedButton(new ClassResource(
+        final EmbeddedButton button = new EmbeddedButton(new ClassResource(
                 "smiley.jpg", this));
         main.addComponent(button);
     }
@@ -632,7 +639,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
                 main.addComponent(new WindowOpener("Window Opener", main));
             } else if (param.equals("multiple")) {
                 /* Create a new window. */
-                Window mywindow = new Window("Second Window");
+                final Window mywindow = new Window("Second Window");
                 mywindow.setName("mywindow");
                 mywindow.addComponent(new Label("This is a second window."));
 
@@ -651,12 +658,12 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
         }
 
         /* Create a new window. */
-        Window mywindow = new Window("My Window");
+        final Window mywindow = new Window("My Window");
         mywindow.setName("mywindow");
 
         /* Add some components in the window. */
         mywindow.addComponent(new Label("A text label in the window."));
-        Button okbutton = new Button("OK");
+        final Button okbutton = new Button("OK");
         mywindow.addComponent(okbutton);
 
         /* Set window size. */
@@ -673,7 +680,7 @@ public class MagiTestApplication extends com.itmill.toolkit.Application {
     }
 
     void example_ClassResource(Window main, String param) {
-        DateField df = new DateField();
+        final DateField df = new DateField();
         main.addComponent(df);
         df.setIcon(new ClassResource("smiley.jpg", main.getApplication()));
         main.addComponent(new Embedded("This is Embedded", new ClassResource(
index ef8efa8d5f0838dc4faa76fa5be5c1c9d65f2914..17d2aaf0785691aca1b53f7784194b0486f25f57 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.magi;
 
 import java.io.File;
@@ -27,11 +31,11 @@ public class MyUploader extends CustomComponent implements
             try {
                 /* Open the file for writing. */
                 fos = new FileOutputStream(file);
-            } catch (java.io.FileNotFoundException e) {
+            } catch (final java.io.FileNotFoundException e) {
                 return null; /*
-                 * Error while opening the file. Not reported
-                 * here.
-                 */
+                                 * Error while opening the file. Not reported
+                                 * here.
+                                 */
             }
 
             return fos; /* Return the output stream. */
@@ -50,7 +54,7 @@ public class MyUploader extends CustomComponent implements
         uploadReceiver = new MyUploadReceiver();
 
         /* Create the Upload component. */
-        Upload upload = new Upload("Upload", uploadReceiver);
+        final Upload upload = new Upload("Upload", uploadReceiver);
 
         /* Listen for Upload.FinishedEvent events. */
         upload.addListener(this);
@@ -72,8 +76,8 @@ public class MyUploader extends CustomComponent implements
                 + " of type '" + event.getMIMEType() + "' uploaded."));
 
         /* Display the uploaded file in the image panel. */
-        FileResource imageResource = new FileResource(uploadReceiver.getFile(),
-                getApplication());
+        final FileResource imageResource = new FileResource(uploadReceiver
+                .getFile(), getApplication());
         imagePanel.removeAllComponents();
         imagePanel.addComponent(new Embedded("", imageResource));
     }
index 9333abf3693b8c325ef1ce567db50671dcb4682f..0d52da04f8480c2307ba2ecceb6e038da4b2c7a6 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.magi;
 
 import java.text.MessageFormat;
@@ -25,7 +29,7 @@ public class SSNField extends CustomComponent implements
         public boolean isValid(Object value) {
             try {
                 validate(value);
-            } catch (InvalidValueException e) {
+            } catch (final InvalidValueException e) {
                 return false;
             }
             return true;
@@ -33,13 +37,13 @@ public class SSNField extends CustomComponent implements
 
         /** Validate the given SSN. */
         public void validate(Object value) throws InvalidValueException {
-            String ssn = (String) value;
+            final String ssn = (String) value;
             if (ssn.length() != 11) {
                 throw new InvalidValueException("Invalid SSN length");
             }
 
-            String numbers = ssn.substring(0, 6) + ssn.substring(7, 10);
-            int checksum = new Integer(numbers).intValue() % 31;
+            final String numbers = ssn.substring(0, 6) + ssn.substring(7, 10);
+            final int checksum = new Integer(numbers).intValue() % 31;
             if (!ssn.substring(10).equals(
                     "0123456789ABCDEFHJKLMNPRSTUVWXY".substring(checksum,
                             checksum + 1))) {
@@ -58,7 +62,7 @@ public class SSNField extends CustomComponent implements
         myfield.setFormat(new MessageFormat("{0,number,##}"));
 
         /* Create and set the validator object for the field. */
-        SSNValidator ssnvalidator = new SSNValidator();
+        final SSNValidator ssnvalidator = new SSNValidator();
         myfield.addValidator(ssnvalidator);
 
         /*
@@ -85,7 +89,7 @@ public class SSNField extends CustomComponent implements
             /* The value was correct. */
             myerror.setValue("Ok");
             myfield.setStyle("");
-        } catch (Validator.InvalidValueException e) {
+        } catch (final Validator.InvalidValueException e) {
             /* Report the error message to the user. */
             myerror.setValue(e.getMessage());
 
index 112f1c9c77c48d87f651c892b386804261c8a0cc..9571b3a066ab1d37de02935509d158a97ac81f63 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.magi;
 
 import com.itmill.toolkit.Application;
index 200b123db405faf0d9bc0b2ba57b79b52a76509c..a19ac56d152310403ee5f07d28e24e54c6a61dda 100644 (file)
@@ -1,53 +1,64 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.magi;
-import com.itmill.toolkit.ui.*;
+
+import com.itmill.toolkit.ui.Button;
+import com.itmill.toolkit.ui.CustomComponent;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.TabSheet;
 import com.itmill.toolkit.ui.Button.ClickEvent;
 import com.itmill.toolkit.ui.TabSheet.SelectedTabChangeEvent;
 
-public class TabSheetExample extends CustomComponent implements Button.ClickListener, TabSheet.SelectedTabChangeListener {
-       TabSheet tabsheet = new TabSheet();
-       Button tab1 = new Button("Push this button");
-       Label  tab2 = new Label("Contents of Second Tab");
-       Label  tab3 = new Label("Contents of Third Tab");
-       
-       TabSheetExample () {
-               setCompositionRoot (tabsheet);
-
-               /* Listen for changes in tab selection. */
-               tabsheet.addListener(this);
-
-               /* First tab contains a button, for which we listen button click events. */
-               tab1.addListener(this);
-               tabsheet.addTab(tab1, "First Tab", null);
-
-               /* A tab that is initially invisible. */
-               tab2.setVisible(false);
-               tabsheet.addTab(tab2, "Second Tab", null);
-               
-               /* A tab that is initially disabled. */
-               tab3.setEnabled(false);
-               tabsheet.addTab(tab3, "Third tab", null);
-       }
-
-       public void buttonClick(ClickEvent event) {
-               /* Enable the invisible and disabled tabs. */
-               tab2.setVisible(true);
-               tab3.setEnabled(true);
-               
-               /* Change selection automatically to second tab. */
-               tabsheet.setSelectedTab(tab2);
-       }
-
-       public void selectedTabChange(SelectedTabChangeEvent event) {
-               /* Cast to a TabSheet. This isn't really necessary in this example,
-                * as we have only one TabSheet component, but would be useful if
-                * there were multiple TabSheets. */
-               TabSheet source = (TabSheet) event.getSource();
-               if (source == tabsheet) {
-                       /* If the first tab was selected. */
-                       if (source.getSelectedTab() == tab1) {
-                               tab2.setVisible(false);
-                               tab3.setEnabled(false);
-                       }
-               }
-       }
+public class TabSheetExample extends CustomComponent implements
+        Button.ClickListener, TabSheet.SelectedTabChangeListener {
+    TabSheet tabsheet = new TabSheet();
+    Button tab1 = new Button("Push this button");
+    Label tab2 = new Label("Contents of Second Tab");
+    Label tab3 = new Label("Contents of Third Tab");
+
+    TabSheetExample() {
+        setCompositionRoot(tabsheet);
+
+        /* Listen for changes in tab selection. */
+        tabsheet.addListener(this);
+
+        /* First tab contains a button, for which we listen button click events. */
+        tab1.addListener(this);
+        tabsheet.addTab(tab1, "First Tab", null);
+
+        /* A tab that is initially invisible. */
+        tab2.setVisible(false);
+        tabsheet.addTab(tab2, "Second Tab", null);
+
+        /* A tab that is initially disabled. */
+        tab3.setEnabled(false);
+        tabsheet.addTab(tab3, "Third tab", null);
+    }
+
+    public void buttonClick(ClickEvent event) {
+        /* Enable the invisible and disabled tabs. */
+        tab2.setVisible(true);
+        tab3.setEnabled(true);
+
+        /* Change selection automatically to second tab. */
+        tabsheet.setSelectedTab(tab2);
+    }
+
+    public void selectedTabChange(SelectedTabChangeEvent event) {
+        /*
+         * Cast to a TabSheet. This isn't really necessary in this example, as
+         * we have only one TabSheet component, but would be useful if there
+         * were multiple TabSheets.
+         */
+        final TabSheet source = (TabSheet) event.getSource();
+        if (source == tabsheet) {
+            /* If the first tab was selected. */
+            if (source.getSelectedTab() == tab1) {
+                tab2.setVisible(false);
+                tab3.setEnabled(false);
+            }
+        }
+    }
 }
index 989fc863ccae9cd03638d9e7b972871cc75c156b..ab896f44467bead0e90de128c837d9c91cd44fff 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.magi;
 
 import com.itmill.toolkit.ui.CustomComponent;
index 4f41e2ddde5340881d023ee4d5fd553116943b81..877b35cf03d5828097850ca880049e1d9278782d 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.magi;
 
 import com.itmill.toolkit.ui.Button;
index 64962b2260161bd618edf9d660e69fc783926a33..627e472c63f87ec82fbba27c5bd13b2133bf0b3b 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.magi;
 
 import com.itmill.toolkit.ui.AbstractComponentContainer;
index b4604df8730396bd2051c7ccc317c09f2188cb7e..316907f819d82e639c4e6507e5fdd76481cac85f 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.magi;
 
 import com.itmill.toolkit.ui.AbstractComponentContainer;
index a5280efb7f0fec53e4b746c9e9ba05dba9ab8ec5..a3256711e879fa3faa391f37aa12b7f02d71d2b4 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.magi;
 
 import com.itmill.toolkit.ui.AbstractComponentContainer;
index c38dbfc9a60e441c0ab9388450aba9eb5225c360..ca33aa49ab56693d9dc95c9ac8a450f2a4e4a40c 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.magi;
 
 import com.itmill.toolkit.ui.Button;
@@ -20,7 +24,7 @@ public class WindowOpener extends CustomComponent implements
         mainwindow = main;
 
         /* The component consists of a button that opens the window. */
-        OrderedLayout layout = new OrderedLayout();
+        final OrderedLayout layout = new OrderedLayout();
         layout.addComponent(openbutton = new Button("Open Window", this,
                 "openButtonClick"));
         layout.addComponent(explanation = new Label("Explanation"));
index 35373cfabb8460fa936a79921f013a51b37856e7..486a5270b7c4feeaa0329a92d9fa3e8d55dbc18e 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.testbench;
 
 import java.io.File;
@@ -56,9 +60,10 @@ public class TestBench extends com.itmill.toolkit.Application implements
         for (int p = 0; p < testablePackages.length; p++) {
             testables.addItem(testablePackages[p]);
             try {
-                List testableClasses = getTestableClassesForPackage(testablePackages[p]);
-                for (Iterator it = testableClasses.iterator(); it.hasNext();) {
-                    Class t = (Class) it.next();
+                final List testableClasses = getTestableClassesForPackage(testablePackages[p]);
+                for (final Iterator it = testableClasses.iterator(); it
+                        .hasNext();) {
+                    final Class t = (Class) it.next();
                     // ignore TestBench itself
                     if (t.equals(TestBench.class)) {
                         continue;
@@ -68,32 +73,32 @@ public class TestBench extends com.itmill.toolkit.Application implements
                         itemCaptions.put(t, t.getName());
                         testables.setParent(t, testablePackages[p]);
                         continue;
-                    } catch (Exception e) {
+                    } catch (final Exception e) {
                         try {
                             testables.addItem(t);
                             itemCaptions.put(t, t.getName());
                             testables.setParent(t, testablePackages[p]);
                             continue;
-                        } catch (Exception e1) {
+                        } catch (final Exception e1) {
                             e1.printStackTrace();
                         }
                     }
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 e.printStackTrace();
             }
         }
 
         menu = new Tree("Testables", testables);
-        for (Iterator i = itemCaptions.keySet().iterator(); i.hasNext();) {
-            Class testable = (Class) i.next();
+        for (final Iterator i = itemCaptions.keySet().iterator(); i.hasNext();) {
+            final Class testable = (Class) i.next();
             // simplify captions
-            String name = testable.getName().substring(
+            final String name = testable.getName().substring(
                     testable.getName().lastIndexOf('.') + 1);
             menu.setItemCaption(testable, name);
         }
         // expand all root items
-        for (Iterator i = menu.rootItemIds().iterator(); i.hasNext();) {
+        for (final Iterator i = menu.rootItemIds().iterator(); i.hasNext();) {
             menu.expandItemsRecursively(i.next());
         }
 
@@ -118,14 +123,14 @@ public class TestBench extends com.itmill.toolkit.Application implements
 
     private Component createTestable(Class c) {
         try {
-            Application app = (Application) c.newInstance();
+            final Application app = (Application) c.newInstance();
             app.init();
             return app.getMainWindow().getLayout();
-        } catch (Exception e) {
+        } catch (final Exception e) {
             try {
-                CustomComponent cc = (CustomComponent) c.newInstance();
+                final CustomComponent cc = (CustomComponent) c.newInstance();
                 return cc;
-            } catch (Exception e1) {
+            } catch (final Exception e1) {
                 e1.printStackTrace();
                 return new Label("Cannot create custom component: "
                         + e1.toString());
@@ -138,10 +143,10 @@ public class TestBench extends com.itmill.toolkit.Application implements
         bodyLayout.removeAllComponents();
         bodyLayout.setCaption(null);
 
-        Object o = menu.getValue();
+        final Object o = menu.getValue();
         if (o != null && o instanceof Class) {
-            Class c = (Class) o;
-            String title = c.getName();
+            final Class c = (Class) o;
+            final String title = c.getName();
             bodyLayout.setCaption(title);
             bodyLayout.addComponent(createTestable(c));
         } else {
@@ -160,38 +165,39 @@ public class TestBench extends com.itmill.toolkit.Application implements
      */
     public static List getTestableClassesForPackage(String packageName)
             throws Exception {
-        ArrayList directories = new ArrayList();
+        final ArrayList directories = new ArrayList();
         try {
-            ClassLoader cld = Thread.currentThread().getContextClassLoader();
+            final ClassLoader cld = Thread.currentThread()
+                    .getContextClassLoader();
             if (cld == null) {
                 throw new ClassNotFoundException("Can't get class loader.");
             }
-            String path = packageName.replace('.', '/');
+            final String path = packageName.replace('.', '/');
             // Ask for all resources for the path
-            Enumeration resources = cld.getResources(path);
+            final Enumeration resources = cld.getResources(path);
             while (resources.hasMoreElements()) {
-                URL url = (URL) resources.nextElement();
+                final URL url = (URL) resources.nextElement();
                 directories.add(new File(url.getFile()));
             }
-        } catch (Exception x) {
+        } catch (final Exception x) {
             throw new Exception(packageName
                     + " does not appear to be a valid package.");
         }
 
-        ArrayList classes = new ArrayList();
+        final ArrayList classes = new ArrayList();
         // For every directory identified capture all the .class files
-        for (Iterator it = directories.iterator(); it.hasNext();) {
-            File directory = (File) it.next();
+        for (final Iterator it = directories.iterator(); it.hasNext();) {
+            final File directory = (File) it.next();
             if (directory.exists()) {
                 // Get the list of the files contained in the package
-                String[] files = directory.list();
+                final String[] files = directory.list();
                 for (int j = 0; j < files.length; j++) {
                     // we are only interested in .class files
                     if (files[j].endsWith(".class")) {
                         // removes the .class extension
-                        String p = packageName + '.'
+                        final String p = packageName + '.'
                                 + files[j].substring(0, files[j].length() - 6);
-                        Class c = Class.forName(p);
+                        final Class c = Class.forName(p);
                         if (c.getSuperclass() != null) {
                             if ((c.getSuperclass()
                                     .equals(com.itmill.toolkit.ui.CustomComponent.class))) {
index 858ddaa29b771ef59082ff177e822ea20aa60aa1..3cdde28e707359fa2d966dfce4aa0846f4111e1c 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.testbench;
 
 import com.itmill.toolkit.ui.Button;
@@ -10,18 +14,18 @@ public class TestForAlignments extends CustomComponent {
 
     public TestForAlignments() {
 
-        OrderedLayout main = new OrderedLayout();
+        final OrderedLayout main = new OrderedLayout();
 
-        Button b1 = new Button("Right");
-        Button b2 = new Button("Left");
-        Button b3 = new Button("Bottom");
-        Button b4 = new Button("Top");
-        TextField t1 = new TextField("Right aligned");
-        TextField t2 = new TextField("Bottom aligned");
-        DateField d1 = new DateField("Center aligned");
-        DateField d2 = new DateField("Center aligned");
+        final Button b1 = new Button("Right");
+        final Button b2 = new Button("Left");
+        final Button b3 = new Button("Bottom");
+        final Button b4 = new Button("Top");
+        final TextField t1 = new TextField("Right aligned");
+        final TextField t2 = new TextField("Bottom aligned");
+        final DateField d1 = new DateField("Center aligned");
+        final DateField d2 = new DateField("Center aligned");
 
-        OrderedLayout vert = new OrderedLayout();
+        final OrderedLayout vert = new OrderedLayout();
         vert.addComponent(b1);
         vert.addComponent(b2);
         vert.addComponent(t1);
@@ -36,7 +40,7 @@ public class TestForAlignments extends CustomComponent {
         vert.setComponentAlignment(d1,
                 OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER,
                 OrderedLayout.ALIGNMENT_TOP);
-        OrderedLayout hori = new OrderedLayout(
+        final OrderedLayout hori = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
         hori.addComponent(b3);
         hori.addComponent(b4);
index 822c408be1615f3edf8ec41bc344a1c1854f12e6..171a262dcce06b01b49cafc9e4ac01163f2662ca 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.tests.testbench;\r
 \r
 import java.sql.SQLException;\r
@@ -21,9 +25,9 @@ import com.itmill.toolkit.ui.Button.ClickListener;
 \r
 public class TestForBasicApplicationLayout extends CustomComponent {\r
 \r
-    private Button click;\r
-    private Button click2;\r
-    private TabSheet tab;\r
+    private final Button click;\r
+    private final Button click2;\r
+    private final TabSheet tab;\r
 \r
     // Database provided with sample data\r
     private SampleDatabase sampleDatabase;\r
@@ -47,26 +51,27 @@ public class TestForBasicApplicationLayout extends CustomComponent {
 \r
         });\r
 \r
-        SplitPanel sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);\r
+        final SplitPanel sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);\r
         sp.setSplitPosition(290, Sizeable.UNITS_PIXELS);\r
 \r
-        SplitPanel sp2 = new SplitPanel(SplitPanel.ORIENTATION_VERTICAL);\r
+        final SplitPanel sp2 = new SplitPanel(SplitPanel.ORIENTATION_VERTICAL);\r
         sp2.setSplitPosition(255, Sizeable.UNITS_PIXELS);\r
 \r
-        Panel p = new Panel("Accordion Panel");\r
+        final Panel p = new Panel("Accordion Panel");\r
         p.setSizeFull();\r
 \r
         tab = new TabSheet();\r
         tab.setSizeFull();\r
 \r
-        Panel report = new Panel("Monthly Program Runs", new ExpandLayout());\r
-        OrderedLayout controls = new OrderedLayout();\r
+        final Panel report = new Panel("Monthly Program Runs",\r
+                new ExpandLayout());\r
+        final OrderedLayout controls = new OrderedLayout();\r
         controls.setMargin(true);\r
         controls.addComponent(new Label("Report tab"));\r
         controls.addComponent(click);\r
         controls.addComponent(click2);\r
         report.addComponent(controls);\r
-        DateField cal = new DateField();\r
+        final DateField cal = new DateField();\r
         cal.setResolution(DateField.RESOLUTION_DAY);\r
         cal.setLocale(new Locale("en", "US"));\r
         report.addComponent(cal);\r
@@ -77,14 +82,14 @@ public class TestForBasicApplicationLayout extends CustomComponent {
 \r
         sp2.setFirstComponent(report);\r
 \r
-        Table table = new Table();\r
+        final Table table = new Table();\r
         // populate Toolkit table component with test SQL table rows\r
         try {\r
             sampleDatabase = new SampleDatabase();\r
-            QueryContainer qc = new QueryContainer("SELECT * FROM employee",\r
-                    sampleDatabase.getConnection());\r
+            final QueryContainer qc = new QueryContainer(\r
+                    "SELECT * FROM employee", sampleDatabase.getConnection());\r
             table.setContainerDataSource(qc);\r
-        } catch (SQLException e) {\r
+        } catch (final SQLException e) {\r
             e.printStackTrace();\r
         }\r
         // define which columns should be visible on Table component\r
index 93320ee0d8c84d9a68727a0371a9db33ba0466d1..73b93dc20c4a531c418f643afcdcab6b087a63c5 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.testbench;
 
 import com.itmill.toolkit.data.util.IndexedContainer;
@@ -30,13 +34,13 @@ public class TestForContainerFilterable extends CustomComponent {
         ic.addContainerProperty("first", String.class, "");
         ic.addContainerProperty("second", String.class, "");
         for (int i = 0; i < 1000; i++) {
-            Object id = ic.addItem();
+            final Object id = ic.addItem();
             ic.getContainerProperty(id, "first").setValue(randomWord());
             ic.getContainerProperty(id, "second").setValue(randomWord());
         }
 
         // Init filtering view
-        Panel filterPanel = new Panel("Filter", new OrderedLayout(
+        final Panel filterPanel = new Panel("Filter", new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL));
         filterPanel.setWidth(100);
         filterPanel.setWidthUnits(Sizeable.UNITS_PERCENTAGE);
@@ -62,12 +66,12 @@ public class TestForContainerFilterable extends CustomComponent {
             public void buttonClick(ClickEvent event) {
                 ic.removeAllContainerFilters();
                 if (firstFilter.toString().length() > 0) {
-                    ic.addContainerFilter("first", firstFilter.toString(), false,
-                            false);
+                    ic.addContainerFilter("first", firstFilter.toString(),
+                            false, false);
                 }
                 if (secondFilter.toString().length() > 0) {
-                    ic.addContainerFilter("second", secondFilter.toString(), true,
-                            true);
+                    ic.addContainerFilter("second", secondFilter.toString(),
+                            true, true);
                 }
                 count.setValue("Rows in table: " + ic.size());
             }
@@ -84,7 +88,7 @@ public class TestForContainerFilterable extends CustomComponent {
 
     private String randomWord() {
         int len = (int) (Math.random() * 4);
-        StringBuffer buf = new StringBuffer();
+        final StringBuffer buf = new StringBuffer();
         while (len-- >= 0) {
             buf.append(parts[(int) (Math.random() * parts.length)]);
         }
index a4649bbb18dcdec4eca00fa60ab4e8886af15958..0bfcab513ac1afe9b0b88ba4b52e2f891e2a6745 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.testbench;
 
 import java.util.ArrayList;
@@ -63,19 +67,19 @@ public class TestForMultipleStyleNames extends CustomComponent implements
 
     public void valueChange(ValueChangeEvent event) {
 
-        String currentStyle = l.getStyle();
-        String[] tmp = currentStyle.split(" ");
-        ArrayList curStyles = new ArrayList();
+        final String currentStyle = l.getStyle();
+        final String[] tmp = currentStyle.split(" ");
+        final ArrayList curStyles = new ArrayList();
         for (int i = 0; i < tmp.length; i++) {
             if (tmp[i] != "") {
                 curStyles.add(tmp[i]);
             }
         }
 
-        Collection styles = (Collection) s.getValue();
+        final Collection styles = (Collection) s.getValue();
 
-        for (Iterator iterator = styles.iterator(); iterator.hasNext();) {
-            String styleName = (String) iterator.next();
+        for (final Iterator iterator = styles.iterator(); iterator.hasNext();) {
+            final String styleName = (String) iterator.next();
             if (curStyles.contains(styleName)) {
                 // already added
                 curStyles.remove(styleName);
@@ -83,8 +87,9 @@ public class TestForMultipleStyleNames extends CustomComponent implements
                 l.addStyleName(styleName);
             }
         }
-        for (Iterator iterator2 = curStyles.iterator(); iterator2.hasNext();) {
-            String object = (String) iterator2.next();
+        for (final Iterator iterator2 = curStyles.iterator(); iterator2
+                .hasNext();) {
+            final String object = (String) iterator2.next();
             l.removeStyleName(object);
         }
     }
index 99ca0e3089ca9cd65ccbffe36bfe480ed78fed6b..7ab15d7360fea9d4d473c35c8d32ac96edfdf90c 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.testbench;
 
 import com.itmill.toolkit.event.Action;
@@ -87,14 +91,14 @@ public class TestForPreconfiguredComponents extends CustomComponent implements
                 .setCaption("OptionGroup + multiselect manually (configured from select)");
         main.addComponent(test);
 
-        Button b = new Button("refresh view", this, "createNewView");
+        final Button b = new Button("refresh view", this, "createNewView");
         main.addComponent(b);
 
     }
 
     public static void fillSelect(AbstractSelect s, int items) {
         for (int i = 0; i < items; i++) {
-            String name = firstnames[(int) (Math.random() * (firstnames.length - 1))]
+            final String name = firstnames[(int) (Math.random() * (firstnames.length - 1))]
                     + " "
                     + lastnames[(int) (Math.random() * (lastnames.length - 1))];
             s.addItem(name);
@@ -103,7 +107,7 @@ public class TestForPreconfiguredComponents extends CustomComponent implements
 
     public Tree createTestTree() {
         Tree t = new Tree("Tree");
-        String[] names = new String[100];
+        final String[] names = new String[100];
         for (int i = 0; i < names.length; i++) {
             names[i] = firstnames[(int) (Math.random() * (firstnames.length - 1))]
                     + " "
@@ -114,7 +118,7 @@ public class TestForPreconfiguredComponents extends CustomComponent implements
         t = new Tree("Organization Structure");
         for (int i = 0; i < 100; i++) {
             t.addItem(names[i]);
-            String parent = names[(int) (Math.random() * (names.length - 1))];
+            final String parent = names[(int) (Math.random() * (names.length - 1))];
             if (t.containsId(parent)) {
                 t.setParent(names[i], parent);
             }
@@ -130,7 +134,7 @@ public class TestForPreconfiguredComponents extends CustomComponent implements
     }
 
     public Panel createTestBench(Component t) {
-        Panel ol = new Panel();
+        final Panel ol = new Panel();
         ol.setLayout(new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL));
 
         ol.addComponent(t);
index ebefb888c98994de5d2eac787019cbb828084c52..d7c1ca0c93a2b7ea17a2f87a6642ca3a0d66828e 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.testbench;
 
 import com.itmill.toolkit.data.Property.ValueChangeEvent;
@@ -15,7 +19,7 @@ import com.itmill.toolkit.ui.RichTextArea;
 public class TestForRichTextEditor extends CustomComponent implements
         ValueChangeListener {
 
-    private OrderedLayout main = new OrderedLayout();
+    private final OrderedLayout main = new OrderedLayout();
 
     private Label l;
 
index cf89b2c27bf16bd15654ac4abf5420b5789517dc..71884144dbfed5d1333ce3b53d60d67ebda6bae3 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.testbench;
 
 import com.itmill.toolkit.event.Action;
@@ -26,9 +30,9 @@ public class TestForTrees extends CustomComponent implements Handler {
             "Smith", "Jones", "Beck", "Sheridan", "Picard", "Hill", "Fielding",
             "Einstein" };
 
-    private OrderedLayout main = new OrderedLayout();
+    private final OrderedLayout main = new OrderedLayout();
 
-    private Action[] actions = new Action[] { new Action("edit"),
+    private final Action[] actions = new Action[] { new Action("edit"),
             new Action("delete") };
 
     private Panel al;
@@ -75,20 +79,20 @@ public class TestForTrees extends CustomComponent implements Handler {
         t.setCaption("with actions");
         t.setImmediate(true);
         t.addActionHandler(this);
-        OrderedLayout ol = (OrderedLayout) createTestBench(t);
+        final OrderedLayout ol = (OrderedLayout) createTestBench(t);
         al = new Panel("action log");
         ol.addComponent(al);
         main.addComponent(ol);
         contextTree = t;
 
-        Button b = new Button("refresh view", this, "createNewView");
+        final Button b = new Button("refresh view", this, "createNewView");
         main.addComponent(b);
 
     }
 
     public Tree createTestTree() {
         Tree t = new Tree("Tree");
-        String[] names = new String[100];
+        final String[] names = new String[100];
         for (int i = 0; i < names.length; i++) {
             names[i] = firstnames[(int) (Math.random() * (firstnames.length - 1))]
                     + " "
@@ -99,7 +103,7 @@ public class TestForTrees extends CustomComponent implements Handler {
         t = new Tree("Organization Structure");
         for (int i = 0; i < 100; i++) {
             t.addItem(names[i]);
-            String parent = names[(int) (Math.random() * (names.length - 1))];
+            final String parent = names[(int) (Math.random() * (names.length - 1))];
             if (t.containsId(parent)) {
                 t.setParent(names[i], parent);
             }
@@ -115,7 +119,7 @@ public class TestForTrees extends CustomComponent implements Handler {
     }
 
     public Component createTestBench(Tree t) {
-        OrderedLayout ol = new OrderedLayout();
+        final OrderedLayout ol = new OrderedLayout();
         ol.setOrientation(OrderedLayout.ORIENTATION_HORIZONTAL);
 
         ol.addComponent(t);
index 2e6c5d4e297c9329574b6b5bb96c0b084ca8f3f9..0a873631f394b9fd554ac09bc1c59cb25af00a01 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.testbench;
 
 import java.io.ByteArrayInputStream;
@@ -78,9 +82,9 @@ public class TestForUpload extends CustomComponent implements
 
         up.setProgressListener(this);
 
-        Button b = new Button("b", this, "readState");
+        final Button b = new Button("b", this, "readState");
 
-        Button c = new Button("b with gc", this, "gc");
+        final Button c = new Button("b with gc", this, "gc");
 
         main.addComponent(b);
         main.addComponent(c);
@@ -112,7 +116,7 @@ public class TestForUpload extends CustomComponent implements
         status.setVisible(false);
         main.addComponent(status);
 
-        Button restart = new Button("R");
+        final Button restart = new Button("R");
         restart.addListener(new Button.ClickListener() {
 
             public void buttonClick(ClickEvent event) {
@@ -124,7 +128,7 @@ public class TestForUpload extends CustomComponent implements
     }
 
     private void setBuffer() {
-        String id = (String) uploadBufferSelector.getValue();
+        final String id = (String) uploadBufferSelector.getValue();
         if ("memory".equals(id)) {
             buffer = new MemoryBuffer();
         } else if ("tempfile".equals(id)) {
@@ -139,7 +143,7 @@ public class TestForUpload extends CustomComponent implements
     }
 
     public void readState() {
-        StringBuffer sb = new StringBuffer();
+        final StringBuffer sb = new StringBuffer();
 
         if (up.isUploading()) {
             sb.append("Uploading...");
@@ -159,7 +163,7 @@ public class TestForUpload extends CustomComponent implements
 
     public void uploadFinished(FinishedEvent event) {
         status.removeAllComponents();
-        InputStream stream = buffer.getStream();
+        final InputStream stream = buffer.getStream();
         if (stream == null) {
             status.addComponent(new Label(
                     "Upload finished, but output buffer is null!!"));
@@ -245,11 +249,11 @@ public class TestForUpload extends CustomComponent implements
         private FileInputStream stream;
 
         public TmpFileBuffer() {
-            String tempFileName = "upload_tmpfile_"
+            final String tempFileName = "upload_tmpfile_"
                     + System.currentTimeMillis();
             try {
                 file = File.createTempFile(tempFileName, null);
-            } catch (IOException e) {
+            } catch (final IOException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
             }
@@ -262,7 +266,7 @@ public class TestForUpload extends CustomComponent implements
             }
             try {
                 return new FileInputStream(file);
-            } catch (FileNotFoundException e) {
+            } catch (final FileNotFoundException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
             }
@@ -278,7 +282,7 @@ public class TestForUpload extends CustomComponent implements
             mimeType = MIMEType;
             try {
                 return new FileOutputStream(file);
-            } catch (FileNotFoundException e) {
+            } catch (final FileNotFoundException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
             }
index b8f94e13d7a756db69623f9a6a259d91cca3b4e5..3e9b31a1c9fe92dc02aa2d46293fdb0c4305a189 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.testbench;
 
 import com.itmill.toolkit.terminal.ExternalResource;
@@ -10,14 +14,14 @@ public class TestForWindowOpen extends CustomComponent {
 
     public TestForWindowOpen() {
 
-        OrderedLayout main = new OrderedLayout();
+        final OrderedLayout main = new OrderedLayout();
         setCompositionRoot(main);
 
         main.addComponent(new Button("Open in this window",
                 new Button.ClickListener() {
 
                     public void buttonClick(ClickEvent event) {
-                        ExternalResource r = new ExternalResource(
+                        final ExternalResource r = new ExternalResource(
                                 "http://www.google.com");
                         getApplication().getMainWindow().open(r);
 
@@ -29,7 +33,7 @@ public class TestForWindowOpen extends CustomComponent {
                 new Button.ClickListener() {
 
                     public void buttonClick(ClickEvent event) {
-                        ExternalResource r = new ExternalResource(
+                        final ExternalResource r = new ExternalResource(
                                 "http://www.google.com");
                         getApplication().getMainWindow().open(r, "mytarget");
 
@@ -41,7 +45,7 @@ public class TestForWindowOpen extends CustomComponent {
                 new Button.ClickListener() {
 
                     public void buttonClick(ClickEvent event) {
-                        ExternalResource r = new ExternalResource(
+                        final ExternalResource r = new ExternalResource(
                                 "http://www.google.com");
                         getApplication().getMainWindow()
                                 .open(r, "secondtarget");
index eec366b578b0ffec139145e633c275141ba08c62..2ed29d78006db1d75a98672c341fc89046a24d56 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.testbench;
 
 import com.itmill.toolkit.data.Property.ValueChangeEvent;
@@ -20,60 +24,62 @@ public class TestForWindowing extends CustomComponent {
 
     public TestForWindowing() {
 
-        OrderedLayout main = new OrderedLayout();
+        final OrderedLayout main = new OrderedLayout();
 
         main.addComponent(new Label(
                 "Click the button to create a new inline window."));
 
-        Button create = new Button("Create a new window", new ClickListener() {
+        final Button create = new Button("Create a new window",
+                new ClickListener() {
 
-            public void buttonClick(ClickEvent event) {
-                Window w = new Window("Testing Window");
+                    public void buttonClick(ClickEvent event) {
+                        Window w = new Window("Testing Window");
 
-                AbstractSelect s1 = new OptionGroup();
-                s1.setCaption("1. Select output format");
-                s1.addItem("Excel sheet");
-                s1.addItem("CSV plain text");
-                s1.setValue("Excel sheet");
+                        AbstractSelect s1 = new OptionGroup();
+                        s1.setCaption("1. Select output format");
+                        s1.addItem("Excel sheet");
+                        s1.addItem("CSV plain text");
+                        s1.setValue("Excel sheet");
 
-                s2 = new Select();
-                s2.addItem("Separate by comma (,)");
-                s2.addItem("Separate by colon (:)");
-                s2.addItem("Separate by semicolon (;)");
-                s2.setEnabled(false);
+                        s2 = new Select();
+                        s2.addItem("Separate by comma (,)");
+                        s2.addItem("Separate by colon (:)");
+                        s2.addItem("Separate by semicolon (;)");
+                        s2.setEnabled(false);
 
-                s1.addListener(new ValueChangeListener() {
+                        s1.addListener(new ValueChangeListener() {
 
-                    public void valueChange(ValueChangeEvent event) {
-                        String v = (String) event.getProperty().getValue();
-                        if (v.equals("CSV plain text")) {
-                            s2.setEnabled(true);
-                        } else {
-                            s2.setEnabled(false);
-                        }
-                    }
+                            public void valueChange(ValueChangeEvent event) {
+                                String v = (String) event.getProperty()
+                                        .getValue();
+                                if (v.equals("CSV plain text")) {
+                                    s2.setEnabled(true);
+                                } else {
+                                    s2.setEnabled(false);
+                                }
+                            }
 
-                });
+                        });
 
-                w.addComponent(s1);
-                w.addComponent(s2);
+                        w.addComponent(s1);
+                        w.addComponent(s2);
 
-                Slider s = new Slider();
-                s.setCaption("Volume");
-                s.setMax(13);
-                s.setMin(12);
-                s.setResolution(2);
-                s.setImmediate(true);
-                // s.setOrientation(Slider.ORIENTATION_VERTICAL);
-                // s.setArrows(false);
+                        Slider s = new Slider();
+                        s.setCaption("Volume");
+                        s.setMax(13);
+                        s.setMin(12);
+                        s.setResolution(2);
+                        s.setImmediate(true);
+                        // s.setOrientation(Slider.ORIENTATION_VERTICAL);
+                        // s.setArrows(false);
 
-                w.addComponent(s);
+                        w.addComponent(s);
 
-                getApplication().getMainWindow().addWindow(w);
+                        getApplication().getMainWindow().addWindow(w);
 
-            }
+                    }
 
-        });
+                });
 
         main.addComponent(create);
 
index 2c6da7a26a33f676d70a35fecd3f570f67820c10..0a02a86f39917efee9471ce3cdb9770248a2dca3 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.testbench;
 
 import com.itmill.toolkit.ui.Button;
@@ -18,7 +22,7 @@ public class TestSetVisibleAndCaching extends com.itmill.toolkit.Application {
     int selectedPanel = 0;
 
     public void init() {
-        Window mainWindow = new Window("TestSetVisibleAndCaching");
+        final Window mainWindow = new Window("TestSetVisibleAndCaching");
         setMainWindow(mainWindow);
 
         panelA.addComponent(new Label(
index a4234cdcf58089c62b1a8f05d1a96834e7158345..4fbee14c6063ce3d96c4fb2dc89eb3842e0b00f2 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.tests.testbench;
 
 import com.itmill.toolkit.ui.Label;
@@ -9,7 +13,7 @@ public class TestSplitPanel extends com.itmill.toolkit.Application {
     SplitPanel verticalSplit = new SplitPanel(SplitPanel.ORIENTATION_VERTICAL);
 
     public void init() {
-        Window mainWindow = new Window("Feature Browser");
+        final Window mainWindow = new Window("Feature Browser");
         setMainWindow(mainWindow);
 
         verticalSplit.setFirstComponent(new Label("vertical first"));
index 08d447640fe902c71d18a561045492b0007a46a4..d62939add75362853cdab7fc9e857c0e237a8293 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -188,7 +164,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource
     public String getStyleName() {
         String s = "";
         if (styles != null) {
-            for (Iterator it = styles.iterator(); it.hasNext();) {
+            for (final Iterator it = styles.iterator(); it.hasNext();) {
                 s += (String) it.next();
                 if (it.hasNext()) {
                     s += " ";
@@ -266,7 +242,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource
         if (parent != null) {
             return parent.getLocale();
         }
-        Application app = getApplication();
+        final Application app = getApplication();
         if (app != null) {
             return app.getLocale();
         }
@@ -614,14 +590,14 @@ public abstract class AbstractComponent implements Component, MethodEventSource
 
             // Only paint content of visible components.
             if (isVisible()) {
-                String desc = getDescription();
+                final String desc = getDescription();
                 if (desc != null && description.length() > 0) {
                     target.addAttribute("description", getDescription());
                 }
 
                 paintContent(target);
 
-                ErrorMessage error = getErrorMessage();
+                final ErrorMessage error = getErrorMessage();
                 if (error != null) {
                     error.paint(target);
                 }
@@ -684,8 +660,8 @@ public abstract class AbstractComponent implements Component, MethodEventSource
             // Notify the listeners
             if (repaintRequestListeners != null
                     && !repaintRequestListeners.isEmpty()) {
-                Object[] listeners = repaintRequestListeners.toArray();
-                RepaintRequestEvent event = new RepaintRequestEvent(this);
+                final Object[] listeners = repaintRequestListeners.toArray();
+                final RepaintRequestEvent event = new RepaintRequestEvent(this);
                 for (int i = 0; i < listeners.length; i++) {
                     if (alreadyNotified == null) {
                         alreadyNotified = new LinkedList();
@@ -700,7 +676,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource
             }
 
             // Notify the parent
-            Component parent = getParent();
+            final Component parent = getParent();
             if (parent != null) {
                 parent.childRequestedRepaint(alreadyNotified);
             }
@@ -758,7 +734,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource
             COMPONENT_EVENT_METHOD = Component.Listener.class
                     .getDeclaredMethod("componentEvent",
                             new Class[] { Component.Event.class });
-        } catch (java.lang.NoSuchMethodException e) {
+        } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             e.printStackTrace();
             throw new java.lang.RuntimeException();
index 9f4fcb45a1ce53cbf969d7c00d140533662f7339..eaf3274de15caabe91f03ca24468c770721076cf 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -58,15 +34,15 @@ public abstract class AbstractComponentContainer extends AbstractComponent
      * reimplemented in extending classes for a more powerfull implementation.
      */
     public void removeAllComponents() {
-        LinkedList l = new LinkedList();
+        final LinkedList l = new LinkedList();
 
         // Adds all components
-        for (Iterator i = getComponentIterator(); i.hasNext();) {
+        for (final Iterator i = getComponentIterator(); i.hasNext();) {
             l.add(i.next());
         }
 
         // Removes all component
-        for (Iterator i = l.iterator(); i.hasNext();) {
+        for (final Iterator i = l.iterator(); i.hasNext();) {
             removeComponent((Component) i.next());
         }
     }
@@ -77,13 +53,13 @@ public abstract class AbstractComponentContainer extends AbstractComponent
      * implemented interface.
      */
     public void moveComponentsFrom(ComponentContainer source) {
-        LinkedList components = new LinkedList();
-        for (Iterator i = source.getComponentIterator(); i.hasNext();) {
+        final LinkedList components = new LinkedList();
+        for (final Iterator i = source.getComponentIterator(); i.hasNext();) {
             components.add(i.next());
         }
 
-        for (Iterator i = components.iterator(); i.hasNext();) {
-            Component c = (Component) i.next();
+        for (final Iterator i = components.iterator(); i.hasNext();) {
+            final Component c = (Component) i.next();
             source.removeComponent(c);
             addComponent(c);
         }
@@ -98,7 +74,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent
     public void attach() {
         super.attach();
 
-        for (Iterator i = getComponentIterator(); i.hasNext();) {
+        for (final Iterator i = getComponentIterator(); i.hasNext();) {
             ((Component) i.next()).attach();
         }
     }
@@ -112,7 +88,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent
     public void detach() {
         super.detach();
 
-        for (Iterator i = getComponentIterator(); i.hasNext();) {
+        for (final Iterator i = getComponentIterator(); i.hasNext();) {
             ((Component) i.next()).detach();
         }
     }
@@ -131,7 +107,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent
             COMPONENT_DETACHED_METHOD = ComponentDetachListener.class
                     .getDeclaredMethod("componentDetachedFromContainer",
                             new Class[] { ComponentDetachEvent.class });
-        } catch (java.lang.NoSuchMethodException e) {
+        } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             throw new java.lang.RuntimeException();
         }
index 3b398a13d532a08e9cad173c7450d8eac7b01f3c..d85ab2014ef76111d3d76e78c5e5e5d976773922 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -220,13 +196,13 @@ public abstract class AbstractField extends AbstractComponent implements Field,
     public void commit() throws Buffered.SourceException {
         if (dataSource != null && (isInvalidCommitted() || isValid())
                 && !dataSource.isReadOnly()) {
-            Object newValue = getValue();
+            final Object newValue = getValue();
             try {
 
                 // Commits the value to datasource.
                 dataSource.setValue(newValue);
 
-            } catch (Throwable e) {
+            } catch (final Throwable e) {
 
                 // Sets the buffering state.
                 currentBufferedSourceException = new Buffered.SourceException(
@@ -276,7 +252,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
                     currentBufferedSourceException = null;
                     requestRepaint();
                 }
-            } catch (Throwable e) {
+            } catch (final Throwable e) {
 
                 // Sets the buffering state
                 currentBufferedSourceException = new Buffered.SourceException(
@@ -287,7 +263,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
                 throw currentBufferedSourceException;
             }
 
-            boolean wasModified = isModified();
+            final boolean wasModified = isModified();
             modified = false;
 
             // If the new value differs from the previous one
@@ -370,7 +346,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
      * @see java.lang.Object#toString()
      */
     public String toString() {
-        Object value = getValue();
+        final Object value = getValue();
         if (value == null) {
             return null;
         }
@@ -392,7 +368,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
             return value;
         }
 
-        Object newValue = dataSource.getValue();
+        final Object newValue = dataSource.getValue();
         if ((newValue == null && value != null)
                 || (newValue != null && !newValue.equals(value))) {
             setInternalValue(newValue);
@@ -438,9 +414,9 @@ public abstract class AbstractField extends AbstractComponent implements Field,
 
             // If invalid values are not allowed, the value must be checked
             if (!isInvalidAllowed()) {
-                Collection v = getValidators();
+                final Collection v = getValidators();
                 if (v != null) {
-                    for (Iterator i = v.iterator(); i.hasNext();) {
+                    for (final Iterator i = v.iterator(); i.hasNext();) {
                         ((Validator) i.next()).validate(newValue);
                     }
                 }
@@ -461,7 +437,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
                     // The buffer is now unmodified
                     modified = false;
 
-                } catch (Throwable e) {
+                } catch (final Throwable e) {
 
                     // Sets the buffering state
                     currentBufferedSourceException = new Buffered.SourceException(
@@ -518,12 +494,12 @@ public abstract class AbstractField extends AbstractComponent implements Field,
     public void setPropertyDataSource(Property newDataSource) {
 
         // Saves the old value
-        Object oldValue = value;
+        final Object oldValue = value;
 
         // Discards all changes to old datasource
         try {
             discard();
-        } catch (Buffered.SourceException ignored) {
+        } catch (final Buffered.SourceException ignored) {
         }
 
         // Stops listening the old data source changes
@@ -542,7 +518,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
                 setInternalValue(dataSource.getValue());
             }
             modified = false;
-        } catch (Throwable e) {
+        } catch (final Throwable e) {
             currentBufferedSourceException = new Buffered.SourceException(this,
                     e);
             modified = true;
@@ -555,9 +531,10 @@ public abstract class AbstractField extends AbstractComponent implements Field,
 
         // Copy the validators from the data source
         if (dataSource instanceof Validatable) {
-            Collection validators = ((Validatable) dataSource).getValidators();
+            final Collection validators = ((Validatable) dataSource)
+                    .getValidators();
             if (validators != null) {
-                for (Iterator i = validators.iterator(); i.hasNext();) {
+                for (final Iterator i = validators.iterator(); i.hasNext();) {
                     addValidator((Validator) i.next());
                 }
             }
@@ -623,8 +600,8 @@ public abstract class AbstractField extends AbstractComponent implements Field,
             return true;
         }
 
-        Object value = getValue();
-        for (Iterator i = validators.iterator(); i.hasNext();) {
+        final Object value = getValue();
+        for (final Iterator i = validators.iterator(); i.hasNext();) {
             if (!((Validator) i.next()).isValid(value)) {
                 return false;
             }
@@ -648,13 +625,13 @@ public abstract class AbstractField extends AbstractComponent implements Field,
         // Initialize temps
         Validator.InvalidValueException firstError = null;
         LinkedList errors = null;
-        Object value = getValue();
+        final Object value = getValue();
 
         // Gets all the validation errors
-        for (Iterator i = validators.iterator(); i.hasNext();) {
+        for (final Iterator i = validators.iterator(); i.hasNext();) {
             try {
                 ((Validator) i.next()).validate(value);
-            } catch (Validator.InvalidValueException e) {
+            } catch (final Validator.InvalidValueException e) {
                 if (firstError == null) {
                     firstError = e;
                 } else {
@@ -678,10 +655,10 @@ public abstract class AbstractField extends AbstractComponent implements Field,
         }
 
         // Creates composite validator
-        Validator.InvalidValueException[] exceptions = new Validator.InvalidValueException[errors
+        final Validator.InvalidValueException[] exceptions = new Validator.InvalidValueException[errors
                 .size()];
         int index = 0;
-        for (Iterator i = errors.iterator(); i.hasNext();) {
+        for (final Iterator i = errors.iterator(); i.hasNext();) {
             exceptions[index++] = (Validator.InvalidValueException) i.next();
         }
 
@@ -725,7 +702,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
      * @see com.itmill.toolkit.ui.AbstractComponent#getErrorMessage()
      */
     public ErrorMessage getErrorMessage() {
-        ErrorMessage superError = super.getErrorMessage();
+        final ErrorMessage superError = super.getErrorMessage();
         return superError;
         /*
          * TODO: Check the logic of this ErrorMessage validationError = null;
@@ -750,7 +727,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
             VALUE_CHANGE_METHOD = Property.ValueChangeListener.class
                     .getDeclaredMethod("valueChange",
                             new Class[] { Property.ValueChangeEvent.class });
-        } catch (java.lang.NoSuchMethodException e) {
+        } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             throw new java.lang.RuntimeException();
         }
@@ -796,7 +773,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
                     .getDeclaredMethod(
                             "readOnlyStatusChange",
                             new Class[] { Property.ReadOnlyStatusChangeEvent.class });
-        } catch (java.lang.NoSuchMethodException e) {
+        } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             throw new java.lang.RuntimeException();
         }
@@ -885,7 +862,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
      * Asks the terminal to place the cursor to this field.
      */
     public void focus() {
-        Window w = getWindow();
+        final Window w = getWindow();
         if (w != null) {
             w.setFocusedComponent(this);
         } else {
@@ -917,7 +894,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
 
         // Boolean field
         if (Boolean.class.isAssignableFrom(propertyType)) {
-            Button button = new Button("");
+            final Button button = new Button("");
             button.setSwitchMode(true);
             button.setImmediate(false);
             return button;
index c862c0a48b6f52056a2775254662140b1a9070ac..d66376052abecba82e535fb4f2049775be6b4fe7 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.ui;
 
 import com.itmill.toolkit.terminal.PaintException;
index 30d4b3c6517029a85abcc76f62ec4de77520a369..c10ad10fa40aa83fe97539ba95931005abc5f39e 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -246,9 +222,9 @@ public abstract class AbstractSelect extends AbstractField implements
     public AbstractSelect(String caption, Collection options) {
 
         // Creates the options container and add given options to it
-        Container c = new IndexedContainer();
+        final Container c = new IndexedContainer();
         if (options != null) {
-            for (Iterator i = options.iterator(); i.hasNext();) {
+            for (final Iterator i = options.iterator(); i.hasNext();) {
                 c.addItem(i.next());
             }
         }
@@ -300,14 +276,14 @@ public abstract class AbstractSelect extends AbstractField implements
         target.startTag("options");
         int keyIndex = 0;
         // Support for external null selection item id
-        Collection ids = getItemIds();
+        final Collection ids = getItemIds();
         if (isNullSelectionAllowed() && getNullSelectionItemId() != null
                 && !ids.contains(getNullSelectionItemId())) {
             // Gets the option attribute values
-            Object id = getNullSelectionItemId();
-            String key = itemIdMapper.key(id);
-            String caption = getItemCaption(id);
-            Resource icon = getItemIcon(id);
+            final Object id = getNullSelectionItemId();
+            final String key = itemIdMapper.key(id);
+            final String caption = getItemCaption(id);
+            final Resource icon = getItemIcon(id);
             // Paints option
             target.startTag("so");
             if (icon != null) {
@@ -323,20 +299,20 @@ public abstract class AbstractSelect extends AbstractField implements
             target.endTag("so");
         }
 
-        Iterator i = getItemIds().iterator();
+        final Iterator i = getItemIds().iterator();
         // Paints the available selection options from data source
         while (i.hasNext()) {
             // Gets the option attribute values
-            Object id = i.next();
+            final Object id = i.next();
             if (!isNullSelectionAllowed() && id != null
                     && id.equals(getNullSelectionItemId())) {
                 // Remove item if it's the null selection item but null
                 // selection is not allowed
                 continue;
             }
-            String key = itemIdMapper.key(id);
-            String caption = getItemCaption(id);
-            Resource icon = getItemIcon(id); // Paints the option
+            final String key = itemIdMapper.key(id);
+            final String caption = getItemCaption(id);
+            final Resource icon = getItemIcon(id); // Paints the option
             target.startTag("so");
             if (icon != null) {
                 target.addAttribute("icon", icon);
@@ -373,7 +349,7 @@ public abstract class AbstractSelect extends AbstractField implements
         // Try to set the property value
 
         // New option entered (and it is allowed)
-        String newitem = (String) variables.get("newitem");
+        final String newitem = (String) variables.get("newitem");
         if (newitem != null && newitem.length() > 0) {
 
             // Checks for readonly
@@ -389,7 +365,7 @@ public abstract class AbstractSelect extends AbstractField implements
                     try {
                         getContainerProperty(newitem,
                                 getItemCaptionPropertyId()).setValue(newitem);
-                    } catch (Property.ConversionException ignored) {
+                    } catch (final Property.ConversionException ignored) {
                         // The conversion exception is safely ignored, the
                         // caption is
                         // just missing
@@ -400,7 +376,7 @@ public abstract class AbstractSelect extends AbstractField implements
 
         // Selection change
         if (variables.containsKey("selected")) {
-            String[] ka = (String[]) variables.get("selected");
+            final String[] ka = (String[]) variables.get("selected");
 
             // Multiselect mode
             if (isMultiSelect()) {
@@ -408,9 +384,9 @@ public abstract class AbstractSelect extends AbstractField implements
                 // TODO Optimize by adding repaintNotNeeded when applicable
 
                 // Converts the key-array to id-set
-                LinkedList s = new LinkedList();
+                final LinkedList s = new LinkedList();
                 for (int i = 0; i < ka.length; i++) {
-                    Object id = itemIdMapper.get(ka[i]);
+                    final Object id = itemIdMapper.get(ka[i]);
                     if (!isNullSelectionAllowed()
                             && (id == null || id == getNullSelectionItemId())) {
                         // skip empty selection if nullselection is not allowed
@@ -431,7 +407,7 @@ public abstract class AbstractSelect extends AbstractField implements
 
                 // Limits the deselection to the set of visible items
                 // (non-visible items can not be deselected)
-                Collection visible = getVisibleItemIds();
+                final Collection visible = getVisibleItemIds();
                 if (visible != null) {
                     Set newsel = (Set) getValue();
                     if (newsel == null) {
@@ -453,13 +429,13 @@ public abstract class AbstractSelect extends AbstractField implements
                 if (ka.length == 0) {
                     // Allows deselection only if the deselected item is
                     // visible
-                    Object current = getValue();
-                    Collection visible = getVisibleItemIds();
+                    final Object current = getValue();
+                    final Collection visible = getVisibleItemIds();
                     if (visible != null && visible.contains(current)) {
                         setValue(null, true);
                     }
                 } else {
-                    Object id = itemIdMapper.get(ka[0]);
+                    final Object id = itemIdMapper.get(ka[0]);
                     if (!isNullSelectionAllowed() && id == null) {
                         requestRepaint();
                     } else if (id != null
@@ -520,7 +496,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * @see com.itmill.toolkit.ui.AbstractField#getValue()
      */
     public Object getValue() {
-        Object retValue = super.getValue();
+        final Object retValue = super.getValue();
 
         if (isMultiSelect()) {
 
@@ -533,7 +509,7 @@ public abstract class AbstractSelect extends AbstractField implements
             } else if (retValue instanceof Collection) {
                 return new HashSet((Collection) retValue);
             } else {
-                Set s = new HashSet();
+                final Set s = new HashSet();
                 if (items.containsId(retValue)) {
                     s.add(retValue);
                 }
@@ -689,7 +665,7 @@ public abstract class AbstractSelect extends AbstractField implements
     public boolean addContainerProperty(Object propertyId, Class type,
             Object defaultValue) throws UnsupportedOperationException {
 
-        boolean retval = items.addContainerProperty(propertyId, type,
+        final boolean retval = items.addContainerProperty(propertyId, type,
                 defaultValue);
         if (retval && !(items instanceof Container.PropertySetChangeNotifier)) {
             firePropertySetChange();
@@ -708,7 +684,7 @@ public abstract class AbstractSelect extends AbstractField implements
      */
     public boolean removeAllItems() throws UnsupportedOperationException {
 
-        boolean retval = items.removeAllItems();
+        final boolean retval = items.removeAllItems();
         itemIdMapper.removeAll();
         if (retval) {
             setValue(null);
@@ -729,7 +705,7 @@ public abstract class AbstractSelect extends AbstractField implements
      */
     public Object addItem() throws UnsupportedOperationException {
 
-        Object retval = items.addItem();
+        final Object retval = items.addItem();
         if (retval != null
                 && !(items instanceof Container.ItemSetChangeNotifier)) {
             fireItemSetChange();
@@ -753,7 +729,7 @@ public abstract class AbstractSelect extends AbstractField implements
      */
     public Item addItem(Object itemId) throws UnsupportedOperationException {
 
-        Item retval = items.addItem(itemId);
+        final Item retval = items.addItem(itemId);
         if (retval != null
                 && !(items instanceof Container.ItemSetChangeNotifier)) {
             fireItemSetChange();
@@ -773,7 +749,7 @@ public abstract class AbstractSelect extends AbstractField implements
             throws UnsupportedOperationException {
 
         unselect(itemId);
-        boolean retval = items.removeItem(itemId);
+        final boolean retval = items.removeItem(itemId);
         itemIdMapper.remove(itemId);
         if (retval && !(items instanceof Container.ItemSetChangeNotifier)) {
             fireItemSetChange();
@@ -794,7 +770,7 @@ public abstract class AbstractSelect extends AbstractField implements
     public boolean removeContainerProperty(Object propertyId)
             throws UnsupportedOperationException {
 
-        boolean retval = items.removeContainerProperty(propertyId);
+        final boolean retval = items.removeContainerProperty(propertyId);
         if (retval && !(items instanceof Container.PropertySetChangeNotifier)) {
             firePropertySetChange();
         }
@@ -821,13 +797,13 @@ public abstract class AbstractSelect extends AbstractField implements
                 try {
                     ((Container.ItemSetChangeNotifier) items)
                             .removeListener(this);
-                } catch (ClassCastException ignored) {
+                } catch (final ClassCastException ignored) {
                     // Ignored
                 }
                 try {
                     ((Container.PropertySetChangeNotifier) items)
                             .removeListener(this);
-                } catch (ClassCastException ignored) {
+                } catch (final ClassCastException ignored) {
                     // Ignored
                 }
             }
@@ -842,13 +818,13 @@ public abstract class AbstractSelect extends AbstractField implements
             if (items != null) {
                 try {
                     ((Container.ItemSetChangeNotifier) items).addListener(this);
-                } catch (ClassCastException ignored) {
+                } catch (final ClassCastException ignored) {
                     // Ignored
                 }
                 try {
                     ((Container.PropertySetChangeNotifier) items)
                             .addListener(this);
-                } catch (ClassCastException ignored) {
+                } catch (final ClassCastException ignored) {
                     // Ignored
                 }
             }
@@ -894,19 +870,19 @@ public abstract class AbstractSelect extends AbstractField implements
         if (multiSelect != this.multiSelect) {
 
             // Selection before mode change
-            Object oldValue = getValue();
+            final Object oldValue = getValue();
 
             this.multiSelect = multiSelect;
 
             // Convert the value type
             if (multiSelect) {
-                Set s = new HashSet();
+                final Set s = new HashSet();
                 if (oldValue != null) {
                     s.add(oldValue);
                 }
                 setValue(s);
             } else {
-                Set s = (Set) oldValue;
+                final Set s = (Set) oldValue;
                 if (s == null || s.isEmpty()) {
                     setValue(null);
                 } else {
@@ -994,12 +970,12 @@ public abstract class AbstractSelect extends AbstractField implements
             try {
                 caption = String.valueOf(((Container.Indexed) items)
                         .indexOfId(itemId));
-            } catch (ClassCastException ignored) {
+            } catch (final ClassCastException ignored) {
             }
             break;
 
         case ITEM_CAPTION_MODE_ITEM:
-            Item i = getItem(itemId);
+            final Item i = getItem(itemId);
             if (i != null) {
                 caption = i.toString();
             }
@@ -1017,7 +993,7 @@ public abstract class AbstractSelect extends AbstractField implements
             break;
 
         case ITEM_CAPTION_MODE_PROPERTY:
-            Property p = getContainerProperty(itemId,
+            final Property p = getContainerProperty(itemId,
                     getItemCaptionPropertyId());
             if (p != null) {
                 caption = p.toString();
@@ -1056,7 +1032,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * @return the Icon for the item or null, if not specified.
      */
     public Resource getItemIcon(Object itemId) {
-        Resource explicit = (Resource) itemIcons.get(itemId);
+        final Resource explicit = (Resource) itemIcons.get(itemId);
         if (explicit != null) {
             return explicit;
         }
@@ -1065,11 +1041,12 @@ public abstract class AbstractSelect extends AbstractField implements
             return null;
         }
 
-        Property ip = getContainerProperty(itemId, getItemIconPropertyId());
+        final Property ip = getContainerProperty(itemId,
+                getItemIconPropertyId());
         if (ip == null) {
             return null;
         }
-        Object icon = ip.getValue();
+        final Object icon = ip.getValue();
         if (icon instanceof Resource) {
             return (Resource) icon;
         }
@@ -1267,7 +1244,7 @@ public abstract class AbstractSelect extends AbstractField implements
         if (isMultiSelect()) {
             return ((Set) getValue()).contains(itemId);
         } else {
-            Object value = getValue();
+            final Object value = getValue();
             return itemId.equals(value == null ? getNullSelectionItemId()
                     : value);
         }
@@ -1290,7 +1267,7 @@ public abstract class AbstractSelect extends AbstractField implements
     public void select(Object itemId) {
         if (!isSelected(itemId) && items.containsId(itemId)) {
             if (isMultiSelect()) {
-                Set s = new HashSet((Set) getValue());
+                final Set s = new HashSet((Set) getValue());
                 s.add(itemId);
                 setValue(s);
             } else if (itemId.equals(getNullSelectionItemId())) {
@@ -1313,7 +1290,7 @@ public abstract class AbstractSelect extends AbstractField implements
     public void unselect(Object itemId) {
         if (isSelected(itemId)) {
             if (isMultiSelect()) {
-                Set s = new HashSet((Set) getValue());
+                final Set s = new HashSet((Set) getValue());
                 s.remove(itemId);
                 setValue(s);
             } else {
@@ -1403,8 +1380,8 @@ public abstract class AbstractSelect extends AbstractField implements
     protected void firePropertySetChange() {
         if (propertySetEventListeners != null
                 && !propertySetEventListeners.isEmpty()) {
-            Container.PropertySetChangeEvent event = new PropertySetChangeEvent();
-            Object[] listeners = propertySetEventListeners.toArray();
+            final Container.PropertySetChangeEvent event = new PropertySetChangeEvent();
+            final Object[] listeners = propertySetEventListeners.toArray();
             for (int i = 0; i < listeners.length; i++) {
                 ((Container.PropertySetChangeListener) listeners[i])
                         .containerPropertySetChange(event);
@@ -1418,8 +1395,8 @@ public abstract class AbstractSelect extends AbstractField implements
      */
     protected void fireItemSetChange() {
         if (itemSetEventListeners != null && !itemSetEventListeners.isEmpty()) {
-            Container.ItemSetChangeEvent event = new ItemSetChangeEvent();
-            Object[] listeners = itemSetEventListeners.toArray();
+            final Container.ItemSetChangeEvent event = new ItemSetChangeEvent();
+            final Object[] listeners = itemSetEventListeners.toArray();
             for (int i = 0; i < listeners.length; i++) {
                 ((Container.ItemSetChangeListener) listeners[i])
                         .containerItemSetChange(event);
index e5d6af12e64322805c73f217333f4ed581bc9115..6ab3ccf11434e73b2541fc1d79b713b51a201738 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -74,14 +50,14 @@ public class BaseFieldFactory implements FieldFactory {
 
         // Date field
         if (Date.class.isAssignableFrom(type)) {
-            DateField df = new DateField();
+            final DateField df = new DateField();
             df.setResolution(DateField.RESOLUTION_DAY);
             return df;
         }
 
         // Boolean field
         if (Boolean.class.isAssignableFrom(type)) {
-            Button button = new Button();
+            final Button button = new Button();
             button.setSwitchMode(true);
             button.setImmediate(false);
             return button;
@@ -112,7 +88,8 @@ public class BaseFieldFactory implements FieldFactory {
      */
     public Field createField(Item item, Object propertyId, Component uiContext) {
         if (item != null && propertyId != null) {
-            Field f = createField(item.getItemProperty(propertyId), uiContext);
+            final Field f = createField(item.getItemProperty(propertyId),
+                    uiContext);
             if (f instanceof AbstractComponent) {
                 ((AbstractComponent) f).setCaption(propertyId.toString());
             }
index 80def407d800e1f88b2bb620436b5aaa717d157b..4ec0c4c9f43149719c0e30114462d9a38fbdd5d5 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -158,7 +134,7 @@ public class Button extends AbstractField {
         boolean state;
         try {
             state = ((Boolean) getValue()).booleanValue();
-        } catch (NullPointerException e) {
+        } catch (final NullPointerException e) {
             state = false;
         }
         target.addVariable(this, "state", state);
@@ -175,8 +151,8 @@ public class Button extends AbstractField {
     public void changeVariables(Object source, Map variables) {
         if (variables.containsKey("state")) {
             // Gets the new and old button states
-            Boolean newValue = (Boolean) variables.get("state");
-            Boolean oldValue = (Boolean) getValue();
+            final Boolean newValue = (Boolean) variables.get("state");
+            final Boolean oldValue = (Boolean) getValue();
 
             if (isSwitchMode()) {
 
@@ -256,7 +232,7 @@ public class Button extends AbstractField {
         try {
             BUTTON_CLICK_METHOD = ClickListener.class.getDeclaredMethod(
                     "buttonClick", new Class[] { ClickEvent.class });
-        } catch (java.lang.NoSuchMethodException e) {
+        } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             throw new java.lang.RuntimeException();
         }
index 6252a121d64fa9421046d680216ad1ec2cae24b2..97558e4fc09251803ad6725ad5ff0dd32119c497 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.ui;
 
 import com.itmill.toolkit.data.Property;
index 55f2c317d3c8d3fcc2add05793211a1fad0174f6..3f3bd67bced99735d78ceeade2e7b48c3281f0ab 100644 (file)
@@ -1,6 +1,7 @@
-/**\r
- * \r
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
  */\r
+\r
 package com.itmill.toolkit.ui;\r
 \r
 import java.util.Collection;\r
index fd5d78840ebcb781f6a0050a8fedb6d7a835b3a3..a0cfe3338f8d81f182cbe2b07a942b6dad3f1ac2 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -342,7 +318,7 @@ public interface Component extends Paintable, VariableOwner {
          */
         private static final long serialVersionUID = 4051323457293857333L;
 
-        private ErrorMessage message;
+        private final ErrorMessage message;
 
         /**
          * Constructs a new event with a specified source component.
index fae3670d05a09a6fb4a66232db1189e82648f43d..c5b72ca1008b73cf1e5d8d3893f2b6302c240bb1 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -166,7 +142,7 @@ public interface ComponentContainer extends Component {
          */
         private static final long serialVersionUID = 3257285812184692019L;
 
-        private Component component;
+        private final Component component;
 
         /**
          * Creates a new attach event.
@@ -214,7 +190,7 @@ public interface ComponentContainer extends Component {
          */
         private static final long serialVersionUID = 3618140052337930290L;
 
-        private Component component;
+        private final Component component;
 
         /**
          * Creates a new detach event.
index 3f63ff4806d0025580fc01d9008472548ab2b37e..42fadb63dda386618e9f26b79c86e1f2cd97b21b 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -305,8 +281,8 @@ public class CustomComponent implements Component {
             // Notify the listeners
             if (repaintRequestListeners != null
                     && !repaintRequestListeners.isEmpty()) {
-                Object[] listeners = repaintRequestListeners.toArray();
-                RepaintRequestEvent event = new RepaintRequestEvent(this);
+                final Object[] listeners = repaintRequestListeners.toArray();
+                final RepaintRequestEvent event = new RepaintRequestEvent(this);
                 for (int i = 0; i < listeners.length; i++) {
                     if (alreadyNotified == null) {
                         alreadyNotified = new LinkedList();
@@ -322,7 +298,7 @@ public class CustomComponent implements Component {
             repaintRequestListenersNotified = true;
 
             // Notify the parent
-            Component parent = getParent();
+            final Component parent = getParent();
             if (parent != null) {
                 parent.childRequestedRepaint(alreadyNotified);
             }
@@ -423,7 +399,7 @@ public class CustomComponent implements Component {
         }
 
         if (isVisible()) {
-            String type = getComponentType();
+            final String type = getComponentType();
             if (type != null) {
                 if (!target.startTag(this, "component")) {
                     target.addAttribute("type", type);
index 283c1edf1904dad87e73f2703c5b65819098129c..2b4ea0d481037b62b8888ba175823c542562e224 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -66,7 +42,7 @@ public class CustomLayout extends AbstractLayout {
     /**
      * Custom layout slots containing the components.
      */
-    private HashMap slots = new HashMap();
+    private final HashMap slots = new HashMap();
 
     private String templateName;
 
@@ -95,7 +71,7 @@ public class CustomLayout extends AbstractLayout {
      *                the location of the component.
      */
     public void addComponent(Component c, String location) {
-        Component old = (Component) slots.get(location);
+        final Component old = (Component) slots.get(location);
         if (old != null) {
             removeComponent(old);
         }
@@ -178,10 +154,10 @@ public class CustomLayout extends AbstractLayout {
 
         target.addAttribute("template", templateName);
         // Adds all items in all the locations
-        for (Iterator i = slots.keySet().iterator(); i.hasNext();) {
+        for (final Iterator i = slots.keySet().iterator(); i.hasNext();) {
             // Gets the (location,component)
-            String location = (String) i.next();
-            Component c = (Component) slots.get(location);
+            final String location = (String) i.next();
+            final Component c = (Component) slots.get(location);
             if (c != null) {
                 // Writes the item
                 target.startTag("location");
@@ -198,9 +174,9 @@ public class CustomLayout extends AbstractLayout {
         // Gets the locations
         String oldLocation = null;
         String newLocation = null;
-        for (Iterator i = slots.keySet().iterator(); i.hasNext();) {
-            String location = (String) i.next();
-            Component component = (Component) slots.get(location);
+        for (final Iterator i = slots.keySet().iterator(); i.hasNext();) {
+            final String location = (String) i.next();
+            final Component component = (Component) slots.get(location);
             if (component == oldComponent) {
                 oldLocation = location;
             }
index 55e5c58264991429108d96cd5acd9309d410bb15..942d95de9114ab8628423bfe0ae8a3c46c5cde3b 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -202,7 +178,7 @@ public class DateField extends AbstractField {
         super.paintContent(target);
 
         // Adds the locale as attribute
-        Locale l = getLocale();
+        final Locale l = getLocale();
         if (l != null) {
             target.addAttribute("locale", l.toString());
         }
@@ -210,8 +186,8 @@ public class DateField extends AbstractField {
         target.addAttribute("type", type);
 
         // Gets the calendar
-        Calendar calendar = getCalendar();
-        Date currentDate = (Date) getValue();
+        final Calendar calendar = getCalendar();
+        final Date currentDate = (Date) getValue();
 
         for (int r = resolution; r <= largestModifiable; r++) {
             switch (r) {
@@ -273,7 +249,7 @@ public class DateField extends AbstractField {
                         .containsKey("msec"))) {
 
             // Old and new dates
-            Date oldDate = (Date) getValue();
+            final Date oldDate = (Date) getValue();
             Date newDate = null;
 
             // Gets the new date in parts
@@ -307,7 +283,7 @@ public class DateField extends AbstractField {
             } else {
 
                 // Clone the calendar for date operation
-                Calendar cal = getCalendar();
+                final Calendar cal = getCalendar();
 
                 // Make sure that meaningful values exists
                 // Use the previous value if some of the variables
@@ -357,7 +333,7 @@ public class DateField extends AbstractField {
      * implemented interface.
      */
     public String toString() {
-        Date value = (Date) getValue();
+        final Date value = (Date) getValue();
         if (value != null) {
             return value.toString();
         }
@@ -383,10 +359,10 @@ public class DateField extends AbstractField {
 
             // Try to parse as string
             try {
-                SimpleDateFormat parser = new SimpleDateFormat();
-                Date val = parser.parse(newValue.toString());
+                final SimpleDateFormat parser = new SimpleDateFormat();
+                final Date val = parser.parse(newValue.toString());
                 super.setValue(val, repaintIsNotNeeded);
-            } catch (ParseException e) {
+            } catch (final ParseException e) {
                 throw new Property.ConversionException(e.getMessage());
             }
         }
@@ -446,10 +422,10 @@ public class DateField extends AbstractField {
         }
 
         // Clone the instance
-        Calendar newCal = (Calendar) calendar.clone();
+        final Calendar newCal = (Calendar) calendar.clone();
 
         // Assigns the current time tom calendar.
-        Date currentDate = (Date) getValue();
+        final Date currentDate = (Date) getValue();
         if (currentDate != null) {
             newCal.setTime(currentDate);
         }
index 6f00c7855e155f1e2f6aa3f6da2cabde10f42589..fd1127d4e41dc1c0e09294de1f5c17332bc7e295 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -192,9 +168,9 @@ public class Embedded extends AbstractComponent implements Sizeable {
         }
 
         // Params
-        for (Iterator i = getParameterNames(); i.hasNext();) {
+        for (final Iterator i = getParameterNames(); i.hasNext();) {
             target.startTag("embeddedparam");
-            String key = (String) i.next();
+            final String key = (String) i.next();
             target.addAttribute("name", key);
             target.addAttribute("value", getParameter(key));
             target.endTag("embeddedparam");
@@ -448,7 +424,7 @@ public class Embedded extends AbstractComponent implements Sizeable {
     public void setSource(Resource source) {
         if (source != null && !source.equals(this.source)) {
             this.source = source;
-            String mt = source.getMIMEType();
+            final String mt = source.getMIMEType();
             if ((mt.substring(0, mt.indexOf("/")).equalsIgnoreCase("image"))) {
                 type = TYPE_IMAGE;
             } else {
index 9d7d119b0268457c0cd8820479e3462a07daa899..dab5ee2cf10b57d9058118be1cf3ca5f7d456ec6 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.ui;
 
 import java.util.Iterator;
@@ -73,12 +77,12 @@ public class ExpandLayout extends OrderedLayout {
             target.addAttribute("orientation", "horizontal");
         }
 
-        String[] alignmentsArray = new String[components.size()];
+        final String[] alignmentsArray = new String[components.size()];
 
         // Adds all items in all the locations
         int index = 0;
-        for (Iterator i = getComponentIterator(); i.hasNext();) {
-            Component c = (Component) i.next();
+        for (final Iterator i = getComponentIterator(); i.hasNext();) {
+            final Component c = (Component) i.next();
             if (c != null) {
                 target.startTag("cc");
                 if (c == expanded) {
index e4248f8e9bfb6e1ef4b0a9cadc5404b8337ed97b..2da6d0ca89dc68412cd0a5d33e07ae101b39eb0e 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
index 7abbe29909b5a25ab87b876fd5acdb7ffec51dd2..9090f267b583b4693ed5c53ba7a9e688c2858baa 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
index 765fcc15b004128015e105f19e2f63a76731c8e4..ed69ba24e1b3a6e894842fc2fd215feec648d383 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -93,7 +69,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
     /**
      * Ordered list of property ids in this editor.
      */
-    private LinkedList propertyIds = new LinkedList();
+    private final LinkedList propertyIds = new LinkedList();
 
     /**
      * Current buffered source exception.
@@ -113,7 +89,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
     /**
      * Mapping from propertyName to corresponding field.
      */
-    private HashMap fields = new HashMap();
+    private final HashMap fields = new HashMap();
 
     /**
      * Field factory for this form.
@@ -189,14 +165,14 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
         LinkedList problems = null;
 
         // Try to commit all
-        for (Iterator i = propertyIds.iterator(); i.hasNext();) {
+        for (final Iterator i = propertyIds.iterator(); i.hasNext();) {
             try {
-                Field f = ((Field) fields.get(i.next()));
+                final Field f = ((Field) fields.get(i.next()));
                 // Commit only non-readonly fields.
                 if (!f.isReadOnly()) {
                     f.commit();
                 }
-            } catch (Buffered.SourceException e) {
+            } catch (final Buffered.SourceException e) {
                 if (problems == null) {
                     problems = new LinkedList();
                 }
@@ -214,12 +190,13 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
         }
 
         // Commit problems
-        Throwable[] causes = new Throwable[problems.size()];
+        final Throwable[] causes = new Throwable[problems.size()];
         int index = 0;
-        for (Iterator i = problems.iterator(); i.hasNext();) {
+        for (final Iterator i = problems.iterator(); i.hasNext();) {
             causes[index++] = (Throwable) i.next();
         }
-        Buffered.SourceException e = new Buffered.SourceException(this, causes);
+        final Buffered.SourceException e = new Buffered.SourceException(this,
+                causes);
         currentBufferedSourceException = e;
         requestRepaint();
         throw e;
@@ -234,10 +211,10 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
         LinkedList problems = null;
 
         // Try to discard all changes
-        for (Iterator i = propertyIds.iterator(); i.hasNext();) {
+        for (final Iterator i = propertyIds.iterator(); i.hasNext();) {
             try {
                 ((Field) fields.get(i.next())).discard();
-            } catch (Buffered.SourceException e) {
+            } catch (final Buffered.SourceException e) {
                 if (problems == null) {
                     problems = new LinkedList();
                 }
@@ -255,12 +232,13 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
         }
 
         // Discards problems occurred
-        Throwable[] causes = new Throwable[problems.size()];
+        final Throwable[] causes = new Throwable[problems.size()];
         int index = 0;
-        for (Iterator i = problems.iterator(); i.hasNext();) {
+        for (final Iterator i = problems.iterator(); i.hasNext();) {
             causes[index++] = (Throwable) i.next();
         }
-        Buffered.SourceException e = new Buffered.SourceException(this, causes);
+        final Buffered.SourceException e = new Buffered.SourceException(this,
+                causes);
         currentBufferedSourceException = e;
         requestRepaint();
         throw e;
@@ -271,8 +249,8 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
      * here, we use the default one from the interface.
      */
     public boolean isModified() {
-        for (Iterator i = propertyIds.iterator(); i.hasNext();) {
-            Field f = (Field) fields.get(i.next());
+        for (final Iterator i = propertyIds.iterator(); i.hasNext();) {
+            final Field f = (Field) fields.get(i.next());
             if (f != null && f.isModified()) {
                 return true;
             }
@@ -304,7 +282,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
     public void setReadThrough(boolean readThrough) {
         if (readThrough != this.readThrough) {
             this.readThrough = readThrough;
-            for (Iterator i = propertyIds.iterator(); i.hasNext();) {
+            for (final Iterator i = propertyIds.iterator(); i.hasNext();) {
                 ((Field) fields.get(i.next())).setReadThrough(readThrough);
             }
         }
@@ -317,7 +295,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
     public void setWriteThrough(boolean writeThrough) {
         if (writeThrough != this.writeThrough) {
             this.writeThrough = writeThrough;
-            for (Iterator i = propertyIds.iterator(); i.hasNext();) {
+            for (final Iterator i = propertyIds.iterator(); i.hasNext();) {
                 ((Field) fields.get(i.next())).setWriteThrough(writeThrough);
             }
         }
@@ -341,7 +319,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
         }
 
         // Gets suitable field
-        Field field = fieldFactory.createField(property, this);
+        final Field field = fieldFactory.createField(property, this);
         if (field == null) {
             return false;
         }
@@ -358,7 +336,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
                         + caption.substring(1, caption.length());
             }
             field.setCaption(caption);
-        } catch (Throwable ignored) {
+        } catch (final Throwable ignored) {
             return false;
         }
 
@@ -420,11 +398,11 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
      * @see com.itmill.toolkit.data.Item#getItemProperty(Object)
      */
     public Property getItemProperty(Object id) {
-        Field field = (Field) fields.get(id);
+        final Field field = (Field) fields.get(id);
         if (field == null) {
             return null;
         }
-        Property property = field.getPropertyDataSource();
+        final Property property = field.getPropertyDataSource();
 
         if (property != null) {
             return property;
@@ -455,7 +433,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
      */
     public boolean removeItemProperty(Object id) {
 
-        Field field = (Field) fields.get(id);
+        final Field field = (Field) fields.get(id);
 
         if (field != null) {
             propertyIds.remove(id);
@@ -476,7 +454,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
      *         (and only if) the return value is <code>true</code>.
      */
     public boolean removeAllProperties() {
-        Object[] properties = propertyIds.toArray();
+        final Object[] properties = propertyIds.toArray();
         boolean success = true;
 
         for (int i = 0; i < properties.length; i++) {
@@ -534,11 +512,12 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
         }
 
         // Adds all the properties to this form
-        for (Iterator i = propertyIds.iterator(); i.hasNext();) {
-            Object id = i.next();
-            Property property = itemDatasource.getItemProperty(id);
+        for (final Iterator i = propertyIds.iterator(); i.hasNext();) {
+            final Object id = i.next();
+            final Property property = itemDatasource.getItemProperty(id);
             if (id != null && property != null) {
-                Field f = fieldFactory.createField(itemDatasource, id, this);
+                final Field f = fieldFactory.createField(itemDatasource, id,
+                        this);
                 if (f != null) {
                     f.setPropertyDataSource(property);
                     addField(id, f);
@@ -616,12 +595,12 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
         }
 
         // Gets the old field
-        Field oldField = (Field) fields.get(propertyId);
+        final Field oldField = (Field) fields.get(propertyId);
         if (oldField == null) {
             throw new IllegalArgumentException("Field with given propertyid '"
                     + propertyId.toString() + "' can not be found.");
         }
-        Object value = oldField.getValue();
+        final Object value = oldField.getValue();
 
         // Checks that the value exists and check if the select should
         // be forced in multiselect mode
@@ -635,9 +614,9 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
         }
         if (value != null && !found) {
             if (value instanceof Collection) {
-                for (Iterator it = ((Collection) value).iterator(); it
+                for (final Iterator it = ((Collection) value).iterator(); it
                         .hasNext();) {
-                    Object val = it.next();
+                    final Object val = it.next();
                     found = false;
                     for (int i = 0; i < values.length && !found; i++) {
                         if (values[i] == val
@@ -662,7 +641,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
         }
 
         // Creates the new field matching to old field parameters
-        Select newField = new Select();
+        final Select newField = new Select();
         if (isMultiselect) {
             newField.setMultiSelect(true);
         }
@@ -680,7 +659,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
                 id = new Object();
                 newField.setNullSelectionItemId(id);
             }
-            Item item = newField.addItem(id);
+            final Item item = newField.addItem(id);
             if (item != null) {
                 item.getItemProperty("desc").setValue(
                         descriptions[i].toString());
@@ -688,7 +667,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
         }
 
         // Sets the property data source
-        Property property = oldField.getPropertyDataSource();
+        final Property property = oldField.getPropertyDataSource();
         oldField.setPropertyDataSource(null);
         newField.setPropertyDataSource(property);
 
@@ -766,7 +745,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
      */
     public boolean isValid() {
         boolean valid = true;
-        for (Iterator i = propertyIds.iterator(); i.hasNext();) {
+        for (final Iterator i = propertyIds.iterator(); i.hasNext();) {
             valid &= ((Field) fields.get(i.next())).isValid();
         }
         return valid;
@@ -778,7 +757,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
      * @see com.itmill.toolkit.data.Validatable#validate()
      */
     public void validate() throws InvalidValueException {
-        for (Iterator i = propertyIds.iterator(); i.hasNext();) {
+        for (final Iterator i = propertyIds.iterator(); i.hasNext();) {
             ((Field) fields.get(i.next())).validate();
         }
     }
@@ -809,7 +788,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
      */
     public void setReadOnly(boolean readOnly) {
         super.setReadOnly(readOnly);
-        for (Iterator i = propertyIds.iterator(); i.hasNext();) {
+        for (final Iterator i = propertyIds.iterator(); i.hasNext();) {
             ((Field) fields.get(i.next())).setReadOnly(readOnly);
         }
     }
@@ -859,7 +838,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
      */
     protected void setInternalValue(Object newValue) {
         // Stores the old value
-        Object oldValue = propertyValue;
+        final Object oldValue = propertyValue;
 
         // Sets the current Value
         super.setInternalValue(newValue);
@@ -932,7 +911,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
      */
     public void setVisibleItemProperties(Collection visibleProperties) {
         visibleItemProperties = visibleProperties;
-        Object value = getValue();
+        final Object value = getValue();
         setFormDataSource(value, getVisibleItemProperties());
     }
 
@@ -942,7 +921,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
      * @see com.itmill.toolkit.ui.Component.Focusable#focus()
      */
     public void focus() {
-        Field f = getFirstField();
+        final Field f = getFirstField();
         if (f != null) {
             f.focus();
         }
@@ -955,7 +934,7 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
      */
     public void setTabIndex(int tabIndex) {
         super.setTabIndex(tabIndex);
-        for (Iterator i = getItemPropertyIds().iterator(); i.hasNext();) {
+        for (final Iterator i = getItemPropertyIds().iterator(); i.hasNext();) {
             (getField(i.next())).setTabIndex(tabIndex);
         }
     }
index c81ba29ab0fa12be45b0e60111b05a53b83f2d7c..fe972db98b90952d004002c4cb0fad8dfd26f41c 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.ui;
 
 public class FormLayout extends OrderedLayout {
index 0e0d80172e21017674e2462521ac37521b0ad2d7..e7f5293b2375c719a3cc64ac690bb47cce57609c 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2007 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -87,12 +63,12 @@ public class GridLayout extends AbstractLayout {
      * Contains all items that are placed on the grid. These are components with
      * grid area definition.
      */
-    private LinkedList areas = new LinkedList();
+    private final LinkedList areas = new LinkedList();
 
     /**
      * Mapping from components to their respective areas.
      */
-    private LinkedList components = new LinkedList();
+    private final LinkedList components = new LinkedList();
 
     /**
      * Mapping from components to alignments (horizontal + vertical).
@@ -204,7 +180,7 @@ public class GridLayout extends AbstractLayout {
         }
 
         // Creates the area
-        Area area = new Area(component, column1, row1, column2, row2);
+        final Area area = new Area(component, column1, row1, column2, row2);
 
         // Checks the validity of the coordinates
         if (column2 < column1 || row2 < row1) {
@@ -221,11 +197,11 @@ public class GridLayout extends AbstractLayout {
         // Inserts the component to right place at the list
         // Respect top-down, left-right ordering
         component.setParent(this);
-        Iterator i = areas.iterator();
+        final Iterator i = areas.iterator();
         int index = 0;
         boolean done = false;
         while (!done && i.hasNext()) {
-            Area existingArea = (Area) i.next();
+            final Area existingArea = (Area) i.next();
             if ((existingArea.row1 >= row1 && existingArea.column1 > column1)
                     || existingArea.row1 > row1) {
                 areas.add(index, area);
@@ -253,8 +229,8 @@ public class GridLayout extends AbstractLayout {
      *                 if <code>area</code> overlaps with any existing area.
      */
     private void checkExistingOverlaps(Area area) throws OverlapsException {
-        for (Iterator i = areas.iterator(); i.hasNext();) {
-            Area existingArea = (Area) i.next();
+        for (final Iterator i = areas.iterator(); i.hasNext();) {
+            final Area existingArea = (Area) i.next();
             if (existingArea.overlaps(area)) {
                 // Component not added, overlaps with existing component
                 throw new OverlapsException(existingArea);
@@ -323,7 +299,7 @@ public class GridLayout extends AbstractLayout {
                 area = new Area(component, cursorX, cursorY, cursorX, cursorY);
                 checkExistingOverlaps(area);
                 done = true;
-            } catch (OverlapsException ignored) {
+            } catch (final OverlapsException ignored) {
                 space();
             }
         }
@@ -351,8 +327,8 @@ public class GridLayout extends AbstractLayout {
         super.removeComponent(component);
 
         Area area = null;
-        for (Iterator i = areas.iterator(); area == null && i.hasNext();) {
-            Area a = (Area) i.next();
+        for (final Iterator i = areas.iterator(); area == null && i.hasNext();) {
+            final Area a = (Area) i.next();
             if (a.getComponent() == component) {
                 area = a;
             }
@@ -379,8 +355,8 @@ public class GridLayout extends AbstractLayout {
     public void removeComponent(int column, int row) {
 
         // Finds the area
-        for (Iterator i = areas.iterator(); i.hasNext();) {
-            Area area = (Area) i.next();
+        for (final Iterator i = areas.iterator(); i.hasNext();) {
+            final Area area = (Area) i.next();
             if (area.getColumn1() == column && area.getRow1() == row) {
                 removeComponent(area.getComponent());
                 return;
@@ -419,13 +395,13 @@ public class GridLayout extends AbstractLayout {
         }
 
         // Area iterator
-        Iterator areaiterator = areas.iterator();
+        final Iterator areaiterator = areas.iterator();
 
         // Current item to be processed (fetch first item)
         Area area = areaiterator.hasNext() ? (Area) areaiterator.next() : null;
 
         // Collects rowspan related information here
-        HashMap cellUsed = new HashMap();
+        final HashMap cellUsed = new HashMap();
 
         // Empty cell collector
         int emptyCells = 0;
@@ -454,8 +430,8 @@ public class GridLayout extends AbstractLayout {
                     }
 
                     // Now proceed rendering current item
-                    int cols = (area.column2 - area.column1) + 1;
-                    int rows = (area.row2 - area.row1) + 1;
+                    final int cols = (area.column2 - area.column1) + 1;
+                    final int rows = (area.row2 - area.row1) + 1;
                     target.startTag("gc");
 
                     target.addAttribute("x", curx);
@@ -500,8 +476,8 @@ public class GridLayout extends AbstractLayout {
 
                         // Current column contains already an item,
                         // check if rowspan affects at current x,y position
-                        int rowspanDepth = ((Integer) cellUsed.get(new Integer(
-                                curx))).intValue();
+                        final int rowspanDepth = ((Integer) cellUsed
+                                .get(new Integer(curx))).intValue();
 
                         if (rowspanDepth >= cury) {
 
@@ -582,22 +558,22 @@ public class GridLayout extends AbstractLayout {
         /**
          * The column of the upper left corner cell of the area.
          */
-        private int column1;
+        private final int column1;
 
         /**
          * The row of the upper left corner cell of the area.
          */
-        private int row1;
+        private final int row1;
 
         /**
          * The column of the lower right corner cell of the area.
          */
-        private int column2;
+        private final int column2;
 
         /**
          * The row of the lower right corner cell of the area.
          */
-        private int row2;
+        private final int row2;
 
         /**
          * Component painted on the area.
@@ -765,7 +741,7 @@ public class GridLayout extends AbstractLayout {
          */
         private static final long serialVersionUID = 3978144339870101561L;
 
-        private Area existingArea;
+        private final Area existingArea;
 
         /**
          * Constructs an <code>OverlapsException</code>.
@@ -802,7 +778,7 @@ public class GridLayout extends AbstractLayout {
          */
         private static final long serialVersionUID = 3618985589664592694L;
 
-        private Area areaOutOfBounds;
+        private final Area areaOutOfBounds;
 
         /**
          * Constructs an <code>OoutOfBoundsException</code> with the specified
@@ -874,8 +850,8 @@ public class GridLayout extends AbstractLayout {
 
         // Checks for overlaps
         if (cols > columns) {
-            for (Iterator i = areas.iterator(); i.hasNext();) {
-                Area area = (Area) i.next();
+            for (final Iterator i = areas.iterator(); i.hasNext();) {
+                final Area area = (Area) i.next();
                 if (area.column2 >= columns) {
                     throw new OutOfBoundsException(area);
                 }
@@ -946,8 +922,8 @@ public class GridLayout extends AbstractLayout {
 
         // Checks for overlaps
         if (this.rows > rows) {
-            for (Iterator i = areas.iterator(); i.hasNext();) {
-                Area area = (Area) i.next();
+            for (final Iterator i = areas.iterator(); i.hasNext();) {
+                final Area area = (Area) i.next();
                 if (area.row2 >= rows) {
                     throw new OutOfBoundsException(area);
                 }
@@ -998,9 +974,9 @@ public class GridLayout extends AbstractLayout {
         // Gets the locations
         Area oldLocation = null;
         Area newLocation = null;
-        for (Iterator i = areas.iterator(); i.hasNext();) {
-            Area location = (Area) i.next();
-            Component component = location.getComponent();
+        for (final Iterator i = areas.iterator(); i.hasNext();) {
+            final Area location = (Area) i.next();
+            final Component component = location.getComponent();
             if (component == oldComponent) {
                 oldLocation = location;
             }
index 2219bb24a15c0f4320022aa4db58c778736ec570..46db9c7fc71a9d088ec529d4f28ea4f492fc75c5 100644 (file)
@@ -1,6 +1,7 @@
-/**\r
- * \r
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
  */\r
+\r
 package com.itmill.toolkit.ui;\r
 \r
 import java.util.Date;\r
index 30a8ceaebc526895f4ffa4c36d0415d44e4b9fdc..c3f74763ec2a9d3693ebae846b849162bbc00ebc 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -397,7 +373,7 @@ public class Label extends AbstractComponent implements Property,
             VALUE_CHANGE_METHOD = Property.ValueChangeListener.class
                     .getDeclaredMethod("valueChange",
                             new Class[] { Property.ValueChangeEvent.class });
-        } catch (java.lang.NoSuchMethodException e) {
+        } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             throw new java.lang.RuntimeException();
         }
@@ -534,10 +510,10 @@ public class Label extends AbstractComponent implements Property,
      */
     private String stripTags(String xml) {
 
-        StringBuffer res = new StringBuffer();
+        final StringBuffer res = new StringBuffer();
 
         int processed = 0;
-        int xmlLen = xml.length();
+        final int xmlLen = xml.length();
         while (processed < xmlLen) {
             int next = xml.indexOf('<', processed);
             if (next < 0) {
index 8e6062db81ed6187c3b027ceb330a9497d5ae28e..cdc7c4273013337dab1b37b306a655233ace2408 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
index 6e12c67a31acfdc5b37946ef9eba32140fb900d6..0ba5f535649c1e90f3060486cef0568f07723172 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -133,7 +109,7 @@ public class Link extends AbstractComponent {
         }
 
         // Target window name
-        String name = getTargetName();
+        final String name = getTargetName();
         if (name != null && name.length() > 0) {
             target.addAttribute("name", name);
         }
index 235524a64954597c6d282d83c729c906ad752317..303e321e85a38d12bd817a7c4c6548799e67fbc2 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.ui;
 
 import java.util.Collection;
index 9c5859095e6003e8259f0013cfeabedaa19c02d0..d3e445dcf6e7d5427334eee150edae20be6fb77e 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.ui;
 
 import java.util.Collection;
index 0d7ff51245e671034d28b34436082a67bc929301..e7e5b515d9a877da7ab23dc1997252bbae59fe43 100644 (file)
@@ -1,6 +1,7 @@
-/**
- * 
+/* 
+@ITMillApache2LicenseForJavaFiles@
  */
+
 package com.itmill.toolkit.ui;
 
 import java.util.Collection;
index 3b05e06dd7d8b6c43ad4f0b0a2b979aef3203500..7bdf0611a2c07d0cabf60726c7f5af0d193f54a3 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -72,7 +48,7 @@ public class OrderedLayout extends AbstractLayout {
     /**
      * Mapping from components to alignments (horizontal + vertical).
      */
-    private Map componentToAlignment = new HashMap();
+    private final Map componentToAlignment = new HashMap();
 
     /**
      * Contained component should be aligned horizontally to the left.
@@ -230,11 +206,11 @@ public class OrderedLayout extends AbstractLayout {
             target.addAttribute("spacing", spacing);
         }
 
-        String[] alignmentsArray = new String[components.size()];
+        final String[] alignmentsArray = new String[components.size()];
         // Adds all items in all the locations
         int index = 0;
-        for (Iterator i = components.iterator(); i.hasNext();) {
-            Component c = (Component) i.next();
+        for (final Iterator i = components.iterator(); i.hasNext();) {
+            final Component c = (Component) i.next();
             if (c != null) {
                 // Paint child component UIDL
                 c.paint(target);
@@ -276,9 +252,9 @@ public class OrderedLayout extends AbstractLayout {
         // FIXME remove lines below and uncomment above
         // Workaround to bypass IOrderedLayouts limitations (separate classes
         // for different orientation + subtreecacing)
-        Iterator it = getComponentIterator();
+        final Iterator it = getComponentIterator();
         while (it.hasNext()) {
-            Component c = (Component) it.next();
+            final Component c = (Component) it.next();
             c.requestRepaint();
         }
     }
@@ -290,8 +266,8 @@ public class OrderedLayout extends AbstractLayout {
         int oldLocation = -1;
         int newLocation = -1;
         int location = 0;
-        for (Iterator i = components.iterator(); i.hasNext();) {
-            Component component = (Component) i.next();
+        for (final Iterator i = components.iterator(); i.hasNext();) {
+            final Component component = (Component) i.next();
 
             if (component == oldComponent) {
                 oldLocation = location;
@@ -347,7 +323,8 @@ public class OrderedLayout extends AbstractLayout {
     }
 
     public int getComponentAlignment(Component childComponent) {
-        Integer bitMask = (Integer) componentToAlignment.get(childComponent);
+        final Integer bitMask = (Integer) componentToAlignment
+                .get(childComponent);
         if (bitMask != null) {
             return bitMask.intValue();
         } else {
index 541effb479714d1f88ef93de3e0c5623d4179874..a2be804cd6198d7b73c587a1440bb5df68d346c5 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -229,14 +205,14 @@ public class Panel extends AbstractComponentContainer implements Sizeable,
             target.addVariable(this, "action", "");
             target.startTag("actions");
 
-            for (Iterator ahi = actionHandlers.iterator(); ahi.hasNext();) {
-                Action[] aa = ((Action.Handler) ahi.next()).getActions(null,
-                        this);
+            for (final Iterator ahi = actionHandlers.iterator(); ahi.hasNext();) {
+                final Action[] aa = ((Action.Handler) ahi.next()).getActions(
+                        null, this);
                 if (aa != null) {
                     for (int ai = 0; ai < aa.length; ai++) {
-                        Action a = aa[ai];
+                        final Action a = aa[ai];
                         target.startTag("action");
-                        String akey = actionMapper.key(aa[ai]);
+                        final String akey = actionMapper.key(aa[ai]);
                         target.addAttribute("key", akey);
                         if (a.getCaption() != null) {
                             target.addAttribute("caption", a.getCaption());
@@ -245,11 +221,11 @@ public class Panel extends AbstractComponentContainer implements Sizeable,
                             target.addAttribute("icon", a.getIcon());
                         }
                         if (a instanceof ShortcutAction) {
-                            ShortcutAction sa = (ShortcutAction) a;
+                            final ShortcutAction sa = (ShortcutAction) a;
                             target.addAttribute("kc", sa.getKeyCode());
-                            int[] modifiers = sa.getModifiers();
+                            final int[] modifiers = sa.getModifiers();
                             if (modifiers != null) {
-                                String[] smodifiers = new String[modifiers.length];
+                                final String[] smodifiers = new String[modifiers.length];
                                 for (int i = 0; i < modifiers.length; i++) {
                                     smodifiers[i] = String
                                             .valueOf(modifiers[i]);
@@ -322,8 +298,8 @@ public class Panel extends AbstractComponentContainer implements Sizeable,
         super.changeVariables(source, variables);
 
         // Get new size
-        Integer newWidth = (Integer) variables.get("width");
-        Integer newHeight = (Integer) variables.get("height");
+        final Integer newWidth = (Integer) variables.get("width");
+        final Integer newHeight = (Integer) variables.get("height");
         if (newWidth != null && newWidth.intValue() != getWidth()) {
             setWidth(newWidth.intValue());
             // ensure units as we are reading pixels
@@ -337,8 +313,8 @@ public class Panel extends AbstractComponentContainer implements Sizeable,
         }
 
         // Scrolling
-        Integer newScrollX = (Integer) variables.get("scrollleft");
-        Integer newScrollY = (Integer) variables.get("scrolldown");
+        final Integer newScrollX = (Integer) variables.get("scrollleft");
+        final Integer newScrollY = (Integer) variables.get("scrolldown");
         if (newScrollX != null && newScrollX.intValue() != getScrollOffsetX()) {
             setScrollOffsetX(newScrollX.intValue());
         }
@@ -348,10 +324,10 @@ public class Panel extends AbstractComponentContainer implements Sizeable,
 
         // Actions
         if (variables.containsKey("action")) {
-            String key = (String) variables.get("action");
-            Action action = (Action) actionMapper.get(key);
+            final String key = (String) variables.get("action");
+            final Action action = (Action) actionMapper.get(key);
             if (action != null && actionHandlers != null) {
-                for (Iterator i = actionHandlers.iterator(); i.hasNext();) {
+                for (final Iterator i = actionHandlers.iterator(); i.hasNext();) {
                     ((Action.Handler) i.next())
                             .handleAction(action, this, this);
                 }
index deb216e05fc094b57d195b2f2ad54301e88f404d..b00f55ae9222d9b58a91c894c11938d3e2720ffd 100644 (file)
@@ -1,6 +1,7 @@
-/**\r
- * \r
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
  */\r
+\r
 package com.itmill.toolkit.ui;\r
 \r
 import java.util.Date;\r
index 2314e833e17e2281b457a4fb1c1c52bbcfd1a382..8a48239da0e08bfad10a502cce9f77ade89c4e85 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
index 96043b5751d9ff6c9e50e6e7e164128cb3cf95a2..09dd0fd6486e45b7177cb366ce28b6250185b3f7 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
+
 package com.itmill.toolkit.ui;
 
 import com.itmill.toolkit.terminal.PaintException;
index 34ada06365db3a731f9b8a36ed391c06e280fad6..9658940c3417a8d69b6eed3abb9a0398405a29a7 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -188,7 +164,7 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering {
          */
         target.startTag("options");
 
-        boolean paintNullSelection = needNullSelectOption
+        final boolean paintNullSelection = needNullSelectOption
                 && (currentPage == 0 && (filterstring == null
                         || filterstring.equals("") || filterstring.equals("-")));
 
@@ -214,16 +190,16 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering {
             }
             options = options.subList(first, last);
         }
-        Iterator i = options.iterator();
+        final Iterator i = options.iterator();
         // Paints the available selection options from data source
 
         while (i.hasNext()) {
 
             // Gets the option attribute values
-            Object id = i.next();
-            String key = itemIdMapper.key(id);
-            String caption = getItemCaption(id);
-            Resource icon = getItemIcon(id);
+            final Object id = i.next();
+            final String key = itemIdMapper.key(id);
+            final String caption = getItemCaption(id);
+            final Resource icon = getItemIcon(id);
 
             // Paints the option
             target.startTag("so");
@@ -282,8 +258,8 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering {
         prevfilterstring = filterstring;
 
         filteredOptions = new LinkedList();
-        for (Iterator it = items.iterator(); it.hasNext();) {
-            Object itemId = it.next();
+        for (final Iterator it = items.iterator(); it.hasNext();) {
+            final Object itemId = it.next();
             String caption = getItemCaption(itemId);
             if (caption == null || caption.equals("")) {
                 continue;
@@ -330,7 +306,7 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering {
         // Try to set the property value
 
         // New option entered (and it is allowed)
-        String newitem = (String) variables.get("newitem");
+        final String newitem = (String) variables.get("newitem");
         if (newitem != null && newitem.length() > 0) {
 
             // Checks for readonly
@@ -346,7 +322,7 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering {
                     try {
                         getContainerProperty(newitem,
                                 getItemCaptionPropertyId()).setValue(newitem);
-                    } catch (Property.ConversionException ignored) {
+                    } catch (final Property.ConversionException ignored) {
                         // The conversion exception is safely ignored, the
                         // caption is
                         // just missing
@@ -358,7 +334,7 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering {
 
         // Selection change
         if (variables.containsKey("selected")) {
-            String[] ka = (String[]) variables.get("selected");
+            final String[] ka = (String[]) variables.get("selected");
 
             // Multiselect mode
             if (isMultiSelect()) {
@@ -366,9 +342,9 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering {
                 // TODO Optimize by adding repaintNotNeeded whan applicaple
 
                 // Converts the key-array to id-set
-                LinkedList s = new LinkedList();
+                final LinkedList s = new LinkedList();
                 for (int i = 0; i < ka.length; i++) {
-                    Object id = itemIdMapper.get(ka[i]);
+                    final Object id = itemIdMapper.get(ka[i]);
                     if (id != null && containsId(id)) {
                         s.add(id);
                     } else if (itemIdMapper.isNewIdKey(ka[i])
@@ -379,7 +355,7 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering {
 
                 // Limits the deselection to the set of visible items
                 // (non-visible items can not be deselected)
-                Collection visible = getVisibleItemIds();
+                final Collection visible = getVisibleItemIds();
                 if (visible != null) {
                     Set newsel = (Set) getValue();
                     if (newsel == null) {
@@ -398,13 +374,13 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering {
                 if (ka.length == 0) {
 
                     // Allows deselection only if the deselected item is visible
-                    Object current = getValue();
-                    Collection visible = getVisibleItemIds();
+                    final Object current = getValue();
+                    final Collection visible = getVisibleItemIds();
                     if (visible != null && visible.contains(current)) {
                         setValue(null, true);
                     }
                 } else {
-                    Object id = itemIdMapper.get(ka[0]);
+                    final Object id = itemIdMapper.get(ka[0]);
                     if (id != null && id.equals(getNullSelectionItemId())) {
                         setValue(null, true);
                     } else if (itemIdMapper.isNewIdKey(ka[0])) {
index 02191f8cfd889bfaaac34712d69bf93e17a80643..d0598e70fe1e92fa1cd4d729a801cb6dd82fa572 100644 (file)
@@ -1,3 +1,7 @@
+/* \r
+@ITMillApache2LicenseForJavaFiles@\r
+ */\r
+\r
 package com.itmill.toolkit.ui;\r
 \r
 import java.util.Map;\r
@@ -90,7 +94,7 @@ public class Slider extends AbstractField {
      * (client-side implementation decides the increment, usually somewhere\r
      * between 5-10% of slide range).\r
      */\r
-    private boolean arrows = false;\r
+    private final boolean arrows = false;\r
 \r
     /**\r
      * Default Slider constructor. Sets all values to defaults and the slide\r
@@ -175,7 +179,7 @@ public class Slider extends AbstractField {
             if ((new Double(getValue().toString())).doubleValue() > max) {\r
                 super.setValue(new Double(max));\r
             }\r
-        } catch (ClassCastException e) {\r
+        } catch (final ClassCastException e) {\r
             super.setValue(new Double(max));\r
         }\r
         requestRepaint();\r
@@ -203,7 +207,7 @@ public class Slider extends AbstractField {
             if ((new Double(getValue().toString())).doubleValue() < min) {\r
                 super.setValue(new Double(min));\r
             }\r
-        } catch (ClassCastException e) {\r
+        } catch (final ClassCastException e) {\r
             super.setValue(new Double(min));\r
         }\r
         requestRepaint();\r
@@ -263,7 +267,7 @@ public class Slider extends AbstractField {
      */\r
     public void setValue(Double value, boolean repaintIsNotNeeded)\r
             throws ValueOutOfBoundsException {\r
-        double v = value.doubleValue();\r
+        final double v = value.doubleValue();\r
         double newValue;\r
         if (resolution > 0) {\r
             // Round up to resolution\r
@@ -358,17 +362,17 @@ public class Slider extends AbstractField {
      * \r
      * @param visible\r
      *//*\r
-     * public void setArrows(boolean visible) { arrows = visible;\r
-     * requestRepaint(); }\r
-     */\r
+         * public void setArrows(boolean visible) { arrows = visible;\r
+         * requestRepaint(); }\r
+         */\r
 \r
     /*\r
      * Does the slider have arrows?\r
      * \r
      * @return arrows visible\r
      *//*\r
-     * public boolean isArrowsVisible() { return arrows; }\r
-     */\r
+         * public boolean isArrowsVisible() { return arrows; }\r
+         */\r
 \r
     public String getTag() {\r
         return "slider";\r
@@ -421,13 +425,13 @@ public class Slider extends AbstractField {
      */\r
     public void changeVariables(Object source, Map variables) {\r
         if (variables.containsKey("value")) {\r
-            Object value = variables.get("value");\r
-            Double newValue = new Double(value.toString());\r
+            final Object value = variables.get("value");\r
+            final Double newValue = new Double(value.toString());\r
             if (newValue != null && newValue != getValue()\r
                     && !newValue.equals(getValue())) {\r
                 try {\r
                     setValue(newValue, true);\r
-                } catch (ValueOutOfBoundsException e) {\r
+                } catch (final ValueOutOfBoundsException e) {\r
                     // Convert to nearest bound\r
                     double out = e.getValue().doubleValue();\r
                     if (out < min) {\r
@@ -455,7 +459,7 @@ public class Slider extends AbstractField {
          */\r
         private static final long serialVersionUID = -6451298598644446340L;\r
 \r
-        private Double value;\r
+        private final Double value;\r
 \r
         /**\r
          * Constructs an <code>ValueOutOfBoundsException</code> with the\r
index f26d39deda7f0f2fe3d1998d48b8fd7977bf8fff..c09b337b099c6a2ff16085e6efc119c5cf95541d 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -218,7 +194,7 @@ public class SplitPanel extends AbstractLayout {
     public void paintContent(PaintTarget target) throws PaintException {
         super.paintContent(target);
 
-        String position = pos + UNIT_SYMBOLS[posUnit];
+        final String position = pos + UNIT_SYMBOLS[posUnit];
 
         target.addAttribute("position", position);
 
index 833732224d26ad8ea8774ac29062cb39a2d6d9a8..87ec3cfc16f738062ed94296e6c5eac8f159cb48 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -53,24 +29,24 @@ public class TabSheet extends AbstractComponentContainer implements Sizeable {
     /**
      * Linked list of component tabs.
      */
-    private LinkedList tabs = new LinkedList();
+    private final LinkedList tabs = new LinkedList();
 
     /**
      * Tab -> caption mapping.
      */
-    private Hashtable tabCaptions = new Hashtable();
+    private final Hashtable tabCaptions = new Hashtable();
 
     /**
      * Tab -> icon mapping .
      */
-    private Hashtable tabIcons = new Hashtable();
+    private final Hashtable tabIcons = new Hashtable();
 
     /**
      * Selected tab.
      */
     private Component selected = null;
 
-    private KeyMapper keyMapper = new KeyMapper();
+    private final KeyMapper keyMapper = new KeyMapper();
 
     /**
      * Holds the value of property tabsHIdden.
@@ -197,8 +173,8 @@ public class TabSheet extends AbstractComponentContainer implements Sizeable {
      *                the container components are removed from.
      */
     public void moveComponentsFrom(ComponentContainer source) {
-        for (Iterator i = source.getComponentIterator(); i.hasNext();) {
-            Component c = (Component) i.next();
+        for (final Iterator i = source.getComponentIterator(); i.hasNext();) {
+            final Component c = (Component) i.next();
             String caption = null;
             Resource icon = null;
             if (TabSheet.class.isAssignableFrom(source.getClass())) {
@@ -237,17 +213,17 @@ public class TabSheet extends AbstractComponentContainer implements Sizeable {
 
         target.startTag("tabs");
 
-        for (Iterator i = getComponentIterator(); i.hasNext();) {
-            Component c = (Component) i.next();
+        for (final Iterator i = getComponentIterator(); i.hasNext();) {
+            final Component c = (Component) i.next();
             if (!c.isVisible()) {
                 continue;
             }
             target.startTag("tab");
-            Resource icon = getTabIcon(c);
+            final Resource icon = getTabIcon(c);
             if (icon != null) {
                 target.addAttribute("icon", icon);
             }
-            String caption = getTabCaption(c);
+            final String caption = getTabCaption(c);
             if (!c.isEnabled()) {
                 target.addAttribute("disabled", true);
             }
@@ -381,17 +357,17 @@ public class TabSheet extends AbstractComponentContainer implements Sizeable {
     public void replaceComponent(Component oldComponent, Component newComponent) {
 
         // Gets the captions
-        String oldCaption = getTabCaption(oldComponent);
-        Resource oldIcon = getTabIcon(oldComponent);
-        String newCaption = getTabCaption(newComponent);
-        Resource newIcon = getTabIcon(newComponent);
+        final String oldCaption = getTabCaption(oldComponent);
+        final Resource oldIcon = getTabIcon(oldComponent);
+        final String newCaption = getTabCaption(newComponent);
+        final Resource newIcon = getTabIcon(newComponent);
 
         // Gets the locations
         int oldLocation = -1;
         int newLocation = -1;
         int location = 0;
-        for (Iterator i = tabs.iterator(); i.hasNext();) {
-            Component component = (Component) i.next();
+        for (final Iterator i = tabs.iterator(); i.hasNext();) {
+            final Component component = (Component) i.next();
 
             if (component == oldComponent) {
                 oldLocation = location;
@@ -442,7 +418,7 @@ public class TabSheet extends AbstractComponentContainer implements Sizeable {
             SELECTED_TAB_CHANGE_METHOD = SelectedTabChangeListener.class
                     .getDeclaredMethod("selectedTabChange",
                             new Class[] { SelectedTabChangeEvent.class });
-        } catch (java.lang.NoSuchMethodException e) {
+        } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             throw new java.lang.RuntimeException();
         }
index 15ca1e4455855ae637eef4f5385a1c4bfd0f8d09..4be9b840e882ed71d0b4f73c59482030e561a8a3 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -394,7 +370,7 @@ public class Table extends AbstractSelect implements Action.Container,
 
         // Checks that the new visible columns contains no nulls and properties
         // exist
-        Collection properties = getContainerPropertyIds();
+        final Collection properties = getContainerPropertyIds();
         for (int i = 0; i < visibleColumns.length; i++) {
             if (visibleColumns[i] == null) {
                 throw new NullPointerException("Properties must be non-nulls");
@@ -407,15 +383,15 @@ public class Table extends AbstractSelect implements Action.Container,
 
         // If this is called befor the constructor is finished, it might be
         // uninitialized
-        LinkedList newVC = new LinkedList();
+        final LinkedList newVC = new LinkedList();
         for (int i = 0; i < visibleColumns.length; i++) {
             newVC.add(visibleColumns[i]);
         }
 
         // Removes alignments, icons and headers from hidden columns
         if (this.visibleColumns != null) {
-            for (Iterator i = this.visibleColumns.iterator(); i.hasNext();) {
-                Object col = i.next();
+            for (final Iterator i = this.visibleColumns.iterator(); i.hasNext();) {
+                final Object col = i.next();
                 if (!newVC.contains(col)) {
                     setColumnHeader(col, null);
                     setColumnAlignment(col, null);
@@ -448,9 +424,9 @@ public class Table extends AbstractSelect implements Action.Container,
         if (columnHeaders == null) {
             return null;
         }
-        String[] headers = new String[visibleColumns.size()];
+        final String[] headers = new String[visibleColumns.size()];
         int i = 0;
-        for (Iterator it = visibleColumns.iterator(); it.hasNext(); i++) {
+        for (final Iterator it = visibleColumns.iterator(); it.hasNext(); i++) {
             headers[i] = (String) columnHeaders.get(it.next());
         }
         return headers;
@@ -481,7 +457,7 @@ public class Table extends AbstractSelect implements Action.Container,
 
         this.columnHeaders.clear();
         int i = 0;
-        for (Iterator it = visibleColumns.iterator(); it.hasNext()
+        for (final Iterator it = visibleColumns.iterator(); it.hasNext()
                 && i < columnHeaders.length; i++) {
             this.columnHeaders.put(it.next(), columnHeaders[i]);
         }
@@ -507,9 +483,9 @@ public class Table extends AbstractSelect implements Action.Container,
         if (columnIcons == null) {
             return null;
         }
-        Resource[] icons = new Resource[visibleColumns.size()];
+        final Resource[] icons = new Resource[visibleColumns.size()];
         int i = 0;
-        for (Iterator it = visibleColumns.iterator(); it.hasNext(); i++) {
+        for (final Iterator it = visibleColumns.iterator(); it.hasNext(); i++) {
             icons[i] = (Resource) columnIcons.get(it.next());
         }
 
@@ -540,7 +516,7 @@ public class Table extends AbstractSelect implements Action.Container,
 
         this.columnIcons.clear();
         int i = 0;
-        for (Iterator it = visibleColumns.iterator(); it.hasNext()
+        for (final Iterator it = visibleColumns.iterator(); it.hasNext()
                 && i < columnIcons.length; i++) {
             this.columnIcons.put(it.next(), columnIcons[i]);
         }
@@ -571,9 +547,9 @@ public class Table extends AbstractSelect implements Action.Container,
         if (columnAlignments == null) {
             return null;
         }
-        String[] alignments = new String[visibleColumns.size()];
+        final String[] alignments = new String[visibleColumns.size()];
         int i = 0;
-        for (Iterator it = visibleColumns.iterator(); it.hasNext(); i++) {
+        for (final Iterator it = visibleColumns.iterator(); it.hasNext(); i++) {
             alignments[i++] = getColumnAlignment(it.next());
         }
 
@@ -607,7 +583,7 @@ public class Table extends AbstractSelect implements Action.Container,
 
         // Checks all alignments
         for (int i = 0; i < columnAlignments.length; i++) {
-            String a = columnAlignments[i];
+            final String a = columnAlignments[i];
             if (a != null && !a.equals(ALIGN_LEFT) && !a.equals(ALIGN_CENTER)
                     && !a.equals(ALIGN_RIGHT)) {
                 throw new IllegalArgumentException("Column " + i
@@ -616,9 +592,9 @@ public class Table extends AbstractSelect implements Action.Container,
         }
 
         // Resets the alignments
-        HashMap newCA = new HashMap();
+        final HashMap newCA = new HashMap();
         int i = 0;
-        for (Iterator it = visibleColumns.iterator(); it.hasNext()
+        for (final Iterator it = visibleColumns.iterator(); it.hasNext()
                 && i < columnAlignments.length; i++) {
             newCA.put(it.next(), columnAlignments[i]);
         }
@@ -650,7 +626,7 @@ public class Table extends AbstractSelect implements Action.Container,
      * @return width of colun or -1 when value not set
      */
     public int getColumnWidth(Object propertyId) {
-        Integer value = (Integer) columnWidths.get(propertyId);
+        final Integer value = (Integer) columnWidths.get(propertyId);
         if (value == null) {
             return -1;
         }
@@ -699,7 +675,7 @@ public class Table extends AbstractSelect implements Action.Container,
 
         // Priorise index over id if indexes are supported
         if (items instanceof Container.Indexed) {
-            int index = getCurrentPageFirstItemIndex();
+            final int index = getCurrentPageFirstItemIndex();
             Object id = null;
             if (index >= 0 && index < size()) {
                 id = ((Container.Indexed) items).getIdByIndex(index);
@@ -730,7 +706,7 @@ public class Table extends AbstractSelect implements Action.Container,
         try {
             index = ((Container.Indexed) items)
                     .indexOfId(currentPageFirstItemId);
-        } catch (ClassCastException e) {
+        } catch (final ClassCastException e) {
 
             // If the table item container does not have index, we have to
             // calculates the index by hand
@@ -839,7 +815,7 @@ public class Table extends AbstractSelect implements Action.Container,
      * @return the specified column's alignment if it as one; null otherwise.
      */
     public String getColumnAlignment(Object propertyId) {
-        String a = (String) columnAlignments.get(propertyId);
+        final String a = (String) columnAlignments.get(propertyId);
         return a == null ? ALIGN_LEFT : a;
     }
 
@@ -973,7 +949,7 @@ public class Table extends AbstractSelect implements Action.Container,
         if (columnOrder == null || !isColumnReorderingAllowed()) {
             return;
         }
-        LinkedList newOrder = new LinkedList();
+        final LinkedList newOrder = new LinkedList();
         for (int i = 0; i < columnOrder.length; i++) {
             if (columnOrder[i] != null
                     && visibleColumns.contains(columnOrder[i])) {
@@ -981,8 +957,8 @@ public class Table extends AbstractSelect implements Action.Container,
                 newOrder.add(columnOrder[i]);
             }
         }
-        for (Iterator it = visibleColumns.iterator(); it.hasNext();) {
-            Object columnId = it.next();
+        for (final Iterator it = visibleColumns.iterator(); it.hasNext();) {
+            final Object columnId = it.next();
             if (!newOrder.contains(columnId)) {
                 newOrder.add(columnId);
             }
@@ -1023,7 +999,7 @@ public class Table extends AbstractSelect implements Action.Container,
             try {
                 currentPageFirstItemId = ((Container.Indexed) items)
                         .getIdByIndex(newIndex);
-            } catch (IndexOutOfBoundsException e) {
+            } catch (final IndexOutOfBoundsException e) {
                 currentPageFirstItemId = null;
             }
             currentPageFirstItemIndex = newIndex;
@@ -1241,7 +1217,7 @@ public class Table extends AbstractSelect implements Action.Container,
     public Object addItem(Object[] cells, Object itemId)
             throws UnsupportedOperationException {
 
-        Object[] cols = getVisibleColumns();
+        final Object[] cols = getVisibleColumns();
 
         // Checks that a correct number of cells are given
         if (cells.length != cols.length) {
@@ -1328,7 +1304,7 @@ public class Table extends AbstractSelect implements Action.Container,
 
         // Page start index
         if (variables.containsKey("firstvisible")) {
-            Integer value = (Integer) variables.get("firstvisible");
+            final Integer value = (Integer) variables.get("firstvisible");
             if (value != null) {
                 setCurrentPageFirstItemIndex(value.intValue());
             }
@@ -1351,14 +1327,15 @@ public class Table extends AbstractSelect implements Action.Container,
 
         // Actions
         if (variables.containsKey("action")) {
-            StringTokenizer st = new StringTokenizer((String) variables
+            final StringTokenizer st = new StringTokenizer((String) variables
                     .get("action"), ",");
             if (st.countTokens() == 2) {
-                Object itemId = itemIdMapper.get(st.nextToken());
-                Action action = (Action) actionMapper.get(st.nextToken());
+                final Object itemId = itemIdMapper.get(st.nextToken());
+                final Action action = (Action) actionMapper.get(st.nextToken());
                 if (action != null && containsId(itemId)
                         && actionHandlers != null) {
-                    for (Iterator i = actionHandlers.iterator(); i.hasNext();) {
+                    for (final Iterator i = actionHandlers.iterator(); i
+                            .hasNext();) {
                         ((Action.Handler) i.next()).handleAction(action, this,
                                 itemId);
                     }
@@ -1370,15 +1347,15 @@ public class Table extends AbstractSelect implements Action.Container,
         boolean doSort = false;
         if (!sortDisabled) {
             if (variables.containsKey("sortcolumn")) {
-                String colId = (String) variables.get("sortcolumn");
+                final String colId = (String) variables.get("sortcolumn");
                 if (colId != null && !"".equals(colId) && !"null".equals(colId)) {
-                    Object id = columnIdMap.get(colId);
+                    final Object id = columnIdMap.get(colId);
                     setSortContainerPropertyId(id);
                     doSort = true;
                 }
             }
             if (variables.containsKey("sortascending")) {
-                boolean state = ((Boolean) variables.get("sortascending"))
+                final boolean state = ((Boolean) variables.get("sortascending"))
                         .booleanValue();
                 if (state != sortAscending) {
                     setSortAscending(state);
@@ -1395,27 +1372,30 @@ public class Table extends AbstractSelect implements Action.Container,
         if (isColumnCollapsingAllowed()) {
             if (variables.containsKey("collapsedcolumns")) {
                 try {
-                    Object[] ids = (Object[]) variables.get("collapsedcolumns");
-                    for (Iterator it = visibleColumns.iterator(); it.hasNext();) {
+                    final Object[] ids = (Object[]) variables
+                            .get("collapsedcolumns");
+                    for (final Iterator it = visibleColumns.iterator(); it
+                            .hasNext();) {
                         setColumnCollapsed(it.next(), false);
                     }
                     for (int i = 0; i < ids.length; i++) {
                         setColumnCollapsed(columnIdMap.get(ids[i].toString()),
                                 true);
                     }
-                } catch (Exception ignored) {
+                } catch (final Exception ignored) {
                 }
             }
         }
         if (isColumnReorderingAllowed()) {
             if (variables.containsKey("columnorder")) {
                 try {
-                    Object[] ids = (Object[]) variables.get("columnorder");
+                    final Object[] ids = (Object[]) variables
+                            .get("columnorder");
                     for (int i = 0; i < ids.length; i++) {
                         ids[i] = columnIdMap.get(ids[i].toString());
                     }
                     setColumnOrder(ids);
-                } catch (Exception ignored) {
+                } catch (final Exception ignored) {
                 }
             }
         }
@@ -1452,16 +1432,16 @@ public class Table extends AbstractSelect implements Action.Container,
         }
 
         // Initialize temps
-        Object[] colids = getVisibleColumns();
-        int cols = colids.length;
-        int first = getCurrentPageFirstItemIndex();
+        final Object[] colids = getVisibleColumns();
+        final int cols = colids.length;
+        final int first = getCurrentPageFirstItemIndex();
         int total = size();
-        int pagelen = getPageLength();
-        int colHeadMode = getColumnHeaderMode();
-        boolean colheads = colHeadMode != COLUMN_HEADER_MODE_HIDDEN;
-        boolean rowheads = getRowHeaderMode() != ROW_HEADER_MODE_HIDDEN;
-        Object[][] cells = getVisibleCells();
-        boolean iseditable = isEditable();
+        final int pagelen = getPageLength();
+        final int colHeadMode = getColumnHeaderMode();
+        final boolean colheads = colHeadMode != COLUMN_HEADER_MODE_HIDDEN;
+        final boolean rowheads = getRowHeaderMode() != ROW_HEADER_MODE_HIDDEN;
+        final Object[][] cells = getVisibleCells();
+        final boolean iseditable = isEditable();
         int rows = cells[0].length;
 
         if (!isNullSelectionAllowed() && getNullSelectionItemId() != null
@@ -1503,10 +1483,10 @@ public class Table extends AbstractSelect implements Action.Container,
         }
 
         // Visible column order
-        Collection sortables = getSortableContainerPropertyIds();
-        ArrayList visibleColOrder = new ArrayList();
-        for (Iterator it = visibleColumns.iterator(); it.hasNext();) {
-            Object columnId = it.next();
+        final Collection sortables = getSortableContainerPropertyIds();
+        final ArrayList visibleColOrder = new ArrayList();
+        for (final Iterator it = visibleColumns.iterator(); it.hasNext();) {
+            final Object columnId = it.next();
             if (!isColumnCollapsed(columnId)) {
                 visibleColOrder.add(columnIdMap.key(columnId));
             }
@@ -1514,20 +1494,20 @@ public class Table extends AbstractSelect implements Action.Container,
         target.addAttribute("vcolorder", visibleColOrder.toArray());
 
         // Rows
-        Set actionSet = new LinkedHashSet();
-        boolean selectable = isSelectable();
-        boolean[] iscomponent = new boolean[visibleColumns.size()];
+        final Set actionSet = new LinkedHashSet();
+        final boolean selectable = isSelectable();
+        final boolean[] iscomponent = new boolean[visibleColumns.size()];
         int iscomponentIndex = 0;
-        for (Iterator it = visibleColumns.iterator(); it.hasNext()
+        for (final Iterator it = visibleColumns.iterator(); it.hasNext()
                 && iscomponentIndex < iscomponent.length;) {
-            Object columnId = it.next();
-            Class colType = getType(columnId);
+            final Object columnId = it.next();
+            final Class colType = getType(columnId);
             iscomponent[iscomponentIndex++] = colType != null
                     && Component.class.isAssignableFrom(colType);
         }
         target.startTag("rows");
         for (int i = 0; i < cells[0].length; i++) {
-            Object itemId = cells[CELL_ITEMID][i];
+            final Object itemId = cells[CELL_ITEMID][i];
 
             if (!isNullSelectionAllowed() && getNullSelectionItemId() != null
                     && itemId == getNullSelectionItemId()) {
@@ -1558,13 +1538,14 @@ public class Table extends AbstractSelect implements Action.Container,
 
             // Actions
             if (actionHandlers != null) {
-                ArrayList keys = new ArrayList();
-                for (Iterator ahi = actionHandlers.iterator(); ahi.hasNext();) {
-                    Action[] aa = ((Action.Handler) ahi.next()).getActions(
-                            itemId, this);
+                final ArrayList keys = new ArrayList();
+                for (final Iterator ahi = actionHandlers.iterator(); ahi
+                        .hasNext();) {
+                    final Action[] aa = ((Action.Handler) ahi.next())
+                            .getActions(itemId, this);
                     if (aa != null) {
                         for (int ai = 0; ai < aa.length; ai++) {
-                            String key = actionMapper.key(aa[ai]);
+                            final String key = actionMapper.key(aa[ai]);
                             actionSet.add(aa[ai]);
                             keys.add(key);
                         }
@@ -1575,15 +1556,15 @@ public class Table extends AbstractSelect implements Action.Container,
 
             // cells
             int currentColumn = 0;
-            for (Iterator it = visibleColumns.iterator(); it.hasNext(); currentColumn++) {
-                Object columnId = it.next();
+            for (final Iterator it = visibleColumns.iterator(); it.hasNext(); currentColumn++) {
+                final Object columnId = it.next();
                 if (columnId == null || isColumnCollapsed(columnId)) {
                     continue;
                 }
                 if ((iscomponent[currentColumn] || iseditable)
                         && Component.class.isInstance(cells[CELL_FIRSTCOL
                                 + currentColumn][i])) {
-                    Component c = (Component) cells[CELL_FIRSTCOL
+                    final Component c = (Component) cells[CELL_FIRSTCOL
                             + currentColumn][i];
                     if (c == null) {
                         target.addText("");
@@ -1630,8 +1611,8 @@ public class Table extends AbstractSelect implements Action.Container,
         if (!actionSet.isEmpty()) {
             target.addVariable(this, "action", "");
             target.startTag("actions");
-            for (Iterator it = actionSet.iterator(); it.hasNext();) {
-                Action a = (Action) it.next();
+            for (final Iterator it = actionSet.iterator(); it.hasNext();) {
+                final Action a = (Action) it.next();
                 target.startTag("action");
                 if (a.getCaption() != null) {
                     target.addAttribute("caption", a.getCaption());
@@ -1645,9 +1626,9 @@ public class Table extends AbstractSelect implements Action.Container,
             target.endTag("actions");
         }
         if (columnReorderingAllowed) {
-            String[] colorder = new String[visibleColumns.size()];
+            final String[] colorder = new String[visibleColumns.size()];
             int i = 0;
-            for (Iterator it = visibleColumns.iterator(); it.hasNext()
+            for (final Iterator it = visibleColumns.iterator(); it.hasNext()
                     && i < colorder.length;) {
                 colorder[i++] = columnIdMap.key(it.next());
             }
@@ -1655,18 +1636,18 @@ public class Table extends AbstractSelect implements Action.Container,
         }
         // Available columns
         if (columnCollapsingAllowed) {
-            HashSet ccs = new HashSet();
-            for (Iterator i = visibleColumns.iterator(); i.hasNext();) {
-                Object o = i.next();
+            final HashSet ccs = new HashSet();
+            for (final Iterator i = visibleColumns.iterator(); i.hasNext();) {
+                final Object o = i.next();
                 if (isColumnCollapsed(o)) {
                     ccs.add(o);
                 }
             }
-            String[] collapsedkeys = new String[ccs.size()];
+            final String[] collapsedkeys = new String[ccs.size()];
             int nextColumn = 0;
-            for (Iterator it = visibleColumns.iterator(); it.hasNext()
+            for (final Iterator it = visibleColumns.iterator(); it.hasNext()
                     && nextColumn < collapsedkeys.length;) {
-                Object columnId = it.next();
+                final Object columnId = it.next();
                 if (isColumnCollapsed(columnId)) {
                     collapsedkeys[nextColumn++] = columnIdMap.key(columnId);
                 }
@@ -1675,12 +1656,12 @@ public class Table extends AbstractSelect implements Action.Container,
         }
         target.startTag("visiblecolumns");
         int i = 0;
-        for (Iterator it = visibleColumns.iterator(); it.hasNext(); i++) {
-            Object columnId = it.next();
+        for (final Iterator it = visibleColumns.iterator(); it.hasNext(); i++) {
+            final Object columnId = it.next();
             if (columnId != null) {
                 target.startTag("column");
                 target.addAttribute("cid", columnIdMap.key(columnId));
-                String head = getColumnHeader(columnId);
+                final String head = getColumnHeader(columnId);
                 target.addAttribute("caption", (head != null ? head : ""));
                 if (isColumnCollapsed(columnId)) {
                     target.addAttribute("collapsed", true);
@@ -1732,7 +1713,7 @@ public class Table extends AbstractSelect implements Action.Container,
         if (listenedProperties == null) {
             listenedProperties = new LinkedList();
         } else {
-            for (Iterator i = listenedProperties.iterator(); i.hasNext();) {
+            for (final Iterator i = listenedProperties.iterator(); i.hasNext();) {
                 ((Property.ValueChangeNotifier) i.next()).removeListener(this);
             }
         }
@@ -1741,16 +1722,16 @@ public class Table extends AbstractSelect implements Action.Container,
         if (visibleComponents == null) {
             visibleComponents = new LinkedList();
         } else {
-            for (Iterator i = visibleComponents.iterator(); i.hasNext();) {
+            for (final Iterator i = visibleComponents.iterator(); i.hasNext();) {
                 ((Component) i.next()).setParent(null);
             }
             visibleComponents.clear();
         }
 
         // Collects the basic facts about the table page
-        Object[] colids = getVisibleColumns();
-        int cols = colids.length;
-        int pagelen = getPageLength();
+        final Object[] colids = getVisibleColumns();
+        final int cols = colids.length;
+        final int pagelen = getPageLength();
         int firstIndex = getCurrentPageFirstItemIndex();
         int rows = size();
         if (rows > 0 && firstIndex >= 0) {
@@ -1791,8 +1772,8 @@ public class Table extends AbstractSelect implements Action.Container,
             }
         }
 
-        int headmode = getRowHeaderMode();
-        boolean[] iscomponent = new boolean[cols];
+        final int headmode = getRowHeaderMode();
+        final boolean[] iscomponent = new boolean[cols];
         for (int i = 0; i < cols; i++) {
             iscomponent[i] = Component.class
                     .isAssignableFrom(getType(colids[i]));
@@ -1816,7 +1797,7 @@ public class Table extends AbstractSelect implements Action.Container,
             if (cols > 0) {
                 for (int j = 0; j < cols; j++) {
                     Object value = null;
-                    Property p = getContainerProperty(id, colids[j]);
+                    final Property p = getContainerProperty(id, colids[j]);
                     if (p != null) {
                         if (p instanceof Property.ValueChangeNotifier) {
                             ((Property.ValueChangeNotifier) p)
@@ -1849,7 +1830,7 @@ public class Table extends AbstractSelect implements Action.Container,
 
         // Assures that all the rows of the cell-buffer are valid
         if (filledRows != cells[0].length) {
-            Object[][] temp = new Object[cells.length][filledRows];
+            final Object[][] temp = new Object[cells.length][filledRows];
             for (int i = 0; i < cells.length; i++) {
                 for (int j = 0; j < filledRows; j++) {
                     temp[i][j] = cells[i][j];
@@ -1886,8 +1867,8 @@ public class Table extends AbstractSelect implements Action.Container,
     protected Object getPropertyValue(Object rowId, Object colId,
             Property property) {
         if (isEditable() && fieldFactory != null) {
-            Field f = fieldFactory.createField(getContainerDataSource(), rowId,
-                    colId, this);
+            final Field f = fieldFactory.createField(getContainerDataSource(),
+                    rowId, colId, this);
             if (f != null) {
                 f.setPropertyDataSource(property);
                 return f;
@@ -1984,7 +1965,7 @@ public class Table extends AbstractSelect implements Action.Container,
         super.attach();
 
         if (visibleComponents != null) {
-            for (Iterator i = visibleComponents.iterator(); i.hasNext();) {
+            for (final Iterator i = visibleComponents.iterator(); i.hasNext();) {
                 ((Component) i.next()).attach();
             }
         }
@@ -1999,7 +1980,7 @@ public class Table extends AbstractSelect implements Action.Container,
         super.detach();
 
         if (visibleComponents != null) {
-            for (Iterator i = visibleComponents.iterator(); i.hasNext();) {
+            for (final Iterator i = visibleComponents.iterator(); i.hasNext();) {
                 ((Component) i.next()).detach();
             }
         }
@@ -2022,8 +2003,9 @@ public class Table extends AbstractSelect implements Action.Container,
      * @see com.itmill.toolkit.data.Container#removeItem(Object)
      */
     public boolean removeItem(Object itemId) {
-        Object nextItemId = ((Container.Ordered) items).nextItemId(itemId);
-        boolean ret = super.removeItem(itemId);
+        final Object nextItemId = ((Container.Ordered) items)
+                .nextItemId(itemId);
+        final boolean ret = super.removeItem(itemId);
         if (ret && (itemId != null) && (itemId.equals(currentPageFirstItemId))) {
             currentPageFirstItemId = nextItemId;
         }
@@ -2111,9 +2093,9 @@ public class Table extends AbstractSelect implements Action.Container,
      */
     public Collection getVisibleItemIds() {
 
-        LinkedList visible = new LinkedList();
+        final LinkedList visible = new LinkedList();
 
-        Object[][] cells = getVisibleCells();
+        final Object[][] cells = getVisibleCells();
         for (int i = 0; i < cells[CELL_ITEMID].length; i++) {
             visible.add(cells[CELL_ITEMID][i]);
         }
@@ -2334,9 +2316,9 @@ public class Table extends AbstractSelect implements Action.Container,
      */
     public void sort(Object[] propertyId, boolean[] ascending)
             throws UnsupportedOperationException {
-        Container c = getContainerDataSource();
+        final Container c = getContainerDataSource();
         if (c instanceof Container.Sortable) {
-            int pageIndex = getCurrentPageFirstItemIndex();
+            final int pageIndex = getCurrentPageFirstItemIndex();
             ((Container.Sortable) c).sort(propertyId, ascending);
             setCurrentPageFirstItemIndex(pageIndex);
         } else if (c != null) {
@@ -2366,7 +2348,7 @@ public class Table extends AbstractSelect implements Action.Container,
      * @see com.itmill.toolkit.data.Container.Sortable#getSortableContainerPropertyIds()
      */
     public Collection getSortableContainerPropertyIds() {
-        Container c = getContainerDataSource();
+        final Container c = getContainerDataSource();
         if (c instanceof Container.Sortable && !isSortDisabled()) {
             return ((Container.Sortable) c).getSortableContainerPropertyIds();
         } else {
index c90af1058e3b0e64f876d890aa3983b23465a298..056b75a155a1b43ecc19555e57dd435626d33c23 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -174,8 +150,8 @@ public class TextField extends AbstractField {
         }
 
         // Adds the number of column and rows
-        int c = getColumns();
-        int r = getRows();
+        final int c = getColumns();
+        final int r = getRows();
         if (c != 0) {
             target.addAttribute("cols", String.valueOf(c));
         }
@@ -208,11 +184,11 @@ public class TextField extends AbstractField {
      * @see Format
      */
     protected String getFormattedValue() {
-        Object value = getValue();
+        final Object value = getValue();
         if (format != null && value != null) {
             try {
                 return format.format(value);
-            } catch (IllegalArgumentException ignored) {
+            } catch (final IllegalArgumentException ignored) {
                 // Ignored exception
             }
         }
@@ -243,7 +219,7 @@ public class TextField extends AbstractField {
             // Only do the setting if the string representation of the value
             // has been updated
             String newValue = (String) variables.get("text");
-            String oldValue = getFormattedValue();
+            final String oldValue = getFormattedValue();
             if (newValue != null
                     && (oldValue == null || isNullSettingAllowed())
                     && newValue.equals(getNullRepresentation())) {
index 2042d4b312c5bcfb95f7a851f8d585c279a8de40..9ef41c156799fe16565c476b072683936816a053 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -73,7 +49,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
                     "nodeExpand", new Class[] { ExpandEvent.class });
             COLLAPSE_METHOD = CollapseListener.class.getDeclaredMethod(
                     "nodeCollapse", new Class[] { CollapseEvent.class });
-        } catch (java.lang.NoSuchMethodException e) {
+        } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             e.printStackTrace();
             throw new java.lang.RuntimeException(
@@ -231,12 +207,12 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
         boolean result = true;
 
         // Initial stack
-        Stack todo = new Stack();
+        final Stack todo = new Stack();
         todo.add(startItemId);
 
         // Expands recursively
         while (!todo.isEmpty()) {
-            Object id = todo.pop();
+            final Object id = todo.pop();
             if (areChildrenAllowed(id) && !expandItem(id, false)) {
                 result = false;
             }
@@ -284,12 +260,12 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
         boolean result = true;
 
         // Initial stack
-        Stack todo = new Stack();
+        final Stack todo = new Stack();
         todo.add(startItemId);
 
         // Collapse recursively
         while (!todo.isEmpty()) {
-            Object id = todo.pop();
+            final Object id = todo.pop();
             if (areChildrenAllowed(id) && !collapseItem(id)) {
                 result = false;
             }
@@ -360,9 +336,9 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
 
         // Collapses the nodes
         if (variables.containsKey("collapse")) {
-            String[] keys = (String[]) variables.get("collapse");
+            final String[] keys = (String[]) variables.get("collapse");
             for (int i = 0; i < keys.length; i++) {
-                Object id = itemIdMapper.get(keys[i]);
+                final Object id = itemIdMapper.get(keys[i]);
                 if (id != null && isExpanded(id)) {
                     expanded.remove(id);
                     fireCollapseEvent(id);
@@ -376,9 +352,9 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
             if (variables.containsKey("requestChildTree")) {
                 sendChildTree = true;
             }
-            String[] keys = (String[]) variables.get("expand");
+            final String[] keys = (String[]) variables.get("expand");
             for (int i = 0; i < keys.length; i++) {
-                Object id = itemIdMapper.get(keys[i]);
+                final Object id = itemIdMapper.get(keys[i]);
                 if (id != null) {
                     expandItem(id, sendChildTree);
                 }
@@ -391,14 +367,15 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
         // Actions
         if (variables.containsKey("action")) {
 
-            StringTokenizer st = new StringTokenizer((String) variables
+            final StringTokenizer st = new StringTokenizer((String) variables
                     .get("action"), ",");
             if (st.countTokens() == 2) {
-                Object itemId = itemIdMapper.get(st.nextToken());
-                Action action = (Action) actionMapper.get(st.nextToken());
+                final Object itemId = itemIdMapper.get(st.nextToken());
+                final Action action = (Action) actionMapper.get(st.nextToken());
                 if (action != null && containsId(itemId)
                         && actionHandlers != null) {
-                    for (Iterator i = actionHandlers.iterator(); i.hasNext();) {
+                    for (final Iterator i = actionHandlers.iterator(); i
+                            .hasNext();) {
                         ((Action.Handler) i.next()).handleAction(action, this,
                                 itemId);
                     }
@@ -448,7 +425,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
         }
 
         // Initialize variables
-        Set actionSet = new LinkedHashSet();
+        final Set actionSet = new LinkedHashSet();
         String[] selectedKeys;
         if (isMultiSelect()) {
             selectedKeys = new String[((Set) getValue()).size()];
@@ -456,10 +433,10 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
             selectedKeys = new String[(getValue() == null ? 0 : 1)];
         }
         int keyIndex = 0;
-        LinkedList expandedKeys = new LinkedList();
+        final LinkedList expandedKeys = new LinkedList();
 
         // Iterates through hierarchical tree using a stack of iterators
-        Stack iteratorStack = new Stack();
+        final Stack iteratorStack = new Stack();
         Collection ids;
         if (partialUpdate) {
             ids = getChildren(expandedItemId);
@@ -474,7 +451,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
         while (!iteratorStack.isEmpty()) {
 
             // Gets the iterator for current tree level
-            Iterator i = (Iterator) iteratorStack.peek();
+            final Iterator i = (Iterator) iteratorStack.peek();
 
             // If the level is finished, back to previous tree level
             if (!i.hasNext()) {
@@ -490,10 +467,10 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
 
             // Adds the item on current level
             else {
-                Object itemId = i.next();
+                final Object itemId = i.next();
 
                 // Starts the item / node
-                boolean isNode = areChildrenAllowed(itemId)
+                final boolean isNode = areChildrenAllowed(itemId)
                         && hasChildren(itemId);
                 if (isNode) {
                     target.startTag("node");
@@ -503,11 +480,11 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
 
                 // Adds the attributes
                 target.addAttribute("caption", getItemCaption(itemId));
-                Resource icon = getItemIcon(itemId);
+                final Resource icon = getItemIcon(itemId);
                 if (icon != null) {
                     target.addAttribute("icon", getItemIcon(itemId));
                 }
-                String key = itemIdMapper.key(itemId);
+                final String key = itemIdMapper.key(itemId);
                 target.addAttribute("key", key);
                 if (isSelected(itemId)) {
                     target.addAttribute("selected", true);
@@ -520,14 +497,14 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
 
                 // Actions
                 if (actionHandlers != null) {
-                    ArrayList keys = new ArrayList();
-                    for (Iterator ahi = actionHandlers.iterator(); ahi
+                    final ArrayList keys = new ArrayList();
+                    for (final Iterator ahi = actionHandlers.iterator(); ahi
                             .hasNext();) {
-                        Action[] aa = ((Action.Handler) ahi.next()).getActions(
-                                itemId, this);
+                        final Action[] aa = ((Action.Handler) ahi.next())
+                                .getActions(itemId, this);
                         if (aa != null) {
                             for (int ai = 0; ai < aa.length; ai++) {
-                                String akey = actionMapper.key(aa[ai]);
+                                final String akey = actionMapper.key(aa[ai]);
                                 actionSet.add(aa[ai]);
                                 keys.add(akey);
                             }
@@ -554,8 +531,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
         if (!actionSet.isEmpty()) {
             target.addVariable(this, "action", "");
             target.startTag("actions");
-            for (Iterator i = actionSet.iterator(); i.hasNext();) {
-                Action a = (Action) i.next();
+            for (final Iterator i = actionSet.iterator(); i.hasNext();) {
+                final Action a = (Action) i.next();
                 target.startTag("action");
                 if (a.getCaption() != null) {
                     target.addAttribute("caption", a.getCaption());
@@ -648,8 +625,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
      *      boolean)
      */
     public boolean setChildrenAllowed(Object itemId, boolean areChildrenAllowed) {
-        boolean success = ((Container.Hierarchical) items).setChildrenAllowed(
-                itemId, areChildrenAllowed);
+        final boolean success = ((Container.Hierarchical) items)
+                .setChildrenAllowed(itemId, areChildrenAllowed);
         if (success) {
             fireValueChange(false);
         }
@@ -663,8 +640,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
      *      Object)
      */
     public boolean setParent(Object itemId, Object newParentId) {
-        boolean success = ((Container.Hierarchical) items).setParent(itemId,
-                newParentId);
+        final boolean success = ((Container.Hierarchical) items).setParent(
+                itemId, newParentId);
         if (success) {
             requestRepaint();
         }
@@ -923,18 +900,18 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
      */
     public Collection getVisibleItemIds() {
 
-        LinkedList visible = new LinkedList();
+        final LinkedList visible = new LinkedList();
 
         // Iterates trough hierarchical tree using a stack of iterators
-        Stack iteratorStack = new Stack();
-        Collection ids = rootItemIds();
+        final Stack iteratorStack = new Stack();
+        final Collection ids = rootItemIds();
         if (ids != null) {
             iteratorStack.push(ids.iterator());
         }
         while (!iteratorStack.isEmpty()) {
 
             // Gets the iterator for current tree level
-            Iterator i = (Iterator) iteratorStack.peek();
+            final Iterator i = (Iterator) iteratorStack.peek();
 
             // If the level is finished, back to previous tree level
             if (!i.hasNext()) {
@@ -945,7 +922,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
 
             // Adds the item on current level
             else {
-                Object itemId = i.next();
+                final Object itemId = i.next();
 
                 visible.add(itemId);
 
index 3a77d868f4277de3a82f6e54b60dcf636dbd1b7c..2799bb7c0e1b7020cc95b913fb2ad330d99240a8 100644 (file)
@@ -1,6 +1,7 @@
-/**
- * 
+/* 
+@ITMillApache2LicenseForJavaFiles@
  */
+
 package com.itmill.toolkit.ui;
 
 import java.util.Collection;
index 998178d0d257709b440535eb94d830b6fad71918..5604465b759310aff4214820d70b6e18a6efa78b 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -56,7 +32,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
     /**
      * Should the field be focused on next repaint?
      */
-    private boolean focus = false;
+    private final boolean focus = false;
 
     /**
      * The tab order number of this field.
@@ -114,19 +90,19 @@ public class Upload extends AbstractComponent implements Component.Focusable {
         }
 
         // Gets file properties
-        String filename = upload.getContentName();
-        String type = upload.getContentType();
+        final String filename = upload.getContentName();
+        final String type = upload.getContentType();
 
         fireStarted(filename, type);
 
         // Gets the output target stream
-        OutputStream out = receiver.receiveUpload(filename, type);
+        final OutputStream out = receiver.receiveUpload(filename, type);
         if (out == null) {
             throw new RuntimeException(
                     "Error getting outputstream from upload receiver");
         }
 
-        InputStream in = upload.getStream();
+        final InputStream in = upload.getStream();
 
         if (null == in) {
             // No file, for instance non-existent filename in html upload
@@ -135,7 +111,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
             return;
         }
 
-        byte buffer[] = new byte[BUFFER_SIZE];
+        final byte buffer[] = new byte[BUFFER_SIZE];
         int bytesRead = 0;
         totalBytes = 0;
         try {
@@ -155,7 +131,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
             endUpload();
             requestRepaint();
 
-        } catch (IOException e) {
+        } catch (final IOException e) {
 
             // Download interrupted
             fireUploadInterrupted(filename, type, totalBytes);
@@ -246,7 +222,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
             UPLOAD_SUCCEEDED_METHOD = SucceededListener.class
                     .getDeclaredMethod("uploadSucceeded",
                             new Class[] { SucceededEvent.class });
-        } catch (java.lang.NoSuchMethodException e) {
+        } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             throw new java.lang.RuntimeException("Internal error");
         }
@@ -271,17 +247,17 @@ public class Upload extends AbstractComponent implements Component.Focusable {
         /**
          * Length of the received file.
          */
-        private long length;
+        private final long length;
 
         /**
          * MIME type of the received file.
          */
-        private String type;
+        private final String type;
 
         /**
          * Received file name.
          */
-        private String filename;
+        private final String filename;
 
         /**
          * 
@@ -413,8 +389,8 @@ public class Upload extends AbstractComponent implements Component.Focusable {
          * Serial generated by eclipse.
          */
         private static final long serialVersionUID = -3984393770487403525L;
-        private String filename;
-        private String type;
+        private final String filename;
+        private final String type;
 
         /**
          * 
@@ -687,7 +663,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
      * @see com.itmill.toolkit.ui.Component.Focusable#focus()
      */
     public void focus() {
-        Window w = getWindow();
+        final Window w = getWindow();
         if (w != null) {
             w.setFocusedComponent(this);
         }
index e104c5881d36fd4feeacac08dd8f0580a183bc67..92ed8db5ada00a6921b00013cd15571a3e40ab69 100644 (file)
@@ -1,30 +1,6 @@
-/* *************************************************************************
- IT Mill Toolkit 
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might 
- require purchasing a commercial license from IT Mill Ltd. For guidelines 
- on usage, see licensing-guidelines.html
-
- *************************************************************************
- For more information, contact:
- IT Mill Ltd                           phone: +358 2 4802 7180
- Ruukinkatu 2-4                        fax:   +358 2 4802 7181
- 20540, Turku                          email:  info@itmill.com
- Finland                               company www: www.itmill.com
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
+/* 
+@ITMillApache2LicenseForJavaFiles@
+ */
 
 package com.itmill.toolkit.ui;
 
@@ -349,7 +325,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
                 handlers = uriHandlerList.toArray();
             }
             for (int i = 0; i < handlers.length; i++) {
-                DownloadStream ds = ((URIHandler) handlers[i]).handleURI(
+                final DownloadStream ds = ((URIHandler) handlers[i]).handleURI(
                         context, relativeUri);
                 if (ds != null) {
                     if (result != null) {
@@ -477,11 +453,11 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
             throws PaintException {
 
         // Sets the window name
-        String name = getName();
+        final String name = getName();
         target.addAttribute("name", name == null ? "" : name);
 
         // Sets the window theme
-        String theme = getTheme();
+        final String theme = getTheme();
         target.addAttribute("theme", theme == null ? "" : theme);
 
         if (modal) {
@@ -497,7 +473,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
         // Open requested resource
         synchronized (openList) {
             if (!openList.isEmpty()) {
-                for (Iterator i = openList.iterator(); i.hasNext();) {
+                for (final Iterator i = openList.iterator(); i.hasNext();) {
                     ((OpenResource) i.next()).paintContent(target);
                 }
                 openList.clear();
@@ -527,16 +503,16 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
         }
 
         // Paint subwindows
-        for (Iterator i = subwindows.iterator(); i.hasNext();) {
-            Window w = (Window) i.next();
+        for (final Iterator i = subwindows.iterator(); i.hasNext();) {
+            final Window w = (Window) i.next();
             w.paint(target);
         }
 
         // Paint notifications
         if (notifications != null) {
             target.startTag("notifications");
-            for (Iterator it = notifications.iterator(); it.hasNext();) {
-                Notification n = (Notification) it.next();
+            for (final Iterator it = notifications.iterator(); it.hasNext();) {
+                final Notification n = (Notification) it.next();
                 target.startTag("notification");
                 if (n.getCaption() != null) {
                     target.addAttribute("caption", n.getCaption());
@@ -636,7 +612,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
 
         try {
             return new URL(application.getURL(), getName() + "/");
-        } catch (MalformedURLException e) {
+        } catch (final MalformedURLException e) {
             throw new RuntimeException("Internal problem, please report");
         }
     }
@@ -858,42 +834,42 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
         super.changeVariables(source, variables);
 
         // Gets the focused component
-        String focusedId = (String) variables.get("focused");
+        final String focusedId = (String) variables.get("focused");
         if (focusedId != null) {
             try {
-                long id = Long.parseLong(focusedId);
+                final long id = Long.parseLong(focusedId);
                 focusedComponent = Window.getFocusableById(id);
-            } catch (NumberFormatException ignored) {
+            } catch (final NumberFormatException ignored) {
                 // We ignore invalid focusable ids
             }
         }
 
         // Positioning
-        Integer positionx = (Integer) variables.get("positionx");
+        final Integer positionx = (Integer) variables.get("positionx");
         if (positionx != null) {
-            int x = positionx.intValue();
+            final int x = positionx.intValue();
             setPositionX(x < 0 ? -1 : x);
         }
-        Integer positiony = (Integer) variables.get("positiony");
+        final Integer positiony = (Integer) variables.get("positiony");
         if (positiony != null) {
-            int y = positiony.intValue();
+            final int y = positiony.intValue();
             setPositionY(y < 0 ? -1 : y);
         }
 
         // Scroll position
-        Integer scrolltop = (Integer) variables.get("scrolltop");
+        final Integer scrolltop = (Integer) variables.get("scrolltop");
         if (scrolltop != null) {
-            int top = scrolltop.intValue();
+            final int top = scrolltop.intValue();
             setScrollTop(top < 0 ? 0 : top);
         }
-        Integer scrollleft = (Integer) variables.get("scrollleft");
+        final Integer scrollleft = (Integer) variables.get("scrollleft");
         if (scrollleft != null) {
-            int left = scrollleft.intValue();
+            final int left = scrollleft.intValue();
             setScrollLeft(left < 0 ? 0 : left);
         }
 
         // Closing
-        Boolean close = (Boolean) variables.get("close");
+        final Boolean close = (Boolean) variables.get("close");
         if (close != null && close.booleanValue()) {
             setVisible(false);
             fireClose();
@@ -916,7 +892,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
      *                the Focused component or null if none is focused.
      */
     public void setFocusedComponent(Component.Focusable focusable) {
-        Application app = getApplication();
+        final Application app = getApplication();
         if (app != null) {
             app.setFocusedComponent(focusable);
             focusedComponent = focusable;
@@ -936,8 +912,8 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
      *                the focused component.
      */
     public static long getNewFocusableId(Component.Focusable focusable) {
-        long newId = ++lastUsedFocusableId;
-        WeakReference ref = new WeakReference(focusable);
+        final long newId = ++lastUsedFocusableId;
+        final WeakReference ref = new WeakReference(focusable);
         focusableComponents.put(new Long(newId), ref);
         return newId;
     }
@@ -950,10 +926,10 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
      * @return the focusable Id.
      */
     public static Component.Focusable getFocusableById(long focusableId) {
-        WeakReference ref = (WeakReference) focusableComponents.get(new Long(
-                focusableId));
+        final WeakReference ref = (WeakReference) focusableComponents
+                .get(new Long(focusableId));
         if (ref != null) {
-            Object o = ref.get();
+            final Object o = ref.get();
             if (o != null) {
                 return (Component.Focusable) o;
             }
@@ -968,8 +944,8 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
      *                the focusable Id to remove.
      */
     public static void removeFocusableId(long focusableId) {
-        Long id = new Long(focusableId);
-        WeakReference ref = (WeakReference) focusableComponents.get(id);
+        final Long id = new Long(focusableId);
+        final WeakReference ref = (WeakReference) focusableComponents.get(id);
         ref.clear();
         focusableComponents.remove(id);
     }
@@ -1033,7 +1009,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
         try {
             WINDOW_CLOSE_METHOD = CloseListener.class.getDeclaredMethod(
                     "windowClose", new Class[] { CloseEvent.class });
-        } catch (java.lang.NoSuchMethodException e) {
+        } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             throw new java.lang.RuntimeException();
         }