@ -32,6 +32,8 @@ abstract class ModelUtil {
//直接遍历出来目标值,然后按需处理
//直接遍历出来目标值,然后按需处理
xCreator . traversalNameRelatedXCreators ( nameRelatedCreators ) ;
xCreator . traversalNameRelatedXCreators ( nameRelatedCreators ) ;
Map < String , String > renameMap = new HashMap < > ( ) ;
Map < String , String > renameMap = new HashMap < > ( ) ;
// 避免与旧名称重复
initDuplicated ( nameRelatedCreators , duplicated ) ;
for ( XCreator target : nameRelatedCreators ) {
for ( XCreator target : nameRelatedCreators ) {
String uniqueName = uniqueName ( form , target , duplicated ) ;
String uniqueName = uniqueName ( form , target , duplicated ) ;
String oldName = target . toData ( ) . getWidgetName ( ) ;
String oldName = target . toData ( ) . getWidgetName ( ) ;
@ -42,6 +44,12 @@ abstract class ModelUtil {
}
}
EventDispatcher . fire ( WidgetNameModifyEvent . INSTANCE , new ContentChangeItem ( renameMap , xCreator . toData ( ) , ChangeItem . WIDGET_NAME ) ) ;
EventDispatcher . fire ( WidgetNameModifyEvent . INSTANCE , new ContentChangeItem ( renameMap , xCreator . toData ( ) , ChangeItem . WIDGET_NAME ) ) ;
}
}
private static void initDuplicated ( Set < XCreator > nameRelatedCreators , Set < String > duplicated ) {
for ( XCreator xCreator : nameRelatedCreators ) {
duplicated . add ( xCreator . toData ( ) . getWidgetName ( ) ) ;
}
}
private static String uniqueName ( Form form , XCreator xCreator , Set < String > duplicated ) {
private static String uniqueName ( Form form , XCreator xCreator , Set < String > duplicated ) {