Commit 1cf4b590 authored by Nico Mack's avatar Nico Mack

Added VariableValue property to VariableBasedCallback

Adds VariableBased Coronas as Listeners of ValueWidget
parent 0ce9998f
......@@ -127,6 +127,7 @@ public class VariableBasedCallback implements BootstrapCallback {
context.setProperty(Templating.VARIABLE_NAME_PROPERTY, variable.getName());
context.setProperty(Templating.VARIABLE_DISPLAY_NAME_PROPERTY, variable.getDisplayName());
context.setProperty(Templating.VARIABLE_UNIT_PROPERTY, variable.getUnit());
context.setProperty(Templating.VARIABLE_VALUE_PROPERTY, variable.getValue());
if (variable instanceof NumericalVariable) {
NumericalVariable numerical = (NumericalVariable) variable;
......
......@@ -36,6 +36,7 @@ public class VariableBootstrapper {
String name = BootstrappingUtils.getContentAsString(variableNode, EquationSystemBundle.NAME_ATTRIBUTE, BootstrappingUtils.MANDATORY, null, context);
String type = BootstrappingUtils.getContentAsString(variableNode, EquationSystemBundle.TYPE_NODE, BootstrappingUtils.MANDATORY, null, context);
switch (type) {
case EquationSystemBundle.NUMERIC_TYPE:
String unit = BootstrappingUtils.getContentAsString(variableNode, EquationSystemBundle.UNIT_ATTRIBUTE, BootstrappingUtils.OPTIONAL, EquationSystemBundle.EMPTY_STRING, context);
......
......@@ -174,8 +174,8 @@ public class EquationSystemBuilder {
variableClass = properties.getProperty(EquationSystemBundle.LOGIC_VARIABLE_CLASS);
variable = (Variable<T>) Class.forName(variableClass)
.getConstructor(String.class, String.class, boolean.class)
.newInstance(name, unit, false);
.getConstructor(String.class, boolean.class)
.newInstance(name, false);
if (!Strings.isNullOrEmpty(value))
variable.setValue(variable.valueFromString(value));
......@@ -326,9 +326,9 @@ public class EquationSystemBuilder {
// ---------------------------------------------------------------------------
/**
* Checks whether the specified equation creates a dependency cycle. Dependency cycles occur
* when two equations are mutually dependent, i.e. equation 1 has an input parameter being the
* result of equation 2 and vice versa.
* Checks whether the specified equation creates a dependency cycle. Dependency cycles occur when
* two equations are mutually dependent, i.e. equation 1 has an input parameter being the result of
* equation 2 and vice versa.
*
* @param equation
* specifies the XML node representing the equation
......@@ -360,8 +360,8 @@ public class EquationSystemBuilder {
// ---------------------------------------------------------------------------
/**
* Checks whether all defined output variables are connected to a corresponding equation to get
* the values from.
* Checks whether all defined output variables are connected to a corresponding equation to get the
* values from.
*
* @return <code>true</code> if all output variables are assigned to an equation.
*/
......@@ -677,8 +677,8 @@ public class EquationSystemBuilder {
* @param equationFile
* The file containing the XML representation of the equation system.
* @throws EquationSystemException
* Thrown when the file is <code>null</code>, does not exist, or if a required tag to
* parse the file correctly is missing.
* Thrown when the file is <code>null</code>, does not exist, or if a required tag to parse
* the file correctly is missing.
*/
// ---------------------------------------------------------------------------
......@@ -706,11 +706,10 @@ public class EquationSystemBuilder {
* Method used to build an equation system from a provided element.
*
* @param element
* The element holding, as child elements, the required data to build the equation
* system.
* The element holding, as child elements, the required data to build the equation system.
* @throws EquationSystemException
* Thrown when an error in the equation system specification prevented the equation
* system from being built.
* Thrown when an error in the equation system specification prevented the equation system
* from being built.
*/
// ---------------------------------------------------------------------------
......
......@@ -35,6 +35,7 @@ IMPORTS_ELEMENT=imports
IMPORT_ELEMENT=import
FUNCTION_ATTRIBUTE=function
FROM_ATTRIBUTE=from
SCOPE_ATTRIBUTE=scope
SYSTEM_ELEMENT=system
UNIT_ATTRIBUTE=unit
TYPE_NODE=type
\ No newline at end of file
......@@ -146,8 +146,8 @@ public abstract class Variable<V> implements Cloneable {
/**
* Simple getter method for the value held by the {@link Variable} instance. Reading the value
* will reset the modified flag.
* Simple getter method for the value held by the {@link Variable} instance. Reading the value will
* reset the modified flag.
*
* @return The value held by the {@link Variable} instance.
*/
......@@ -159,8 +159,7 @@ public abstract class Variable<V> implements Cloneable {
/**
* checks whether this variable was modified since it was read for the last time. *
*
* @return <code>true</code> if variable was modified since last read, <code>false</code>
* otherwise.
* @return <code>true</code> if variable was modified since last read, <code>false</code> otherwise.
*/
public boolean wasModified() {
......@@ -312,8 +311,8 @@ public abstract class Variable<V> implements Cloneable {
/**
* Method invoked to add a {@link InputChangeListener} to the {@link Vector} of listeners to
* notify on tick.
* Method invoked to add a {@link InputChangeListener} to the {@link Vector} of listeners to notify
* on tick.
*
* @param listener
* The {@link InputChangeListener} to add.
......@@ -325,12 +324,12 @@ public abstract class Variable<V> implements Cloneable {
}
/**
* Sets the suspendNotification flag for InputChangeListeners. When suspend,
* InputChangeListeners will not be notified on value changes.
* Sets the suspendNotification flag for InputChangeListeners. When suspend, InputChangeListeners
* will not be notified on value changes.
*
* @param suspend
* specify <code>true</true> to suspend listener notification, <code>false</code> to
* enable notification of InputChangeListerners on value change.
* specify <code>true</true> to suspend listener notification, <code>false</code> to enable
* notification of InputChangeListerners on value change.
* @see #consolidateListeners
*/
public synchronized void suspendListenerNotification(boolean suspend) {
......@@ -346,12 +345,12 @@ public abstract class Variable<V> implements Cloneable {
}
/**
* Causes this variable to add its InputChangeListeners to the specified HashMap. HashMap
* ensures that no duplicate listeners will be added to consolidated list.
* Causes this variable to add its InputChangeListeners to the specified HashMap. HashMap ensures
* that no duplicate listeners will be added to consolidated list.
*
* @param consolidated
* specifies the HashMap to add this variables' listeners to. Note that key-value pair
* with identical listener key will be replaced by entry inserted by this call.
* specifies the HashMap to add this variables' listeners to. Note that key-value pair with
* identical listener key will be replaced by entry inserted by this call.
* @return specified HashMap enriched by this variables' listeners.
*/
......@@ -363,8 +362,8 @@ public abstract class Variable<V> implements Cloneable {
}
/**
* Invokes inputChanged method of each registered InputChangeListener unless consolidated flag
* is raised
* Invokes inputChanged method of each registered InputChangeListener unless consolidated flag is
* raised
*
* @param event
* specifies the event to be passed to each listeners inputChanged method.
......
......@@ -366,6 +366,12 @@ public class ValueWidget extends TetherableWidget implements InformationProvider
}
}
List<VariableBased> displays = this.getCoronas(VariableBased.class);
for (VariableBased display : displays) {
connected.addAll(display.connectWithSystemVariables(systemVariables));
}
return connected;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment