@ -5,9 +5,15 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter ;
import com.fr.design.file.HistoryTemplateListCache ;
import com.fr.design.mainframe.DesignerContext ;
import com.fr.design.mainframe.JTemplate ;
import com.fr.design.mainframe.WorkSheetDesigner ;
import com.fr.design.menu.KeySetUtils ;
import com.fr.design.report.ReportEnginePane ;
import com.fr.intelli.record.FocusPoint ;
import com.fr.intelli.record.MetricRegistry ;
import com.fr.intelli.record.Original ;
import com.fr.json.JSONObject ;
import com.fr.report.stable.LayerReportAttr ;
import com.fr.report.worksheet.WorkSheet ;
public class ReportEngineAttrAction extends ReportComponentAction < WorkSheetDesigner > {
@ -19,7 +25,6 @@ public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesig
this . setMnemonic ( getMenuKeySet ( ) . getMnemonic ( ) ) ;
this . setSmallIcon ( "/com/fr/design/images/m_report/reportEngineAttr" ) ;
this . generateAndSetSearchText ( ReportEnginePane . class . getName ( ) ) ;
}
private boolean isChange ;
@ -43,9 +48,15 @@ public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesig
@Override
public void doOk ( ) {
isChange = true ;
tplEC . setLayerReportAttr ( layerReportEnginePane . updateBean ( ) ) ;
LayerReportAttr originLayerReportAttr = tplEC . getLayerReportAttr ( ) ;
LayerReportAttr layerReportAttr = layerReportEnginePane . updateBean ( ) ;
tplEC . setLayerReportAttr ( layerReportAttr ) ;
//设置新引擎后,需要刷新一下,计算属性设置入口是否显示,取决于是否设置了新引擎模式。
DesignerContext . getDesignerFrame ( ) . resetToolkitByPlus ( HistoryTemplateListCache . getInstance ( ) . getCurrentEditingTemplate ( ) ) ;
//只有当前设置为新引擎时,才会提交埋点。
if ( layerReportAttr . isEnableEngineX ( ) & & layerReportAttr . isChanged ( originLayerReportAttr ) ) {
new ReportEngineMetricRecord ( ) . submit ( layerReportAttr ) ;
}
}
} ) ;
@ -53,4 +64,29 @@ public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesig
return isChange ;
}
/ * *
* 内部类
* * /
class ReportEngineMetricRecord {
private final static String FOCUS_ID = "FR-F6011" ;
private void submit ( LayerReportAttr layerReportAttr ) {
JSONObject body = new JSONObject ( ) ;
body . put ( "totalPage" , layerReportAttr . isPageQuery ( ) ? 1 : 0 ) ;
body . put ( "pagesize" , layerReportAttr . getCountPerPage ( ) ) ;
body . put ( "totalNum" , layerReportAttr . isEnableRowCount ( ) ? 1 : 0 ) ;
FocusPoint focusPoint = FocusPoint . newBuilder ( )
. id ( FOCUS_ID )
. source ( Original . EMBED )
. text ( getPath ( ) )
. body ( body . toString ( ) )
. build ( ) ;
MetricRegistry . getMetric ( ) . submit ( focusPoint ) ;
}
private String getPath ( ) {
JTemplate < ? , ? > currentEditingTemplate = HistoryTemplateListCache . getInstance ( ) . getCurrentEditingTemplate ( ) ;
return currentEditingTemplate . getPath ( ) ;
}
}
}