Browse Source

REPORT-60012 主题管理-编辑主题-预览界面国际化

research/11.0
kerry 3 years ago
parent
commit
7eefd96056
  1. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java
  2. 59
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECPreviewPane.java
  3. 36
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java

4
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java

@ -65,7 +65,7 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane<FormTheme> {
} }
}; };
columnChartPanel.setLayout(new BorderLayout()); columnChartPanel.setLayout(new BorderLayout());
columnChartPreviewPane = createChartPreviewPane(initColumnChart(), i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Column_Title")); columnChartPreviewPane = createChartPreviewPane(initColumnChart(), i18nText("Design_Basic_Template_Theme_Profile_Pane_Comp_Title1"));
columnChartPanel.add(columnChartPreviewPane, BorderLayout.CENTER); columnChartPanel.add(columnChartPreviewPane, BorderLayout.CENTER);
JPanel pieChartPanel = new UINoOpaquePanel() { JPanel pieChartPanel = new UINoOpaquePanel() {
@ -74,7 +74,7 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane<FormTheme> {
} }
}; };
pieChartPanel.setLayout(new BorderLayout()); pieChartPanel.setLayout(new BorderLayout());
pieChartPreviewPane = createChartPreviewPane(initPieChart(), i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Pie_Title")); pieChartPreviewPane = createChartPreviewPane(initPieChart(), i18nText("Design_Basic_Template_Theme_Profile_Pane_Comp_Title2"));
pieChartPanel.add(pieChartPreviewPane, BorderLayout.CENTER); pieChartPanel.add(pieChartPreviewPane, BorderLayout.CENTER);
chartContent.add(columnChartPanel, BorderLayout.CENTER); chartContent.add(columnChartPanel, BorderLayout.CENTER);
chartContent.add(pieChartPanel, BorderLayout.EAST); chartContent.add(pieChartPanel, BorderLayout.EAST);

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

@ -2,20 +2,16 @@ package com.fr.design.mainframe.theme.preview.ecpreview;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyleList; import com.fr.base.theme.settings.ThemedCellStyleList;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.theme.preview.UINoOpaquePanel; import com.fr.design.mainframe.theme.preview.UINoOpaquePanel;
import com.fr.design.mainframe.theme.preview.ecpreview.cell.AbstractPreviewCell; import com.fr.design.mainframe.theme.preview.ecpreview.cell.AbstractPreviewCell;
import com.fr.design.mainframe.theme.preview.ecpreview.cell.PreviewCell; import com.fr.design.mainframe.theme.preview.ecpreview.cell.PreviewCell;
import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.io.BufferedReader;
import java.io.StringReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -25,70 +21,39 @@ import java.util.List;
* Created by Starryi on 2021/8/13 * Created by Starryi on 2021/8/13
*/ */
public class ECPreviewPane extends AbstractECPreviewPane { public class ECPreviewPane extends AbstractECPreviewPane {
private static String csv = private final List<AbstractPreviewCell> headerCellList = new ArrayList<>();
"城市 当月目标 当月完成 月完成率 年完成率\n" + private final List<AbstractPreviewCell> contentCellList = new ArrayList<>();
"合肥市 248,938 348,938 140% 140%\n" + private final List<AbstractPreviewCell> highLightCellList = new ArrayList<>();
"邵阳市 248,938 348,938 140% 140%\n" +
"合计 1,071,460 1,371,460 128% 128%";
private final List<String[]> DATA_LIST = createDataList();
private static final String BLANK_CHAR = " ";
private List<AbstractPreviewCell> headerCellList = new ArrayList<>();
private List<AbstractPreviewCell> contentCellList = new ArrayList<>();
private List<AbstractPreviewCell> hightLightCellList = new ArrayList<>();
private List<String[]> createDataList() {
List<String[]> data = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new StringReader(csv))) {
String textLine;
while ((textLine = reader.readLine()) != null) {
String[] texts = textLine.split(BLANK_CHAR);
data.add(texts);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return data;
}
public ECPreviewPane() { public ECPreviewPane() {
this.setPreferredSize(new Dimension(517, 147)); this.setPreferredSize(new Dimension(517, 147));
this.setBorder(BorderFactory.createEmptyBorder(0, 1, 2, 1)); this.setBorder(BorderFactory.createEmptyBorder(0, 1, 2, 1));
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
String[] titleArr = DATA_LIST.get(0);
String[] endArr = DATA_LIST.get(DATA_LIST.size() - 1);
JPanel titlePane = new UINoOpaquePanel(new GridLayout()); JPanel titlePane = new UINoOpaquePanel(new GridLayout());
this.add(titlePane, BorderLayout.NORTH); this.add(titlePane, BorderLayout.NORTH);
for (String title : titleArr) { for (int i = 0; i < 5; i++) {
PreviewCell cell = new PreviewCell(title); PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
cell.setPreferredSize(new Dimension(103, 36)); cell.setPreferredSize(new Dimension(103, 36));
titlePane.add(cell); titlePane.add(cell);
headerCellList.add(cell); headerCellList.add(cell);
} }
JPanel contentPane = new UINoOpaquePanel(new GridLayout(2, 5, 0, 0)); JPanel contentPane = new UINoOpaquePanel(new GridLayout(2, 5, 0, 0));
this.add(contentPane, BorderLayout.CENTER); this.add(contentPane, BorderLayout.CENTER);
for (int i = 1; i < DATA_LIST.size() - 1; i++) { for (int i = 0; i < 10; i++) {
String[] textLine = DATA_LIST.get(i); PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text"));
for (int j = 0; j < textLine.length; j++) {
String text = textLine[j];
PreviewCell cell = new PreviewCell(text);
cell.setPreferredSize(new Dimension(103, 33)); cell.setPreferredSize(new Dimension(103, 33));
contentPane.add(cell); contentPane.add(cell);
contentCellList.add(cell); contentCellList.add(cell);
} }
}
JPanel endPane = new UINoOpaquePanel(new GridLayout()); JPanel endPane = new UINoOpaquePanel(new GridLayout());
this.add(endPane, BorderLayout.SOUTH); this.add(endPane, BorderLayout.SOUTH);
for (String text : endArr) { for (int i = 0; i < 5; i++) {
PreviewCell cell = new PreviewCell(text); PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text"));
cell.setPreferredSize(new Dimension(103, 33)); cell.setPreferredSize(new Dimension(103, 33));
endPane.add(cell); endPane.add(cell);
hightLightCellList.add(cell); highLightCellList.add(cell);
} }
} }
@Override @Override
@ -96,7 +61,7 @@ public class ECPreviewPane extends AbstractECPreviewPane {
ThemedCellStyleList cellStyleConfig = theme.getCellStyleList(); ThemedCellStyleList cellStyleConfig = theme.getCellStyleList();
refresh(headerCellList, getReportHeaderStyle(cellStyleConfig)); refresh(headerCellList, getReportHeaderStyle(cellStyleConfig));
refresh(contentCellList, getMainContentStyle(cellStyleConfig)); refresh(contentCellList, getMainContentStyle(cellStyleConfig));
refresh(hightLightCellList, getHighLightStyle(cellStyleConfig)); refresh(highLightCellList, getHighLightStyle(cellStyleConfig));
} }

36
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java

@ -22,13 +22,13 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreviewed<ReportTheme> { public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreviewed<ReportTheme> {
private List<AbstractPreviewCell> headerTitleCellList = new ArrayList<>(); private final List<AbstractPreviewCell> headerTitleCellList = new ArrayList<>();
private List<AbstractPreviewCell> headerCellList = new ArrayList<>(); private final List<AbstractPreviewCell> headerCellList = new ArrayList<>();
private List<AbstractPreviewCell> titleCellList = new ArrayList<>(); private final List<AbstractPreviewCell> titleCellList = new ArrayList<>();
private List<AbstractPreviewCell> contentCellList = new ArrayList<>(); private final List<AbstractPreviewCell> contentCellList = new ArrayList<>();
private List<AbstractPreviewCell> highLightCellList = new ArrayList<>(); private final List<AbstractPreviewCell> highLightCellList = new ArrayList<>();
private PreviewPane previewPane; private final PreviewPane previewPane;
public ECReportPreviewPane() { public ECReportPreviewPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -58,26 +58,26 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
private JPanel createNorthPane() { private JPanel createNorthPane() {
JPanel northPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); JPanel northPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
AbstractPreviewCell bigTitleCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Big_Title")); AbstractPreviewCell bigTitleCell = new PreviewCell(Toolkit.i18nText("Design_Basic_Template_Theme_Profile_Pane_Cell_Style_Big_Title"));
bigTitleCell.setPreferredSize(new Dimension(615, 46)); bigTitleCell.setPreferredSize(new Dimension(615, 46));
headerTitleCellList.add(bigTitleCell); headerTitleCellList.add(bigTitleCell);
northPane.add(bigTitleCell, BorderLayout.NORTH); northPane.add(bigTitleCell, BorderLayout.NORTH);
CornerPreviewCell cornerCell = new CornerPreviewCell(new String[]{Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Product"), CornerPreviewCell cornerCell = new CornerPreviewCell(new String[]{Toolkit.i18nText("Fine-Design_Basic_Column_Name"),
Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Data"), Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Statistical_Dimension")}, Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Data"), Toolkit.i18nText("Design_Basic_Template_Theme_Profile_Pane_Row_Name")},
new Point2D[]{new Point(159, 71), new Point(225, 49)}); new Point2D[]{new Point(159, 71), new Point(225, 49)});
cornerCell.setPreferredSize(new Dimension(225, 71)); cornerCell.setPreferredSize(new Dimension(225, 71));
headerCellList.add(cornerCell); headerCellList.add(cornerCell);
northPane.add(cornerCell, BorderLayout.WEST); northPane.add(cornerCell, BorderLayout.WEST);
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
northPane.add(centerPane, BorderLayout.CENTER); northPane.add(centerPane, BorderLayout.CENTER);
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Statistical_By_Area")); PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Small_Title"));
titleCellList.add(cell); titleCellList.add(cell);
cell.setPreferredSize(new Dimension(308, 38)); cell.setPreferredSize(new Dimension(308, 38));
centerPane.add(cell, BorderLayout.NORTH); centerPane.add(cell, BorderLayout.NORTH);
JPanel eastSouthPane = new UINoOpaquePanel(new GridLayout()); JPanel eastSouthPane = new UINoOpaquePanel(new GridLayout());
PreviewCell cell1 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_East_China")); PreviewCell cell1 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
PreviewCell cell2 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_South_China")); PreviewCell cell2 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
PreviewCell cell3 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Subtotal")); PreviewCell cell3 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
headerCellList.add(cell1); headerCellList.add(cell1);
headerCellList.add(cell2); headerCellList.add(cell2);
headerCellList.add(cell3); headerCellList.add(cell3);
@ -92,13 +92,13 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
JPanel westPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); JPanel westPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
centerPane.add(westPane, BorderLayout.WEST); centerPane.add(westPane, BorderLayout.WEST);
PreviewCell cell1 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Drink")); PreviewCell cell1 = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Small_Title"));
titleCellList.add(cell1); titleCellList.add(cell1);
cell1.setPreferredSize(new Dimension(112, 153)); cell1.setPreferredSize(new Dimension(112, 153));
westPane.add(cell1, BorderLayout.WEST); westPane.add(cell1, BorderLayout.WEST);
JPanel gridPane = new UINoOpaquePanel(new GridLayout(5, 1)); JPanel gridPane = new UINoOpaquePanel(new GridLayout(5, 1));
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Apple_Juice")); PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
cell.setPreferredSize(new Dimension(113, 31)); cell.setPreferredSize(new Dimension(113, 31));
headerCellList.add(cell); headerCellList.add(cell);
gridPane.add(cell); gridPane.add(cell);
@ -108,13 +108,15 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
JPanel innerCenterPane = new UINoOpaquePanel(new GridLayout(5, 3)); JPanel innerCenterPane = new UINoOpaquePanel(new GridLayout(5, 3));
centerPane.add(innerCenterPane, BorderLayout.CENTER); centerPane.add(innerCenterPane, BorderLayout.CENTER);
for (int i = 0; i < 15; i++) { for (int i = 0; i < 15; i++) {
PreviewCell cell = new PreviewCell("35600"); PreviewCell cell ;
cell.setPreferredSize(new Dimension(123, 31));
if ((i + 1) % 3 == 0) { if ((i + 1) % 3 == 0) {
cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text"));
highLightCellList.add(cell); highLightCellList.add(cell);
} else { } else {
cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text"));
contentCellList.add(cell); contentCellList.add(cell);
} }
cell.setPreferredSize(new Dimension(123, 31));
innerCenterPane.add(cell); innerCenterPane.add(cell);
} }

Loading…
Cancel
Save