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
6 6 import org.sophie2.base.model.book.interfaces.StyledElement; 7 7 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 8 8 import org.sophie2.base.model.resources.r4.changes.AutoAction; 9 import org.sophie2.base.model.resources.r4.changes.ResourceChanger;10 9 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 11 10 import org.sophie2.base.skins.Message; 12 11 import org.sophie2.base.visual.BaseVisualElement; … … 17 16 import org.sophie2.core.mvc.EventFilterBuilder; 18 17 import org.sophie2.core.mvc.OperationDef; 19 18 import org.sophie2.core.mvc.events.EventR3; 19 import org.sophie2.main.app.halos.actions.SetBgColorAndTypeAction; 20 20 import org.sophie2.main.app.halos.huds.appearance.AppearanceHud.BackgroundPanel; 21 21 import org.sophie2.main.app.halos.huds.color.ColorPickerHudField; 22 22 … … 96 96 97 97 assert input != null; 98 98 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); 109 102 return true; 110 103 } 111 104 -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/UseTemplateAction.java
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmList; 4 import org.sophie2.base.model.resources.r4.changes.AutoAction; 5 import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 6 import org.sophie2.base.skins.Message; 7 8 9 /** 10 * An {@link AutoAction} for using template. 11 * 12 * @author pap 13 * 14 */ 15 public 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
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmColor; 4 import org.sophie2.base.model.book.interfaces.StyledElement; 5 import org.sophie2.base.model.resources.r4.changes.AutoAction; 6 import org.sophie2.base.skins.Message; 7 8 9 /** 10 * An {@link AutoAction} for changing the border color. 11 * 12 * @author peko 13 * 14 */ 15 public 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
1 package org.sophie2.dev.author; 2 3 import java.util.Arrays; 4 import java.util.List; 5 6 import javax.swing.SwingUtilities; 7 8 import org.junit.Before; 9 import org.junit.Test; 10 import org.sophie2.base.bound.BoundModule; 11 import org.sophie2.base.commons.BaseCommonsModule; 12 import org.sophie2.base.dialogs.BaseDialogsModule; 13 import org.sophie2.base.dialogs.TestingDialogManager; 14 import org.sophie2.base.halos.HaloButton; 15 import org.sophie2.base.model.resources.r4.ResourceRefR4; 16 import org.sophie2.base.model.resources.r4.changes.AutoAction; 17 import org.sophie2.base.model.text.BaseModelTextModule; 18 import org.sophie2.base.model.text.model.ImmHotText; 19 import org.sophie2.base.model.text.model.ImmText; 20 import org.sophie2.base.skins.Message; 21 import org.sophie2.core.modularity.SophieModule; 22 import org.sophie2.core.mvc.LogicR3; 23 import org.sophie2.core.mvc.events.EventR3; 24 import org.sophie2.dev.testing.SystemTestBase; 25 import org.sophie2.main.app.commons.book.BaseBookView; 26 import org.sophie2.main.app.commons.page.RootPageView; 27 import org.sophie2.main.app.halos.MainAppHalosModule; 28 import org.sophie2.main.app.halos.frame.FrameRemoveHaloButton; 29 import org.sophie2.main.app.halos.shared.MainHaloMenu; 30 import org.sophie2.main.app.layout.MainAppLayoutModule; 31 import org.sophie2.main.app.menus.MainAppMenusModule; 32 import org.sophie2.main.app.model.MainAppModelModule; 33 import org.sophie2.main.dialogs.input.ConfirmDialogInput; 34 import org.sophie2.main.func.resources.MainFuncResourcesModule; 35 import org.sophie2.main.func.text.TextFuncModule; 36 import org.sophie2.main.func.text.chaining.ChainingMode; 37 import org.sophie2.main.func.text.model.HeadTextFrameH; 38 import org.sophie2.main.func.text.utils.TextChainUtils; 39 import org.sophie2.main.func.text.view.HeadTextFrameView; 40 import org.sophie2.main.func.text.view.TextFrameView; 41 42 /** 43 * Tests the deleting of auto chained frames. 44 * 45 * @author diana 46 * 47 */ 48 public 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
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.position.ImmInsets; 4 import org.sophie2.base.model.resources.r4.changes.AutoAction; 5 import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 6 import 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 */ 15 public 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
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.model.book.frame.FrameR4; 4 import org.sophie2.base.model.resources.r4.changes.AutoAction; 5 import 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 */ 14 public 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
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmList; 4 import org.sophie2.base.model.resources.r4.changes.AutoAction; 5 import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 6 import org.sophie2.base.skins.Message; 7 8 /** 9 * An {@link AutoAction} for locking the keys of the template. 10 * 11 * @author pap 12 * 13 */ 14 public 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
103 103 newStyles = unitAt(styleIndex).getStyle(); 104 104 } 105 105 if (! interval.isEmpty() && interval.getBegin() != getEnd()) { 106 newStyles = newStyles. replaceDerive(this.unitAt(interval.getBegin()).getStyle());106 newStyles = newStyles.derive(this.unitAt(interval.getBegin()).getStyle()); 107 107 } 108 108 // XXX I do not agree we should bypass invalid intervals --kyli 109 109 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
70 70 import org.sophie2.main.app.commons.frame.FrameView; 71 71 import org.sophie2.main.app.commons.page.PageWorkArea; 72 72 import org.sophie2.main.app.commons.page.RootPageView; 73 import org.sophie2.main.app.halos.actions.ChangeBgOpacityAction; 74 import org.sophie2.main.app.halos.actions.ChangeBorderColorAction; 75 import org.sophie2.main.app.halos.actions.ChangeFrameVisibilityAction; 76 import org.sophie2.main.app.halos.actions.SetBgTypeAction; 77 import org.sophie2.main.app.halos.actions.SetBorderInsetsAction; 73 78 import org.sophie2.main.app.halos.actions.SetInsetsAction; 79 import org.sophie2.main.app.halos.actions.SetShadowEnabledAction; 80 import org.sophie2.main.app.halos.actions.SetShadowOffsetAction; 81 import org.sophie2.main.app.halos.actions.SetWrapModeAction; 74 82 import org.sophie2.main.app.halos.common.AppHaloUtil; 75 83 import org.sophie2.main.app.halos.huds.ElementHud; 76 84 import org.sophie2.main.app.halos.huds.TemplatesControlGroup; … … 793 801 if (access == null) { 794 802 return false; 795 803 } 804 805 new ChangeBgOpacityAction(Message.create(BG_OPACITY), true, input).register(access); 796 806 797 new AutoAction(Message.create(BG_OPACITY), true) {798 @Override799 public void performAuto() {800 getChanger().setRaw(StyledElement.KEY_BACKGROUND__OPACITY,801 input.floatValue() / 100);802 }803 }.register(access);804 807 return true; 805 808 } 806 809 … … 859 862 final ImmColor input = event.getEventParam( 860 863 ColorPickerHudField.EventIds.COLOR_PARAM_INDEX, ImmColor.class); 861 864 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); 868 868 return true; 869 869 } 870 870 … … 889 889 final Boolean input = event 890 890 .getEventParam(EventIds.INPUT_PARAM_INDEX, Boolean.class); 891 891 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); 898 895 899 896 return true; 900 897 } … … 921 918 String inputData = event.getEventParam(EventIds.INPUT_PARAM_INDEX, String.class); 922 919 final Float input = BoundValidation.parseNumber(inputData, Float.class); 923 920 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); 931 924 932 925 return true; 933 926 } … … 951 944 ComboInput<BackgroundType> input = event.getEventParam( 952 945 BoundControl.EventIds.INPUT_PARAM_INDEX, ComboInput.class); 953 946 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); 960 950 return true; 961 951 } 962 952 … … 987 977 final VisibleChannel channel = ElementR4.KEY_VISIBLE.get(access); 988 978 final TimePos time = fv.getTime(); 989 979 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); 996 983 return true; 997 984 } 998 985 }, … … 1012 999 ResourceAccess access = getAccess(source); 1013 1000 final Boolean input = event.getEventParam(BoundControl.EventIds.INPUT_PARAM_INDEX, 1014 1001 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); 1021 1005 return true; 1022 1006 } 1023 1007 }, … … 1041 1025 final WrappingModes input = comboInput.getSelectedItem(); 1042 1026 1043 1027 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); 1050 1031 } 1051 1032 1052 1033 return true; … … 1092 1073 */ 1093 1074 protected static void setBorderInsets(final ImmInsets insets, Message eventDescription, 1094 1075 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); 1101 1078 } 1102 1079 1103 1080 /** -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetPageSizeAction.java
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.position.ImmSize; 4 import org.sophie2.base.model.book.resource.r4.BookR4; 5 import org.sophie2.base.model.resources.r4.changes.AutoAction; 6 import org.sophie2.base.skins.Message; 7 8 /** 9 * An {@link AutoAction} for setting the page size. 10 * 11 * @author pap 12 * 13 */ 14 public 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
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmList; 4 import org.sophie2.base.model.book.ElementGroupH; 5 import org.sophie2.base.model.book.timelines.ActivationChannel; 6 import org.sophie2.base.model.resources.r4.ResourceRefR4; 7 import org.sophie2.base.model.resources.r4.changes.AutoAction; 8 import org.sophie2.base.skins.Message; 9 10 11 /** 12 * An {@link AutoAction} for deleting groups. 13 * 14 * @author mitex 15 * 16 */ 17 public 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
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmColor; 4 import org.sophie2.base.model.book.frame.FrameR4; 5 import org.sophie2.base.model.resources.r4.changes.AutoAction; 6 import org.sophie2.base.skins.Message; 7 8 9 /** 10 * An {@link AutoAction} for setting the bg color. 11 * 12 * @author stefan 13 * 14 */ 15 public 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
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmColor; 4 import org.sophie2.base.model.book.frame.FrameR4; 5 import org.sophie2.base.model.resources.r4.changes.AutoAction; 6 import 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 */ 15 public 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
43 43 import org.sophie2.core.prolib.list.ProList; 44 44 import org.sophie2.main.app.commons.element.ElementView; 45 45 import org.sophie2.main.app.commons.util.AppViewUtil; 46 import org.sophie2.main.app.halos.actions.ChangeBgImageAction; 46 47 import org.sophie2.main.app.halos.huds.ElementHud; 47 48 import org.sophie2.main.func.resources.view.ResourceChooser; 48 49 … … 293 294 294 295 final PatternOptions newOptions = oldOptions.modifyOffset(newOffset); 295 296 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()); 303 300 304 301 return true; 305 302 } … … 329 326 330 327 final PatternOptions newOptions = oldOptions.modifyOffset(newOffset); 331 328 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()); 339 332 340 333 return true; 341 334 } … … 362 355 363 356 final PatternOptions newOptions = oldOptions.modifyScale(newSize); 364 357 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 372 362 return true; 373 363 } 374 364 }, … … 392 382 PatternOptions oldOptions = AppearanceHud.getStyleHelper(hud).getBackgroundPattern().getOptions(); 393 383 394 384 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()); 402 388 return true; 403 389 } 404 390 -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/appearance/BackgroundGradientField.java
9 9 import org.sophie2.base.model.book.interfaces.StyledElement; 10 10 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 11 11 import org.sophie2.base.model.resources.r4.changes.AutoAction; 12 import org.sophie2.base.model.resources.r4.changes.ResourceChanger;13 12 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 14 13 import org.sophie2.base.skins.Message; 15 14 import org.sophie2.base.visual.BaseVisualElement; … … 20 19 import org.sophie2.core.mvc.EventFilterBuilder; 21 20 import org.sophie2.core.mvc.OperationDef; 22 21 import org.sophie2.core.mvc.events.EventR3; 22 import org.sophie2.main.app.halos.actions.SetBgGradientAndTypeAction; 23 23 import org.sophie2.main.app.halos.huds.appearance.AppearanceHud.BackgroundPanel; 24 24 import org.sophie2.main.app.halos.huds.gradient.GradientHudButton; 25 25 … … 81 81 source, AppearanceHud.class); 82 82 final ResourceAccess access = hud.access().get(); 83 83 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); 94 87 return true; 95 88 } 96 89 -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetBgTypeAction.java
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.model.book.BackgroundType; 4 import org.sophie2.base.model.book.interfaces.StyledElement; 5 import org.sophie2.base.model.resources.r4.changes.AutoAction; 6 import org.sophie2.base.skins.Message; 7 8 9 /** 10 * An {@link AutoAction} for setting the background type. 11 * 12 * @author peko 13 * 14 */ 15 public 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
150 150 151 151 @Override 152 152 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; 154 158 } 155 159 } -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/DeleteGroupResourceAction.java
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmList; 4 import org.sophie2.base.model.book.interfaces.CompositeElement; 5 import org.sophie2.base.model.book.timelines.ActivationChannel; 6 import org.sophie2.base.model.resources.r4.ResourceRefR4; 7 import org.sophie2.base.model.resources.r4.changes.AutoAction; 8 import org.sophie2.base.skins.Message; 9 10 11 /** 12 * An {@link AutoAction} for deleting groups. 13 * 14 * @author mitex 15 * 16 */ 17 public 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
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmColor; 4 import org.sophie2.base.model.book.BackgroundType; 5 import org.sophie2.base.model.book.interfaces.StyledElement; 6 import org.sophie2.base.model.resources.r4.changes.AutoAction; 7 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 8 import 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 */ 17 public 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
4 4 import org.sophie2.base.dialogs.DialogManager; 5 5 import org.sophie2.base.halos.ClickHaloButton; 6 6 import org.sophie2.base.halos.HaloButton; 7 import org.sophie2.base.model.book.interfaces.StyledElement;8 7 import org.sophie2.base.model.resources.r4.changes.AutoAction; 9 8 import org.sophie2.base.skins.Message; 10 9 import org.sophie2.core.logging.SophieLog; … … 12 11 import org.sophie2.core.mvc.OperationDef; 13 12 import org.sophie2.core.mvc.events.EventR3; 14 13 import org.sophie2.main.app.commons.frame.FrameView; 14 import org.sophie2.main.app.halos.actions.ChangeFrameBorderColorAction; 15 15 import org.sophie2.main.dialogs.input.ColorDialogInput; 16 16 17 17 //TODO This class should be a HudHaloButton. … … 50 50 final ImmColor bg = DialogManager.get().showDialog(new ColorDialogInput( 51 51 halo.swingComponent().get(), DIALOG_TITLE, INITIAL_COLOR)); 52 52 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()); 61 55 62 56 SophieLog.debug("Border color changed for" + currentView); 63 57 } -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/GroupElementsAction.java
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmList; 4 import org.sophie2.base.model.book.ElementGroupH; 5 import org.sophie2.base.model.book.timelines.ActivationChannel; 6 import org.sophie2.base.model.resources.r4.ResourceRefList; 7 import org.sophie2.base.model.resources.r4.ResourceRefR4; 8 import org.sophie2.base.model.resources.r4.changes.AutoAction; 9 import org.sophie2.base.skins.Message; 10 11 12 /** 13 * An {@link AutoAction} for grouping elements. 14 * 15 * @author mitex 16 * 17 */ 18 public 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 1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmList; 4 import org.sophie2.base.commons.util.position.ImmPoint; 5 import org.sophie2.base.media.TimePos; 6 import org.sophie2.base.model.book.interfaces.MemberElement; 7 import org.sophie2.base.model.book.timelines.LocationChannel; 8 import org.sophie2.base.model.resources.r4.ResourceRefList; 9 import org.sophie2.base.model.resources.r4.ResourceRefR4; 10 import org.sophie2.base.model.resources.r4.changes.AutoAction; 11 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 12 import org.sophie2.base.skins.Message; 13 14 /** 15 * An AutoAction for alignment of elements. 16 * 17 * @author diana 18 * 19 */ 20 public 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
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.model.book.interfaces.StyledElement; 4 import org.sophie2.base.model.resources.r4.changes.AutoAction; 5 import org.sophie2.base.skins.Message; 6 7 8 /** 9 * An {@link AutoAction} for changing the background opacity. 10 * 11 * @author peko 12 * 13 */ 14 public 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
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.model.book.interfaces.ResourceFrame; 4 import org.sophie2.base.model.resources.r4.changes.AutoAction; 5 import org.sophie2.base.skins.Message; 6 7 8 /** 9 * An {@link AutoAction} for setting the frame content templating. 10 * 11 * @author jani 12 * 13 */ 14 public 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
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.position.ImmPoint; 4 import org.sophie2.base.media.TimePos; 5 import org.sophie2.base.model.book.interfaces.MemberElement; 6 import org.sophie2.base.model.book.timelines.LocationChannel; 7 import org.sophie2.base.model.resources.r4.ResourceRefR4; 8 import org.sophie2.base.model.resources.r4.changes.AutoAction; 9 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 10 import org.sophie2.base.skins.Message; 11 import 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 */ 20 public 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
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.model.book.frame.FrameR4; 4 import org.sophie2.base.model.book.frame.WrappingModes; 5 import org.sophie2.base.model.resources.r4.changes.AutoAction; 6 import org.sophie2.base.skins.Message; 7 8 9 /** 10 * An {@link AutoAction} for setting the wrap mode. 11 * 12 * @author peko 13 * 14 */ 15 public 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
34 34 import org.sophie2.core.prolib.impl.AutoProperty; 35 35 import org.sophie2.core.prolib.interfaces.Prop; 36 36 import org.sophie2.main.app.commons.frame.FrameView; 37 import org.sophie2.main.app.halos.actions.SetShadowColorAction; 38 import org.sophie2.main.app.halos.actions.SetShadowOffsetAction; 39 import org.sophie2.main.app.halos.actions.SetShadowOpacityAction; 37 40 import org.sophie2.main.app.halos.common.AppHaloUtil; 38 41 import org.sophie2.main.app.halos.huds.TemplatesControlGroup; 39 42 import org.sophie2.main.app.halos.huds.color.ColorPickerHudField; … … 333 336 334 337 System.out.println("point = " + point); 335 338 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); 342 342 return true; 343 343 } 344 344 }, … … 361 361 Float x = FrameR4.KEY_SHADOW__POSITION.get(access).getX(); 362 362 Float y = BoundValidation.parseNumber(input, Float.class); 363 363 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); 370 367 return true; 371 368 } 372 369 }, … … 388 385 } 389 386 final ImmColor input = event.getEventParam( 390 387 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); 397 392 return true; 398 393 } 399 394 }, … … 422 417 return false; 423 418 } 424 419 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); 432 423 return true; 433 424 } 434 425 }; -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/ChangeFrameVisibilityAction.java
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.media.TimePos; 4 import org.sophie2.base.model.book.resource.r4.ElementR4; 5 import org.sophie2.base.model.book.timelines.VisibleChannel; 6 import org.sophie2.base.model.resources.r4.changes.AutoAction; 7 import org.sophie2.base.skins.Message; 8 9 10 /** 11 * An {@link AutoAction} for changing the visibility. 12 * 13 * @author peko 14 * 15 */ 16 public 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
33 33 import org.sophie2.main.app.commons.page.PageWorkArea; 34 34 import org.sophie2.main.app.commons.page.PwaSelector; 35 35 import org.sophie2.main.app.commons.util.AppViewUtil; 36 import org.sophie2.main.app.halos.actions.DeleteGroupAction; 37 import org.sophie2.main.app.halos.actions.DeleteGroupResourceAction; 38 import org.sophie2.main.app.halos.actions.GroupElementsAction; 36 39 import org.sophie2.main.app.halos.common.AppHaloUtil; 37 40 import org.sophie2.main.dialogs.input.DialogUtils; 38 41 … … 138 141 CompositeElement.KEY_SUB_ELEMENTS.get(access); 139 142 final String groupTitle = ResourceUtil.getNextTitle( 140 143 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); 148 146 149 147 // select the new group 150 148 ResourceRefR4 parentRef = parentView.getAccess().getRef(); … … 195 193 final ImmList<ActivationChannel> channels = 196 194 CompositeElement.KEY_SUB_ELEMENTS.get(parentAccess); 197 195 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); 204 198 205 199 return true; 206 200 } … … 244 238 ActivationChannel frameChan = parentH.getActivationChannel(relativeGroupRef); 245 239 246 240 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); 254 243 255 244 return true; 256 245 } -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetShadowOffsetAction.java
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.position.ImmPoint; 4 import org.sophie2.base.model.book.frame.FrameR4; 5 import org.sophie2.base.model.resources.r4.changes.AutoAction; 6 import org.sophie2.base.skins.Message; 7 8 9 /** 10 * An {@link AutoAction} for setting the shadow position. 11 * 12 * @author peko 13 * 14 */ 15 public 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
10 10 import org.sophie2.base.commons.util.position.ImmSize; 11 11 import org.sophie2.base.commons.util.position.ImmVector; 12 12 import org.sophie2.base.halos.MoveHaloButton; 13 import org.sophie2.base.model.book.AutoActionsUtil; 13 14 import org.sophie2.base.model.book.BookH; 14 import org.sophie2.base.model.book.resource.r4.BookR4;15 15 import org.sophie2.base.model.book.resource.r4.PageR4; 16 16 import org.sophie2.base.model.resources.r4.changes.AutoAction; 17 17 import org.sophie2.base.scene.SceneVisual; … … 24 24 import org.sophie2.base.visual.skins.VisualElementDef; 25 25 import org.sophie2.core.prolib.interfaces.Prop; 26 26 import org.sophie2.main.app.commons.page.PageWorkArea; 27 import org.sophie2.main.app.halos.actions.SetPageSizeAction; 27 28 import org.sophie2.main.app.halos.common.AppHaloUtil; 28 29 29 30 /** … … 88 89 sv.wantedViewRect().set(null); 89 90 90 91 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()); 98 96 } 99 97 100 98 @Override … … 121 119 } 122 120 123 121 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()); 130 125 } 131 126 132 127 }; -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/ChangeFrameBorderColorAction.java
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmColor; 4 import org.sophie2.base.model.book.interfaces.StyledElement; 5 import org.sophie2.base.model.resources.r4.changes.AutoAction; 6 import org.sophie2.base.skins.Message; 7 8 9 /** 10 * An {@link AutoAction} for changing the frame border color. 11 * 12 * @author peko 13 * 14 */ 15 public 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
14 14 import org.sophie2.base.halos.HudTitleBar; 15 15 import org.sophie2.base.model.book.FrameH; 16 16 import org.sophie2.base.model.book.StyledElementH; 17 import org.sophie2.base.model.book.frame.FrameR4;18 17 import org.sophie2.base.model.book.interfaces.StyledElement; 19 18 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 20 19 import org.sophie2.base.model.resources.r4.changes.AutoAction; … … 33 32 import org.sophie2.core.prolib.list.EmptyProList; 34 33 import org.sophie2.core.prolib.list.ProList; 35 34 import org.sophie2.main.app.commons.element.ElementView; 35 import org.sophie2.main.app.halos.actions.SetBorderColorAction; 36 36 import org.sophie2.main.app.halos.common.AppHaloUtil; 37 37 import org.sophie2.main.app.halos.huds.ElementHud; 38 38 … … 415 415 filter.setSourceClass(BorderOpacity.class); 416 416 } 417 417 418 @SuppressWarnings("static-access")419 418 public boolean handle(EventR3 event) { 420 419 VisualElement source = event.getSource(BorderOpacity.class); 421 420 Integer inputData = event.getEventParam(BoundControl.EventIds.INPUT_PARAM_INDEX, … … 434 433 borderColor.getBlueValue(), 435 434 alpha); 436 435 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); 443 439 return true; 444 440 445 441 } -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/TemplatesControlGroup.java
20 20 import org.sophie2.core.mvc.events.EventR3; 21 21 import org.sophie2.core.prolib.impl.AutoProperty; 22 22 import org.sophie2.core.prolib.interfaces.Prop; 23 import org.sophie2.main.app.halos.actions.LockAction; 24 import org.sophie2.main.app.halos.actions.LockTemplateAction; 25 import org.sophie2.main.app.halos.actions.UseTemplateAction; 23 26 24 27 /** 25 28 * A {@link ControlButtonGroup} that manipulates states of templated keys. … … 210 213 TemplatesControlGroup templateGroup = findParentElement(source, TemplatesControlGroup.class); 211 214 final ImmList<TemplatedKey<?>> keys = templateGroup.keys().get(); 212 215 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); 222 217 223 }.register(access);224 225 218 return true; 226 219 } 227 220 … … 256 249 257 250 final ImmList<Object> finalValues = accumultaingValues; 258 251 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); 271 253 272 }.register(access);273 274 254 return true; 275 255 } 276 256 … … 304 284 } 305 285 306 286 final ImmList<Object> finalValues = accumultaingValues; 287 new LockTemplateAction(Message.create(LOCK), true, 288 finalValues, keys).register(access); 307 289 308 new AutoAction(Message.create(LOCK), true){309 310 @SuppressWarnings("unchecked")311 @Override312 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 323 290 return true; 324 291 } 325 292 -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/SetBgGradientAndTypeAction.java
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmGradient; 4 import org.sophie2.base.model.book.BackgroundType; 5 import org.sophie2.base.model.book.interfaces.StyledElement; 6 import org.sophie2.base.model.resources.r4.changes.AutoAction; 7 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 8 import org.sophie2.base.skins.Message; 9 10 11 /** 12 * An {@link AutoAction} for setting bg gradient and type. 13 * 14 * @author pap 15 * 16 */ 17 public 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
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmList; 4 import org.sophie2.base.model.resources.r4.changes.AutoAction; 5 import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 6 import 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 */ 15 public 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
31 31 import org.sophie2.main.app.commons.element.ElementView; 32 32 import org.sophie2.main.app.commons.frame.FrameView; 33 33 import org.sophie2.main.app.commons.util.AppViewUtil; 34 import org.sophie2.main.app.halos.actions.ChangeFrameZOrderAction; 35 import org.sophie2.main.app.halos.actions.SetFrameContentTemplAction; 34 36 import org.sophie2.main.app.halos.common.AppHaloUtil; 35 37 import org.sophie2.main.dialogs.input.ConfirmDialogInput; 36 38 import org.sophie2.main.dialogs.input.DialogUtils; … … 58 60 ResourceAccess access = AppHaloUtil.getSingleFrameView(source).model().get().getAccess(); 59 61 Boolean state = ResourceFrame.KEY_MAIN_RESOURCE.getMode(access) == Mode.USE_TEMPLATE; 60 62 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); 67 65 } 68 66 69 67 return true; … … 254 252 final ImmList<ActivationChannel> newChannels = 255 253 channels.remove(index).add(newIndex, channel); 256 254 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); 266 257 } 267 258 } -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/ChangeBgImageAction.java
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmPattern.PatternOptions; 4 import org.sophie2.base.model.book.BackgroundType; 5 import org.sophie2.base.model.book.interfaces.StyledElement; 6 import org.sophie2.base.model.resources.r4.changes.AutoAction; 7 import 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 */ 16 public 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
29 29 import org.sophie2.base.model.resources.r4.ResourceRefR4; 30 30 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 31 31 import org.sophie2.base.model.resources.r4.changes.AutoAction; 32 import org.sophie2.base.model.resources.r4.changes.ResourceChanger;33 32 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 34 33 import org.sophie2.base.scene.SceneVisual; 35 34 import org.sophie2.base.scene.helpers.SceneHelper; … … 51 50 import org.sophie2.main.app.commons.element.GroupView; 52 51 import org.sophie2.main.app.commons.frame.FrameView; 53 52 import org.sophie2.main.app.commons.page.PageWorkArea; 53 import org.sophie2.main.app.halos.actions.SetLocationAction; 54 54 import org.sophie2.main.app.halos.common.AppHaloUtil; 55 55 import org.sophie2.main.app.halos.shared.MainHaloMenu; 56 56 … … 329 329 MemberElement.KEY_LOCATION.get(frameAccess); 330 330 final TimePos time = times.get(i); 331 331 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); 341 334 } 342 335 } 343 336 -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/actions/ChangeFrameZOrderAction.java
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.commons.util.ImmList; 4 import org.sophie2.base.model.book.interfaces.CompositeElement; 5 import org.sophie2.base.model.book.timelines.ActivationChannel; 6 import org.sophie2.base.model.resources.r4.changes.AutoAction; 7 import org.sophie2.base.skins.Message; 8 9 10 /** 11 * An {@link AutoAction} for changing the frame z order. 12 * 13 * @author jani 14 * 15 */ 16 public 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
1 package org.sophie2.main.app.halos.actions; 2 3 import org.sophie2.base.model.book.frame.FrameR4; 4 import org.sophie2.base.model.resources.r4.changes.AutoAction; 5 import org.sophie2.base.skins.Message; 6 7 8 /** 9 * An {@link AutoAction} for enable/disable the shadow. 10 * 11 * @author peko 12 * 13 */ 14 public 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 }