|
|
@ -3,25 +3,70 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package com.fr.design.designer.creator; |
|
|
|
package com.fr.design.designer.creator; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.FRContext; |
|
|
|
|
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
|
|
import com.fr.design.designer.creator.cardlayout.*; |
|
|
|
import com.fr.design.designer.creator.cardlayout.XCardAddButton; |
|
|
|
|
|
|
|
import com.fr.design.designer.creator.cardlayout.XCardSwitchButton; |
|
|
|
|
|
|
|
import com.fr.design.designer.creator.cardlayout.XWCardLayout; |
|
|
|
|
|
|
|
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; |
|
|
|
|
|
|
|
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; |
|
|
|
|
|
|
|
import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout; |
|
|
|
|
|
|
|
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; |
|
|
|
import com.fr.design.fun.FormWidgetOptionProvider; |
|
|
|
import com.fr.design.fun.FormWidgetOptionProvider; |
|
|
|
import com.fr.design.fun.ParameterWidgetOptionProvider; |
|
|
|
import com.fr.design.fun.ParameterWidgetOptionProvider; |
|
|
|
import com.fr.design.module.DesignModuleFactory; |
|
|
|
import com.fr.design.module.DesignModuleFactory; |
|
|
|
import com.fr.design.utils.gui.LayoutUtils; |
|
|
|
import com.fr.design.utils.gui.LayoutUtils; |
|
|
|
import com.fr.form.parameter.FormSubmitButton; |
|
|
|
import com.fr.form.parameter.FormSubmitButton; |
|
|
|
import com.fr.form.ui.Button; |
|
|
|
import com.fr.form.ui.Button; |
|
|
|
import com.fr.form.ui.*; |
|
|
|
import com.fr.form.ui.CardAddButton; |
|
|
|
|
|
|
|
import com.fr.form.ui.CardSwitchButton; |
|
|
|
|
|
|
|
import com.fr.form.ui.CheckBox; |
|
|
|
|
|
|
|
import com.fr.form.ui.CheckBoxGroup; |
|
|
|
|
|
|
|
import com.fr.form.ui.ComboBox; |
|
|
|
|
|
|
|
import com.fr.form.ui.ComboCheckBox; |
|
|
|
|
|
|
|
import com.fr.form.ui.DataTable; |
|
|
|
|
|
|
|
import com.fr.form.ui.DateEditor; |
|
|
|
|
|
|
|
import com.fr.form.ui.EditorHolder; |
|
|
|
|
|
|
|
import com.fr.form.ui.ElementCaseEditor; |
|
|
|
|
|
|
|
import com.fr.form.ui.ErrorMarker; |
|
|
|
|
|
|
|
import com.fr.form.ui.FileEditor; |
|
|
|
|
|
|
|
import com.fr.form.ui.FreeButton; |
|
|
|
|
|
|
|
import com.fr.form.ui.IframeEditor; |
|
|
|
import com.fr.form.ui.Label; |
|
|
|
import com.fr.form.ui.Label; |
|
|
|
|
|
|
|
import com.fr.form.ui.ListEditor; |
|
|
|
|
|
|
|
import com.fr.form.ui.MultiFileEditor; |
|
|
|
|
|
|
|
import com.fr.form.ui.NameWidget; |
|
|
|
|
|
|
|
import com.fr.form.ui.NumberEditor; |
|
|
|
|
|
|
|
import com.fr.form.ui.Password; |
|
|
|
|
|
|
|
import com.fr.form.ui.Radio; |
|
|
|
|
|
|
|
import com.fr.form.ui.RadioGroup; |
|
|
|
|
|
|
|
import com.fr.form.ui.Table; |
|
|
|
|
|
|
|
import com.fr.form.ui.TableTree; |
|
|
|
import com.fr.form.ui.TextArea; |
|
|
|
import com.fr.form.ui.TextArea; |
|
|
|
import com.fr.form.ui.container.*; |
|
|
|
import com.fr.form.ui.TextEditor; |
|
|
|
|
|
|
|
import com.fr.form.ui.TreeComboBoxEditor; |
|
|
|
|
|
|
|
import com.fr.form.ui.TreeEditor; |
|
|
|
|
|
|
|
import com.fr.form.ui.Widget; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WAbsoluteBodyLayout; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WAbsoluteLayout; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WBorderLayout; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WCardLayout; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WFitLayout; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WGridLayout; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WHorizontalBoxLayout; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WHorizontalSplitLayout; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WParameterLayout; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WScaleLayout; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WTitleLayout; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WVerticalBoxLayout; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WVerticalSplitLayout; |
|
|
|
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; |
|
|
|
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; |
|
|
|
import com.fr.form.ui.container.cardlayout.WCardTagLayout; |
|
|
|
import com.fr.form.ui.container.cardlayout.WCardTagLayout; |
|
|
|
import com.fr.form.ui.container.cardlayout.WCardTitleLayout; |
|
|
|
import com.fr.form.ui.container.cardlayout.WCardTitleLayout; |
|
|
|
import com.fr.form.ui.container.cardlayout.WTabFitLayout; |
|
|
|
import com.fr.form.ui.container.cardlayout.WTabFitLayout; |
|
|
|
import com.fr.general.GeneralContext; |
|
|
|
import com.fr.general.GeneralContext; |
|
|
|
import com.fr.general.IOUtils; |
|
|
|
import com.fr.general.IOUtils; |
|
|
|
|
|
|
|
import com.fr.invoke.Reflect; |
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.plugin.context.PluginContext; |
|
|
|
import com.fr.plugin.context.PluginContext; |
|
|
|
import com.fr.plugin.injectable.PluginModule; |
|
|
|
import com.fr.plugin.injectable.PluginModule; |
|
|
|
import com.fr.plugin.manage.PluginFilter; |
|
|
|
import com.fr.plugin.manage.PluginFilter; |
|
|
@ -31,7 +76,6 @@ import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.lang.reflect.Constructor; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* XCreator的相关处理 |
|
|
|
* XCreator的相关处理 |
|
|
@ -40,47 +84,46 @@ import java.lang.reflect.Constructor; |
|
|
|
* @since 6.5.3 |
|
|
|
* @since 6.5.3 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class XCreatorUtils { |
|
|
|
public class XCreatorUtils { |
|
|
|
|
|
|
|
|
|
|
|
public static java.util.Map<Class<? extends Widget>, Class<?>> objectMap = new java.util.HashMap<Class<? extends Widget>, Class<?>>(); |
|
|
|
public static java.util.Map<Class<? extends Widget>, Class<?>> objectMap = new java.util.HashMap<Class<? extends Widget>, Class<?>>(); |
|
|
|
|
|
|
|
|
|
|
|
private static java.util.Map<Class<? extends Widget>, Class<?>> extraObjectMap = new java.util.HashMap<Class<? extends Widget>, Class<?>>(); |
|
|
|
private static java.util.Map<Class<? extends Widget>, Class<?>> extraObjectMap = new java.util.HashMap<Class<? extends Widget>, Class<?>>(); |
|
|
|
|
|
|
|
|
|
|
|
public static java.util.Map<Class<? extends Widget>, Class<?>> xLayoutMap = new java.util.HashMap<Class<? extends Widget>, Class<?>>(); |
|
|
|
public static java.util.Map<Class<? extends Widget>, Class<?>> xLayoutMap = new java.util.HashMap<Class<? extends Widget>, Class<?>>(); |
|
|
|
|
|
|
|
|
|
|
|
static { |
|
|
|
static { |
|
|
|
init(); |
|
|
|
init(); |
|
|
|
GeneralContext.listenPluginRunningChanged(new PluginEventListener() { |
|
|
|
GeneralContext.listenPluginRunningChanged(new PluginEventListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void on(PluginEvent event) { |
|
|
|
public void on(PluginEvent event) { |
|
|
|
|
|
|
|
|
|
|
|
reInitExtra(); |
|
|
|
reInitExtra(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, new PluginFilter() { |
|
|
|
}, new PluginFilter() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean accept(PluginContext context) { |
|
|
|
public boolean accept(PluginContext context) { |
|
|
|
|
|
|
|
|
|
|
|
return context.contain(PluginModule.ExtraDesign, ParameterWidgetOptionProvider.XML_TAG) |
|
|
|
return context.contain(PluginModule.ExtraDesign, ParameterWidgetOptionProvider.XML_TAG) |
|
|
|
|| context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG); |
|
|
|
|| context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void init() { |
|
|
|
private static void init() { |
|
|
|
|
|
|
|
|
|
|
|
putDefault(); |
|
|
|
putDefault(); |
|
|
|
putExtraEditor(); |
|
|
|
putExtraEditor(); |
|
|
|
putDefaultLayouts(); |
|
|
|
putDefaultLayouts(); |
|
|
|
reInitExtra(); |
|
|
|
reInitExtra(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void putDefaultLayouts() { |
|
|
|
private static void putDefaultLayouts() { |
|
|
|
|
|
|
|
|
|
|
|
xLayoutMap.put(WAbsoluteLayout.class, XWAbsoluteLayout.class); |
|
|
|
xLayoutMap.put(WAbsoluteLayout.class, XWAbsoluteLayout.class); |
|
|
|
xLayoutMap.put(WParameterLayout.class, XWParameterLayout.class); |
|
|
|
xLayoutMap.put(WParameterLayout.class, XWParameterLayout.class); |
|
|
|
xLayoutMap.put(WAbsoluteBodyLayout.class, XWAbsoluteBodyLayout.class); |
|
|
|
xLayoutMap.put(WAbsoluteBodyLayout.class, XWAbsoluteBodyLayout.class); |
|
|
|
xLayoutMap.put(WAbsoluteLayout.class, XWAbsoluteLayout.class); |
|
|
|
|
|
|
|
xLayoutMap.put(WHorizontalBoxLayout.class, XWHorizontalBoxLayout.class); |
|
|
|
xLayoutMap.put(WHorizontalBoxLayout.class, XWHorizontalBoxLayout.class); |
|
|
|
xLayoutMap.put(WBorderLayout.class, XWBorderLayout.class); |
|
|
|
xLayoutMap.put(WBorderLayout.class, XWBorderLayout.class); |
|
|
|
xLayoutMap.put(WCardLayout.class, XWCardLayout.class); |
|
|
|
xLayoutMap.put(WCardLayout.class, XWCardLayout.class); |
|
|
@ -88,7 +131,7 @@ public class XCreatorUtils { |
|
|
|
xLayoutMap.put(WHorizontalSplitLayout.class, XWHorizontalSplitLayout.class); |
|
|
|
xLayoutMap.put(WHorizontalSplitLayout.class, XWHorizontalSplitLayout.class); |
|
|
|
xLayoutMap.put(WVerticalSplitLayout.class, XWVerticalSplitLayout.class); |
|
|
|
xLayoutMap.put(WVerticalSplitLayout.class, XWVerticalSplitLayout.class); |
|
|
|
xLayoutMap.put(WGridLayout.class, XWGridLayout.class); |
|
|
|
xLayoutMap.put(WGridLayout.class, XWGridLayout.class); |
|
|
|
|
|
|
|
|
|
|
|
xLayoutMap.put(WFitLayout.class, XWFitLayout.class); |
|
|
|
xLayoutMap.put(WFitLayout.class, XWFitLayout.class); |
|
|
|
xLayoutMap.put(WScaleLayout.class, XWScaleLayout.class); |
|
|
|
xLayoutMap.put(WScaleLayout.class, XWScaleLayout.class); |
|
|
|
xLayoutMap.put(WTitleLayout.class, XWTitleLayout.class); |
|
|
|
xLayoutMap.put(WTitleLayout.class, XWTitleLayout.class); |
|
|
@ -97,9 +140,9 @@ public class XCreatorUtils { |
|
|
|
xLayoutMap.put(WTabFitLayout.class, XWTabFitLayout.class); |
|
|
|
xLayoutMap.put(WTabFitLayout.class, XWTabFitLayout.class); |
|
|
|
xLayoutMap.put(WCardMainBorderLayout.class, XWCardMainBorderLayout.class); |
|
|
|
xLayoutMap.put(WCardMainBorderLayout.class, XWCardMainBorderLayout.class); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void putDefault() { |
|
|
|
private static void putDefault() { |
|
|
|
|
|
|
|
|
|
|
|
objectMap.put(TextEditor.class, XTextEditor.class); |
|
|
|
objectMap.put(TextEditor.class, XTextEditor.class); |
|
|
|
objectMap.put(TextArea.class, XTextArea.class); |
|
|
|
objectMap.put(TextArea.class, XTextArea.class); |
|
|
|
objectMap.put(NumberEditor.class, XNumberEditor.class); |
|
|
|
objectMap.put(NumberEditor.class, XNumberEditor.class); |
|
|
@ -112,7 +155,6 @@ public class XCreatorUtils { |
|
|
|
objectMap.put(FileEditor.class, XFileUploader.class); |
|
|
|
objectMap.put(FileEditor.class, XFileUploader.class); |
|
|
|
objectMap.put(Table.class, XTableEditor.class); |
|
|
|
objectMap.put(Table.class, XTableEditor.class); |
|
|
|
objectMap.put(IframeEditor.class, XIframeEditor.class); |
|
|
|
objectMap.put(IframeEditor.class, XIframeEditor.class); |
|
|
|
objectMap.put(FreeButton.class, XButton.class); |
|
|
|
|
|
|
|
objectMap.put(FormSubmitButton.class, XButton.class); |
|
|
|
objectMap.put(FormSubmitButton.class, XButton.class); |
|
|
|
objectMap.put(Button.class, XButton.class); |
|
|
|
objectMap.put(Button.class, XButton.class); |
|
|
|
objectMap.put(Label.class, XLabel.class); |
|
|
|
objectMap.put(Label.class, XLabel.class); |
|
|
@ -132,23 +174,23 @@ public class XCreatorUtils { |
|
|
|
objectMap.put(CardAddButton.class, XCardAddButton.class); |
|
|
|
objectMap.put(CardAddButton.class, XCardAddButton.class); |
|
|
|
objectMap.put(ErrorMarker.class, ErrorCreator.class); |
|
|
|
objectMap.put(ErrorMarker.class, ErrorCreator.class); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void reInitExtra() { |
|
|
|
private static void reInitExtra() { |
|
|
|
|
|
|
|
|
|
|
|
extraObjectMap.clear(); |
|
|
|
extraObjectMap.clear(); |
|
|
|
extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getParameterWidgetOptionsMap()); |
|
|
|
extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getParameterWidgetOptionsMap()); |
|
|
|
extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getFormWidgetOptionsMap()); |
|
|
|
extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getFormWidgetOptionsMap()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void putExtraEditor() { |
|
|
|
private static void putExtraEditor() { |
|
|
|
if (DesignModuleFactory.getChartEditorClass() != null) { |
|
|
|
if (DesignModuleFactory.getChartEditorClass() != null) { |
|
|
|
objectMap.put(DesignModuleFactory.getChartEditorClass(), XChartEditor.class); |
|
|
|
objectMap.put(DesignModuleFactory.getChartEditorClass(), XChartEditor.class); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
private static Class<? extends XCreator> searchXCreatorClass(Class<? extends Widget> clazz) { |
|
|
|
private static Class<? extends XCreator> searchXCreatorClass(Class<? extends Widget> clazz) { |
|
|
|
|
|
|
|
|
|
|
|
Class<? extends XCreator> xClazz = (Class<? extends XCreator>) objectMap.get(clazz); |
|
|
|
Class<? extends XCreator> xClazz = (Class<? extends XCreator>) objectMap.get(clazz); |
|
|
|
if (xClazz == null) { |
|
|
|
if (xClazz == null) { |
|
|
|
xClazz = (Class<? extends XCreator>) extraObjectMap.get(clazz); |
|
|
|
xClazz = (Class<? extends XCreator>) extraObjectMap.get(clazz); |
|
|
@ -160,7 +202,8 @@ public class XCreatorUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
*创建creator |
|
|
|
* 创建creator |
|
|
|
|
|
|
|
* |
|
|
|
* @param widget 控件 |
|
|
|
* @param widget 控件 |
|
|
|
* @return 返回控件的creator |
|
|
|
* @return 返回控件的creator |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -170,8 +213,9 @@ public class XCreatorUtils { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 带初始大小的Widget转化为XCreator当然XCreator也需要把大小赋值上 |
|
|
|
* 带初始大小的Widget转化为XCreator当然XCreator也需要把大小赋值上 |
|
|
|
|
|
|
|
* |
|
|
|
* @param widget 控件 |
|
|
|
* @param widget 控件 |
|
|
|
* @param d 大小 |
|
|
|
* @param d 大小 |
|
|
|
* @return 返回控件的xcreator |
|
|
|
* @return 返回控件的xcreator |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static XCreator createXCreator(Widget widget, Dimension d) { |
|
|
|
public static XCreator createXCreator(Widget widget, Dimension d) { |
|
|
@ -184,23 +228,18 @@ public class XCreatorUtils { |
|
|
|
widgetClass = widget.getClass(); |
|
|
|
widgetClass = widget.getClass(); |
|
|
|
clazz = XCreatorUtils.searchXCreatorClass(widgetClass); |
|
|
|
clazz = XCreatorUtils.searchXCreatorClass(widgetClass); |
|
|
|
if (clazz == null) { |
|
|
|
if (clazz == null) { |
|
|
|
FRContext.getLogger().error(widget + "'s" + " xcreator doesn't exsit!"); |
|
|
|
FineLoggerFactory.getLogger().error(widget + "'s" + " xcreator doesn't exsit!"); |
|
|
|
clazz = NullCreator.class; |
|
|
|
clazz = NullCreator.class; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
XCreator creator = null; |
|
|
|
XCreator creator = null; |
|
|
|
Constructor[] constructors = clazz.getConstructors(); |
|
|
|
try { |
|
|
|
for (Constructor c : constructors) { |
|
|
|
creator = Reflect.on(clazz).create(widget, d).get(); |
|
|
|
try { |
|
|
|
} catch (Exception ignore) { |
|
|
|
creator = (XCreator) c.newInstance(widget, d); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} catch (Exception ignore) { |
|
|
|
|
|
|
|
// richie:这里的错误可以忽略
|
|
|
|
|
|
|
|
// FRContext.getLogger().error(ignore.getMessage());
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (creator == null) { |
|
|
|
if (creator == null) { |
|
|
|
FRContext.getLogger().error("Error to create xcreator!"); |
|
|
|
FineLoggerFactory.getLogger().error("Error to create xcreator!"); |
|
|
|
creator = new NullCreator(widget, d); |
|
|
|
creator = new NullCreator(widget, d); |
|
|
|
} |
|
|
|
} |
|
|
|
creator.setXDescrption(widget);//设置描述信息
|
|
|
|
creator.setXDescrption(widget);//设置描述信息
|
|
|
@ -208,7 +247,8 @@ public class XCreatorUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
*刷新所有名字控件 |
|
|
|
* 刷新所有名字控件 |
|
|
|
|
|
|
|
* |
|
|
|
* @param container 布局容器 |
|
|
|
* @param container 布局容器 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static void refreshAllNameWidgets(XLayoutContainer container) { |
|
|
|
public static void refreshAllNameWidgets(XLayoutContainer container) { |
|
|
@ -228,52 +268,52 @@ public class XCreatorUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取焦点组件所在的顶层容器,不包括目标本身 |
|
|
|
* 获取焦点组件所在的顶层容器,不包括目标本身 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param creator 组件 |
|
|
|
* @param creator 组件 |
|
|
|
* @return 返回父容器 |
|
|
|
* @return 返回父容器 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static XLayoutContainer getParentXLayoutContainer(XCreator creator) { |
|
|
|
public static XLayoutContainer getParentXLayoutContainer(XCreator creator) { |
|
|
|
Container c = creator.getParent(); |
|
|
|
Container c = creator.getParent(); |
|
|
|
while (c != null) { |
|
|
|
while (c != null) { |
|
|
|
XCreator crea = (XCreator) c; |
|
|
|
XCreator crea = (XCreator) c; |
|
|
|
if(crea.acceptType(XWCardTitleLayout.class)){ |
|
|
|
if (crea.acceptType(XWCardTitleLayout.class)) { |
|
|
|
return (XLayoutContainer) c.getParent(); |
|
|
|
return (XLayoutContainer) c.getParent(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (crea.isDedicateContainer()) { |
|
|
|
if (crea.isDedicateContainer()) { |
|
|
|
return (XLayoutContainer) c.getParent(); |
|
|
|
return (XLayoutContainer) c.getParent(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (c instanceof XLayoutContainer) { |
|
|
|
if (c instanceof XLayoutContainer) { |
|
|
|
return (XLayoutContainer) c; |
|
|
|
return (XLayoutContainer) c; |
|
|
|
} |
|
|
|
} |
|
|
|
c = c.getParent(); |
|
|
|
c = c.getParent(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取焦点组件所在的顶层容器,可能是目标本身 |
|
|
|
* 获取焦点组件所在的顶层容器,可能是目标本身 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param creator 组件 |
|
|
|
* @param creator 组件 |
|
|
|
* @return 返回顶层容器 |
|
|
|
* @return 返回顶层容器 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static XLayoutContainer getHotspotContainer(XCreator creator) { |
|
|
|
public static XLayoutContainer getHotspotContainer(XCreator creator) { |
|
|
|
if (creator.isDedicateContainer()) { |
|
|
|
if (creator.isDedicateContainer()) { |
|
|
|
return (XLayoutContainer) creator.getParent(); |
|
|
|
return (XLayoutContainer) creator.getParent(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (creator instanceof XLayoutContainer) { |
|
|
|
if (creator instanceof XLayoutContainer) { |
|
|
|
return (XLayoutContainer) creator; |
|
|
|
return (XLayoutContainer) creator; |
|
|
|
} |
|
|
|
} |
|
|
|
return getParentXLayoutContainer(creator); |
|
|
|
return getParentXLayoutContainer(creator); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 返回组件的图标 |
|
|
|
* 返回组件的图标 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param creator 组件 |
|
|
|
* @param creator 组件 |
|
|
|
* @return 组件icon |
|
|
|
* @return 组件icon |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Icon getCreatorIcon(XCreator creator) { |
|
|
|
public static Icon getCreatorIcon(XCreator creator) { |
|
|
|
String iconPath = creator.getIconPath(); |
|
|
|
String iconPath = creator.getIconPath(); |
|
|
|
if (StringUtils.isEmpty(iconPath)) { |
|
|
|
if (StringUtils.isEmpty(iconPath)) { |
|
|
|