Browse Source

Pull request #5868: 无JIRA任务 冲突

Merge in DESIGN/design from ~STARRYI/design:merge10t011 to release/11.0

* commit '278687d10f8d5c9252f53cb093ac3bf45ce113df':
  REPORT-57551 设计器显示,自适应布局下body背景设置以后,画布中没有实时显示背景
  REPORT-57551 设计器显示,自适应布局下body背景设置以后,画布中没有实时显示背景
  REPORT-57551 设计器显示,自适应布局下body背景设置以后,画布中没有实时显示背景
  REPORT-58301 【决策报表】布局切换以后,body背景样式不保留
bugfix/11.0
ju|剧浩宇 3 years ago
parent
commit
a998918b26
  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. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java
  8. 10
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  9. 2
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  10. 1
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  11. 10
      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);
@ -344,7 +344,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)
@ -342,7 +342,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

@ -75,7 +75,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)
@ -118,7 +118,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();
} }
@ -547,7 +547,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
} }

2
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);

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

@ -417,7 +417,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());

10
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,15 @@ 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().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