@ -9,6 +9,7 @@ import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.dialog.FineJOptionPane ;
import com.fr.design.dialog.FineJOptionPane ;
import com.fr.design.dialog.UIDialog ;
import com.fr.design.dialog.UIDialog ;
import com.fr.design.file.HistoryTemplateListCache ;
import com.fr.design.file.HistoryTemplateListCache ;
import com.fr.design.gui.icombobox.UIComboBox ;
import com.fr.design.gui.itextfield.UITextField ;
import com.fr.design.gui.itextfield.UITextField ;
import com.fr.design.i18n.Toolkit ;
import com.fr.design.i18n.Toolkit ;
import com.fr.design.mainframe.DesignerContext ;
import com.fr.design.mainframe.DesignerContext ;
@ -22,6 +23,7 @@ import com.fr.stable.StringUtils;
import javax.swing.JOptionPane ;
import javax.swing.JOptionPane ;
import javax.swing.JPanel ;
import javax.swing.JPanel ;
import java.awt.BorderLayout ;
import java.awt.BorderLayout ;
import java.awt.Color ;
import java.awt.Dimension ;
import java.awt.Dimension ;
import java.awt.Point ;
import java.awt.Point ;
import java.awt.event.ActionEvent ;
import java.awt.event.ActionEvent ;
@ -117,8 +119,10 @@ public class ITReplaceMainDialog extends UIDialog {
JPanel center = new JPanel ( new BorderLayout ( ) ) ;
JPanel center = new JPanel ( new BorderLayout ( ) ) ;
UIComboBox replaceComboBox = northPane . getReplaceInputCombobox ( ) ;
northPane . getFindInputCombobox ( ) . setEditable ( true ) ;
northPane . getFindInputCombobox ( ) . setEditable ( true ) ;
northPane . getReplaceInputCombobox ( ) . setEditable ( false ) ;
replaceComboBox . setEnabled ( false ) ;
replaceComboBox . setEditable ( true ) ;
northPane . getReplaceButton ( ) . setEnabled ( false ) ;
northPane . getReplaceButton ( ) . setEnabled ( false ) ;
( ( UITextField ) ( northPane . getFindInputCombobox ( ) . getEditor ( ) . getEditorComponent ( ) ) ) . setPlaceholder ( Toolkit . i18nText ( "Fine-Design_Replace_Search_Input" ) ) ;
( ( UITextField ) ( northPane . getFindInputCombobox ( ) . getEditor ( ) . getEditorComponent ( ) ) ) . setPlaceholder ( Toolkit . i18nText ( "Fine-Design_Replace_Search_Input" ) ) ;
@ -160,7 +164,8 @@ public class ITReplaceMainDialog extends UIDialog {
private void replace ( ) {
private void replace ( ) {
String searchStr = ( ( UITextField ) ( northPane . getFindInputCombobox ( ) . getEditor ( ) . getEditorComponent ( ) ) ) . getText ( ) ;
String searchStr = ( ( UITextField ) ( northPane . getFindInputCombobox ( ) . getEditor ( ) . getEditorComponent ( ) ) ) . getText ( ) ;
String replaceStr = ( ( UITextField ) ( northPane . getReplaceInputCombobox ( ) . getEditor ( ) . getEditorComponent ( ) ) ) . getText ( ) ;
String replaceStr = ( ( UITextField ) ( northPane . getReplaceInputCombobox ( ) . getEditor ( ) . getEditorComponent ( ) ) ) . getText ( ) ;
if ( StringUtils . equals ( getSearchStr ( ) , searchStr ) ) {
//替换内容为空需要触发搜索
if ( StringUtils . equals ( getSearchStr ( ) , searchStr ) & & StringUtils . isNotEmpty ( replaceStr ) ) {
if ( isITReplaceValid ( ) & & checkTemplateChanged ( searchResultList ) ) {
if ( isITReplaceValid ( ) & & checkTemplateChanged ( searchResultList ) ) {
for ( Info info : searchResultList ) {
for ( Info info : searchResultList ) {
if ( info . getContent ( ) . isSelected ( ) ) {
if ( info . getContent ( ) . isSelected ( ) ) {
@ -298,7 +303,8 @@ public class ITReplaceMainDialog extends UIDialog {
northPane . getResultLabel ( ) . setText ( "<html>" + Toolkit . i18nText ( "Fine-Design_Replace_Search_Finish" ) + "<font color = 'rgb(61,153,249)'>" + searchResultList . size ( ) + "</font>" + Toolkit . i18nText ( "Fine-Design_Replace_Result" ) ) ;
northPane . getResultLabel ( ) . setText ( "<html>" + Toolkit . i18nText ( "Fine-Design_Replace_Search_Finish" ) + "<font color = 'rgb(61,153,249)'>" + searchResultList . size ( ) + "</font>" + Toolkit . i18nText ( "Fine-Design_Replace_Result" ) ) ;
}
}
ITTableEditorPane . ITHeaderRenderer renderer = ( ITTableEditorPane . ITHeaderRenderer ) getEditTable ( ) . getTableHeader ( ) . getDefaultRenderer ( ) ;
ITTableEditorPane . ITHeaderRenderer renderer = ( ITTableEditorPane . ITHeaderRenderer ) getEditTable ( ) . getTableHeader ( ) . getDefaultRenderer ( ) ;
renderer . refreshHeader ( getEditTable ( ) ) ;
//刷新表头,并且重新勾选中表头全选框
renderer . refreshHeader ( getEditTable ( ) , true ) ;
itTableEditor . fireTableDataChanged ( ) ;
itTableEditor . fireTableDataChanged ( ) ;
northPane . refreshFindInputComboBoxItems ( ) ;
northPane . refreshFindInputComboBoxItems ( ) ;
setSearchFlag ( true ) ;
setSearchFlag ( true ) ;
@ -306,18 +312,17 @@ public class ITReplaceMainDialog extends UIDialog {
//如果有结果,默认选中第一行
//如果有结果,默认选中第一行
if ( searchResultList . size ( ) > 0 ) {
if ( searchResultList . size ( ) > 0 ) {
getEditTable ( ) . addRowSelectionInterval ( FIRST_ROW , FIRST_ROW ) ;
getEditTable ( ) . addRowSelectionInterval ( FIRST_ROW , FIRST_ROW ) ;
northPane . getReplaceButton ( ) . setEnabled ( true ) ;
}
}
//更新替换按钮可用性
//设置替换输入框的可用性
if ( StringUtils . isEmpty ( searchStr ) | | searchResultList . size ( ) = = 0 ) {
if ( StringUtils . isNotEmpty ( searchStr ) ) {
northPane . getReplaceButton ( ) . setEnabled ( false ) ;
( ( UITextField ) ( northPane . getReplaceInputCombobox ( ) . getEditor ( ) . getEditorComponent ( ) ) ) . setEditable ( true ) ;
northPane . getReplaceInputCombobox ( ) . setEditable ( true ) ;
} else {
} else {
( ( UITextField ) ( northPane . getReplaceInputCombobox ( ) . getEditor ( ) . getEditorComponent ( ) ) ) . setEditable ( false ) ;
northPane . getReplaceButton ( ) . setEnabled ( true ) ;
northPane . getReplaceInputCombobox ( ) . setEditable ( false ) ;
}
}
//设置替换输入框的可用性
northPane . getReplaceInputCombobox ( ) . setEnabled ( StringUtils . isNotEmpty ( searchStr ) ) ;
} else {
} else {
//todo
//todo
}
}