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) {
super.resetCreatorName(name);
XCreator child = getXCreator(XWScaleLayout.INDEX);
//TODO 这里是怎么实现改名的
//实现WTitleLayout的SetWidgetName
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
CloneNotSupportedException {
ArrayList<String> clonedNameList = new ArrayList<String>();
ArrayList<String> nameSpace = new ArrayList<String>();
Widget copied = (Widget) xCreator.toData().clone();
//重命名拷贝的组件
String name = getCopiedName(formDesigner, copied, clonedNameList);
String name = getCopiedName(formDesigner, copied, nameSpace);
if (copied instanceof WTitleLayout) {
XWTitleLayout xwTitleLayout = new XWTitleLayout((WTitleLayout) copied, xCreator.getSize());
xwTitleLayout.resetCreatorName(name);
@ -144,15 +144,15 @@ public class FormSelectionUtils {
*
* @param formDesigner
* @param copied
* @param clonedNameList
* @param nameSpace
* @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();
do {
name += postfix;
} while (formDesigner.getTarget().isNameExist(name) || clonedNameList.contains(name));
clonedNameList.add(name);
} while (formDesigner.getTarget().isNameExist(name) || nameSpace.contains(name));
nameSpace.add(name);
return name;
}

Loading…
Cancel
Save