Browse Source

合代码冲突

persist/11.0
neil 5 years ago
parent
commit
231b41f01a
  1. 38
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

38
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -66,8 +66,7 @@ import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.StringUtils;
import com.fr.third.javax.annotation.Nonnull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
import javax.swing.Icon;
import java.awt.Container;
@ -165,44 +164,21 @@ public class XCreatorUtils {
}
private static void reInitExtra() {
extraObjectMap.clear();
extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getParameterWidgetOptionsMap());
extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getFormWidgetOptionsMap());
}
private static void putExtraEditor() {
if (DesignModuleFactory.getChartEditorClass() != null) {
objectMap.put(DesignModuleFactory.getChartEditorClass(), XChartEditor.class);
}
}
/**
* 对于继承的子组件来说可能并没有对应的 XCreator
* 这个时候就需要递归的找父类
*
* @param clazz 组件类
* @return 创建类
*/
@SuppressWarnings("unchecked")
@Nullable
private static Class<? extends XCreator> similarXCreatorClass(Class<? extends Widget> clazz) {
Class<?> target = clazz;
Class<? extends XCreator> xClazz = null;
//判断条件有两个
//1.还没找到对应的 xClazz
//2.一直到 终极父类-Widget 都找不到
while (xClazz == null && Widget.class.isAssignableFrom(target)) {
xClazz = searchXCreatorClass((Class<? extends Widget>) target);
target = target.getSuperclass();
}
return xClazz;
}
@SuppressWarnings("unchecked")
private static Class<? extends XCreator> searchXCreatorClass(Class<? extends Widget> clazz) {
Class<? extends XCreator> xClazz = (Class<? extends XCreator>) objectMap.get(clazz);
if (xClazz == null) {
xClazz = (Class<? extends XCreator>) extraObjectMap.get(clazz);
@ -238,7 +214,7 @@ public class XCreatorUtils {
clazz = NullCreator.class;
} else {
widgetClass = widget.getClass();
clazz = XCreatorUtils.similarXCreatorClass(widgetClass);
clazz = XCreatorUtils.searchXCreatorClass(widgetClass);
if (clazz == null) {
FineLoggerFactory.getLogger().error(widget + "'s" + " xcreator doesn't exsit!");
clazz = NullCreator.class;
@ -310,7 +286,7 @@ public class XCreatorUtils {
* @param creator 组件
* @return 返回顶层容器
*/
public static XLayoutContainer getHotspotContainer(@Nonnull XCreator creator) {
public static XLayoutContainer getHotspotContainer(@NotNull XCreator creator) {
if (creator.isDedicateContainer()) {
return (XLayoutContainer) creator.getParent();
}

Loading…
Cancel
Save