Class StrokeProperty
- java.lang.Object
-
- org.openstreetmap.josm.data.preferences.AbstractProperty<T>
-
- org.openstreetmap.josm.data.preferences.AbstractToStringProperty<java.awt.BasicStroke>
-
- org.openstreetmap.josm.data.preferences.StrokeProperty
-
public class StrokeProperty extends AbstractToStringProperty<java.awt.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(java.lang.String key, java.awt.BasicStroke defaultStroke)Create a new stroke property from a stroke object.StrokeProperty(java.lang.String key, java.lang.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 java.awt.BasicStrokefromString(java.lang.String string)Converts the string to an object of the given type.static java.awt.BasicStrokegetFromString(java.lang.String code)Return s new BasicStroke object with given thickness and styleprivate static float[]toDashArray(java.util.List<java.lang.Double> dashes)protected java.lang.StringtoString(java.awt.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(java.lang.String key, java.lang.String defaultValue)
Create a new stroke property from a string.- Parameters:
key- The key to usedefaultValue- The default stroke as string
-
StrokeProperty
public StrokeProperty(java.lang.String key, java.awt.BasicStroke defaultStroke)
Create a new stroke property from a stroke object.- Parameters:
key- The keydefaultStroke- The default stroke.
-
-
Method Detail
-
fromString
protected java.awt.BasicStroke fromString(java.lang.String string)
Description copied from class:AbstractToStringPropertyConverts the string to an object of the given type.- Specified by:
fromStringin classAbstractToStringProperty<java.awt.BasicStroke>- Parameters:
string- The string- Returns:
- The object.
-
toString
protected java.lang.String toString(java.awt.BasicStroke t)
Description copied from class:AbstractToStringPropertyConverts the string to an object of the given type.- Specified by:
toStringin classAbstractToStringProperty<java.awt.BasicStroke>- Parameters:
t- The object.- Returns:
- The string representing the object
-
getFromString
public static java.awt.BasicStroke getFromString(java.lang.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(java.util.List<java.lang.Double> dashes)
-
-