Browse Source

合代码冲突

research/11.0
neil 5 years ago
parent
commit
d36959825e
  1. 74
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java

74
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -5,6 +5,7 @@ import com.fr.base.PaperSize;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.FormMobileAttrAction; import com.fr.design.actions.FormMobileAttrAction;
@ -13,6 +14,7 @@ import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; import com.fr.design.actions.file.export.EmbeddedFormExportExportAction;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.cell.FloatElementsProvider; import com.fr.design.cell.FloatElementsProvider;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.actions.CopyAction; import com.fr.design.designer.beans.actions.CopyAction;
import com.fr.design.designer.beans.actions.CutAction; import com.fr.design.designer.beans.actions.CutAction;
@ -29,6 +31,7 @@ import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
@ -125,60 +128,63 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
//FORM_TAB代表是否点击编辑,用于点击编辑前后菜单的显示 //FORM_TAB代表是否点击编辑,用于点击编辑前后菜单的显示
protected int index = FORM_TAB; protected int index = FORM_TAB;
private PluginEventListener pluginListener;
public JForm() { public JForm() {
super(new Form(new WBorderLayout("form")), "Form"); super(new Form(new WBorderLayout("form")), "Form");
initPluginPane(); initPluginPane();
startListenPlugin(); startListenPlugin();
} }
public JForm(Form form, FILE file) { public JForm(Form form, FILE file) {
super(form, file); super(form, file);
initPluginPane(); initPluginPane();
startListenPlugin(); startListenPlugin();
} }
private void startListenPlugin() { private void startListenPlugin() {
PluginFilter filter = new PluginFilter() { PluginFilter filter = new PluginFilter() {
@Override @Override
public boolean accept(PluginContext context) { public boolean accept(PluginContext context) {
return context.contain(PropertyItemPaneProvider.XML_TAG); return context.contain(PropertyItemPaneProvider.XML_TAG);
} }
}; };
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginListener = new PluginEventListener(PropertyItemPaneProvider.LAST) {
new PluginEventListener(PropertyItemPaneProvider.LAST) { @Override
@Override public void on(PluginEvent event) {
public void on(PluginEvent event) { PluginContext context = event.getContext();
PluginContext context = event.getContext(); PluginRuntime runtime = context.getRuntime();
PluginRuntime runtime = context.getRuntime(); Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG); for (PropertyItemPaneProvider provider : providers) {
for (PropertyItemPaneProvider provider : providers) { addPane(provider);
addPane(provider); }
} }
} };
}, filter); PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginListener, filter);
} }
private void initPluginPane() { private void initPluginPane() {
ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign); ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<PropertyItemPaneProvider> providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG); Set<PropertyItemPaneProvider> providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) { for (PropertyItemPaneProvider provider : providers) {
addPane(provider); addPane(provider);
} }
} }
private void addPane(PropertyItemPaneProvider provider) { private void addPane(PropertyItemPaneProvider provider) {
PaneHolder<FormDesigner> holder = provider.getPaneHolder(FormDesigner.class); PaneHolder<FormDesigner> holder = provider.getPaneHolder(FormDesigner.class);
if (holder != null) { if (holder != null) {
JPanel panel = holder.getInstance(formDesign); JPanel panel = holder.getInstance(formDesign);
EastRegionContainerPane.getInstance().replaceKeyPane(provider.key(), panel); EastRegionContainerPane.getInstance().replaceKeyPane(provider.key(), panel);
} }
} }
@Override @Override
public void refreshEastPropertiesPane() { public void refreshEastPropertiesPane() {
// 暂时用不到,遇到的时候再加刷新右侧tab面板的代码 // 暂时用不到,遇到的时候再加刷新右侧tab面板的代码
@ -203,12 +209,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
} }
public TemplateProcessInfo<Form> getProcessInfo() { public TemplateProcessInfo<Form> getProcessInfo() {
//这边需要判空,图表的埋点信息收集时可能没有初始化processInfo
if (processInfo == null) { if (processInfo == null) {
processInfo = new JFormProcessInfo(template); processInfo = new JFormProcessInfo(template);
} }
return processInfo; return processInfo;
} }
public FormECCompositeProvider getReportComposite() { public FormECCompositeProvider getReportComposite() {
return this.reportComposite; return this.reportComposite;
} }
@ -559,10 +567,19 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
@Override @Override
public ShortCut[] shortcut4TemplateMenu() { public ShortCut[] shortcut4TemplateMenu() {
if (this.index == FORM_TAB) { if (this.index == FORM_TAB) {
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), getReportFitAttrAction()}, new ShortCut[0]);
} else { } else {
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), getReportFitAttrAction()}, this.elementCaseDesign.shortcut4TemplateMenu());
}
}
private ShortCut getReportFitAttrAction() {
FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING);
if (adaptiveConfigUI != null) {
return adaptiveConfigUI.getConfigShortCut(this);
} }
return new ReportFitAttrAction(this);
} }
/** /**
@ -644,6 +661,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
//下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC //下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC
formDesign.setElementCase(dataTable); formDesign.setElementCase(dataTable);
} }
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -822,7 +840,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
refreshWidgetLibPane(); refreshWidgetLibPane();
} }
private void refreshWidgetLibPane() { private void refreshWidgetLibPane() {
if (EastRegionContainerPane.getInstance().getWidgetLibPane() == null) { if (EastRegionContainerPane.getInstance().getWidgetLibPane() == null) {
new Thread() { new Thread() {
@ -872,6 +890,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
* @param index 切换位置 * @param index 切换位置
*/ */
public void tabChanged(int index) { public void tabChanged(int index) {
this.index = index;
if (index == ELEMENTCASE_TAB) { if (index == ELEMENTCASE_TAB) {
formDesign.setReportBlockEditing(true); formDesign.setReportBlockEditing(true);
ecTabAction(); ecTabAction();
@ -879,7 +898,6 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
formDesign.setReportBlockEditing(false); formDesign.setReportBlockEditing(false);
formTabAction(); formTabAction();
} }
this.index = index;
refreshToolArea(); refreshToolArea();
this.cardLayout.show(tabCenterPane, CARDNAME[index]); this.cardLayout.show(tabCenterPane, CARDNAME[index]);
if (elementCaseDesign != null && index == ELEMENTCASE_TAB) { if (elementCaseDesign != null && index == ELEMENTCASE_TAB) {
@ -1022,4 +1040,10 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
// richer:form文件 daniel 改成三个字 // richer:form文件 daniel 改成三个字
fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRM, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRM, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
} }
@Override
public void whenClose() {
// stop的时候 pluginListener 和 PluginFilter 都会移除
PluginListenerRegistration.getInstance().stopListen(this.pluginListener);
}
} }

Loading…
Cancel
Save