TagRepository extends AbstractHtmlRepository implements Serializable { public static Collection<AbstractHtml> findTagsByTagName( final String tagName, final AbstractHtml... fromTags) throws NullValueException { return findTagsByTagName(false, tagName, fromTags); } @Deprecated  TagRepository(final Object accessObject,
            final BrowserPage browserPage, final AbstractHtml... rootTags);  TagRepository(final Object accessObject,
            final BrowserPage browserPage,
            final Map<String, AbstractHtml> tagByWffId,
            final AbstractHtml... rootTags); static AbstractHtml findTagById(final String id,
            final AbstractHtml... fromTags); static AbstractHtml findTagById(final boolean parallel,
            final String id, final AbstractHtml... fromTags); AbstractHtml findTagById(final String id); AbstractHtml findTagById(final boolean parallel, final String id); static Collection<AbstractHtml> findTagsByAttribute(
            final String attributeName, final String attributeValue,
            final AbstractHtml... fromTags); static Collection<AbstractHtml> findTagsByAttribute(
            final boolean parallel, final String attributeName,
            final String attributeValue, final AbstractHtml... fromTags); static Collection<AbstractHtml> findTagsByTagName(
            final String tagName, final AbstractHtml... fromTags); static Collection<AbstractHtml> findTagsByTagName(
            final boolean parallel, final String tagName,
            final AbstractHtml... fromTags); static Collection<AbstractAttribute> findAttributesByTagName(
            final String tagName, final AbstractHtml... fromTags); static Collection<AbstractAttribute> findAttributesByAttributeFilter(
            final Predicate<? super AbstractAttribute> filter,
            final AbstractHtml... fromTags); static Collection<AbstractAttribute> findAttributesByAttributeFilter(
            final boolean parallel,
            final Predicate<? super AbstractAttribute> filter,
            final AbstractHtml... fromTags); static Collection<AbstractAttribute> findAttributesByTagName(
            final boolean parallel, final String tagName,
            final AbstractHtml... fromTags); static Collection<AbstractAttribute> findAttributesByTagFilter(
            final Predicate<? super AbstractHtml> filter,
            final AbstractHtml... fromTags); static Collection<AbstractAttribute> findAttributesByTagFilter(
            final boolean parallel,
            final Predicate<? super AbstractHtml> filter,
            final AbstractHtml... fromTags); static AbstractHtml findOneTagByAttribute(final String attributeName,
            final String attributeValue, final AbstractHtml... fromTags); static AbstractHtml findOneTagByAttribute(final boolean parallel,
            final String attributeName, final String attributeValue,
            final AbstractHtml... fromTags); static AbstractHtml findOneTagByTagName(final String tagName,
            final AbstractHtml... fromTags); static AbstractHtml findOneTagByTagName(final boolean parallel,
            final String tagName, final AbstractHtml... fromTags); static T findOneTagAssignableToTag(
            final Class<T> tagClass, final AbstractHtml... fromTags); @SuppressWarnings("unchecked") static T findOneTagAssignableToTag(
            final boolean parallel, final Class<T> tagClass,
            final AbstractHtml... fromTags); static Collection<T> findTagsAssignableToTag(
            final Class<T> tagClass, final AbstractHtml... fromTags); @SuppressWarnings("unchecked") static Collection<T> findTagsAssignableToTag(
            final boolean parallel, final Class<T> tagClass,
            final AbstractHtml... fromTags); static AbstractHtml findOneTagByAttributeName(
            final String attributeName, final AbstractHtml... fromTags); static AbstractHtml findOneTagByAttributeName(final boolean parallel,
            final String attributeName, final AbstractHtml... fromTags); static Collection<AbstractHtml> findTagsByAttributeName(
            final String attributeName, final AbstractHtml... fromTags); static Collection<AbstractHtml> findTagsByAttributeName(
            final boolean parallel, final String attributeName,
            final AbstractHtml... fromTags); Collection<AbstractHtml> findTagsByAttributeName(
            final String attributeName); Collection<AbstractHtml> findTagsByAttributeName(
            final boolean parallel, final String attributeName); Collection<AbstractHtml> findTagsByAttribute(
            final String attributeName, final String attributeValue); Collection<AbstractHtml> findTagsByAttribute(final boolean parallel,
            final String attributeName, final String attributeValue); Collection<AbstractHtml> findTagsByTagName(final String tagName); Collection<AbstractHtml> findTagsByTagName(final boolean parallel,
            final String tagName); Collection<AbstractHtml> findTagsByTagFilter(
            final Predicate<? super AbstractHtml> filter); Collection<AbstractHtml> findTagsByTagFilter(final boolean parallel,
            final Predicate<? super AbstractHtml> filter); static Collection<AbstractHtml> findTagsByTagFilter(
            final boolean parallel,
            final Predicate<? super AbstractHtml> filter,
            final AbstractHtml... fromTags); static Collection<AbstractHtml> findTagsByTagFilter(
            final Predicate<? super AbstractHtml> filter,
            final AbstractHtml... fromTags); Collection<AbstractAttribute> findAttributesByTagName(
            final String tagName); Collection<AbstractAttribute> findAttributesByTagName(
            final boolean parallel, final String tagName); Collection<AbstractAttribute> findAttributesByAttributeFilter(
            final Predicate<? super AbstractAttribute> filter); Collection<AbstractAttribute> findAttributesByAttributeFilter(
            final boolean parallel,
            final Predicate<? super AbstractAttribute> filter); AbstractHtml findOneTagByAttribute(final String attributeName,
            final String attributeValue); AbstractHtml findOneTagByAttribute(final boolean parallel,
            final String attributeName, final String attributeValue); AbstractHtml findOneTagByTagName(final String tagName); AbstractHtml findOneTagByTagName(final boolean parallel,
            final String tagName); T findOneTagAssignableToTag(
            final Class<T> tagClass); @SuppressWarnings("unchecked") T findOneTagAssignableToTag(
            final boolean parallel, final Class<T> tagClass); Collection<T> findTagsAssignableToTag(
            final Class<T> tagClass); @SuppressWarnings("unchecked") Collection<T> findTagsAssignableToTag(
            final boolean parallel, final Class<T> tagClass); AbstractHtml findOneTagByAttributeName(final String attributeName); AbstractHtml findOneTagByAttributeName(final boolean parallel,
            final String attributeName); Collection<AbstractHtml> findTagsByAttribute(
            final AbstractAttribute attribute); AbstractHtml findOneTagByAttribute(
            final AbstractAttribute attribute); void upsert(final AbstractHtml tag, final String key,
            final WffBMObject bmObject); void upsert(final AbstractHtml tag, final String key,
            final WffBMArray bmArray); void delete(final AbstractHtml tag, final String key); WffBMData getWffBMData(final AbstractHtml tag, final String key); Collection<AbstractHtml> findAllTags(); Collection<AbstractHtml> findAllTags(final boolean parallel); Stream<AbstractHtml> buildAllTagsStream(final boolean parallel); static Collection<AbstractHtml> findAllTags(
            final AbstractHtml... fromTags); static Collection<AbstractHtml> findAllTags(final boolean parallel,
            final AbstractHtml... fromTags); Collection<AbstractAttribute> findAllAttributes(); Collection<AbstractAttribute> findAllAttributes(
            final boolean parallel); Stream<AbstractAttribute> buildAllAttributesStream(
            final boolean parallel); static Collection<AbstractAttribute> findAllAttributes(
            final AbstractHtml... fromTags); static Collection<AbstractAttribute> findAllAttributes(
            final boolean parallel, final AbstractHtml... fromTags); boolean exists(final AbstractHtml tag); boolean exists(final AbstractAttribute attribute); boolean executeJs(final String js); void execute(final BrowserPageAction pageAction); Body findBodyTag(); Body findBodyTag(final boolean parallel); Head findHeadTag(); Head findHeadTag(final boolean parallel); TitleTag findTitleTag(); TitleTag findTitleTag(final boolean parallel); static Stream<AbstractHtml> buildAllTagsStream(
            final boolean parallel, final AbstractHtml... fromTags); static Stream<AbstractHtml> buildAllTagsStream(
            final AbstractHtml... fromTags); static Stream<AbstractAttribute> buildAllAttributesStream(
            final AbstractHtml... fromTags); static Stream<AbstractAttribute> buildAllAttributesStream(
            final boolean parallel, final AbstractHtml... fromTags); Stream<AbstractAttribute> buildAllAttributesStream();  }
@Test public void testStaticFindTagsByTagNameBooleanStringAbstractHtmls() throws Exception { final Html html = new Html(null) {{ new Body(this) {{ new Div(this, new Id("one"), new Name("name1")) {{ new Span(this, new Id("two")) {{ new H1(this, new Id("three"), new Name("name1")); new H2(this, new Id("four")); new NoTag(this, "something"); }}; new Span(this, new Id("spanthree")); new H3(this, new Name("name1")); }}; }}; }}; { final Collection<AbstractHtml> tags = TagRepository.findTagsByTagName(false, TagNameConstants.SPAN, html); for (AbstractHtml tag : tags) { assertTrue((tag instanceof Span)); } assertEquals(2, tags.size()); } { final Collection<AbstractHtml> tags = TagRepository.findTagsByTagName(false, TagNameConstants.HTML, html); for (AbstractHtml tag : tags) { assertTrue((tag instanceof Html)); } assertEquals(1, tags.size()); } }
@Test public void testFindTagsByTagName() { final Set<Div> divs = new HashSet<Div>(); final Form form = new Form(null) { { new Input(this, new Name("name1")); Div d1 = new Div(this, new Name("excluded")){{ new Input(this, new Name("name2")); }}; divs.add(d1); new Input(this, new Name("name3")); Div d2 = new Div(this){{new Input(this, new Name("name4"));}}; divs.add(d2); Div d3 = new Div(this){{new Input(this, new Id("id4"));}}; divs.add(d3); Div d4 = new Div(this){{new Input(this, new Name("name4"));}}; divs.add(d4); new TextArea(this, new Name("included")); } }; Assert.assertEquals(form, TagRepository.findOneTagByTagName(TagNameConstants.FORM, form)); Assert.assertEquals("div", TagRepository.findOneTagByTagName(TagNameConstants.DIV, form).getTagName()); final Collection<AbstractHtml> tagsByTagName = TagRepository.findTagsByTagName(TagNameConstants.DIV, form); Assert.assertTrue(tagsByTagName.size() == divs.size()); for (Div div : divs) { Assert.assertTrue(tagsByTagName.contains(div)); } final AbstractHtml[] tags = new AbstractHtml[1]; Html html = new Html(null) {{ new Head(this); new Body(this) {{ tags[0] = this; new Div(this) {{ new NoTag(this, "\nsamplediv "); new Div(this); }}; }}; }}; Assert.assertEquals(tags[0], TagRepository.findOneTagByTagName(TagNameConstants.BODY, html)); Assert.assertEquals("div", TagRepository.findOneTagByTagName(TagNameConstants.DIV, html).getTagName()); }