Browse Source

REPORT-78647【运营产品化二期】单模板目前点击立即使用未下载

1、修改pr
feature/x
Link.Zhao 2 years ago
parent
commit
8d72ca0892
  1. 38
      designer-base/src/main/java/com/fr/design/mainframe/toast/SimpleToast.java

38
designer-base/src/main/java/com/fr/design/mainframe/toast/SimpleToast.java

@ -27,8 +27,8 @@ public class SimpleToast extends UIDialog {
private static final TimeUnit DEFAULT_TIME_UNIT = TimeUnit.MILLISECONDS; private static final TimeUnit DEFAULT_TIME_UNIT = TimeUnit.MILLISECONDS;
private ScheduledExecutorService TIMER; private ScheduledExecutorService timer;
private int hide_height = 0; private int hideHeight = 0;
private JPanel contentPane; private JPanel contentPane;
private boolean show = false; private boolean show = false;
private Window parent; private Window parent;
@ -72,7 +72,7 @@ public class SimpleToast extends UIDialog {
this.getContentPane().setLayout(null); this.getContentPane().setLayout(null);
this.getContentPane().add(contentPane); this.getContentPane().add(contentPane);
Dimension dimension = calculatePreferSize(); Dimension dimension = calculatePreferSize();
hide_height = dimension.height; hideHeight = dimension.height;
setSize(new Dimension(dimension.width, 0)); setSize(new Dimension(dimension.width, 0));
contentPane.setSize(dimension); contentPane.setSize(dimension);
setRelativeLocation(dimension); setRelativeLocation(dimension);
@ -94,19 +94,19 @@ public class SimpleToast extends UIDialog {
} }
public void display(JPanel outerJPanel) { public void display(JPanel outerPanel) {
show = true; show = true;
outerJPanel.setLocation(0, -hide_height); outerPanel.setLocation(0, -hideHeight);
ScheduledExecutorService TIP_TOOL_TIMER = createToastScheduleExecutorService(); ScheduledExecutorService tipToolTimer = createToastScheduleExecutorService();
TIP_TOOL_TIMER.scheduleAtFixedRate(new Runnable() { tipToolTimer.scheduleAtFixedRate(new Runnable() {
@Override @Override
public void run() { public void run() {
Point point = outerJPanel.getLocation(); Point point = outerPanel.getLocation();
if (point.y >= 0) { if (point.y >= 0 && !tipToolTimer.isShutdown()) {
TIP_TOOL_TIMER.shutdown(); tipToolTimer.shutdown();
} }
int showDistance = 5 + point.y < 0 ? 5 : -point.y; int showDistance = 5 + point.y < 0 ? 5 : -point.y;
outerJPanel.setLocation(point.x, point.y + showDistance); outerPanel.setLocation(point.x, point.y + showDistance);
Dimension dimension = SimpleToast.this.getSize(); Dimension dimension = SimpleToast.this.getSize();
SimpleToast.this.setSize(new Dimension(dimension.width, dimension.height + showDistance)); SimpleToast.this.setSize(new Dimension(dimension.width, dimension.height + showDistance));
} }
@ -115,8 +115,8 @@ public class SimpleToast extends UIDialog {
} }
private void disappear(JPanel outerJPanel, long delay, TimeUnit timeUnit) { private void disappear(JPanel outerJPanel, long delay, TimeUnit timeUnit) {
TIMER = createToastScheduleExecutorService(); timer = createToastScheduleExecutorService();
TIMER.schedule(new DisappearMotion(outerJPanel), delay, timeUnit); timer.schedule(new DisappearMotion(outerJPanel), delay, timeUnit);
} }
/** /**
@ -131,13 +131,13 @@ public class SimpleToast extends UIDialog {
@Override @Override
public void run() { public void run() {
ScheduledExecutorService TIP_TOOL_TIMER = createToastScheduleExecutorService(); ScheduledExecutorService tipToolTimer = createToastScheduleExecutorService();
TIP_TOOL_TIMER.scheduleAtFixedRate(new Runnable() { tipToolTimer.scheduleAtFixedRate(new Runnable() {
@Override @Override
public void run() { public void run() {
Point point = panel.getLocation(); Point point = panel.getLocation();
if (point.y <= -hide_height) { if (point.y <= -hideHeight && !tipToolTimer.isShutdown()) {
TIP_TOOL_TIMER.shutdown(); tipToolTimer.shutdown();
SimpleToast.this.setVisible(false); SimpleToast.this.setVisible(false);
SimpleToast.this.dispose(); SimpleToast.this.dispose();
SimpleToast.this.show = false; SimpleToast.this.show = false;
@ -151,8 +151,8 @@ public class SimpleToast extends UIDialog {
} }
private void disappear(JPanel outerJPanel) { private void disappear(JPanel outerPanel) {
disappear(outerJPanel, DEFAULT_DISAPPEAR_DELAY, DEFAULT_TIME_UNIT); disappear(outerPanel, DEFAULT_DISAPPEAR_DELAY, DEFAULT_TIME_UNIT);
} }
private ScheduledExecutorService createToastScheduleExecutorService() { private ScheduledExecutorService createToastScheduleExecutorService() {

Loading…
Cancel
Save