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. |
java.lang.String |
getHtml()
Get the inner html of the element, taking the inner span wrap into
consideration, if needed.
|
java.lang.String |
getText()
Get the inner text of the element, taking the inner span wrap into
consideration, if needed.
|
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 |
setHtml(SafeHtml content)
Sets the element's content to the given value (html).
|
void |
setHtml(SafeHtml content,
HasDirection.Direction dir)
Sets the element's content to the given value (html), applying the given
direction.
|
void |
setHtml(java.lang.String content)
Sets the element's content to the given value (html).
|
void |
setHtml(java.lang.String content,
HasDirection.Direction dir)
Sets the element's content to the given value (html), applying the given
direction.
|
void |
setText(java.lang.String content)
Sets the element's content to the given value (plain text).
|
void |
setText(java.lang.String content,
HasDirection.Direction dir)
Sets the element's content to the given value (plain text), applying the
given direction.
|
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()
HasDirectionEstimator
DirectionEstimator
object.getDirectionEstimator
in interface HasDirectionEstimator
public HasDirection.Direction getTextDirection()
public java.lang.String getText()
public java.lang.String getHtml()
public java.lang.String getTextOrHtml(boolean isHtml)
getText()
or getHtml()
instead of this method.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 setText(java.lang.String content)
setText(String, Direction)
.content
- the element's new contentpublic void setHtml(SafeHtml content)
setHtml(String, Direction)
.content
- the element's new contentpublic void setHtml(java.lang.String content)
setHtml(String, Direction)
.content
- the element's new contentpublic void setTextOrHtml(java.lang.String content, boolean isHtml)
setText
or setHtml
instead of
this method.content
- the element's new contentisHtml
- whether the content is HTMLpublic void setText(java.lang.String content, HasDirection.Direction dir)
Implementation details:
BidiFormatter
for more
details.
content
- the element's new contentdir
- the content's directionpublic void setHtml(SafeHtml content, HasDirection.Direction dir)
Implementation details:
BidiFormatter
for more
details.
content
- the element's new contentdir
- the content's directionpublic void setHtml(java.lang.String content, HasDirection.Direction dir)
Implementation details:
BidiFormatter
for more
details.
content
- the element's new contentdir
- the content's directionpublic void setTextOrHtml(java.lang.String content, HasDirection.Direction dir, boolean isHtml)
setText
or
setHtml
instead of this method.content
- the element's new contentdir
- the content's directionisHtml
- whether the content is HTML