|
|
|
@ -4,6 +4,7 @@ import com.fr.base.svg.IconUtils;
|
|
|
|
|
import com.fr.design.components.tooltip.ModernToolTip; |
|
|
|
|
import com.fr.design.gui.icontainer.UIScrollPane; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.gui.itextfield.FRGraphics2D; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
import com.fr.design.utils.ColorUtils; |
|
|
|
@ -17,6 +18,8 @@ import javax.swing.Icon;
|
|
|
|
|
import javax.swing.JComponent; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.JToolTip; |
|
|
|
|
import javax.swing.JViewport; |
|
|
|
|
import javax.swing.RepaintManager; |
|
|
|
|
import javax.swing.ScrollPaneConstants; |
|
|
|
|
import javax.swing.border.EmptyBorder; |
|
|
|
|
import java.awt.BasicStroke; |
|
|
|
@ -28,9 +31,11 @@ import java.awt.Font;
|
|
|
|
|
import java.awt.Graphics; |
|
|
|
|
import java.awt.Graphics2D; |
|
|
|
|
import java.awt.GridLayout; |
|
|
|
|
import java.awt.Image; |
|
|
|
|
import java.awt.RenderingHints; |
|
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
import java.awt.image.ImageObserver; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
|
|
|
|
|
@ -127,9 +132,15 @@ public class StartupPageWorkspacePanel extends JPanel {
|
|
|
|
|
this.contentPanel = generateUnLimitContentPanel(this.partitions); |
|
|
|
|
this.add(contentPanel, BorderLayout.NORTH); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JComponent generateUnLimitContentPanel(List<List<StartupWorkspaceBean>> partitions) { |
|
|
|
|
|
|
|
|
|
JComponent panel = generateUnLimitContentPanel0(partitions); |
|
|
|
|
ColorUtils.transparentBackground(panel); |
|
|
|
|
return panel; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JComponent generateUnLimitContentPanel0(List<List<StartupWorkspaceBean>> partitions) { |
|
|
|
|
|
|
|
|
|
JPanel workspaceDescWrapper = new JPanel(); |
|
|
|
|
workspaceDescWrapper.setLayout(new BorderLayout(0, 0)); |
|
|
|
|
workspaceDescWrapper.setBorder(new EmptyBorder(0, 0, 0, 0)); |
|
|
|
@ -144,14 +155,20 @@ public class StartupPageWorkspacePanel extends JPanel {
|
|
|
|
|
if (needScroll) { |
|
|
|
|
// 滚动条
|
|
|
|
|
UIScrollPane scrollPane = new UIScrollPane(workspaceDescPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
|
|
|
|
JViewport viewport = scrollPane.getViewport(); |
|
|
|
|
JViewport scrollViewport = new TransparentScrollViewPort(); |
|
|
|
|
// 动态画图
|
|
|
|
|
scrollViewport.addChangeListener(e -> repaintAll()); |
|
|
|
|
scrollViewport.setView(viewport.getView()); |
|
|
|
|
scrollPane.setViewport(scrollViewport); |
|
|
|
|
scrollPane.setBorder(new EmptyBorder(10, 0, 0, 0)); |
|
|
|
|
scrollPane.setPreferredSize(new Dimension(CONTENT_WIDTH, SCROLL_HEIGHT)); |
|
|
|
|
workspaceDescWrapper.add(scrollPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
return workspaceDescWrapper; |
|
|
|
|
} |
|
|
|
|
workspaceDescWrapper.add(workspaceDescPanel, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
ColorUtils.transparentBackground(workspaceDescWrapper); |
|
|
|
|
return workspaceDescWrapper; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -580,4 +597,27 @@ public class StartupPageWorkspacePanel extends JPanel {
|
|
|
|
|
|
|
|
|
|
this.getRootPane().repaint(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 支持透明的滚动视图 |
|
|
|
|
*/ |
|
|
|
|
private class TransparentScrollViewPort extends JViewport { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 从而屏蔽掉 {@link RepaintManager.PaintManager#paintDoubleBuffered(JComponent, Image, Graphics, int, int, int, int)} |
|
|
|
|
* |
|
|
|
|
* @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; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|