|
|
@ -5,9 +5,6 @@ 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.XElementCase; |
|
|
|
import com.fr.design.designer.creator.XElementCase; |
|
|
|
import com.fr.design.designer.creator.XLayoutContainer; |
|
|
|
import com.fr.design.designer.creator.XLayoutContainer; |
|
|
|
import com.fr.design.designer.creator.XWParameterLayout; |
|
|
|
|
|
|
|
import com.fr.design.form.parameter.FormParaDesigner; |
|
|
|
|
|
|
|
import com.fr.design.form.util.FormDesignerUtils; |
|
|
|
|
|
|
|
import com.fr.design.utils.ComponentUtils; |
|
|
|
import com.fr.design.utils.ComponentUtils; |
|
|
|
import com.fr.stable.Constants; |
|
|
|
import com.fr.stable.Constants; |
|
|
|
import com.fr.stable.GraphDrawHelper; |
|
|
|
import com.fr.stable.GraphDrawHelper; |
|
|
@ -48,6 +45,10 @@ public class FormSpacingLineDrawer { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void draw(Graphics g) { |
|
|
|
public void draw(Graphics g) { |
|
|
|
|
|
|
|
if (!isMouseMoveEvent) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!isDrawSpacingLine()) { |
|
|
|
if (!isDrawSpacingLine()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -136,55 +137,13 @@ public class FormSpacingLineDrawer { |
|
|
|
GraphDrawHelper.drawString(g2d, text, labelX, labelY); |
|
|
|
GraphDrawHelper.drawString(g2d, text, labelX, labelY); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isSelectedParaComponent() { |
|
|
|
|
|
|
|
return designer.getParaComponent() == designer.getSelectionModel().getSelection().getSelectedCreator(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isSelectedRootComponent() { |
|
|
|
|
|
|
|
return designer.isRoot(designer.getSelectionModel().getSelection().getSelectedCreator()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isSelectedForm() { |
|
|
|
|
|
|
|
return designer.getSelectionModel().getSelection().getSelectedCreator().getParent() == null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isNeedExtendedLine(AbstractFormParallelLine[] nearestSides) { |
|
|
|
private boolean isNeedExtendedLine(AbstractFormParallelLine[] nearestSides) { |
|
|
|
return nearestSides[0].isVerticalCenterLineBeforeTheParallelLine(nearestSides[1]) || nearestSides[0].isVerticalCenterLineBehindTheParallelLine(nearestSides[1]); |
|
|
|
return nearestSides[0].isVerticalCenterLineBeforeTheParallelLine(nearestSides[1]) || nearestSides[0].isVerticalCenterLineBehindTheParallelLine(nearestSides[1]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isSelectedRootPane() { |
|
|
|
|
|
|
|
// form、body、para这三个选中了,都不要画任何间距线
|
|
|
|
|
|
|
|
return isSelectedForm() || isSelectedRootComponent() || isSelectedParaComponent(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当前组件是否在参数面板里面
|
|
|
|
|
|
|
|
private boolean isCompInPara(XCreator creator) { |
|
|
|
|
|
|
|
XLayoutContainer container = XCreatorUtils.getHotspotContainer(creator); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean xCreatorAccept = creator.acceptType(XWParameterLayout.class); |
|
|
|
|
|
|
|
boolean containerAccept = container != null && container.acceptType(XWParameterLayout.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return xCreatorAccept || containerAccept; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isBodyAbsoluteLayout() { |
|
|
|
|
|
|
|
return !(designer instanceof FormParaDesigner) && FormDesignerUtils.isBodyAbsolute(designer); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isSelectedCompInPara() { |
|
|
|
|
|
|
|
return isCompInPara(designer.getSelectionModel().getSelection().getSelectedCreator()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isHoveredCompInPara() { |
|
|
|
|
|
|
|
return isCompInPara(hoverCreator); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isSelectedCompOrHoveredCompInPara() { |
|
|
|
|
|
|
|
return isSelectedCompInPara() || isHoveredCompInPara(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isDrawSpacingLine() { |
|
|
|
private boolean isDrawSpacingLine() { |
|
|
|
return isBodyAbsoluteLayout() && !isSelectedRootPane() && hoverCreator != null && !isSelectedCompOrHoveredCompInPara() && isMouseMoveEvent; |
|
|
|
XCreator selectedCreator = designer.getSelectionModel().getSelection().getSelectedCreator(); |
|
|
|
|
|
|
|
return hoverCreator != null && selectedCreator != null && hoverCreator.isAbleDrawSpacingLine() && selectedCreator.isAbleDrawSpacingLine(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private AbstractFormParallelLine[] getNearestHorizontalSide() { |
|
|
|
private AbstractFormParallelLine[] getNearestHorizontalSide() { |
|
|
|