|
|
|
@ -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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|