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
cb01e7db
Commit
cb01e7db
authored
Mar 27, 2015
by
Cristina Cocho
Browse files
Solved problem related to properties with zero value decimals (ie. 2.0 vs 2)
parent
cb8ebadd
Changes
13
Hide whitespace changes
Inline
Side-by-side
src/fr/ill/ics/core/property/Float32Property.java
View file @
cb01e7db
...
...
@@ -30,9 +30,9 @@ public class Float32Property extends FloatProperty {
public
String
getServerValue
()
{
if
(
isCommandBox
)
{
return
this
.
propertyFormat
.
format
(
new
Float
(
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
getFloat32Value
(
containerId
,
id
)).
toString
());
return
this
.
propertyFormat
.
format
ForDisplay
(
new
Float
(
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
getFloat32Value
(
containerId
,
id
)).
toString
());
}
else
{
return
this
.
propertyFormat
.
format
(
new
Float
(
DataAccessor
.
getInstance
(
serverId
).
getFloat32Value
(
containerId
,
id
)).
toString
());
return
this
.
propertyFormat
.
format
ForDisplay
(
new
Float
(
DataAccessor
.
getInstance
(
serverId
).
getFloat32Value
(
containerId
,
id
)).
toString
());
}
}
...
...
src/fr/ill/ics/core/property/Float64Property.java
View file @
cb01e7db
...
...
@@ -30,9 +30,9 @@ public class Float64Property extends FloatProperty {
public
String
getServerValue
()
{
if
(
isCommandBox
)
{
return
this
.
propertyFormat
.
format
(
new
Double
(
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
getFloat64Value
(
containerId
,
id
)).
toString
());
return
this
.
propertyFormat
.
format
ForDisplay
(
new
Double
(
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
getFloat64Value
(
containerId
,
id
)).
toString
());
}
else
{
return
this
.
propertyFormat
.
format
(
new
Double
(
DataAccessor
.
getInstance
(
serverId
).
getFloat64Value
(
containerId
,
id
)).
toString
());
return
this
.
propertyFormat
.
format
ForDisplay
(
new
Double
(
DataAccessor
.
getInstance
(
serverId
).
getFloat64Value
(
containerId
,
id
)).
toString
());
}
}
...
...
src/fr/ill/ics/core/property/Int16Property.java
View file @
cb01e7db
...
...
@@ -30,9 +30,9 @@ public class Int16Property extends IntegerProperty {
public
String
getServerValue
()
{
if
(
isCommandBox
)
{
return
this
.
propertyFormat
.
format
(
new
Short
(
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
getInt16Value
(
containerId
,
id
)).
toString
());
return
this
.
propertyFormat
.
format
ForDisplay
(
new
Short
(
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
getInt16Value
(
containerId
,
id
)).
toString
());
}
else
{
return
this
.
propertyFormat
.
format
(
new
Short
(
DataAccessor
.
getInstance
(
serverId
).
getInt16Value
(
containerId
,
id
)).
toString
());
return
this
.
propertyFormat
.
format
ForDisplay
(
new
Short
(
DataAccessor
.
getInstance
(
serverId
).
getInt16Value
(
containerId
,
id
)).
toString
());
}
}
...
...
src/fr/ill/ics/core/property/Int32Property.java
View file @
cb01e7db
...
...
@@ -30,9 +30,9 @@ public class Int32Property extends IntegerProperty {
public
String
getServerValue
()
{
if
(
isCommandBox
)
{
return
this
.
propertyFormat
.
format
(
new
Integer
(
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
getInt32Value
(
containerId
,
id
)).
toString
());
return
this
.
propertyFormat
.
format
ForDisplay
(
new
Integer
(
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
getInt32Value
(
containerId
,
id
)).
toString
());
}
else
{
return
this
.
propertyFormat
.
format
(
new
Integer
(
DataAccessor
.
getInstance
(
serverId
).
getInt32Value
(
containerId
,
id
)).
toString
());
return
this
.
propertyFormat
.
format
ForDisplay
(
new
Integer
(
DataAccessor
.
getInstance
(
serverId
).
getInt32Value
(
containerId
,
id
)).
toString
());
}
}
...
...
src/fr/ill/ics/core/property/Int64Property.java
View file @
cb01e7db
...
...
@@ -30,9 +30,9 @@ public class Int64Property extends IntegerProperty {
public
String
getServerValue
()
{
if
(
isCommandBox
)
{
return
this
.
propertyFormat
.
format
(
new
Long
(
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
getInt64Value
(
containerId
,
id
)).
toString
());
return
this
.
propertyFormat
.
format
ForDisplay
(
new
Long
(
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
getInt64Value
(
containerId
,
id
)).
toString
());
}
else
{
return
this
.
propertyFormat
.
format
(
new
Long
(
DataAccessor
.
getInstance
(
serverId
).
getInt64Value
(
containerId
,
id
)).
toString
());
return
this
.
propertyFormat
.
format
ForDisplay
(
new
Long
(
DataAccessor
.
getInstance
(
serverId
).
getInt64Value
(
containerId
,
id
)).
toString
());
}
}
...
...
src/fr/ill/ics/core/property/Int8Property.java
View file @
cb01e7db
...
...
@@ -29,9 +29,9 @@ public class Int8Property extends IntegerProperty {
public
String
getServerValue
()
{
if
(
isCommandBox
)
{
return
this
.
propertyFormat
.
format
(
new
Long
(
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
getInt8Value
(
containerId
,
id
)).
toString
());
return
this
.
propertyFormat
.
format
ForDisplay
(
new
Long
(
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
getInt8Value
(
containerId
,
id
)).
toString
());
}
else
{
return
this
.
propertyFormat
.
format
(
new
Long
(
DataAccessor
.
getInstance
(
serverId
).
getInt8Value
(
containerId
,
id
)).
toString
());
return
this
.
propertyFormat
.
format
ForDisplay
(
new
Long
(
DataAccessor
.
getInstance
(
serverId
).
getInt8Value
(
containerId
,
id
)).
toString
());
}
}
...
...
src/fr/ill/ics/core/property/StringProperty.java
View file @
cb01e7db
...
...
@@ -29,9 +29,9 @@ public class StringProperty extends Property {
public
String
getServerValue
()
{
if
(
isCommandBox
)
{
return
this
.
propertyFormat
.
format
(
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
getStringValue
(
containerId
,
id
));
return
this
.
propertyFormat
.
format
ForDisplay
(
AtomicCommandBoxAccessorProxy
.
getInstance
(
serverId
).
getStringValue
(
containerId
,
id
));
}
else
{
return
this
.
propertyFormat
.
format
(
DataAccessor
.
getInstance
(
serverId
).
getStringValue
(
containerId
,
id
));
return
this
.
propertyFormat
.
format
ForDisplay
(
DataAccessor
.
getInstance
(
serverId
).
getStringValue
(
containerId
,
id
));
}
}
...
...
src/fr/ill/ics/core/property/format/DecimalFormat.java
View file @
cb01e7db
...
...
@@ -40,7 +40,7 @@ public class DecimalFormat extends PropertyFormat {
private
static
java
.
text
.
DecimalFormat
scientificFormat
=
new
java
.
text
.
DecimalFormat
(
"0.000E00"
);
private
java
.
text
.
DecimalFormat
df
;
private
static
String
[]
decimalFormats
=
new
String
[]
{
private
static
String
[]
decimal
Display
Formats
=
new
String
[]
{
"0"
,
"0.0"
,
"0.00"
,
...
...
@@ -52,18 +52,6 @@ public class DecimalFormat extends PropertyFormat {
"0.00000000"
,
"0.000000000"
};
/*
"0.#",
"0.##",
"0.###",
"0.####",
"0.#####",
"0.######",
"0.#######",
"0.########",
"0.#########"};
*/
public
DecimalFormat
(
int
numberOfDecimalPlaces
,
boolean
isScientific
)
{
this
.
nbOfDecimalPlaces
=
numberOfDecimalPlaces
;
...
...
@@ -77,8 +65,18 @@ public class DecimalFormat extends PropertyFormat {
this
.
isScientific
=
isScientific
;
}
public
DecimalFormat
()
{
}
public
String
format
(
String
value
)
{
// Remove unnecessary zeros
df
=
new
java
.
text
.
DecimalFormat
(
"0.###########################"
);
return
df
.
format
(
Double
.
valueOf
(
value
));
}
public
String
formatForDisplay
(
String
value
)
{
if
(
nbOfDecimalPlaces
==
-
1
)
{
// First format, get number of decimals from dedicated property
...
...
@@ -120,7 +118,7 @@ public class DecimalFormat extends PropertyFormat {
// absolute value is less than MINIMUM (0.01) or more than MAXIMUM (999) values
df
=
scientificFormat
;
}
else
{
df
=
new
java
.
text
.
DecimalFormat
(
decimalFormats
[
nbOfDecimalPlaces
]);
df
=
new
java
.
text
.
DecimalFormat
(
decimal
Display
Formats
[
nbOfDecimalPlaces
]);
}
...
...
src/fr/ill/ics/core/property/format/HexadecimalFormat.java
View file @
cb01e7db
...
...
@@ -22,7 +22,7 @@ import java.math.BigInteger;
public
class
HexadecimalFormat
extends
PropertyFormat
{
public
String
format
(
String
value
)
{
public
String
format
ForDisplay
(
String
value
)
{
return
Integer
.
toHexString
(
new
Integer
(
value
).
intValue
());
}
...
...
src/fr/ill/ics/core/property/format/NoFormat.java
View file @
cb01e7db
...
...
@@ -20,7 +20,7 @@ package fr.ill.ics.core.property.format;
public
class
NoFormat
extends
PropertyFormat
{
public
String
format
(
String
value
)
{
public
String
format
ForDisplay
(
String
value
)
{
return
value
;
}
...
...
src/fr/ill/ics/core/property/format/PropertyFormat.java
View file @
cb01e7db
...
...
@@ -27,7 +27,7 @@ public abstract class PropertyFormat {
protected
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
PropertyFormat
.
class
.
getName
());
public
abstract
String
format
(
String
value
);
public
abstract
String
format
ForDisplay
(
String
value
);
public
abstract
String
unformat
(
String
value
);
...
...
src/fr/ill/ics/core/property/format/UnitFormat.java
View file @
cb01e7db
...
...
@@ -46,7 +46,7 @@ public class UnitFormat extends PropertyFormat {
}
public
String
format
(
String
value
)
{
public
String
format
ForDisplay
(
String
value
)
{
if
(
formattedUnits
==
null
)
{
init
();
}
...
...
src/fr/ill/ics/core/property/undo/UndoableState.java
View file @
cb01e7db
...
...
@@ -46,7 +46,7 @@ public class UndoableState extends UndoState {
// forcing to add last value
undoableValues
.
addLast
(
property
.
getServerValue
());
}
return
property
.
getPropertyFormat
().
format
((
String
)
undoableValues
.
getLast
());
return
property
.
getPropertyFormat
().
format
ForDisplay
((
String
)
undoableValues
.
getLast
());
}
/**
...
...
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