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


Java NavigationFilter.setDot方法代码示例

本文整理汇总了Java中javax.swing.text.NavigationFilter.setDot方法的典型用法代码示例。如果您正苦于以下问题:Java NavigationFilter.setDot方法的具体用法?Java NavigationFilter.setDot怎么用?Java NavigationFilter.setDot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.text.NavigationFilter的用法示例。


在下文中一共展示了NavigationFilter.setDot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setDot

import javax.swing.text.NavigationFilter; //导入方法依赖的package包/类
/**
 * Change dot of the given caret.
 *
 * @param caret non-null caret.
 * @param dotPos new dot position.
 * @return false if passed caret is obsolete or invalid (e.g. a member of another {@link EditorCaret})
 *  or true otherwise.
 */
public boolean setDot(@NonNull CaretInfo caret, @NonNull Position dotPos, @NonNull Position.Bias dotBias) {
    NavigationFilter naviFilter = transaction.getCaret().getNavigationFilterNoDefault(transaction.getOrigin());
    if (naviFilter != null) {
        FilterBypassImpl fbi = new FilterBypassImpl(transaction, caret, transaction.getDocument());
        naviFilter.setDot(fbi, dotPos.getOffset(), Position.Bias.Forward);
        return fbi.getResult();
    } else {
        return setDotAndMark(caret, dotPos, dotBias, dotPos, dotBias);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:CaretMoveContext.java

示例2: setDot

import javax.swing.text.NavigationFilter; //导入方法依赖的package包/类
@Override
public void setDot(NavigationFilter.FilterBypass fb, int dot, Position.Bias bias) {
    NavigationFilter chain = component.getNavigationFilter();
    if (chain != null) {
        chain.setDot(fb, dot, bias);
    } else {
        super.setDot(fb, dot, bias);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:EditorCaret.java

示例3: setNavigationFilter

import javax.swing.text.NavigationFilter; //导入方法依赖的package包/类
/**
 * Sets navigation filter for a certain operation type, defined by {@link MoveCaretsOrigin}.
 * <p>
 * The registered filter will receive <b>only those caret movements</b>, which correspond to the
 * passed {@link MoveCaretsOrigin}. To receive all caret movements, register for {@link MoveCaretsOrigin#DEFAULT} 
 * or use {@link JTextComponent#setNavigationFilter}.
 * </p><p>
 * All the key part(s) of MoveCaretOrigin of a caret operation and `origin' parameter in this function must
 * match in order for the filter to be invoked.
 * </p><p>
 * The NavigationFilter implementation <b>may downcast</b> the passed {@link NavigationFilter.FilterBypass FilterBypass}
 * parameter to {@link NavigationFilterBypass} to get full infomration about the movement. 
 * </p>
 * @param component the component which will use the filter
 * @param origin the origin
 * @param naviFilter the installed filter
 * @see JTextComponent#setNavigationFilter
 * @see NavigationFilterBypass
 * @since 2.10
 */
public static void setNavigationFilter(JTextComponent component, MoveCaretsOrigin origin, @NullAllowed NavigationFilter naviFilter) {
    if (origin == null) {
        origin = MoveCaretsOrigin.DEFAULT;
    }
    final NavigationFilter prev = getNavigationFilter(component, origin);
    if (naviFilter != null) {
        // Note:
        // if the caller passes in a non-cascading filter, we would loose the filter chain information.
        // the alien filter is wrapped by CascadingNavigationFilter delegator, so the previous filter
        // link is preserved.
        if (!(naviFilter instanceof CascadingNavigationFilter)) {
            final NavigationFilter del = naviFilter;
            naviFilter = new CascadingNavigationFilter() {
                @Override
                public void setDot(NavigationFilter.FilterBypass fb, int dot, Position.Bias bias) {
                    del.setDot(fb, dot, bias);
                }

                @Override
                public void moveDot(NavigationFilter.FilterBypass fb, int dot, Position.Bias bias) {
                    del.moveDot(fb, dot, bias);
                }

                @Override
                public int getNextVisualPositionFrom(JTextComponent text, int pos, Position.Bias bias, int direction, Position.Bias[] biasRet) throws BadLocationException {
                    return del.getNextVisualPositionFrom(text, pos, bias, direction, biasRet);
                }
            };
        }
        ((CascadingNavigationFilter)naviFilter).setOwnerAndPrevious(component, origin, prev);
    }
    if (MoveCaretsOrigin.DEFAULT == origin) {
        component.setNavigationFilter(naviFilter);
    } else {
        doPutNavigationFilter(component, origin.getActionType(), prev);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:58,代码来源:EditorCaret.java


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