Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
NomadCommandSystem
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Instrument Control
NomadCommandSystem
Commits
aee0810d
Commit
aee0810d
authored
Mar 15, 2019
by
ics
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ForLoop synchronisation
parent
f2c67df7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
83 additions
and
4 deletions
+83
-4
src/main/java/fr/ill/ics/bridge/command/CommandWrapper.java
src/main/java/fr/ill/ics/bridge/command/CommandWrapper.java
+7
-0
src/main/java/fr/ill/ics/bridge/command/ForLoopCommandWrapper.java
...java/fr/ill/ics/bridge/command/ForLoopCommandWrapper.java
+1
-1
src/main/java/fr/ill/ics/bridge/command/ICommandBoxSyncEventListener.java
.../ill/ics/bridge/command/ICommandBoxSyncEventListener.java
+2
-0
src/main/java/fr/ill/ics/bridge/listeners/ServerCommandBoxSyncListener.java
...ll/ics/bridge/listeners/ServerCommandBoxSyncListener.java
+2
-0
src/main/java/fr/ill/ics/nscclient/notification/commandzone/sync/CommandZoneSyncEventClient.java
...fication/commandzone/sync/CommandZoneSyncEventClient.java
+18
-3
src/main/java/fr/ill/ics/nscclient/notification/commandzone/sync/CommandZoneSyncEventNotifier.java
...cation/commandzone/sync/CommandZoneSyncEventNotifier.java
+10
-0
src/main/java/fr/ill/ics/nscclient/notification/commandzone/sync/SetForLoopStepType.java
...ent/notification/commandzone/sync/SetForLoopStepType.java
+43
-0
No files found.
src/main/java/fr/ill/ics/bridge/command/CommandWrapper.java
View file @
aee0810d
...
...
@@ -27,6 +27,7 @@ import fr.ill.ics.bridge.listeners.ServerExpressionChangeListener;
import
fr.ill.ics.bridge.listeners.ServerProgressChangeListener
;
import
fr.ill.ics.bridge.listeners.ServerPropertyChangeListener
;
import
fr.ill.ics.bridge.listeners.ServerResetCommandListener
;
import
fr.ill.ics.nscclient.command.CommandZoneAccessor.ForLoopStepType
;
import
fr.ill.ics.nscclient.command.CommandZoneAccessor.ForLoopType
;
import
fr.ill.ics.nscclient.command.ServerCommandBox
;
import
fr.ill.ics.nscclient.notification.commandzone.CommandZoneEventClient
;
...
...
@@ -84,6 +85,7 @@ public abstract class CommandWrapper implements IServerCommand, ICommandBoxEvent
public
void
removeServerCommandBoxSyncListener
(
ServerCommandBoxSyncListener
listener
)
{
this
.
commandBoxSyncListener
=
null
;
CommandZoneEventClient
.
getInstance
().
removeCommandBoxListener
(
this
);
}
public
void
addServerExpressionChangeListener
(
ServerExpressionChangeListener
listener
)
{
...
...
@@ -239,6 +241,11 @@ public abstract class CommandWrapper implements IServerCommand, ICommandBoxEvent
commandBoxSyncListener
.
onSetForLoopType
(
type
,
lineIndex
);
}
@Override
public
void
onSetForLoopStepType
(
ForLoopStepType
type
,
int
lineIndex
)
{
commandBoxSyncListener
.
onSetForLoopStepType
(
type
,
lineIndex
);
}
@Override
public
void
onSetForLoopValues
(
int
lineIndex
,
String
value
)
{
commandBoxSyncListener
.
onSetForLoopValues
(
lineIndex
,
value
);
...
...
src/main/java/fr/ill/ics/bridge/command/ForLoopCommandWrapper.java
View file @
aee0810d
...
...
@@ -123,7 +123,7 @@ public class ForLoopCommandWrapper extends CommandWrapper implements IForLoopEve
return
StepType
.
NBPOINTS
;
}
public
boolean
addForLoopLine
(
int
index
)
{
public
final
boolean
addForLoopLine
(
int
index
)
{
return
serverForLoopCommandBox
.
addForLoopLine
(
index
);
}
...
...
src/main/java/fr/ill/ics/bridge/command/ICommandBoxSyncEventListener.java
View file @
aee0810d
...
...
@@ -18,6 +18,7 @@
package
fr.ill.ics.bridge.command
;
import
fr.ill.ics.nscclient.command.CommandZoneAccessor.ForLoopStepType
;
import
fr.ill.ics.nscclient.command.CommandZoneAccessor.ForLoopType
;
public
interface
ICommandBoxSyncEventListener
{
...
...
@@ -42,4 +43,5 @@ public interface ICommandBoxSyncEventListener {
void
onAddForLoopLine
(
int
lineIndex
);
void
onRemoveForLoopLine
(
int
lineIndex
);
void
onSetForLoopStepType
(
ForLoopStepType
forLoopStepType
,
int
lineIndex
);
}
\ No newline at end of file
src/main/java/fr/ill/ics/bridge/listeners/ServerCommandBoxSyncListener.java
View file @
aee0810d
...
...
@@ -18,6 +18,7 @@
package
fr.ill.ics.bridge.listeners
;
import
fr.ill.ics.nscclient.command.CommandZoneAccessor.ForLoopStepType
;
import
fr.ill.ics.nscclient.command.CommandZoneAccessor.ForLoopType
;
public
interface
ServerCommandBoxSyncListener
{
...
...
@@ -37,4 +38,5 @@ public interface ServerCommandBoxSyncListener {
void
onSetForLoopStepSize
(
int
lineIndex
,
double
value
);
void
onAddForLoopLine
(
int
lineIndex
);
void
onRemoveForLoopLine
(
int
lineIndex
);
void
onSetForLoopStepType
(
ForLoopStepType
type
,
int
lineIndex
);
}
\ No newline at end of file
src/main/java/fr/ill/ics/nscclient/notification/commandzone/sync/CommandZoneSyncEventClient.java
View file @
aee0810d
...
...
@@ -61,7 +61,7 @@ public class CommandZoneSyncEventClient {
}
}
public
void
removeCommand
Zone
Listener
(
ICommandBoxSyncEventListener
listener
)
{
public
void
removeCommand
Box
Listener
(
ICommandBoxSyncEventListener
listener
)
{
synchronized
(
commandBoxListeners
)
{
if
(
commandBoxListeners
.
containsKey
(
listener
.
getCommandBoxID
()))
{
HashSet
<
ICommandBoxSyncEventListener
>
listeners
=
commandBoxListeners
.
get
(
listener
.
getCommandBoxID
());
...
...
@@ -157,6 +157,20 @@ public class CommandZoneSyncEventClient {
}
}
private
void
notifySetForLoopStepType
(
SetForLoopStepType
event
)
{
synchronized
(
commandBoxListeners
)
{
if
(
commandBoxListeners
.
containsKey
(
event
.
getCommandBoxId
()))
{
HashSet
<
ICommandBoxSyncEventListener
>
listeners
=
commandBoxListeners
.
get
(
event
.
getCommandBoxId
());
Iterator
<
ICommandBoxSyncEventListener
>
it
=
listeners
.
iterator
();
while
(
it
.
hasNext
())
{
it
.
next
().
onSetForLoopStepType
(
event
.
getForLoopStepType
(),
event
.
getLineIndex
());
}
}
}
}
private
void
notifySetForLoopValues
(
SetForLoopValues
event
)
{
synchronized
(
commandBoxListeners
)
{
...
...
@@ -338,7 +352,6 @@ public class CommandZoneSyncEventClient {
}
private
void
notifyAddNewForLoopCommandBox
(
AddNewForLoopCommandBox
event
)
{
synchronized
(
commandZoneListeners
)
{
Iterator
<
ICommandZoneSyncEventListener
>
it
=
commandZoneListeners
.
iterator
();
while
(
it
.
hasNext
())
{
...
...
@@ -348,7 +361,6 @@ public class CommandZoneSyncEventClient {
}
private
void
notifyAddNewForLoopCommandBoxAtEnd
(
AddNewForLoopCommandBoxAtEnd
event
)
{
synchronized
(
commandZoneListeners
)
{
Iterator
<
ICommandZoneSyncEventListener
>
it
=
commandZoneListeners
.
iterator
();
while
(
it
.
hasNext
())
{
...
...
@@ -457,6 +469,9 @@ public class CommandZoneSyncEventClient {
else
if
(
event
instanceof
SetForLoopType
)
{
notifySetForLoopType
((
SetForLoopType
)
event
);
}
else
if
(
event
instanceof
SetForLoopStepType
)
{
notifySetForLoopStepType
((
SetForLoopStepType
)
event
);
}
else
if
(
event
instanceof
SetForLoopValues
)
{
notifySetForLoopValues
((
SetForLoopValues
)
event
);
}
...
...
src/main/java/fr/ill/ics/nscclient/notification/commandzone/sync/CommandZoneSyncEventNotifier.java
View file @
aee0810d
...
...
@@ -6,6 +6,7 @@ import fr.ill.ics.nomadserver.commandzone.CommandZoneRequests;
import
fr.ill.ics.nomadserver.common.Common
;
import
fr.ill.ics.nomadserver.notification.NotificationMessage
;
import
fr.ill.ics.nscclient.command.CommandZoneAccessor.ContainerType
;
import
fr.ill.ics.nscclient.command.CommandZoneAccessor.ForLoopStepType
;
import
fr.ill.ics.nscclient.command.CommandZoneAccessor.ForLoopType
;
import
fr.ill.ics.nscclient.sessionmanagement.SessionManager
;
...
...
@@ -296,6 +297,15 @@ public class CommandZoneSyncEventNotifier {
return
new
SetForLoopType
(
request
.
getCommandBoxID
(),
request
.
getLineIndex
(),
(
forLoopType
==
CommandZoneRequests
.
ForLoopType
.
Type
.
VALUES
?
ForLoopType
.
VALUES
:
ForLoopType
.
RANGE
));
}
}
else
if
(
type
==
CommandZoneRequests
.
Message
.
Type
.
SetStepType
)
{
CommandZoneRequests
.
SetForLoopStepTypeRequest
request
=
CommandZoneRequests
.
SetForLoopStepTypeRequest
.
parseFrom
(
message
.
getSerializedContent
());
// Notify only if it is the same client that was the originator of the request.
if
(
request
.
getClientID
()
!=
getClientID
())
{
CommandZoneRequests
.
ForLoopStepType
.
Type
forLoopStepType
=
request
.
getType
();
return
new
SetForLoopStepType
(
request
.
getCommandBoxID
(),
request
.
getLineIndex
(),
(
forLoopStepType
==
CommandZoneRequests
.
ForLoopStepType
.
Type
.
DELTA
?
ForLoopStepType
.
DELTA
:
ForLoopStepType
.
NBPOINTS
));
}
}
else
if
(
type
==
CommandZoneRequests
.
Message
.
Type
.
SetVariableName
)
{
CommandZoneRequests
.
SetForLoopStringValueRequest
request
=
CommandZoneRequests
.
SetForLoopStringValueRequest
.
parseFrom
(
message
.
getSerializedContent
());
...
...
src/main/java/fr/ill/ics/nscclient/notification/commandzone/sync/SetForLoopStepType.java
0 → 100644
View file @
aee0810d
/*
* 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.ForLoopStepType
;
public
class
SetForLoopStepType
extends
CommandBoxSyncEvent
{
private
ForLoopStepType
forLoopStepType
;
private
int
lineIndex
;
public
SetForLoopStepType
(
int
commandBoxId
,
int
lineIndex
,
ForLoopStepType
forLoopStepType
)
{
super
(
commandBoxId
);
this
.
forLoopStepType
=
forLoopStepType
;
this
.
lineIndex
=
lineIndex
;
}
public
ForLoopStepType
getForLoopStepType
()
{
return
forLoopStepType
;
}
public
int
getLineIndex
()
{
return
lineIndex
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment