Ticket #2402: auto-actions.3.patch
File auto-actions.3.patch, 323.7 KB (added by tanya, 15 years ago) |
---|
-
modules/org.sophie2.base.model.resources.r4/src/test/java/org/sophie2/base/model/resources/r4/dummies/helpers/DummyBookHelper.java
### Eclipse Workspace Patch 1.0 #P sophie
23 23 import org.sophie2.base.model.resources.r4.model.ResourceRevision; 24 24 import org.sophie2.base.model.resources.r4.resources.ResourceH; 25 25 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 26 import org.sophie2.base.skins.Message; 26 27 27 28 /** 28 29 * Dummy helper for the {@link DummyBook}. … … 32 33 public class DummyBookHelper extends ResourceH { 33 34 34 35 /** 36 * Constant created for creating new page. 37 * Constant created to be a parameter of a message of an {@link AutoAction}. 38 * Used for skinning. Used in the test. 39 */ 40 public static final String CREATE_NEW_PAGE = "Create new page"; 41 42 /** 35 43 * Constructs the helper with an access 36 44 * 37 45 * @param access … … 113 121 114 122 final ResourceRefList pages = book.get(DummyBook.KEY_PAGES); 115 123 116 new AutoAction( "Create new page", true) {124 new AutoAction(Message.create(CREATE_NEW_PAGE), true) { 117 125 @Override 118 126 public void performAuto() { 119 127 DummyBookHelper.addNewPage(getChanger(), pageRef, pages); -
modules/org.sophie2.main.func.media/src/main/java/org/sophie2/main/func/media/logic/MediaLogic.java
4 4 import org.sophie2.base.media.MediaState; 5 5 import org.sophie2.base.media.TimePos; 6 6 import org.sophie2.base.model.resources.r4.changes.AutoAction; 7 import org.sophie2.base.skins.Message; 7 8 import org.sophie2.base.visual.interaction.InputEventR3; 8 9 import org.sophie2.core.logging.SophieLog; 9 10 import org.sophie2.core.modularity.SortKey; … … 64 65 final TimePos viewTime = view.getTime(); 65 66 final TimePos endTime = view.model().get().getTimelineOptions().advance(viewTime, duration); 66 67 // Incorrect (see the previous line)- new TimePos(viewTime.getPhase(), viewTime.getMillis() + duration); 67 new AutoAction( "Play/Pause", true) {68 new AutoAction(Message.create(PLAY_PAUSE), true) { 68 69 @Override 69 70 public void performAuto() { 70 71 MediaStateChannel newChannel; … … 107 108 final MediaStateChannel oldChannel = view.model().get().get( 108 109 MediaFrameR4.KEY_STATE); 109 110 110 new AutoAction( "Stop", true) {111 new AutoAction(Message.create(STOP), true) { 111 112 112 113 @Override 113 114 public void performAuto() { … … 158 159 }; 159 160 160 161 /** 162 * Constant created for seek. 163 * Constant created to be a parameter of a message of an {@link AutoAction}. 164 * Used for skinning. 165 */ 166 public static final String SEEK = "Seek"; 167 168 /** 169 * Constant created for stop. 170 * Constant created to be a parameter of a message of an {@link AutoAction}. 171 * Used for skinning. 172 */ 173 public static final String STOP = "Stop"; 174 175 /** 176 * Constant created for play/pause. 177 * Constant created to be a parameter of a message of an {@link AutoAction}. 178 * Used for skinning. 179 */ 180 public static final String PLAY_PAUSE = "Play/Pause"; 181 182 /** 161 183 * Handles the events coming from the SeekMediaManipulationView. 162 184 * 163 185 * @param event … … 205 227 final MediaStateChannel oldChannel = view.model().get().get( 206 228 MediaFrameR4.KEY_STATE); 207 229 208 new AutoAction( "Seek", true) {230 new AutoAction(Message.create(SEEK), true) { 209 231 210 232 @Override 211 233 public void performAuto() { -
modules/org.sophie2.main.func.timelines/src/main/java/org/sophie2/main/func/timelines/links/PlayingActionLogic.java
5 5 import org.sophie2.base.model.book.links.LinkAction; 6 6 import org.sophie2.base.model.book.resource.r4.BookR4; 7 7 import org.sophie2.base.model.resources.r4.changes.AutoAction; 8 import org.sophie2.base.skins.Message; 8 9 import org.sophie2.core.mvc.EventFilterBuilder; 9 10 import org.sophie2.core.mvc.OperationDef; 10 11 import org.sophie2.core.mvc.events.EventR3; … … 37 38 BookView bookView = event.getSource(BookView.class); 38 39 BookH book = bookView.model().get(); 39 40 40 new AutoAction( "Play timelines.", true) {41 new AutoAction(Message.create(PLAY_TIMELINES), true) { 41 42 @Override 42 43 public void performAuto() { 43 44 getChanger().setRaw(BookR4.KEY_PLAY_TIMELINES, true); … … 66 67 67 68 bookView.setTime(TimePos.MAIN_START); 68 69 69 new AutoAction( "Stop timelines.", true) {70 new AutoAction(Message.create(STOP_TIMELINES), true) { 70 71 @Override 71 72 public void performAuto() { 72 73 getChanger().setRaw(BookR4.KEY_PLAY_TIMELINES, false); … … 113 114 BookView bookView = event.getSource(BookView.class); 114 115 BookH book = bookView.model().get(); 115 116 116 new AutoAction( "Pause timelines.", true) {117 new AutoAction(Message.create(PAUSE_TIMELINES), true) { 117 118 @Override 118 119 public void performAuto() { 119 120 getChanger().setRaw(BookR4.KEY_PLAY_TIMELINES, false); … … 123 124 return true; 124 125 } 125 126 }; 127 128 /** 129 * Constant created for pause timelines. 130 * Constant created to be a parameter of a message of an {@link AutoAction}. 131 * Used for skinning. 132 */ 133 public static final String PAUSE_TIMELINES = "Pause timelines."; 134 135 /** 136 * Constant created for stop timelines. 137 * Constant created to be a parameter of a message of an {@link AutoAction}. 138 * Used for skinning. 139 */ 140 public static final String STOP_TIMELINES = "Stop timelines."; 141 142 /** 143 * Constant created for play timelines.. 144 * Constant created to be a parameter of a message of an {@link AutoAction}. 145 * Used for skinning. 146 */ 147 public static final String PLAY_TIMELINES = "Play timelines."; 126 148 } 149 No newline at end of file -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/appearance/AppearanceHud.java
44 44 import org.sophie2.base.model.resources.r4.keys.CompositeKey; 45 45 import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 46 46 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 47 import org.sophie2.base.skins.Message; 47 48 import org.sophie2.base.skins.SkinElementId; 48 49 import org.sophie2.base.visual.BaseSwingVisualElement; 49 50 import org.sophie2.base.visual.BaseVisualElement; … … 791 792 return false; 792 793 } 793 794 794 new AutoAction( "Change frame background opacity", true) {795 new AutoAction(Message.create(BG_OPACITY), true) { 795 796 @Override 796 797 public void performAuto() { 797 798 getChanger().setRaw(StyledElement.KEY_BACKGROUND__OPACITY, … … 823 824 String inputData = event.getEventParam(EventIds.INPUT_PARAM_INDEX, String.class); 824 825 final Float input = BoundValidation.parseNumber(inputData, Float.class); 825 826 826 new AutoAction( "Change border size.", true) {827 new AutoAction(Message.create(BORDER_SIZE), true) { 827 828 @Override 828 829 public void performAuto() { 829 830 getChanger().setRaw(StyledElement.KEY_BORDER__INSETS, new ImmInsets(input)); … … 856 857 final ImmColor input = event.getEventParam( 857 858 ColorPickerHudField.EventIds.COLOR_PARAM_INDEX, ImmColor.class); 858 859 859 new AutoAction( "Change frame border color", true) {860 new AutoAction(Message.create(BORDER_COLOR), true) { 860 861 @Override 861 862 public void performAuto() { 862 863 getChanger().setRaw(StyledElement.KEY_BORDER__COLOR, input); … … 886 887 final Boolean input = event 887 888 .getEventParam(EventIds.INPUT_PARAM_INDEX, Boolean.class); 888 889 889 new AutoAction( "Toggle shadow enabled.", true) {890 new AutoAction(Message.create(SHADOW_ENABLED), true) { 890 891 @Override 891 892 public void performAuto() { 892 893 getChanger().setRaw(FrameR4.KEY_SHADOW__ENABLED, input); … … 918 919 String inputData = event.getEventParam(EventIds.INPUT_PARAM_INDEX, String.class); 919 920 final Float input = BoundValidation.parseNumber(inputData, Float.class); 920 921 921 new AutoAction( "Change shadow offset.", true) {922 new AutoAction(Message.create(SHADOW_OFFSET), true) { 922 923 @Override 923 924 public void performAuto() { 924 925 getChanger().setRaw(FrameR4.KEY_SHADOW__POSITION, … … 948 949 ComboInput<BackgroundType> input = event.getEventParam( 949 950 BoundControl.EventIds.INPUT_PARAM_INDEX, ComboInput.class); 950 951 final BackgroundType type = input.getSelectedItem(); 951 new AutoAction( "Set background type.", true) {952 new AutoAction(Message.create(BG_TYPE), true) { 952 953 @Override 953 954 public void performAuto() { 954 955 getChanger().setRaw(StyledElement.KEY_BACKGROUND__TYPE, type); … … 984 985 final VisibleChannel channel = ElementR4.KEY_VISIBLE.get(access); 985 986 final TimePos time = fv.getTime(); 986 987 987 new AutoAction( "Toggle frame visibility.", true) {988 new AutoAction(Message.create(FRAME_VISIBILITY), true) { 988 989 @Override 989 990 public void performAuto() { 990 991 getChanger().setRaw(ElementR4.KEY_VISIBLE, channel.setValue(time, input)); … … 1009 1010 ResourceAccess access = getAccess(source); 1010 1011 final Boolean input = event.getEventParam(BoundControl.EventIds.INPUT_PARAM_INDEX, 1011 1012 Boolean.class); 1012 new AutoAction( "Toggle shadow enabled.", true) {1013 new AutoAction(Message.create(SHADOW_ENABLED), true) { 1013 1014 @Override 1014 1015 public void performAuto() { 1015 1016 getChanger().setRaw(FrameR4.KEY_SHADOW__ENABLED, input); … … 1038 1039 final WrappingModes input = comboInput.getSelectedItem(); 1039 1040 1040 1041 if (!input.equals(FrameR4.KEY_WRAP.get(access))) { 1041 new AutoAction( "Change wrap mode.", true) {1042 new AutoAction(Message.create(WRAP_MODE), true) { 1042 1043 @Override 1043 1044 public void performAuto() { 1044 1045 getChanger().setRaw(FrameR4.KEY_WRAP, input); … … 1067 1068 * The {@link TemplatedKey} used to access the value. 1068 1069 */ 1069 1070 protected static void setBorderInsetsComponent(Side side, String input, 1070 StringeventDescription, ResourceAccess access, final TemplatedKey<ImmInsets> key) {1071 Message eventDescription, ResourceAccess access, final TemplatedKey<ImmInsets> key) { 1071 1072 ImmInsets insets = key.get(access); 1072 1073 float value = BoundValidation.parseNumber(input, Float.class); 1073 1074 final ImmInsets newInsets = insets.setSide(side, value); … … 1087 1088 * @param key 1088 1089 * The {@link TemplatedKey} used to access the value. 1089 1090 */ 1090 protected static void setBorderInsets(final ImmInsets insets, StringeventDescription,1091 protected static void setBorderInsets(final ImmInsets insets, Message eventDescription, 1091 1092 ResourceAccess access, final TemplatedKey<ImmInsets> key) { 1092 1093 new AutoAction(eventDescription, true) { 1093 1094 @Override … … 1142 1143 Mode templateMode = key.getMode(access); 1143 1144 return templateMode == mode; 1144 1145 } 1146 1147 /** 1148 * Constant created for changing background opacity. 1149 * Constant created to be a parameter of a message of an {@link AutoAction}. 1150 * Used for skinning. 1151 */ 1152 public static final String BG_OPACITY = "Change background opacity"; 1153 1154 /** 1155 * Constant created for changing border size. 1156 * Constant created to be a parameter of a message of an {@link AutoAction}. 1157 * Used for skinning. 1158 */ 1159 public static final String BORDER_SIZE = "Change border size."; 1160 1161 /** 1162 * Constant created for changing border color. 1163 * Constant created to be a parameter of a message of an {@link AutoAction}. 1164 * Used for skinning. 1165 */ 1166 public static final String BORDER_COLOR = "Change border color"; 1167 1168 /** 1169 * Constant created for toggling shadow enable. 1170 * Constant created to be a parameter of a message of an {@link AutoAction}. 1171 * Used for skinning. 1172 */ 1173 public static final String SHADOW_ENABLED = "Toggle shadow enabled."; 1174 1175 /** 1176 * Constant created for setting background type. 1177 * Constant created to be a parameter of a message of an {@link AutoAction}. 1178 * Used for skinning. 1179 */ 1180 public static final String BG_TYPE = "Set background type."; 1181 1182 /** 1183 * Constant created for changing shadow offset. 1184 * Constant created to be a parameter of a message of an {@link AutoAction}. 1185 * Used for skinning. 1186 */ 1187 public static final String SHADOW_OFFSET = "Change shadow offset."; 1188 1189 /** 1190 * Constant created for toggling frame visibility. 1191 * Constant created to be a parameter of a message of an {@link AutoAction}. 1192 * Used for skinning. 1193 */ 1194 public static final String FRAME_VISIBILITY = "Toggle frame visibility."; 1195 1196 /** 1197 * Constant created for changing wrap mode. 1198 * Constant created to be a parameter of a message of an {@link AutoAction}. 1199 * Used for skinning. 1200 */ 1201 public static final String WRAP_MODE = "Change wrap mode."; 1145 1202 } 1203 No newline at end of file -
modules/org.sophie2.base.model.resources.r4/src/test/java/org/sophie2/base/model/resources/r4/keys/TemplatingTest.java
15 15 import org.sophie2.base.model.resources.r4.dummies.resources.DummyResource; 16 16 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 17 17 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 18 import org.sophie2.base.skins.Message; 18 19 import org.sophie2.core.modularity.FakeModuleRegistry; 19 20 import org.sophie2.core.prolib.impl.AutoProperty; 20 21 import org.sophie2.core.prolib.impl.BaseProObject; … … 29 30 public class TemplatingTest extends UnitTestBase { 30 31 31 32 /** 33 * Constant created for fred is a human. 34 * Constant created to be a parameter of a message of an {@link AutoAction}. 35 * Used for skinning. Used in the test. 36 */ 37 public static final String FRED_IS_A_HUMAN = "Fred is a human!!!"; 38 39 /** 40 * Constant created for dino is a dog. 41 * Constant created to be a parameter of a message of an {@link AutoAction}. 42 * Used for skinning. Used in the test. 43 */ 44 public static final String DINO_IS_A_DOG = "Dino is a dog!!!"; 45 46 /** 47 * Constant created for locking dino. 48 * Constant created to be a parameter of a message of an {@link AutoAction}. 49 * Used for skinning. Used in the test. 50 */ 51 public static final String LOCKING_DINO = "Locking Dino"; 52 53 /** 54 * Constant created for setting barny to fred's friend. 55 * Constant created to be a parameter of a message of an {@link AutoAction}. 56 * Used for skinning. Used in the test. 57 */ 58 public static final String SETTING_BARNY_TO_FRED_FRIEND = "Setting Barny to Fred's friend"; 59 60 /** 61 * Constant created for making dummy. 62 * Constant created to be a parameter of a message of an {@link AutoAction}. 63 * Used for skinning. Used in the test. 64 */ 65 public static final String MAKING_DUMMY = "making dummy :)"; 66 67 /** 32 68 * Testing class used for testing tracking. 33 69 * 34 70 * @author meddle, deni … … 80 116 ResourceRefR4 ref = ResourceRefR4.make(LocationPrefix.NULL + "Templated res"); 81 117 this.access = MasterTestAccess.make("some-view", ref); 82 118 83 new AutoAction( "making dummy :)", true) {119 new AutoAction(Message.create(MAKING_DUMMY), true) { 84 120 @Override 85 121 public void performAuto() { 86 122 getChanger().setRaw(ResourceR4.KEY_KIND, DummyResource.KIND); … … 116 152 assertSame(Mode.USE_TEMPLATE, templatedMode); 117 153 118 154 // Set a child to be custom: 119 new AutoAction( "Setting Barny to Fred's friend", true) {155 new AutoAction(Message.create(SETTING_BARNY_TO_FRED_FRIEND), true) { 120 156 @Override 121 157 public void performAuto() { 122 158 getChanger().setRaw(DummyResource.KEY_BARNY, "Fred's friend"); … … 127 163 assertSame(Mode.CUSTOM, templatedMode); 128 164 129 165 // Set to use template again: 130 new AutoAction( "Setting Barny to Fred's friend", true) {166 new AutoAction(Message.create(SETTING_BARNY_TO_FRED_FRIEND), true) { 131 167 @Override 132 168 public void performAuto() { 133 169 getChanger().setRaw(DummyResource.KEY_BARNY, null); … … 138 174 assertSame(Mode.USE_TEMPLATE, templatedMode); 139 175 140 176 // Lock one key: 141 new AutoAction( "Locking Dino", true) {177 new AutoAction(Message.create(LOCKING_DINO), true) { 142 178 @Override 143 179 public void performAuto() { 144 180 getChanger().setRaw(DummyResource.KEY_DINO.getLockKey(), true); … … 150 186 assertSame(Mode.CUSTOM, templatedMode); 151 187 152 188 // Lock all keys: 153 new AutoAction( "Locking Dino", true) {189 new AutoAction(Message.create(LOCKING_DINO), true) { 154 190 @Override 155 191 public void performAuto() { 156 192 getChanger().setRaw(DummyResource.KEY_BARNY.getLockKey(), true); … … 163 199 assertSame(Mode.LOCKED, templatedMode); 164 200 165 201 // Set the composite key to 'USE TEMPLATE' mode 166 new AutoAction( "Locking Dino", true) {202 new AutoAction(Message.create(LOCKING_DINO), true) { 167 203 @Override 168 204 public void performAuto() { 169 205 getChanger().setRaw(DummyResource.KEY_BARNY.getLockKey(), false); … … 192 228 assertEquals((Integer) 0, tracker.counter().get()); 193 229 194 230 // Change the composite key's child value: 195 new AutoAction( "Dino is a dog!!!", true) {231 new AutoAction(Message.create(DINO_IS_A_DOG), true) { 196 232 @Override 197 233 public void performAuto() { 198 234 getChanger().setRaw(DummyResource.KEY_DINO, "I'm a dog!"); … … 202 238 assertEquals((Integer) 1, tracker.counter().get()); 203 239 204 240 // Change the composite key's value: 205 new AutoAction( "Dino is a dog!!!", true) {241 new AutoAction(Message.create(DINO_IS_A_DOG), true) { 206 242 @Override 207 243 public void performAuto() { 208 244 getChanger().setRaw(DummyResource.KEY_TEMP_COMPOSITE, null); … … 211 247 212 248 assertEquals((Integer) 2, tracker.counter().get()); 213 249 214 new AutoAction( "Dino is a dog!!!", true) {250 new AutoAction(Message.create(DINO_IS_A_DOG), true) { 215 251 @Override 216 252 public void performAuto() { 217 253 getChanger().setRaw(DummyResource.KEY_DINO, "I'm a dog again!"); … … 220 256 221 257 assertEquals((Integer) 3, tracker.counter().get()); 222 258 223 new AutoAction( "Fred is a human!!!", true) {259 new AutoAction(Message.create(FRED_IS_A_HUMAN), true) { 224 260 @Override 225 261 public void performAuto() { 226 262 getChanger().setRaw(DummyResource.KEY_FRED, "I'm human!"); -
modules/org.sophie2.main.app.menus/src/test/java/org/sophie2/main/app/menus/UndoRedoTest.java
24 24 import org.sophie2.base.natlib.BaseNatlibModule; 25 25 import org.sophie2.base.scene.BaseSceneModule; 26 26 import org.sophie2.base.skins.BaseSkinsModule; 27 import org.sophie2.base.skins.Message; 27 28 import org.sophie2.base.visual.BaseVisualModule; 28 29 import org.sophie2.core.logging.LogLevel; 29 30 import org.sophie2.core.logging.SophieLog; … … 48 49 */ 49 50 public class UndoRedoTest extends AppTestBase { 50 51 52 /** 53 * Constant created for one significant change. 54 * Constant created to be a parameter of a message of an {@link AutoAction}. 55 * Used for skinning. Used in the test. 56 */ 57 public static final String ONE_SIGNIFICANT_CHANGE = "One significant change."; 58 59 /** 60 * Constant created for end of group changes. 61 * Constant created to be a parameter of a message of an {@link AutoAction}. 62 * Used for skinning. Used in the test. 63 */ 64 public static final String END_OF_GROUP_CHANGES = "End of group changes"; 65 66 /** 67 * Constant created for insignificant group change. 68 * Constant created to be a parameter of a message of an {@link AutoAction}. 69 * Used for skinning. Used in the test. 70 */ 71 public static final String INSIGNIFICANT_GROUP_CHANGE = "Unsignificant group change."; 51 72 private AppMainWindow mainWindow; 52 73 53 74 @SuppressWarnings("unchecked") … … 234 255 235 256 private <T> void registerChage(ResourceAccess access, final Key<T> key, 236 257 final T value) { 237 new AutoAction( "Unsignificant group change.", false) {258 new AutoAction(Message.create(INSIGNIFICANT_GROUP_CHANGE), false) { 238 259 @Override 239 260 public void performAuto() { 240 261 getChanger().setRaw(key, value); … … 244 265 } 245 266 246 267 private void registerEndChage(ResourceAccess access) { 247 new AutoAction( "End of group changes", true) {268 new AutoAction(Message.create(END_OF_GROUP_CHANGES), true) { 248 269 @Override 249 270 public void performAuto() { 250 271 //nothing to change … … 266 287 } 267 288 registerEndChage(this.firstAccess); 268 289 269 new AutoAction( "One significant change.", true) {290 new AutoAction(Message.create(ONE_SIGNIFICANT_CHANGE), true) { 270 291 @Override 271 292 public void performAuto() { 272 293 getChanger().setRaw(ResourceR4.KEY_COMMENT, "Comment."); -
modules/org.sophie2.base.skins/src/test/java/org/sophie2/base/skins/MessageTest.java
1 package org.sophie2.base.skins; 2 3 import java.util.HashMap; 4 import java.util.Map; 5 6 import org.sophie2.core.testing.ImmutabilityTestBase; 7 8 /** 9 * Tests the immutability of a message object. 10 * 11 * @author tanya 12 */ 13 public class MessageTest extends ImmutabilityTestBase<Message> { 14 15 @Override 16 protected Map<Class<?>, Object> constructorArgs() throws Exception { 17 Map<Class<?>, Object> args = new HashMap<Class<?>, Object>(); 18 19 return args; 20 } 21 22 @Override 23 protected Message createImmutableEqualToObj1() throws Exception { 24 return Message.create("Size changed from %1$s to %2$s", 10, 20); 25 } 26 27 @Override 28 protected Message createImmutableObj1() throws Exception { 29 return Message.create("Size changed from %1$s to %2$s", 10, 20); 30 } 31 32 @Override 33 protected Map<Class<?>, Object> methodArgs() throws Exception { 34 Map<Class<?>, Object> args = new HashMap<Class<?>, Object>(); 35 36 return args; 37 } 38 39 } -
modules/org.sophie2.base.model.resources.r4/src/main/java/org/sophie2/base/model/resources/r4/changes/Change.java
2 2 3 3 import org.sophie2.base.model.resources.r4.ResourceRefR4; 4 4 import org.sophie2.base.model.resources.r4.model.ResourceRevision; 5 import org.sophie2.base.skins.Message; 5 6 import org.sophie2.core.prolib.annot.Immutable; 6 7 7 8 /** … … 17 18 18 19 private final ResourceRefR4 user; 19 20 private final String viewId; 20 private final Stringdescription;21 private final Message description; 21 22 private final boolean significant; 22 23 23 24 /** … … 35 36 * If the new <code>Change</code> is significant. 36 37 */ 37 38 public Change(ResourceRefR4 user, 38 String viewId, Stringdescription, boolean significant) {39 String viewId, Message description, boolean significant) { 39 40 this.user = user; 40 41 this.viewId = viewId; 41 42 this.description = description; … … 79 80 * The <var>description</var>. 80 81 */ 81 82 public String getDescription() { 82 return this.description ;83 return this.description.getText(); 83 84 } 84 85 85 86 @Override -
modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/util/CopyPageClipboard.java
4 4 import org.sophie2.base.model.book.PageH; 5 5 import org.sophie2.base.model.resources.r4.ResourceRefR4; 6 6 import org.sophie2.base.model.resources.r4.changes.AutoAction; 7 import org.sophie2.base.skins.Message; 7 8 import org.sophie2.core.prolib.util.ProUtil; 8 9 9 10 /** … … 20 21 */ 21 22 public class CopyPageClipboard { 22 23 24 /** 25 * Constant created for copying a page into a new book. 26 * Constant created to be a parameter of a message of an {@link AutoAction}. 27 * Used for skinning. 28 */ 29 public static final String COPY_PAGE_INTO_NEW_BOOK = "Copies a page into a new book"; 23 30 private PageH copiedPage = null; 24 31 25 32 /** … … 46 53 final ResourceRefR4 targetRef = 47 54 ResourceRefR4.makeChild(this.copiedPage.getName()); 48 55 49 new AutoAction( "Copies a page into a new book", true) {56 new AutoAction(Message.create(COPY_PAGE_INTO_NEW_BOOK), true) { 50 57 @Override 51 58 public void performAuto() { 52 59 getChanger().copyResource(sourceRef, targetRef); -
modules/org.sophie2.main.func.servers/src/main/java/org/sophie2/main/func/servers/logic/ServersTabLogic.java
34 34 import org.sophie2.base.model.resources.r4.model.ResourceModel; 35 35 import org.sophie2.base.model.resources.r4.model.RevisionId; 36 36 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 37 import org.sophie2.base.skins.Message; 37 38 import org.sophie2.core.logging.SophieLog; 38 39 import org.sophie2.core.modularity.SortKey; 39 40 import org.sophie2.core.mvc.EventFilterBuilder; … … 296 297 return false; 297 298 } 298 299 299 new AutoAction( "Modify server.", true) {300 new AutoAction(Message.create(MODIFY_SERVER), true) { 300 301 301 302 @Override 302 303 public void performAuto() { … … 446 447 return false; 447 448 } 448 449 449 new AutoAction( "Upload " + resourceRef + " to "450 + serverResourcesDirectory.getRef() + ".", true) {450 new AutoAction(Message.create(UPLOAD_RES_TO_SERVER, resourceRef, 451 serverResourcesDirectory.getRef()), true) { 451 452 @Override 452 453 public void performAuto() { 453 454 ResourceChanger dirChanger = getChanger(); … … 486 487 }; 487 488 488 489 /** 490 * Constant created for uploading a resource (by name of the resource) to server (by name of the server). 491 * Constant created to be a parameter of a message of an {@link AutoAction}. 492 * Used for skinning. 493 */ 494 public static final String UPLOAD_RES_TO_SERVER = "Upload %1$s to %2$s."; 495 496 /** 497 * Constant created for modifying of a server. 498 * Constant created to be a parameter of a message of an {@link AutoAction}. 499 * Used for skinning. 500 */ 501 public static final String MODIFY_SERVER = "Modify server."; 502 503 /** 489 504 * Sets a server account entered by the user in a 490 505 * dialog. 491 506 * -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/properties/PropertiesHud.java
30 30 import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 31 31 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 32 32 import org.sophie2.base.model.resources.r4.resources.ResourceH; 33 import org.sophie2.base.skins.Message; 33 34 import org.sophie2.base.skins.SkinElementId; 34 35 import org.sophie2.base.visual.VisualElement; 35 36 import org.sophie2.base.visual.skins.ElementSkinPart; … … 728 729 729 730 final ImmSize newSize = new ImmSize(width, height); 730 731 731 new AutoAction( "Set frame width.", true) {732 new AutoAction(Message.create(SET_FRAME_WIDTH), true) { 732 733 @Override 733 734 public void performAuto() { 734 735 getChanger().setRaw(ResizableElement.KEY_SIZE, newSize); … … 763 764 } 764 765 765 766 final ImmSize newSize = new ImmSize(width, height); 766 new AutoAction( "Set frame height.", true) {767 new AutoAction(Message.create(SET_FRAME_HEIGHT), true) { 767 768 @Override 768 769 public void performAuto() { 769 770 getChanger().setRaw(ResizableElement.KEY_SIZE, newSize); … … 840 841 final ImmPoint newPoint = new ImmPoint(value, location.getY()); 841 842 final LocationChannel channel = MemberElement.KEY_LOCATION.get(access); 842 843 843 new AutoAction( "Set X position.", true) {844 new AutoAction(Message.create(SET_X_POSITION), true) { 844 845 @Override 845 846 public void performAuto() { 846 847 getChanger().setRaw(MemberElement.KEY_LOCATION, channel.setAll(newPoint)); … … 871 872 final ImmPoint newPoint = new ImmPoint(location.getValue(getTime(source)).getX(), 872 873 value); 873 874 874 new AutoAction( "Set Y position.", true) {875 new AutoAction(Message.create(SET_Y_POSITION), true) { 875 876 @Override 876 877 public void performAuto() { 877 878 getChanger().setRaw(MemberElement.KEY_LOCATION, location.setAll(newPoint)); … … 901 902 902 903 final float value = BoundValidation.parseNumber(input, Float.class); 903 904 904 new AutoAction( "Set margins.", true) {905 new AutoAction(Message.create(SET_MARGINS), true) { 905 906 @Override 906 907 public void performAuto() { 907 908 getChanger().setRaw(FrameR4.KEY_MARGIN_INSETS, new ImmInsets(value)); … … 931 932 932 933 final float value = BoundValidation.parseNumber(input, Float.class); 933 934 934 new AutoAction( "Set padding.", true) {935 new AutoAction(Message.create(SET_PADDING), true) { 935 936 @Override 936 937 public void performAuto() { 937 938 getChanger().setRaw(FrameR4.KEY_PADDING_INSETS, new ImmInsets(value)); … … 959 960 final Double newAngle = Math.toRadians(Double.parseDouble(input)); 960 961 961 962 ResourceAccess access = RotationAngle.getModel(source).getAccess(); 962 new AutoAction( "Set rotation angle", true) {963 new AutoAction(Message.create(SET_ROTATION_ANGLE), true) { 963 964 964 965 @Override 965 966 public void performAuto() { … … 971 972 return true; 972 973 } 973 974 974 } 975 }; 976 977 /** 978 * Constant created for setting rotation angle. 979 * Constant created to be a parameter of a message of an {@link AutoAction}. 980 * Used for skinning. 981 */ 982 public static final String SET_ROTATION_ANGLE = "Set rotation angle"; 983 984 /** 985 * Constant created for setting padding. 986 * Constant created to be a parameter of a message of an {@link AutoAction}. 987 * Used for skinning. 988 */ 989 public static final String SET_PADDING = "Set padding."; 990 991 /** 992 * Constant created for setting margins. 993 * Constant created to be a parameter of a message of an {@link AutoAction}. 994 * Used for skinning. 995 */ 996 public static final String SET_MARGINS = "Set margins."; 997 998 /** 999 * Constant created for setting y position. 1000 * Constant created to be a parameter of a message of an {@link AutoAction}. 1001 * Used for skinning. 1002 */ 1003 public static final String SET_Y_POSITION = "Set Y position."; 1004 1005 /** 1006 * Constant created for setting x position. 1007 * Constant created to be a parameter of a message of an {@link AutoAction}. 1008 * Used for skinning. 1009 */ 1010 public static final String SET_X_POSITION = "Set X position."; 1011 1012 /** 1013 * Constant created for setting frame height. 1014 * Constant created to be a parameter of a message of an {@link AutoAction}. 1015 * Used for skinning. 1016 */ 1017 public static final String SET_FRAME_HEIGHT = "Set frame height."; 1018 1019 /** 1020 * Constant created for setting frame width. 1021 * Constant created to be a parameter of a message of an {@link AutoAction}. 1022 * Used for skinning. 1023 */ 1024 public static final String SET_FRAME_WIDTH = "Set frame width."; 975 1025 } 976 1026 977 1027 } -
modules/org.sophie2.extra.func.scripting/src/test/java/org/sophie2/extra/func/scripting/facade/JSBookTest.java
15 15 import org.sophie2.base.model.resources.r4.changes.AutoAction; 16 16 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 17 17 import org.sophie2.base.skins.BaseSkinsModule; 18 import org.sophie2.base.skins.Message; 18 19 import org.sophie2.base.visual.BaseVisualModule; 19 20 import org.sophie2.core.modularity.SophieModule; 20 21 import org.sophie2.core.mvc.CoreMvcModule; … … 38 39 */ 39 40 public class JSBookTest extends AppTestBase { 40 41 42 /** 43 * Constant created for editing a script. 44 * Constant created to be a parameter of a message of an {@link AutoAction}. 45 * Used for skinning. Used in the test. 46 */ 47 public static final String EDIT_SCRIPT = "Edit Script."; 48 49 /** 50 * Constant created for setting title of a book. 51 * Constant created to be a parameter of a message of an {@link AutoAction}. 52 * Used for skinning. Used in the test. 53 */ 54 public static final String SET_BOOK_TITLE = "Set book title"; 55 56 /** 57 * Constant created for inserting a script. 58 * Constant created to be a parameter of a message of an {@link AutoAction}. 59 * Used for skinning. Used in the test. 60 */ 61 public static final String INSERT_SCRIPT = "Insert script"; 41 62 private BookH book; 42 63 private ScriptResourceH script; 43 64 … … 54 75 final ResourceRefR4 scriptRef = 55 76 ResourceRefR4.generateRandomSub(ScriptResourceH.NAME_PREFIX); 56 77 final ResourceRefR4 bookRef = bookAccess.getRef(); 57 new AutoAction( "Insert script", true) {78 new AutoAction(Message.create(INSERT_SCRIPT), true) { 58 79 59 80 @Override 60 81 public void performAuto() { … … 132 153 public void testNewBook() { 133 154 final String CURRENT_BOOK_TITLE = "Design Patterns by GoF"; 134 155 135 new AutoAction( "Set book title", false) {156 new AutoAction(Message.create(SET_BOOK_TITLE), false) { 136 157 137 158 @Override 138 159 public void performAuto() { … … 172 193 173 194 ResourceAccess scriptAccess = this.script.getAccess(); 174 195 175 new AutoAction( "Edit Script.", true) {196 new AutoAction(Message.create(EDIT_SCRIPT), true) { 176 197 177 198 @Override 178 199 public void performAuto() { -
modules/org.sophie2.main.app.commons/src/test/java/org/sophie2/main/app/commons/content/ContentViewTest.java
20 20 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 21 21 import org.sophie2.base.scene.interfaces.ImageSceneElement; 22 22 import org.sophie2.base.skins.BaseSkinsModule; 23 import org.sophie2.base.skins.Message; 23 24 import org.sophie2.base.visual.BaseVisualModule; 24 25 import org.sophie2.core.modularity.FakeModuleRegistry; 25 26 import org.sophie2.core.mvc.CoreMvcModule; … … 33 34 */ 34 35 public class ContentViewTest extends IntegrationTestBase { 35 36 37 /** 38 * Constant created for setting content to null. 39 * Constant created to be a parameter of a message of an {@link AutoAction}. 40 * Used for skinning. 41 */ 42 public static final String SET_CONTENT_TO_NULL = "Set content to null"; 43 44 /** 45 * Constant created for setting content. 46 * Constant created to be a parameter of a message of an {@link AutoAction}. 47 * Used for skinning. 48 */ 49 public static final String SET_CONTENT = "Set content"; 50 51 /** 52 * Constant created for creating a dummy page. 53 * Constant created to be a parameter of a message of an {@link AutoAction}. 54 * Used for skinning. 55 */ 56 public static final String CREATE_DUMMY_FRAME = "Create dummy frame"; 36 57 private AppLocator locator; 37 58 private FrameH frame; 38 59 private DummyResourceH resource; … … 67 88 final ResourceRefR4 finalResRef = this.resRef; 68 89 final ResourceRefR4 finalResRef2 = this.resRef2; 69 90 70 new AutoAction( "Create dummy frame", true) {91 new AutoAction(Message.create(CREATE_DUMMY_FRAME), true) { 71 92 72 93 @Override 73 94 public void performAuto() { … … 115 136 116 137 final ResourceRefR4 ref = this.resRef; 117 138 118 new AutoAction( "Set content", true) {139 new AutoAction(Message.create(SET_CONTENT), true) { 119 140 120 141 @Override 121 142 public void performAuto() { … … 143 164 assertSame(this.frameView.parent().get(), 144 165 this.frameView); 145 166 146 new AutoAction( "Set content to null", true) {167 new AutoAction(Message.create(SET_CONTENT_TO_NULL), true) { 147 168 148 169 @Override 149 170 public void performAuto() { … … 155 176 156 177 assertNull(this.frameView); 157 178 158 new AutoAction( "Set content", true) {179 new AutoAction(Message.create(SET_CONTENT), true) { 159 180 160 181 @Override 161 182 public void performAuto() { … … 169 190 this.frame); 170 191 171 192 final ResourceRefR4 newRef = this.resRef2; 172 new AutoAction( "Set content", true) {193 new AutoAction(Message.create(SET_CONTENT), true) { 173 194 174 195 @Override 175 196 public void performAuto() { -
modules/org.sophie2.dev/src/main/java/org/sophie2/dev/reader/FakeReaderMain.java
38 38 import org.sophie2.base.persistence.BasePersistenceModule; 39 39 import org.sophie2.base.scene.BaseSceneModule; 40 40 import org.sophie2.base.skins.BaseSkinsModule; 41 import org.sophie2.base.skins.Message; 41 42 import org.sophie2.base.visual.BaseVisualModule; 42 43 import org.sophie2.core.logging.LogLevel; 43 44 import org.sophie2.core.logging.SophieLog; … … 90 91 public class FakeReaderMain { 91 92 92 93 /** 94 * Constant created for modifying the developer's book for the reader. 95 * Constant created to be a parameter of a message of an {@link AutoAction}. 96 * Used for skinning. 97 */ 98 public static final String MODIFY_THE_DEVELOPER_S_BOOK_FOR_THE_READER = "Modify the developer's book for the reader"; 99 100 /** 93 101 * The main method. Instead of running the plugin framework, registers what 94 102 * should be registered and delegates. Should be invoked with enabled 95 103 * assertions. … … 217 225 final String page1Title = ResourceUtil.getNextTitle(book.getRef(), PageR4.DEFAULT_TITLE); 218 226 final String page2Title = ResourceUtil.getNextTitle(book.getRef(), PageR4.DEFAULT_TITLE); 219 227 220 new AutoAction( "Modify the developer's book for the reader", true) {228 new AutoAction(Message.create(MODIFY_THE_DEVELOPER_S_BOOK_FOR_THE_READER), true) { 221 229 @Override 222 230 public void performAuto() { 223 231 ResourceChanger bookCh = getChanger(); -
modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/imports/ResourceImportUtil.java
35 35 import org.sophie2.base.model.resources.r4.model.ResourceModel; 36 36 import org.sophie2.base.model.resources.r4.resources.ResourceH; 37 37 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 38 import org.sophie2.base.skins.Message; 38 39 import org.sophie2.core.logging.SophieLog; 39 40 import org.sophie2.main.app.commons.util.TemplateUtil; 40 41 import org.sophie2.main.dialogs.input.DialogUtils; … … 94 95 ResourceImportType.EMBED); 95 96 96 97 // The description must be smarter... May be with skins --meddle 2009-10-21 97 new AutoAction( "Import resource " + importInfo.getName() + ".", true) {98 new AutoAction(Message.create(IMPORT_RES, importInfo.getName()), true) { 98 99 @Override 99 100 public void performAuto() { 100 101 ResourceChanger changer = getChanger(); … … 134 135 final ResourceImportInfo importInfo = new ResourceImportInfo(data, title); 135 136 final ResourceRefR4 childRef = importManager.generateChildRef(); 136 137 137 new AutoAction( "Import resource " + importInfo.getName(), significant) {138 new AutoAction(Message.create(IMPORT_RES, importInfo.getName()), significant) { 138 139 @Override 139 140 public void performAuto() { 140 141 … … 145 146 146 147 return book.getRef().append(childRef); 147 148 } 149 150 /** 151 * Constant created for importing resources by resource name. 152 * Constant created to be a parameter of a message of an {@link AutoAction}. 153 * Used for skinning. 154 */ 155 public final static String IMPORT_RES = "Import resource %1$s."; 148 156 149 157 private static <D> void insert(final ResourceImportInfo<D> importInfo, 150 158 final ResourceImportManager<D> importManager, BookH book, … … 172 180 173 181 174 182 // The description must be smarter... May be with skins --meddle 2009-10-21 175 new AutoAction( "Insert frame for resource " + importInfo.getName() + ".", true) {183 new AutoAction(Message.create(INSERT_FRAME_FOR_RESOURCE, importInfo.getName()), true) { 176 184 @Override 177 185 public void performAuto() { 178 186 ResourceChanger changer = getChanger(); … … 201 209 FrameH templateH = ResourceH.getHelper(templateAccess, FrameH.class); 202 210 final NaiveImmList<TemplatedKey<?>> immKeys = templateH.getApplicableTemplatedKeys(); 203 211 204 new AutoAction( "Apply template for resource " + importInfo.getName() + ".", false) {212 new AutoAction(Message.create(APPLY_TEMPLATE_FOR_RESOURCE, importInfo.getName()), false) { 205 213 @Override 206 214 public void performAuto() { 207 215 TemplateUtil.applyFrameTemplate(getChanger(), … … 211 219 } 212 220 }.register(frameAccess); 213 221 } 214 215 222 } 223 224 /** 225 * Constant created for inserting frame for resource by name. 226 * Constant created to be a parameter of a message of an {@link AutoAction}. 227 * Used for skinning. 228 */ 229 public static final String INSERT_FRAME_FOR_RESOURCE = "Insert frame for resource %1$s."; 230 231 /** 232 * Constant created for applying template for resource by name. 233 * Constant created to be a parameter of a message of an {@link AutoAction}. 234 * Used for skinning. 235 */ 236 public static final String APPLY_TEMPLATE_FOR_RESOURCE = "Apply template for resource %1$s."; 216 237 217 238 private static <D> ResourceRefR4 getNewResourceRef( 218 239 final ResourceImportInfo<D> importInfo, -
modules/org.sophie2.base.model.resources.r4/src/test/java/org/sophie2/base/model/resources/r4/changes/ChangePersisterTest.java
17 17 import org.sophie2.base.persistence.persister.MasterPersister; 18 18 import org.sophie2.base.persistence.ref.ValueRef; 19 19 import org.sophie2.base.persistence.storage.Storage; 20 import org.sophie2.base.skins.Message; 20 21 import org.sophie2.core.modularity.FakeModuleRegistry; 21 22 import org.sophie2.core.testing.TestBase; 22 23 … … 28 29 */ 29 30 public class ChangePersisterTest extends TestBase { 30 31 32 /** 33 * Constant created for testing model change. 34 * Constant created to be a parameter of a message of an {@link AutoAction}. 35 * Used for skinning. Used in the test. 36 */ 37 public static final String TEST_MODEL_CHANGE = "Test model change"; 38 39 /** 40 * Constant created for testing auto action. 41 * Constant created to be a parameter of a message of an {@link AutoAction}. 42 * Used for skinning. Used in the test. 43 */ 44 public static final String TEST_AUTO_ACTION = "Test auto action"; 31 45 private static final String SCHEMA = PersistenceUtil.getStorageR3Schema(Change.class); 32 46 33 47 @SuppressWarnings("unchecked") … … 95 109 final ResourceRefR4 childRef = ResourceRefR4.makeChild("childRef"); 96 110 final ResourceRefList subDirectories = ResourceRefList.EMPTY; 97 111 98 final AutoAction action = new AutoAction( "Test auto action", true) {112 final AutoAction action = new AutoAction(Message.create(TEST_AUTO_ACTION), true) { 99 113 @Override 100 114 @SuppressWarnings("unused") 101 115 public void performAuto() { … … 113 127 // values = values.add(null); 114 128 // } 115 129 ModelChange change = new ModelChange(ResourceRefR4.NONE_REF, ResourceRefR4.NONE_REF, 116 "test-view-id", "Test model change", true, action.getClass(), values);130 "test-view-id", Message.create(TEST_MODEL_CHANGE), true, action.getClass(), values); 117 131 return change; 118 132 } 119 133 -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/appearance/BorderHud.java
19 19 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 20 20 import org.sophie2.base.model.resources.r4.changes.AutoAction; 21 21 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 22 import org.sophie2.base.skins.Message; 22 23 import org.sophie2.base.skins.SkinElementId; 23 24 import org.sophie2.base.visual.VisualElement; 24 25 import org.sophie2.base.visual.skins.ElementSkinPart; … … 332 333 VisualElement source = event.getSource(BorderInsetsTop.class); 333 334 String input = event.getEventParam(BoundControl.EventIds.INPUT_PARAM_INDEX, 334 335 String.class); 335 AppearanceHud.setBorderInsetsComponent(Side.TOP, input, "Set top border size.",336 AppearanceHud.setBorderInsetsComponent(Side.TOP, input, Message.create(TOP_BORDER_SIZE), 336 337 AppearanceHud.getAccess(source), StyledElement.KEY_BORDER__INSETS); 337 338 return true; 338 339 } … … 355 356 String input = event.getEventParam(BoundControl.EventIds.INPUT_PARAM_INDEX, 356 357 String.class); 357 358 358 AppearanceHud.setBorderInsetsComponent(Side.RIGHT, input, "Set right border size.",359 AppearanceHud.setBorderInsetsComponent(Side.RIGHT, input, Message.create(RIGHT_BORDER_SIZE), 359 360 AppearanceHud.getAccess(source), StyledElement.KEY_BORDER__INSETS); 360 361 return true; 361 362 } … … 376 377 VisualElement source = event.getSource(BorderInsetsBottom.class); 377 378 String input = event.getEventParam(BoundControl.EventIds.INPUT_PARAM_INDEX, 378 379 String.class); 379 AppearanceHud.setBorderInsetsComponent(Side.BOTTOM, input, "Set bottom border size.",380 AppearanceHud.setBorderInsetsComponent(Side.BOTTOM, input, Message.create(BOTTOM_BORDER_SIZE), 380 381 AppearanceHud.getAccess(source), StyledElement.KEY_BORDER__INSETS); 381 382 return true; 382 383 } … … 397 398 VisualElement source = event.getSource(BorderInsetsLeft.class); 398 399 String input = event.getEventParam(BoundControl.EventIds.INPUT_PARAM_INDEX, 399 400 String.class); 400 AppearanceHud.setBorderInsetsComponent(Side.LEFT, input, "Set left border size.",401 AppearanceHud.setBorderInsetsComponent(Side.LEFT, input, Message.create(LEFT_BORDER_SIZE), 401 402 AppearanceHud.getAccess(source), StyledElement.KEY_BORDER__INSETS); 402 403 return true; 403 404 } … … 433 434 borderColor.getBlueValue(), 434 435 alpha); 435 436 436 new AutoAction( "Change border opacity.", true) {437 new AutoAction(Message.create(BORDER_OPACITY), true) { 437 438 @Override 438 439 public void performAuto() { 439 440 getChanger().setRaw(FrameR4.KEY_BORDER__COLOR, input); … … 446 447 return false; 447 448 } 448 449 } 449 450 450 } 451 452 /** 453 * Constant created for changing border opacity. 454 * Constant created to be a parameter of a message of an {@link AutoAction}. 455 * Used for skinning. 456 */ 457 public static final String BORDER_OPACITY = "Change border opacity."; 458 459 /** 460 * Constant created for setting left border size. 461 * Constant created to be a parameter of a message of an {@link AutoAction}. 462 * Used for skinning. 463 */ 464 public static final String LEFT_BORDER_SIZE = "Set left border size."; 465 466 /** 467 * Constant created for setting bottom border size. 468 * Constant created to be a parameter of a message of an {@link AutoAction}. 469 * Used for skinning. 470 */ 471 public static final String BOTTOM_BORDER_SIZE = "Set bottom border size."; 472 473 /** 474 * Constant created for setting right border size. 475 * Constant created to be a parameter of a message of an {@link AutoAction}. 476 * Used for skinning. 477 */ 478 public static final String RIGHT_BORDER_SIZE = "Set right border size."; 479 480 /** 481 * Constant created for setting top border size. 482 * Constant created to be a parameter of a message of an {@link AutoAction}. 483 * Used for skinning. 484 */ 485 public static final String TOP_BORDER_SIZE = "Set top border size."; 451 486 } -
modules/org.sophie2.main.func.links/src/test/java/org/sophie2/main/func/links/LinksDemoTest.java
18 18 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 19 19 import org.sophie2.base.model.resources.r4.changes.AutoAction; 20 20 import org.sophie2.base.skins.BaseSkinsModule; 21 import org.sophie2.base.skins.Message; 21 22 import org.sophie2.base.visual.BaseVisualModule; 22 23 import org.sophie2.core.modularity.SimpleSophieExtension; 23 24 import org.sophie2.core.modularity.SophieExtension; … … 50 51 public class LinksDemoTest extends AppTestBase { 51 52 52 53 /** 54 * Constant created for adding link rule. 55 * Constant created to be a parameter of a message of an {@link AutoAction}. 56 * Used for skinning. Used in the test. 57 */ 58 public static final String ADD_LINK_RULE = "Add link rule"; 59 /** 53 60 * The number of times the demo action has been triggered. 54 61 */ 55 62 int actionTriggeredCount = -0; … … 208 215 ImmList<LinkRule>rules = page.getLink().getRules(); 209 216 final Link link = new Link(rules.add(rule)); 210 217 211 new AutoAction( "Add link rule", true) {218 new AutoAction(Message.create(ADD_LINK_RULE), true) { 212 219 213 220 @Override 214 221 public void performAuto() { -
modules/org.sophie2.extra.func.html/src/test/java/org/sophie2/extra/func/html/HtmlExportTest.java
47 47 import org.sophie2.base.natlib.BaseNatlibModule; 48 48 import org.sophie2.base.persistence.BasePersistenceModule; 49 49 import org.sophie2.base.skins.BaseSkinsModule; 50 import org.sophie2.base.skins.Message; 50 51 import org.sophie2.base.visual.BaseVisualModule; 51 52 import org.sophie2.core.logging.SophieLog; 52 53 import org.sophie2.core.modularity.CoreModularityModule; … … 78 79 */ 79 80 public class HtmlExportTest extends AppTestBase { 80 81 82 /** 83 * Constant created for inserting an image frame. 84 * Constant created to be a parameter of a message of an {@link AutoAction}. 85 * Used for skinning. Used in the test. 86 */ 87 public static final String INSERT_IMAGE_FRAME = "Insert image frame"; 88 89 /** 90 * Constant created for setting up the second page's border. 91 * Constant created to be a parameter of a message of an {@link AutoAction}. 92 * Used for skinning. Used in the test. 93 */ 94 public static final String SET_UP_SECOND_PAGE_BORDER = "Set up the second page's border."; 95 96 /** 97 * Constant created for adding a new page. 98 * Constant created to be a parameter of a message of an {@link AutoAction}. 99 * Used for skinning. Used in the test. 100 */ 101 public static final String ADD_NEW_PAGE = "Add new page."; 102 103 /** 104 * Constant created for setting up the image frame. 105 * Constant created to be a parameter of a message of an {@link AutoAction}. 106 * Used for skinning. Used in the test. 107 */ 108 public static final String SETTING_UP_IMAGE_FRAME = "Setting up the image frame"; 109 81 110 private File file; 82 111 83 112 private static final String IMAGE_FILE_NAME = "funny-cat.jpg"; … … 161 190 * frame1 => bounds width:300.0px; height:240.0px; left:75.0px; 162 191 * top:75.0px; 163 192 */ 164 new AutoAction( "Setting up the image frame", true) {193 new AutoAction(Message.create(SETTING_UP_IMAGE_FRAME), true) { 165 194 166 195 @Override 167 196 public void performAuto() { … … 182 211 final ResourceRefR4 page2Ref = ResourceRefR4.generateRandomSub("Page"); 183 212 final ResourceRefList pages = book.get(BookR4.KEY_PAGES); 184 213 185 new AutoAction( "Add new page.", true) {214 new AutoAction(Message.create(ADD_NEW_PAGE), true) { 186 215 187 216 @Override 188 217 public void performAuto() { … … 190 219 } 191 220 }.register(book.getAccess()); 192 221 193 new AutoAction( "Set up the second page's border.", true) {222 new AutoAction(Message.create(SET_UP_SECOND_PAGE_BORDER), true) { 194 223 195 224 @Override 196 225 public void performAuto() { … … 331 360 final ImmImage image = new ImmImage(imageFile, true); 332 361 final String name = imageFile.getName(); 333 362 334 new AutoAction( "Insert image frame", true) {363 new AutoAction(Message.create(INSERT_IMAGE_FRAME), true) { 335 364 336 365 @Override 337 366 public void performAuto() { -
modules/org.sophie2.base.model.resources.r4/src/test/java/org/sophie2/base/model/resources/r4/access/OpenFunctionalityTest.java
18 18 import org.sophie2.base.model.resources.r4.dummies.resources.DummyBook; 19 19 import org.sophie2.base.model.resources.r4.model.LocalResourceRevision; 20 20 import org.sophie2.base.persistence.BasePersistenceModule; 21 import org.sophie2.base.skins.Message; 21 22 import org.sophie2.core.modularity.FakeModuleRegistry; 22 23 import org.sophie2.core.testing.UnitTestBase; 23 24 … … 30 31 */ 31 32 public class OpenFunctionalityTest extends UnitTestBase { 32 33 34 /** 35 * Constant created for creating a page. 36 * Constant created to be a parameter of a message of an {@link AutoAction}. 37 * Used for skinning. Used in the test. 38 */ 39 public static final String CREATE_PAGE = "Create a page"; 33 40 private AppLocator locator; 34 41 35 42 @SuppressWarnings("unchecked") … … 118 125 assertNotSame(access1, access2); 119 126 final ResourceRefR4 pageRef = ResourceRefR4.makeChild("PageA"); 120 127 final ResourceRefList pages = DummyBook.KEY_PAGES.get(access1); 121 new AutoAction( "Create an page", true) {128 new AutoAction(Message.create(CREATE_PAGE), true) { 122 129 @Override 123 130 public void performAuto() { 124 131 DummyBookHelper.addNewPage(getChanger(), pageRef, pages); -
modules/org.sophie2.base.model.resources.r4/src/test/java/org/sophie2/base/model/resources/r4/changes/MetaChangeTest.java
26 26 import org.sophie2.base.model.resources.r4.model.ResourceRevision; 27 27 import org.sophie2.base.model.resources.r4.model.RevisionId; 28 28 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 29 import org.sophie2.base.skins.Message; 29 30 import org.sophie2.core.modularity.FakeModuleRegistry; 30 31 import org.sophie2.core.testing.UnitTestBase; 31 32 … … 36 37 */ 37 38 public class MetaChangeTest extends UnitTestBase { 38 39 40 /** 41 * Constant created for skip. 42 * Constant created to be a parameter of a message of an {@link AutoAction}. 43 * Used for skinning. Used in the test. 44 */ 45 public static final String SKIP = "skip"; 46 47 /** 48 * Constant created for setting the book title. 49 * Constant created to be a parameter of a message of an {@link AutoAction}. 50 * Used for skinning. Used in the test. 51 */ 52 public static final String SET_THE_BOOK_TITLE = "Set the book title"; 53 54 /** 55 * Constant created for moving the frame down. 56 * Constant created to be a parameter of a message of an {@link AutoAction}. 57 * Used for skinning. Used in the test. 58 */ 59 public static final String MOVE_THE_FRAME_DOWN = "Move the frame down."; 60 61 /** 62 * Constant created for making model change to skip. 63 * Constant created to be a parameter of a message of an {@link AutoAction}. 64 * Used for skinning. Used in the test. 65 */ 66 public static final String MAKE_MODEL_CHANGE_TO_SKIP = "Make a model change to skip."; 67 68 /** 69 * Constant created for creating a page and frame in it. 70 * Constant created to be a parameter of a message of an {@link AutoAction}. 71 * Used for skinning. Used in the test. 72 */ 73 public static final String CREATE_PAGE_AND_FRAME_IN_IT = "Create a page and frame in it."; 74 75 /** 76 * Constant created for changing page C. 77 * Constant created to be a parameter of a message of an {@link AutoAction}. 78 * Used for skinning. Used in the test. 79 */ 80 public static final String CHANGES_PAGE_C = "Changes page C."; 81 82 /** 83 * Constant created for changing page B. 84 * Constant created to be a parameter of a message of an {@link AutoAction}. 85 * Used for skinning. Used in the test. 86 */ 87 public static final String CHANGES_PAGE_B = "Changes page B."; 88 89 /** 90 * Constant created for creating frame 1 in page C. 91 * Constant created to be a parameter of a message of an {@link AutoAction}. 92 * Used for skinning. Used in the test. 93 */ 94 public static final String CREATE_FRAME_1_IN_PAGE_C = "Create Frame 1 in page C."; 95 96 /** 97 * Constant created for setting up the page C background and border. 98 * Constant created to be a parameter of a message of an {@link AutoAction}. 99 * Used for skinning. Used in the test. 100 */ 101 public static final String SETS_UP_THE_PAGE_C_BACKGROUND_AND_BORDER = "Sets up the page C background and border."; 102 103 /** 104 * Constant created for creating page C. 105 * Constant created to be a parameter of a message of an {@link AutoAction}. 106 * Used for skinning. Used in the test. 107 */ 108 public static final String CREATE_PAGE_C = "Create page C."; 109 110 /** 111 * Constant created for creating page B. 112 * Constant created to be a parameter of a message of an {@link AutoAction}. 113 * Used for skinning. Used in the test. 114 */ 115 public static final String CREATE_PAGE_B = "Create page B."; 116 117 /** 118 * Constant created for creating page A. 119 * Constant created to be a parameter of a message of an {@link AutoAction}. 120 * Used for skinning. Used in the test. 121 */ 122 public static final String CREATE_PAGE_A = "Create page A."; 39 123 private ResourceAccess access; 40 124 private String bookTitle = "Book Title"; 41 125 … … 75 159 76 160 final ResourceRefR4 subRef = ResourceRefR4.makeChild("Page A"); 77 161 78 new AutoAction( "Create page A.", true) {162 new AutoAction(Message.create(CREATE_PAGE_A), true) { 79 163 @Override 80 164 public void performAuto() { 81 165 getChanger().makeResource(subRef); … … 87 171 }.register(this.access); 88 172 89 173 final ResourceRefR4 subRefB = ResourceRefR4.makeChild("Page B"); 90 new AutoAction( "Create page B.", true) {174 new AutoAction(Message.create(CREATE_PAGE_B), true) { 91 175 @Override 92 176 public void performAuto() { 93 177 getChanger().makeResource(subRefB); … … 101 185 RevisionId createPageBRevision = this.access.getHead().getId(); 102 186 103 187 final ResourceRefR4 subRefC = ResourceRefR4.makeChild("Page C"); 104 new AutoAction( "Create page C.", true) {188 new AutoAction(Message.create(CREATE_PAGE_C), true) { 105 189 @Override 106 190 public void performAuto() { 107 191 getChanger().makeResource(subRefC); … … 114 198 ResourceAccess pageAccessC = this.access.open(subRefC, null); 115 199 116 200 final ResourceRefR4 frameRef = ResourceRefR4.makeChild("FRAME_1"); 117 new AutoAction( "Sets up the page C background and border.", true) {201 new AutoAction(Message.create(SETS_UP_THE_PAGE_C_BACKGROUND_AND_BORDER), true) { 118 202 @Override 119 203 public void performAuto() { 120 204 getChanger().setRaw(StyledDummyResource.KEY_BACKGROUND__IMAGE, ResourceRefR4.NONE_REF); … … 126 210 } 127 211 }.register(pageAccessC); 128 212 129 new AutoAction( "Create Frame 1 in page C.", true) {213 new AutoAction(Message.create(CREATE_FRAME_1_IN_PAGE_C), true) { 130 214 @Override 131 215 public void performAuto() { 132 216 getChanger().makeResource(frameRef); … … 134 218 }.register(pageAccessC); 135 219 136 220 ResourceAccess pageAccessB = this.access.open(subRefB, null); 137 new AutoAction( "Changes page B.", true) {221 new AutoAction(Message.create(CHANGES_PAGE_B), true) { 138 222 @Override 139 223 public void performAuto() { 140 224 getChanger().setRaw(StyledDummyResource.KEY_BACKGROUND__COLOR, ImmColor.GRAY); … … 144 228 } 145 229 }.register(pageAccessB); 146 230 147 new AutoAction( "Changes page C.", true) {231 new AutoAction(Message.create(CHANGES_PAGE_C), true) { 148 232 @Override 149 233 public void performAuto() { 150 234 getChanger().setRaw(StyledDummyResource.KEY_BACKGROUND__COLOR, ImmColor.ORANGE); … … 195 279 private void registerSkipChange(ImmList<RevisionId> revToSkip) { 196 280 MetaChange change = new MetaChange(this.access.getAccessOptions().getUser(), 197 281 this.access.getAccessOptions().getViewId(), 198 "skip", MetaChangeType.SKIP, revToSkip);282 Message.create(SKIP), MetaChangeType.SKIP, revToSkip); 199 283 200 284 this.access.registerChange(change); 201 285 } … … 245 329 final ResourceRefR4 pageRef = ResourceRefR4.makeChild("PAGE_B"); 246 330 final ResourceRefR4 frameRef = pageRef.sub(ResourceRefR4.makeChild("Frame")); 247 331 final ImmPoint location = new ImmPoint(200.0f, 200.0f); 248 new AutoAction( "Create a page and frame in it.", true) {332 new AutoAction(Message.create(CREATE_PAGE_AND_FRAME_IN_IT), true) { 249 333 @Override 250 334 public void performAuto() { 251 335 getChanger().makeResource(pageRef); … … 266 350 } 267 351 revToSkip.add(moveFrameDown(frameAccess, true)); 268 352 269 new AutoAction( "Make an model change to skip.", true) {353 new AutoAction(Message.create(MAKE_MODEL_CHANGE_TO_SKIP), true) { 270 354 @Override 271 355 public void performAuto() { 272 356 getChanger().setRaw(StyledDummyResource.KEY_BACKGROUND__COLOR, ImmColor.ORANGE); … … 280 364 281 365 private RevisionId moveFrameDown(ResourceAccess frameAccess, boolean isSignificant) { 282 366 283 new AutoAction( "Move the frame down.", isSignificant) {367 new AutoAction(Message.create(MOVE_THE_FRAME_DOWN), isSignificant) { 284 368 @Override 285 369 public void performAuto() { 286 370 final ImmPoint currentLocation = getChanger().getRaw( … … 313 397 } 314 398 315 399 private RevisionId changeTitle(final String titleToSet) { 316 new AutoAction( "Set the book title", true) {400 new AutoAction(Message.create(SET_THE_BOOK_TITLE), true) { 317 401 @Override 318 402 public void performAuto() { 319 403 getChanger().setRaw(ResourceR4.KEY_TITLE, titleToSet); -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/frame/FrameHalosLogic.java
14 14 import org.sophie2.base.model.resources.r4.changes.AutoAction; 15 15 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 16 16 import org.sophie2.base.model.resources.r4.resources.ResourceH; 17 import org.sophie2.base.skins.Message; 17 18 import org.sophie2.base.visual.VisualElement; 18 19 import org.sophie2.core.modularity.SortKey; 19 20 import org.sophie2.core.mvc.EventFilterBuilder; … … 52 53 ResourceAccess access = AppHaloUtil.getSingleFrameView(source).model().get().getAccess(); 53 54 Boolean state = ResourceFrame.KEY_MAIN_RESOURCE.getMode(access) == Mode.USE_TEMPLATE; 54 55 if (!state) { 55 new AutoAction( "Set frame content templating.", true) {56 new AutoAction(Message.create(SET_FRAME_CONTENT_TEMPLATING), true) { 56 57 @Override 57 58 public void performAuto() { 58 59 getChanger().setRaw(ResourceFrame.KEY_MAIN_RESOURCE, null); … … 171 172 ElementH parent = parentView.model().get(); 172 173 ResourceRefR4 frameRef = frame.getRef(); 173 174 ResourceRefR4 elementRef = frameRef.getThisChildRef(); 174 parent.removeSubElement(elementRef, "Delete frame", true);175 parent.removeSubElement(elementRef, Message.create(DELETE_FRAME), true); 175 176 return true; 176 177 } 177 178 178 179 }; 179 180 180 181 /** 182 * Constant created for deleting a frame. 183 * Constant created to be a parameter of a message of an {@link AutoAction}. 184 * Used for skinning. 185 */ 186 public static final String DELETE_FRAME = "Delete frame"; 187 188 /** 189 * Constant created for changing frame z order. 190 * Constant created to be a parameter of a message of an {@link AutoAction}. 191 * Used for skinning. 192 */ 193 public static final String CHANGE_FRAME_Z_ORDER = "Change frame zOrder"; 194 195 /** 196 * Constant created for setting frame content templating. 197 * Constant created to be a parameter of a message of an {@link AutoAction}. 198 * Used for skinning. 199 */ 200 public static final String SET_FRAME_CONTENT_TEMPLATING = "Set frame content templating."; 201 202 /** 181 203 * Changes the zOrder of the currently selected frame. 182 204 * 183 205 * Note that groups are treated as single elements, i.e. if you increase the … … 224 246 final ImmList<ActivationChannel> newChannels = 225 247 channels.remove(index).add(newIndex, channel); 226 248 227 new AutoAction( "Change frame zOrder", true) {249 new AutoAction(Message.create(CHANGE_FRAME_Z_ORDER), true) { 228 250 229 251 @Override 230 252 public void performAuto() { -
modules/org.sophie2.main.func.text/src/main/java/org/sophie2/main/func/text/view/HotTextLogic.java
27 27 import org.sophie2.base.model.text.smart.highlight.HotHighlight; 28 28 import org.sophie2.base.model.text.smart.position.HotInterval; 29 29 import org.sophie2.base.model.text.smart.style.HotStyleDef; 30 import org.sophie2.base.skins.Message; 30 31 import org.sophie2.base.visual.BaseVisualElement; 31 32 import org.sophie2.base.visual.VisualElement; 32 33 import org.sophie2.core.modularity.SortKey; … … 86 87 Change lastChange = model.getAccess().getHead().getLastChange(); 87 88 if ( lastChange != null && 88 89 !lastChange.isSignificant() ) { 89 new AutoAction( "Set text", true) {90 new AutoAction(Message.create(SET_TEXT), true) { 90 91 91 92 @Override 92 93 public void performAuto() { … … 96 97 } 97 98 significant = true; 98 99 } 99 new AutoAction( "Set text", significant) {100 new AutoAction(Message.create(SET_TEXT), significant) { 100 101 101 102 @Override 102 103 public void performAuto() { … … 346 347 }; 347 348 348 349 /** 350 * Constant created for setting text. 351 * Constant created to be a parameter of a message of an {@link AutoAction}. 352 * Used for skinning. 353 */ 354 public static final String SET_TEXT = "Set text"; 355 /** 349 356 * The color used to higlight search results. 350 357 */ 351 358 static final ImmColor SEARCH_HIGHLIGHT_COLOR = new ImmColor(1.0f, 1.0f, 0f, 0.2f); -
modules/org.sophie2.extra.func.browser/src/main/java/org/sophie2/extra/func/browser/flash/view/FlashLogic.java
18 18 import org.sophie2.base.model.resources.r4.ResourceUtil; 19 19 import org.sophie2.base.model.resources.r4.changes.AutoAction; 20 20 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 21 import org.sophie2.base.skins.Message; 21 22 import org.sophie2.core.mvc.EventFilterBuilder; 22 23 import org.sophie2.core.mvc.OperationDef; 23 24 import org.sophie2.core.mvc.events.EventR3; … … 66 67 67 68 final String frameTitle = 68 69 ResourceUtil.getNextTitle(bv.getAccess().getRef(), FrameR4.DEFAULT_TITLE); 69 new AutoAction( "Insert a flash frame.", true) {70 new AutoAction(Message.create(INSERT_A_FLASH_FRAME), true) { 70 71 71 72 @Override 72 73 public void performAuto() { … … 105 106 FlashFrameView flashView = workArea.getSel().getSingleSelected( 106 107 FlashFrameView.class); 107 108 108 new AutoAction( "Change flash URL", true) {109 new AutoAction(Message.create(CHANGE_FLASH_URL), true) { 109 110 110 111 @Override 111 112 public void performAuto() { … … 118 119 }; 119 120 120 121 /** 122 * Constant created for changing the URL of a flash. 123 * Constant created to be a parameter of a message of an {@link AutoAction}. 124 * Used for skinning. 125 */ 126 public static final String CHANGE_FLASH_URL = "Change flash URL"; 127 128 /** 129 * Constant created for inserting a flash frame. 130 * Constant created to be a parameter of a message of an {@link AutoAction}. 131 * Used for skinning. 132 */ 133 public static final String INSERT_A_FLASH_FRAME = "Insert a flash frame."; 134 135 /** 121 136 * Method that creates a file dialog to select a new url to flash file and 122 137 * returns that url. 123 138 * -
modules/org.sophie2.main.app.menus/src/test/java/org/sophie2/main/app/menus/WindowMenuTest.java
14 14 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 15 15 import org.sophie2.base.natlib.BaseNatlibModule; 16 16 import org.sophie2.base.skins.BaseSkinsModule; 17 import org.sophie2.base.skins.Message; 17 18 import org.sophie2.base.visual.BaseVisualModule; 18 19 import org.sophie2.core.modularity.CoreModularityModule; 19 20 import org.sophie2.core.modularity.SophieModule; … … 35 36 */ 36 37 public class WindowMenuTest extends AppTestBase { 37 38 39 /** 40 * Constant created for setting book title. 41 * Constant created to be a parameter of a message of an {@link AutoAction}. 42 * Used for skinning. Used in the test. 43 */ 44 public static final String SET_BOOK_TITLE = "Set book title"; 38 45 private BookH book; 39 46 40 47 @Override … … 88 95 @Test 89 96 public void testShortTitle() { 90 97 final String title = TITLE_BASE; 91 new AutoAction( "Set book title", true) {98 new AutoAction(Message.create(SET_BOOK_TITLE), true) { 92 99 93 100 @Override 94 101 public void performAuto() { … … 107 114 @Test 108 115 public void testLongTitle() { 109 116 final String title = TITLE_BASE + TITLE_BASE + TITLE_BASE + TITLE_BASE; 110 new AutoAction( "Set book title", true) {117 new AutoAction(Message.create(SET_BOOK_TITLE), true) { 111 118 112 119 @Override 113 120 public void performAuto() { -
modules/org.sophie2.extra.comment/src/main/java/org/sophie2/extra/comment/logic/CommentHudLogic.java
4 4 import org.sophie2.base.model.book.interfaces.ResourceFrame; 5 5 import org.sophie2.base.model.resources.r4.ResourceRefR4; 6 6 import org.sophie2.base.model.resources.r4.changes.AutoAction; 7 import org.sophie2.base.skins.Message; 7 8 import org.sophie2.core.logging.SophieLog; 8 9 import org.sophie2.core.mvc.EventFilterBuilder; 9 10 import org.sophie2.core.mvc.OperationDef; … … 53 54 if (streamRef != null) { 54 55 final ResourceRefR4 ref = streamRef; 55 56 56 new AutoAction( "Set comment stream ref", true) {57 new AutoAction(Message.create(SET_COMMENT_STREAM_REF), true) { 57 58 58 59 @Override 59 60 public void performAuto() { … … 65 66 66 67 return true; 67 68 } 68 } 69 }; 70 71 /** 72 * Constant created for setting a comment stream reference. 73 * Constant created to be a parameter of a message of an {@link AutoAction}. 74 * Used for skinning. 75 */ 76 public static final String SET_COMMENT_STREAM_REF = "Set comment stream ref"; 69 77 } -
modules/org.sophie2.extra.func.scripting/src/main/java/org/sophie2/extra/func/scripting/logic/ScriptingLogic.java
16 16 import org.sophie2.base.model.resources.r4.ResourceRefR4; 17 17 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 18 18 import org.sophie2.base.model.resources.r4.changes.AutoAction; 19 import org.sophie2.base.skins.Message; 19 20 import org.sophie2.core.modularity.SortKey; 20 21 import org.sophie2.core.mvc.EventFilterBuilder; 21 22 import org.sophie2.core.mvc.OperationDef; … … 63 64 final ResourceRefR4 scriptRef = 64 65 ResourceRefR4.generateRandomSub(ScriptResourceH.NAME_PREFIX); 65 66 66 new AutoAction( "Insert script", true) {67 new AutoAction(Message.create(INSERT_SCRIPT), true) { 67 68 68 69 @Override 69 70 public void performAuto() { … … 161 162 return false; 162 163 } 163 164 164 new AutoAction( "Insert script from a file", true) {165 new AutoAction(Message.create(INSERT_SCRIPT_FROM_A_FILE), true) { 165 166 166 167 @Override 167 168 public void performAuto() { … … 192 193 193 194 final String newText = window.textArea().get().getText(); 194 195 if (!resource.getScriptText().equals(newText)) { 195 new AutoAction( "Edit Script", true) {196 new AutoAction(Message.create(EDIT_SCRIPT), true) { 196 197 197 198 @Override 198 199 public void performAuto() { … … 276 277 return true; 277 278 } 278 279 }; 280 281 /** 282 * Constant created for editting a script. 283 * Constant created to be a parameter of a message of an {@link AutoAction}. 284 * Used for skinning. 285 */ 286 public static final String EDIT_SCRIPT = "Edit Script"; 287 288 /** 289 * Constant created for inserting a script. 290 * Constant created to be a parameter of a message of an {@link AutoAction}. 291 * Used for skinning. 292 */ 293 public static final String INSERT_SCRIPT = "Insert script"; 294 295 /** 296 * Constant created for inserting a script from a file. 297 * Constant created to be a parameter of a message of an {@link AutoAction}. 298 * Used for skinning. 299 */ 300 public static final String INSERT_SCRIPT_FROM_A_FILE = "Insert script from a file"; 279 301 } -
modules/org.sophie2.server.webui/src/main/java/org/sophie2/server/webui/handlers/EditProfileHandler.java
18 18 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 19 19 import org.sophie2.base.model.security.UserH; 20 20 import org.sophie2.base.model.security.UserR4; 21 import org.sophie2.base.skins.Message; 21 22 import org.sophie2.server.core.ServerResourceHelper; 22 23 import org.sophie2.server.webapp.RequestUtils; 23 24 import org.sophie2.server.webui.BaseHandlerSupport; … … 36 37 public class EditProfileHandler extends BaseHandlerSupport { 37 38 38 39 /** 40 * Constant created for editing user info. 41 * Constant created to be a parameter of a message of an {@link AutoAction}. 42 * Used for skinning. 43 */ 44 public static final String EDIT_USER_INFO = "Edit user info"; 45 /** 39 46 * Default serial version ID. 40 47 */ 41 48 private static final long serialVersionUID = 1L; … … 98 105 99 106 final String screenName = context.getRequestParameter("screenName"); 100 107 final boolean changedName = !userH.getTitle().equals(screenName); 101 new AutoAction( "Edit user info", true) {108 new AutoAction(Message.create(EDIT_USER_INFO), true) { 102 109 @Override 103 110 public void performAuto() { 104 111 ResourceChanger changer = getChanger(); -
modules/org.sophie2.main.func.text/src/main/java/org/sophie2/main/func/text/chaining/TextChainingLogic.java
22 22 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 23 23 import org.sophie2.base.model.text.smart.ImmHotText; 24 24 import org.sophie2.base.model.text.smart.position.HotInterval; 25 import org.sophie2.base.skins.Message; 25 26 import org.sophie2.core.modularity.SortKey; 26 27 import org.sophie2.core.mvc.EventFilterBuilder; 27 28 import org.sophie2.core.mvc.OperationDef; … … 78 79 ChainHudElement element = input.getSelectedItem(); 79 80 if (ChainHudElement.NO_CHAINING_ELEM.equals(element)) { 80 81 if (!ChainingMode.NO_CHAINING.equals(headH.getChainMode())) { 81 new AutoAction( "Turn-off chaining", true) {82 new AutoAction(Message.create(TURN_OFF_CHAINING), true) { 82 83 @Override 83 84 public void performAuto() { 84 85 getChanger().setRaw(TextTemplateR4.KEY_CHAIN_MODE, ChainingMode.NO_CHAINING); … … 88 89 res = true; 89 90 } else if (ChainHudElement.AUTO_CHAIN_ELEM.equals(element)) { 90 91 if (!ChainingMode.AUTO_CHAINING.equals(headH.getChainMode())) { 91 new AutoAction( "Start auto-chaining", true) {92 new AutoAction(Message.create(START_AUTO_CHAINING), true) { 92 93 @Override 93 94 public void performAuto() { 94 95 getChanger().setRaw(TextTemplateR4.KEY_CHAIN_MODE, ChainingMode.AUTO_CHAINING); … … 234 235 }; 235 236 236 237 /** 238 * Constant created for starting auto chaining. 239 * Constant created to be a parameter of a message of an {@link AutoAction}. 240 * Used for skinning. 241 */ 242 public static final String START_AUTO_CHAINING = "Start auto-chaining"; 243 244 /** 245 * Constant created for turning off chaining. 246 * Constant created to be a parameter of a message of an {@link AutoAction}. 247 * Used for skinning. 248 */ 249 public static final String TURN_OFF_CHAINING = "Turn-off chaining"; 250 251 /** 252 * Constant created for chaining text frame. 253 * Constant created to be a parameter of a message of an {@link AutoAction}. 254 * Used for skinning. 255 */ 256 public static final String CHAIN_TEXT_FRAME = "Chain text frame"; 257 258 /** 259 * Constant created for combining text of chained frames. 260 * Constant created to be a parameter of a message of an {@link AutoAction}. 261 * Used for skinning. 262 */ 263 public static final String COMBINE_TEXT_OF_CHAINED_FRAMES = "Combine text of chained frames"; 264 265 /** 266 * Constant created for updating head references. 267 * Constant created to be a parameter of a message of an {@link AutoAction}. 268 * Used for skinning. 269 */ 270 public static final String UPDATE_HEAD_REFERENCES = "Update head references"; 271 272 /** 273 * Constant created for splitting text chain. 274 * Constant created to be a parameter of a message of an {@link AutoAction}. 275 * Used for skinning. 276 */ 277 public static final String SPLIT_TEXT_CHAIN = "Split text chain"; 278 279 /** 237 280 * Chains a text frame at the specified offset after the given view. 238 281 * 239 282 * @param prevView … … 291 334 mergeChains(chainedFramesMap, bookRef, headFrameRef, chainOrder, bookAccess); 292 335 } 293 336 294 new AutoAction( "Chain text frame", significant) {337 new AutoAction(Message.create(CHAIN_TEXT_FRAME), significant) { 295 338 296 339 @Override 297 340 public void performAuto() { … … 329 372 final ResourceRefR4 newTextRef = ResourceRefR4.generateRandomSub(HotTextResourceR4.KIND); 330 373 final String newTextTitle = ResourceUtil.getNextTitle(bookRef, HotTextResourceR4.DEFAULT_TITLE); 331 374 final ImmHotText textToSet = firstFrameText.replace(interval, secondFrameText); 332 new AutoAction( "Combine text of chained frames", false) {375 new AutoAction(Message.create(COMBINE_TEXT_OF_CHAINED_FRAMES), false) { 333 376 334 377 @Override 335 378 public void performAuto() { … … 349 392 final ResourceRefR4 bookRef, final ResourceRefR4 headFrameRef, 350 393 final String chainOrder, ResourceAccess bookAccess) { 351 394 352 new AutoAction( "Update head references", false) {395 new AutoAction(Message.create(UPDATE_HEAD_REFERENCES), false) { 353 396 @Override 354 397 public void performAuto() { 355 398 for (ImmEntry<ResourceRefR4, String> entry : chainedFrames.asList()) { … … 454 497 newTitle = ""; //This is not needed but the compiler doesn't understand it 455 498 newTextRef = headHelper.getMainResource().getThisChildRef(); 456 499 } 457 new AutoAction( "Split text chain", isSign) {500 new AutoAction(Message.create(SPLIT_TEXT_CHAIN), isSign) { 458 501 459 502 @Override 460 503 public void performAuto() { -
modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/book/panels/BookPanelLogic.java
7 7 import org.sophie2.base.model.book.BookH; 8 8 import org.sophie2.base.model.resources.r4.changes.AutoAction; 9 9 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 10 import org.sophie2.base.skins.Message; 10 11 import org.sophie2.core.logging.SophieLog; 11 12 import org.sophie2.core.modularity.SortKey; 12 13 import org.sophie2.core.mvc.EventFilterBuilder; … … 256 257 BookH clone = docView.model().get().clone(mainWindow.locator().get()); 257 258 final String newTitle = BookH.PREVIEW_TITLE_PREFIX + clone.getTitle(); 258 259 259 new AutoAction( "Update preview", false) {260 new AutoAction(Message.create(UPDATE_PREVIEW), false) { 260 261 261 262 @Override 262 263 public void performAuto() { … … 317 318 }; 318 319 319 320 /** 321 * Constant created for updating a preview. 322 * Constant created to be a parameter of a message of an {@link AutoAction}. 323 * Used for skinning. 324 */ 325 public static final String UPDATE_PREVIEW = "Update preview"; 326 327 /** 320 328 * Goes to a page with a given index if possible. 321 329 * 322 330 * @param bookView -
modules/org.sophie2.extra.func.scripting/src/main/java/org/sophie2/extra/func/scripting/facade/JSPage.java
9 9 import org.sophie2.base.model.book.PageH; 10 10 import org.sophie2.base.model.resources.r4.ResourceRefR4; 11 11 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 12 import org.sophie2.base.model.resources.r4.changes.AutoAction; 12 13 import org.sophie2.base.model.text.smart.ImmHotText; 14 import org.sophie2.base.skins.Message; 13 15 import org.sophie2.main.app.commons.book.BookDocView; 14 16 import org.sophie2.main.app.commons.frame.FrameView; 15 17 import org.sophie2.main.app.commons.page.RootPageView; … … 23 25 */ 24 26 public class JSPage extends BaseJSAdapter<RootPageView> { 25 27 28 /** 29 * Constant created for expressing that frame is created using scripting. 30 * Constant created to be a parameter of a message of an {@link AutoAction}. 31 * Used for skinning. 32 */ 33 public static final String SCRIPTING_CREATE_FRAME = "Scripting: Create frame"; 34 35 /** 36 * Constant created for expressing that frame is deleted using scripting. 37 * Constant created to be a parameter of a message of an {@link AutoAction}. 38 * Used for skinning. 39 */ 40 public static final String SCRIPTING_DELETE_FRAME = "Scripting: Delete frame"; 41 26 42 private static final long serialVersionUID = 8411359364027540572L; 27 43 28 44 /** … … 114 130 ImmHotText hotText = ImmHotText.createPlain(frameText); 115 131 116 132 HeadTextFrameH.createTextFrameAction(book, page, hotText, ResourceRefR4.NONE_REF.toUri(), 117 null, "Scripting: Create frame", false);133 null, Message.create(SCRIPTING_CREATE_FRAME), false); 118 134 119 135 JSFrame result = (JSFrame) Context.getCurrentContext().newObject( 120 136 getParentScope(), JSFrame.CLASS_NAME); … … 135 151 public void jsFunction_removeFrame(JSFrame jsFrame) { 136 152 FrameView frameView = jsFrame.getAdaptedObject(); 137 153 ResourceRefR4 ref = frameView.model().get().getRef(); 138 getAdaptedObject().model().get().removeSubElement(ref, "Scripting: Delete frame", false);154 getAdaptedObject().model().get().removeSubElement(ref, Message.create(SCRIPTING_DELETE_FRAME), false); 139 155 } 140 156 141 157 } -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/appearance/BackgroundColorField.java
8 8 import org.sophie2.base.model.resources.r4.changes.AutoAction; 9 9 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 10 10 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 11 import org.sophie2.base.skins.Message; 11 12 import org.sophie2.base.visual.BaseVisualElement; 12 13 import org.sophie2.base.visual.VisualElement; 13 14 import org.sophie2.base.visual.skins.ElementSkinPart; … … 95 96 96 97 assert input != null; 97 98 98 new AutoAction( "Change background color", true) {99 new AutoAction(Message.create(BG_COLOR), true) { 99 100 @Override 100 101 public void performAuto() { 101 102 ResourceChanger changer = getChanger(); … … 110 111 111 112 } 112 113 } 114 115 /** 116 * Constant created for changing background color. 117 * Constant created to be a parameter of a message of an {@link AutoAction}. 118 * Used for skinning. 119 */ 120 public static final String BG_COLOR = "Change background color"; 113 121 } -
modules/org.sophie2.main.func.templates/src/main/java/org/sophie2/main/func/templates/frame/FrameTemplateLogic.java
16 16 import org.sophie2.base.model.resources.r4.changes.AutoAction; 17 17 import org.sophie2.base.model.resources.r4.resources.ResourceH; 18 18 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 19 import org.sophie2.base.skins.Message; 19 20 import org.sophie2.core.logging.SophieLog; 20 21 import org.sophie2.core.modularity.SortKey; 21 22 import org.sophie2.core.mvc.EventFilterBuilder; … … 185 186 186 187 String frameTitle = ResourceR4.KEY_TITLE.get(bookDocView.getAccess().open(template, null)); 187 188 if (TemplatePaletteUtil.confirmDeletion(frameTitle, bookDocView.swingComponent().get())) { 188 new AutoAction( "Delete frame template.", true) {189 new AutoAction(Message.create(DELETE_FRAME_TEMPLATE), true) { 189 190 190 191 @Override 191 192 public void performAuto() { … … 201 202 } 202 203 203 204 }; 204 205 206 /** 207 * Constant created for deleting frame template. 208 * Constant created to be a parameter of a message of an {@link AutoAction}. 209 * Used for skinning. 210 */ 211 public static final String DELETE_FRAME_TEMPLATE = "Delete frame template."; 205 212 } -
modules/org.sophie2.main.func.text/src/main/java/org/sophie2/main/func/text/view/TextLinksHud.java
12 12 import org.sophie2.base.model.text.mvc.TextViewFlow; 13 13 import org.sophie2.base.model.text.smart.ImmHotText; 14 14 import org.sophie2.base.model.text.smart.position.HotInterval; 15 import org.sophie2.base.skins.Message; 15 16 import org.sophie2.base.skins.SkinElementId; 16 17 import org.sophie2.base.visual.BaseSwingVisualElement; 17 18 import org.sophie2.base.visual.BaseVisualElement; … … 224 225 TextLinksHud hud = event.getSource(TextLinksHud.class); 225 226 Link newLink = event.getEventParam(LinksHudLogic.EventIds.LINK_PARAM_INDEX, Link.class); 226 227 LinkAttachment textLink = LinkAttachment.DEFAULT_LINK_ATTACHMENT.setLink(newLink); 227 String description = event.getEventParam(LinksHudLogic.EventIds.DESCRIPTION_PARAM_INDEX, String.class);228 Message description = event.getEventParam(LinksHudLogic.EventIds.DESCRIPTION_PARAM_INDEX, Message.class); 228 229 229 230 TextFrameView frameView = AppHaloUtil.getSingleSelected(hud, TextFrameView.class); 230 231 TextViewFlow flow = frameView.textFlow().get(); -
modules/org.sophie2.base.model.resources.r4/src/test/java/org/sophie2/base/model/resources/r4/keys/TemplatedResourceRefKeyTest.java
15 15 import org.sophie2.base.model.resources.r4.dummies.helpers.DummyBookHelper; 16 16 import org.sophie2.base.model.resources.r4.dummies.resources.DummyFrame; 17 17 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 18 import org.sophie2.base.skins.Message; 18 19 import org.sophie2.core.logging.LogLevel; 19 20 import org.sophie2.core.logging.SophieLog; 20 21 import org.sophie2.core.modularity.FakeModuleRegistry; … … 27 28 */ 28 29 public class TemplatedResourceRefKeyTest extends UnitTestBase { 29 30 31 /** 32 * Constant created for applying template. 33 * Constant created to be a parameter of a message of an {@link AutoAction}. 34 * Used for skinning. Used in the test. 35 */ 36 public static final String APPLYING_TEMPLATE = "applying template"; 37 38 /** 39 * Constant created for creating resources. 40 * Constant created to be a parameter of a message of an {@link AutoAction}. 41 * Used for skinning. Used in the test. 42 */ 43 public static final String RESOURCES_CREATED = "resources created"; 30 44 private ResourceAccess access; 31 45 32 46 @SuppressWarnings("unchecked") … … 74 88 final ResourceRefR4 frameToTemplate = ResourceRefR4.getRelativeRef(page.sub(frame), template); 75 89 final ResourceRefR4 templateToImage = ResourceRefR4.getRelativeRef(template, image); 76 90 77 new AutoAction( "resources created", true) {91 new AutoAction(Message.create(RESOURCES_CREATED), true) { 78 92 @Override 79 93 public void performAuto() { 80 94 getChanger().makeResource(page); … … 92 106 93 107 assertEquals(ResourceRefR4.NONE_REF, mainResource1); 94 108 95 new AutoAction( "applying template", true) {109 new AutoAction(Message.create(APPLYING_TEMPLATE), true) { 96 110 @Override 97 111 public void performAuto() { 98 112 getChanger().setRaw(ResourceR4.KEY_TEMPLATE, frameToTemplate); -
modules/org.sophie2.base.connectivity/src/main/java/org/sophie2/base/connectivity/resources/binary/ServerBinaryModifier.java
21 21 import org.sophie2.base.model.resources.r4.keys.Key; 22 22 import org.sophie2.base.model.resources.r4.keys.RootKey; 23 23 import org.sophie2.base.model.resources.r4.model.ResourceModel; 24 import org.sophie2.base.skins.Message; 24 25 25 26 /** 26 27 * Modifies writes containing {@link BinData} from the server, … … 177 178 178 179 return new ModelChange(old.getChangeScope(), 179 180 old.getUser(), old.getViewId(), 180 old.getDescription(), old.isSignificant(),181 Message.create(old.getDescription()), old.isSignificant(), 181 182 old.getActionClass(), newFields); 182 183 } 183 184 -
modules/org.sophie2.main.func.text/src/main/java/org/sophie2/main/func/text/model/HeadTextFrameH.java
22 22 import org.sophie2.base.model.resources.r4.changes.SubResourceChanger; 23 23 import org.sophie2.base.model.resources.r4.resources.ResourceH; 24 24 import org.sophie2.base.model.text.smart.ImmHotText; 25 import org.sophie2.base.skins.Message; 25 26 import org.sophie2.main.func.text.chaining.ChainingMode; 26 27 import org.sophie2.main.func.text.view.ChainManager; 27 28 … … 33 34 public class HeadTextFrameH extends TextFrameH { 34 35 35 36 /** 37 * Constant created for inserting text frame. 38 * Constant created to be a parameter of a message of an {@link AutoAction}. 39 * Used for skinning. 40 */ 41 public static final String INSERT_TEXT_FRAME = "Insert text frame"; 42 43 /** 36 44 * A constructor with {@link ResourceAccess}. 37 45 * 38 46 * @param access … … 132 140 */ 133 141 public static ResourceRefR4 createTextFrameAction(BookH book, ElementH parent, 134 142 final ImmHotText text, final URI importOrigin, ImmPoint importPosition, 135 StringactionDescription, boolean significant) {143 Message actionDescription, boolean significant) { 136 144 137 145 ResourceRefR4 bookRef = book.getRef(); 138 146 final ResourceRefR4 parentRef = ResourceRefR4.getRelativeRef(bookRef, parent.getRef()); … … 198 206 book.getAccess().getRef(), HotTextResourceR4.DEFAULT_TITLE); 199 207 200 208 final ImmHotText hotText = ImmHotText.createPlain(text); 201 new AutoAction( "Insert text frame", true) {209 new AutoAction(Message.create(INSERT_TEXT_FRAME), true) { 202 210 203 211 @Override 204 212 public void performAuto() { -
modules/org.sophie2.base.connectivity/src/main/java/org/sophie2/base/connectivity/resources/ResourceDirectoryH.java
22 22 import org.sophie2.base.model.resources.r4.model.ResourceRevision; 23 23 import org.sophie2.base.model.resources.r4.resources.ResourceH; 24 24 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 25 import org.sophie2.base.skins.Message; 25 26 26 27 /** 27 28 * Helper class for {@link ResourceDirectoryR4} resources. … … 197 198 final ResourceRefR4 childRef = ResourceRefR4.makeChild(name); 198 199 final ResourceRefList subDirectories = parent.getResources(); 199 200 ResourceAccess parentAccess = parent.getAccess(); 200 new AutoAction( "Create " + name + " directory.", true) {201 new AutoAction(Message.create(CREATE_DIR, name), true) { 201 202 @Override 202 203 public void performAuto() { 203 204 ResourceDirectoryH.addSubDirectory(getChanger(), childRef, … … 208 209 return ResourceH.getHelper(parentAccess.open(childRef, null), 209 210 ResourceDirectoryH.class); 210 211 } 212 213 /** 214 * Constant created for creating a directory by name. 215 * Constant created to be a parameter of a message of an {@link AutoAction}. 216 * Used for skinning. 217 */ 218 public static final String CREATE_DIR = "Create %1$s directory."; 211 219 212 220 private static final <T extends ResourceH> T createResource( 213 221 ResourceDirectoryH directory, String name, String kind, … … 220 228 final ResourceRefR4 childRef = ResourceRefR4.makeChild(name); 221 229 final ResourceRefList resources = directory.getResources(); 222 230 ResourceAccess directoryAccess = directory.getAccess(); 223 new AutoAction("Create " + name + " as " + kind + " resource in " 224 + directory.getName() + ".", true) { 231 new AutoAction(Message.create(CREATE_RES, name, kind, directory.getName()), true) { 225 232 @Override 226 233 public void performAuto() { 227 234 ResourceDirectoryH.addResource(getChanger(), childRef, … … 233 240 helperClass); 234 241 return helper; 235 242 } 243 244 /** 245 * Constant created for creating a resource. 246 * Constant created to be a parameter of a message of an {@link AutoAction}. 247 * Used for skinning. Used in the test. 248 */ 249 public static final String CREATE_RES = "Create %1$s as %2$s resource in %3$s."; 236 250 237 251 /** 238 252 * Helper method which will be removed. Creates a resource in a server … … 279 293 final ResourceRefR4 childRef = ResourceRefR4.makeChild(name); 280 294 final ResourceRefList resources = directory.getResources(); 281 295 ResourceAccess directoryAccess = directory.getAccess(); 282 new AutoAction("Create " + name + " resource in " 283 + directory.getName() + ".", true) { 296 new AutoAction(Message.create(CREATE_RES_IN_DIR, name, directory.getName()), true) { 284 297 @Override 285 298 public void performAuto() { 286 299 ResourceDirectoryH.addResource(getChanger(), childRef, … … 291 304 } 292 305 293 306 /** 307 * Constant created for creating a resource in a directory. 308 * Constant created to be a parameter of a message of an {@link AutoAction}. 309 * Used for skinning. Used in the test. 310 */ 311 public static final String CREATE_RES_IN_DIR = "Create %1$s resource in %2$s."; 312 313 /** 294 314 * Registers action on a directory access which deletes a resource from that 295 315 * directory. 296 316 * @param directoryAccess … … 306 326 } 307 327 final ResourceRefList curResources = 308 328 ResourceDirectoryR4.KEY_RESOURCES.get(directoryAccess); 309 new AutoAction( "Delete " + resourceRef.getName(), true) {329 new AutoAction(Message.create(DELETE_RES, resourceRef.getName()), true) { 310 330 @Override 311 331 public void performAuto() { 312 332 ResourceDirectoryH.removeResource( … … 315 335 }.register(directoryAccess); 316 336 } 317 337 338 /** 339 * Constant created for deleting a resource. 340 * Constant created to be a parameter of a message of an {@link AutoAction}. 341 * Used for skinning. 342 */ 343 public static final String DELETE_RES = "Delete %1$s"; 318 344 } -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/appearance/BackgroundGradientField.java
11 11 import org.sophie2.base.model.resources.r4.changes.AutoAction; 12 12 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 13 13 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 14 import org.sophie2.base.skins.Message; 14 15 import org.sophie2.base.visual.BaseVisualElement; 15 16 import org.sophie2.base.visual.VisualElement; 16 17 import org.sophie2.base.visual.skins.ElementSkinPart; … … 80 81 source, AppearanceHud.class); 81 82 final ResourceAccess access = hud.access().get(); 82 83 final ImmGradient input = event.getEventParam(EventIds.GRADIENT_PARAM_INDEX, ImmGradient.class); 83 new AutoAction( "Change background gradient", true) {84 new AutoAction(Message.create(BG_GRADIENT), true) { 84 85 @Override 85 86 public void performAuto() { 86 87 ResourceChanger changer = getChanger(); … … 95 96 96 97 } 97 98 } 99 100 /** 101 * Constant created for changing background gradient. 102 * Constant created to be a parameter of a message of an {@link AutoAction}. 103 * Used for skinning. 104 */ 105 public final static String BG_GRADIENT = "Change background gradient"; 98 106 } -
modules/org.sophie2.main.app.commons/src/test/java/org/sophie2/main/app/commons/logic/BookWindowOperationTest.java
17 17 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 18 18 import org.sophie2.base.natlib.BaseNatlibModule; 19 19 import org.sophie2.base.skins.BaseSkinsModule; 20 import org.sophie2.base.skins.Message; 20 21 import org.sophie2.base.visual.BaseVisualModule; 21 22 import org.sophie2.core.modularity.SophieModule; 22 23 import org.sophie2.core.mvc.CoreMvcModule; … … 38 39 */ 39 40 public class BookWindowOperationTest extends AppTestBase { 40 41 42 /** 43 * Constant created for setting book title using scripting. 44 * Constant created to be a parameter of a message of an {@link AutoAction}. 45 * Used for skinning. 46 */ 47 public static final String SCRIPTING_SET_BOOK_TITLE = "Scripting: Set book title"; 41 48 private BookDocView bdw; 42 49 43 50 @Override … … 103 110 */ 104 111 @Test 105 112 public void testModifiedBookClosed() { 106 new AutoAction( "Scripting: Set book title", false) {113 new AutoAction(Message.create(SCRIPTING_SET_BOOK_TITLE), false) { 107 114 108 115 @Override 109 116 public void performAuto() { -
modules/org.sophie2.server.webui/src/main/java/org/sophie2/server/webui/handlers/RegisterHandler.java
15 15 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 16 16 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 17 17 import org.sophie2.base.model.security.UserR4; 18 import org.sophie2.base.skins.Message; 18 19 import org.sophie2.server.core.ServerResourceHelper; 19 20 import org.sophie2.server.webapp.RequestUtils; 20 21 import org.sophie2.server.webui.BaseHandlerSupport; … … 32 33 public class RegisterHandler extends BaseHandlerSupport { 33 34 34 35 /** 36 * Constant created for making a new user. 37 * Constant created to be a parameter of a message of an {@link AutoAction}. 38 * Used for skinning. 39 */ 40 public static final String MAKE_NEW_USER = "Make a new user"; 41 /** 35 42 * The serial version UID of this class. 36 43 */ 37 44 private static final long serialVersionUID = 1L; … … 107 114 } 108 115 109 116 final ResourceRefR4 userRef = ResourceRefR4.makeChild(userName); 110 new AutoAction( "Make a new user", true) {117 new AutoAction(Message.create(MAKE_NEW_USER), true) { 111 118 112 119 @Override 113 120 public void performAuto() { -
modules/org.sophie2.main.func.text/src/main/java/org/sophie2/main/func/text/utils/TextChainUtils.java
30 30 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 31 31 import org.sophie2.base.model.text.mvc.TextViewFlow; 32 32 import org.sophie2.base.model.text.smart.ImmHotText; 33 import org.sophie2.base.skins.Message; 33 34 import org.sophie2.main.app.commons.book.BookView; 34 35 import org.sophie2.main.app.commons.element.ElementView; 35 36 import org.sophie2.main.app.commons.frame.FrameView; … … 59 60 public class TextChainUtils { 60 61 61 62 /** 63 * Constant created for changing the head frame's template head reference. 64 * Constant created to be a parameter of a message of an {@link AutoAction}. 65 * Used for skinning. 66 */ 67 public static final String CHANGE_THE_HEAD_FRAME_S_TEMPLATE_HEAD_REF = "Change the head frame's template head ref"; 68 69 /** 70 * Constant created for expanding auto chaining. 71 * Constant created to be a parameter of a message of an {@link AutoAction}. 72 * Used for skinning. 73 */ 74 public static final String EXPAND_AUTO_CHAIN = "Expand auto-chain"; 75 76 /** 77 * Constant created for auto-fitting text flow. 78 * Constant created to be a parameter of a message of an {@link AutoAction}. 79 * Used for skinning. 80 */ 81 public static final String AUTO_FIT_TEXT_FLOW = "Auto-fit text flow."; 82 83 /** 62 84 * Comparator used to order text views of the same chains by their chain order. 63 85 */ 64 86 public static Comparator<TextFrameView> TEXT_VIEW_COMP = new Comparator<TextFrameView>() { … … 157 179 chainMaster.massCnanging().set(false); 158 180 159 181 if (changesMade) { 160 AutoAction.registerEndChange(bookH.getAccess(), "Auto-fit text flow.");182 AutoAction.registerEndChange(bookH.getAccess(), Message.create(AUTO_FIT_TEXT_FLOW)); 161 183 } 162 184 } 163 185 … … 317 339 final ResourceRefList pages = book.getPages(); 318 340 final int lastPageIndex = book.getIndexOf(page.getAccess().getRef()); 319 341 //TODO There is too much similar logic - extract common logic in methods :} 320 new AutoAction( "Expand auto-chain", false) {342 new AutoAction(Message.create(EXPAND_AUTO_CHAIN), false) { 321 343 @Override 322 344 public void performAuto() { 323 345 … … 533 555 ResourceRefR4.getRelativeRef(bookH.getRef(), thisHeadH.getRef()); 534 556 if (ChainingMode.AUTO_CHAINING.equals(thisHeadH.getChainMode())) { 535 557 ResourceAccess frameTemplateAccess = bookH.getAccess().open(frameTemplRef, null); 536 new AutoAction( "Change the head frame's template head ref", false) {558 new AutoAction(Message.create(CHANGE_THE_HEAD_FRAME_S_TEMPLATE_HEAD_REF), false) { 537 559 @Override 538 560 public void performAuto() { 539 561 getChanger().setRaw(ResourceR4.KEY_KIND, TailTextFrameR4.KIND); -
modules/org.sophie2.base.model.book/src/test/java/org/sophie2/base/model/book/resource/r4/InnerAccessTest.java
14 14 import org.sophie2.base.model.resources.r4.changes.AutoAction; 15 15 import org.sophie2.base.model.resources.r4.changes.SubResourceChanger; 16 16 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 17 import org.sophie2.base.skins.Message; 17 18 import org.sophie2.core.testing.UnitTestBase; 18 19 19 20 /** … … 24 25 public class InnerAccessTest extends UnitTestBase{ 25 26 26 27 /** 28 * Constant created for changing frame's background color to pink. 29 * Constant created to be a parameter of a message of an {@link AutoAction}. 30 * Used for skinning. Used in the test. 31 */ 32 public static final String CHANGE_FRAME_S_BACKGROUND_COLOR_TO_PINK = "Change frame's background color to pink"; 33 34 /** 35 * Constant created for changing frame`s background color to green. 36 * Constant created to be a parameter of a message of an {@link AutoAction}. 37 * Used for skinning. Used in the test. 38 */ 39 public static final String CHANGE_FRAME_S_BACKGROUND_COLOR_TO_GREEN = "Change frame`s background color to green"; 40 41 /** 42 * Constant created for creating frame through the page access. 43 * Constant created to be a parameter of a message of an {@link AutoAction}. 44 * Used for skinning. Used in the test. 45 */ 46 public static final String CREATE_FRAME_THROUGH_THE_PAGE_ACCESS = "Create Frame through the page access"; 47 48 /** 49 * Constant created for changing the background color to green. 50 * Constant created to be a parameter of a message of an {@link AutoAction}. 51 * Used for skinning. Used in the test. 52 */ 53 public static final String CHANGE_THE_BACKGROUND_COLOR_TO_GREEN = "Change the background color to Green"; 54 55 /** 27 56 * Tests registering changes through inner accesses. 28 57 */ 29 58 @Test … … 37 66 DelegatingMemAccess pageAccess = (DelegatingMemAccess) access.open(pageA_Ref, null); 38 67 assertEquals(ImmColor.GRAY, pageAccess.getRaw(StyledElement.KEY_BACKGROUND__COLOR)); 39 68 40 new AutoAction( "Change the background color to Green", true) {69 new AutoAction(Message.create(CHANGE_THE_BACKGROUND_COLOR_TO_GREEN), true) { 41 70 @Override 42 71 public void performAuto() { 43 72 getChanger().setRaw(StyledElement.KEY_BACKGROUND__COLOR, ImmColor.GREEN); … … 47 76 assertEquals(ImmColor.GREEN, pageAccess.getRaw(StyledElement.KEY_BACKGROUND__COLOR)); 48 77 49 78 final ResourceRefR4 frame_Ref = ResourceRefR4.make("./NEW_FRAME"); 50 new AutoAction( "Create Frame through the page access", true) {79 new AutoAction(Message.create(CREATE_FRAME_THROUGH_THE_PAGE_ACCESS), true) { 51 80 @Override 52 81 public void performAuto() { 53 82 getChanger().makeResource(frame_Ref); … … 65 94 DelegatingMemAccess frameAccess = (DelegatingMemAccess) access.open(pageA_Ref.append(frame_Ref), null); 66 95 assertEquals(ImmColor.ORANGE, frameAccess.getRaw(StyledElement.KEY_BACKGROUND__COLOR)); 67 96 68 new AutoAction( "Change frame`s background color to green", true) {97 new AutoAction(Message.create(CHANGE_FRAME_S_BACKGROUND_COLOR_TO_GREEN), true) { 69 98 @Override 70 99 public void performAuto() { 71 100 getChanger().setRaw(StyledElement.KEY_BACKGROUND__COLOR, ImmColor.GREEN); … … 75 104 76 105 // Inner access with parent - inner access 77 106 DelegatingMemAccess frameAccess2 = (DelegatingMemAccess) pageAccess.open(frame_Ref, null); 78 new AutoAction( "Change frame's background color to pink", true) {107 new AutoAction(Message.create(CHANGE_FRAME_S_BACKGROUND_COLOR_TO_PINK), true) { 79 108 @Override 80 109 public void performAuto() { 81 110 getChanger().setRaw(StyledElement.KEY_BACKGROUND__COLOR, ImmColor.PINK); -
modules/org.sophie2.main.app.layout/src/main/java/org/sophie2/main/app/layout/left/pages/PageReorderHandler.java
5 5 import org.sophie2.base.model.book.BookH; 6 6 import org.sophie2.base.model.resources.r4.ResourceRefList; 7 7 import org.sophie2.base.model.resources.r4.changes.AutoAction; 8 import org.sophie2.base.skins.Message; 8 9 import org.sophie2.main.app.commons.element.ElementDropHandler; 9 10 import org.sophie2.main.app.commons.page.RootPageView; 10 11 import org.sophie2.main.dnd.dnddata.ResourceRefData; … … 18 19 */ 19 20 public class PageReorderHandler extends ElementDropHandler<RootPageView> { 20 21 22 /** 23 * Constant created for reordering pages. 24 * Constant created to be a parameter of a message of an {@link AutoAction}. 25 * Used for skinning. 26 */ 27 public static final String REORDER_PAGES = "Reorder Pages."; 21 28 private static PageReorderHandler instance = null; 22 29 23 30 private PageReorderHandler() { … … 47 54 final int dropIndex = book.getIndexOf(getView().model().get().getRef()); 48 55 49 56 final ResourceRefList pages = book.getPages(); 50 new AutoAction( "Reorder Pages.", true) {57 new AutoAction(Message.create(REORDER_PAGES), true) { 51 58 52 59 @Override 53 60 public void performAuto() { -
modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/element/ElementLogic.java
32 32 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 33 33 import org.sophie2.base.scene.SceneVisual; 34 34 import org.sophie2.base.scene.interfaces.SceneElement; 35 import org.sophie2.base.skins.Message; 35 36 import org.sophie2.base.visual.VisualElement; 36 37 import org.sophie2.base.visual.interaction.InputEventR3; 37 38 import org.sophie2.base.visual.interaction.InputModifier; … … 191 192 final ImmList<ResourceRefR4> finalChildRefs = childRefs; 192 193 193 194 final ImmList<ActivationChannel> channels = CompositeElement.KEY_SUB_ELEMENTS.get(fakeParentAccess); 194 new AutoAction( "Paste", true) {195 new AutoAction(Message.create(PASTE), true) { 195 196 @Override 196 197 public void performAuto() { 197 198 … … 228 229 }; 229 230 230 231 /** 232 * Constant created for cut. 233 * Constant created to be a parameter of a message of an {@link AutoAction}. 234 * Used for skinning. 235 */ 236 public static final String CUT = "Cut"; 237 238 /** 239 * Constant created for copy. 240 * Constant created to be a parameter of a message of an {@link AutoAction}. 241 * Used for skinning. 242 */ 243 public static final String PASTE = "Paste"; 244 245 /** 231 246 * Selects the element passed as an argument. 232 247 * 233 248 * @param element … … 338 353 339 354 ResourceRefList children = this.getResource().getChildren(); 340 355 for (ResourceRefR4 child : children) { 341 parentView.model().get().removeSubElement(child, "Cut", true);356 parentView.model().get().removeSubElement(child, Message.create(CUT), true); 342 357 } 343 358 } 344 359 -
modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/util/TemplateUtil.java
31 31 import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 32 32 import org.sophie2.base.model.resources.r4.resources.ResourceH; 33 33 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 34 import org.sophie2.base.skins.Message; 34 35 import org.sophie2.base.visual.VisualElement; 35 36 import org.sophie2.main.app.commons.app.AppMainWindow; 36 37 import org.sophie2.main.app.commons.book.BookView; … … 47 48 * @author deni 48 49 */ 49 50 public class TemplateUtil { 51 52 /** 53 * Constant created for applying frame template. 54 * Constant created to be a parameter of a message of an {@link AutoAction}. 55 * Used for skinning. 56 */ 57 public static final String APPLYING_FRAME_TEMPLATE = "Applying frame template"; 58 59 /** 60 * Constant created for creating frame for template. 61 * Constant created to be a parameter of a message of an {@link AutoAction}. 62 * Used for skinning. 63 */ 64 public static final String CREATE_FRAME_FOR_TEMPLATE = "Create frame for template"; 65 66 /** 67 * Constant created for creating group for template. 68 * Constant created to be a parameter of a message of an {@link AutoAction}. 69 * Used for skinning. 70 */ 71 public static final String CREATE_GROUP_FOR_TEMPLATE = "Create group for template"; 72 73 /** 74 * Constant created for applying page template. 75 * Constant created to be a parameter of a message of an {@link AutoAction}. 76 * Used for skinning. 77 */ 78 public static final String APPLY_PAGE_TEMPLATE = "Apply page template."; 79 50 80 /** 51 81 * Creates template element and adds it to the library. 52 82 * … … 111 141 112 142 //auto-action which changes the keys of the root element/its sub-elements 113 143 String changeKeysDescription = "Change the template's elements' keys"; 114 new AutoAction( changeKeysDescription, false) {144 new AutoAction(Message.create(changeKeysDescription), false) { 115 145 @Override 116 146 public void performAuto() { 117 147 getChanger().copyResource(relativeRef, templateRef); … … 160 190 * Auto-action which deletes the unneeded sub-elements (also removes their activation channels from the 161 191 * corresponding parent's KEY_SUB_ELEMENTS key). 162 192 */ 163 new AutoAction ( description, isSign) {193 new AutoAction (Message.create(description), isSign) { 164 194 @Override 165 195 public void performAuto () { 166 196 ResourceChanger subCh = getChanger().getSub(templateRef); … … 321 351 * or to make new frames. 322 352 * 323 353 * This method registers insignificant changes only. You may want to call 324 * {@link AutoAction#registerEndChange(ResourceAccess, String)} to close the group of changes.354 * {@link AutoAction#registerEndChange(ResourceAccess, Message)} to close the group of changes. 325 355 * 326 356 * @param page 327 357 * The page to apply the template to. … … 347 377 // template page properties other than page elements 348 378 final ImmList<TemplatedKey<?>> pageImmKeys = templateH.getApplicableTemplatedKeys(); 349 379 350 new AutoAction( "Apply page template.", false) {380 new AutoAction(Message.create(APPLY_PAGE_TEMPLATE), false) { 351 381 @Override 352 382 public void performAuto() { 353 383 ResourceChanger ch = getChanger(); … … 411 441 final ImmList<ActivationChannel> parentElements = 412 442 CompositeElement.KEY_SUB_ELEMENTS.get(parent.getAccess()); 413 443 414 new AutoAction( "Create group for template", false) {444 new AutoAction(Message.create(CREATE_GROUP_FOR_TEMPLATE), false) { 415 445 416 446 @Override 417 447 public void performAuto() { … … 442 472 final ImmList<ActivationChannel> elements = 443 473 CompositeElement.KEY_SUB_ELEMENTS.get(parent.getAccess()); 444 474 445 new AutoAction( "Create frame for template", false) {475 new AutoAction(Message.create(CREATE_FRAME_FOR_TEMPLATE), false) { 446 476 @Override 447 477 public void performAuto() { 448 478 ResourceChanger ch = getChanger(); … … 468 498 469 499 final ResourceRefR4 targetToTemplateRef = 470 500 ResourceRefR4.getRelativeRef(frameRef, templateH.getRef()); 471 new AutoAction( "Applying frame template", false) {501 new AutoAction(Message.create(APPLYING_FRAME_TEMPLATE), false) { 472 502 473 503 @Override 474 504 public void performAuto() { -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/appearance/ShadowHud.java
20 20 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 21 21 import org.sophie2.base.model.resources.r4.changes.AutoAction; 22 22 import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 23 import org.sophie2.base.skins.Message; 23 24 import org.sophie2.base.skins.SkinElementId; 24 25 import org.sophie2.base.visual.BaseVisualElement; 25 26 import org.sophie2.base.visual.VisualElement; … … 332 333 333 334 System.out.println("point = " + point); 334 335 335 new AutoAction( "Shadow position X change.", true) {336 new AutoAction(Message.create(SHADOW_POSITION_X_CHANGE), true) { 336 337 @Override 337 338 public void performAuto() { 338 339 getChanger().setRaw(FrameR4.KEY_SHADOW__POSITION, point); … … 360 361 Float x = FrameR4.KEY_SHADOW__POSITION.get(access).getX(); 361 362 Float y = BoundValidation.parseNumber(input, Float.class); 362 363 final ImmPoint point = new ImmPoint(x, y); 363 new AutoAction( "Shadow position Y change.", true) {364 new AutoAction(Message.create(SHADOW_POSITION_Y_CHANGE), true) { 364 365 @Override 365 366 public void performAuto() { 366 367 getChanger().setRaw(FrameR4.KEY_SHADOW__POSITION, point); … … 387 388 } 388 389 final ImmColor input = event.getEventParam( 389 390 ColorPickerHudField.EventIds.COLOR_PARAM_INDEX, ImmColor.class); 390 new AutoAction( "Shadow color change.", true) {391 new AutoAction(Message.create(SHADOW_COLOR_CHANGE), true) { 391 392 @Override 392 393 public void performAuto() { 393 394 getChanger().setRaw(FrameR4.KEY_SHADOW__COLOR, input); … … 421 422 return false; 422 423 } 423 424 424 new AutoAction( "Change frame shadow opacity", true) {425 new AutoAction(Message.create(CHANGE_FRAME_SHADOW_OPACITY), true) { 425 426 @Override 426 427 public void performAuto() { 427 428 getChanger().setRaw(FrameR4.KEY_SHADOW__OPACITY, input.floatValue() / 100); … … 430 431 431 432 return true; 432 433 } 433 434 }, 434 }; 435 435 436 /** 437 * Constant created for changing y shadow position . 438 * Constant created to be a parameter of a message of an {@link AutoAction}. 439 * Used for skinning. 440 */ 441 public static final String SHADOW_POSITION_Y_CHANGE = "Shadow position Y change."; 442 443 /** 444 * Constant created for changing x shadow position. 445 * Constant created to be a parameter of a message of an {@link AutoAction}. 446 * Used for skinning. 447 */ 448 public static final String SHADOW_POSITION_X_CHANGE = "Shadow position X change."; 449 450 /** 451 * Constant created for changing shadow color. 452 * Constant created to be a parameter of a message of an {@link AutoAction}. 453 * Used for skinning. 454 */ 455 public static final String SHADOW_COLOR_CHANGE = "Shadow color change."; 456 457 /** 458 * Constant created for changing frame shadow opacity. 459 * Constant created to be a parameter of a message of an {@link AutoAction}. 460 * Used for skinning. 461 */ 462 public static final String CHANGE_FRAME_SHADOW_OPACITY = "Change frame shadow opacity"; 436 463 } 437 464 438 465 /** -
modules/org.sophie2.server.webui/src/main/java/org/sophie2/server/webui/handlers/ForgottenPasswordHandler.java
40 40 public class ForgottenPasswordHandler extends BaseHandlerSupport { 41 41 42 42 /** 43 * Constant created for changing password. 44 * Constant created to be a parameter of a message of an {@link AutoAction}. 45 * Used for skinning. 46 */ 47 public static final String CHANGE_PASS = "Change pass"; 48 49 /** 43 50 * The serial version UID of this class. 44 51 */ 45 52 private static final long serialVersionUID = 4911464333502576011L; … … 108 115 navigator.redirectToReferrer(4, COULD_NOT_SEND_MESSAGE); 109 116 } 110 117 111 new AutoAction( "Change pass", true) {118 new AutoAction(org.sophie2.base.skins.Message.create(CHANGE_PASS), true) { 112 119 113 120 @Override 114 121 public void performAuto() { -
modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/logic/ChangeFrameMainResourceHandler.java
8 8 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 9 9 import org.sophie2.base.model.resources.r4.changes.AutoAction; 10 10 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 11 import org.sophie2.base.skins.Message; 11 12 import org.sophie2.core.mvc.LogicR3; 12 13 import org.sophie2.main.app.commons.book.BookDocView; 13 14 import org.sophie2.main.app.commons.book.BookView; … … 26 27 */ 27 28 public class ChangeFrameMainResourceHandler extends ElementDropHandler<FrameView> { 28 29 30 /** 31 * Constant created for changing the main resource od a frame. 32 * Constant created to be a parameter of a message of an {@link AutoAction}. 33 * Used for skinning. 34 */ 35 public static final String MAIN_RESOURCE_OF_FRAME = "Change the main resource of a frame"; 29 36 private static ChangeFrameMainResourceHandler instance = null; 30 37 31 38 private ChangeFrameMainResourceHandler() { … … 81 88 LogicR3.fire(getView(), bdw, null, null, BookView.EventIds.DELETING_ELEMENT, 82 89 ResourceDeleteLogic.findElementView(bookToFrameRef, getView().getBookView())); 83 90 84 new AutoAction( "Change the main resource of a frame", true) {91 new AutoAction(Message.create(MAIN_RESOURCE_OF_FRAME), true) { 85 92 86 93 @Override 87 94 public void performAuto() { -
modules/org.sophie2.dev/src/test/java/org/sophie2/dev/author/ResourcePreviewSystemTest.java
19 19 import org.sophie2.base.scene.BaseSceneModule; 20 20 import org.sophie2.base.skins.BaseSkinPart; 21 21 import org.sophie2.base.skins.BaseSkinsModule; 22 import org.sophie2.base.skins.Message; 22 23 import org.sophie2.base.skins.SkinUtil; 23 24 import org.sophie2.base.visual.AutoVisualProvider; 24 25 import org.sophie2.base.visual.BaseSwingVisualElement; … … 59 60 public class ResourcePreviewSystemTest extends SystemTestBase { 60 61 61 62 /** 63 * Constant created for creation of an image frame. 64 * Constant created to be a parameter of a message of an {@link AutoAction}. 65 * Used for skinning. Used in the test. 66 */ 67 public static final String CREATING_DUMMY_RESOURCE = "Creating dummy resource."; 68 69 /** 62 70 * Dummy module for testing. 63 71 * 64 72 * @author tanya … … 282 290 final ResourceRefR4 dummyRef = 283 291 ResourceRefR4.generateRandomSub(DummyResourceH.NAME_PREFIX); 284 292 285 new AutoAction( "Creating dummy resource.", true) {293 new AutoAction(Message.create(CREATING_DUMMY_RESOURCE), true) { 286 294 @Override 287 295 public void performAuto() { 288 296 getChanger().makeResource(dummyRef); -
modules/org.sophie2.base.model.book/src/main/java/org/sophie2/base/model/book/ElementH.java
32 32 import org.sophie2.base.model.resources.r4.resources.RedirectR4; 33 33 import org.sophie2.base.model.resources.r4.resources.ResourceH; 34 34 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 35 import org.sophie2.base.skins.Message; 35 36 import org.sophie2.core.logging.SophieLog; 36 37 import org.sophie2.core.prolib.impl.AutoProperty; 37 38 import org.sophie2.core.prolib.interfaces.Prop; … … 411 412 * The significance of the action. 412 413 */ 413 414 public void removeSubElement(final ResourceRefR4 element, 414 StringactionName, boolean significance) {415 Message actionName, boolean significance) { 415 416 416 417 ResourceAccess access = getAccess(); 417 418 final ImmList<ActivationChannel> children = CompositeElement.KEY_SUB_ELEMENTS -
modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/util/DeletePageUtil.java
6 6 import org.sophie2.base.model.resources.r4.ResourceRefR4; 7 7 import org.sophie2.base.model.resources.r4.changes.AutoAction; 8 8 import org.sophie2.base.model.resources.r4.resources.ResourceH; 9 import org.sophie2.base.skins.Message; 9 10 import org.sophie2.core.mvc.LogicR3; 10 11 import org.sophie2.main.app.commons.book.BookDocView; 11 12 import org.sophie2.main.app.commons.book.BookView; … … 20 21 public class DeletePageUtil { 21 22 22 23 /** 24 * Constant created for removing a page. 25 * Constant created to be a parameter of a message of an {@link AutoAction}. 26 * Used for skinning. 27 */ 28 public static final String REMOVE_PAGE = "Remove page"; 29 30 /** 23 31 * Method that removes a page from the model of the book and 24 32 * moves the current page to the next/previous one. 25 33 * … … 66 74 LogicR3.fire(bdw, bdw, null, null, 67 75 BookView.EventIds.DELETING_ELEMENT, pageViewToDel); 68 76 69 new AutoAction( "Remove page", isSign) {77 new AutoAction(Message.create(REMOVE_PAGE), isSign) { 70 78 71 79 @Override 72 80 public void performAuto() { -
modules/org.sophie2.main.func.links/src/main/java/org/sophie2/main/func/links/LinksUtil.java
6 6 import org.sophie2.base.model.book.links.LinkAction; 7 7 import org.sophie2.base.model.book.links.LinkRule; 8 8 import org.sophie2.base.model.resources.r4.changes.AutoAction; 9 import org.sophie2.base.skins.Message; 9 10 import org.sophie2.core.mvc.LogicR3; 10 11 import org.sophie2.main.app.commons.links.LinkHolder; 11 12 import org.sophie2.main.func.links.LinksHudLogic.EventIds; … … 16 17 * @author mira 17 18 */ 18 19 public class LinksUtil { 20 21 /** 22 * Constant created for changing link action settings. 23 * Constant created to be a parameter of a message of an {@link AutoAction}. 24 * Used for skinning. 25 */ 26 public static final String CHANGE_LINK_ACTION_SETTINGS = "Change link action settings"; 27 19 28 /** 20 29 * Performs the {@link AutoAction} that modifies the model. 21 30 * … … 43 52 final Link newLink = new Link(newRules); 44 53 45 54 LogicR3.fire(hud, null, null, null, EventIds.SET_LINK, 46 newLink, "Change link action settings");55 newLink, Message.create(CHANGE_LINK_ACTION_SETTINGS)); 47 56 48 57 hud.wantedRule().set(newRule); 49 58 } -
modules/org.sophie2.extra.func.annotations/src/test/java/org/sophie2/extra/func/annotations/persistence/BookExtraPersistenceTest.java
34 34 import org.sophie2.base.model.resources.r4.model.ResourceRevision; 35 35 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 36 36 import org.sophie2.base.persistence.BasePersistenceModule; 37 import org.sophie2.base.skins.Message; 37 38 import org.sophie2.core.modularity.FakeModuleRegistry; 38 39 import org.sophie2.core.testing.IntegrationTestBase; 39 40 import org.sophie2.extra.func.annotations.AnnotationsModule; … … 46 47 */ 47 48 public class BookExtraPersistenceTest extends IntegrationTestBase { 48 49 50 /** 51 * Constant created for creating a book extra with two stickies. 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 CREATE_EXTRA_WITH_TWO_STICKIES = "Create a book extra with two stickies"; 56 57 /** 58 * Constant created for creating an empty book. 59 * Constant created to be a parameter of a message of an {@link AutoAction}. 60 * Used for skinning. Used in the test. 61 */ 62 public static final String CREATE_EMPTY_BOOK = "Create an empty book"; 49 63 private ResourceAccess bookAccess; 50 64 private ResourceAccess access; 51 65 … … 70 84 final ResourceRefR4 ref = ResourceRefR4.make(location); 71 85 this.bookAccess = locator.create(ref, AccessOptions.DEFAULT_ACCESS_OPTIONS, head); 72 86 73 new AutoAction( "Create an empty book", false) {87 new AutoAction(Message.create(CREATE_EMPTY_BOOK), false) { 74 88 @Override 75 89 public void performAuto() { 76 90 getChanger().setRaw(ResourceR4.KEY_KIND, BookR4.KIND); … … 88 102 this.access = locator.create(extraRef, AccessOptions.DEFAULT_ACCESS_OPTIONS, extraHead); 89 103 90 104 // Create a book with two stickies 91 new AutoAction( "Create a book extra with two stickies", false) {105 new AutoAction(Message.create(CREATE_EXTRA_WITH_TWO_STICKIES), false) { 92 106 @Override 93 107 public void performAuto() { 94 108 getChanger().setRaw(ResourceR4.KEY_KIND, BookExtraR4.KIND); -
modules/org.sophie2.base.model.resources.r4/src/test/java/org/sophie2/base/model/resources/r4/access/mem/MemAccessTest.java
10 10 import org.sophie2.base.model.resources.r4.changes.SubResourceChanger; 11 11 import org.sophie2.base.model.resources.r4.dummies.resources.DummyResource; 12 12 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 13 import org.sophie2.base.skins.Message; 13 14 import org.sophie2.core.testing.UnitTestBase; 14 15 15 16 /** … … 47 48 assertNotNull(asteaAccess); 48 49 String asteaComment = "The company!!!"; 49 50 String changeDescription = "Initializing the Astea resource"; 50 initializeResource(asteaAccess, asteaComment, changeDescription);51 initializeResource(asteaAccess, asteaComment, Message.create(changeDescription)); 51 52 52 53 assertEquals(changeDescription, 53 54 asteaAccess.getHead().getLastChange().getDescription()); … … 71 72 * The initial change description. 72 73 */ 73 74 public static void initializeResource(ResourceAccess access, 74 final String asteaComment, StringchangeDescription) {75 final String asteaComment, Message changeDescription) { 75 76 new AutoAction(changeDescription, true) { 76 77 @Override 77 78 public void performAuto() { -
modules/org.sophie2.dev/src/test/java/org/sophie2/dev/author/TextChainingSystemTest.java
15 15 import org.sophie2.base.menus.MenuItem; 16 16 import org.sophie2.base.model.book.FrameH; 17 17 import org.sophie2.base.model.resources.r4.ResourceRefR4; 18 import org.sophie2.base.model.resources.r4.changes.AutoAction; 18 19 import org.sophie2.base.model.resources.r4.resources.ResourceH; 19 20 import org.sophie2.base.model.text.smart.ImmHotText; 20 21 import org.sophie2.base.scene.BaseSceneModule; 21 22 import org.sophie2.base.skins.BaseSkinsModule; 23 import org.sophie2.base.skins.Message; 22 24 import org.sophie2.base.visual.BaseVisualModule; 23 25 import org.sophie2.core.modularity.SophieModule; 24 26 import org.sophie2.core.mvc.CoreMvcModule; … … 56 58 @SystemTest 57 59 public class TextChainingSystemTest extends SystemTestBase { 58 60 61 /** 62 * Constant created for insertion of a full text frame. 63 * Constant created to be a parameter of a message of an {@link AutoAction}. 64 * Used for skinning. Used in the test. 65 */ 66 public static final String INSERT_FULL_TEXT_FRAME = "Insert a full text frame"; 59 67 private final static int FRAMES_TO_INSERT = 4; 60 68 private final static int SELECTED_FRAME = 0; 61 69 private final static int FIRST_FRAME_TO_CHAIN = 1; … … 234 242 235 243 HeadTextFrameH.createTextFrameAction(curBook(), 236 244 curPageWorkArea().getRootPageView().model().get(), 237 text, ResourceRefR4.NONE_REF.toUri(), null, "Insert a full text frame", true);245 text, ResourceRefR4.NONE_REF.toUri(), null, Message.create(INSERT_FULL_TEXT_FRAME), true); 238 246 239 247 TextFrameView frameViewToSelect = 240 248 curPageWorkArea().getAll(TextFrameView.class).get(4); -
modules/org.sophie2.base.model.resources.r4/src/test/java/org/sophie2/base/model/resources/r4/keys/TemplateIntegrationTest.java
18 18 import org.sophie2.base.model.resources.r4.dummies.resources.DummyPage; 19 19 import org.sophie2.base.model.resources.r4.dummies.resources.StyledDummyResource; 20 20 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 21 import org.sophie2.base.skins.Message; 21 22 import org.sophie2.core.logging.LogLevel; 22 23 import org.sophie2.core.logging.SophieLog; 23 24 import org.sophie2.core.modularity.FakeModuleRegistry; … … 30 31 */ 31 32 public class TemplateIntegrationTest extends UnitTestBase { 32 33 34 /** 35 * Constant created for setting border size to frame 1. 36 * Constant created to be a parameter of a message of an {@link AutoAction}. 37 * Used for skinning. Used in the test. 38 */ 39 public static final String SETTING_BORDER_SIZE_TO_FRAME_1 = "setting border size to frame 1"; 40 41 /** 42 * Constant created for setting border size to frame 2. 43 * Constant created to be a parameter of a message of an {@link AutoAction}. 44 * Used for skinning. Used in the test. 45 */ 46 public static final String SETTING_BORDER_SIZE_TO_FRAME_2 = "setting border size to frame 2"; 47 48 /** 49 * Constant created for setting border size to frame 3. 50 * Constant created to be a parameter of a message of an {@link AutoAction}. 51 * Used for skinning. Used in the test. 52 */ 53 public static final String SETTING_BORDER_SIZE_TO_FRAME_3 = "setting border size to frame 3"; 54 55 /** 56 * Constant created for applying template to frame 2. 57 * Constant created to be a parameter of a message of an {@link AutoAction}. 58 * Used for skinning. Used in the test. 59 */ 60 public static final String APPLYING_TEMPLATE_TO_FRAME_2 = "applying template to frame 2"; 61 62 /** 63 * Constant created for applying template to frame 1. 64 * Constant created to be a parameter of a message of an {@link AutoAction}. 65 * Used for skinning. Used in the test. 66 */ 67 public static final String APPLYING_TEMPLATE_TO_FRAME_1 = "applying template to frame 1"; 68 69 /** 70 * Constant created for creating frame 3. 71 * Constant created to be a parameter of a message of an {@link AutoAction}. 72 * Used for skinning. Used in the test. 73 */ 74 public static final String FRAME_3_CREATED = "frame 3 created"; 75 76 /** 77 * Constant created for creating frame 2. 78 * Constant created to be a parameter of a message of an {@link AutoAction}. 79 * Used for skinning. Used in the test. 80 */ 81 public static final String FRAME_2_CREATED = "frame 2 created"; 82 83 /** 84 * Constant created for creating frame 1. 85 * Constant created to be a parameter of a message of an {@link AutoAction}. 86 * Used for skinning. Used in the test. 87 */ 88 public static final String FRAME_1_CREATED = "frame 1 created"; 89 90 /** 91 * Constant created for removing page border color. 92 * Constant created to be a parameter of a message of an {@link AutoAction}. 93 * Used for skinning. Used in the test. 94 */ 95 public static final String REMOVING_PAGE_BORDER_COLOR = "removing page border color"; 96 97 /** 98 * Constant created for applying template to page. 99 * Constant created to be a parameter of a message of an {@link AutoAction}. 100 * Used for skinning. Used in the test. 101 */ 102 public static final String APPLYING_TEMPLATE_TO_PAGE = "applying template to page"; 103 104 /** 105 * Constant created for setting page template border. 106 * Constant created to be a parameter of a message of an {@link AutoAction}. 107 * Used for skinning. Used in the test. 108 */ 109 public static final String SET_PAGE_TEMPLATE_BORDER = "set page template border"; 110 111 /** 112 * Constant created for setting page border color. 113 * Constant created to be a parameter of a message of an {@link AutoAction}. 114 * Used for skinning. Used in the test. 115 */ 116 public static final String SET_PAGE_BORDER_COLOR = "set page border color"; 117 118 /** 119 * Constant created for creating a template. 120 * Constant created to be a parameter of a message of an {@link AutoAction}. 121 * Used for skinning. Used in the test. 122 */ 123 public static final String TEMPLATE_CREATED = "template created"; 124 125 /** 126 * Constant created for creating page. 127 * Constant created to be a parameter of a message of an {@link AutoAction}. 128 * Used for skinning. Used in the test. 129 */ 130 public static final String PAGE_CREATED = "page created"; 33 131 private ResourceAccess access; 34 132 35 133 @SuppressWarnings("unchecked") … … 71 169 final ResourceRefR4 page = ResourceRefR4.makeChild("page"); 72 170 final ResourceRefR4 template = ResourceRefR4.makeChild("template"); 73 171 74 new AutoAction( "page created", true) {172 new AutoAction(Message.create(PAGE_CREATED), true) { 75 173 @Override 76 174 public void performAuto() { 77 175 getChanger().makeResource(page); … … 79 177 } 80 178 }.register(this.access); 81 179 82 new AutoAction( "template created", true) {180 new AutoAction(Message.create(TEMPLATE_CREATED), true) { 83 181 @Override 84 182 public void performAuto() { 85 183 getChanger().makeResource(template); … … 95 193 assertEquals(StyledDummyResource.DEFAULT_BORDER_COLOR, 96 194 StyledDummyResource.KEY_BORDER__COLOR.get(pageAccess)); 97 195 98 new AutoAction( "set page border color", true) {196 new AutoAction(Message.create(SET_PAGE_BORDER_COLOR), true) { 99 197 @Override 100 198 public void performAuto() { 101 199 getChanger().setRaw(StyledDummyResource.KEY_BORDER__COLOR, … … 106 204 assertEquals(ImmColor.PINK, StyledDummyResource.KEY_BORDER__COLOR 107 205 .get(pageAccess)); 108 206 109 new AutoAction( "set page template border", true) {207 new AutoAction(Message.create(SET_PAGE_TEMPLATE_BORDER), true) { 110 208 @Override 111 209 public void performAuto() { 112 210 getChanger().setRaw(StyledDummyResource.KEY_BORDER__SIZE, 10.0); … … 121 219 .get(templateAccess)); 122 220 123 221 final ResourceRefR4 absoluteTemplateRef = templateAccess.getRef(); 124 new AutoAction( "applying template to page", true) {222 new AutoAction(Message.create(APPLYING_TEMPLATE_TO_PAGE), true) { 125 223 @Override 126 224 public void performAuto() { 127 225 getChanger().setRaw(ResourceR4.KEY_TEMPLATE, … … 133 231 assertEquals(ImmColor.PINK, StyledDummyResource.KEY_BORDER__COLOR 134 232 .get(pageAccess)); 135 233 136 new AutoAction( "removing page border color", true) {234 new AutoAction(Message.create(REMOVING_PAGE_BORDER_COLOR), true) { 137 235 @Override 138 236 public void performAuto() { 139 237 getChanger() … … 145 243 assertEquals(ImmColor.GREEN, StyledDummyResource.KEY_BORDER__COLOR 146 244 .get(pageAccess)); 147 245 148 new AutoAction( "set page template border", true) {246 new AutoAction(Message.create(SET_PAGE_TEMPLATE_BORDER), true) { 149 247 @Override 150 248 public void performAuto() { 151 249 getChanger().setRaw(StyledDummyResource.KEY_BORDER__SIZE, 20.0); … … 171 269 final ResourceRefR4 frame2 = ResourceRefR4.makeChild("frame2"); 172 270 final ResourceRefR4 frame3 = ResourceRefR4.makeChild("frame3"); 173 271 174 new AutoAction( "frame 1 created", true) {272 new AutoAction(Message.create(FRAME_1_CREATED), true) { 175 273 @Override 176 274 public void performAuto() { 177 275 getChanger().makeResource(frame1); … … 179 277 } 180 278 }.register(this.access); 181 279 182 new AutoAction( "frame 2 created", true) {280 new AutoAction(Message.create(FRAME_2_CREATED), true) { 183 281 @Override 184 282 public void performAuto() { 185 283 getChanger().makeResource(frame2); … … 187 285 } 188 286 }.register(this.access); 189 287 190 new AutoAction( "frame 3 created", true) {288 new AutoAction(Message.create(FRAME_3_CREATED), true) { 191 289 @Override 192 290 public void performAuto() { 193 291 getChanger().makeResource(frame3); … … 205 303 assertEquals(StyledDummyResource.DEFAULT_BORDER_SIZE, 206 304 StyledDummyResource.KEY_BORDER__SIZE.get(frameAccess1)); 207 305 208 new AutoAction( "applying template to frame 1", true) {306 new AutoAction(Message.create(APPLYING_TEMPLATE_TO_FRAME_1), true) { 209 307 @Override 210 308 public void performAuto() { 211 309 getChanger().setRaw(ResourceR4.KEY_TEMPLATE, absoluteRef2); 212 310 } 213 311 }.register(frameAccess1); 214 312 215 new AutoAction( "applying template to frame 2", true) {313 new AutoAction(Message.create(APPLYING_TEMPLATE_TO_FRAME_2), true) { 216 314 @Override 217 315 public void performAuto() { 218 316 getChanger().setRaw(ResourceR4.KEY_TEMPLATE, absoluteRef3); … … 226 324 assertEquals(StyledDummyResource.DEFAULT_BORDER_SIZE, 227 325 StyledDummyResource.KEY_BORDER__SIZE.get(frameAccess3)); 228 326 229 new AutoAction( "setting border size to frame 3", true) {327 new AutoAction(Message.create(SETTING_BORDER_SIZE_TO_FRAME_3), true) { 230 328 @Override 231 329 public void performAuto() { 232 330 getChanger().setRaw(StyledDummyResource.KEY_BORDER__SIZE, 3.0); … … 240 338 assertEquals(3.0, StyledDummyResource.KEY_BORDER__SIZE 241 339 .get(frameAccess3)); 242 340 243 new AutoAction( "setting border size to frame 2", true) {341 new AutoAction(Message.create(SETTING_BORDER_SIZE_TO_FRAME_2), true) { 244 342 @Override 245 343 public void performAuto() { 246 344 getChanger().setRaw(StyledDummyResource.KEY_BORDER__SIZE, 2.0); … … 254 352 assertEquals(3.0, StyledDummyResource.KEY_BORDER__SIZE 255 353 .get(frameAccess3)); 256 354 257 new AutoAction( "setting border size to frame 1", true) {355 new AutoAction(Message.create(SETTING_BORDER_SIZE_TO_FRAME_1), true) { 258 356 @Override 259 357 public void performAuto() { 260 358 getChanger().setRaw(StyledDummyResource.KEY_BORDER__SIZE, 1.0); -
modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/frame/FrameLogic.java
21 21 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 22 22 import org.sophie2.base.scene.SceneVisual; 23 23 import org.sophie2.base.scene.helpers.SceneHelper; 24 import org.sophie2.base.skins.Message; 24 25 import org.sophie2.base.visual.interaction.InputEventR3; 25 26 import org.sophie2.core.mvc.EventFilterBuilder; 26 27 import org.sophie2.core.mvc.OperationDef; … … 84 85 new MouseCapture(0, 0, cause) { 85 86 @Override 86 87 public void released() { 87 AutoAction.registerEndChange(access, "Resize frame finished.");88 AutoAction.registerEndChange(access, Message.create(RESIZE_FRAME_FINISHED)); 88 89 sv.wantedViewRect().set(null); 89 90 } 90 91 … … 92 93 final ImmPoint newLocationInPage, final ImmSize newSize) { 93 94 TimePos time = elementView.getTime(); 94 95 final LocationChannel newChannel = oldChannel.setValue(time, newLocationInPage); 95 new AutoAction( "Frame resize", false) {96 new AutoAction(Message.create(FRAME_RESIZE), false) { 96 97 @Override 97 98 public void performAuto() { 98 99 ResourceChanger ch = getChanger(); … … 185 186 } 186 187 187 188 }; 189 190 /** 191 * Constant created for expressing that frame resize is finished. 192 * Constant created to be a parameter of a message of an {@link AutoAction}. 193 * Used for skinning. 194 */ 195 public static final String RESIZE_FRAME_FINISHED = "Resize frame finished."; 196 197 /** 198 * Constant created for expressing that frame is resized. 199 * Constant created to be a parameter of a message of an {@link AutoAction}. 200 * Used for skinning. 201 */ 202 public static final String FRAME_RESIZE = "Frame resize"; 188 203 } 204 No newline at end of file -
modules/org.sophie2.main.func.templates/src/main/java/org/sophie2/main/func/templates/page/PageTemplateLogic.java
17 17 import org.sophie2.base.model.resources.r4.changes.AutoAction; 18 18 import org.sophie2.base.model.resources.r4.resources.ResourceH; 19 19 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 20 import org.sophie2.base.skins.Message; 20 21 import org.sophie2.core.logging.SophieLog; 21 22 import org.sophie2.core.modularity.SortKey; 22 23 import org.sophie2.core.mvc.EventFilterBuilder; … … 322 323 String pageTitle = ResourceR4.KEY_TITLE.get(bookDocView.getAccess().open(template, null)); 323 324 324 325 if (TemplatePaletteUtil.confirmDeletion(pageTitle, bookDocView.swingComponent().get())) { 325 new AutoAction( "Delete page template", true) {326 new AutoAction(Message.create(DELETE_PAGE_TEMPLATE), true) { 326 327 327 328 @Override 328 329 public void performAuto() { … … 339 340 340 341 }; 341 342 343 /** 344 * Constant created for deleting a page template. 345 * Constant created to be a parameter of a message of an {@link AutoAction}. 346 * Used for skinning. 347 */ 348 public static final String DELETE_PAGE_TEMPLATE = "Delete page template"; 342 349 } -
modules/org.sophie2.base.model.book/src/test/java/org/sophie2/base/model/book/BookUnitTest.java
24 24 import org.sophie2.base.model.resources.r4.changes.AutoAction; 25 25 import org.sophie2.base.model.resources.r4.changes.SubResourceChanger; 26 26 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 27 import org.sophie2.base.skins.Message; 27 28 28 29 /** 29 30 * Unit test for {@link BookH}. … … 32 33 */ 33 34 public class BookUnitTest extends ModelTestBase { 34 35 36 /** 37 * Constant created for modifying copied book. 38 * Constant created to be a parameter of a message of an {@link AutoAction}. 39 * Used for skinning. Used in the test. 40 */ 41 public static final String MODIFY_COPIED_BOOK = "Modify the copied book"; 42 43 /** 44 * Constant created for creating a new page with 2 image frames in a group. 45 * Constant created to be a parameter of a message of an {@link AutoAction}. 46 * Used for skinning. Used in the test. 47 */ 48 public static final String CREATE_PAGE_WITH_IMAGE_FRAMES_IN_GROUP = "Create a new page with 2 image frames in a group"; 49 50 /** 51 * Constant created for clearing pages. 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 CLEAR_PAGES = "clear pages"; 56 57 /** 58 * Constant created for moving pages. 59 * Constant created to be a parameter of a message of an {@link AutoAction}. 60 * Used for skinning. Used in the test. 61 */ 62 public static final String MOVE_PAGES = "move pages"; 63 64 /** 65 * Constant created for creating pages. 66 * Constant created to be a parameter of a message of an {@link AutoAction}. 67 * Used for skinning. Used in the test. 68 */ 69 public static final String CREATE_PAGES = "Create pages."; 70 71 /** 72 * Constant created for adding pages. 73 * Constant created to be a parameter of a message of an {@link AutoAction}. 74 * Used for skinning. Used in the test. 75 */ 76 public static final String ADD_PAGES = "Adding new pages"; 35 77 private BookH book; 36 78 37 79 @Override … … 63 105 ResourceRefR4.generateRandomSub(PageH.NAME_PREFIX); 64 106 final ResourceRefList pages = this.book.get(BookR4.KEY_PAGES); 65 107 66 new AutoAction( "Adding new pages", true) {108 new AutoAction(Message.create(ADD_PAGES), true) { 67 109 @Override 68 110 public void performAuto() { 69 111 BookH.addNewPage(getChanger(), pageRef1, pages, PageR4.DEFAULT_TITLE); … … 86 128 ResourceRefR4 page3 = ResourceRefR4.generateRandomSub("Page"); 87 129 final ResourceRefList pages = ResourceRefList.create(page1, page2, page3); 88 130 89 new AutoAction( "Create pages.", false) {131 new AutoAction(Message.create(CREATE_PAGES), false) { 90 132 91 133 @Override 92 134 public void performAuto() { … … 101 143 102 144 final ResourceRefList children = this.book.getPages(); 103 145 // move page 0 to last position and re-check indices 104 new AutoAction( "move pages", false) {146 new AutoAction(Message.create(MOVE_PAGES), false) { 105 147 106 148 @Override 107 149 public void performAuto() { … … 116 158 // return the indices to their initial order and re-check 117 159 // move page 0 to last position and re-check indices 118 160 final ResourceRefList children2 = this.book.getPages(); 119 new AutoAction( "move pages", false) {161 new AutoAction(Message.create(MOVE_PAGES), false) { 120 162 121 163 @Override 122 164 public void performAuto() { … … 128 170 assertEquals(1, this.book.getIndexOf(page2)); 129 171 assertEquals(2, this.book.getIndexOf(page3)); 130 172 131 new AutoAction( "clear pages", false) {173 new AutoAction(Message.create(CLEAR_PAGES), false) { 132 174 133 175 @Override 134 176 public void performAuto() { … … 157 199 final ImmList<ActivationChannel> children = 158 200 CompositeElement.KEY_SUB_ELEMENTS.get(pageAccess); 159 201 160 new AutoAction( "Create a new page with 2 image frames in a group", true) {202 new AutoAction(Message.create(CREATE_PAGE_WITH_IMAGE_FRAMES_IN_GROUP), true) { 161 203 162 204 @Override 163 205 public void performAuto() { … … 201 243 clone.getAccess().getHead().getModel()); 202 244 assertNotSame(this.book, clone); 203 245 204 new AutoAction( "Modify the copied book", true) {246 new AutoAction(Message.create(MODIFY_COPIED_BOOK), true) { 205 247 206 248 @Override 207 249 public void performAuto() { -
modules/org.sophie2.main.func.resources/src/test/java/org/sophie2/main/func/resources/dummy/ColdTextResourceHelper.java
6 6 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 7 7 import org.sophie2.base.model.resources.r4.resources.ResourceH; 8 8 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 9 import org.sophie2.base.skins.Message; 9 10 10 11 /** 11 12 * The helper of our cold text... … … 15 16 public class ColdTextResourceHelper extends ResourceH { 16 17 17 18 /** 19 * Constant created for creating cold text. 20 * Constant created to be a parameter of a message of an {@link AutoAction}. 21 * Used for skinning. 22 */ 23 public static final String CREATING_COLD_TEXT = "Creating cold text"; 24 /** 18 25 * The prefix of the name of this resource. 19 26 */ 20 27 @SuppressWarnings("hiding") … … 75 82 final ResourceRefR4 coldRef = 76 83 ResourceRefR4.generateRandomSub(ColdTextResource.DEFAULT_TITLE); 77 84 78 new AutoAction( "Creating cold text", true) {85 new AutoAction(Message.create(CREATING_COLD_TEXT), true) { 79 86 @Override 80 87 public void performAuto() { 81 88 ColdTextResourceHelper.createColdText( -
modules/org.sophie2.main.func.templates/src/main/java/org/sophie2/main/func/templates/frame/CreateFrameByTemplateHandler.java
16 16 import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 17 17 import org.sophie2.base.model.resources.r4.resources.ResourceH; 18 18 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 19 import org.sophie2.base.skins.Message; 19 20 import org.sophie2.main.app.commons.element.ElementDropHandler; 20 21 import org.sophie2.main.app.commons.page.MainPageView; 21 22 import org.sophie2.main.app.commons.util.TemplateUtil; … … 29 30 */ 30 31 public class CreateFrameByTemplateHandler extends ElementDropHandler<MainPageView> { 31 32 33 /** 34 * Constant created for creating a frame from a template. 35 * Constant created to be a parameter of a message of an {@link AutoAction}. 36 * Used for skinning. 37 */ 38 public static final String CREATE_FRAME_FROM_TEMPLATE = "Create a frame from a template."; 32 39 private static CreateFrameByTemplateHandler instance = null; 33 40 34 41 private CreateFrameByTemplateHandler() { … … 73 80 CompositeElement.KEY_SUB_ELEMENTS.get(parentAccess); 74 81 75 82 final ImmPoint pos = getPoint(); 76 new AutoAction( "Create a frame from a template.", true) {83 new AutoAction(Message.create(CREATE_FRAME_FROM_TEMPLATE), true) { 77 84 @Override 78 85 public void performAuto() { 79 86 ResourceChanger changer = getChanger(); -
modules/org.sophie2.extra.func.embedded/src/main/java/org/sophie2/extra/func/embedded/view/EmbeddedBooksHud.java
15 15 import org.sophie2.base.layout.LogicR3ToggleButton; 16 16 import org.sophie2.base.model.resources.r4.changes.AutoAction; 17 17 import org.sophie2.base.model.resources.r4.keys.Key; 18 import org.sophie2.base.skins.Message; 18 19 import org.sophie2.base.skins.SkinElementId; 19 20 import org.sophie2.base.visual.skins.ElementSkinPart; 20 21 import org.sophie2.base.visual.skins.RelatedChildren; … … 121 122 @VisualElementDef(parent = EmbeddedBooksHud.class, sortKey = "bbb-show-prev-page-button") 122 123 public static class ShowPrevPageButton extends LogicR3ToggleButton { 123 124 125 /** 126 * Constant created for notifying that 'Prev page' button showed. 127 * Constant created to be a parameter of a message of an {@link AutoAction}. 128 * Used for skinning. 129 */ 130 public static final String SHOW_PREV_PAGE_BUTTON = "Show 'Prev page' button"; 131 132 /** 133 * Constant created for notifying that 'Prev page' button hid. 134 * Constant created to be a parameter of a message of an {@link AutoAction}. 135 * Used for skinning. 136 */ 137 public static final String HIDE_PREV_PAGE_BUTTON = "Hide 'Prev page' button"; 138 124 139 @SuppressWarnings("unused") 125 140 @SkinPartDef 126 141 private static void initSkin(ElementSkinPart part) { … … 150 165 protected ImmList<EventR3> computeDeselectedEvents() { 151 166 return ImmTreeList.<EventR3>create(new EventR3( 152 167 this, null, null, null, EventIds.TOGGLE_CONTROL, 153 EmbeddedBookFrameR4.KEY_SHOW_PREV_PAGE, "Hide 'Prev page' button", false));168 EmbeddedBookFrameR4.KEY_SHOW_PREV_PAGE, Message.create(HIDE_PREV_PAGE_BUTTON), false)); 154 169 } 155 170 156 171 @Override 157 172 protected ImmList<EventR3> computeSelectedEvents() { 158 173 return ImmTreeList.<EventR3>create(new EventR3( 159 174 this, null, null, null, EventIds.TOGGLE_CONTROL, 160 EmbeddedBookFrameR4.KEY_SHOW_PREV_PAGE, "Show 'Prev page' button", true));175 EmbeddedBookFrameR4.KEY_SHOW_PREV_PAGE, Message.create(SHOW_PREV_PAGE_BUTTON), true)); 161 176 } 162 177 } 163 178 … … 169 184 @VisualElementDef(parent = EmbeddedBooksHud.class, sortKey = "ccc-show-next-page-button") 170 185 public static class ShowNextPageButton extends LogicR3ToggleButton { 171 186 187 /** 188 * Constant created for notifying that 'Next page' button showed. 189 * Constant created to be a parameter of a message of an {@link AutoAction}. 190 * Used for skinning. 191 */ 192 public static final String SHOW_NEXT_PAGE_BUTTON = "Show 'Next page' button"; 193 194 /** 195 * Constant created for notifying that 'Next page' button hid. 196 * Constant created to be a parameter of a message of an {@link AutoAction}. 197 * Used for skinning. 198 */ 199 public static final String HIDE_NEXT_PAGE_BUTTON = "Hide 'Next page' button"; 200 172 201 @SuppressWarnings("unused") 173 202 @SkinPartDef 174 203 private static void initSkin(ElementSkinPart part) { … … 198 227 protected ImmList<EventR3> computeDeselectedEvents() { 199 228 return ImmTreeList.<EventR3>create(new EventR3( 200 229 this, null, null, null, EventIds.TOGGLE_CONTROL, 201 EmbeddedBookFrameR4.KEY_SHOW_NEXT_PAGE, "Hide 'Next page' button", false));230 EmbeddedBookFrameR4.KEY_SHOW_NEXT_PAGE, Message.create(HIDE_NEXT_PAGE_BUTTON), false)); 202 231 } 203 232 204 233 @Override 205 234 protected ImmList<EventR3> computeSelectedEvents() { 206 235 return ImmTreeList.<EventR3>create(new EventR3( 207 236 this, null, null, null, EventIds.TOGGLE_CONTROL, 208 EmbeddedBookFrameR4.KEY_SHOW_NEXT_PAGE, "Show 'Next page' button", true));237 EmbeddedBookFrameR4.KEY_SHOW_NEXT_PAGE, Message.create(SHOW_NEXT_PAGE_BUTTON), true)); 209 238 } 210 239 } 211 240 … … 225 254 * be registered. The third parameter determines whether the control should be shown 226 255 * or hidden. 227 256 */ 228 @EventParams({ Key.class, String.class, Boolean.class })257 @EventParams({ Key.class, Message.class, Boolean.class }) 229 258 TOGGLE_CONTROL; 230 259 231 260 /** … … 270 299 // suppressing warnings because we need to set a key's value 271 300 final Key<Boolean> key = event.getEventParam( 272 301 EmbeddedBooksHud.EventIds.KEY_PARAM_INDEX, Key.class); 273 Stringdescription = event.getEventParam(274 EmbeddedBooksHud.EventIds.DESCR_PARAM_INDEX, String.class);302 Message description = event.getEventParam( 303 EmbeddedBooksHud.EventIds.DESCR_PARAM_INDEX, Message.class); 275 304 final boolean shown = event.getEventParam( 276 305 EmbeddedBooksHud.EventIds.VISIBLE_PARAM_INDEX, Boolean.class); 277 306 -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/frame/rotate/FrameRotateHaloButton.java
18 18 import org.sophie2.base.scene.SceneVisual; 19 19 import org.sophie2.base.scene.helpers.SceneHelper; 20 20 import org.sophie2.base.scene.interfaces.Scene; 21 import org.sophie2.base.skins.Message; 21 22 import org.sophie2.base.skins.SkinElementId; 22 23 import org.sophie2.base.visual.skins.VisualElementDef; 23 24 import org.sophie2.main.app.commons.frame.FrameView; … … 40 41 @VisualElementDef(parent = FrameRotateHaloMenu.class, sortKey = "jjj-frame-rotate-left-halo-button") 41 42 public class FrameRotateHaloButton extends MoveHaloButton { 42 43 44 /** 45 * Constant created for own frame rotation. 46 * Constant created to be a parameter of a message of an {@link AutoAction}. 47 * Used for skinning. 48 */ 49 public static final String FRAME_ROTATING_OWN = "Frame rotating (own)..."; 50 51 /** 52 * Constant created for expressing that frame is deleted using scripting. 53 * Constant created to be a parameter of a message of an {@link AutoAction}. 54 * Used for skinning. 55 */ 56 public static final String FRAME_ROTATING_UNTEMPLATE = "Frame rotating (untemplate)..."; 57 43 58 @Override 44 59 protected MouseCapture captureClick(MouseEvent e) { 45 60 // all will be in parent element's space … … 98 113 private void templatedRotation(final double newAngle, 99 114 final TimePos time, final ImmPoint newLocation, boolean significant) { 100 115 final LocationChannel oldChannel = frame.get(MemberElement.KEY_LOCATION); 101 new AutoAction( "Frame rotating (untemplate)...", significant) {116 new AutoAction(Message.create(FRAME_ROTATING_UNTEMPLATE), significant) { 102 117 103 118 @Override 104 119 public void performAuto() { … … 113 128 114 129 private void customRotation(final double newAngle, 115 130 final TimePos time, final ImmPoint newLocation, boolean significant) { 116 new AutoAction( "Frame rotating (own)...", significant) {131 new AutoAction(Message.create(FRAME_ROTATING_OWN), significant) { 117 132 118 133 @Override 119 134 public void performAuto() { -
modules/org.sophie2.base.model.resources.r4/pom.xml
36 36 <version>2.0.5</version> 37 37 </dependency> 38 38 <dependency> 39 <groupId>org.sophie2</groupId> 40 <artifactId>org.sophie2.base.skins</artifactId> 41 <version>2.0.5</version> 42 </dependency> 43 <dependency> 39 44 <groupId>junit</groupId> 40 45 <artifactId>junit</artifactId> 41 46 <version>4.4</version> -
modules/org.sophie2.main.func.resources/src/test/java/org/sophie2/main/func/resources/imports/ResourceImportUtilTest.java
29 29 import org.sophie2.base.model.resources.r4.resources.ResourceH; 30 30 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 31 31 import org.sophie2.base.skins.BaseSkinsModule; 32 import org.sophie2.base.skins.Message; 32 33 import org.sophie2.base.visual.BaseVisualModule; 33 34 import org.sophie2.core.logging.LogLevel; 34 35 import org.sophie2.core.logging.SophieLog; … … 55 56 */ 56 57 public class ResourceImportUtilTest extends AppTestBase { 57 58 59 /** 60 * Constant created for creating cold text. 61 * Constant created to be a parameter of a message of an {@link AutoAction}. 62 * Used for skinning. 63 */ 64 public static final String CREATING_COLD_TEXT = "Creating cold text"; 65 58 66 private final static class ColdTransferable implements DndTransferable { 59 67 60 68 final String text; … … 267 275 ResourceRefR4.generateRandomSub(ColdTextResource.DEFAULT_TITLE); 268 276 final String text = "My text"; 269 277 270 new AutoAction( "Creating cold text", true) {278 new AutoAction(Message.create(CREATING_COLD_TEXT), true) { 271 279 @Override 272 280 public void performAuto() { 273 281 ColdTextResourceHelper.createColdText(getChanger(), -
modules/org.sophie2.base.model.book/src/test/java/org/sophie2/base/model/book/resource/r4/PersistenceTest.java
37 37 import org.sophie2.base.persistence.persister.MasterPersister; 38 38 import org.sophie2.base.persistence.ref.ValueRef; 39 39 import org.sophie2.base.persistence.storage.Storage; 40 import org.sophie2.base.skins.Message; 40 41 import org.sophie2.core.logging.LogLevel; 41 42 import org.sophie2.core.logging.SophieLog; 42 43 import org.sophie2.core.modularity.FakeModuleRegistry; … … 50 51 */ 51 52 public class PersistenceTest extends IntegrationTestBase { 52 53 54 /** 55 * Constant created for creating frame 1. 56 * Constant created to be a parameter of a message of an {@link AutoAction}. 57 * Used for skinning. Used in the test. 58 */ 59 public static final String CREATE_FRAME1 = "Create Frame1"; 60 61 /** 62 * Constant created for creating a book with two pages. 63 * Constant created to be a parameter of a message of an {@link AutoAction}. 64 * Used for skinning. Used in the test. 65 */ 66 public static final String CREATE_A_BOOK_WITH_TWO_PAGES = "Create a book with two pages"; 53 67 private DelegatingFileAccess access; 54 68 private ResourceRefR4 ref; 55 69 private static AppLocator locator = new AppLocator(); … … 169 183 ResourceRevision head = LocalResourceRevision.getInitialRevision(); 170 184 ResourceAccess access = locator.create(ref, AccessOptions.DEFAULT_ACCESS_OPTIONS, head); 171 185 172 new AutoAction( "Create a book with two pages", true) {186 new AutoAction(Message.create(CREATE_A_BOOK_WITH_TWO_PAGES), true) { 173 187 @Override 174 188 public void performAuto() { 175 189 getChanger().setRaw(ResourceR4.KEY_KIND, BookR4.KIND); … … 200 214 } 201 215 }.register(access); 202 216 203 new AutoAction( "Create Frame1", true) {217 new AutoAction(Message.create(CREATE_FRAME1), true) { 204 218 @Override 205 219 public void performAuto() { 206 220 ResourceRefR4 subRef = ResourceRefR4.make("./PAGE_A/FRAME_1"); -
modules/org.sophie2.base.model.resources.r4/src/main/java/org/sophie2/base/model/resources/r4/changes/ModelChange.java
9 9 import org.sophie2.base.model.resources.r4.ResourceRefR4; 10 10 import org.sophie2.base.model.resources.r4.keys.Key; 11 11 import org.sophie2.base.model.resources.r4.model.ResourceReader; 12 import org.sophie2.base.skins.Message; 12 13 import org.sophie2.core.prolib.annot.Immutable; 13 14 14 15 /** … … 51 52 * @param actionFieldValues 52 53 * The parameters to construct the {@link AutoAction} with. 53 54 */ 54 public ModelChange(ResourceRefR4 changeScope, ResourceRefR4 user, String viewId, Stringdescription,55 public ModelChange(ResourceRefR4 changeScope, ResourceRefR4 user, String viewId, Message description, 55 56 boolean significant, Class<? extends AutoAction> actionClass, 56 57 ImmList<?> actionFieldValues) { 57 58 super(user, viewId, description, significant); … … 167 168 } 168 169 } catch (Exception e) { 169 170 throw new RuntimeException("The change AutoAction of '" + this.toString() 170 + "' co lud not be resurrected.", e);171 + "' could not be resurrected.", e); 171 172 } 172 173 return res; 173 174 } -
modules/org.sophie2.main.app.commons/src/test/java/org/sophie2/main/app/commons/frame/FrameResizeTest.java
23 23 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 24 24 import org.sophie2.base.model.resources.r4.changes.AutoAction; 25 25 import org.sophie2.base.skins.BaseSkinsModule; 26 import org.sophie2.base.skins.Message; 26 27 import org.sophie2.base.visual.BaseVisualModule; 27 28 import org.sophie2.base.visual.interaction.InputEventR3; 28 29 import org.sophie2.base.visual.interaction.ModifierSet; … … 50 51 */ 51 52 public class FrameResizeTest extends AppTestBase { 52 53 54 /** 55 * Constant created for setting rotation angle. 56 * Constant created to be a parameter of a message of an {@link AutoAction}. 57 * Used for skinning. 58 */ 59 public static final String SET_ROTATION_ANGLE = "Set rotation angle"; 53 60 private FrameView fv; 54 61 private FrameH frame; 55 62 … … 169 176 @Test 170 177 public void testRotatedTopArea() { 171 178 172 new AutoAction( "Set rotation angle", true) {179 new AutoAction(Message.create(SET_ROTATION_ANGLE), true) { 173 180 174 181 @Override 175 182 public void performAuto() { -
modules/org.sophie2.base.model.book/src/main/java/org/sophie2/base/model/book/StyledElementH.java
13 13 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 14 14 import org.sophie2.base.model.resources.r4.changes.AutoAction; 15 15 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 16 import org.sophie2.base.skins.Message; 16 17 17 18 /** 18 19 * A helper class for getting the properties of an {@link StyledElement} … … 21 22 */ 22 23 public class StyledElementH { 23 24 25 /** 26 * Constant created for toggling background lock. 27 * Constant created to be a parameter of a message of an {@link AutoAction}. 28 * Used for skinning. 29 */ 30 public static final String BG_LOCK = "Toggle background lock"; 31 32 /** 33 * Constant created for toggling background templating. 34 * Constant created to be a parameter of a message of an {@link AutoAction}. 35 * Used for skinning. 36 */ 37 public static final String BG_TEMPLATING = "Toggle background templating"; 38 39 /** 40 * Constant created for toggling border lock. 41 * Constant created to be a parameter of a message of an {@link AutoAction}. 42 * Used for skinning. 43 */ 44 public static final String BORDER_LOCK = "Toggle border lock"; 45 46 /** 47 * Constant created for toggling border templating lock. 48 * Constant created to be a parameter of a message of an {@link AutoAction}. 49 * Used for skinning. 50 */ 51 public static final String BORDER_TEMPLATING = "Toggle border templating"; 24 52 private final ResourceAccess access; 25 53 26 54 /** … … 167 195 newColor = StyledElement.KEY_BORDER__COLOR.get(this.access); 168 196 } 169 197 170 new AutoAction( "Toggle border templating", true) {198 new AutoAction(Message.create(BORDER_TEMPLATING), true) { 171 199 @Override 172 200 public void performAuto() { 173 201 ResourceChanger ch = getChanger(); … … 189 217 final ImmColor borderColor = getBorderColor(); 190 218 final ImmInsets borderInsets = getBorderInsets(); 191 219 192 new AutoAction( "Toggle border lock", true) {220 new AutoAction(Message.create(BORDER_LOCK), true) { 193 221 @Override 194 222 public void performAuto() { 195 223 ResourceChanger ch = getChanger(); … … 228 256 opacity = getBackgroundOpacity(); 229 257 } 230 258 231 new AutoAction( "Toggle background templating", true) {259 new AutoAction(Message.create(BG_TEMPLATING), true) { 232 260 @Override 233 261 public void performAuto() { 234 262 ResourceChanger ch = getChanger(); … … 255 283 final ImmGradient gradient = getBackgroundGradient(); 256 284 final Float opacity = getBackgroundOpacity(); 257 285 258 new AutoAction( "Toggle background lock", true) {286 new AutoAction(Message.create(BG_LOCK), true) { 259 287 @Override 260 288 public void performAuto() { 261 289 ResourceChanger ch = getChanger(); -
modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/logic/ResourceDeleteLogic.java
11 11 import org.sophie2.base.model.resources.r4.changes.AutoAction; 12 12 import org.sophie2.base.model.resources.r4.keys.Key; 13 13 import org.sophie2.base.model.resources.r4.resources.ResourceH; 14 import org.sophie2.base.skins.Message; 14 15 import org.sophie2.core.mvc.EventFilterBuilder; 15 16 import org.sophie2.core.mvc.LogicR3; 16 17 import org.sophie2.core.mvc.OperationDef; … … 83 84 } 84 85 }; 85 86 87 /** 88 * Constant created for removing template. 89 * Constant created to be a parameter of a message of an {@link AutoAction}. 90 * Used for skinning. 91 */ 92 public static final String REMOVE_TEMPLATE = "Remove template."; 86 93 //TODO Think of a better place for those: 87 94 88 95 /** 96 * Constant created for removing resource. 97 * Constant created to be a parameter of a message of an {@link AutoAction}. 98 * Used for skinning. 99 */ 100 public static final String REMOVE_RESOURCE = "Remove resource"; 101 102 /** 89 103 * Deletes a resource. 90 104 * 91 105 * @param resource … … 107 121 108 122 final ResourceRefR4 resourceRef = ResourceRefR4.getRelativeRef( 109 123 bookAccess.getRef(), resource.getRef()); 110 new AutoAction( "Remove resource", true) {124 new AutoAction(Message.create(REMOVE_RESOURCE), true) { 111 125 @Override 112 126 public void performAuto() { 113 127 getChanger().removeResource(resourceRef); … … 191 205 ResourceAccess bookAccess = bookView.getAccess(); 192 206 final ResourceRefList templates = key.get(bookAccess); 193 207 if (templates.contains(ref)) { 194 new AutoAction( "Remove template.", true) {208 new AutoAction(Message.create(REMOVE_TEMPLATE), true) { 195 209 @Override 196 210 public void performAuto() { 197 211 getChanger().removeResource(ref); -
modules/org.sophie2.main.func.text/src/test/java/org/sophie2/main/func/text/content/view/HotTextSearchTest.java
12 12 import org.sophie2.base.model.book.PageH; 13 13 import org.sophie2.base.model.resources.r4.ResourceRefR4; 14 14 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 15 import org.sophie2.base.model.resources.r4.changes.AutoAction; 15 16 import org.sophie2.base.model.text.smart.ImmHotText; 16 17 import org.sophie2.base.natlib.BaseNatlibModule; 17 18 import org.sophie2.base.scene.BaseSceneModule; 18 19 import org.sophie2.base.skins.BaseSkinsModule; 20 import org.sophie2.base.skins.Message; 19 21 import org.sophie2.base.visual.BaseVisualModule; 20 22 import org.sophie2.core.modularity.SophieModule; 21 23 import org.sophie2.core.mvc.CoreMvcModule; … … 40 42 */ 41 43 public class HotTextSearchTest extends AppTestBase { 42 44 45 /** 46 * Constant created for creating frame 2. 47 * Constant created to be a parameter of a message of an {@link AutoAction}. 48 * Used for skinning. Used in the test. 49 */ 50 public static final String CREATE_FRAME_2 = "Create frame 2"; 51 52 /** 53 * Constant created for creating frame. 54 * Constant created to be a parameter of a message of an {@link AutoAction}. 55 * Used for skinning. Used in the test. 56 */ 57 public static final String CREATE_FRAME = "Create frame"; 43 58 private BookH book; 44 59 private RootPageView pageView; 45 60 private HeadTextFrameView frameView; … … 79 94 this.hotText = ImmHotText.createPlain("a b c ddd e fff g h i j k lll"); 80 95 81 96 HeadTextFrameH.createTextFrameAction(this.book, page, this.hotText, ResourceRefR4.NONE_REF.toUri(), null, 82 "Create frame", true);97 Message.create(CREATE_FRAME), true); 83 98 this.pageView = bdw.bookView().get().getPageView( 84 99 ResourceRefR4.getRelativeRef(this.book.getRef(), page.getRef())); 85 100 … … 94 109 @Test 95 110 public void testElementSearch() { 96 111 HeadTextFrameH.createTextFrameAction(this.book, this.pageView.model().get(), ImmHotText.createPlain("ddd"), ResourceRefR4.NONE_REF.toUri(), 97 null, "Create frame 2", true);112 null, Message.create(CREATE_FRAME_2), true); 98 113 99 114 List<SearchMatch> results = new ArrayList<SearchMatch>(); 100 115 this.pageView.search("ddd", results); -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/appearance/ImagePickerHud.java
28 28 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 29 29 import org.sophie2.base.model.resources.r4.changes.AutoAction; 30 30 import org.sophie2.base.model.resources.r4.resources.ResourceH; 31 import org.sophie2.base.skins.Message; 31 32 import org.sophie2.base.skins.SkinElementId; 32 33 import org.sophie2.base.visual.BaseVisualElement; 33 34 import org.sophie2.base.visual.skins.ElementSkinPart; … … 199 200 } else { 200 201 selectedRef = ResourceRefR4.NONE_REF; 201 202 } 202 new AutoAction( "Change background image", true) {203 new AutoAction(Message.create(CHANGE_BACKGROUND_IMAGE), true) { 203 204 @Override 204 205 public void performAuto() { 205 206 getChanger().setRaw(StyledElement.KEY_BACKGROUND__IMAGE, selectedRef); … … 212 213 213 214 }; 214 215 216 /** 217 * Constant created for changing background image. 218 * Constant created to be a parameter of a message of an {@link AutoAction}. 219 * Used for skinning. 220 */ 221 public static final String CHANGE_BACKGROUND_IMAGE = "Change background image"; 215 222 } 216 223 217 224 } … … 283 290 284 291 final PatternOptions newOptions = oldOptions.modifyOffset(newOffset); 285 292 286 new AutoAction( "change-background-image-x-offset", true) {293 new AutoAction(Message.create(CHANGE_BACKGROUND_IMAGE_X_OFFSET), true) { 287 294 @Override 288 295 public void performAuto() { 289 296 getChanger().setRaw(StyledElement.KEY_BACKGROUND__TYPE, BackgroundType.IMAGE); … … 319 326 320 327 final PatternOptions newOptions = oldOptions.modifyOffset(newOffset); 321 328 322 new AutoAction( "Change background image offset", true) {329 new AutoAction(Message.create(CHANGE_BACKGROUND_IMAGE_OFFSET), true) { 323 330 @Override 324 331 public void performAuto() { 325 332 getChanger().setRaw(StyledElement.KEY_BACKGROUND__TYPE, BackgroundType.IMAGE); … … 352 359 353 360 final PatternOptions newOptions = oldOptions.modifyScale(newSize); 354 361 355 new AutoAction( "Change background image scale", true) {362 new AutoAction(Message.create(CHANGE_BACKGROUND_IMAGE_SCALE), true) { 356 363 @Override 357 364 public void performAuto() { 358 365 getChanger().setRaw(StyledElement.KEY_BACKGROUND__TYPE, BackgroundType.IMAGE); … … 382 389 PatternOptions oldOptions = AppearanceHud.getStyleHelper(hud).getBackgroundPattern().getOptions(); 383 390 384 391 final PatternOptions newOptions = oldOptions.modifyType(input.getSelectedItem()); 385 new AutoAction( "Change background pattern type", true) {392 new AutoAction(Message.create(CHANGE_BACKGROUND_PATTERN_TYPE), true) { 386 393 @Override 387 394 public void performAuto() { 388 395 getChanger().setRaw(StyledElement.KEY_BACKGROUND__TYPE, BackgroundType.IMAGE); … … 394 401 395 402 }; 396 403 404 /** 405 * Constant created for changing background pattern type. 406 * Constant created to be a parameter of a message of an {@link AutoAction}. 407 * Used for skinning. 408 */ 409 public static final String CHANGE_BACKGROUND_PATTERN_TYPE = "Change background pattern type"; 410 411 /** 412 * Constant created for changing background image scale. 413 * Constant created to be a parameter of a message of an {@link AutoAction}. 414 * Used for skinning. 415 */ 416 public static final String CHANGE_BACKGROUND_IMAGE_SCALE = "Change background image scale"; 417 418 /** 419 * Constant created for changing background image offset. 420 * Constant created to be a parameter of a message of an {@link AutoAction}. 421 * Used for skinning. 422 */ 423 public static final String CHANGE_BACKGROUND_IMAGE_OFFSET = "Change background image offset"; 424 425 /** 426 * Constant created changing background image x offset. 427 * Constant created to be a parameter of a message of an {@link AutoAction}. 428 * Used for skinning. 429 */ 430 public static final String CHANGE_BACKGROUND_IMAGE_X_OFFSET = "change-background-image-x-offset"; 431 397 432 } 398 433 } 399 434 -
modules/org.sophie2.base.model.resources.r4/src/main/java/org/sophie2/base/model/resources/r4/changes/AutoAction.java
12 12 import org.sophie2.base.model.resources.r4.ResourceRefR4; 13 13 import org.sophie2.base.model.resources.r4.access.DelegatingAccess; 14 14 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 15 import org.sophie2.base.skins.Message; 15 16 import org.sophie2.core.prolib.util.ProUtil; 16 17 17 18 /** … … 24 25 */ 25 26 public abstract class AutoAction { 26 27 27 private final Stringdescription;28 private final Message description; 28 29 private final boolean significant; 29 30 30 31 /** … … 36 37 * @param significant 37 38 * The significance of the new <code>AutoAction</code>. 38 39 */ 39 public AutoAction( Stringdescription, boolean significant) {40 public AutoAction(Message description, boolean significant) { 40 41 this.description = description; 41 42 this.significant = significant; 42 43 } … … 88 89 access.getAccessOptions().getViewId(), 89 90 this.description, this.significant, autoActionClass, 90 91 values)); 92 //message 91 93 } 92 94 93 95 /** … … 164 166 * @param description 165 167 * String description of the change to be registered. 166 168 */ 167 public static void registerEndChange(ResourceAccess access, Stringdescription) {169 public static void registerEndChange(ResourceAccess access, Message description) { 168 170 EndAutoAction endChange = new EndAutoAction(description); 169 171 endChange.register(access); 170 172 } … … 184 186 * @param description 185 187 * The description oft he new change. 186 188 */ 187 public EndAutoAction( Stringdescription) {189 public EndAutoAction(Message description) { 188 190 super(description, true); 189 191 } 190 192 -
modules/org.sophie2.extra.func.scripting/src/main/java/org/sophie2/extra/func/scripting/logic/RunScriptLogic.java
15 15 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 16 16 import org.sophie2.base.model.resources.r4.access.ResourceLocator; 17 17 import org.sophie2.base.model.resources.r4.changes.AutoAction; 18 import org.sophie2.base.skins.Message; 18 19 import org.sophie2.core.modularity.SortKey; 19 20 import org.sophie2.core.mvc.EventFilterBuilder; 20 21 import org.sophie2.core.mvc.OperationDef; … … 94 95 result = "(no result)"; 95 96 } 96 97 view.scriptResult().set(result != null ? result.toString() : "null"); 97 String description = "Run script '" + resource.getName() + "'."; 98 AutoAction.registerEndChange(view.getAccess(), description); 98 AutoAction.registerEndChange(view.getAccess(), Message.create(RUN_SCRIPT, resource.getName())); 99 99 } catch (EcmaError e) { 100 100 view.scriptResult().set("ERROR: " + e.getMessage()); 101 101 } catch (EvaluatorException e) { … … 107 107 return true; 108 108 } 109 109 }, 110 110 111 111 /** 112 112 * The 'Run script' action triggered by link. 113 113 */ … … 201 201 jsAdapter.setAdaptedObject(adaptedObject); 202 202 203 203 } 204 205 /** 206 * Constant created for running a script. Takes one parameter - resource name. 207 * Constant created to be a parameter of a message of an {@link AutoAction}. 208 * Used for skinning. 209 */ 210 public static final String RUN_SCRIPT = "Run script %1$s."; 204 211 } -
modules/org.sophie2.server.core/src/test/java/org/sophie2/server/core/facade/ServerFacadeTest.java
41 41 import org.sophie2.base.model.resources.r4.resources.ResourceH; 42 42 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 43 43 import org.sophie2.base.model.security.BaseModelSecurityModule; 44 import org.sophie2.base.skins.Message; 44 45 import org.sophie2.core.logging.SophieLog; 45 46 import org.sophie2.core.modularity.FakeModuleRegistry; 46 47 import org.sophie2.core.testing.UnitTestBase; … … 56 57 */ 57 58 public class ServerFacadeTest extends UnitTestBase { 58 59 60 /** 61 * Constant created for creating a resource. 62 * Constant created to be a parameter of a message of an {@link AutoAction}. 63 * Used for skinning. Used in the test. 64 */ 65 public static final String CREATE_RESOURCE = "Create resource"; 66 67 /** 68 * Constant created for creating a new page. 69 * Constant created to be a parameter of a message of an {@link AutoAction}. 70 * Used for skinning. Used in the test. 71 */ 72 public static final String CREATE_NEW_PAGE = "Create new page"; 59 73 private ServerFacade facade; 60 74 61 75 private ResourceAccess createBook(ResourceRefR4 bookRef) throws Exception { … … 82 96 final String pageName = 83 97 ResourceUtil.getNextTitle(book.getRef(), PageR4.DEFAULT_TITLE); 84 98 85 new AutoAction( "Create new page", true) {99 new AutoAction(Message.create(CREATE_NEW_PAGE), true) { 86 100 @Override 87 101 public void performAuto() { 88 102 BookH.addNewPage(getChanger(), pageRef, pages, pageName); … … 95 109 private ResourceAccess initResource(ResourceAccess access, 96 110 Class<? extends ResourceR4> resourceModelClass) throws Exception { 97 111 final ImmList<Key<?>> modelKeys = findModelKeys(resourceModelClass); 98 new AutoAction( "Create resource", true) {112 new AutoAction(Message.create(CREATE_RESOURCE), true) { 99 113 @SuppressWarnings("unchecked") 100 114 @Override 101 115 public void performAuto() { … … 195 209 ResourceAccess access = createBook(memRef); 196 210 final int changesCount = 10; 197 211 for (int i = 0; i < changesCount; i++) { 198 createDummyChange(access, "dummy change " + i);212 createDummyChange(access, Message.create("dummy change " + i)); 199 213 } 200 214 Response<ImmList<HistoryEntry>> resourceHistory; 201 215 resourceHistory = this.facade.getResourceHistory("123", serverRef, … … 233 247 changesCount)); 234 248 } 235 249 236 private void createDummyChange(ResourceAccess access, Stringcomment) {250 private void createDummyChange(ResourceAccess access, Message comment) { 237 251 238 252 new AutoAction(comment, true) { 239 253 -
modules/org.sophie2.server.mock/src/main/java/org/sophie2/server/mock/bindata/FacadeBinDataTest.java
32 32 import org.sophie2.base.model.resources.r4.keys.UndefinedKey; 33 33 import org.sophie2.base.model.resources.r4.model.ResourceModel; 34 34 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 35 import org.sophie2.base.skins.Message; 35 36 import org.sophie2.core.logging.LogLevel; 36 37 import org.sophie2.core.logging.SophieLog; 37 38 import org.sophie2.core.modularity.FileEntryManager; … … 49 50 */ 50 51 public class FacadeBinDataTest extends ServerModelTestBase { 51 52 53 /** 54 * Constant created for uploading. 55 * Constant created to be a parameter of a message of an {@link AutoAction}. 56 * Used for skinning. Used in the test. 57 */ 58 public static final String UPLOAD = "Upload"; 59 60 /** 61 * Constant created for setting up binary server book. 62 * Constant created to be a parameter of a message of an {@link AutoAction}. 63 * Used for skinning. Used in the test. 64 */ 65 public static final String SETUP_BINATY_SERVER_BOOK = "Setup binaty server book"; 52 66 private FileBinData testData = null; 53 67 54 68 @Override … … 94 108 final BinData testData2 = new RawBinData("boo booo".getBytes()); 95 109 final ResourceRefR4 ref = ResourceRefR4.generateRandomSub("bin"); 96 110 97 new AutoAction( "Setup binaty server book", true) {111 new AutoAction(Message.create(SETUP_BINATY_SERVER_BOOK), true) { 98 112 @Override 99 113 public void performAuto() { 100 114 getChanger().makeResource(ref); … … 190 204 getFacade(), absServerRef, sessionId, originalModel, false); 191 205 final ResourceRefList curResources = getServerDirectory().getResources(); 192 206 193 new AutoAction( "Upload", true) {207 new AutoAction(Message.create(UPLOAD), true) { 194 208 195 209 @Override 196 210 public void performAuto() { -
modules/org.sophie2.main.func.text/src/test/java/org/sophie2/main/func/text/links/LinkAttachmentsTest.java
30 30 import org.sophie2.base.model.text.smart.layout.HotLayout; 31 31 import org.sophie2.base.model.text.smart.position.HotInterval; 32 32 import org.sophie2.base.skins.BaseSkinsModule; 33 import org.sophie2.base.skins.Message; 33 34 import org.sophie2.base.visual.BaseVisualModule; 34 35 import org.sophie2.base.visual.interaction.InputEventR3; 35 36 import org.sophie2.base.visual.interaction.ModifierSet; … … 60 61 */ 61 62 public class LinkAttachmentsTest extends AppTestBase { 62 63 64 /** 65 * Constant created for creating a frame. 66 * Constant created to be a parameter of a message of an {@link AutoAction}. 67 * Used for skinning. Used in the test. 68 */ 69 public static final String CREATE_FRAME = "Create frame"; 70 71 /** 72 * Constant created for adding link. 73 * Constant created to be a parameter of a message of an {@link AutoAction}. 74 * Used for skinning. Used in the test. 75 */ 76 public static final String ADD_LINK = "Add link"; 63 77 private HeadTextFrameView fv; 64 78 private HeadTextFrameH textFrame; 65 79 … … 90 104 ImmHotText text = ImmHotText.createPlain(str); 91 105 ResourceRefR4 textFrameRef = 92 106 HeadTextFrameH.createTextFrameAction(book, new PageH(pageAccess), 93 text, ResourceRefR4.NONE_REF.toUri(), null, "Create frame", true);107 text, ResourceRefR4.NONE_REF.toUri(), null, Message.create(CREATE_FRAME), true); 94 108 ResourceAccess textFrameAccess = bookAccess.open(textFrameRef, null); 95 109 this.textFrame = new HeadTextFrameH(textFrameAccess); 96 110 … … 107 121 ImmColor.MAGENTA); 108 122 final ImmHotText newText = text.addAttachment(this.linkInterval, this.linkAtt); 109 123 110 new AutoAction( "Add link", true) {124 new AutoAction(Message.create(ADD_LINK), true) { 111 125 112 126 @Override 113 127 public void performAuto() { -
modules/org.sophie2.main.func.templates/src/main/java/org/sophie2/main/func/templates/frame/ApplyFrameTemplateHandler.java
8 8 import org.sophie2.base.model.resources.r4.changes.AutoAction; 9 9 import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 10 10 import org.sophie2.base.model.resources.r4.resources.ResourceH; 11 import org.sophie2.base.skins.Message; 11 12 import org.sophie2.main.app.commons.element.ElementDropHandler; 12 13 import org.sophie2.main.app.commons.frame.FrameView; 13 14 import org.sophie2.main.app.commons.util.TemplateUtil; … … 59 60 final String templateKind = templateH.getKind(); 60 61 final NaiveImmList<TemplatedKey<?>> immKeys = templateH.getApplicableTemplatedKeys(); 61 62 62 new AutoAction( "Apply frame template.", true) {63 new AutoAction(Message.create(FRAME_TEMPLATE), true) { 63 64 64 65 @Override 65 66 public void performAuto() { … … 69 70 70 71 }.register(frameAccess); 71 72 } 73 74 /** 75 * Constant created for applying frame template. 76 * Constant created to be a parameter of a message of an {@link AutoAction}. 77 * Used for skinning. 78 */ 79 public static final String FRAME_TEMPLATE = "Apply frame template."; 72 80 } -
modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/book/BookView.java
24 24 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 25 25 import org.sophie2.base.model.resources.r4.changes.AutoAction; 26 26 import org.sophie2.base.model.resources.r4.resources.ResourceH; 27 import org.sophie2.base.skins.Message; 27 28 import org.sophie2.base.visual.BaseVisualElement; 28 29 import org.sophie2.core.logging.Profiler; 29 30 import org.sophie2.core.logging.SophieLog; … … 50 51 public class BookView extends BaseVisualElement implements MediaComposite, ResourceView { 51 52 52 53 /** 54 * Constant created for adding new templated page. 55 * Constant created to be a parameter of a message of an {@link AutoAction}. 56 * Used for skinning. 57 */ 58 public static final String ADD_NEW_TEMPLATED_PAGE = "Add a new templated page"; 59 60 /** 61 * Constant created for adding new page. 62 * Constant created to be a parameter of a message of an {@link AutoAction}. 63 * Used for skinning. 64 */ 65 public static final String ADD_NEW_PAGE = "Add a new page"; 66 67 /** 53 68 * Creates a new {@code BookView} with a given {@link ResourceAccess}. Sets 54 69 * the {@link BookViewOptions} to the default author options. 55 70 * … … 501 516 ResourceRefR4 realTemplateRef = getTemplateRef(templateRef); 502 517 boolean significant = ResourceRefR4.NONE_REF.equals(realTemplateRef); 503 518 504 new AutoAction( "Add a new page", significant) {519 new AutoAction(Message.create(ADD_NEW_PAGE), significant) { 505 520 506 521 @Override 507 522 public void performAuto() { … … 523 538 524 539 TemplateUtil.applyPageTemplate(page, absTemplateRef, null, getAllSubelements(templateH)); 525 540 526 AutoAction.registerEndChange(getAccess(), "Add a new templated page");541 AutoAction.registerEndChange(getAccess(), Message.create(ADD_NEW_TEMPLATED_PAGE)); 527 542 } 528 543 529 544 goToPage(model().get().getPages().get(index)); -
modules/org.sophie2.base.skins/src/main/java/org/sophie2/base/skins/Message.java
1 package org.sophie2.base.skins; 2 3 import java.util.ArrayList; 4 import java.util.List; 5 6 import org.sophie2.core.logging.SophieLog; 7 import org.sophie2.core.prolib.annot.Immutable; 8 9 /** 10 * Message is the object that will be transferred when an auto action is created. 11 * A message object is constructed via a factory create method. Constructed via key and parameters. 12 * The key parameter is the one that will be used for skinning. The number of parameters can be different 13 * every time. The parameters are the parameters of the key. 14 * 15 * 16 * <ul> 17 * <b>Example</b> 18 * <li> key = "The size changed from %1$s to %2$s" 19 * <li> param1 = 10 20 * <li> param2 = 20 21 * </ul> 22 * 23 * 24 * Messages are important when there are different clients with different localization. 25 * 26 * @author tanya 27 */ 28 @Immutable 29 public class Message { 30 31 private List<Object> parameters; 32 private String key; 33 34 private Message(String key, Object...parameters) { 35 this.key = key; 36 this.parameters = new ArrayList<Object>(); 37 38 for (Object param : parameters) { 39 this.parameters.add(param); 40 } 41 } 42 43 /** 44 * Factory method that creates a new message. 45 * 46 * @param key 47 * The key using which the description of the auto action is to be skinned. 48 * @param parameters 49 * The parameters of the key that will be necessary to the description to be created. 50 * @return 51 * New instance of a message. 52 */ 53 public static Message create(String key, Object...parameters) { 54 assert key != null : "Key must not be null!"; 55 assert key != "" : "Key must not be empty string!"; 56 57 return new Message(key, parameters); 58 } 59 60 /** 61 * Returns the description of the message. 62 * 63 * @return 64 * The description of the message. 65 */ 66 public String getText() { 67 String fromSkin = SkinUtil.getSkinValue(getClass(), this.key, String.class); 68 String toFormat = (fromSkin == null)? this.key : fromSkin; 69 70 SophieLog.trace(toFormat); 71 SophieLog.trace(this.parameters); 72 73 return String.format(toFormat, this.parameters.toArray()); 74 } 75 76 @Override 77 public int hashCode() { 78 final int prime = 31; 79 int result = 1; 80 result = prime * result + ((this.key == null) ? 0 : this.key.hashCode()); 81 result = prime * result 82 + ((this.parameters == null) ? 0 : this.parameters.hashCode()); 83 return result; 84 } 85 86 @Override 87 public boolean equals(Object obj) { 88 if (this == obj) { 89 return true; 90 } 91 if (obj == null) { 92 return false; 93 } 94 if (getClass() != obj.getClass()) { 95 return false; 96 } 97 Message other = (Message) obj; 98 if (this.key == null) { 99 if (other.key != null) { 100 return false; 101 } 102 } else if (!this.key.equals(other.key)) { 103 return false; 104 } 105 if (this.parameters == null) { 106 if (other.parameters != null) { 107 return false; 108 } 109 } else if (!this.parameters.equals(other.parameters)) { 110 return false; 111 } 112 return true; 113 } 114 } -
modules/org.sophie2.server.core/src/test/java/org/sophie2/server/core/facade/MergeChangesTest.java
26 26 import org.sophie2.base.model.resources.r4.model.ResourceModel; 27 27 import org.sophie2.base.model.resources.r4.model.RevisionId; 28 28 import org.sophie2.base.persistence.BasePersistenceModule; 29 import org.sophie2.base.skins.Message; 29 30 import org.sophie2.core.modularity.FakeModuleRegistry; 30 31 import org.sophie2.server.core.ServerResourceHelper; 31 32 import org.sophie2.server.core.persistence.access.DBResourceAccess; … … 40 41 */ 41 42 public class MergeChangesTest extends DBModelTest { 42 43 44 /** 45 * Constant created for making a book. 46 * Constant created to be a parameter of a message of an {@link AutoAction}. 47 * Used for skinning. Used in the test. 48 */ 49 public static final String MAKE_BOOK = "Make book"; 50 43 51 private static final String SERVER_URL = "http://localhost:8003"; 44 52 45 53 private ServerFacade facade = null; … … 77 85 private BookH createInitialBook() { 78 86 final ResourceRefR4 bookRef = ResourceRefR4.generateRandomSub("Book"); 79 87 80 new AutoAction( "Make book", true) {88 new AutoAction(Message.create(MAKE_BOOK), true) { 81 89 82 90 @Override 83 91 public void performAuto() { … … 134 142 135 143 private ModelChange createChange(ResourceRefR4 pageRef) { 136 144 String description = "Change page border"; 137 AutoAction autoAction = new AutoAction( description, true) {145 AutoAction autoAction = new AutoAction(Message.create(description), true) { 138 146 @Override 139 147 public void performAuto() { 140 148 getChanger().setRaw(StyledElement.KEY_BORDER__COLOR, ImmColor.BLUE); … … 142 150 }; 143 151 ImmList<Object> fields = AutoAction.getConstructorArgs(autoAction); 144 152 ModelChange res = new ModelChange(pageRef, null, null, 145 description, true, autoAction.getClass(), fields);153 Message.create(description), true, autoAction.getClass(), fields); 146 154 return res; 147 155 } 148 156 149 157 private ModelChange createDeleteChange(final ResourceRefR4 pageRef) { 150 158 String description = "Delete page"; 151 AutoAction autoAction = new AutoAction( description, true) {159 AutoAction autoAction = new AutoAction(Message.create(description), true) { 152 160 @Override 153 161 public void performAuto() { 154 162 getChanger().removeResource(pageRef); … … 156 164 }; 157 165 ImmList<Object> fields = AutoAction.getConstructorArgs(autoAction); 158 166 ModelChange res = new ModelChange(ResourceRefR4.CURRENT_REF, null, null, 159 description, true, autoAction.getClass(), fields);167 Message.create(description), true, autoAction.getClass(), fields); 160 168 return res; 161 169 } 162 170 -
modules/org.sophie2.main.func.links/src/main/java/org/sophie2/main/func/links/LinksHudLogic.java
13 13 import org.sophie2.base.model.book.resource.r4.ElementR4; 14 14 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 15 15 import org.sophie2.base.model.resources.r4.changes.AutoAction; 16 import org.sophie2.base.skins.Message; 16 17 import org.sophie2.core.mvc.EventFilterBuilder; 17 18 import org.sophie2.core.mvc.EventParams; 18 19 import org.sophie2.core.mvc.LogicR3; … … 87 88 final Link newLink = new Link(rules.add(newRule)); 88 89 89 90 LogicR3.fire(hud, control, null, event, EventIds.SET_LINK, 90 newLink, "Add link rule");91 newLink, Message.create(ADD_LINK_RULE)); 91 92 92 93 assert holder.getLink().getRules().asList().indexOf(newRule) >= 0 : 93 94 "The rule could not be added!"; … … 114 115 final Link newLink = new Link(newRules); 115 116 116 117 LogicR3.fire(hud, control, null, event, EventIds.SET_LINK, 117 newLink, "Change link trigger");118 newLink, Message.create(CHANGE_LINK_TRIGGER)); 118 119 119 120 hud.wantedRule().set(newRule); 120 121 } … … 161 162 final Link newLink = new Link(newRules); 162 163 163 164 LogicR3.fire(hud, control, null, event, EventIds.SET_LINK, 164 newLink, "Change link action");165 newLink, Message.create(CHANGE_LINK_ACTION)); 165 166 166 167 hud.wantedRule().set(newRule); 167 168 SwingUtilities.invokeLater(new Runnable() { … … 207 208 final Link newLink = new Link(rules.remove(ruleIndex)); 208 209 209 210 LogicR3.fire(hud, control, null, event, EventIds.SET_LINK, 210 newLink, "Remove link rule");211 newLink, Message.create(REMOVE_LINK_RULE)); 211 212 212 213 hud.wantedRule().set(null); 213 214 return true; … … 230 231 ResourceAccess access = hud.holder().get().getAccess(); 231 232 232 233 final Link newLink = event.getEventParam(LinksHudLogic.EventIds.LINK_PARAM_INDEX, Link.class); 233 String description = event.getEventParam(LinksHudLogic.EventIds.DESCRIPTION_PARAM_INDEX, String.class);234 Message description = event.getEventParam(LinksHudLogic.EventIds.DESCRIPTION_PARAM_INDEX, Message.class); 234 235 235 236 new AutoAction(description, true) { 236 237 … … 246 247 }; 247 248 248 249 /** 250 * Constant created for removing link rule. 251 * Constant created to be a parameter of a message of an {@link AutoAction}. 252 * Used for skinning. 253 */ 254 public static final String REMOVE_LINK_RULE = "Remove link rule"; 255 256 /** 257 * Constant created for changing link action. 258 * Constant created to be a parameter of a message of an {@link AutoAction}. 259 * Used for skinning. 260 */ 261 public static final String CHANGE_LINK_ACTION = "Change link action"; 262 263 /** 264 * Constant created for changing link tigger. 265 * Constant created to be a parameter of a message of an {@link AutoAction}. 266 * Used for skinning. 267 */ 268 public static final String CHANGE_LINK_TRIGGER = "Change link trigger"; 269 270 /** 271 * Constant created for adding link rule. 272 * Constant created to be a parameter of a message of an {@link AutoAction}. 273 * Used for skinning. 274 */ 275 public static final String ADD_LINK_RULE = "Add link rule"; 276 277 /** 249 278 * The ids of the events that can be fired by this logic. 250 279 * 251 280 * @author deni -
modules/org.sophie2.base.model.resources.r4/src/main/java/org/sophie2/base/model/resources/r4/changes/MetaChange.java
13 13 import org.sophie2.base.model.resources.r4.keys.Key; 14 14 import org.sophie2.base.model.resources.r4.model.ResourceRevision; 15 15 import org.sophie2.base.model.resources.r4.model.RevisionId; 16 import org.sophie2.base.skins.Message; 16 17 17 18 /** 18 19 * Represents a meta {@link Change} to the model. … … 41 42 * @param revisionsToSkip 42 43 * The ids of the revisions this <code>MetaChange</code> reverses. 43 44 */ 44 public MetaChange(ResourceRefR4 user, String viewId, Stringdescription,45 public MetaChange(ResourceRefR4 user, String viewId, Message description, 45 46 MetaChangeType type, ImmList<RevisionId> revisionsToSkip) { 46 47 super(user, viewId, description, true); 47 48 this.type = type; … … 100 101 * The description of the registered skip change. 101 102 */ 102 103 public static void registerSkip(ResourceAccess access, ResourceRevision revToSkip, 103 Stringdescription) {104 Message description) { 104 105 registerMetaChange(access, MetaChangeType.SKIP, 105 106 getGroupedRevisions(revToSkip, access.getAccessOptions().getViewId()), 106 107 description); … … 119 120 120 121 registerMetaChange(access, MetaChangeType.UNDO, 121 122 getGroupedRevisions(toUndo, access.getAccessOptions().getViewId()), 122 toUndo.getLastChange().getDescription());123 Message.create(toUndo.getLastChange().getDescription())); 123 124 } 124 125 125 126 private static ImmList<RevisionId> getGroupedRevisions(ResourceRevision revision, … … 202 203 203 204 ImmList<RevisionId> skipIds = NaiveImmList.create(toRedo.getId()); 204 205 registerMetaChange(access, MetaChangeType.REDO, skipIds, 205 toRedo.getLastChange().getDescription());206 Message.create(toRedo.getLastChange().getDescription())); 206 207 207 208 } 208 209 … … 238 239 } 239 240 240 241 private static void registerMetaChange(ResourceAccess access, MetaChangeType type, 241 ImmList<RevisionId> revisionsToSkip, Stringdescription) {242 ImmList<RevisionId> revisionsToSkip, Message description) { 242 243 MetaChange change = new MetaChange(access.getAccessOptions().getUser(), 243 244 access.getAccessOptions().getViewId(), 244 245 description, type, revisionsToSkip); -
modules/org.sophie2.main.func.media/src/main/java/org/sophie2/main/func/media/logic/MediaPropertiesHudLogic.java
6 6 import org.sophie2.base.layout.LogicR3ToggleButton; 7 7 import org.sophie2.base.model.resources.r4.changes.AutoAction; 8 8 import org.sophie2.base.model.resources.r4.keys.Key; 9 import org.sophie2.base.skins.Message; 9 10 import org.sophie2.core.logging.SophieLog; 10 11 import org.sophie2.core.mvc.EventFilterBuilder; 11 12 import org.sophie2.core.mvc.OperationDef; … … 53 54 return false; 54 55 } 55 56 56 new AutoAction( "Change looping", true) {57 new AutoAction(Message.create(CHANGE_LOOPING), true) { 57 58 58 59 @Override 59 60 public void performAuto() { … … 106 107 final MediaClip clip = new MediaClip(value, helper.getMediaClip() 107 108 .getEndSecond()); 108 109 109 new AutoAction( "Change clipping start position", true) {110 new AutoAction(Message.create(CHANGE_CLIPPING_START_POSITION), true) { 110 111 111 112 @Override 112 113 public void performAuto() { … … 156 157 final MediaClip clip = new MediaClip(helper.getMediaClip() 157 158 .getStartSecond(), value); 158 159 159 new AutoAction( "Change clipping end position", true) {160 new AutoAction(Message.create(CHANGE_CLIPPING_END_POSITION), true) { 160 161 161 162 @Override 162 163 public void performAuto() { … … 188 189 189 190 final Key<Boolean> key = event.getEventParam( 190 191 MediaPropertiesHud.EventIds.KEY_PARAM_INDEX, Key.class); 191 Stringdescription = event.getEventParam(192 MediaPropertiesHud.EventIds.DESCR_PARAM_INDEX, String.class);192 Message description = event.getEventParam( 193 MediaPropertiesHud.EventIds.DESCR_PARAM_INDEX, Message.class); 193 194 final boolean shown = event.getEventParam( 194 195 MediaPropertiesHud.EventIds.VISIBLE_PARAM_INDEX, Boolean.class); 195 196 … … 204 205 return true; 205 206 } 206 207 }; 208 209 /** 210 * Constant created for changing clipping end position. 211 * Constant created to be a parameter of a message of an {@link AutoAction}. 212 * Used for skinning. 213 */ 214 public static final String CHANGE_CLIPPING_END_POSITION = "Change clipping end position"; 215 216 /** 217 * Constant created for changing clipping start position. 218 * Constant created to be a parameter of a message of an {@link AutoAction}. 219 * Used for skinning. 220 */ 221 public static final String CHANGE_CLIPPING_START_POSITION = "Change clipping start position"; 222 223 /** 224 * Constant created for changing looping. 225 * Constant created to be a parameter of a message of an {@link AutoAction}. 226 * Used for skinning. 227 */ 228 public static final String CHANGE_LOOPING = "Change looping"; 207 229 } -
modules/org.sophie2.extra.comment/src/test/java/org/sophie2/extra/comment/model/CommentStreamTest.java
13 13 import org.sophie2.base.model.resources.r4.immutables.ImmDate; 14 14 import org.sophie2.base.model.resources.r4.resources.ResourceH; 15 15 import org.sophie2.base.model.text.smart.ImmHotText; 16 import org.sophie2.base.skins.Message; 16 17 import org.sophie2.core.modularity.SophieModule; 17 18 import org.sophie2.extra.comment.CommentModule; 18 19 import org.sophie2.extra.comment.CommentTestUtil; … … 24 25 */ 25 26 public class CommentStreamTest extends ModelTestBase { 26 27 28 public static final String ADD_A_REPLY_TO_THE_FIRST_COMMENT = "Add a reply to the first comment."; 29 public static final String REMOVE_A_COMMENT_FROM_A_STREAM = "Remove a comment from a stream."; 27 30 private BookH book; 28 31 29 32 @Override … … 65 68 66 69 final ImmTreeList<Comment> comments = stream.get(CommentStream.KEY_COMMENTS); 67 70 68 new AutoAction( "Remove a comment from a stream.", true) {71 new AutoAction(Message.create(REMOVE_A_COMMENT_FROM_A_STREAM), true) { 69 72 70 73 @Override 71 74 public void performAuto() { … … 98 101 final Comment reply = new Comment(0, newText, newDate, 99 102 newAuthor, CommentTestUtil.COMMENT_1.getCommentId()); 100 103 101 new AutoAction( "Add a reply to the first comment.", true) {104 new AutoAction(Message.create(ADD_A_REPLY_TO_THE_FIRST_COMMENT), true) { 102 105 103 106 @Override 104 107 public void performAuto() { -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/grouping/GroupHalosLogic.java
18 18 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 19 19 import org.sophie2.base.model.resources.r4.changes.AutoAction; 20 20 import org.sophie2.base.model.resources.r4.resources.ResourceH; 21 import org.sophie2.base.skins.Message; 21 22 import org.sophie2.core.modularity.SortKey; 22 23 import org.sophie2.core.mvc.EventFilterBuilder; 23 24 import org.sophie2.core.mvc.LogicR3; … … 137 138 CompositeElement.KEY_SUB_ELEMENTS.get(access); 138 139 final String groupTitle = ResourceUtil.getNextTitle( 139 140 pwa.bookView().get().getAccess().getRef(), ElementGroupR4.DEFAULT_TITLE); 140 new AutoAction( "Group elements.", true) {141 new AutoAction(Message.create(GROUP_ELEMENTS), true) { 141 142 @Override 142 143 public void performAuto() { 143 144 ElementGroupH.createGroup(getChanger(), groupRef, groupTitle, … … 194 195 final ImmList<ActivationChannel> channels = 195 196 CompositeElement.KEY_SUB_ELEMENTS.get(parentAccess); 196 197 197 new AutoAction( "Delete group.", true) {198 new AutoAction(Message.create(DELETE_GROUP), true) { 198 199 @Override 199 200 public void performAuto() { 200 201 ElementGroupH.deleteGroup(getChanger(), groupRef, channels); … … 243 244 ActivationChannel frameChan = parentH.getActivationChannel(relativeGroupRef); 244 245 245 246 final ImmList<ActivationChannel> newChannels = channels.remove(frameChan); 246 new AutoAction( "Delete Group.", true) {247 new AutoAction(Message.create(DELETE_GROUP), true) { 247 248 @Override 248 249 public void performAuto() { 249 250 getChanger().removeResource(relativeGroupRef); … … 254 255 return true; 255 256 } 256 257 257 } 258 }; 259 260 /** 261 * Constant created for deleting a group. 262 * Constant created to be a parameter of a message of an {@link AutoAction}. 263 * Used for skinning. 264 */ 265 public static final String DELETE_GROUP = "Delete group."; 266 267 /** 268 * Constant created for grouping elements. 269 * Constant created to be a parameter of a message of an {@link AutoAction}. 270 * Used for skinning. 271 */ 272 public static final String GROUP_ELEMENTS = "Group elements."; 258 273 } -
modules/org.sophie2.extra.func.scripting/src/test/java/org/sophie2/extra/func/scripting/links/RunScriptLinkActionTest.java
25 25 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 26 26 import org.sophie2.base.natlib.BaseNatlibModule; 27 27 import org.sophie2.base.skins.BaseSkinsModule; 28 import org.sophie2.base.skins.Message; 28 29 import org.sophie2.base.visual.BaseVisualModule; 29 30 import org.sophie2.core.modularity.SophieModule; 30 31 import org.sophie2.core.mvc.CoreMvcModule; … … 55 56 */ 56 57 public class RunScriptLinkActionTest extends SystemTestBase { 57 58 59 /** 60 * Constant created for editing a script. 61 * Constant created to be a parameter of a message of an {@link AutoAction}. 62 * Used for skinning. Used in the test. 63 */ 64 public static final String EDIT_SCRIPT = "Edit Script"; 65 66 /** 67 * Constant created for adding a link rule. 68 * Constant created to be a parameter of a message of an {@link AutoAction}. 69 * Used for skinning. Used in the test. 70 */ 71 public static final String ADD_LINK_RULE = "Add link rule"; 72 73 /** 74 * Constant created for inserting a script. 75 * Constant created to be a parameter of a message of an {@link AutoAction}. 76 * Used for skinning. Used in the test. 77 */ 78 public static final String INSERT_SCRIPT = "Insert script"; 79 80 /** 81 * Constant created for setting a book title. 82 * Constant created to be a parameter of a message of an {@link AutoAction}. 83 * Used for skinning. Used in the test. 84 */ 85 public static final String SET_BOOK_TITLE = "Set book title"; 58 86 private BookH book; 59 87 private BookDocView bdv; 60 88 … … 102 130 @Test 103 131 public void testRunScriptLinkAction() { 104 132 105 new AutoAction( "Set book title", false) {133 new AutoAction(Message.create(SET_BOOK_TITLE), false) { 106 134 107 135 @Override 108 136 public void performAuto() { … … 122 150 @Test 123 151 public void testInvalidScript() { 124 152 125 new AutoAction( "Set book title", false) {153 new AutoAction(Message.create(SET_BOOK_TITLE), false) { 126 154 127 155 @Override 128 156 public void performAuto() { … … 143 171 final ResourceRefR4 scriptRef = 144 172 ResourceRefR4.generateRandomSub(ScriptResourceH.NAME_PREFIX); 145 173 final ResourceRefR4 bookRef = bookAccess.getRef(); 146 new AutoAction( "Insert script", true) {174 new AutoAction(Message.create(INSERT_SCRIPT), true) { 147 175 148 176 @Override 149 177 public void performAuto() { … … 153 181 }.register(bookAccess); 154 182 ResourceAccess scriptAccess = bookAccess.open( 155 183 scriptRef, bookAccess.getAccessOptions()); 156 new AutoAction( "Edit Script", true) {184 new AutoAction(Message.create(EDIT_SCRIPT), true) { 157 185 158 186 @Override 159 187 public void performAuto() { … … 172 200 ImmList<LinkRule> rules = ElementR4.KEY_LINK.get(page.getAccess()).getRules(); 173 201 final Link link = new Link(rules.add(rule)); 174 202 175 new AutoAction( "Add link rule", true) {203 new AutoAction(Message.create(ADD_LINK_RULE), true) { 176 204 177 205 @Override 178 206 public void performAuto() { -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/page/resize/PageResizeHaloButton.java
16 16 import org.sophie2.base.model.resources.r4.changes.AutoAction; 17 17 import org.sophie2.base.scene.SceneVisual; 18 18 import org.sophie2.base.scene.helpers.SceneHelper; 19 import org.sophie2.base.skins.Message; 19 20 import org.sophie2.base.skins.SkinElementId; 20 21 import org.sophie2.base.visual.BaseVisualElement; 21 22 import org.sophie2.base.visual.skins.ElementSkinPart; … … 32 33 @VisualElementDef(parent = PageResizeHaloMenu.class, sortKey = "kkk-page-resize-halo-button") 33 34 public class PageResizeHaloButton extends MoveHaloButton { 34 35 36 /** 37 * Constant created for notifying that a page is resized. 38 * Constant created to be a parameter of a message of an {@link AutoAction}. 39 * Used for skinning. 40 */ 41 public static final String PAGE_RESIZE = "Page resize"; 42 43 /** 44 * Constant created for setting page size. 45 * Constant created to be a parameter of a message of an {@link AutoAction}. 46 * Used for skinning. 47 */ 48 public static final String SET_PAGE_SIZE = "Set page size"; 49 50 35 51 @SuppressWarnings("unused") 36 52 @SkinPartDef 37 53 private static void defineSkin(ElementSkinPart part) { … … 71 87 sv.wantedViewRect().set(null); 72 88 73 89 74 new AutoAction( "Set page size", true) {90 new AutoAction(Message.create(SET_PAGE_SIZE), true) { 75 91 76 92 @Override 77 93 public void performAuto() { … … 104 120 } 105 121 106 122 final ImmSize value = new ImmSize(width, height); 107 new AutoAction( "Page resize", false) {123 new AutoAction(Message.create(PAGE_RESIZE), false) { 108 124 @Override 109 125 public void performAuto() { 110 126 getChanger().setRaw(BookR4.KEY_PAGE_SIZE, value); -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/TemplatesControlGroup.java
10 10 import org.sophie2.base.model.resources.r4.changes.AutoAction; 11 11 import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 12 12 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 13 import org.sophie2.base.skins.Message; 13 14 import org.sophie2.base.visual.skins.ElementSkinPart; 14 15 import org.sophie2.base.visual.skins.RelatedChildren; 15 16 import org.sophie2.base.visual.skins.SkinPartDef; … … 209 210 TemplatesControlGroup templateGroup = findParentElement(source, TemplatesControlGroup.class); 210 211 final ImmList<TemplatedKey<?>> keys = templateGroup.keys().get(); 211 212 212 new AutoAction( "Use template", true){213 new AutoAction(Message.create(USE_TEMPLATE), true){ 213 214 214 215 @Override 215 216 public void performAuto() { … … 255 256 256 257 final ImmList<Object> finalValues = accumultaingValues; 257 258 258 new AutoAction( "Lock", true){259 new AutoAction(Message.create(LOCK), true){ 259 260 260 261 @SuppressWarnings("unchecked") 261 262 @Override … … 304 305 305 306 final ImmList<Object> finalValues = accumultaingValues; 306 307 307 new AutoAction( "Lock", true){308 new AutoAction(Message.create(LOCK), true){ 308 309 309 310 @SuppressWarnings("unchecked") 310 311 @Override … … 322 323 return true; 323 324 } 324 325 325 } 326 }; 327 328 /** 329 * Constant created for expressing lock. 330 * Constant created to be a parameter of a message of an {@link AutoAction}. 331 * Used for skinning. 332 */ 333 public static final String LOCK = "Lock"; 326 334 335 /** 336 * Constant created for expressing use template. 337 * Constant created to be a parameter of a message of an {@link AutoAction}. 338 * Used for skinning. 339 */ 340 public static final String USE_TEMPLATE = "Use template"; 327 341 } 328 329 330 331 342 } -
modules/org.sophie2.main.func.media/src/main/java/org/sophie2/main/func/media/links/MediaActionLogic.java
7 7 import org.sophie2.base.model.resources.r4.ResourceRefR4; 8 8 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 9 9 import org.sophie2.base.model.resources.r4.changes.AutoAction; 10 import org.sophie2.base.skins.Message; 10 11 import org.sophie2.core.mvc.EventFilterBuilder; 11 12 import org.sophie2.core.mvc.OperationDef; 12 13 import org.sophie2.core.mvc.events.EventR3; … … 51 52 MediaFrameView mediaView = getMediaView(bw, mediaFrameAccess.getRef()); 52 53 if (mediaView != null) { 53 54 MediaState newState = MediaState.DEFAULT_STOPPED; 54 return setMediaChannel(mediaView, newState, true, "Stop", mediaFrameAccess);55 return setMediaChannel(mediaView, newState, true, Message.create(STOP), mediaFrameAccess); 55 56 } 56 57 return false; 57 58 … … 82 83 if(mediaView != null) { 83 84 MediaState oldState = mediaView.model().get().getMediaState(mediaView.getTime()); 84 85 MediaState newState = oldState.setPlaying(false); 85 return setMediaChannel(mediaView, newState,true,"Pause",mediaFrameAccess);86 return setMediaChannel(mediaView, newState, true, Message.create(PAUSE), mediaFrameAccess); 86 87 } 87 88 return false; 88 89 } … … 112 113 if(mediaView != null) { 113 114 MediaState oldState = mediaView.model().get().getMediaState(mediaView.getTime()); 114 115 MediaState newState = oldState.setPlaying(true); 115 return setMediaChannel(mediaView, newState,true,"Play",mediaFrameAccess);116 return setMediaChannel(mediaView, newState, true, Message.create(PLAY), mediaFrameAccess); 116 117 117 118 } 118 119 return false; … … 143 144 if(mediaView != null) { 144 145 MediaState oldState = mediaView.model().get().getMediaState(mediaView.getTime()); 145 146 MediaState newState = new MediaState(oldState.getVolume(), 0, oldState.isPlaying()); 146 return setMediaChannel(mediaView, newState,true,"Rewind",mediaFrameAccess);147 return setMediaChannel(mediaView, newState, true, Message.create(REWIND), mediaFrameAccess); 147 148 148 149 } 149 150 return false; … … 153 154 }; 154 155 155 156 /** 157 * Constant created for stop. 158 * Constant created to be a parameter of a message of an {@link AutoAction}. 159 * Used for skinning. 160 */ 161 public static final String STOP = "Stop"; 162 163 /** 164 * Constant created for pause. 165 * Constant created to be a parameter of a message of an {@link AutoAction}. 166 * Used for skinning. 167 */ 168 public static final String PAUSE = "Pause"; 169 170 /** 171 * Constant created for play. 172 * Constant created to be a parameter of a message of an {@link AutoAction}. 173 * Used for skinning. 174 */ 175 public static final String PLAY = "Play"; 176 177 /** 178 * Constant created for rewind. 179 * Constant created to be a parameter of a message of an {@link AutoAction}. 180 * Used for skinning. 181 */ 182 public static final String REWIND = "Rewind"; 183 184 /** 156 185 * Gets the target frame. 157 186 * 158 187 * @param event … … 193 222 * @return true 194 223 */ 195 224 boolean setMediaChannel( MediaFrameView mediaView,MediaState newState, 196 boolean significance, Stringdescription,ResourceAccess mediaFrameAccess) {225 boolean significance,Message description,ResourceAccess mediaFrameAccess) { 197 226 198 227 TimePos newTime = mediaView.getTime(); 199 228 MediaStateChannel oldChannel = mediaView.model().get().get(MediaFrameR4.KEY_STATE); -
modules/org.sophie2.extra.func.annotations/src/main/java/org/sophie2/extra/func/annotations/logic/StickiesLogic.java
13 13 import org.sophie2.base.model.resources.r4.ResourceRefR4; 14 14 import org.sophie2.base.model.resources.r4.ResourceUtil; 15 15 import org.sophie2.base.model.resources.r4.changes.AutoAction; 16 import org.sophie2.base.skins.Message; 16 17 import org.sophie2.core.mvc.EventFilterBuilder; 17 18 import org.sophie2.core.mvc.OperationDef; 18 19 import org.sophie2.core.mvc.events.EventR3; … … 73 74 final ImmPoint location = PageExtraH.DEFAULT_ELEMENT_LOCATION; 74 75 final ResourceRefList pageExtras = currentBookExtra.getPageExtras(); 75 76 76 new AutoAction( "Create page extra with sticky", true) {77 new AutoAction(Message.create(CREATE_PAGE_EXTRA_WITH_STICKY), true) { 77 78 78 79 @Override 79 80 public void performAuto() { … … 91 92 curPageExtra.get(CompositeElement.KEY_SUB_ELEMENTS); 92 93 final ImmPoint location = curPageExtra.selectInsertLocation(); 93 94 94 new AutoAction( "Create new sticky.", true) {95 new AutoAction(Message.create(CREATE_NEW_STICKY), true) { 95 96 96 97 @Override 97 98 public void performAuto() { … … 150 151 pageExtra.get(CompositeElement.KEY_SUB_ELEMENTS); 151 152 final ActivationChannel chan = pageExtra.getActivationChannel(stickyRef); 152 153 153 new AutoAction( "Delete sticky.", true) {154 new AutoAction(Message.create(DELETE_STICKY), true) { 154 155 155 156 @Override 156 157 public void performAuto() { … … 167 168 168 169 }; 169 170 171 /** 172 * Constant created for deleting of a sticky. 173 * Constant created to be a parameter of a message of an {@link AutoAction}. 174 * Used for skinning. 175 */ 176 public static final String DELETE_STICKY = "Delete sticky."; 177 178 /** 179 * Constant created for creation of a new sticky. 180 * Constant created to be a parameter of a message of an {@link AutoAction}. 181 * Used for skinning. 182 */ 183 public static final String CREATE_NEW_STICKY = "Create new sticky."; 184 185 /** 186 * Constant created for creation of a page extra with a sticky. 187 * Constant created to be a parameter of a message of an {@link AutoAction}. 188 * Used for skinning. 189 */ 190 public static final String CREATE_PAGE_EXTRA_WITH_STICKY = "Create page extra with sticky"; 191 170 192 171 193 } -
modules/org.sophie2.dev/src/test/java/org/sophie2/dev/author/ResourceChooserDemo.java
28 28 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 29 29 import org.sophie2.base.model.text.BaseModelTextModule; 30 30 import org.sophie2.base.skins.BaseSkinsModule; 31 import org.sophie2.base.skins.Message; 31 32 import org.sophie2.base.visual.BaseVisualModule; 32 33 import org.sophie2.base.visual.VisualElement; 33 34 import org.sophie2.core.logging.LogLevel; … … 59 60 */ 60 61 public class ResourceChooserDemo extends AppTestBase { 61 62 62 63 /** 64 * Constant created for creation of fictive resources. 65 * Constant created to be a parameter of a message of an {@link AutoAction}. 66 * Used for skinning. Used in the test. 67 */ 68 public static final String CREATING_FICTIVE_RESOURCES = "Creating fictive resources"; 69 63 70 /** 64 71 * A {@link ResourceChooser} implementation used by the demo. 65 72 * … … 251 258 final ResourceRefR4 audioRef2 = 252 259 ResourceRefR4.generateRandomSub(AudioResourceR4.KIND); 253 260 254 new AutoAction( "Creating fictive resources", true) {261 new AutoAction(Message.create(CREATING_FICTIVE_RESOURCES), true) { 255 262 256 263 @Override 257 264 public void performAuto() { -
modules/org.sophie2.main.func.resources/src/main/java/org/sophie2/main/func/resources/logic/ChangeBackgroundHandler.java
9 9 import org.sophie2.base.model.resources.r4.ResourceRefR4; 10 10 import org.sophie2.base.model.resources.r4.changes.AutoAction; 11 11 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 12 import org.sophie2.base.skins.Message; 12 13 import org.sophie2.main.app.commons.element.ElementDropHandler; 13 14 import org.sophie2.main.app.commons.element.ElementView; 14 15 import org.sophie2.main.dnd.dnddata.ResourceRefData; … … 22 23 */ 23 24 public class ChangeBackgroundHandler extends ElementDropHandler<ElementView> { 24 25 26 /** 27 * Constant created for setting image background. 28 * Constant created to be a parameter of a message of an {@link AutoAction}. 29 * Used for skinning. 30 */ 31 public static final String SET_IMAGE_BG = "Set image background"; 25 32 private static ChangeBackgroundHandler instance = null; 26 33 27 34 private ChangeBackgroundHandler() { … … 62 69 final ResourceRefR4 elementToImageRef = 63 70 ResourceRefR4.getRelativeRef(absElementRef, absImageRef); 64 71 65 new AutoAction( "Set image background", true) {72 new AutoAction(Message.create(SET_IMAGE_BG), true) { 66 73 67 74 @Override 68 75 public void performAuto() { -
modules/org.sophie2.base.model.book/src/test/java/org/sophie2/base/model/book/PageUnitTest.java
13 13 import org.sophie2.base.model.book.timelines.ActivationChannel; 14 14 import org.sophie2.base.model.resources.r4.ResourceRefR4; 15 15 import org.sophie2.base.model.resources.r4.changes.AutoAction; 16 import org.sophie2.base.skins.Message; 16 17 17 18 /** 18 19 * Test for {@link PageH}. … … 21 22 */ 22 23 public class PageUnitTest extends ModelTestBase { 23 24 25 /** 26 * Constant created for adding a null frame. 27 * Constant created to be a parameter of a message of an {@link AutoAction}. 28 * Used for skinning. Used in the test. 29 */ 30 public static final String ADD_NULL_FRAME = "Add a nullFrame"; 24 31 private PageH page; 25 32 26 33 @Override … … 57 64 try { 58 65 final ImmList<ActivationChannel> channels = CompositeElement.KEY_SUB_ELEMENTS.get(this.page.getAccess()); 59 66 60 new AutoAction( "Add a nullFrame", true) {67 new AutoAction(Message.create(ADD_NULL_FRAME), true) { 61 68 62 69 @Override 63 70 public void performAuto() { -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/frame/MainTitleBarHalo.java
32 32 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 33 33 import org.sophie2.base.scene.SceneVisual; 34 34 import org.sophie2.base.scene.helpers.SceneHelper; 35 import org.sophie2.base.skins.Message; 35 36 import org.sophie2.base.skins.SkinElementId; 36 37 import org.sophie2.base.visual.BaseVisualElement; 37 38 import org.sophie2.base.visual.skins.ElementSkinPart; … … 62 63 @VisualElementDef(parent = MainHaloMenu.class, sortKey = "yyy-main-title-bar-halo") 63 64 public class MainTitleBarHalo extends AbstractHalo { 64 65 66 /** 67 * Constant created for setting location. 68 * Constant created to be a parameter of a message of an {@link AutoAction}. 69 * Used for skinning. 70 */ 71 public static final String SET_LOCATION = "Set location."; 65 72 private static ImmColor BASIC_COLOR = new ImmColor(0.5f, 0.5f, 1f, 0.5f); 66 73 private static ImmColor SELECTED_COLOR = new ImmColor(0.25f, 0.25f, 1f, 0.7f); 67 74 … … 296 303 final ResourceRefList refs, ImmList<TimePos> times) { 297 304 if (currentPage().get() != null) { 298 305 ResourceAccess pageAccess = currentPage().get().getAccess(); 299 AutoAction.registerEndChange(pageAccess, "Set location.");306 AutoAction.registerEndChange(pageAccess, Message.create(SET_LOCATION)); 300 307 } 301 308 302 309 } … … 320 327 MemberElement.KEY_LOCATION.get(frameAccess); 321 328 final TimePos time = times.get(i); 322 329 323 new AutoAction( "Set location.", false) {330 new AutoAction(Message.create(SET_LOCATION), false) { 324 331 @Override 325 332 public void performAuto() { 326 333 ResourceChanger subChanger = getChanger().getSub(frameRef); -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/properties/OrientationHud.java
29 29 import org.sophie2.base.model.book.timelines.LocationChannel; 30 30 import org.sophie2.base.model.resources.r4.changes.AutoAction; 31 31 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 32 import org.sophie2.base.skins.Message; 32 33 import org.sophie2.base.skins.SkinElementId; 33 34 import org.sophie2.base.visual.BaseSwingVisualElement; 34 35 import org.sophie2.base.visual.BaseVisualElement; … … 495 496 MemberElement.KEY_LOCATION.getMode(frame.getAccess()) == Mode.USE_TEMPLATE; 496 497 if (wasTemplated) { 497 498 final LocationChannel oldChannel = frame.get(MemberElement.KEY_LOCATION); 498 new AutoAction( "Rotate frame (untemplate)", true) {499 new AutoAction(Message.create(ROTATE_FRAME_UNTEMPLATE), true) { 499 500 500 501 @Override 501 502 public void performAuto() { … … 508 509 } 509 510 }.register(frame.getAccess()); 510 511 } else { 511 new AutoAction( "Rotate frame (own)", true) {512 new AutoAction(Message.create(ROTATE_FRAME_OWN), true) { 512 513 513 514 @Override 514 515 public void performAuto() { … … 527 528 return true; 528 529 } 529 530 530 } 531 }; 532 533 /** 534 * Constant created for rotation of a frame. 535 * Constant created to be a parameter of a message of an {@link AutoAction}. 536 * Used for skinning. 537 */ 538 public static final String ROTATE_FRAME_OWN = "Rotate frame (own)"; 539 540 /** 541 * Constant created for rotation of frame that is not templated. 542 * Constant created to be a parameter of a message of an {@link AutoAction}. 543 * Used for skinning. 544 */ 545 public static final String ROTATE_FRAME_UNTEMPLATE = "Rotate frame (untemplate)"; 531 546 } 532 547 } -
modules/org.sophie2.main.func.links/src/main/java/org/sophie2/main/func/links/actions/showing/ShowingActionLogic.java
9 9 import org.sophie2.base.model.resources.r4.ResourceRefR4; 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.skins.Message; 12 13 import org.sophie2.core.mvc.EventFilterBuilder; 13 14 import org.sophie2.core.mvc.OperationDef; 14 15 import org.sophie2.core.mvc.events.EventR3; … … 43 44 } 44 45 final VisibleChannel channel = ElementR4.KEY_VISIBLE.get(frameAccess); 45 46 46 new AutoAction( "Show frame.", true) {47 new AutoAction(Message.create(SHOW_FRAME), true) { 47 48 @Override 48 49 public void performAuto() { 49 50 getChanger().setRaw( … … 75 76 } 76 77 final VisibleChannel channel = ElementR4.KEY_VISIBLE.get(frameAccess); 77 78 78 new AutoAction( "Hide frame.", true) {79 new AutoAction(Message.create(HIDE_FRAME), true) { 79 80 @Override 80 81 public void performAuto() { 81 82 getChanger().setRaw( … … 108 109 final VisibleChannel channel = ElementR4.KEY_VISIBLE.get(frameAccess); 109 110 final Boolean visible = !channel.getValue(TimePos.INTRO_START); 110 111 111 new AutoAction( "Toggle frame visibility.", true) {112 new AutoAction(Message.create(TOGGLE_FRAME_VISIBILITY), true) { 112 113 @Override 113 114 public void performAuto() { 114 115 getChanger().setRaw( … … 122 123 }; 123 124 124 125 /** 126 * Constant created for toggling frame visibility. 127 * Constant created to be a parameter of a message of an {@link AutoAction}. 128 * Used for skinning. 129 */ 130 public static final String TOGGLE_FRAME_VISIBILITY = "Toggle frame visibility."; 131 132 /** 133 * Constant created for hiding frame. 134 * Constant created to be a parameter of a message of an {@link AutoAction}. 135 * Used for skinning. 136 */ 137 public static final String HIDE_FRAME = "Hide frame."; 138 139 /** 140 * Constant created for showing frame. 141 * Constant created to be a parameter of a message of an {@link AutoAction}. 142 * Used for skinning. 143 */ 144 public static final String SHOW_FRAME = "Show frame."; 145 146 /** 125 147 * Gets the {@link ResourceAccess} of the target frame of the 126 148 * {@link FrameShowingAction} 127 149 * -
modules/org.sophie2.main.func.media/src/main/java/org/sophie2/main/func/media/view/controls/MediaPropertiesHud.java
16 16 import org.sophie2.base.halos.HudDialog; 17 17 import org.sophie2.base.halos.HudTitleBar; 18 18 import org.sophie2.base.layout.LogicR3ToggleButton; 19 import org.sophie2.base.model.resources.r4.changes.AutoAction; 19 20 import org.sophie2.base.model.resources.r4.keys.Key; 21 import org.sophie2.base.skins.Message; 20 22 import org.sophie2.base.skins.SkinElementId; 21 23 import org.sophie2.base.visual.skins.ElementSkinPart; 22 24 import org.sophie2.base.visual.skins.RelatedChildren; … … 389 391 @VisualElementDef(parent = MediaPropertiesHud.class, sortKey = "hhh-show-play-pause-button") 390 392 public static class ShowPlayPauseButton extends LogicR3ToggleButton { 391 393 394 /** 395 * Constant created for showing play/pause button. 396 * Constant created to be a parameter of a message of an {@link AutoAction}. 397 * Used for skinning. 398 */ 399 public static final String SHOW_PLAY_PAUSE_BUTTON = "Show Play/Pause button"; 400 401 /** 402 * Constant created for hiding play/pause button. 403 * Constant created to be a parameter of a message of an {@link AutoAction}. 404 * Used for skinning. 405 */ 406 public static final String HIDE_PLAY_PAUSE_BUTTON = "Hide Play/Pause button"; 407 392 408 @SuppressWarnings("unused") 393 409 @SkinPartDef 394 410 private static void initSkin(ElementSkinPart part) { … … 418 434 protected ImmList<EventR3> computeDeselectedEvents() { 419 435 return ImmTreeList.<EventR3>create(new EventR3( 420 436 this, null, null, null, EventIds.TOGGLE_CONTROL, 421 MediaFrameR4.KEY_SHOW_PLAY_BUTTON, "Hide Play/Pause button", false));437 MediaFrameR4.KEY_SHOW_PLAY_BUTTON, Message.create(HIDE_PLAY_PAUSE_BUTTON), false)); 422 438 } 423 439 424 440 @Override 425 441 protected ImmList<EventR3> computeSelectedEvents() { 426 442 return ImmTreeList.<EventR3>create(new EventR3( 427 443 this, null, null, null, EventIds.TOGGLE_CONTROL, 428 MediaFrameR4.KEY_SHOW_PLAY_BUTTON, "Show Play/Pause button", true));444 MediaFrameR4.KEY_SHOW_PLAY_BUTTON, Message.create(SHOW_PLAY_PAUSE_BUTTON), true)); 429 445 } 430 446 } 431 447 … … 437 453 @VisualElementDef(parent = MediaPropertiesHud.class, sortKey = "iii-show-stop-button") 438 454 public static class ShowStopButton extends LogicR3ToggleButton { 439 455 456 /** 457 * Constant created for showing stop button. 458 * Constant created to be a parameter of a message of an {@link AutoAction}. 459 * Used for skinning. 460 */ 461 public static final String SHOW_STOP_BUTTON = "Show Stop button"; 462 463 /** 464 * Constant created for hiding stop button. 465 * Constant created to be a parameter of a message of an {@link AutoAction}. 466 * Used for skinning. 467 */ 468 public static final String HIDE_STOP_BUTTON = "Hide Stop button"; 469 440 470 @SuppressWarnings("unused") 441 471 @SkinPartDef 442 472 private static void initSkin(ElementSkinPart part) { … … 465 495 protected ImmList<EventR3> computeDeselectedEvents() { 466 496 return ImmTreeList.<EventR3>create(new EventR3( 467 497 this, null, null, null, EventIds.TOGGLE_CONTROL, 468 MediaFrameR4.KEY_SHOW_STOP_BUTTON, "Hide Stop button", false));498 MediaFrameR4.KEY_SHOW_STOP_BUTTON, Message.create(HIDE_STOP_BUTTON), false)); 469 499 } 470 500 471 501 @Override 472 502 protected ImmList<EventR3> computeSelectedEvents() { 473 503 return ImmTreeList.<EventR3>create(new EventR3( 474 504 this, null, null, null, EventIds.TOGGLE_CONTROL, 475 MediaFrameR4.KEY_SHOW_STOP_BUTTON, "Show Stop button", true));505 MediaFrameR4.KEY_SHOW_STOP_BUTTON, Message.create(SHOW_STOP_BUTTON), true)); 476 506 } 477 507 } 478 508 … … 484 514 @VisualElementDef(parent = MediaPropertiesHud.class, sortKey = "jjj-show-seekbar") 485 515 public static class ShowSeekBar extends LogicR3ToggleButton { 486 516 517 /** 518 * Constant created for showing seekbar. 519 * Constant created to be a parameter of a message of an {@link AutoAction}. 520 * Used for skinning. 521 */ 522 public static final String SHOW_SEEKBAR = "Show seekbar"; 523 524 /** 525 * Constant created for hiding seekbar. 526 * Constant created to be a parameter of a message of an {@link AutoAction}. 527 * Used for skinning. 528 */ 529 public static final String HIDE_SEEKBAR = "Hide seekbar"; 530 487 531 @SuppressWarnings("unused") 488 532 @SkinPartDef 489 533 private static void initSkin(ElementSkinPart part) { … … 512 556 protected ImmList<EventR3> computeDeselectedEvents() { 513 557 return ImmTreeList.<EventR3>create(new EventR3( 514 558 this, null, null, null, EventIds.TOGGLE_CONTROL, 515 MediaFrameR4.KEY_SHOW_SEEKBAR, "Hide seekbar", false));559 MediaFrameR4.KEY_SHOW_SEEKBAR, Message.create(HIDE_SEEKBAR), false)); 516 560 } 517 561 518 562 @Override 519 563 protected ImmList<EventR3> computeSelectedEvents() { 520 564 return ImmTreeList.<EventR3>create(new EventR3( 521 565 this, null, null, null, EventIds.TOGGLE_CONTROL, 522 MediaFrameR4.KEY_SHOW_SEEKBAR, "Show seekbar", true));566 MediaFrameR4.KEY_SHOW_SEEKBAR, Message.create(SHOW_SEEKBAR), true)); 523 567 } 524 568 } 525 569 … … 538 582 * be registered. The third parameter determines whether the control should be shown 539 583 * or hidden. 540 584 */ 541 @EventParams({ Key.class, String.class, Boolean.class })585 @EventParams({ Key.class, Message.class, Boolean.class }) 542 586 TOGGLE_CONTROL; 543 587 544 588 /** -
modules/org.sophie2.extra.comment/src/main/java/org/sophie2/extra/comment/logic/CommentLogic.java
6 6 import org.sophie2.base.model.resources.r4.LocationPrefix; 7 7 import org.sophie2.base.model.resources.r4.ResourceRefR4; 8 8 import org.sophie2.base.model.resources.r4.changes.AutoAction; 9 import org.sophie2.base.skins.Message; 9 10 import org.sophie2.base.visual.interaction.InputEventR3; 10 11 import org.sophie2.core.logging.SophieLog; 11 12 import org.sophie2.core.mvc.EventFilterBuilder; … … 149 150 return false; 150 151 } 151 152 152 new AutoAction( "Add commment reply.", true) {153 new AutoAction(Message.create(ADD_COMMMENT_REPLY), true) { 153 154 154 155 @Override 155 156 public void performAuto() { … … 201 202 return true; 202 203 } 203 204 204 new AutoAction( "Add new commment.", true) {205 new AutoAction(Message.create(ADD_NEW_COMMMENT), true) { 205 206 206 207 @Override 207 208 public void performAuto() { … … 251 252 final ResourceRefR4 valueToSet = 252 253 frameView.model().get().getCommentStreamH().getRef(); 253 254 254 new AutoAction( "Update comment frame reference.", false) {255 new AutoAction(Message.create(UPDATE_COMMENT_FRAME_REFERENCE), false) { 255 256 public void performAuto() { 256 257 getChanger().getSub(relRef).setRaw( 257 258 ResourceFrame.KEY_MAIN_RESOURCE, valueToSet); … … 270 271 271 272 return true; 272 273 } 273 } 274 }; 275 276 /** 277 * Constant created for updating of a comment frame reference. 278 * Constant created to be a parameter of a message of an {@link AutoAction}. 279 * Used for skinning. 280 */ 281 public static final String UPDATE_COMMENT_FRAME_REFERENCE = "Update comment frame reference."; 282 283 /** 284 * Constant created for adding new comment. 285 * Constant created to be a parameter of a message of an {@link AutoAction}. 286 * Used for skinning. 287 */ 288 public static final String ADD_NEW_COMMMENT = "Add new commment."; 289 290 /** 291 * Constant created for adding a comment reply. 292 * Constant created to be a parameter of a message of an {@link AutoAction}. 293 * Used for skinning. 294 */ 295 public static final String ADD_COMMMENT_REPLY = "Add commment reply."; 274 296 } -
modules/org.sophie2.main.func.resources/src/test/java/org/sophie2/main/func/resources/imports/ResourceImportManagerTest.java
29 29 import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 30 30 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 31 31 import org.sophie2.base.skins.BaseSkinsModule; 32 import org.sophie2.base.skins.Message; 32 33 import org.sophie2.base.visual.BaseVisualModule; 33 34 import org.sophie2.core.modularity.FileEntryManager; 34 35 import org.sophie2.core.modularity.SophieModule; … … 52 53 */ 53 54 public class ResourceImportManagerTest extends AppTestBase { 54 55 56 /** 57 * Constant created for inserting the frame. 58 * Constant created to be a parameter of a message of an {@link AutoAction}. 59 * Used for skinning. Used in the test. 60 */ 61 public static final String INSERT_THE_FRAME = "Insert the frame."; 62 63 /** 64 * Constant created for creating cold text. 65 * Constant created to be a parameter of a message of an {@link AutoAction}. 66 * Used for skinning. 67 */ 68 public static final String CREATING_COLD_TEXT = "Creating cold text"; 69 55 70 private ResourceImportProvider provider; 56 71 57 72 /** … … 168 183 ResourceRefR4.generateRandomSub(ColdTextResource.DEFAULT_TITLE); 169 184 final String text = "Some text"; 170 185 171 new AutoAction( "Creating cold text", true) {186 new AutoAction(Message.create(CREATING_COLD_TEXT), true) { 172 187 @Override 173 188 public void performAuto() { 174 189 ColdTextResourceHelper.createColdText( … … 192 207 ResourceRefR4.generateRandomSub(FrameH.NAME_PREFIX); 193 208 final ImmList<ActivationChannel> elements = ImmTreeList.empty(); 194 209 195 new AutoAction( "Insert the frame.", true) {210 new AutoAction(Message.create(INSERT_THE_FRAME), true) { 196 211 @Override 197 212 public void performAuto() { 198 213 manager.insertFrame(getChanger().getSub(parentRef), -
modules/org.sophie2.base.model.book/src/test/java/org/sophie2/base/model/book/FrameSizeLocationTest.java
15 15 import org.sophie2.base.model.book.timelines.LocationChannel; 16 16 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 17 17 import org.sophie2.base.model.resources.r4.changes.AutoAction; 18 import org.sophie2.base.skins.Message; 18 19 19 20 /** 20 21 * Common tests for size and location functionalities in {@link FrameH}. … … 23 24 */ 24 25 public class FrameSizeLocationTest extends ModelTestBase { 25 26 27 /** 28 * Constant created for BLAH. 29 * Constant created to be a parameter of a message of an {@link AutoAction}. 30 * Used for skinning. 31 */ 32 public static final String BLAH = "Blah"; 26 33 private FrameH frame; 27 34 28 35 @Override … … 48 55 final ImmInsets testMarginInsets = new ImmInsets(40.f, 10.f, 20.f, 30.f); 49 56 50 57 51 new AutoAction( "Blah", true) {58 new AutoAction(Message.create(BLAH), true) { 52 59 53 60 @Override 54 61 public void performAuto() { … … 117 124 final ImmInsets testMarginInsets = new ImmInsets(topMarginWidth, 118 125 leftMarginWidth, bottomMarginWidth, rightMarginWidth); 119 126 120 new AutoAction( "Blah", true) {127 new AutoAction(Message.create(BLAH), true) { 121 128 122 129 @Override 123 130 public void performAuto() { -
modules/org.sophie2.main.func.timelines/src/main/java/org/sophie2/main/func/timelines/hud/ChildRow.java
24 24 import org.sophie2.base.model.resources.r4.ResourceRefR4; 25 25 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 26 26 import org.sophie2.base.model.resources.r4.changes.AutoAction; 27 import org.sophie2.base.skins.Message; 27 28 import org.sophie2.base.visual.BaseSwingVisualElement; 28 29 import org.sophie2.base.visual.SwingVisualElement; 29 30 import org.sophie2.base.visual.skins.ElementSkinPart; … … 489 490 final ImmList<ActivationChannel> newChannels = createActivationChannels( 490 491 newPhase, inputData, access, row); 491 492 492 new AutoAction( "Add activation channel entry", true) {493 new AutoAction(Message.create(ADD_ACTIVATION_CHANNEL_ENTRY), true) { 493 494 494 495 @Override 495 496 public void performAuto() { … … 551 552 Phase.valueOf(inputData.getSelectedItem()), 552 553 currentValue, access, row); 553 554 554 new AutoAction( "Set child timeline options", true) {555 new AutoAction(Message.create(SET_CHILD_TIMELINE_OPTIONS), true) { 555 556 556 557 @Override 557 558 public void performAuto() { … … 567 568 }; 568 569 569 570 /** 571 * Constant created for setting child timeline options. 572 * Constant created to be a parameter of a message of an {@link AutoAction}. 573 * Used for skinning. 574 */ 575 public static final String SET_CHILD_TIMELINE_OPTIONS = "Set child timeline options"; 576 577 /** 578 * Constant created for adding activation channel entry. 579 * Constant created to be a parameter of a message of an {@link AutoAction}. 580 * Used for skinning. 581 */ 582 public static final String ADD_ACTIVATION_CHANNEL_ENTRY = "Add activation channel entry"; 583 584 /** 570 585 * Helper method to create an {@link ImmList} with the 571 586 * {@link ActivationChannel}s to be set 572 587 * -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/huds/properties/InsetsHud.java
17 17 import org.sophie2.base.model.resources.r4.changes.AutoAction; 18 18 import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 19 19 import org.sophie2.base.model.resources.r4.keys.TemplatedKey.Mode; 20 import org.sophie2.base.skins.Message; 20 21 import org.sophie2.base.skins.SkinElementId; 21 22 import org.sophie2.base.visual.VisualElement; 22 23 import org.sophie2.base.visual.skins.ElementSkinPart; … … 467 468 ResourceAccess access = getAccess(source); 468 469 String input = event.getEventParam( 469 470 BoundControl.EventIds.INPUT_PARAM_INDEX, String.class); 470 setFrameInsetsComponent(Side.TOP, input, "Set top padding.",471 setFrameInsetsComponent(Side.TOP, input, Message.create(SET_TOP_PADDING), 471 472 access, FrameR4.KEY_PADDING_INSETS); 472 473 return true; 473 474 } … … 487 488 ResourceAccess access = getAccess(source); 488 489 String input = event.getEventParam( 489 490 BoundControl.EventIds.INPUT_PARAM_INDEX, String.class); 490 setFrameInsetsComponent(Side.RIGHT, input, "Set right padding.",491 setFrameInsetsComponent(Side.RIGHT, input, Message.create(SET_RIGHT_PADDING), 491 492 access, FrameR4.KEY_PADDING_INSETS); 492 493 return true; 493 494 } … … 508 509 ResourceAccess access = getAccess(source); 509 510 String input = event.getEventParam( 510 511 BoundControl.EventIds.INPUT_PARAM_INDEX, String.class); 511 setFrameInsetsComponent(Side.BOTTOM, input, "Set bottom padding.",512 setFrameInsetsComponent(Side.BOTTOM, input, Message.create(SET_BOTTOM_PADDING), 512 513 access, FrameR4.KEY_PADDING_INSETS); 513 514 return true; 514 515 } … … 528 529 ResourceAccess access = getAccess(source); 529 530 String input = event.getEventParam( 530 531 BoundControl.EventIds.INPUT_PARAM_INDEX, String.class); 531 setFrameInsetsComponent(Side.LEFT, input, "Set left padding.",532 setFrameInsetsComponent(Side.LEFT, input, Message.create(SET_LEFT_PADDING), 532 533 access, FrameR4.KEY_PADDING_INSETS); 533 534 return true; 534 535 } … … 548 549 ResourceAccess access = getAccess(source); 549 550 String input = event.getEventParam( 550 551 BoundControl.EventIds.INPUT_PARAM_INDEX, String.class); 551 setFrameInsetsComponent(Side.TOP, input, "Set top margin.",552 setFrameInsetsComponent(Side.TOP, input, Message.create(SET_TOP_MARGIN), 552 553 access, FrameR4.KEY_MARGIN_INSETS); 553 554 return true; 554 555 } … … 569 570 ResourceAccess access = getAccess(source); 570 571 String input = event.getEventParam( 571 572 BoundControl.EventIds.INPUT_PARAM_INDEX, String.class); 572 setFrameInsetsComponent(Side.RIGHT, input, "Set right margin.",573 setFrameInsetsComponent(Side.RIGHT, input, Message.create(SET_RIGHT_MARGIN), 573 574 access, FrameR4.KEY_MARGIN_INSETS); 574 575 return true; 575 576 } … … 590 591 ResourceAccess access = getAccess(source); 591 592 String input = event.getEventParam( 592 593 BoundControl.EventIds.INPUT_PARAM_INDEX, String.class); 593 setFrameInsetsComponent(Side.BOTTOM, input, "Set bottom margin.",594 setFrameInsetsComponent(Side.BOTTOM, input, Message.create(SET_BOTTOM_MARGIN), 594 595 access, FrameR4.KEY_MARGIN_INSETS); 595 596 return true; 596 597 } … … 611 612 ResourceAccess access = getAccess(source); 612 613 String input = event.getEventParam( 613 614 BoundControl.EventIds.INPUT_PARAM_INDEX, String.class); 614 setFrameInsetsComponent(Side.LEFT, input, "Set left margin.",615 setFrameInsetsComponent(Side.LEFT, input, Message.create(SET_LEFT_MARGIN), 615 616 access, FrameR4.KEY_MARGIN_INSETS); 616 617 return true; 617 618 } 618 }, 619 }; 620 621 /** 622 * Constant created for setting top padding. 623 * Constant created to be a parameter of a message of an {@link AutoAction}. 624 * Used for skinning. 625 */ 626 public static final String SET_TOP_PADDING = "Set top padding."; 619 627 628 /** 629 * Constant created for setting right padding. 630 * Constant created to be a parameter of a message of an {@link AutoAction}. 631 * Used for skinning. 632 */ 633 public static final String SET_RIGHT_PADDING = "Set right padding."; 634 635 /** 636 * Constant created for setting bottom padding. 637 * Constant created to be a parameter of a message of an {@link AutoAction}. 638 * Used for skinning. 639 */ 640 public static final String SET_BOTTOM_PADDING = "Set bottom padding."; 641 642 /** 643 * Constant created for setting left padding. 644 * Constant created to be a parameter of a message of an {@link AutoAction}. 645 * Used for skinning. 646 */ 647 public static final String SET_LEFT_PADDING = "Set left padding."; 648 649 /** 650 * Constant created for setting top margin. 651 * Constant created to be a parameter of a message of an {@link AutoAction}. 652 * Used for skinning. 653 */ 654 public static final String SET_TOP_MARGIN = "Set top margin."; 655 656 /** 657 * Constant created for setting tight margin. 658 * Constant created to be a parameter of a message of an {@link AutoAction}. 659 * Used for skinning. 660 */ 661 public static final String SET_RIGHT_MARGIN = "Set right margin."; 662 663 /** 664 * Constant created for setting bottom margin. 665 * Constant created to be a parameter of a message of an {@link AutoAction}. 666 * Used for skinning. 667 */ 668 public static final String SET_BOTTOM_MARGIN = "Set bottom margin."; 669 670 /** 671 * Constant created for setting left margin. 672 * Constant created to be a parameter of a message of an {@link AutoAction}. 673 * Used for skinning. 674 */ 675 public static final String SET_LEFT_MARGIN = "Set left margin."; 620 676 } 621 677 622 678 /** … … 635 691 * The key of the insets of the frame. 636 692 */ 637 693 protected static void setFrameInsetsComponent(Side side, String input, 638 StringeventDescription, ResourceAccess access,694 Message eventDescription, ResourceAccess access, 639 695 final TemplatedKey<ImmInsets> key) { 640 696 ImmInsets insets = key.get(access); 641 697 float value = BoundValidation.parseNumber(input, Float.class); … … 655 711 * @param key 656 712 * The key of the insets of the frame. 657 713 */ 658 protected static void setFrameInsets(final ImmInsets insets, StringeventDescription,714 protected static void setFrameInsets(final ImmInsets insets, Message eventDescription, 659 715 ResourceAccess access, final TemplatedKey<ImmInsets> key) { 660 716 new AutoAction(eventDescription, true) { 661 717 @Override -
modules/org.sophie2.main.func.media/src/test/java/org/sophie2/main/func/media/model/resources/MediaPersistenceTest.java
28 28 import org.sophie2.base.persistence.persister.MasterPersister; 29 29 import org.sophie2.base.persistence.ref.ValueRef; 30 30 import org.sophie2.base.persistence.storage.Storage; 31 import org.sophie2.base.skins.Message; 31 32 import org.sophie2.core.logging.LogLevel; 32 33 import org.sophie2.core.logging.SophieLog; 33 34 import org.sophie2.core.modularity.FileEntryManager; … … 50 51 public class MediaPersistenceTest extends ModelTestBase { 51 52 52 53 /** 54 * Constant created for creating audio resource. 55 * Constant created to be a parameter of a message of an {@link AutoAction}. 56 * Used for skinning. 57 */ 58 public static final String CREATING_AUDIO_RESOURCE = "Creating audio resource."; 59 60 /** 53 61 * Matches the {@link AudioImportManager}'s provider 54 62 * form all the registered as extensions providers. 55 63 * … … 213 221 new ResourceImportInfo<BinData>(binData, 214 222 this.testFile.getName()); 215 223 216 new AutoAction( "Creating audio resource.", true) {224 new AutoAction(Message.create(CREATING_AUDIO_RESOURCE), true) { 217 225 @Override 218 226 public void performAuto() { 219 227 audioImportManager.makeResource(getChanger(), audioRef, info); … … 240 248 new ResourceImportInfo<ResourceModel>(model, 241 249 sophieMediaFile.getName()); 242 250 243 new AutoAction( "Creating audio resource.", true) {251 new AutoAction(Message.create(CREATING_AUDIO_RESOURCE), true) { 244 252 @Override 245 253 public void performAuto() { 246 254 sophieManager.makeResource(getChanger(), audioRef, info); -
modules/org.sophie2.main.app.halos/src/test/java/org/sophie2/main/app/halos/frame/rotate/FrameRotateHaloButtonTest.java
22 22 import org.sophie2.base.model.resources.r4.changes.AutoAction; 23 23 import org.sophie2.base.scene.BaseSceneModule; 24 24 import org.sophie2.base.skins.BaseSkinsModule; 25 import org.sophie2.base.skins.Message; 25 26 import org.sophie2.base.visual.BaseVisualModule; 26 27 import org.sophie2.core.logging.LogLevel; 27 28 import org.sophie2.core.logging.SophieLog; … … 45 46 */ 46 47 public class FrameRotateHaloButtonTest extends AppTestBase { 47 48 49 /** 50 * Constant created for changing size. 51 * Constant created to be a parameter of a message of an {@link AutoAction}. 52 * Used for skinning. 53 */ 54 public static final String CHANGE_SIZE = "Change size"; 55 48 56 private FrameH frame; 49 57 50 58 private FrameView fv; … … 64 72 this.frame = makeFrame(pageAccess); 65 73 66 74 // a square frame will be easier for testing 67 new AutoAction( "Change size", true) {75 new AutoAction(Message.create(CHANGE_SIZE), true) { 68 76 69 77 @Override 70 78 public void performAuto() { -
modules/org.sophie2.extra.func.scripting/src/test/java/org/sophie2/extra/func/scripting/logic/ScriptingLogicTest.java
24 24 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 25 25 import org.sophie2.base.persistence.BasePersistenceModule; 26 26 import org.sophie2.base.skins.BaseSkinsModule; 27 import org.sophie2.base.skins.Message; 27 28 import org.sophie2.base.visual.BaseVisualModule; 28 29 import org.sophie2.core.modularity.SophieModule; 29 30 import org.sophie2.core.mvc.CoreMvcModule; … … 53 54 */ 54 55 public class ScriptingLogicTest extends AppTestBase { 55 56 57 /** 58 * Constant created for inserting a script from a file. 59 * Constant created to be a parameter of a message of an {@link AutoAction}. 60 * Used for skinning. Used in the test. 61 */ 62 public static final String INSERT_SCRIPT_FROM_FILE = "Insert script from a file."; 56 63 private BookH book; 57 64 58 65 @Override … … 180 187 ResourceRefR4.generateRandomSub(ScriptResourceH.NAME_PREFIX); 181 188 final ResourceRefR4 bookRef = bookAccess.getRef(); 182 189 183 new AutoAction( "Insert script from a file.", true) {190 new AutoAction(Message.create(INSERT_SCRIPT_FROM_FILE), true) { 184 191 @Override 185 192 public void performAuto() { 186 193 ScriptResourceH.create(getChanger(), scriptRef, SAMPLE_SCRIPT, bookRef); -
modules/org.sophie2.main.app.menus/src/main/java/org/sophie2/main/app/menus/file/FileMenuLogic.java
12 12 import org.sophie2.base.model.resources.r4.changes.AutoAction; 13 13 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 14 14 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 15 import org.sophie2.base.skins.Message; 15 16 import org.sophie2.core.logging.SophieLog; 16 17 import org.sophie2.core.modularity.SortKey; 17 18 import org.sophie2.core.mvc.EventFilterBuilder; … … 159 160 160 161 SophieLog.debug("Setting new book properties: " + newTitle + " / " + newPageSize 161 162 + " / " + newBgAudio); 162 new AutoAction( "Change book properties", true) {163 new AutoAction(Message.create(CHANGE_BOOK_PROPERTIES), true) { 163 164 164 165 @Override 165 166 public void performAuto() { … … 220 221 } 221 222 222 223 }; 224 225 /** 226 * Constant created for changing book properties. 227 * Constant created to be a parameter of a message of an {@link AutoAction}. 228 * Used for skinning. 229 */ 230 public static final String CHANGE_BOOK_PROPERTIES = "Change book properties"; 223 231 } -
modules/org.sophie2.main.func.templates/src/main/java/org/sophie2/main/func/templates/page/ApplyPageTemplateHandler.java
13 13 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 14 14 import org.sophie2.base.model.resources.r4.changes.AutoAction; 15 15 import org.sophie2.base.model.resources.r4.resources.ResourceH; 16 import org.sophie2.base.skins.Message; 16 17 import org.sophie2.main.app.commons.book.BookView; 17 18 import org.sophie2.main.app.commons.element.ElementDropHandler; 18 19 import org.sophie2.main.app.commons.page.MainPageView; … … 28 29 */ 29 30 public class ApplyPageTemplateHandler extends ElementDropHandler<MainPageView> { 30 31 32 /** 33 * Constant created for removing unassigned sub-element. 34 * Constant created to be a parameter of a message of an {@link AutoAction}. 35 * Used for skinning. 36 */ 37 public static final String REMOVE_UNASSIGNED_SUBELEMENT = "Remove unassigned subelement"; 38 39 /** 40 * Constant created for applying page template. 41 * Constant created to be a parameter of a message of an {@link AutoAction}. 42 * Used for skinning. 43 */ 44 public static final String APPLY_PAGE_TEMPLATE = "Apply page template"; 31 45 private static ApplyPageTemplateHandler instance = null; 32 46 33 47 private ApplyPageTemplateHandler() { … … 74 88 TemplateUtil.applyPageTemplate(page, refData.getTemplateRef(), 75 89 existingMap, newElements); 76 90 77 AutoAction.registerEndChange(page.getAccess(), "Apply page template");91 AutoAction.registerEndChange(page.getAccess(), Message.create(APPLY_PAGE_TEMPLATE)); 78 92 79 93 // go to the page that was changed 80 94 BookView bookView = getView().getBookView(); … … 88 102 for (ElementH subelement : element.getSubElements()) { 89 103 if (!existingMap.containsValue(subelement.getRef())) { 90 104 element.removeSubElement(subelement.getRef().getThisChildRef(), 91 "Remove unassigned subelement", false);105 Message.create(REMOVE_UNASSIGNED_SUBELEMENT), false); 92 106 } else { 93 107 deleteUnassignedElements(subelement, existingMap); 94 108 } -
modules/org.sophie2.base.model.resources.r4/src/test/java/org/sophie2/base/model/resources/r4/access/BaseResourceAccessTest.java
9 9 import org.sophie2.base.model.resources.r4.dummies.resources.DummyResource; 10 10 import org.sophie2.base.model.resources.r4.resources.ResourceH; 11 11 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 12 import org.sophie2.base.skins.Message; 12 13 import org.sophie2.core.prolib.impl.AutoProperty; 13 14 import org.sophie2.core.prolib.interfaces.Prop; 14 15 import org.sophie2.core.testing.UnitTestBase; … … 21 22 */ 22 23 public class BaseResourceAccessTest extends UnitTestBase { 23 24 25 /** 26 * Constant created for moving the redirect. 27 * Constant created to be a parameter of a message of an {@link AutoAction}. 28 * Used for skinning. Used in the test. 29 */ 30 public static final String MOVE_REDIRECT = "Move the redirect"; 31 32 /** 33 * Constant created for moving the group with a group in another group. 34 * Constant created to be a parameter of a message of an {@link AutoAction}. 35 * Used for skinning. Used in the test. 36 */ 37 public static final String MOVE_GROUP_WITH_GROUP_IN_ANOTHER_GROUP = "Move the group with a group in another group."; 38 39 /** 40 * Constant created for moving the group with a frame in another group. 41 * Constant created to be a parameter of a message of an {@link AutoAction}. 42 * Used for skinning. Used in the test. 43 */ 44 public static final String MOVE_GROUP_WITH_FRAME_IN_ANOTHER_GROUP = "Move the group with a frame in another group."; 45 46 /** 47 * Constant created for moving the frame in a group. 48 * Constant created to be a parameter of a message of an {@link AutoAction}. 49 * Used for skinning. Used in the test. 50 */ 51 public static final String MOVE_FRAME_IN_GROUP = "Move the frame in a group"; 24 52 private ResourceAccess access; 25 53 private TestHelper helper; 26 54 … … 134 162 assertEquals(0, TestHelper.autoCounter); 135 163 136 164 final String one = "1+"; 137 new AutoAction( "Changing one", true) {165 new AutoAction(Message.create(CHANGE_ONE), true) { 138 166 139 167 private final String myField = one; 140 168 … … 155 183 156 184 157 185 final String two = "2"; 158 new AutoAction( "Changing two", true) {186 new AutoAction(Message.create(CHANGE_TWO), true) { 159 187 @Override 160 188 public void performAuto() { 161 189 getChanger().setRaw(DummyResource.KEY_DUMMY_COMPOSITE_TWO, two); … … 170 198 assertEquals(2, TestHelper.autoCounter); // one + two 171 199 172 200 final String dummy = "dummy"; 173 new AutoAction( "Changing dummy", true) {201 new AutoAction(Message.create(CHANGE_DUMMY), true) { 174 202 @Override 175 203 public void performAuto() { 176 204 getChanger().setRaw(DummyResource.KEY_SIMPLE_DUMMY, dummy); … … 190 218 final String FRAME_KIND = "Frame A"; 191 219 192 220 final ResourceRefR4 frameRef = ResourceRefR4.makeChild("Frame A"); 193 new AutoAction( "Create a Frame in this book", true) {221 new AutoAction(Message.create(CREATE_FRAME), true) { 194 222 @Override 195 223 public void performAuto() { 196 224 getChanger().makeResource(frameRef); … … 199 227 }.register(this.access); 200 228 201 229 final ResourceRefR4 groupRef = ResourceRefR4.makeChild("Group A"); 202 new AutoAction( "Move the frame in a group", true) {230 new AutoAction(Message.create(MOVE_FRAME_IN_GROUP), true) { 203 231 @Override 204 232 public void performAuto() { 205 233 getChanger().makeResource(groupRef); … … 210 238 }.register(this.access); 211 239 212 240 final ResourceRefR4 anotherGroupRef = ResourceRefR4.makeChild("Group B"); 213 new AutoAction( "Move the group with a frame in another group.", true) {241 new AutoAction(Message.create(MOVE_GROUP_WITH_FRAME_IN_ANOTHER_GROUP), true) { 214 242 @Override 215 243 public void performAuto() { 216 244 getChanger().makeResource(anotherGroupRef); … … 221 249 }.register(this.access); 222 250 223 251 final ResourceRefR4 thirdGroupRef = ResourceRefR4.makeChild("Group C"); 224 new AutoAction( "Move the group with a group in another group.", true) {252 new AutoAction(Message.create(MOVE_GROUP_WITH_GROUP_IN_ANOTHER_GROUP), true) { 225 253 @Override 226 254 public void performAuto() { 227 255 getChanger().makeResource(thirdGroupRef); … … 230 258 } 231 259 }.register(this.access); 232 260 233 new AutoAction( "Move the redirect", true) {261 new AutoAction(Message.create(MOVE_REDIRECT), true) { 234 262 @Override 235 263 public void performAuto() { 236 264 getChanger().moveResource(frameRef, ResourceRefR4.makeChild("a secret place.")); … … 240 268 ResourceAccess frame = this.access.open(frameRef, AccessOptions.DEFAULT_ACCESS_OPTIONS); 241 269 assertEquals(FRAME_KIND, frame.getRaw(ResourceR4.KEY_KIND)); 242 270 } 271 272 /** 273 * Constant created for changing one. 274 * Constant created to be a parameter of a message of an {@link AutoAction}. 275 * Used for skinning. Used in the test. 276 */ 277 public static final String CHANGE_ONE = "Changing one"; 278 279 /** 280 * Constant created for changing two. 281 * Constant created to be a parameter of a message of an {@link AutoAction}. 282 * Used for skinning. Used in the test. 283 */ 284 public static final String CHANGE_TWO = "Changing two"; 285 286 /** 287 * Constant created for changing dummy. 288 * Constant created to be a parameter of a message of an {@link AutoAction}. 289 * Used for skinning. Used in the test. 290 */ 291 public static final String CHANGE_DUMMY = "Changing dummy"; 292 293 /** 294 * Constant created for creating a frame in this book. 295 * Constant created to be a parameter of a message of an {@link AutoAction}. 296 * Used for skinning. Used in the test. 297 */ 298 public static final String CREATE_FRAME = "Create a Frame in this book"; 243 299 } 300 No newline at end of file -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/align/AlignElementsLogic.java
16 16 import org.sophie2.base.model.resources.r4.ResourceRefR4; 17 17 import org.sophie2.base.model.resources.r4.changes.AutoAction; 18 18 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 19 import org.sophie2.base.skins.Message; 19 20 import org.sophie2.core.mvc.EventFilterBuilder; 20 21 import org.sophie2.core.mvc.OperationDef; 21 22 import org.sophie2.core.mvc.events.EventR3; … … 29 30 * @author peko, mitex 30 31 */ 31 32 public enum AlignElementsLogic implements OperationDef { 32 33 33 34 /** 34 35 * Handles a user request to align the selected page elements. Uses the 35 36 * bounding rectangle of the elements. … … 85 86 final ImmList<LocationChannel> immOldLocations = NaiveImmList.create(oldLocations); 86 87 final ImmList<TimePos> immTimes = NaiveImmList.create(localTimes); 87 88 88 new AutoAction( "Align elements", true) {89 new AutoAction(Message.create(ALIGN_ELEMENTS), true) { 89 90 90 91 @Override 91 92 public void performAuto() { … … 102 103 103 104 return true; 104 105 } 105 } 106 }; 107 108 /** 109 * Constant created for aligning elements. 110 * Constant created to be a parameter of a message of an {@link AutoAction}. 111 * Used for skinning. 112 */ 113 public static final String ALIGN_ELEMENTS = "Align elements"; 106 114 } -
modules/org.sophie2.main.app.halos/src/main/java/org/sophie2/main/app/halos/common/ChangeColorButton.java
6 6 import org.sophie2.base.halos.HaloButton; 7 7 import org.sophie2.base.model.book.interfaces.StyledElement; 8 8 import org.sophie2.base.model.resources.r4.changes.AutoAction; 9 import org.sophie2.base.skins.Message; 9 10 import org.sophie2.core.logging.SophieLog; 10 11 import org.sophie2.core.mvc.EventFilterBuilder; 11 12 import org.sophie2.core.mvc.OperationDef; … … 49 50 final ImmColor bg = DialogManager.get().showDialog(new ColorDialogInput( 50 51 halo.swingComponent().get(), DIALOG_TITLE, INITIAL_COLOR)); 51 52 if(bg!=null) { 52 new AutoAction( "Change frame border color", true) {53 new AutoAction(Message.create(CHANGE_FRAME_BORDER_COLOR), true) { 53 54 54 55 @Override 55 56 public void performAuto() { … … 64 65 return true; 65 66 } 66 67 67 }, 68 }; 69 70 /** 71 * Constant created for changing frame border color. 72 * Constant created to be a parameter of a message of an {@link AutoAction}. 73 * Used for skinning. 74 */ 75 public static final String CHANGE_FRAME_BORDER_COLOR = "Change frame border color"; 68 76 } 69 77 } -
modules/org.sophie2.main.func.servers/src/test/java/org/sophie2/main/func/servers/resources/ServerResourceLocatorTest.java
19 19 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 20 20 import org.sophie2.base.model.security.BaseModelSecurityModule; 21 21 import org.sophie2.base.persistence.BasePersistenceModule; 22 import org.sophie2.base.skins.Message; 22 23 import org.sophie2.core.logging.LogLevel; 23 24 import org.sophie2.core.logging.SophieLog; 24 25 import org.sophie2.core.modularity.FakeModuleRegistry; … … 37 38 */ 38 39 public class ServerResourceLocatorTest extends IntegrationTestBase { 39 40 41 /** 42 * Constant created for significant test change. 43 * Constant created to be a parameter of a message of an {@link AutoAction}. 44 * Used for skinning. Used in the test. 45 */ 46 public static final String SIGNIFACNT_TEST_CHANGE = "signifacnt test change"; 47 40 48 private static final String TEST_SERVER_LOCATION = "/resources/test-book.book.s2"; 41 49 42 50 private String testBookLocation = null; … … 118 126 StoredResourceAccess asteaAccess = 119 127 (StoredResourceAccess) this.appLocator.open(target, null); 120 128 final String titleVale = "signifacantly changed comment."; 121 new AutoAction( "signifacnt test change", true) {129 new AutoAction(Message.create(SIGNIFACNT_TEST_CHANGE), true) { 122 130 123 131 @Override 124 132 public void performAuto() { -
modules/org.sophie2.extra.func.scripting/src/main/java/org/sophie2/extra/func/scripting/facade/JSFrame.java
16 16 import org.sophie2.base.model.resources.r4.ResourceRefR4; 17 17 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 18 18 import org.sophie2.base.model.resources.r4.changes.AutoAction; 19 import org.sophie2.base.skins.Message; 19 20 import org.sophie2.main.app.commons.element.ElementView; 20 21 import org.sophie2.main.app.commons.frame.FrameView; 21 22 … … 25 26 * @author mitex 26 27 */ 27 28 public class JSFrame extends BaseJSAdapter<FrameView> { 29 30 /** 31 * Constant created for expressing that rotation angle of a frame is set using scripting. 32 * Constant created to be a parameter of a message of an {@link AutoAction}. 33 * Used for skinning. 34 */ 35 public static final String SCRIPTING_SET_ROTATION_ANGLE_OF_FRAME = "Scripting: Set rotation angle of frame"; 36 37 /** 38 * Constant created for expressing that frame location is set using scripting. 39 * Constant created to be a parameter of a message of an {@link AutoAction}. 40 * Used for skinning. 41 */ 42 public static final String SCRIPTING_SET_FRAME_LOCATION = "Scripting: Set frame location"; 43 44 /** 45 * Constant created for expressing that z order of a frame is changed using scripting. 46 * Constant created to be a parameter of a message of an {@link AutoAction}. 47 * Used for skinning. 48 */ 49 public static final String CHANGE_FRAME_Z_ORDER = "Change frame zOrder"; 50 51 /** 52 * Constant created for expressing that frame size is set using scripting. 53 * Constant created to be a parameter of a message of an {@link AutoAction}. 54 * Used for skinning. 55 */ 56 public static final String SCRIPTING_SET_FRAME_SIZE = "Scripting: Set frame size"; 28 57 29 58 private static final long serialVersionUID = 3475060641486028780L; 30 59 … … 71 100 final ImmSize newSize = BoundMode.OUT_BORDER.setSize(size, frame.getPaddingInsets(), 72 101 frame.getStyleHelper().getBorderInsets(), frame.getMarginInsets()); 73 102 74 new AutoAction( "Scripting: Set frame size", false) {103 new AutoAction(Message.create(SCRIPTING_SET_FRAME_SIZE), false) { 75 104 76 105 @Override 77 106 public void performAuto() { … … 129 158 final ImmList<ActivationChannel> newChannels = 130 159 channels.remove(index).add(newIndex, channel); 131 160 132 new AutoAction( "Change frame zOrder", false) {161 new AutoAction(Message.create(CHANGE_FRAME_Z_ORDER), false) { 133 162 134 163 @Override 135 164 public void performAuto() { … … 182 211 final LocationChannel channel = frame.get(MemberElement.KEY_LOCATION); 183 212 final TimePos time = getAdaptedObject().getTime(); 184 213 185 new AutoAction( "Scripting: Set frame location", false) {214 new AutoAction(Message.create(SCRIPTING_SET_FRAME_LOCATION), false) { 186 215 187 216 @Override 188 217 public void performAuto() { … … 214 243 public void jsSet_rotatingAngle(double angle) { 215 244 216 245 final Double angleRef = new Double(angle * Math.PI / 180); 217 new AutoAction( "Scripting: Set rotation angle of frame", false) {246 new AutoAction(Message.create(SCRIPTING_SET_ROTATION_ANGLE_OF_FRAME), false) { 218 247 219 248 @Override 220 249 public void performAuto() { -
modules/org.sophie2.extra.func.browser/src/main/java/org/sophie2/extra/func/browser/view/BrowserLogic.java
4 4 import org.sophie2.base.commons.util.position.ImmPoint; 5 5 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 6 6 import org.sophie2.base.model.resources.r4.changes.AutoAction; 7 import org.sophie2.base.skins.Message; 7 8 import org.sophie2.base.visual.interaction.InputEventR3; 8 9 import org.sophie2.core.mvc.EventFilterBuilder; 9 10 import org.sophie2.core.mvc.OperationDef; … … 181 182 ResourceAccess access = AppHaloUtil.getSingleSelected(addressBar, 182 183 NativeBrowserFrameView.class).getAccess(); 183 184 184 new AutoAction( "Browser address changed", true) {185 new AutoAction(Message.create(BROWSER_ADDRESS_CHANGED), true) { 185 186 @Override 186 187 public void performAuto() { 187 188 getChanger().setRaw(BrowserFrameR4.KEY_URL, value); … … 191 192 return true; 192 193 } 193 194 194 } 195 }; 196 197 /** 198 * Constant created for notifying that the browser address changed. 199 * Constant created to be a parameter of a message of an {@link AutoAction}. 200 * Used for skinning. 201 */ 202 public static final String BROWSER_ADDRESS_CHANGED = "Browser address changed"; 195 203 } -
modules/org.sophie2.extra.func.annotations/src/main/java/org/sophie2/extra/func/annotations/view/halos/StickyMoveHaloButton.java
13 13 import org.sophie2.base.model.resources.r4.changes.AutoAction; 14 14 import org.sophie2.base.scene.SceneVisual; 15 15 import org.sophie2.base.scene.helpers.SceneHelper; 16 import org.sophie2.base.skins.Message; 16 17 import org.sophie2.base.skins.SkinElementId; 17 18 import org.sophie2.base.visual.skins.VisualElementDef; 18 19 import org.sophie2.extra.func.annotations.view.StickyView; … … 28 29 @VisualElementDef(parent = StickyHaloMenu.class, sortKey = "xxx-sticky-move-halo-button") 29 30 public class StickyMoveHaloButton extends PageElementMoveHaloButton { 30 31 32 /** 33 * Constant created for notifying that a sticky is moving. 34 * Constant created to be a parameter of a message of an {@link AutoAction}. 35 * Used for skinning. 36 */ 37 public static final String STICKY_IS_MOVING = "Sticky is moving..."; 38 39 /** 40 * Constant created for notifying that a sticky is moved. 41 * Constant created to be a parameter of a message of an {@link AutoAction}. 42 * Used for skinning. 43 */ 44 public static final String STICKY_MOVED = "Sticky moved."; 45 31 46 @Override 32 47 protected MouseCapture captureClick(MouseEvent e) { 33 48 … … 53 68 final ImmPoint newlocation = 54 69 MemberElement.KEY_LOCATION.get(access).getValue(time); 55 70 56 new AutoAction( "Sticky moved.", true) {71 new AutoAction(Message.create(STICKY_MOVED), true) { 57 72 58 73 @Override 59 74 public void performAuto() { … … 69 84 ImmSize offset = sceneToParent.transform(new ImmPoint(newX, newY)).minus(zero); 70 85 final ImmPoint newLocation = oldLocation.plus(offset); 71 86 72 new AutoAction( "Sticky is moving...", false) {87 new AutoAction(Message.create(STICKY_IS_MOVING), false) { 73 88 74 89 @Override 75 90 public void performAuto() { -
modules/org.sophie2.main.app.commons/src/test/java/org/sophie2/main/app/commons/dialogs/BookPropertiesDialogDemo.java
23 23 import org.sophie2.base.model.resources.r4.resources.ResourceH; 24 24 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 25 25 import org.sophie2.base.skins.BaseSkinsModule; 26 import org.sophie2.base.skins.Message; 26 27 import org.sophie2.base.visual.BaseVisualModule; 27 28 import org.sophie2.core.modularity.SophieModule; 28 29 import org.sophie2.core.mvc.CoreMvcModule; … … 35 36 */ 36 37 public class BookPropertiesDialogDemo extends ModelTestBase { 37 38 39 /** 40 * Constant created for creating a book with two pages. 41 * Constant created to be a parameter of a message of an {@link AutoAction}. 42 * Used for skinning. 43 */ 44 public static final String CREATE_BOOK_TWO_PAGES = "Create a book with two pages"; 45 38 46 @SuppressWarnings("unchecked") 39 47 @Override 40 48 protected List<Class<? extends SophieModule>> fillDependencies() { … … 46 54 47 55 ResourceAccess access = makeBookAccess(); 48 56 49 new AutoAction( "Create a book with two pages", true) {57 new AutoAction(Message.create(CREATE_BOOK_TWO_PAGES), true) { 50 58 @Override 51 59 public void performAuto() { 52 60 getChanger().setRaw(ResourceR4.KEY_KIND, BookR4.KIND); -
modules/org.sophie2.main.func.timelines/src/main/java/org/sophie2/main/func/timelines/hud/HeadSection.java
16 16 import org.sophie2.base.model.book.timelines.TimelineOptions; 17 17 import org.sophie2.base.model.resources.r4.access.ResourceAccess; 18 18 import org.sophie2.base.model.resources.r4.changes.AutoAction; 19 import org.sophie2.base.skins.Message; 19 20 import org.sophie2.base.skins.SkinElementId; 20 21 import org.sophie2.base.visual.BaseSwingVisualElement; 21 22 import org.sophie2.base.visual.skins.ElementSkinPart; … … 392 393 } 393 394 394 395 @Override 395 public StringgetActionLabel() {396 return "Set intro length";396 public Message getActionLabel() { 397 return Message.create(SET_INTRO_LENGTH); 397 398 } 398 399 399 400 }, … … 416 417 } 417 418 418 419 @Override 419 public StringgetActionLabel() {420 return "Set main length";420 public Message getActionLabel() { 421 return Message.create(SET_MAIN_LENGTH); 421 422 } 422 423 423 424 }, … … 434 435 } 435 436 436 437 @Override 437 public StringgetActionLabel() {438 return "Set outro length";438 public Message getActionLabel() { 439 return Message.create(SET_OUTRO_LENGTH); 439 440 } 440 441 441 442 @Override … … 445 446 } 446 447 }; 447 448 449 /** 450 * Constant created for setting intro length. 451 * Constant created to be a parameter of a message of an {@link AutoAction}. 452 * Used for skinning. 453 */ 454 public static final String SET_INTRO_LENGTH = "Set intro length"; 455 456 /** 457 * Constant created for setting main length. 458 * Constant created to be a parameter of a message of an {@link AutoAction}. 459 * Used for skinning. 460 */ 461 public static final String SET_MAIN_LENGTH = "Set main length"; 462 463 /** 464 * Constant created for setting outro length. 465 * Constant created to be a parameter of a message of an {@link AutoAction}. 466 * Used for skinning. 467 */ 468 public static final String SET_OUTRO_LENGTH = "Set outro length"; 469 448 470 public boolean handle(EventR3 event) { 449 471 BaseTimelinesSpinner spinner = event.getSource(BaseTimelinesSpinner.class); 450 472 … … 482 504 * 483 505 * @return Description of the action that will be performed 484 506 */ 485 protected abstract StringgetActionLabel();507 protected abstract Message getActionLabel(); 486 508 487 509 /** 488 510 * Should create a new instance of {@link TimelineOptions} that will -
modules/org.sophie2.extra.func.plain/src/main/java/org/sophie2/extra/func/plain/PlainTextLogic.java
9 9 import org.sophie2.base.menus.MenuItem; 10 10 import org.sophie2.base.model.book.BookH; 11 11 import org.sophie2.base.model.book.PageH; 12 import org.sophie2.base.model.resources.r4.changes.AutoAction; 12 13 import org.sophie2.base.model.text.smart.ImmHotText; 14 import org.sophie2.base.skins.Message; 13 15 import org.sophie2.core.logging.SophieLog; 14 16 import org.sophie2.core.mvc.EventFilterBuilder; 15 17 import org.sophie2.core.mvc.OperationDef; … … 72 74 ImmHotText text = ImmHotText.createPlain(str.toString()); 73 75 74 76 HeadTextFrameH.createTextFrameAction(book, page, text, txtFile.toURI(), 75 null, "Insert plain text", true);77 null, Message.create(INSERT_PLAIN_TEXT), true); 76 78 return true; 77 79 } 78 80 79 81 }; 82 83 /** 84 * Constant created for notifying that plain text is inserted. 85 * Constant created to be a parameter of a message of an {@link AutoAction}. 86 * Used for skinning. 87 */ 88 public static final String INSERT_PLAIN_TEXT = "Insert plain text"; 80 89 } -
modules/org.sophie2.server.core/src/test/java/org/sophie2/server/core/persistence/db/DBContextTest.java
26 26 import org.sophie2.base.model.resources.r4.model.RevisionId; 27 27 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 28 28 import org.sophie2.base.persistence.BasePersistenceModule; 29 import org.sophie2.base.skins.Message; 29 30 import org.sophie2.core.modularity.FakeModuleRegistry; 30 31 import org.sophie2.server.core.persistence.db.params.DBKeyChange; 31 32 import org.sophie2.server.core.persistence.db.params.DBResource; … … 465 466 } 466 467 467 468 private Class<?> getTestChangeClass() { 468 AutoAction action = new AutoAction( TEST_DESC, true) {469 AutoAction action = new AutoAction(Message.create(TEST_DESC), true) { 469 470 470 471 @Override 471 472 public void performAuto() { -
modules/org.sophie2.base.model.book/pom.xml
61 61 <groupId>org.sophie2</groupId> 62 62 <artifactId>org.sophie2.base.skins</artifactId> 63 63 <version>2.0.5</version> 64 <scope>test</scope>65 64 </dependency> 66 65 <dependency> 67 66 <groupId>junit</groupId> -
modules/org.sophie2.extra.comment/src/test/java/org/sophie2/extra/comment/CommentTestUtil.java
19 19 import org.sophie2.base.model.resources.r4.resources.ResourceH; 20 20 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 21 21 import org.sophie2.base.model.text.smart.ImmHotText; 22 import org.sophie2.base.skins.Message; 22 23 import org.sophie2.extra.comment.model.Comment; 23 24 import org.sophie2.extra.comment.model.CommentStream; 24 25 import org.sophie2.extra.comment.model.CommentStreamH; … … 30 31 */ 31 32 public class CommentTestUtil { 32 33 34 public static final String CREATE_FRAME1 = "Create Frame1"; 35 36 public static final String CREATE_A_BOOK_WITH_TWO_PAGES = "Create a book with two pages"; 37 38 public static final String CREATE_A_COMMENT_STREAM_WITH_2_COMMENTS = "Create a comment stream with 2 comments."; 39 33 40 /** 34 41 * Sample content of the first {@link Comment} in the stream. 35 42 */ … … 66 73 67 74 final ResourceRefR4 streamRef = ResourceRefR4.generateRandomSub("Stream"); 68 75 69 new AutoAction( "Create a comment stream with 2 comments.", true) {76 new AutoAction(Message.create(CREATE_A_COMMENT_STREAM_WITH_2_COMMENTS), true) { 70 77 71 78 @Override 72 79 public void performAuto() { … … 105 112 ResourceRevision head = LocalResourceRevision.getInitialRevision(); 106 113 ResourceAccess access = locator.create(ref, AccessOptions.DEFAULT_ACCESS_OPTIONS, head); 107 114 108 new AutoAction( "Create a book with two pages", true) {115 new AutoAction(Message.create(CREATE_A_BOOK_WITH_TWO_PAGES), true) { 109 116 @Override 110 117 public void performAuto() { 111 118 getChanger().setRaw(ResourceR4.KEY_KIND, BookR4.KIND); … … 124 131 } 125 132 }.register(access); 126 133 127 new AutoAction( "Create Frame1", true) {134 new AutoAction(Message.create(CREATE_FRAME1), true) { 128 135 @Override 129 136 public void performAuto() { 130 137 ResourceRefR4 subRef = ResourceRefR4.make("./PAGE_A/FRAME_1"); -
modules/org.sophie2.base.model.resources.r4/src/main/java/org/sophie2/base/model/resources/r4/changes/ChangePersister.java
12 12 import org.sophie2.base.persistence.persister.RefToStoragePersister; 13 13 import org.sophie2.base.persistence.ref.ValueRef; 14 14 import org.sophie2.base.persistence.storage.Storage; 15 import org.sophie2.base.skins.Message; 15 16 import org.sophie2.core.prolib.annot.Immutable; 16 17 17 18 /** … … 111 112 PersistenceUtil.getStorageR3Schema(Immutable.class)); 112 113 if (options.isLoadMode()) { 113 114 source.set(new ModelChange(scopeRef.get(), userRef.get(), viewIdRef.get(), 114 descriptionRef.get(), isSignificantRef.get(), autoActionClassRef.get(),115 Message.create(descriptionRef.get()), isSignificantRef.get(), autoActionClassRef.get(), 115 116 actionFieldsRef.get())); 116 117 } 117 118 } else if (metaChange) { … … 129 130 MasterPersister.persist(skipedRevisionIdRef, target.child("skipped-revision-id"), options, 130 131 PersistenceUtil.getStorageR3Schema(Immutable.class)); 131 132 if (options.isLoadMode()) { 132 source.set(new MetaChange(userRef.get(), viewIdRef.get(), descriptionRef.get(),133 source.set(new MetaChange(userRef.get(), viewIdRef.get(), Message.create(descriptionRef.get()), 133 134 metaChangeTypeRef.get(), skipedRevisionIdRef.get())); 134 135 } 135 136 -
modules/org.sophie2.extra.func.scripting/src/main/java/org/sophie2/extra/func/scripting/facade/JSBook.java
13 13 import org.sophie2.base.model.resources.r4.ResourceUtil; 14 14 import org.sophie2.base.model.resources.r4.changes.AutoAction; 15 15 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 16 import org.sophie2.base.skins.Message; 16 17 import org.sophie2.main.app.commons.book.BookView; 17 18 import org.sophie2.main.app.commons.page.RootPageView; 18 19 … … 23 24 */ 24 25 public class JSBook extends BaseJSAdapter<BookView> { 25 26 27 /** 28 * Constant created for expressing that page is moved using scripting. 29 * Constant created to be a parameter of a message of an {@link AutoAction}. 30 * Used for skinning. 31 */ 32 public static final String SCRIPTING_MOVE_PAGE = "Scripting: Move page"; 33 34 /** 35 * Constant created for expressing that page is removed using scripting. 36 * Constant created to be a parameter of a message of an {@link AutoAction}. 37 * Used for skinning. 38 */ 39 public static final String SCRIPTING_REMOVE_PAGE = "Scripting: Remove page"; 40 41 /** 42 * Constant created for expressing that new page is added using scripting. 43 * Constant created to be a parameter of a message of an {@link AutoAction}. 44 * Used for skinning. 45 */ 46 public static final String SCRIPTING_ADD_NEW_PAGE = "Scripting: Add new page"; 47 48 /** 49 * Constant created for expressing that page size is set using scripting. 50 * Constant created to be a parameter of a message of an {@link AutoAction}. 51 * Used for skinning. 52 */ 53 public static final String SCRIPTING_SET_PAGE_SIZE = "Scripting: Set page size"; 54 55 /** 56 * Constant created for expressing that book title is set using scripting. 57 * Constant created to be a parameter of a message of an {@link AutoAction}. 58 * Used for skinning. 59 */ 60 public static final String SCRIPTING_SET_BOOK_TITLE = "Scripting: Set book title"; 61 26 62 private static final long serialVersionUID = -3264517072898693605L; 27 63 28 64 /** … … 54 90 public void jsSet_title(final String title) { 55 91 BookH book = getAdaptedObject().model().get(); 56 92 57 new AutoAction( "Scripting: Set book title", false) {93 new AutoAction(Message.create(SCRIPTING_SET_BOOK_TITLE), false) { 58 94 59 95 @Override 60 96 public void performAuto() { … … 83 119 final ImmSize size = (ImmSize) value.unwrap(); 84 120 BookH book = getAdaptedObject().model().get(); 85 121 86 new AutoAction( "Scripting: Set page size", false) {122 new AutoAction(Message.create(SCRIPTING_SET_PAGE_SIZE), false) { 87 123 88 124 @Override 89 125 public void performAuto() { … … 126 162 127 163 final String pageName = 128 164 ResourceUtil.getNextTitle(book.getRef(), PageR4.DEFAULT_TITLE); 129 new AutoAction( "Scripting: Add new page", false) {165 new AutoAction(Message.create(SCRIPTING_ADD_NEW_PAGE), false) { 130 166 131 167 @Override 132 168 public void performAuto() { … … 153 189 final ResourceRefR4 pageRef = book.getPages().get(index); 154 190 final ResourceRefList pages = book.get(BookR4.KEY_PAGES); 155 191 156 new AutoAction( "Scripting: Remove page", false) {192 new AutoAction(Message.create(SCRIPTING_REMOVE_PAGE), false) { 157 193 158 194 @Override 159 195 public void performAuto() { … … 175 211 BookH book = getAdaptedObject().model().get(); 176 212 final ResourceRefList children = book.getPages(); 177 213 178 new AutoAction( "Scripting: Move page", false) {214 new AutoAction(Message.create(SCRIPTING_MOVE_PAGE), false) { 179 215 180 216 @Override 181 217 public void performAuto() { -
modules/org.sophie2.base.model.resources.r4/src/main/java/org/sophie2/base/model/resources/r4/resources/ResourceH.java
18 18 import org.sophie2.base.model.resources.r4.keys.Key; 19 19 import org.sophie2.base.model.resources.r4.keys.TemplatedKey; 20 20 import org.sophie2.base.model.resources.r4.model.ResourceReferrer; 21 import org.sophie2.base.skins.Message; 21 22 import org.sophie2.core.prolib.errors.NotAvailableException; 22 23 import org.sophie2.core.prolib.impl.BaseProObject; 23 24 import org.sophie2.core.prolib.interfaces.Prop; … … 410 411 * The new title of the resource. 411 412 */ 412 413 public static void changeTitle(ResourceH resource, final String newTitle) { 413 new AutoAction( "Change resource title to " + newTitle, true) {414 new AutoAction(Message.create(RES_TITLE, newTitle), true) { 414 415 415 416 @Override 416 417 public void performAuto() { … … 421 422 } 422 423 423 424 /** 425 * Constant created for changing resource title. 426 * Constant created to be a parameter of a message of an {@link AutoAction}. 427 * Used for skinning. 428 */ 429 public static final String RES_TITLE = "Change resource title to %1$s"; 430 431 /** 424 432 * Gets the file extension for the export of this resource. Different helpers 425 433 * could override this method to give more specific extensions. 426 434 * -
modules/org.sophie2.base.model.book/src/main/java/org/sophie2/base/model/book/testing/ModelTestBase.java
29 29 import org.sophie2.base.model.resources.r4.model.ResourceModel; 30 30 import org.sophie2.base.model.resources.r4.model.ResourceRevision; 31 31 import org.sophie2.base.model.resources.r4.resources.ResourceH; 32 import org.sophie2.base.skins.Message; 32 33 import org.sophie2.core.modularity.FakeModuleRegistry; 33 34 import org.sophie2.core.modularity.SophieModule; 34 35 import org.sophie2.core.testing.IntegrationTestBase; … … 42 43 @NoTest 43 44 public class ModelTestBase extends IntegrationTestBase { 44 45 46 /** 47 * Constant created for creating test frame. 48 * Constant created to be a parameter of a message of an {@link AutoAction}. 49 * Used for skinning. Used in the test. 50 */ 51 public static final String CREATE_TEST_FRAME = "Create test frame."; 52 53 /** 54 * Constant created for creating test page. 55 * Constant created to be a parameter of a message of an {@link AutoAction}. 56 * Used for skinning. Used in the test. 57 */ 58 public static final String CREATE_TEST_PAGE = "Create test page."; 45 59 private AppLocator appLocator; 46 60 47 61 … … 114 128 book.getAccess().getHead().getModel().debugPrint(); 115 129 final ResourceRefList pages = book.get(BookR4.KEY_PAGES); 116 130 117 new AutoAction( "Create test page.", true) {131 new AutoAction(Message.create(CREATE_TEST_PAGE), true) { 118 132 @Override 119 133 public void performAuto() { 120 134 BookH.addNewPage(getChanger(), pageRef, pages, PageR4.DEFAULT_TITLE); … … 139 153 final ImmList<ActivationChannel> children = 140 154 CompositeElement.KEY_SUB_ELEMENTS.get(page.getAccess()); 141 155 142 new AutoAction( "Create test frame.", true) {156 new AutoAction(Message.create(CREATE_TEST_FRAME), true) { 143 157 @Override 144 158 public void performAuto() { 145 159 FrameH.create(getChanger(), frameRef, FrameR4.DEFAULT_TITLE, -
modules/org.sophie2.base.model.book/src/main/java/org/sophie2/base/model/book/BookH.java
28 28 import org.sophie2.base.model.resources.r4.model.ResourceRevision; 29 29 import org.sophie2.base.model.resources.r4.resources.ResourceH; 30 30 import org.sophie2.base.model.resources.r4.resources.ResourceR4; 31 import org.sophie2.base.skins.Message; 31 32 32 33 /** 33 34 * A class representing a book. … … 37 38 public final class BookH extends ResourceH { 38 39 39 40 /** 41 * Constant created for creating a blank page. 42 * Constant created to be a parameter of a message of an {@link AutoAction}. 43 * Used for skinning. 44 */ 45 public static final String CREATE_BLANK_PAGE = "Create blank page."; 46 47 /** 40 48 * The prefix of the titles in the books that are in preview mode. 41 49 */ 42 50 public static final String PREVIEW_TITLE_PREFIX = "Preview of "; … … 447 455 */ 448 456 public static AutoAction createInitAction(final ResourceRefR4 pageRef, 449 457 final String pageTitle) { 450 return new AutoAction( "Create blank page.", true) {458 return new AutoAction(Message.create(CREATE_BLANK_PAGE), true) { 451 459 @Override 452 460 public void performAuto() { 453 461 BookH.addNewPage(getChanger(), pageRef, BookR4.KEY_PAGES -
modules/org.sophie2.base.model.book/src/test/java/org/sophie2/base/model/book/GroupTest.java
19 19 import org.sophie2.base.model.resources.r4.changes.AutoAction; 20 20 import org.sophie2.base.model.resources.r4.changes.ResourceChanger; 21 21 import org.sophie2.base.model.resources.r4.resources.ResourceH; 22 import org.sophie2.base.skins.Message; 22 23 23 24 /** 24 25 * Test for the {@link ElementGroupH} class. … … 27 28 */ 28 29 public class GroupTest extends ModelTestBase { 29 30 31 /** 32 * Constant created for deleting group1 from the page. 33 * Constant created to be a parameter of a message of an {@link AutoAction}. 34 * Used for skinning. Used in the test. 35 */ 36 public static final String DELETE_GROUP1_FROM_THE_PAGE = "Delete group1 from the page."; 37 38 /** 39 * Constant created for deleting group2 from page. 40 * Constant created to be a parameter of a message of an {@link AutoAction}. 41 * Used for skinning. Used in the test. 42 */ 43 public static final String DELETE_GROUP2_FROM_PAGE = "Delete group2 from page."; 44 45 /** 46 * Constant created for deleting group2 from page. 47 * Constant created to be a parameter of a message of an {@link AutoAction}. 48 * Used for skinning. Used in the test. 49 */ 50 public static final String CREATE_GROUP_WITH_GROUP1_AND_FRAME2 = "Create a group with group1 and frame2."; 51 52 /** 53 * Constant created for deleting group2 from page. 54 * Constant created to be a parameter of a message of an {@link AutoAction}. 55 * Used for skinning. Used in the test. 56 */ 57 public static final String CREATE_GROUP_WITH_GROUP1_AND_FRAME3 = "Create a group with group1 and frame3."; 58 59 /** 60 * Constant created for creating a group with group0 and frame2.. 61 * Constant created to be a parameter of a message of an {@link AutoAction}. 62 * Used for skinning. Used in the test. 63 */ 64 public static final String CREATE_GROUP_WITH_GROUP0_AND_FRAME2 = "Create a group with group0 and frame2."; 65 66 /** 67 * Constant created for creating a group with frame0 and frame1. 68 * Constant created to be a parameter of a message of an {@link AutoAction}. 69 * Used for skinning. Used in the test. 70 */ 71 public static final String CREATE_GROUP_FRAME0_AND_FRAME1 = "Create a group with frame0 and frame1."; 72 73 /** 74 * Constant created for creating a group with a group. 75 * Constant created to be a parameter of a message of an {@link AutoAction}. 76 * Used for skinning. Used in the test. 77 */ 78 public static final String CREATE_GROUP_WITH_GROUP = "Create a group with a group."; 79 80 /** 81 * Constant created for creating a group with two elements. 82 * Constant created to be a parameter of a message of an {@link AutoAction}. 83 * Used for skinning. Used in the test. 84 */ 85 public static final String CREATE_GROUP_TWO_ELEMENTS = "Create a group with two elements."; 86 87 /** 88 * Constant created for creating a bad group with one element. 89 * Constant created to be a parameter of a message of an {@link AutoAction}. 90 * Used for skinning. Used in the test. 91 */ 92 public static final String CREATE_GROUP_ONE_ELEMENT = "Create a bad group with one element."; 93 94 /** 95 * Constant created for creating a bad group with zero elements. 96 * Constant created to be a parameter of a message of an {@link AutoAction}. 97 * Used for skinning. Used in the test. 98 */ 99 public static final String CREATE_GROUP_ZERO_ELEMENTS = "Create a bad group with zero elements."; 30 100 private ResourceAccess bookAccess; 31 101 private PageH page; 32 102 private FrameH frame0; … … 70 140 final ImmList<ActivationChannel> channels = 71 141 CompositeElement.KEY_SUB_ELEMENTS.get(this.page.getAccess()); 72 142 73 new AutoAction( "Create a bad group with zero elements.", true) {143 new AutoAction(Message.create(CREATE_GROUP_ZERO_ELEMENTS), true) { 74 144 @Override 75 145 public void performAuto() { 76 146 ElementGroupH.createGroup(getChanger(), groupRef, groupRef.getName(), … … 94 164 final ImmList<ActivationChannel> channels = 95 165 CompositeElement.KEY_SUB_ELEMENTS.get(this.page.getAccess()); 96 166 97 new AutoAction( "Create a bad group with one element.", true) {167 new AutoAction(Message.create(CREATE_GROUP_ONE_ELEMENT), true) { 98 168 @Override 99 169 public void performAuto() { 100 170 ElementGroupH.createGroup(getChanger(), groupRef, groupRef.getName(), … … 118 188 final ImmList<ActivationChannel> channels = 119 189 CompositeElement.KEY_SUB_ELEMENTS.get(this.page.getAccess()); 120 190 121 new AutoAction( "Create a group with two elements.", true) {191 new AutoAction(Message.create(CREATE_GROUP_TWO_ELEMENTS), true) { 122 192 @Override 123 193 public void performAuto() { 124 194 ElementGroupH.createGroup(getChanger(), groupRef, groupRef.getName(), … … 148 218 final ImmList<ActivationChannel> channels2 = 149 219 CompositeElement.KEY_SUB_ELEMENTS.get(this.page.getAccess()); 150 220 151 new AutoAction( "Create a group with a group.", true) {221 new AutoAction(Message.create(CREATE_GROUP_WITH_GROUP), true) { 152 222 @Override 153 223 public void performAuto() { 154 224 ElementGroupH.createGroup(getChanger(), group2Ref, group2Ref.getName(), … … 187 257 final ImmList<ActivationChannel> channels = 188 258 CompositeElement.KEY_SUB_ELEMENTS.get(this.page.getAccess()); 189 259 190 new AutoAction( "Create a group with frame0 and frame1.", true) {260 new AutoAction(Message.create(CREATE_GROUP_FRAME0_AND_FRAME1), true) { 191 261 @Override 192 262 public void performAuto() { 193 263 ElementGroupH.createGroup(getChanger(), groupRef, groupRef.getName(), … … 215 285 final ImmList<ActivationChannel> channels2 = 216 286 CompositeElement.KEY_SUB_ELEMENTS.get(this.page.getAccess()); 217 287 218 new AutoAction( "Create a group with group0 and frame2.", true) {288 new AutoAction(Message.create(CREATE_GROUP_WITH_GROUP0_AND_FRAME2), true) { 219 289 @Override 220 290 public void performAuto() { 221 291 ElementGroupH.createGroup(getChanger(), group1Ref, group1Ref.getName(), … … 240 310 final ImmList<ActivationChannel> channels3 = 241 311 CompositeElement.KEY_SUB_ELEMENTS.get(this.page.getAccess()); 242 312 243 new AutoAction( "Create a group with group1 and frame3.", true) {313 new AutoAction(Message.create(CREATE_GROUP_WITH_GROUP1_AND_FRAME3), true) { 244 314 @Override 245 315 public void performAuto() { 246 316 ElementGroupH.createGroup(getChanger(), group2Ref, group2Ref.getName(), … … 295 365 final ImmList<ActivationChannel> channels = 296 366 CompositeElement.KEY_SUB_ELEMENTS.get(this.page.getAccess()); 297 367 298 new AutoAction( "Create a group with frame0 and frame1.", true) {368 new AutoAction(Message.create(CREATE_GROUP_FRAME0_AND_FRAME1), true) { 299 369 @Override 300 370 public void performAuto() { 301 371 ElementGroupH.createGroup(getChanger(), groupRef, groupRef.getName(), … … 314 384 final ImmList<ActivationChannel> channels2 = 315 385 CompositeElement.KEY_SUB_ELEMENTS.get(this.page.getAccess()); 316 386 317 new AutoAction( "Create a group with group1 and frame2.", true) {387 new AutoAction(Message.create(CREATE_GROUP_WITH_GROUP1_AND_FRAME2), true) { 318 388 @Override 319 389 public void performAuto() { 320 390 ElementGroupH.createGroup(getChanger(), group2Ref, group2Ref.getName(), … … 329 399 CompositeElement.KEY_SUB_ELEMENTS.get(this.page.getAccess()); 330 400 // Now, we delete a group which contains another group - 331 401 // the inner one should not be destroyed. 332 new AutoAction( "Delete group2 from page.", true) {402 new AutoAction(Message.create(DELETE_GROUP2_FROM_PAGE), true) { 333 403 @Override 334 404 public void performAuto() { 335 405 ElementGroupH.deleteGroup(getChanger(), group2Ref, parentChannels); … … 347 417 final ImmList<ActivationChannel> parentChannels2 = 348 418 CompositeElement.KEY_SUB_ELEMENTS.get(this.page.getAccess()); 349 419 350 new AutoAction( "Delete group1 from the page.", true) {420 new AutoAction(Message.create(DELETE_GROUP1_FROM_THE_PAGE), true) { 351 421 @Override 352 422 public void performAuto() { 353 423 ElementGroupH.deleteGroup(getChanger(), ref, parentChannels2); … … 379 449 final ImmList<ActivationChannel> channels = 380 450 CompositeElement.KEY_SUB_ELEMENTS.get(this.page.getAccess()); 381 451 382 new AutoAction( "Create a group with two elements.", true) {452 new AutoAction(Message.create(CREATE_GROUP_TWO_ELEMENTS), true) { 383 453 @Override 384 454 public void performAuto() { 385 455 ElementGroupH.createGroup(getChanger(), groupRef, groupRef.getName(), -
modules/org.sophie2.server.core/src/main/java/org/sophie2/server/core/facade/ServerFacade.java
30 30 import org.sophie2.base.model.resources.r4.keys.Key; 31 31 import org.sophie2.base.model.resources.r4.model.RevisionId; 32 32 import org.sophie2.base.model.security.UserR4; 33 import org.sophie2.base.skins.Message; 33 34 import org.sophie2.core.logging.SophieLog; 34 35 import org.sophie2.core.modularity.SophieExtension; 35 36 import org.sophie2.core.prolib.interfaces.ListProp; … … 290 291 } 291 292 } 292 293 return new MetaChange(change.getUser(), change.getViewId(), 293 change.getDescription(), change.getType(),294 Message.create(change.getDescription()), change.getType(), 294 295 NaiveImmList.<RevisionId>create(result)); 295 296 } 296 297 -
modules/org.sophie2.dev/src/test/java/org/sophie2/dev/author/BookDocViewDemo.java
36 36 import org.sophie2.base.model.resources.r4.resources.ResourceH; 37 37 import org.sophie2.base.scene.BaseSceneModule; 38 38 import org.sophie2.base.skins.BaseSkinsModule; 39 import org.sophie2.base.skins.Message; 39 40 import org.sophie2.base.visual.BaseVisualElement; 40 41 import org.sophie2.base.visual.BaseVisualModule; 41 42 import org.sophie2.core.logging.LogLevel; … … 60 61 */ 61 62 public class BookDocViewDemo extends AppTestBase { 62 63 64 /** 65 * Constant created for creation of an image frame. 66 * Constant created to be a parameter of a message of an {@link AutoAction}. 67 * Used for skinning. Used in the test. 68 */ 69 public static final String CREATE_IMAGE_FRAME = "Create test image frame."; 70 71 /** 72 * Constant created for creation of a frame. 73 * Constant created to be a parameter of a message of an {@link AutoAction}. 74 * Used for skinning. Used in the test. 75 */ 76 public static final String CREATE_FRAME = "Create test frame."; 77 78 /** 79 * Constant created for changing of frame border. 80 * Constant created to be a parameter of a message of an {@link AutoAction}. 81 * Used for skinning. Used in the test. 82 */ 83 public static final String FRAME_BORDER = "Changing frame border"; 84 85 /** 86 * Constant created for changing of page border. 87 * Constant created to be a parameter of a message of an {@link AutoAction}. 88 * Used for skinning. Used in the test. 89 */ 90 public static final String PAGE_BORDER = "Changing page border"; 91 92 /** 93 * Constant created for changing of content location. 94 * Constant created to be a parameter of a message of an {@link AutoAction}. 95 * Used for skinning. Used in the test. 96 */ 97 public static final String CONTENT_LOCATION = "Changing content location"; 98 99 /** 100 * Constant created for changing background to green. 101 * Constant created to be a parameter of a message of an {@link AutoAction}. 102 * Used for skinning. Used in the test. 103 */ 104 public static final String BG_TO_GREEN = "Background to green"; 105 63 106 private static class DummyBookDocView extends BookDocView { 64 107 65 108 public DummyBookDocView(ResourceAccess access) { … … 157 200 this.page = makePage(this.bookAccess); 158 201 final ResourceRefR4 pageRef = ResourceRefR4.make("./" + this.page.getName()); 159 202 160 new AutoAction( "Background to green", true) {203 new AutoAction(Message.create(BG_TO_GREEN), true) { 161 204 @Override 162 205 public void performAuto() { 163 206 ResourceChanger pageChanger = getChanger().getSub(pageRef); … … 170 213 this.frame = makeEmptyFrame(this.page.getAccess()); 171 214 final ResourceRefR4 frameRef = this.page.getChildRef(this.frame); 172 215 173 new AutoAction( "Changing content location", true) {216 new AutoAction(Message.create(CONTENT_LOCATION), true) { 174 217 @Override 175 218 public void performAuto() { 176 219 ResourceChanger frameChanger = getChanger().getSub(pageRef).getSub(frameRef); … … 219 262 SwingUtilities.invokeAndWait(new Runnable() { 220 263 221 264 public void run() { 222 new AutoAction( "Changing page border", true) {265 new AutoAction(Message.create(PAGE_BORDER), true) { 223 266 224 267 @Override 225 268 public void performAuto() { … … 237 280 SwingUtilities.invokeAndWait(new Runnable() { 238 281 239 282 public void run() { 240 new AutoAction( "Changing frame border", true) {283 new AutoAction(Message.create(FRAME_BORDER), true) { 241 284 242 285 @Override 243 286 public void performAuto() { … … 265 308 final ImmList<ActivationChannel> children = 266 309 CompositeElement.KEY_SUB_ELEMENTS.get(pageAccess); 267 310 268 new AutoAction( "Create test frame.", true) {311 new AutoAction(Message.create(CREATE_FRAME), true) { 269 312 @Override 270 313 public void performAuto() { 271 314 FrameH.create(getChanger(), frameRef, FrameR4.DEFAULT_TITLE, … … 293 336 final ImmImage image = new ImmImage(imgFile, false); 294 337 final String imageName = imgFile.getName(); 295 338 296 new AutoAction( "Create test image frame.", true) {339 new AutoAction(Message.create(CREATE_IMAGE_FRAME), true) { 297 340 @Override 298 341 public void performAuto() { 299 342 ImageResourceH.create(getChanger(), imageRef, image, imageName);