|
|
|
@ -4,6 +4,7 @@ import com.fr.design.constants.UIConstants;
|
|
|
|
|
import com.fr.design.designer.creator.XCreator; |
|
|
|
|
import com.fr.design.designer.creator.XCreatorUtils; |
|
|
|
|
import com.fr.design.designer.creator.XLayoutContainer; |
|
|
|
|
import com.fr.design.designer.creator.XWTitleLayout; |
|
|
|
|
import com.fr.design.designer.treeview.ComponentTreeCellRenderer; |
|
|
|
|
import com.fr.design.designer.treeview.ComponentTreeModel; |
|
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
@ -378,22 +379,30 @@ public class ComponentTree extends JTree {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
|
// 鼠标左键 双击
|
|
|
|
|
if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1 && !designer.isFormParaDesigner()) { |
|
|
|
|
Point p = e.getPoint(); |
|
|
|
|
// 解析组件树路径 获取选中的组件
|
|
|
|
|
int selRow = tree.getRowForLocation(p.x, p.y); |
|
|
|
|
TreePath path = tree.getPathForRow(selRow); |
|
|
|
|
Rectangle bounds = tree.getPathBounds(path); |
|
|
|
|
if (bounds != null) { |
|
|
|
|
Point point = bounds.getLocation(); |
|
|
|
|
SwingUtilities.convertPointToScreen(point, tree); |
|
|
|
|
XCreator comp = (XCreator) path.getLastPathComponent(); |
|
|
|
|
Point p = e.getPoint(); |
|
|
|
|
// 解析组件树路径 获取选中的组件
|
|
|
|
|
int selRow = tree.getRowForLocation(p.x, p.y); |
|
|
|
|
TreePath path = tree.getPathForRow(selRow); |
|
|
|
|
Rectangle bounds = tree.getPathBounds(path); |
|
|
|
|
if (bounds != null) { |
|
|
|
|
Point point = bounds.getLocation(); |
|
|
|
|
SwingUtilities.convertPointToScreen(point, tree); |
|
|
|
|
XCreator comp = (XCreator) path.getLastPathComponent(); |
|
|
|
|
// 鼠标左键 双击
|
|
|
|
|
if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1 && !designer.isFormParaDesigner()) { |
|
|
|
|
startEditing(comp, e); |
|
|
|
|
} else if (e.getClickCount() == 1 && e.getButton() == MouseEvent.BUTTON1) { |
|
|
|
|
showSelectedPopup(comp); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void showSelectedPopup(XCreator comp) { |
|
|
|
|
Rectangle rectangle = getRelativeBounds(comp); |
|
|
|
|
comp.showSelectedPopup(designer, rectangle, comp.acceptType(XWTitleLayout.class)); |
|
|
|
|
comp.setSelected(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 组件进入编辑状态 |
|
|
|
|
* |
|
|
|
|