当前位置: 首页>>代码示例>>Java>>正文


Java CSSFactory.createNodeData方法代码示例

本文整理汇总了Java中cz.vutbr.web.css.CSSFactory.createNodeData方法的典型用法代码示例。如果您正苦于以下问题:Java CSSFactory.createNodeData方法的具体用法?Java CSSFactory.createNodeData怎么用?Java CSSFactory.createNodeData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cz.vutbr.web.css.CSSFactory的用法示例。


在下文中一共展示了CSSFactory.createNodeData方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAnonymousStyle

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
/**
 * Creates the style definition for an anonymous box. It contains only the class name set to "Xanonymous"
 * and the display: property set according to the parametres.
 * @param display <code>display:</code> property value of the resulting style.
 * @return Resulting style definition
 */
public NodeData createAnonymousStyle(String display)
{
    NodeData ret = CSSFactory.createNodeData();
    
    Declaration cls = CSSFactory.getRuleFactory().createDeclaration();
    cls.unlock();
    cls.setProperty("class");
    cls.add(CSSFactory.getTermFactory().createString("Xanonymous"));
    ret.push(cls);
    
    Declaration disp = CSSFactory.getRuleFactory().createDeclaration();
    disp.unlock();
    disp.setProperty("display");
    disp.add(CSSFactory.getTermFactory().createIdent(display));
    ret.push(disp);
    
    return ret;
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:25,代码来源:BoxFactory.java

示例2: getElementStyle

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
/**
 * Computes the style of an element with an eventual pseudo element for the given media.
 * @param el The DOM element.
 * @param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after).
 * @param media Used media name (e.g. "screen" or "all")
 * @return The relevant declarations from the registered style sheets.
 */
public NodeData getElementStyle(Element el, PseudoDeclaration pseudo, String media)
{
    Holder holder;
    if (UNIVERSAL_HOLDER.equals(media)) 
        holder = rules.get(UNIVERSAL_HOLDER);
    else 
        holder = Holder.union(rules.get(UNIVERSAL_HOLDER), rules.get(media));
    
    List<Declaration> decls = getDeclarationsForElement(el, pseudo, holder);
    
    NodeData main = CSSFactory.createNodeData();
    for (Declaration d : decls)
        main.push(d);
    
    return main;
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:24,代码来源:DirectAnalyzer.java

示例3: Viewport

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
/**
    * Creates a new Viewport with the given initial size. The actual size may be increased during the layout. 
    *  
    * @param e The anonymous element representing the viewport.
    * @param g 
    * @param ctx
    * @param factory The factory used for creating the child boxes.
    * @param root The root element of the rendered document.
    * @param width Preferred (minimal) width.
    * @param height Preferred (minimal) height.
    */
   public Viewport(Element e, Graphics2D g, VisualContext ctx, BoxFactory factory, Element root, int width, int height)
{
	super(e, g, ctx);
	ctx.setViewport(this);
	this.factory = factory;
	this.root = root;
	style = CSSFactory.createNodeData(); //Viewport starts with an empty style
       nested = new Vector<Box>();
       startChild = 0;
       endChild = 0;
	this.width = width;
	this.height = height;
       isblock = true;
       contblock = true;
       root = null;
       visibleRect = new Rectangle(0, 0, width, height);
}
 
开发者ID:radkovo,项目名称:CSSBox,代码行数:29,代码来源:Viewport.java

示例4: Viewport

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
/**
 * Creates a new Viewport with the given initial size. The actual size may be increased during the layout.
 *
 * @param e       The anonymous element representing the viewport.
 * @param g
 * @param ctx
 * @param factory The factory used for creating the child boxes.
 * @param root    The root element of the rendered document.
 * @param width   Preferred (minimal) width.
 * @param height  Preferred (minimal) height.
 */
public Viewport(HtmlTag e, Graphics2D g, VisualContext ctx, BoxFactory factory, HtmlTag root, int width, int height) {
    super(e, g, ctx);
    ctx.setViewport(this);
    this.factory = factory;
    this.root = root;
    style = CSSFactory.createNodeData(); //Viewport starts with an empty style
    nested = new Vector<Box>();
    startChild = 0;
    endChild = 0;
    this.width = width;
    this.height = height;
    isblock = true;
    contblock = true;
    root = null;
    viewInfo = new ViewInfo("viewport", e, 0, 0, width, height);
    viewInfo.setChildren(new ArrayList<>());
    viewInfo.setExtendedInfo(0, 0, 0, 0, 0);
    visibleRect = new Rectangle(0, 0, width, height);
}
 
开发者ID:chrimm,项目名称:cordovastudio,代码行数:31,代码来源:Viewport.java

示例5: Viewport

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
public Viewport(Element e, Graphics2D g, VisualContext ctx, BoxFactory factory, Element root, int width, int height)
{
	super(e, g, ctx);
	this.factory = factory;
	this.root = root;
	style = CSSFactory.createNodeData(); //Viewport starts with an empty style
       nested = new Vector<Box>();
       startChild = 0;
       endChild = 0;
	this.width = width;
	this.height = height;
       isblock = true;
       contblock = true;
       root = null;
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:16,代码来源:Viewport.java

示例6: createBlockStyle

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
/**
 * Creates an empty block style definition.
 * @return 
 */
protected NodeData createBlockStyle()
{
    NodeData ret = CSSFactory.createNodeData();
    TermFactory tf = CSSFactory.getTermFactory();
    ret.push(createDeclaration("display", tf.createIdent("block")));
    return ret;
}
 
开发者ID:radkovo,项目名称:Pdf2Dom,代码行数:12,代码来源:CSSBoxTree.java

示例7: createLineStyle

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
protected NodeData createLineStyle(float x1, float y1, float x2, float y2)
{
    HtmlDivLine line = new HtmlDivLine(x1, y1, x2, y2);
    String bside = line.getBorderSide();

    NodeData ret = CSSFactory.createNodeData();
    TermFactory tf = CSSFactory.getTermFactory();
    ret.push(createDeclaration("position", tf.createIdent("absolute")));
    ret.push(createDeclaration("position", tf.createIdent("absolute")));
    ret.push(createDeclaration("left", tf.createLength(line.getLeft(), unit)));
    ret.push(createDeclaration("top", tf.createLength(line.getTop(), unit)));
    ret.push(createDeclaration("width", tf.createLength(line.getWidth(), unit)));
    ret.push(createDeclaration("height", tf.createLength((float) line.getHeight(), unit)));
    ret.push(createDeclaration(bside + "-width", tf.createLength(line.getLineStrokeWidth(), unit)));
    ret.push(createDeclaration(bside + "-style", tf.createIdent("solid")));
    String color = colorString(getGraphicsState().getStrokingColor());
    ret.push(createDeclaration(bside + "-color", tf.createColor(color)));

    if (line.getAngleDegrees() != 0)
    {
        TermFunction rotate = tf.createFunction();
        rotate.setFunctionName("rotate").add(tf.createAngle(String.valueOf(line.getAngleDegrees()), Unit.deg, 1));
        ret.push(createDeclaration("transform", rotate));
    }

    return ret;
}
 
开发者ID:radkovo,项目名称:Pdf2Dom,代码行数:28,代码来源:CSSBoxTree.java

示例8: makeNodeData

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
static NodeData makeNodeData(final List<Declaration> decls)
{
	final NodeData main = CSSFactory.createNodeData();
       for (final Declaration d : decls)
           main.push(d);
       
       return main;
}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:9,代码来源:AnalyzerUtil.java

示例9: createDataInstance

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@Override
protected NodeData createDataInstance()
{
	return CSSFactory.createNodeData();
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:6,代码来源:StyleMap.java

示例10: createTextStyle

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
/**
   * Creates the style declaration for a text box based on the given {@link BoxStyle} structure.
   * @param style The source box style.
   * @return The element style definition.
   */
  protected NodeData createTextStyle(BoxStyle style, float width)
  {
      NodeData ret = CSSFactory.createNodeData();
      TermFactory tf = CSSFactory.getTermFactory();
      ret.push(createDeclaration("position", tf.createIdent("absolute")));
      ret.push(createDeclaration("overflow", tf.createIdent("hidden")));
      ret.push(createDeclaration("left", tf.createLength(style.getLeft(), unit)));
      ret.push(createDeclaration("top", tf.createLength(style.getTop(), unit)));
      ret.push(createDeclaration("line-height", tf.createLength(style.getLineHeight(), unit)));
      if (style.getFontFamily() != null)
          ret.push(createDeclaration("font-family", tf.createString(style.getFontFamily())));
      if (style.getFontSize() != 0)
      {
          float size = (float) style.getFontSize();
          if (style.getFontFamily() == null)
              size = size * unknownFontScale;
          ret.push(createDeclaration("font-size", tf.createLength(size, unit)));
      }
      if (style.getFontWeight() != null)
          ret.push(createDeclaration("font-weight", tf.createIdent(style.getFontWeight())));
      if (style.getFontStyle() != null)
          ret.push(createDeclaration("font-style", tf.createIdent(style.getFontStyle())));
      if (style.getWordSpacing() != 0)
          ret.push(createDeclaration("word-spacing", tf.createLength((float) style.getWordSpacing(), unit)));
      if (style.getLetterSpacing() != 0)
          ret.push(createDeclaration("letter-spacing", tf.createLength((float) style.getLetterSpacing(), unit)));
      if (style.getColor() != null)
      {
          String fillColor = style.getColor();

          // text stroke css attrs don't render atm but can use stroke as fall back for fill if fill is transparent
          boolean hasStrokeColor = style.getStrokeColor() != null && fillColor.equals(transparentColor);
          if (fillColor.equals(transparentColor) && hasStrokeColor)
              fillColor = style.getStrokeColor();

          ret.push(createDeclaration("color", createTermColor(fillColor)));
      }

ret.push(createDeclaration("width", tf.createLength(width, unit)));

      return ret;
  }
 
开发者ID:radkovo,项目名称:Pdf2Dom,代码行数:48,代码来源:CSSBoxTree.java

示例11: createDataInstance

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
@Override
protected NodeData createDataInstance() {
    return CSSFactory.createNodeData();
}
 
开发者ID:chrimm,项目名称:cordovastudio,代码行数:5,代码来源:StyleMap.java

示例12: memoryUsage

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
private long memoryUsage(Class<? extends NodeData> clazz) throws Exception {

		final int SAMPLE = 100;

		CSSFactory.registerNodeDataInstance(clazz);

		Object[] holder = new Object[SAMPLE];

		@SuppressWarnings("unused")
		Object throwAway = clazz.newInstance();

		long memoryUsageBefore, memoryUsageAfter;
		int i = 0;

		memoryUsageBefore = memoryUsage();
		for (i = 0; i < SAMPLE; i++)
			holder[i] = CSSFactory.createNodeData();
		memoryUsageAfter = memoryUsage();

		return Math.round((memoryUsageAfter - memoryUsageBefore)
				/ ((float) SAMPLE));

	}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:24,代码来源:NodeDataVariantTest.java

示例13: timeUsage

import cz.vutbr.web.css.CSSFactory; //导入方法依赖的package包/类
private long timeUsage(Class<? extends NodeData> clazz) throws Exception {

		final int SAMPLE = 100000;

		CSSFactory.registerNodeDataInstance(clazz);

		long timeBefore = System.currentTimeMillis();
		for (int i = 0; i < SAMPLE; i++)
			CSSFactory.createNodeData();
		long timeAfter = System.currentTimeMillis();

		return timeAfter - timeBefore;
	}
 
开发者ID:radkovo,项目名称:jStyleParser,代码行数:14,代码来源:NodeDataVariantTest.java


注:本文中的cz.vutbr.web.css.CSSFactory.createNodeData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。