Browse Source

Merge pull request #5861 in DESIGN/design from release/10.0 to bugfix/10.0

* commit '4eda1e8dd598ed193100646b62d225fa8cc80532':
  REPORT-59189 导出-导出事件-导出模板选cptx会出问题
  REPORT-57551 设计器显示,自适应布局下body背景设置以后,画布中没有实时显示背景
  REPORT-57551 设计器显示,自适应布局下body背景设置以后,画布中没有实时显示背景
  REPORT-57551 设计器显示,自适应布局下body背景设置以后,画布中没有实时显示背景
  REPORT-58301 【决策报表】布局切换以后,body背景样式不保留
bugfix/10.0
superman 3 years ago
parent
commit
7fc3164d98
  1. 4
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  2. 42
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  3. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java
  4. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java
  5. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java
  6. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java
  7. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  8. 2
      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. 8
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  12. 14
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

4
designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java

@ -2,6 +2,7 @@ package com.fr.design.javascript;
import com.fr.base.BaseFormula;
import com.fr.base.Parameter;
import com.fr.base.extension.FileExtension;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
@ -417,6 +418,9 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
if (path == null) {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_The_Selected_File_Cannot_Be_Null"));
}
if (path.endsWith(FileExtension.CPTX.getExtension())) {
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Function_Cptx_Unsupported"));
}
}
/**

42
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.border.Border;
import javax.swing.border.LineBorder;
import javax.swing.plaf.PanelUI;
import javax.swing.plaf.basic.BasicPanelUI;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;
@ -42,12 +44,23 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) {
super(widget, initSize);
setUI(new NoBackgroundPaneUI());
setOpaque(false);
setBackupBound(null);
ExtendSharableAttrMark sharableAttrMark = this.toData().getWidgetAttrMark(ExtendSharableAttrMark.XML_TAG);
if (sharableAttrMark != null) {
this.setShareId(sharableAttrMark.getShareId());
}
}
@Override
public void setUI(PanelUI ui) {
if (ui instanceof NoBackgroundPaneUI) {
super.setUI(ui);
}
}
public Background getBackground4Painting() {
return this.background4Painting;
}
@ -88,12 +101,12 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
super.addToWrapper(parentPanel, width, minHeight);
// REPORT-53175: 新创建的图表组件默认显示标题 since 10.0.18
// 将当前对象添加到父容器后,初始化默认样式的效果
initStyle();
refreshStylePreviewEffect();
}
protected void initStyle() {
public void refreshStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle();
initBorderAndBackgroundStyle();
refreshBorderAndBackgroundStylePreviewEffect();
if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) {
initTitleStyle(style);
} else {
@ -104,7 +117,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
reshuffleBorderAndBackgroundPaintingEffectIfTitleExists();
}
protected void initBorderAndBackgroundStyle() {
public void refreshBorderAndBackgroundStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle();
LineBorder DEFAULT_LINE_BORDER = (LineBorder) DEFALUTBORDER;
@ -263,6 +276,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
}
@Override
public void setBackground(Color bg) {
super.setBackground(bg);
}
// 根据当前组件边框裁剪内容,如果当前组件存在圆角,则应当按圆角裁剪内容
private void clipByRoundedBorder(Graphics2D g2d) {
Border currentBorder = getBorder();
@ -280,6 +298,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
// 设计器预览界面中绘制组件背景效果
public void paintBackground(Graphics2D g2d) {
if (isOpaque()) {
g2d.setColor(getBackground());
g2d.fillRect(0, 0, getWidth(), getHeight());
}
Background background4Painting = getBackground4Painting();
if (background4Painting != null) {
Composite oldComposite = g2d.getComposite();
@ -303,12 +326,12 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
}
public void paintForeground(Graphics2D g2d) {
super.paint(g2d);
super.paintComponent(g2d);
super.paintBorder(g2d);
}
@Override
public void paint(Graphics g) {
public void paintComponent(Graphics g) {
this.clipByRoundedBorder((Graphics2D) g);
this.paintBackground((Graphics2D) g);
this.paintBorderImage((Graphics2D) g);
@ -370,4 +393,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
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
public void propertyChange() {
initStyle();
refreshStylePreviewEffect();
}
}),
};
@ -165,7 +165,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
@Override
protected void initXCreatorProperties() {
super.initXCreatorProperties();
initBorderAndBackgroundStyle();
refreshBorderAndBackgroundStylePreviewEffect();
BaseChartCollection collection = ((BaseChartEditor) data).getChartCollection();
isRefreshing = true;
((MiddleChartComponent) designerEditor.getEditorTarget()).populate(collection);
@ -341,7 +341,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
* data属性改变触发其他操作
*/
public void firePropertyChange() {
initStyle();
refreshStylePreviewEffect();
}
@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();
// 报表块初始化时要加载对应的borderStyle
initBorderAndBackgroundStyle();
refreshBorderAndBackgroundStylePreviewEffect();
}
/**
@ -94,7 +94,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
@Override
public void propertyChange() {
initStyle();
refreshStylePreviewEffect();
}
}),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
@ -342,7 +342,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
*
*/
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
public void propertyChange() {
initStyle();
refreshStylePreviewEffect();
}
}),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
@ -118,7 +118,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
@Override
protected void initXCreatorProperties() {
super.initXCreatorProperties();
initBorderAndBackgroundStyle();
refreshBorderAndBackgroundStylePreviewEffect();
this.initLayoutManager();
this.convert();
}
@ -547,7 +547,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
*
*/
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
public void propertyChange() {
initStyle();
XWAbsoluteBodyLayout.this.refreshStylePreviewEffect();
}
})
};
@ -105,8 +105,8 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
}
@Override
protected void initStyle() {
initBorderAndBackgroundStyle();
public void refreshStylePreviewEffect() {
refreshBorderAndBackgroundStylePreviewEffect();
}
/**
@ -114,7 +114,7 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
*
*/
public void firePropertyChange(){
initStyle();
this.refreshStylePreviewEffect();
}
@Override

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

@ -305,7 +305,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
}
@Override
protected void initStyle() {
public void refreshStylePreviewEffect() {
// 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
protected void initBorderAndBackgroundStyle() {
public void refreshBorderAndBackgroundStylePreviewEffect() {
setBorder(null);
setBorderImage4Painting(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
protected XLayoutContainer getCreatorWrapper(String widgetName) {
initStyle();
refreshStylePreviewEffect();
Dimension dimension = new Dimension();
//主结构是一个borderlayout, 标签部分是north, card部分为center
WCardMainBorderLayout border = new WCardMainBorderLayout();
@ -389,7 +389,7 @@ public class XWCardLayout extends XLayoutContainer {
@Override
public void propertyChange() {
initStyle();
refreshStylePreviewEffect();
}
})
};
@ -397,10 +397,10 @@ public class XWCardLayout extends XLayoutContainer {
//初始化样式
@Override
protected void initStyle() {
public void refreshStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle();
initBorderTitleStyle(style);
initBorderAndBackgroundStyle();
refreshBorderAndBackgroundStylePreviewEffect();
clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE));
}
@ -484,7 +484,7 @@ public class XWCardLayout extends XLayoutContainer {
*/
@Override
public void firePropertyChange() {
initStyle();
refreshStylePreviewEffect();
}
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(){
XWCardLayout cardLayout = this.getCardPart();
if (cardLayout != null && cardLayout.toData() != null) {
cardLayout.initStyle();
cardLayout.refreshStylePreviewEffect();
}
}

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

@ -24,6 +24,8 @@ import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout;
import com.fr.general.act.BorderPacker;
import com.fr.report.core.ReportUtils;
import javax.swing.BorderFactory;
@ -150,7 +152,13 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
if (state == WBodyLayoutType.FIT.getTypeValue()) {
XWFitLayout xwFitLayout = ((XWFitLayout)creator.getBackupParent());
xwFitLayout.switch2FitBodyLayout(creator);
WFitLayout wFitLayout = xwFitLayout.toData();
// 切换布局类型时,保留body背景样式
if (wFitLayout != null) {
wFitLayout.setBorderStyle(layout.getBorderStyle());
}
copyLayoutAttr(layout, xwFitLayout.toData());
xwFitLayout.refreshStylePreviewEffect();
}
}
layout.setBorderStyle(stylePane.updateBean());

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

@ -34,10 +34,12 @@ import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.act.BorderPacker;
import com.fr.log.FineLoggerFactory;
import com.fr.report.core.ReportUtils;
import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;
/**
@ -191,9 +193,12 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
layout.setLayoutType(WBodyLayoutType.parse(state));
layout.setCompState(adaptComboBox.getSelectedIndex());
try {
// 自适应布局切换到绝对布局
if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) {
WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body");
wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED);
// 切换布局类型时,保留body背景样式
wAbsoluteBodyLayout.setBorderStyle((BorderPacker) (layout.getBorderStyle().clone()));
Component[] components = xWFitLayout.getComponents();
xWFitLayout.removeAll();
layout.resetStyle();
@ -215,6 +220,15 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreators(
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) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);

Loading…
Cancel
Save