Browse Source

Merge pull request #5736 in DESIGN/design from release/11.0 to feature/x

* commit 'b1d6405ad0de23a31d59e12752e53f5794c402c8':
  REPORT-58513 设计器-表单保存-工具栏新引擎转化按钮变为可用
  REPORT-58513 设计器-表单保存-工具栏新引擎转化按钮变为可用
  REPORT-58513 设计器-表单保存-工具栏新引擎转化按钮变为可用
  REPORT-57722 看看绘制间距线判断的地方有没有优化的空间
  REPORT-58036 【主题切换】发布前,添加的测试按钮需要去掉
  REPORT-58901 FR11-二轮回归-非中文 设计器启动时闪退
  REPORT-58397【主题切换】主题顺序更新不生效
  REPORT-58902 【主题切换】打开frm模板的时候编辑cpt的主题,保存后右侧面板显示的是单元格的样式
  REPORT-58403 【主题切换】组件右侧边框标题部分,间距有点大
  REPORT-58589 【主题切换】单元格样式很多时,多次选择样式以后会概率遇到样式没有选中的情况
  REPORT-58503 【主题切换】预览区ui改版
  REPORT-58698 主题切换-主题配置相关问题
  REPORT-58698 主题切换-主题配置相关问题
  CHART-20568 [产品验收]设计器预览页面图表组件鬼畜
  REPORT-57722 修正缺少的默认值
  REPORT-57722 看看绘制间距线判断的地方有没有优化的空间
research/11.0
superman 3 years ago
parent
commit
ad20c55d24
  1. 8
      designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java
  2. 22
      designer-base/src/main/java/com/fr/design/gui/itoolbar/UIToolbar.java
  3. 13
      designer-base/src/main/java/com/fr/design/gui/style/ComponentTitleStylePane.java
  4. 15
      designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java
  5. 7
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  6. 27
      designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java
  7. 12
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java
  8. 10
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java
  9. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java
  10. 8
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemePreviewPane.java
  11. 11
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java
  12. 72
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java
  13. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java
  14. 16
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java
  15. 19
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/AbstractECPreviewPane.java
  16. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java
  17. 1
      designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java
  18. 43
      designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java
  19. 27
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  20. 11
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  21. 22
      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.ScreenResolution;
import com.fr.base.Style;
import com.fr.general.IOUtils;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
/**
* @author Starryi
@ -18,7 +18,7 @@ import java.awt.Toolkit;
*/
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 transparentBackgroundHeight;
private String paintText = "Report";
@ -38,7 +38,7 @@ public class CellStylePreviewPane extends JPanel {
}
@Override
public void paintComponent(Graphics g) {
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
int resolution = ScreenResolution.getScreenResolution();

22
designer-base/src/main/java/com/fr/design/gui/itoolbar/UIToolbar.java

@ -2,9 +2,12 @@ package com.fr.design.gui.itoolbar;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.JTemplate;
import java.awt.Component;
import java.awt.FlowLayout;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JToolBar;
public class UIToolbar extends JToolBar {
@ -35,13 +38,18 @@ public class UIToolbar extends JToolBar {
}
}
public void refreshUIToolBar() {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {
for (int i = 0; i < getComponentCount(); i++) {
Component component = getComponents()[i];
component.setEnabled(template.checkEnable());
}
public Map<Component, Boolean> getComponentState() {
Map<Component, Boolean> componentState = new HashMap<>();
for (int i = 0; i < getComponentCount(); i++) {
Component component = getComponent(i);
componentState.put(component, component.isEnabled());
}
return componentState;
}
public static void resetComponentState(Map<Component, Boolean> componentState) {
for (Component component : componentState.keySet()) {
component.setEnabled(componentState.get(component));
}
}
}

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

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

15
designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java

@ -19,10 +19,14 @@ import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.border.MatteBorder;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Insets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* @author shine
@ -96,7 +100,7 @@ public class CenterRegionContainerPane extends JPanel {
}
private ToolBarMenuDock getToolBarMenuDock() {
public ToolBarMenuDock getToolBarMenuDock() {
return DesignerContext.getDesignerFrame().getToolBarMenuDock();
}
@ -267,12 +271,13 @@ public class CenterRegionContainerPane extends JPanel {
return centerTemplateCardPane;
}
protected void refreshUIToolBar() {
public Map<Component, Boolean> getToolbarComponentState() {
Map<Component, Boolean> toolbarComponentState = new HashMap<>();
if (toolbarComponent instanceof UIToolbar) {
((UIToolbar ) toolbarComponent).refreshUIToolBar();
toolbarComponentState.putAll(((UIToolbar) toolbarComponent).getComponentState());
}
combineUp.refreshUIToolBar();
getToolBarMenuDock().updateEnable();
toolbarComponentState.putAll(combineUp.getComponentState());
return toolbarComponentState;
}
}

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

@ -361,14 +361,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
public DesktopCardPane getCenterTemplateCardPane() {
return CenterRegionContainerPane.getInstance().getCenterTemplateCardPane();
}
public void refreshUIToolBar() {
CenterRegionContainerPane.getInstance().refreshUIToolBar();
}
/**
* 初始menuPane的方法 方便OEM时修改该组件
*/
@ -1040,7 +1035,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt != null) {
if (jt != null) {
DesignerEnvManager.getEnvManager().setLastOpenFile(jt.getEditingFILE().getPath());
}

27
designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java

@ -10,11 +10,14 @@ import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.gui.itoolbar.UIToolbar;
import javax.swing.JComponent;
import javax.swing.JLayeredPane;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.HashMap;
import java.util.Map;
/**
@ -33,6 +36,9 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
private TransparentPane transparentPane = new TransparentPane();
private OpenLoadingPane loadingPane = new OpenLoadingPane();
private OpenFailedPane failedPane = new OpenFailedPane();
Map<Component, Boolean> backUpToolbarComponentState = new HashMap<>();
private JLayeredPane layeredPane = new JLayeredPane() {
@Override
public void doLayout() {
@ -103,7 +109,7 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
}
private void showOpenStatus() {
DesignerContext.getDesignerFrame().refreshUIToolBar();
forbidToolBar();
DesignerFrameFileDealerPane.getInstance().stateChange();
EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
@ -120,9 +126,9 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
}
public void showCover() {
forbidToolBar();
transparentPane.start();
layeredPane.moveToFront(transparentPane);
DesignerContext.getDesignerFrame().refreshUIToolBar();
EastRegionContainerPane.getInstance().updateAllPropertyPane();
JComponent downPane = WestRegionContainerPane.getInstance().getDownPane();
if (downPane instanceof BasicTableDataTreePane) {
@ -132,6 +138,7 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
}
public void hideCover() {
recoverToolBar();
transparentPane.stop();
layeredPane.moveToFront(component);
EastRegionContainerPane.getInstance().updateAllPropertyPane();
@ -142,6 +149,22 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
}
}
private void forbidToolBar() {
CenterRegionContainerPane centerRegionContainerPane = CenterRegionContainerPane.getInstance();
backUpToolbarComponentState = centerRegionContainerPane.getToolbarComponentState();
for (Component component : backUpToolbarComponentState.keySet()) {
component.setEnabled(false);
}
centerRegionContainerPane.getToolBarMenuDock().updateEnable();
}
private void recoverToolBar() {
UIToolbar.resetComponentState(backUpToolbarComponentState);
backUpToolbarComponentState.clear();
CenterRegionContainerPane centerRegionContainerPane = CenterRegionContainerPane.getInstance();
centerRegionContainerPane.getToolBarMenuDock().updateEnable();
}
protected JTemplate<?, ?> getSelectedJTemplate() {
return component;
}

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
*/
public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
public static final int HEIGHT = 150;
public static final int THUMBNAIL_HEIGHT = 125;
public static final int INFO_HEIGHT = 30;
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 final String name;
@ -97,13 +98,14 @@ public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
private void initializePane() {
setLayout(FRGUIPaneFactory.createBorderLayout());
setPreferredSize(new Dimension(getPreferredSize().width, HEIGHT));
setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
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();
infoPane.setPreferredSize(new Dimension(CONTENT_WIDTH, INFO_HEIGHT));
infoPane.setBackground(Color.WHITE);
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);
invalidate();
repaint();
}
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.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemeThumbnail;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.ChangeEvent;
@ -29,7 +30,9 @@ import java.util.Map;
public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
public static final int BLOCK_COUNT_ROW_LINE = 3;
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;
private final AsyncThemeFetcher<T> asyncThemeFetcher;
@ -59,7 +62,7 @@ public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
private void initializePane() {
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.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: {
if (existingBlock != null) {
fillContentListPane();
asyncFetchTheme(themeName);
validate();
repaint();
}
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.layout.FRGUIPaneFactory;
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.ToolBarDef;
import com.fr.general.IOUtils;
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.JOptionPane;
@ -55,6 +52,8 @@ import static com.fr.design.i18n.Toolkit.i18nText;
* Created by Starryi on 2021/8/13
*/
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 UIButton setTheme4NewTemplateButton;
@ -94,6 +93,7 @@ public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane
private void initializePane() {
setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
add(createActionsContainer(), BorderLayout.NORTH);
@ -102,7 +102,6 @@ public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane
nextContainer.add(new JSeparator(), BorderLayout.NORTH);
themeListPane.setPreferredSize(new Dimension(themeListPane.getPreferredSize().width, 490));
themeListPane.setSelectedChangeListener(new ChangeListener() {
@Override
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 thumbnailHeight = ThemeThumbnail.HEIGHT;
float thumbnailAspect = 1.0F * thumbnailWidth / thumbnailHeight;
int width = getWidth();
int height = getHeight();
float aspect = 1.0F * width / height;
if (thumbnailAspect > aspect) {
height = (int) (width / thumbnailAspect);
} else {
width = (int) (height * thumbnailAspect);
}
try {
// 使用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.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.theme.TemplateThemeListPane;
import com.fr.design.mainframe.theme.TemplateThemeManagePane;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -25,13 +27,12 @@ import java.awt.event.ActionListener;
* Created by Starryi on 2021/8/13
*/
public class TemplateThemeManageDialog extends TemplateThemeDialog {
public static final int CONTENT_WIDTH = 660;
public static final int CONTENT_HEIGHT = 570;
private final TemplateThemeManageDialogContentPane contentPane;
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();
setContentPane(createDialogContentPane(contentPane, new UIButton[]{ createCompleteButton() }));
@ -55,12 +56,16 @@ public class TemplateThemeManageDialog extends TemplateThemeDialog {
}
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<ReportTheme> reportThemesManagerPane;
public TemplateThemeManageDialogContentPane() {
setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
UITabbedPane tabbedPane = new UITabbedPane();
add(tabbedPane, BorderLayout.NORTH);

72
designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java

@ -4,15 +4,7 @@ import com.fr.base.theme.TemplateTheme;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.theme.TemplateThemeProfilePane;
import com.fr.file.FILE;
import com.fr.file.FILEChooserPane;
import com.fr.file.FileFILE;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ListSet;
import com.fr.stable.xml.XMLPrintWriter;
import javax.swing.JPanel;
import java.awt.BorderLayout;
@ -21,10 +13,6 @@ import java.awt.Dimension;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
/**
@ -47,9 +35,6 @@ public class TemplateThemeProfileDialog<T extends TemplateTheme> extends Templat
content.add(profilePane, BorderLayout.CENTER);
setContentPane(createDialogContentPane(content, new UIButton[]{
// 用于视觉设计师导出内置主题文件,发布前关闭
// 后续由产品经理决定是否开启此功能
createExportButton(profilePane),
profilePane.createSaveButton(),
profilePane.createSaveAsButton(this),
createCancelButton()
@ -58,63 +43,6 @@ public class TemplateThemeProfileDialog<T extends TemplateTheme> extends Templat
currentVisibleProfilePane = profilePane;
}
private void exportTheme(T theme) {
FILEChooserPane fileChooser = FILEChooserPane.getInstance(true, true, new ChooseFileFilter() {
@Override
public boolean accept(FILE f) {
return f.isDirectory();
}
@Override
public String getDescription() {
return "export theme to xml";
}
@Override
public boolean containsExtension(String extension) {
return true;
}
@Override
public String toString() {
return getDescription();
}
});
fileChooser.setCurrentDirectory(new FileFILE(new File("~/")));
fileChooser.setFileNameTextField(theme.getName(), ".xml");
FILE exportedFile = null;
int result = fileChooser.showSaveDialog(DesignerContext.getDesignerFrame(), ".xml");
if (result == FILEChooserPane.JOPTIONPANE_OK_OPTION || result == FILEChooserPane.OK_OPTION) {
exportedFile = fileChooser.getSelectedFILE();
}
if (exportedFile == null) {
return;
}
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(exportedFile.getPath()))) {
XMLPrintWriter writer = XMLPrintWriter.create(bos);
theme.writeXML(writer);
writer.flush();
writer.close();
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
public UIButton createExportButton(TemplateThemeProfilePane<T> profilePane) {
UIButton exportButton = new UIButton();
exportButton.setText(Toolkit.i18nText("Fine-Design_Basic_Export"));
exportButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
T theme = profilePane.updateBean();
theme.getImageIdList().setIdList(new ListSet<>());
exportTheme(theme);
}
});
return exportButton;
}
private UIButton createCancelButton() {
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"));
button.addActionListener(new ActionListener() {

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
TemplateThemeUsingDialog<T extends TemplateTheme> extends TemplateThemeDialog {
public static final int CONTENT_WIDTH = 660;
public static final int CONTENT_HEIGHT = 515;
public static final int CONTENT_WIDTH = TemplateThemeListPane.CONTENT_WIDTH + 42;
public static final int CONTENT_HEIGHT = TemplateThemeListPane.CONTENT_HEIGHT + 23;
private final TemplateThemeListPane<T> themeListPane;
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) {
NameObject selectNameObject = (NameObject) selectModel.wrapper;
ThemedCellStyle cellStyle = (ThemedCellStyle) (selectNameObject.getObject());
this.shortCut.setEnabled(cellStyle.isRemovable() && !cellStyle.isDefault4New());
this.shortCut.setEnabled(cellStyle.isRemovable() && !cellStyle.isUse4Default());
} else {
this.shortCut.setEnabled(false);
}
@ -266,9 +266,13 @@ public class CellStyleListEditPane extends JListControlPane {
cellStyle.setName(menuName);
cellStyle.setStyle(Style.getInstance());
cellStyle.setRemovable(true);
cellStyle.setImmutable(true);
cellStyle.setDefault4Absent(false);
cellStyle.setDefault4New(false);
cellStyle.setUse4Default(false);
cellStyle.setUse4BigTitle(false);
cellStyle.setUse4SmallTitle(false);
cellStyle.setUse4Header(false);
cellStyle.setUse4MainText(false);
cellStyle.setUse4SupportInfo(false);
cellStyle.setUse4HighlightText(false);
return new NameObject(helper.createUnrepeatedName(this.menuName()), cellStyle);
}
@ -285,7 +289,7 @@ public class CellStyleListEditPane extends JListControlPane {
}
public boolean acceptNameObject(Object ob) {
return !((ThemedCellStyle) ob).isDefault4New();
return !((ThemedCellStyle) ob).isUse4Default();
}
}
@ -297,7 +301,7 @@ public class CellStyleListEditPane extends JListControlPane {
@Override
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.settings.ThemedCellStyle;
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.UINoOpaquePanel;
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;
public abstract class AbstractECPreviewPane extends UINoOpaquePanel implements ThemePreviewed<TemplateTheme> {
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) {
return getCellStyle(cellStyleList, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text"));
return getCellStyle(cellStyleList.getUse4MainText());
}
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) {
return getCellStyle(cellStyleList, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Small_Title"));
return getCellStyle(cellStyleList.getUse4SmallTitle());
}
private Style getCellStyle(ThemedCellStyleList cellStyleList, String styleName) {
ThemedCellStyle cellStyle = cellStyleList.find(styleName);
if (cellStyle == null) {
private Style getCellStyle(ThemedCellStyle themedCellStyle) {
if (themedCellStyle == null) {
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) {

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();
if (template != null) {
TemplateTheme theme = template.getTemplateTheme();
ThemedCellStyle themedCellStyle = theme.getCellStyleList().getDefaultCellStyle4New();
ThemedCellStyle themedCellStyle = theme.getCellStyleList().getUse4Default();
if (themedCellStyle != null) {
NameStyle nameStyle = NameStyle.getPassiveInstance(themedCellStyle.getName(), themedCellStyle.getStyle());
cellElement.setStyle(nameStyle);

1
designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java

@ -70,7 +70,6 @@ public class SaveWorker extends SwingWorker<Boolean, Void> {
this.template.setSaving(false);
// 恢复界面
if (slowly && ComparatorUtils.equals(this.template.getName(), HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getName())) {
DesignerContext.getDesignerFrame().refreshUIToolBar();
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().hideCover();
}
DesignerFrameFileDealerPane.getInstance().stateChange();

43
designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java

@ -31,6 +31,7 @@ public class FormSpacingLineDrawer {
private FormDesigner designer;
private XCreator hoverCreator = null;
private XCreator selectedCreator = null;
private Rectangle selectedRec;
private Rectangle hoveredRec;
private boolean isMouseMoveEvent = false;
@ -40,19 +41,19 @@ public class FormSpacingLineDrawer {
}
public void updateMouseEvent(MouseEvent e, boolean isMouseMoveEvent) {
XCreator creator = designer.getSelectionModel().getSelection().getSelectedCreator();
if (creator != null) {
selectedCreator = designer.getSelectionModel().getSelection().getSelectedCreator();
if (selectedCreator != null) {
this.hoverCreator = getHoverComponentAt(e.getX(), e.getY());
}
this.isMouseMoveEvent = isMouseMoveEvent;
}
public void draw(Graphics g) {
if (!isDrawSpacingLine()) {
if (!isMouseMoveEvent || selectedCreator == null || hoverCreator == null) {
return;
}
if (!hoverCreator.isParentAbsolute()) {
if (!isDrawSpacingLine()) {
return;
}
@ -137,15 +138,15 @@ public class FormSpacingLineDrawer {
}
private boolean isSelectedParaComponent() {
return designer.getParaComponent() == designer.getSelectionModel().getSelection().getSelectedCreator();
return designer.getParaComponent() == selectedCreator;
}
private boolean isSelectedRootComponent() {
return designer.isRoot(designer.getSelectionModel().getSelection().getSelectedCreator());
return designer.isRoot(selectedCreator);
}
private boolean isSelectedForm() {
return designer.getSelectionModel().getSelection().getSelectedCreator().getParent() == null;
return selectedCreator.getParent() == null;
}
private boolean isNeedExtendedLine(AbstractFormParallelLine[] nearestSides) {
@ -158,33 +159,33 @@ public class FormSpacingLineDrawer {
}
// 当前组件是否在参数面板里面
private boolean isCompInPara(XCreator creator) {
private boolean isCompInBody(XCreator creator) {
XLayoutContainer container = XCreatorUtils.getHotspotContainer(creator);
return container != null && !container.acceptType(XWParameterLayout.class);
}
boolean xCreatorAccept = creator.acceptType(XWParameterLayout.class);
boolean containerAccept = container != null && container.acceptType(XWParameterLayout.class);
return xCreatorAccept || containerAccept;
private boolean isSelectedCompInBody() {
return isCompInBody(selectedCreator);
}
private boolean isBodyAbsoluteLayout() {
return !(designer instanceof FormParaDesigner) && FormDesignerUtils.isBodyAbsolute(designer);
private boolean isHoveredCompInBody() {
return isCompInBody(hoverCreator);
}
private boolean isSelectedCompInPara() {
return isCompInPara(designer.getSelectionModel().getSelection().getSelectedCreator());
private boolean isCompInBody() {
return isSelectedCompInBody() && isHoveredCompInBody();
}
private boolean isHoveredCompInPara() {
return isCompInPara(hoverCreator);
private boolean isBodyAbsoluteLayout() {
return !(designer instanceof FormParaDesigner) && FormDesignerUtils.isBodyAbsolute(designer);
}
private boolean isSelectedCompOrHoveredCompInPara() {
return isSelectedCompInPara() || isHoveredCompInPara();
private boolean isInAbsoluteLayout() {
return isBodyAbsoluteLayout() && hoverCreator.isParentAbsolute() && selectedCreator.isParentAbsolute();
}
private boolean isDrawSpacingLine() {
return isBodyAbsoluteLayout() && !isSelectedRootPane() && hoverCreator != null && !isSelectedCompOrHoveredCompInPara() && isMouseMoveEvent;
return isInAbsoluteLayout() && !isSelectedRootPane() && isCompInBody();
}
private AbstractFormParallelLine[] getNearestHorizontalSide() {

27
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.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.PropertyItemPaneProvider;
@ -1199,13 +1200,25 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
getTarget().setTemplateTheme(newTheme, compatible);
fireTargetModified(shouldCreateUndoState);
formDesign.refreshRoot();
// 刷新界面后恢复原来的尺寸
formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue);
FormHierarchyTreePane.getInstance().refreshRoot();
if (this.index != FORM_TAB) {
refreshToolArea();
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
fireTargetModified(shouldCreateUndoState);
formDesign.refreshRoot();
// 刷新界面后恢复原来的尺寸
formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue);
if (this.index != FORM_TAB) {
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);

11
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.designer.TargetComponent;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.fun.PreviewProvider;
@ -1311,10 +1312,12 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
getTarget().setTemplateTheme(newTheme, compatible);
fireTargetModified(shouldCreateUndoState);
reportComposite.setSelectedIndex(reportComposite.getSelectedIndex());
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
fireTargetModified(shouldCreateUndoState);
reportComposite.setSelectedIndex(reportComposite.getSelectedIndex());
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
}
super.setTemplateTheme(newTheme, compatible);
}

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

Loading…
Cancel
Save