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


Java Declaration类代码示例

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


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

示例1: createAnonymousStyle

import cz.vutbr.web.css.Declaration; //导入依赖的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: prepareRuleMargin

import cz.vutbr.web.css.Declaration; //导入依赖的package包/类
public RuleMargin prepareRuleMargin(String area, List<Declaration> decl) {

        if ((decl == null || decl.isEmpty()))
        {
            log.debug("Empty RuleMargin was ommited");
            return null;
        }

        Priority prio = ps.getAndIncrement();
        RuleMargin rm = rf.createMargin(area, prio);
        rm.replaceAll(decl);

        log.info("Create @" + area + " as " + prio + "th with:\n" + rm);

        return rm;
    }
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:17,代码来源:SimplePreparator.java

示例3: prepareInlineRuleSet

import cz.vutbr.web.css.Declaration; //导入依赖的package包/类
public RuleBlock<?> prepareInlineRuleSet(List<Declaration> dlist,
		List<PseudoPage> pseudos) {

	if(dlist==null || dlist.isEmpty()) {
		log.debug("Empty RuleSet (inline) was ommited");
		return null;
	}
	
	// create selector with element
	CombinedSelector cs = (CombinedSelector) rf.createCombinedSelector()
			.unlock();
	Selector sel = (Selector) rf.createSelector().unlock();
	sel.add(rf.createElementDOM(elem, inlinePriority));
	if(pseudos!=null) sel.addAll(pseudos);
	cs.add(sel);
	
	Priority prio = ps.getAndIncrement();
	RuleSet rs = rf.createSet(prio);
	rs.replaceAll(dlist);
	rs.setSelectors(Arrays.asList(cs));
	
	log.info("Create @media as {}th with:\n{}", prio, rs);
	
	return (RuleBlock<?>) rs;
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:26,代码来源:SimplePreparator.java

示例4: processAdditionalCSSGenericProperty

import cz.vutbr.web.css.Declaration; //导入依赖的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

示例5: tryOneTermVariant

import cz.vutbr.web.css.Declaration; //导入依赖的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

示例6: parsingMethods

import cz.vutbr.web.css.Declaration; //导入依赖的package包/类
protected Map<String, Method> parsingMethods() {

		Map<String, Method> map = new HashMap<String, Method>(css
				.getTotalProperties(), 1.0f);

		for (String key : css.getDefinedPropertyNames()) {
			try {
				Method m = DeclarationTransformer.class.getDeclaredMethod(
						DeclarationTransformer.camelCase("process-" + key),
						Declaration.class, Map.class, Map.class);
				map.put(key, m);
			} catch (Exception e) {
				log.warn("Unable to find method for property {}.", key);
			}
		}
		log.info("Totally found {} parsing methods", map.size());
		return map;
	}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:19,代码来源:DeclarationTransformer.java

示例7: processQuotes

import cz.vutbr.web.css.Declaration; //导入依赖的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: push

import cz.vutbr.web.css.Declaration; //导入依赖的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;
	
	this.propertiesOwn.putAll(properties);
	
	// remove operators from terms
	for(Entry<String,Term<?>> entry: terms.entrySet()) {
		entry.getValue().setOperator(null);
		valuesOwn.put(entry.getKey(), entry.getValue());
	}
	
	return this;
	
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:24,代码来源:QuadrupleMapNodeData.java

示例9: compareTo

import cz.vutbr.web.css.Declaration; //导入依赖的package包/类
/**
 * This declaration type is not about to be compared
 * using precise conditions
 */
public int compareTo(Declaration o) {
	
	if(this.isImportant() && ! o.isImportant())
           return 1;
       else if(o.isImportant() && ! this.isImportant())
           return -1;
	
	return 0;
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:14,代码来源:DeclarationImpl.java

示例10: processOutlineWidth

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

示例11: prepareRuleViewport

import cz.vutbr.web.css.Declaration; //导入依赖的package包/类
public RuleBlock<?> prepareRuleViewport(List<Declaration> decl) {

        if (decl == null || decl.isEmpty()) {
            log.debug("Empty Viewport was ommited");
            return null;
        }

        Priority prio = ps.getAndIncrement();
        RuleViewport rp = rf.createViewport(prio);
        rp.replaceAll(decl);
        log.info("Create @viewport as {}th with:\n{}", prio, rp);

        return (RuleBlock<?>) rp;
    }
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:15,代码来源:SimplePreparator.java

示例12: prepareRuleFontFace

import cz.vutbr.web.css.Declaration; //导入依赖的package包/类
public RuleBlock<?> prepareRuleFontFace(List<Declaration> decl) {

        if (decl == null || decl.isEmpty()) {
            log.debug("Empty RuleFontFace was ommited");
            return null;
        }

        Priority prio = ps.getAndIncrement();
        RuleFontFace rp = rf.createFontFace(prio);
        rp.replaceAll(decl);
        log.info("Create @font-face as {}th with:\n{}", prio, rp);

        return (RuleBlock<?>) rp;
    }
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:15,代码来源:SimplePreparator.java

示例13: add

import cz.vutbr.web.css.Declaration; //导入依赖的package包/类
@Override
public boolean add(Rule<?> element) {
	if (element instanceof Declaration || element instanceof RuleMargin)
		return super.add(element);
	else
		throw new IllegalArgumentException("Element must be either a Declaration or a RuleMargin");
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:8,代码来源:RulePageImpl.java

示例14: genericOneIdentOrInteger

import cz.vutbr.web.css.Declaration; //导入依赖的package包/类
protected <T extends CSSProperty> boolean genericOneIdentOrInteger(
		Class<T> type, T integerIdentification, boolean sanify,
		Declaration d, Map<String, CSSProperty> properties,
		Map<String, Term<?>> values) {

	if (d.size() != 1)
		return false;

	return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(),
			properties)
			|| genericTerm(TermInteger.class, d.get(0), d.getProperty(),
					integerIdentification, sanify, properties, values);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:14,代码来源:DeclarationTransformer.java

示例15: genericOneIdentOrIntegerOrNumber

import cz.vutbr.web.css.Declaration; //导入依赖的package包/类
protected <T extends CSSProperty> boolean genericOneIdentOrIntegerOrNumber(
        Class<T> type, T integerIdentification, T numberIdentification, boolean sanify,
        Declaration d, Map<String, CSSProperty> properties,
        Map<String, Term<?>> values) {

    if (d.size() != 1)
        return false;

    return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(), properties)
            || genericTerm(TermInteger.class, d.get(0), d.getProperty(),
                    integerIdentification, sanify, properties, values)
            || genericTerm(TermNumber.class, d.get(0), d.getProperty(),
                    numberIdentification, sanify, properties, values);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:15,代码来源:DeclarationTransformer.java


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