Browse Source

REPORT-58391 预览图修改

fix-lag
kerry 3 years ago
parent
commit
452d2cb14a
  1. 5
      designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java
  2. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemePreviewPane.java
  3. 16
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
  4. 8
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeDialog.java
  5. 10
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java
  6. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ChartComponentPreviewPane.java
  7. 18
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java
  8. 16
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java
  9. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java
  10. 6
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECComponentPreviewPane.java
  11. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECPreviewPane.java

5
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

4
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<T extends TemplateTheme> extends JPanel implements CallbackEvent, ThemePreviewed<T> {
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<T extends TemplateTheme> extends
@Override
public void paintComponent(Graphics g) {
g.clearRect(0, 0, 517, 532);
g.clearRect(0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT);
paintBackground((Graphics2D) g);
}

16
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<T extends TemplateTheme> 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<T extends TemplateTheme> 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<T extends TemplateTheme> 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() {

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

10
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<T extends TemplateTheme> extends TemplateThemeDialog {
private static final int PADDING_VERTICAL = 4;
public static TemplateThemeProfilePane<? extends TemplateTheme> 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<T> profilePane) {
super(parent, profilePane.getTitle(), CONTENT_WIDTH, CONTENT_HEIGHT);
@ -142,4 +142,8 @@ public class TemplateThemeProfileDialog<T extends TemplateTheme> extends Templat
public static boolean isEditingTheme() {
return currentVisibleProfilePane != null;
}
protected int getPaddingVertical(){
return PADDING_VERTICAL;
}
}

4
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<FormTheme> {
private ChartPreviewPane contentPane;
public ChartComponentPreviewPane(boolean showTitle) {
super(showTitle);
public ChartComponentPreviewPane(String title) {
super(title);
}
@Override

18
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<FormTheme> {
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)

16
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<FormTheme> {
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<FormTheme> {
}
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);
}

2
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java

@ -60,7 +60,7 @@ public class ReportThemePreviewPane extends TemplateThemePreviewPane<ReportTheme
if (background == null) {
background = ColorBackground.getInstance(Color.WHITE);
}
background.paint(g2d, new Rectangle2D.Double(0, 0, 517, 532));
background.paint(g2d, new Rectangle2D.Double(0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT));
}

6
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECComponentPreviewPane.java

@ -5,6 +5,8 @@ import com.fr.design.mainframe.theme.preview.ComponentPreviewPane;
import java.awt.Component;
import static com.fr.design.i18n.Toolkit.i18nText;
/**
* @author Starryi
* @version 1.0
@ -13,6 +15,10 @@ import java.awt.Component;
public class ECComponentPreviewPane extends ComponentPreviewPane {
private ECPreviewPane contentPane;
public ECComponentPreviewPane(){
super(i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Title"));
}
@Override
protected Component createContentPane() {
contentPane = new ECPreviewPane();

7
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECPreviewPane.java

@ -26,8 +26,7 @@ import java.util.List;
*/
public class ECPreviewPane extends AbstractECPreviewPane {
private static String csv =
"城市 当月目标 当月实际完成 月度完成率 全年完成率\n" +
"南通市 324,646 324,646 100% 100%\n" +
"城市 当月目标 当月完成 月完成率 年完成率\n" +
"合肥市 248,938 348,938 140% 140%\n" +
"邵阳市 248,938 348,938 140% 140%\n" +
"合计 1,071,460 1,371,460 128% 128%";
@ -53,7 +52,7 @@ public class ECPreviewPane extends AbstractECPreviewPane {
public ECPreviewPane() {
this.setPreferredSize(new Dimension(517, 170));
this.setPreferredSize(new Dimension(517, 147));
this.setBorder(BorderFactory.createEmptyBorder(0, 1, 2, 1));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
String[] titleArr = DATA_LIST.get(0);
@ -67,7 +66,7 @@ public class ECPreviewPane extends AbstractECPreviewPane {
headerCellList.add(cell);
}
JPanel contentPane = new UINoOpaquePanel(new GridLayout(3, 5, 0, 0));
JPanel contentPane = new UINoOpaquePanel(new GridLayout(2, 5, 0, 0));
this.add(contentPane, BorderLayout.CENTER);
for (int i = 1; i < DATA_LIST.size() - 1; i++) {
String[] textLine = DATA_LIST.get(i);

Loading…
Cancel
Save