|
|
|
@ -1,13 +1,15 @@
|
|
|
|
|
package com.fr.design.mainframe.guide.scene; |
|
|
|
|
|
|
|
|
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
|
|
|
|
import com.fr.design.mainframe.guide.base.GuideManager; |
|
|
|
|
|
|
|
|
|
import javax.swing.AbstractButton; |
|
|
|
|
import javax.swing.ButtonModel; |
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.awt.Point; |
|
|
|
|
import java.awt.Rectangle; |
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
|
|
|
|
@ -58,50 +60,61 @@ public class ClickScene extends AbstractGuideScene{
|
|
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
|
if (e.getButton() == MouseEvent.BUTTON1) { |
|
|
|
|
if ((e.getClickCount() == 1 && clickType == ClickType.LEFT) || (e.getClickCount() == 2 && clickType == ClickType.LEFT_DOUBLE)) { |
|
|
|
|
if (isDispatch) { |
|
|
|
|
redispatchMouseEvent(e, target); |
|
|
|
|
} |
|
|
|
|
complete(); |
|
|
|
|
dealWithDispatchLeftClick(target, e, isDispatch); |
|
|
|
|
} |
|
|
|
|
} else if (e.getButton() == MouseEvent.BUTTON3 && clickType == ClickType.RIGHT) { |
|
|
|
|
clear(); |
|
|
|
|
SwingUtilities.invokeLater(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
if (isDispatch) { |
|
|
|
|
redispatchMouseEvent(e, target); |
|
|
|
|
} |
|
|
|
|
complete(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
|
|
if (isDispatch) { |
|
|
|
|
if (target instanceof AbstractButton) { |
|
|
|
|
AbstractButton b = (AbstractButton) target; |
|
|
|
|
b.setFocusable(false); |
|
|
|
|
} |
|
|
|
|
redispatchMouseEvent(e, target); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void mouseReleased(MouseEvent e) { |
|
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
|
|
if ((target instanceof AbstractButton) && (target.getParent() instanceof UIButtonGroup)) { |
|
|
|
|
if (isDispatch) { |
|
|
|
|
redispatchMouseEvent(e, target); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void mouseEntered(MouseEvent e) { |
|
|
|
|
if (isDispatch) { |
|
|
|
|
redispatchMouseEvent(e, target); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void dealWithDispatchLeftClick(Component target, MouseEvent e, boolean isDispatch) { |
|
|
|
|
clear(); |
|
|
|
|
SwingUtilities.invokeLater(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void mouseExited(MouseEvent e) { |
|
|
|
|
public void run() { |
|
|
|
|
if (isDispatch) { |
|
|
|
|
if (target instanceof AbstractButton) { |
|
|
|
|
AbstractButton button = (AbstractButton) target; |
|
|
|
|
ActionListener[] actionListeners= button.getActionListeners(); |
|
|
|
|
for(int i = 0; i < actionListeners.length; i++) { |
|
|
|
|
ActionListener actionListener = actionListeners[i]; |
|
|
|
|
actionListener.actionPerformed(new ActionEvent( |
|
|
|
|
button, |
|
|
|
|
ActionEvent.ACTION_PERFORMED, |
|
|
|
|
button.getActionCommand(), |
|
|
|
|
e.getWhen(), |
|
|
|
|
e.getModifiers() |
|
|
|
|
)); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
redispatchMouseEvent(e, target); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
complete(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -114,7 +127,7 @@ public class ClickScene extends AbstractGuideScene{
|
|
|
|
|
@Override |
|
|
|
|
public void showScene() { |
|
|
|
|
// 交互类的 scene 如果没有高亮内容块载,需要及时终止Guide,否则就没法去掉模态框影响到设计器主功能的使用了
|
|
|
|
|
if (this.getComponentCount() == 0) { |
|
|
|
|
if (this.getComponentCount() == 0 && getHighlightList().isEmpty()) { |
|
|
|
|
GuideManager.getInstance().getCurrentGuide().terminate(); |
|
|
|
|
} else { |
|
|
|
|
super.showScene(); |
|
|
|
|