|
|
|
@ -13,11 +13,9 @@ import com.fr.design.file.HistoryTemplateListCache;
|
|
|
|
|
import com.fr.design.gui.itree.UITreeUI; |
|
|
|
|
import com.fr.design.utils.ComponentUtils; |
|
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
import java.awt.Rectangle; |
|
|
|
|
import java.awt.event.MouseListener; |
|
|
|
|
import java.util.Stack; |
|
|
|
|
import java.util.function.Consumer; |
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
@ -387,7 +385,7 @@ public class ComponentTree extends JTree {
|
|
|
|
|
@Override |
|
|
|
|
public void accept(XCreator creator) { |
|
|
|
|
if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1 && !designer.isFormParaDesigner()) { |
|
|
|
|
startEditing(creator, e); |
|
|
|
|
startEditing(creator); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -455,18 +453,11 @@ public class ComponentTree extends JTree {
|
|
|
|
|
* 组件进入编辑状态 |
|
|
|
|
* |
|
|
|
|
* @param comp |
|
|
|
|
* @param e |
|
|
|
|
*/ |
|
|
|
|
private void startEditing(XCreator comp, MouseEvent e) { |
|
|
|
|
private void startEditing(XCreator comp) { |
|
|
|
|
designer.getSelectionModel().selectACreator(comp); |
|
|
|
|
Rectangle rectangle = getRelativeBounds(comp); |
|
|
|
|
int x = rectangle.x + rectangle.width / 2; |
|
|
|
|
int y = rectangle.y + rectangle.height / 2; |
|
|
|
|
XCreator creator = comp.getEditingChildCreator(); |
|
|
|
|
MouseListener[] listeners = designer.getMouseListeners(); |
|
|
|
|
if (ArrayUtils.isNotEmpty(listeners) && listeners[0] instanceof EditingMouseListener) { |
|
|
|
|
responseClickAll(creator, (EditingMouseListener) listeners[0], new MouseEvent(creator, MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), x, y, e.getClickCount(), false)); |
|
|
|
|
} |
|
|
|
|
responseEditing(creator); |
|
|
|
|
// 放到事件尾部执行
|
|
|
|
|
SwingUtilities.invokeLater(new Runnable() { |
|
|
|
|
@Override |
|
|
|
@ -488,10 +479,8 @@ public class ComponentTree extends JTree {
|
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param creator |
|
|
|
|
* @param editingMouseListener |
|
|
|
|
* @param mouseEvent |
|
|
|
|
*/ |
|
|
|
|
public void responseClickAll(XCreator creator, EditingMouseListener editingMouseListener, MouseEvent mouseEvent) { |
|
|
|
|
private void responseEditing(XCreator creator) { |
|
|
|
|
Stack<XCreator> stack = new Stack<>(); |
|
|
|
|
stack.push(creator); |
|
|
|
|
while (creator.getParent() instanceof XCreator) { |
|
|
|
@ -499,7 +488,7 @@ public class ComponentTree extends JTree {
|
|
|
|
|
stack.push(creator); |
|
|
|
|
} |
|
|
|
|
while (!stack.isEmpty()) { |
|
|
|
|
stack.pop().respondClick(editingMouseListener, mouseEvent); |
|
|
|
|
stack.pop().startEditing(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|