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

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

java 1次浏览

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

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

示例1: processQuotes

点赞 3

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

示例2: setValue

点赞 2

import cz.vutbr.web.css.TermString; //导入依赖的package包/类
@Override
public TermString setValue(String value) {
	if (value == null) {
		throw new IllegalArgumentException(
				"Invalid value for TermString(null)");
	}
	/* This should be done by parser
	value = value.replaceAll("^'", "")
		.replaceAll("^\"", "")
		.replaceAll("'$", "")
		.replaceAll("\"$", "");
	*/	
	this.value = value;
	return this;
}
 

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

示例3: checkForFormat

点赞 2

import cz.vutbr.web.css.TermString; //导入依赖的package包/类
private String checkForFormat(Term<?> term)
{
    if (term instanceof TermFunction && term.getOperator() == Operator.SPACE)
    {
        final TermFunction fn = (TermFunction) term;
        if (fn.getFunctionName().equalsIgnoreCase("format") && fn.size() == 1 && fn.get(0) instanceof TermString)
        {
            return ((TermString) fn.get(0)).getValue();
        }
        else
            return null;
    }
    else
        return null;
}
 

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

示例4: createPseudoElement

点赞 2

import cz.vutbr.web.css.TermString; //导入依赖的package包/类
/**
 * Creates a new box for a pseudo-element.
 * @param box the parent box of the pseudo element
 * @param pseudo The pseudo element name
 * @return A new box of a subclass of ElementBox based on the value of the 'display' CSS property
 */
private Node createPseudoElement(ElementBox box, Selector.PseudoDeclaration pseudo) 
{
    Element n = box.getElement();
    //New box style
    NodeData style = decoder.getElementStyleInherited(n, pseudo);
    if (style != null)
    {
        TermList cont = style.getValue(TermList.class, "content");
        if (cont != null && cont.size() > 0)
        {
            //create the DOM tree for the pseudo element
            //parent
            Element pelem = createAnonymousElement(n.getOwnerDocument(), "XPspan", "inline"); 
            //content elements
            for (Term<?> c : cont)
            {
                if (c instanceof TermIdent)
                {
                }
                else if (c instanceof TermString)
                {
                    Text txt = n.getOwnerDocument().createTextNode(((TermString) c).getValue());
                    pelem.appendChild(txt);
                }
                else if (c instanceof TermURI)
                {
                }
                else if (c instanceof TermFunction)
                {
                }
            }

            //use the pseudo element style for the new (main) element
            decoder.useStyle(pelem, null, style);

            return pelem;
        }
        else
            return null; //no contents
    }
    else
        return null; //no pseudo declaration
}
 

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

示例5: createString

点赞 2

import cz.vutbr.web.css.TermString; //导入依赖的package包/类
public TermString createString(String value) {
	return (new TermStringImpl()).setValue(value);
}
 

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

示例6: processContent

点赞 2

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

	// content contains no explicit values
	if (d.size() == 1 && genericOneIdent(Content.class, d, properties)) {
		return true;
	} else {

		// valid term idents
		final Set<String> validTermIdents = new HashSet<String>(Arrays
				.asList("open-quote", "close-quote", "no-open-quote",
						"no-close-quote"));

		// valid term function names
		final Set<String> validFuncNames = new HashSet<String>(Arrays
				.asList("counter", "counters", "attr"));

		TermList list = tf.createList();

		for (Term<?> t : d.asList()) {
			// one of valid terms
			if (t instanceof TermIdent
					&& validTermIdents.contains(((TermIdent) t).getValue()
							.toLowerCase()))
				list.add(t);
			else if (t instanceof TermString)
				list.add(t);
			else if (t instanceof TermURI)
				list.add(t);
			else if (t instanceof TermFunction
					&& validFuncNames.contains(((TermFunction) t)
							.getFunctionName().toLowerCase()))
				list.add(t);
			else
				return false;
		}
		// there is nothing in list after parsing
		if (list.isEmpty())
			return false;

		properties.put("content", Content.list_values);
		values.put("content", list);
		return true;
	}
}
 

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


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