• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java VerticalAlign类的典型用法和代码示例

java 1次浏览

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

VerticalAlign类属于cz.vutbr.web.css.CSSProperty包,在下文中一共展示了VerticalAlign类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: alignBox

点赞 3

import cz.vutbr.web.css.CSSProperty.VerticalAlign; //导入依赖的package包/类
/**
 * Aligns a new box and updates the line metrics. 
 * @param box the box to be placed on the line
 * @return the Y distance of the box top content edge from top of this line box
 */
public int alignBox(Inline box)
{
	if (box instanceof InlineElement)
	{
     VerticalAlign va = ((InlineElement) box).getVerticalAlign();
     if (va == VerticalAlign.TOP)
     {
         return 0;
     }
     else if (va == VerticalAlign.BOTTOM)
     {
         return getTotalLineHeight() - ((ElementBox) box).getContentHeight() + 1;
     }
     else
     {
         return above + computeBaselineDifference((InlineElement) box) - box.getBaselineOffset() + ((InlineElement) box).getLineboxOffset();
     }
	}
	else
		return above - box.getBaselineOffset();
}
 

开发者ID:mantlik,
项目名称:swingbox-javahelp-viewer,
代码行数:27,
代码来源:LineBox.java

示例2: alignBox

点赞 3

import cz.vutbr.web.css.CSSProperty.VerticalAlign; //导入依赖的package包/类
/**
 * Aligns a new box and updates the line metrics. 
 * @param box the box to be placed on the line
 * @return the Y distance of the box top content edge from top of this line box
 */
public int alignBox(Inline box)
{
	if (box instanceof InlineElement)
	{
     VerticalAlign va = ((InlineElement) box).getVerticalAlign();
     if (va == VerticalAlign.TOP || va == VerticalAlign.BOTTOM)
     {
         return 0; //top and bottom boxes are aligned to the line box in their absolutePositions()
     }
     else
     {
         return above + computeBaselineDifference((InlineElement) box) - box.getBaselineOffset() + ((InlineElement) box).getLineboxOffset();
     }
	}
	else
		return above - box.getBaselineOffset();
}
 

开发者ID:radkovo,
项目名称:CSSBox,
代码行数:23,
代码来源:LineBox.java

示例3: alignBox

点赞 3

import cz.vutbr.web.css.CSSProperty.VerticalAlign; //导入依赖的package包/类
/**
 * Aligns a new box and updates the line metrics.
 * @param box the box to be placed on the line
 * @return the Y distance of the box top content edge from top of this line box
 */
public int alignBox(Inline box)
{
	if (box instanceof InlineElement)
	{
     VerticalAlign va = ((InlineElement) box).getVerticalAlign();
     if (va == VerticalAlign.TOP)
     {
         return 0;
     }
     else if (va == VerticalAlign.BOTTOM)
     {
         return getTotalLineHeight() - ((ElementBox) box).getContentHeight() + 1;
     }
     else
     {
         return above + computeBaselineDifference((InlineElement) box) - box.getBaselineOffset() + ((InlineElement) box).getLineboxOffset();
     }
	}
	else
		return above - box.getBaselineOffset();
}
 

开发者ID:chrimm,
项目名称:cordovastudio,
代码行数:27,
代码来源:LineBox.java

示例4: considerBox

点赞 2

import cz.vutbr.web.css.CSSProperty.VerticalAlign; //导入依赖的package包/类
public void considerBox(Inline box)
{
    if (((Box) box).isDisplayed())
    {
        int a = box.getBaselineOffset();
        int b = box.getBelowBaseline();
    	if (box instanceof InlineElement)
    	{
	        VerticalAlign va = ((InlineElement) box).getVerticalAlign();
	        if (va != VerticalAlign.TOP && va != VerticalAlign.BOTTOM) //the box influences 'a' and 'b'
	        {
	            int dif = computeBaselineDifference((InlineElement) box);
	            a -= dif; //what from the box is above our baseline
	            b += dif; //what from the box is below
	            above = Math.max(above, a);
	            below = Math.max(below, b);
	        }
    	}
    	else
    	{
	        above = Math.max(above, a);
	        below = Math.max(below, b);
    	}

    	maxlineheight = Math.max(maxlineheight, box.getMaxLineHeight());
    }
}
 

开发者ID:mantlik,
项目名称:swingbox-javahelp-viewer,
代码行数:28,
代码来源:LineBox.java

示例5: processVerticalAlign

点赞 2

import cz.vutbr.web.css.CSSProperty.VerticalAlign; //导入依赖的package包/类
@SuppressWarnings("unused")
private boolean processVerticalAlign(Declaration d,
		Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
	return genericOneIdentOrLengthOrPercent(VerticalAlign.class,
			VerticalAlign.length, VerticalAlign.percentage, false, d,
			properties, values);
}
 

开发者ID:mantlik,
项目名称:swingbox-javahelp-viewer,
代码行数:8,
代码来源:DeclarationTransformer.java

示例6: considerBox

点赞 2

import cz.vutbr.web.css.CSSProperty.VerticalAlign; //导入依赖的package包/类
/**
 * Updates the line box sizes according to a new inline box.
 * @param box the new box
 */
public void considerBox(Inline box)
{
    if (((Box) box).isDisplayed() && !box.collapsedCompletely())
    {
        int a = box.getBaselineOffset();
        int b = box.getBelowBaseline();
    	if (box instanceof InlineElement)
    	{
	        VerticalAlign va = ((InlineElement) box).getVerticalAlign();
	        if (va != VerticalAlign.TOP && va != VerticalAlign.BOTTOM) //the box influences 'a' and 'b'
	        {
	            int dif = computeBaselineDifference((InlineElement) box);
	            a -= dif; //what from the box is above our baseline
	            b += dif; //what from the box is below
	            above = Math.max(above, a);
	            below = Math.max(below, b);
	            maxAlignedHeight = Math.max(maxAlignedHeight, box.getMaxLineHeight());
	        }
	        else if (va == VerticalAlign.BOTTOM)
	            heightFromBottom = Math.max(heightFromBottom, box.getMaxLineHeight());
    	}
    	else
    	{
	        above = Math.max(above, a);
	        below = Math.max(below, b);
            maxAlignedHeight = Math.max(maxAlignedHeight, box.getMaxLineHeight());
    	}
    	
        maxBoxHeight = Math.max(maxBoxHeight, box.getMaxLineHeight());
    }
}
 

开发者ID:radkovo,
项目名称:CSSBox,
代码行数:36,
代码来源:LineBox.java

示例7: computeBaselineDifference

点赞 2

import cz.vutbr.web.css.CSSProperty.VerticalAlign; //导入依赖的package包/类
/** 
 * Computes the difference between the box baseline and our baseline according to the vertical alignment of the box.
 * @param box The box whose baseline should be considered
 * @return the vertical difference betweein baselines, positive dif means the box baseline is below our baseline 
 */
private int computeBaselineDifference(InlineElement box)
{
    int a = box.getBaselineOffset();
    int b = box.getBelowBaseline();
    CSSProperty.VerticalAlign va = box.getVerticalAlign();
    
    int dif = 0;

    if (va == CSSProperty.VerticalAlign.BASELINE)
        dif = 0; //just sits on the baseline
    else if (va == CSSProperty.VerticalAlign.MIDDLE)
    {
        int midbox = box.getLineHeight() / 2;
        int halfex = (int) Math.round(parent.getVisualContext().getEx() / 2);
        //int na = midbox + halfex;
        dif = midbox - halfex;
    }
    else if (va == CSSProperty.VerticalAlign.SUB)
        dif = (int) Math.round(0.3 * parent.getLineHeight());
    else if (va == CSSProperty.VerticalAlign.SUPER)
        dif = - (int) Math.round(0.3 * parent.getLineHeight());  
    else if (va == CSSProperty.VerticalAlign.TEXT_TOP)
    {
        int na = parent.getVisualContext().getBaselineOffset();
        dif = a - na;
    }
    else if (va == CSSProperty.VerticalAlign.TEXT_BOTTOM)
    {
        int nb = parent.getVisualContext().getFontHeight() - parent.getVisualContext().getBaselineOffset();
        dif = nb - b;
    }
    else if (va == CSSProperty.VerticalAlign.length || va == CSSProperty.VerticalAlign.percentage)
    {
        CSSDecoder dec = new CSSDecoder(((ElementBox) box).getVisualContext());
        int len = dec.getLength(((ElementBox) box).getLengthValue("vertical-align"), false, 0, 0, box.getLineHeight());
        dif = -len;
    }
    return dif;
}
 

开发者ID:radkovo,
项目名称:CSSBox,
代码行数:45,
代码来源:LineBox.java

示例8: processVerticalAlign

点赞 2

import cz.vutbr.web.css.CSSProperty.VerticalAlign; //导入依赖的package包/类
@SuppressWarnings("unused")
private boolean processVerticalAlign(Declaration d,
		Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
	return genericOneIdentOrLengthOrPercent(VerticalAlign.class,
			VerticalAlign.length, VerticalAlign.percentage, ValueRange.ALLOW_ALL, d,
			properties, values);
}
 

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


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)