|
|
@ -66,8 +66,7 @@ import com.fr.plugin.manage.PluginFilter; |
|
|
|
import com.fr.plugin.observer.PluginEvent; |
|
|
|
import com.fr.plugin.observer.PluginEvent; |
|
|
|
import com.fr.plugin.observer.PluginEventListener; |
|
|
|
import com.fr.plugin.observer.PluginEventListener; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.third.javax.annotation.Nonnull; |
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
import org.jetbrains.annotations.Nullable; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.Icon; |
|
|
|
import javax.swing.Icon; |
|
|
|
import java.awt.Container; |
|
|
|
import java.awt.Container; |
|
|
@ -177,29 +176,6 @@ public class XCreatorUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 对于继承的子组件来说,可能并没有对应的 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") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
private static Class<? extends XCreator> searchXCreatorClass(Class<? extends Widget> clazz) { |
|
|
|
private static Class<? extends XCreator> searchXCreatorClass(Class<? extends Widget> clazz) { |
|
|
|
|
|
|
|
|
|
|
@ -238,7 +214,7 @@ public class XCreatorUtils { |
|
|
|
clazz = NullCreator.class; |
|
|
|
clazz = NullCreator.class; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
widgetClass = widget.getClass(); |
|
|
|
widgetClass = widget.getClass(); |
|
|
|
clazz = XCreatorUtils.similarXCreatorClass(widgetClass); |
|
|
|
clazz = XCreatorUtils.searchXCreatorClass(widgetClass); |
|
|
|
if (clazz == null) { |
|
|
|
if (clazz == null) { |
|
|
|
FineLoggerFactory.getLogger().error(widget + "'s" + " xcreator doesn't exsit!"); |
|
|
|
FineLoggerFactory.getLogger().error(widget + "'s" + " xcreator doesn't exsit!"); |
|
|
|
clazz = NullCreator.class; |
|
|
|
clazz = NullCreator.class; |
|
|
@ -310,7 +286,7 @@ public class XCreatorUtils { |
|
|
|
* @param creator 组件 |
|
|
|
* @param creator 组件 |
|
|
|
* @return 返回顶层容器 |
|
|
|
* @return 返回顶层容器 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static XLayoutContainer getHotspotContainer(@Nonnull XCreator creator) { |
|
|
|
public static XLayoutContainer getHotspotContainer(@NotNull XCreator creator) { |
|
|
|
if (creator.isDedicateContainer()) { |
|
|
|
if (creator.isDedicateContainer()) { |
|
|
|
return (XLayoutContainer) creator.getParent(); |
|
|
|
return (XLayoutContainer) creator.getParent(); |
|
|
|
} |
|
|
|
} |
|
|
|