Browse Source

REPORT-134498 修复启动页的环境卡片边框问题

fbp/release
vito 3 months ago
parent
commit
f9b348b851
  1. 47
      designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java
  2. 117
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  3. 20
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java
  4. 8
      designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonStoryBoard.java
  5. 3
      designer-realize/src/main/java/com/fr/start/CarinaDesigner.java

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

@ -44,6 +44,9 @@ import static com.formdev.flatlaf.util.UIScale.scale;
*/ */
public class FineUIUtils { public class FineUIUtils {
public static final String LEFT = "LEFT";
public static final String RIGHT = "RIGHT";
public static final int RETINA_SCALE_FACTOR = 2; public static final int RETINA_SCALE_FACTOR = 2;
/** /**
@ -212,17 +215,48 @@ public class FineUIUtils {
*/ */
public static void paintPartRoundButtonBorder(Component c, Graphics2D g2, int x, int y, int width, int height, public static void paintPartRoundButtonBorder(Component c, Graphics2D g2, int x, int y, int width, int height,
float borderWidth, float arc) { float borderWidth, float arc) {
if (isLeftRoundButton(c)) {
paintPartRoundButtonBorder(g2, x, y, width, height, borderWidth, arc, LEFT, false);
} else {
paintPartRoundButtonBorder(g2, x, y, width, height, borderWidth, arc, RIGHT, false);
}
}
/**
* 绘制部分圆角矩形边框
*
* @param g2 Graphics2D
* @param x x坐标
* @param y y坐标
* @param width 宽度
* @param height 高度
* @param borderWidth 边框宽度
* @param arc 圆角
* @param roundPart 圆角的方位当前只能设置一侧
* @param closedPath 是否封闭非圆角那一侧是否有边框是为有边框
*/
public static void paintPartRoundButtonBorder(Graphics2D g2, int x, int y, int width, int height,
float borderWidth, float arc, String roundPart, boolean closedPath) {
FlatUIUtils.setRenderingHints(g2); FlatUIUtils.setRenderingHints(g2);
arc = scale(arc); arc = scale(arc);
float t = scale(borderWidth); float t = scale(borderWidth);
float t2x = t * 2; float t2x = t * 2;
Path2D path2D = new Path2D.Float(Path2D.WIND_EVEN_ODD); Path2D path2D = new Path2D.Float(Path2D.WIND_EVEN_ODD);
if (isLeftRoundButton(c)) { switch (roundPart) {
path2D.append(createLeftRoundRectangle(x, y, width, height, arc), false);
path2D.append(createLeftRoundRectangle(x + t, y + t, width - t, height - t2x, arc - t), false); case LEFT: {
} else { path2D.append(createLeftRoundRectangle(x, y, width, height, arc), false);
path2D.append(createRightRoundRectangle(x, y, width, height, arc), false); path2D.append(createLeftRoundRectangle(x + t, y + t,
path2D.append(createRightRoundRectangle(x, y + t, width - t, height - t2x, arc - t), false); width - (closedPath ? t2x : t), height - t2x, arc - t), false);
break;
}
case RIGHT:
default: {
path2D.append(createRightRoundRectangle(x, y, width, height, arc), false);
path2D.append(createRightRoundRectangle(x + (closedPath ? t : 0), y + t,
width - (closedPath ? t2x : t), height - t2x, arc - t), false);
break;
}
} }
g2.fill(path2D); g2.fill(path2D);
} }
@ -452,6 +486,7 @@ public class FineUIUtils {
/** /**
* 创建一个支持自动换行的提示文本 * 创建一个支持自动换行的提示文本
*
* @param text 显示的文本内容 * @param text 显示的文本内容
* @return 自动换行提示文本 * @return 自动换行提示文本
*/ */

117
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -104,12 +104,12 @@ import java.util.concurrent.atomic.AtomicBoolean;
* The manager of Designer GUI. * The manager of Designer GUI.
* 下面的作者日期都是随手写的具体作者已经无法考究 * 下面的作者日期都是随手写的具体作者已经无法考究
* *
* @author anonymous * @author anonymous
* @version 11.0 * @version 11.0
* created by anonymous on 2002/11/08 * created by anonymous on 2002/11/08
*/ */
public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReadable { public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReadable {
private static final int MAX_SHOW_NUM = 10; private static final int MAX_SHOW_NUM = 10;
private static final String VERSION_80 = "80"; private static final String VERSION_80 = "80";
private static final String VERSION_90 = "90"; private static final String VERSION_90 = "90";
@ -122,26 +122,26 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
* 指定默认工作空间 * 指定默认工作空间
*/ */
public static final String DEFAULT_WORKSPACE_PATH = "fr.designer.workspace.default"; public static final String DEFAULT_WORKSPACE_PATH = "fr.designer.workspace.default";
public static final String LAST_EAST_REGION_LAYOUT = "LastEastRegionLayout"; public static final String LAST_EAST_REGION_LAYOUT = "LastEastRegionLayout";
public static final String LAST_WEST_REGION_LAYOUT = "LastWestRegionLayout"; public static final String LAST_WEST_REGION_LAYOUT = "LastWestRegionLayout";
private static DesignerEnvManager designerEnvManager; // gui. private static DesignerEnvManager designerEnvManager; // gui.
private String activationKey = null; private String activationKey = null;
private String logLocation = null; private String logLocation = null;
private Rectangle windowBounds = null; // window bounds. private Rectangle windowBounds = null; // window bounds.
private String DialogCurrentDirectory = null; private String DialogCurrentDirectory = null;
private String CurrentDirectoryPrefix = null; private String CurrentDirectoryPrefix = null;
private Map<String, List<String>> recentOpenedFileListMap = new HashMap<>(); private Map<String, List<String>> recentOpenedFileListMap = new HashMap<>();
private List<String> tempRecentOpenedFilePathList = new ArrayList<String>(); private List<String> tempRecentOpenedFilePathList = new ArrayList<String>();
private XmlElement<Map<String, List<String>>> recentOpenedMapping = SimpleXmlElement.of(recentOpenedFileListMap); private XmlElement<Map<String, List<String>>> recentOpenedMapping = SimpleXmlElement.of(recentOpenedFileListMap);
private boolean showPaintToolBar = true; private boolean showPaintToolBar = true;
private int maxNumberOrPreviewRow = 200; private int maxNumberOrPreviewRow = 200;
private XmlElement<EnvConfiguration> envConfig = SimpleXmlElement.of(new EnvConfiguration()); private XmlElement<EnvConfiguration> envConfig = SimpleXmlElement.of(new EnvConfiguration());
private boolean showProjectPane = true; private boolean showProjectPane = true;
private boolean showDataPane = true; private boolean showDataPane = true;
//p:这是当前选择的数据库连接的名字,这个在新建数据源的时候用到. //p:这是当前选择的数据库连接的名字,这个在新建数据源的时候用到.
@ -195,12 +195,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
private boolean embedServerLazyStartup = false; private boolean embedServerLazyStartup = false;
//最近使用的颜色 //最近使用的颜色
private ColorSelectConfigManager configManager = new ColorSelectConfigManager(); private ColorSelectConfigManager configManager = new ColorSelectConfigManager();
/** /**
* 环境检测配置 * 环境检测配置
*/ */
private EnvDetectorConfig envDetectorConfig = EnvDetectorConfig.getInstance(); private EnvDetectorConfig envDetectorConfig = EnvDetectorConfig.getInstance();
/** /**
* alphafine * alphafine
*/ */
@ -214,11 +214,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
private DesignerPushUpdateConfigManager designerPushUpdateConfigManager = DesignerPushUpdateConfigManager.getInstance(); private DesignerPushUpdateConfigManager designerPushUpdateConfigManager = DesignerPushUpdateConfigManager.getInstance();
private VcsConfigManager vcsConfigManager = VcsConfigManager.getInstance(); private VcsConfigManager vcsConfigManager = VcsConfigManager.getInstance();
private DesignerStartupConfig designerStartupConfig = DesignerStartupConfig.getInstance(); private DesignerStartupConfig designerStartupConfig = DesignerStartupConfig.getInstance();
private SwitchForSwingChecker switchForSwingChecker = SwitchForSwingChecker.getInstance(); private SwitchForSwingChecker switchForSwingChecker = SwitchForSwingChecker.getInstance();
public static final String CAS_CERTIFICATE_PATH = "certificatePath"; public static final String CAS_CERTIFICATE_PATH = "certificatePath";
public static final String CAS_CERTIFICATE_PASSWORD = "certificatePass"; public static final String CAS_CERTIFICATE_PASSWORD = "certificatePass";
@ -267,7 +267,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
designerEnvManager = new DesignerEnvManager(); designerEnvManager = new DesignerEnvManager();
//REPORT-15332有一个国际化调用比较早,需要在这边就设置好locale,由于后台GeneralContext默认是China //REPORT-15332有一个国际化调用比较早,需要在这边就设置好locale,由于后台GeneralContext默认是China
GeneralContext.setLocale(designerEnvManager.getLanguage()); GeneralContext.setLocale(designerEnvManager.getLanguage());
if (!asyncInitEnvManager()) { if (!asyncInitEnvManager()) {
// 如果异步读取失败, 则恢复原来的逻辑 // 如果异步读取失败, 则恢复原来的逻辑
compatibleInitEnvManager(); compatibleInitEnvManager();
@ -287,9 +287,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
return designerEnvManager; return designerEnvManager;
} }
private static void compatibleInitEnvManager() { private static void compatibleInitEnvManager() {
try { try {
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile()); XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile());
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
@ -299,7 +299,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
/** /**
* 异步初始化环境管理, 提供配置, 帮助处理预期外的问题 * 异步初始化环境管理, 提供配置, 帮助处理预期外的问题
* 1-当优化开启时才走异步逻辑 * 1-当优化开启时才走异步逻辑
@ -308,7 +308,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
* @return / * @return /
*/ */
private static boolean asyncInitEnvManager() { private static boolean asyncInitEnvManager() {
AtomicBoolean noEx = new AtomicBoolean(false); AtomicBoolean noEx = new AtomicBoolean(false);
OptimizeUtil.initiateOpen(DesignerEnvManager.class.getSimpleName().toLowerCase(), () -> { OptimizeUtil.initiateOpen(DesignerEnvManager.class.getSimpleName().toLowerCase(), () -> {
try { try {
@ -326,7 +326,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
} }
public static void checkNameEnvMap() { public static void checkNameEnvMap() {
if (designerEnvManager == null || designerEnvManager.getNameEnvMap().size() > 0) { if (designerEnvManager == null || designerEnvManager.getNameEnvMap().size() > 0) {
return; return;
} }
@ -1060,11 +1060,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
public void setLanguage(Locale locale) { public void setLanguage(Locale locale) {
this.language = locale; this.language = locale;
} }
public boolean isStartupPageEnabled() { public boolean isStartupPageEnabled() {
return this.designerStartupConfig.isEnabled(); return this.designerStartupConfig.isEnabled();
} }
public void setStartupPageEnabled(boolean enabled) { public void setStartupPageEnabled(boolean enabled) {
this.designerStartupConfig.setEnabled(enabled); this.designerStartupConfig.setEnabled(enabled);
} }
@ -1191,9 +1191,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
public void setCurrentDirectoryPrefix(String prefix) { public void setCurrentDirectoryPrefix(String prefix) {
this.CurrentDirectoryPrefix = prefix; this.CurrentDirectoryPrefix = prefix;
} }
public List<String> getRecentOpenedFilePathList4Env(String envName) { public List<String> getRecentOpenedFilePathList4Env(String envName) {
if (StringUtils.isEmpty(envName)) { if (StringUtils.isEmpty(envName)) {
return tempRecentOpenedFilePathList; return tempRecentOpenedFilePathList;
} else { } else {
@ -1201,7 +1201,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
recentOpenedMapping.getValue().put(envName, tempRecentOpenedFilePathList); recentOpenedMapping.getValue().put(envName, tempRecentOpenedFilePathList);
} }
} }
return recentOpenedMapping.getValue().get(envName); return recentOpenedMapping.getValue().get(envName);
} }
@ -1209,7 +1209,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
* 返回最近打开的文件路径列表 * 返回最近打开的文件路径列表
*/ */
public List<String> getRecentOpenedFilePathList() { public List<String> getRecentOpenedFilePathList() {
return this.getRecentOpenedFilePathList4Env(getCurEnvName()); return this.getRecentOpenedFilePathList4Env(getCurEnvName());
} }
@ -1713,7 +1713,16 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
} }
} }
} }
Carina.config(LanguageConfigProvider.class).setLocale(CommonUtils.localeToString(designerEnvManager.getLanguage())); setLocale();
}
private static void setLocale() {
try {
Carina.config(LanguageConfigProvider.class)
.setLocale(CommonUtils.localeToString(designerEnvManager.getLanguage()));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} }
@ -1853,10 +1862,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
public void setLayoutTemplateStyle(int layoutTemplateStyle) { public void setLayoutTemplateStyle(int layoutTemplateStyle) {
this.layoutTemplateStyle = layoutTemplateStyle; this.layoutTemplateStyle = layoutTemplateStyle;
} }
@Override @Override
public void initElements(File xmlFile) throws XmlException { public void initElements(File xmlFile) throws XmlException {
try { try {
backupOldXmlFile(); backupOldXmlFile();
XmlInitialFactory xmlInitialFactory = XmlInitialFactory.create(xmlFile); XmlInitialFactory xmlInitialFactory = XmlInitialFactory.create(xmlFile);
@ -1876,7 +1885,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
}); });
}) })
.init("EnvConfigMap", (e) -> { .init("EnvConfigMap", (e) -> {
final EnvConfiguration previousConfig = this.envConfig.getValue(); final EnvConfiguration previousConfig = this.envConfig.getValue();
this.envConfig = AsyncXmlElement.of(DesignerStartupPool.common(), () -> { this.envConfig = AsyncXmlElement.of(DesignerStartupPool.common(), () -> {
DesignerEnvManager.this.readEnvConfigMap(e, previousConfig); DesignerEnvManager.this.readEnvConfigMap(e, previousConfig);
@ -1928,13 +1937,13 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
throw new XmlException(e); throw new XmlException(e);
} }
} }
/** /**
* 备份老的 xml 文件, 防止第一次修改存在问题 * 备份老的 xml 文件, 防止第一次修改存在问题
* 但是只备份一次其他都走老逻辑 * 但是只备份一次其他都走老逻辑
*/ */
private void backupOldXmlFile() { private void backupOldXmlFile() {
try { try {
File oldFile = getEnvFile(); File oldFile = getEnvFile();
String newFilePath = ProductConstants.getEnvHome() + File.separator + ProductConstants.APP_NAME + "Env_backup.xml"; String newFilePath = ProductConstants.getEnvHome() + File.separator + ProductConstants.APP_NAME + "Env_backup.xml";
@ -1948,7 +1957,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
} catch (Exception ignored) { } catch (Exception ignored) {
} }
} }
/** /**
* Read XML.<br> * Read XML.<br>
* The method will be invoked when read data from XML file.<br> * The method will be invoked when read data from XML file.<br>
@ -2040,16 +2049,16 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
} }
private void readAlphaFineAttr(XMLableReader reader) { private void readAlphaFineAttr(XMLableReader reader) {
AlphaFineConfigManager config = AlphaFineConfigManager.getInstance(); AlphaFineConfigManager config = AlphaFineConfigManager.getInstance();
reader.readXMLObject(config); reader.readXMLObject(config);
this.alphaFineConfigManager = SimpleXmlElement.of(config); this.alphaFineConfigManager = SimpleXmlElement.of(config);
} }
private void readEnvDetectorConfig(XMLableReader reader) { private void readEnvDetectorConfig(XMLableReader reader) {
reader.readXMLObject(this.envDetectorConfig); reader.readXMLObject(this.envDetectorConfig);
} }
private void readStartupConfig(XMLableReader reader) { private void readStartupConfig(XMLableReader reader) {
reader.readXMLObject(this.designerStartupConfig); reader.readXMLObject(this.designerStartupConfig);
} }
@ -2165,9 +2174,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
this.setPaginationLineColor(new Color(Integer.parseInt(tmpVal))); this.setPaginationLineColor(new Color(Integer.parseInt(tmpVal)));
} }
} }
private void readEnvConfigMap(XMLableReader reader, EnvConfiguration envConfigs) { private void readEnvConfigMap(XMLableReader reader, EnvConfiguration envConfigs) {
String currentEnv = reader.getAttrAsString("currentEnv", StringUtils.EMPTY); String currentEnv = reader.getAttrAsString("currentEnv", StringUtils.EMPTY);
envConfigs.setCurEnvName(currentEnv); envConfigs.setCurEnvName(currentEnv);
reader.readXMLObject(new XMLReadable() { reader.readXMLObject(new XMLReadable() {
@ -2232,15 +2241,15 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
} }
}); });
} }
private void readRecentOpenFileList(XMLableReader reader) { private void readRecentOpenFileList(XMLableReader reader) {
readRecentOpenFileList0(reader); readRecentOpenFileList0(reader);
checkRecentOpenedFileNum(); checkRecentOpenedFileNum();
} }
private void readRecentOpenFileList0(XMLableReader reader) { private void readRecentOpenFileList0(XMLableReader reader) {
reader.readXMLObject(new XMLReadable() { reader.readXMLObject(new XMLReadable() {
@Override @Override
public void readXML(XMLableReader reader) { public void readXML(XMLableReader reader) {
@ -2358,13 +2367,13 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
writer.end(); writer.end();
} }
} }
private void writeEnvDetectorConfig(XMLPrintWriter writer) { private void writeEnvDetectorConfig(XMLPrintWriter writer) {
if (this.envDetectorConfig != null) { if (this.envDetectorConfig != null) {
this.envDetectorConfig.writeXML(writer); this.envDetectorConfig.writeXML(writer);
} }
} }
private void writeStartupConfig(XMLPrintWriter writer) { private void writeStartupConfig(XMLPrintWriter writer) {
if (this.designerStartupConfig != null) { if (this.designerStartupConfig != null) {
this.designerStartupConfig.writeXML(writer); this.designerStartupConfig.writeXML(writer);
@ -2630,7 +2639,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
} }
private void readFvsDesignerConfig(XMLableReader reader) { private void readFvsDesignerConfig(XMLableReader reader) {
SimpleDesignerConfig config = fvsDesignerConfig.getValue(); SimpleDesignerConfig config = fvsDesignerConfig.getValue();
reader.readXMLObject(config); reader.readXMLObject(config);
fvsDesignerConfig = SimpleXmlElement.of(config); fvsDesignerConfig = SimpleXmlElement.of(config);
@ -2672,39 +2681,39 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
public SnapChatConfig getSnapChatConfig() { public SnapChatConfig getSnapChatConfig() {
return snapChatConfig; return snapChatConfig;
} }
private EnvConfiguration getEnvConfig() { private EnvConfiguration getEnvConfig() {
return envConfig.getValue(); return envConfig.getValue();
} }
private Map<String, DesignerWorkspaceInfo> getNameEnvMap() { private Map<String, DesignerWorkspaceInfo> getNameEnvMap() {
return getEnvConfig().getNameEnvMap(); return getEnvConfig().getNameEnvMap();
} }
private static class EnvConfiguration { private static class EnvConfiguration {
// name和Env的键值对 // name和Env的键值对
private Map<String, DesignerWorkspaceInfo> nameEnvMap = new ListMap<>(); private Map<String, DesignerWorkspaceInfo> nameEnvMap = new ListMap<>();
// marks: 当前报表服务器名字 // marks: 当前报表服务器名字
private String curEnvName = null; private String curEnvName = null;
public Map<String, DesignerWorkspaceInfo> getNameEnvMap() { public Map<String, DesignerWorkspaceInfo> getNameEnvMap() {
return nameEnvMap; return nameEnvMap;
} }
public void setNameEnvMap(Map<String, DesignerWorkspaceInfo> nameEnvMap) { public void setNameEnvMap(Map<String, DesignerWorkspaceInfo> nameEnvMap) {
this.nameEnvMap = nameEnvMap; this.nameEnvMap = nameEnvMap;
} }
public String getCurEnvName() { public String getCurEnvName() {
return curEnvName; return curEnvName;
} }
public void setCurEnvName(String curEnvName) { public void setCurEnvName(String curEnvName) {
this.curEnvName = curEnvName; this.curEnvName = curEnvName;
} }
} }
} }

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

@ -23,7 +23,6 @@ import javax.swing.JPanel;
import javax.swing.JScrollBar; import javax.swing.JScrollBar;
import javax.swing.JViewport; import javax.swing.JViewport;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
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;
@ -311,11 +310,10 @@ public class StartupPageWorkspacePanel extends JPanel {
if (borderColor != null) { if (borderColor != null) {
g2d.setColor(borderColor); g2d.setColor(borderColor);
g2d.setStroke(new BasicStroke(BORDER_THIN)); FineUIUtils.paintPartRoundButtonBorder(g2d, 0, 0,
FlatUIUtils.setRenderingHints(g2d); this.getWidth(), this.getHeight(),
Path2D path2D = FineUIUtils.createLeftRoundRectangle(0, 0, BORDER_THIN, ARC_DIAMETER,
getWidth() - BORDER_THIN, getHeight() - BORDER_THIN, ARC_DIAMETER); FineUIUtils.LEFT, true);
g2d.draw(path2D);
} }
} }
}; };
@ -437,11 +435,11 @@ public class StartupPageWorkspacePanel extends JPanel {
Color borderColor = borderColorRef.get(); Color borderColor = borderColorRef.get();
if (borderColor != null) { if (borderColor != null) {
g2d.setColor(borderColor); g2d.setColor(borderColor);
g2d.setStroke(new BasicStroke(BORDER_THIN)); FineUIUtils.paintPartRoundButtonBorder(g2d, 0, 0,
FlatUIUtils.setRenderingHints(g2d); this.getWidth(), this.getHeight(),
Path2D path2D = FineUIUtils.createRightRoundRectangle(0, 0, BORDER_THIN, ARC_DIAMETER,
getWidth() - BORDER_THIN, getHeight() - BORDER_THIN, ARC_DIAMETER); FineUIUtils.RIGHT, true
g2d.draw(path2D); );
} }
} }

8
designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonStoryBoard.java

@ -3,9 +3,11 @@ package com.fr.design.gui.storybook.components;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UICombinationButton; import com.fr.design.gui.ibutton.UICombinationButton;
import com.fr.design.gui.ibutton.UISaveForbiddenButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.storybook.Story; import com.fr.design.gui.storybook.Story;
import com.fr.design.gui.storybook.StoryBoard; import com.fr.design.gui.storybook.StoryBoard;
import com.fr.design.i18n.Toolkit;
import com.fr.design.style.color.UIToolbarColorButton; import com.fr.design.style.color.UIToolbarColorButton;
import javax.swing.JButton; import javax.swing.JButton;
@ -177,7 +179,9 @@ public class ButtonStoryBoard extends StoryBoard {
.with(it -> setStyle(it, STYLE_PRIMARY)), .with(it -> setStyle(it, STYLE_PRIMARY)),
cell(new UICombinationButton("按钮2", new LazyIcon("triangle_down"))), cell(new UICombinationButton("按钮2", new LazyIcon("triangle_down"))),
cell(new JButton("按钮", new LazyIcon("add"))), cell(new JButton("按钮", new LazyIcon("add"))),
cell(new JButton(new LazyIcon("multi"))) cell(new UICombinationButton(
new UISaveForbiddenButton(Toolkit.i18nText("Fine-Design_Basic_Preview"), new LazyIcon("run").white()),
new UISaveForbiddenButton(new LazyIcon("triangle_down").white()))).with(UICombinationButton::setPrimary)
), ),
row(20, row(20,
cell(new UIToolbarColorButton(new LazyIcon("foreground"))), cell(new UIToolbarColorButton(new LazyIcon("foreground"))),
@ -189,7 +193,7 @@ public class ButtonStoryBoard extends StoryBoard {
); );
} }
public JComponent toolbar(){ public JComponent toolbar() {
JToolBar bar = new JToolBar(); JToolBar bar = new JToolBar();
UIToolbarColorButton foreground = new UIToolbarColorButton(new LazyIcon("foreground")); UIToolbarColorButton foreground = new UIToolbarColorButton(new LazyIcon("foreground"));
bar.add(foreground); bar.add(foreground);

3
designer-realize/src/main/java/com/fr/start/CarinaDesigner.java

@ -41,6 +41,7 @@ public class CarinaDesigner extends MainDesigner{
* main * main
*/ */
public static void main(String[] args) { public static void main(String[] args) {
installUIDevModeTools();
DesignerStartupContext.getRecorder().start(); DesignerStartupContext.getRecorder().start();
PartitionManager manager = new PartitionManagerImpl(); PartitionManager manager = new PartitionManagerImpl();
StateHubContext.setReady(false); StateHubContext.setReady(false);
@ -66,8 +67,6 @@ public class CarinaDesigner extends MainDesigner{
DesignerStartupContext.getRecorder().stop(); DesignerStartupContext.getRecorder().stop();
SwitchForSwingChecker.initThreadMonitoring(); SwitchForSwingChecker.initThreadMonitoring();
DesignerLatencyMetric.getInstance().start(); DesignerLatencyMetric.getInstance().start();
installUIDevModeTools();
} }
/** /**

Loading…
Cancel
Save