public class DirectionalTextHelper extends java.lang.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() |
java.lang.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(java.lang.String content,
boolean isHtml)
Sets the element's content to the given value (either plain text or HTML).
|
void |
setTextOrHtml(java.lang.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()
HasDirectionEstimatorDirectionEstimator object.getDirectionEstimator in interface HasDirectionEstimatorpublic HasDirection.Direction getTextDirection()
public java.lang.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 HasDirectionEstimatorenabled - Whether to enable direction estimation. If true,
sets the DirectionEstimator object to a default
DirectionEstimator.public void setDirectionEstimator(DirectionEstimator directionEstimator)
setDirectionEstimator in interface HasDirectionEstimatordirectionEstimator - The DirectionEstimator to be set. null means turning off direction estimation.public void setTextOrHtml(java.lang.String content,
boolean isHtml)
setTextOrHtml(String, Direction, boolean).content - the element's new contentisHtml - whether the content is HTMLpublic void setTextOrHtml(java.lang.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 HTML