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
cb8ebadd
Commit
cb8ebadd
authored
Mar 27, 2015
by
helene ortiz
Browse files
Systematically allocate maximum width for label widgets
parent
079bff09
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/fr/ill/ics/core/property/FloatProperty.java
View file @
cb8ebadd
...
...
@@ -120,4 +120,9 @@ public abstract class FloatProperty extends Property {
public
boolean
acceptsNegativeValue
()
{
return
acceptNegativeValue
;
}
protected
int
getDefaultMaxLength
()
{
return
XMLPropertyDescriptor
.
DEFAULT_NUMERIC_MAX_LENGTH
;
}
}
\ No newline at end of file
src/fr/ill/ics/core/property/IntegerProperty.java
View file @
cb8ebadd
...
...
@@ -24,6 +24,7 @@ import fr.ill.ics.core.property.condition.IPropertyCondition;
import
fr.ill.ics.core.property.condition.PositivePropertyCondition
;
import
fr.ill.ics.core.property.condition.StrictlyPositivePropertyCondition
;
import
fr.ill.ics.core.property.event.VerifyIntegerValueListener
;
import
fr.ill.ics.core.property.parser.descriptor.XMLPropertyDescriptor
;
public
abstract
class
IntegerProperty
extends
Property
{
...
...
@@ -112,4 +113,9 @@ public abstract class IntegerProperty extends Property {
public
boolean
acceptsNegativeValue
()
{
return
acceptNegativeValue
;
}
protected
int
getDefaultMaxLength
()
{
return
XMLPropertyDescriptor
.
DEFAULT_NUMERIC_MAX_LENGTH
;
}
}
\ No newline at end of file
src/fr/ill/ics/core/property/Property.java
View file @
cb8ebadd
...
...
@@ -64,7 +64,7 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
private
boolean
isArray
=
false
;
private
boolean
isCheckable
=
true
;
private
int
maxLength
=
XMLPropertyDescriptor
.
DEFAULT_MAX_LENGTH
;
private
int
maxLength
;
private
boolean
maxLengthOnlyForTextFieldSize
=
false
;
// private long lastPropertyChangedTime;
private
String
errorMessage
;
...
...
@@ -83,6 +83,9 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
this
.
containerId
=
containerId
;
this
.
isCommandBox
=
isCommandBox
;
maxLength
=
getDefaultMaxLength
();
// Set property change listeners initial size to 2
this
.
propertyChangeListeners
=
new
HashSet
<
IPropertyChangeListener
>(
1
);
this
.
propertyErrorListeners
=
new
ArrayList
(
2
);
...
...
@@ -619,8 +622,6 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
this
.
undoState
.
setAutoApply
();
}
public
abstract
boolean
isNumeric
();
public
boolean
isCheckable
()
{
return
isCheckable
;
}
...
...
@@ -680,20 +681,7 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
return
ServantDatabase
.
getInstance
().
getControllerName
(
PropertyDatabase
.
getInstance
().
getServantIdForDynamicProperty
(
id
));
}
public
abstract
String
getType
();
/**
* <p>
* Has to be implemented in the concret Property classe to set the pVerifyListener. Thus, the hasVerifyListener() method will return true.
* </p>
*
* <p>
* Implement nothing if the concret Property class does not need a pVerifyListener. Thus, the hasVerifyListener() method will return false.
* </p>
*
*/
public
abstract
void
setPVerifyListener
();
public
void
removeFromPropertyNotification
()
{
DataNotificationClient
.
getInstance
().
removePropertyChangeListener
(
this
);
}
...
...
@@ -709,5 +697,27 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
public
void
setShowSettingPropertyMessage
(
boolean
showSettingPropertyMessage
)
{
this
.
showSettingPropertyMessage
=
showSettingPropertyMessage
;
}
protected
int
getDefaultMaxLength
()
{
return
XMLPropertyDescriptor
.
DEFAULT_STRING_MAX_LENGTH
;
}
public
abstract
String
getType
();
/**
* <p>
* Has to be implemented in the concret Property classe to set the pVerifyListener. Thus, the hasVerifyListener() method will return true.
* </p>
*
* <p>
* Implement nothing if the concret Property class does not need a pVerifyListener. Thus, the hasVerifyListener() method will return false.
* </p>
*
*/
public
abstract
void
setPVerifyListener
();
public
abstract
boolean
isNumeric
();
}
\ No newline at end of file
src/fr/ill/ics/core/property/PropertyManager.java
View file @
cb8ebadd
...
...
@@ -189,7 +189,7 @@ public class PropertyManager {
LinkedHashMap
<
String
,
XMLPropertyDescriptor
>
propertiesFromFile
=
new
LinkedHashMap
<
String
,
XMLPropertyDescriptor
>(
propertyParser
.
getProperties
().
size
());
propertiesFromFile
.
putAll
(
propertyParser
.
getProperties
());
propertiesByControllerType
.
put
(
propertyParser
.
getControllerType
(),
propertiesFromFile
);
if
(!
propertyParser
.
getDynamicProperties
().
isEmpty
())
{
...
...
src/fr/ill/ics/core/property/format/DecimalFormat.java
View file @
cb8ebadd
...
...
@@ -37,11 +37,23 @@ public class DecimalFormat extends PropertyFormat {
private
int
propertyId
;
private
static
java
.
text
.
DecimalFormat
scientificFormat
=
new
java
.
text
.
DecimalFormat
(
"0.
###E
0"
);
private
static
java
.
text
.
DecimalFormat
scientificFormat
=
new
java
.
text
.
DecimalFormat
(
"0.
000E0
0"
);
private
java
.
text
.
DecimalFormat
df
;
private
static
String
[]
decimalFormats
=
new
String
[]
{
"0"
,
"0.#"
,
private
static
String
[]
decimalFormats
=
new
String
[]
{
"0"
,
"0.0"
,
"0.00"
,
"0.000"
,
"0.0000"
,
"0.00000"
,
"0.000000"
,
"0.0000000"
,
"0.00000000"
,
"0.000000000"
};
/*
"0.#",
"0.##",
"0.###",
"0.####",
...
...
@@ -51,7 +63,8 @@ public class DecimalFormat extends PropertyFormat {
"0.########",
"0.#########"};
*/
public
DecimalFormat
(
int
numberOfDecimalPlaces
,
boolean
isScientific
)
{
this
.
nbOfDecimalPlaces
=
numberOfDecimalPlaces
;
this
.
isScientific
=
isScientific
;
...
...
src/fr/ill/ics/core/property/parser/descriptor/XMLPropertyDescriptor.java
View file @
cb8ebadd
...
...
@@ -26,12 +26,13 @@ import fr.ill.ics.core.property.parser.PropertyParser;
public
class
XMLPropertyDescriptor
{
public
static
final
int
DEFAULT_MAX_LENGTH
=
15
;
public
static
final
int
DEFAULT_STRING_MAX_LENGTH
=
15
;
public
static
final
int
DEFAULT_NUMERIC_MAX_LENGTH
=
10
;
public
static
final
int
DEFAULT_NB_PLACES
=
2
;
protected
String
propertyName
;
protected
String
propertyType
;
private
int
maxLength
=
DEFAULT_MAX_LENGTH
;
private
int
maxLength
=
DEFAULT_
STRING_
MAX_LENGTH
;
private
boolean
isUndoable
=
false
;
private
String
format
=
PropertyParser
.
TAG_NO_FORMAT
;
private
int
nbDecimalPlaces
=
DEFAULT_NB_PLACES
;
...
...
@@ -63,6 +64,17 @@ public class XMLPropertyDescriptor {
this
.
propertyType
.
toLowerCase
().
equals
(
"unknown"
)
||
this
.
propertyType
.
toLowerCase
().
equals
(
"longarray"
)))
{
System
.
err
.
println
(
"Warning: unknown property type "
+
type
+
" for property "
+
name
);
}
else
{
if
(
this
.
propertyType
.
toLowerCase
().
equals
(
"double"
)
||
this
.
propertyType
.
toLowerCase
().
equals
(
"float32"
)
||
this
.
propertyType
.
toLowerCase
().
equals
(
"float64"
)
||
this
.
propertyType
.
toLowerCase
().
equals
(
"int8"
)
||
this
.
propertyType
.
toLowerCase
().
equals
(
"int16"
)
||
this
.
propertyType
.
toLowerCase
().
equals
(
"int32"
)
||
this
.
propertyType
.
toLowerCase
().
equals
(
"int64"
)
||
this
.
propertyType
.
toLowerCase
().
equals
(
"long"
))
{
maxLength
=
DEFAULT_NUMERIC_MAX_LENGTH
;
}
}
}
...
...
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