本文整理汇总了Java中com.hp.gagawa.java.DocumentType类的典型用法代码示例。如果您正苦于以下问题:Java DocumentType类的具体用法?Java DocumentType怎么用?Java DocumentType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DocumentType类属于com.hp.gagawa.java包,在下文中一共展示了DocumentType类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: genPosts
import com.hp.gagawa.java.DocumentType; //导入依赖的package包/类
private void genPosts(ArrayList<File> postXmls, File out, File root)
{
Document postsDoc = new Document(DocumentType.HTMLTransitional);
initDocumentHeader(postsDoc, "Posts", out, null, root, true);
for (File postXml : postXmls)
{
Properties props = loadProperties(postXml);
Div singlePost = new Div();
File photoXml = FileUtils.resolveRelativePath(postXml, props.getProperty(PostInfoKey.PICTURE.toString()));
Properties picProps = loadProperties(photoXml);
File picFile = FileUtils.resolveRelativePath(photoXml, picProps.getProperty(PhotoInfoKey.FILE.toString()));
Img pic = new Img("Photo", FileUtils.getWayTo(out, picFile));
singlePost.appendChild(pic);
singlePost.setCSSClass("comment");
singlePost.appendChild(wrapInfos(PostInfoKey.values(), props, true));
postsDoc.body.appendChild(singlePost);
}
writeDocument(postsDoc, out);
}
示例2: groupOverview
import com.hp.gagawa.java.DocumentType; //导入依赖的package包/类
public void groupOverview(File groupHtml, File root, ArrayList<File> groupXmls)
{
if (!groupHtml.getParentFile().exists())
groupHtml.getParentFile().mkdirs();
Document groupsDoc = new Document(DocumentType.HTMLTransitional);
initDocumentHeader(groupsDoc, "Gruppen", groupHtml, null, root, true);
Ul groupList = new Ul();
for (File groupXml : groupXmls)
{
Properties groupProps = loadProperties(groupXml);
Li groupItem = new Li();
A groupLink = new A();
File singleGroupHtml = new File("" + groupHtml.getParentFile() + "/" + groupProps.getProperty(GroupInfoKey.ID.toString()));
genGroup(groupProps, singleGroupHtml, root);
groupLink.setHref(FileUtils.getWayTo(groupHtml, singleGroupHtml));
groupLink.appendText(groupProps.getProperty(GroupInfoKey.NAME.toString()));
groupItem.appendChild(groupLink);
groupList.appendChild(groupItem);
}
groupsDoc.body.appendChild(groupList);
writeDocument(groupsDoc, groupHtml);
}
示例3: genPages
import com.hp.gagawa.java.DocumentType; //导入依赖的package包/类
public void genPages(File pagesHtml, ArrayList<File> pageXmls, File root)
{
if (!pagesHtml.getParentFile().exists())
pagesHtml.getParentFile().mkdirs();
Document pagesDoc = new Document(DocumentType.HTMLTransitional);
initDocumentHeader(pagesDoc, "Seiten", pagesHtml, null, root, true);
Ul pageList = new Ul();
for (File pageXml : pageXmls)
{
Li item = new Li();
A link = new A();
Properties pageProps = loadProperties(pageXml);
File pageHtml = new File("" + pagesHtml.getParentFile() + "/" + pageProps.getProperty(PageInfoKey.ID.toString()) + "/page.html");
link.setHref(FileUtils.getWayTo(pagesHtml, pageHtml));
link.appendText(pageProps.getProperty(PageInfoKey.NAME.toString()));
genPage(pageHtml, pageProps, root);
item.appendChild(link);
pageList.appendChild(item);
}
pagesDoc.body.appendChild(pageList);
writeDocument(pagesDoc, pagesHtml);
}
示例4: genPage
import com.hp.gagawa.java.DocumentType; //导入依赖的package包/类
public void genPage(File pageHtml, Properties pageProps, File root)
{
if (!pageHtml.getParentFile().exists())
pageHtml.getParentFile().mkdirs();
Document pageDoc = new Document(DocumentType.HTMLTransitional);
initDocumentHeader(pageDoc, pageProps.getProperty(PageInfoKey.NAME.toString()), pageHtml, null, root, true);
Div sidebar = new Div();
sidebar.setCSSClass("sidebar");
sidebar.appendChild(wrapInfos(PageInfoKey.values(), pageProps, true));
pageDoc.body.appendChild(sidebar);
Div realContent = new Div();
realContent.setCSSClass("page");
H1 head = new H1();
head.appendText(pageProps.getProperty(PageInfoKey.NAME.toString()));
realContent.appendChild(head);
pageDoc.body.appendChild(realContent);
writeDocument(pageDoc, pageHtml);
}
示例5: genPhotoFile
import com.hp.gagawa.java.DocumentType; //导入依赖的package包/类
public void genPhotoFile(Properties photoProps, File photoHtml, File photoXml, File root, Node... add)
{
File icon = FileUtils.resolveRelativePath(photoXml, photoProps.getProperty(PhotoInfoKey.FILE.toString()));
Document photoDoc = new Document(DocumentType.HTMLTransitional);
photoDoc = initDocumentHeader(photoDoc, photoProps.getProperty(PhotoInfoKey.ID.toString(), "Foto"), photoHtml, icon, root, true);
String relativeImg = FileUtils.getWayTo(photoHtml, icon);
Img picture = new Img("Photo", relativeImg);
picture.setCSSClass("picture");
Div sideInfos = new Div();
sideInfos.setCSSClass("sidebar");
sideInfos.appendChild(wrapInfos(PhotoInfoKey.values(), photoProps, true));
photoDoc.body.appendChild(sideInfos);
photoDoc.body.appendChild(picture);
if (add != null)
for (Node n : add)
if (n != null)
photoDoc.body.appendChild(n);
writeDocument(photoDoc, photoHtml);
}
示例6: genGroup
import com.hp.gagawa.java.DocumentType; //导入依赖的package包/类
public void genGroup(Properties groupProps, File groupHTML, File root)
{
if (!groupHTML.getParentFile().exists())
groupHTML.getParentFile().mkdirs();
Document groupDoc = new Document(DocumentType.HTMLTransitional);
initDocumentHeader(groupDoc, groupProps.getProperty(GroupInfoKey.NAME.toString()), groupHTML, null, root, true);
Div sidebar = new Div();
sidebar.setCSSClass("sidebar");
sidebar.appendChild(wrapInfos(GroupInfoKey.values(), groupProps, true));
groupDoc.body.appendChild(sidebar);
writeDocument(groupDoc, groupHTML);
}
示例7: HtmlReportComposer
import com.hp.gagawa.java.DocumentType; //导入依赖的package包/类
public HtmlReportComposer() {
doc = new Document(DocumentType.XHTMLStrict);
doc.body.setBgcolor(PAGE_BACKGROUND_COLOR);
doc.body.setStyle("margin:" + PAGE_MARGIN);
}
示例8: genAlbums
import com.hp.gagawa.java.DocumentType; //导入依赖的package包/类
private void genAlbums(File albumsHtml, ArrayList<File> albumsPropsFiles, File root)
{
File albumFolder = albumsHtml.getParentFile();
if (!albumFolder.exists())
albumFolder.mkdirs();
Document albums = new Document(DocumentType.HTMLTransitional);
albums = initDocumentHeader(albums, "Alben", albumsHtml, null, root, true);
Div albumContainer = new Div();
albumContainer.setCSSClass("picture_container");
Ul albumlist = new Ul();
for (File albumProps : albumsPropsFiles)
{
Properties albumsProps = loadProperties(albumProps);
Div innerItem = new Div();
Li item = new Li();
String relativeImg = "";
File photoFolder = FileUtils.resolveRelativePath(albumProps, albumsProps.getProperty(AlbumInfoKey.PHOTO_DIR.toString()));
File coverDir = new File("" + photoFolder + "/" + albumsProps.getProperty(AlbumInfoKey.COVER_PHOTO_ID.toString()));
File coverXml = FileUtils.resolveRelativePath(coverDir, albumsProps.getProperty(AlbumInfoKey.PHOTO_INFO.toString()));
Properties coverProps = loadProperties(coverXml);
File photo = FileUtils.resolveRelativePath(coverXml, coverProps.getProperty(PhotoInfoKey.FILE.toString()));
relativeImg = FileUtils.getWayTo(albumsHtml, photo);
A albumLink = new A();
Img cover = new Img(albumsProps.getProperty(AlbumInfoKey.NAME.toString()), relativeImg);
innerItem.setCSSClass("album_picture");
innerItem.appendChild(cover);
albumLink.appendChild(innerItem);
File singleAlbumHtml = new File("" + albumsHtml.getParentFile() + "/" + albumsProps.getProperty(AlbumInfoKey.ID.toString()) + "/album.html");
albumLink.setHref(FileUtils.getWayTo(albumsHtml, singleAlbumHtml));
String albumName = albumsProps.getProperty(AlbumInfoKey.NAME.toString());
String desc = albumsProps.getProperty(AlbumInfoKey.DESCRIPTION.toString());
P textBelow = new P();
if (albumName != null)
textBelow.appendText(albumName);
if (desc != null)
textBelow.appendText("<br/>" + desc);
innerItem.appendChild(textBelow);
item.appendChild(albumLink);
albumlist.appendChild(item);
genAlbum(albumsProps, albumProps, singleAlbumHtml, root);
}
albumContainer.appendChild(albumlist);
albums.body.appendChild(albumContainer);
writeDocument(albums, albumsHtml);
}
示例9: genAlbum
import com.hp.gagawa.java.DocumentType; //导入依赖的package包/类
private void genAlbum(Properties albumProps, File albumXml, File albumHtml, File root)
{
Document albumFile = new Document(DocumentType.HTMLTransitional);
File photoHtmlContainer = albumHtml.getParentFile();
if (!photoHtmlContainer.exists())
photoHtmlContainer.mkdirs();
File coverXml = FileUtils.resolveRelativePath(FileUtils.resolveRelativePath(albumXml, albumProps.getProperty(AlbumInfoKey.PHOTO_DIR.toString()) + "/" + albumProps.getProperty(AlbumInfoKey.COVER_PHOTO_ID.toString())), albumProps.getProperty(AlbumInfoKey.PHOTO_INFO.toString()));
Properties coverProps = loadProperties(coverXml);
File cover = FileUtils.resolveRelativePath(coverXml, coverProps.getProperty(PhotoInfoKey.FILE.toString()));
albumFile = initDocumentHeader(albumFile, albumProps.getProperty(AlbumInfoKey.NAME.toString(), "Album"), albumHtml, cover, root, true);
Div photoContainer = new Div();
photoContainer.setCSSClass("picture_container");
Ul photoList = new Ul();
for (File photoFolder : FileUtils.resolveRelativePath(albumXml, albumProps.getProperty(AlbumInfoKey.PHOTO_DIR.toString())).listFiles())
{
File photoXml = FileUtils.resolveRelativePath(photoFolder, albumProps.getProperty(AlbumInfoKey.PHOTO_INFO.toString()));
Properties photoProps = loadProperties(photoXml);
Li photoItem = new Li();
A photoLink = new A();
File photoHtml = new File("" + albumHtml.getParentFile() + "/" + photoProps.getProperty(PhotoInfoKey.ID.toString()) + ".html");
photoLink.setHref(FileUtils.getWayTo(albumHtml, photoHtml));
Div innerItem = new Div().setCSSClass("album_picture");
String relativePhoto = FileUtils.getWayTo(albumHtml, FileUtils.resolveRelativePath(photoXml, photoProps.getProperty(PhotoInfoKey.FILE.toString())));
innerItem.appendChild(new Img("Photo", relativePhoto));
innerItem.appendChild(new P().appendText("Likes: " + photoProps.getProperty(PhotoInfoKey.LIKES.toString())));
photoLink.appendChild(innerItem);
photoItem.appendChild(photoLink);
photoList.appendChild(photoItem);
ArrayList<Node> commentNodes = new ArrayList<>();
File comments = new File("" + photoXml.getParentFile() + "/" + photoProps.getProperty(PhotoInfoKey.COMMENT_DIR.toString()));
if (comments.exists())
for (File f : comments.listFiles())
commentNodes.add(genComment(f, photoHtml));
genPhotoFile(photoProps, photoHtml, photoXml, root, commentNodes.toArray(new Node[commentNodes.size()]));
}
Div sideInfos = new Div();
sideInfos.setCSSClass("sidebar");
sideInfos.appendChild(wrapInfos(AlbumInfoKey.values(), albumProps, true));
photoContainer.appendChild(photoList);
albumFile.body.appendChild(sideInfos);
albumFile.body.appendChild(photoContainer);
writeDocument(albumFile, albumHtml);
}
示例10: Doctype
import com.hp.gagawa.java.DocumentType; //导入依赖的package包/类
public Doctype(DocumentType spec){
super("!DOCTYPE");
this.spec = spec;
}