MCPcopy Create free account
hub / github.com/apache/xmlgraphics-fop / addMarker

Method addMarker

fop-core/src/main/java/org/apache/fop/fo/FObj.java:407–434  ·  view source on GitHub ↗

Add the marker to this formatting object. If this object can contain markers it checks that the marker has a unique class-name for this object and that it is the first child. @param marker Marker to add.

(Marker marker)

Source from the content-addressed store, hash-verified

405 * @param marker Marker to add.
406 */
407 protected void addMarker(Marker marker) {
408 String mcname = marker.getMarkerClassName();
409 if (firstChild != null) {
410 // check for empty childNodes
411 for (FONodeIterator iter = getChildNodes(); iter.hasNext();) {
412 FONode node = iter.next();
413 if (node instanceof FObj
414 || (node instanceof FOText
415 && ((FOText) node).willCreateArea())) {
416 getFOValidationEventProducer().markerNotInitialChild(this, getName(),
417 mcname, locator);
418 return;
419 } else if (node instanceof FOText) {
420 iter.remove();
421 notifyChildRemoval(node);
422 }
423 }
424 }
425 if (markers == null) {
426 markers = new HashMap<String, Marker>();
427 }
428 if (!markers.containsKey(mcname)) {
429 markers.put(mcname, marker);
430 } else {
431 getFOValidationEventProducer().markerNotUniqueForSameParent(this, getName(),
432 mcname, locator);
433 }
434 }
435
436 /**
437 * @return true if there are any Markers attached to this object

Callers 2

addChildNodeMethod · 0.95
addChildNodeMethod · 0.80

Calls 13

getChildNodesMethod · 0.95
hasNextMethod · 0.95
nextMethod · 0.95
removeMethod · 0.95
notifyChildRemovalMethod · 0.95
getMarkerClassNameMethod · 0.80
willCreateAreaMethod · 0.80
markerNotInitialChildMethod · 0.80
containsKeyMethod · 0.80
getNameMethod · 0.65

Tested by

no test coverage detected