Class DesignerBindings.DefaultDesignerBindings
- java.lang.Object
-
- net.sourceforge.pmd.util.designerbindings.DesignerBindings.DefaultDesignerBindings
-
- All Implemented Interfaces:
DesignerBindings
- Enclosing interface:
- DesignerBindings
public static class DesignerBindings.DefaultDesignerBindings extends Object implements DesignerBindings
A base implementation forDesignerBindings
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.sourceforge.pmd.util.designerbindings.DesignerBindings
DesignerBindings.AdditionalInfo, DesignerBindings.DefaultDesignerBindings, DesignerBindings.TreeIconId
-
-
Constructor Summary
Constructors Constructor Description DefaultDesignerBindings()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<DesignerBindings.AdditionalInfo>
getAdditionalInfo(Node node)
Returns a collection of "additional information" entries pertaining to the given node.DesignerBindings.TreeIconId
getIcon(Node node)
Returns a constant describing an icon that the node should bear in the treeview and other relevant places.static DesignerBindings.DefaultDesignerBindings
getInstance()
Returns the default instance.Attribute
getMainAttribute(Node node)
Returns the "main" attribute of the given node.RelatedNodesSelector
getRelatedNodesSelector()
Returns an instance ofRelatedNodesSelector
, or null if it should be defaulted to using the old symbol table (ScopedNode
).boolean
isExpandedByDefaultInTree(Node node)
Returns true if the children of this node should be displayed in the treeview by default.
-
-
-
Method Detail
-
getRelatedNodesSelector
public RelatedNodesSelector getRelatedNodesSelector()
Description copied from interface:DesignerBindings
Returns an instance ofRelatedNodesSelector
, or null if it should be defaulted to using the old symbol table (ScopedNode
). That default behaviour is implemented in the designer directly.- Specified by:
getRelatedNodesSelector
in interfaceDesignerBindings
-
getAdditionalInfo
public Collection<DesignerBindings.AdditionalInfo> getAdditionalInfo(Node node)
Description copied from interface:DesignerBindings
Returns a collection of "additional information" entries pertaining to the given node. An entry may look like("Type = List<String>", 0)
, or show the result of an XPath function. The information is shown when the node is displayed.Order of the collection is unimportant, it's sorted using
DesignerBindings.AdditionalInfo.getSortKey()
.- Specified by:
getAdditionalInfo
in interfaceDesignerBindings
-
getMainAttribute
public Attribute getMainAttribute(Node node)
Description copied from interface:DesignerBindings
Returns the "main" attribute of the given node. The string representation of this attribute (Attribute.getStringValue()
) will be displayed next to the node type in the treeview. For example, for a numeric literal, this could return the attribute(@IntValue, 1)
, for a class declaration, it could return the name of the class (eg(@SimpleName, String)
.If there's no obvious "main" attribute, or if the node is not supported, returns null. If the returned attribute is non-null, but its string value is, the return value is ignored.
Note: the attribute doesn't need to originate from
Node.getXPathAttributesIterator()
, it can be constructed ad-hoc. The name of the attribute should be a valid name for the XPath attribute though.This method is meant to break the designer's dependency on
Node.getImage()
.- Specified by:
getMainAttribute
in interfaceDesignerBindings
-
isExpandedByDefaultInTree
public boolean isExpandedByDefaultInTree(Node node)
Description copied from interface:DesignerBindings
Returns true if the children of this node should be displayed in the treeview by default. Returning "true" is the safe default value.- Specified by:
isExpandedByDefaultInTree
in interfaceDesignerBindings
-
getIcon
public DesignerBindings.TreeIconId getIcon(Node node)
Description copied from interface:DesignerBindings
Returns a constant describing an icon that the node should bear in the treeview and other relevant places. Returns null if no icon is applicable.- Specified by:
getIcon
in interfaceDesignerBindings
-
getInstance
public static DesignerBindings.DefaultDesignerBindings getInstance()
Returns the default instance.
-
-