265 int direction, Position.Bias[] biasRet, |
265 int direction, Position.Bias[] biasRet, |
266 int rowIndex, int x) |
266 int rowIndex, int x) |
267 throws BadLocationException { |
267 throws BadLocationException { |
268 JTextComponent text = (JTextComponent)getContainer(); |
268 JTextComponent text = (JTextComponent)getContainer(); |
269 Document doc = getDocument(); |
269 Document doc = getDocument(); |
270 AbstractDocument aDoc = (doc instanceof AbstractDocument) ? |
|
271 (AbstractDocument)doc : null; |
|
272 View row = getView(rowIndex); |
270 View row = getView(rowIndex); |
273 int lastPos = -1; |
271 int lastPos = -1; |
274 // This could be made better to check backward positions too. |
272 // This could be made better to check backward positions too. |
275 biasRet[0] = Position.Bias.Forward; |
273 biasRet[0] = Position.Bias.Forward; |
276 for(int vc = 0, numViews = row.getViewCount(); vc < numViews; vc++) { |
274 for(int vc = 0, numViews = row.getViewCount(); vc < numViews; vc++) { |
277 View v = row.getView(vc); |
275 View v = row.getView(vc); |
278 int start = v.getStartOffset(); |
276 int start = v.getStartOffset(); |
279 boolean ltr = (aDoc != null) ? aDoc.isLeftToRight |
277 boolean ltr = AbstractDocument.isLeftToRight(doc, start, start + 1); |
280 (start, start + 1) : true; |
|
281 if(ltr) { |
278 if(ltr) { |
282 lastPos = start; |
279 lastPos = start; |
283 for(int end = v.getEndOffset(); lastPos < end; lastPos++) { |
280 for(int end = v.getEndOffset(); lastPos < end; lastPos++) { |
284 float xx = text.modelToView(lastPos).getBounds().x; |
281 float xx = text.modelToView(lastPos).getBounds().x; |
285 if(xx >= x) { |
282 if(xx >= x) { |
336 * position, otherwise false. |
333 * position, otherwise false. |
337 */ |
334 */ |
338 protected boolean flipEastAndWestAtEnds(int position, |
335 protected boolean flipEastAndWestAtEnds(int position, |
339 Position.Bias bias) { |
336 Position.Bias bias) { |
340 Document doc = getDocument(); |
337 Document doc = getDocument(); |
341 if(doc instanceof AbstractDocument && |
338 position = getStartOffset(); |
342 !((AbstractDocument)doc).isLeftToRight(getStartOffset(), |
339 return !AbstractDocument.isLeftToRight(doc, position, position + 1); |
343 getStartOffset() + 1)) { |
|
344 return true; |
|
345 } |
|
346 return false; |
|
347 } |
340 } |
348 |
341 |
349 // --- FlowView methods --------------------------------------------- |
342 // --- FlowView methods --------------------------------------------- |
350 |
343 |
351 /** |
344 /** |