Class Media.AbstractMedia<N extends Media.AbstractMedia<N>>

    • Field Detail

      • width

        @Nullable
        protected Number width
      • height

        @Nullable
        protected Number height
      • alt

        @Nullable
        protected String alt
    • Constructor Detail

      • AbstractMedia

        public AbstractMedia()
    • Method Detail

      • markClass

        public final Class<MediaMark> markClass()
        Description copied from interface: Marked
        Returns the type of marks that may be applied to this node.
        Specified by:
        markClass in interface Marked<Media,​MediaMark>
        Returns:
        the type of marks that may be applied to this node, which is the concrete type for the generic type <M> on this interface.
      • mark

        public N mark​(MediaMark mark)
        Description copied from interface: Marked
        Adds the given mark to this marked node.
        Specified by:
        mark in interface Marked<Media,​MediaMark>
        Parameters:
        mark - the mark to be added
        Returns:
        this
      • link

        public N link​(Link link)
      • link

        public N link​(String href)
      • linkMark

        public N linkMark​(@Nullable
                          Link link)
        Specified by:
        linkMark in interface Media
      • linkMark

        public N linkMark​(@Nullable
                          URL url)
        Specified by:
        linkMark in interface Media
      • linkMark

        public N linkMark​(@Nullable
                          String href)
        Specified by:
        linkMark in interface Media
      • border

        public N border​(@Nullable
                        Border border)
        Specified by:
        border in interface Media
      • border

        public N border​(@Nullable
                        String color)
        Specified by:
        border in interface Media
      • border

        public N border​(int size,
                        String color)
        Specified by:
        border in interface Media
      • marks

        public Collection<MediaMark> marks()
        Description copied from interface: Marked
        Returns a list of the marks currently assigned to this node.
        Specified by:
        marks in interface Marked<Media,​MediaMark>
        Returns:
        a list of the marks currently assigned to this node.
      • marks

        public <T extends MediaMarkStream<? extends T> marks​(Class<T> markClass)
        Description copied from interface: Marked
        Returns a stream of the marks that are currently assigned to this node and match the given type.

        Since only one mark of each type is permitted to be assigned to a single node, the stream will not contain multiple elements when markClass is a concrete mark class.

        Specified by:
        marks in interface Marked<Media,​MediaMark>
        Type Parameters:
        T - the inferred mark class
        Parameters:
        markClass - the mark types to be included in the stream
        Returns:
        the stream of matching marks
      • mark

        public Optional<MediaMark> mark​(String type)
        Description copied from interface: Marked
        Returns the existing mark of the given type, if it exists.
        Specified by:
        mark in interface Marked<Media,​MediaMark>
        Parameters:
        type - the mark type to look up
        Returns:
        the existing mark, or empty if no such mark does exist
      • width

        public Optional<Number> width()
        Description copied from interface: Media
        Returns the media node's display width, if set.
        Specified by:
        width in interface Media
        Returns:
        the media node's display width, or empty() if not set.
      • width

        public N width​(@Nullable
                       Number width)
        Description copied from interface: Media
        Sets the width of the media. Although this attribute is optional, it must be set for the media item in a mediaSingle node, or the media is not displayed.
        Specified by:
        width in interface Media
        Parameters:
        width - the display width of the media item, in pixels; must be positive
        Returns:
        this
      • height

        public Optional<Number> height()
        Description copied from interface: Media
        Returns the media node's display height, if set.
        Specified by:
        height in interface Media
        Returns:
        the media node's display height, or empty() if not set.
      • height

        public N height​(@Nullable
                        Number height)
        Description copied from interface: Media
        Sets the height of the media. Although this attribute is optional, it must be set for the media item in a mediaSingle node, or the media is not displayed.
        Specified by:
        height in interface Media
        Parameters:
        height - the display height of the media item, in pixels; must be positive
        Returns:
        this
      • alt

        public N alt​(@Nullable
                     String alt)
        Specified by:
        alt in interface Media
      • ifLink

        @Deprecated
        public void ifLink​(Consumer<? super Media.LinkMedia> effect)
        Deprecated.
        Most of the support for link media no longer functions in the editor code base, so clients are unlikely to encounter it in the wild and should not use it in new ADF.
        Specified by:
        ifLink in interface Media
      • elementType

        public String elementType()
        Description copied from interface: Element
        The type value that identifies this element, such as "paragraph" or "strong".
        Specified by:
        elementType in interface Element
      • validate

        public void validate()
        Description copied from interface: Element
        Verifies that the node is well-formed (including the state of any descendents that it has).
        Specified by:
        validate in interface Element
      • nodeEquals

        protected final boolean nodeEquals​(N other)
        Description copied from class: AbstractNode
        Allows nodes that have their own fields to augment the equals implementation with tests for their own field values.

        Implementations need not check for identity, null, or a different node class; those are already covered by the AbstractNode.equals(Object) implementation that is expected to be this method's only consumer.

        Just as with the relationship between hashCode, equals, and toString for ordinary Java classes, subclasses of AbstractNode should maintain consistent implementations of nodeHashCode, nodeEquals, and appendNodeFields.

        Overrides:
        nodeEquals in class AbstractNode<N extends Media.AbstractMedia<N>>
        Returns:
        true if all additional field values that belong to a particular type of content node test as equal; false if differences are found
        See Also:
        AbstractNode.nodeHashCode(), AbstractNode.appendNodeFields(ToStringHelper)
      • nodeHashCode

        protected int nodeHashCode()
        Description copied from class: AbstractNode
        Allows nodes that have their own fields to augment the hashCode implementation with a hash of their own field values.

        Implementations need not include the node's class; that is already covered by the AbstractNode.hashCode() implementation that is expected to be this method's only consumer.

        Just as with the relationship between hashCode, equals, and toString for ordinary Java classes, subclasses of AbstractNode should maintain consistent implementations of nodeHashCode, nodeEquals, and appendNodeFields.

        Overrides:
        nodeHashCode in class AbstractNode<N extends Media.AbstractMedia<N>>
        Returns:
        the hash code of any additional field values that belong to a particular type of content node.
        See Also:
        AbstractNode.nodeEquals(AbstractNode), AbstractNode.appendNodeFields(ToStringHelper)
      • mediaEquals

        protected abstract boolean mediaEquals​(N other)
      • mediaHashCode

        protected abstract int mediaHashCode()
      • addCommonAttrs

        protected void addCommonAttrs​(FieldMap attrs)
      • parseCommonAttrs

        protected void parseCommonAttrs​(Map<String,​?> map)