Package com._1c.g5.v8.dt.ui.util
Class Labeler
java.lang.Object
com._1c.g5.v8.dt.ui.util.Labeler
Support class to build UI-representable labels for metadata objects or metadata object features. Supports:
- Basic object label building, such as
Catalog
. - Path object label building, such as
Catalogs.Catalog1.Forms.Form1
.Labeler
is aware of current DT IDE locale and produce nodes with appropriate language.
Path will be constructed in the terms of 1C:Enterprise Navigator, including Navigator container nodes, such
as Catalogs
or Forms
. Clients can filter
unnecessary nodes and
elements or define stop elements and conditions.
Example of usage:
String pathLabel = Labeler.path(form, '.').skipCommonNode().stopBefore(IProject.class) .stopBefore(Configuration.class).label(); // pathLabel will be like "Catalogs.Catalog1.Forms.Form1" String basicLabel = Labeler.label(form); // basicLabel will be like "Form1"Instances of of
Labeler
are stateful and not safe for use by multiple threads.-
Method Summary
Modifier and TypeMethodDescriptionFilter building label path elements with the given predicate.label()
Build path label.static String
Returns basic label for a given object.static Labeler
Returns label builder for the given object and path separator.static Labeler
Returns label builder for the given object and path separator.Skip 1C:Enterprise Navigator "Common" node.Stop label path bulding after path element will be instance of the given class.Stop label path bulding after path element will be instance of the given class.Stop label path bulding after path element will satisfy the given predicate.stopBefore
(Class<?> stopBefore) Stop label path bulding when path element will be instance of the given class.stopBefore
(Predicate<Object> stopBefore) Stop label path bulding when path element will satisfy the given predicate.
-
Method Details
-
label
Returns basic label for a given object. Supports metadata objects, metadata object features or 1C:Enterprise Navigator nodes.- Parameters:
object
- the object to obtain label for, cannot benull
- Returns:
- obtained label or empty string if object has no label, never
null
-
path
Returns label builder for the given object and path separator. Clients can configure label builder and build label withlabel()
method.Path will be constructed in the terms of 1C:Enterprise Navigator, including Navigator container nodes, such as
Catalogs
orForms
. Clients canfilter
unnecessary nodes and elements or define stop elements and conditions.- Parameters:
object
- the object to obtain path label for, cannot benull
separator
- the path separator to use, cannot benull
- Returns:
- the label builder, never
null
-
path
Returns label builder for the given object and path separator. Clients can configure label builder and build label withlabel()
method.Path will be constructed in the terms of 1C:Enterprise Navigator, including Navigator container nodes, such as
Catalogs
orForms
. Clients canfilter
unnecessary nodes and elements or define stop elements and conditions.- Parameters:
object
- the object to obtain path label for, cannot benull
separator
- the path separator to use, cannot benull
- Returns:
- the label builder, never
null
-
filter
Filter building label path elements with the given predicate. AllLabeler
filter predicates will be combined with "and" operation.- Parameters:
filter
- the filter predicate to filter path elements, cannot benull
- Returns:
- a reference to this label builder, never
null
-
stopBefore
Stop label path bulding when path element will satisfy the given predicate. AllLabeler
stop-before predicates will be combined with "or" operation.- Parameters:
stopBefore
- the predicate to stop bulding path before, cannot benull
- Returns:
- a reference to this label builder, never
null
-
stopBefore
Stop label path bulding when path element will be instance of the given class. AllLabeler
stop-before predicates will be combined with "or" operation.- Parameters:
stopBefore
- the class to stop bulding path before, cannot benull
- Returns:
- a reference to this label builder, never
null
-
stopAfter
Stop label path bulding after path element will satisfy the given predicate. AllLabeler
stop-after predicates will be combined with "or" operation.- Parameters:
stopAfter
- the predicate to stop bulding path after, cannot benull
- Returns:
- a reference to this label builder, never
null
-
stopAfter
Stop label path bulding after path element will be instance of the given class. AllLabeler
stop-after predicates will be combined with "or" operation.- Parameters:
stopAfter
- the class to stop bulding path after, cannot benull
- Returns:
- a reference to this label builder, never
null
-
stopAfter
Stop label path bulding after path element will be instance of the given class. AllLabeler
stop-after predicates will be combined with "or" operation.- Parameters:
stopAfter
- the class to stop bulding path after, cannot benull
fromIndex
- the index of the occurrence of thestopAfter
to use to stop, must be positive- Returns:
- a reference to this label builder, never
null
-
skipCommonNode
Skip 1C:Enterprise Navigator "Common" node.- Returns:
- a reference to this label builder, never
null
-
label
Build path label. Result may be used in UI representation.- Returns:
- the path label as
String
, nevernull
-