|
|
@ -5,17 +5,15 @@ import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.guide.scene.AbstractGuideScene; |
|
|
|
import com.fr.design.mainframe.guide.scene.AbstractGuideScene; |
|
|
|
import com.fr.design.mainframe.guide.scene.GuideScene; |
|
|
|
import com.fr.design.mainframe.guide.scene.GuideScene; |
|
|
|
import com.fr.design.mainframe.guide.ui.GuideLoadingGlassPane; |
|
|
|
import com.fr.design.mainframe.guide.ui.GuideLoadingGlassPane; |
|
|
|
|
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.JDialog; |
|
|
|
import javax.swing.JDialog; |
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Graphics; |
|
|
|
import java.awt.Graphics; |
|
|
|
import java.awt.Window; |
|
|
|
import java.awt.Window; |
|
|
|
import java.awt.event.ComponentAdapter; |
|
|
|
import java.awt.event.WindowAdapter; |
|
|
|
import java.awt.event.ComponentEvent; |
|
|
|
|
|
|
|
import java.awt.event.ComponentListener; |
|
|
|
|
|
|
|
import java.awt.event.WindowEvent; |
|
|
|
import java.awt.event.WindowEvent; |
|
|
|
import java.awt.event.WindowFocusListener; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class GuideView extends JDialog { |
|
|
|
public class GuideView extends JDialog { |
|
|
|
private static GuideView guideView; |
|
|
|
private static GuideView guideView; |
|
|
@ -43,32 +41,19 @@ public class GuideView extends JDialog { |
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
setBg(); |
|
|
|
setBg(); |
|
|
|
this.setGlassPane(new GuideLoadingGlassPane()); |
|
|
|
this.setGlassPane(new GuideLoadingGlassPane()); |
|
|
|
} |
|
|
|
DesignerContext.getDesignerFrame().addWindowListener(new WindowAdapter() { |
|
|
|
|
|
|
|
|
|
|
|
private WindowFocusListener windowFocusListener = new WindowFocusListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void windowGainedFocus(WindowEvent e) { |
|
|
|
|
|
|
|
requestFocus(); |
|
|
|
|
|
|
|
setLocationRelativeTo(window); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void windowLostFocus(WindowEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ComponentListener componentListener = new ComponentAdapter() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void componentResized(ComponentEvent e) { |
|
|
|
|
|
|
|
setLocationRelativeTo(window); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void componentMoved(ComponentEvent e) { |
|
|
|
public void windowDeiconified(WindowEvent e) { |
|
|
|
setLocation(window.getLocation()); |
|
|
|
if (isVisible()) { |
|
|
|
} |
|
|
|
updateGuideViewLocation(); |
|
|
|
}; |
|
|
|
// window 带透明的dialog在窗口最小化后再打开会不渲染,这边试了下重新设置visible可行
|
|
|
|
|
|
|
|
setVisible(false); |
|
|
|
|
|
|
|
setVisible(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public GuideView(Window window, Guide guide) { |
|
|
|
public GuideView(Window window, Guide guide) { |
|
|
|
this(window); |
|
|
|
this(window); |
|
|
@ -98,11 +83,7 @@ public class GuideView extends JDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void showGuide() { |
|
|
|
public void showGuide() { |
|
|
|
window.addComponentListener(componentListener); |
|
|
|
updateGuideViewLocation(); |
|
|
|
window.addWindowFocusListener(windowFocusListener); |
|
|
|
|
|
|
|
this.setLocationRelativeTo(window); |
|
|
|
|
|
|
|
this.setSize(window.getSize()); |
|
|
|
|
|
|
|
this.setLocation(window.getLocation()); |
|
|
|
|
|
|
|
this.setVisible(true); |
|
|
|
this.setVisible(true); |
|
|
|
if (scene != null) { |
|
|
|
if (scene != null) { |
|
|
|
scene.start(); |
|
|
|
scene.start(); |
|
|
@ -112,8 +93,6 @@ public class GuideView extends JDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void dismissGuide() { |
|
|
|
public void dismissGuide() { |
|
|
|
window.removeComponentListener(componentListener); |
|
|
|
|
|
|
|
window.removeWindowFocusListener(windowFocusListener); |
|
|
|
|
|
|
|
this.getLayeredPane().removeAll(); |
|
|
|
this.getLayeredPane().removeAll(); |
|
|
|
revalidate(); |
|
|
|
revalidate(); |
|
|
|
repaint(); |
|
|
|
repaint(); |
|
|
@ -127,6 +106,7 @@ public class GuideView extends JDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void showLoading() { |
|
|
|
public void showLoading() { |
|
|
|
|
|
|
|
updateGuideViewLocation(); |
|
|
|
this.setVisible(true); |
|
|
|
this.setVisible(true); |
|
|
|
this.getGlassPane().setVisible(true); |
|
|
|
this.getGlassPane().setVisible(true); |
|
|
|
} |
|
|
|
} |
|
|
@ -141,4 +121,9 @@ public class GuideView extends JDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void updateGuideViewLocation() { |
|
|
|
|
|
|
|
GUICoreUtils.centerWindow(window, this); |
|
|
|
|
|
|
|
this.setSize(getSize()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|