Browse Source

REPORT-54183 加密的复用组件无法修改组件名

final/10.0
kuangshuai 3 years ago
parent
commit
6ab7a6ee15
  1. 4
      designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  2. 33
      designer-realize/src/main/java/com/fr/design/share/SharableManager.java

4
designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java

@ -132,6 +132,10 @@ public class FormWidgetDefinePaneFactoryBase {
defineMap.put(widget, appearance); defineMap.put(widget, appearance);
} }
public static Appearance getDefinePane(Class<? extends Widget> widget) {
return defineMap.get(widget);
}
public static RN createWidgetDefinePane(XCreator creator, FormDesigner designer, Widget widget, Operator operator) { public static RN createWidgetDefinePane(XCreator creator, FormDesigner designer, Widget widget, Operator operator) {
if (isExtraXWidget(widget)) { if (isExtraXWidget(widget)) {
WidgetDefinePane widgetDefinePane = new WidgetDefinePane(creator, designer); WidgetDefinePane widgetDefinePane = new WidgetDefinePane(creator, designer);

33
designer-realize/src/main/java/com/fr/design/share/SharableManager.java

@ -10,14 +10,21 @@ import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.collect.SharableCollectorManager; import com.fr.design.mainframe.share.collect.SharableCollectorManager;
import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptSelectionClipboardHandler; import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptSelectionClipboardHandler;
import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptTransferableClipboardHandler; import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptTransferableClipboardHandler;
import com.fr.design.mainframe.share.ui.block.LocalWidgetBlock;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
import com.fr.design.mainframe.share.util.ShareComponentUtils; import com.fr.design.mainframe.share.util.ShareComponentUtils;
import com.fr.design.share.utils.EffectItemUtils; import com.fr.design.share.utils.EffectItemUtils;
import com.fr.form.share.ShareLoader; import com.fr.design.widget.FormWidgetDefinePaneFactoryBase;
import com.fr.form.share.encrypt.engine.ClazzCreatorFactory;
import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.bridge.BridgeMark;
import com.fr.stable.bridge.StableFactory;
import java.util.List; import java.util.List;
@ -27,6 +34,7 @@ public class SharableManager {
listenEnv(); listenEnv();
ClipboardFilter.registerClipboardHandler(EncryptSelectionClipboardHandler.getInstance()); ClipboardFilter.registerClipboardHandler(EncryptSelectionClipboardHandler.getInstance());
ClipboardFilter.registerClipboardHandler(EncryptTransferableClipboardHandler.getInstance()); ClipboardFilter.registerClipboardHandler(EncryptTransferableClipboardHandler.getInstance());
registerSharableEncryptDefinePanes();
} }
public static void saveTemplate(JTemplate jt) { public static void saveTemplate(JTemplate jt) {
@ -61,4 +69,25 @@ public class SharableManager {
} }
}); });
} }
private static void registerSharableEncryptDefinePane(Class<? extends Widget> mainClazz) {
String newClazzName = ClazzCreatorFactory.getInstance().createName(mainClazz);
Class<? extends Widget> newClazz;
try {
newClazz = (Class<? extends Widget>) Class.forName(newClazzName, false, mainClazz.getClassLoader());
} catch (Exception e) {
newClazz = (Class<? extends Widget>) ClazzCreatorFactory.getInstance().newSharableClazz(mainClazz.getClassLoader(), mainClazz);
}
if (FormWidgetDefinePaneFactoryBase.getDefinePane(newClazz) == null) {
FormWidgetDefinePaneFactoryBase.registerDefinePane(newClazz, FormWidgetDefinePaneFactoryBase.getDefinePane(mainClazz));
}
}
private static void registerSharableEncryptDefinePanes() {
registerSharableEncryptDefinePane(ElementCaseEditor.class);
registerSharableEncryptDefinePane(StableFactory.getMarkedClass(BridgeMark.CHART_EDITOR, AbstractBorderStyleWidget.class));
registerSharableEncryptDefinePane(WAbsoluteLayout.class);
registerSharableEncryptDefinePane(WCardMainBorderLayout.class);
}
} }

Loading…
Cancel
Save