Browse Source

REPORT-26262 切换工作目录,控件插件不能使用

feature/big-screen
lucian 5 years ago
parent
commit
661babee78
  1. 32
      designer-realize/src/main/java/com/fr/design/widget/WidgetDefinePaneFactory.java
  2. 30
      designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java

32
designer-realize/src/main/java/com/fr/design/widget/WidgetDefinePaneFactory.java

@ -1,6 +1,7 @@
package com.fr.design.widget; package com.fr.design.widget;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.gui.core.WidgetConstants; import com.fr.design.gui.core.WidgetConstants;
import com.fr.design.widget.ui.ButtonDefinePane; import com.fr.design.widget.ui.ButtonDefinePane;
import com.fr.design.widget.ui.CheckBoxDefinePane; import com.fr.design.widget.ui.CheckBoxDefinePane;
@ -42,7 +43,13 @@ import com.fr.form.ui.TextEditor;
import com.fr.form.ui.TreeComboBoxEditor; import com.fr.form.ui.TreeComboBoxEditor;
import com.fr.form.ui.TreeEditor; import com.fr.form.ui.TreeEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.report.web.button.form.TreeNodeToggleButton; import com.fr.report.web.button.form.TreeNodeToggleButton;
import com.fr.report.web.button.write.AppendRowButton; import com.fr.report.web.button.write.AppendRowButton;
import com.fr.report.web.button.write.DeleteRowButton; import com.fr.report.web.button.write.DeleteRowButton;
@ -66,6 +73,26 @@ public class WidgetDefinePaneFactory {
private static Map<Class<? extends Widget>, Appearance> pluginDefineMap = ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap(); private static Map<Class<? extends Widget>, Appearance> pluginDefineMap = ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap();
static { static {
putDefault();
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshPluginMap();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, CellWidgetOptionProvider.XML_TAG);
}
});
}
private WidgetDefinePaneFactory() {
}
private static void putDefault() {
defineMap.put(NumberEditor.class, new Appearance(NumberEditorDefinePane.class, WidgetConstants.NUMBER + "")); defineMap.put(NumberEditor.class, new Appearance(NumberEditorDefinePane.class, WidgetConstants.NUMBER + ""));
defineMap.put(DateEditor.class, new Appearance(DateEditorDefinePane.class, WidgetConstants.DATE + "")); defineMap.put(DateEditor.class, new Appearance(DateEditorDefinePane.class, WidgetConstants.DATE + ""));
defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + "")); defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + ""));
@ -96,8 +123,9 @@ public class WidgetDefinePaneFactory {
defineMap.put(TreeNodeToggleButton.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + "")); defineMap.put(TreeNodeToggleButton.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + ""));
} }
private WidgetDefinePaneFactory() { private static void refreshPluginMap() {
pluginDefineMap.clear();
pluginDefineMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap());
} }
@Nullable @Nullable

30
designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java

@ -1,13 +1,20 @@
package com.fr.design.widget; package com.fr.design.widget;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.widget.mobile.WidgetMobilePane; import com.fr.design.widget.mobile.WidgetMobilePane;
import com.fr.design.widget.ui.mobile.MultiFileEditorMobilePane; import com.fr.design.widget.ui.mobile.MultiFileEditorMobilePane;
import com.fr.design.widget.ui.mobile.ScanCodeMobilePane; import com.fr.design.widget.ui.mobile.ScanCodeMobilePane;
import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.TextEditor; import com.fr.form.ui.TextEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -17,22 +24,43 @@ import java.util.Map;
*/ */
public class WidgetMobilePaneFactory { public class WidgetMobilePaneFactory {
private static Map<Class<? extends Widget>, Class<? extends WidgetMobilePane>> mobilePaneMap = new HashMap<>(); private static Map<Class<? extends Widget>, Class<? extends WidgetMobilePane>> mobilePaneMap = new HashMap<>();
private static Map<Class<? extends Widget>, Class<? extends WidgetMobilePane>> mobilePluginPaneMap = new HashMap<>();
static { static {
mobilePaneMap.put(MultiFileEditor.class, MultiFileEditorMobilePane.class); mobilePaneMap.put(MultiFileEditor.class, MultiFileEditorMobilePane.class);
mobilePaneMap.put(TextEditor.class, ScanCodeMobilePane.class); mobilePaneMap.put(TextEditor.class, ScanCodeMobilePane.class);
mobilePaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap()); mobilePluginPaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap());
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshPluginMap();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, CellWidgetOptionProvider.XML_TAG);
}
});
} }
private WidgetMobilePaneFactory() { private WidgetMobilePaneFactory() {
} }
private static void refreshPluginMap() {
mobilePluginPaneMap.clear();
mobilePluginPaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap());
}
public static WidgetMobilePane createWidgetMobilePane(Widget widget) { public static WidgetMobilePane createWidgetMobilePane(Widget widget) {
WidgetMobilePane mobilePane = WidgetMobilePane.DEFAULT_PANE; WidgetMobilePane mobilePane = WidgetMobilePane.DEFAULT_PANE;
try { try {
if (mobilePaneMap.containsKey(widget.getClass())) { if (mobilePaneMap.containsKey(widget.getClass())) {
mobilePane = mobilePaneMap.get(widget.getClass()).newInstance(); mobilePane = mobilePaneMap.get(widget.getClass()).newInstance();
mobilePane.populate(widget); mobilePane.populate(widget);
} else if (mobilePluginPaneMap.containsKey(widget.getClass())){
mobilePane = mobilePluginPaneMap.get(widget.getClass()).newInstance();
mobilePane.populate(widget);
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);

Loading…
Cancel
Save