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


Java Constants类代码示例

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


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

示例1: loadElementAttributes

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
private void loadElementAttributes()
{
    org.w3c.dom.Element elem = findAnchorElement(box.getElement());
    Map<String, String> elementAttributes = anchor.getProperties();

    if (elem != null)
    {
        anchor.setActive(true);
        elementAttributes.put(Constants.ELEMENT_A_ATTRIBUTE_HREF, elem.getAttribute("href"));
        elementAttributes.put(Constants.ELEMENT_A_ATTRIBUTE_NAME, elem.getAttribute("name"));
        elementAttributes.put(Constants.ELEMENT_A_ATTRIBUTE_TITLE, elem.getAttribute("title"));
        String target = elem.getAttribute("target");
        if ("".equals(target))
        {
            target = "_self";
        }
        elementAttributes.put(Constants.ELEMENT_A_ATTRIBUTE_TARGET, target);
        // System.err.println("## Anchor at : " + this + " attr: "+
        // elementAttributes);
    }
    else
    {
        anchor.setActive(false);
        elementAttributes.clear();
    }
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:27,代码来源:ElementBoxView.java

示例2: getBox

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
/**
 * Gets the box reference from properties.
 * 
 * @param v
 *            just a view.
 * @return the box set in properties, if there is one.
 */
public static final Box getBox(View v)
{
    if (v instanceof CSSBoxView) return getBox((CSSBoxView) v);

    AttributeSet attr = v.getAttributes();
    if (attr == null)
    {
        throw new NullPointerException("AttributeSet of " + v.getClass().getName() + "@"
                            + Integer.toHexString(v.hashCode()) + " is set to NULL.");
    }
    Object obj = attr.getAttribute(Constants.ATTRIBUTE_BOX_REFERENCE);
    if (obj != null && obj instanceof Box)
    {
        return (Box) obj;
    }
    else
    {
        throw new IllegalArgumentException("Box reference in attributes is not an instance of a Box.");
    }

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

示例3: getToolTipText

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
@Override
public String getToolTipText(float x, float y, Shape allocation)
{
    String val = "";
    String tmp;
    Map<String, String> elementAttributes = anchor.getProperties();

    if (title != null && !"".equals(title))
        val = val + "<b>" + title + "</b><br>";
    tmp = elementAttributes.get(Constants.ELEMENT_A_ATTRIBUTE_TITLE);
    if (tmp != null && !"".equals(tmp))
        val = val + "<i>" + tmp + "</i><br>";
    if (val.equals("")) {
        if (alt != null && ! "".equals(alt)) {
            val = val + "<b>" + alt + "</b><br>";
        }
    }
    tmp = elementAttributes.get(Constants.ELEMENT_A_ATTRIBUTE_HREF);
    if (tmp != null && !"".equals(tmp) && "".equals(val)) val = val + tmp;

    return "".equals(val) ? null : "<html>" + val + "</html>";
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:23,代码来源:BlockReplacedBoxView.java

示例4: getToolTipText

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
@Override
public String getToolTipText(float x, float y, Shape allocation)
{
    Map<String, String> elementAttributes = anchor.getProperties();
    String val = "";
    String tmp;
    // image title
    if (title != null && !"".equals(title))
        val = val + "<b>" + title + "</b><br>";
    // anchor title
    tmp = elementAttributes.get(Constants.ELEMENT_A_ATTRIBUTE_TITLE);
    if (tmp != null && !"".equals(tmp))
        val = val + "<i>" + tmp + "</i><br>";
    if (val.equals("")) {
        if (alt != null && ! "".equals(alt)) {
            val = val + "<b>" + alt + "</b><br>";
        }
    }
    // anchor href
    tmp = elementAttributes.get(Constants.ELEMENT_A_ATTRIBUTE_HREF);
    if (tmp != null && !"".equals(tmp) && "".equals(val)) val = val + tmp;

    return "".equals(val) ? null : "<html>" + val + "</html>";
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:25,代码来源:InlineReplacedBoxView.java

示例5: TextBoxView

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
/**
 * Instantiates a new text based view, able to display rich text. This view
 * corresponds to TextBox in CSSBox. <br>
 * <a href="http://www.w3.org/TR/CSS21/box.html">Box Model</a>
 * 
 * @param elem
 *            the elem
 * 
 */

public TextBoxView(Element elem)
{
    super(elem);
    AttributeSet tmpAttr = elem.getAttributes();
    Object obj = tmpAttr.getAttribute(Constants.ATTRIBUTE_BOX_REFERENCE);
    anchor = (Anchor) tmpAttr.getAttribute(Constants.ATTRIBUTE_ANCHOR_REFERENCE);

    if (obj instanceof TextBox)
    {
        box = (TextBox) obj;
    }
    else
    {
        throw new IllegalArgumentException("Box reference is not an instance of TextBox");
    }

    tmpRect = new Rectangle();
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:29,代码来源:TextBoxView.java

示例6: getToolTipText

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
@Override
public String getToolTipText(float x, float y, Shape allocation)
{
    if (anchor.isActive())
    {
        Map<String, String> elementAttributes = anchor.getProperties();
        String val = "";
        String tmp;
        tmp = elementAttributes.get(Constants.ELEMENT_A_ATTRIBUTE_TITLE);
        if (tmp != null && !"".equals(tmp))
            val = val + "<i>" + tmp + "</i><br>";
        tmp = elementAttributes.get(Constants.ELEMENT_A_ATTRIBUTE_HREF);
        if (tmp != null && !"".equals(tmp) && "".equals(val)) val = val + tmp;

        return "".equals(val) ? null : "<html>" + val + "</html>";
    }

    //return "NotLink: " + this;
    return null;
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:21,代码来源:TextBoxView.java

示例7: setPropertiesFromAttributes

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
/**
 * Sets the properties from the attributes.
 * 
 * @param attr
 *            the new properties from attributes
 */
protected void setPropertiesFromAttributes(AttributeSet attr)
{
    if (attr != null)
    {
        Font newFont = (Font) attr.getAttribute(Constants.ATTRIBUTE_FONT);
        if (newFont != null)
        {
            setFont(newFont);
        }
        else
        {
            // the font is the most important for us
            throw new IllegalStateException("Font can not be null !");
        }

        setForeground((Color) attr.getAttribute(Constants.ATTRIBUTE_FOREGROUND));
        setFontVariant((String) attr.getAttribute(Constants.ATTRIBUTE_FONT_VARIANT));

        @SuppressWarnings("unchecked")
        List<TextDecoration> attribute = (List<TextDecoration>) attr.getAttribute(Constants.ATTRIBUTE_TEXT_DECORATION);
        setTextDecoration(attribute);
    }
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:30,代码来源:TextBoxView.java

示例8: loadElementAttributes

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
private void loadElementAttributes()
{
    org.w3c.dom.Element elem = Anchor.findAnchorElement(box.getElement());
    Map<String, String> elementAttributes = anchor.getProperties();

    if (elem != null)
    {
        anchor.setActive(true);
        elementAttributes.put(Constants.ELEMENT_A_ATTRIBUTE_HREF, elem.getAttribute("href"));
        elementAttributes.put(Constants.ELEMENT_A_ATTRIBUTE_NAME, elem.getAttribute("name"));
        elementAttributes.put(Constants.ELEMENT_A_ATTRIBUTE_TITLE, elem.getAttribute("title"));
        String target = elem.getAttribute("target");
        if ("".equals(target))
        {
            target = "_self";
        }
        elementAttributes.put(Constants.ELEMENT_A_ATTRIBUTE_TARGET, target);
        // System.err.println("## Anchor at : " + this + " attr: "+
        // elementAttributes);
    }
    else
    {
        anchor.setActive(false);
        elementAttributes.clear();
    }
}
 
开发者ID:radkovo,项目名称:SwingBox,代码行数:27,代码来源:ElementBoxView.java

示例9: getToolTipText

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
@Override
public String getToolTipText(float x, float y, Shape allocation)
{
    String val = "";
    String tmp;
    Map<String, String> elementAttributes = anchor.getProperties();

    if (title != null && !"".equals(title))
        val = val + "<b>" + title + "</b><br>";
    tmp = elementAttributes.get(Constants.ELEMENT_A_ATTRIBUTE_TITLE);
    if (tmp != null && !"".equals(tmp))
        val = val + "<i>" + tmp + "</i><br>";
    tmp = elementAttributes.get(Constants.ELEMENT_A_ATTRIBUTE_HREF);
    if (tmp != null && !"".equals(tmp)) val = val + tmp;

    return "".equals(val) ? null : "<html>" + val + "</html>";
}
 
开发者ID:radkovo,项目名称:SwingBox,代码行数:18,代码来源:BlockReplacedBoxView.java

示例10: getToolTipText

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
@Override
public String getToolTipText(float x, float y, Shape allocation)
{
    Map<String, String> elementAttributes = anchor.getProperties();
    String val = "";
    String tmp;
    // image title
    if (title != null && !"".equals(title))
        val = val + "<b>" + title + "</b><br>";
    // anchor title
    tmp = elementAttributes.get(Constants.ELEMENT_A_ATTRIBUTE_TITLE);
    if (tmp != null && !"".equals(tmp))
        val = val + "<i>" + tmp + "</i><br>";
    // anchor href
    tmp = elementAttributes.get(Constants.ELEMENT_A_ATTRIBUTE_HREF);
    if (tmp != null && !"".equals(tmp)) val = val + tmp;

    return "".equals(val) ? null : "<html>" + val + "</html>";
}
 
开发者ID:radkovo,项目名称:SwingBox,代码行数:20,代码来源:InlineReplacedBoxView.java

示例11: getToolTipText

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
@Override
public String getToolTipText(float x, float y, Shape allocation)
{
    if (anchor.isActive())
    {
        Map<String, String> elementAttributes = anchor.getProperties();
        String val = "";
        String tmp;
        tmp = elementAttributes.get(Constants.ELEMENT_A_ATTRIBUTE_TITLE);
        if (tmp != null && !"".equals(tmp))
            val = val + "<i>" + tmp + "</i><br>";
        tmp = elementAttributes.get(Constants.ELEMENT_A_ATTRIBUTE_HREF);
        if (tmp != null && !"".equals(tmp)) val = val + tmp;

        return "".equals(val) ? null : "<html>" + val + "</html>";
    }

    //return "NotLink: " + this;
    return null;
}
 
开发者ID:radkovo,项目名称:SwingBox,代码行数:21,代码来源:TextBoxView.java

示例12: ElementBoxView

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
/**
 * @param elem
 */
public ElementBoxView(Element elem)
{
    // Y axis as default
    super(elem);
    majorAxis = Y_AXIS;
    AttributeSet tmpAttr = elem.getAttributes();
    Object obj = tmpAttr.getAttribute(Constants.ATTRIBUTE_BOX_REFERENCE);

    if (obj != null && obj instanceof ElementBox)
    {
        box = (ElementBox) obj;
        if (box instanceof BlockBox)
        {
            if (((BlockBox) box).isFloating())
            {
                majorAxis = X_AXIS;
            }
        }
    }
    else
    {
        throw new IllegalArgumentException("Box reference is null or not an instance of ElementBox");
    }

    obj = tmpAttr.getAttribute(Constants.ATTRIBUTE_ANCHOR_REFERENCE);
    if (obj != null && obj instanceof Anchor)
    {
        anchor = (Anchor) obj;
    }
    else
    {
        throw new IllegalArgumentException("Anchor reference is null or not an instance of Anchor");
    }

    oldDimension = new Dimension();
    tmpRect = new Rectangle();

    loadElementAttributes();
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:43,代码来源:ElementBoxView.java

示例13: createAttributes

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
protected SimpleAttributeSet createAttributes()
{
    // get all 'working variables' and make an AttributeSet.
    // hint: use MutableAttributeSet & recycle instance
    SimpleAttributeSet res = new SimpleAttributeSet();

    res.addAttribute(Constants.ATTRIBUTE_ANCHOR_REFERENCE, anchor);
    res.addAttribute(Constants.ATTRIBUTE_BOX_REFERENCE, box);
    // TODO: v niektorych pripadoch jr box==null, ako je to mozne ?
    // ak nacitam novu stranku a v testapp mam stary strom elementov a view
    // objektov
    // a zbehol GC tak hadze null , NPE!

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

示例14: createAttributes

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
protected SimpleAttributeSet createAttributes()
{
    // called from getAttributes()
    SimpleAttributeSet res = super.createAttributes();
    res.addAttribute(Constants.ATTRIBUTE_REPLACED_CONTENT, content);

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

示例15: createAttributes

import org.fit.cssbox.swingbox.util.Constants; //导入依赖的package包/类
private AttributeSet createAttributes()
{
    // get all 'working variables' and make an AttributeSet.
    SimpleAttributeSet res = new SimpleAttributeSet();

    res.addAttribute(Constants.ATTRIBUTE_BOX_REFERENCE, box);
    res.addAttribute(Constants.ATTRIBUTE_ANCHOR_REFERENCE, anchor);
    res.addAttribute(Constants.ATTRIBUTE_FONT_VARIANT, fontVariant);
    res.addAttribute(Constants.ATTRIBUTE_TEXT_DECORATION, textDecoration);
    res.addAttribute(Constants.ATTRIBUTE_FONT, font);
    res.addAttribute(Constants.ATTRIBUTE_FOREGROUND, foreground);

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


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