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