Browse Source

REPORT-76079【迭代】【起始页】交互问题

1. 起始页标题缺失
3. 显示全部处理
4. 路径显示不全的问题
5. 悬浮有点虚的效果
6. 只显示前六张即可
feature/x
Harrison 2 years ago
parent
commit
c09f84a510
  1. 18
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java
  2. 33
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java
  3. 8
      designer-base/src/test/java/com/fr/startup/ui/StartupPageWindowTest.java

18
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.ui.util.UIUtil;
import com.fr.design.utils.ColorUtils; import com.fr.design.utils.ColorUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ProductConstants;
import com.fr.stable.collections.CollectionUtils; import com.fr.stable.collections.CollectionUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -135,6 +137,7 @@ public class StartupPageWindow extends JFrame {
// Workspace-detail // Workspace-detail
setSize(SCREEN_SIZE); setSize(SCREEN_SIZE);
setDefaultTitle();
repaint(); repaint();
validate(); validate();
@ -143,6 +146,19 @@ public class StartupPageWindow extends JFrame {
GUICoreUtils.centerWindow(this); 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) { private void patchUIAction(StartupPageModel pageModel) {
Runnable selectAndOpenLastTemplateRunnable = pageModel.getOpenLastTemplateRunnable(); Runnable selectAndOpenLastTemplateRunnable = pageModel.getOpenLastTemplateRunnable();
@ -317,7 +333,7 @@ public class StartupPageWindow extends JFrame {
recentOpenGroupPanel.setPreferredSize(new Dimension(GROUP_WIDTH, (int) preferredSize.getHeight())); recentOpenGroupPanel.setPreferredSize(new Dimension(GROUP_WIDTH, (int) preferredSize.getHeight()));
if (needScroll) { 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); UIScrollPane scrollPane = new UIScrollPane(recentOpenGroupPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0)); scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
scrollPane.setPreferredSize(new Dimension(GROUP_WIDTH, scrollHeight)); scrollPane.setPreferredSize(new Dimension(GROUP_WIDTH, scrollHeight));

33
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.contentPanel = generateLimitContentPanel(partitions);
this.add(contentPanel, BorderLayout.NORTH); this.add(contentPanel, BorderLayout.NORTH);
if (partitions.size() > 2) {
this.tailPanel = generateTailPanel(); this.tailPanel = generateTailPanel();
this.add(tailPanel, BorderLayout.SOUTH);
}
this.createNewTemplateRunnable = pageModel.getCreateNewTemplateRunnable(); this.createNewTemplateRunnable = pageModel.getCreateNewTemplateRunnable();
this.openEmptyTemplateRunnable = pageModel.getOpenEmptyTemplateRunnable(); this.openEmptyTemplateRunnable = pageModel.getOpenEmptyTemplateRunnable();
this.add(tailPanel, BorderLayout.SOUTH);
this.repaint(); this.repaint();
} }
@ -293,10 +295,8 @@ public class StartupPageWorkspacePanel extends JPanel {
int roundOffset = 15; int roundOffset = 15;
// 画一个圆角 // 画一个圆角
int fixRoundWidth = getWidth() - rectOffset; int fixRoundWidth = getWidth() - rectOffset;
int fixRoundHeight = getHeight() - BORDER_THIN; int fixRoundHeight = getHeight() - BORDER_THIN * 2;
g2d.drawRoundRect(strokeOffset, strokeOffset, fixRoundWidth, fixRoundHeight, ARC_DIAMETER, ARC_DIAMETER); g2d.drawRoundRect(BORDER_THIN, BORDER_THIN, fixRoundWidth, fixRoundHeight, ARC_DIAMETER, ARC_DIAMETER);
// 画一个直角
g2d.drawRoundRect(getWidth() - roundOffset, strokeOffset, roundOffset - strokeOffset, getHeight() - BORDER_THIN, 0, 0);
g2d.setColor(backColor); g2d.setColor(backColor);
@ -306,8 +306,13 @@ public class StartupPageWorkspacePanel extends JPanel {
// 偏左一点的 fixedX // 偏左一点的 fixedX
int fixedX = getWidth() - roundOffset - BORDER_THIN; int fixedX = getWidth() - roundOffset - BORDER_THIN;
// 圆角和直角相交的区域 // 圆角和直角相交的区域
int coverWidth = 10; int coverWidth = 15;
g2d.fillRect(fixedX, BORDER_THIN, coverWidth, coverHeight); 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 font = nameLabel.getFont();
Font newSizeFont = font.deriveFont(font.getStyle(), NAME_LABEL_SIZE); Font newSizeFont = font.deriveFont(font.getStyle(), NAME_LABEL_SIZE);
nameLabel.setFont(newSizeFont); nameLabel.setFont(newSizeFont);
nameLabel.setPreferredSize(PATH_DIMENSION);
Color nameForeground = nameLabel.getForeground(); Color nameForeground = nameLabel.getForeground();
simpleDescPanel.add(nameLabel,BorderLayout.NORTH); simpleDescPanel.add(nameLabel,BorderLayout.NORTH);
@ -450,12 +456,19 @@ public class StartupPageWorkspacePanel extends JPanel {
if (borderColor != null) { if (borderColor != null) {
g2d.setColor(borderColor); g2d.setColor(borderColor);
g2d.setStroke(new BasicStroke(BORDER_THIN)); g2d.setStroke(new BasicStroke(BORDER_THIN));
int borderOffset = BORDER_THIN * 2;
// 画画的笔触需要调整一下 // 画画的笔触需要调整一下
g2d.drawRoundRect(strokeOffset, strokeOffset, getWidth() - rectOffset, getHeight() - BORDER_THIN, 0, 0); //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(BORDER_THIN, BORDER_THIN, getWidth() - borderOffset, getHeight() - borderOffset, ARC_DIAMETER, ARC_DIAMETER);
g2d.setColor(backColor); g2d.setColor(backColor);
int fillWidth = 11; int fillWidth = 15;
g2d.fillRect(getWidth() - fixedRoundOffset - BORDER_THIN, BORDER_THIN, fillWidth, getHeight() - BORDER_THIN * 2); 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);
} }
} }

8
designer-base/src/test/java/com/fr/startup/ui/StartupPageWindowTest.java

@ -16,13 +16,13 @@ public class StartupPageWindowTest {
@Override @Override
public void run() { public void run() {
HashMap<String, List<String>> recentOpenFileMap = new HashMap<>(); HashMap<String, List<String>> 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( StartupPageModel model = new StartupPageModel(Stream.of(
StartupWorkspaceBean.create("111", "222333344455556663333444555566633334445555666"), StartupWorkspaceBean.create("113", "222"), StartupWorkspaceBean.create("111", "222333344455556663333444555566633334445555666"), StartupWorkspaceBean.create("113", "222"),
StartupWorkspaceBean.create("114", "222"), StartupWorkspaceBean.create("115", "222"), StartupWorkspaceBean.create("116", "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("117", "222"), StartupWorkspaceBean.create("118", "222"), StartupWorkspaceBean.create("119", "222"),
StartupWorkspaceBean.create("121", "222"), StartupWorkspaceBean.create("122", "222"), StartupWorkspaceBean.create("123", "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("1245678888888", "222"), StartupWorkspaceBean.create("125", "222"), StartupWorkspaceBean.create("126", "222")
).collect(Collectors.toList()), recentOpenFileMap); ).collect(Collectors.toList()), recentOpenFileMap);
StartupPageWindow window = new StartupPageWindow(model); StartupPageWindow window = new StartupPageWindow(model);
window.setVisible(true); window.setVisible(true);

Loading…
Cancel
Save