Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -593,27 +593,27 @@ protected void loadBackgroundImage(final java.net.URL imageURL) {
if (img != null) {
BaseElementRenderable.this.backgroundImage = img;
// Cause observer to be called
final int w = img.getWidth(BaseElementRenderable.this);
final int h = img.getHeight(BaseElementRenderable.this);
// Maybe image already done...
if ((w != -1) && (h != -1)) {
BaseElementRenderable.this.repaint();
}
}
final int w = img.getWidth(BaseElementRenderable.this);
final int h = img.getHeight(BaseElementRenderable.this);
// Maybe image already done...
if ((w != -1) && (h != -1)) {
BaseElementRenderable.this.repaint();
}
}
}) ;
}
}
}) ;

SecurityUtil.doPrivileged(() -> {
// Code might have restrictions on accessing items from elsewhere.
try {
request.open("GET", imageURL);
request.send(null, new Request(imageURL, RequestKind.Image));
} catch (final java.io.IOException thrown) {
logger.log(Level.WARNING, "loadBackgroundImage()", thrown);
}
return null;
});
try {
request.open("GET", imageURL);
request.send(null, new Request(imageURL, RequestKind.Image));
} catch (final java.io.IOException thrown) {
logger.log(Level.WARNING, "loadBackgroundImage()", thrown);
}
return null;
});
}
}

Expand Down Expand Up @@ -759,83 +759,191 @@ private void prePaintBorder(final java.awt.Graphics g, int totalWidth, int total
final Rectangle clipBounds = g.getClipBounds();
if (!clientRegion.contains(clipBounds)) {
final BorderInfo borderInfo = this.borderInfo;

if (btop > 0) {
g.setColor(this.getBorderTopColor());
final Color borderTopDarkColor = g.getColor().darker();
final Color borderTopLightColor = g.getColor().brighter();
final int borderStyle = borderInfo == null ? HtmlValues.BORDER_STYLE_SOLID : borderInfo.topStyle;

if (borderStyle == HtmlValues.BORDER_STYLE_DOTTED) {
final int topMid = startY + (btop / 2);
GUITasks.drawDotted(g, startX, topMid, startX + totalWidth, topMid, btop);
} else {
int btopBy3 = btop / 3;
int btopBy2 = btop / 2;
if (borderStyle == HtmlValues.BORDER_STYLE_INSET) {
g.setColor(borderTopDarkColor);
} else if (borderStyle == HtmlValues.BORDER_STYLE_OUTSET) {
g.setColor(borderTopLightColor);
} else if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) {
g.setColor(borderTopDarkColor);
} else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) {
g.setColor(borderTopLightColor);
}
for (int i = 0; i < btop; i++) {
final int leftOffset = (i * bleft) / btop;
final int rightOffset = (i * bright) / btop;

if (borderStyle == HtmlValues.BORDER_STYLE_DASHED) {
GUITasks.drawDashed(g, startX + leftOffset, startY + i, (startX + totalWidth) - rightOffset - 1, startY + i, 10 + btop, 6);
} else {
if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) {
if (i == btopBy2) {
g.setColor(borderTopLightColor);
}
} else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) {
if (i == btopBy2) {
g.setColor(borderTopDarkColor);
}
}
g.drawLine(startX + leftOffset, startY + i, (startX + totalWidth) - rightOffset - 1, startY + i);
if (borderStyle == HtmlValues.BORDER_STYLE_DOUBLE) {
if (i == btopBy3) {
i += btopBy3;
}
}
}
}
}
}
if (bright > 0) {
final int borderStyle = borderInfo == null ? HtmlValues.BORDER_STYLE_SOLID : borderInfo.rightStyle;
g.setColor(this.getBorderRightColor());
final Color borderRightLightColor = g.getColor().brighter();
final Color borderRightDarkColor = g.getColor().darker();
final int lastX = (startX + totalWidth) - 1;

if (borderStyle == HtmlValues.BORDER_STYLE_DOTTED) {
final int rightMid = lastX - (bright / 2);
GUITasks.drawDotted(g, rightMid, startY, rightMid, startY + totalHeight, bright);
} else {
int brightBy3 = bright / 3;
int brightBy2 = bright / 2;
if (borderStyle == HtmlValues.BORDER_STYLE_INSET) {
g.setColor(borderRightLightColor);
} else if (borderStyle == HtmlValues.BORDER_STYLE_OUTSET) {
g.setColor(borderRightDarkColor);
} else if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) {
g.setColor(borderRightLightColor);
} else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) {
g.setColor(borderRightDarkColor);
}
for (int i = 0; i < bright; i++) {
final int topOffset = (i * btop) / bright;
final int bottomOffset = (i * bbottom) / bright;
if (borderStyle == HtmlValues.BORDER_STYLE_DASHED) {
GUITasks.drawDashed(g, lastX - i, startY + topOffset, lastX - i, (startY + totalHeight) - bottomOffset - 1, 10 + bright, 6);
} else {
if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) {
if (i == brightBy2) {
g.setColor(borderRightDarkColor);
}
} else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) {
if (i == brightBy2) {
g.setColor(borderRightLightColor);
}
}
g.drawLine(lastX - i, startY + topOffset, lastX - i, (startY + totalHeight) - bottomOffset - 1);
if (borderStyle == HtmlValues.BORDER_STYLE_DOUBLE) {
if (i == brightBy3) {
i += brightBy3;
}
}
}
}
}
}
if (bbottom > 0) {
final int borderStyle = borderInfo == null ? HtmlValues.BORDER_STYLE_SOLID : borderInfo.bottomStyle;
g.setColor(this.getBorderBottomColor());
final Color borderBottomDarkColor = g.getColor().darker();
final Color borderBottomLightColor = g.getColor().brighter();

final int lastY = (startY + totalHeight) - 1;

if (borderStyle == HtmlValues.BORDER_STYLE_DOTTED) {
final int bottomMid = lastY - (bbottom / 2);
GUITasks.drawDotted(g, startX, bottomMid, startX + totalWidth, bottomMid, bbottom);
} else {
int bbottomBy3 = bbottom / 3;
int bbottomBy2 = bbottom / 2;
if (borderStyle == HtmlValues.BORDER_STYLE_INSET) {
g.setColor(borderBottomLightColor);
} else if (borderStyle == HtmlValues.BORDER_STYLE_OUTSET) {
g.setColor(borderBottomDarkColor);
} else if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) {
g.setColor(borderBottomLightColor);
} else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) {
g.setColor(borderBottomDarkColor);
}
for (int i = 0; i < bbottom; i++) {
final int leftOffset = (i * bleft) / bbottom;
final int rightOffset = (i * bright) / bbottom;
if (borderStyle == HtmlValues.BORDER_STYLE_DASHED) {
GUITasks.drawDashed(g, startX + leftOffset, lastY - i, (startX + totalWidth) - rightOffset - 1, lastY - i, 10 + bbottom, 6);
} else {
if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) {
if (i == bbottomBy2) {
g.setColor(borderBottomDarkColor);
}
} else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) {
if (i == bbottomBy2) {
g.setColor(borderBottomLightColor);
}
}
g.drawLine(startX + leftOffset, lastY - i, (startX + totalWidth) - rightOffset - 1, lastY - i);
if (borderStyle == HtmlValues.BORDER_STYLE_DOUBLE) {
if (i == bbottomBy3) {
i += bbottomBy3;
}
}
}
}
}
}
if (bleft > 0) {
final int borderStyle = borderInfo == null ? HtmlValues.BORDER_STYLE_SOLID : borderInfo.leftStyle;
g.setColor(this.getBorderLeftColor());
final Color borderLeftDarkColor = g.getColor().darker();
final Color borderLeftLightColor = g.getColor().brighter();

if (borderStyle == HtmlValues.BORDER_STYLE_DOTTED) {
final int leftMid = startX + (bleft / 2);
GUITasks.drawDotted(g, leftMid, startY, leftMid, startY + totalHeight, bleft);
} else {
int bleftBy3 = bleft / 3;
int bleftBy2 = bleft / 2;
if (borderStyle == HtmlValues.BORDER_STYLE_INSET) {
g.setColor(borderLeftDarkColor);
} else if (borderStyle == HtmlValues.BORDER_STYLE_OUTSET) {
g.setColor(borderLeftLightColor);
} else if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) {
g.setColor(borderLeftDarkColor);
} else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) {
g.setColor(borderLeftLightColor);
}
for (int i = 0; i < bleft; i++) {
final int topOffset = (i * btop) / bleft;
final int bottomOffset = (i * bbottom) / bleft;
if (borderStyle == HtmlValues.BORDER_STYLE_DASHED) {
GUITasks
.drawDashed(g, startX + i, startY + topOffset, startX + i, (startY + totalHeight) - bottomOffset - 1, 10 + bleft, 6);
} else {
if (borderStyle == HtmlValues.BORDER_STYLE_GROOVE) {
if (i == bleftBy2) {
g.setColor(borderLeftLightColor);
}
} else if (borderStyle == HtmlValues.BORDER_STYLE_RIDGE) {
if (i == bleftBy2) {
g.setColor(borderLeftDarkColor);
}
}
g.drawLine(startX + i, startY + topOffset, startX + i, (startY + totalHeight) - bottomOffset - 1);
if (borderStyle == HtmlValues.BORDER_STYLE_DOUBLE) {
if (i == bleftBy3) {
i += bleftBy3;
}
}
}
}
}
Expand Down Expand Up @@ -1070,4 +1178,4 @@ public int getMarginTop() {
return marginInsets == null ? 0 : marginInsets.top;
}

}
}