Ticket #2427: autoActions.patch

File autoActions.patch, 46.3 KB (added by meddle, 15 years ago)

Auto actions and fixes

  • modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/actions/RemoveResourceAction.java

    ### Eclipse Workspace Patch 1.0
    #P sophie
     
     1package org.sophie2.main.func.resources.actions; 
     2 
     3import org.sophie2.base.model.resources.r4.ResourceRefR4; 
     4import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     5import org.sophie2.base.skins.Message; 
     6 
     7/** 
     8 * {@link AutoAction} for deleting a resource. 
     9 *  
     10 * @author diana 
     11 */ 
     12public class RemoveResourceAction extends AutoAction { 
     13         
     14        private final ResourceRefR4 resourceRef; 
     15 
     16        /** 
     17         * Creates the action with the reference to the resource to delete. 
     18         *  
     19         * @param description  
     20         *                      Description of the action.  
     21         * @param significant  
     22         *                      Significance of the action.  
     23         * @param resourceRef 
     24         *                      {@link ResourceRefR4} pointing to the resource to delete. 
     25         */ 
     26        public RemoveResourceAction(Message description, boolean significant, 
     27                        ResourceRefR4 resourceRef) { 
     28                super(description, significant); 
     29                 
     30                this.resourceRef = resourceRef; 
     31        } 
     32 
     33        @Override 
     34        public void performAuto() { 
     35                getChanger().removeResource(this.resourceRef); 
     36        } 
     37} 
  • modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/actions/ApplyTemplateAction.java

     
     1package org.sophie2.main.func.resources.actions; 
     2 
     3import org.sophie2.base.commons.util.NaiveImmList; 
     4import org.sophie2.base.model.resources.r4.ResourceRefR4; 
     5import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     6import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 
     7import org.sophie2.base.skins.Message; 
     8import org.sophie2.main.app.commons.util.TemplateUtil; 
     9 
     10/** 
     11 * {@link AutoAction} for applying a template to a resource. 
     12 *  
     13 * @author deni 
     14 */ 
     15public class ApplyTemplateAction extends AutoAction { 
     16         
     17        private final NaiveImmList<TemplatedKey<?>> immKeys; 
     18        private final ResourceRefR4 templateRef; 
     19        private final String kind; 
     20 
     21        /** 
     22         * Creates the action with all the needed information for applying a 
     23         * template to a resource. 
     24         *  
     25         * @param description  
     26         *                      Description of the action.  
     27         * @param significant  
     28         *                      Significance of the action.  
     29         * @param immKeys 
     30         *                      The templated keys of the resource. 
     31         * @param templateRef 
     32         *                      The reference to the template to apply. 
     33         * @param kind 
     34         *                      The kind of the template. 
     35         */ 
     36        public ApplyTemplateAction(Message description, boolean significant, 
     37                        NaiveImmList<TemplatedKey<?>> immKeys, 
     38                        ResourceRefR4 templateRef, String kind) { 
     39                super(description, significant); 
     40                 
     41                this.immKeys = immKeys; 
     42                this.templateRef = templateRef; 
     43                this.kind = kind; 
     44        } 
     45 
     46        @Override 
     47        public void performAuto() { 
     48                TemplateUtil.applyFrameTemplate(getChanger(),  
     49                                this.immKeys.asList(),  
     50                                this.templateRef, false, this.kind, true); 
     51 
     52        } 
     53} 
  • modules/org.sophie2.main.func.resources/src/test/java/org/sophie2/main/func/resources/imports/ResourceImportUtilTest.java

     
    88 
    99import org.junit.Before; 
    1010import org.junit.Test; 
     11import org.sophie2.base.bound.BoundModule; 
    1112import org.sophie2.base.commons.BaseCommonsModule; 
    1213import org.sophie2.base.commons.util.position.ImmPoint; 
     14import org.sophie2.base.config.BaseConfigModule; 
    1315import org.sophie2.base.dialogs.BaseDialogsModule; 
    1416import org.sophie2.base.dialogs.TestingDialogManager; 
    1517import org.sophie2.base.dnd.DndData; 
     
    2830import org.sophie2.base.model.resources.r4.immutables.SubEntryNames; 
    2931import org.sophie2.base.model.resources.r4.resources.ResourceH; 
    3032import org.sophie2.base.model.resources.r4.resources.ResourceR4; 
     33import org.sophie2.base.persistence.BasePersistenceModule; 
    3134import org.sophie2.base.skins.BaseSkinsModule; 
    3235import org.sophie2.base.skins.Message; 
    3336import org.sophie2.base.visual.BaseVisualModule; 
     
    4144import org.sophie2.main.dialogs.input.file.FileDialogInput; 
    4245import org.sophie2.main.dialogs.input.file.FileFilterInfo; 
    4346import org.sophie2.main.func.file.FileFunctionalityModule; 
     47import org.sophie2.main.func.resources.actions.CreateColdTextAction; 
    4448import org.sophie2.main.func.resources.dummy.ColdTextData; 
    4549import org.sophie2.main.func.resources.dummy.ColdTextFrame; 
    4650import org.sophie2.main.func.resources.dummy.ColdTextImportManager; 
     
    117121        protected List<Class<? extends SophieModule>> fillDependencies() { 
    118122                return Arrays.asList(BaseModelResourcesR4Module.class, 
    119123                                BaseVisualModule.class, BaseMediaModule.class, 
    120                                 BaseCommonsModule.class, MainMediaNatlibModule.class, 
    121                                 BaseDialogsModule.class, BaseSkinsModule.class, 
    122                                 BaseModelBookModule.class, FileFunctionalityModule.class, 
    123                                 MainAppModule.class, 
     124                                BaseConfigModule.class, BasePersistenceModule.class, 
     125                                BaseCommonsModule.class, BoundModule.class,  
     126                                MainMediaNatlibModule.class, BaseDialogsModule.class,  
     127                                BaseSkinsModule.class, BaseModelBookModule.class,  
     128                                FileFunctionalityModule.class, MainAppModule.class, 
    124129                                ColdTextModule.class); 
    125130        } 
    126131         
     
    275280                        ResourceRefR4.generateRandomSub(ColdTextResource.DEFAULT_TITLE); 
    276281                final String text = "My text"; 
    277282                 
    278                 new AutoAction(Message.create(CREATING_COLD_TEXT), true) { 
    279                         @Override 
    280                         public void performAuto() { 
    281                                 ColdTextResourceHelper.createColdText(getChanger(), 
    282                                                 coldRef, text); 
    283                          
    284                         } 
    285                 }.register(bookAccess); 
     283                Message description = Message.create(CREATING_COLD_TEXT); 
     284                AutoAction action = new CreateColdTextAction(description, true, text, coldRef); 
     285                action.register(bookAccess); 
    286286                 
    287287                // text and page: 
    288288                assertEquals(2, book.getChildren().size()); 
  • modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/actions/SetFrameResourceAction.java

     
     1package org.sophie2.main.func.resources.actions; 
     2 
     3import org.sophie2.base.model.book.interfaces.ResourceFrame; 
     4import org.sophie2.base.model.resources.r4.ResourceRefR4; 
     5import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     6import org.sophie2.base.model.resources.r4.resources.ResourceR4; 
     7import org.sophie2.base.skins.Message; 
     8 
     9/** 
     10 * {@link AutoAction} for changing the main resource of a frame. 
     11 *  
     12 * @author deni 
     13 */ 
     14public class SetFrameResourceAction extends AutoAction { 
     15         
     16        private final ResourceRefR4 relRef; 
     17        private final String newFrameKind; 
     18 
     19        /** 
     20         * Creates the action with a relative {@link ResourceRefR4} from the frame to 
     21         * the new main resource and new kind of the frame, corresponding to the resource. 
     22         *  
     23         * @param description  
     24         *                      Description of the action.  
     25         * @param significant  
     26         *                      Significance of the action.  
     27         * @param relRef 
     28         *                      Reference from the frame to the new main resource. 
     29         * @param newFrameKind 
     30         *                      The new frame kind, according to the new main resource. 
     31         */ 
     32        public SetFrameResourceAction(Message description, boolean significant, 
     33                        ResourceRefR4 relRef, String newFrameKind) { 
     34                super(description, significant); 
     35                 
     36                this.relRef = relRef; 
     37                this.newFrameKind = newFrameKind; 
     38        } 
     39 
     40        @Override 
     41        public void performAuto() { 
     42                getChanger().setRaw(ResourceR4.KEY_KIND, this.newFrameKind); 
     43                getChanger().setRaw(ResourceFrame.KEY_MAIN_RESOURCE, this.relRef); 
     44        } 
     45} 
  • modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/imports/ResourceImportUtil.java

     
    3030import org.sophie2.base.model.resources.r4.ResourceUtil; 
    3131import org.sophie2.base.model.resources.r4.access.ResourceAccess; 
    3232import org.sophie2.base.model.resources.r4.changes.AutoAction; 
    33 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 
    3433import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 
    3534import org.sophie2.base.model.resources.r4.model.ResourceModel; 
    3635import org.sophie2.base.model.resources.r4.resources.ResourceH; 
    3736import org.sophie2.base.model.resources.r4.resources.ResourceR4; 
    3837import org.sophie2.base.skins.Message; 
    3938import org.sophie2.core.logging.SophieLog; 
    40 import org.sophie2.main.app.commons.util.TemplateUtil; 
    4139import org.sophie2.main.dialogs.input.DialogUtils; 
    4240import org.sophie2.main.dialogs.input.MessageDialogInput; 
    4341import org.sophie2.main.dialogs.input.MessageDialogInput.MessageType; 
    4442import org.sophie2.main.dialogs.input.file.FileDialogInput; 
     43import org.sophie2.main.func.resources.actions.ApplyTemplateAction; 
     44import org.sophie2.main.func.resources.actions.ImportResourceAction; 
     45import org.sophie2.main.func.resources.actions.InsertFrameAction; 
    4546import org.sophie2.main.func.resources.imports.bindata.ResourceImportType; 
    4647 
    4748/** 
     
    9495                        new ResourceImportInfo<D>(data, resFile.getName(), resFile.toURI(), 
    9596                                        ResourceImportType.EMBED); 
    9697 
    97                 // The description must be smarter... May be with skins --meddle 2009-10-21 
    98                 new AutoAction(Message.create(IMPORT_RES, importInfo.getName()), true) { 
    99                         @Override 
    100                         public void performAuto() { 
    101                                 ResourceChanger changer = getChanger(); 
    102  
    103                                 importManager.makeResource(changer, resourceRef, importInfo); 
    104  
    105                         } 
    106                 }.register(book.getAccess()); 
     98                Message description = Message.create(IMPORT_RES, importInfo.getName()); 
     99                ImportResourceAction<D> action = new ImportResourceAction<D>( 
     100                                description, true, importInfo, resourceRef, importManager); 
     101                action.register(book.getAccess()); 
    107102 
    108103                return resourceRef; 
    109104        }        
     
    135130                final ResourceImportInfo importInfo = new ResourceImportInfo(data, title); 
    136131                final ResourceRefR4 childRef = importManager.generateChildRef(); 
    137132                 
    138                 new AutoAction(Message.create(IMPORT_RES, importInfo.getName()), significant) { 
    139                         @Override 
    140                         public void performAuto() { 
    141  
    142                                 importManager.makeResource(getChanger(), childRef, importInfo); 
    143  
    144                         } 
    145                 }.register(book.getAccess()); 
     133                Message description = Message.create(IMPORT_RES, importInfo.getName()); 
     134                AutoAction action = new ImportResourceAction( 
     135                                description, significant, importInfo, childRef, importManager); 
     136                action.register(book.getAccess()); 
    146137                 
    147138                return book.getRef().append(childRef); 
    148139        } 
     
    179170                final boolean linked = importInfo.isModelLinked();  
    180171 
    181172 
    182                 // The description must be smarter... May be with skins --meddle 2009-10-21 
    183                 new AutoAction(Message.create(INSERT_FRAME_FOR_RESOURCE, importInfo.getName()), true) { 
    184                         @Override 
    185                         public void performAuto() { 
    186                                 ResourceChanger changer = getChanger(); 
    187                                 if (!linked) { 
    188                                         importManager.makeResource(changer, resourceRef, importInfo); 
    189                                 } 
    190  
    191                                 importManager.insertFrame(changer.getSub(parentRef), 
    192                                                 parentRef, frameRef, resourceRef, frameTitle, 
    193                                                 elements, pos, frameSize); 
    194  
    195                         } 
    196                 }.register(book.getAccess()); 
     173                Message description = Message.create(INSERT_FRAME_FOR_RESOURCE, importInfo.getName()); 
     174                AutoAction action = new InsertFrameAction<D>(description, true, importInfo,  
     175                                frameRef, pos, frameSize, elements, parentRef, importManager, linked, 
     176                                resourceRef, frameTitle); 
     177                action.register(book.getAccess()); 
    197178                 
    198179                if (isDefaultTemplate) { 
    199180                        ResourceRefR4 absoluteDefRef = book.getRef().getAbsolute(defaultTemplate); 
     
    211192                        FrameH templateH = ResourceH.getHelper(templateAccess, FrameH.class); 
    212193                        final NaiveImmList<TemplatedKey<?>> immKeys = templateH.getApplicableTemplatedKeys(); 
    213194 
    214                         new AutoAction(Message.create(APPLY_TEMPLATE_FOR_RESOURCE, importInfo.getName()), false) { 
    215                                 @Override 
    216                                 public void performAuto() { 
    217                                         TemplateUtil.applyFrameTemplate(getChanger(),  
    218                                                         immKeys.asList(),  
    219                                                         templateRef, false, kind, true); 
    220  
    221                                 } 
    222                         }.register(frameAccess); 
     195                        description = Message.create(APPLY_TEMPLATE_FOR_RESOURCE, importInfo.getName()); 
     196                        action =  
     197                                new ApplyTemplateAction(description, false, immKeys, templateRef, kind); 
     198                        action.register(frameAccess); 
    223199                } 
    224200        } 
    225201         
     
    537513                        int count; 
    538514                        byte data[] = new byte[1024]; 
    539515 
    540                         String fileName = tempDir + entry.getName(); 
     516                        String fileName = tempDir + ResourceFilesUtil.FILE_SEPARATOR + entry.getName(); 
    541517 
    542518                        File resFile = new File(fileName); 
    543519                        resFile.deleteOnExit(); 
    544520 
    545                         try{ 
     521                        try { 
     522                                new File(resFile.getParent()).mkdirs(); 
    546523                                resFile.createNewFile(); 
    547524                                FileOutputStream fos = new FileOutputStream(resFile); 
    548525                                out = new BufferedOutputStream(fos, 1024); 
  • modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/logic/ChangeFrameMainResourceHandler.java

     
    33import org.sophie2.base.dnd.DndTransferable; 
    44import org.sophie2.base.dnd.DropHandler; 
    55import org.sophie2.base.model.book.BookH; 
    6 import org.sophie2.base.model.book.interfaces.ResourceFrame; 
    76import org.sophie2.base.model.resources.r4.ResourceRefR4; 
    87import org.sophie2.base.model.resources.r4.access.ResourceAccess; 
    98import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     
    1514import org.sophie2.main.app.commons.element.ElementDropHandler; 
    1615import org.sophie2.main.app.commons.frame.FrameView; 
    1716import org.sophie2.main.dnd.dnddata.ResourceRefData; 
     17import org.sophie2.main.func.resources.actions.SetFrameResourceAction; 
    1818import org.sophie2.main.func.resources.imports.ResourceImportProvider; 
    1919import org.sophie2.main.func.resources.imports.ResourceImportUtil; 
    2020import org.sophie2.main.func.resources.imports.SimpleResourceImportProvider; 
     
    8888                LogicR3.fire(getView(), bdw, null, null, BookView.EventIds.DELETING_ELEMENT, 
    8989                                ResourceDeleteLogic.findElementView(bookToFrameRef, getView().getBookView())); 
    9090                 
    91                 new AutoAction(Message.create(MAIN_RESOURCE_OF_FRAME), true) { 
    92                          
    93                         @Override 
    94                         public void performAuto() { 
    95                                 getChanger().setRaw(ResourceR4.KEY_KIND, newFrameKind); 
    96                                 getChanger().setRaw(ResourceFrame.KEY_MAIN_RESOURCE, relRef); 
    97                         } 
    98                 }.register(frameAccess); 
     91                Message description = Message.create(MAIN_RESOURCE_OF_FRAME); 
     92                AutoAction action = new SetFrameResourceAction(description, true, relRef, newFrameKind); 
     93                action.register(frameAccess); 
    9994        } 
    10095} 
  • modules/org.sophie2.main.func.resources/src/test/java/org/sophie2/main/func/resources/imports/ResourceImportManagerTest.java

     
    66 
    77import org.junit.Before; 
    88import org.junit.Test; 
     9import org.sophie2.base.bound.BoundModule; 
    910import org.sophie2.base.commons.BaseCommonsModule; 
    1011import org.sophie2.base.commons.structures.ImmTreeList; 
    1112import org.sophie2.base.commons.util.ImmList; 
    12 import org.sophie2.base.commons.util.position.ImmPoint; 
     13import org.sophie2.base.config.BaseConfigModule; 
    1314import org.sophie2.base.dialogs.BaseDialogsModule; 
    1415import org.sophie2.base.dialogs.TestingDialogManager; 
    1516import org.sophie2.base.media.BaseMediaModule; 
    1617import org.sophie2.base.model.book.BaseModelBookModule; 
    1718import org.sophie2.base.model.book.FrameH; 
    18 import org.sophie2.base.model.book.frame.FrameR4; 
    1919import org.sophie2.base.model.book.interfaces.ResourceFrame; 
    2020import org.sophie2.base.model.book.resource.r4.BookR4; 
    2121import org.sophie2.base.model.book.timelines.ActivationChannel; 
     
    2828import org.sophie2.base.model.resources.r4.keys.ChildrenKey; 
    2929import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 
    3030import org.sophie2.base.model.resources.r4.resources.ResourceR4; 
     31import org.sophie2.base.persistence.BasePersistenceModule; 
    3132import org.sophie2.base.skins.BaseSkinsModule; 
    3233import org.sophie2.base.skins.Message; 
    3334import org.sophie2.base.visual.BaseVisualModule; 
     
    4041import org.sophie2.main.dialogs.input.file.FileDialogInput; 
    4142import org.sophie2.main.dialogs.input.file.FileFilterInfo; 
    4243import org.sophie2.main.func.file.FileFunctionalityModule; 
     44import org.sophie2.main.func.resources.actions.CreateColdTextAction; 
     45import org.sophie2.main.func.resources.actions.InsertTextFrameAction; 
    4346import org.sophie2.main.func.resources.dummy.ColdTextImportManager; 
    4447import org.sophie2.main.func.resources.dummy.ColdTextModule; 
    4548import org.sophie2.main.func.resources.dummy.ColdTextResource; 
     
    8083        protected List<Class<? extends SophieModule>> fillDependencies() { 
    8184                return Arrays.asList(BaseModelResourcesR4Module.class, 
    8285                                BaseVisualModule.class, BaseMediaModule.class, 
     86                                BaseConfigModule.class, BasePersistenceModule.class, 
    8387                                BaseCommonsModule.class, MainMediaNatlibModule.class, 
    84                                 BaseDialogsModule.class, BaseSkinsModule.class, 
     88                                BaseDialogsModule.class, BoundModule.class, BaseSkinsModule.class, 
    8589                                BaseModelBookModule.class, FileFunctionalityModule.class, 
    8690                                MainAppModule.class, 
    8791                                ColdTextModule.class); 
     
    183187                        ResourceRefR4.generateRandomSub(ColdTextResource.DEFAULT_TITLE); 
    184188                final String text = "Some text"; 
    185189                 
    186                 new AutoAction(Message.create(CREATING_COLD_TEXT), true) { 
    187                         @Override 
    188                         public void performAuto() { 
    189                                 ColdTextResourceHelper.createColdText( 
    190                                                 getChanger(), coldRef, text); 
    191                         } 
    192                 }.register(bookAccess); 
     190                Message description = Message.create(CREATING_COLD_TEXT); 
     191                AutoAction action = new CreateColdTextAction(description, true, text, coldRef); 
     192                action.register(bookAccess); 
    193193                 
    194194                SubEntryNames children = ResourceR4.KEY_CHILDREN.get(bookAccess); 
    195195                 
     
    207207                        ResourceRefR4.generateRandomSub(FrameH.NAME_PREFIX); 
    208208                final ImmList<ActivationChannel> elements = ImmTreeList.empty(); 
    209209                 
    210                 new AutoAction(Message.create(INSERT_THE_FRAME), true) { 
    211                         @Override 
    212                         public void performAuto() { 
    213                                 manager.insertFrame(getChanger().getSub(parentRef), 
    214                                                 parentRef, frameRef, coldRef, 
    215                                                 "Bau", elements, 
    216                                                 ImmPoint.ZERO, 
    217                                                 FrameR4.DEFAULT_FRAME_SIZE); 
    218                         } 
    219                          
    220                 }.register(bookAccess); 
     210                description = Message.create(INSERT_THE_FRAME); 
     211                action = new InsertTextFrameAction(description, true, manager, frameRef, 
     212                                parentRef, elements, coldRef); 
     213                action.register(bookAccess); 
    221214                 
    222215                ChildrenKey pageChildrenKey =  
    223216                        ResourceR4.KEY_CHILDREN.sub(parentRef).sub(ResourceR4.KEY_CHILDREN); 
  • modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/logic/ResourceDeleteLogic.java

     
    2323import org.sophie2.main.app.commons.util.AppViewUtil; 
    2424import org.sophie2.main.dialogs.input.ConfirmDialogInput; 
    2525import org.sophie2.main.dialogs.input.DialogUtils; 
     26import org.sophie2.main.func.resources.actions.RemoveResourceAction; 
     27import org.sophie2.main.func.resources.actions.RemoveTemplateAction; 
    2628import org.sophie2.main.func.resources.view.ResourceDetailsPalette; 
    2729import org.sophie2.main.func.resources.view.ResourceDetailsPalette.DeleteResourceButton; 
    2830import org.sophie2.main.func.resources.view.ResourcesPalette.ResourceItem; 
     
    8385                        return true; 
    8486                } 
    8587        }; 
    86          
     88 
    8789        /** 
    8890         * Constant created for removing template. 
    8991         * Constant created to be a parameter of a message of an {@link AutoAction}.  
     
    121123 
    122124                final ResourceRefR4 resourceRef = ResourceRefR4.getRelativeRef( 
    123125                                bookAccess.getRef(), resource.getRef()); 
    124                 new AutoAction(Message.create(REMOVE_RESOURCE), true) { 
    125                         @Override 
    126                         public void performAuto() { 
    127                                 getChanger().removeResource(resourceRef); 
    128                         } 
    129  
    130                 }.register(bookAccess); 
     126                 
     127                Message description = Message.create(REMOVE_RESOURCE); 
     128                AutoAction action = new RemoveResourceAction(description, true, resourceRef); 
     129                action.register(bookAccess); 
    131130 
    132131                return true; 
    133132        } 
     
    205204                ResourceAccess bookAccess = bookView.getAccess(); 
    206205                final ResourceRefList templates = key.get(bookAccess); 
    207206                if (templates.contains(ref)) { 
    208                         new AutoAction(Message.create(REMOVE_TEMPLATE), true) { 
    209                                 @Override 
    210                                 public void performAuto() { 
    211                                         getChanger().removeResource(ref); 
    212                                         getChanger().setRaw(key, templates.remove(ref)); 
    213                                 } 
    214  
    215                         }.register(bookAccess); 
     207                        Message description = Message.create(REMOVE_TEMPLATE); 
     208                        AutoAction action = new RemoveTemplateAction(description, true, templates, key, ref); 
     209                        action.register(bookAccess); 
    216210                         
    217211                        return true; 
    218212                } 
  • modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/actions/ImportResourceAction.java

     
     1package org.sophie2.main.func.resources.actions; 
     2 
     3import org.sophie2.base.model.resources.r4.ResourceRefR4; 
     4import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     5import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 
     6import org.sophie2.base.skins.Message; 
     7import org.sophie2.main.func.resources.imports.ResourceImportInfo; 
     8import org.sophie2.main.func.resources.imports.ResourceImportManager; 
     9 
     10/** 
     11 * {@link AutoAction} for importing a new resource in a parent resource. 
     12 *  
     13 * @author meddle 
     14 * 
     15 * @param <D> 
     16 *                      The type of the import information needed to import the resource. 
     17 */ 
     18public class ImportResourceAction<D> extends AutoAction { 
     19         
     20        private final ResourceImportInfo<D> importInfo; 
     21        private final ResourceRefR4 resourceRef; 
     22        private final ResourceImportManager<D> importManager; 
     23 
     24        /** 
     25         * Creates the action with the import manager used to import the resource, 
     26         * the {@link ResourceImportInfo} needed for the import and the {@link ResourceRefR4} 
     27         * that will be pointing to the new resource. 
     28         *  
     29         * @param description  
     30         *                      Description of the action.  
     31         * @param significant  
     32         *                      Significance of the action.  
     33         * @param importInfo 
     34         *                      The info needed to import the resource. 
     35         * @param resourceRef 
     36         *                      The reference to the resource to import. 
     37         * @param importManager 
     38         *                      The import manager used to import the resource. 
     39         */ 
     40        public ImportResourceAction(Message description, boolean significant, 
     41                        ResourceImportInfo<D> importInfo, ResourceRefR4 resourceRef, 
     42                        ResourceImportManager<D> importManager) { 
     43                super(description, significant); 
     44                 
     45                this.importInfo = importInfo; 
     46                this.resourceRef = resourceRef; 
     47                this.importManager = importManager; 
     48        } 
     49 
     50        @Override 
     51        public void performAuto() { 
     52                ResourceChanger changer = getChanger(); 
     53 
     54                this.importManager.makeResource(changer, this.resourceRef, this.importInfo); 
     55        } 
     56} 
  • modules/org.sophie2.base.model.book/src/main/java/org/sophie2/base/model/book/resource/ResourceFilesUtil.java

     
    4040        private static final String INSTANCE_RESOURCES_TEMP = UUID.randomUUID().toString(); 
    4141         
    4242        /** 
     43         * The file separator used for storing files from Sophie. 
     44         */ 
     45        public static final String FILE_SEPARATOR = "/"; 
     46         
     47        /** 
    4348         * Stores a file to the special folder relative to 
    4449         * a resource specified by {@link ResourceFilesUtil#FILES_DIRECTORY}. 
    4550         *   
     
    141146        public static boolean isRelativeToParent(ResourceRefR4 ref, String parentLocation) { 
    142147                File parentDir = ResourceFilesUtil.getDir(parentLocation); 
    143148                String parentDirLocation = parentDir.getAbsolutePath().replace( 
    144                                 File.separator, ResourceRefR4.SEPARATOR); 
     149                                File.separator, FILE_SEPARATOR); 
    145150                String location = ref.getLocation(); 
    146151 
    147152                if (location.contains(parentDirLocation) 
     
    166171 
    167172                        String parent = System.getProperty("java.io.tmpdir"); 
    168173                        String pathname = INSTANCE_RESOURCES_TEMP + resourceLocation.substring(start) + FILES_DIRECTORY; 
    169                         pathname = parent + File.separator + pathname.replaceAll(":", "_"); 
     174                        pathname = parent + FILE_SEPARATOR + pathname.replaceAll(":", "_"); 
    170175                        File tempDir = new File(pathname); 
    171176 
    172177                        if (!tempDir.exists()) { 
     
    176181                        return tempDir; 
    177182                } 
    178183 
    179                 int lastSeparator = resourceLocation.lastIndexOf(File.separator); 
     184                int lastSeparator = resourceLocation.lastIndexOf(FILE_SEPARATOR); 
    180185 
    181186                String resourceName = getDirName(resourceLocation, lastSeparator); 
    182187 
    183188                String dirName = resourceLocation.substring(0, lastSeparator) + 
    184                 File.separator + resourceName; 
     189                FILE_SEPARATOR + resourceName; 
    185190 
    186191                dirName = dirName.replace( 
    187                                 File.separator, ResourceRefR4.SEPARATOR); 
     192                                File.separator, FILE_SEPARATOR); 
    188193                if (dirName.startsWith(LocationPrefix.FILE)) { 
    189194                        dirName = dirName.substring(LocationPrefix.FILE.length()); 
    190195                } 
     
    202207         */ 
    203208        public static String getValidPath(String path) { 
    204209                String validPath = path.replace( 
    205                                 File.separator, ResourceRefR4.SEPARATOR); 
     210                                File.separator, FILE_SEPARATOR); 
    206211                if (validPath.startsWith(LocationPrefix.FILE)) { 
    207212                        validPath = validPath.substring(LocationPrefix.FILE.length()); 
    208213                } 
     
    348353                if (!target.exists()) { 
    349354                        if (parentPath == null) { 
    350355                                String validParentPath = filePath.substring(0, 
    351                                                 filePath.lastIndexOf(File.separator)); 
     356                                                filePath.lastIndexOf(FILE_SEPARATOR)); 
    352357                                File validParentDir = new File(validParentPath); 
    353358                                if (!validParentDir.exists()) { 
    354359                                        validParentDir.mkdir(); 
  • modules/org.sophie2.main.func.resources/src/test/java/org/sophie2/main/func/resources/exports/ResourceExportManagerTest.java

     
    1313import javax.swing.filechooser.FileFilter; 
    1414 
    1515import org.junit.Test; 
     16import org.sophie2.base.config.BaseConfigModule; 
    1617import org.sophie2.base.media.BaseMediaModule; 
    1718import org.sophie2.base.model.resources.r4.BaseModelResourcesR4Module; 
    1819import org.sophie2.base.model.resources.r4.access.ResourceAccess; 
    1920import org.sophie2.base.model.resources.r4.resources.ResourceR4; 
     21import org.sophie2.base.persistence.BasePersistenceModule; 
    2022import org.sophie2.base.skins.BaseSkinsModule; 
    2123import org.sophie2.base.visual.BaseVisualModule; 
    2224import org.sophie2.core.modularity.CoreModularityModule; 
     
    4143        protected List<Class<? extends SophieModule>> fillDependencies() { 
    4244                return Arrays.asList( 
    4345                                CoreModularityModule.class, 
     46                                BasePersistenceModule.class, 
     47                                BaseConfigModule.class, 
    4448                                BaseModelResourcesR4Module.class, 
    4549                                BaseSkinsModule.class, BaseVisualModule.class, 
    4650                                BaseMediaModule.class, MainMediaNatlibModule.class, 
  • modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/actions/ChangeImageBackgroundAction.java

     
     1package org.sophie2.main.func.resources.actions; 
     2 
     3import org.sophie2.base.model.book.BackgroundType; 
     4import org.sophie2.base.model.book.interfaces.StyledElement; 
     5import org.sophie2.base.model.resources.r4.ResourceRefR4; 
     6import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     7import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 
     8import org.sophie2.base.skins.Message; 
     9 
     10/** 
     11 * {@link AutoAction} for changes the background of an element to an image. 
     12 *  
     13 * @author tanya, deni 
     14 */ 
     15public class ChangeImageBackgroundAction extends AutoAction { 
     16         
     17        private final ResourceRefR4 elementToImageRef; 
     18 
     19        /** 
     20         * Creates the action with the needed relative reference from the element to the image. 
     21         *  
     22         * @param description  
     23         *                      Description of the action.  
     24         * @param significant  
     25         *                      Significance of the action.  
     26         * @param elementToImageRef 
     27         *                      The reference from the element (for which the background will be changed) 
     28         *                      to the image. 
     29         */ 
     30        public ChangeImageBackgroundAction(Message description, 
     31                        boolean significant, ResourceRefR4 elementToImageRef) { 
     32                super(description, significant); 
     33                 
     34                this.elementToImageRef = elementToImageRef; 
     35        } 
     36 
     37        @Override 
     38        public void performAuto() { 
     39                ResourceChanger changer = getChanger(); 
     40 
     41                changer.setRaw(StyledElement.KEY_BACKGROUND__IMAGE, this.elementToImageRef); 
     42                changer.setRaw(StyledElement.KEY_BACKGROUND__TYPE, BackgroundType.IMAGE); 
     43        } 
     44} 
  • modules/org.sophie2.main.func.resources/src/test/java/org/sophie2/main/func/resources/actions/InsertTextFrameAction.java

     
     1package org.sophie2.main.func.resources.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmList; 
     4import org.sophie2.base.commons.util.position.ImmPoint; 
     5import org.sophie2.base.model.book.frame.FrameR4; 
     6import org.sophie2.base.model.book.timelines.ActivationChannel; 
     7import org.sophie2.base.model.resources.r4.ResourceRefR4; 
     8import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     9import org.sophie2.base.skins.Message; 
     10import org.sophie2.main.func.resources.dummy.ColdTextImportManager; 
     11 
     12/** 
     13 * {@link AutoAction} for inserting test frame with text. 
     14 *  
     15 * @author meddle 
     16 */ 
     17public class InsertTextFrameAction extends AutoAction { 
     18         
     19        private final ColdTextImportManager manager; 
     20        private final ResourceRefR4 frameRef; 
     21        private final ResourceRefR4 parentRef; 
     22        private final ImmList<ActivationChannel> elements; 
     23        private final ResourceRefR4 coldRef; 
     24 
     25        /** 
     26         * Creates the action with all needed information to insert the frame. 
     27         *  
     28         * @param description  
     29         *                      Description of the action.  
     30         * @param significant  
     31         *                      Significance of the action. 
     32         * @param manager 
     33         *                      The import manager to insert the frame. 
     34         * @param frameRef 
     35         *                      The reference to the frame. 
     36         * @param parentRef 
     37         *                      The parent of the frame. 
     38         * @param elements 
     39         *                      The current elements of the parent element. 
     40         * @param coldRef 
     41         *                      The reference to the main resource of the frame to insert 
     42         */ 
     43        public InsertTextFrameAction(Message description, boolean significant, 
     44                        ColdTextImportManager manager, ResourceRefR4 frameRef, 
     45                        ResourceRefR4 parentRef, ImmList<ActivationChannel> elements, 
     46                        ResourceRefR4 coldRef) { 
     47                super(description, significant); 
     48                 
     49                this.manager = manager; 
     50                this.frameRef = frameRef; 
     51                this.parentRef = parentRef; 
     52                this.elements = elements; 
     53                this.coldRef = coldRef; 
     54        } 
     55 
     56        @Override 
     57        public void performAuto() { 
     58                this.manager.insertFrame(getChanger().getSub(this.parentRef), 
     59                                this.parentRef, this.frameRef, this.coldRef, 
     60                                "Bau", this.elements, 
     61                                ImmPoint.ZERO, 
     62                                FrameR4.DEFAULT_FRAME_SIZE); 
     63        } 
     64} 
  • modules/org.sophie2.main.func.resources/src/test/java/org/sophie2/main/func/resources/actions/CreateColdTextAction.java

     
     1package org.sophie2.main.func.resources.actions; 
     2 
     3import org.sophie2.base.model.resources.r4.ResourceRefR4; 
     4import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     5import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 
     6import org.sophie2.base.skins.Message; 
     7import org.sophie2.main.func.resources.dummy.ColdTextResource; 
     8import org.sophie2.main.func.resources.dummy.ColdTextResourceHelper; 
     9 
     10 
     11/** 
     12 * {@link AutoAction} for creating the {@link ColdTextResource}. 
     13 *  
     14 * @author meddle 
     15 */ 
     16public class CreateColdTextAction extends AutoAction { 
     17         
     18        private final String text; 
     19        private final ResourceRefR4 coldRef; 
     20 
     21        /** 
     22         * Creates the action with the location of the new resource and the text 
     23         * contained by it. 
     24         *  
     25         * @param description  
     26         *                      Description of the action.  
     27         * @param significant  
     28         *                      Significance of the action. 
     29         * @param text 
     30         *                      The text as string for the new resource. 
     31         * @param coldRef 
     32         *                      The reference to the place the resource will be created. 
     33         */ 
     34        public CreateColdTextAction(Message description, boolean significant, 
     35                        String text, ResourceRefR4 coldRef) { 
     36                super(description, significant); 
     37                 
     38                this.text = text; 
     39                this.coldRef = coldRef; 
     40        } 
     41 
     42        @Override 
     43        public void performAuto() { 
     44                ResourceChanger changer = getChanger(); 
     45                 
     46                ColdTextResourceHelper.createColdText(changer, this.coldRef, this.text); 
     47        } 
     48} 
  • modules/org.sophie2.main.func.resources/src/test/java/org/sophie2/main/func/resources/SophiePackageFormatTest.java

     
    22 
    33import java.io.File; 
    44import java.net.URL; 
     5import java.util.Arrays; 
    56import java.util.Collection; 
    67import java.util.Collections; 
    78import java.util.List; 
     
    1112import org.junit.Test; 
    1213import org.sophie2.base.commons.util.bindata.BinData; 
    1314import org.sophie2.base.commons.util.bindata.RawBinData; 
     15import org.sophie2.base.config.BaseConfigModule; 
    1416import org.sophie2.base.model.book.BaseModelBookModule; 
    1517import org.sophie2.base.model.book.BookH; 
    1618import org.sophie2.base.model.book.resource.r4.BookR4; 
    1719import org.sophie2.base.model.book.testing.ModelTestBase; 
     20import org.sophie2.base.model.resources.r4.BaseModelResourcesR4Module; 
    1821import org.sophie2.base.model.resources.r4.ResourceRefR4; 
    1922import org.sophie2.base.model.resources.r4.access.ResourceAccess; 
    2023import org.sophie2.base.model.resources.r4.immutables.SubEntryNames; 
     
    5053 
    5154        private File exportOtputFile = null; 
    5255 
     56        @SuppressWarnings("unchecked") 
    5357        @Override 
    5458        protected List<Class<? extends SophieModule>> fillDependencies() { 
    55                 List<Class<? extends SophieModule>> modules = super.fillDependencies();  
    56  
    57                 modules.add(CoreModularityModule.class); 
    58                 modules.add(BasePersistenceModule.class); 
    59                 modules.add(BaseModelBookModule.class); 
    60                 modules.add(MainFuncResourcesModule.class); 
    61  
    62                 return modules; 
    63         } 
     59                return Arrays.asList( 
     60                                CoreModularityModule.class, 
     61                                BaseConfigModule.class, 
     62                                BasePersistenceModule.class, 
     63                                BaseModelResourcesR4Module.class, 
     64                                BaseModelBookModule.class, 
     65                                MainFuncResourcesModule.class);  
     66                } 
    6467 
    6568        @Override 
    6669        @Before 
  • modules/org.sophie2.main.func.resources/src/test/java/org/sophie2/main/func/resources/dummy/ColdTextResourceHelper.java

     
    77import org.sophie2.base.model.resources.r4.resources.ResourceH; 
    88import org.sophie2.base.model.resources.r4.resources.ResourceR4; 
    99import org.sophie2.base.skins.Message; 
     10import org.sophie2.main.func.resources.actions.CreateColdTextAction; 
    1011 
    1112/** 
    1213 * The helper of our cold text... 
     
    8283                final ResourceRefR4 coldRef =  
    8384                        ResourceRefR4.generateRandomSub(ColdTextResource.DEFAULT_TITLE); 
    8485                 
    85                 new AutoAction(Message.create(CREATING_COLD_TEXT), true) { 
    86                         @Override 
    87                         public void performAuto() { 
    88                                 ColdTextResourceHelper.createColdText( 
    89                                                 getChanger(), coldRef, text); 
    90                         } 
    91                 }.register(bookAccess); 
     86                Message description = Message.create(CREATING_COLD_TEXT); 
     87                AutoAction action = new CreateColdTextAction(description, true, text, coldRef); 
     88                action.register(bookAccess); 
    9289                 
    9390                return bookAccess.open(coldRef, null); 
    9491        } 
  • modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/actions/RemoveTemplateAction.java

     
     1package org.sophie2.main.func.resources.actions; 
     2 
     3import org.sophie2.base.model.resources.r4.ResourceRefList; 
     4import org.sophie2.base.model.resources.r4.ResourceRefR4; 
     5import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     6import org.sophie2.base.model.resources.r4.keys.Key; 
     7import org.sophie2.base.skins.Message; 
     8 
     9/** 
     10 * {@link AutoAction} for removing a template. 
     11 *  
     12 * @author diana 
     13 */ 
     14public class RemoveTemplateAction extends AutoAction { 
     15         
     16        private final ResourceRefList templates; 
     17        private final Key<ResourceRefList> key; 
     18        private final ResourceRefR4 ref; 
     19 
     20        /** 
     21         * Creates the action with all the needed data for template removal. 
     22         *  
     23         * @param description  
     24         *                      Description of the action.  
     25         * @param significant  
     26         *                      Significance of the action. 
     27         * @param templates 
     28         *                      The current list with the templates. 
     29         * @param key 
     30         *                      The key containing the templates. 
     31         * @param ref 
     32         *                      The reference to the template to remove. 
     33         */ 
     34        public RemoveTemplateAction(Message description, boolean significant, 
     35                        ResourceRefList templates, Key<ResourceRefList> key, 
     36                        ResourceRefR4 ref) { 
     37                super(description, significant); 
     38                 
     39                this.templates = templates; 
     40                this.key = key; 
     41                this.ref = ref; 
     42        } 
     43 
     44        @Override 
     45        public void performAuto() { 
     46                getChanger().removeResource(this.ref); 
     47                getChanger().setRaw(this.key, this.templates.remove(this.ref)); 
     48        } 
     49} 
  • modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/actions/InsertFrameAction.java

     
     1package org.sophie2.main.func.resources.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmList; 
     4import org.sophie2.base.commons.util.position.ImmPoint; 
     5import org.sophie2.base.commons.util.position.ImmSize; 
     6import org.sophie2.base.model.book.timelines.ActivationChannel; 
     7import org.sophie2.base.model.resources.r4.ResourceRefR4; 
     8import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     9import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 
     10import org.sophie2.base.skins.Message; 
     11import org.sophie2.main.func.resources.imports.ResourceImportInfo; 
     12import org.sophie2.main.func.resources.imports.ResourceImportManager; 
     13 
     14/** 
     15 * {@link AutoAction} for inserting a frame for given resource. 
     16 * It makes resource if the resource is not created and inserts frame for it. 
     17 *  
     18 * @author meddle 
     19 * 
     20 * @param <D> 
     21 *                              The type of the resource data to insert frame for. 
     22 */ 
     23public class InsertFrameAction<D> extends AutoAction { 
     24         
     25        private final ResourceImportInfo<D> importInfo; 
     26        private final ResourceRefR4 frameRef; 
     27        private final ImmPoint pos; 
     28        private final ImmSize frameSize; 
     29        private final ImmList<ActivationChannel> elements; 
     30        private final ResourceRefR4 parentRef; 
     31        private final ResourceImportManager<D> importManager; 
     32        private final boolean linked; 
     33        private final ResourceRefR4 resourceRef; 
     34        private final String frameTitle; 
     35 
     36        /** 
     37         * Creates the action with all needed data to insert a frame for a resource. 
     38         *  
     39         * @param description  
     40         *                      Description of the action.  
     41         * @param significant  
     42         *                      Significance of the action.  
     43         * @param importInfo 
     44         *                      The {@link ResourceImportInfo} needed for the resource contained 
     45         *                      in the frame. 
     46         * @param frameRef 
     47         *                      The {@link ResourceRefR4} for the new frame. 
     48         * @param pos 
     49         *                      The position of the new frame. 
     50         * @param frameSize 
     51         *                      The size of the new frame. 
     52         * @param elements 
     53         *                      The current sub-elements of the parent element of the new frame. 
     54         * @param parentRef 
     55         *                      The {@link ResourceRefR4} pointing to the parent of the new frame. 
     56         * @param importManager 
     57         *                      The {@link ResourceImportManager} responsible for creating resource 
     58         *                      for the frame and creating the frame. 
     59         * @param linked 
     60         *                      If the resource in the frame is linked (i.e. already created). 
     61         * @param resourceRef 
     62         *                      The reference to the resource the new frame shows. 
     63         * @param frameTitle 
     64         *                      The title of the new frame. 
     65         */ 
     66        public InsertFrameAction(Message description, boolean significant, 
     67                        ResourceImportInfo<D> importInfo, ResourceRefR4 frameRef, 
     68                        ImmPoint pos, ImmSize frameSize, 
     69                        ImmList<ActivationChannel> elements, ResourceRefR4 parentRef, 
     70                        ResourceImportManager<D> importManager, boolean linked, 
     71                        ResourceRefR4 resourceRef, String frameTitle) { 
     72                super(description, significant); 
     73                 
     74                this.importInfo = importInfo; 
     75                this.frameRef = frameRef; 
     76                this.pos = pos; 
     77                this.frameSize = frameSize; 
     78                this.elements = elements; 
     79                this.parentRef = parentRef; 
     80                this.importManager = importManager; 
     81                this.linked = linked; 
     82                this.resourceRef = resourceRef; 
     83                this.frameTitle = frameTitle; 
     84        } 
     85 
     86        @Override 
     87        public void performAuto() { 
     88                ResourceChanger changer = getChanger(); 
     89                if (!this.linked) { 
     90                        this.importManager.makeResource(changer, this.resourceRef, this.importInfo); 
     91                } 
     92 
     93                this.importManager.insertFrame(changer.getSub(this.parentRef), 
     94                                this.parentRef, this.frameRef, this.resourceRef, this.frameTitle, 
     95                                this.elements, this.pos, this.frameSize); 
     96 
     97        } 
     98} 
  • modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/logic/ChangeBackgroundHandler.java

     
    33import org.sophie2.base.dnd.DndTransferable; 
    44import org.sophie2.base.dnd.DropHandler; 
    55import org.sophie2.base.dnd.dnddata.ImageData; 
    6 import org.sophie2.base.model.book.BackgroundType; 
    76import org.sophie2.base.model.book.BookH; 
    8 import org.sophie2.base.model.book.interfaces.StyledElement; 
    97import org.sophie2.base.model.resources.r4.ResourceRefR4; 
    108import org.sophie2.base.model.resources.r4.changes.AutoAction; 
    11 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 
    129import org.sophie2.base.skins.Message; 
    1310import org.sophie2.main.app.commons.element.ElementDropHandler; 
    1411import org.sophie2.main.app.commons.element.ElementView; 
    1512import org.sophie2.main.dnd.dnddata.ResourceRefData; 
     13import org.sophie2.main.func.resources.actions.ChangeImageBackgroundAction; 
    1614import org.sophie2.main.func.resources.imports.ResourceImportUtil; 
    1715 
    1816/** 
     
    6967                final ResourceRefR4 elementToImageRef =  
    7068                        ResourceRefR4.getRelativeRef(absElementRef, absImageRef); 
    7169         
    72                 new AutoAction(Message.create(SET_IMAGE_BG), true) { 
    73  
    74                         @Override 
    75                         public void performAuto() { 
    76                                 ResourceChanger changer = getChanger(); 
    77  
    78                                 changer.setRaw(StyledElement.KEY_BACKGROUND__IMAGE, elementToImageRef); 
    79                                 changer.setRaw(StyledElement.KEY_BACKGROUND__TYPE, BackgroundType.IMAGE); 
    80                         } 
    81                 }.register(getView().getAccess()); 
     70                Message description = Message.create(SET_IMAGE_BG); 
     71                AutoAction action = new ChangeImageBackgroundAction(description, true, elementToImageRef); 
     72                action.register(getView().getAccess()); 
    8273        } 
    8374}