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. |
String |
getHtml()
Get the inner html of the element, taking the inner span wrap into
consideration, if needed.
|
String |
getText()
Get the inner text of the element, taking the inner span wrap into
consideration, if needed.
|
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 |
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(String content)
Sets the element's content to the given value (html).
|
void |
setHtml(String content,
HasDirection.Direction dir)
Sets the element's content to the given value (html), applying the given
direction.
|
void |
setText(String content)
Sets the element's content to the given value (plain text).
|
void |
setText(String content,
HasDirection.Direction dir)
Sets the element's content to the given value (plain text), applying the
given direction.
|
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 getText()
public String getHtml()
public 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(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(String content)
setHtml(String, Direction)
.content
- the element's new contentpublic void setTextOrHtml(String content, boolean isHtml)
setText
or setHtml
instead of
this method.content
- the element's new contentisHtml
- whether the content is HTMLpublic void setText(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(String content, HasDirection.Direction dir)
Implementation details:
BidiFormatter
for more
details.
content
- the element's new contentdir
- the content's directionpublic void setTextOrHtml(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 HTMLCopyright © 2016. All rights reserved.