@ -1,8 +1,6 @@
/ *
* Copyright ( c ) 2001 - 2010 , FineReport Inc , All Rights Reserved .
* /
package com.fr.design.actions.server ;
package com.fr.design.actions.server ;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory ;
import com.fr.base.TableData ;
import com.fr.base.TableData ;
import com.fr.design.DesignModelAdapter ;
import com.fr.design.DesignModelAdapter ;
import com.fr.design.actions.UpdateAction ;
import com.fr.design.actions.UpdateAction ;
@ -14,7 +12,6 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter ;
import com.fr.design.dialog.DialogActionAdapter ;
import com.fr.design.editlock.EditLockUtils ;
import com.fr.design.editlock.EditLockUtils ;
import com.fr.design.editlock.ServerTableDataLockChangeChecker ;
import com.fr.design.editlock.ServerTableDataLockChangeChecker ;
import com.fr.design.gui.NameInspector ;
import com.fr.design.gui.imenu.UILockMenuItem ;
import com.fr.design.gui.imenu.UILockMenuItem ;
import com.fr.design.gui.imenu.UIMenuItem ;
import com.fr.design.gui.imenu.UIMenuItem ;
import com.fr.design.mainframe.DesignerContext ;
import com.fr.design.mainframe.DesignerContext ;
@ -23,7 +20,6 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.esd.event.DSMapping ;
import com.fr.esd.event.DSMapping ;
import com.fr.esd.event.DsNameTarget ;
import com.fr.esd.event.DsNameTarget ;
import com.fr.esd.event.StrategyEventsNotifier ;
import com.fr.esd.event.StrategyEventsNotifier ;
import com.fr.file.TableDataConfig ;
import com.fr.report.LockItem ;
import com.fr.report.LockItem ;
@ -79,12 +75,10 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
}
}
// 锁定成功,执行后续操作
// 锁定成功,执行后续操作
final DesignerFrame designerFrame = DesignerContext . getDesignerFrame ( ) ;
final DesignerFrame designerFrame = DesignerContext . getDesignerFrame ( ) ;
final TableDataConfig tableDataConfig = TableDataConfig . getInstance ( ) ;
final Map < String , TableData > tableDataMap = TableDataConfigProviderFactory . getInstance ( ) . getTableDatas ( ) ;
final TableDataManagerPane globalTableDataPane = new TableDataManagerPane ( ) {
final TableDataManagerPane globalTableDataPane = new TableDataManagerPane ( ) {
public void complete ( ) {
public void complete ( ) {
populate ( tableDataMap ) ;
TableDataConfig mirror = tableDataConfig . mirror ( ) ;
populate ( mirror ) ;
}
}
protected void renameConnection ( final String oldName , final String newName ) {
protected void renameConnection ( final String oldName , final String newName ) {
@ -102,10 +96,10 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
globalTableDataDialog . setDoOKSucceed ( false ) ;
globalTableDataDialog . setDoOKSucceed ( false ) ;
return ;
return ;
}
}
globalTableDataPane . update ( tableDataConfig ) ;
globalTableDataPane . update ( tableDataMap ) ;
DesignTableDataManager . clearGlobalDs ( ) ;
DesignTableDataManager . clearGlobalDs ( ) ;
// 保存时 移除服务器数据集列名缓存
// 保存时 移除服务器数据集列名缓存
for ( String name : tableDataConfig . getTableDatas ( ) . keySet ( ) ) {
for ( String name : tableDataMap . keySet ( ) ) {
DesignTableDataManager . removeSelectedColumnNames ( name ) ;
DesignTableDataManager . removeSelectedColumnNames ( name ) ;
}
}
// 刷新共有数据集
// 刷新共有数据集
@ -125,32 +119,6 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
globalTableDataDialog . setVisible ( true ) ;
globalTableDataDialog . setVisible ( true ) ;
}
}
private boolean doWithDatasourceManager ( TableDataConfig datasourceManager , TableDataManagerPane tableDataManagerPane , BasicDialog databaseListDialog ) {
boolean isFailed = false ;
//
//存在请重命名则不能更新
int index = isTableDataMapContainsRename ( datasourceManager ) ;
if ( index ! = - 1 ) {
isFailed = true ;
tableDataManagerPane . setSelectedIndex ( index ) ;
}
databaseListDialog . setDoOKSucceed ( ! isFailed ) ;
return ! isFailed ;
}
/ * *
* 是否包含重命名key
*
* @return 包含则返回序列 , 若返回 - 1则说明不包含重命名key
* /
public int isTableDataMapContainsRename ( TableDataConfig datasourceManager ) {
Map < String , TableData > tableDataMap = datasourceManager . getTableDatas ( ) ;
if ( tableDataMap . containsKey ( NameInspector . ILLEGAL_NAME_HOLDER ) ) {
return datasourceManager . getTableDataIndex ( NameInspector . ILLEGAL_NAME_HOLDER ) ;
}
return - 1 ;
}
public void update ( ) {
public void update ( ) {
this . setEnabled ( true ) ;
this . setEnabled ( true ) ;
}
}