Last active
October 2, 2019 02:47
-
-
Save webfirmframework/3d758303988006aecbf3ce7e9eb89bb5 to your computer and use it in GitHub Desktop.
Example for getRootTag method on a tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.webfirmframework.wffweb.tag.html.Body; | |
import com.webfirmframework.wffweb.tag.html.Html; | |
import com.webfirmframework.wffweb.tag.html.TitleTag; | |
import com.webfirmframework.wffweb.tag.html.attribute.global.Id; | |
import com.webfirmframework.wffweb.tag.html.metainfo.Head; | |
import com.webfirmframework.wffweb.tag.html.stylesandsemantics.Div; | |
import com.webfirmframework.wffweb.tag.htmlwff.NoTag; | |
import com.webfirmframework.wffweb.tag.repository.TagRepository; | |
public class RootTagOnTagUsage { | |
public static void main(String[] args) { | |
// use latest version to use this coding style | |
Html rootTag = new Html(null).give(html -> { | |
new Head(html).give(head -> { | |
new TitleTag(head).give(title -> { | |
new NoTag(title, "some title"); | |
}); | |
}); | |
new Body(html, new Id("one")).give(body -> { | |
new Div(body); | |
}); | |
}); | |
Div div = TagRepository.findOneTagAssignableToTag(Div.class, rootTag); | |
// prints true because the root tag of the whole hierarchy is rootTag | |
System.out.println(div.getRootTag().equals(rootTag)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Developers guide to get started
Convert HTML5 to webfirmframework Java/Kotlin Code