@ -4,12 +4,14 @@ import com.fr.base.Formula;
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSHighlightAction ;
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSHighlightAction ;
import com.fr.design.actions.replace.info.FormulaInfo ;
import com.fr.design.actions.replace.info.FormulaInfo ;
import com.fr.design.actions.replace.info.base.ITContent ;
import com.fr.design.actions.replace.info.base.ITContent ;
import com.fr.design.actions.replace.info.base.SearchTag ;
import com.fr.design.i18n.Toolkit ;
import com.fr.design.i18n.Toolkit ;
import com.fr.form.event.Listener ;
import com.fr.form.event.Listener ;
import com.fr.form.ui.DataControl ;
import com.fr.form.ui.DataControl ;
import com.fr.form.ui.Widget ;
import com.fr.form.ui.Widget ;
import com.fr.form.ui.container.WScaleLayout ;
import com.fr.form.ui.container.WScaleLayout ;
import com.fr.form.ui.widget.CRBoundsWidget ;
import com.fr.form.ui.widget.CRBoundsWidget ;
import com.fr.stable.StableUtils ;
import java.util.List ;
import java.util.List ;
@ -33,12 +35,13 @@ public abstract class AbstractSearchWidgetFormulaAction implements SearchWidgetF
Widget widget = ( Widget ) content . getReplaceObject ( ) ;
Widget widget = ( Widget ) content . getReplaceObject ( ) ;
//控件值中的公式
//控件值中的公式
searchFormulaFromWidgetValue ( content , formulaInfos ) ;
searchFormulaFromWidgetValue ( content , formulaInfos ) ;
searchFormulaFromWidgetLabel ( content , formulaInfos ) ;
for ( int i = 0 ; i < widget . getListenerSize ( ) ; i + + ) {
for ( int i = 0 ; i < widget . getListenerSize ( ) ; i + + ) {
Listener listener = widget . getListener ( i ) ;
Listener listener = widget . getListener ( i ) ;
ITContent newContent = ITContent . copy ( content ) ;
ITContent newContent = ITContent . copy ( content ) ;
//控件的事件可以使用的JS有五种,这边统一交给Highlight那边判断超级链接并进行处理
//控件的事件可以使用的JS有五种,这边统一交给Highlight那边判断超级链接并进行处理
SearchJSHighlightAction jsHighlightAction = SearchJSHighlightAction . getInstance ( ) ;
SearchJSHighlightAction jsHighlightAction = SearchJSHighlightAction . getInstance ( ) ;
newContent . addOtherPos ( Toolkit . i18nText ( "Fine-Design_Report_Event" ) , listener . getName ( ) ) ;
newContent . addOtherPos ( Toolkit . i18nText ( "Fine-Design_Report_Event" ) , listener . getName ( ) ) ;
jsHighlightAction . searchJSFormulaFromOther ( formulaInfos , newContent , listener . getAction ( ) ) ;
jsHighlightAction . searchJSFormulaFromOther ( formulaInfos , newContent , listener . getAction ( ) ) ;
}
}
@ -53,8 +56,8 @@ public abstract class AbstractSearchWidgetFormulaAction implements SearchWidgetF
@Override
@Override
public void searchFormulaFromWidgetValue ( ITContent content , List < FormulaInfo > formulaInfos ) {
public void searchFormulaFromWidgetValue ( ITContent content , List < FormulaInfo > formulaInfos ) {
Widget widget = ( Widget ) content . getReplaceObject ( ) ;
Widget widget = ( Widget ) content . getReplaceObject ( ) ;
if ( widget instanceof WScaleLayout ) {
if ( widget instanceof WScaleLayout ) {
widget = ( ( CRBoundsWidget ) ( ( WScaleLayout ) widget ) . getWidget ( 0 ) ) . getWidget ( ) ;
widget = ( ( CRBoundsWidget ) ( ( WScaleLayout ) widget ) . getWidget ( 0 ) ) . getWidget ( ) ;
}
}
if ( widget instanceof DataControl ) {
if ( widget instanceof DataControl ) {
if ( isWidgetValueValid ( ( ( DataControl ) widget ) ) ) {
if ( isWidgetValueValid ( ( ( DataControl ) widget ) ) ) {
@ -66,7 +69,23 @@ public abstract class AbstractSearchWidgetFormulaAction implements SearchWidgetF
}
}
}
}
private boolean isWidgetValueValid ( DataControl control ) {
public void searchFormulaFromWidgetLabel ( ITContent content , List < FormulaInfo > formulaInfos ) {
Widget widget = ( Widget ) content . getReplaceObject ( ) ;
if ( widget instanceof WScaleLayout ) {
widget = ( ( CRBoundsWidget ) ( ( WScaleLayout ) widget ) . getWidget ( 0 ) ) . getWidget ( ) ;
}
if ( StableUtils . canBeFormula ( widget . getLabelName ( ) ) ) {
ITContent newContent = ITContent . copy ( content ) ;
newContent . addOtherPos ( Toolkit . i18nText ( "Fine-Design_Form_Label_Name" ) ) ;
newContent . setHoldObject ( widget ) ;
newContent . setReplaceObject ( widget . getLabelName ( ) ) ;
newContent . setTag ( SearchTag . WIDGET_LABEL ) ;
formulaInfos . add ( new FormulaInfo ( newContent ) ) ;
}
}
private boolean isWidgetValueValid ( DataControl control ) {
return control . getWidgetValue ( ) ! = null
return control . getWidgetValue ( ) ! = null
& & control . getWidgetValue ( ) . getValue ( ) instanceof Formula ;
& & control . getWidgetValue ( ) . getValue ( ) instanceof Formula ;
}
}