Browse Source

Pull request #5837: REPORT-59421 & REPORT-58301

Merge in DESIGN/design from ~STARRYI/design:feature/x to feature/x

* commit 'f7113798cae2a922405f378353f4464efb4091bb':
  REPORT-59421 决策报表-参数面板-参数面板设置样式,现在设计画布里看不到样式效果,之前组件样式分离迭代时有对body进行设计画布可看到样式效果的支持
  REPORT-57551 设计器显示,自适应布局下body背景设置以后,画布中没有实时显示背景
  REPORT-57551 设计器显示,自适应布局下body背景设置以后,画布中没有实时显示背景
  REPORT-57551 设计器显示,自适应布局下body背景设置以后,画布中没有实时显示背景
research/11.0
starryi 3 years ago
parent
commit
1922255eab
  1. 34
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  2. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java
  3. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java
  4. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java
  5. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java
  6. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  7. 12
      designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java
  8. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java
  9. 10
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  10. 2
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  11. 1
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  12. 11
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

34
designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -21,6 +21,8 @@ import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import javax.swing.plaf.PanelUI;
import javax.swing.plaf.basic.BasicPanelUI;
import java.awt.*; import java.awt.*;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
@ -42,6 +44,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) { public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) {
super(widget, initSize); super(widget, initSize);
setUI(new NoBackgroundPaneUI());
setOpaque(false); setOpaque(false);
setBackupBound(null); setBackupBound(null);
@ -51,6 +54,13 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
} }
} }
@Override
public void setUI(PanelUI ui) {
if (ui instanceof NoBackgroundPaneUI) {
super.setUI(ui);
}
}
public Background getBackground4Painting() { public Background getBackground4Painting() {
return this.background4Painting; return this.background4Painting;
} }
@ -91,12 +101,12 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
super.addToWrapper(parentPanel, width, minHeight); super.addToWrapper(parentPanel, width, minHeight);
// REPORT-53175: 新创建的图表组件默认显示标题 since 10.0.18 // REPORT-53175: 新创建的图表组件默认显示标题 since 10.0.18
// 将当前对象添加到父容器后,初始化默认样式的效果 // 将当前对象添加到父容器后,初始化默认样式的效果
initStyle(); refreshStylePreviewEffect();
} }
protected void initStyle() { public void refreshStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle(); BorderPacker style = toData().getBorderStyle();
initBorderAndBackgroundStyle(); refreshBorderAndBackgroundStylePreviewEffect();
if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) {
initTitleStyle(style); initTitleStyle(style);
} else { } else {
@ -107,7 +117,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
reshuffleBorderAndBackgroundPaintingEffectIfTitleExists(); reshuffleBorderAndBackgroundPaintingEffectIfTitleExists();
} }
protected void initBorderAndBackgroundStyle() { public void refreshBorderAndBackgroundStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle(); BorderPacker style = toData().getBorderStyle();
LineBorder DEFAULT_LINE_BORDER = (LineBorder) DEFALUTBORDER; LineBorder DEFAULT_LINE_BORDER = (LineBorder) DEFALUTBORDER;
@ -288,6 +298,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
// 设计器预览界面中绘制组件背景效果 // 设计器预览界面中绘制组件背景效果
public void paintBackground(Graphics2D g2d) { public void paintBackground(Graphics2D g2d) {
if (isOpaque()) {
g2d.setColor(getBackground());
g2d.fillRect(0, 0, getWidth(), getHeight());
}
Background background4Painting = getBackground4Painting(); Background background4Painting = getBackground4Painting();
if (background4Painting != null) { if (background4Painting != null) {
Composite oldComposite = g2d.getComposite(); Composite oldComposite = g2d.getComposite();
@ -311,12 +326,12 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
} }
public void paintForeground(Graphics2D g2d) { public void paintForeground(Graphics2D g2d) {
super.paint(g2d); super.paintComponent(g2d);
super.paintBorder(g2d); super.paintBorder(g2d);
} }
@Override @Override
public void paint(Graphics g) { public void paintComponent(Graphics g) {
this.clipByRoundedBorder((Graphics2D) g); this.clipByRoundedBorder((Graphics2D) g);
this.paintBackground((Graphics2D) g); this.paintBackground((Graphics2D) g);
this.paintBorderImage((Graphics2D) g); this.paintBorderImage((Graphics2D) g);
@ -378,4 +393,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} }
} }
public static class NoBackgroundPaneUI extends BasicPanelUI {
@Override
public void update(Graphics g, JComponent c) {
paint(g, c);
}
}
} }

6
designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java

@ -122,7 +122,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
@Override @Override
public void propertyChange() { public void propertyChange() {
initStyle(); refreshStylePreviewEffect();
} }
}), }),
}; };
@ -165,7 +165,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
@Override @Override
protected void initXCreatorProperties() { protected void initXCreatorProperties() {
super.initXCreatorProperties(); super.initXCreatorProperties();
initBorderAndBackgroundStyle(); refreshBorderAndBackgroundStylePreviewEffect();
BaseChartCollection collection = ((BaseChartEditor) data).getChartCollection(); BaseChartCollection collection = ((BaseChartEditor) data).getChartCollection();
isRefreshing = true; isRefreshing = true;
((MiddleChartComponent) designerEditor.getEditorTarget()).populate(collection); ((MiddleChartComponent) designerEditor.getEditorTarget()).populate(collection);
@ -345,7 +345,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
* data属性改变触发其他操作 * data属性改变触发其他操作
*/ */
public void firePropertyChange() { public void firePropertyChange() {
initStyle(); refreshStylePreviewEffect();
} }
@Override @Override

6
designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java

@ -58,7 +58,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
super.initXCreatorProperties(); super.initXCreatorProperties();
// 报表块初始化时要加载对应的borderStyle // 报表块初始化时要加载对应的borderStyle
initBorderAndBackgroundStyle(); refreshBorderAndBackgroundStylePreviewEffect();
} }
/** /**
@ -94,7 +94,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
@Override @Override
public void propertyChange() { public void propertyChange() {
initStyle(); refreshStylePreviewEffect();
} }
}), }),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class) new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
@ -344,7 +344,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
* *
*/ */
public void firePropertyChange() { public void firePropertyChange() {
initStyle(); refreshStylePreviewEffect();
} }
/** /**

6
designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java

@ -77,7 +77,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
@Override @Override
public void propertyChange() { public void propertyChange() {
initStyle(); refreshStylePreviewEffect();
} }
}), }),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class) new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
@ -120,7 +120,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
@Override @Override
protected void initXCreatorProperties() { protected void initXCreatorProperties() {
super.initXCreatorProperties(); super.initXCreatorProperties();
initBorderAndBackgroundStyle(); refreshBorderAndBackgroundStylePreviewEffect();
this.initLayoutManager(); this.initLayoutManager();
this.convert(); this.convert();
} }
@ -549,7 +549,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
* *
*/ */
public void firePropertyChange(){ public void firePropertyChange(){
initStyle(); refreshStylePreviewEffect();
} }
/** /**

8
designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java

@ -78,7 +78,7 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
@Override @Override
public void propertyChange() { public void propertyChange() {
initStyle(); XWAbsoluteBodyLayout.this.refreshStylePreviewEffect();
} }
}) })
}; };
@ -105,8 +105,8 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
} }
@Override @Override
protected void initStyle() { public void refreshStylePreviewEffect() {
initBorderAndBackgroundStyle(); refreshBorderAndBackgroundStylePreviewEffect();
} }
/** /**
@ -114,7 +114,7 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
* *
*/ */
public void firePropertyChange(){ public void firePropertyChange(){
initStyle(); this.refreshStylePreviewEffect();
} }
@Override @Override

2
designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -305,7 +305,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
} }
@Override @Override
protected void initStyle() { public void refreshStylePreviewEffect() {
// do nothing // do nothing
} }

12
designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java

@ -43,6 +43,16 @@ public class XWParameterLayout extends XWAbsoluteLayout {
super(widget, initSize); super(widget, initSize);
} }
@Override
public void refreshBorderAndBackgroundStylePreviewEffect() {
WParameterLayout data = toData();
if (data != null) {
Background background = data.getBackground();
setBackground4Painting(background, 1.0);
repaint();
}
}
/** /**
* 初始化尺寸 * 初始化尺寸
* @return 尺寸 * @return 尺寸
@ -235,7 +245,7 @@ public class XWParameterLayout extends XWAbsoluteLayout {
* *
*/ */
public void firePropertyChange(){ public void firePropertyChange(){
refreshBorderAndBackgroundStylePreviewEffect();
} }
@Override @Override

6
designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java

@ -63,7 +63,7 @@ public class XWTitleLayout extends DedicateLayoutContainer {
} }
@Override @Override
protected void initBorderAndBackgroundStyle() { public void refreshBorderAndBackgroundStylePreviewEffect() {
setBorder(null); setBorder(null);
setBorderImage4Painting(null, 0.0); setBorderImage4Painting(null, 0.0);
setBackground4Painting(null, 0.0); setBackground4Painting(null, 0.0);
@ -76,7 +76,7 @@ public class XWTitleLayout extends DedicateLayoutContainer {
// 初始化后(如打开旧模版),需要重新调整组件/标题/边框的显示效果 // 初始化后(如打开旧模版),需要重新调整组件/标题/边框的显示效果
XCreator xCreator = getBodyCreator(); XCreator xCreator = getBodyCreator();
if (xCreator instanceof XBorderStyleWidgetCreator) { if (xCreator instanceof XBorderStyleWidgetCreator) {
((XBorderStyleWidgetCreator) xCreator).initStyle(); ((XBorderStyleWidgetCreator) xCreator).refreshStylePreviewEffect();
} }
} }
@ -237,7 +237,7 @@ public class XWTitleLayout extends DedicateLayoutContainer {
} }
// 刷新时重置下样式 // 刷新时重置下样式
if (bodyCreator != null) { if (bodyCreator != null) {
bodyCreator.initStyle(); bodyCreator.refreshStylePreviewEffect();
} }
isRefreshing = false; isRefreshing = false;
} }

10
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -160,7 +160,7 @@ public class XWCardLayout extends XLayoutContainer {
*/ */
@Override @Override
protected XLayoutContainer getCreatorWrapper(String widgetName) { protected XLayoutContainer getCreatorWrapper(String widgetName) {
initStyle(); refreshStylePreviewEffect();
Dimension dimension = new Dimension(); Dimension dimension = new Dimension();
//主结构是一个borderlayout, 标签部分是north, card部分为center //主结构是一个borderlayout, 标签部分是north, card部分为center
WCardMainBorderLayout border = new WCardMainBorderLayout(); WCardMainBorderLayout border = new WCardMainBorderLayout();
@ -389,7 +389,7 @@ public class XWCardLayout extends XLayoutContainer {
@Override @Override
public void propertyChange() { public void propertyChange() {
initStyle(); refreshStylePreviewEffect();
} }
}) })
}; };
@ -397,10 +397,10 @@ public class XWCardLayout extends XLayoutContainer {
//初始化样式 //初始化样式
@Override @Override
protected void initStyle() { public void refreshStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle(); BorderPacker style = toData().getBorderStyle();
initBorderTitleStyle(style); initBorderTitleStyle(style);
initBorderAndBackgroundStyle(); refreshBorderAndBackgroundStylePreviewEffect();
clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)); clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE));
} }
@ -479,7 +479,7 @@ public class XWCardLayout extends XLayoutContainer {
*/ */
@Override @Override
public void firePropertyChange() { public void firePropertyChange() {
initStyle(); refreshStylePreviewEffect();
} }
public void resetTabBackground(TemplateStyle templateStyle) { public void resetTabBackground(TemplateStyle templateStyle) {

2
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -405,7 +405,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
public void firePropertyChange(){ public void firePropertyChange(){
XWCardLayout cardLayout = this.getCardPart(); XWCardLayout cardLayout = this.getCardPart();
if (cardLayout != null && cardLayout.toData() != null) { if (cardLayout != null && cardLayout.toData() != null) {
cardLayout.initStyle(); cardLayout.refreshStylePreviewEffect();
} }
} }

1
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

@ -181,6 +181,7 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
wFitLayout.setBorderStyle(layout.getBorderStyle()); wFitLayout.setBorderStyle(layout.getBorderStyle());
} }
copyLayoutAttr(layout, xwFitLayout.toData()); copyLayoutAttr(layout, xwFitLayout.toData());
xwFitLayout.refreshStylePreviewEffect();
} }
} }
layout.setBorderStyleFollowingTheme(themePane.isFollowingTheme()); layout.setBorderStyleFollowingTheme(themePane.isFollowingTheme());

11
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

@ -42,6 +42,7 @@ import com.fr.log.FineLoggerFactory;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*; import java.awt.*;
/** /**
@ -243,6 +244,16 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreators( formDesigner.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout})); FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout}));
if (xwAbsoluteBodyLayout.toData() != null) {
xwAbsoluteBodyLayout.toData().setBorderStyleFollowingTheme(wAbsoluteBodyLayout.isBorderStyleFollowingTheme());
xwAbsoluteBodyLayout.toData().setBorderStyle(wAbsoluteBodyLayout.getBorderStyle());
}
xwAbsoluteBodyLayout.refreshStylePreviewEffect();
if (xWFitLayout.toData() != null) {
xWFitLayout.toData().resetStyle();
}
xWFitLayout.refreshStylePreviewEffect();
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);

Loading…
Cancel
Save