Browse Source

REPORT-55188 【组件背景分离】组件复用-设计器右侧组件目录树选中组件应也触发绝对布局下组件的工具栏

zheng-1641779399395
hades 3 years ago
parent
commit
428e1e63b1
  1. 13
      designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java

13
designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java

@ -4,6 +4,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer; 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.ComponentTreeCellRenderer;
import com.fr.design.designer.treeview.ComponentTreeModel; import com.fr.design.designer.treeview.ComponentTreeModel;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
@ -378,8 +379,6 @@ public class ComponentTree extends JTree {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
// 鼠标左键 双击
if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1 && !designer.isFormParaDesigner()) {
Point p = e.getPoint(); Point p = e.getPoint();
// 解析组件树路径 获取选中的组件 // 解析组件树路径 获取选中的组件
int selRow = tree.getRowForLocation(p.x, p.y); int selRow = tree.getRowForLocation(p.x, p.y);
@ -389,11 +388,21 @@ public class ComponentTree extends JTree {
Point point = bounds.getLocation(); Point point = bounds.getLocation();
SwingUtilities.convertPointToScreen(point, tree); SwingUtilities.convertPointToScreen(point, tree);
XCreator comp = (XCreator) path.getLastPathComponent(); XCreator comp = (XCreator) path.getLastPathComponent();
// 鼠标左键 双击
if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1 && !designer.isFormParaDesigner()) {
startEditing(comp, e); 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);
}
/** /**
* 组件进入编辑状态 * 组件进入编辑状态
* *

Loading…
Cancel
Save