Browse Source

Pull request #5716: CHART-20568 & REPORT-58698

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

* commit 'a40589755a7fc8de955ca7be33d8fbb6ff738531':
  REPORT-58901 FR11-二轮回归-非中文 设计器启动时闪退
  REPORT-58397【主题切换】主题顺序更新不生效
  REPORT-58902 【主题切换】打开frm模板的时候编辑cpt的主题,保存后右侧面板显示的是单元格的样式
  REPORT-58403 【主题切换】组件右侧边框标题部分,间距有点大
  REPORT-58589 【主题切换】单元格样式很多时,多次选择样式以后会概率遇到样式没有选中的情况
  REPORT-58503 【主题切换】预览区ui改版
  REPORT-58698 主题切换-主题配置相关问题
  REPORT-58698 主题切换-主题配置相关问题
  CHART-20568 [产品验收]设计器预览页面图表组件鬼畜
persist/11.0
ju|剧浩宇 3 years ago
parent
commit
a11b2bd32d
  1. 8
      designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java
  2. 7
      designer-base/src/main/java/com/fr/design/gui/style/ComponentTitleStylePane.java
  3. 12
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java
  4. 10
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java
  5. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java
  6. 8
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemePreviewPane.java
  7. 11
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java
  8. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java
  9. 16
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java
  10. 19
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/AbstractECPreviewPane.java
  11. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java
  12. 15
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  13. 3
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  14. 18
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java

8
designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java

@ -3,13 +3,13 @@ package com.fr.design.cell;
import com.fr.base.NameStyle; import com.fr.base.NameStyle;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.general.IOUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Image; import java.awt.image.BufferedImage;
import java.awt.Toolkit;
/** /**
* @author Starryi * @author Starryi
@ -18,7 +18,7 @@ import java.awt.Toolkit;
*/ */
public class CellStylePreviewPane extends JPanel { public class CellStylePreviewPane extends JPanel {
private static final Image transparentBackgroundImage = Toolkit.getDefaultToolkit().createImage(CellStylePreviewPane.class.getResource("/com/fr/design/images/transparent_background.png")); private static final BufferedImage transparentBackgroundImage = IOUtils.readImage("/com/fr/design/images/transparent_background.png");
private final float transparentBackgroundWidth; private final float transparentBackgroundWidth;
private final float transparentBackgroundHeight; private final float transparentBackgroundHeight;
private String paintText = "Report"; private String paintText = "Report";
@ -38,7 +38,7 @@ public class CellStylePreviewPane extends JPanel {
} }
@Override @Override
public void paintComponent(Graphics g) { public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
int resolution = ScreenResolution.getScreenResolution(); int resolution = ScreenResolution.getScreenResolution();

7
designer-base/src/main/java/com/fr/design/gui/style/ComponentTitleStylePane.java

@ -303,16 +303,19 @@ public class ComponentTitleStylePane extends AbstractBorderPackerPane {
return; return;
} }
JPanel container = this; JPanel container = this;
for (JComponent component: components) { for (int i = 0; i < components.length; i++) {
JComponent component = components[i];
if (component != null) { if (component != null) {
container.add(component, BorderLayout.NORTH); container.add(component, BorderLayout.NORTH);
component.setBorder(BorderFactory.createEmptyBorder(i == 0 ? 0 : IntervalConstants.INTERVAL_L1, 0, 0, 0));
if (i < components.length - 1) {
JPanel nextContainer = new JPanel(FRGUIPaneFactory.createBorderLayout()); JPanel nextContainer = new JPanel(FRGUIPaneFactory.createBorderLayout());
nextContainer.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0));
container.add(nextContainer, BorderLayout.CENTER); container.add(nextContainer, BorderLayout.CENTER);
container = nextContainer; container = nextContainer;
} }
} }
} }
}
public void setSupportTitleVisible(boolean supporting) { public void setSupportTitleVisible(boolean supporting) {

12
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java

@ -37,8 +37,9 @@ import java.awt.event.MouseEvent;
* Created by Starryi on 2021/8/13 * Created by Starryi on 2021/8/13
*/ */
public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel { public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
public static final int HEIGHT = 150; public static final int INFO_HEIGHT = 30;
public static final int THUMBNAIL_HEIGHT = 125; public static final int CONTENT_WIDTH = ThemeThumbnail.WIDTH;
public static final int CONTENT_HEIGHT = ThemeThumbnail.HEIGHT + INFO_HEIGHT;
private static final Color HOVERING_BORDER_COLOR = new Color(65, 155, 249); private static final Color HOVERING_BORDER_COLOR = new Color(65, 155, 249);
private final String name; private final String name;
@ -97,13 +98,14 @@ public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
private void initializePane() { private void initializePane() {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
setPreferredSize(new Dimension(getPreferredSize().width, HEIGHT)); setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
setBackground(Color.WHITE); setBackground(Color.WHITE);
thumbnailPane.setBackground(Color.WHITE); thumbnailPane.setBackground(Color.WHITE);
thumbnailPane.setPreferredSize(new Dimension(getPreferredSize().width, THUMBNAIL_HEIGHT)); thumbnailPane.setPreferredSize(new Dimension(ThemeThumbnail.WIDTH, ThemeThumbnail.HEIGHT));
JPanel infoPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel infoPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
infoPane.setPreferredSize(new Dimension(CONTENT_WIDTH, INFO_HEIGHT));
infoPane.setBackground(Color.WHITE); infoPane.setBackground(Color.WHITE);
infoPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L7,0,IntervalConstants.INTERVAL_L7)); infoPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L7,0,IntervalConstants.INTERVAL_L7));
@ -129,6 +131,8 @@ public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
} }
} }
thumbnailPane.setThumbnail(image); thumbnailPane.setThumbnail(image);
invalidate();
repaint();
} }
public T getTheme() { public T getTheme() {

10
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.theme;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemeThumbnail;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.event.ChangeEvent; import com.fr.design.event.ChangeEvent;
@ -29,7 +30,9 @@ import java.util.Map;
public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane { public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
public static final int BLOCK_COUNT_ROW_LINE = 3; public static final int BLOCK_COUNT_ROW_LINE = 3;
public static final int BLOCK_GAP = IntervalConstants.INTERVAL_L1; public static final int BLOCK_GAP = IntervalConstants.INTERVAL_L1;
public static final int CONTENT_WIDTH = 630; public static final int CONTENT_WIDTH = TemplateThemeBlock.CONTENT_WIDTH * BLOCK_COUNT_ROW_LINE + BLOCK_GAP * (BLOCK_COUNT_ROW_LINE - 1) + 10;
public static final int BLOCK_ROWS_PER_PAGE = 3;
public static final int CONTENT_HEIGHT = TemplateThemeBlock.CONTENT_HEIGHT * BLOCK_ROWS_PER_PAGE + BLOCK_GAP * (BLOCK_ROWS_PER_PAGE + 1);
public static final int ASYNC_FETCH_THEME_THREAD_COUNT = 10; public static final int ASYNC_FETCH_THEME_THREAD_COUNT = 10;
private final AsyncThemeFetcher<T> asyncThemeFetcher; private final AsyncThemeFetcher<T> asyncThemeFetcher;
@ -59,7 +62,7 @@ public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
private void initializePane() { private void initializePane() {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
setPreferredSize(new Dimension(CONTENT_WIDTH, getPreferredSize().height)); setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
contentListPane.setBorder(BorderFactory.createEmptyBorder(BLOCK_GAP, 0, BLOCK_GAP, 0)); contentListPane.setBorder(BorderFactory.createEmptyBorder(BLOCK_GAP, 0, BLOCK_GAP, 0));
contentListPane.setLayout(new GridLayout(0, BLOCK_COUNT_ROW_LINE, BLOCK_GAP, BLOCK_GAP)); contentListPane.setLayout(new GridLayout(0, BLOCK_COUNT_ROW_LINE, BLOCK_GAP, BLOCK_GAP));
@ -173,7 +176,10 @@ public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
} }
case UPDATE: { case UPDATE: {
if (existingBlock != null) { if (existingBlock != null) {
fillContentListPane();
asyncFetchTheme(themeName); asyncFetchTheme(themeName);
validate();
repaint();
} }
break; break;
} }

7
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java

@ -17,15 +17,12 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.theme.dialog.TemplateThemeProfileDialog; import com.fr.design.mainframe.theme.dialog.TemplateThemeProfileDialog;
import com.fr.design.mainframe.theme.edit.CellStyleListEditPane;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
@ -55,6 +52,8 @@ import static com.fr.design.i18n.Toolkit.i18nText;
* Created by Starryi on 2021/8/13 * Created by Starryi on 2021/8/13
*/ */
public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane { public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane {
public static final int CONTENT_WIDTH = TemplateThemeListPane.CONTENT_WIDTH + 10;
public static final int CONTENT_HEIGHT = TemplateThemeListPane.CONTENT_HEIGHT + 37;
private final RemoveThemeAction removeAction; private final RemoveThemeAction removeAction;
private final UIButton setTheme4NewTemplateButton; private final UIButton setTheme4NewTemplateButton;
@ -94,6 +93,7 @@ public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane
private void initializePane() { private void initializePane() {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
add(createActionsContainer(), BorderLayout.NORTH); add(createActionsContainer(), BorderLayout.NORTH);
@ -102,7 +102,6 @@ public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane
nextContainer.add(new JSeparator(), BorderLayout.NORTH); nextContainer.add(new JSeparator(), BorderLayout.NORTH);
themeListPane.setPreferredSize(new Dimension(themeListPane.getPreferredSize().width, 490));
themeListPane.setSelectedChangeListener(new ChangeListener() { themeListPane.setSelectedChangeListener(new ChangeListener() {
@Override @Override
public void fireChanged(ChangeEvent event) { public void fireChanged(ChangeEvent event) {

8
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemePreviewPane.java

@ -43,17 +43,9 @@ public abstract class TemplateThemePreviewPane<T extends TemplateTheme> extends
int thumbnailWidth = ThemeThumbnail.WIDTH; int thumbnailWidth = ThemeThumbnail.WIDTH;
int thumbnailHeight = ThemeThumbnail.HEIGHT; int thumbnailHeight = ThemeThumbnail.HEIGHT;
float thumbnailAspect = 1.0F * thumbnailWidth / thumbnailHeight;
int width = getWidth(); int width = getWidth();
int height = getHeight(); int height = getHeight();
float aspect = 1.0F * width / height;
if (thumbnailAspect > aspect) {
height = (int) (width / thumbnailAspect);
} else {
width = (int) (height * thumbnailAspect);
}
try { try {
// 使用TYPE_INT_RGB和new Color(255, 255, 255, 1)设置有透明背景buffer image, // 使用TYPE_INT_RGB和new Color(255, 255, 255, 1)设置有透明背景buffer image,

11
designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java

@ -10,11 +10,13 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.theme.TemplateThemeListPane;
import com.fr.design.mainframe.theme.TemplateThemeManagePane; import com.fr.design.mainframe.theme.TemplateThemeManagePane;
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.Window; import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -25,13 +27,12 @@ import java.awt.event.ActionListener;
* Created by Starryi on 2021/8/13 * Created by Starryi on 2021/8/13
*/ */
public class TemplateThemeManageDialog extends TemplateThemeDialog { public class TemplateThemeManageDialog extends TemplateThemeDialog {
public static final int CONTENT_WIDTH = 660;
public static final int CONTENT_HEIGHT = 570;
private final TemplateThemeManageDialogContentPane contentPane; private final TemplateThemeManageDialogContentPane contentPane;
public TemplateThemeManageDialog(Window parent) { public TemplateThemeManageDialog(Window parent) {
super(parent, Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Title"), CONTENT_WIDTH, CONTENT_HEIGHT); super(parent, Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Title"),
TemplateThemeManageDialogContentPane.CONTENT_WIDTH, TemplateThemeManageDialogContentPane.CONTENT_HEIGHT);
contentPane = new TemplateThemeManageDialogContentPane(); contentPane = new TemplateThemeManageDialogContentPane();
setContentPane(createDialogContentPane(contentPane, new UIButton[]{ createCompleteButton() })); setContentPane(createDialogContentPane(contentPane, new UIButton[]{ createCompleteButton() }));
@ -55,12 +56,16 @@ public class TemplateThemeManageDialog extends TemplateThemeDialog {
} }
public static class TemplateThemeManageDialogContentPane extends JPanel { public static class TemplateThemeManageDialogContentPane extends JPanel {
public static final int CONTENT_WIDTH = TemplateThemeManagePane.CONTENT_WIDTH + 24;
public static final int CONTENT_HEIGHT = TemplateThemeManagePane.CONTENT_HEIGHT + 40;
private final TemplateThemeManagePane<FormTheme> formThemesManagerPane; private final TemplateThemeManagePane<FormTheme> formThemesManagerPane;
private final TemplateThemeManagePane<ReportTheme> reportThemesManagerPane; private final TemplateThemeManagePane<ReportTheme> reportThemesManagerPane;
public TemplateThemeManageDialogContentPane() { public TemplateThemeManageDialogContentPane() {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
UITabbedPane tabbedPane = new UITabbedPane(); UITabbedPane tabbedPane = new UITabbedPane();
add(tabbedPane, BorderLayout.NORTH); add(tabbedPane, BorderLayout.NORTH);

4
designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java

@ -27,8 +27,8 @@ import java.awt.event.ActionListener;
*/ */
public class public class
TemplateThemeUsingDialog<T extends TemplateTheme> extends TemplateThemeDialog { TemplateThemeUsingDialog<T extends TemplateTheme> extends TemplateThemeDialog {
public static final int CONTENT_WIDTH = 660; public static final int CONTENT_WIDTH = TemplateThemeListPane.CONTENT_WIDTH + 42;
public static final int CONTENT_HEIGHT = 515; public static final int CONTENT_HEIGHT = TemplateThemeListPane.CONTENT_HEIGHT + 23;
private final TemplateThemeListPane<T> themeListPane; private final TemplateThemeListPane<T> themeListPane;
private final ThemedTemplate currentTemplate; private final ThemedTemplate currentTemplate;

16
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java

@ -229,7 +229,7 @@ public class CellStyleListEditPane extends JListControlPane {
if (selectModel != null) { if (selectModel != null) {
NameObject selectNameObject = (NameObject) selectModel.wrapper; NameObject selectNameObject = (NameObject) selectModel.wrapper;
ThemedCellStyle cellStyle = (ThemedCellStyle) (selectNameObject.getObject()); ThemedCellStyle cellStyle = (ThemedCellStyle) (selectNameObject.getObject());
this.shortCut.setEnabled(cellStyle.isRemovable() && !cellStyle.isDefault4New()); this.shortCut.setEnabled(cellStyle.isRemovable() && !cellStyle.isUse4Default());
} else { } else {
this.shortCut.setEnabled(false); this.shortCut.setEnabled(false);
} }
@ -266,9 +266,13 @@ public class CellStyleListEditPane extends JListControlPane {
cellStyle.setName(menuName); cellStyle.setName(menuName);
cellStyle.setStyle(Style.getInstance()); cellStyle.setStyle(Style.getInstance());
cellStyle.setRemovable(true); cellStyle.setRemovable(true);
cellStyle.setImmutable(true); cellStyle.setUse4Default(false);
cellStyle.setDefault4Absent(false); cellStyle.setUse4BigTitle(false);
cellStyle.setDefault4New(false); cellStyle.setUse4SmallTitle(false);
cellStyle.setUse4Header(false);
cellStyle.setUse4MainText(false);
cellStyle.setUse4SupportInfo(false);
cellStyle.setUse4HighlightText(false);
return new NameObject(helper.createUnrepeatedName(this.menuName()), cellStyle); return new NameObject(helper.createUnrepeatedName(this.menuName()), cellStyle);
} }
@ -285,7 +289,7 @@ public class CellStyleListEditPane extends JListControlPane {
} }
public boolean acceptNameObject(Object ob) { public boolean acceptNameObject(Object ob) {
return !((ThemedCellStyle) ob).isDefault4New(); return !((ThemedCellStyle) ob).isUse4Default();
} }
} }
@ -297,7 +301,7 @@ public class CellStyleListEditPane extends JListControlPane {
@Override @Override
public boolean acceptNameObject(Object ob) { public boolean acceptNameObject(Object ob) {
return ((ThemedCellStyle) ob).isDefault4New(); return ((ThemedCellStyle) ob).isUse4Default();
} }
} }
} }

19
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/AbstractECPreviewPane.java

@ -4,38 +4,35 @@ import com.fr.base.Style;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.base.theme.settings.ThemedCellStyle;
import com.fr.base.theme.settings.ThemedCellStyleList; import com.fr.base.theme.settings.ThemedCellStyleList;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.theme.preview.ThemePreviewed; import com.fr.design.mainframe.theme.preview.ThemePreviewed;
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 javax.swing.JPanel;
import java.util.List; import java.util.List;
public abstract class AbstractECPreviewPane extends UINoOpaquePanel implements ThemePreviewed<TemplateTheme> { public abstract class AbstractECPreviewPane extends UINoOpaquePanel implements ThemePreviewed<TemplateTheme> {
protected Style getReportHeaderStyle(ThemedCellStyleList cellStyleList) { protected Style getReportHeaderStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header")); return getCellStyle(cellStyleList.getUse4Header());
} }
protected Style getMainContentStyle(ThemedCellStyleList cellStyleList) { protected Style getMainContentStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text")); return getCellStyle(cellStyleList.getUse4MainText());
} }
protected Style getHighLightStyle(ThemedCellStyleList cellStyleList) { protected Style getHighLightStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text")); return getCellStyle(cellStyleList.getUse4HighlightText());
} }
protected Style getSmallTitleStyle(ThemedCellStyleList cellStyleList) { protected Style getSmallTitleStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Small_Title")); return getCellStyle(cellStyleList.getUse4SmallTitle());
} }
private Style getCellStyle(ThemedCellStyleList cellStyleList, String styleName) { private Style getCellStyle(ThemedCellStyle themedCellStyle) {
ThemedCellStyle cellStyle = cellStyleList.find(styleName); if (themedCellStyle == null) {
if (cellStyle == null) {
return Style.DEFAULT_STYLE; return Style.DEFAULT_STYLE;
} }
return cellStyle.getStyle(); Style style = themedCellStyle.getStyle();
return style != null ? style : Style.DEFAULT_STYLE;
} }
protected void refresh(List<AbstractPreviewCell> list, Style style) { protected void refresh(List<AbstractPreviewCell> list, Style style) {

2
designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java

@ -34,7 +34,7 @@ public class DefaultThemedTemplateCellElementCase {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) { if (template != null) {
TemplateTheme theme = template.getTemplateTheme(); TemplateTheme theme = template.getTemplateTheme();
ThemedCellStyle themedCellStyle = theme.getCellStyleList().getDefaultCellStyle4New(); ThemedCellStyle themedCellStyle = theme.getCellStyleList().getUse4Default();
if (themedCellStyle != null) { if (themedCellStyle != null) {
NameStyle nameStyle = NameStyle.getPassiveInstance(themedCellStyle.getName(), themedCellStyle.getStyle()); NameStyle nameStyle = NameStyle.getPassiveInstance(themedCellStyle.getName(), themedCellStyle.getStyle());
cellElement.setStyle(nameStyle); cellElement.setStyle(nameStyle);

15
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -39,6 +39,7 @@ import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor; import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.fun.PropertyItemPaneProvider;
@ -1199,13 +1200,25 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
getTarget().setTemplateTheme(newTheme, compatible); getTarget().setTemplateTheme(newTheme, compatible);
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
fireTargetModified(shouldCreateUndoState); fireTargetModified(shouldCreateUndoState);
formDesign.refreshRoot(); formDesign.refreshRoot();
// 刷新界面后恢复原来的尺寸 // 刷新界面后恢复原来的尺寸
formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue); formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue);
FormHierarchyTreePane.getInstance().refreshRoot();
if (this.index != FORM_TAB) { if (this.index != FORM_TAB) {
refreshToolArea(); refreshToolArea();
} else {
// CHART-20568: 当图表块处于编辑状态时,任何界面内容的修改都会导致其进行截图操作,进而引起设计器界面再次重绘,导致死循环,因而需要停止编辑 恢复浮层展示
TreePath[] treePaths = FormHierarchyTreePane.getInstance(formDesign).getComponentTree().getSelectedTreePath();
if (treePaths != null) {
for (TreePath path : treePaths) {
if (path != null) {
formDesign.stopEditing(path);
}
}
}
}
FormHierarchyTreePane.getInstance().refreshRoot();
} }
super.setTemplateTheme(newTheme, compatible); super.setTemplateTheme(newTheme, compatible);

3
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -37,6 +37,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
@ -1295,10 +1296,12 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
getTarget().setTemplateTheme(newTheme, compatible); getTarget().setTemplateTheme(newTheme, compatible);
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
fireTargetModified(shouldCreateUndoState); fireTargetModified(shouldCreateUndoState);
reportComposite.setSelectedIndex(reportComposite.getSelectedIndex()); reportComposite.setSelectedIndex(reportComposite.getSelectedIndex());
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView(); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
}
super.setTemplateTheme(newTheme, compatible); super.setTemplateTheme(newTheme, compatible);
} }

18
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java

@ -22,11 +22,11 @@ import javax.swing.JPanel;
import javax.swing.ListCellRenderer; import javax.swing.ListCellRenderer;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
@ -44,21 +44,17 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
styleList.setCellRenderer(new RadioButtonListCellRenderer()); styleList.setCellRenderer(new RadioButtonListCellRenderer());
styleList.setOpaque(false); styleList.setOpaque(false);
styleList.setBackground(null); styleList.setBackground(null);
setLayout(FRGUIPaneFactory.createBorderLayout()); styleList.addListSelectionListener(new ListSelectionListener() {
add(styleList, BorderLayout.CENTER);
setBorder(BorderFactory.createEmptyBorder(0 ,LEFT_BORDER, 0, RIGHT_BORDER));
styleList.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void valueChanged(ListSelectionEvent e) {
int clickedNumber = e.getClickCount();
if (clickedNumber == 1) {
if (changeListener != null) { if (changeListener != null) {
changeListener.stateChanged(new ChangeEvent(styleList)); changeListener.stateChanged(new ChangeEvent(styleList));
} }
} }
}
}); });
setLayout(FRGUIPaneFactory.createBorderLayout());
add(styleList, BorderLayout.CENTER);
setBorder(BorderFactory.createEmptyBorder(0 ,LEFT_BORDER, 0, RIGHT_BORDER));
DesignerContext.setDesignerBean("predefinedStyle", this); DesignerContext.setDesignerBean("predefinedStyle", this);
} }

Loading…
Cancel
Save