|
|
@ -69,6 +69,19 @@ public class XWTitleLayout extends DedicateLayoutContainer { |
|
|
|
setBackground4Painting(null, 0.0); |
|
|
|
setBackground4Painting(null, 0.0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Insets getInsets() { |
|
|
|
|
|
|
|
if (getComponentCount() > 1) { |
|
|
|
|
|
|
|
XCreator bodyCreator = getBodyCreator(); |
|
|
|
|
|
|
|
if (bodyCreator instanceof XBorderStyleWidgetCreator) { |
|
|
|
|
|
|
|
XBorderStyleWidgetCreator styleBodyCreator = (XBorderStyleWidgetCreator) bodyCreator; |
|
|
|
|
|
|
|
setPaddingInsets4Painting(styleBodyCreator.toData().getMargin()); |
|
|
|
|
|
|
|
return getPaddingInsets4Painting(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return super.getInsets(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void initXCreatorProperties() { |
|
|
|
protected void initXCreatorProperties() { |
|
|
|
super.initXCreatorProperties(); |
|
|
|
super.initXCreatorProperties(); |
|
|
@ -187,12 +200,15 @@ public class XWTitleLayout extends DedicateLayoutContainer { |
|
|
|
Composite oldComposite = g2d.getComposite(); |
|
|
|
Composite oldComposite = g2d.getComposite(); |
|
|
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, (float) this.titleBackgroundOpacity4Painting)); |
|
|
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, (float) this.titleBackgroundOpacity4Painting)); |
|
|
|
XCreator titleCreator = getTitleCreator(); |
|
|
|
XCreator titleCreator = getTitleCreator(); |
|
|
|
int titleHeight = titleCreator != null ? titleCreator.getHeight() : 0; |
|
|
|
if (titleCreator != null) { |
|
|
|
|
|
|
|
int height = titleCreator.getHeight(); |
|
|
|
|
|
|
|
Insets paddingInsets = getInsets(); |
|
|
|
|
|
|
|
|
|
|
|
Shape shape = new Rectangle2D.Double(0, 0, getWidth(), titleHeight); |
|
|
|
Shape shape = new Rectangle2D.Double(0, 0, getWidth(), height + paddingInsets.top); |
|
|
|
titleBackground4Painting.paint(g2d, shape); |
|
|
|
titleBackground4Painting.paint(g2d, shape); |
|
|
|
|
|
|
|
|
|
|
|
g2d.setComposite(oldComposite); |
|
|
|
g2d.setComposite(oldComposite); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -201,14 +217,18 @@ public class XWTitleLayout extends DedicateLayoutContainer { |
|
|
|
Composite oldComposite = g2d.getComposite(); |
|
|
|
Composite oldComposite = g2d.getComposite(); |
|
|
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, (float) this.bodyBackgroundOpacity4Painting)); |
|
|
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, (float) this.bodyBackgroundOpacity4Painting)); |
|
|
|
|
|
|
|
|
|
|
|
XCreator titleCreator = getTitleCreator(); |
|
|
|
XCreator bodyCreator = getBodyCreator(); |
|
|
|
int titleHeight = titleCreator != null ? titleCreator.getHeight() : 0; |
|
|
|
|
|
|
|
// 兼容性考虑,组件样式背景不作用在标题范围内,只作用在控件整体,但同时不能遮挡作用于整体的边框图片
|
|
|
|
if (bodyCreator != null) { |
|
|
|
// 所以考虑样式背景与边框图片都由XWTitleLayout绘制,但样式背景要向下偏移标题栏的高度
|
|
|
|
int y = bodyCreator.getY(); |
|
|
|
Shape shape = new Rectangle2D.Double(0, titleHeight, getWidth(), getHeight() - titleHeight); |
|
|
|
int height = bodyCreator.getHeight(); |
|
|
|
bodyBackground4Painting.paint(g2d, shape); |
|
|
|
Insets paddingInsets = getInsets(); |
|
|
|
|
|
|
|
|
|
|
|
g2d.setComposite(oldComposite); |
|
|
|
Shape shape = new Rectangle2D.Double(0, y, getWidth(), height + paddingInsets.bottom); |
|
|
|
|
|
|
|
bodyBackground4Painting.paint(g2d, shape); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g2d.setComposite(oldComposite); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|