Commit 24ac9269 authored by legoc's avatar legoc

Added command zone sync messages for command box management

parent 78acbdb7
......@@ -81,7 +81,7 @@ public abstract class CommandWrapper implements IServerCommand, ICommandBoxEvent
this.resetCommandListener = null;
}
public void removeServerCommandBoxSyncListener() {
public void removeServerCommandBoxSyncListener(ServerCommandBoxSyncListener listener) {
this.commandBoxSyncListener = null;
}
......@@ -208,4 +208,24 @@ public abstract class CommandWrapper implements IServerCommand, ICommandBoxEvent
commandBoxSyncListener.onToggleBackground();
}
@Override
public void onSetSettingsFileName(String fileName) {
commandBoxSyncListener.onSetSettingsFileName(fileName);
}
@Override
public void onSetControllerName(String value) {
commandBoxSyncListener.onSetControllerName(value);
}
@Override
public void onSetPropertyName(String value) {
commandBoxSyncListener.onSetPropertyName(value);
}
@Override
public void onSetValue(String value) {
commandBoxSyncListener.onSetValue(value);
}
}
\ No newline at end of file
......@@ -26,15 +26,17 @@ import fr.ill.ics.bridge.events.ServerCommandStateChangeEvent.CommandState;
import fr.ill.ics.bridge.events.ServerResetCommandEvent;
import fr.ill.ics.bridge.listeners.ServerCommandStateChangeListener;
import fr.ill.ics.bridge.listeners.ServerCommandZoneErrorListener;
import fr.ill.ics.bridge.listeners.ServerCommandZoneSyncListener;
import fr.ill.ics.bridge.listeners.ServerProgressChangeListener;
import fr.ill.ics.bridge.listeners.ServerResetCommandListener;
import fr.ill.ics.nscclient.command.CommandZoneAccessor;
import fr.ill.ics.nscclient.command.CommandZoneAccessor.ContainerType;
import fr.ill.ics.nscclient.command.ServerCommandZone;
import fr.ill.ics.nscclient.dataprovider.CommandDatabase;
import fr.ill.ics.nscclient.dataprovider.ServantDatabase;
import fr.ill.ics.nscclient.notification.commandzone.CommandZoneEventClient;
public class CommandZoneWrapper implements ICommandZoneEventListener {
public class CommandZoneWrapper implements ICommandZoneEventListener, ICommandZoneSyncEventListener {
public final static String SERVER_ID = "real";
public final static String EDITOR_ID = "editor";
......@@ -49,7 +51,7 @@ public class CommandZoneWrapper implements ICommandZoneEventListener {
private ServerProgressChangeListener commandProgressListener;
private ServerResetCommandListener resetCommandListener;
private ServerCommandZoneErrorListener commandZoneErrorListener;
private ServerCommandZoneSyncListener commandZoneSyncListener;
// private static Map<Integer, CommandZoneWrapper> commandZoneWrappers = new HashMap<Integer, CommandZoneWrapper>();
......@@ -104,6 +106,10 @@ public class CommandZoneWrapper implements ICommandZoneEventListener {
public void addServerCommandZoneErrorListener(ServerCommandZoneErrorListener listener) {
this.commandZoneErrorListener = listener;
}
public void addServerCommandZoneSyncListener(ServerCommandZoneSyncListener listener) {
this.commandZoneSyncListener = listener;
}
public void removeServerProgressChangeListener(ServerProgressChangeListener listener) {
this.commandProgressListener = null;
......@@ -121,6 +127,10 @@ public class CommandZoneWrapper implements ICommandZoneEventListener {
public void removeServerCommandZoneErrorListener(ServerCommandZoneErrorListener listener) {
this.commandZoneErrorListener = null;
}
public void removeServerCommandZoneSyncListener(ServerCommandZoneSyncListener listener) {
this.commandZoneSyncListener = null;
}
public void commandZoneStarted() {
if (commandStateListener != null) {
......@@ -294,4 +304,69 @@ public class CommandZoneWrapper implements ICommandZoneEventListener {
return serverCommandZone.print();
}
@Override
public void onAddNewAtomicCommandBoxAtEnd(ContainerType type, int commandBoxId, int commandId, boolean isSettings, int newCommandBoxId) {
commandZoneSyncListener.onAddNewAtomicCommandBoxAtEnd(type, commandBoxId, commandId, isSettings, newCommandBoxId);
}
@Override
public void onAddNewAtomicCommandBox(ContainerType type, int commandBoxId, int commandId, boolean isSettings, int commandBoxIdToMove, boolean above, int newCommandBoxId) {
commandZoneSyncListener.onAddNewAtomicCommandBox(type, commandBoxId, commandId, isSettings, commandBoxIdToMove, above, newCommandBoxId);
}
@Override
public void onAddNewControlCommandBoxAtEnd(ContainerType type, int commandBoxId, int boxType, int newCommandBoxId) {
commandZoneSyncListener.onAddNewControlCommandBoxAtEnd(type, commandBoxId, boxType, newCommandBoxId);
}
@Override
public void onAddNewControlCommandBox(ContainerType type, int commandBoxId, int boxType, int commandBoxIdToMove, boolean above, int newCommandBoxId) {
commandZoneSyncListener.onAddNewControlCommandBox(type, commandBoxId, boxType, commandBoxIdToMove, above, newCommandBoxId);
}
@Override
public void onAddNewForLoopCommandBoxAtEnd(ContainerType type, int commandBoxId, String variableName, int newCommandBoxId) {
commandZoneSyncListener.onAddNewForLoopCommandBoxAtEnd(type, commandBoxId, variableName, newCommandBoxId);
}
@Override
public void onAddNewForLoopCommandBox(ContainerType type, int commandBoxId, String variableName, int commandBoxIdToMove, boolean above, int newCommandBoxId) {
commandZoneSyncListener.onAddNewForLoopCommandBox(type, commandBoxId, variableName, commandBoxIdToMove, above, newCommandBoxId);
}
@Override
public void onAddNewGenericCommandBoxAtEnd(ContainerType type, int commandBoxId, int boxType, int newCommandBoxId) {
commandZoneSyncListener.onAddNewGenericCommandBoxAtEnd(type, commandBoxId, boxType, newCommandBoxId);
}
@Override
public void onAddNewGenericCommandBox(ContainerType type, int commandBoxId, int boxType, int commandBoxIdToMove, boolean above, int newCommandBoxId) {
commandZoneSyncListener.onAddNewGenericCommandBox(type, commandBoxId, boxType, commandBoxIdToMove, above, newCommandBoxId);
}
@Override
public void onAddNewScanCommandBox(ContainerType type, int commandBoxId, String scanName, int commandBoxIdToMove, boolean above, int newCommandBoxId) {
commandZoneSyncListener.onAddNewScanCommandBox(type, commandBoxId, scanName, commandBoxIdToMove, above, newCommandBoxId);
}
@Override
public void onAddNewScanCommandBoxAtEnd(ContainerType type, int commandBoxId, String scanName, int newCommandBoxId) {
commandZoneSyncListener.onAddNewScanCommandBoxAtEnd(type, commandBoxId, scanName, newCommandBoxId);
}
@Override
public void onMoveCommandBox(ContainerType type, int commandBoxId, int commandBoxIdToMove, int commandBoxIdToShift, boolean above) {
commandZoneSyncListener.onMoveCommandBox(type, commandBoxId, commandBoxIdToMove, commandBoxIdToShift, above);
}
@Override
public void onMoveCommandBoxToEnd(ContainerType type, int commandBoxId, int commandBoxIdToMove) {
commandZoneSyncListener.onMoveCommandBoxToEnd(type, commandBoxId, commandBoxIdToMove);
}
@Override
public void deleteCommandBox(ContainerType type, int commandBoxId, int commandBoxIdToMove) {
commandZoneSyncListener.deleteCommandBox(type, commandBoxId, commandBoxIdToMove);
}
}
\ No newline at end of file
......@@ -23,5 +23,9 @@ public interface ICommandBoxSyncEventListener {
int getCommandBoxID();
void onToggleParallel();
void onToggleBackground();
void onSetSettingsFileName(String fileName);
void onSetControllerName(String value);
void onSetPropertyName(String value);
void onSetValue(String value);
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.bridge.command;
import fr.ill.ics.nscclient.command.CommandZoneAccessor.ContainerType;
public interface ICommandZoneSyncEventListener {
public void onAddNewAtomicCommandBoxAtEnd(ContainerType type, int commandBoxId, int commandId, boolean isSettings, int newCommandBoxId);
public void onAddNewAtomicCommandBox(ContainerType type, int commandBoxId, int commandId, boolean isSettings, int commandBoxIdToMove, boolean above, int newCommandBoxId);
public void onAddNewControlCommandBoxAtEnd(ContainerType type, int commandBoxId, int boxType, int newCommandBoxId);
public void onAddNewControlCommandBox(ContainerType type, int commandBoxId, int boxType, int commandBoxIdToMove, boolean above, int newCommandBoxId);
public void onAddNewForLoopCommandBoxAtEnd(ContainerType type, int commandBoxId, String variableName, int newCommandBoxId);
public void onAddNewForLoopCommandBox(ContainerType type, int commandBoxId, String variableName, int commandBoxIdToMove, boolean above, int newCommandBoxId);
public void onAddNewGenericCommandBoxAtEnd(ContainerType type, int commandBoxId, int boxType, int newCommandBoxId);
public void onAddNewGenericCommandBox(ContainerType type, int commandBoxId, int boxType, int commandBoxIdToMove, boolean above, int newCommandBoxId);
public void onAddNewScanCommandBox(ContainerType type, int commandBoxId, String scanName, int commandBoxIdToMove, boolean above, int newCommandBoxId);
public void onAddNewScanCommandBoxAtEnd(ContainerType type, int commandBoxId, String scanName, int newCommandBoxId);
public void onMoveCommandBox(ContainerType type, int commandBoxId, int commandBoxIdToMove, int commandBoxIdToShift, boolean above);
public void onMoveCommandBoxToEnd(ContainerType type, int commandBoxId, int commandBoxIdToMove);
public void deleteCommandBox(ContainerType type, int commandBoxId, int commandBoxIdToMove);
}
\ No newline at end of file
......@@ -22,4 +22,8 @@ public interface ServerCommandBoxSyncListener {
void onToggleParallel();
void onToggleBackground();
void onSetSettingsFileName(String fileName);
void onSetControllerName(String value);
void onSetPropertyName(String value);
void onSetValue(String value);
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.bridge.listeners;
import fr.ill.ics.nscclient.command.CommandZoneAccessor.ContainerType;
public interface ServerCommandZoneSyncListener {
public void onAddNewAtomicCommandBoxAtEnd(ContainerType type, int commandBoxId, int commandId, boolean isSettings, int newCommandBoxId);
public void onAddNewAtomicCommandBox(ContainerType type, int commandBoxId, int commandId, boolean isSettings, int commandBoxIdToMove, boolean above, int newCommandBoxId);
public void onAddNewControlCommandBoxAtEnd(ContainerType type, int commandBoxId, int boxType, int newCommandBoxId);
public void onAddNewControlCommandBox(ContainerType type, int commandBoxId, int boxType, int commandBoxIdToMove, boolean above, int newCommandBoxId);
public void onAddNewForLoopCommandBoxAtEnd(ContainerType type, int commandBoxId, String variableName, int newCommandBoxId);
public void onAddNewForLoopCommandBox(ContainerType type, int commandBoxId, String variableName, int commandBoxIdToMove, boolean above, int newCommandBoxId);
public void onAddNewGenericCommandBoxAtEnd(ContainerType type, int commandBoxId, int boxType, int newCommandBoxId);
public void onAddNewGenericCommandBox(ContainerType type, int commandBoxId, int boxType, int commandBoxIdToMove, boolean above, int newCommandBoxId);
public void onAddNewScanCommandBox(ContainerType type, int commandBoxId, String scanName, int commandBoxIdToMove, boolean above, int newCommandBoxId);
public void onAddNewScanCommandBoxAtEnd(ContainerType type, int commandBoxId, String scanName, int newCommandBoxId);
public void onMoveCommandBox(ContainerType type, int commandBoxId, int commandBoxIdToMove, int commandBoxIdToShift, boolean above);
public void onMoveCommandBoxToEnd(ContainerType type, int commandBoxId, int commandBoxIdToMove);
public void deleteCommandBox(ContainerType type, int commandBoxId, int commandBoxIdToMove);
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.nscclient.notification.commandzone.sync;
import fr.ill.ics.nscclient.command.CommandZoneAccessor.ContainerType;
public class AddNewAtomicCommandBox extends CommandZoneSyncEvent {
private int commandId;
private boolean isSettings;
private int commandBoxIdToMove;
private boolean above;
private int newCommandBoxId;
public AddNewAtomicCommandBox(ContainerType type, int commandBoxId, int commandId, boolean isSettings, int commandBoxIdToMove, boolean above, int newCommandBoxId) {
super(type, commandBoxId);
this.commandId = commandId;
this.isSettings = isSettings;
this.commandBoxIdToMove = commandBoxIdToMove;
this.above = above;
this.newCommandBoxId = newCommandBoxId;
}
public int getCommandId() {
return commandId;
}
public boolean isSettings() {
return isSettings;
}
public int getCommandBoxIdToMove() {
return commandBoxIdToMove;
}
public boolean isAbove() {
return above;
}
public int getNewCommandBoxId() {
return newCommandBoxId;
}
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.nscclient.notification.commandzone.sync;
import fr.ill.ics.nscclient.command.CommandZoneAccessor.ContainerType;
public class AddNewAtomicCommandBoxAtEnd extends CommandZoneSyncEvent {
private int commandId;
private boolean isSettings;
private int newCommandBoxId;
public AddNewAtomicCommandBoxAtEnd(ContainerType type, int commandBoxId, int commandId, boolean isSettings, int newCommandBoxId) {
super(type, commandBoxId);
this.commandId = commandId;
this.isSettings = isSettings;
this.newCommandBoxId = newCommandBoxId;
}
public int getCommandId() {
return commandId;
}
public boolean isSettings() {
return isSettings;
}
public int getNewCommandBoxId() {
return newCommandBoxId;
}
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.nscclient.notification.commandzone.sync;
import fr.ill.ics.nscclient.command.CommandZoneAccessor.ContainerType;
public class AddNewControlCommandBox extends CommandZoneSyncEvent {
private int boxType;
private int commandBoxIdToMove;
private boolean above;
private int newCommandBoxId;
public AddNewControlCommandBox(ContainerType type, int commandBoxId, int boxType, int commandBoxIdToMove, boolean above, int newCommandBoxId) {
super(type, commandBoxId);
this.boxType = boxType;
this.commandBoxIdToMove = commandBoxIdToMove;
this.above = above;
this.newCommandBoxId = newCommandBoxId;
}
public int getBoxType() {
return boxType;
}
public int getCommandBoxIdToMove() {
return commandBoxIdToMove;
}
public boolean isAbove() {
return above;
}
public int getNewCommandBoxId() {
return newCommandBoxId;
}
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.nscclient.notification.commandzone.sync;
import fr.ill.ics.nscclient.command.CommandZoneAccessor.ContainerType;
public class AddNewControlCommandBoxAtEnd extends CommandZoneSyncEvent {
private int boxType;
private int newCommandBoxId;
public AddNewControlCommandBoxAtEnd(ContainerType type, int commandBoxId, int boxType, int newCommandBoxId) {
super(type, commandBoxId);
this.boxType = boxType;
this.newCommandBoxId = newCommandBoxId;
}
public int getBoxType() {
return boxType;
}
public int getNewCommandBoxId() {
return newCommandBoxId;
}
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.nscclient.notification.commandzone.sync;
import fr.ill.ics.nscclient.command.CommandZoneAccessor.ContainerType;
public class AddNewForLoopCommandBox extends CommandZoneSyncEvent {
private String variableName;
private int commandBoxIdToMove;
private boolean above;
private int newCommandBoxId;
public AddNewForLoopCommandBox(ContainerType type, int commandBoxId, String variableName, int commandBoxIdToMove, boolean above, int newCommandBoxId) {
super(type, commandBoxId);
this.variableName = variableName;
this.commandBoxIdToMove = commandBoxIdToMove;
this.above = above;
this.newCommandBoxId = newCommandBoxId;
}
public String getVariableName() {
return variableName;
}
public int getCommandBoxIdToMove() {
return commandBoxIdToMove;
}
public boolean isAbove() {
return above;
}
public int getNewCommandBoxId() {
return newCommandBoxId;
}
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.nscclient.notification.commandzone.sync;
import fr.ill.ics.nscclient.command.CommandZoneAccessor.ContainerType;
public class AddNewForLoopCommandBoxAtEnd extends CommandZoneSyncEvent {
private String variableName;
private int newCommandBoxId;
public AddNewForLoopCommandBoxAtEnd(ContainerType type, int commandBoxId, String variableName, int newCommandBoxId) {
super(type, commandBoxId);
this.variableName = variableName;
this.newCommandBoxId = newCommandBoxId;
}
public String getVariableName() {
return variableName;
}
public int getNewCommandBoxId() {
return newCommandBoxId;
}
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/