@ -1,7 +1,9 @@
package com.fr.design.data.datapane ;
import com.fr.base.TableData ;
import com.fr.data.MultiResultTableData ;
import com.fr.data.TableDataSource ;
import com.fr.data.api.StoreProcedureAssist ;
import com.fr.data.impl.DBTableData ;
import com.fr.data.impl.TableDataSourceDependent ;
import com.fr.design.DesignModelAdapter ;
@ -15,10 +17,10 @@ import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.StrategyConfigAttrUtils ;
import com.fr.design.data.datapane.auth.TableDataAuthHelper ;
import com.fr.design.data.datapane.management.clip.TableDataTreeClipboard ;
import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager ;
import com.fr.design.data.datapane.management.search.pane.TableDataSearchRemindPane ;
import com.fr.design.data.datapane.management.search.pane.TreeSearchToolbarPane ;
import com.fr.design.data.datapane.management.search.searcher.TableDataSearchMode ;
import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager ;
import com.fr.design.data.tabledata.StoreProcedureWorkerListener ;
import com.fr.design.data.tabledata.paste.TableDataFollowingPasteUtils ;
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane ;
@ -121,6 +123,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
/ * *
* 获取不必每次都refreshDockingView的数据集树面板
* 不会主动替换DesignModelAdapter , 需要保证使用时没有跨模板动作 , 谨慎使用
*
* @param tc
* @return
* /
@ -484,7 +487,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
tdNamePanel . addPropertyChangeListener ( new PropertyChangeAdapter ( ) {
@Override
public void propertyChange ( ) {
doPropertyChange ( dg , tdNamePanel , oldName ) ;
checkNameChange ( tableDataPane , dg , tdNamePanel , oldName ) ;
}
} ) ;
// 有些数据集(DBTableData)面板的初始化过程中是包含了SwingWorker处理(查询数据连接、查表等)的
@ -494,6 +497,34 @@ public class TableDataTreePane extends BasicTableDataTreePane {
} ) ;
}
private void checkNameChange ( AbstractTableDataPane < ? > tableDataPane , BasicDialog dg , BasicPane . NamePane nPanel , final String oldName ) {
nPanel . setShowText ( StringUtils . BLANK ) ;
dg . setButtonEnabled ( true ) ;
String tempName = nPanel . getObjectName ( ) ;
if ( StringUtils . isBlank ( tempName ) ) {
nPanel . setShowText ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Table_Data_Empty_Name_Tips" ) ) ;
dg . setButtonEnabled ( false ) ;
} else if ( ! ComparatorUtils . equals ( oldName , tempName ) & & isDsNameRepeaded ( tempName ) ) {
nPanel . setShowText ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Table_Data_Duplicate_Name_Tips" , tempName ) ) ;
dg . setButtonEnabled ( false ) ;
} else if ( oldName . length ( ) > = PROCEDURE_NAME_INDEX & & tableDataPane . updateBean ( ) instanceof MultiResultTableData ) {
if ( isIncludeUnderline ( tempName ) ) {
nPanel . setShowText ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Multi_Result_Table_Data_Name_Tips" ) ) ;
dg . setButtonEnabled ( false ) ;
}
} else if ( ! BasicTableDataUtils . checkName ( tempName ) ) {
dg . setButtonEnabled ( false ) ;
} else {
nPanel . setShowText ( StringUtils . BLANK ) ;
dg . setButtonEnabled ( true ) ;
}
}
private boolean isIncludeUnderline ( String name ) {
return ! ComparatorUtils . equals ( name . indexOf ( StoreProcedureAssist . GROUP_MARKER ) , - 1 ) ;
}
@Override
public void removeTableData ( String sourceName ) {
TableDataSource tds = this . tc . getBook ( ) ;