Browse Source

Merge pull request #1484 in DESIGN/design from ~LUCIAN.CHEN/design:release/10.0 to release/10.0

* commit '661babee78939bc5451b60dd99371626d7e4976d':
  REPORT-26262 切换工作目录,控件插件不能使用
feature/big-screen
Lucian.Chen 5 years ago
parent
commit
e03f9b374a
  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;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.gui.core.WidgetConstants;
import com.fr.design.widget.ui.ButtonDefinePane;
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.TreeEditor;
import com.fr.form.ui.Widget;
import com.fr.general.GeneralContext;
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.write.AppendRowButton;
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();
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(DateEditor.class, new Appearance(DateEditorDefinePane.class, WidgetConstants.DATE + ""));
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 + ""));
}
private WidgetDefinePaneFactory() {
private static void refreshPluginMap() {
pluginDefineMap.clear();
pluginDefineMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap());
}
@Nullable

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

@ -1,13 +1,20 @@
package com.fr.design.widget;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.widget.mobile.WidgetMobilePane;
import com.fr.design.widget.ui.mobile.MultiFileEditorMobilePane;
import com.fr.design.widget.ui.mobile.ScanCodeMobilePane;
import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.Widget;
import com.fr.general.GeneralContext;
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.Map;
@ -17,22 +24,43 @@ import java.util.Map;
*/
public class WidgetMobilePaneFactory {
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 {
mobilePaneMap.put(MultiFileEditor.class, MultiFileEditorMobilePane.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 static void refreshPluginMap() {
mobilePluginPaneMap.clear();
mobilePluginPaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap());
}
public static WidgetMobilePane createWidgetMobilePane(Widget widget) {
WidgetMobilePane mobilePane = WidgetMobilePane.DEFAULT_PANE;
try {
if (mobilePaneMap.containsKey(widget.getClass())) {
mobilePane = mobilePaneMap.get(widget.getClass()).newInstance();
mobilePane.populate(widget);
} else if (mobilePluginPaneMap.containsKey(widget.getClass())){
mobilePane = mobilePluginPaneMap.get(widget.getClass()).newInstance();
mobilePane.populate(widget);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);

Loading…
Cancel
Save