|
|
@ -37,6 +37,7 @@ public class FormSelection { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 是否没有选中的组件 |
|
|
|
* 是否没有选中的组件 |
|
|
|
|
|
|
|
* |
|
|
|
* @return 为空返回true |
|
|
|
* @return 为空返回true |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean isEmpty() { |
|
|
|
public boolean isEmpty() { |
|
|
@ -45,6 +46,7 @@ public class FormSelection { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 选中的组件数量 |
|
|
|
* 选中的组件数量 |
|
|
|
|
|
|
|
* |
|
|
|
* @return 选中的组件数量 |
|
|
|
* @return 选中的组件数量 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public int size() { |
|
|
|
public int size() { |
|
|
@ -53,6 +55,7 @@ public class FormSelection { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 去除选中的组件中指定组件 |
|
|
|
* 去除选中的组件中指定组件 |
|
|
|
|
|
|
|
* |
|
|
|
* @param creator 待去除组件 |
|
|
|
* @param creator 待去除组件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void removeCreator(XCreator creator) { |
|
|
|
public void removeCreator(XCreator creator) { |
|
|
@ -61,6 +64,7 @@ public class FormSelection { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 是否成功删除选择的组件 |
|
|
|
* 是否成功删除选择的组件 |
|
|
|
|
|
|
|
* |
|
|
|
* @param comp 组件 |
|
|
|
* @param comp 组件 |
|
|
|
* @return 是则返回true |
|
|
|
* @return 是则返回true |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -74,6 +78,7 @@ public class FormSelection { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 成功增加选中的组件 |
|
|
|
* 成功增加选中的组件 |
|
|
|
|
|
|
|
* |
|
|
|
* @param creator 组件 |
|
|
|
* @param creator 组件 |
|
|
|
* @return 成功增加返回true |
|
|
|
* @return 成功增加返回true |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -87,6 +92,7 @@ public class FormSelection { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 是否是可以增加的 |
|
|
|
* 是否是可以增加的 |
|
|
|
|
|
|
|
* |
|
|
|
* @param creator 组件 |
|
|
|
* @param creator 组件 |
|
|
|
* @return 是则返回true |
|
|
|
* @return 是则返回true |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -108,6 +114,7 @@ public class FormSelection { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 返回选中的第一个组件,为空返回null |
|
|
|
* 返回选中的第一个组件,为空返回null |
|
|
|
|
|
|
|
* |
|
|
|
* @return 返回选中组件 |
|
|
|
* @return 返回选中组件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public XCreator getSelectedCreator() { |
|
|
|
public XCreator getSelectedCreator() { |
|
|
@ -116,6 +123,7 @@ public class FormSelection { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 返回选中的所有组件 |
|
|
|
* 返回选中的所有组件 |
|
|
|
|
|
|
|
* |
|
|
|
* @return 所有组件s |
|
|
|
* @return 所有组件s |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public XCreator[] getSelectedCreators() { |
|
|
|
public XCreator[] getSelectedCreators() { |
|
|
@ -146,6 +154,7 @@ public class FormSelection { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 是否包含当前控件 |
|
|
|
* 是否包含当前控件 |
|
|
|
|
|
|
|
* |
|
|
|
* @param widget 控件 |
|
|
|
* @param widget 控件 |
|
|
|
* @return 是则返回true |
|
|
|
* @return 是则返回true |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -196,7 +205,7 @@ public class FormSelection { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Rectangle getSelctionBounds() { |
|
|
|
public Rectangle getSelctionBounds() { |
|
|
|
if(selection.isEmpty()) { |
|
|
|
if (selection.isEmpty()) { |
|
|
|
return new Rectangle(); |
|
|
|
return new Rectangle(); |
|
|
|
} |
|
|
|
} |
|
|
|
Rectangle bounds = selection.get(0).getBounds(); |
|
|
|
Rectangle bounds = selection.get(0).getBounds(); |
|
|
@ -221,8 +230,8 @@ public class FormSelection { |
|
|
|
if (size == 1) { |
|
|
|
if (size == 1) { |
|
|
|
XCreator creator = selection.get(0); |
|
|
|
XCreator creator = selection.get(0); |
|
|
|
creator.setBounds(rec); |
|
|
|
creator.setBounds(rec); |
|
|
|
if(creator.acceptType(XWParameterLayout.class)){ |
|
|
|
if (creator.acceptType(XWParameterLayout.class)) { |
|
|
|
designer.setParaHeight((int)rec.getHeight()); |
|
|
|
designer.setParaHeight((int) rec.getHeight()); |
|
|
|
designer.getArea().doLayout(); |
|
|
|
designer.getArea().doLayout(); |
|
|
|
} |
|
|
|
} |
|
|
|
LayoutUtils.layoutContainer(creator); |
|
|
|
LayoutUtils.layoutContainer(creator); |
|
|
@ -235,8 +244,8 @@ public class FormSelection { |
|
|
|
newBounds.height = rec.height * newBounds.height / backupBounds.height; |
|
|
|
newBounds.height = rec.height * newBounds.height / backupBounds.height; |
|
|
|
XCreator creator = selection.get(i); |
|
|
|
XCreator creator = selection.get(i); |
|
|
|
creator.setBounds(newBounds); |
|
|
|
creator.setBounds(newBounds); |
|
|
|
if(creator.acceptType(XWParameterLayout.class)){ |
|
|
|
if (creator.acceptType(XWParameterLayout.class)) { |
|
|
|
designer.setParaHeight((int)rec.getHeight()); |
|
|
|
designer.setParaHeight((int) rec.getHeight()); |
|
|
|
designer.getArea().doLayout(); |
|
|
|
designer.getArea().doLayout(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -246,6 +255,7 @@ public class FormSelection { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 调整组件大小 |
|
|
|
* 调整组件大小 |
|
|
|
|
|
|
|
* |
|
|
|
* @param designer 设计界面组件 |
|
|
|
* @param designer 设计界面组件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void fixCreator(FormDesigner designer) { |
|
|
|
public void fixCreator(FormDesigner designer) { |
|
|
@ -275,6 +285,7 @@ public class FormSelection { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 剪切选中的所有组件 |
|
|
|
* 剪切选中的所有组件 |
|
|
|
|
|
|
|
* |
|
|
|
* @param clipBoard 剪切板 |
|
|
|
* @param clipBoard 剪切板 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void cut2ClipBoard(FormSelection clipBoard) { |
|
|
|
public void cut2ClipBoard(FormSelection clipBoard) { |
|
|
@ -289,6 +300,7 @@ public class FormSelection { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 复制选中的所有组件 |
|
|
|
* 复制选中的所有组件 |
|
|
|
|
|
|
|
* |
|
|
|
* @param clipBoard 复制板 |
|
|
|
* @param clipBoard 复制板 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void copy2ClipBoard(FormSelection clipBoard) { |
|
|
|
public void copy2ClipBoard(FormSelection clipBoard) { |
|
|
|