|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.actf.model.locate.AbstractNodeLocator
public abstract class AbstractNodeLocator
default base class for element locators. Clients should extend this class rather than attempting to
implement INodeLocator
directly.
Field Summary | |
---|---|
static String |
CONTAINSSUBSTR_SEARCH
|
protected String |
defaultIdPropName
|
static String |
EXACTMATCH_SEARCH
|
static String |
IGNORECASE_SEARCH
|
protected IModel |
model
|
static String |
NODELOCATOR_VARIABLE
|
static String |
NODENAME_CHARCLASS
|
static String |
NODENAME_KEY
|
static String |
PREDICATEVAL_CHARCLASS
|
protected Map |
propertiesMap
|
static String |
REGEXP_SEARCH
|
protected static org.apache.commons.jxpath.ri.JXPathContextReferenceImpl |
ROOT_JXPATH_CONTEXT
|
static Pattern |
SEGMENT_PATTERN
|
Constructor Summary | |
---|---|
AbstractNodeLocator(String defaultIdProperty,
String modelName,
org.apache.commons.jxpath.ri.model.NodePointerFactory factory)
create a new node locator |
Method Summary | |
---|---|
protected void |
addNodePointerFactory(org.apache.commons.jxpath.ri.model.NodePointerFactory factory)
|
Properties |
describe(Object element)
identify or distinguish the given element in the hierarchy. |
static String |
descriptionAsString(Properties properties)
utility method for converting the set of properties returned by describe to a string. |
Object |
find(String path,
Object startNode)
finds an object in a model given the specified path. |
Object[] |
findAll(String path,
Object startNode)
finds all objects in a model that match the specified path. |
protected String |
getDefaultIdPropertyName()
return the property used by default for discovering the id string of a component. |
protected IModel |
getModel()
|
String |
getNodeId(org.apache.commons.jxpath.ExpressionContext context)
used by the JXPath evaluator to find the node ID of the context node by querying the underlying model. |
protected Object |
invokeGetter(Object element,
String propName)
invoke the getter with the specified method name on the given element. |
String |
locate(Object element,
Object root)
locate a component within a model from the given root. |
boolean |
matches(org.apache.commons.jxpath.ExpressionContext context,
String property,
String input,
String searchType)
used by the JXPath evaluator to perform various comparisons during a find operation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String NODENAME_KEY
public static final String NODELOCATOR_VARIABLE
public static final String EXACTMATCH_SEARCH
public static final String IGNORECASE_SEARCH
public static final String CONTAINSSUBSTR_SEARCH
public static final String REGEXP_SEARCH
public static final String NODENAME_CHARCLASS
public static final String PREDICATEVAL_CHARCLASS
public static final Pattern SEGMENT_PATTERN
protected static final org.apache.commons.jxpath.ri.JXPathContextReferenceImpl ROOT_JXPATH_CONTEXT
protected String defaultIdPropName
protected IModel model
protected Map propertiesMap
Constructor Detail |
---|
public AbstractNodeLocator(String defaultIdProperty, String modelName, org.apache.commons.jxpath.ri.model.NodePointerFactory factory)
defaultIdProperty
- - name of property to serve as default identification of nodemodelName
- - name of model for which this locator is being registeredfactory
- Method Detail |
---|
protected IModel getModel()
public String getNodeId(org.apache.commons.jxpath.ExpressionContext context)
$<NODELOCATOR_VARIABLE>
, which
can be used to invoke this method.
context
- supplied by the JXPath runtime
public boolean matches(org.apache.commons.jxpath.ExpressionContext context, String property, String input, String searchType)
$<NODELOCATOR_VARIABLE>
, which
can be used to invoke this method.
context
- supplied by the JXPath runtimeproperty
- property whose value is to be testedinput
- against which property value is to be testedsearchType
- one of EXACTMATCH_SEARCH
, IGNORECASE_SEARCH
, CONTAINSSUBSTR_SEARCH
, REGEXP_SEARCH
true
if the given input matches the value of the property for the given
node according to the search type, false
otherwisepublic Properties describe(Object element)
IConfiguration.MODEL_LOCATORIDS_POOL
symbol pool of a given model type. The returned Properties
object contains the names of these properties as keys and their values.
If no getter was defined for the type of the given element, this implementation then uses the property name
returned by getDefaultIdPropertyName
.
Note: If the model associated
with this locator is an instance of IRenderableModel
, this locator will invoke
this getter on the UI thread.
describe
in interface INodeLocator
element
- element to be identified
IRenderableModel
public static String descriptionAsString(Properties properties)
describe
to a string. The
returned string will have the form:
key1=val1,key2=val2,...
properties
- as returned by describe
describe(Object)
protected Object invokeGetter(Object element, String propName)
IRenderableModel
, the getter will
be invoked on the UI thread.
element
- methName
-
protected void addNodePointerFactory(org.apache.commons.jxpath.ri.model.NodePointerFactory factory)
protected String getDefaultIdPropertyName()
public String locate(Object element, Object root)
describey
to provide a
richer description of the component.
locate
in interface INodeLocator
element
- element within a graph to be locatedroot
- - root from which element is to be located or null
if
element is to be found from a start node in the graph
public Object find(String path, Object startNode)
locate
is just such a path.
If a startNode is specified, the path is assumed to have that startNode
as its context node. If the startNode is null
, the model's start nodes
will be used as supplying potential context nodes for the path.
The parameters for searching for a node can be defined in
the Configuration.MODEL_ID
symbol pool using the public symbolic constants of this interface.
find
in interface INodeLocator
path
- - path to desired node in the modelstartNode
- - context for the path (may be null
)
null
if no object in the model
matches the given pathpublic Object[] findAll(String path, Object startNode)
locate
is just such a path.
If a startNode is specified, the path is assumed to have that startNode
as its context node. If the startNode is null
, the model's start nodes
will be used as supplying potential context nodes for the path.
The parameters for searching for a node can be defined in
the Configuration.MODEL_ID
symbol pool using the public symbolic constants of this interface.
findAll
in interface INodeLocator
path
- - path to desired nodes in the modelstartNode
- - context for the path (may be null
)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |