public void changedUpdate(DocumentEvent changes, Shape a, ViewFactory f) { super.changedUpdate(changes, a, f); int pos = changes.getOffset(); if (pos <= getStartOffset() && (pos + changes.getLength()) >= getEndOffset()) { setPropertiesFromAttributes(); } }
/* */ public void setSize(float paramFloat1, float paramFloat2) /* */ { /* 381 */ updateMetrics(); /* 382 */ if ((int) paramFloat1 != getWidth()) /* */ { /* 385 */ preferenceChanged(null, true, true); /* 386 */ this.widthChanging = true; /* */ } /* 388 */ super.setSize(paramFloat1, paramFloat2); /* 389 */ this.widthChanging = false; /* */ }
/** * Sets the size of the view. This should cause layout of the view along the given axis, if it has * any layout duties. * * @param width the width >= 0 * @param height the height >= 0 */ public void setSize(float width, float height) { updateMetrics(); if ((int) width != getWidth()) { // invalidate the view itself since the childrens // desired widths will be based upon this views width. preferenceChanged(null, true, true); widthChanging = true; } super.setSize(width, height); widthChanging = false; }
/* */ public void paint(Graphics paramGraphics, Shape paramShape) /* */ { /* 356 */ Rectangle localRectangle = (Rectangle) paramShape; /* 357 */ this.tabBase = localRectangle.x; /* 358 */ JTextComponent localJTextComponent = (JTextComponent) getContainer(); /* 359 */ this.sel0 = localJTextComponent.getSelectionStart(); /* 360 */ this.sel1 = localJTextComponent.getSelectionEnd(); /* 361 */ this.unselected = (localJTextComponent.isEnabled() ? localJTextComponent.getForeground() : localJTextComponent.getDisabledTextColor()); /* */ /* 363 */ Caret localCaret = localJTextComponent.getCaret(); /* 364 */ this.selected = ((localCaret.isSelectionVisible()) && (localJTextComponent.getHighlighter() != null) ? localJTextComponent.getSelectedTextColor() : this.unselected); /* */ /* 366 */ paramGraphics.setFont(localJTextComponent.getFont()); /* */ /* 369 */ super.paint(paramGraphics, paramShape); /* */ }
/** * Lays out the children. If the span along the flow axis has changed, layout is marked as invalid * which which will cause the superclass behavior to recalculate the layout along the box axis. * The FlowStrategy.layout method will be called to rebuild the flow rows as appropriate. If the * height of this view changes (determined by the perferred size along the box axis), a * preferenceChanged is called. Following all of that, the normal box layout of the superclass is * performed. * * @param width the width to lay out against >= 0. This is the width inside of the inset area. * @param height the height to lay out against >= 0 This is the height inside of the inset area. */ protected void layout(int width, int height) { final int faxis = getFlowAxis(); int newSpan; if (faxis == X_AXIS) { newSpan = (int) width; } else { newSpan = (int) height; } if (layoutSpan != newSpan) { layoutChanged(faxis); layoutChanged(getAxis()); layoutSpan = newSpan; } // repair the flow if necessary if (!isLayoutValid(faxis)) { final int heightAxis = getAxis(); int oldFlowHeight = (int) ((heightAxis == X_AXIS) ? getWidth() : getHeight()); strategy.layout(this); int newFlowHeight = (int) getPreferredSpan(heightAxis); if (oldFlowHeight != newFlowHeight) { View p = getParent(); if (p != null) { p.preferenceChanged(this, (heightAxis == X_AXIS), (heightAxis == Y_AXIS)); } // PENDING(shannonh) // Temporary fix for 4250847 // Can be removed when TraversalContext is added Component host = getContainer(); if (host != null) { // nb idk 12/12/2001 host should not be equal to null. We need to add assertion here host.repaint(); } } } super.layout(width, height); }
/** * Establishes the parent view for this view. This is guaranteed to be called before any other * methods if the parent view is functioning properly. * * <p>This is implemented to forward to the superclass as well as call the {@link * #setPropertiesFromAttributes()} method to set the paragraph properties from the css attributes. * The call is made at this time to ensure the ability to resolve upward through the parents view * attributes. * * @param parent the new parent, or null if the view is being removed from a parent it was * previously added to */ public void setParent(View parent) { super.setParent(parent); if (parent != null) { setPropertiesFromAttributes(); } }
/** * Renders using the given rendering surface and area on that surface. This is implemented to * delegate to the css box painter to paint the border and background prior to the interior. * * @param g the rendering surface to use * @param allocation the allocated region to render into * @see View#paint */ public void paint(Graphics g, Shape allocation) { Rectangle a = (Rectangle) allocation; painter.paint(g, a.x, a.y, a.width, a.height, this); super.paint(g, a); }