Browse Source

无JIRA任务 PMD

master
zack 8 years ago
parent
commit
a848d5736e
  1. 25
      designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java

25
designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -56,15 +56,11 @@ public class FormCreatorDropTarget extends DropTarget {
private void adding(int x, int y) {
// 当前鼠标所在的组件
XCreator hoveredComponent = designer.getComponentAt(x, y);
// 获取该组件所在的焦点容器
XLayoutContainer container = XCreatorUtils.getHotspotContainer(hoveredComponent);
//cardTagLayout里用到
container.stopAddingState(designer);
boolean success = false;
if (container != null) {
// 如果是容器,则调用其acceptComponent接受组件
AddingModel model = designer.getAddingModel();
@ -77,7 +73,6 @@ public class FormCreatorDropTarget extends DropTarget {
}
cancelPromptWidgetForbidEnter();
}
if (success) {
// 如果添加成功,则触发相应事件
XCreator xCreator = container.acceptType(XWParameterLayout.class) ? designer.getParaComponent() : designer.getRootComponent();
@ -101,7 +96,6 @@ public class FormCreatorDropTarget extends DropTarget {
} else {
Toolkit.getDefaultToolkit().beep();
}
// 取消提示
designer.setPainter(null);
// 切换添加状态到普通状态
@ -132,6 +126,18 @@ public class FormCreatorDropTarget extends DropTarget {
//提示组件是否可以拖入
promptUser(x, y, container);
if (container != null) {
dealWithContainer(x, y, container);
} else {
// 如果鼠标不在任何组件上,则取消提示器
designer.setPainter(null);
current = null;
}
designer.repaint();
}
private void dealWithContainer(int x, int y, XLayoutContainer container) {
HoverPainter painter = null;
if (container != current || designer.getPainter() == null) {
@ -163,7 +169,6 @@ public class FormCreatorDropTarget extends DropTarget {
painter = (HoverPainter) p;
}
}
if (painter != null) {
// 为提示渲染器设置焦点位置、区域等渲染参数
Rectangle rect = ComponentUtils.getRelativeBounds(container);
@ -173,12 +178,6 @@ public class FormCreatorDropTarget extends DropTarget {
painter.setHotspot(new Point(x, y));
painter.setCreator(addingModel.getXCreator());
}
} else {
// 如果鼠标不在任何组件上,则取消提示器
designer.setPainter(null);
current = null;
}
designer.repaint();
}
private void promptUser(int x, int y, XLayoutContainer container) {

Loading…
Cancel
Save