本文整理汇总了Java中org.fit.cssbox.layout.BlockReplacedBox类的典型用法代码示例。如果您正苦于以下问题:Java BlockReplacedBox类的具体用法?Java BlockReplacedBox怎么用?Java BlockReplacedBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockReplacedBox类属于org.fit.cssbox.layout包,在下文中一共展示了BlockReplacedBox类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BlockReplacedBoxView
import org.fit.cssbox.layout.BlockReplacedBox; //导入依赖的package包/类
/**
* Instantiates a new block replaced box view.
*
* @param elem
* the element
*/
public BlockReplacedBoxView(Element elem)
{
// bonus : spravit klikaciu mapu :)
super(elem);
content = ((BlockReplacedBox) box).getContentObj();
if (content instanceof ReplacedImage)
{
repImage = (ReplacedImage) content;
}
else
{
repImage = null;
}
loadElementAttributes();
}
示例2: buildBlockReplacedBox
import org.fit.cssbox.layout.BlockReplacedBox; //导入依赖的package包/类
private void buildBlockReplacedBox(List<ElementSpec> elements, BlockReplacedBox box)
{
// some content
org.w3c.dom.Element elem = box.getElement();
String text = "";
// add some textual info, if picture
if ("img".equalsIgnoreCase(elem.getTagName()))
{
text = " [" + elem.getAttribute("alt") + " Location: "
+ elem.getAttribute("src") + "] ";
}
MutableAttributeSet attr = new SimpleAttributeSet();
attr.addAttribute(SwingBoxDocument.ElementNameAttribute, Constants.BLOCK_REPLACED_BOX);
attr.addAttribute(Constants.ATTRIBUTE_BOX_REFERENCE, box);
attr.addAttribute(Constants.ATTRIBUTE_ANCHOR_REFERENCE, new Anchor());
attr.addAttribute(Constants.ATTRIBUTE_REPLACED_CONTENT,
box.getContentObj());
elements.add(new ElementSpec(attr, ElementSpec.ContentType, text.toCharArray(), 0, text.length()));
}
示例3: buildReplacedBox
import org.fit.cssbox.layout.BlockReplacedBox; //导入依赖的package包/类
private SimpleAttributeSet buildReplacedBox(ReplacedBox box)
{
SimpleAttributeSet attr = new SimpleAttributeSet();
if (box instanceof BlockReplacedBox)
attr.addAttribute(SwingBoxDocument.ElementNameAttribute, Constants.BLOCK_REPLACED_BOX);
else if (box instanceof InlineBlockReplacedBox)
attr.addAttribute(SwingBoxDocument.ElementNameAttribute, Constants.INLINE_BLOCK_REPLACED_BOX);
else
attr.addAttribute(SwingBoxDocument.ElementNameAttribute, Constants.INLINE_REPLACED_BOX);
attr.addAttribute(Constants.ATTRIBUTE_BOX_REFERENCE, box);
attr.addAttribute(Constants.ATTRIBUTE_ANCHOR_REFERENCE, new Anchor());
attr.addAttribute(Constants.ATTRIBUTE_REPLACED_CONTENT, box.getContentObj());
return attr;
}
示例4: buildElements
import org.fit.cssbox.layout.BlockReplacedBox; //导入依赖的package包/类
private void buildElements(List<ElementSpec> elements, ElementBox box)
{
Box tmp;
int total = box.getEndChild();
for (int i = box.getStartChild(); i < total; i++)
{
tmp = box.getSubBox(i);
if (tmp instanceof TextBox)
{ // -- text box
buildText(elements, (TextBox) tmp);
}
else if (tmp instanceof InlineReplacedBox)
{ // -- inline boxes
buildInlineReplacedBox(elements, (InlineReplacedBox) tmp);
}
else if (tmp instanceof InlineBox)
{
buildInlineBox(elements, (InlineBox) tmp);
}
else if (tmp instanceof Viewport)
{ // -- the boxes
buildViewport(elements, (Viewport) tmp);
}
else if (tmp instanceof BlockReplacedBox)
{
buildBlockReplacedBox(elements, (BlockReplacedBox) tmp);
}
else if (tmp instanceof TableBox)
{ // -- tables
buildTableBox(elements, (TableBox) tmp);
}
else if (tmp instanceof TableCaptionBox)
{
buildTableCaptionBox(elements, (TableCaptionBox) tmp);
}
else if (tmp instanceof TableBodyBox)
{
buildTableBodyBox(elements, (TableBodyBox) tmp);
}
else if (tmp instanceof TableRowBox)
{
buildTableRowBox(elements, (TableRowBox) tmp);
}
else if (tmp instanceof TableCellBox)
{
buildTableCellBox(elements, (TableCellBox) tmp);
}
else if (tmp instanceof TableColumnGroup)
{
buildTableColumnGroup(elements, (TableColumnGroup) tmp);
}
else if (tmp instanceof TableColumn)
{
buildTableColumn(elements, (TableColumn) tmp);
}
else if (tmp instanceof BlockTableBox)
{
buildBlockTableBox(elements, (BlockTableBox) tmp);
}
else if (tmp instanceof ListItemBox)
{
buildListItemBox(elements, (ListItemBox) tmp);
}
else if (tmp instanceof BlockBox)
{
buildBlockBox(elements, (BlockBox) tmp);
}
else
{
// todo log this !
System.err.println("Unknowen BOX : " + tmp.getClass().getName());
}
}
}