[Component] Define the semantics of propagation for ports, based on causality
During the ticket #2129, it was disabled/enabled the different controls associated to the input value and type.
The exploration of the ticket affected somehow to the propagation of this initial value, taking into account:
- If the containing component is weakly or strongly causal.
- If the port is connected or not.
- In case of connected ports, if the port is a source (output) or a sink (input) port.
- If the selected port is selected inside or outside the contained component.
All these cases are explored in the associated af3 project, with 19 different cases, in which the propagation should be checked.
The general rule is:
- A input port belonging to a weakly causal component should never receive (through propagation) an initial value.
- The forward and backward propagation buttons in
Properties
view should be activated or deactivated, according to the nature of contained component (weakly or strongly causal) and the nature of the connected channel associated component. - It should be defined a semantics regarding inside contained elements (examples 15-19 in attached file).
For exploring this ticket, we should target to the plugin
org.fortiss.af3.component.ui
, and concretely in the method
refresh(Port port)
in the file PortDataPropagation.java
.
An initial primitive implementation of this ticket is as follows:
/**
* Greys out backward/forward depending if the port is seen as a source/target and if there is
* anything to propagate.
*/
public void refresh(Port port) {
boolean isCurrentInputPort;
boolean isCurrentOutputPort;
// Check if the current port is input port.
if(port.getIncomingChannels().isEmpty()) {
isCurrentInputPort = false;
} else {
isCurrentInputPort = true;
}
// Check if the current port is output port.
if(port.getOutgoingChannels().isEmpty()) {
isCurrentOutputPort = false;
} else {
isCurrentOutputPort = true;
}
// If it is not connected through a channel, cannot be propagated.
if(!isCurrentInputPort && !isCurrentOutputPort) {
propagateBackward.setEnabled(false);
propagateForward.setEnabled(false);
return;
}
portsToPropagate = getPortsToPropagate(port, portDataAccess.getPart());
// Explore the source/target port.
for(Pair<Channel, Port> channelPort : portsToPropagate) {
Channel pairChannel = channelPort.getFirst();
Port pairPort = channelPort.getSecond();
boolean test;
// Check if the current port is input or output.
if(seenAsSource(port, portDataAccess.getPart())) {
test = true;
} else {
test = false;
}
}
if(seenAsSource(port, portDataAccess.getPart())) {
propagateBackward.setEnabled(false);
propagateForward.setEnabled(!portsToPropagate.isEmpty());
} else {
propagateBackward.setEnabled(!portsToPropagate.isEmpty());
propagateForward.setEnabled(false);
}
}
This ticket can be labeled as resolved when:
- Buttons
Propagate Backwards
andPropagate Forwards
during Port selection are enabled/disabled based on the causality of the components/connected components. - A consistent semantics allows to specify this enabling/disabling.
- A propagation is performed only when necessary: that means that no weakly causal component port will receive an initial value.
(from redmine: issue id 2341, created on 2015-05-28, closed on 2015-07-28)
- Relations:
- precedes #2129 (closed)
- Uploads:
- Issue2341.af3_23 The file in which all possible combinations needed for this ticket are explored