424 return getSkinnable().prefHeight(width);
425 }
426
427 /** {@inheritDoc} */
428 @Override public double computeBaselineOffset(double topInset, double rightInset, double bottomInset, double leftInset) {
429 return topInset + textNode.getBaselineOffset();
430 }
431
432 // Public for behavior
433 /**
434 * Replaces a range of characters with the given text.
435 *
436 * Call this implementation from behavior classes instead of the
437 * one provided on TextInputControl to ensure that the text
438 * scrolls as needed.
439 *
440 * @param start The starting index in the range, inclusive. This must be >= 0 and < the end.
441 * @param end The ending index in the range, exclusive. This is one-past the last character to
442 * delete (consistent with the String manipulation methods). This must be > the start,
443 * and <= the length of the text.
444 * @param text The text that is to replace the range. This must not be null.
445 * @see TextField#replaceText(int, int, String)
446 */
447 public void replaceText(int start, int end, String txt) {
448 final double textMaxXOld = textNode.getBoundsInParent().getMaxX();
449 final double caretMaxXOld = caretPath.getLayoutBounds().getMaxX() + textTranslateX.get();
450 getSkinnable().replaceText(start, end, txt);
451 scrollAfterDelete(textMaxXOld, caretMaxXOld);
452 }
453
454 // Public for behavior
455 /**
456 * Deletes the character that follows or precedes the current
457 * caret position from the text if there is no selection, or
458 * deletes the selection if there is one.
459 *
460 * Call this implementation from behavior classes instead of the
461 * one provided on TextInputControl to ensure that the text
462 * scrolls as needed.
463 *
464 * @param previous whether to delete the preceding character.
|
424 return getSkinnable().prefHeight(width);
425 }
426
427 /** {@inheritDoc} */
428 @Override public double computeBaselineOffset(double topInset, double rightInset, double bottomInset, double leftInset) {
429 return topInset + textNode.getBaselineOffset();
430 }
431
432 // Public for behavior
433 /**
434 * Replaces a range of characters with the given text.
435 *
436 * Call this implementation from behavior classes instead of the
437 * one provided on TextInputControl to ensure that the text
438 * scrolls as needed.
439 *
440 * @param start The starting index in the range, inclusive. This must be >= 0 and < the end.
441 * @param end The ending index in the range, exclusive. This is one-past the last character to
442 * delete (consistent with the String manipulation methods). This must be > the start,
443 * and <= the length of the text.
444 * @param txt The text that is to replace the range. This must not be null.
445 * @see TextField#replaceText(int, int, String)
446 */
447 public void replaceText(int start, int end, String txt) {
448 final double textMaxXOld = textNode.getBoundsInParent().getMaxX();
449 final double caretMaxXOld = caretPath.getLayoutBounds().getMaxX() + textTranslateX.get();
450 getSkinnable().replaceText(start, end, txt);
451 scrollAfterDelete(textMaxXOld, caretMaxXOld);
452 }
453
454 // Public for behavior
455 /**
456 * Deletes the character that follows or precedes the current
457 * caret position from the text if there is no selection, or
458 * deletes the selection if there is one.
459 *
460 * Call this implementation from behavior classes instead of the
461 * one provided on TextInputControl to ensure that the text
462 * scrolls as needed.
463 *
464 * @param previous whether to delete the preceding character.
|