/** * Gives notification that something was inserted into the document in a location that this view * is responsible for. This is implemented to simply update the children. * * @param changes The change information from the associated document. * @param a the current allocation of the view * @param f the factory to use to rebuild if the view has children * @see View#insertUpdate */ public void insertUpdate(DocumentEvent changes, Shape a, ViewFactory f) { updateChildren(changes, a); Rectangle alloc = ((a != null) && isAllocationValid()) ? getInsideAllocation(a) : null; int pos = changes.getOffset(); View v = getViewAtPosition(pos, alloc); if (v != null) v.insertUpdate(changes, alloc, f); }
/** * Forwards the <code>DocumentEvent</code> to the give child view. This simply messages the view * with a call to <code>insertUpdate</code>, <code>removeUpdate</code>, or <code>changedUpdate * </code> depending upon the type of the event. This is called by <a * href="#forwardUpdate">forwardUpdate</a> to forward the event to children that need it. * * @param v the child view to forward the event to * @param e the change information from the associated document * @param a the current allocation of the view * @param f the factory to use to rebuild if the view has children * @see #forwardUpdate * @since 1.3 */ protected void forwardUpdateToView(View v, DocumentEvent e, Shape a, ViewFactory f) { DocumentEvent.EventType type = e.getType(); if (type == DocumentEvent.EventType.INSERT) { v.insertUpdate(e, a, f); } else if (type == DocumentEvent.EventType.REMOVE) { v.removeUpdate(e, a, f); } else { v.changedUpdate(e, a, f); } }