< prev index next >
modules/graphics/src/main/java/javafx/scene/text/Text.java
Print this page
@@ -113,10 +113,31 @@
public void doUpdatePeer(Node node) {
((Text) node).doUpdatePeer();
}
@Override
+ public Bounds doComputeLayoutBounds(Node node) {
+ return ((Text) node).doComputeLayoutBounds();
+ }
+
+ @Override
+ public BaseBounds doComputeGeomBounds(Node node,
+ BaseBounds bounds, BaseTransform tx) {
+ return ((Text) node).doComputeGeomBounds(bounds, tx);
+ }
+
+ @Override
+ public boolean doComputeContains(Node node, double localX, double localY) {
+ return ((Text) node).doComputeContains(localX, localY);
+ }
+
+ @Override
+ public void doGeomChanged(Node node) {
+ ((Text) node).doGeomChanged();
+ }
+
+ @Override
public com.sun.javafx.geom.Shape doConfigShape(Shape shape) {
return ((Text) shape).doConfigShape();
}
});
}
@@ -205,11 +226,11 @@
/* Create new text span every time the font or text changes
* so the text layout can see that the content has changed.
*/
textSpan = null;
- /* Relies on impl_geomChanged() to request text flow to relayout */
+ /* Relies on NodeHelper.geomChanged(this) to request text flow to relayout */
} else {
TextLayout layout = getTextLayout();
String string = getTextInternal();
Object font = getFontInternal();
layout.setContent(string, font);
@@ -217,11 +238,11 @@
needsTextLayout();
}
private void needsTextLayout() {
textRuns = null;
- impl_geomChanged();
+ NodeHelper.geomChanged(this);
NodeHelper.markDirty(this, DirtyBits.NODE_CONTENTS);
}
private TextSpan textSpan;
TextSpan getTextSpan() {
@@ -293,19 +314,19 @@
/* Sometimes a property change in the text node will causes layout in
* text flow. In this case all the dirty bits are already clear and no
* extra work is necessary. Other times the layout is caused by changes
* in the text flow object (wrapping width and text alignment for example).
* In the second case the dirty bits must be set here using
- * impl_geomChanged() and NodeHelper.markDirty(). Note that impl_geomChanged()
+ * NodeHelper.geomChanged(this) and NodeHelper.markDirty(). Note that NodeHelper.geomChanged(this)
* causes another (undesired) layout request in the parent.
* In general this is not a problem because shapes are not resizable and
* region objects do not propagate layout changes to the parent.
* This is a special case where a shape is resized by the parent during
* layoutChildren(). See TextFlow#requestLayout() for information how
* text flow deals with this situation.
*/
- impl_geomChanged();
+ NodeHelper.geomChanged(this);
NodeHelper.markDirty(this, DirtyBits.NODE_CONTENTS);
}
BaseBounds getSpanBounds() {
if (spanBoundsInvalid) {
@@ -454,11 +475,11 @@
if (x == null) {
x = new DoublePropertyBase() {
@Override public Object getBean() { return Text.this; }
@Override public String getName() { return "x"; }
@Override public void invalidated() {
- impl_geomChanged();
+ NodeHelper.geomChanged(Text.this);
}
};
}
return x;
}
@@ -482,11 +503,11 @@
if (y == null) {
y = new DoublePropertyBase() {
@Override public Object getBean() { return Text.this; }
@Override public String getName() { return "y"; }
@Override public void invalidated() {
- impl_geomChanged();
+ NodeHelper.geomChanged(Text.this);
}
};
}
return y;
}
@@ -591,11 +612,11 @@
type |= TextLayout.BOUNDS_CENTER;
}
if (layout.setBoundsType(type)) {
needsTextLayout();
} else {
- impl_geomChanged();
+ NodeHelper.geomChanged(Text.this);
}
}
};
}
return boundsType;
@@ -628,11 +649,11 @@
if (!isSpan()) {
TextLayout layout = getTextLayout();
if (layout.setWrapWidth((float)get())) {
needsTextLayout();
} else {
- impl_geomChanged();
+ NodeHelper.geomChanged(Text.this);
}
}
}
};
}
@@ -774,26 +795,21 @@
@Override public CssMetaData<Text,FontSmoothingType> getCssMetaData() {
return StyleableProperties.FONT_SMOOTHING_TYPE;
}
@Override public void invalidated() {
NodeHelper.markDirty(Text.this, DirtyBits.TEXT_ATTRS);
- impl_geomChanged();
+ NodeHelper.geomChanged(Text.this);
}
};
}
return fontSmoothingType;
}
- /**
- * @treatAsPrivate implementation detail
- * @deprecated This is an internal API that is not intended
- * for use and will be removed in the next version
+ /*
+ * Note: This method MUST only be called via its accessor method.
*/
- @Deprecated
- @Override
- protected final void impl_geomChanged() {
- super.impl_geomChanged();
+ private final void doGeomChanged() {
if (attributes != null) {
if (attributes.caretBinding != null) {
attributes.caretBinding.invalidate();
}
if (attributes.selectionBinding != null) {
@@ -1053,18 +1069,11 @@
default: return 0;
}
}
}
- /**
- * @treatAsPrivate implementation detail
- * @deprecated This is an internal API that is not intended
- * for use and will be removed in the next version
- */
- @Deprecated
- @Override
- protected final Bounds impl_computeLayoutBounds() {
+ private final Bounds doComputeLayoutBounds() {
if (isSpan()) {
BaseBounds bounds = getSpanBounds();
double width = bounds.getWidth();
double height = bounds.getHeight();
return new BoundingBox(0, 0, width, height);
@@ -1072,11 +1081,11 @@
if (getBoundsType() == TextBoundsType.VISUAL) {
/* In Node the layout bounds is computed based in the geom
* bounds and in Shape the geom bounds is computed based
* on the shape (generated here in #configShape()) */
- return super.impl_computeLayoutBounds();
+ return TextHelper.superComputeLayoutBounds(this);
}
BaseBounds bounds = getLogicalBounds();
double x = bounds.getMinX() + getX();
double y = bounds.getMinY() + getY() + getYAdjustment(bounds);
double width = bounds.getWidth();
@@ -1084,22 +1093,18 @@
double wrappingWidth = getWrappingWidth();
if (wrappingWidth != 0) width = wrappingWidth;
return new BoundingBox(x, y, width, height);
}
- /**
- * @treatAsPrivate implementation detail
- * @deprecated This is an internal API that is not intended
- * for use and will be removed in the next version
+ /*
+ * Note: This method MUST only be called via its accessor method.
*/
- @Deprecated
- @Override
- public final BaseBounds impl_computeGeomBounds(BaseBounds bounds,
+ private BaseBounds doComputeGeomBounds(BaseBounds bounds,
BaseTransform tx) {
if (isSpan()) {
if (ShapeHelper.getMode(this) != NGShape.Mode.FILL && getStrokeType() != StrokeType.INSIDE) {
- return super.impl_computeGeomBounds(bounds, tx);
+ return TextHelper.superComputeGeomBounds(this, bounds, tx);
}
TextLayout layout = getTextLayout();
bounds = layout.getBounds(getTextSpan(), bounds);
BaseBounds spanBounds = getSpanBounds();
float minX = bounds.getMinX() - spanBounds.getMinX();
@@ -1123,11 +1128,11 @@
bounds.deriveWithNewBounds(x, y, 0, x + visualBounds.getWidth(),
y + visualBounds.getHeight(), 0);
return tx.transform(bounds, bounds);
} else {
/* Let the super class compute the bounds using shape */
- return super.impl_computeGeomBounds(bounds, tx);
+ return TextHelper.superComputeGeomBounds(this, bounds, tx);
}
}
BaseBounds textBounds = getLogicalBounds();
float x = textBounds.getMinX() + (float)getX();
@@ -1152,12 +1157,11 @@
}
textBounds = new RectBounds(x, y, x + width, y + height);
/* handle stroked text */
if (ShapeHelper.getMode(this) != NGShape.Mode.FILL && getStrokeType() != StrokeType.INSIDE) {
- bounds =
- super.impl_computeGeomBounds(bounds,
+ bounds = TextHelper.superComputeGeomBounds(this, bounds,
BaseTransform.IDENTITY_TRANSFORM);
} else {
TextLayout layout = getTextLayout();
bounds = layout.getBounds(null, bounds);
x = bounds.getMinX() + (float)getX();
@@ -1167,18 +1171,14 @@
bounds = bounds.deriveWithUnion(textBounds);
return tx.transform(bounds, bounds);
}
- /**
- * @treatAsPrivate implementation detail
- * @deprecated This is an internal API that is not intended
- * for use and will be removed in the next version
+ /*
+ * Note: This method MUST only be called via its accessor method.
*/
- @Deprecated
- @Override
- protected final boolean impl_computeContains(double localX, double localY) {
+ private boolean doComputeContains(double localX, double localY) {
/* Used for spans, regular text uses bounds based picking */
double x = localX + getSpanBounds().getMinX();
double y = localY + getSpanBounds().getMinY();
GlyphList[] runs = getRuns();
if (runs.length != 0) {
@@ -1496,11 +1496,11 @@
@Override public String getName() { return "textOrigin"; }
@Override public CssMetaData getCssMetaData() {
return StyleableProperties.TEXT_ORIGIN;
}
@Override public void invalidated() {
- impl_geomChanged();
+ NodeHelper.geomChanged(Text.this);
}
};
}
return textOrigin;
}
@@ -1520,11 +1520,11 @@
return StyleableProperties.UNDERLINE;
}
@Override public void invalidated() {
NodeHelper.markDirty(Text.this, DirtyBits.TEXT_ATTRS);
if (getBoundsType() == TextBoundsType.VISUAL) {
- impl_geomChanged();
+ NodeHelper.geomChanged(Text.this);
}
}
};
}
return underline;
@@ -1545,11 +1545,11 @@
return StyleableProperties.STRIKETHROUGH;
}
@Override public void invalidated() {
NodeHelper.markDirty(Text.this, DirtyBits.TEXT_ATTRS);
if (getBoundsType() == TextBoundsType.VISUAL) {
- impl_geomChanged();
+ NodeHelper.geomChanged(Text.this);
}
}
};
}
return strikethrough;
< prev index next >