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


Java CSSProperty类代码示例

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


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

示例1: operation

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
@Override
protected boolean operation(int i, Map<String, CSSProperty> properties,
		Map<String, Term<?>> values) {

	final Set<Clip> allowedClips = EnumSet.of(Clip.AUTO);

	Clip clip = null;

	if (terms.get(i) instanceof TermIdent
			&& (clip = genericPropertyRaw(Clip.class, allowedClips,
					(TermIdent) terms.get(i))) != null) {
		properties.put(names.get(i), clip);
		return true;
	} else
		return genericTermLength(terms.get(i),
				names.get(i), Clip.rect, false, properties, values);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:18,代码来源:DeclarationTransformer.java

示例2: setParent

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
@Override
public void setParent(ElementBox parent)
{
    super.setParent(parent);
    if (getParent() != null)
    {
        //load the relevant style values
        transform = getParent().getStyle().getProperty("text-transform");
        if (transform == null)
            transform = TextTransform.NONE;
        //reset the whitespace processing according to the parent settings
        CSSProperty.WhiteSpace ws = getParent().getWhiteSpace();
        if (ws != ElementBox.WHITESPACE_NORMAL || transform != TextTransform.NONE)
            setWhiteSpace(ws);
    }
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:17,代码来源:TextBox.java

示例3: getProperty

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
public <T extends CSSProperty> T getProperty(String name,
		boolean includeInherited) {
	
	Quadruple q = map.get(name);
	if(q==null) return null;
	
	CSSProperty tmp;
	
	if(includeInherited) {
		if(q.curProp!=null) tmp = q.curProp;
		else tmp = q.inhProp;
	}
	else {
		tmp = q.curProp;
	}
	
	// this will cast to inferred type
	// if there is no inferred type, cast to CSSProperty is safe
	// otherwise the possibility having wrong left side of assignment
	// is roughly the same as use wrong dynamic class cast 
	@SuppressWarnings("unchecked")
	T retval = (T) tmp;
	return retval;
	
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:26,代码来源:SingleMapNodeData.java

示例4: push

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
public NodeData push(Declaration d) {
	
	Map<String,CSSProperty> properties = 
		new HashMap<String,CSSProperty>(COMMON_DECLARATION_SIZE);
	Map<String,Term<?>> terms = 
		new HashMap<String, Term<?>>(COMMON_DECLARATION_SIZE);
	
	boolean result = transformer.parseDeclaration(d, properties, terms);
	
	// in case of false do not insert anything
	if(!result) return this;
	
	for(String key: properties.keySet()) {
		Quadruple q = map.get(key);
		if(q==null) q = new Quadruple();
		q.curProp = properties.get(key);
		q.curValue = terms.get(key);
		// remove operator
		if(q.curValue!=null) q.curValue = q.curValue.setOperator(null);
		map.put(key, q);
	}
	return this;

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

示例5: createInherit

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
/**
 * Creates INHERIT value of given class
 * 
 * @param i
 *            Ordinal in list of types
 * @return Created CSSProperty with value inherit
 * @throws UnsupportedOperationException
 *             If class does not provide INHERIT or is not implementation of
 *             CSSProperty
 */
private CSSProperty createInherit(int i) {

	try {
		Class<? extends CSSProperty> clazz = types.get(i);
		CSSProperty property = CSSProperty.Translator.createInherit(clazz);
		if (property != null)
			return property;

		throw new IllegalAccessException("No inherit value for: "
				+ clazz.getName());
	} catch (Exception e) {
		throw new UnsupportedOperationException(
				"Unable to create inherit value", e);
	}

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

示例6: tryOneTermVariant

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
/**
 * Uses variator functionality to test selected variant on term
 * 
 * @param variant
 *            Which variant will be tested
 * @param d
 *            The declaration on which variant will be tested
 * @param properties
 *            Properties map where to store property type
 * @param values
 *            Values map where to store property value
 * @return <code>true</code> in case of success, <code>false</code>
 *         otherwise
 */
public boolean tryOneTermVariant(int variant, Declaration d,
		Map<String, CSSProperty> properties, Map<String, Term<?>> values) {

	// only one term is allowed
	if (d.size() != 1)
		return false;

	// try inherit variant
	if (checkInherit(variant, d.get(0), properties))
		return true;

	this.terms = new ArrayList<Term<?>>();
	this.terms.add(d.get(0));

	return variant(variant, new IntegerRef(0), properties, values);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:31,代码来源:Variator.java

示例7: processQuotes

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
@SuppressWarnings("unused")
private boolean processQuotes(Declaration d,
		Map<String, CSSProperty> properties, Map<String, Term<?>> values) {

	if (d.size() == 1
			&& genericTermIdent(Quotes.class, d.get(0), ALLOW_INH,
					"quotes", properties)) {
		return true;
	} else {
		TermList list = tf.createList();
		for (Term<?> term : d.asList()) {
			if (term instanceof TermString)
				list.add(term);
			else
				return false;
		}

		// there are pairs of quotes
		if (!list.isEmpty() && list.size() % 2 == 0) {
			properties.put("quotes", Quotes.list_values);
			values.put("quotes", list);
			return true;
		}
		return false;
	}
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:27,代码来源:DeclarationTransformer.java

示例8: getProperty

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
public <T extends CSSProperty> T getProperty(String name, boolean includeInherited) {

		CSSProperty inh = null, tmp = null;
		
		if(includeInherited) 
			inh = propertiesInh.get(name);

		tmp = propertiesOwn.get(name);
		if(tmp==null) tmp = inh;
		
		// this will cast to inferred type
		// if there is no inferred type, cast to CSSProperty is safe
		// otherwise the possibility having wrong left side of assignment
		// is roughly the same as use wrong dynamic class cast 
		@SuppressWarnings("unchecked")
		T retval = (T) tmp;
		return retval;
	}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:19,代码来源:QuadrupleMapNodeData.java

示例9: processAdditionalCSSGenericProperty

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
/**
 * Processes an unknown property and stores its value. Unknown properties containing
 * multiple values are ignored (the interpretation is not clear).
 * 
 * @param d the declaration.
 * @param properties the properties.
 * @param values the values.
 * 
 * @return <code>true</code>, if the property has been pared successfully
 */
private boolean processAdditionalCSSGenericProperty(Declaration d, Map<String, CSSProperty> properties, Map<String, Term<?>> values)
{
	if (d.size() == 1)
	{
     Term<?> term = d.get(0);
	
     if (term instanceof TermIdent)
         return genericProperty(GenericCSSPropertyProxy.class, (TermIdent) term, true, properties, d.getProperty());
     else
         return genericTerm(TermLength.class, term, d.getProperty(), null, false, properties, values)
             || genericTerm(TermPercent.class, term, d.getProperty(), null, false, properties, values)
             || genericTerm(TermInteger.class, term, d.getProperty(), null, false, properties, values)
             || genericTermColor(term, d.getProperty(), null, properties, values);
	}
	else
	{
		log.warn("Ignoring unsupported property " + d.getProperty() + " with multiple values");
		return false;
	}
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:31,代码来源:DeclarationTransformer.java

示例10: vary

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
@Override
public boolean vary(Map<String, CSSProperty> properties,
		Map<String, Term<?>> values) {

	// special check for user interface values
	// such as "caption", "icon" or "menu"
	// this will break inheritance division into distint categories,
	// so it must be reconstructed later
	if (terms.size() == 1 && terms.get(0) instanceof TermIdent) {

		if (checkInherit(ALL_VARIANTS, terms.get(0), properties))
			return true;

		return genericTermIdent(Font.class, terms.get(0), AVOID_INH,
				"font", properties);
	}
	// follow basic control flow
	return super.vary(properties, values);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:20,代码来源:DeclarationTransformer.java

示例11: processOutline

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
@SuppressWarnings("unused")
private boolean processOutline(Declaration d,
		Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
	Variator outline = new OutlineVariator();
	outline.assignTermsFromDeclaration(d);
	outline.assignDefaults(properties, values);
	return outline.vary(properties, values);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:9,代码来源:DeclarationTransformer.java

示例12: writeBorderSVG

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
protected void writeBorderSVG(ElementBox eb, int x1, int y1, int x2, int y2, String side, int width, int right, int down, PrintWriter out) throws IOException
{
    TermColor tclr = eb.getStyle().getValue(TermColor.class, "border-"+side+"-color");
    CSSProperty.BorderStyle bst = eb.getStyle().getProperty("border-"+side+"-style");
    if (tclr != null && bst != CSSProperty.BorderStyle.HIDDEN)
    {
        Color clr = tclr.getValue();
        if (clr == null) clr = Color.BLACK;

        String stroke = "";
        if (bst == CSSProperty.BorderStyle.SOLID)
        {
            stroke = "stroke-width:" + width;
        }
        else if (bst == CSSProperty.BorderStyle.DOTTED)
        {
            stroke = "stroke-width:" + width + ";stroke-dasharray:" + width + "," + width;
        }
        else if (bst == CSSProperty.BorderStyle.DASHED)
        {
            stroke = "stroke-width:" + width + ";stroke-dasharray:" + (3*width) + "," + width;
        }
        else if (bst == CSSProperty.BorderStyle.DOUBLE)
        {
            //double is not supported yet, we'll use single
            stroke = "stroke-width:" + width;
        }
        else //default or unsupported - draw a solid line
        {
            stroke = "stroke-width:" + width;
        }
        
        String coords = "M " + (x1+right) + "," + (y1+down) + " L " + (x2+right) + "," + (y2+down);
        String style = "fill:none;stroke:" + colorString(clr) + ";" + stroke;
        out.println("<path style=\"" + style + "\" d=\"" + coords + "\" />");  
    }
    
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:39,代码来源:ImageRenderer.java

示例13: computeWidthsInFlow

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
@Override
protected void computeWidthsInFlow(TermLengthOrPercent width, boolean auto, boolean exact, int contw, boolean update)
{
    //The same as for absolutely positioned boxes (shrink-to-fit or explicitely set)
    CSSDecoder dec = new CSSDecoder(ctx);
    
    if (width == null) auto = true; //no value behaves as "auto"

    boolean mleftauto = style.getProperty("margin-left") == CSSProperty.Margin.AUTO;
    TermLengthOrPercent mleft = getLengthValue("margin-left");
    boolean mrightauto = style.getProperty("margin-right") == CSSProperty.Margin.AUTO;
    TermLengthOrPercent mright = getLengthValue("margin-right");
    preferredWidth = -1;
    
    if (!widthComputed) update = false;
    
    if (auto)
    {
        if (exact) wset = false;
        if (!update)
            content.width = dec.getLength(width, auto, 0, 0, contw);
        preferredWidth = -1; //we don't prefer anything (auto width)
    }
    else
    {
        if (exact) 
        {
            wset = true;
            wrelative = width.isPercentage();
        }
        content.width = dec.getLength(width, auto, 0, 0, contw);
    }

    //auto margins are treated as zero
    margin.left = dec.getLength(mleft, mleftauto, 0, 0, contw);
    margin.right = dec.getLength(mright, mrightauto, 0, 0, contw);
    
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:39,代码来源:InlineBlockBox.java

示例14: processMaxHeight

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
@SuppressWarnings("unused")
private boolean processMaxHeight(Declaration d,
		Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
	return genericOneIdentOrLengthOrPercent(MaxHeight.class,
			MaxHeight.length, MaxHeight.percentage, true, d, properties,
			values);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:8,代码来源:DeclarationTransformer.java

示例15: setWhiteSpace

import cz.vutbr.web.css.CSSProperty; //导入依赖的package包/类
/**
 * Sets the whitespace processing for this box. The text content is then treated accordingly. The text start and text end
 * indices are reset to their initial values.
 */
public void setWhiteSpace(CSSProperty.WhiteSpace value)
{
    splitws = (value == ElementBox.WHITESPACE_NORMAL || value == ElementBox.WHITESPACE_PRE_WRAP || value== ElementBox.WHITESPACE_PRE_LINE);
    collapsews = (value == ElementBox.WHITESPACE_NORMAL || value == ElementBox.WHITESPACE_NOWRAP || value == ElementBox.WHITESPACE_PRE_LINE);
    linews = (value == ElementBox.WHITESPACE_NORMAL || value == ElementBox.WHITESPACE_NOWRAP);
    //When this is the original box, apply the whitespace. For the copied boxes, the whitespace has been already applied (they contain
    //a copy of the original, already processed content). 
    if (!splitted)
        applyWhiteSpace();
    //recompute widths (possibly different wrapping)
    computeLineLengths();
    minwidth = computeMinimalWidth();
    maxwidth = computeMaximalWidth();
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:19,代码来源:TextBox.java


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