Browse Source

Pull request #1744: REPORT-31990 设计器右侧面板新增tab接口

Merge in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit 'c78baf759fcbe29362cefebf1e815679243def4f':
  REPORT-31990 设计器右侧面板新增tab接口
feature/big-screen
Hades 4 years ago
parent
commit
8205c92da9
  1. 57
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 2
      designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java
  3. 54
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  4. 11
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

57
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -28,6 +28,7 @@ import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerFrameUpButtonProvider;
import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
@ -55,6 +56,14 @@ import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
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.plugin.observer.PluginEventType;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage;
import com.fr.stable.ArrayUtils;
@ -100,7 +109,10 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
protected TimeConsumeTimer consumeTimer = new TimeConsumeTimer();
public int resolution = ScreenResolution.getScreenResolution();
private PluginEventListener pluginListener;
public JTemplate() {
initAndStartPlugin();
}
public JTemplate(T t, String defaultFileName) {
@ -129,8 +141,50 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
designModel = createDesignModel();
consumeTimer.setEnabled(shouldInitForCollectInfo(isNewFile));
initAndStartPlugin();
}
private void initAndStartPlugin() {
initPluginPane();
startListenPlugin();
}
private void startListenPlugin() {
PluginFilter filter = new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PropertyItemPaneProvider.XML_TAG);
}
};
this.pluginListener = new PluginEventListener(PropertyItemPaneProvider.LAST) {
@Override
public void on(PluginEvent event) {
PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime();
Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPane(provider);
}
}
};
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginListener, filter);
}
private void initPluginPane() {
ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<PropertyItemPaneProvider> providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPane(provider);
}
}
protected <R> void addPane(PropertyItemPaneProvider provider) {
// do nothing
}
void onGetFocus() {
consumeTimer.start();
}
@ -251,7 +305,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* 模板关闭时
*/
public void whenClose() {
// do nothing
// stop的时候 pluginListener 和 PluginFilter 都会移除
PluginListenerRegistration.getInstance().stopListen(this.pluginListener);
}
/**

2
designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java

@ -211,6 +211,8 @@ public class JVirtualTemplate extends JTemplate {
List<JTemplate<?, ?>> historyList = HistoryTemplateListPane.getInstance().getHistoryList();
historyList.set(index, jt);
DesignerContext.getDesignerFrame().addAndActivateJTemplate(jt);
// 虚拟模板JVirtualTemplate被激活后 由真实的JTemplate替换 此时调用whenClose 防止JVirtualTemplate无法释放
this.whenClose();
}
@Override

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

@ -70,14 +70,7 @@ import com.fr.form.ui.container.WLayout;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.page.PaperSettingProvider;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
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.plugin.observer.PluginEventType;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.worksheet.FormElementCase;
@ -104,7 +97,6 @@ import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<Form> {
private static final String FORM_CARD = "FORM";
@ -132,51 +124,15 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
public JForm() {
super(new Form(new WBorderLayout("form")), "Form");
initPluginPane();
startListenPlugin();
}
public JForm(Form form, FILE file) {
super(form, file);
initPluginPane();
startListenPlugin();
}
private void startListenPlugin() {
PluginFilter filter = new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PropertyItemPaneProvider.XML_TAG);
}
};
this.pluginListener = new PluginEventListener(PropertyItemPaneProvider.LAST) {
@Override
public void on(PluginEvent event) {
PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime();
Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPane(provider);
}
}
};
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginListener, filter);
}
private void initPluginPane() {
ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<PropertyItemPaneProvider> providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPane(provider);
}
}
private void addPane(PropertyItemPaneProvider provider) {
@Override
protected void addPane(PropertyItemPaneProvider provider) {
PaneHolder<FormDesigner> holder = provider.getPaneHolder(FormDesigner.class);
if (holder != null) {
@ -1040,10 +996,4 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
// richer:form文件 daniel 改成三个字
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);
}
}

11
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -36,6 +36,7 @@ import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
@ -152,6 +153,15 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
populateReportParameterAttr();
}
@Override
protected void addPane(PropertyItemPaneProvider provider) {
PaneHolder<JWorkBook> holder = provider.getPaneHolder(JWorkBook.class);
if (holder != null) {
JPanel panel = holder.getInstance(this);
EastRegionContainerPane.getInstance().replaceKeyPane(provider.key(), panel);
}
}
@Override
public void refreshEastPropertiesPane() {
if (isEditingPolySheet()) {
@ -1191,6 +1201,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
@Override
public void whenClose() {
super.whenClose();
reportComposite.doRemoveAction();
}
}

Loading…
Cancel
Save