Ticket #2447: 2447.patch

File 2447.patch, 87.4 KB (added by diana, 15 years ago)
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/appearance/BackgroundColorField.java

    ### Eclipse Workspace Patch 1.0
    #P sophie
     
    66import org.sophie2.base.model.book.interfaces.StyledElement; 
    77import org.sophie2.base.model.resources.r4.access.ResourceAccess; 
    88import org.sophie2.base.model.resources.r4.changes.AutoAction; 
    9 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 
    109import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 
    1110import org.sophie2.base.skins.Message; 
    1211import org.sophie2.base.visual.BaseVisualElement; 
     
    1716import org.sophie2.core.mvc.EventFilterBuilder; 
    1817import org.sophie2.core.mvc.OperationDef; 
    1918import org.sophie2.core.mvc.events.EventR3; 
     19import org.sophie2.main.app.halos.actions.SetBgColorAndTypeAction; 
    2020import org.sophie2.main.app.halos.huds.appearance.AppearanceHud.BackgroundPanel; 
    2121import org.sophie2.main.app.halos.huds.color.ColorPickerHudField; 
    2222 
     
    9696                                 
    9797                                assert input != null; 
    9898                                 
    99                                 new AutoAction(Message.create(BG_COLOR), true) { 
    100                                         @Override 
    101                                         public void performAuto() { 
    102                                                 ResourceChanger changer = getChanger(); 
    103                                                 changer.setRaw(StyledElement.KEY_BACKGROUND__COLOR, 
    104                                                                 input); 
    105                                                 changer.setRaw(StyledElement.KEY_BACKGROUND__TYPE, 
    106                                                                 BackgroundType.SOLID); 
    107                                         } 
    108                                 }.register(access); 
     99                                AutoAction action = new SetBgColorAndTypeAction(Message.create(BG_COLOR), 
     100                                                true, input); 
     101                                action.register(access); 
    109102                                return true; 
    110103                        } 
    111104                         
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/UseTemplateAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmList; 
     4import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     5import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 
     6import org.sophie2.base.skins.Message; 
     7 
     8 
     9/** 
     10 * An {@link AutoAction} for using template.  
     11 *  
     12 * @author pap 
     13 * 
     14 */ 
     15public final class UseTemplateAction extends AutoAction { 
     16 
     17        private final ImmList<TemplatedKey<?>> keys; 
     18 
     19        /** 
     20         * Creates a new instance of {@link UseTemplateAction}. 
     21         *  
     22         * @param description 
     23         *                      The message describing the action. 
     24         * @param significant 
     25         *                      The significance of the action. 
     26         * @param keys 
     27         *           The keys to be used for templating. 
     28         */ 
     29        public UseTemplateAction(Message description, boolean significant,  
     30                        ImmList<TemplatedKey<?>> keys) { 
     31                super(description, significant); 
     32                this.keys = keys; 
     33        } 
     34 
     35        @Override 
     36        public void performAuto() { 
     37                for(TemplatedKey<?> key : this.keys) { 
     38                        getChanger().setRaw(key, null); 
     39                        getChanger().setRaw(key.getLockKey(), false); 
     40                } 
     41                 
     42        } 
     43 
     44} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/ChangeBorderColorAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmColor; 
     4import org.sophie2.base.model.book.interfaces.StyledElement; 
     5import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     6import org.sophie2.base.skins.Message; 
     7 
     8 
     9/** 
     10 * An {@link AutoAction} for changing the border color. 
     11 *  
     12 * @author peko 
     13 * 
     14 */ 
     15public final class ChangeBorderColorAction extends AutoAction { 
     16 
     17        private final ImmColor input; 
     18        /** 
     19         * Creates an instance of {@link ChangeBorderColorAction}. 
     20         *  
     21         * @param description 
     22         *             The description of the AutoAction. 
     23         * @param significant 
     24         *                              The significance of the AutoAction. 
     25         * @param input 
     26         *              The new color of the border. 
     27         */ 
     28        public ChangeBorderColorAction(Message description, boolean significant, ImmColor input) { 
     29                super(description, significant); 
     30                this.input = input; 
     31        } 
     32 
     33        @Override 
     34        public void performAuto() { 
     35                getChanger().setRaw(StyledElement.KEY_BORDER__COLOR, this.input); 
     36                 
     37        } 
     38 
     39} 
  • modules/org.sophie2.dev/src/test/java/org/sophie2/dev/author/TestDeleteAutoChainedFrame.java

     
     1package org.sophie2.dev.author; 
     2 
     3import java.util.Arrays; 
     4import java.util.List; 
     5 
     6import javax.swing.SwingUtilities; 
     7 
     8import org.junit.Before; 
     9import org.junit.Test; 
     10import org.sophie2.base.bound.BoundModule; 
     11import org.sophie2.base.commons.BaseCommonsModule; 
     12import org.sophie2.base.dialogs.BaseDialogsModule; 
     13import org.sophie2.base.dialogs.TestingDialogManager; 
     14import org.sophie2.base.halos.HaloButton; 
     15import org.sophie2.base.model.resources.r4.ResourceRefR4; 
     16import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     17import org.sophie2.base.model.text.BaseModelTextModule; 
     18import org.sophie2.base.model.text.model.ImmHotText; 
     19import org.sophie2.base.model.text.model.ImmText; 
     20import org.sophie2.base.skins.Message; 
     21import org.sophie2.core.modularity.SophieModule; 
     22import org.sophie2.core.mvc.LogicR3; 
     23import org.sophie2.core.mvc.events.EventR3; 
     24import org.sophie2.dev.testing.SystemTestBase; 
     25import org.sophie2.main.app.commons.book.BaseBookView; 
     26import org.sophie2.main.app.commons.page.RootPageView; 
     27import org.sophie2.main.app.halos.MainAppHalosModule; 
     28import org.sophie2.main.app.halos.frame.FrameRemoveHaloButton; 
     29import org.sophie2.main.app.halos.shared.MainHaloMenu; 
     30import org.sophie2.main.app.layout.MainAppLayoutModule; 
     31import org.sophie2.main.app.menus.MainAppMenusModule; 
     32import org.sophie2.main.app.model.MainAppModelModule; 
     33import org.sophie2.main.dialogs.input.ConfirmDialogInput; 
     34import org.sophie2.main.func.resources.MainFuncResourcesModule; 
     35import org.sophie2.main.func.text.TextFuncModule; 
     36import org.sophie2.main.func.text.chaining.ChainingMode; 
     37import org.sophie2.main.func.text.model.HeadTextFrameH; 
     38import org.sophie2.main.func.text.utils.TextChainUtils; 
     39import org.sophie2.main.func.text.view.HeadTextFrameView; 
     40import org.sophie2.main.func.text.view.TextFrameView; 
     41 
     42/** 
     43 * Tests the deleting of auto chained frames.  
     44 *  
     45 * @author diana 
     46 * 
     47 */ 
     48public class TestDeleteAutoChainedFrame extends SystemTestBase { 
     49 
     50        /** 
     51         * Constant created for insertion of a full text frame. 
     52         * Constant created to be a parameter of a message of an {@link AutoAction}.  
     53         * Used for skinning. Used in the test. 
     54         */ 
     55        public static final String INSERT_FULL_TEXT_FRAME = "Insert a full text frame"; 
     56 
     57        @SuppressWarnings("unchecked") 
     58        @Override 
     59        protected List<Class<? extends SophieModule>> fillDependencies() { 
     60 
     61                List<Class<? extends SophieModule>> res = super.fillDependencies(); 
     62                List<Class<? extends SophieModule>> toAppend =  
     63                        Arrays.asList( 
     64                                        BoundModule.class, 
     65                                        MainAppMenusModule.class, 
     66                                        BaseModelTextModule.class, 
     67                                        MainAppHalosModule.class, 
     68                                        TextFuncModule.class, 
     69                                        MainAppLayoutModule.class, 
     70                                        MainAppModelModule.class, 
     71                                        MainFuncResourcesModule.class, 
     72                                        BaseDialogsModule.class, 
     73                                        BaseCommonsModule.class 
     74                        ); 
     75 
     76                merge(res, toAppend); 
     77 
     78                return res; 
     79        } 
     80 
     81        @Override 
     82        @Before 
     83        protected void setUp() throws Exception { 
     84                super.setUp(); 
     85                SwingUtilities.invokeAndWait(new Runnable() { 
     86 
     87                        @SuppressWarnings("synthetic-access") 
     88                        public void run() { 
     89                                createNewBook(); 
     90                        } 
     91                }); 
     92 
     93                try { 
     94                        Thread.sleep(10000); 
     95                } catch (InterruptedException e) { 
     96                        //nothing 
     97                } 
     98                ImmText text = new ImmHotText( 
     99                                "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean dui" + 
     100                                " ligula, rhoncus id interdum nec, vestibulum non dolor. Suspendisse nec" + 
     101                                " ante vitae purus pellentesque porttitor. Duis orci elit, blandit blandit" + 
     102                                " vestibulum sed, dictum ac dolor. Donec sed blandit ante. In pretium arcu" + 
     103                                " eleifend ligula imperdiet eget tempor nunc viverra. Maecenas interdum " + 
     104                                "sapien id nisl dignissim pulvinar. Morbi congue, magna a tincidunt" + 
     105                                " tincidunt, nibh tortor varius ligula, at feugiat ante neque eu nisl." + 
     106                                " Proin at odio a elit pharetra egestas vel ac nibh. Integer nunc ipsum," + 
     107                                " ornare quis lobortis vulputate, accumsan eu purus. Phasellus tristique" + 
     108                                " interdum odio, id vulputate lorem pretium eu. Aenean at nulla libero," + 
     109                                " sit amet egestas nisl. Sed metus arcu, cursus eu facilisis quis," + 
     110                                " dignissim eget neque. Nulla facilisi. Sed quam nisl, ornare vitae blandit" + 
     111                                " at, tristique sagittis quam." 
     112                                + "Maecenas vel vestibulum lectus. Ut gravida pellentesque turpis at" + 
     113                                " pharetra. Mauris luctus est nisl. Aenean egestas lectus vitae" + 
     114                                " dolor luctus in vestibulum purus faucibus. Vivamus eros dolor," + 
     115                                " tristique vitae tincidunt nec, ullamcorper id erat. Nunc id lorem" + 
     116                                " lectus, sed tristique neque. Nullam imperdiet ligula ut velit" + 
     117                                " facilisis gravida. Lorem ipsum dolor sit amet, consectetur" + 
     118                                " adipiscing elit. Integer eget dolor ipsum. Nullam elementum" + 
     119                                " lectus a est tincidunt ultricies tempus nisl interdum. Integer" + 
     120                                " posuere felis eget lectus pellentesque ac vestibulum neque" + 
     121                                " vulputate. Donec ut lectus quis eros tincidunt sagittis.", null); 
     122 
     123                HeadTextFrameH.createTextFrameAction(curBook(), 
     124                                curPageWorkArea().getRootPageView().model().get(), 
     125                                text, ResourceRefR4.NONE_REF.toUri(), null, 
     126                                Message.create(INSERT_FULL_TEXT_FRAME), true, true); 
     127 
     128                TextFrameView frameViewToSelect = 
     129                        curPageWorkArea().getAll(TextFrameView.class).get(0); 
     130                curPageWorkArea().getSel().select(frameViewToSelect, false); 
     131 
     132                final HeadTextFrameView selectedFrameView = 
     133                        curPageWorkArea().getSel().getSingleSelected(HeadTextFrameView.class); 
     134                assertNotNull(selectedFrameView); 
     135 
     136                try { 
     137                        Thread.sleep(5000); 
     138                } catch (InterruptedException e) { 
     139                        //nothing 
     140                } 
     141                SwingUtilities.invokeAndWait(new Runnable() { 
     142 
     143                        @SuppressWarnings("synthetic-access") 
     144                        public void run() { 
     145                                assertEquals(ChainingMode.AUTO_CHAINING, selectedFrameView.model().get().getChainMode()); 
     146                                assertTrue(curBook().getPageCount() >= 2); 
     147 
     148                                assertTrue(TextChainUtils.getChainedFrameViews( 
     149                                                selectedFrameView.getBookView(), selectedFrameView).size() >= 2); 
     150 
     151                        } 
     152                }); 
     153 
     154        } 
     155 
     156 
     157 
     158        /** 
     159         * Tests the deleting of chained frames. 
     160         */ 
     161        @Test 
     162        public void testChainingNavigationDown() { 
     163 
     164                HeadTextFrameView selectedFrameView = 
     165                        curPageWorkArea().getSel().getSingleSelected(HeadTextFrameView.class); 
     166                TextFrameView viewToSelect = TextChainUtils.getChainedFrameViews( 
     167                                selectedFrameView.getBookView(), selectedFrameView).get(1); 
     168                assertNotNull(viewToSelect); 
     169 
     170                BaseBookView bookView = curPageWorkArea().bookView().get(); 
     171                RootPageView page = viewToSelect.findParentElement(RootPageView.class); 
     172                bookView.goToPage(ResourceRefR4.getRelativeRef(bookView.getAccess().getRef(), 
     173                                page.getAccess().getRef())); 
     174                curPageWorkArea().getSel().select(viewToSelect, false);          
     175 
     176 
     177                MainHaloMenu mainHaloMenu = viewToSelect.findNearestElement(null, MainHaloMenu.class); 
     178                FrameRemoveHaloButton removeButton = null; 
     179                for (HaloButton button : mainHaloMenu.buttons().get()) { 
     180                        if (button instanceof FrameRemoveHaloButton) { 
     181                                removeButton = (FrameRemoveHaloButton) button; 
     182                                break; 
     183                        } 
     184                } 
     185                assert removeButton != null; 
     186 
     187 
     188                try { 
     189                        TestingDialogManager.get().expect(ConfirmDialogInput.class,  
     190                                        ConfirmDialogInput.Response.YES); 
     191 
     192                        LogicR3.fire(new EventR3(removeButton, null, null, null, HaloButton.EventIds.HALO_CLICK)); 
     193 
     194                } catch (Exception e) { 
     195                        fail(); 
     196                } 
     197 
     198        } 
     199 
     200} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetBorderInsetsAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.position.ImmInsets; 
     4import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     5import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 
     6import org.sophie2.base.skins.Message; 
     7 
     8 
     9/** 
     10 * An {@link AutoAction} for setting the border insets of a source. 
     11 *  
     12 * @author peko 
     13 * 
     14 */ 
     15public final class SetBorderInsetsAction extends AutoAction { 
     16 
     17        private final TemplatedKey<ImmInsets> key; 
     18        private final ImmInsets insets; 
     19         
     20        /** 
     21         * Creates a <code>SetBorderInsetsAction</code>. 
     22         *  
     23         * @param description 
     24         *                      The message describing the action. 
     25         * @param significant 
     26         *                      The significance of the action. 
     27         * @param key 
     28         *                      The insets of the source. 
     29         * @param insets 
     30         *                      The new insets of the source. 
     31         */ 
     32        public SetBorderInsetsAction(Message description, boolean significant,  
     33                        TemplatedKey<ImmInsets> key, ImmInsets insets) { 
     34                super(description, significant); 
     35                this.insets = insets; 
     36                this.key = key; 
     37        } 
     38 
     39        @Override 
     40        public void performAuto() { 
     41                getChanger().setRaw(this.key, this.insets);              
     42        } 
     43 
     44} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetShadowOpacityAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.model.book.frame.FrameR4; 
     4import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     5import org.sophie2.base.skins.Message; 
     6 
     7 
     8/** 
     9 * An {@link AutoAction} for changing the shadow opacity of a source. 
     10 *  
     11 * @author Tanya 
     12 * 
     13 */ 
     14public final class SetShadowOpacityAction extends AutoAction { 
     15 
     16        private final Float input; 
     17         
     18        /** 
     19         * Creates an instance of {@link SetShadowOpacityAction}. 
     20         *  
     21         * @param description 
     22         *             The description of the AutoAction. 
     23         * @param significant 
     24         *                              The significance of the AutoAction. 
     25         * @param input 
     26         *                              The new value of the opacity. 
     27         */ 
     28        public SetShadowOpacityAction(Message description, boolean significant, Float input) { 
     29                super(description, significant); 
     30                this.input = input; 
     31        } 
     32 
     33        @Override 
     34        public void performAuto() { 
     35                getChanger().setRaw(FrameR4.KEY_SHADOW__OPACITY, this.input); 
     36                 
     37        } 
     38 
     39} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/LockAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmList; 
     4import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     5import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 
     6import org.sophie2.base.skins.Message; 
     7 
     8/** 
     9 * An {@link AutoAction} for locking the keys of the template. 
     10 *  
     11 * @author pap 
     12 * 
     13 */ 
     14public final class LockAction extends AutoAction{ 
     15 
     16        private final ImmList<Object> finalValues; 
     17        private final ImmList<TemplatedKey<?>> keys; 
     18 
     19        /** 
     20         * Creates a new instance of {@link LockAction}. 
     21         *  
     22         * @param description 
     23         *                      The message describing the action. 
     24         * @param significant 
     25         *                      The significance of the action. 
     26         * @param finalValues 
     27         *           The values of the keys to be locked. 
     28         * @param keys 
     29         *          The keys to be locked. 
     30         */ 
     31        public LockAction(Message description, boolean significant, ImmList<Object> finalValues, 
     32                        ImmList<TemplatedKey<?>> keys) { 
     33                super(description, significant); 
     34                this.finalValues = finalValues; 
     35                this.keys = keys; 
     36        } 
     37 
     38        @SuppressWarnings("unchecked") 
     39        @Override 
     40        public void performAuto() { 
     41                for ( int keyIndex = 0; keyIndex < this.keys.size(); keyIndex++ ) { 
     42                        TemplatedKey key = this.keys.get(keyIndex); 
     43                        Object value = this.finalValues.get(keyIndex); 
     44                        getChanger().setRaw(key, value); 
     45                        getChanger().setRaw(key.getLockKey(), true); 
     46                } 
     47 
     48        } 
     49 
     50} 
  • modules/org.sophie2.base.model.text/src/main/java/org/sophie2/base/model/text/model/ImmHotText.java

     
    103103                        newStyles = unitAt(styleIndex).getStyle(); 
    104104                } 
    105105                if (! interval.isEmpty() && interval.getBegin() != getEnd()) { 
    106                         newStyles = newStyles.replaceDerive(this.unitAt(interval.getBegin()).getStyle()); 
     106                        newStyles = newStyles.derive(this.unitAt(interval.getBegin()).getStyle()); 
    107107                } 
    108108                // XXX I do not agree we should bypass invalid intervals --kyli 
    109109                for (int i = index; i < Math.min(interval.getEnd(), getEnd()); ++i) { 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/appearance/AppearanceHud.java

     
    7070import org.sophie2.main.app.commons.frame.FrameView; 
    7171import org.sophie2.main.app.commons.page.PageWorkArea; 
    7272import org.sophie2.main.app.commons.page.RootPageView; 
     73import org.sophie2.main.app.halos.actions.ChangeBgOpacityAction; 
     74import org.sophie2.main.app.halos.actions.ChangeBorderColorAction; 
     75import org.sophie2.main.app.halos.actions.ChangeFrameVisibilityAction; 
     76import org.sophie2.main.app.halos.actions.SetBgTypeAction; 
     77import org.sophie2.main.app.halos.actions.SetBorderInsetsAction; 
    7378import org.sophie2.main.app.halos.actions.SetInsetsAction; 
     79import org.sophie2.main.app.halos.actions.SetShadowEnabledAction; 
     80import org.sophie2.main.app.halos.actions.SetShadowOffsetAction; 
     81import org.sophie2.main.app.halos.actions.SetWrapModeAction; 
    7482import org.sophie2.main.app.halos.common.AppHaloUtil; 
    7583import org.sophie2.main.app.halos.huds.ElementHud; 
    7684import org.sophie2.main.app.halos.huds.TemplatesControlGroup; 
     
    793801                                if (access == null) { 
    794802                                        return false; 
    795803                                } 
     804                                 
     805                                new ChangeBgOpacityAction(Message.create(BG_OPACITY), true, input).register(access); 
    796806 
    797                                 new AutoAction(Message.create(BG_OPACITY), true) { 
    798                                         @Override 
    799                                         public void performAuto() { 
    800                                                 getChanger().setRaw(StyledElement.KEY_BACKGROUND__OPACITY, 
    801                                                                 input.floatValue() / 100); 
    802                                         } 
    803                                 }.register(access); 
    804807                                return true; 
    805808                        } 
    806809 
     
    859862                                final ImmColor input = event.getEventParam( 
    860863                                                ColorPickerHudField.EventIds.COLOR_PARAM_INDEX, ImmColor.class); 
    861864 
    862                                 new AutoAction(Message.create(BORDER_COLOR), true) { 
    863                                         @Override 
    864                                         public void performAuto() { 
    865                                                 getChanger().setRaw(StyledElement.KEY_BORDER__COLOR, input); 
    866                                         } 
    867                                 }.register(access); 
     865                                AutoAction action = new ChangeBorderColorAction(Message.create(BORDER_COLOR), 
     866                                                true, input); 
     867                                action.register(access); 
    868868                                return true; 
    869869                        } 
    870870 
     
    889889                                final Boolean input = event 
    890890                                .getEventParam(EventIds.INPUT_PARAM_INDEX, Boolean.class); 
    891891 
    892                                 new AutoAction(Message.create(SHADOW_ENABLED), true) { 
    893                                         @Override 
    894                                         public void performAuto() { 
    895                                                 getChanger().setRaw(FrameR4.KEY_SHADOW__ENABLED, input); 
    896                                         } 
    897                                 }.register(access); 
     892                                AutoAction action = new SetShadowEnabledAction(Message.create(SHADOW_ENABLED), 
     893                                                true, input); 
     894                                action.register(access); 
    898895 
    899896                                return true; 
    900897                        } 
     
    921918                                String inputData = event.getEventParam(EventIds.INPUT_PARAM_INDEX, String.class); 
    922919                                final Float input = BoundValidation.parseNumber(inputData, Float.class); 
    923920 
    924                                 new AutoAction(Message.create(SHADOW_OFFSET), true) { 
    925                                         @Override 
    926                                         public void performAuto() { 
    927                                                 getChanger().setRaw(FrameR4.KEY_SHADOW__POSITION, 
    928                                                                 new ImmPoint(input, input)); 
    929                                         } 
    930                                 }.register(access); 
     921                                AutoAction action = new SetShadowOffsetAction(Message.create(SHADOW_OFFSET), true, 
     922                                                new ImmPoint(input, input)); 
     923                                action.register(access); 
    931924 
    932925                                return true; 
    933926                        } 
     
    951944                                ComboInput<BackgroundType> input = event.getEventParam( 
    952945                                                BoundControl.EventIds.INPUT_PARAM_INDEX, ComboInput.class); 
    953946                                final BackgroundType type = input.getSelectedItem(); 
    954                                 new AutoAction(Message.create(BG_TYPE), true) { 
    955                                         @Override 
    956                                         public void performAuto() { 
    957                                                 getChanger().setRaw(StyledElement.KEY_BACKGROUND__TYPE, type); 
    958                                         } 
    959                                 }.register(access); 
     947                                AutoAction action = new SetBgTypeAction(Message.create(BG_TYPE), 
     948                                                true, type); 
     949                                action.register(access); 
    960950                                return true; 
    961951                        } 
    962952 
     
    987977                                final VisibleChannel channel = ElementR4.KEY_VISIBLE.get(access); 
    988978                                final TimePos time = fv.getTime(); 
    989979 
    990                                 new AutoAction(Message.create(FRAME_VISIBILITY), true) { 
    991                                         @Override 
    992                                         public void performAuto() { 
    993                                                 getChanger().setRaw(ElementR4.KEY_VISIBLE, channel.setValue(time, input)); 
    994                                         } 
    995                                 }.register(access); 
     980                                AutoAction action = new ChangeFrameVisibilityAction(Message.create(FRAME_VISIBILITY), 
     981                                                true, channel, time, input); 
     982                                action.register(access); 
    996983                                return true; 
    997984                        } 
    998985                }, 
     
    1012999                                ResourceAccess access = getAccess(source); 
    10131000                                final Boolean input = event.getEventParam(BoundControl.EventIds.INPUT_PARAM_INDEX, 
    10141001                                                Boolean.class); 
    1015                                 new AutoAction(Message.create(SHADOW_ENABLED), true) { 
    1016                                         @Override 
    1017                                         public void performAuto() { 
    1018                                                 getChanger().setRaw(FrameR4.KEY_SHADOW__ENABLED, input); 
    1019                                         } 
    1020                                 }.register(access); 
     1002                                AutoAction action = new SetShadowEnabledAction(Message.create(SHADOW_ENABLED), 
     1003                                                true, input); 
     1004                                action.register(access); 
    10211005                                return true; 
    10221006                        } 
    10231007                }, 
     
    10411025                                final WrappingModes input = comboInput.getSelectedItem(); 
    10421026                                 
    10431027                                if (!input.equals(FrameR4.KEY_WRAP.get(access))) {  
    1044                                         new AutoAction(Message.create(WRAP_MODE), true) {  
    1045                                                 @Override  
    1046                                                 public void performAuto() {  
    1047                                                         getChanger().setRaw(FrameR4.KEY_WRAP, input);  
    1048                                                 }  
    1049                                         }.register(access);  
     1028                                        AutoAction action = new SetWrapModeAction(Message.create(WRAP_MODE), 
     1029                                                        true, input); 
     1030                                        action.register(access); 
    10501031                                } 
    10511032                                 
    10521033                                return true;  
     
    10921073         */ 
    10931074        protected static void setBorderInsets(final ImmInsets insets, Message eventDescription, 
    10941075                        ResourceAccess access, final TemplatedKey<ImmInsets> key) { 
    1095                 new AutoAction(eventDescription, true) { 
    1096                         @Override 
    1097                         public void performAuto() { 
    1098                                 getChanger().setRaw(key, insets); 
    1099                         } 
    1100                 }.register(access); 
     1076                AutoAction action = new SetBorderInsetsAction(eventDescription, true, key, insets); 
     1077                action.register(access); 
    11011078        } 
    11021079 
    11031080        /** 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetPageSizeAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.position.ImmSize; 
     4import org.sophie2.base.model.book.resource.r4.BookR4; 
     5import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     6import org.sophie2.base.skins.Message; 
     7 
     8/** 
     9 * An {@link AutoAction} for setting the page size. 
     10 *  
     11 * @author pap 
     12 * 
     13 */ 
     14public final class SetPageSizeAction extends AutoAction { 
     15 
     16        private final ImmSize value; 
     17         
     18        /** 
     19         * Creates an instance of {@link SetPageSizeAction}. 
     20         *  
     21         * @param description 
     22         *             The description of the AutoAction. 
     23         * @param significant 
     24         *                              The significance of the AutoAction. 
     25         * @param value 
     26         *                              The new size of the page. 
     27         */ 
     28        public SetPageSizeAction(Message description, boolean significant, ImmSize value) { 
     29                super(description, significant); 
     30                this.value = value; 
     31        } 
     32 
     33        @Override 
     34        public void performAuto() { 
     35                getChanger().setRaw(BookR4.KEY_PAGE_SIZE, this.value); 
     36                 
     37        } 
     38 
     39} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/DeleteGroupAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmList; 
     4import org.sophie2.base.model.book.ElementGroupH; 
     5import org.sophie2.base.model.book.timelines.ActivationChannel; 
     6import org.sophie2.base.model.resources.r4.ResourceRefR4; 
     7import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     8import org.sophie2.base.skins.Message; 
     9 
     10 
     11/** 
     12 * An {@link AutoAction} for deleting groups. 
     13 *  
     14 * @author mitex 
     15 * 
     16 */ 
     17public final class DeleteGroupAction extends AutoAction { 
     18 
     19        private final ResourceRefR4 groupRef; 
     20        private final ImmList<ActivationChannel> channels; 
     21 
     22        /** 
     23         * Creates an instance of {@link DeleteGroupAction}. 
     24         *  
     25         * @param description 
     26         *                      The message describing the action. 
     27         * @param significant 
     28         *                      The significance of the action. 
     29         * @param groupRef 
     30         *          The ref for the group to be deleted. 
     31         * @param channels 
     32         *          The channels of the group to be deleted. 
     33         */ 
     34        public DeleteGroupAction(Message description, boolean significant,  
     35                        ResourceRefR4 groupRef, ImmList<ActivationChannel> channels) { 
     36                super(description, significant); 
     37                this.groupRef = groupRef; 
     38                this.channels = channels; 
     39        } 
     40 
     41        @Override 
     42        public void performAuto() { 
     43                ElementGroupH.deleteGroup(getChanger(), this.groupRef, this.channels); 
     44                 
     45        } 
     46 
     47} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetBorderColorAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmColor; 
     4import org.sophie2.base.model.book.frame.FrameR4; 
     5import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     6import org.sophie2.base.skins.Message; 
     7 
     8 
     9/** 
     10 * An {@link AutoAction} for setting the bg color. 
     11 *  
     12 * @author stefan 
     13 * 
     14 */ 
     15public final class SetBorderColorAction extends AutoAction { 
     16 
     17        private final ImmColor input; 
     18         
     19        /** 
     20         * Creates an instance of {@link SetBorderColorAction}. 
     21         *  
     22         * @param description 
     23         *             The description of the AutoAction. 
     24         * @param significant 
     25         *                              The significance of the AutoAction. 
     26         * @param input 
     27         *                              The new color of the source. 
     28         */ 
     29        public SetBorderColorAction(Message description, boolean significant, ImmColor input) { 
     30                super(description, significant); 
     31                this.input = input; 
     32        } 
     33 
     34        @SuppressWarnings("static-access") 
     35        @Override 
     36        public void performAuto() { 
     37                getChanger().setRaw(FrameR4.KEY_BORDER__COLOR, this.input);              
     38        } 
     39 
     40} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetShadowColorAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmColor; 
     4import org.sophie2.base.model.book.frame.FrameR4; 
     5import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     6import org.sophie2.base.skins.Message; 
     7 
     8 
     9/** 
     10 * An {@link AutoAction} for setting the shadow color of a source. 
     11 *   
     12 * @author Tanya 
     13 * 
     14 */ 
     15public final class SetShadowColorAction extends AutoAction { 
     16 
     17        private final ImmColor input; 
     18         
     19        /** 
     20         * Creates an instance of {@link SetShadowColorAction}. 
     21         *  
     22         * @param description 
     23         *             The description of the AutoAction. 
     24         * @param significant 
     25         *                              The significance of the AutoAction. 
     26         * @param input 
     27         *                              The new color. 
     28         */ 
     29        public SetShadowColorAction(Message description, boolean significant, ImmColor input) { 
     30                super(description, significant); 
     31                this.input = input; 
     32        } 
     33 
     34        @Override 
     35        public void performAuto() { 
     36                getChanger().setRaw(FrameR4.KEY_SHADOW__COLOR, this.input); 
     37        } 
     38 
     39} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/appearance/ImagePickerHud.java

     
    4343import org.sophie2.core.prolib.list.ProList; 
    4444import org.sophie2.main.app.commons.element.ElementView; 
    4545import org.sophie2.main.app.commons.util.AppViewUtil; 
     46import org.sophie2.main.app.halos.actions.ChangeBgImageAction; 
    4647import org.sophie2.main.app.halos.huds.ElementHud; 
    4748import org.sophie2.main.func.resources.view.ResourceChooser; 
    4849 
     
    293294                                         
    294295                                        final PatternOptions newOptions = oldOptions.modifyOffset(newOffset); 
    295296                                         
    296                                         new AutoAction(Message.create(CHANGE_BACKGROUND_IMAGE_X_OFFSET), true) { 
    297                                                 @Override 
    298                                                 public void performAuto() { 
    299                                                         getChanger().setRaw(StyledElement.KEY_BACKGROUND__TYPE, BackgroundType.IMAGE); 
    300                                                         getChanger().setRaw(StyledElement.KEY_BACKGROUND__PATTERN_OPTIONS, newOptions); 
    301                                                 } 
    302                                         }.register(hud.access().get()); 
     297                                        AutoAction action = new ChangeBgImageAction(Message. 
     298                                                        create(CHANGE_BACKGROUND_IMAGE_X_OFFSET), true, newOptions); 
     299                                        action.register(hud.access().get()); 
    303300                                         
    304301                                        return true; 
    305302                                } 
     
    329326                                         
    330327                                        final PatternOptions newOptions = oldOptions.modifyOffset(newOffset); 
    331328                                         
    332                                         new AutoAction(Message.create(CHANGE_BACKGROUND_IMAGE_OFFSET), true) { 
    333                                                 @Override 
    334                                                 public void performAuto() { 
    335                                                         getChanger().setRaw(StyledElement.KEY_BACKGROUND__TYPE, BackgroundType.IMAGE); 
    336                                                         getChanger().setRaw(StyledElement.KEY_BACKGROUND__PATTERN_OPTIONS, newOptions); 
    337                                                 } 
    338                                         }.register(hud.access().get()); 
     329                                        AutoAction action = new ChangeBgImageAction(Message.create 
     330                                                        (CHANGE_BACKGROUND_IMAGE_OFFSET), true, newOptions); 
     331                                        action.register(hud.access().get()); 
    339332                                         
    340333                                        return true; 
    341334                                } 
     
    362355                                         
    363356                                        final PatternOptions newOptions = oldOptions.modifyScale(newSize); 
    364357                                         
    365                                         new AutoAction(Message.create(CHANGE_BACKGROUND_IMAGE_SCALE), true) { 
    366                                                 @Override 
    367                                                 public void performAuto() { 
    368                                                         getChanger().setRaw(StyledElement.KEY_BACKGROUND__TYPE, BackgroundType.IMAGE); 
    369                                                         getChanger().setRaw(StyledElement.KEY_BACKGROUND__PATTERN_OPTIONS, newOptions); 
    370                                                 } 
    371                                         }.register(hud.access().get()); 
     358                                        AutoAction action = new ChangeBgImageAction(Message.create 
     359                                                        (CHANGE_BACKGROUND_IMAGE_OFFSET), true, newOptions); 
     360                                        action.register(hud.access().get()); 
     361                                         
    372362                                        return true; 
    373363                                } 
    374364                        }, 
     
    392382                                        PatternOptions oldOptions = AppearanceHud.getStyleHelper(hud).getBackgroundPattern().getOptions(); 
    393383 
    394384                                        final PatternOptions newOptions = oldOptions.modifyType(input.getSelectedItem());  
    395                                         new AutoAction(Message.create(CHANGE_BACKGROUND_PATTERN_TYPE), true) { 
    396                                                 @Override 
    397                                                 public void performAuto() { 
    398                                                         getChanger().setRaw(StyledElement.KEY_BACKGROUND__TYPE, BackgroundType.IMAGE); 
    399                                                         getChanger().setRaw(StyledElement.KEY_BACKGROUND__PATTERN_OPTIONS, newOptions); 
    400                                                 } 
    401                                         }.register(hud.access().get()); 
     385                                        AutoAction action = new ChangeBgImageAction(Message.create 
     386                                                        (CHANGE_BACKGROUND_IMAGE_OFFSET), true, newOptions); 
     387                                        action.register(hud.access().get()); 
    402388                                        return true; 
    403389                                } 
    404390 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/appearance/BackgroundGradientField.java

     
    99import org.sophie2.base.model.book.interfaces.StyledElement; 
    1010import org.sophie2.base.model.resources.r4.access.ResourceAccess; 
    1111import org.sophie2.base.model.resources.r4.changes.AutoAction; 
    12 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 
    1312import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 
    1413import org.sophie2.base.skins.Message; 
    1514import org.sophie2.base.visual.BaseVisualElement; 
     
    2019import org.sophie2.core.mvc.EventFilterBuilder; 
    2120import org.sophie2.core.mvc.OperationDef; 
    2221import org.sophie2.core.mvc.events.EventR3; 
     22import org.sophie2.main.app.halos.actions.SetBgGradientAndTypeAction; 
    2323import org.sophie2.main.app.halos.huds.appearance.AppearanceHud.BackgroundPanel; 
    2424import org.sophie2.main.app.halos.huds.gradient.GradientHudButton; 
    2525 
     
    8181                                                source, AppearanceHud.class); 
    8282                                final ResourceAccess access = hud.access().get(); 
    8383                                final ImmGradient input = event.getEventParam(EventIds.GRADIENT_PARAM_INDEX, ImmGradient.class); 
    84                                 new AutoAction(Message.create(BG_GRADIENT), true) { 
    85                                         @Override 
    86                                         public void performAuto() { 
    87                                                 ResourceChanger changer = getChanger(); 
    88                                                 changer.setRaw(StyledElement.KEY_BACKGROUND__GRADIENT, 
    89                                                                 input); 
    90                                                 changer.setRaw(StyledElement.KEY_BACKGROUND__TYPE, 
    91                                                                 BackgroundType.GRADIENT); 
    92                                         } 
    93                                 }.register(access); 
     84                                AutoAction action = new SetBgGradientAndTypeAction(Message.create(BG_GRADIENT), 
     85                                                true, input); 
     86                                action.register(access); 
    9487                                return true; 
    9588                        } 
    9689                         
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetBgTypeAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.model.book.BackgroundType; 
     4import org.sophie2.base.model.book.interfaces.StyledElement; 
     5import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     6import org.sophie2.base.skins.Message; 
     7 
     8 
     9/** 
     10 * An {@link AutoAction} for setting the background type. 
     11 *  
     12 * @author peko 
     13 * 
     14 */ 
     15public final class SetBgTypeAction extends AutoAction { 
     16 
     17        private final BackgroundType type; 
     18         
     19        /** 
     20         * Creates an instance of {@link SetBgTypeAction}. 
     21         *  
     22         * @param description 
     23         *             The description of the AutoAction. 
     24         * @param significant 
     25         *                              The significance of the AutoAction. 
     26         * @param type  
     27         *                              The {@link BackgroundType}. 
     28         */ 
     29        public SetBgTypeAction(Message description, boolean significant, BackgroundType type) { 
     30                super(description, significant); 
     31                this.type = type; 
     32        } 
     33 
     34        @Override 
     35        public void performAuto() { 
     36                getChanger().setRaw(StyledElement.KEY_BACKGROUND__TYPE, this.type);              
     37        } 
     38 
     39} 
  • modules/org.sophie2.main.func.text/src/main/java/org/sophie2/main/func/text/view/TextFrameView.java

     
    150150         
    151151        @Override 
    152152        public boolean isEditable() { 
    153                 return super.isEditable() && textFlow().get().isEditable(); 
     153                boolean isEditable = super.isEditable(); 
     154                if (textFlow().get() != null) { 
     155                        isEditable = isEditable && textFlow().get().isEditable(); 
     156                } 
     157                return isEditable; 
    154158        } 
    155159} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/DeleteGroupResourceAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmList; 
     4import org.sophie2.base.model.book.interfaces.CompositeElement; 
     5import org.sophie2.base.model.book.timelines.ActivationChannel; 
     6import org.sophie2.base.model.resources.r4.ResourceRefR4; 
     7import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     8import org.sophie2.base.skins.Message; 
     9 
     10 
     11/** 
     12 * An {@link AutoAction} for deleting groups. 
     13 *  
     14 * @author mitex 
     15 * 
     16 */ 
     17public final class DeleteGroupResourceAction extends AutoAction { 
     18 
     19        private final ImmList<ActivationChannel> newChannels; 
     20        private final ResourceRefR4 relativeGroupRef; 
     21 
     22        /** 
     23         * Creates an instance of {@link DeleteGroupAction}. 
     24         *  
     25         * @param description 
     26         *                      The message describing the action. 
     27         * @param significant 
     28         *                      The significance of the action. 
     29         * @param relativeGroupRef 
     30         *          The ref for the group to be deleted. 
     31         * @param newChannels 
     32         *          The channels of the group to be deleted. 
     33         */ 
     34        public DeleteGroupResourceAction(Message description, boolean significant,  
     35                        ResourceRefR4 relativeGroupRef, ImmList<ActivationChannel> newChannels) { 
     36                super(description, significant); 
     37                this.newChannels = newChannels; 
     38                this.relativeGroupRef = relativeGroupRef; 
     39        } 
     40 
     41        @Override 
     42        public void performAuto() { 
     43                getChanger().removeResource(this.relativeGroupRef); 
     44                getChanger().setRaw(CompositeElement.KEY_SUB_ELEMENTS, this.newChannels); 
     45                 
     46        } 
     47 
     48} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetBgColorAndTypeAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmColor; 
     4import org.sophie2.base.model.book.BackgroundType; 
     5import org.sophie2.base.model.book.interfaces.StyledElement; 
     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/** 
     12 * An {@link AutoAction} for setting the bg color and type. 
     13 *  
     14 * @author pap 
     15 * 
     16 */ 
     17public final class SetBgColorAndTypeAction extends AutoAction { 
     18 
     19        private final ImmColor input; 
     20         
     21        /** 
     22         * Creates a new instance of {@link SetBgColorAndTypeAction}. 
     23         *  
     24         * @param description 
     25         *                      The message describing the action. 
     26         * @param significant 
     27         *                      The significance of the action. 
     28         * @param input 
     29         *                      The new color of the background. 
     30         */ 
     31        public SetBgColorAndTypeAction(Message description, boolean significant, ImmColor input) { 
     32                super(description, significant); 
     33                this.input = input; 
     34        } 
     35 
     36        @Override 
     37        public void performAuto() { 
     38                ResourceChanger changer = getChanger(); 
     39                changer.setRaw(StyledElement.KEY_BACKGROUND__COLOR, 
     40                                this.input); 
     41                changer.setRaw(StyledElement.KEY_BACKGROUND__TYPE, 
     42                                BackgroundType.SOLID); 
     43                 
     44        } 
     45 
     46} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/common/ChangeColorButton.java

     
    44import org.sophie2.base.dialogs.DialogManager; 
    55import org.sophie2.base.halos.ClickHaloButton; 
    66import org.sophie2.base.halos.HaloButton; 
    7 import org.sophie2.base.model.book.interfaces.StyledElement; 
    87import org.sophie2.base.model.resources.r4.changes.AutoAction; 
    98import org.sophie2.base.skins.Message; 
    109import org.sophie2.core.logging.SophieLog; 
     
    1211import org.sophie2.core.mvc.OperationDef; 
    1312import org.sophie2.core.mvc.events.EventR3; 
    1413import org.sophie2.main.app.commons.frame.FrameView; 
     14import org.sophie2.main.app.halos.actions.ChangeFrameBorderColorAction; 
    1515import org.sophie2.main.dialogs.input.ColorDialogInput; 
    1616 
    1717//TODO This class should be a HudHaloButton. 
     
    5050                                final ImmColor bg = DialogManager.get().showDialog(new ColorDialogInput( 
    5151                                                halo.swingComponent().get(), DIALOG_TITLE, INITIAL_COLOR)); 
    5252                                if(bg!=null) { 
    53                                         new AutoAction(Message.create(CHANGE_FRAME_BORDER_COLOR), true) { 
    54                                                  
    55                                                 @Override 
    56                                                 public void performAuto() { 
    57                                                         getChanger().setRaw(StyledElement.KEY_BORDER__COLOR, bg); 
    58                                                 } 
    59                                                  
    60                                         }.register(currentView.getAccess()); 
     53                                        new ChangeFrameBorderColorAction(Message.create(CHANGE_FRAME_BORDER_COLOR), 
     54                                                        true, bg).register(currentView.getAccess()); 
    6155                                         
    6256                                        SophieLog.debug("Border color changed for" + currentView); 
    6357                                } 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/GroupElementsAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmList; 
     4import org.sophie2.base.model.book.ElementGroupH; 
     5import org.sophie2.base.model.book.timelines.ActivationChannel; 
     6import org.sophie2.base.model.resources.r4.ResourceRefList; 
     7import org.sophie2.base.model.resources.r4.ResourceRefR4; 
     8import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     9import org.sophie2.base.skins.Message; 
     10 
     11 
     12/** 
     13 * An {@link AutoAction} for grouping elements. 
     14 *  
     15 * @author mitex 
     16 * 
     17 */ 
     18public final class GroupElementsAction extends AutoAction { 
     19 
     20        final private ResourceRefR4 groupRef; 
     21        final private String groupTitle; 
     22        final private ImmList<ActivationChannel> channels; 
     23        final private ResourceRefList elements; 
     24 
     25        /** 
     26         * Creates a new instance of {@link GroupElementsAction}. 
     27         *  
     28         * @param description 
     29         *                      The message describing the action. 
     30         * @param significant 
     31         *                      The significance of the action. 
     32         * @param elements 
     33         *          The elements of the group. 
     34         * @param groupRef 
     35         *          The ref of the group. 
     36         * @param groupTitle 
     37         *          The title of the group. 
     38         * @param channels 
     39         *          The channels of the grouped elements. 
     40         */ 
     41        public GroupElementsAction(Message description, boolean significant,ResourceRefList elements,  
     42                        ResourceRefR4 groupRef, String groupTitle, ImmList<ActivationChannel> channels) { 
     43                super(description, significant); 
     44                this.groupRef = groupRef; 
     45                this.groupTitle = groupTitle; 
     46                this.channels = channels; 
     47                this.elements = elements; 
     48        } 
     49 
     50        @Override 
     51        public void performAuto() { 
     52                ElementGroupH.createGroup(getChanger(), this.groupRef, this.groupTitle,  
     53                                this.elements, this.channels);           
     54        } 
     55 
     56} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/AlignElementsAction.java

     
    1 /** 
    2  *  
    3  */ 
    4 package org.sophie2.main.app.halos.actions; 
    5  
    6 import org.sophie2.base.commons.util.ImmList; 
    7 import org.sophie2.base.commons.util.position.ImmPoint; 
    8 import org.sophie2.base.media.TimePos; 
    9 import org.sophie2.base.model.book.interfaces.MemberElement; 
    10 import org.sophie2.base.model.book.timelines.LocationChannel; 
    11 import org.sophie2.base.model.resources.r4.ResourceRefList; 
    12 import org.sophie2.base.model.resources.r4.ResourceRefR4; 
    13 import org.sophie2.base.model.resources.r4.changes.AutoAction; 
    14 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 
    15 import org.sophie2.base.skins.Message; 
    16  
    17 /** 
    18  * An {@link AutoAction} that aligns a selection of elements. 
    19  *  
    20  * @author peko, mitex 
    21  */ 
    22 public class AlignElementsAction extends AutoAction { 
    23          
    24         private final ImmList<ImmPoint> newBounds; 
    25         private final ResourceRefList immRefs; 
    26         private final ImmList<LocationChannel> immOldLocations; 
    27         private final ImmList<TimePos> immTimes; 
    28  
    29         /** 
    30          * Creates an <code>AlignElementsAction</code>. 
    31          *  
    32          * @param description 
    33          *                      The message describing the action. 
    34          * @param significant 
    35          *                      The significance of the action. 
    36          * @param newLocations 
    37          *                      The list of new locations of the elements being aligned. 
    38          * @param immRefs 
    39          *                      The list of elements to be aligned 
    40          * @param immOldLocations 
    41          *                      The old locations of the elements. 
    42          * @param immTimes 
    43          *                      The list of times for which to set the new location. 
    44          */ 
    45         public AlignElementsAction(Message description, boolean significant, 
    46                         ImmList<ImmPoint> newLocations, ResourceRefList immRefs, 
    47                         ImmList<LocationChannel> immOldLocations, ImmList<TimePos> immTimes) { 
    48                 super(description, significant); 
    49                  
    50                 this.newBounds = newLocations; 
    51                 this.immRefs = immRefs; 
    52                 this.immOldLocations = immOldLocations; 
    53                 this.immTimes = immTimes; 
    54         } 
    55  
    56         @Override 
    57         public void performAuto() { 
    58                 for (int i = 0; i < this.immRefs.size(); ++i) { 
    59                         ResourceRefR4 ref = this.immRefs.get(i); 
    60                         ResourceChanger ch = getChanger().getSub(ref); 
    61                         LocationChannel chan = this.immOldLocations.get(i).setValue(this.immTimes.get(i),  
    62                                         this.newBounds.get(i)); 
    63  
    64                         ch.setRaw(MemberElement.KEY_LOCATION, chan); 
    65                 } 
    66         } 
    67 } 
    68  No newline at end of file 
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmList; 
     4import org.sophie2.base.commons.util.position.ImmPoint; 
     5import org.sophie2.base.media.TimePos; 
     6import org.sophie2.base.model.book.interfaces.MemberElement; 
     7import org.sophie2.base.model.book.timelines.LocationChannel; 
     8import org.sophie2.base.model.resources.r4.ResourceRefList; 
     9import org.sophie2.base.model.resources.r4.ResourceRefR4; 
     10import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     11import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 
     12import org.sophie2.base.skins.Message; 
     13 
     14/** 
     15 * An AutoAction for alignment of elements. 
     16 *  
     17 * @author diana 
     18 * 
     19 */ 
     20public final class AlignElementsAction extends AutoAction{ 
     21 
     22        private final ImmList<ImmPoint> newBounds; 
     23        private final ResourceRefList immRefs; 
     24        private final ImmList<LocationChannel> immOldLocations; 
     25        private final ImmList<TimePos> immTimes; 
     26         
     27        /** 
     28         * Creates an instance of {@link AlignElementsAction}. 
     29         *  
     30         * @param description 
     31         *             The description of the AutoAction. 
     32         * @param significant 
     33         *                              The significance of the AutoAction. 
     34         * @param newBounds 
     35         *                              The new bounds of the alignment. 
     36         * @param immRefs 
     37         *              The list of refs to be changed. 
     38         * @param immOldLocations 
     39         *              The old locations of the resources. 
     40         * @param immTimes 
     41         *              The times of the new alignment. 
     42         */ 
     43        public AlignElementsAction(Message description, boolean significant,  
     44                        ImmList<ImmPoint> newBounds, ResourceRefList immRefs, 
     45                        ImmList<LocationChannel> immOldLocations, ImmList<TimePos> immTimes) { 
     46                super(description, significant); 
     47                this.newBounds = newBounds; 
     48                this.immOldLocations = immOldLocations; 
     49                this.immRefs = immRefs; 
     50                this.immTimes = immTimes; 
     51        } 
     52 
     53        @Override 
     54        public void performAuto() { 
     55                for (int i = 0; i < this.immRefs.size(); ++i) { 
     56                        ResourceRefR4 ref = this.immRefs.get(i); 
     57                        ResourceChanger ch = getChanger().getSub(ref); 
     58                        LocationChannel chan = this.immOldLocations.get(i).setValue( 
     59                                        this.immTimes.get(i), this.newBounds.get(i)); 
     60 
     61                        ch.setRaw(MemberElement.KEY_LOCATION, chan); 
     62                } 
     63        } 
     64 
     65} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/ChangeBgOpacityAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.model.book.interfaces.StyledElement; 
     4import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     5import org.sophie2.base.skins.Message; 
     6 
     7 
     8/** 
     9 * An {@link AutoAction} for changing the background opacity. 
     10 *  
     11 * @author peko 
     12 * 
     13 */ 
     14public final class ChangeBgOpacityAction extends AutoAction { 
     15 
     16        private final Integer input; 
     17 
     18        /** 
     19         * Creates an instance of {@link ChangeBgOpacityAction}. 
     20         *  
     21         * @param description 
     22         *             The description of the AutoAction. 
     23         * @param significant 
     24         *                              The significance of the AutoAction. 
     25         * @param input 
     26         *              The new opacity of the background. 
     27         */ 
     28        public ChangeBgOpacityAction(Message description, boolean significant, Integer input) { 
     29                super(description, significant); 
     30                this.input = input; 
     31        } 
     32 
     33        @Override 
     34        public void performAuto() { 
     35                getChanger().setRaw(StyledElement.KEY_BACKGROUND__OPACITY, 
     36                                this.input.floatValue() / 100); 
     37        } 
     38 
     39} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetFrameContentTemplAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.model.book.interfaces.ResourceFrame; 
     4import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     5import org.sophie2.base.skins.Message; 
     6 
     7 
     8/** 
     9 * An {@link AutoAction} for setting the frame content templating. 
     10 *  
     11 * @author jani 
     12 * 
     13 */ 
     14public final class SetFrameContentTemplAction extends AutoAction { 
     15 
     16        /** 
     17         * Creates a <code>SetFrameContentTemplAction</code>. 
     18         *  
     19         * @param description 
     20         *                      The message describing the action. 
     21         * @param significant 
     22         *                      The significance of the action. 
     23         */ 
     24        public SetFrameContentTemplAction(Message description, boolean significant) { 
     25                super(description, significant); 
     26        } 
     27 
     28        @Override 
     29        public void performAuto() { 
     30                getChanger().setRaw(ResourceFrame.KEY_MAIN_RESOURCE, null);              
     31        } 
     32 
     33} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetLocationAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.position.ImmPoint; 
     4import org.sophie2.base.media.TimePos; 
     5import org.sophie2.base.model.book.interfaces.MemberElement; 
     6import org.sophie2.base.model.book.timelines.LocationChannel; 
     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.app.halos.frame.MainTitleBarHalo; 
     12 
     13 
     14/** 
     15 * An {@link AutoAction} for setting location of the {@link MainTitleBarHalo}. 
     16 *  
     17 * @author vlado 
     18 * 
     19 */ 
     20public final class SetLocationAction extends AutoAction { 
     21 
     22        private final ImmPoint newValue; 
     23        private final ResourceRefR4 frameRef;                                    
     24        private final LocationChannel oldChanel; 
     25        private final TimePos time; 
     26         
     27        /** 
     28         *  Creates an instance of {@link SetLocationAction}. 
     29         *   
     30         * @param description 
     31         *                      The message describing the action. 
     32         * @param significant 
     33         *                      The significance of the action. 
     34         * @param newValue 
     35         *           The new location. 
     36         * @param frameRef 
     37         *           The frame of the halo. 
     38         * @param oldChanel 
     39         *           The old channel of the halo. 
     40         * @param time 
     41         *           The time when moved. 
     42         */ 
     43        public SetLocationAction(Message description, boolean significant,  
     44                        ImmPoint newValue, ResourceRefR4 frameRef, LocationChannel oldChanel,  
     45                        TimePos time) { 
     46                super(description, significant); 
     47                this.newValue = newValue; 
     48                this.frameRef = frameRef; 
     49                this.oldChanel = oldChanel; 
     50                this.time = time; 
     51        } 
     52 
     53        @Override 
     54        public void performAuto() { 
     55                ResourceChanger subChanger = getChanger().getSub(this.frameRef); 
     56 
     57                subChanger.setRaw(MemberElement.KEY_LOCATION, this.oldChanel 
     58                                .setValue(this.time, this.newValue)); 
     59                 
     60        } 
     61 
     62} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetWrapModeAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.model.book.frame.FrameR4; 
     4import org.sophie2.base.model.book.frame.WrappingModes; 
     5import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     6import org.sophie2.base.skins.Message; 
     7 
     8 
     9/** 
     10 * An {@link AutoAction} for setting the wrap mode. 
     11 *  
     12 * @author peko 
     13 * 
     14 */ 
     15public final class SetWrapModeAction extends AutoAction { 
     16 
     17        private final WrappingModes input; 
     18         
     19        /** 
     20         * Creates an instance of {@link SetWrapModeAction}. 
     21         *  
     22         * @param description 
     23         *             The description of the AutoAction. 
     24         * @param significant 
     25         *                              The significance of the AutoAction. 
     26         * @param input 
     27         *                              The new {@link WrappingModes} of the source. 
     28         */ 
     29        public SetWrapModeAction(Message description, boolean significant, WrappingModes input) { 
     30                super(description, significant); 
     31                this.input = input; 
     32        } 
     33 
     34        @Override 
     35        public void performAuto() { 
     36                getChanger().setRaw(FrameR4.KEY_WRAP, this.input); 
     37                 
     38        } 
     39 
     40} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/appearance/ShadowHud.java

     
    3434import org.sophie2.core.prolib.impl.AutoProperty; 
    3535import org.sophie2.core.prolib.interfaces.Prop; 
    3636import org.sophie2.main.app.commons.frame.FrameView; 
     37import org.sophie2.main.app.halos.actions.SetShadowColorAction; 
     38import org.sophie2.main.app.halos.actions.SetShadowOffsetAction; 
     39import org.sophie2.main.app.halos.actions.SetShadowOpacityAction; 
    3740import org.sophie2.main.app.halos.common.AppHaloUtil; 
    3841import org.sophie2.main.app.halos.huds.TemplatesControlGroup; 
    3942import org.sophie2.main.app.halos.huds.color.ColorPickerHudField; 
     
    333336 
    334337                                System.out.println("point = " + point); 
    335338 
    336                                 new AutoAction(Message.create(SHADOW_POSITION_X_CHANGE), true) { 
    337                                         @Override 
    338                                         public void performAuto() { 
    339                                                 getChanger().setRaw(FrameR4.KEY_SHADOW__POSITION, point); 
    340                                         } 
    341                                 }.register(access); 
     339                                AutoAction action = new SetShadowOffsetAction(Message. 
     340                                                create(SHADOW_POSITION_X_CHANGE), true, point); 
     341                                action.register(access); 
    342342                                return true; 
    343343                        } 
    344344                }, 
     
    361361                                Float x = FrameR4.KEY_SHADOW__POSITION.get(access).getX(); 
    362362                                Float y = BoundValidation.parseNumber(input, Float.class); 
    363363                                final ImmPoint point = new ImmPoint(x, y); 
    364                                 new AutoAction(Message.create(SHADOW_POSITION_Y_CHANGE), true) { 
    365                                         @Override 
    366                                         public void performAuto() { 
    367                                                 getChanger().setRaw(FrameR4.KEY_SHADOW__POSITION, point); 
    368                                         } 
    369                                 }.register(access); 
     364                                AutoAction action = new SetShadowOffsetAction(Message. 
     365                                                create(SHADOW_POSITION_X_CHANGE), true, point); 
     366                                action.register(access); 
    370367                                return true; 
    371368                        } 
    372369                }, 
     
    388385                                } 
    389386                                final ImmColor input = event.getEventParam( 
    390387                                                ColorPickerHudField.EventIds.COLOR_PARAM_INDEX, ImmColor.class); 
    391                                 new AutoAction(Message.create(SHADOW_COLOR_CHANGE), true) { 
    392                                         @Override 
    393                                         public void performAuto() { 
    394                                                 getChanger().setRaw(FrameR4.KEY_SHADOW__COLOR, input); 
    395                                         } 
    396                                 }.register(access); 
     388                                 
     389                                AutoAction action = new SetShadowColorAction(Message.create(SHADOW_COLOR_CHANGE), 
     390                                                true, input); 
     391                                action.register(access); 
    397392                                return true; 
    398393                        } 
    399394                }, 
     
    422417                                        return false; 
    423418                                } 
    424419 
    425                                 new AutoAction(Message.create(CHANGE_FRAME_SHADOW_OPACITY), true) { 
    426                                         @Override 
    427                                         public void performAuto() { 
    428                                                 getChanger().setRaw(FrameR4.KEY_SHADOW__OPACITY, input.floatValue() / 100); 
    429                                         } 
    430                                 }.register(access); 
    431  
     420                                AutoAction action = new SetShadowOpacityAction(Message. 
     421                                                create(CHANGE_FRAME_SHADOW_OPACITY), true, input.floatValue() / 100); 
     422                                action.register(access); 
    432423                                return true; 
    433424                        } 
    434425                }; 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/ChangeFrameVisibilityAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.media.TimePos; 
     4import org.sophie2.base.model.book.resource.r4.ElementR4; 
     5import org.sophie2.base.model.book.timelines.VisibleChannel; 
     6import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     7import org.sophie2.base.skins.Message; 
     8 
     9 
     10/** 
     11 * An {@link AutoAction} for changing the visibility. 
     12 *  
     13 * @author peko 
     14 * 
     15 */ 
     16public final class ChangeFrameVisibilityAction extends AutoAction { 
     17 
     18        private final VisibleChannel channel; 
     19        private final TimePos time; 
     20        private final Boolean input; 
     21         
     22        /** 
     23         * Creates an instance of {@link ChangeFrameVisibilityAction}. 
     24         *  
     25         * @param description 
     26         *             The description of the AutoAction. 
     27         * @param significant 
     28         *                              The significance of the AutoAction. 
     29         * @param channel 
     30         *              The {@link VisibleChannel} of the source. 
     31         * @param time 
     32         *                      The time when changing the visibility. 
     33         * @param input 
     34         *             True if the source will be visible, false otherwise.  
     35         */ 
     36        public ChangeFrameVisibilityAction(Message description, boolean significant, 
     37                        VisibleChannel channel, TimePos time, Boolean input) { 
     38                super(description, significant); 
     39                this.channel = channel; 
     40                this.input = input; 
     41                this.time = time; 
     42        } 
     43 
     44        @Override 
     45        public void performAuto() { 
     46                getChanger().setRaw(ElementR4.KEY_VISIBLE, this.channel.setValue(this.time, this.input)); 
     47        } 
     48 
     49} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/grouping/GroupHalosLogic.java

     
    3333import org.sophie2.main.app.commons.page.PageWorkArea; 
    3434import org.sophie2.main.app.commons.page.PwaSelector; 
    3535import org.sophie2.main.app.commons.util.AppViewUtil; 
     36import org.sophie2.main.app.halos.actions.DeleteGroupAction; 
     37import org.sophie2.main.app.halos.actions.DeleteGroupResourceAction; 
     38import org.sophie2.main.app.halos.actions.GroupElementsAction; 
    3639import org.sophie2.main.app.halos.common.AppHaloUtil; 
    3740import org.sophie2.main.dialogs.input.DialogUtils; 
    3841 
     
    138141                                CompositeElement.KEY_SUB_ELEMENTS.get(access); 
    139142                        final String groupTitle = ResourceUtil.getNextTitle( 
    140143                                        pwa.bookView().get().getAccess().getRef(), ElementGroupR4.DEFAULT_TITLE); 
    141                         new AutoAction(Message.create(GROUP_ELEMENTS), true) { 
    142                                 @Override 
    143                                 public void performAuto() { 
    144                                         ElementGroupH.createGroup(getChanger(), groupRef, groupTitle,  
    145                                                                                                                         elements, channels); 
    146                                 } 
    147                         }.register(access); 
     144                        new GroupElementsAction(Message.create(GROUP_ELEMENTS), true, 
     145                                        elements, groupRef, groupTitle, channels).register(access); 
    148146                         
    149147                        // select the new group 
    150148                        ResourceRefR4 parentRef = parentView.getAccess().getRef(); 
     
    195193                        final ImmList<ActivationChannel> channels =  
    196194                                CompositeElement.KEY_SUB_ELEMENTS.get(parentAccess); 
    197195                         
    198                         new AutoAction(Message.create(DELETE_GROUP), true) { 
    199                                 @Override 
    200                                 public void performAuto() { 
    201                                         ElementGroupH.deleteGroup(getChanger(), groupRef, channels); 
    202                                 } 
    203                         }.register(parentAccess); 
     196                        new DeleteGroupAction(Message.create(DELETE_GROUP), true, 
     197                                        groupRef, channels).register(parentAccess); 
    204198                         
    205199                        return true; 
    206200                } 
     
    244238                        ActivationChannel frameChan = parentH.getActivationChannel(relativeGroupRef); 
    245239                         
    246240                        final ImmList<ActivationChannel> newChannels = channels.remove(frameChan); 
    247                         new AutoAction(Message.create(DELETE_GROUP), true) { 
    248                                 @Override 
    249                                 public void performAuto() { 
    250                                         getChanger().removeResource(relativeGroupRef); 
    251                                         getChanger().setRaw(CompositeElement.KEY_SUB_ELEMENTS, newChannels); 
    252                                 } 
    253                         }.register(parentAccess); 
     241                        new DeleteGroupResourceAction(Message.create(DELETE_GROUP), true, 
     242                                        relativeGroupRef, newChannels).register(parentAccess); 
    254243                         
    255244                        return true; 
    256245                } 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetShadowOffsetAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.position.ImmPoint; 
     4import org.sophie2.base.model.book.frame.FrameR4; 
     5import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     6import org.sophie2.base.skins.Message; 
     7 
     8 
     9/** 
     10 * An {@link AutoAction} for setting the shadow position.  
     11 *  
     12 * @author peko 
     13 * 
     14 */ 
     15public final class SetShadowOffsetAction extends AutoAction { 
     16 
     17        private final ImmPoint point; 
     18         
     19        /** 
     20         * Creates an instance of {@link SetShadowOffsetAction}. 
     21         *  
     22         * @param description 
     23         *             The description of the AutoAction. 
     24         * @param significant 
     25         *                              The significance of the AutoAction. 
     26         * @param point 
     27         *                      The new position of the shadow. 
     28         */ 
     29        public SetShadowOffsetAction(Message description, boolean significant, ImmPoint point) { 
     30                super(description, significant); 
     31                this.point = point; 
     32        } 
     33 
     34        @Override 
     35        public void performAuto() { 
     36                getChanger().setRaw(FrameR4.KEY_SHADOW__POSITION, this.point);           
     37        } 
     38 
     39} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/page/resize/PageResizeHaloButton.java

     
    1010import org.sophie2.base.commons.util.position.ImmSize; 
    1111import org.sophie2.base.commons.util.position.ImmVector; 
    1212import org.sophie2.base.halos.MoveHaloButton; 
     13import org.sophie2.base.model.book.AutoActionsUtil; 
    1314import org.sophie2.base.model.book.BookH; 
    14 import org.sophie2.base.model.book.resource.r4.BookR4; 
    1515import org.sophie2.base.model.book.resource.r4.PageR4; 
    1616import org.sophie2.base.model.resources.r4.changes.AutoAction; 
    1717import org.sophie2.base.scene.SceneVisual; 
     
    2424import org.sophie2.base.visual.skins.VisualElementDef; 
    2525import org.sophie2.core.prolib.interfaces.Prop; 
    2626import org.sophie2.main.app.commons.page.PageWorkArea; 
     27import org.sophie2.main.app.halos.actions.SetPageSizeAction; 
    2728import org.sophie2.main.app.halos.common.AppHaloUtil; 
    2829 
    2930/** 
     
    8889                                        sv.wantedViewRect().set(null); 
    8990 
    9091 
    91                                         new AutoAction(Message.create(SET_PAGE_SIZE), true) { 
    92  
    93                                                 @Override 
    94                                                 public void performAuto() { 
    95                                                         // TODO (r4) is this ok???? 
    96                                                 } 
    97                                         }.register(book.getAccess()); 
     92                                        // TODO (r4) is this ok???? 
     93                                        AutoAction action = new AutoActionsUtil.EndAutoAction( 
     94                                                        Message.create(SET_PAGE_SIZE)); 
     95                                        action.register(book.getAccess()); 
    9896                                } 
    9997 
    10098                                @Override 
     
    121119                                        } 
    122120                                         
    123121                                        final ImmSize value = new ImmSize(width, height); 
    124                                         new AutoAction(Message.create(PAGE_RESIZE), false) { 
    125                                                 @Override 
    126                                                 public void performAuto() { 
    127                                                         getChanger().setRaw(BookR4.KEY_PAGE_SIZE, value); 
    128                                                 } 
    129                                         }.register(book.getAccess()); 
     122                                        AutoAction action = new SetPageSizeAction(Message.create(PAGE_RESIZE), 
     123                                                        false, value); 
     124                                        action.register(book.getAccess()); 
    130125                                } 
    131126 
    132127                        }; 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/ChangeFrameBorderColorAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmColor; 
     4import org.sophie2.base.model.book.interfaces.StyledElement; 
     5import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     6import org.sophie2.base.skins.Message; 
     7 
     8 
     9/** 
     10 * An {@link AutoAction} for changing the frame border color. 
     11 *  
     12 * @author peko 
     13 * 
     14 */ 
     15public final class ChangeFrameBorderColorAction extends AutoAction { 
     16 
     17        private final ImmColor bg; 
     18         
     19        /** 
     20         * Creates an instance of {@link ChangeFrameBorderColorAction}. 
     21         *  
     22         * @param description 
     23         *             The description of the AutoAction. 
     24         * @param significant 
     25         *                              The significance of the AutoAction. 
     26         * @param bg 
     27         *                              The background of the border. 
     28         */ 
     29        public ChangeFrameBorderColorAction(Message description, boolean significant, ImmColor bg) { 
     30                super(description, significant); 
     31                this.bg = bg; 
     32        } 
     33 
     34        @Override 
     35        public void performAuto() { 
     36                getChanger().setRaw(StyledElement.KEY_BORDER__COLOR, this.bg); 
     37                 
     38        } 
     39 
     40} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/appearance/BorderHud.java

     
    1414import org.sophie2.base.halos.HudTitleBar; 
    1515import org.sophie2.base.model.book.FrameH; 
    1616import org.sophie2.base.model.book.StyledElementH; 
    17 import org.sophie2.base.model.book.frame.FrameR4; 
    1817import org.sophie2.base.model.book.interfaces.StyledElement; 
    1918import org.sophie2.base.model.resources.r4.access.ResourceAccess; 
    2019import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     
    3332import org.sophie2.core.prolib.list.EmptyProList; 
    3433import org.sophie2.core.prolib.list.ProList; 
    3534import org.sophie2.main.app.commons.element.ElementView; 
     35import org.sophie2.main.app.halos.actions.SetBorderColorAction; 
    3636import org.sophie2.main.app.halos.common.AppHaloUtil; 
    3737import org.sophie2.main.app.halos.huds.ElementHud; 
    3838 
     
    415415                                filter.setSourceClass(BorderOpacity.class); 
    416416                        } 
    417417 
    418                         @SuppressWarnings("static-access") 
    419418                        public boolean handle(EventR3 event) { 
    420419                                VisualElement source = event.getSource(BorderOpacity.class); 
    421420                                Integer inputData = event.getEventParam(BoundControl.EventIds.INPUT_PARAM_INDEX, 
     
    434433                                                        borderColor.getBlueValue(),  
    435434                                                        alpha); 
    436435                                         
    437                                         new AutoAction(Message.create(BORDER_OPACITY), true) { 
    438                                                 @Override 
    439                                                 public void performAuto() { 
    440                                                         getChanger().setRaw(FrameR4.KEY_BORDER__COLOR, input); 
    441                                                 } 
    442                                         }.register(access); 
     436                                        AutoAction action = new SetBorderColorAction(Message.create(BORDER_OPACITY), 
     437                                                        true, input); 
     438                                        action.register(access); 
    443439                                        return true; 
    444440 
    445441                                } 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/TemplatesControlGroup.java

     
    2020import org.sophie2.core.mvc.events.EventR3; 
    2121import org.sophie2.core.prolib.impl.AutoProperty; 
    2222import org.sophie2.core.prolib.interfaces.Prop; 
     23import org.sophie2.main.app.halos.actions.LockAction; 
     24import org.sophie2.main.app.halos.actions.LockTemplateAction; 
     25import org.sophie2.main.app.halos.actions.UseTemplateAction; 
    2326 
    2427/** 
    2528 * A {@link ControlButtonGroup} that manipulates states of templated keys. 
     
    210213                                TemplatesControlGroup templateGroup = findParentElement(source, TemplatesControlGroup.class); 
    211214                                final ImmList<TemplatedKey<?>> keys = templateGroup.keys().get(); 
    212215                         
    213                                 new AutoAction(Message.create(USE_TEMPLATE), true){ 
    214                                          
    215                                         @Override 
    216                                         public void performAuto() { 
    217                                                 for(TemplatedKey<?> key : keys) { 
    218                                                         getChanger().setRaw(key, null); 
    219                                                         getChanger().setRaw(key.getLockKey(), false); 
    220                                                 } 
    221                                         } 
     216                                new UseTemplateAction(Message.create(USE_TEMPLATE), true, keys).register(access); 
    222217                                 
    223                                 }.register(access); 
    224                                  
    225218                                return true; 
    226219                        } 
    227220                         
     
    256249                                 
    257250                                final ImmList<Object> finalValues = accumultaingValues; 
    258251                                 
    259                                 new AutoAction(Message.create(LOCK), true){ 
    260                                          
    261                                         @SuppressWarnings("unchecked") 
    262                                         @Override 
    263                                         public void performAuto() { 
    264                                                 for ( int keyIndex = 0; keyIndex<keys.size(); keyIndex++ ) { 
    265                                                         TemplatedKey key = keys.get(keyIndex); 
    266                                                         Object value = finalValues.get(keyIndex); 
    267                                                         getChanger().setRaw(key, value); 
    268                                                         getChanger().setRaw(key.getLockKey(), true); 
    269                                                 } 
    270                                         } 
     252                                new LockAction(Message.create(LOCK), true, finalValues, keys).register(access); 
    271253                                 
    272                                 }.register(access); 
    273                                  
    274254                                return true; 
    275255                        } 
    276256                         
     
    304284                                } 
    305285                                 
    306286                                final ImmList<Object> finalValues = accumultaingValues; 
     287                                new LockTemplateAction(Message.create(LOCK), true, 
     288                                                finalValues, keys).register(access); 
    307289                                 
    308                                 new AutoAction(Message.create(LOCK), true){ 
    309                                          
    310                                         @SuppressWarnings("unchecked") 
    311                                         @Override 
    312                                         public void performAuto() { 
    313                                                 for ( int keyIndex = 0; keyIndex < keys.size(); keyIndex++ ) { 
    314                                                         TemplatedKey key = keys.get(keyIndex); 
    315                                                         Object value = finalValues.get(keyIndex); 
    316                                                         getChanger().setRaw(key, value); 
    317                                                         getChanger().setRaw(key.getLockKey(), false); 
    318                                                 } 
    319                                         } 
    320                                  
    321                                 }.register(access); 
    322                                  
    323290                                return true; 
    324291                        } 
    325292                         
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetBgGradientAndTypeAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmGradient; 
     4import org.sophie2.base.model.book.BackgroundType; 
     5import org.sophie2.base.model.book.interfaces.StyledElement; 
     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/** 
     12 * An {@link AutoAction} for setting bg gradient and type. 
     13 *  
     14 * @author pap 
     15 * 
     16 */ 
     17public final class SetBgGradientAndTypeAction extends AutoAction { 
     18 
     19        private final ImmGradient input; 
     20         
     21        /** 
     22         * Creates a new instance of {@link SetBgGradientAndTypeAction}. 
     23         *  
     24         * @param description 
     25         *                      The message describing the action. 
     26         * @param significant 
     27         *                      The significance of the action. 
     28         * @param input 
     29         *                      The new {@link ImmGradient} of the source. 
     30         */ 
     31        public SetBgGradientAndTypeAction(Message description, boolean significant, ImmGradient input) { 
     32                super(description, significant); 
     33                this.input = input; 
     34        } 
     35 
     36        @Override 
     37        public void performAuto() { 
     38                ResourceChanger changer = getChanger(); 
     39                changer.setRaw(StyledElement.KEY_BACKGROUND__GRADIENT, 
     40                                this.input); 
     41                changer.setRaw(StyledElement.KEY_BACKGROUND__TYPE, 
     42                                BackgroundType.GRADIENT); 
     43                 
     44        } 
     45 
     46} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/LockTemplateAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmList; 
     4import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     5import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 
     6import org.sophie2.base.skins.Message; 
     7 
     8 
     9/** 
     10 * An {@link AutoAction} for locking the keys of the template. 
     11 *  
     12 * @author pap 
     13 * 
     14 */ 
     15public final class LockTemplateAction extends AutoAction { 
     16 
     17        private final ImmList<TemplatedKey<?>> keys; 
     18        private final ImmList<Object> finalValues; 
     19         
     20        /** 
     21         * Creates a new instance of {@link LockTemplateAction}. 
     22         *  
     23         * @param description 
     24         *                      The message describing the action. 
     25         * @param significant 
     26         *                      The significance of the action. 
     27         * @param finalValues 
     28         *           The values of the keys to be locked in the template. 
     29         * @param keys 
     30         *           The keys to be locked. 
     31         */ 
     32        public LockTemplateAction(Message description, boolean significant, 
     33                        ImmList<Object> finalValues, ImmList<TemplatedKey<?>> keys) { 
     34                super(description, significant); 
     35                this.keys = keys; 
     36                this.finalValues = finalValues; 
     37        } 
     38 
     39        @SuppressWarnings("unchecked") 
     40        @Override 
     41        public void performAuto() { 
     42                for ( int keyIndex = 0; keyIndex < this.keys.size(); keyIndex++ ) { 
     43                        TemplatedKey key = this.keys.get(keyIndex); 
     44                        Object value = this.finalValues.get(keyIndex); 
     45                        getChanger().setRaw(key, value); 
     46                        getChanger().setRaw(key.getLockKey(), false); 
     47                } 
     48                 
     49        } 
     50 
     51} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/frame/FrameHalosLogic.java

     
    3131import org.sophie2.main.app.commons.element.ElementView; 
    3232import org.sophie2.main.app.commons.frame.FrameView; 
    3333import org.sophie2.main.app.commons.util.AppViewUtil; 
     34import org.sophie2.main.app.halos.actions.ChangeFrameZOrderAction; 
     35import org.sophie2.main.app.halos.actions.SetFrameContentTemplAction; 
    3436import org.sophie2.main.app.halos.common.AppHaloUtil; 
    3537import org.sophie2.main.dialogs.input.ConfirmDialogInput; 
    3638import org.sophie2.main.dialogs.input.DialogUtils; 
     
    5860                        ResourceAccess access = AppHaloUtil.getSingleFrameView(source).model().get().getAccess(); 
    5961                        Boolean state = ResourceFrame.KEY_MAIN_RESOURCE.getMode(access) == Mode.USE_TEMPLATE; 
    6062                        if (!state) { 
    61                                 new AutoAction(Message.create(SET_FRAME_CONTENT_TEMPLATING), true) { 
    62                                         @Override 
    63                                         public void performAuto() {      
    64                                                 getChanger().setRaw(ResourceFrame.KEY_MAIN_RESOURCE, null); 
    65                                         } 
    66                                 }.register(access); 
     63                                new SetFrameContentTemplAction(Message.create(SET_FRAME_CONTENT_TEMPLATING), 
     64                                                true).register(access); 
    6765                        } 
    6866 
    6967                        return true; 
     
    254252                final ImmList<ActivationChannel> newChannels =  
    255253                        channels.remove(index).add(newIndex, channel); 
    256254 
    257                 new AutoAction(Message.create(CHANGE_FRAME_Z_ORDER), true) { 
    258  
    259                         @Override 
    260                         public void performAuto() { 
    261                                 getChanger().setRaw(CompositeElement.KEY_SUB_ELEMENTS, 
    262                                                 newChannels);    
    263                         } 
    264  
    265                 }.register(parentAccess); 
     255                new ChangeFrameZOrderAction(Message.create(CHANGE_FRAME_Z_ORDER), true, 
     256                                newChannels).register(parentAccess); 
    266257        } 
    267258} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/ChangeBgImageAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmPattern.PatternOptions; 
     4import org.sophie2.base.model.book.BackgroundType; 
     5import org.sophie2.base.model.book.interfaces.StyledElement; 
     6import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     7import org.sophie2.base.skins.Message; 
     8 
     9 
     10/** 
     11 * An {@link AutoAction} for changing the background image x offset. 
     12 *  
     13 * @author stefan 
     14 * 
     15 */ 
     16public final class ChangeBgImageAction extends AutoAction { 
     17 
     18        private final PatternOptions newOptions; 
     19         
     20        /** 
     21         * Creates an instance of {@link ChangeBgImageAction}. 
     22         *  
     23         * @param description 
     24         *             The description of the AutoAction. 
     25         * @param significant 
     26         *                              The significance of the AutoAction. 
     27         * @param newOptions 
     28         *                              The new {@link PatternOptions} of the source. 
     29         */ 
     30        public ChangeBgImageAction(Message description, boolean significant, PatternOptions newOptions) { 
     31                super(description, significant); 
     32                this.newOptions = newOptions; 
     33        } 
     34 
     35        @Override 
     36        public void performAuto() { 
     37                getChanger().setRaw(StyledElement.KEY_BACKGROUND__TYPE, 
     38                                BackgroundType.IMAGE); 
     39                getChanger().setRaw(StyledElement.KEY_BACKGROUND__PATTERN_OPTIONS, this.newOptions); 
     40                 
     41        } 
     42 
     43} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/frame/MainTitleBarHalo.java

     
    2929import org.sophie2.base.model.resources.r4.ResourceRefR4; 
    3030import org.sophie2.base.model.resources.r4.access.ResourceAccess; 
    3131import org.sophie2.base.model.resources.r4.changes.AutoAction; 
    32 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 
    3332import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 
    3433import org.sophie2.base.scene.SceneVisual; 
    3534import org.sophie2.base.scene.helpers.SceneHelper; 
     
    5150import org.sophie2.main.app.commons.element.GroupView; 
    5251import org.sophie2.main.app.commons.frame.FrameView; 
    5352import org.sophie2.main.app.commons.page.PageWorkArea; 
     53import org.sophie2.main.app.halos.actions.SetLocationAction; 
    5454import org.sophie2.main.app.halos.common.AppHaloUtil; 
    5555import org.sophie2.main.app.halos.shared.MainHaloMenu; 
    5656 
     
    329329                                                MemberElement.KEY_LOCATION.get(frameAccess); 
    330330                                        final TimePos time = times.get(i); 
    331331 
    332                                         new AutoAction(Message.create(SET_LOCATION), false) { 
    333                                                 @Override 
    334                                                 public void performAuto() { 
    335                                                         ResourceChanger subChanger = getChanger().getSub(frameRef); 
    336  
    337                                                         subChanger.setRaw(MemberElement.KEY_LOCATION, oldChanel 
    338                                                                         .setValue(time, newValue)); 
    339                                                 } 
    340                                         }.register(pageAccess); 
     332                                        new SetLocationAction(Message.create(SET_LOCATION), false, 
     333                                                        newValue, frameRef, oldChanel, time).register(pageAccess); 
    341334                                } 
    342335                        } 
    343336 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/ChangeFrameZOrderAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.commons.util.ImmList; 
     4import org.sophie2.base.model.book.interfaces.CompositeElement; 
     5import org.sophie2.base.model.book.timelines.ActivationChannel; 
     6import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     7import org.sophie2.base.skins.Message; 
     8 
     9 
     10/** 
     11 * An {@link AutoAction} for changing the frame z order. 
     12 *  
     13 * @author jani 
     14 * 
     15 */ 
     16public final class ChangeFrameZOrderAction extends AutoAction { 
     17 
     18        private final ImmList<ActivationChannel> newChannels; 
     19         
     20        /** 
     21         * Creates an instance of {@link ChangeFrameZOrderAction}. 
     22         *  
     23         * @param description 
     24         *             The description of the AutoAction. 
     25         * @param significant 
     26         *                              The significance of the AutoAction. 
     27         * @param newChannels 
     28         *              The new channels of the frames. 
     29         */ 
     30        public ChangeFrameZOrderAction(Message description, boolean significant, 
     31                 ImmList<ActivationChannel> newChannels) { 
     32                super(description, significant); 
     33                this.newChannels = newChannels; 
     34        } 
     35 
     36        @Override 
     37        public void performAuto() { 
     38                getChanger().setRaw(CompositeElement.KEY_SUB_ELEMENTS, 
     39                                this.newChannels);               
     40        } 
     41 
     42} 
  • modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetShadowEnabledAction.java

     
     1package org.sophie2.main.app.halos.actions; 
     2 
     3import org.sophie2.base.model.book.frame.FrameR4; 
     4import org.sophie2.base.model.resources.r4.changes.AutoAction; 
     5import org.sophie2.base.skins.Message; 
     6 
     7 
     8/** 
     9 * An {@link AutoAction} for enable/disable the shadow. 
     10 *  
     11 * @author peko 
     12 * 
     13 */ 
     14public final class SetShadowEnabledAction extends AutoAction { 
     15 
     16        private final Boolean input; 
     17         
     18        /** 
     19         * Creates an instance of {@link SetShadowEnabledAction}. 
     20         *  
     21         * @param description 
     22         *             The description of the AutoAction. 
     23         * @param significant 
     24         *                              The significance of the AutoAction. 
     25         * @param input 
     26         *                              True if the shadow will be enabled, false otherwise. 
     27         */ 
     28        public SetShadowEnabledAction(Message description, boolean significant, Boolean input) { 
     29                super(description, significant); 
     30                this.input = input; 
     31        } 
     32 
     33        @Override 
     34        public void performAuto() { 
     35                getChanger().setRaw(FrameR4.KEY_SHADOW__ENABLED, this.input); 
     36        } 
     37 
     38}