@ -3,6 +3,7 @@ package com.fr.design.mainframe.share.collect;
import com.fr.base.io.XMLReadHelper ;
import com.fr.config.MarketConfig ;
import com.fr.design.DesignerEnvManager ;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo ;
import com.fr.form.share.DefaultSharableWidget ;
import com.fr.form.share.SharableWidgetProvider ;
import com.fr.form.share.constants.ComponentPath ;
@ -44,6 +45,12 @@ import java.util.Iterator;
* created by Harrison on 2020 / 03 / 25
* * /
public class ComponentCollector implements XMLable {
private static final long ONE_MINUTE = 60 * 1000L ;
private static final int REUSE_INFO_FIRST_POPUP = 1 ;
private static final int REUSE_INFO_SECOND_POPUP = 2 ;
private static final String SIMPLE_DATE_PATTERN = "yyyy-MM-dd" ;
private static final String XML = "ComponentCollector" ;
@ -90,8 +97,13 @@ public class ComponentCollector implements XMLable {
private static final String MARKET_CLICK = "marketClick" ;
private static final String PROMPT_JUMP = "promptJump" ;
private static final String TOOLBAR_JUMP = "toolbarJump" ;
private static final String POPUP_JUMP = "popupJump" ;
private static final String uuid = DesignerEnvManager . getEnvManager ( ) . getUUID ( ) ;
private static ComponentCollector instance ;
private int localCmpNumber = 0 ;
@ -103,6 +115,12 @@ public class ComponentCollector implements XMLable {
private int cmpBoardClick = 0 ;
private int promptJump = 0 ;
private int toolbarJump = 0 ;
private int popupJump = 0 ;
private JSONArray activateRecord = JSONFactory . createJSON ( JSON . ARRAY ) ;
private JSONArray generateCmpRecord = JSONFactory . createJSON ( JSON . ARRAY ) ;
@ -314,6 +332,41 @@ public class ComponentCollector implements XMLable {
saveInfo ( ) ;
}
public void collectPromptJumpWhenJump ( ) {
if ( ComponentReuseNotificationInfo . getInstance ( ) . getNotifiedNumber ( ) = = REUSE_INFO_FIRST_POPUP ) {
this . promptJump = 1 ;
saveInfo ( ) ;
} else if ( ComponentReuseNotificationInfo . getInstance ( ) . getNotifiedNumber ( ) = = REUSE_INFO_SECOND_POPUP ) {
this . promptJump = 2 ;
saveInfo ( ) ;
}
}
public void collectPromptJumpWhenShow ( ) {
if ( ComponentReuseNotificationInfo . getInstance ( ) . getNotifiedNumber ( ) = = REUSE_INFO_SECOND_POPUP ) {
this . promptJump = - 1 ;
saveInfo ( ) ;
}
}
public void collectToolbarJump ( ) {
if ( this . toolbarJump = = 0 ) {
this . toolbarJump = 1 ;
saveInfo ( ) ;
}
}
public void collectPopupJump ( ) {
long currentTime = System . currentTimeMillis ( ) ;
long lastGuidePopUpTime = ComponentReuseNotificationInfo . getInstance ( ) . getLastGuidePopUpTime ( ) ;
if ( currentTime - lastGuidePopUpTime < = ONE_MINUTE & & this . popupJump = = 0 ) {
this . popupJump = 1 ;
saveInfo ( ) ;
}
}
public void clearSortType ( ) {
sortType = JSONFactory . createJSON ( JSON . ARRAY ) ;
}
@ -419,6 +472,9 @@ public class ComponentCollector implements XMLable {
this . searchContent = parseJSONArray ( reader . getAttrAsString ( SEARCH_CONTENT , StringUtils . EMPTY ) ) ;
this . filterContent = parseJSONArray ( reader . getAttrAsString ( FILTER_CONTENT , StringUtils . EMPTY ) ) ;
this . sortType = parseJSONArray ( reader . getAttrAsString ( SORT_TYPE , StringUtils . EMPTY ) ) ;
this . promptJump = reader . getAttrAsInt ( PROMPT_JUMP , 0 ) ;
this . toolbarJump = reader . getAttrAsInt ( TOOLBAR_JUMP , 0 ) ;
this . popupJump = reader . getAttrAsInt ( POPUP_JUMP , 0 ) ;
}
}
@ -453,6 +509,9 @@ public class ComponentCollector implements XMLable {
. attr ( SEARCH_CONTENT , searchContent . toString ( ) )
. attr ( FILTER_CONTENT , filterContent . toString ( ) )
. attr ( SORT_TYPE , sortType . toString ( ) )
. attr ( PROMPT_JUMP , promptJump )
. attr ( TOOLBAR_JUMP , toolbarJump )
. attr ( POPUP_JUMP , popupJump )
. end ( ) ;
}
@ -477,6 +536,15 @@ public class ComponentCollector implements XMLable {
jo . put ( SEARCH_CONTENT , searchContent . toString ( ) ) ;
jo . put ( FILTER_CONTENT , filterContent . toString ( ) ) ;
jo . put ( SORT_TYPE , sortType . toString ( ) ) ;
jo . put ( "guideInfo" , assembleGuideInfo ( ) ) ;
return jo . toString ( ) ;
}
private String assembleGuideInfo ( ) {
JSONObject jo = JSONFactory . createJSON ( JSON . OBJECT ) ;
jo . put ( PROMPT_JUMP , promptJump )
. put ( TOOLBAR_JUMP , toolbarJump )
. put ( POPUP_JUMP , popupJump ) ;
return jo . toString ( ) ;
}