|
|
|
@ -66,7 +66,8 @@ import com.fr.plugin.manage.PluginFilter;
|
|
|
|
|
import com.fr.plugin.observer.PluginEvent; |
|
|
|
|
import com.fr.plugin.observer.PluginEventListener; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
|
import com.fr.third.javax.annotation.Nonnull; |
|
|
|
|
import org.jetbrains.annotations.Nullable; |
|
|
|
|
|
|
|
|
|
import javax.swing.Icon; |
|
|
|
|
import java.awt.Container; |
|
|
|
@ -164,21 +165,44 @@ 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); |
|
|
|
@ -214,7 +238,7 @@ public class XCreatorUtils {
|
|
|
|
|
clazz = NullCreator.class; |
|
|
|
|
} else { |
|
|
|
|
widgetClass = widget.getClass(); |
|
|
|
|
clazz = XCreatorUtils.searchXCreatorClass(widgetClass); |
|
|
|
|
clazz = XCreatorUtils.similarXCreatorClass(widgetClass); |
|
|
|
|
if (clazz == null) { |
|
|
|
|
FineLoggerFactory.getLogger().error(widget + "'s" + " xcreator doesn't exsit!"); |
|
|
|
|
clazz = NullCreator.class; |
|
|
|
@ -286,7 +310,7 @@ public class XCreatorUtils {
|
|
|
|
|
* @param creator 组件 |
|
|
|
|
* @return 返回顶层容器 |
|
|
|
|
*/ |
|
|
|
|
public static XLayoutContainer getHotspotContainer(@NotNull XCreator creator) { |
|
|
|
|
public static XLayoutContainer getHotspotContainer(@Nonnull XCreator creator) { |
|
|
|
|
if (creator.isDedicateContainer()) { |
|
|
|
|
return (XLayoutContainer) creator.getParent(); |
|
|
|
|
} |
|
|
|
|