Browse Source

Merge remote-tracking branch 'origin/final/11.0' into final/11.0

new-design
Destiny.Lin 2 years ago
parent
commit
7bb2af2bfb
  1. 62
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java
  2. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
  3. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
  4. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
  5. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties

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

@ -4,6 +4,7 @@ import com.fr.base.svg.IconUtils;
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.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.design.utils.ColorUtils;
@ -17,6 +18,8 @@ import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JToolTip; import javax.swing.JToolTip;
import javax.swing.JViewport;
import javax.swing.RepaintManager;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import java.awt.BasicStroke; import java.awt.BasicStroke;
@ -28,9 +31,11 @@ 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;
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.image.ImageObserver;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
@ -127,9 +132,15 @@ public class StartupPageWorkspacePanel extends JPanel {
this.contentPanel = generateUnLimitContentPanel(this.partitions); this.contentPanel = generateUnLimitContentPanel(this.partitions);
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);
ColorUtils.transparentBackground(panel);
return panel;
}
private JComponent generateUnLimitContentPanel0(List<List<StartupWorkspaceBean>> partitions) {
JPanel workspaceDescWrapper = new JPanel(); JPanel workspaceDescWrapper = new JPanel();
workspaceDescWrapper.setLayout(new BorderLayout(0, 0)); workspaceDescWrapper.setLayout(new BorderLayout(0, 0));
workspaceDescWrapper.setBorder(new EmptyBorder(0, 0, 0, 0)); workspaceDescWrapper.setBorder(new EmptyBorder(0, 0, 0, 0));
@ -142,16 +153,28 @@ public class StartupPageWorkspacePanel extends JPanel {
} }
boolean needScroll = partitions.size() > 4; boolean needScroll = partitions.size() > 4;
if (needScroll) { if (needScroll) {
// 滚动条 return generateScrollUnLimitContentPanel(workspaceDescWrapper, workspaceDescPanel);
UIScrollPane scrollPane = new UIScrollPane(workspaceDescPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
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); workspaceDescWrapper.add(workspaceDescPanel, BorderLayout.CENTER);
ColorUtils.transparentBackground(workspaceDescWrapper); return workspaceDescWrapper;
}
@NotNull
private JPanel generateScrollUnLimitContentPanel(JPanel workspaceDescWrapper, JPanel workspaceDescPanel) {
// 滚动条
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; return workspaceDescWrapper;
} }
@ -580,4 +603,27 @@ public class StartupPageWorkspacePanel extends JPanel {
this.getRootPane().repaint(); 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;
}
};
}
}
} }

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties

@ -15,6 +15,7 @@ com.fr.design.report.fit.firstColumn=120*20
com.fr.design.report.fit.column=160*20 com.fr.design.report.fit.column=160*20
com.fr.design.lock.LockInfoDialog=500*180 com.fr.design.lock.LockInfoDialog=500*180
com.fr.design.mainframe.ForbiddenPane.refreshButton=75*24 com.fr.design.mainframe.ForbiddenPane.refreshButton=75*24
com.fr.start.common.DesignerOpenEmptyPanel.createButton=120*24
com.fr.design.cell.expand.sort.pane=257*185 com.fr.design.cell.expand.sort.pane=257*185
com.fr.design.sort.rule.item=125*20 com.fr.design.sort.rule.item=125*20
com.fr.design.ds.column.sort.pane=250*180 com.fr.design.ds.column.sort.pane=250*180

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties

@ -14,6 +14,7 @@ com.fr.design.report.fit.firstColumn=170*20
com.fr.design.report.fit.column=100*20 com.fr.design.report.fit.column=100*20
com.fr.design.lock.LockInfoDialog=500*180 com.fr.design.lock.LockInfoDialog=500*180
com.fr.design.mainframe.ForbiddenPane.refreshButton=68*24 com.fr.design.mainframe.ForbiddenPane.refreshButton=68*24
com.fr.start.common.DesignerOpenEmptyPanel.createButton=120*24
com.fr.design.cell.expand.sort.pane=257*170 com.fr.design.cell.expand.sort.pane=257*170
com.fr.design.sort.rule.item=125*20 com.fr.design.sort.rule.item=125*20
com.fr.design.ds.column.sort.pane=250*165 com.fr.design.ds.column.sort.pane=250*165

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties

@ -14,6 +14,7 @@ com.fr.design.report.fit.firstColumn=130*20
com.fr.design.report.fit.column=100*20 com.fr.design.report.fit.column=100*20
com.fr.design.lock.LockInfoDialog=500*180 com.fr.design.lock.LockInfoDialog=500*180
com.fr.design.mainframe.ForbiddenPane.refreshButton=80*24 com.fr.design.mainframe.ForbiddenPane.refreshButton=80*24
com.fr.start.common.DesignerOpenEmptyPanel.createButton=70*24
com.fr.design.cell.expand.sort.pane=267*165 com.fr.design.cell.expand.sort.pane=267*165
com.fr.design.sort.rule.item=125*20 com.fr.design.sort.rule.item=125*20
com.fr.design.ds.column.sort.pane=250*180 com.fr.design.ds.column.sort.pane=250*180

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties

@ -14,6 +14,7 @@ com.fr.design.report.fit.firstColumn=80*20
com.fr.design.report.fit.column=100*20 com.fr.design.report.fit.column=100*20
com.fr.design.lock.LockInfoDialog=400*180 com.fr.design.lock.LockInfoDialog=400*180
com.fr.design.mainframe.ForbiddenPane.refreshButton=68*24 com.fr.design.mainframe.ForbiddenPane.refreshButton=68*24
com.fr.start.common.DesignerOpenEmptyPanel.createButton=70*24
com.fr.design.cell.expand.sort.pane=227*155 com.fr.design.cell.expand.sort.pane=227*155
com.fr.design.sort.rule.item=80*20 com.fr.design.sort.rule.item=80*20
com.fr.design.ds.column.sort.pane=220*150 com.fr.design.ds.column.sort.pane=220*150

Loading…
Cancel
Save