Browse Source

代码调整

master
yaoh.wu 8 years ago
parent
commit
d5bfb700b7
  1. 2
      designer_form/src/com/fr/design/designer/creator/DedicateLayoutContainer.java
  2. 12
      designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java

2
designer_form/src/com/fr/design/designer/creator/DedicateLayoutContainer.java

@ -62,7 +62,7 @@ public abstract class DedicateLayoutContainer extends XLayoutContainer {
public void resetCreatorName(String name) { public void resetCreatorName(String name) {
super.resetCreatorName(name); super.resetCreatorName(name);
XCreator child = getXCreator(XWScaleLayout.INDEX); XCreator child = getXCreator(XWScaleLayout.INDEX);
//TODO 这里是怎么实现改名的 //实现WTitleLayout的SetWidgetName
child.toData().setWidgetName(name); child.toData().setWidgetName(name);
} }

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

@ -121,10 +121,10 @@ public class FormSelectionUtils {
private static Widget copyWidget(FormDesigner formDesigner, XCreator xCreator) throws private static Widget copyWidget(FormDesigner formDesigner, XCreator xCreator) throws
CloneNotSupportedException { CloneNotSupportedException {
ArrayList<String> clonedNameList = new ArrayList<String>(); ArrayList<String> nameSpace = new ArrayList<String>();
Widget copied = (Widget) xCreator.toData().clone(); Widget copied = (Widget) xCreator.toData().clone();
//重命名拷贝的组件 //重命名拷贝的组件
String name = getCopiedName(formDesigner, copied, clonedNameList); String name = getCopiedName(formDesigner, copied, nameSpace);
if (copied instanceof WTitleLayout) { if (copied instanceof WTitleLayout) {
XWTitleLayout xwTitleLayout = new XWTitleLayout((WTitleLayout) copied, xCreator.getSize()); XWTitleLayout xwTitleLayout = new XWTitleLayout((WTitleLayout) copied, xCreator.getSize());
xwTitleLayout.resetCreatorName(name); xwTitleLayout.resetCreatorName(name);
@ -144,15 +144,15 @@ public class FormSelectionUtils {
* *
* @param formDesigner * @param formDesigner
* @param copied * @param copied
* @param clonedNameList * @param nameSpace
* @return name * @return name
*/ */
private static String getCopiedName(FormDesigner formDesigner, Widget copied, ArrayList<String> clonedNameList) { private static String getCopiedName(FormDesigner formDesigner, Widget copied, ArrayList<String> nameSpace) {
String name = copied.getWidgetName(); String name = copied.getWidgetName();
do { do {
name += postfix; name += postfix;
} while (formDesigner.getTarget().isNameExist(name) || clonedNameList.contains(name)); } while (formDesigner.getTarget().isNameExist(name) || nameSpace.contains(name));
clonedNameList.add(name); nameSpace.add(name);
return name; return name;
} }

Loading…
Cancel
Save