Browse Source

REPORT-113994 【NewUI】设计器启动页翻新、进度条优化

newui
Levy.Xie-解安森 6 months ago
parent
commit
c6d8d3253b
  1. 4
      designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java
  2. 4
      designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java
  3. 1
      designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java
  4. 21
      designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java
  5. 4
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  6. 32
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java
  7. 46
      designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java
  8. 2
      designer-base/src/main/java/com/fr/startup/ui/StartupPageConstants.java
  9. 11
      designer-base/src/main/java/com/fr/startup/ui/StartupPageUtil.java
  10. 55
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java
  11. 284
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java
  12. 5
      designer-base/src/main/resources/com/fine/theme/icon/add_hover.svg
  13. 15
      designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/fvs_locked.svg
  14. 16
      designer-base/src/main/resources/com/fine/theme/icon/startup/local_server_background.svg
  15. 3
      designer-base/src/main/resources/com/fine/theme/icon/startup/more.svg
  16. 3
      designer-base/src/main/resources/com/fine/theme/icon/startup/more_hover.svg
  17. 18
      designer-base/src/main/resources/com/fine/theme/icon/startup/remote_server_background.svg
  18. 3
      designer-base/src/main/resources/com/fine/theme/icon/startup/show_less.svg
  19. 3
      designer-base/src/main/resources/com/fine/theme/icon/startup/show_more.svg
  20. 10
      designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json
  21. 20
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  22. 1
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/base/DownloadProgressPane.java

4
designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java

@ -43,8 +43,8 @@ public abstract class FineLaf extends FlatLaf {
*/ */
private static void resetWindowDecorations() { private static void resetWindowDecorations() {
if (SystemInfo.isWindows_10_orLater) { if (SystemInfo.isWindows_10_orLater) {
System.setProperty("flatlaf.useWindowDecorations", "false"); System.setProperty("flatlaf.useWindowDecorations", "true");
System.setProperty("flatlaf.menuBarEmbedded", "false"); System.setProperty("flatlaf.menuBarEmbedded", "true");
} }
} }
} }

4
designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java

@ -28,6 +28,10 @@ public interface FineClientProperties extends FlatClientProperties {
String PANEL_TYPE = "panelType"; String PANEL_TYPE = "panelType";
String ROUNDED_PANEL = "roundedPanel"; String ROUNDED_PANEL = "roundedPanel";
//--------------------------- ComboBox ----------------------------
String COMBO_BOX_TYPE = "comboBoxType";
String ADAPTIVE_COMBO_BOX = "adaptiveComboBox";
int GROUP_BUTTON_POSITION_INNER = 0; int GROUP_BUTTON_POSITION_INNER = 0;
int GROUP_BUTTON_POSITION_LEFT = 1; int GROUP_BUTTON_POSITION_LEFT = 1;
int GROUP_BUTTON_POSITION_RIGHT = 2; int GROUP_BUTTON_POSITION_RIGHT = 2;

1
designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java

@ -38,6 +38,7 @@ public interface FineUIStyle {
String POPUP_MENU_TOOL_BAR = "popupMenuToolBar"; String POPUP_MENU_TOOL_BAR = "popupMenuToolBar";
String POPUP_MENU_DROPDOWN = "dropdownPopupMenu"; String POPUP_MENU_DROPDOWN = "dropdownPopupMenu";
String TRANSPARENT_TEXT_FIELD = "transparentTextField"; String TRANSPARENT_TEXT_FIELD = "transparentTextField";
String TRANSPARENT_BACKGROUND = "transparentBackground";
String PURE_LIST = "pureList"; String PURE_LIST = "pureList";
String PURE_TREE = "pureTree"; String PURE_TREE = "pureTree";
String PASTEL_BUTTON = "pastelButton"; String PASTEL_BUTTON = "pastelButton";

21
designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java

@ -13,14 +13,7 @@ import javax.swing.JLabel;
import javax.swing.JLayer; import javax.swing.JLayer;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.awt.Color; import java.awt.*;
import java.awt.Component;
import java.awt.Composite;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Insets;
import java.awt.geom.Path2D; import java.awt.geom.Path2D;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@ -422,4 +415,16 @@ public class FineUIUtils {
return new JLayer<>(new UIScrollPane(c, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER), return new JLayer<>(new UIScrollPane(c, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER),
new CollapsibleScrollBarLayerUI(verticalPolicy, horizontalPolicy)); new CollapsibleScrollBarLayerUI(verticalPolicy, horizontalPolicy));
} }
/**
* 设置组件字体大小已适配字体缩放
*
* @param c 组件
* @param size 字体大小
*/
public static void setFontSize(Component c, int size) {
Font font = c.getFont();
Font newSizeFont = font.deriveFont(font.getStyle(), scale(size));
c.setFont(newSizeFont);
}
} }

4
designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java

@ -1,5 +1,6 @@
package com.fr.design.gui.iprogressbar; package com.fr.design.gui.iprogressbar;
import com.fine.theme.utils.FineUIScale;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -58,7 +59,7 @@ public class ProgressDialog extends UIDialog {
protected void initCenterDialog(Frame parent) { protected void initCenterDialog(Frame parent) {
centerDialog = new JDialog(this); centerDialog = new JDialog(this);
centerDialog.setSize(new Dimension(482, 124)); centerDialog.setSize(FineUIScale.scale(new Dimension(482, 124)));
centerDialog.setUndecorated(true); centerDialog.setUndecorated(true);
centerDialog.setLocationRelativeTo(parent); centerDialog.setLocationRelativeTo(parent);
centerDialog.getContentPane().add(progressPanel); centerDialog.getContentPane().add(progressPanel);
@ -66,7 +67,6 @@ public class ProgressDialog extends UIDialog {
protected void initProgressBar() { protected void initProgressBar() {
progressBar = new JProgressBar(); progressBar = new JProgressBar();
progressBar.setUI(new ModernUIProgressBarUI());
progressBar.setBorderPainted(false); progressBar.setBorderPainted(false);
progressBar.setOpaque(false); progressBar.setOpaque(false);
progressBar.setBorder(null); progressBar.setBorder(null);

32
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java

@ -28,6 +28,7 @@ public class FileTreeIcon {
public static final Icon FOLDER_OPEN_IMAGE_ICON = new LazyIcon("folder_open"); public static final Icon FOLDER_OPEN_IMAGE_ICON = new LazyIcon("folder_open");
public static final Icon MODERN_CPT_FILE_IMAGE_ICON = new LazyIcon("cpt_icon"); public static final Icon MODERN_CPT_FILE_IMAGE_ICON = new LazyIcon("cpt_icon");
public static final Icon MODERN_FRM_FILE_IMAGE_ICON = new LazyIcon("frm_icon"); public static final Icon MODERN_FRM_FILE_IMAGE_ICON = new LazyIcon("frm_icon");
public static final Icon MODERN_FVS_FILE_IMAGE_ICON = new LazyIcon("fvs_icon");
public static final Icon FILE_IMAGE_ICON = UIManager.getIcon("FileView.fileIcon"); public static final Icon FILE_IMAGE_ICON = UIManager.getIcon("FileView.fileIcon");
@ -44,6 +45,10 @@ public class FileTreeIcon {
public static final Icon MODERN_CHT_FILE_IMAGE_ICON = new LazyIcon("chtFile"); public static final Icon MODERN_CHT_FILE_IMAGE_ICON = new LazyIcon("chtFile");
public static final Icon CPTX_ICON = new LazyIcon("cpt_icon"); public static final Icon CPTX_ICON = new LazyIcon("cpt_icon");
public static final Icon CPT_FILE_LOCK_ICON = new LazyIcon("cpt_locked");
public static final Icon FRM_FILE_LOCK_ICON = new LazyIcon("frm_locked");
public static final Icon FVS_FILE_LOCK_ICON = new LazyIcon("fvs_locked");
// TODO: 以下Icon视觉暂未提供,需提供后替换 // TODO: 以下Icon视觉暂未提供,需提供后替换
public static final Icon BLANK_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/blank.gif"); public static final Icon BLANK_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/blank.gif");
public static final Icon FOLDER_HALF_IMAGE_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/folder_half_authority.svg"); public static final Icon FOLDER_HALF_IMAGE_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/folder_half_authority.svg");
@ -76,10 +81,6 @@ public class FileTreeIcon {
new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/jpgFile.gif")); new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/jpgFile.gif"));
public static final LockIcon BMP_FILE_LOCK_ICON = public static final LockIcon BMP_FILE_LOCK_ICON =
new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/bmpFile.gif")); new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/bmpFile.gif"));
public static final LockIcon CPT_FILE_LOCK_ICON =
new LockIcon(BaseUtils.readImage("/com/fr/base/images/oem/cptlocked.png"));
public static final LockIcon FRM_FILE_LOCK_ICON =
new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/frmlocked.png"));
public static final LockIcon CHT_FILE_LOCK_ICON = public static final LockIcon CHT_FILE_LOCK_ICON =
new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/frmlocked.png")); new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/frmlocked.png"));
/** /**
@ -110,6 +111,7 @@ public class FileTreeIcon {
public final static int FRM_FILE = 12; //.form .frm public final static int FRM_FILE = 12; //.form .frm
public final static int CHT_FILE = 13; //.chart .cht public final static int CHT_FILE = 13; //.chart .cht
public final static int CPTX_FILE = 14; //.cptx public final static int CPTX_FILE = 14; //.cptx
public final static int FVS_FILE = 15; //.fvs
public static Icon getIcon(File file) { public static Icon getIcon(File file) {
return FileTreeIcon.getIcon(file, false); return FileTreeIcon.getIcon(file, false);
@ -143,6 +145,20 @@ public class FileTreeIcon {
return getIcon(node, showLock); return getIcon(node, showLock);
} }
/**
* 获取文件名对应的图标
*
* @param filename 文件名
* @return 文件的图标
*/
public static Icon getIconByFileName(String filename) {
Icon icon = getExtraIcon(filename, false);
if (icon != null) {
return icon;
}
return getIcon(getFileType(filename), false);
}
/** /**
* 获取文件节点对应的图标(含展开与否的属性) * 获取文件节点对应的图标(含展开与否的属性)
* *
@ -298,6 +314,12 @@ public class FileTreeIcon {
} else { } else {
return FileTreeIcon.MODERN_CHT_FILE_IMAGE_ICON; return FileTreeIcon.MODERN_CHT_FILE_IMAGE_ICON;
} }
} else if (fileType == FVS_FILE) { // fvs
if (isLocked) {
return FileTreeIcon.FVS_FILE_LOCK_ICON;
} else {
return FileTreeIcon.MODERN_FVS_FILE_IMAGE_ICON;
}
} else { } else {
if (isLocked) { if (isLocked) {
return FileTreeIcon.FILE_LOCK_ICON; return FileTreeIcon.FILE_LOCK_ICON;
@ -354,6 +376,8 @@ public class FileTreeIcon {
return FRM_FILE; return FRM_FILE;
} else if (fileName.endsWith(".cht") || fileName.endsWith(".chart")) { } else if (fileName.endsWith(".cht") || fileName.endsWith(".chart")) {
return CHT_FILE; return CHT_FILE;
} else if (fileName.endsWith(".fvs")) {
return FVS_FILE;
} else { } else {
return TEXT_FILE; return TEXT_FILE;
} }

46
designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java

@ -1,36 +1,32 @@
package com.fr.start.common; package com.fr.start.common;
import com.fine.theme.utils.FineUIStyle;
import com.fr.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MultiTemplateTabPane; import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.DesignSizeI18nManager;
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.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.utils.ColorUtils;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineUIStyle.setStyle;
/** /**
* created by Harrison on 2022/07/09 * created by Harrison on 2022/07/09
**/ **/
public class DesignerOpenEmptyPanel extends JPanel { public class DesignerOpenEmptyPanel extends JPanel {
private static final Color BUTTON_COLOR = new Color(63, 155, 249);
private static final int ARC = 4;
private final JPanel body; private final JPanel body;
public DesignerOpenEmptyPanel() { public DesignerOpenEmptyPanel() {
@ -38,20 +34,8 @@ public class DesignerOpenEmptyPanel extends JPanel {
this.body = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.body = FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel createIcon = new UILabel(IconUtils.readIcon("/com/fr/design/startup/create_new_template.svg")); UILabel createIcon = new UILabel(IconUtils.readIcon("/com/fr/design/startup/create_new_template.svg"));
JButton createButton = new JButton(Toolkit.i18nText("Fine-Design_New_Template")) { JButton createButton = new JButton(Toolkit.i18nText("Fine-Design_New_Template"));
@Override setStyle(createButton, FineUIStyle.STYLE_PRIMARY);
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(BUTTON_COLOR);
g2d.fillRoundRect(0, 0, getWidth(), getHeight(), ARC, ARC);
super.paintComponent(g2d);
}
};
createButton.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.start.common.DesignerOpenEmptyPanel.createButton"));
createButton.setForeground(Color.WHITE);
createButton.setBorderPainted(false);
createButton.setContentAreaFilled(false);
createButton.addActionListener(new ActionListener() { createButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -62,18 +46,14 @@ public class DesignerOpenEmptyPanel extends JPanel {
MultiTemplateTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); MultiTemplateTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
} }
}); });
createButton.setBorder(new EmptyBorder(0, 10, 0, 10));
JPanel createButtonPanel = new JPanel(FRGUIPaneFactory.createCenterFlowLayout());
createButtonPanel.add(createButton);
createButtonPanel.setBorder(new EmptyBorder(0, 0, 0, 0));
createButtonPanel.setBackground(Color.WHITE);
this.body.add(createIcon, BorderLayout.NORTH); this.body.add(createIcon, BorderLayout.NORTH);
this.body.add(createButtonPanel, BorderLayout.SOUTH); this.body.add(row(
flex(),cell(createButton),flex()
).getComponent(), BorderLayout.SOUTH);
setLayout(FRGUIPaneFactory.createCenterLayout(this.body, 0.4d, 0.4d)); setLayout(FRGUIPaneFactory.createCenterLayout(this.body, 0.4d, 0.4d));
setStyle(this.body, FineUIStyle.NORMAL_COLOR);
ColorUtils.syncBackground(this, Color.WHITE); setStyle(this, FineUIStyle.NORMAL_COLOR);
add(this.body); add(this.body);
} }
} }

2
designer-base/src/main/java/com/fr/startup/ui/StartupPageConstants.java

@ -10,7 +10,7 @@ public class StartupPageConstants {
/** /**
* 圆弧长度 * 圆弧长度
*/ */
public static final int ARC_DIAMETER = 20; public static final int ARC_DIAMETER = 10;
/** /**
* 内容宽度 * 内容宽度

11
designer-base/src/main/java/com/fr/startup/ui/StartupPageUtil.java

@ -1,7 +1,8 @@
package com.fr.startup.ui; package com.fr.startup.ui;
import com.fr.base.svg.SVGIcon; import com.fine.theme.icon.LazyIcon;
import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.gui.itree.filetree.FileTreeIcon;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -27,9 +28,9 @@ public class StartupPageUtil {
public static Icon getIcon4RecentAreaByWorkspace(StartupWorkspaceBean workspaceBean) { public static Icon getIcon4RecentAreaByWorkspace(StartupWorkspaceBean workspaceBean) {
if (workspaceBean.getType() == DesignerWorkspaceType.Local) { if (workspaceBean.getType() == DesignerWorkspaceType.Local) {
return SVGIcon.readSVGIcon("/com/fr/design/startup/local_server_background_36.svg", 36, 36); return new LazyIcon("local_server_background", 36);
} }
return SVGIcon.readSVGIcon("/com/fr/design/startup/remote_server_background_36.svg", 36, 36); return new LazyIcon("remote_server_background", 36);
} }
/** /**
@ -41,9 +42,9 @@ public class StartupPageUtil {
public static Icon getIcon4DescAreaByWorkspace(StartupWorkspaceBean workspaceBean) { public static Icon getIcon4DescAreaByWorkspace(StartupWorkspaceBean workspaceBean) {
if (workspaceBean.getType() == DesignerWorkspaceType.Local) { if (workspaceBean.getType() == DesignerWorkspaceType.Local) {
return SVGIcon.readSVGIcon("/com/fr/design/startup/local_server_background_28.svg", 28, 28); return new LazyIcon("local_server_background", 28);
} }
return SVGIcon.readSVGIcon("/com/fr/design/startup/remote_server_background_28.svg", 28, 28); return new LazyIcon("remote_server_background", 28);
} }
/** /**

55
designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java

@ -1,11 +1,14 @@
package com.fr.startup.ui; package com.fr.startup.ui;
import com.fr.base.svg.IconUtils; import com.fine.theme.utils.FineUIStyle;
import com.fr.concurrent.NamedThreadFactory; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.UIExpandDialog; import com.fr.design.dialog.UIExpandDialog;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.filetree.FileTreeIcon;
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.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
@ -13,7 +16,6 @@ import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector;
import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage; import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage;
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.ThemeUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.exit.DesignerExiter; import com.fr.exit.DesignerExiter;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
@ -26,7 +28,6 @@ import com.fr.start.common.DesignerStartupContext;
import com.fr.startup.metric.DesignerMetrics; import com.fr.startup.metric.DesignerMetrics;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -34,12 +35,10 @@ import javax.swing.JSeparator;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.border.EmptyBorder;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.GridLayout; import java.awt.GridLayout;
@ -52,8 +51,8 @@ import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import static com.fine.theme.utils.FineUIScale.scale;
/** /**
* 启动页 * 启动页
@ -66,13 +65,13 @@ public class StartupPageWindow extends JFrame {
private static final Color HOVER_COLOR = new Color(65, 155, 249); private static final Color HOVER_COLOR = new Color(65, 155, 249);
private static final Color SEP_COLOR = new Color(224, 224, 225); private static final Color SEP_COLOR = new Color(224, 224, 225);
private static final int GROUP_WIDTH = 600; private static final int GROUP_WIDTH = scale(600);
private static final int WORKSPACE_PANEL_WIDTH = scale(180);
private static final int RECENT_FILE_LIMIT = 6; private static final int RECENT_FILE_LIMIT = 6;
private static final int RECENT_FILE_SCROLL = RECENT_FILE_LIMIT + 1;
private static final int WORKSPACE_PANEL_WIDTH = 180;
private static final int TITLE_FONT_SIZE = 24; private static final int TITLE_FONT_SIZE = 24;
private static final int ITEM_VERTICAL_GAP = 5; private static final int ITEM_VERTICAL_GAP = 5;
private static final Dimension SCREEN_SIZE = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); private static final Dimension SCREEN_SIZE = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
private static final BufferedImage BACKGROUND_IMAGE = IOUtils.readImage("com/fr/design/startup/startup_page_background.jpg"); private static final BufferedImage BACKGROUND_IMAGE = IOUtils.readImage("com/fr/design/startup/startup_page_background.jpg");
@ -117,7 +116,7 @@ public class StartupPageWindow extends JFrame {
} }
private void initHeaderPanel() { private void initHeaderPanel() {
this.body = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.body = new JPanel(new BorderLayout(0, scale(20)));
this.body.setBackground(new Color(0, 0, 0, 0)); this.body.setBackground(new Color(0, 0, 0, 0));
JPanel headerPanel = createHeader(); JPanel headerPanel = createHeader();
this.body.add(headerPanel, BorderLayout.NORTH); this.body.add(headerPanel, BorderLayout.NORTH);
@ -169,9 +168,7 @@ public class StartupPageWindow extends JFrame {
// Header // Header
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Startup_Page_Select_Workspace")); UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Startup_Page_Select_Workspace"));
Font font = label.getFont(); FineUIUtils.setFontSize(label, TITLE_FONT_SIZE);
Font titleFont = font.deriveFont(font.getStyle(), TITLE_FONT_SIZE);
label.setFont(titleFont);
JPanel headerPanel = new JPanel(); JPanel headerPanel = new JPanel();
LayoutManager centerFlowLayout = FRGUIPaneFactory.createCenterFlowLayout(); LayoutManager centerFlowLayout = FRGUIPaneFactory.createCenterFlowLayout();
headerPanel.setLayout(centerFlowLayout); headerPanel.setLayout(centerFlowLayout);
@ -288,18 +285,18 @@ public class StartupPageWindow extends JFrame {
} }
private JPanel generateRecentOpenPanel(StartupPageModel pageModel) { private JPanel generateRecentOpenPanel(StartupPageModel pageModel) {
Color color = FlatUIUtils.getUIColor("fill.normal", Color.WHITE);
JPanel recentOpenPanel = new JPanel() { JPanel recentOpenPanel = new JPanel() {
@Override @Override
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(Color.WHITE); g2d.setColor(color);
g2d.fillRoundRect(0, 0, getWidth(), getHeight(), StartupPageConstants.ARC_DIAMETER, StartupPageConstants.ARC_DIAMETER); g2d.fillRoundRect(0, 0, getWidth(), getHeight(), 2 * StartupPageConstants.ARC_DIAMETER, 2 * StartupPageConstants.ARC_DIAMETER);
} }
}; };
recentOpenPanel.setLayout(new BorderLayout()); recentOpenPanel.setLayout(new BorderLayout());
recentOpenPanel.setBorder(BorderFactory.createEmptyBorder(25, 25, 25, 6)); recentOpenPanel.setBorder(new ScaledEmptyBorder(25, 25, 25, 6));
StartupWorkspaceBean workspaceInfo = pageModel.getSelectWorkspaceInfo(); StartupWorkspaceBean workspaceInfo = pageModel.getSelectWorkspaceInfo();
JPanel workspaceWrapperYPanel = new JPanel(); JPanel workspaceWrapperYPanel = new JPanel();
@ -309,15 +306,15 @@ public class StartupPageWindow extends JFrame {
JPanel workspaceWrapperXPanel = new JPanel(); JPanel workspaceWrapperXPanel = new JPanel();
workspaceWrapperXPanel.setLayout(new FlowLayout()); workspaceWrapperXPanel.setLayout(new FlowLayout());
workspaceWrapperXPanel.setBorder(BorderFactory.createEmptyBorder());
JPanel workspacePanel = new JPanel(); JPanel workspacePanel = new JPanel();
workspacePanel.setLayout(new BorderLayout(0, 15)); workspacePanel.setLayout(new BorderLayout(0, scale(15)));
UILabel workspaceIcon = new UILabel(StartupPageUtil.getIcon4RecentAreaByWorkspace(workspaceInfo)); UILabel workspaceIcon = new UILabel(StartupPageUtil.getIcon4RecentAreaByWorkspace(workspaceInfo));
workspacePanel.add(workspaceIcon, BorderLayout.NORTH); workspacePanel.add(workspaceIcon, BorderLayout.NORTH);
UILabel nameLabel = new UILabel(workspaceInfo.getName()); UILabel nameLabel = new UILabel(workspaceInfo.getName());
FineUIUtils.setFontSize(nameLabel, 15);
nameLabel.setHorizontalAlignment(SwingConstants.CENTER); nameLabel.setHorizontalAlignment(SwingConstants.CENTER);
workspacePanel.add(nameLabel, BorderLayout.SOUTH); workspacePanel.add(nameLabel, BorderLayout.SOUTH);
workspaceWrapperXPanel.add(workspacePanel); workspaceWrapperXPanel.add(workspacePanel);
@ -340,18 +337,17 @@ public class StartupPageWindow extends JFrame {
JComponent recentOpenGroupPanel = generateRecentOpenGroupPanel(pageModel, workspaceInfo); JComponent recentOpenGroupPanel = generateRecentOpenGroupPanel(pageModel, workspaceInfo);
recentOpenPanel.add(recentOpenGroupPanel, BorderLayout.EAST); recentOpenPanel.add(recentOpenGroupPanel, BorderLayout.EAST);
ColorUtils.syncBackground(recentOpenPanel, Color.WHITE); ColorUtils.syncBackground(recentOpenPanel, color);
Dimension preferredSize = recentOpenPanel.getPreferredSize(); Dimension preferredSize = recentOpenPanel.getPreferredSize();
recentOpenPanel.setPreferredSize(new Dimension(StartupPageConstants.CONTENT_WIDTH, (int) preferredSize.getHeight())); recentOpenPanel.setPreferredSize(new Dimension(scale(StartupPageConstants.CONTENT_WIDTH), (int) preferredSize.getHeight()));
JPanel recentOpenWrapperPanel = new JPanel(); JPanel recentOpenWrapperPanel = new JPanel();
recentOpenWrapperPanel.setName("recentOpenWrapper"); recentOpenWrapperPanel.setName("recentOpenWrapper");
recentOpenWrapperPanel.setLayout(new BorderLayout(0, 0)); recentOpenWrapperPanel.setLayout(new BorderLayout(0, 0));
recentOpenWrapperPanel.setBorder(new EmptyBorder(0, 0, 0, 20));
recentOpenWrapperPanel.add(recentOpenPanel, BorderLayout.CENTER); recentOpenWrapperPanel.add(recentOpenPanel, BorderLayout.CENTER);
ColorUtils.syncBackgroundIfAbsent(recentOpenWrapperPanel, new Color(0,0,0,0), ThemeUtils.BACK_COLOR); FineUIStyle.setStyle(recentOpenWrapperPanel, FineUIStyle.TRANSPARENT_BACKGROUND);
return recentOpenWrapperPanel; return recentOpenWrapperPanel;
} }
@ -372,8 +368,9 @@ public class StartupPageWindow extends JFrame {
for (String recentFile : recentFiles) { for (String recentFile : recentFiles) {
JPanel recentItemPanel = new JPanel(); JPanel recentItemPanel = new JPanel();
recentItemPanel.setLayout(new FlowLayout(FlowLayout.LEFT, ITEM_VERTICAL_GAP, 0)); recentItemPanel.setLayout(new FlowLayout(FlowLayout.LEFT, ITEM_VERTICAL_GAP, 0));
recentItemPanel.add(new UILabel(IconUtils.readIcon("/com/fr/design/standard/system/cpt"))); recentItemPanel.add(new UILabel(FileTreeIcon.getIconByFileName(recentFile)));
UILabel recentFileLabel = new UILabel(recentFile); UILabel recentFileLabel = new UILabel(recentFile);
FineUIUtils.setFontSize(recentFileLabel, 13);
Color recentFileLabelForeground = recentFileLabel.getForeground(); Color recentFileLabelForeground = recentFileLabel.getForeground();
recentItemPanel.add(recentFileLabel); recentItemPanel.add(recentFileLabel);
recentItemPanel.addMouseListener(new MouseAdapter() { recentItemPanel.addMouseListener(new MouseAdapter() {
@ -406,7 +403,7 @@ public class StartupPageWindow extends JFrame {
if (needScroll) { if (needScroll) {
int scrollHeight = (int) Math.round(itemHeight * RECENT_FILE_LIMIT + ITEM_VERTICAL_GAP * (RECENT_FILE_LIMIT)); 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 ScaledEmptyBorder(0, 0, 0, 0));
scrollPane.setPreferredSize(new Dimension(GROUP_WIDTH, scrollHeight)); scrollPane.setPreferredSize(new Dimension(GROUP_WIDTH, scrollHeight));
return scrollPane; return scrollPane;
} }
@ -415,9 +412,7 @@ public class StartupPageWindow extends JFrame {
private StartupPageWorkspacePanel generateWorkspacePanel(StartupPageModel pageModel) { private StartupPageWorkspacePanel generateWorkspacePanel(StartupPageModel pageModel) {
StartupPageWorkspacePanel startupPageWorkspacePanel = new StartupPageWorkspacePanel(pageModel); return new StartupPageWorkspacePanel(pageModel);
ColorUtils.syncBackgroundIfAbsent(startupPageWorkspacePanel, new Color(0, 0, 0, 0), ThemeUtils.BACK_COLOR);
return startupPageWorkspacePanel;
} }
protected LayoutManager getCenterLayout(JComponent centerBody) { protected LayoutManager getCenterLayout(JComponent centerBody) {

284
designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java

@ -1,44 +1,49 @@
package com.fr.startup.ui; package com.fr.startup.ui;
import com.fr.base.svg.IconUtils; import com.fine.swing.ui.layout.Column;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.components.tooltip.ModernToolTip; import com.fr.design.components.tooltip.ModernToolTip;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.FRGraphics2D; import com.fr.design.gui.itextfield.FRGraphics2D;
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.utils.ColorUtils;
import com.fr.start.common.DesignerStartupContext; import com.fr.start.common.DesignerStartupContext;
import com.fr.startup.metric.DesignerMetrics; import com.fr.startup.metric.DesignerMetrics;
import com.fr.third.guava.collect.Lists; import com.fr.third.guava.collect.Lists;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.JToolTip; import javax.swing.JToolTip;
import javax.swing.JViewport; import javax.swing.JViewport;
import javax.swing.RepaintManager;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
import javax.swing.border.EmptyBorder;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Image; import java.awt.Image;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.geom.Path2D;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import static com.fine.theme.utils.FineUIScale.scale;
import static com.fine.theme.utils.FineUIStyle.setStyle;
import static com.fr.startup.ui.StartupPageConstants.ARC_DIAMETER; import static com.fr.startup.ui.StartupPageConstants.ARC_DIAMETER;
/** /**
@ -48,7 +53,6 @@ public class StartupPageWorkspacePanel extends JPanel {
/* color */ /* color */
private static final Color SHALLOW_WHITE_COLOR = new Color(248, 250, 254);
private static final Color HOVER_COLOR = new Color(65, 155, 249); private static final Color HOVER_COLOR = new Color(65, 155, 249);
private static final Color PATH_COLOR = new Color(51, 51, 52, (int) Math.round(255 * 0.5)); private static final Color PATH_COLOR = new Color(51, 51, 52, (int) Math.round(255 * 0.5));
@ -56,20 +60,20 @@ public class StartupPageWorkspacePanel extends JPanel {
private static final int SCROLL_BAR_WIDTH = 20; private static final int SCROLL_BAR_WIDTH = 20;
private static final int CONTENT_WIDTH = StartupPageConstants.CONTENT_WIDTH + SCROLL_BAR_WIDTH; private static final int CONTENT_WIDTH = scale(StartupPageConstants.CONTENT_WIDTH + SCROLL_BAR_WIDTH);
private static final int BORDER_THIN = 2; private static final int BORDER_THIN = 2;
private static final int ITEM_VERTICAL_GAP = 20; private static final int ITEM_VERTICAL_GAP = scale(20);
private static final int SINGLE_ITEM_HEIGHT = 72; private static final int SINGLE_ITEM_HEIGHT = scale(72);
private static final int SCROLL_HEIGHT = SINGLE_ITEM_HEIGHT * 4 + ITEM_VERTICAL_GAP * 4; private static final int SCROLL_HEIGHT = SINGLE_ITEM_HEIGHT * 4 + ITEM_VERTICAL_GAP * 4;
private static final int NAME_LABEL_SIZE = 15; private static final int NAME_LABEL_SIZE = 15;
private static final int PATH_LABEL_SIZE = 10; private static final int PATH_LABEL_SIZE = 10;
private static final Dimension LABEL_DIMENSION = new Dimension(28, 28); private static final Dimension LABEL_DIMENSION = scale(new Dimension(28, 28));
private static final Dimension PATH_DIMENSION = new Dimension(100, 20); private static final Dimension PATH_DIMENSION = scale(new Dimension(100, 20));
private static final Dimension SELECT_WORKSPACE_DIMENSION = new Dimension(210, 72); private static final Dimension SELECT_WORKSPACE_DIMENSION = scale(new Dimension(210, 72));
private static final Dimension SELECT_CREATE_DIMENSION = new Dimension(60, 72); private static final Dimension SELECT_CREATE_DIMENSION = scale(new Dimension(70, 72));
private static final int COLUMN_LIMIT = 3; private static final int COLUMN_LIMIT = 3;
private static final int DOUBLE_CLICK_COUNT = 2; private static final int DOUBLE_CLICK_COUNT = 2;
@ -95,8 +99,7 @@ public class StartupPageWorkspacePanel extends JPanel {
public StartupPageWorkspacePanel(StartupPageModel pageModel) { public StartupPageWorkspacePanel(StartupPageModel pageModel) {
this.setLayout(new BorderLayout(0, 0)); this.setLayout(new BorderLayout(0, scale(10)));
this.setBorder(new EmptyBorder(15, 0, 20, 0));
this.pageModel = pageModel; this.pageModel = pageModel;
@ -104,6 +107,7 @@ public class StartupPageWorkspacePanel extends JPanel {
this.partitions = Lists.partition(workspaceInfos, COLUMN_LIMIT); this.partitions = Lists.partition(workspaceInfos, COLUMN_LIMIT);
this.contentPanel = generateLimitContentPanel(partitions); this.contentPanel = generateLimitContentPanel(partitions);
this.add(contentPanel, BorderLayout.NORTH); this.add(contentPanel, BorderLayout.NORTH);
if (partitions.size() > PARTITION_LIMIT) { if (partitions.size() > PARTITION_LIMIT) {
@ -114,6 +118,9 @@ public class StartupPageWorkspacePanel extends JPanel {
this.createNewTemplateRunnable = pageModel.getCreateNewTemplateRunnable(); this.createNewTemplateRunnable = pageModel.getCreateNewTemplateRunnable();
this.openEmptyTemplateRunnable = pageModel.getOpenEmptyTemplateRunnable(); this.openEmptyTemplateRunnable = pageModel.getOpenEmptyTemplateRunnable();
setStyle(contentPanel, FineUIStyle.TRANSPARENT_BACKGROUND);
setStyle(this, FineUIStyle.TRANSPARENT_BACKGROUND);
this.repaint(); this.repaint();
} }
@ -130,33 +137,33 @@ public class StartupPageWorkspacePanel extends JPanel {
this.remove(this.contentPanel); this.remove(this.contentPanel);
this.contentPanel = generateUnLimitContentPanel(this.partitions); this.contentPanel = generateUnLimitContentPanel(this.partitions);
this.contentPanel.setOpaque(false);
this.add(contentPanel, BorderLayout.NORTH); this.add(contentPanel, BorderLayout.NORTH);
} }
private JComponent generateUnLimitContentPanel(List<List<StartupWorkspaceBean>> partitions) { private JComponent generateUnLimitContentPanel(List<List<StartupWorkspaceBean>> partitions) {
JComponent panel = generateUnLimitContentPanel0(partitions); JComponent panel = generateUnLimitContentPanel0(partitions);
ColorUtils.transparentBackground(panel); setStyle(panel, FineUIStyle.TRANSPARENT_BACKGROUND);
return panel; return panel;
} }
private JComponent generateUnLimitContentPanel0(List<List<StartupWorkspaceBean>> partitions) { private JComponent generateUnLimitContentPanel0(List<List<StartupWorkspaceBean>> partitions) {
JPanel workspaceDescWrapper = new JPanel(); JPanel workspaceDescWrapper = new JPanel();
workspaceDescWrapper.setLayout(new BorderLayout(0, 0)); setStyle(workspaceDescWrapper, FineUIStyle.TRANSPARENT_BACKGROUND);
workspaceDescWrapper.setBorder(new EmptyBorder(0, 0, 0, 0)); workspaceDescWrapper.setLayout(new BorderLayout());
Column workSpaceDescPanel = new Column();
JPanel workspaceDescPanel = new JPanel(); workSpaceDescPanel.setSpacing(20);
workspaceDescPanel.setLayout(new GridLayout(partitions.size(), 1, 0, 0)); setStyle(workSpaceDescPanel, FineUIStyle.TRANSPARENT_BACKGROUND);
for (List<StartupWorkspaceBean> partition : partitions) { for (List<StartupWorkspaceBean> partition : partitions) {
JPanel partitionPanel = generatePartitionPanel(partition); JPanel partitionPanel = generatePartitionPanel(partition);
workspaceDescPanel.add(partitionPanel); workSpaceDescPanel.add(partitionPanel);
} }
boolean needScroll = partitions.size() > 4; boolean needScroll = partitions.size() > 4;
if (needScroll) { if (needScroll) {
return generateScrollUnLimitContentPanel(workspaceDescWrapper, workspaceDescPanel); return generateScrollUnLimitContentPanel(workspaceDescWrapper, workSpaceDescPanel);
} }
workspaceDescWrapper.add(workspaceDescPanel, BorderLayout.CENTER); workspaceDescWrapper.add(workSpaceDescPanel, BorderLayout.CENTER);
return workspaceDescWrapper; return workspaceDescWrapper;
} }
@ -164,23 +171,30 @@ public class StartupPageWorkspacePanel extends JPanel {
private JPanel generateScrollUnLimitContentPanel(JPanel workspaceDescWrapper, JPanel workspaceDescPanel) { private JPanel generateScrollUnLimitContentPanel(JPanel workspaceDescWrapper, JPanel workspaceDescPanel) {
// 滚动条 // 滚动条
UIScrollPane scrollPane = new UIScrollPane(workspaceDescPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); UIScrollPane scrollPane = new UIScrollPane(workspaceDescPanel,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
workspaceDescWrapper.setPreferredSize(new Dimension(CONTENT_WIDTH + SCROLL_BAR_WIDTH, SCROLL_HEIGHT));
JViewport viewport = scrollPane.getViewport(); JViewport viewport = scrollPane.getViewport();
JViewport scrollViewport = new TransparentScrollViewPort(); JViewport scrollViewport = new TransparentScrollViewPort();
// 动态画图 // 动态画图
scrollViewport.addChangeListener(e -> repaintAll()); scrollViewport.addChangeListener(e -> repaintAll());
scrollViewport.setView(viewport.getView()); scrollViewport.setView(viewport.getView());
scrollPane.setViewport(scrollViewport); scrollPane.setViewport(scrollViewport);
scrollPane.setBorder(new EmptyBorder(10, 0, 0, 0)); // 透明度配置
scrollPane.setPreferredSize(new Dimension(CONTENT_WIDTH, SCROLL_HEIGHT)); InReactiveScrollBar bar = new InReactiveScrollBar();
workspaceDescWrapper.add(scrollPane, BorderLayout.CENTER); scrollPane.setVerticalScrollBar(bar);
setStyle(bar, FineUIStyle.TRANSPARENT_BACKGROUND);
scrollViewport.setOpaque(false);
workspaceDescWrapper.add(scrollPane, BorderLayout.CENTER);
return workspaceDescWrapper; return workspaceDescWrapper;
} }
private JPanel generateLimitContentPanel(List<List<StartupWorkspaceBean>> partitions) { private JPanel generateLimitContentPanel(List<List<StartupWorkspaceBean>> partitions) {
JPanel workspaceDescPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEFT, 0, 0); Column workspaceDescPanel = new Column();
workspaceDescPanel.setSpacing(20);
int limit = 2; int limit = 2;
for (int i = 0; i < partitions.size(); i++) { for (int i = 0; i < partitions.size(); i++) {
if (i >= limit) { if (i >= limit) {
@ -192,8 +206,7 @@ public class StartupPageWorkspacePanel extends JPanel {
workspaceDescPanel.add(partitionPanel); workspaceDescPanel.add(partitionPanel);
} }
ColorUtils.transparentBackground(workspaceDescPanel); setStyle(workspaceDescPanel, FineUIStyle.TRANSPARENT_BACKGROUND);
return workspaceDescPanel; return workspaceDescPanel;
} }
@ -205,7 +218,6 @@ public class StartupPageWorkspacePanel extends JPanel {
JPanel tailPanel = new JPanel(); JPanel tailPanel = new JPanel();
{ {
tailPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); tailPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
tailPanel.setBorder(new EmptyBorder(0, 0, 0, 20));
JPanel showAllPanel = new JPanel() { JPanel showAllPanel = new JPanel() {
@Override @Override
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
@ -217,34 +229,17 @@ public class StartupPageWorkspacePanel extends JPanel {
} }
} }
}; };
showAllPanel.setLayout(new BorderLayout(5, 0)); showAllPanel.setLayout(new BorderLayout());
showAllPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
UILabel fontLabel = new UILabel(Toolkit.i18nText("Fine-Design_Startup_Page_Expand_All")); UILabel fontLabel = new UILabel(Toolkit.i18nText("Fine-Design_Startup_Page_Expand_All"));
fontLabel.setForeground(HOVER_COLOR); fontLabel.setForeground(FlatUIUtils.getUIColor("brand.normal", HOVER_COLOR));
showAllPanel.setBackground(new Color(0, 0, 0, 0));
showAllPanel.add(fontLabel, BorderLayout.WEST); showAllPanel.add(fontLabel, BorderLayout.WEST);
setStyle(showAllPanel, FineUIStyle.TRANSPARENT_BACKGROUND);
UILabel iconLabel = new UILabel(IconUtils.readIcon("/com/fr/design/startup/show_more.svg")); UILabel iconLabel = new UILabel(new LazyIcon("show_more"));
showAllPanel.add(iconLabel, BorderLayout.EAST); showAllPanel.add(iconLabel, BorderLayout.EAST);
Color showAllBackground = showAllPanel.getBackground();
showAllPanel.addMouseListener(new MouseAdapter() { showAllPanel.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
Color hoverBackColor = new Color(217, 235, 254);
hoverBackColorRef.set(hoverBackColor);
repaintAll();
}
@Override
public void mouseExited(MouseEvent e) {
hoverBackColorRef.set(null);
ColorUtils.syncBackground(showAllPanel, showAllBackground);
repaintAll();
}
@Override @Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
doShowAllAction(fontLabel, iconLabel); doShowAllAction(fontLabel, iconLabel);
@ -252,21 +247,16 @@ public class StartupPageWorkspacePanel extends JPanel {
}); });
tailPanel.add(showAllPanel); tailPanel.add(showAllPanel);
Dimension preferredSize = tailPanel.getPreferredSize(); Dimension preferredSize = tailPanel.getPreferredSize();
tailPanel.setPreferredSize(new Dimension(CONTENT_WIDTH, (int) preferredSize.getHeight())); tailPanel.setPreferredSize(new Dimension(scale(StartupPageConstants.CONTENT_WIDTH), (int) preferredSize.getHeight()));
} }
setStyle(tailPanel, FineUIStyle.TRANSPARENT_BACKGROUND);
return tailPanel; return tailPanel;
} }
@NotNull @NotNull
private JPanel generatePartitionPanel(List<StartupWorkspaceBean> partition) { private JPanel generatePartitionPanel(List<StartupWorkspaceBean> partition) {
JPanel partitionPanelWrapper = new JPanel(); List<JPanel> workSpacePaneList = new ArrayList<>();
partitionPanelWrapper.setBorder(new EmptyBorder(10,0,10,0));
partitionPanelWrapper.setLayout(new BorderLayout());
JPanel partitionPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(0, 20, 0);
partitionPanel.setName("partitionPanel");
for (StartupWorkspaceBean workspaceInfo : partition) { for (StartupWorkspaceBean workspaceInfo : partition) {
JPanel workspaceItemDesc = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel workspaceItemDesc = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -275,13 +265,17 @@ public class StartupPageWorkspacePanel extends JPanel {
layoutSelectAndCreatePanel(workspaceInfo, workspaceItemDesc); layoutSelectAndCreatePanel(workspaceInfo, workspaceItemDesc);
partitionPanel.add(workspaceItemDesc); setStyle(workspaceItemDesc, FineUIStyle.TRANSPARENT_BACKGROUND);
Dimension preferredSize = partitionPanel.getPreferredSize(); workSpacePaneList.add(workspaceItemDesc);
partitionPanel.setPreferredSize(new Dimension(CONTENT_WIDTH, (int) preferredSize.getHeight()));
} }
partitionPanelWrapper.add(partitionPanel, BorderLayout.CENTER); JPanel singleRow = FineLayoutBuilder.createCommonTableLayout(3, 20, 0, workSpacePaneList);
singleRow.setName("partitionPanel");
JPanel partitionPanelWrapper = FineLayoutBuilder.asBorderLayoutWrapped(singleRow);
setStyle(singleRow, FineUIStyle.TRANSPARENT_BACKGROUND);
setStyle(partitionPanelWrapper, FineUIStyle.TRANSPARENT_BACKGROUND);
return partitionPanelWrapper; return partitionPanelWrapper;
} }
@ -302,35 +296,18 @@ public class StartupPageWorkspacePanel extends JPanel {
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color borderColor = borderColorRef.get();
Color backColor = Color.WHITE; Color backColor = FlatUIUtils.getUIColor("fill.normal", Color.WHITE);
g2d.setColor(backColor); g2d.setColor(backColor);
// 直角和圆角上下叠合在一起 Path2D path2D = FineUIUtils.createLeftRoundRectangle(0, 0, this.getWidth(), this.getHeight(), ARC_DIAMETER);
int rectOffset = 10; g2d.fill(path2D);
int roundOffset = 15;
// 填充一个直角 Color borderColor = borderColorRef.get();
g2d.fillRoundRect(0, 0, getWidth() - rectOffset, getHeight(), ARC_DIAMETER, ARC_DIAMETER);
// 填充一个圆角
g2d.fillRoundRect(getWidth() - roundOffset, 0, roundOffset, getHeight(), 0, 0);
paintBorderIfHover(g2d, borderColor, backColor); paintBorderIfHover(g2d, borderColor, backColor);
} }
/** /**
* 当悬浮的时候将边框展示出来 * 当悬浮的时候将边框展示出来
* 会叠合然后填充中间
*
* |-------
* | A C B
* |-------
*
* 见上面有两种线分别是 A- B-
* 这里会将 A B 叠在一起中间则存在 C然后将 C 的部分扩大一点然后填充上背景
* 则形成下面这种图形
*
* |----
* |----
*
* @param g2d 绘画 * @param g2d 绘画
* @param borderColor 边框颜色 * @param borderColor 边框颜色
* @param backColor 背景颜色 * @param backColor 背景颜色
@ -340,70 +317,48 @@ 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));
// 需要一个修正值 FlatUIUtils.setRenderingHints(g2d);
int strokeOffset = BORDER_THIN / 2; Path2D path2D = FineUIUtils.createLeftRoundRectangle(0, 0,
// 直角和圆角上下叠合在一起 getWidth() - BORDER_THIN, getHeight() - BORDER_THIN, ARC_DIAMETER);
int rectOffset = 10; g2d.draw(path2D);
int roundOffset = 15;
// 画一个圆角
int fixRoundWidth = getWidth() - rectOffset;
int fixRoundHeight = getHeight() - BORDER_THIN;
g2d.drawRoundRect(strokeOffset, strokeOffset, fixRoundWidth, fixRoundHeight, ARC_DIAMETER, ARC_DIAMETER);
g2d.setColor(backColor);
// 绘制一个矩形,覆盖住多余的相交线
// 需要考虑上下的线宽
int coverHeight = getHeight() - (BORDER_THIN * 2);
// 偏左一点的 fixedX
int fixedX = getWidth() - roundOffset - BORDER_THIN;
// 圆角和直角相交的区域
int coverWidth = 15;
g2d.fillRect(fixedX, BORDER_THIN, coverWidth, coverHeight);
g2d.setColor(borderColor);
g2d.drawLine(getWidth() / 2, strokeOffset, getWidth(), strokeOffset);
g2d.drawLine(getWidth() / 2, getHeight() - strokeOffset, getWidth(), getHeight() - strokeOffset);
g2d.drawLine(getWidth() - strokeOffset, strokeOffset, getWidth() - strokeOffset, getHeight() - strokeOffset);
} }
} }
}; };
selectWorkspacePanel.setLayout(new BorderLayout(0,0)); selectWorkspacePanel.setLayout(new BorderLayout());
selectWorkspacePanel.setToolTipText(Toolkit.i18nText("Fine-Design_Startup_Page_Double_Click_Enter_Workspace")); selectWorkspacePanel.setToolTipText(Toolkit.i18nText("Fine-Design_Startup_Page_Double_Click_Enter_Workspace"));
selectWorkspacePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); selectWorkspacePanel.setBorder(new ScaledEmptyBorder(10, 10, 10, 10));
{ {
JPanel iconPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel iconPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
iconPanel.setBorder(new EmptyBorder(0, 10, 0, 10));
Icon icon = StartupPageUtil.getIcon4DescAreaByWorkspace(workspaceInfo); Icon icon = StartupPageUtil.getIcon4DescAreaByWorkspace(workspaceInfo);
UILabel label = new UILabel(icon); UILabel label = new UILabel(icon);
label.setPreferredSize(LABEL_DIMENSION); label.setPreferredSize(LABEL_DIMENSION);
iconPanel.add(label, BorderLayout.CENTER); iconPanel.add(label, BorderLayout.CENTER);
iconPanel.setOpaque(false);
selectWorkspacePanel.add(iconPanel, BorderLayout.WEST); selectWorkspacePanel.add(iconPanel, BorderLayout.WEST);
// desc / >箭头 // desc / >箭头
JPanel descPanel = new JPanel(); JPanel descPanel = new JPanel();
descPanel.setOpaque(false);
descPanel.setLayout(FRGUIPaneFactory.createM_BorderLayout()); descPanel.setLayout(FRGUIPaneFactory.createM_BorderLayout());
descPanel.setBorder(new EmptyBorder(0, 10, 0, 0));
JPanel simpleDescPanelWrapper = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.CENTER, 0, 0); JPanel simpleDescPanelWrapper = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.CENTER, 0, 0);
JPanel simpleDescPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel simpleDescPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel nameLabel = new UILabel(workspaceInfo.getName()); UILabel nameLabel = new UILabel(workspaceInfo.getName());
Font font = nameLabel.getFont(); FineUIUtils.setFontSize(nameLabel, NAME_LABEL_SIZE);
Font newSizeFont = font.deriveFont(font.getStyle(), NAME_LABEL_SIZE);
nameLabel.setFont(newSizeFont);
nameLabel.setPreferredSize(PATH_DIMENSION); nameLabel.setPreferredSize(PATH_DIMENSION);
Color nameForeground = nameLabel.getForeground(); Color nameForeground = nameLabel.getForeground();
simpleDescPanel.add(nameLabel,BorderLayout.NORTH); simpleDescPanel.add(nameLabel,BorderLayout.NORTH);
UILabel pathLabel = new UILabel(workspaceInfo.getPath()); UILabel pathLabel = new UILabel(workspaceInfo.getPath());
pathLabel.setPreferredSize(PATH_DIMENSION); pathLabel.setPreferredSize(PATH_DIMENSION);
Font pathFont = pathLabel.getFont(); FineUIUtils.setFontSize(pathLabel, PATH_LABEL_SIZE);
pathLabel.setFont(pathFont.deriveFont(pathFont.getStyle(), PATH_LABEL_SIZE));
Color pathColor = PATH_COLOR; Color pathColor = PATH_COLOR;
pathLabel.setForeground(pathColor); pathLabel.setForeground(pathColor);
simpleDescPanel.add(pathLabel, BorderLayout.SOUTH); simpleDescPanel.add(pathLabel, BorderLayout.SOUTH);
simpleDescPanel.setOpaque(false);
simpleDescPanelWrapper.add(simpleDescPanel); simpleDescPanelWrapper.add(simpleDescPanel);
simpleDescPanelWrapper.setOpaque(false);
descPanel.add(simpleDescPanelWrapper, BorderLayout.WEST); descPanel.add(simpleDescPanelWrapper, BorderLayout.WEST);
@ -411,7 +366,7 @@ public class StartupPageWorkspacePanel extends JPanel {
@Override @Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
Color hoverColor = HOVER_COLOR; Color hoverColor = FlatUIUtils.getUIColor("brand.normal", HOVER_COLOR);
borderColorRef.set(hoverColor); borderColorRef.set(hoverColor);
nameLabel.setForeground(hoverColor); nameLabel.setForeground(hoverColor);
pathLabel.setForeground(hoverColor ); pathLabel.setForeground(hoverColor );
@ -439,7 +394,7 @@ public class StartupPageWorkspacePanel extends JPanel {
}; };
UILabel arrowLabel = new UILabel(IconUtils.readIcon("/com/fr/design/startup/more.svg")) { UILabel arrowLabel = new UILabel(new LazyIcon("more_arrow", 20)) {
@Override @Override
public JToolTip createToolTip() { public JToolTip createToolTip() {
return new ModernToolTip(); return new ModernToolTip();
@ -449,13 +404,13 @@ public class StartupPageWorkspacePanel extends JPanel {
arrowLabel.addMouseListener(new MouseAdapter() { arrowLabel.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
arrowLabel.setIcon(IconUtils.readIcon("/com/fr/design/startup/more_hover.svg")); arrowLabel.setIcon(new LazyIcon("more_arrow_hover", 20));
selectWorkspaceMouseListener.mouseEntered(e); selectWorkspaceMouseListener.mouseEntered(e);
} }
@Override @Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
arrowLabel.setIcon(IconUtils.readIcon("/com/fr/design/startup/more.svg")); arrowLabel.setIcon(new LazyIcon("more_arrow", 20));
selectWorkspaceMouseListener.mouseExited(e); selectWorkspaceMouseListener.mouseExited(e);
} }
@ -465,12 +420,10 @@ public class StartupPageWorkspacePanel extends JPanel {
} }
}); });
descPanel.add(arrowLabel, BorderLayout.EAST); descPanel.add(arrowLabel, BorderLayout.EAST);
selectWorkspacePanel.add(descPanel, BorderLayout.CENTER); selectWorkspacePanel.add(descPanel, BorderLayout.CENTER);
selectWorkspacePanel.addMouseListener(selectWorkspaceMouseListener); selectWorkspacePanel.addMouseListener(selectWorkspaceMouseListener);
} }
ColorUtils.syncBackground(selectWorkspacePanel, Color.WHITE);
selectWorkspacePanel.setPreferredSize(SELECT_WORKSPACE_DIMENSION); selectWorkspacePanel.setPreferredSize(SELECT_WORKSPACE_DIMENSION);
workspaceItemDesc.add(selectWorkspacePanel, BorderLayout.WEST); workspaceItemDesc.add(selectWorkspacePanel, BorderLayout.WEST);
} }
@ -489,58 +442,43 @@ public class StartupPageWorkspacePanel extends JPanel {
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color borderColor = borderColorRef.get();
Color backColor = SHALLOW_WHITE_COLOR; Color backColor = FlatUIUtils.getUIColor("fill.deep", Color.GRAY);
g2d.setColor(backColor); g2d.setColor(backColor);
Path2D shape = FineUIUtils.createRightRoundRectangle(0, 0, this.getWidth(), this.getHeight(), ARC_DIAMETER);
g2d.fill(shape);
// 见 layoutSelectWorkspacePanel 部分的分析 Color borderColor = borderColorRef.get();
// 直角和圆角上下叠合在一起
int rectOffset = 10;
int roundOffset = 15;
int strokeOffset = BORDER_THIN / 2;
int fixedRoundOffset = roundOffset + strokeOffset;
g2d.fillRoundRect(0, 0, getWidth() - rectOffset, getHeight(), 0, 0);
g2d.fillRoundRect(getWidth() - fixedRoundOffset, 0, roundOffset, getHeight(), ARC_DIAMETER, ARC_DIAMETER);
if (borderColor != null) { if (borderColor != null) {
g2d.setColor(borderColor); g2d.setColor(borderColor);
g2d.setStroke(new BasicStroke(BORDER_THIN)); g2d.setStroke(new BasicStroke(BORDER_THIN));
FlatUIUtils.setRenderingHints(g2d);
int borderOffset = BORDER_THIN * 2; Path2D path2D = FineUIUtils.createRightRoundRectangle(0, 0,
// 画画的笔触需要调整一下 getWidth() - BORDER_THIN, getHeight() - BORDER_THIN, ARC_DIAMETER);
g2d.drawRoundRect(strokeOffset, strokeOffset, getWidth() - borderOffset, getHeight() - BORDER_THIN, ARC_DIAMETER, ARC_DIAMETER); g2d.draw(path2D);
g2d.setColor(backColor);
int fillWidth = 15;
g2d.fillRect(0, 0, fillWidth, getHeight());
g2d.setColor(borderColor);
g2d.drawLine(strokeOffset, strokeOffset, fillWidth, strokeOffset);
g2d.drawLine(strokeOffset, getHeight() - strokeOffset, fillWidth, getHeight() - strokeOffset);
g2d.drawLine(strokeOffset, strokeOffset, strokeOffset, getHeight() - strokeOffset);
} }
} }
}; };
selectAndCreatePanel.setToolTipText(Toolkit.i18nText("Fine-Design_Startup_Page_Enter_Workspace_And_Create")); selectAndCreatePanel.setToolTipText(Toolkit.i18nText("Fine-Design_Startup_Page_Enter_Workspace_And_Create"));
selectAndCreatePanel.setBorder(new EmptyBorder(0, 0, 0, 0));
selectAndCreatePanel.setLayout(new BorderLayout()); selectAndCreatePanel.setLayout(new BorderLayout());
{ {
UILabel label = new UILabel(IconUtils.readIcon("/com/fr/design/standard/system/add")); UILabel label = new UILabel(new LazyIcon("add", 20));
label.setPreferredSize(new Dimension(ARC_DIAMETER, ARC_DIAMETER)); label.setPreferredSize(new Dimension(ARC_DIAMETER, ARC_DIAMETER));
label.setForeground(HOVER_COLOR); label.setForeground(FlatUIUtils.getUIColor("brand.normal", HOVER_COLOR));
selectAndCreatePanel.add(label, BorderLayout.CENTER); selectAndCreatePanel.add(label, BorderLayout.CENTER);
selectAndCreatePanel.addMouseListener(new MouseAdapter() { selectAndCreatePanel.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
borderColorRef.set(HOVER_COLOR); borderColorRef.set(FlatUIUtils.getUIColor("brand.normal", HOVER_COLOR));
label.setIcon(IconUtils.readIcon("/com/fr/design/standard/system/add_hover.svg")); label.setIcon(new LazyIcon("add_hover", 20));
repaintAll(); repaintAll();
} }
@Override @Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
borderColorRef.set(null); borderColorRef.set(null);
label.setIcon(IconUtils.readIcon("/com/fr/design/standard/system/add")); label.setIcon(new LazyIcon("add", 20));
repaintAll(); repaintAll();
} }
@Override @Override
@ -550,7 +488,6 @@ public class StartupPageWorkspacePanel extends JPanel {
} }
}); });
} }
ColorUtils.syncBackground(selectAndCreatePanel, Color.GREEN);
selectAndCreatePanel.setPreferredSize(SELECT_CREATE_DIMENSION); selectAndCreatePanel.setPreferredSize(SELECT_CREATE_DIMENSION);
workspaceItemDesc.add(selectAndCreatePanel, BorderLayout.EAST); workspaceItemDesc.add(selectAndCreatePanel, BorderLayout.EAST);
} }
@ -584,12 +521,12 @@ public class StartupPageWorkspacePanel extends JPanel {
if (showMore) { if (showMore) {
fontLabel.setText(Toolkit.i18nText("Fine-Design_Startup_Page_Collapse_Workspace")); fontLabel.setText(Toolkit.i18nText("Fine-Design_Startup_Page_Collapse_Workspace"));
iconLabel.setIcon(IconUtils.readIcon("/com/fr/design/startup/show_less.svg")); iconLabel.setIcon(new LazyIcon("show_less"));
showMoreContent(); showMoreContent();
showMore = !showMore; showMore = !showMore;
} else { } else {
fontLabel.setText(Toolkit.i18nText("Fine-Design_Startup_Page_Expand_All")); fontLabel.setText(Toolkit.i18nText("Fine-Design_Startup_Page_Expand_All"));
iconLabel.setIcon(IconUtils.readIcon("/com/fr/design/startup/show_more.svg")); iconLabel.setIcon(new LazyIcon("show_more"));
showLessContent(); showLessContent();
showMore = !showMore; showMore = !showMore;
} }
@ -607,11 +544,30 @@ public class StartupPageWorkspacePanel extends JPanel {
/** /**
* 支持透明的滚动视图 * 支持透明的滚动视图
*/ */
private class TransparentScrollViewPort extends JViewport { private static class TransparentScrollViewPort extends JViewport {
/**
* @return 创建一个不会实际画图的 Graphics
*/
@Override
public Graphics getGraphics() {
Graphics graphics = super.getGraphics();
return new FRGraphics2D((Graphics2D) graphics) {
@Override
public boolean drawImage(Image img, int x, int y, ImageObserver observer) {
return true;
}
};
}
}
/**
* 支持透明的滚动条
*/
private static class InReactiveScrollBar extends JScrollBar {
/** /**
* 从而屏蔽掉 {@link RepaintManager.PaintManager#paintDoubleBuffered(JComponent, Image, Graphics, int, int, int, int)}
*
* @return 创建一个不会实际画图的 Graphics * @return 创建一个不会实际画图的 Graphics
*/ */
@Override @Override

5
designer-base/src/main/resources/com/fine/theme/icon/add_hover.svg

@ -0,0 +1,5 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="&#229;&#144;&#141;&#231;&#167;&#176;=&#230;&#183;&#187;&#229;&#138;&#160;, &#231;&#166;&#129;&#231;&#148;&#168;=off">
<path id="Union" d="M14.8 17.2L14.8 27.8C14.8 28.4627 15.3373 29 16 29C16.6627 29 17.2 28.4627 17.2 27.8V17.2H27.8C28.4627 17.2 29 16.6627 29 16C29 15.3373 28.4627 14.8 27.8 14.8H17.2V4.2C17.2 3.53726 16.6627 3 16 3C15.3373 3 14.8 3.53726 14.8 4.2L14.8 14.8H4.2C3.53726 14.8 3 15.3373 3 16C3 16.6627 3.53726 17.2 4.2 17.2H14.8Z" fill="#2576EF" fill-opacity="0.9"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 598 B

15
designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/fvs_locked.svg

@ -0,0 +1,15 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="&#231;&#177;&#187;&#229;&#158;&#139;=fvs, &#231;&#166;&#129;&#231;&#148;&#168;=off, &#233;&#148;&#129;&#229;&#174;&#154;=on, Property=&#226;&#128;&#148;">
<path id="Subtract" fill-rule="evenodd" clip-rule="evenodd" d="M4.48996 3.40002C3.88794 3.40002 3.3999 3.88505 3.3999 4.48336V28.3167C3.3999 28.915 3.88794 29.4 4.48996 29.4H15.0264C15.009 29.2691 15 29.1356 15 28.9999V21.9999C15 20.3431 16.3431 18.9999 18 18.9999H18.0831C18.5592 16.1622 21.0272 14 24.0002 14C26.3749 14 28.4274 15.3796 29.3999 17.381V4.48336C29.3999 3.88505 28.9119 3.40002 28.3098 3.40002H4.48996Z" fill="#856CD8"/>
<path id="Rectangle 34624679" d="M7.18555 19.8645H10.7011V24.3845H7.18555V19.8645Z" fill="white"/>
<path id="Subtract_2" d="M24.569 7L17.94 13.3923C17.1163 14.1866 15.7807 14.1866 14.957 13.3923L13.714 12.1937C13.6225 12.1054 13.4741 12.1054 13.3826 12.1937L7.18555 18.1694V15.6125L12.0568 10.9153C12.8805 10.1209 14.2161 10.1209 15.0398 10.9153L16.2828 12.1138C16.3743 12.2021 16.5227 12.2021 16.6142 12.1138L19.9287 8.91768L18.7686 7.79903L24.569 7Z" fill="white"/>
<path id="Subtract_3" fill-rule="evenodd" clip-rule="evenodd" d="M16.5601 19.3674C16.9875 19.1332 17.4782 18.9999 18 18.9999H18.0831C18.1649 18.5123 18.3056 18.0447 18.4975 17.6045H16.5601V19.3674Z" fill="white"/>
<path id="Subtract_4" opacity="0.8" fill-rule="evenodd" clip-rule="evenodd" d="M24.7626 11.9546H21.2471V14.6675C22.0716 14.2409 23.0078 14 24.0002 14C24.2585 14 24.5129 14.0163 24.7626 14.048V11.9546Z" fill="white"/>
<path id="Subtract_5" opacity="0.8" fill-rule="evenodd" clip-rule="evenodd" d="M15.3881 20.523V16.4746H11.8726V24.3846H15V21.9999C15 21.463 15.141 20.959 15.3881 20.523Z" fill="white"/>
<path id="Subtract_6" fill-rule="evenodd" clip-rule="evenodd" d="M27.4786 2H4.5214C3.12887 2 2 3.12263 2 4.50746V27.4925C2 28.8774 3.12887 30 4.5214 30H15.1707C15.0602 29.6872 15 29.3506 15 28.9999V28.5373H4.5214C3.94118 28.5373 3.47082 28.0696 3.47082 27.4925V4.50746C3.47082 3.93045 3.94118 3.46269 4.5214 3.46269H27.4786C28.0588 3.46269 28.5292 3.93045 28.5292 4.50746V16.0644C29.2699 16.9161 29.7744 17.9788 29.9405 19.1503C29.9604 19.1569 29.9802 19.1637 30 19.1706V4.50746C30 3.12263 28.8711 2 27.4786 2Z" fill="#4834AE"/>
<g id="Union">
<path d="M24 24C23.4477 24 23 24.4477 23 25V27C23 27.5523 23.4477 28 24 28C24.5523 28 25 27.5523 25 27V25C25 24.4477 24.5523 24 24 24Z" fill="#F1393C"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M29 21H28V20C28 17.7909 26.2091 16 24 16C21.7909 16 20 17.7909 20 20V21H19C17.8954 21 17 21.8954 17 23V29C17 30.1046 17.8954 31 19 31H29C30.1046 31 31 30.1046 31 29V23C31 21.8954 30.1046 21 29 21ZM26.6 20V21H21.4V20C21.4 18.5641 22.5641 17.4 24 17.4C25.4359 17.4 26.6 18.5641 26.6 20ZM19 22.4C18.6686 22.4 18.4 22.6686 18.4 23V29C18.4 29.3314 18.6686 29.6 19 29.6H29C29.3314 29.6 29.6 29.3314 29.6 29V23C29.6 22.6686 29.3314 22.4 29 22.4H19Z" fill="#F1393C"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

16
designer-base/src/main/resources/com/fine/theme/icon/startup/local_server_background.svg

@ -0,0 +1,16 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_11520_43875)">
<rect width="28" height="28" rx="5" fill="url(#paint0_linear_11520_43875)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.9007 9.62541H14.0997L14.0002 9.52588L13.9007 9.62541Z" fill="#DADADD"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.4098 7.38719L5.25014 14.5469L6.84045 16.1372L7.4375 15.5401V21.1096V22.2034H8.53125H20.5636V21.1096V15.541L21.1598 16.1372L22.7501 14.5469L15.5905 7.38719L14.0001 5.79688L12.4098 7.38719ZM14.0001 8.9775L8.4305 14.5471H8.53125V21.1096H19.4688V14.5471H19.5698L14.0001 8.9775ZM16.1875 20.0159H11.8125V15.6409H16.1875V20.0159Z" fill="white"/>
</g>
<defs>
<linearGradient id="paint0_linear_11520_43875" x1="21" y1="-1.10526" x2="21.3684" y2="28" gradientUnits="userSpaceOnUse">
<stop stop-color="#00D2FF"/>
<stop offset="1" stop-color="#04BBF7"/>
</linearGradient>
<clipPath id="clip0_11520_43875">
<rect width="28" height="28" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

3
designer-base/src/main/resources/com/fine/theme/icon/startup/more.svg

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.6 10C17.6 14.1974 14.1974 17.6 10 17.6C5.80264 17.6 2.4 14.1974 2.4 10C2.4 5.80264 5.80264 2.4 10 2.4C14.1974 2.4 17.6 5.80264 17.6 10ZM19 10C19 14.9706 14.9706 19 10 19C5.02944 19 1 14.9706 1 10C1 5.02944 5.02944 1 10 1C14.9706 1 19 5.02944 19 10ZM14.9578 10.5297C15.106 10.4014 15.1998 10.2118 15.1998 10.0003C15.1998 9.78879 15.106 9.59919 14.9577 9.47083L10.9608 5.9735C10.6698 5.71892 10.2276 5.7484 9.973 6.03935C9.71842 6.3303 9.74791 6.77253 10.0389 7.02711L12.6368 9.3003H4.9998C4.61321 9.3003 4.2998 9.6137 4.2998 10.0003C4.2998 10.3869 4.61321 10.7003 4.9998 10.7003H12.6368L10.0389 12.9735C9.74791 13.2281 9.71842 13.6703 9.973 13.9613C10.2276 14.2522 10.6698 14.2817 10.9608 14.0271L14.9578 10.5297Z" fill="#62646E"/>
</svg>

After

Width:  |  Height:  |  Size: 887 B

3
designer-base/src/main/resources/com/fine/theme/icon/startup/more_hover.svg

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.6 10C17.6 14.1974 14.1974 17.6 10 17.6C5.80264 17.6 2.4 14.1974 2.4 10C2.4 5.80264 5.80264 2.4 10 2.4C14.1974 2.4 17.6 5.80264 17.6 10ZM19 10C19 14.9706 14.9706 19 10 19C5.02944 19 1 14.9706 1 10C1 5.02944 5.02944 1 10 1C14.9706 1 19 5.02944 19 10ZM14.9578 10.5297C15.106 10.4014 15.1998 10.2118 15.1998 10.0003C15.1998 9.78879 15.106 9.59919 14.9577 9.47083L10.9608 5.9735C10.6698 5.71892 10.2276 5.7484 9.973 6.03935C9.71842 6.3303 9.74791 6.77253 10.0389 7.02711L12.6368 9.3003H4.9998C4.61321 9.3003 4.2998 9.6137 4.2998 10.0003C4.2998 10.3869 4.61321 10.7003 4.9998 10.7003H12.6368L10.0389 12.9735C9.74791 13.2281 9.71842 13.6703 9.973 13.9613C10.2276 14.2522 10.6698 14.2817 10.9608 14.0271L14.9578 10.5297Z" fill="#419BF9"/>
</svg>

After

Width:  |  Height:  |  Size: 887 B

18
designer-base/src/main/resources/com/fine/theme/icon/startup/remote_server_background.svg

@ -0,0 +1,18 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_11520_46350)">
<rect width="28" height="28" rx="5" fill="url(#paint0_linear_11520_46350)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.15784 13.9998C5.15784 18.8832 9.11658 22.8419 13.9999 22.8419C18.8833 22.8419 22.842 18.8832 22.842 13.9998C22.842 9.11646 18.8833 5.15771 13.9999 5.15771C9.11658 5.15771 5.15784 9.11646 5.15784 13.9998ZM21.7368 13.9998C21.7368 18.2728 18.2729 21.7367 13.9999 21.7367C9.727 21.7367 6.2631 18.2728 6.2631 13.9998C6.2631 9.72688 9.727 6.26298 13.9999 6.26298C18.2729 6.26298 21.7368 9.72688 21.7368 13.9998Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.36841 13.9998C7.36841 18.8832 10.3375 22.8419 14 22.8419C17.6625 22.8419 20.6316 18.8832 20.6316 13.9998C20.6316 9.11646 17.6625 5.15771 14 5.15771C10.3375 5.15771 7.36841 9.11646 7.36841 13.9998ZM19.5263 13.9998C19.5263 18.3306 16.9717 21.7367 14 21.7367C11.0283 21.7367 8.47367 18.3306 8.47367 13.9998C8.47367 9.66909 11.0283 6.26298 14 6.26298C16.9717 6.26298 19.5263 9.66909 19.5263 13.9998Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.6842 13.9998C10.6842 18.8832 12.1687 22.8419 14 22.8419C15.8313 22.8419 17.3158 18.8832 17.3158 13.9998C17.3158 9.11646 15.8313 5.15771 14 5.15771C12.1687 5.15771 10.6842 9.11646 10.6842 13.9998ZM16.2105 13.9998C16.2105 18.3089 14.9251 21.7367 14 21.7367C13.0749 21.7367 11.7895 18.3089 11.7895 13.9998C11.7895 9.69071 13.0749 6.26298 14 6.26298C14.9251 6.26298 16.2105 9.69071 16.2105 13.9998Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.9999 10.6841C9.11657 10.6841 5.15783 12.1686 5.15783 13.9999C5.15783 15.8311 9.11657 17.3157 13.9999 17.3157C18.8833 17.3157 22.842 15.8311 22.842 13.9999C22.842 12.1686 18.8833 10.6841 13.9999 10.6841ZM13.9999 16.2104C9.69082 16.2104 6.26309 14.925 6.26309 13.9999C6.26309 13.0747 9.69082 11.7893 13.9999 11.7893C18.309 11.7893 21.7368 13.0747 21.7368 13.9999C21.7368 14.925 18.309 16.2104 13.9999 16.2104Z" fill="white"/>
</g>
<defs>
<linearGradient id="paint0_linear_11520_46350" x1="5.89474" y1="-6.53009e-08" x2="14" y2="28" gradientUnits="userSpaceOnUse">
<stop stop-color="#4BA3FF"/>
<stop offset="1" stop-color="#2576EF"/>
</linearGradient>
<clipPath id="clip0_11520_46350">
<rect width="28" height="28" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

3
designer-base/src/main/resources/com/fine/theme/icon/startup/show_less.svg

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15 13L10 7L5 13" stroke="#419BF9" stroke-width="1.5" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 191 B

3
designer-base/src/main/resources/com/fine/theme/icon/startup/show_more.svg

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5 7L10 13L15 7" stroke="#419BF9" stroke-width="1.5" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 190 B

10
designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json

@ -18,6 +18,7 @@
"remove": "remove.svg", "remove": "remove.svg",
"search": "search.svg", "search": "search.svg",
"add": "add.svg", "add": "add.svg",
"add_hover": "add_hover.svg",
"detail": "detail.svg", "detail": "detail.svg",
"dataLink": "dataLink.svg", "dataLink": "dataLink.svg",
"jumpHelp": "jumpHelp.svg", "jumpHelp": "jumpHelp.svg",
@ -78,6 +79,7 @@
"excelFile": "filetree/filetype/excelFile.svg", "excelFile": "filetree/filetype/excelFile.svg",
"flashFile": "filetree/filetype/flashFile.svg", "flashFile": "filetree/filetype/flashFile.svg",
"frm_locked": "filetree/filetype/frm_locked.svg", "frm_locked": "filetree/filetype/frm_locked.svg",
"fvs_locked": "filetree/filetype/fvs_locked.svg",
"gifFile": "filetree/filetype/gifFile.svg", "gifFile": "filetree/filetype/gifFile.svg",
"htmlFile": "filetree/filetype/htmlFile.svg", "htmlFile": "filetree/filetype/htmlFile.svg",
"jarFile": "filetree/filetype/jarFile.svg", "jarFile": "filetree/filetype/jarFile.svg",
@ -341,6 +343,12 @@
"data_analysis": "preview/data_analysis.svg", "data_analysis": "preview/data_analysis.svg",
"variable": "variable/variable.svg", "variable": "variable/variable.svg",
"dataItem": "variable/dataItem.svg", "dataItem": "variable/dataItem.svg",
"param_global": "variable/param_global.svg" "param_global": "variable/param_global.svg",
"local_server_background": "startup/local_server_background.svg",
"remote_server_background": "startup/remote_server_background.svg",
"more_arrow": "startup/more.svg",
"more_arrow_hover": "startup/more_hover.svg",
"show_less": "startup/show_less.svg",
"show_more": "startup/show_more.svg"
} }
} }

20
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

@ -142,6 +142,7 @@ border.divider=#DADEE7
tooltip.normal=#3F506A tooltip.normal=#3F506A
tooltip.disabled=#A3ADBD tooltip.disabled=#A3ADBD
hover.deep=#e2fbe6 hover.deep=#e2fbe6
fill.deep=#F6F9FE
#---- Button ---- #---- Button ----
@ -583,14 +584,14 @@ PopupMenuSeparator.Insets=0,10,0,10
#---- ProgressBar ---- #---- ProgressBar ----
ProgressBar.border = com.formdev.flatlaf.ui.FlatEmptyBorder ProgressBar.border = com.formdev.flatlaf.ui.FlatEmptyBorder
ProgressBar.arc = 4 ProgressBar.arc = 10
ProgressBar.horizontalSize = 146,4 ProgressBar.horizontalSize = 146,4
ProgressBar.verticalSize = 4,146 ProgressBar.verticalSize = 4,146
ProgressBar.cycleTime = 4000 ProgressBar.cycleTime = 4000
ProgressBar.repaintInterval = 15 ProgressBar.repaintInterval = 15
ProgressBar.font = -2 ProgressBar.font = -2
ProgressBar.background = darken(@background,13%) ProgressBar.background = #E8E8E9
ProgressBar.foreground = @accentSliderColor ProgressBar.foreground = #419BF9
ProgressBar.selectionBackground = @foreground ProgressBar.selectionBackground = @foreground
ProgressBar.selectionForeground = contrast($ProgressBar.foreground, @foreground, @componentBackground) ProgressBar.selectionForeground = contrast($ProgressBar.foreground, @foreground, @componentBackground)
@ -658,7 +659,7 @@ ScrollBar.allowsAbsolutePositioning = true
ScrollBar.track = #00000000 ScrollBar.track = #00000000
ScrollBar.thumb = #0a1c3833 ScrollBar.thumb = #0a1c3833
ScrollBar.hoverTrackColor = darken($ScrollBar.track,3%,derived noAutoInverse) ScrollBar.hoverTrackColor = fade(@background, 0%)
ScrollBar.hoverThumbColor = darken($ScrollBar.thumb,10%,derived noAutoInverse) ScrollBar.hoverThumbColor = darken($ScrollBar.thumb,10%,derived noAutoInverse)
ScrollBar.pressedThumbColor = #0a1c3849 ScrollBar.pressedThumbColor = #0a1c3849
ScrollBar.hoverButtonBackground = darken(@background,5%,derived noAutoInverse) ScrollBar.hoverButtonBackground = darken(@background,5%,derived noAutoInverse)
@ -671,7 +672,7 @@ ScrollBar.largeBar.thumbInsets = 0,4,0,4
ScrollBar.largeBar.buttonBackground = $ScrollBar.track ScrollBar.largeBar.buttonBackground = $ScrollBar.track
#---- Panel ---- #---- Panel ----
Panel.arc = 5 Panel.arc = 20
#---- ScrollPane ---- #---- ScrollPane ----
@ -1294,6 +1295,10 @@ CellOtherSetPane.height=$Component.defaultHeight
background: fade(@background, 0%); \ background: fade(@background, 0%); \
borderInsets: 0,0,0,0; borderInsets: 0,0,0,0;
[style]Panel.transparentBackground=\
background: fade(@background, 0%); \
border: null;
#---- clearButton ---- #---- clearButton ----
# for clear/cancel button in text fields # for clear/cancel button in text fields
@ -1333,3 +1338,8 @@ CellOtherSetPane.height=$Component.defaultHeight
[style]Tree.pureTree = \ [style]Tree.pureTree = \
background: $fill.normal background: $fill.normal
[style]ScrollBar.transparentBackground = \
background: null;\
track: fade(@background, 0%); \
hoverTrackColor : fade(@background, 0%)

1
designer-form/src/main/java/com/fr/design/mainframe/share/ui/base/DownloadProgressPane.java

@ -79,7 +79,6 @@ public class DownloadProgressPane extends JPanel {
private JProgressBar createProgressBar() { private JProgressBar createProgressBar() {
JProgressBar jProgressBar = new JProgressBar(); JProgressBar jProgressBar = new JProgressBar();
jProgressBar.setUI(new ModernUIProgressBarUI());
jProgressBar.setBorderPainted(false); jProgressBar.setBorderPainted(false);
jProgressBar.setOpaque(false); jProgressBar.setOpaque(false);
jProgressBar.setBorder(null); jProgressBar.setBorder(null);

Loading…
Cancel
Save