本文整理汇总了Java中sun.font.BidiUtils.reorderVisually方法的典型用法代码示例。如果您正苦于以下问题:Java BidiUtils.reorderVisually方法的具体用法?Java BidiUtils.reorderVisually怎么用?Java BidiUtils.reorderVisually使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.font.BidiUtils
的用法示例。
在下文中一共展示了BidiUtils.reorderVisually方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: layoutRow
import sun.font.BidiUtils; //导入方法依赖的package包/类
/**
* Creates a row of views that will fit within the
* layout span of the row. This is implemented to execute the
* superclass functionality (which fills the row with child
* views or view fragments) and follow that with bidi reordering
* of the unidirectional view fragments.
*
* @param row the row to fill in with views. This is assumed
* to be empty on entry.
* @param pos The current position in the children of
* this views element from which to start.
* @return the position to start the next row
*/
protected int layoutRow(FlowView fv, int rowIndex, int p0) {
int p1 = super.layoutRow(fv, rowIndex, p0);
View row = fv.getView(rowIndex);
Document doc = fv.getDocument();
Object i18nFlag = doc.getProperty(AbstractDocument.I18NProperty);
if ((i18nFlag != null) && i18nFlag.equals(Boolean.TRUE)) {
int n = row.getViewCount();
if (n > 1) {
AbstractDocument d = (AbstractDocument)fv.getDocument();
Element bidiRoot = d.getBidiRootElement();
byte[] levels = new byte[n];
View[] reorder = new View[n];
for( int i=0; i<n; i++ ) {
View v = row.getView(i);
int bidiIndex =bidiRoot.getElementIndex(v.getStartOffset());
Element bidiElem = bidiRoot.getElement( bidiIndex );
levels[i] = (byte)StyleConstants.getBidiLevel(bidiElem.getAttributes());
reorder[i] = v;
}
BidiUtils.reorderVisually( levels, reorder );
row.replace(0, n, reorder);
}
}
return p1;
}
示例2: layoutRow
import sun.font.BidiUtils; //导入方法依赖的package包/类
/**
* Creates a row of views that will fit within the
* layout span of the row. This is implemented to execute the
* superclass functionality (which fills the row with child
* views or view fragments) and follow that with bidi reordering
* of the unidirectional view fragments.
*
* @param rowIndex the row to fill in with views. This is assumed
* to be empty on entry.
* @param p0 The current position in the children of
* this views element from which to start.
* @return the position to start the next row
*/
protected int layoutRow(FlowView fv, int rowIndex, int p0) {
int p1 = super.layoutRow(fv, rowIndex, p0);
View row = fv.getView(rowIndex);
Document doc = fv.getDocument();
Object i18nFlag = doc.getProperty(AbstractDocument.I18NProperty);
if ((i18nFlag != null) && i18nFlag.equals(Boolean.TRUE)) {
int n = row.getViewCount();
if (n > 1) {
AbstractDocument d = (AbstractDocument)fv.getDocument();
Element bidiRoot = d.getBidiRootElement();
byte[] levels = new byte[n];
View[] reorder = new View[n];
for( int i=0; i<n; i++ ) {
View v = row.getView(i);
int bidiIndex =bidiRoot.getElementIndex(v.getStartOffset());
Element bidiElem = bidiRoot.getElement( bidiIndex );
levels[i] = (byte)StyleConstants.getBidiLevel(bidiElem.getAttributes());
reorder[i] = v;
}
BidiUtils.reorderVisually( levels, reorder );
row.replace(0, n, reorder);
}
}
return p1;
}