Moving shared notification events for tiles into common.
This commit is contained in:
+3
-3
@@ -63,7 +63,6 @@ public class TiledPanelMediator extends Mediator<TiledPanel> {
|
||||
return new String[]{
|
||||
MsgAPI.SCENE_LOADED,
|
||||
TiledPlugin.TILE_ADDED,
|
||||
TiledPlugin.IMAGE_BUNDLE_DROP_SINGLE,
|
||||
TiledPlugin.TILE_SELECTED,
|
||||
TiledPlugin.ACTION_DELETE_TILE,
|
||||
TiledPlugin.ACTION_SET_GRID_SIZE_FROM_LIST,
|
||||
@@ -72,6 +71,7 @@ public class TiledPanelMediator extends Mediator<TiledPanel> {
|
||||
TiledPlugin.GRID_CHANGED,
|
||||
SettingsTab.OK_BTN_CLICKED,
|
||||
TiledPlugin.ACTION_SET_GRID_SIZE_FROM_ITEM,
|
||||
MsgAPI.IMAGE_BUNDLE_DROP_SINGLE,
|
||||
MsgAPI.ACTION_DELETE_IMAGE_RESOURCE,
|
||||
MsgAPI.TOOL_SELECTED,
|
||||
MsgAPI.ACTION_KEY_DOWN
|
||||
@@ -111,7 +111,7 @@ public class TiledPanelMediator extends Mediator<TiledPanel> {
|
||||
if (type == EntityFactory.IMAGE_TYPE) {
|
||||
// ensure that all selected images are dropped
|
||||
// the respective listener is responsible for dropping one-by-one, since he tracks the selected ones
|
||||
tiledPlugin.facade.sendNotification(TiledPlugin.IMAGE_BUNDLE_DROP, new Object[]{tileName, type});
|
||||
tiledPlugin.facade.sendNotification(MsgAPI.IMAGE_BUNDLE_DROP, new Object[]{tileName, type});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -120,7 +120,7 @@ public class TiledPanelMediator extends Mediator<TiledPanel> {
|
||||
viewComponent.setEngine(engine);
|
||||
viewComponent.setFixedPosition();
|
||||
break;
|
||||
case TiledPlugin.IMAGE_BUNDLE_DROP_SINGLE:
|
||||
case MsgAPI.IMAGE_BUNDLE_DROP_SINGLE:
|
||||
// aliasing the drop from the main project
|
||||
case TiledPlugin.TILE_ADDED:
|
||||
Object[] payload = notification.getBody();
|
||||
|
||||
@@ -67,9 +67,6 @@ public class TiledPlugin extends H2DPluginAdapter {
|
||||
public static final String TILE_GRID_OFFSET_ADDED = CLASS_NAME + ".TILE_GRID_OFFSET_ADDED";
|
||||
public static final String ACTION_SET_GRID_SIZE_FROM_ITEM = CLASS_NAME + ".ACTION_SET_GRID_SIZE_FROM_ITEM";
|
||||
public static final String ACTION_SET_GRID_SIZE_FROM_LIST = CLASS_NAME + ".ACTION_SET_GRID_SIZE_FROM_LIST";
|
||||
// notification from the main project
|
||||
public static final String IMAGE_BUNDLE_DROP_SINGLE = "games.rednblack.editor.view.ui.box.UIResourcesBoxMediator.IMAGE_BUNDLE_DROP_SINGLE";
|
||||
public static final String IMAGE_BUNDLE_DROP = "games.rednblack.editor.view.ui.box.UIResourcesBoxMediator.IMAGE_BUNDLE_DROP";
|
||||
//-------end--------//
|
||||
|
||||
public static final String TILE_TAG = "TILE";
|
||||
|
||||
@@ -15,6 +15,7 @@ import games.rednblack.editor.HyperLap2DFacade;
|
||||
import games.rednblack.editor.view.ui.box.UIResourcesBoxMediator;
|
||||
import games.rednblack.editor.view.ui.box.resourcespanel.UIImagesTab;
|
||||
import games.rednblack.editor.view.ui.box.resourcespanel.draggable.box.ImageResource;
|
||||
import games.rednblack.h2d.common.MsgAPI;
|
||||
|
||||
/**
|
||||
* This mediator is part of the behavior that allows multiple images to be selected and dropped to other panels (like the GridTilesTab from the tiles plugin).
|
||||
@@ -47,7 +48,7 @@ public class ImageResourceSelectionUIMediator extends Mediator<ImageResource> {
|
||||
public String[] listNotificationInterests() {
|
||||
return new String[]{
|
||||
UIResourcesBoxMediator.IMAGE_LEFT_CLICK,
|
||||
UIResourcesBoxMediator.IMAGE_BUNDLE_DROP,
|
||||
MsgAPI.IMAGE_BUNDLE_DROP,
|
||||
UIResourcesBoxMediator.IMAGE_TABLE_UPDATED
|
||||
};
|
||||
}
|
||||
@@ -76,13 +77,13 @@ public class ImageResourceSelectionUIMediator extends Mediator<ImageResource> {
|
||||
|
||||
imageResourcePreviousClick = imageResource;
|
||||
break;
|
||||
case UIResourcesBoxMediator.IMAGE_BUNDLE_DROP:
|
||||
case MsgAPI.IMAGE_BUNDLE_DROP:
|
||||
Set<String> nameSet = new HashSet<>(imageResourceSelectedSet);
|
||||
// remove the dropped one, so that it is not added twice
|
||||
Object[] payloadBody = notification.getBody();
|
||||
nameSet.remove(payloadBody[0]);
|
||||
for (String name : nameSet) {
|
||||
HyperLap2DFacade.getInstance().sendNotification(UIResourcesBoxMediator.IMAGE_BUNDLE_DROP_SINGLE, new Object[] {name, payloadBody[1]});
|
||||
HyperLap2DFacade.getInstance().sendNotification(MsgAPI.IMAGE_BUNDLE_DROP_SINGLE, new Object[] {name, payloadBody[1]});
|
||||
}
|
||||
break;
|
||||
case UIResourcesBoxMediator.IMAGE_TABLE_UPDATED:
|
||||
|
||||
@@ -46,9 +46,6 @@ public class UIResourcesBoxMediator extends PanelMediator<UIResourcesBox> {
|
||||
private static final String PREFIX = "games.rednblack.editor.view.ui.box.UIResourcesBoxMediator";
|
||||
|
||||
public static final String IMAGE_LEFT_CLICK = PREFIX + ".IMAGE_LEFT_CLICK";
|
||||
public static final String IMAGE_BUNDLE_DROP = PREFIX + ".IMAGE_BUNDLE_DROP";
|
||||
public static final String IMAGE_BUNDLE_DROP_SINGLE = PREFIX + ".IMAGE_BUNDLE_DROP_SINGLE";
|
||||
|
||||
|
||||
public static final String SHIFT_CTRL_EVENT_TYPE = PREFIX + ".SHIFT_CTRL_EVENT_TYPE";
|
||||
public static final String SHIFT_EVENT_TYPE = PREFIX + ".SHIFT_EVENT_TYPE";
|
||||
|
||||
Reference in New Issue
Block a user