From c09f84a5106b3199aed01293103dca79d9dccda6 Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 8 Aug 2022 16:32:14 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-76079=E3=80=90=E8=BF=AD=E4=BB=A3?= =?UTF-8?q?=E3=80=91=E3=80=90=E8=B5=B7=E5=A7=8B=E9=A1=B5=E3=80=91=E4=BA=A4?= =?UTF-8?q?=E4=BA=92=E9=97=AE=E9=A2=98=201.=20=E8=B5=B7=E5=A7=8B=E9=A1=B5?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E7=BC=BA=E5=A4=B1=203.=20=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E5=A4=84=E7=90=86=204.=20=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=205.=20=E6=82=AC=E6=B5=AE=E6=9C=89=E7=82=B9=E8=99=9A=E7=9A=84?= =?UTF-8?q?=E6=95=88=E6=9E=9C=206.=20=E5=8F=AA=E6=98=BE=E7=A4=BA=E5=89=8D?= =?UTF-8?q?=E5=85=AD=E5=BC=A0=E5=8D=B3=E5=8F=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/startup/ui/StartupPageWindow.java | 18 +++++++++- .../startup/ui/StartupPageWorkspacePanel.java | 35 +++++++++++++------ .../fr/startup/ui/StartupPageWindowTest.java | 8 ++--- 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java index fefe6e8eca..40a1cb5544 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java @@ -12,7 +12,9 @@ import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.ColorUtils; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; +import com.fr.stable.ProductConstants; import com.fr.stable.collections.CollectionUtils; import org.jetbrains.annotations.NotNull; @@ -135,6 +137,7 @@ public class StartupPageWindow extends JFrame { // Workspace-detail setSize(SCREEN_SIZE); + setDefaultTitle(); repaint(); validate(); @@ -143,6 +146,19 @@ public class StartupPageWindow extends JFrame { GUICoreUtils.centerWindow(this); } + private void setDefaultTitle() { + + StringBuilder sb = new StringBuilder(); + sb.append(ProductConstants.APP_NAME); + sb.append(" "); + sb.append(GeneralUtils.getVersion()); + sb.append(" "); + sb.append(ProductConstants.BRANCH); + sb.append(" "); + sb.append(Toolkit.i18nText("Fine-Design_Startup_Page_Title")); + setTitle(sb.toString()); + } + private void patchUIAction(StartupPageModel pageModel) { Runnable selectAndOpenLastTemplateRunnable = pageModel.getOpenLastTemplateRunnable(); @@ -317,7 +333,7 @@ public class StartupPageWindow extends JFrame { recentOpenGroupPanel.setPreferredSize(new Dimension(GROUP_WIDTH, (int) preferredSize.getHeight())); if (needScroll) { - int scrollHeight = (int) Math.round(itemHeight * RECENT_FILE_LIMIT + ITEM_VERTICAL_GAP * (RECENT_FILE_SCROLL)); + int scrollHeight = (int) Math.round(itemHeight * RECENT_FILE_LIMIT + ITEM_VERTICAL_GAP * (RECENT_FILE_LIMIT)); UIScrollPane scrollPane = new UIScrollPane(recentOpenGroupPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0)); scrollPane.setPreferredSize(new Dimension(GROUP_WIDTH, scrollHeight)); diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java index a22c32b03b..297feaa253 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java @@ -95,12 +95,14 @@ public class StartupPageWorkspacePanel extends JPanel { this.contentPanel = generateLimitContentPanel(partitions); this.add(contentPanel, BorderLayout.NORTH); - this.tailPanel = generateTailPanel(); + if (partitions.size() > 2) { + this.tailPanel = generateTailPanel(); + this.add(tailPanel, BorderLayout.SOUTH); + } this.createNewTemplateRunnable = pageModel.getCreateNewTemplateRunnable(); this.openEmptyTemplateRunnable = pageModel.getOpenEmptyTemplateRunnable(); - this.add(tailPanel, BorderLayout.SOUTH); this.repaint(); } @@ -293,10 +295,8 @@ public class StartupPageWorkspacePanel extends JPanel { int roundOffset = 15; // 画一个圆角 int fixRoundWidth = getWidth() - rectOffset; - int fixRoundHeight = getHeight() - BORDER_THIN; - g2d.drawRoundRect(strokeOffset, strokeOffset, fixRoundWidth, fixRoundHeight, ARC_DIAMETER, ARC_DIAMETER); - // 画一个直角 - g2d.drawRoundRect(getWidth() - roundOffset, strokeOffset, roundOffset - strokeOffset, getHeight() - BORDER_THIN, 0, 0); + int fixRoundHeight = getHeight() - BORDER_THIN * 2; + g2d.drawRoundRect(BORDER_THIN, BORDER_THIN, fixRoundWidth, fixRoundHeight, ARC_DIAMETER, ARC_DIAMETER); g2d.setColor(backColor); @@ -306,8 +306,13 @@ public class StartupPageWorkspacePanel extends JPanel { // 偏左一点的 fixedX int fixedX = getWidth() - roundOffset - BORDER_THIN; // 圆角和直角相交的区域 - int coverWidth = 10; + int coverWidth = 15; g2d.fillRect(fixedX, BORDER_THIN, coverWidth, coverHeight); + + g2d.setColor(borderColor); + g2d.drawLine(getWidth() / 2, BORDER_THIN, getWidth(), BORDER_THIN); + g2d.drawLine(getWidth() / 2, getHeight() - BORDER_THIN, getWidth(), getHeight() - BORDER_THIN); + g2d.drawLine(getWidth() - strokeOffset, BORDER_THIN, getWidth() - strokeOffset, getHeight() - BORDER_THIN); } } }; @@ -335,6 +340,7 @@ public class StartupPageWorkspacePanel extends JPanel { Font font = nameLabel.getFont(); Font newSizeFont = font.deriveFont(font.getStyle(), NAME_LABEL_SIZE); nameLabel.setFont(newSizeFont); + nameLabel.setPreferredSize(PATH_DIMENSION); Color nameForeground = nameLabel.getForeground(); simpleDescPanel.add(nameLabel,BorderLayout.NORTH); @@ -450,12 +456,19 @@ public class StartupPageWorkspacePanel extends JPanel { if (borderColor != null) { g2d.setColor(borderColor); g2d.setStroke(new BasicStroke(BORDER_THIN)); + + int borderOffset = BORDER_THIN * 2; // 画画的笔触需要调整一下 - g2d.drawRoundRect(strokeOffset, strokeOffset, getWidth() - rectOffset, getHeight() - BORDER_THIN, 0, 0); - g2d.drawRoundRect(getWidth() - fixedRoundOffset, strokeOffset, roundOffset - strokeOffset, getHeight() - BORDER_THIN, ARC_DIAMETER, ARC_DIAMETER); + //g2d.drawRoundRect(strokeOffset, strokeOffset, getWidth() - rectOffset, getHeight() - BORDER_THIN, 0, 0); + g2d.drawRoundRect(BORDER_THIN, BORDER_THIN, getWidth() - borderOffset, getHeight() - borderOffset, ARC_DIAMETER, ARC_DIAMETER); g2d.setColor(backColor); - int fillWidth = 11; - g2d.fillRect(getWidth() - fixedRoundOffset - BORDER_THIN, BORDER_THIN, fillWidth, getHeight() - BORDER_THIN * 2); + int fillWidth = 15; + g2d.fillRect(0, 0, fillWidth, getHeight()); + + g2d.setColor(borderColor); + g2d.drawLine(BORDER_THIN, BORDER_THIN, fillWidth, BORDER_THIN); + g2d.drawLine(BORDER_THIN, getHeight() - BORDER_THIN, fillWidth, getHeight() - BORDER_THIN); + g2d.drawLine(BORDER_THIN, BORDER_THIN, BORDER_THIN, getHeight() - BORDER_THIN); } } diff --git a/designer-base/src/test/java/com/fr/startup/ui/StartupPageWindowTest.java b/designer-base/src/test/java/com/fr/startup/ui/StartupPageWindowTest.java index c1d33a66a6..804bb7d3fb 100644 --- a/designer-base/src/test/java/com/fr/startup/ui/StartupPageWindowTest.java +++ b/designer-base/src/test/java/com/fr/startup/ui/StartupPageWindowTest.java @@ -16,13 +16,13 @@ public class StartupPageWindowTest { @Override public void run() { HashMap> recentOpenFileMap = new HashMap<>(); - recentOpenFileMap.put("111", Lists.newArrayList("111.cpt", "222//3333.cpt","333.cpt", "444.cpt", "555.cpt", "666.cpt")); + recentOpenFileMap.put("111", Lists.newArrayList("111.cpt", "222//3333.cpt","333.cpt", "444.cpt", "555.cpt", "666.cpt", "777.cpt")); StartupPageModel model = new StartupPageModel(Stream.of( StartupWorkspaceBean.create("111", "222333344455556663333444555566633334445555666"), StartupWorkspaceBean.create("113", "222"), StartupWorkspaceBean.create("114", "222"), StartupWorkspaceBean.create("115", "222"), StartupWorkspaceBean.create("116", "222"), - StartupWorkspaceBean.create("117", "222"), StartupWorkspaceBean.create("118", "222"), StartupWorkspaceBean.create("119", "222"), - StartupWorkspaceBean.create("121", "222"), StartupWorkspaceBean.create("122", "222"), StartupWorkspaceBean.create("123", "222"), - StartupWorkspaceBean.create("124", "222"), StartupWorkspaceBean.create("125", "222"), StartupWorkspaceBean.create("126", "222") + //StartupWorkspaceBean.create("117", "222"), StartupWorkspaceBean.create("118", "222"), StartupWorkspaceBean.create("119", "222"), + //StartupWorkspaceBean.create("121", "222"), StartupWorkspaceBean.create("122", "222"), StartupWorkspaceBean.create("123", "222"), + StartupWorkspaceBean.create("1245678888888", "222"), StartupWorkspaceBean.create("125", "222"), StartupWorkspaceBean.create("126", "222") ).collect(Collectors.toList()), recentOpenFileMap); StartupPageWindow window = new StartupPageWindow(model); window.setVisible(true);