本文整理汇总了Java中cz.vutbr.web.css.TermColor.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java TermColor.getValue方法的具体用法?Java TermColor.getValue怎么用?Java TermColor.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cz.vutbr.web.css.TermColor
的用法示例。
在下文中一共展示了TermColor.getValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBorderColor
import cz.vutbr.web.css.TermColor; //导入方法依赖的package包/类
/**
* Returns color of border
*/
private Color getBorderColor(ElementBox elem, String side) {
Color clr = null;
// gets the color value from CSS property
CSSProperty.BorderColor bclr = elem.getStyle().getProperty("border-"+side+"-color");
TermColor tclr = elem.getStyle().getValue(TermColor.class, "border-"+side+"-color");
CSSProperty.BorderStyle bst = elem.getStyle().getProperty("border-"+side+"-style");
if (bst != CSSProperty.BorderStyle.HIDDEN && bclr != CSSProperty.BorderColor.TRANSPARENT) {
if (tclr != null) clr = tclr.getValue();
if (clr == null) {
clr = elem.getVisualContext().getColor();
if (clr == null) clr = Color.BLACK;
}
}
else { clr = elem.getBgcolor(); }
return clr;
}
示例2: writeBorderSVG
import cz.vutbr.web.css.TermColor; //导入方法依赖的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 + "\" />");
}
}
示例3: writeBorderSVG
import cz.vutbr.web.css.TermColor; //导入方法依赖的package包/类
private void writeBorderSVG(ElementBox eb, int x1, int y1, int x2, int y2, String side, int width, int right, int down)
{
CSSProperty.BorderColor bclr = eb.getStyle().getProperty("border-"+side+"-color");
TermColor tclr = eb.getStyle().getValue(TermColor.class, "border-"+side+"-color");
CSSProperty.BorderStyle bst = eb.getStyle().getProperty("border-"+side+"-style");
if (bst != CSSProperty.BorderStyle.HIDDEN && bclr != CSSProperty.BorderColor.TRANSPARENT)
{
Color clr = null;
if (tclr != null)
clr = tclr.getValue();
if (clr == null)
{
clr = eb.getVisualContext().getColor();
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 + "\" />");
}
}