Browse Source

Merge remote-tracking branch 'origin/newui' into newui

# Conflicts:
#	designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java
#	designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
newui
lemon 4 months ago
parent
commit
f764226119
  1. 28
      designer-base/src/main/java/com/fine/theme/light/ui/FineComboBoxUI.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. 15
      designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java
  5. 4
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  6. 4
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  7. 2
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  8. 3
      designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java
  9. 1
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  10. 4
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  11. 32
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java
  12. 14
      designer-base/src/main/java/com/fr/design/mainframe/DesignerUIModeConfig.java
  13. 6
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  14. 1
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java
  15. 1
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsProgressDialog.java
  16. 3
      designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java
  17. 6
      designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java
  18. 46
      designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java
  19. 2
      designer-base/src/main/java/com/fr/startup/ui/StartupPageConstants.java
  20. 13
      designer-base/src/main/java/com/fr/startup/ui/StartupPageUtil.java
  21. 61
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java
  22. 468
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java
  23. 5
      designer-base/src/main/resources/com/fine/theme/icon/add_hover.svg
  24. 15
      designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/fvs_locked.svg
  25. 16
      designer-base/src/main/resources/com/fine/theme/icon/startup/local_server_background.svg
  26. 3
      designer-base/src/main/resources/com/fine/theme/icon/startup/more.svg
  27. 3
      designer-base/src/main/resources/com/fine/theme/icon/startup/more_hover.svg
  28. 18
      designer-base/src/main/resources/com/fine/theme/icon/startup/remote_server_background.svg
  29. 3
      designer-base/src/main/resources/com/fine/theme/icon/startup/show_less.svg
  30. 3
      designer-base/src/main/resources/com/fine/theme/icon/startup/show_more.svg
  31. 10
      designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json
  32. 20
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  33. 64
      designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotUITabGroup.java
  34. 19
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotSeriesPane.java
  35. 1
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/base/DownloadProgressPane.java
  36. 6
      designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java
  37. 3
      designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java
  38. 4
      designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java
  39. 14
      designer-realize/src/main/java/com/fr/start/MainDesigner.java

28
designer-base/src/main/java/com/fine/theme/light/ui/FineComboBoxUI.java

@ -1,11 +1,16 @@
package com.fine.theme.light.ui; package com.fine.theme.light.ui;
import com.fine.theme.utils.FineClientProperties;
import com.fine.theme.utils.FineUIScale;
import com.formdev.flatlaf.ui.FlatComboBoxUI; import com.formdev.flatlaf.ui.FlatComboBoxUI;
import com.formdev.flatlaf.ui.FlatUIUtils;
import org.jetbrains.annotations.Nullable;
import javax.swing.JComponent;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import java.awt.Dimension;
import java.awt.Graphics2D; import java.awt.Graphics2D;
/** /**
@ -38,4 +43,25 @@ public class FineComboBoxUI extends FlatComboBoxUI {
super.paintArrow(g); super.paintArrow(g);
} }
} }
@Override
public Dimension getMinimumSize(JComponent c) {
// ComboBox基于子组件计算适配尺寸性能一般,仅考虑部分ComboBox进行适配计算,其他采用默认值
if (FineClientProperties.ADAPTIVE_COMBO_BOX.equals(getComboBoxTypeStr(c))) {
return super.getMinimumSize(c);
}
return FineUIScale.scale(new Dimension(
FlatUIUtils.getUIInt("ComboBox.minimumWidth", 72),
FlatUIUtils.getUIInt("ComboBox.comboHeight", 24)
));
}
@Nullable
static String getComboBoxTypeStr(JComponent c) {
Object value = c.getClientProperty(FineClientProperties.COMBO_BOX_TYPE);
if (value instanceof String) {
return (String) value;
}
return null;
}
} }

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";

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

@ -16,6 +16,7 @@ import javax.swing.UIManager;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Composite; import java.awt.Composite;
import java.awt.Font;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.GraphicsDevice; import java.awt.GraphicsDevice;
@ -388,7 +389,7 @@ public class FineUIUtils {
* 面板元素头部添加小标题 * 面板元素头部添加小标题
* *
* @param component 面板元素 * @param component 面板元素
* @param title 标题文本 * @param title 标题文本
* @return 包装面板 * @return 包装面板
*/ */
public static Component wrapComponentWithTitle(Component component, String title) { public static Component wrapComponentWithTitle(Component component, String title) {
@ -422,4 +423,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/actions/file/PreferencePane.java

@ -114,6 +114,8 @@ import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.fix; import static com.fine.swing.ui.layout.Layouts.fix;
import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE;
import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX;
import static com.fine.theme.utils.FineUIConstants.SCALE_FONT_SIZE_12; import static com.fine.theme.utils.FineUIConstants.SCALE_FONT_SIZE_12;
import static com.fr.design.i18n.Toolkit.i18nText; import static com.fr.design.i18n.Toolkit.i18nText;
@ -615,6 +617,7 @@ public class PreferencePane extends BasicPane {
String[] undoTimes = {i18nText("Fine-Design_Basic_Max_Undo_Limit"), MAX_UNDO_LIMIT_5 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_10 + i18nText("Fine-Design_Basic_Time(s)") String[] undoTimes = {i18nText("Fine-Design_Basic_Max_Undo_Limit"), MAX_UNDO_LIMIT_5 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_10 + i18nText("Fine-Design_Basic_Time(s)")
, MAX_UNDO_LIMIT_15 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_20 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_50 + i18nText("Fine-Design_Basic_Time(s)")}; , MAX_UNDO_LIMIT_15 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_20 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_50 + i18nText("Fine-Design_Basic_Time(s)")};
maxUndoLimit = new UIComboBox(undoTimes); maxUndoLimit = new UIComboBox(undoTimes);
maxUndoLimit.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX);
//不支持撤销则不能选择撤销可缓存,也不能设置最大撤销次数 //不支持撤销则不能选择撤销可缓存,也不能设置最大撤销次数
supportUndoCheckBox.addActionListener(new ActionListener() { supportUndoCheckBox.addActionListener(new ActionListener() {
@ -811,6 +814,7 @@ public class PreferencePane extends BasicPane {
i++; i++;
} }
UIDictionaryComboBox<Locale> languageComboBox = new UIDictionaryComboBox<>(keys, values); UIDictionaryComboBox<Locale> languageComboBox = new UIDictionaryComboBox<>(keys, values);
languageComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX);
languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, SCALE_FONT_SIZE_12));//为了在中文系统中显示韩文 languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, SCALE_FONT_SIZE_12));//为了在中文系统中显示韩文
return languageComboBox; return languageComboBox;
} }

4
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -90,6 +90,9 @@ import java.awt.event.KeyListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE;
import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX;
/** /**
* @author rinoux * @author rinoux
* @version 10.0 * @version 10.0
@ -337,6 +340,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
private void createToolbarEsdComponents(final UIToolbar editToolBar) { private void createToolbarEsdComponents(final UIToolbar editToolBar) {
this.esdSettingsLabel = new UILabel(Toolkit.i18nText("Fine-Design_ESD_Cache_Settings")); this.esdSettingsLabel = new UILabel(Toolkit.i18nText("Fine-Design_ESD_Cache_Settings"));
this.esdConfigOption = new UIComboBox(StrategyConfigFrom.values()); this.esdConfigOption = new UIComboBox(StrategyConfigFrom.values());
this.esdConfigOption.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX);
this.esdEnabled = new UICheckBox(Toolkit.i18nText("Fine-Design_ESD_Enable_Cache")); this.esdEnabled = new UICheckBox(Toolkit.i18nText("Fine-Design_ESD_Enable_Cache"));
this.barErrorTips = new UILabel(); this.barErrorTips = new UILabel();
this.barErrorTips.setForeground(Color.RED); this.barErrorTips.setForeground(Color.RED);

2
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java

@ -428,7 +428,7 @@ public class MultiTemplateTabPane extends Row {
public void closeOther() { public void closeOther() {
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
SaveSomeTemplatePane saveSomeTemplatePane = new SaveSomeTemplatePane(false); SaveSomeTemplatePane saveSomeTemplatePane = new SaveSomeTemplatePane(false);
if (saveSomeTemplatePane.showSavePane(null, false, true)) { if (saveSomeTemplatePane.showSavePane(null, false, false)) {
List<JTemplate<?, ?>> openedTemplate = HistoryTemplateListCache.getInstance().getHistoryList(); List<JTemplate<?, ?>> openedTemplate = HistoryTemplateListCache.getInstance().getHistoryList();
JTemplate<?, ?>[] templates = new JTemplate<?, ?>[openedTemplate.size()]; JTemplate<?, ?>[] templates = new JTemplate<?, ?>[openedTemplate.size()];

3
designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java

@ -19,6 +19,8 @@ import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.fix; import static com.fine.swing.ui.layout.Layouts.fix;
import static com.fine.swing.ui.layout.Layouts.flex; import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineClientProperties.PANEL_TYPE;
import static com.fine.theme.utils.FineClientProperties.ROUNDED_PANEL;
/** /**
* Tab面板组件 * Tab面板组件
@ -118,6 +120,7 @@ public class FineTabbedPane extends Column {
private void initLayout() { private void initLayout() {
cards = new CardLayout(); cards = new CardLayout();
centerPane = new JPanel(cards); centerPane = new JPanel(cards);
centerPane.putClientProperty(PANEL_TYPE, ROUNDED_PANEL);
tabComponents.forEach((key, value) -> { tabComponents.forEach((key, value) -> {
value.setOpaque(false); value.setOpaque(false);
centerPane.add(value, key); centerPane.add(value, key);

1
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -237,7 +237,6 @@ public class UIButtonGroup<T> extends Column implements GlobalNameObserver, UIOb
} }
protected void initButton(UIToggleButton labelButton, int index) { protected void initButton(UIToggleButton labelButton, int index) {
labelButton.setBorder(new FineRoundBorder());
labelButton.setBorderPainted(false); labelButton.setBorderPainted(false);
labelButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_GROUP); labelButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_GROUP);
labelButton.putClientProperty(BUTTON_GROUP_POSITION, getGroupButtonPosition(index)); labelButton.putClientProperty(BUTTON_GROUP_POSITION, getGroupButtonPosition(index));

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;
} }

14
designer-base/src/main/java/com/fr/design/mainframe/DesignerUIModeConfig.java

@ -9,13 +9,18 @@ import com.fr.general.ComparatorUtils;
*/ */
public class DesignerUIModeConfig { public class DesignerUIModeConfig {
private DesignerUIMode mode = AbsoluteMeasureUIMode.getInstance(); private DesignerUIMode mode = AbsoluteMeasureUIMode.getInstance();
private boolean uiDevMode = false;
private static class DesignerUIModeConfigHolder { private static class DesignerUIModeConfigHolder {
private static final DesignerUIModeConfig designerUIModeConfig = new DesignerUIModeConfig(); private static final DesignerUIModeConfig designerUIModeConfig = new DesignerUIModeConfig();
} }
private DesignerUIModeConfig() { private DesignerUIModeConfig() {
init();
}
private void init() {
uiDevMode = Boolean.parseBoolean(System.getProperty("uiDevMode", "false"));
} }
public static DesignerUIModeConfig getInstance() { public static DesignerUIModeConfig getInstance() {
@ -32,6 +37,15 @@ public class DesignerUIModeConfig {
return ComparatorUtils.equals(SimulateWebUIMode.getInstance(), mode); return ComparatorUtils.equals(SimulateWebUIMode.getInstance(), mode);
} }
/**
* 判断是否是ui开发者模式
*
* @return boolean
*/
public boolean isUIDevMode() {
return uiDevMode;
}
/** /**
* 设置新ui模式 * 设置新ui模式
*/ */

6
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -57,6 +57,7 @@ import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIMenuBar; import com.fr.design.gui.imenu.UIMenuBar;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.locale.impl.SupportLocaleImpl; import com.fr.design.locale.impl.SupportLocaleImpl;
import com.fr.design.mainframe.DesignerUIModeConfig;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.platform.ServicePlatformAction; import com.fr.design.mainframe.platform.ServicePlatformAction;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
@ -295,7 +296,10 @@ public abstract class ToolBarMenuDock {
} }
}, SupportLocaleImpl.COMMUNITY); }, SupportLocaleImpl.COMMUNITY);
menuList.add(createLookAndFeel()); // 当前仅UI开发者模式显示外观配置选项
if (DesignerUIModeConfig.getInstance().isUIDevMode()) {
menuList.add(createLookAndFeel());
}
// 添加全部UpdateAction到actionmanager中 // 添加全部UpdateAction到actionmanager中
addAllUpdateActionsToList(menuList); addAllUpdateActionsToList(menuList);

1
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java

@ -174,7 +174,6 @@ public class VcsMovePanel extends BasicPane {
JPanel processPane = new JPanel(); JPanel processPane = new JPanel();
JPanel body = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel body = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
PROGRESS_BAR.setStringPainted(true); PROGRESS_BAR.setStringPainted(true);
PROGRESS_BAR.setUI(new ModernUIProgressBarUI());
PROGRESS_BAR.setBorderPainted(false); PROGRESS_BAR.setBorderPainted(false);
PROGRESS_BAR.setOpaque(false); PROGRESS_BAR.setOpaque(false);
PROGRESS_BAR.setBorder(null); PROGRESS_BAR.setBorder(null);

1
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsProgressDialog.java

@ -38,7 +38,6 @@ public class VcsProgressDialog{
}; };
JPanel body = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel body = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
progressBar.setStringPainted(true); progressBar.setStringPainted(true);
progressBar.setUI(new ModernUIProgressBarUI());
progressBar.setBorderPainted(false); progressBar.setBorderPainted(false);
progressBar.setOpaque(false); progressBar.setOpaque(false);
progressBar.setBorder(null); progressBar.setBorder(null);

3
designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java

@ -19,6 +19,8 @@ import java.util.stream.Collectors;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE;
import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX;
import static com.fr.design.i18n.Toolkit.i18nText; import static com.fr.design.i18n.Toolkit.i18nText;
public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> { public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
@ -96,6 +98,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
private void initItemChoose() { private void initItemChoose() {
belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set")); belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set"));
itemChoose = new UIComboBox(getItemNames()); itemChoose = new UIComboBox(getItemNames());
itemChoose.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX);
ItemListener itemListener = getItemListener(); ItemListener itemListener = getItemListener();
itemChoose.addItemListener(itemListener); itemChoose.addItemListener(itemListener);
//以下设置横向布局 //以下设置横向布局

6
designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java

@ -4,6 +4,7 @@ import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.swing.ui.layout.Spacer; import com.fine.swing.ui.layout.Spacer;
import com.fine.theme.light.ui.FineTableHeaderUI; import com.fine.theme.light.ui.FineTableHeaderUI;
import com.fine.theme.utils.FineClientProperties;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
@ -99,6 +100,7 @@ import java.util.stream.Collectors;
import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.row;
//august:这个东西应该分成两类,一类是有单元格的情况,一类是没有单元格的情况 //august:这个东西应该分成两类,一类是有单元格的情况,一类是没有单元格的情况
public class DBManipulationPane extends BasicBeanPane<DBManipulation> { public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
@ -154,6 +156,7 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
dmlConfigComboBox = new UIComboBox(DML_CONFIG_TYPES); dmlConfigComboBox = new UIComboBox(DML_CONFIG_TYPES);
dmlConfigComboBox.putClientProperty(FineClientProperties.COMBO_BOX_TYPE, FineClientProperties.ADAPTIVE_COMBO_BOX);
JPanel typePane = new JPanel(new BorderLayout()); JPanel typePane = new JPanel(new BorderLayout());
typePane.add(row(10, typePane.add(row(10,
@ -163,7 +166,7 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
chooseTable.setTableNameComboBoxPopSize(FineUIScale.scale(160), FineUIScale.scale(320)); chooseTable.setTableNameComboBoxPopSize(FineUIScale.scale(160), FineUIScale.scale(320));
// peter:编辑的TablePane // peter:编辑的TablePane
JPanel editTablePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel editTablePane = new JPanel(new BorderLayout(FineUIScale.scale(10), 0));
editTablePane.setBounds(0, 0, FineUIScale.scale(280), FineUIScale.scale(180)); editTablePane.setBounds(0, 0, FineUIScale.scale(280), FineUIScale.scale(180));
keyColumnValuesTable = new KeyColumnNameValueTable(); keyColumnValuesTable = new KeyColumnNameValueTable();
editTablePane.add(new UIScrollPane(keyColumnValuesTable), BorderLayout.CENTER); editTablePane.add(new UIScrollPane(keyColumnValuesTable), BorderLayout.CENTER);
@ -706,6 +709,7 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
// 设置column1的editor // 设置column1的editor
columnsComboBox = new UIComboBox(new DefaultComboBoxModel()); columnsComboBox = new UIComboBox(new DefaultComboBoxModel());
columnsComboBox.setRenderer(new UIComboBoxRenderer() { columnsComboBox.setRenderer(new UIComboBoxRenderer() {
@Override @Override

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;
/** /**
* 内容宽度 * 内容宽度

13
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,11 +42,11 @@ 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);
} }
/** /**
* 返回 ip : port * 返回 ip : port
* *

61
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,12 +65,12 @@ 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();
@ -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;
} }
@ -414,10 +411,8 @@ 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) {

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

@ -1,211 +1,223 @@
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;
/** /**
* created by Harrison on 2022/07/06 * created by Harrison on 2022/07/06
**/ **/
public class StartupPageWorkspacePanel extends JPanel { 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));
/* 长度 */ /* 长度 */
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;
public static final int PARTITION_LIMIT = 2; public static final int PARTITION_LIMIT = 2;
/* model */ /* model */
private final StartupPageModel pageModel; private final StartupPageModel pageModel;
private final List<List<StartupWorkspaceBean>> partitions; private final List<List<StartupWorkspaceBean>> partitions;
private Runnable selectWorkspaceRunnable; private Runnable selectWorkspaceRunnable;
private final Runnable createNewTemplateRunnable; private final Runnable createNewTemplateRunnable;
private final Runnable openEmptyTemplateRunnable; private final Runnable openEmptyTemplateRunnable;
private JComponent contentPanel; private JComponent contentPanel;
private JPanel tailPanel; private JPanel tailPanel;
private boolean showMore = true; private boolean showMore = true;
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;
List<StartupWorkspaceBean> workspaceInfos = pageModel.getWorkspaceInfos(); List<StartupWorkspaceBean> workspaceInfos = pageModel.getWorkspaceInfos();
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) {
this.tailPanel = generateTailPanel(); this.tailPanel = generateTailPanel();
this.add(tailPanel, BorderLayout.SOUTH); this.add(tailPanel, BorderLayout.SOUTH);
} }
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();
} }
public void showLessContent() { public void showLessContent() {
this.remove(this.contentPanel); this.remove(this.contentPanel);
this.contentPanel = generateLimitContentPanel(this.partitions); this.contentPanel = generateLimitContentPanel(this.partitions);
this.add(contentPanel, BorderLayout.NORTH); this.add(contentPanel, BorderLayout.NORTH);
} }
public void showMoreContent() { public void showMoreContent() {
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;
} }
@NotNull @NotNull
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();
scrollPane.setVerticalScrollBar(bar);
setStyle(bar, FineUIStyle.TRANSPARENT_BACKGROUND);
scrollViewport.setOpaque(false);
workspaceDescWrapper.add(scrollPane, BorderLayout.CENTER); 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) {
break; break;
} }
List<StartupWorkspaceBean> partition = partitions.get(i); List<StartupWorkspaceBean> partition = partitions.get(i);
JPanel partitionPanel = generatePartitionPanel(partition); JPanel partitionPanel = generatePartitionPanel(partition);
workspaceDescPanel.add(partitionPanel); workspaceDescPanel.add(partitionPanel);
} }
ColorUtils.transparentBackground(workspaceDescPanel); setStyle(workspaceDescPanel, FineUIStyle.TRANSPARENT_BACKGROUND);
return workspaceDescPanel; return workspaceDescPanel;
} }
@NotNull @NotNull
private JPanel generateTailPanel() { private JPanel generateTailPanel() {
AtomicReference<Color> hoverBackColorRef = new AtomicReference<>(); 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));
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() {
@Override
public void mouseEntered(MouseEvent e) {
Color hoverBackColor = new Color(217, 235, 254);
hoverBackColorRef.set(hoverBackColor);
repaintAll();
}
@Override showAllPanel.addMouseListener(new MouseAdapter() {
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,172 +247,132 @@ 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();
layoutSelectWorkspacePanel(workspaceInfo, workspaceItemDesc); layoutSelectWorkspacePanel(workspaceInfo, workspaceItemDesc);
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;
} }
private void layoutSelectWorkspacePanel(StartupWorkspaceBean workspaceInfo, JPanel workspaceItemDesc) { private void layoutSelectWorkspacePanel(StartupWorkspaceBean workspaceInfo, JPanel workspaceItemDesc) {
// 选择工作目录 // 选择工作目录
// 图标 / 分隔符 / 说明-进入 // 图标 / 分隔符 / 说明-进入
// 选择并新建 // 选择并新建
AtomicReference<Color> borderColorRef = new AtomicReference<>(null); AtomicReference<Color> borderColorRef = new AtomicReference<>(null);
JPanel selectWorkspacePanel = new JPanel() { JPanel selectWorkspacePanel = new JPanel() {
@Override @Override
public JToolTip createToolTip() { public JToolTip createToolTip() {
return new ModernToolTip(); return new ModernToolTip();
} }
@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);
Color borderColor = borderColorRef.get();
Color backColor = FlatUIUtils.getUIColor("fill.normal", Color.WHITE);
Color backColor = 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 背景颜色
*/ */
private void paintBorderIfHover(Graphics2D g2d, Color borderColor, Color backColor) { private void paintBorderIfHover(Graphics2D g2d, Color borderColor, Color backColor) {
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);
MouseAdapter selectWorkspaceMouseListener = new MouseAdapter() { MouseAdapter selectWorkspaceMouseListener = new MouseAdapter() {
@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 );
repaintAll(); repaintAll();
} }
@Override @Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
borderColorRef.set(Color.WHITE); borderColorRef.set(Color.WHITE);
@ -436,10 +391,10 @@ public class StartupPageWorkspacePanel extends JPanel {
} }
doSwitchWorkspace(workspaceInfo); doSwitchWorkspace(workspaceInfo);
} }
}; };
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,18 +420,16 @@ 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);
} }
private void layoutSelectAndCreatePanel(StartupWorkspaceBean workspaceInfo, JPanel workspaceItemDesc) { private void layoutSelectAndCreatePanel(StartupWorkspaceBean workspaceInfo, JPanel workspaceItemDesc) {
// 选择并新建 // 选择并新建
AtomicReference<Color> borderColorRef = new AtomicReference<>(null); AtomicReference<Color> borderColorRef = new AtomicReference<>(null);
JPanel selectAndCreatePanel = new JPanel() { JPanel selectAndCreatePanel = new JPanel() {
@ -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 = FlatUIUtils.getUIColor("fill.deep", Color.GRAY);
Color backColor = SHALLOW_WHITE_COLOR;
g2d.setColor(backColor); g2d.setColor(backColor);
Path2D shape = FineUIUtils.createRightRoundRectangle(0, 0, this.getWidth(), this.getHeight(), ARC_DIAMETER);
// 见 layoutSelectWorkspacePanel 部分的分析 g2d.fill(shape);
// 直角和圆角上下叠合在一起
int rectOffset = 10; Color borderColor = borderColorRef.get();
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,73 +488,91 @@ 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);
} }
public void setSelectWorkspaceRunnable(Runnable selectWorkspaceRunnable) { public void setSelectWorkspaceRunnable(Runnable selectWorkspaceRunnable) {
this.selectWorkspaceRunnable = selectWorkspaceRunnable; this.selectWorkspaceRunnable = selectWorkspaceRunnable;
} }
private void doOpenEmptyTemplate(StartupWorkspaceBean workspaceInfo) { private void doOpenEmptyTemplate(StartupWorkspaceBean workspaceInfo) {
pageModel.setSelectWorkspaceInfo(workspaceInfo); pageModel.setSelectWorkspaceInfo(workspaceInfo);
openEmptyTemplateRunnable.run(); openEmptyTemplateRunnable.run();
DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics(); DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics();
designerMetrics.getStatistic().recordOpenEmptyTemplate(); designerMetrics.getStatistic().recordOpenEmptyTemplate();
} }
private void doSwitchWorkspace(StartupWorkspaceBean workspaceInfo) { private void doSwitchWorkspace(StartupWorkspaceBean workspaceInfo) {
StartupWorkspaceBean lastWorkspaceInfo = pageModel.getSelectWorkspaceInfo(); StartupWorkspaceBean lastWorkspaceInfo = pageModel.getSelectWorkspaceInfo();
// selectWorkspaceRunnable // selectWorkspaceRunnable
pageModel.setSelectWorkspaceInfo(workspaceInfo); pageModel.setSelectWorkspaceInfo(workspaceInfo);
selectWorkspaceRunnable.run(); selectWorkspaceRunnable.run();
DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics(); DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics();
designerMetrics.getStatistic().recordSwitchWorkspace(lastWorkspaceInfo, workspaceInfo); designerMetrics.getStatistic().recordSwitchWorkspace(lastWorkspaceInfo, workspaceInfo);
} }
private void doShowAllAction(UILabel fontLabel, UILabel iconLabel) { private void doShowAllAction(UILabel fontLabel, UILabel iconLabel) {
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;
} }
DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics(); DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics();
designerMetrics.getStatistic().recordShowAllAction(); designerMetrics.getStatistic().recordShowAllAction();
repaintAll(); repaintAll();
} }
private void repaintAll() { private void repaintAll() {
this.getRootPane().repaint(); this.getRootPane().repaint();
} }
/** /**
* 支持透明的滚动视图 * 支持透明的滚动视图
*/ */
private class TransparentScrollViewPort extends JViewport { private static class TransparentScrollViewPort extends JViewport {
/** /**
* 从而屏蔽掉 {@link RepaintManager.PaintManager#paintDoubleBuffered(JComponent, Image, Graphics, int, int, int, int)}
*
* @return 创建一个不会实际画图的 Graphics * @return 创建一个不会实际画图的 Graphics
*/ */
@Override @Override
public Graphics getGraphics() { 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 {
/**
* @return 创建一个不会实际画图的 Graphics
*/
@Override
public Graphics getGraphics() {
Graphics graphics = super.getGraphics(); Graphics graphics = super.getGraphics();
return new FRGraphics2D((Graphics2D) graphics) { return new FRGraphics2D((Graphics2D) 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 ----
@ -1299,6 +1300,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
@ -1339,5 +1344,10 @@ 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%)
[style]Table.defaultTable = \ [style]Table.defaultTable = \
background: $Table.default.background background: $Table.default.background

64
designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotUITabGroup.java

@ -2,14 +2,10 @@ package com.fr.van.chart.custom.component;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UITabGroup; import com.fr.design.gui.ibutton.UITabGroup;
import com.fr.design.gui.ibutton.UIToggleButton;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout; import java.awt.GridBagLayout;
import java.awt.LayoutManager; import java.awt.LayoutManager;
@ -36,66 +32,6 @@ public class VanChartCustomPlotUITabGroup extends UITabGroup{
return new GridBagLayout(); return new GridBagLayout();
} }
@Override
protected void initButton(UIToggleButton labelButton, int buttonIndex) {
int ButtonWidth = WIDTH / 3;
if (listNum <= 1){
return;
}else if (listNum == 2){
ButtonWidth = WIDTH / 2;
}
//将button加入到pane中,以便可以对边框进行控制
labelButton.setRoundBorder(false);
labelButton.setBorderPainted(false);
labelButtonList.add(labelButton);
int index = labelButtonList.size() - 1;
JPanel panel = getButtonPanel(labelButton, index);
GridBagConstraints constraints=new GridBagConstraints();
int end = listNum % 3;
if (end == 1 && index == 0){
constraints.gridy = 0;
constraints.gridx = 0;
constraints.gridheight = 1;
constraints.gridwidth = 6;
ButtonWidth = WIDTH + 2;
}else if (end == 2 && (index == 0 || index == 1) && listNum != 2){
constraints.gridy = 0;
constraints.gridx = index == 1 ? 4 : 0;
constraints.gridheight = 1;
constraints.gridwidth = index == 0 ? 4 : 2;
ButtonWidth = index == 0 ? ButtonWidth * 2 + 1 : ButtonWidth;
}else {
int l = ((index + ((end == 0) ? end : (3 - end))) / 3);
constraints.gridy = l;
constraints.gridx = ((index - (l * 3 - (end == 0 ? end : 3 - end))))*2;
constraints.gridheight = 1;
constraints.gridwidth = 2;
}
labelButton.setPreferredSize(new Dimension(ButtonWidth, BUTTON_HEIGHT));
this.add(panel, constraints);
}
private JPanel getButtonPanel(UIToggleButton labelButton, int index) {
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(labelButton,BorderLayout.CENTER);
setPanelBorder(panel, index);
return panel;
}
public void setPanelBorder(JPanel panel, int index) { public void setPanelBorder(JPanel panel, int index) {
int end = listNum % 3; int end = listNum % 3;
int num = listNum; int num = listNum;

19
designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomPlotSeriesPane.java

@ -1,20 +1,17 @@
package com.fr.van.chart.custom.style; package com.fr.van.chart.custom.style;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane; import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane;
import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
/** /**
* Created by Fangjie on 2016/4/26. * Created by Fangjie on 2016/4/26.
*/ */
public class VanChartCustomPlotSeriesPane extends BasicBeanPane<Plot> { public class VanChartCustomPlotSeriesPane extends BasicBeanPane<Plot> {
private static final int WIDTH = 236;
private static final int DELTA_HEIGHT = 300;
private BasicBeanPane<Plot> axisPane; private BasicBeanPane<Plot> axisPane;
private AbstractPlotSeriesPane seriesPane; private AbstractPlotSeriesPane seriesPane;
public VanChartCustomPlotSeriesPane(BasicBeanPane<Plot> axisPane, AbstractPlotSeriesPane seriesPane) { public VanChartCustomPlotSeriesPane(BasicBeanPane<Plot> axisPane, AbstractPlotSeriesPane seriesPane) {
@ -25,15 +22,7 @@ public class VanChartCustomPlotSeriesPane extends BasicBeanPane<Plot> {
} }
private void initContentPane() { private void initContentPane() {
setLayout(new BorderLayout());
seriesPane.setPreferredSize(new Dimension(WIDTH, (int) (seriesPane.getPreferredSize().getHeight() + DELTA_HEIGHT)));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p};
if (axisPane == null) { if (axisPane == null) {
this.add(seriesPane); this.add(seriesPane);
}else { }else {
@ -41,7 +30,7 @@ public class VanChartCustomPlotSeriesPane extends BasicBeanPane<Plot> {
new Component[]{axisPane}, new Component[]{axisPane},
new Component[]{seriesPane} new Component[]{seriesPane}
}; };
this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize)); this.add(FineLayoutBuilder.compatibleTableLayout(0, components, new double[]{1}));
} }
} }

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);

6
designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.actions.cell.style; package com.fr.design.actions.cell.style;
import com.fine.theme.utils.FineUIScale;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import java.awt.Dimension; import java.awt.Dimension;
@ -11,7 +12,6 @@ import javax.swing.ComboBoxModel;
import javax.swing.JComponent; import javax.swing.JComponent;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.Utils;
import com.fr.base.core.StyleUtils; import com.fr.base.core.StyleUtils;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -84,9 +84,7 @@ public class ReportFontNameAction extends AbstractStyleAction {
UIComboBox itemComponent = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report()); UIComboBox itemComponent = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
this.putValue(UIComboBox.class.getName(), itemComponent); this.putValue(UIComboBox.class.getName(), itemComponent);
//设置最佳宽度. //设置最佳宽度.
itemComponent.setPreferredSize(new Dimension( itemComponent.setPreferredSize(FineUIScale.scale(new Dimension(140, 24)));
Math.min(140, itemComponent.getPreferredSize().width),
itemComponent.getPreferredSize().height));
itemComponent.setEnabled(this.isEnabled()); itemComponent.setEnabled(this.isEnabled());
itemComponent.addActionListener(this); itemComponent.addActionListener(this);

3
designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java

@ -35,6 +35,8 @@ import java.awt.event.ActionListener;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE;
import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX;
import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.SPECIFY; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.SPECIFY;
@ -236,6 +238,7 @@ public class DSColumnAdvancedPane extends BasicPane {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Odd"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Odd"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Even"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Even"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Specify"),}); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Specify"),});
selectCountComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX);
selectCountComboBox.addActionListener(new ActionListener() { selectCountComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {

4
designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java

@ -100,7 +100,7 @@ public class ReportColumnsPane extends BasicPane{
} }
}; };
north.setPreferredSize(FineUIScale.scale(new Dimension(549, 59))); north.setPreferredSize(FineUIScale.scale(new Dimension(549, 59)));
north.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(11, 23, 6, 23), new UIRoundedBorder(new Color(204, 204, 204), 1, 10))); north.setBorder(BorderFactory.createCompoundBorder(new ScaledEmptyBorder(11, 23, 6, 23), new UIRoundedBorder(new Color(204, 204, 204), 1, 10)));
String[] textArray = new String[] { String[] textArray = new String[] {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_TurnOn"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_TurnOff") com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_TurnOn"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_TurnOff")
}; };
@ -108,7 +108,7 @@ public class ReportColumnsPane extends BasicPane{
onOffButtonGroup = new UIButtonGroup(textArray) { onOffButtonGroup = new UIButtonGroup(textArray) {
@Override @Override
protected void initButton(UIToggleButton labelButton, int index) { protected void initButton(UIToggleButton labelButton, int index) {
labelButton.setSize(new Dimension(60,20)); labelButton.setSize(FineUIScale.scale(new Dimension(60,20)));
labelButton.setPreferredSize(FineUIScale.scale(new Dimension(60, 20))); labelButton.setPreferredSize(FineUIScale.scale(new Dimension(60, 20)));
super.initButton(labelButton, index); super.initButton(labelButton, index);
} }

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

@ -30,6 +30,7 @@ import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ActiveKeyGenerator; import com.fr.design.mainframe.ActiveKeyGenerator;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerUIModeConfig;
import com.fr.design.mainframe.InformationCollector; import com.fr.design.mainframe.InformationCollector;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JWorkBook; import com.fr.design.mainframe.JWorkBook;
@ -158,9 +159,18 @@ public class MainDesigner extends BaseDesigner {
FineLoggerFactory.getLogger().info("Designer started.Time used {} ms", DesignerStartupContext.getRecorder().getTime(TimeUnit.MILLISECONDS)); FineLoggerFactory.getLogger().info("Designer started.Time used {} ms", DesignerStartupContext.getRecorder().getTime(TimeUnit.MILLISECONDS));
DesignerStartupContext.getRecorder().stop(); DesignerStartupContext.getRecorder().stop();
SwitchForSwingChecker.initThreadMonitoring(); SwitchForSwingChecker.initThreadMonitoring();
// new UiInspector();
// EdtInvocationManager.installEDTCheckers();
DesignerLatencyMetric.getInstance().start(); DesignerLatencyMetric.getInstance().start();
installUIDevModeTools();
}
/**
* 进入UI开发者模式
*/
private static void installUIDevModeTools() {
if (DesignerUIModeConfig.getInstance().isUIDevMode()) {
new UiInspector();
}
} }
/** /**

Loading…
Cancel
Save