Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadCommandSystem
Commits
079bff09
Commit
079bff09
authored
Mar 23, 2015
by
helene ortiz
Browse files
bug fixed: range property condition for dynamic properties
parent
a081dcad
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/fr/ill/ics/core/property/PropertyFactory.java
View file @
079bff09
...
...
@@ -186,7 +186,7 @@ public class PropertyFactory {
property
.
addCondition
(
new
RangePropertyCondition
(
conditionDescriptor
.
getMin
(),
conditionDescriptor
.
getMax
()));
}
else
if
(
conditionDescriptor
.
getType
().
equals
(
PropertyParser
.
TAG_PROPERTY_RANGE
))
{
property
.
addCondition
(
new
RangePropertyDependentCondition
(
property
,
conditionDescriptor
.
getMinProperty
(),
conditionDescriptor
.
getMaxProperty
(),
conditionDescriptor
.
getMinPropertyExcluded
(),
conditionDescriptor
.
getMaxPropertyExcluded
()));
property
.
addCondition
(
new
RangePropertyDependentCondition
(
property
,
conditionDescriptor
,
propertyDescriptor
.
isDynamic
()));
}
else
if
(
conditionDescriptor
.
getType
().
equals
(
PropertyParser
.
TAG_SPECIFIC_VALUES
))
{
property
.
addCondition
(
new
SpecificValuesPropertyCondition
(
property
,
conditionDescriptor
.
getValues
()));
...
...
src/fr/ill/ics/core/property/condition/RangePropertyDependentCondition.java
View file @
079bff09
...
...
@@ -20,6 +20,7 @@ package fr.ill.ics.core.property.condition;
import
fr.ill.ics.core.property.Property
;
import
fr.ill.ics.core.property.PropertyManager
;
import
fr.ill.ics.core.property.parser.descriptor.ConditionDescriptor
;
import
fr.ill.ics.nscclient.dataprovider.PropertyDatabase
;
import
fr.ill.ics.util.ConfigManager
;
...
...
@@ -35,20 +36,28 @@ public class RangePropertyDependentCondition implements IPropertyCondition {
private
boolean
minPropertyExcluded
;
private
boolean
maxPropertyExcluded
;
private
boolean
isDynamic
;
// concerns main property (the one stored in "property" attribute)
public
RangePropertyDependentCondition
(
Property
property
,
String
minPropertyName
,
String
maxPropertyName
,
boolean
minPropertyExcluded
,
boolean
maxPropertyExcluded
)
{
public
RangePropertyDependentCondition
(
Property
property
,
ConditionDescriptor
conditionDescriptor
,
boolean
isDynamic
)
{
this
.
property
=
property
;
this
.
minPropertyName
=
minPropertyName
;
this
.
maxPropertyName
=
maxPropertyName
;
this
.
minPropertyExcluded
=
minPropertyExcluded
;
this
.
maxPropertyExcluded
=
maxPropertyExcluded
;
this
.
minPropertyName
=
conditionDescriptor
.
getMinProperty
();
this
.
maxPropertyName
=
conditionDescriptor
.
getMaxProperty
();
this
.
minPropertyExcluded
=
conditionDescriptor
.
getMinPropertyExcluded
();
this
.
maxPropertyExcluded
=
conditionDescriptor
.
getMaxPropertyExcluded
();
this
.
isDynamic
=
isDynamic
;
}
public
boolean
isOk
(
String
valueToBeTested
)
{
try
{
if
(
minProperty
==
null
&&
maxProperty
==
null
)
{
int
servantId
=
PropertyDatabase
.
getInstance
().
getServantIdForProperty
(
property
.
getPropertyID
());
int
servantId
=
-
1
;
if
(
isDynamic
)
{
servantId
=
PropertyDatabase
.
getInstance
().
getServantIdForDynamicProperty
(
property
.
getPropertyID
());
}
else
{
servantId
=
PropertyDatabase
.
getInstance
().
getServantIdForProperty
(
property
.
getPropertyID
());
}
if
(
servantId
!=
-
1
)
{
int
minPropertyId
=
PropertyDatabase
.
getInstance
().
getPropertyIdForServant
(
servantId
,
minPropertyName
);
...
...
src/fr/ill/ics/core/property/parser/descriptor/XMLDynamicPropertyDescriptor.java
View file @
079bff09
...
...
@@ -51,6 +51,10 @@ public class XMLDynamicPropertyDescriptor extends XMLPropertyDescriptor {
return
sizePropertyName
;
}
public
boolean
isDynamic
()
{
return
true
;
}
public
String
toString
()
{
return
"DynamicPropertyDescriptor "
+
propertyName
;
}
...
...
src/fr/ill/ics/core/property/parser/descriptor/XMLPropertyDescriptor.java
View file @
079bff09
...
...
@@ -132,4 +132,8 @@ public class XMLPropertyDescriptor {
public
String
getDecimaFormatPropertyName
()
{
return
decimalFormatPropertyName
;
}
public
boolean
isDynamic
()
{
return
false
;
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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