From 452d2cb14ab8c0efb60dc70e6f89676207eadeb3 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 3 Sep 2021 17:52:13 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-58391=20=E9=A2=84=E8=A7=88=E5=9B=BE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../theme/ReportThemeProfilePane.java | 5 ----- .../theme/TemplateThemePreviewPane.java | 4 +++- .../theme/TemplateThemeProfilePane.java | 16 +++++++++------- .../theme/dialog/TemplateThemeDialog.java | 8 +++++++- .../dialog/TemplateThemeProfileDialog.java | 10 +++++++--- .../preview/ChartComponentPreviewPane.java | 4 ++-- .../theme/preview/ComponentPreviewPane.java | 18 ++++++++++++------ .../theme/preview/FormThemePreviewPane.java | 16 +++++++++------- .../theme/preview/ReportThemePreviewPane.java | 2 +- .../ecpreview/ECComponentPreviewPane.java | 6 ++++++ .../theme/preview/ecpreview/ECPreviewPane.java | 7 +++---- 11 files changed, 59 insertions(+), 37 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java index 59f3ace8c1..5a1bff3c0f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java @@ -1,16 +1,11 @@ package com.fr.design.mainframe.theme; -import com.fr.base.theme.FineColorManager; import com.fr.base.theme.ReportTheme; import com.fr.base.theme.TemplateThemeConfig; -import com.fr.base.theme.settings.ThemedReportBodyStyle; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.theme.edit.ReportBodyStyleEditPane; import com.fr.design.mainframe.theme.preview.ReportThemePreviewPane; - import javax.swing.JPanel; -import java.awt.Color; -import java.util.List; /** * @author Starryi diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemePreviewPane.java index fab425fbe7..153929707d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemePreviewPane.java @@ -22,6 +22,8 @@ import java.awt.image.BufferedImage; */ public abstract class TemplateThemePreviewPane extends JPanel implements CallbackEvent, ThemePreviewed { private JPanel parent; + public static final int PREVIEW_WIDTH = 627; + public static final int PREVIEW_HEIGHT = 532; public void setParent(JPanel parent) { this.parent = parent; @@ -85,7 +87,7 @@ public abstract class TemplateThemePreviewPane extends @Override public void paintComponent(Graphics g) { - g.clearRect(0, 0, 517, 532); + g.clearRect(0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT); paintBackground((Graphics2D) g); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java index fa6d087dbd..9e63e2240b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java @@ -5,6 +5,7 @@ import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.settings.ThemeThumbnail; import com.fr.base.theme.settings.ThemedCellStyleList; +import com.fr.base.theme.settings.ThemedChartStyle; import com.fr.base.theme.settings.ThemedColorScheme; import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.FineJOptionPane; @@ -26,9 +27,12 @@ import com.fr.design.mainframe.theme.edit.ui.ColorListPane; import com.fr.design.mainframe.theme.edit.ui.LabelUtils; import com.fr.design.mainframe.theme.ui.BorderUtils; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.transaction.CallBackAdaptor; +import com.fr.transaction.Configurations; +import com.fr.transaction.WorkerFacade; import javax.swing.BorderFactory; import javax.swing.JComponent; @@ -40,7 +44,6 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import java.util.List; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -52,6 +55,7 @@ import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.util.List; import static com.fr.design.i18n.Toolkit.i18nText; @@ -62,12 +66,12 @@ import static com.fr.design.i18n.Toolkit.i18nText; */ public abstract class TemplateThemeProfilePane extends AbstractAttrNoScrollPane { public static final int TITLE_BORDER_FONT = 12; - public static final int LEFT_TITLE_PANE_WIDTH = 397; - public static final int LEFT_TITLE_PANE_HEIGHT = 532 + TITLE_BORDER_FONT / 2 + 10; + public static final int LEFT_TITLE_PANE_WIDTH = 627; + public static final int LEFT_TITLE_PANE_HEIGHT = 539; public static final int PREVIEW_PANE_WIDTH = LEFT_TITLE_PANE_WIDTH - 10; public static final int PREVIEW_PANE_HEIGHT = LEFT_TITLE_PANE_HEIGHT - TITLE_BORDER_FONT - 16; - public static final int RIGHT_PANE_WIDTH = 362; + public static final int RIGHT_PANE_WIDTH = 352; public static final int RIGHT_PANE_HEIGHT = LEFT_TITLE_PANE_HEIGHT; public static final int COLOR_SCHEME_TITLE_PANE_WIDTH = 298; public static final int COLOR_SCHEME_TITLE_PANE_HEIGHT = 174 + TITLE_BORDER_FONT / 2; @@ -143,8 +147,6 @@ public abstract class TemplateThemeProfilePane extends themePreviewPane = createThemePreviewPane(); themePreviewPane.setPreferredSize(new Dimension(PREVIEW_PANE_WIDTH, PREVIEW_PANE_HEIGHT)); - themePreviewPane.setPreferredSize(new Dimension(PREVIEW_PANE_WIDTH, PREVIEW_PANE_HEIGHT)); - previewContainer.add(themePreviewPane, BorderLayout.CENTER); return titleContainer; @@ -286,7 +288,7 @@ public abstract class TemplateThemeProfilePane extends return container; } public void addCustomEditorPane(String title, JComponent component) { - component.setPreferredSize(new Dimension(360, 260)); + component.setPreferredSize(new Dimension(317, 239)); uiTabbedPane.addTab(title, component); } protected JPanel createCellStyleSettingPane() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeDialog.java index 69a057d65f..ed2e22d29b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeDialog.java @@ -67,7 +67,7 @@ public abstract class TemplateThemeDialog extends JDialog { private JPanel createActionsContainer(int align, UIButton... buttons) { JPanel container = new JPanel(new FlowLayout(align, DIALOG_BOTTOM_ACTION_BUTTON_GAP, 0)); - int paddingVertical = (DIALOG_BOTTOM_ACTION_BAR_HEIGHT - DIALOG_BOTTOM_ACTION_BUTTON_HEIGHT) / 2; + int paddingVertical = getPaddingVertical(); container.setBorder(BorderFactory.createEmptyBorder(paddingVertical, 0, paddingVertical, 0)); if (buttons == null || buttons.length == 0) { @@ -84,6 +84,12 @@ public abstract class TemplateThemeDialog extends JDialog { return container; } + protected int getPaddingVertical(){ + return (DIALOG_BOTTOM_ACTION_BAR_HEIGHT - DIALOG_BOTTOM_ACTION_BUTTON_HEIGHT) / 2; + } + + + private JPanel createActionsContainer(UIButton[] leftButtons, UIButton[] rightButtons) { JPanel leftPane = createActionsContainer(FlowLayout.LEFT, leftButtons); JPanel rightPane = createActionsContainer(FlowLayout.RIGHT, rightButtons); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java index f0eeb2f48b..a1db7f5651 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java @@ -33,11 +33,11 @@ import java.util.List; * Created by Starryi on 2021/8/13 */ public class TemplateThemeProfileDialog extends TemplateThemeDialog { - + private static final int PADDING_VERTICAL = 4; public static TemplateThemeProfilePane currentVisibleProfilePane; - public static final int CONTENT_WIDTH = 910; - public static final int CONTENT_HEIGHT = 570; + public static final int CONTENT_WIDTH = 1000; + public static final int CONTENT_HEIGHT = 542; public TemplateThemeProfileDialog(Window parent, TemplateThemeProfilePane profilePane) { super(parent, profilePane.getTitle(), CONTENT_WIDTH, CONTENT_HEIGHT); @@ -142,4 +142,8 @@ public class TemplateThemeProfileDialog extends Templat public static boolean isEditingTheme() { return currentVisibleProfilePane != null; } + + protected int getPaddingVertical(){ + return PADDING_VERTICAL; + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ChartComponentPreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ChartComponentPreviewPane.java index 261804b4b5..5c000749f8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ChartComponentPreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ChartComponentPreviewPane.java @@ -12,8 +12,8 @@ import java.awt.Component; public class ChartComponentPreviewPane extends ComponentPreviewPane implements ThemePreviewed { private ChartPreviewPane contentPane; - public ChartComponentPreviewPane(boolean showTitle) { - super(showTitle); + public ChartComponentPreviewPane(String title) { + super(title); } @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java index d7bdfadfd9..cb854a3f35 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java @@ -14,6 +14,7 @@ import com.fr.general.Background; import com.fr.general.act.BorderPacker; import com.fr.general.act.TitlePacker; import com.fr.stable.Constants; +import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -42,21 +43,21 @@ import java.awt.geom.RoundRectangle2D; * Created by Starryi on 2021/8/13 */ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements ThemePreviewed { - public static final int TITLE_HEIGHT = 35; + public static final int TITLE_HEIGHT = 46; private final JPanel container; private TitleDemoPane titlePane; private BorderPacker style = new LayoutBorderStyle(); public ComponentPreviewPane(){ - this(false); + this(StringUtils.EMPTY); } - public ComponentPreviewPane(boolean showTitle) { + public ComponentPreviewPane(String title) { container = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); setLayout(new BorderLayout()); - if (showTitle) { - titlePane = new TitleDemoPane(); + if (StringUtils.isNotEmpty(title)) { + titlePane = new TitleDemoPane(title); titlePane.setPreferredSize(new Dimension(517, TITLE_HEIGHT)); container.add(titlePane, BorderLayout.NORTH); } @@ -108,6 +109,11 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th private static class TitleDemoPane extends UINoOpaquePanel { private final Label data = new Label(); + private String title = StringUtils.EMPTY; + + public TitleDemoPane(String title){ + this.title = title; + } public void refresh(ThemedComponentStyle componentStyle) { BorderPacker borderPacker = componentStyle.getStyle(); @@ -144,7 +150,7 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th BaseUtils.drawStringStyleInRotation(g2d, getWidth(), getHeight(), - data.getWidgetValue().toString(), + title, Style.getInstance(data.getFont()) .deriveHorizontalAlignment(data.getTextalign()) .deriveVerticalAlignment(data.isVerticalCenter() ? SwingConstants.CENTER : SwingConstants.TOP) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java index 8b96eba4b9..18ac4b962d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java @@ -33,6 +33,8 @@ import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; +import static com.fr.design.i18n.Toolkit.i18nText; + /** * @author Starryi * @version 1.0 @@ -59,28 +61,28 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane { chartContent.setLayout(new BorderLayout()); JPanel columnChartPanel = new UINoOpaquePanel() { public Dimension getPreferredSize() { - return new Dimension(300, 368); + return new Dimension(379, 314); } }; columnChartPanel.setLayout(new BorderLayout()); - columnChartPreviewPane = createChartPreviewPane(initColumnChart(), 300, 368); + columnChartPreviewPane = createChartPreviewPane(initColumnChart(), i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Column_Title")); columnChartPanel.add(columnChartPreviewPane, BorderLayout.CENTER); JPanel pieChartPanel = new UINoOpaquePanel() { public Dimension getPreferredSize() { - return new Dimension(217, 368); + return new Dimension(236, 314); } }; pieChartPanel.setLayout(new BorderLayout()); - pieChartPreviewPane = createChartPreviewPane(initPieChart(), 217, 368); + pieChartPreviewPane = createChartPreviewPane(initPieChart(), i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Pie_Title")); pieChartPanel.add(pieChartPreviewPane, BorderLayout.CENTER); chartContent.add(columnChartPanel, BorderLayout.CENTER); chartContent.add(pieChartPanel, BorderLayout.EAST); return chartContent; } - private ChartComponentPreviewPane createChartPreviewPane(ChartCollection chartCollection, int width, int height) { - ChartComponentPreviewPane chartComponentPreviewPane = new ChartComponentPreviewPane(true); + private ChartComponentPreviewPane createChartPreviewPane(ChartCollection chartCollection, String title) { + ChartComponentPreviewPane chartComponentPreviewPane = new ChartComponentPreviewPane(title); chartComponentPreviewPane.getContentPane().populate(chartCollection); chartComponentPreviewPane.getContentPane().setCallbackEvent(this); return chartComponentPreviewPane; @@ -103,7 +105,7 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane { } Composite oldComposite = g2d.getComposite(); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); - background.paint(g2d, new Rectangle2D.Double(0, 0, 517, 532)); + background.paint(g2d, new Rectangle2D.Double(0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT)); g2d.setComposite(oldComposite); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java index ce4f4f49be..e4b4ee7a98 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java @@ -60,7 +60,7 @@ public class ReportThemePreviewPane extends TemplateThemePreviewPane