当前位置: 首页>>代码示例>>Java>>正文


Java BidiUtils.reorderVisually方法代码示例

本文整理汇总了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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:TextLayoutStrategy.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:41,代码来源:TextLayoutStrategy.java


注:本文中的sun.font.BidiUtils.reorderVisually方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。