Browse Source

Pull request #9814: REPORT-78498 && REPORT-78365

Merge in DESIGN/design from ~HARRISON/design:feature/x to feature/x

* commit '70e025d348675244813248c47db0d6ba43ef9f91':
  无 JIRA 任务,添加注释
  REPORT-76061【迭代】【起始页】起始页已打开,系统文件夹直接打开模板 1-支持mac 2-修复 path 路径的传递问题
  REPORT-78365【迭代】【起始页】不打开任何报表,普通报表聚合报表都新建失败 修复 npe
  REPORT-78498【起始页】视觉问题 处理视觉问题
feature/x
Harrison 2 years ago
parent
commit
063c0cdeb2
  1. 4
      designer-base/src/main/java/com/fr/design/components/tooltip/ModernToolTip.java
  2. 15
      designer-base/src/main/java/com/fr/design/deeplink/DeepLinkCore.java
  3. 5
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  4. 8
      designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java
  5. 32
      designer-base/src/main/java/com/fr/design/utils/ColorUtils.java
  6. 13
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  7. 14
      designer-base/src/main/java/com/fr/start/common/DesignerStartupContext.java
  8. 3
      designer-base/src/main/java/com/fr/start/common/DesignerStartupUtil.java
  9. 12
      designer-base/src/main/java/com/fr/startup/ui/StartupPageConstants.java
  10. 15
      designer-base/src/main/java/com/fr/startup/ui/StartupPageUtil.java
  11. 22
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java
  12. 79
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java
  13. BIN
      designer-base/src/main/resources/com/fr/design/startup/startup_page_background.jpg
  14. 2
      designer-realize/src/main/java/com/fr/start/MainDesigner.java

4
designer-base/src/main/java/com/fr/design/components/tooltip/ModernToolTip.java

@ -12,11 +12,9 @@ import javax.swing.plaf.ToolTipUI;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.awt.GradientPaint;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.geom.GeneralPath;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
@ -52,7 +50,7 @@ public class ModernToolTip extends UIToolTip {
Graphics2D g2 = (Graphics2D) g; Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setColor(new Color(51, 51, 52, (int) Math.round(0.7 * 255))); g2.setColor(new Color(51, 51, 52, (int) Math.round(0.7 * 255)));
g2.fillRoundRect(0, 0, width, height, 0, 0); g2.fillRoundRect(0, 0, width, height, 4, 4);
g2.setColor(Color.WHITE); g2.setColor(Color.WHITE);
if (strs != null) { if (strs != null) {

15
designer-base/src/main/java/com/fr/design/deeplink/DeepLinkCore.java

@ -10,6 +10,7 @@ import com.fr.event.Null;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import com.fr.start.common.DesignerStartupContext;
import com.fr.third.org.apache.http.NameValuePair; import com.fr.third.org.apache.http.NameValuePair;
import com.fr.web.URLUtils; import com.fr.web.URLUtils;
@ -131,7 +132,19 @@ public class DeepLinkCore {
} }
private boolean canConsumePendingURL() { private boolean canConsumePendingURL() {
return StringUtils.isNotEmpty(this.pendingURL) && isDesignerStartupCompleted; return StringUtils.isNotEmpty(this.pendingURL) && isAvailableConsumingTime();
}
/**
* 是否是可用的消耗时机
* 满足任一即可
* 1-设计器已经启动
* 2-出在设计器启动页页面
*
* @return /
*/
private boolean isAvailableConsumingTime() {
return isDesignerStartupCompleted || DesignerStartupContext.getInstance().isOnWaiting();
} }
private void consumePendingURL() { private void consumePendingURL() {

5
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -99,6 +99,11 @@ public class HistoryTemplateListCache implements CallbackEvent {
} }
/**
* 需要使用 {@link JTemplate#isValid(JTemplate)} 来判断空
*
* @return 当前正在编辑的模板
*/
@Nullable @Nullable
public JTemplate<?, ?> getCurrentEditingTemplate() { public JTemplate<?, ?> getCurrentEditingTemplate() {
return this.editingTemplate; return this.editingTemplate;

8
designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java

@ -156,7 +156,7 @@ public class CenterRegionContainerPane extends JPanel {
private void addExtraButtons() { private void addExtraButtons() {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt == null) { if (!JTemplate.isValid(jt)) {
return; return;
} }
@ -172,7 +172,7 @@ public class CenterRegionContainerPane extends JPanel {
private void addCheckButton() { private void addCheckButton() {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt == null) { if (!JTemplate.isValid(jt)) {
return; return;
} }
combineUp.addSeparator(new Dimension(2, 16)); combineUp.addSeparator(new Dimension(2, 16));
@ -185,7 +185,7 @@ public class CenterRegionContainerPane extends JPanel {
private void addShareButton() { private void addShareButton() {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt == null) { if (!JTemplate.isValid(jt)) {
return; return;
} }
@ -205,7 +205,7 @@ public class CenterRegionContainerPane extends JPanel {
protected void checkCombineUp(boolean flag, ArrayList<String> al) { protected void checkCombineUp(boolean flag, ArrayList<String> al) {
//Yvan: 检查当前是否为WORK_SHEET状态,因为只有WORK_SHEET中含有格式刷组件,此时是不需要进行checkComponentsByNames的 //Yvan: 检查当前是否为WORK_SHEET状态,因为只有WORK_SHEET中含有格式刷组件,此时是不需要进行checkComponentsByNames的
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate != null) { if (JTemplate.isValid(jTemplate)) {
// 第一个条件满足后还需要添加一重判断,判断是编辑报表块还是参数面板,编辑报表块时则直接return // 第一个条件满足后还需要添加一重判断,判断是编辑报表块还是参数面板,编辑报表块时则直接return
if (jTemplate.getMenuState() == DesignState.WORK_SHEET && !jTemplate.isUpMode()) { if (jTemplate.getMenuState() == DesignState.WORK_SHEET && !jTemplate.isUpMode()) {
return; return;

32
designer-base/src/main/java/com/fr/design/utils/ColorUtils.java

@ -28,6 +28,38 @@ public class ColorUtils {
} }
} }
/**
* 递归的同步颜色如何组件的背景颜色等于默认颜色的话变更为 replaceColor
*
* @param component 组件
* @param replaceColor 替换颜色
* @param defaultColor 默认颜色
*/
public static void syncBackgroundIfAbsent(Component component, Color replaceColor, Color defaultColor) {
if (component.getBackground() != defaultColor) {
return;
}
component.setBackground(replaceColor);
if (component instanceof Container) {
Container container = (Container) component;
Component[] components = container.getComponents();
if (components != null) {
Arrays.stream(components).forEach((e) -> syncBackgroundIfAbsent(e, replaceColor, defaultColor));
}
}
}
/**
* 使背景透明
*
* @param component 组件
*/
public static void transparentBackground(Component component) {
syncBackgroundIfAbsent(component, new Color(0,0,0,0), ThemeUtils.BACK_COLOR);
}
public static boolean isDarkColor(Color color) { public static boolean isDarkColor(Color color) {
if(color == null) { if(color == null) {
return false; return false;

13
designer-base/src/main/java/com/fr/start/BaseDesigner.java

@ -35,6 +35,7 @@ import com.fr.start.common.DesignerStartupContext;
import com.fr.start.common.DesignerStartupUtil; import com.fr.start.common.DesignerStartupUtil;
import com.fr.start.event.LazyStartupEvent; import com.fr.start.event.LazyStartupEvent;
import com.fr.workspace.base.WorkspaceStatus; import com.fr.workspace.base.WorkspaceStatus;
import org.jetbrains.annotations.Nullable;
import java.awt.Window; import java.awt.Window;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -126,7 +127,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
if (args != null && args.length > 0) { if (args != null && args.length > 0) {
file = DesignerStartupUtil.convertArgs2FILE(args); file = DesignerStartupUtil.convertArgs2FILE(args);
} else { } else {
file = FILEFactory.createFILE(FILEFactory.ENV_PREFIX + DesignerEnvManager.getEnvManager().getLastOpenFile()); file = getLastOpenFile();
} }
DesignerFrame df = DesignerContext.getDesignerFrame(); DesignerFrame df = DesignerContext.getDesignerFrame();
isException = openFile(df, isException, file); isException = openFile(df, isException, file);
@ -142,6 +143,16 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
} }
} }
@Nullable
private FILE getLastOpenFile() {
FILE file = DesignerStartupContext.getInstance().getStartingTemplateFile();
if (file == null) {
file = FILEFactory.createFILE(FILEFactory.ENV_PREFIX + DesignerEnvManager.getEnvManager().getLastOpenFile());
}
return file;
}
private boolean openFile(final DesignerFrame df, boolean isException, FILE file) { private boolean openFile(final DesignerFrame df, boolean isException, FILE file) {
AtomicBoolean isExWrapper = new AtomicBoolean(isException); AtomicBoolean isExWrapper = new AtomicBoolean(isException);

14
designer-base/src/main/java/com/fr/start/common/DesignerStartupContext.java

@ -3,6 +3,7 @@ package com.fr.start.common;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.DesignerWorkspaceType;
import com.fr.file.FileFILE;
import com.fr.start.module.StartupArgs; import com.fr.start.module.StartupArgs;
import com.fr.startup.metric.DesignerMetrics; import com.fr.startup.metric.DesignerMetrics;
import com.fr.startup.ui.StartupPageModel; import com.fr.startup.ui.StartupPageModel;
@ -64,6 +65,11 @@ public class DesignerStartupContext {
*/ */
private boolean createNew; private boolean createNew;
/**
* 启动的模板
*/
private FileFILE startingTemplateFile;
/** /**
* 时间记录 * 时间记录
*/ */
@ -87,6 +93,14 @@ public class DesignerStartupContext {
/* 启动模式 */ /* 启动模式 */
public FileFILE getStartingTemplateFile() {
return startingTemplateFile;
}
public void setStartingTemplateFile(FileFILE startingTemplateFile) {
this.startingTemplateFile = startingTemplateFile;
}
/** /**
* 展示启动页 * 展示启动页
* 1. 判断当前的工作目录数量 * 1. 判断当前的工作目录数量

3
designer-base/src/main/java/com/fr/start/common/DesignerStartupUtil.java

@ -30,8 +30,7 @@ public class DesignerStartupUtil {
if (context.isOnWaiting()) { if (context.isOnWaiting()) {
FileFILE fileFILE = new FileFILE(file); FileFILE fileFILE = new FileFILE(file);
// 设置上一次启动模板为当前模板 // 设置上一次启动模板为当前模板
// 注意这里需要设置为 envFullName DesignerStartupContext.getInstance().setStartingTemplateFile(fileFILE);
DesignerEnvManager.getEnvManager().setLastOpenFile(fileFILE.getEnvFullName());
StartupPageModel model = context.getStartupPageModel(); StartupPageModel model = context.getStartupPageModel();
Optional.ofNullable(model) Optional.ofNullable(model)
.ifPresent((e) -> { .ifPresent((e) -> {

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

@ -1,5 +1,7 @@
package com.fr.startup.ui; package com.fr.startup.ui;
import java.awt.Color;
/** /**
* created by Harrison on 2022/07/07 * created by Harrison on 2022/07/07
**/ **/
@ -14,4 +16,14 @@ public class StartupPageConstants {
* 内容宽度 * 内容宽度
*/ */
public static final int CONTENT_WIDTH = 850; public static final int CONTENT_WIDTH = 850;
/**
* 边框的颜色
*/
public static final Color BORDER_COLOR = Color.WHITE;
/**
* 透明的颜色
*/
public static final Color TRANSPARENT_COLOR = new Color(0, 0, 0, 0);
} }

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

@ -6,6 +6,8 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JRootPane;
import java.net.URL; import java.net.URL;
/** /**
@ -68,4 +70,17 @@ public class StartupPageUtil {
return urlStr; return urlStr;
} }
} }
/**
* 透明的背景需要从根节点重绘
*
* @param component 组件
*/
public static void repaintAll(JComponent component) {
JRootPane rootPane = component.getRootPane();
if (rootPane != null) {
rootPane.repaint();
}
}
} }

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

@ -11,8 +11,10 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout; 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.ThemeUtils;
import com.fr.exit.DesignerExiter; import com.fr.exit.DesignerExiter;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.collections.CollectionUtils; import com.fr.stable.collections.CollectionUtils;
@ -43,6 +45,7 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -95,6 +98,7 @@ public class StartupPageWindow extends JFrame {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
this.body = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.body = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.body.setBackground(new Color(0, 0, 0, 0));
// 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(); Font font = label.getFont();
@ -104,6 +108,7 @@ public class StartupPageWindow extends JFrame {
LayoutManager centerFlowLayout = FRGUIPaneFactory.createCenterFlowLayout(); LayoutManager centerFlowLayout = FRGUIPaneFactory.createCenterFlowLayout();
headerPanel.setLayout(centerFlowLayout); headerPanel.setLayout(centerFlowLayout);
headerPanel.add(label); headerPanel.add(label);
headerPanel.setBackground(new Color(0, 0, 0, 0));
this.body.add(headerPanel, BorderLayout.NORTH); this.body.add(headerPanel, BorderLayout.NORTH);
// Workspace-description // Workspace-description
@ -125,7 +130,14 @@ public class StartupPageWindow extends JFrame {
this.recentOpenPanel = generateRecentOpenPanel(pageModel); this.recentOpenPanel = generateRecentOpenPanel(pageModel);
this.body.add(recentOpenPanel, BorderLayout.SOUTH); this.body.add(recentOpenPanel, BorderLayout.SOUTH);
this.contentPane = new JPanel(); this.contentPane = new JPanel() {
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
BufferedImage image = IOUtils.readImage("com/fr/design/startup/startup_page_background.jpg");
g.drawImage(image, 0, 0, SCREEN_SIZE.width, SCREEN_SIZE.height, this);
}
};
this.contentPane.setLayout(getCenterLayout(body)); this.contentPane.setLayout(getCenterLayout(body));
this.contentPane.add(this.body, BorderLayout.CENTER); this.contentPane.add(this.body, BorderLayout.CENTER);
this.contentPane.setPreferredSize(this.body.getPreferredSize()); this.contentPane.setPreferredSize(this.body.getPreferredSize());
@ -302,6 +314,7 @@ public class StartupPageWindow extends JFrame {
recentOpenWrapperPanel.setBorder(new EmptyBorder(0, 0, 0, 20)); 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);
return recentOpenWrapperPanel; return recentOpenWrapperPanel;
} }
@ -330,11 +343,13 @@ public class StartupPageWindow extends JFrame {
@Override @Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
recentFileLabel.setForeground(HOVER_COLOR); recentFileLabel.setForeground(HOVER_COLOR);
StartupPageUtil.repaintAll(recentOpenGroupPanel);
} }
@Override @Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
recentFileLabel.setForeground(recentFileLabelForeground); recentFileLabel.setForeground(recentFileLabelForeground);
StartupPageUtil.repaintAll(recentOpenGroupPanel);
} }
@Override @Override
@ -363,7 +378,9 @@ public class StartupPageWindow extends JFrame {
private StartupPageWorkspacePanel generateWorkspacePanel(StartupPageModel pageModel) { private StartupPageWorkspacePanel generateWorkspacePanel(StartupPageModel pageModel) {
return new StartupPageWorkspacePanel(pageModel); StartupPageWorkspacePanel startupPageWorkspacePanel = 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) {
@ -376,4 +393,5 @@ public class StartupPageWindow extends JFrame {
DesignerEnvManager.getEnvManager().setLastOpenFile(recentFile); DesignerEnvManager.getEnvManager().setLastOpenFile(recentFile);
pageModel.getOpenLastTemplateRunnable().run(); pageModel.getOpenLastTemplateRunnable().run();
} }
} }

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

@ -89,6 +89,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, 0));
this.setBorder(new EmptyBorder(15, 0, 20, 0));
this.pageModel = pageModel; this.pageModel = pageModel;
@ -129,10 +130,10 @@ public class StartupPageWorkspacePanel extends JPanel {
JPanel workspaceDescWrapper = new JPanel(); JPanel workspaceDescWrapper = new JPanel();
workspaceDescWrapper.setLayout(new BorderLayout(0, 0)); workspaceDescWrapper.setLayout(new BorderLayout(0, 0));
workspaceDescWrapper.setBorder(new EmptyBorder(20, 0, 0, 0)); workspaceDescWrapper.setBorder(new EmptyBorder(0, 0, 0, 0));
JPanel workspaceDescPanel = new JPanel(); JPanel workspaceDescPanel = new JPanel();
workspaceDescPanel.setLayout(new GridLayout(partitions.size(), 1, 0, ITEM_VERTICAL_GAP)); workspaceDescPanel.setLayout(new GridLayout(partitions.size(), 1, 0, 0));
for (List<StartupWorkspaceBean> partition : partitions) { for (List<StartupWorkspaceBean> partition : partitions) {
JPanel partitionPanel = generatePartitionPanel(partition); JPanel partitionPanel = generatePartitionPanel(partition);
workspaceDescPanel.add(partitionPanel); workspaceDescPanel.add(partitionPanel);
@ -144,15 +145,17 @@ public class StartupPageWorkspacePanel extends JPanel {
scrollPane.setBorder(new EmptyBorder(10, 0, 0, 0)); scrollPane.setBorder(new EmptyBorder(10, 0, 0, 0));
scrollPane.setPreferredSize(new Dimension(CONTENT_WIDTH, SCROLL_HEIGHT)); scrollPane.setPreferredSize(new Dimension(CONTENT_WIDTH, SCROLL_HEIGHT));
workspaceDescWrapper.add(scrollPane, BorderLayout.CENTER); workspaceDescWrapper.add(scrollPane, BorderLayout.CENTER);
return scrollPane; return workspaceDescWrapper;
} }
workspaceDescWrapper.add(workspaceDescPanel, BorderLayout.CENTER); workspaceDescWrapper.add(workspaceDescPanel, BorderLayout.CENTER);
ColorUtils.transparentBackground(workspaceDescWrapper);
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, ITEM_VERTICAL_GAP); JPanel workspaceDescPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEFT, 0, 0);
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) {
@ -163,22 +166,38 @@ public class StartupPageWorkspacePanel extends JPanel {
JPanel partitionPanel = generatePartitionPanel(partition); JPanel partitionPanel = generatePartitionPanel(partition);
workspaceDescPanel.add(partitionPanel); workspaceDescPanel.add(partitionPanel);
} }
ColorUtils.transparentBackground(workspaceDescPanel);
return workspaceDescPanel; return workspaceDescPanel;
} }
@NotNull @NotNull
private JPanel generateTailPanel() { private JPanel generateTailPanel() {
AtomicReference<Color> hoverBackColorRef = new AtomicReference<>();
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)); tailPanel.setBorder(new EmptyBorder(0, 0, 0, 20));
JPanel showAllPanel = new JPanel(); JPanel showAllPanel = new JPanel() {
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (hoverBackColorRef.get() != null) {
g.setColor(hoverBackColorRef.get());
Dimension preferredSize = getPreferredSize();
g.fillRoundRect(0, 0, preferredSize.width, preferredSize.height, 5, 5);
}
}
};
showAllPanel.setLayout(new BorderLayout(5, 0)); showAllPanel.setLayout(new BorderLayout(5, 0));
showAllPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); 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(HOVER_COLOR);
showAllPanel.setBackground(new Color(0, 0, 0, 0));
showAllPanel.add(fontLabel, BorderLayout.WEST); showAllPanel.add(fontLabel, BorderLayout.WEST);
UILabel iconLabel = new UILabel(IconUtils.readIcon("/com/fr/design/startup/show_more.svg")); UILabel iconLabel = new UILabel(IconUtils.readIcon("/com/fr/design/startup/show_more.svg"));
@ -189,13 +208,16 @@ public class StartupPageWorkspacePanel extends JPanel {
showAllPanel.addMouseListener(new MouseAdapter() { showAllPanel.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
Color hoverColor = new Color(217, 235, 254); Color hoverBackColor = new Color(217, 235, 254);
showAllPanel.setBackground(hoverColor); hoverBackColorRef.set(hoverBackColor);
repaintAll();
} }
@Override @Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
hoverBackColorRef.set(null);
ColorUtils.syncBackground(showAllPanel, showAllBackground); ColorUtils.syncBackground(showAllPanel, showAllBackground);
repaintAll();
} }
@Override @Override
@ -213,7 +235,11 @@ public class StartupPageWorkspacePanel extends JPanel {
@NotNull @NotNull
private JPanel generatePartitionPanel(List<StartupWorkspaceBean> partition) { private JPanel generatePartitionPanel(List<StartupWorkspaceBean> partition) {
JPanel partitionPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(0, 20, 0);; JPanel partitionPanelWrapper = new JPanel();
partitionPanelWrapper.setBorder(new EmptyBorder(10,0,10,0));
partitionPanelWrapper.setLayout(new BorderLayout());
JPanel partitionPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(0, 20, 0);
partitionPanel.setName("partitionPanel"); partitionPanel.setName("partitionPanel");
for (StartupWorkspaceBean workspaceInfo : partition) { for (StartupWorkspaceBean workspaceInfo : partition) {
@ -229,7 +255,9 @@ public class StartupPageWorkspacePanel extends JPanel {
Dimension preferredSize = partitionPanel.getPreferredSize(); Dimension preferredSize = partitionPanel.getPreferredSize();
partitionPanel.setPreferredSize(new Dimension(CONTENT_WIDTH, (int) preferredSize.getHeight())); partitionPanel.setPreferredSize(new Dimension(CONTENT_WIDTH, (int) preferredSize.getHeight()));
} }
return partitionPanel;
partitionPanelWrapper.add(partitionPanel, BorderLayout.CENTER);
return partitionPanelWrapper;
} }
private void layoutSelectWorkspacePanel(StartupWorkspaceBean workspaceInfo, JPanel workspaceItemDesc) { private void layoutSelectWorkspacePanel(StartupWorkspaceBean workspaceInfo, JPanel workspaceItemDesc) {
@ -294,8 +322,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 * 2; int fixRoundHeight = getHeight() - BORDER_THIN;
g2d.drawRoundRect(BORDER_THIN, BORDER_THIN, fixRoundWidth, fixRoundHeight, ARC_DIAMETER, ARC_DIAMETER); g2d.drawRoundRect(strokeOffset, strokeOffset, fixRoundWidth, fixRoundHeight, ARC_DIAMETER, ARC_DIAMETER);
g2d.setColor(backColor); g2d.setColor(backColor);
@ -309,9 +337,9 @@ public class StartupPageWorkspacePanel extends JPanel {
g2d.fillRect(fixedX, BORDER_THIN, coverWidth, coverHeight); g2d.fillRect(fixedX, BORDER_THIN, coverWidth, coverHeight);
g2d.setColor(borderColor); g2d.setColor(borderColor);
g2d.drawLine(getWidth() / 2, BORDER_THIN, getWidth(), BORDER_THIN); g2d.drawLine(getWidth() / 2, strokeOffset, getWidth(), strokeOffset);
g2d.drawLine(getWidth() / 2, getHeight() - BORDER_THIN, getWidth(), getHeight() - BORDER_THIN); g2d.drawLine(getWidth() / 2, getHeight() - strokeOffset, getWidth(), getHeight() - strokeOffset);
g2d.drawLine(getWidth() - strokeOffset, BORDER_THIN, getWidth() - strokeOffset, getHeight() - BORDER_THIN); g2d.drawLine(getWidth() - strokeOffset, strokeOffset, getWidth() - strokeOffset, getHeight() - strokeOffset);
} }
} }
}; };
@ -362,7 +390,7 @@ public class StartupPageWorkspacePanel extends JPanel {
borderColorRef.set(hoverColor); borderColorRef.set(hoverColor);
nameLabel.setForeground(hoverColor); nameLabel.setForeground(hoverColor);
pathLabel.setForeground(hoverColor ); pathLabel.setForeground(hoverColor );
selectWorkspacePanel.getParent().repaint(); repaintAll();
} }
@Override @Override
@ -370,7 +398,7 @@ public class StartupPageWorkspacePanel extends JPanel {
borderColorRef.set(Color.WHITE); borderColorRef.set(Color.WHITE);
nameLabel.setForeground(nameForeground); nameLabel.setForeground(nameForeground);
pathLabel.setForeground(pathColor); pathLabel.setForeground(pathColor);
selectWorkspacePanel.getParent().repaint(); repaintAll();
} }
@Override @Override
@ -455,16 +483,15 @@ public class StartupPageWorkspacePanel extends JPanel {
int borderOffset = BORDER_THIN * 2; int borderOffset = BORDER_THIN * 2;
// 画画的笔触需要调整一下 // 画画的笔触需要调整一下
//g2d.drawRoundRect(strokeOffset, strokeOffset, getWidth() - rectOffset, getHeight() - BORDER_THIN, 0, 0); g2d.drawRoundRect(strokeOffset, strokeOffset, getWidth() - borderOffset, 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 = 15; int fillWidth = 15;
g2d.fillRect(0, 0, fillWidth, getHeight()); g2d.fillRect(0, 0, fillWidth, getHeight());
g2d.setColor(borderColor); g2d.setColor(borderColor);
g2d.drawLine(BORDER_THIN, BORDER_THIN, fillWidth, BORDER_THIN); g2d.drawLine(strokeOffset, strokeOffset, fillWidth, strokeOffset);
g2d.drawLine(BORDER_THIN, getHeight() - BORDER_THIN, fillWidth, getHeight() - BORDER_THIN); g2d.drawLine(strokeOffset, getHeight() - strokeOffset, fillWidth, getHeight() - strokeOffset);
g2d.drawLine(BORDER_THIN, BORDER_THIN, BORDER_THIN, getHeight() - BORDER_THIN); g2d.drawLine(strokeOffset, strokeOffset, strokeOffset, getHeight() - strokeOffset);
} }
} }
@ -481,15 +508,15 @@ public class StartupPageWorkspacePanel extends JPanel {
@Override @Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
borderColorRef.set(HOVER_COLOR); borderColorRef.set(HOVER_COLOR);
selectAndCreatePanel.getParent().repaint();
label.setIcon(IconUtils.readIcon("/com/fr/design/standard/system/add_hover.svg")); label.setIcon(IconUtils.readIcon("/com/fr/design/standard/system/add_hover.svg"));
repaintAll();
} }
@Override @Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
borderColorRef.set(null); borderColorRef.set(null);
selectAndCreatePanel.getParent().repaint();
label.setIcon(IconUtils.readIcon("/com/fr/design/standard/system/add.svg")); label.setIcon(IconUtils.readIcon("/com/fr/design/standard/system/add.svg"));
repaintAll();
} }
@Override @Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
@ -533,5 +560,11 @@ public class StartupPageWorkspacePanel extends JPanel {
showLessContent(); showLessContent();
showMore = !showMore; showMore = !showMore;
} }
repaintAll();
}
private void repaintAll() {
this.getRootPane().repaint();
} }
} }

BIN
designer-base/src/main/resources/com/fr/design/startup/startup_page_background.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

2
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -408,7 +408,7 @@ public class MainDesigner extends BaseDesigner {
@Override @Override
protected void refreshLargeToolbarState() { protected void refreshLargeToolbarState() {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt == null) { if (!JTemplate.isValid(jt)) {
return; return;
} }
saveButton.setEnabled(!jt.isSaved() && !DesignModeContext.isVcsMode() && jt.checkEnable()); saveButton.setEnabled(!jt.isSaved() && !DesignModeContext.isVcsMode() && jt.checkEnable());

Loading…
Cancel
Save