@ -51,6 +51,8 @@ public class ITReplaceMainDialog extends UIDialog {
private ITReplaceWestPanel westPanel ;
private boolean searchFlag ;
private String searchStr ;
private static final int FIRST_ROW = 0 ;
public static int selectCount = 0 ;
public ITReplaceMainDialog ( ) {
super ( DesignerContext . getDesignerFrame ( ) ) ;
@ -117,6 +119,7 @@ public class ITReplaceMainDialog extends UIDialog {
northPane . getFindInputCombobox ( ) . setEditable ( true ) ;
northPane . getReplaceInputCombobox ( ) . setEditable ( false ) ;
northPane . getReplaceButton ( ) . setEnabled ( false ) ;
( ( UITextField ) ( northPane . getFindInputCombobox ( ) . getEditor ( ) . getEditorComponent ( ) ) ) . setPlaceholder ( Toolkit . i18nText ( "Fine-Design_Replace_Search_Input" ) ) ;
( ( UITextField ) ( northPane . getReplaceInputCombobox ( ) . getEditor ( ) . getEditorComponent ( ) ) ) . setPlaceholder ( Toolkit . i18nText ( "Fine-Design_Replace_Input" ) ) ;
@ -282,9 +285,13 @@ public class ITReplaceMainDialog extends UIDialog {
templateID = HistoryTemplateListCache . getInstance ( ) . getCurrentEditingTemplate ( ) . getTarget ( ) . getTemplateID ( ) ;
itTableEditor . clear ( ) ;
String searchStr = ( ( UITextField ) ( northPane . getFindInputCombobox ( ) . getEditor ( ) . getEditorComponent ( ) ) ) . getText ( ) ;
//更新搜索内容
setSearchStr ( searchStr ) ;
//处理通配符的regexStr
ShowValueUtils . containPattern = Pattern . compile ( ShowValueUtils . changeRegex ( searchStr ) ) ;
//获取搜索目标
ShowSearchResultAction searchAction = ShowSearchResultAction . match ( GeneralUtils . objectToString ( northPane . getFindCombobox ( ) . getSelectedItem ( ) ) ) ;
//搜索
if ( searchAction ! = null ) {
searchResultList = searchAction . addMatchResult ( searchStr , searchAction . showSearchValue ( jTemplate ) ) ;
itTableEditor . add ( searchResultList ) ;
@ -295,7 +302,15 @@ public class ITReplaceMainDialog extends UIDialog {
itTableEditor . fireTableDataChanged ( ) ;
northPane . refreshFindInputComboBoxItems ( ) ;
setSearchFlag ( true ) ;
selectCount = searchResultList . size ( ) ;
//如果有结果,默认选中第一行
if ( searchResultList . size ( ) > 0 ) {
getEditTable ( ) . addRowSelectionInterval ( FIRST_ROW , FIRST_ROW ) ;
northPane . getReplaceButton ( ) . setEnabled ( true ) ;
}
//设置替换输入框的可用性
if ( StringUtils . isNotEmpty ( searchStr ) ) {
( ( UITextField ) ( northPane . getReplaceInputCombobox ( ) . getEditor ( ) . getEditorComponent ( ) ) ) . setEditable ( true ) ;
northPane . getReplaceInputCombobox ( ) . setEditable ( true ) ;
@ -309,7 +324,21 @@ public class ITReplaceMainDialog extends UIDialog {
}
public ITReplaceSouthPanel getSouthPanel ( ) {
return southPanel ;
}
public void setSouthPanel ( ITReplaceSouthPanel southPanel ) {
this . southPanel = southPanel ;
}
public ITReplaceNorthPanel getNorthPane ( ) {
return northPane ;
}
public void setNorthPane ( ITReplaceNorthPanel northPane ) {
this . northPane = northPane ;
}
/ * *
* 检测结果是否合法