diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java index 7fcfd7310a..543df64eb0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java +++ b/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 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 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 extends JPanel { } } thumbnailPane.setThumbnail(image); + invalidate(); + repaint(); } public T getTheme() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java index 4930335126..ad60ad5810 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java +++ b/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 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 asyncThemeFetcher; @@ -59,7 +62,7 @@ public class TemplateThemeListPane 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)); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java index bf93c6345a..be9dec1600 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java +++ b/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 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 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 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) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java index 31762e72e6..f306fcacfc 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java +++ b/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 formThemesManagerPane; private final TemplateThemeManagePane 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); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java index e4f4b5fd27..9c9f9220e4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java +++ b/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 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 themeListPane; private final ThemedTemplate currentTemplate;