Class Roles.Role
- java.lang.Object
-
- org.openstreetmap.josm.gui.tagging.presets.items.Roles.Role
-
- Enclosing class:
- Roles
public static class Roles.Role extends Object
Therole
element in tagging preset definition. Information on a certain role, which is expected for the relation members.
-
-
Field Summary
Fields Modifier and Type Field Description private short
count
How often must the element appearString
key
Role name used in a relationString
locale_text
The localized version oftext
.SearchCompiler.Match
memberExpression
An expression (cf.boolean
regexp
Is the role name a regular expressionboolean
required
Is this role required at least once in the relation?String
text
The text to displayString
text_context
The context used for translatingtext
Set<TaggingPresetType>
types
Presets types expected for this role
-
Constructor Summary
Constructors Constructor Description Role()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addToPanel(JPanel p)
Adds this role to the given panel.long
getValidCount(long c)
Return either argument, the highest possible value or the lowest allowed valueboolean
isRole(String role)
Check if the given role matches this class (required to check regexp role types)void
setCount(String count)
Sets how often must the element appear.void
setMember_expression(String memberExpression)
Sets an expression (cf.void
setRegexp(String str)
Sets whether the role name is a regular expression.void
setRequisite(String str)
Sets whether this role is required at least once in the relation.void
setType(String types)
Sets the presets types expected for this role.String
toString()
-
-
-
Field Detail
-
types
public Set<TaggingPresetType> types
Presets types expected for this role
-
regexp
public boolean regexp
Is the role name a regular expression
-
text_context
public String text_context
The context used for translatingtext
-
locale_text
public String locale_text
The localized version oftext
.
-
memberExpression
public SearchCompiler.Match memberExpression
An expression (cf. search dialog) for objects of this role
-
required
public boolean required
Is this role required at least once in the relation?
-
count
private short count
How often must the element appear
-
-
Constructor Detail
-
Role
public Role()
-
-
Method Detail
-
setType
public void setType(String types) throws SAXException
Sets the presets types expected for this role.- Parameters:
types
- comma-separated set of expected types- Throws:
SAXException
- if an unknown type is detected
-
setRequisite
public void setRequisite(String str) throws SAXException
Sets whether this role is required at least once in the relation.- Parameters:
str
- "required" or "optional"- Throws:
SAXException
- if str is neither "required" or "optional"
-
setRegexp
public void setRegexp(String str) throws SAXException
Sets whether the role name is a regular expression.- Parameters:
str
- "true" or "false"- Throws:
SAXException
- if str is neither "true" or "false"
-
setMember_expression
public void setMember_expression(String memberExpression) throws SAXException
Sets an expression (cf. search dialog) for objects of this role- Parameters:
memberExpression
- an expression (cf. search dialog) for objects of this role- Throws:
SAXException
- in case of parsing error
-
setCount
public void setCount(String count)
Sets how often must the element appear.- Parameters:
count
- how often must the element appear
-
getValidCount
public long getValidCount(long c)
Return either argument, the highest possible value or the lowest allowed value- Parameters:
c
- count- Returns:
- the highest possible value or the lowest allowed value
- See Also:
required
-
isRole
public boolean isRole(String role)
Check if the given role matches this class (required to check regexp role types)- Parameters:
role
- role to check- Returns:
true
if role matches- Since:
- 11989
-
addToPanel
public boolean addToPanel(JPanel p)
Adds this role to the given panel.- Parameters:
p
- panel where to add this role- Returns:
true
-
-