[kune-commits] r1127 - in trunk/src/main/java/org/ourproject/kune: app/client platf/client/actions/ui platf/client/services platf/client/ui/rte/saving workspace/client/hello

vjrj vjrj at ourproject.org
Fri Jun 12 02:39:54 CEST 2009


Author: vjrj
Date: 2009-06-12 02:39:51 +0200 (Fri, 12 Jun 2009)
New Revision: 1127

Added:
   trunk/src/main/java/org/ourproject/kune/platf/client/services/Loader.java
Removed:
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java
Modified:
   trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/SubMenuGui.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/CoreModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java
Log:
Complete - task Hello World updated and Application Boot improved 


Modified: trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java	2009-06-11 22:14:06 UTC (rev 1126)
+++ trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java	2009-06-12 00:39:51 UTC (rev 1127)
@@ -23,15 +23,15 @@
 import org.ourproject.kune.chat.client.ChatClientModule;
 import org.ourproject.kune.docs.client.DocumentClientModule;
 import org.ourproject.kune.gallery.client.GalleryClientModule;
-import org.ourproject.kune.platf.client.services.CoreModule;
+import org.ourproject.kune.platf.client.services.Loader;
 import org.ourproject.kune.platf.client.services.PlatformModule;
 import org.ourproject.kune.wiki.client.WikiClientModule;
 import org.ourproject.kune.workspace.client.RegistryModule;
 import org.ourproject.kune.workspace.client.WorkspaceModule;
+import org.ourproject.kune.workspace.client.hello.HelloWorldModule;
 
 import com.allen_sauer.gwt.log.client.Log;
 import com.calclab.emiteuimodule.client.EmiteUIModule;
-import com.calclab.suco.client.Suco;
 import com.google.gwt.core.client.EntryPoint;
 import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.DeferredCommand;
@@ -52,8 +52,11 @@
         // At the moment, in runtime:
         Log.setCurrentLogLevel(Log.LOG_LEVEL_DEBUG);
 
-        Suco.install(new CoreModule(), new RegistryModule(), new PlatformModule(), new EmiteUIModule(),
-                new DocumentClientModule(), new BlogClientModule(), new WikiClientModule(), new GalleryClientModule(),
-                new ChatClientModule(), new WorkspaceModule());
+        Loader.install(new RegistryModule(), new DocumentClientModule(), new BlogClientModule(),
+                new WikiClientModule(), new GalleryClientModule(), new EmiteUIModule(), new ChatClientModule(),
+                new WorkspaceModule(), new PlatformModule());
+
+        // We install our HelloWorldModule
+        Loader.install(new HelloWorldModule());
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/SubMenuGui.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/SubMenuGui.java	2009-06-11 22:14:06 UTC (rev 1126)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/SubMenuGui.java	2009-06-12 00:39:51 UTC (rev 1127)
@@ -14,7 +14,7 @@
         item = new MenuItem();
         item.setMenu(menu);
         setAction(descriptor.action);
-        // initWidget(item);
+        initWidget(item);
     }
 
     public MenuItem getMenuItem() {

Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java	2009-06-11 22:14:06 UTC (rev 1126)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java	2009-06-12 00:39:51 UTC (rev 1127)
@@ -1,75 +0,0 @@
-package org.ourproject.kune.platf.client.actions.ui;
-
-import org.ourproject.kune.platf.client.actions.AbstractAction;
-import org.ourproject.kune.platf.client.actions.Action;
-import org.ourproject.kune.platf.client.actions.ActionEvent;
-import org.ourproject.kune.platf.client.ui.img.ImgResources;
-import org.ourproject.kune.platf.client.ui.noti.NotifyUser;
-import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-
-import com.google.gwt.user.client.Timer;
-
-public class TestButton {
-
-    static class HelloWorldAction extends AbstractAction {
-        public HelloWorldAction(final ImgResources img) {
-            super();
-            super.putValue(Action.NAME, "helloword");
-            super.putValue(Action.SHORT_DESCRIPTION, "helloworld item");
-            super.putValue(Action.SMALL_ICON, img.info());
-        }
-
-        public void actionPerformed(final ActionEvent actionEvent) {
-            if (actionEvent.getEvent().getCtrlKey()) {
-                NotifyUser.info("Button clicked with ctrl button");
-            }
-            NotifyUser.info("Button clicked");
-        }
-    }
-
-    public TestButton(final WorkspaceSkeleton wksp, final GuiBindingsRegister bindings, final ImgResources img) {
-        final HelloWorldAction noti = new HelloWorldAction(img);
-
-        final PushButtonDescriptor btn = new PushButtonDescriptor(noti);
-
-        final MenuDescriptor menu = new MenuDescriptor("File", "File menu tooltip", null);
-
-        final MenuItemDescriptor item = new MenuItemDescriptor(menu, noti);
-        final MenuItemDescriptor item2 = new MenuItemDescriptor(menu, noti);
-        final MenuDescriptor submenu = new MenuDescriptor("Options", "submenu tooltip", null);
-        submenu.setParent(menu);
-        final MenuItemDescriptor item3 = new MenuItemDescriptor(submenu, noti);
-        final MenuCheckItemDescriptor item4 = new MenuCheckItemDescriptor(submenu, noti);
-        item4.setChecked(true);
-        final MenuRadioItemDescriptor item5 = new MenuRadioItemDescriptor(submenu, noti, "new");
-        final MenuRadioItemDescriptor item6 = new MenuRadioItemDescriptor(submenu, noti, "new");
-        item5.setChecked(true);
-        final ComplexToolbar toolbar = new ComplexToolbar(bindings);
-
-        toolbar.add(btn, menu);
-        toolbar.add(item);
-        toolbar.add(new MenuSeparatorDescriptor(menu));
-        toolbar.add(item2);
-        toolbar.add(submenu);
-        toolbar.add(item3);
-        toolbar.add(item4);
-        toolbar.add(new MenuSeparatorDescriptor(submenu));
-        toolbar.add(item5);
-        toolbar.add(item6);
-        // toolbar.add(new ToolbarSeparatorDescriptor(Type.separator));
-
-        wksp.getEntityWorkspace().getBottomTitle().add(toolbar);
-
-        new Timer() {
-            @Override
-            public void run() {
-                noti.putValue(Action.NAME, "test2");
-                noti.putValue(Action.SHORT_DESCRIPTION, "test2 button");
-                btn.setPushed(false);
-            }
-        }.schedule(10000);
-
-        btn.setPushed(true);
-
-    }
-}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/CoreModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/CoreModule.java	2009-06-11 22:14:06 UTC (rev 1126)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/CoreModule.java	2009-06-12 00:39:51 UTC (rev 1127)
@@ -21,18 +21,97 @@
 
 import org.ourproject.kune.platf.client.app.ApplicationComponentGroup;
 import org.ourproject.kune.platf.client.app.EntityOptionsGroup;
+import org.ourproject.kune.platf.client.app.HistoryWrapper;
+import org.ourproject.kune.platf.client.app.HistoryWrapperDefault;
 import org.ourproject.kune.platf.client.app.ToolGroup;
+import org.ourproject.kune.platf.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.platf.client.rpc.I18nService;
+import org.ourproject.kune.platf.client.rpc.I18nServiceAsync;
+import org.ourproject.kune.platf.client.rpc.UserService;
+import org.ourproject.kune.platf.client.rpc.UserServiceAsync;
+import org.ourproject.kune.platf.client.state.ContentProvider;
+import org.ourproject.kune.platf.client.state.ContentProviderDefault;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.SessionDefault;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.state.StateManagerDefault;
 import org.ourproject.kune.platf.client.ui.rte.insertimg.InsertImageGroup;
 import org.ourproject.kune.platf.client.ui.rte.insertlink.InsertLinkGroup;
 import org.ourproject.kune.platf.client.ui.rte.insertmedia.InsertMediaGroup;
 import org.ourproject.kune.platf.client.ui.rte.insertspecialchar.InsertSpecialCharGroup;
 
-import com.calclab.suco.client.ioc.module.AbstractModule;
+import com.calclab.suco.client.events.Listener0;
+import com.calclab.suco.client.ioc.decorator.Singleton;
+import com.calclab.suco.client.ioc.module.Factory;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.Cookies;
+import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
 
-public class CoreModule extends AbstractModule {
+public class CoreModule extends AbstractExtendedModule {
 
+    private final Listener0 onI18nReady;
+
+    public CoreModule(final Listener0 onI18nReady) {
+        this.onI18nReady = onI18nReady;
+    }
+
     @Override
-    public void onInstall() {
+    protected void onInstall() {
+
+        register(Singleton.class, new Factory<Session>(Session.class) {
+            @Override
+            public Session create() {
+                return new SessionDefault(Cookies.getCookie(Session.USERHASH), p(UserServiceAsync.class));
+            }
+        }, new Factory<I18nServiceAsync>(I18nServiceAsync.class) {
+            @Override
+            public I18nServiceAsync create() {
+                final I18nServiceAsync service = (I18nServiceAsync) GWT.create(I18nService.class);
+                ((ServiceDefTarget) service).setServiceEntryPoint(GWT.getModuleBaseURL() + "I18nService");
+                return service;
+            }
+        }, new Factory<UserServiceAsync>(UserServiceAsync.class) {
+            @Override
+            public UserServiceAsync create() {
+                final UserServiceAsync service = (UserServiceAsync) GWT.create(UserService.class);
+                ((ServiceDefTarget) service).setServiceEntryPoint(GWT.getModuleBaseURL() + "UserService");
+                return service;
+            }
+        });
+
+        register(Singleton.class, new Factory<I18nUITranslationService>(I18nUITranslationService.class) {
+            @Override
+            public I18nUITranslationService create() {
+                final I18nUITranslationService i18n = new I18nUITranslationService();
+                i18n.init(i(I18nServiceAsync.class), i(Session.class), onI18nReady);
+                return i18n;
+            }
+        });
+
+        i(I18nUITranslationService.class);
+
+        register(Singleton.class, new Factory<HistoryWrapper>(HistoryWrapper.class) {
+            @Override
+            public HistoryWrapper create() {
+                return new HistoryWrapperDefault();
+            }
+        }, new Factory<ContentProvider>(ContentProvider.class) {
+            @Override
+            public ContentProvider create() {
+                return new ContentProviderDefault(i(ContentServiceAsync.class));
+            }
+        }, new Factory<StateManager>(StateManager.class) {
+            @Override
+            public StateManager create() {
+                final StateManagerDefault stateManager = new StateManagerDefault(i(ContentProvider.class),
+                        i(Session.class), i(HistoryWrapper.class));
+                History.addValueChangeHandler(stateManager);
+                return stateManager;
+            }
+        });
+
         registerDecorator(ApplicationComponentGroup.class, new ApplicationComponentGroup(container));
         registerDecorator(ToolGroup.class, new ToolGroup(container));
         registerDecorator(EntityOptionsGroup.class, new EntityOptionsGroup(container));

Added: trunk/src/main/java/org/ourproject/kune/platf/client/services/Loader.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/Loader.java	2009-06-11 22:14:06 UTC (rev 1126)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/Loader.java	2009-06-12 00:39:51 UTC (rev 1127)
@@ -0,0 +1,67 @@
+package org.ourproject.kune.platf.client.services;
+
+import java.util.ArrayList;
+
+import com.calclab.suco.client.Suco;
+import com.calclab.suco.client.events.Listener0;
+import com.calclab.suco.client.ioc.Container;
+import com.calclab.suco.client.ioc.module.SucoModule;
+
+public class Loader extends Suco {
+
+    private static ArrayList<SucoModule> pendingModules = new ArrayList<SucoModule>();
+    private static boolean deferred = true;
+    private static boolean initialized = false;
+
+    /**
+     * Obtain a instance from the Suco container
+     *
+     * @param <T>
+     * @param componentType
+     * @return
+     */
+    public static <T> T get(final Class<T> componentType) {
+        return Suco.get(componentType);
+    }
+
+    /**
+     * Get the Suco container itself.
+     *
+     * @return the Suco singleton container
+     */
+    public static Container getComponents() {
+        return Suco.getComponents();
+    }
+
+    /**
+     * Install the given modules into the container
+     *
+     * @param modules
+     *            the list of modules to be installed in the singleton Suco
+     *            container
+     */
+    public static void install(final SucoModule... modules) {
+        init();
+        if (deferred) {
+            for (final SucoModule module : modules) {
+                pendingModules.add(module);
+            }
+        } else {
+            Suco.install(modules);
+        }
+    }
+
+    private static void init() {
+        if (!initialized) {
+            Suco.install(new CoreModule(new Listener0() {
+                public void onEvent() {
+                    for (final SucoModule module : pendingModules) {
+                        Suco.install(module);
+                    }
+                    deferred = false;
+                }
+            }));
+            initialized = true;
+        }
+    }
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java	2009-06-11 22:14:06 UTC (rev 1126)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java	2009-06-12 00:39:51 UTC (rev 1127)
@@ -24,25 +24,14 @@
 import org.ourproject.kune.platf.client.app.Application;
 import org.ourproject.kune.platf.client.app.ApplicationComponentGroup;
 import org.ourproject.kune.platf.client.app.ApplicationDefault;
-import org.ourproject.kune.platf.client.app.HistoryWrapper;
-import org.ourproject.kune.platf.client.app.HistoryWrapperDefault;
 import org.ourproject.kune.platf.client.app.ToolGroup;
 import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
 import org.ourproject.kune.platf.client.i18n.I18nUITranslationService;
 import org.ourproject.kune.platf.client.i18n.Resources;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-import org.ourproject.kune.platf.client.rpc.I18nService;
-import org.ourproject.kune.platf.client.rpc.I18nServiceAsync;
-import org.ourproject.kune.platf.client.rpc.UserService;
-import org.ourproject.kune.platf.client.rpc.UserServiceAsync;
 import org.ourproject.kune.platf.client.shortcuts.GlobalShortcutRegister;
-import org.ourproject.kune.platf.client.state.ContentProvider;
-import org.ourproject.kune.platf.client.state.ContentProviderDefault;
 import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.state.SessionDefault;
 import org.ourproject.kune.platf.client.state.StateManager;
-import org.ourproject.kune.platf.client.state.StateManagerDefault;
 import org.ourproject.kune.platf.client.ui.QuickTipsHelper;
 import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
 import org.ourproject.kune.platf.client.ui.img.ImgResources;
@@ -115,75 +104,17 @@
 import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper;
 import org.ourproject.kune.platf.client.utils.TimerWrapper;
 
-import com.calclab.suco.client.events.Listener0;
 import com.calclab.suco.client.ioc.decorator.NoDecoration;
 import com.calclab.suco.client.ioc.decorator.Singleton;
 import com.calclab.suco.client.ioc.module.Factory;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.libideas.client.StyleInjector;
-import com.google.gwt.user.client.Cookies;
-import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.rpc.ServiceDefTarget;
 
 public class PlatformModule extends AbstractExtendedModule {
 
     @Override
     protected void onInstall() {
 
-        register(Singleton.class, new Factory<Session>(Session.class) {
-            @Override
-            public Session create() {
-                return new SessionDefault(Cookies.getCookie(Session.USERHASH), p(UserServiceAsync.class));
-            }
-        }, new Factory<I18nServiceAsync>(I18nServiceAsync.class) {
-            @Override
-            public I18nServiceAsync create() {
-                final I18nServiceAsync service = (I18nServiceAsync) GWT.create(I18nService.class);
-                ((ServiceDefTarget) service).setServiceEntryPoint(GWT.getModuleBaseURL() + "I18nService");
-                return service;
-            }
-        }, new Factory<UserServiceAsync>(UserServiceAsync.class) {
-            @Override
-            public UserServiceAsync create() {
-                final UserServiceAsync service = (UserServiceAsync) GWT.create(UserService.class);
-                ((ServiceDefTarget) service).setServiceEntryPoint(GWT.getModuleBaseURL() + "UserService");
-                return service;
-            }
-        });
-
-        register(Singleton.class, new Factory<HistoryWrapper>(HistoryWrapper.class) {
-            @Override
-            public HistoryWrapper create() {
-                return new HistoryWrapperDefault();
-            }
-        }, new Factory<ContentProvider>(ContentProvider.class) {
-            @Override
-            public ContentProvider create() {
-                return new ContentProviderDefault(i(ContentServiceAsync.class));
-            }
-        }, new Factory<StateManager>(StateManager.class) {
-            @Override
-            public StateManager create() {
-                final StateManagerDefault stateManager = new StateManagerDefault(i(ContentProvider.class),
-                        i(Session.class), i(HistoryWrapper.class));
-                History.addValueChangeHandler(stateManager);
-                return stateManager;
-            }
-        });
-
-        register(Singleton.class, new Factory<I18nUITranslationService>(I18nUITranslationService.class) {
-            @Override
-            public I18nUITranslationService create() {
-                final I18nUITranslationService i18n = new I18nUITranslationService();
-                i18n.init(i(I18nServiceAsync.class), i(Session.class), new Listener0() {
-                    public void onEvent() {
-                        onI18nReady();
-                    }
-                });
-                return i18n;
-            }
-        });
-
         register(Singleton.class, new Factory<FileDownloadUtils>(FileDownloadUtils.class) {
             @Override
             public FileDownloadUtils create() {
@@ -200,12 +131,8 @@
             });
         }
 
-        i(I18nUITranslationService.class);
         i(QuickTipsHelper.class);
 
-    }
-
-    private void onI18nReady() {
         final I18nUITranslationService i18n = i(I18nUITranslationService.class);
 
         if (container.hasProvider(I18nTranslationService.class)) {
@@ -534,12 +461,5 @@
         i(ToolGroup.class).createAll();
         i(Application.class).start();
 
-        // We install our HelloWorldModule
-        //Suco.install(new HelloWorldModule());
-
-        // And because nobody use this module, we get the class (to force the
-        // creation of the
-        // Helloworld instance):
-        //i(HelloWorld.class);
     }
 }
\ No newline at end of file

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java	2009-06-11 22:14:06 UTC (rev 1126)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java	2009-06-12 00:39:51 UTC (rev 1127)
@@ -233,7 +233,7 @@
         saveAction = new SaveAction(NO_TEXT, i18n.t("Save"),imgResources.save());
 
         final ButtonDescriptor saveBtn = new ButtonDescriptor(saveAction);
-        final KeyStroke key_S = KeyStroke.getKeyStroke(Keyboard.KEY_S, Keyboard.MODIFIER_CTRL);
+        final KeyStroke key_S = KeyStroke.getKeyStroke(Character.valueOf('S'), Keyboard.MODIFIER_CTRL);
         saveBtn.setPosition(0);
         saveBtn.setLocation(RTEditor.SNDBAR);
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java	2009-06-11 22:14:06 UTC (rev 1126)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java	2009-06-12 00:39:51 UTC (rev 1127)
@@ -98,10 +98,15 @@
             /**
              * We can add some gui action items to the content editor
              * 
-             * Summary)
+             * Summary).
              * 
              * @param i18n
-             **/
+             *            the i18n
+             * @param contentEditorProv
+             *            the content editor provider
+             * @param img
+             *            the img
+             */
             private void createActions(final Provider<ContentEditor> contentEditorProv, final ImgResources img,
                     final I18nTranslationService i18n) {
 
@@ -113,7 +118,7 @@
 
                 // We no use i18n.t() in most of these gui widgets but it's is
                 // recommended the use in real code
-                final MenuDescriptor menu = new MenuDescriptor(i18n.t("File"), "File menu tooltip");
+                final MenuDescriptor menu = new MenuDescriptor(i18n.t("HelloWorldMenu"), "File menu tooltip");
 
                 final MenuItemDescriptor menuitem = new MenuItemDescriptor(menu, action);
                 final MenuItemDescriptor menuitem2 = new MenuItemDescriptor(menu, action);
@@ -141,12 +146,11 @@
                 //
                 // Using Provider<Class> we do lazy instantiation. When we call
                 // actionRegistry.get() it creates the instance if is not
-                // created
-                // yet.
+                // created yet.
                 final ContentEditor contentEditor = contentEditorProv.get();
 
                 // We want to add some items to the topbar and other to the
-                // second bar
+                // second bar of the editor
                 contentEditor.setLocation(ContentEditor.TOPBAR, menu, menuitem, menuSeparator, menuitem2, submenu,
                         menuitem3, menuitem4, otherSeparator, menuitem5, menuitem6);
                 contentEditor.setLocation(ContentEditor.SNDBAR, btn);
@@ -160,8 +164,8 @@
                 // It's important to add the menus before its menu items
                 contentEditor.addActions(menuitem2, submenu, menuitem3, menuitem4, otherSeparator, menuitem5, menuitem6);
 
-                // We can change descriptors properties and are changed in the
-                // UI
+                // We can change descriptors properties after render and the UI
+                // is updated automatically
                 btn.setPushed(true);
 
                 // After some time we can change the common action or some other
@@ -170,12 +174,11 @@
                     @Override
                     public void run() {
                         // The text of the action (in the menu or in the button)
-                        action.putValue(Action.NAME, "hello world new");
-                        // And the tooltip (on over message):
-                        action.putValue(Action.SHORT_DESCRIPTION, "hello world new");
+                        action.putValue(Action.NAME, "hello world (updated)");
+                        action.putValue(Action.SHORT_DESCRIPTION, "hello world tooltip (updated)");
                         btn.setPushed(false);
                     }
-                }.schedule(10000);
+                }.schedule(15000);
             }
         }
 
@@ -189,7 +192,7 @@
         }
 
         public void showMessage() {
-            /** i18n use with parameters **/
+            // i18n use with parameters
             NotifyUser.info(i18n.t("Hello [%s]!", "world"));
         }
     }
@@ -205,16 +208,17 @@
     static class HelloWorldAction extends AbstractAction {
         public HelloWorldAction(final ImgResources img) {
             super();
-            super.putValue(Action.NAME, "helloword");
-            super.putValue(Action.SHORT_DESCRIPTION, "helloworld item");
+            super.putValue(Action.NAME, "helloworld");
+            super.putValue(Action.SHORT_DESCRIPTION, "helloworld tooltip");
             super.putValue(Action.SMALL_ICON, img.info());
         }
 
         public void actionPerformed(final ActionEvent actionEvent) {
             if (actionEvent.getEvent().getCtrlKey()) {
                 NotifyUser.info("Hello world action fired with ctrl key pressed");
+            } else {
+                NotifyUser.info("Hello world action fired");
             }
-            NotifyUser.info("Hello world action fired");
         }
     }
 
@@ -241,11 +245,18 @@
         register(Singleton.class, new Factory<HelloWorld>(HelloWorld.class) {
             /**
              * Singleton.class decorator: creates only one instance of
-             * HelloWorld.class and when we use it the provider returns always
+             * HelloWorld.class and when we use it, the provider returns always
              * the same instance.
              * 
              * NoDecorator.class: Use it if we need to create a new instance of
              * HelloWorld.class in every use.
+             * 
+             * Others:
+             * 
+             * ApplicationComponentGroup.class: Use this decorator with parts of
+             * kune that are needed at start time (like main widgets in
+             * workspace). They are created automatically when starting.
+             * 
              */
             @Override
             public HelloWorld create() {
@@ -261,7 +272,7 @@
 
             /**
              * Optionally: we can do something after the instance is created
-             **/
+             */
             @Override
             public void onAfterCreated(final HelloWorld instance) {
                 Log.info("HelloWorld singleton instance created");
@@ -272,7 +283,7 @@
          * we use a mock for i18n in this sample because we don't really want to
          * translate this module messages. Normally we use:
          * I18nTranslationService.class instead of the mock
-         **/
+         */
         register(Singleton.class, new Factory<I18nTranslationServiceMocked>(I18nTranslationServiceMocked.class) {
             @Override
             public I18nTranslationServiceMocked create() {
@@ -288,5 +299,11 @@
                 NotifyUser.info("Global Ctrl+S pressed");
             }
         });
+
+        // And because nobody use this module, we get the class (to force the
+        // creation of the Helloworld instance):
+        // i(HelloWorld.class);
+
+        // See KuneEntryPoint for a sample of modules registration
     }
 }
\ No newline at end of file




More information about the kune-commits mailing list