Class StrokeProperty
- java.lang.Object
-
- org.openstreetmap.josm.data.preferences.AbstractProperty<T>
-
- org.openstreetmap.josm.data.preferences.AbstractToStringProperty<BasicStroke>
-
- org.openstreetmap.josm.data.preferences.StrokeProperty
-
public class StrokeProperty extends AbstractToStringProperty<BasicStroke>
A property that stores aBasicStroke
.- Since:
- 10874
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.preferences.AbstractToStringProperty
AbstractToStringProperty.ChildProperty<T>
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
AbstractProperty.InvalidPreferenceValueException, AbstractProperty.ValueChangeEvent<T>, AbstractProperty.ValueChangeListener<T>
-
-
Field Summary
-
Fields inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
defaultValue, key, preferences
-
-
Constructor Summary
Constructors Constructor Description StrokeProperty(String key, BasicStroke defaultStroke)
Create a new stroke property from a stroke object.StrokeProperty(String key, String defaultValue)
Create a new stroke property from a string.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BasicStroke
fromString(String string)
Converts the string to an object of the given type.static BasicStroke
getFromString(String code)
Return s new BasicStroke object with given thickness and styleprivate static float[]
toDashArray(List<Double> dashes)
protected String
toString(BasicStroke t)
Converts the string to an object of the given type.-
Methods inherited from class org.openstreetmap.josm.data.preferences.AbstractToStringProperty
get, getAsString, getChildProperty, getSpecialized, put
-
Methods inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
addListener, addListenerImpl, addWeakListener, cached, equals, getDefaultValue, getKey, getPreferences, hashCode, isSet, remove, removeListener, removeListenerImpl, storeDefaultValue
-
-
-
-
Constructor Detail
-
StrokeProperty
public StrokeProperty(String key, String defaultValue)
Create a new stroke property from a string.- Parameters:
key
- The key to usedefaultValue
- The default stroke as string
-
StrokeProperty
public StrokeProperty(String key, BasicStroke defaultStroke)
Create a new stroke property from a stroke object.- Parameters:
key
- The keydefaultStroke
- The default stroke.
-
-
Method Detail
-
fromString
protected BasicStroke fromString(String string)
Description copied from class:AbstractToStringProperty
Converts the string to an object of the given type.- Specified by:
fromString
in classAbstractToStringProperty<BasicStroke>
- Parameters:
string
- The string- Returns:
- The object.
-
toString
protected String toString(BasicStroke t)
Description copied from class:AbstractToStringProperty
Converts the string to an object of the given type.- Specified by:
toString
in classAbstractToStringProperty<BasicStroke>
- Parameters:
t
- The object.- Returns:
- The string representing the object
-
getFromString
public static BasicStroke getFromString(String code)
Return s new BasicStroke object with given thickness and style- Parameters:
code
- = 3.5 -> thickness=3.5px; 3.5 10 5 -> thickness=3.5px, dashed: 10px filled + 5px empty- Returns:
- stroke for drawing
-
toDashArray
private static float[] toDashArray(List<Double> dashes)
-
-