@ -49,6 +49,7 @@ import com.fr.design.menu.ShortCut;
import com.fr.design.preview.PagePreview ;
import com.fr.design.preview.PagePreview ;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane ;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane ;
import com.fr.design.write.submit.DBManipulationPane ;
import com.fr.design.write.submit.DBManipulationPane ;
import com.fr.event.EventDispatcher ;
import com.fr.file.FILE ;
import com.fr.file.FILE ;
import com.fr.file.FILEChooserPane ;
import com.fr.file.FILEChooserPane ;
import com.fr.file.MemFILE ;
import com.fr.file.MemFILE ;
@ -107,7 +108,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
private DesignModelAdapter < T , ? > designModel ;
private DesignModelAdapter < T , ? > designModel ;
private PreviewProvider previewType ;
private PreviewProvider previewType ;
protected TimeConsumeTimer consumeTimer = new TimeConsumeTimer ( ) ;
protected TimeConsumeTimer consumeTimer = new TimeConsumeTimer ( ) ;
public int resolution = ScreenResolution . getScreenResolution ( ) ;
private PluginEventListener pluginListener ;
private PluginEventListener pluginListener ;
@ -125,6 +125,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public JTemplate ( T t , FILE file , boolean isNewFile ) {
public JTemplate ( T t , FILE file , boolean isNewFile ) {
super ( t ) ;
super ( t ) ;
beforeInit ( ) ;
// 判断是否切换设计器状态到禁止拷贝剪切
// 判断是否切换设计器状态到禁止拷贝剪切
if ( t . getAttrMark ( DesignBanCopyAttrMark . XML_TAG ) ! = null ) {
if ( t . getAttrMark ( DesignBanCopyAttrMark . XML_TAG ) ! = null ) {
DesignModeContext . switchTo ( com . fr . design . base . mode . DesignerMode . BAN_COPY_AND_CUT ) ;
DesignModeContext . switchTo ( com . fr . design . base . mode . DesignerMode . BAN_COPY_AND_CUT ) ;
@ -301,6 +302,20 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
}
/ * *
* 模板初始化之前
* /
private void beforeInit ( ) {
EventDispatcher . fire ( JTemplateEvent . BEFORE_TEMPLATE_INIT , this ) ;
}
/ * *
* 模板激活之前之前
* /
protected void beforeActive ( ) {
EventDispatcher . fire ( JTemplateEvent . BEFORE_TEMPLATE_ACTIVE , this ) ;
}
/ * *
/ * *
* 模板关闭时
* 模板关闭时
* /
* /
@ -309,6 +324,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
PluginListenerRegistration . getInstance ( ) . stopListen ( this . pluginListener ) ;
PluginListenerRegistration . getInstance ( ) . stopListen ( this . pluginListener ) ;
}
}
/ * *
/ * *
* 刷新内部资源
* 刷新内部资源
*
*
@ -1076,6 +1092,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* 激活指定的template
* 激活指定的template
* /
* /
public void activeJTemplate ( int index , JTemplate jt ) {
public void activeJTemplate ( int index , JTemplate jt ) {
beforeActive ( ) ;
DesignerContext . getDesignerFrame ( ) . activateJTemplate ( this ) ;
DesignerContext . getDesignerFrame ( ) . activateJTemplate ( this ) ;
}
}
@ -1083,6 +1100,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* 激活已存在的模板
* 激活已存在的模板
* /
* /
public void activeOldJTemplate ( ) {
public void activeOldJTemplate ( ) {
beforeActive ( ) ;
DesignerContext . getDesignerFrame ( ) . activateJTemplate ( this ) ;
DesignerContext . getDesignerFrame ( ) . activateJTemplate ( this ) ;
}
}
@ -1090,6 +1108,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* 激活新的模板
* 激活新的模板
* /
* /
public void activeNewJTemplate ( ) {
public void activeNewJTemplate ( ) {
beforeActive ( ) ;
DesignerContext . getDesignerFrame ( ) . addAndActivateJTemplate ( this ) ;
DesignerContext . getDesignerFrame ( ) . addAndActivateJTemplate ( this ) ;
}
}