Browse Source

REPORT-58698 主题切换-主题配置相关问题

【问题原因】
1. 修改主题管理界面/主题选择界面的尺寸计算方式
2. 修复初始时不显示主题标记的问题

【改动思路】
同上
fix-lag
Starryi 3 years ago
parent
commit
f7022099a0
  1. 12
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java
  2. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java
  3. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java
  4. 11
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java
  5. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java

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() {

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

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

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;

Loading…
Cancel
Save