Browse Source

无任务 代码调整

master
yaoh.wu 8 years ago
parent
commit
2715c3c598
  1. 8
      designer_base/src/com/fr/design/actions/edit/CopyAction.java
  2. 2
      designer_base/src/com/fr/design/beans/location/MoveUtils.java
  3. 73
      designer_base/src/com/fr/design/parameter/ParameterDesignerProvider.java
  4. 11
      designer_base/src/com/fr/design/utils/ComponentUtils.java
  5. 11
      designer_form/src/com/fr/design/designer/beans/actions/CopyAction.java
  6. 6
      designer_form/src/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java
  7. 28
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  8. 42
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  9. 3
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java
  10. 67
      designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java
  11. 80
      designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java
  12. 12
      designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
  13. 85
      designer_form/src/com/fr/design/mainframe/EditingMouseListener.java
  14. 21
      designer_form/src/com/fr/design/mainframe/FormDesigner.java
  15. 6
      designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java
  16. 1
      designer_form/src/com/fr/design/mainframe/JForm.java
  17. 3
      designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java

8
designer_base/src/com/fr/design/actions/edit/CopyAction.java

@ -3,15 +3,14 @@
*/
package com.fr.design.actions.edit;
import java.awt.event.KeyEvent;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.designer.TargetComponent;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.event.KeyEvent;
/**
* Copy.
*/
@ -31,7 +30,6 @@ public class CopyAction extends TemplateComponentAction {
if (tc != null) {
tc.copy();
}
return false;
}
}

2
designer_base/src/com/fr/design/beans/location/MoveUtils.java

@ -18,7 +18,7 @@ public class MoveUtils {
public static final int SORPTION_UNIT = 5;
private static final int EQUIDISTANTLINE_UNIT = 4;
public static ArrayList<EquidistantLine> equidistantLines = new ArrayList<>();
private static ArrayList<EquidistantLine> equidistantLines = new ArrayList<>();
private MoveUtils() {

73
designer_base/src/com/fr/design/parameter/ParameterDesignerProvider.java

@ -1 +1,72 @@
package com.fr.design.parameter; import com.fr.base.Parameter; import com.fr.base.parameter.ParameterUI; import com.fr.design.mainframe.AuthorityEditPane; import javax.swing.*; import java.awt.*; /** * 参数设计界面接口 */ public interface ParameterDesignerProvider { void addListener(ParaDefinitePane paraDefinitePane); Component createWrapper(); void setDesignHeight(int height); Dimension getDesignSize(); Dimension getPreferredSize(); void populate(ParameterUI p); void refreshAllNameWidgets(); void refresh4TableData(String oldName, String newName); void refreshParameter(ParaDefinitePane paraDefinitePane); boolean isWithQueryButton(); java.util.List<String> getAllXCreatorNameList(); boolean isWithoutParaXCreator(Parameter[] ps); boolean isBlank(); ParameterUI getParaTarget(); boolean addingParameter2Editor(Parameter parameter, int index); boolean addingParameter2EditorWithQueryButton(Parameter parameter, int index); void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex); JPanel[] toolbarPanes4Form(); JComponent[] toolBarButton4Form(); void initBeforeUpEdit(); void populateParameterPropertyPane(ParaDefinitePane p); void initWidgetToolbarPane(); AuthorityEditPane getAuthorityEditPane(); JPanel getEastUpPane(); JPanel getEastDownPane(); boolean isSupportAuthority(); void removeSelection(); ParameterBridge getParaComponent(); }
package com.fr.design.parameter;
import com.fr.base.Parameter;
import com.fr.base.parameter.ParameterUI;
import com.fr.design.mainframe.AuthorityEditPane;
import javax.swing.*;
import java.awt.*;
/**
* 参数设计界面接口
*/
public interface ParameterDesignerProvider {
void addListener(ParaDefinitePane paraDefinitePane);
Component createWrapper();
void setDesignHeight(int height);
Dimension getDesignSize();
Dimension getPreferredSize();
void populate(ParameterUI p);
void refreshAllNameWidgets();
void refresh4TableData(String oldName, String newName);
void refreshParameter(ParaDefinitePane paraDefinitePane);
boolean isWithQueryButton();
java.util.List<String> getAllXCreatorNameList();
boolean isWithoutParaXCreator(Parameter[] ps);
boolean isBlank();
ParameterUI getParaTarget();
boolean addingParameter2Editor(Parameter parameter, int index);
boolean addingParameter2EditorWithQueryButton(Parameter parameter, int index);
void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex);
JPanel[] toolbarPanes4Form();
JComponent[] toolBarButton4Form();
void initBeforeUpEdit();
void populateParameterPropertyPane(ParaDefinitePane p);
void initWidgetToolbarPane();
AuthorityEditPane getAuthorityEditPane();
JPanel getEastUpPane();
JPanel getEastDownPane();
boolean isSupportAuthority();
void removeSelection();
ParameterBridge getParaComponent();
}

11
designer_base/src/com/fr/design/utils/ComponentUtils.java

@ -12,6 +12,9 @@ import java.util.ArrayList;
*/
public class ComponentUtils {
private ComponentUtils() {
}
public static boolean isComponentVisible(Component comp) {
if (!comp.isVisible() && !isRootComponent(comp)) {
return false;
@ -79,7 +82,7 @@ public class ComponentUtils {
for (int i = 0; i < count; i++) {
Component child = container.getComponent(i);
if (child == target) {
if (child.equals(target)) {
return i;
}
}
@ -105,10 +108,10 @@ public class ComponentUtils {
* 计算组件root相对于其顶层容器的可见区域
*/
public static Rectangle computeVisibleRect(JComponent root) {
Rectangle root_bounds = ComponentUtils.getRelativeBounds(root);
Rectangle rootBounds = ComponentUtils.getRelativeBounds(root);
Rectangle rect = computeVisibleRectRel2Root(root);
rect.x -= root_bounds.x;
rect.y -= root_bounds.y;
rect.x -= rootBounds.x;
rect.y -= rootBounds.y;
return rect;
}

11
designer_form/src/com/fr/design/designer/beans/actions/CopyAction.java

@ -1,13 +1,12 @@
package com.fr.design.designer.beans.actions;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.general.Inter;
import com.fr.design.mainframe.FormDesigner;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
public class CopyAction extends FormEditAction {

6
designer_form/src/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java

@ -1,8 +1,5 @@
package com.fr.design.designer.beans.adapters.layout;
import java.awt.LayoutManager;
import com.fr.general.ComparatorUtils;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.beans.ConstraintsGroupModel;
import com.fr.design.designer.beans.HoverPainter;
@ -13,6 +10,9 @@ import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.ComparatorUtils;
import java.awt.*;
public abstract class AbstractLayoutAdapter implements LayoutAdapter {

28
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

@ -1,7 +1,5 @@
package com.fr.design.designer.beans.adapters.layout;
import java.awt.*;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.beans.ConstraintsGroupModel;
import com.fr.design.designer.beans.HoverPainter;
@ -9,13 +7,14 @@ import com.fr.design.designer.beans.painters.FRAbsoluteLayoutPainter;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.properties.BoundsGroupModel;
import com.fr.design.designer.properties.FRAbsoluteLayoutPropertiesGroupModel;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import java.awt.*;
public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
//是不是添加到父容器上
private boolean isAdd2ParentLayout = false;
@ -75,13 +74,13 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout();
if (topLayout != null) {
if (topLayout.isEditable()) {
return topLayoutAccept(creator, x, y, topLayout);
return topLayoutAccept(creator, x, y);
}
//绝对布局嵌套,处于内层,不可编辑,不添加,topLayout只能获取到最外层可编辑的布局
else if (((XLayoutContainer) topLayout.getParent()).acceptType(XWAbsoluteLayout.class)) {
return false;
} else {
return acceptWidget(creator, x, y);
return acceptWidget(x, y);
}
} else {
FRLogger.getLogger().error("top layout is null!");
@ -91,7 +90,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
}
//topLayout假如可以编辑的话就往里面添加组件
private boolean topLayoutAccept(XCreator creator, int x, int y, XLayoutContainer topLayout) {
private boolean topLayoutAccept(XCreator creator, int x, int y) {
//允许组件重叠,可以不判断有没有和当前控件重叠
//先计算当前控件的位置
int creatorX, creatorY;
@ -109,18 +108,6 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
creatorX = x - w;
creatorY = y - h;
}
//frm 组件复用允许组件重叠
//无须再判断和布局中其他控件重叠
//Rectangle curRec = new Rectangle(creatorX, creatorY, creator.getWidth(), creator.getHeight());
//WAbsoluteLayout wAbsoluteLayout = (WAbsoluteLayout) topLayout.toData();
//for (int i = 0, count = wAbsoluteLayout.getWidgetCount(); i < count; i++) {
//BoundsWidget temp = (BoundsWidget) wAbsoluteLayout.getWidget(i);
//Rectangle rectangle = temp.getBounds();
//if (curRec.intersects(rectangle)) {
//允许组件重叠
//return false;
//}
//}
if (creatorX < 0 || creatorX + creator.getWidth() > container.getWidth()) {
return false;
}
@ -174,11 +161,10 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
}
//当前绝对布局不可编辑,就当成一个控件,组件添加在周围
private boolean acceptWidget(XCreator creator, int x, int y) {
private boolean acceptWidget(int x, int y) {
isFindRelatedComps = false;
//拖入组件判断时,先判断是否为交叉点区域,其次三等分区域,再次平分区域
Component comp = container.getComponentAt(x, y);
boolean isMatchEdge = false;
//如果当前处于边缘地带, 那么就把他贴到父容器上
XLayoutContainer parent = container.findNearestFit();
container = parent != null ? parent : container;

42
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -3,12 +3,6 @@
*/
package com.fr.design.designer.beans.adapters.layout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.beans.ConstraintsGroupModel;
import com.fr.design.designer.beans.HoverPainter;
@ -31,6 +25,10 @@ import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.general.ComparatorUtils;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/**
* 自适应布局的容器适配器
*
@ -270,13 +268,6 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
return super.isCrossPointArea(currentComp, x, y);
}
protected void initCompsList() {
super.initCompsList();
}
protected void clearCompsList() {
super.clearCompsList();
}
protected Rectangle getLayoutBound(XWCardMainBorderLayout mainLayout) {
return mainLayout.getBounds();
@ -559,8 +550,8 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
difference = Math.max(difference, minWidth - getMinWidth(leftComps));
}
//重新计算左右两侧组件size、point
if (CalculateLefttRelatComponent(difference)) {
CalculateRightRelatComponent(objx + difference, -difference);
if (calculateLefttRelatComponent(difference)) {
calculateRightRelatComponent(objx + difference, -difference);
}
}
@ -675,10 +666,9 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
difference = Math.max(difference, minHeight - getMinHeight(upComps));
}
//重新计算上下两侧组件size、point
if (CalculateUpRelatComponent(difference)) {
CalculateDownRelatComponent(objY + difference, -difference);
if (calculateUpRelatComponent(difference)) {
calculateDownRelatComponent(objY + difference, -difference);
}
;
}
/**
@ -758,13 +748,13 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
int height = creatorHeight;
calculateRelatedComponent(x, y, width, height);
if (!rightComps.isEmpty() && getAllHeight(rightComps) == height) {
CalculateRightRelatComponent(x, width + actualVal);
calculateRightRelatComponent(x, width + actualVal);
} else if (!leftComps.isEmpty() && getAllHeight(leftComps) == height) {
CalculateLefttRelatComponent(width + actualVal);
calculateLefttRelatComponent(width + actualVal);
} else if (!downComps.isEmpty() && getAllWidth(downComps) == width) {
CalculateDownRelatComponent(y, height + actualVal);
calculateDownRelatComponent(y, height + actualVal);
} else if (!upComps.isEmpty() && getAllWidth(upComps) == width) {
CalculateUpRelatComponent(height + actualVal);
calculateUpRelatComponent(height + actualVal);
} else {
// 由于布局三等分的存在,可能会出现删除组件时,找不到关联的组件填充,此时特殊处理
calculateNoRelatedComponent(x, y, width, height);
@ -1070,7 +1060,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
* @param objX 调整后的坐标x
* @param objWidth 调整后的宽度
*/
protected void CalculateRightRelatComponent(int objX, int objWidth) {
protected void calculateRightRelatComponent(int objX, int objWidth) {
int count = rightComps.size();
for (int i = 0; i < count; i++) {
XCreator creator = (XCreator) rightComps.get(i);
@ -1110,7 +1100,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
/**
* 删除或拉伸控件左边框时 调整左侧的组件位置大小
*/
protected boolean CalculateLefttRelatComponent(int objWidth) {
protected boolean calculateLefttRelatComponent(int objWidth) {
if (isBeyondAdjustWidthScope(objWidth)) {
return false;
}
@ -1128,7 +1118,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
/**
* 删除或拉伸下边框 调整下方的组件位置大小
*/
protected void CalculateDownRelatComponent(int objY, int objHeight) {
protected void calculateDownRelatComponent(int objY, int objHeight) {
int count = downComps.size();
for (int i = 0; i < count; i++) {
XCreator creator = (XCreator) downComps.get(i);
@ -1168,7 +1158,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
/**
* 删除或拉伸上边框 调整上方的组件位置大小
*/
protected boolean CalculateUpRelatComponent(int objHeight) {
protected boolean calculateUpRelatComponent(int objHeight) {
if (isBeyondAdjustHeightScope(objHeight)) {
return false;
}

3
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java

@ -7,7 +7,6 @@ package com.fr.design.designer.beans.adapters.layout;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
@ -28,8 +27,6 @@ import java.awt.*;
* @date 2014-6-24
*/
public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter {
//标题栏高度对tab布局内部组件的y坐标造成了偏移
private static int TAB_HEIGHT = 40;
/**
* 构造函数

67
designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java

@ -3,19 +3,17 @@
*/
package com.fr.design.designer.beans.location;
import java.awt.*;
import com.fr.design.beans.location.Absorptionline;
import com.fr.design.beans.location.MoveUtils;
import com.fr.design.designer.creator.*;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelection;
import com.fr.design.utils.ComponentUtils;
import com.fr.form.main.Form;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.widget.BoundsWidget;
import java.awt.*;
/**
* @author richer
* @since 6.5.3
@ -28,10 +26,10 @@ public abstract class AccessDirection implements Direction {
abstract int getCursor();
protected abstract Rectangle getDraggedBounds(int dx, int dy, Rectangle current_bounds, FormDesigner designer,
Rectangle oldbounds);
protected abstract Rectangle getDraggedBounds(int dx, int dy, Rectangle currentBounds, FormDesigner designer,
Rectangle oldBounds);
protected int[] sorption(int x, int y,Rectangle current_bounds, FormDesigner designer) {
protected int[] sorption(int x, int y, Rectangle currentBounds, FormDesigner designer) {
// 自适应布局不需要吸附线,但需要对齐线,对齐线后面处理
if (!designer.hasWAbsoluteLayout()) {
designer.getStateModel().setEquidistantLine(null);
@ -39,16 +37,14 @@ public abstract class AccessDirection implements Direction {
designer.getStateModel().setYAbsorptionline(null);
return new int[]{x, y};
} else {
int posy = current_bounds.y;
Point relativePoint = getRelativePoint(x, y, current_bounds,designer);
sorptionPoint(relativePoint,current_bounds, designer);
Point relativePoint = getRelativePoint(x, y, currentBounds, designer);
sorptionPoint(relativePoint, currentBounds, designer);
return new int[]{relativePoint.x, relativePoint.y};
}
}
protected Point getRelativePoint(int x, int y, Rectangle current_bounds,FormDesigner designer) {
protected Point getRelativePoint(int x, int y, Rectangle currentBounds, FormDesigner designer) {
if (x < 0) {
x = 0;
} else if (x > designer.getRootComponent().getWidth() && designer.getSelectionModel().hasSelectionComponent()) {
@ -64,12 +60,11 @@ public abstract class AccessDirection implements Direction {
return new Point(x, y);
}
protected void sorptionPoint(Point point, Rectangle current_bounds,FormDesigner designer) {
boolean findInX = current_bounds.getWidth() <= MoveUtils.SORPTION_UNIT ? true : false;
boolean findInY = current_bounds.getHeight() <= MoveUtils.SORPTION_UNIT ? true : false;
protected void sorptionPoint(Point point, Rectangle currentBounds, FormDesigner designer) {
boolean findInX = currentBounds.getWidth() <= MoveUtils.SORPTION_UNIT;
boolean findInY = currentBounds.getHeight() <= MoveUtils.SORPTION_UNIT;
WAbsoluteLayout layout = getLayout(designer);
FormSelection selection = designer.getSelectionModel().getSelection();
// boolean isWidgetsIntersect = false;
for (int i = 0, count = layout.getWidgetCount(); i < count; i++) {
BoundsWidget temp = (BoundsWidget) layout.getWidget(i);
if (!temp.isVisible() || selection.contains(temp.getWidget())) {
@ -105,17 +100,14 @@ public abstract class AccessDirection implements Direction {
break;
}
// if (current_bounds.intersects(bounds) && !(layout instanceof WParameterLayout)) {
// isWidgetsIntersect = true;
// }
}
// processRectangleIntersects(designer, point.x, point.y, isWidgetsIntersect);
setDesignerStateModelProperties(designer, findInX, findInY, current_bounds, point);
setDesignerStateModelProperties(designer, findInX, findInY, currentBounds, point);
}
private void setDesignerStateModelProperties (FormDesigner designer, boolean findInX, boolean findInY, Rectangle current_bounds, Point point) {
designer.getStateModel().setXAbsorptionline(findInX && current_bounds.getWidth() > MoveUtils.SORPTION_UNIT ? Absorptionline.createXAbsorptionline(point.x) : null);
designer.getStateModel().setYAbsorptionline(findInY && current_bounds.getHeight() > MoveUtils.SORPTION_UNIT ? Absorptionline.createYAbsorptionline(point.y) : null);
private void setDesignerStateModelProperties(FormDesigner designer, boolean findInX, boolean findInY, Rectangle
currentBounds, Point point) {
designer.getStateModel().setXAbsorptionline(findInX && currentBounds.getWidth() > MoveUtils.SORPTION_UNIT ? Absorptionline.createXAbsorptionline(point.x) : null);
designer.getStateModel().setYAbsorptionline(findInY && currentBounds.getHeight() > MoveUtils.SORPTION_UNIT ? Absorptionline.createYAbsorptionline(point.y) : null);
designer.getStateModel().setEquidistantLine(null);
}
@ -131,18 +123,6 @@ public abstract class AccessDirection implements Direction {
return relativeRec;
}
// private void processRectangleIntersects(FormDesigner designer, int x, int y, boolean isIntersects){
// if(isIntersects){
// if(designer.getLocationOnScreen() != null) {
// MoveUtils.displayForbidWindow(x + designer.getLocationOnScreen().x, y + designer.getLocationOnScreen().y);
// }
// designer.setWidgetsIntersect(true);
// }
// else{
// MoveUtils.hideForbidWindow();
// designer.setWidgetsIntersect(false);
// }
// }
private WAbsoluteLayout getLayout(final FormDesigner designer) {
XLayoutContainer formLayoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator(
@ -152,8 +132,7 @@ public abstract class AccessDirection implements Direction {
Container container = designer.getSelectionModel().getSelection().getSelectedCreator().getParent();
if (container instanceof XWAbsoluteLayout) {
layout = ((XWAbsoluteLayout) container).toData();
}
else {
} else {
layout = (WAbsoluteLayout) designer.getParaComponent().toData();
}
} else {
@ -164,12 +143,18 @@ public abstract class AccessDirection implements Direction {
/**
* 拖拽
*
* @param dx 坐标x
* @param dy 坐标y
* @param designer 设计界面
*/
public void drag(int dx, int dy, FormDesigner designer) {
Rectangle rec = getDraggedBounds(dx, dy, designer.getSelectionModel().getSelection().getRelativeBounds(), designer, designer.getSelectionModel().getSelection().getBackupBounds());
if (rec != null) {
designer.getSelectionModel().getSelection().setSelectionBounds(rec, designer);
} else {
return;
}
//设定控件最小高度21,因每次拖曳至少移动1,防止控件高度等于21时,拖曳导致rec.y的变化使得控件不停的向上或向下移动。
if (rec.height == MINHEIGHT) {
ymin = rec.y;
@ -192,13 +177,12 @@ public abstract class AccessDirection implements Direction {
rec.width = MINWIDTH;
rec.x = xmin;
}
if(rec != null) {
designer.getSelectionModel().getSelection().setSelectionBounds(rec, designer);
}
}
/**
* 更新鼠标指针形状
*
* @param formEditor 设计界面组件
*/
public void updateCursor(FormDesigner formEditor) {
@ -214,6 +198,7 @@ public abstract class AccessDirection implements Direction {
/**
* 生成组件备用的bound
*
* @param formEditor 设计界面组件
*/
public void backupBounds(FormDesigner formEditor) {

80
designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java

@ -1,11 +1,5 @@
package com.fr.design.designer.beans.models;
import java.awt.LayoutManager;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.events.DesignerEvent;
@ -20,9 +14,12 @@ import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelection;
import com.fr.design.mainframe.FormSelectionUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.stable.ArrayUtils;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
/**
* 该model保存当前选择的组件和剪切版信息
*/
@ -30,10 +27,10 @@ public class SelectionModel {
//被粘贴组件在所选组件位置处往下、往右各错开20像素。执行多次粘贴时,在上一次粘贴的位置处错开20像素。
private static final int DELTA_X_Y = 20; //粘贴时候的偏移距离
private static final int BORDER_PROPORTION = 20;
private static FormSelection CLIP_BOARD = new FormSelection();
private static FormSelection clipboard = new FormSelection();
private FormDesigner designer;
private FormSelection selection;
private Rectangle hotspot_bounds;
private Rectangle hotspotBounds;
public SelectionModel(FormDesigner designer) {
this.designer = designer;
@ -45,7 +42,7 @@ public class SelectionModel {
*/
public void reset() {
selection.reset();
hotspot_bounds = null;
hotspotBounds = null;
}
/**
@ -54,7 +51,7 @@ public class SelectionModel {
* @return 是否为空
*/
public static boolean isEmpty() {
return CLIP_BOARD.isEmpty();
return clipboard.isEmpty();
}
/**
@ -67,7 +64,6 @@ public class SelectionModel {
// 如果Ctrl或者Shift键盘没有按下,则清除已经选择的组件
selection.reset();
}
// 获取e所在的组件
XCreator comp = designer.getComponentAt(e);
@ -93,7 +89,7 @@ public class SelectionModel {
*/
public void cutSelectedCreator2ClipBoard() {
if (hasSelectionComponent()) {
selection.cut2ClipBoard(CLIP_BOARD);
selection.cut2ClipBoard(clipboard);
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_CUTED);
designer.repaint();
}
@ -104,7 +100,7 @@ public class SelectionModel {
*/
public void copySelectedCreator2ClipBoard() {
if (!selection.isEmpty()) {
selection.copy2ClipBoard(CLIP_BOARD);
selection.copy2ClipBoard(clipboard);
}
}
@ -114,7 +110,7 @@ public class SelectionModel {
* @return
*/
public boolean pasteFromClipBoard() {
if (!CLIP_BOARD.isEmpty()) {
if (!clipboard.isEmpty()) {
XLayoutContainer parent = null;
//未选
if (!hasSelectionComponent()) {
@ -124,14 +120,14 @@ public class SelectionModel {
Rectangle rec = selection.getRelativeBounds();
//Tab布局
FormSelectionUtils.paste2Container(designer, (XLayoutContainer) selection.getSelectedCreator(),
CLIP_BOARD,
clipboard,
rec.x + rec.width / 2,
rec.y + BORDER_PROPORTION);
} else {
Rectangle rec = selection.getRelativeBounds();
//自适应布局
FormSelectionUtils.paste2Container(designer, designer.getRootComponent(),
CLIP_BOARD,
clipboard,
rec.x + rec.width / 2,
rec.y + BORDER_PROPORTION);
}
@ -140,7 +136,7 @@ public class SelectionModel {
//编辑器外面还有两层容器,使用designer.getRootComponent()获取到的是编辑器中层的容器,不是编辑器表层
//当前选择的就是编辑器表层
FormSelectionUtils.paste2Container(designer, (XLayoutContainer) selection.getSelectedCreator(),
CLIP_BOARD,
clipboard,
DELTA_X_Y,
DELTA_X_Y);
}
@ -148,7 +144,7 @@ public class SelectionModel {
//cpt本地组件复用,编辑器就一层,是最底层,使用designer.getRootComponent()就可以获取到
//使用selection.getSelectedCreator()也应该是可以获取到的。
FormSelectionUtils.paste2Container(designer, designer.getRootComponent(),
CLIP_BOARD,
clipboard,
DELTA_X_Y,
DELTA_X_Y);
}
@ -157,19 +153,16 @@ public class SelectionModel {
else {
//获取到编辑器的表层容器(已选的组件的父容器就是表层容器)
parent = XCreatorUtils.getParentXLayoutContainer(selection.getSelectedCreator());
if (selection.getSelectedCreator().getParent() instanceof XWFitLayout) {
if (parent != null && selection.getSelectedCreator().getParent() instanceof XWFitLayout) {
//自适应布局
if (parent != null) {
Rectangle rec = selection.getRelativeBounds();
FormSelectionUtils.paste2Container(designer, parent, CLIP_BOARD, rec.x + rec.width / 2, rec.y +
FormSelectionUtils.paste2Container(designer, parent, clipboard, rec.x + rec.width / 2, rec.y +
rec.height - BORDER_PROPORTION);
}
} else if (selection.getSelectedCreator().getParent() instanceof XWAbsoluteLayout) {
} else if (parent != null && selection.getSelectedCreator().getParent() instanceof XWAbsoluteLayout) {
//绝对布局
if (parent != null) {
Rectangle rec = selection.getSelctionBounds();
FormSelectionUtils.paste2Container(designer, parent, CLIP_BOARD, rec.x + DELTA_X_Y, rec.y + DELTA_X_Y);
}
FormSelectionUtils.paste2Container(designer, parent, clipboard, rec.x + DELTA_X_Y, rec.y + DELTA_X_Y);
}
}
} else {
@ -223,14 +216,14 @@ public class SelectionModel {
* 设置选择区域
*/
public void setHotspotBounds(Rectangle rect) {
hotspot_bounds = rect;
hotspotBounds = rect;
}
/**
* 获得当前选择区域
*/
public Rectangle getHotspotBounds() {
return hotspot_bounds;
return hotspotBounds;
}
private void removeCreatorFromContainer(XCreator creator, int creatorWidth, int creatorHeight) {
@ -271,22 +264,28 @@ public class SelectionModel {
* 其他两层不是靠添加组件就可以编辑的
*/
public boolean hasSelectionComponent() {
XCreator selectionXCreator = selection.getSelectedCreator();
if (designer.getClass().equals(FormDesigner.class)) {
//frm本地组件复用
return selection.getSelectedCreator() != null
&& !(
if (selectionXCreator != null) {
if (selectionXCreator.getClass().equals(XWAbsoluteBodyLayout.class)) {
//frm绝对布局编辑器
selection.getSelectedCreator().getClass().equals(XWAbsoluteBodyLayout.class)
return false;
} else if (selectionXCreator.getClass().equals(XWCardMainBorderLayout.class)
|| selectionXCreator.getClass().equals(XWCardLayout.class)
|| selectionXCreator.getClass().equals(XWTabFitLayout.class)) {
//Tab布局编辑器
|| selection.getSelectedCreator().getClass().equals(XWCardMainBorderLayout.class)
|| selection.getSelectedCreator().getClass().equals(XWCardLayout.class)
|| selection.getSelectedCreator().getClass().equals(XWTabFitLayout.class)
return false;
} else {
//自适应布局编辑器
|| selection.getSelectedCreator().getClass().equals(XWFitLayout.class)
);
return !selectionXCreator.getClass().equals(XWFitLayout.class);
}
} else {
return false;
}
} else {
//cpt本地组件复用,selection.getSelectedCreator().getParent()=@XWParameterLayout instanceof @XWAbsoluteLayout
return selection.getSelectedCreator() != null && selection.getSelectedCreator().getParent() != null;
return selectionXCreator != null && selectionXCreator.getParent() != null;
}
}
@ -330,11 +329,10 @@ public class SelectionModel {
int x = e.getX() + designer.getArea().getHorizontalValue();
int y = e.getY() + designer.getArea().getVerticalValue();
dir = getDirection(selection.getRelativeBounds(), x, y);
if (selection.size() == 1) {
if (!ArrayUtils.contains(selection.getSelectedCreator().getDirections(), dir.getActual())) {
if (selection.size() == 1 && !ArrayUtils.contains(selection.getSelectedCreator().getDirections(), dir
.getActual())) {
dir = Location.outer;
}
}
} else {
dir = Location.outer;
}

12
designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java

@ -313,7 +313,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
*/
public boolean isWithQueryButton() {
XLayoutContainer rootContainer = this.getRootComponent();
return SearchQueryCreators(rootContainer);
return searchQueryCreators(rootContainer);
}
/**
@ -322,18 +322,18 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
* @return 同上
*/
public Action[] getActions() {
if (designer_actions == null) {
designer_actions = new Action[]{new CutAction(this), new CopyAction(this), new PasteAction(this),
if (designerActions == null) {
designerActions = new Action[]{new CutAction(this), new CopyAction(this), new PasteAction(this),
new FormDeleteAction(this)};
}
return designer_actions;
return designerActions;
}
private boolean SearchQueryCreators(XLayoutContainer rootContainer) {
private boolean searchQueryCreators(XLayoutContainer rootContainer) {
boolean b = false;
for (int i = 0; i < rootContainer.getXCreatorCount(); i++) {
if (rootContainer.getXCreator(i) instanceof XLayoutContainer) {
b = SearchQueryCreators((XLayoutContainer) rootContainer.getXCreator(i));
b = searchQueryCreators((XLayoutContainer) rootContainer.getXCreator(i));
} else if (rootContainer.getXCreator(i) instanceof XFormSubmit) {
b = true;
}

85
designer_form/src/com/fr/design/mainframe/EditingMouseListener.java

@ -1,7 +1,6 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.beans.location.MoveUtils;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.events.DesignerEditor;
@ -31,7 +30,6 @@ import java.awt.event.MouseEvent;
*/
public class EditingMouseListener extends MouseInputAdapter {
private static final int INDEX = 0;
private FormDesigner designer;
/**
@ -56,6 +54,7 @@ public class EditingMouseListener extends MouseInputAdapter {
* 选择模型存储当前选择的组件和剪切板
*/
private SelectionModel selectionModel;
/**
* 获取选择模型
*
@ -65,10 +64,10 @@ public class EditingMouseListener extends MouseInputAdapter {
return selectionModel;
}
private XCreator last_creator;
private XCreator lastXCreator;
private MouseEvent lastPressEvent;
private DesignerEditor<? extends JComponent> current_editor;
private XCreator current_creator;
private DesignerEditor<? extends JComponent> currentEditor;
private XCreator currentXCreator;
//备份开始拖动的位置和大小
private Rectangle dragBackupBounds;
@ -113,11 +112,11 @@ public class EditingMouseListener extends MouseInputAdapter {
private void promptWidgetForbidEnter(int x, int y, XLayoutContainer container) {
container.setBorder(BorderFactory.createLineBorder(Color.RED, Constants.LINE_MEDIUM));
int screen_X = (int)designer.getArea().getLocationOnScreen().getX();
int screen_Y = (int)designer.getArea().getLocationOnScreen().getY();
int screenX = (int) designer.getArea().getLocationOnScreen().getX();
int screenY = (int) designer.getArea().getLocationOnScreen().getY();
this.promptWindow.setSize(promptWindow.getPreferredSize());
this.promptWindow.setPreferredSize(promptWindow.getPreferredSize());
promptWindow.setLocation(screen_X + x + GAP, screen_Y + y + GAP);
promptWindow.setLocation(screenX + x + GAP, screenY + y + GAP);
promptWindow.setVisible(true);
}
@ -129,6 +128,7 @@ public class EditingMouseListener extends MouseInputAdapter {
/**
* 按下
*
* @param e 鼠标事件
*/
public void mousePressed(MouseEvent e) {
@ -139,9 +139,7 @@ public class EditingMouseListener extends MouseInputAdapter {
// 获取焦点,以便获取热键
designer.requestFocus();
}
if (e.isPopupTrigger()) {
// 为触发上下文菜单预留
} else if (e.getButton() == MouseEvent.BUTTON1) {
if (e.getButton() == MouseEvent.BUTTON1) {
Direction dir = selectionModel.getDirectionAt(e);
if (!BaseUtils.isAuthorityEditing()) {
@ -157,7 +155,7 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.getArea().getHorizontalValue() + e.getX(),
designer.getArea().getVerticalValue() + e.getY())) {
lastPressEvent = e;
last_creator = selectionModel.getSelection().getSelectedCreator();
lastXCreator = selectionModel.getSelection().getSelectedCreator();
} else {
stateModel.startSelecting(e);
}
@ -170,6 +168,7 @@ public class EditingMouseListener extends MouseInputAdapter {
/**
* 释放
*
* @param e 鼠标事件
*/
public void mouseReleased(MouseEvent e) {
@ -192,7 +191,7 @@ public class EditingMouseListener extends MouseInputAdapter {
}
}
lastPressEvent = null;
last_creator = null;
lastXCreator = null;
}
private void mouseDraggingRelease(MouseEvent e) {
@ -202,7 +201,6 @@ public class EditingMouseListener extends MouseInputAdapter {
XCreator selectionXCreator = designer.getSelectionModel().getSelection().getSelectedCreator();
if (selectionXCreator != null) {
selectionXCreator.setBounds(dragBackupBounds.x, dragBackupBounds.y, dragBackupBounds.width, dragBackupBounds.height);
// MoveUtils.hideForbidWindow();
}
}
dragBackupBounds = null;
@ -231,17 +229,14 @@ public class EditingMouseListener extends MouseInputAdapter {
}
/**
* 激活上下文菜单待完善
* TODO 激活上下文菜单待完善
* 6.56暂时不支持右键 bugid 8777
*/
private void trigger_popup(MouseEvent e) {
private void triggerPopup(MouseEvent e) {
XCreator creator = selectionModel.getSelection().getSelectedCreator();
if (creator == null) {
return;
}
JPopupMenu popupMenu = null;
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, creator);
popupMenu = adapter.getContextPopupMenu(e);
@ -255,6 +250,7 @@ public class EditingMouseListener extends MouseInputAdapter {
/**
* 移动
*
* @param e 鼠标事件
*/
public void mouseMoved(MouseEvent e) {
@ -409,6 +405,7 @@ public class EditingMouseListener extends MouseInputAdapter {
/**
* 拖拽
*
* @param e 鼠标事件
*/
public void mouseDragged(MouseEvent e) {
@ -446,13 +443,13 @@ public class EditingMouseListener extends MouseInputAdapter {
// 如果是拖拽选择区域状态,则更新选择区域
stateModel.changeSelection(e);
} else {
if ((lastPressEvent == null) || (last_creator == null)) {
if ((lastPressEvent == null) || (lastXCreator == null)) {
return;
}
if (e.getPoint().distance(lastPressEvent.getPoint()) > minDragSize) {
//参数面板和自适应布局不支持拖拽
if (last_creator.isSupportDrag()){
designer.startDraggingComponent(last_creator, lastPressEvent, e.getX(), e.getY());
if (lastXCreator.isSupportDrag()) {
designer.startDraggingComponent(lastXCreator, lastPressEvent, e.getX(), e.getY());
}
e.consume();
lastPressEvent = null;
@ -483,7 +480,7 @@ public class EditingMouseListener extends MouseInputAdapter {
}
private boolean isCreatorInLayout(XCreator creator, XCreator layout) {
if (creator == layout){
if (creator.equals(layout)) {
return true;
}
if (layout.getParent() != null) {
@ -495,7 +492,8 @@ public class EditingMouseListener extends MouseInputAdapter {
private XCreator processTopLayoutMouseClick(XCreator creator) {
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(creator).getTopLayout();
if (topLayout != null) {
if (clickTopLayout != null && clickTopLayout != topLayout && !isCreatorInLayout(clickTopLayout, topLayout)){
if (clickTopLayout != null && !clickTopLayout.equals(topLayout) && !isCreatorInLayout(clickTopLayout,
topLayout)) {
clickTopLayout.setEditable(false);
setTopLayoutUnEditable(clickTopLayout, topLayout);
}
@ -503,8 +501,7 @@ public class EditingMouseListener extends MouseInputAdapter {
if (!topLayout.isEditable()) {
creator = topLayout;
}
}
else{
} else {
if (clickTopLayout != null) {
clickTopLayout.setEditable(false);
setTopLayoutUnEditable(clickTopLayout, null);
@ -513,8 +510,10 @@ public class EditingMouseListener extends MouseInputAdapter {
return creator;
}
/**
* 点击
*
* @param e 鼠标事件
*/
public void mouseClicked(MouseEvent e) {
@ -534,9 +533,9 @@ public class EditingMouseListener extends MouseInputAdapter {
}
/**
* 离开
*
* @param e 鼠标事件
*/
public void mouseExited(MouseEvent e) {
@ -551,6 +550,7 @@ public class EditingMouseListener extends MouseInputAdapter {
/**
* 开始编辑
*
* @param creator 容器
* @param designerEditor 设计器
* @param adapter 适配器
@ -558,8 +558,8 @@ public class EditingMouseListener extends MouseInputAdapter {
public void startEditing(XCreator creator, DesignerEditor<? extends JComponent> designerEditor, ComponentAdapter adapter) {
if (designerEditor != null) {
Rectangle rect = ComponentUtils.getRelativeBounds(creator);
current_editor = designerEditor;
current_creator = creator;
currentEditor = designerEditor;
currentXCreator = creator;
Rectangle bounds = new Rectangle(1, 1, creator.getWidth() - 2, creator.getHeight() - 2);
bounds.x += (rect.x - designer.getArea().getHorizontalValue());
bounds.y += (rect.y - designer.getArea().getVerticalValue());
@ -574,22 +574,23 @@ public class EditingMouseListener extends MouseInputAdapter {
/**
* 停止编辑
*
* @return 是否编辑成功
*/
public boolean stopEditing() {
if (current_editor != null) {
designer.remove(current_editor.getEditorTarget());
current_editor.fireEditStoped();
if (currentEditor != null) {
designer.remove(currentEditor.getEditorTarget());
currentEditor.fireEditStoped();
Container container = current_creator.getParent();
Container container = currentXCreator.getParent();
if (container != null) {
LayoutUtils.layoutRootContainer(container);
}
designer.invalidate();
designer.repaint();
current_creator = null;
current_editor = null;
currentXCreator = null;
currentEditor = null;
return true;
}
return true;
@ -599,22 +600,22 @@ public class EditingMouseListener extends MouseInputAdapter {
* 重置编辑控件大小
*/
public void resetEditorComponentBounds() {
if (current_editor == null) {
if (currentEditor == null) {
return;
}
if (current_creator.getParent() == null) {
if (currentXCreator.getParent() == null) {
stopEditing();
return;
}
Rectangle rect = ComponentUtils.getRelativeBounds(current_creator);
Rectangle bounds = new Rectangle(1, 1, current_creator.getWidth() - 2, current_creator.getHeight() - 2);
Rectangle rect = ComponentUtils.getRelativeBounds(currentXCreator);
Rectangle bounds = new Rectangle(1, 1, currentXCreator.getWidth() - 2, currentXCreator.getHeight() - 2);
bounds.x += (rect.x - designer.getArea().getHorizontalValue());
bounds.y += (rect.y - designer.getArea().getVerticalValue());
if (current_creator instanceof XEditorHolder) {
ToolTipEditor.getInstance().resetBounds((XEditorHolder) current_creator, bounds, current_editor.getEditorTarget().getBounds());
if (currentXCreator instanceof XEditorHolder) {
ToolTipEditor.getInstance().resetBounds((XEditorHolder) currentXCreator, bounds, currentEditor.getEditorTarget().getBounds());
}
current_editor.getEditorTarget().setBounds(bounds);
currentEditor.getEditorTarget().setBounds(bounds);
}
}

21
designer_form/src/com/fr/design/mainframe/FormDesigner.java

@ -46,7 +46,6 @@ import com.fr.form.ui.container.WFitLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.ExtraClassManager;
import com.fr.stable.ArrayUtils;
import com.fr.stable.bridge.StableFactory;
@ -72,7 +71,6 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
protected static final ArrayList<String> NAME_ARRAY_LIST = new ArrayList<String>(
Arrays.asList(new String[]{Inter.getLocText("M_Edit-Cut"), Inter.getLocText("M_Edit-Copy"), Inter.getLocText("M_Edit-Delete")})
);
private static final int BORDER_WIDTH = 6;
//底层容器的默认大小
protected static final Dimension LARGE_PREFERRED_SIZE = new Dimension(WBorderLayout.DEFAULT_WIDTH, WBorderLayout.DEFAULT_HEIGHT);
private int paraHeight = 0;
@ -84,7 +82,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
private XLayoutContainer paraComponent;
private boolean drawLineMode;
private FormArea formArea;
private ConnectorHelper ConnectorHelper;
private ConnectorHelper connectorHelper;
private boolean isReportBlockEditing = false;
//组件重叠
@ -107,7 +105,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
// 编辑状态的事件表
private CreatorEventListenerTable edit;
protected Action[] designer_actions;
protected Action[] designerActions;
private FormDesignerModeForSpecial<?> desigerMode;
private Action switchAction;
private FormElementCaseContainerProvider elementCaseContainer;
@ -763,13 +761,10 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
* @param e 鼠标事件
*/
public void updateDrawLineMode(MouseEvent e) {
Point p = ConnectorHelper.getNearWidgetPoint(e);
if (p == null) {
XComponent comp = getComponentAt(e);
if (comp == rootComponent) {
Point p = connectorHelper.getNearWidgetPoint(e);
if (p == null && getComponentAt(e) == rootComponent) {
p = new Point(e.getX() + formArea.getHorizontalValue(), e.getY() + formArea.getVerticalValue());
}
}
stateModel.startDrawLine(p);
}
@ -1120,11 +1115,11 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
* @return 同上
*/
public Action[] getActions() {
if (designer_actions == null) {
designer_actions = new Action[]{new CutAction(this), new CopyAction(this), new PasteAction(this),
if (designerActions == null) {
designerActions = new Action[]{new CutAction(this), new CopyAction(this), new PasteAction(this),
new FormDeleteAction(this)};
}
return designer_actions;
return designerActions;
}
protected Border getOuterBorder() {
@ -1191,7 +1186,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
* @return ConnectorHelper类
*/
public ConnectorHelper getDrawLineHelper() {
return ConnectorHelper;
return connectorHelper;
}
/**

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

@ -204,14 +204,14 @@ public class FormSelectionUtils {
private static ArrayList<XCreator> rebuildSelection(XCreator rootComponent, List<Widget> selectionWidget,
ArrayList<XCreator> newSelection) {
FormSelectionUtils._rebuild(rootComponent, selectionWidget, newSelection);
FormSelectionUtils.rebuild(rootComponent, selectionWidget, newSelection);
if (newSelection.isEmpty()) {
newSelection.add(rootComponent);
}
return newSelection;
}
private static void _rebuild(XCreator root, List<Widget> selectionWidget, List<XCreator> newSelection) {
private static void rebuild(XCreator root, List<Widget> selectionWidget, List<XCreator> newSelection) {
if (selectionWidget.isEmpty()) {
return;
}
@ -238,7 +238,7 @@ public class FormSelectionUtils {
}
}
if (c instanceof XLayoutContainer) {
_rebuild((XLayoutContainer) c, selectionWidget, newSelection);
rebuild((XLayoutContainer) c, selectionWidget, newSelection);
}
}
}

1
designer_form/src/com/fr/design/mainframe/JForm.java

@ -43,7 +43,6 @@ import com.fr.form.FormElementCaseProvider;
import com.fr.form.main.Form;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;

3
designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java

@ -36,7 +36,7 @@ public class MobileWidgetTable extends JTable {
private static final int WIDGET_TABLE_ROW_HEIGHT = 22;
private UILabel moveComponent = new UILabel(); // 作为拖动时候随鼠标移动的那个半透明控件
private int selectedRow = -1;
private int GAP = 11;
private static final int GAP = 11;
private boolean draging = false;
private boolean collapsed = false; // 控件列表是否折叠
@ -334,6 +334,7 @@ public class MobileWidgetTable extends JTable {
/**
* 是否可编辑
*
* @param row 行号
* @param column 列号
* @return 是否可编辑

Loading…
Cancel
Save