use of org.loboevolution.info.BorderInfo in project LoboEvolution by LoboEvolution.
the class HRRenderState method getBorderInfo.
/**
* {@inheritDoc}
*/
@Override
public BorderInfo getBorderInfo() {
BorderInfo binfo = this.borderInfo;
if (binfo != INVALID_BORDER_INFO) {
return binfo;
}
binfo = super.getBorderInfo();
if (binfo == null || binfo.borderInfoIsVoid()) {
if (binfo == null) {
binfo = new BorderInfo();
}
binfo.setInsets(getDefaultBordernsets());
binfo.setTopColor(Color.DARK_GRAY);
binfo.setLeftColor(Color.DARK_GRAY);
binfo.setRightColor(Color.DARK_GRAY);
binfo.setBottomColor(Color.DARK_GRAY);
binfo.setTopStyle(BorderInsets.BORDER_STYLE_SOLID);
binfo.setLeftStyle(BorderInsets.BORDER_STYLE_SOLID);
binfo.setRightStyle(BorderInsets.BORDER_STYLE_SOLID);
binfo.setBottomStyle(BorderInsets.BORDER_STYLE_SOLID);
}
this.borderInfo = binfo;
return binfo;
}
use of org.loboevolution.info.BorderInfo in project LoboEvolution by LoboEvolution.
the class BaseElementRenderable method borderInsets.
private Insets borderInsets(RenderState rs, int availWidth, int availHeight) {
Insets ins = null;
final BorderInfo borderInfo = rs.getBorderInfo();
this.borderInfo = borderInfo;
if (borderInfo != null) {
HtmlInsets html = (HtmlInsets) borderInfo.getInsets();
if (html == null) {
ins = RBlockViewport.ZERO_INSETS;
} else {
ins = html.getAWTInsets(availWidth, availHeight, 0, 0);
}
this.borderTopColor = borderInfo.getTopColor();
this.borderLeftColor = borderInfo.getLeftColor();
this.borderBottomColor = borderInfo.getBottomColor();
this.borderRightColor = borderInfo.getRightColor();
} else {
this.borderTopColor = null;
this.borderLeftColor = null;
this.borderBottomColor = null;
this.borderRightColor = null;
}
this.borderInsets = ins;
return ins;
}
use of org.loboevolution.info.BorderInfo in project LoboEvolution by LoboEvolution.
the class IFrameRenderState method getBorderInfo.
/**
* {@inheritDoc}
*/
@Override
public BorderInfo getBorderInfo() {
BorderInfo binfo = this.borderInfo;
if (binfo != INVALID_BORDER_INFO) {
return binfo;
}
binfo = super.getBorderInfo();
if (binfo == null || binfo.borderInfoIsVoid()) {
if (binfo == null) {
binfo = new BorderInfo();
}
final HTMLElementImpl element = this.element;
if (element != null) {
String border = element.getAttribute("frameborder");
if (border != null) {
border = border.trim();
}
int value;
if (border != null) {
try {
value = Integer.parseInt(border);
} catch (final NumberFormatException nfe) {
value = 0;
}
} else {
value = 1;
}
binfo.setInsets(new HtmlInsets(value != 0 ? 1 : 0, HtmlInsets.TYPE_PIXELS));
if (binfo.getTopColor() == null) {
binfo.setTopColor(Color.DARK_GRAY);
}
if (binfo.getLeftColor() == null) {
binfo.setLeftColor(Color.DARK_GRAY);
}
if (binfo.getRightColor() == null) {
binfo.setRightColor(Color.LIGHT_GRAY);
}
if (binfo.getBottomColor() == null) {
binfo.setBottomColor(Color.LIGHT_GRAY);
}
if (value != 0) {
binfo.setTopStyle(BorderInsets.BORDER_STYLE_SOLID);
binfo.setLeftStyle(BorderInsets.BORDER_STYLE_SOLID);
binfo.setRightStyle(BorderInsets.BORDER_STYLE_SOLID);
binfo.setBottomStyle(BorderInsets.BORDER_STYLE_SOLID);
}
}
}
this.borderInfo = binfo;
return binfo;
}
use of org.loboevolution.info.BorderInfo in project LoboEvolution by LoboEvolution.
the class ImageRenderState method getBorderInfo.
/**
* {@inheritDoc}
*/
@Override
public BorderInfo getBorderInfo() {
BorderInfo binfo = this.borderInfo;
if (binfo != INVALID_BORDER_INFO) {
return binfo;
}
binfo = super.getBorderInfo();
if (binfo == null || binfo.borderInfoIsVoid()) {
if (binfo == null) {
binfo = new BorderInfo();
}
final HTMLElementImpl element = this.element;
if (element != null) {
String border = element.getAttribute("border");
if (border != null) {
border = border.trim();
int value;
int valueType;
if (border.endsWith("%")) {
valueType = HtmlInsets.TYPE_PERCENT;
try {
value = Integer.parseInt(border.substring(0, border.length() - 1));
} catch (final NumberFormatException nfe) {
value = 0;
}
} else {
valueType = HtmlInsets.TYPE_PIXELS;
try {
value = Integer.parseInt(border);
} catch (final NumberFormatException nfe) {
value = 0;
}
}
binfo.setInsets(new HtmlInsets(value, valueType));
if (binfo.getTopColor() == null) {
binfo.setTopColor(Color.BLACK);
}
if (binfo.getLeftColor() == null) {
binfo.setLeftColor(Color.BLACK);
}
if (binfo.getRightColor() == null) {
binfo.setRightColor(Color.BLACK);
}
if (binfo.getBottomColor() == null) {
binfo.setBottomColor(Color.BLACK);
}
if (value != 0) {
binfo.setTopStyle(BorderInsets.BORDER_STYLE_SOLID);
binfo.setLeftStyle(BorderInsets.BORDER_STYLE_SOLID);
binfo.setRightStyle(BorderInsets.BORDER_STYLE_SOLID);
binfo.setBottomStyle(BorderInsets.BORDER_STYLE_SOLID);
}
}
}
}
this.borderInfo = binfo;
return binfo;
}
Aggregations