plough 8 years ago
parent
commit
dcca839903
  1. 44
      designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  2. 4
      designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java

44
designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -3,14 +3,6 @@
*/
package com.fr.design.designer.creator;
import java.awt.*;
import java.awt.event.ContainerEvent;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.beans.IntrospectionException;
import java.util.ArrayList;
import java.util.HashMap;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.LayoutAdapter;
@ -20,16 +12,26 @@ import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.form.layout.FRAbsoluteLayout;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.*;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormArea;
import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.Connector;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.WLayout;
import com.fr.general.FRScreen;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import java.awt.*;
import java.awt.event.ContainerEvent;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.beans.IntrospectionException;
import java.util.ArrayList;
import java.util.HashMap;
/**
* @author richer
* @since 6.5.3
@ -88,6 +90,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
/**
* 返回容器大小的百分比
*
* @return the containerPercent
*/
public double getContainerPercent() {
@ -96,6 +99,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
/**
* 设置容器大小的百分比
*
* @param containerPercent the containerPercent to set
*/
public void setContainerPercent(double containerPercent) {
@ -106,6 +110,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
/**
* 返回界面处根据百分比调整后的最小宽度
*
* @return 最小宽度
*/
public int getActualMinWidth() {
@ -114,6 +119,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
/**
* 返回界面处根据百分比调整后的最小高度
*
* @return 最小高度
*/
public int getActualMinHeight() {
@ -122,6 +128,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
/**
* 返回界面处根据百分比调整后的间隔大小且为偶数
*
* @return 间隔
*/
public int getAcualInterval() {
@ -164,7 +171,8 @@ public class XWAbsoluteLayout extends XLayoutContainer {
tabLayout.updateBoundsWidget();
}
}
BoundsWidget boundsWidget = (BoundsWidget) layout.getBoundsWidget(xCreator.toData()); Rectangle rectangle = dealWidgetBound(xCreator.getBounds());
BoundsWidget boundsWidget = (BoundsWidget) layout.getBoundsWidget(xCreator.toData());
Rectangle rectangle = dealWidgetBound(xCreator.getBounds());
}
private Rectangle calculateBound(Rectangle rec, double pw, double ph) {
@ -207,6 +215,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
* 更新子组件的Bound
* 这边主要用于绝对布局子组件在适应区域选项时
* 涉及到的不同分辨率下缩放
*
* @param minHeight 最小高度
*/
@Override
@ -231,6 +240,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
/**
* 增加对齐线
*
* @param connector 对齐线
*/
public void addConnector(Connector connector) {
@ -244,6 +254,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
/**
* 去除对齐线
*
* @param connector 对齐线
*/
public void removeConnector(Connector connector) {
@ -253,6 +264,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
/**
* 返回对应的widget容器
*
* @return 返回WAbsoluteLayout
*/
@Override
@ -267,6 +279,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
/**
* 返回默认的容器name
*
* @return 返回绝对布局容器名
*/
@Override
@ -324,6 +337,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
/**
* 当前组件zorder位置替换新的控件
*
* @param widget 控件
* @param oldcreator 旧组件
* @return 组件
@ -342,6 +356,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
/**
* 组件增加
*
* @param e 容器事件
*/
@Override
@ -359,6 +374,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
/**
* 在设计界面中有组件移除的时候需要通知WLayout容器重新paint
*
* @param e 容器事件
*/
@Override
@ -388,14 +404,14 @@ public class XWAbsoluteLayout extends XLayoutContainer {
XLayoutContainer xTopLayout = XCreatorUtils.getParentXLayoutContainer(this).getTopLayout();
if (xTopLayout != null && !xTopLayout.isEditable()) {
return xTopLayout;
}
else{
} else {
return this;
}
}
/**
* 得到属性名
*
* @return 属性名
* @throws java.beans.IntrospectionException
*/
@ -468,6 +484,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
/**
* body大小手动调整的时候
* 按照比例调整组件的宽度
*
* @param percent 比例
*/
@Override
@ -484,6 +501,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
/**
* body大小手动调整的时候
* 按照比例调整组件的高度
*
* @param percent 比例
*/
@Override

4
designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java

@ -133,8 +133,10 @@ public class FormSelectionUtils {
boolean xOut = x < 0 || x + copiedCreator.getWidth() / 2 + xoffset > container.getWidth();
boolean yOut = y < 0 || y + copiedCreator.getHeight() / 2 + yoffset > container.getHeight();
boolean isEdge = (x - DELAY_X_Y == container.getWidth() - copiedCreator.getWidth() / 2 - xoffset)
&& (y - DELAY_X_Y == container.getHeight() - copiedCreator.getHeight() / 2 - yoffset);
y = yOut ? container.getHeight() - copiedCreator.getHeight() / 2 - yoffset : y;
boolean isEdge = (x - DELAY_X_Y == container.getWidth() - copiedCreator.getWidth() / 2 - xoffset);
if (xOut) {
if (isEdge) {
//向左偏移

Loading…
Cancel
Save