public class DirectionalTextHelper extends Object implements HasDirectionEstimator
Modifier and Type | Field and Description |
---|---|
static DirectionEstimator |
DEFAULT_DIRECTION_ESTIMATOR
A default direction estimator instance.
|
Constructor and Description |
---|
DirectionalTextHelper(Element element,
boolean isElementInline) |
Modifier and Type | Method and Description |
---|---|
DirectionEstimator |
getDirectionEstimator()
Returns the
DirectionEstimator object. |
HasDirection.Direction |
getTextDirection() |
String |
getTextOrHtml(boolean isHtml)
Get the inner text or html of the element, taking the inner span wrap into
consideration, if needed.
|
void |
setDirection(HasDirection.Direction direction)
Deprecated.
|
void |
setDirectionEstimator(boolean enabled)
|
void |
setDirectionEstimator(DirectionEstimator directionEstimator)
Note: if the element already has non-empty content, this will update
its direction according to the new estimator's result.
|
void |
setTextOrHtml(String content,
boolean isHtml)
Sets the element's content to the given value (either plain text or HTML).
|
void |
setTextOrHtml(String content,
HasDirection.Direction dir,
boolean isHtml)
Sets the element's content to the given value (either plain text or HTML),
applying the given direction.
|
public static final DirectionEstimator DEFAULT_DIRECTION_ESTIMATOR
public DirectionalTextHelper(Element element, boolean isElementInline)
element
- The widget's element holding text.isElementInline
- Whether the element is an inline element.public DirectionEstimator getDirectionEstimator()
HasDirectionEstimator
DirectionEstimator
object.getDirectionEstimator
in interface HasDirectionEstimator
public HasDirection.Direction getTextDirection()
public String getTextOrHtml(boolean isHtml)
isHtml
- true to get the inner html, false to get the inner text@Deprecated public void setDirection(HasDirection.Direction direction)
public void setDirectionEstimator(boolean enabled)
setDirectionEstimator
in interface HasDirectionEstimator
enabled
- Whether to enable direction estimation. If true
,
sets the DirectionEstimator
object to a default
DirectionEstimator
.public void setDirectionEstimator(DirectionEstimator directionEstimator)
setDirectionEstimator
in interface HasDirectionEstimator
directionEstimator
- The DirectionEstimator
to be set. null
means turning off direction estimation.public void setTextOrHtml(String content, boolean isHtml)
setTextOrHtml(String, Direction, boolean)
.content
- the element's new contentisHtml
- whether the content is HTMLpublic void setTextOrHtml(String content, HasDirection.Direction dir, boolean isHtml)
Implementation details:
BidiFormatter
for more
details.
content
- the element's new contentdir
- the content's directionisHtml
- whether the content is HTMLCopyright © 2018. All rights reserved.