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