@ -1,16 +1,17 @@
package com.fr.design.javascript ;
import com.fr.design.write.submit.DBManipulationPane ;
import com.fr.design.beans.FurtherBasicBeanPane ;
import com.fr.design.gui.frpane.CommitTabbedPane ;
import com.fr.design.gui.ibutton.UIButton ;
import com.fr.design.layout.FRGUIPaneFactory ;
import com.fr.design.write.submit.DBManipulationPane ;
import com.fr.js.Commit2DBJavaScript ;
import com.fr.write.DBManipulation ;
import javax.swing.* ;
import java.awt.* ;
import javax.swing.JPanel ;
import java.awt.BorderLayout ;
import java.awt.CardLayout ;
import java.awt.Dimension ;
import java.util.ArrayList ;
import java.util.List ;
@ -25,63 +26,64 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/ * *
* 构造函数 , 控件事件的提交入库面板
* @param javaScriptActionPane JS提交面板对象
*
* @param javaScriptActionPane JS提交面板对象
* @param dbManipulationPaneList 提交入库的提交面板列表
* /
public Commit2DBJavaScriptPane ( final JavaScriptActionPane javaScriptActionPane , List dbManipulationPaneList ) {
this . dbmPaneList = dbManipulationPaneList ;
this . dbmPaneList = dbManipulationPaneList ;
this . javaScriptActionPane = javaScriptActionPane ;
this . setLayout ( FRGUIPaneFactory . createBorderLayout ( ) ) ;
commitTabbedPane = new CommitTabbedPane ( this , dbmPaneList ) ;
commitTabbedPane . setPreferredSize ( new Dimension ( commitTabbedPane . getWidth ( ) , 20 ) ) ;
this . add ( commitTabbedPane , BorderLayout . NORTH ) ;
commitTabbedPane = new CommitTabbedPane ( this , dbmPaneList ) ;
commitTabbedPane . setPreferredSize ( new Dimension ( commitTabbedPane . getWidth ( ) , 20 ) ) ;
this . add ( commitTabbedPane , BorderLayout . NORTH ) ;
cardPane = new JPanel ( new CardLayout ( ) ) ;
cardNames = new String [ dbmPaneList . size ( ) ] ;
cardNames = new String [ dbmPaneList . size ( ) ] ;
for ( int i = 0 ; i < this . dbmPaneList . size ( ) ; i + + ) {
if ( ( ( DBManipulationPane ) this . dbmPaneList . get ( i ) ) . getSubMitName ( ) = = null ) {
if ( ( ( DBManipulationPane ) this . dbmPaneList . get ( i ) ) . getSubMitName ( ) = = null ) {
cardNames [ i ] = "" ;
} else {
cardNames [ i ] = ( ( DBManipulationPane ) this . dbmPaneList . get ( i ) ) . getSubMitName ( ) ;
} else {
cardNames [ i ] = ( ( DBManipulationPane ) this . dbmPaneList . get ( i ) ) . getSubMitName ( ) ;
}
cardPane . add ( ( DBManipulationPane ) this . dbmPaneList . get ( i ) , cardNames [ i ] ) ;
cardPane . add ( ( DBManipulationPane ) this . dbmPaneList . get ( i ) , cardNames [ i ] ) ;
}
this . add ( cardPane , BorderLayout . CENTER ) ;
JPanel btPane = FRGUIPaneFactory . createNormalFlowInnerContainer_S_Pane ( ) ;
this . add ( btPane , BorderLayout . SOUTH ) ;
addCallbackButton = javaScriptActionPane . createCallButton ( ) ;
btPane . add ( addCallbackButton ) ;
}
this . add ( btPane , BorderLayout . SOUTH ) ;
addCallbackButton = javaScriptActionPane . createCallButton ( ) ;
btPane . add ( addCallbackButton ) ;
}
/ * *
* 更新DBManipulationPane
* /
public void updateCardPane ( ) {
cardNames = new String [ dbmPaneList . size ( ) ] ;
public void updateCardPane ( ) {
cardNames = new String [ dbmPaneList . size ( ) ] ;
for ( int i = 0 ; i < this . dbmPaneList . size ( ) ; i + + ) {
if ( ( ( DBManipulationPane ) this . dbmPaneList . get ( i ) ) . getSubMitName ( ) = = null ) {
if ( ( ( DBManipulationPane ) this . dbmPaneList . get ( i ) ) . getSubMitName ( ) = = null ) {
cardNames [ i ] = "" ;
} else {
cardNames [ i ] = ( ( DBManipulationPane ) this . dbmPaneList . get ( i ) ) . getSubMitName ( ) ;
} else {
cardNames [ i ] = ( ( DBManipulationPane ) this . dbmPaneList . get ( i ) ) . getSubMitName ( ) ;
}
cardPane . add ( ( DBManipulationPane ) this . dbmPaneList . get ( i ) , cardNames [ i ] ) ;
cardPane . add ( ( DBManipulationPane ) this . dbmPaneList . get ( i ) , cardNames [ i ] ) ;
}
CardLayout cardLayout = ( CardLayout ) cardPane . getLayout ( ) ;
cardLayout . show ( cardPane , cardNames [ commitTabbedPane . getSelectedIndex ( ) ] ) ;
CardLayout cardLayout = ( CardLayout ) cardPane . getLayout ( ) ;
cardLayout . show ( cardPane , cardNames [ commitTabbedPane . getSelectedIndex ( ) ] ) ;
}
public void setList ( List list ) {
public void setList ( List list ) {
this . dbmPaneList = list ;
}
/ * *
* 新建DBManipulationPane
* @return 新建的DBManipulationPane
*
* @return 新建的DBManipulationPane
* /
public DBManipulationPane createDBManipulationPane ( ) {
public DBManipulationPane createDBManipulationPane ( ) {
DBManipulationPane db = javaScriptActionPane . createDBManipulationPane ( ) ;
db . populateBean ( null ) ;
dbmPaneList . add ( db ) ;
@ -91,25 +93,26 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/ * *
* 窗口名称
*
* @return 返回窗口名称
* /
public String title4PopupWindow ( ) {
return com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_JavaScript_Commit_To_Database" ) ;
}
public String title4PopupWindow ( ) {
return com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_JavaScript_Commit_To_Database" ) ;
}
/ * *
* 界面重置
* /
public void reset ( ) {
this . javaScriptActionPane . setCall ( null ) ;
//重置后只保留,只留第一个tab
while ( dbmPaneList . size ( ) > 1 ) {
/ * *
* 界面重置
* /
public void reset ( ) {
this . javaScriptActionPane . setCall ( null ) ;
//重置后只保留,只留第一个tab
while ( dbmPaneList . size ( ) > 1 ) {
dbmPaneList . remove ( 1 ) ;
}
( ( DBManipulationPane ) dbmPaneList . get ( 0 ) ) . populateBean ( null ) ;
}
( ( DBManipulationPane ) dbmPaneList . get ( 0 ) ) . populateBean ( null ) ;
}
@Override
@Override
/ * *
* 将JavaBean内的数据输出至界面上
* /
@ -131,11 +134,15 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/ * *
* 更新数据层JavaBean
*
* @return 返回JavaBean
* /
public Commit2DBJavaScript updateBean ( ) {
Commit2DBJavaScript commit2dbJavaScript = new Commit2DBJavaScript ( ) ;
public Commit2DBJavaScript updateBean ( ) {
Commit2DBJavaScript commit2dbJavaScript = new Commit2DBJavaScript ( ) ;
if ( javaScriptActionPane . getResourceInfo ( ) ! = null ) {
commit2dbJavaScript . setJsResourceInfo ( javaScriptActionPane . getResourceInfo ( ) ) ;
}
List dbmaniList = new ArrayList ( ) ;
for ( int i = 0 ; i < this . dbmPaneList . size ( ) ; i + + ) {
DBManipulationPane dbmpane = ( DBManipulationPane ) this . dbmPaneList . get ( i ) ;
@ -154,11 +161,12 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/ * *
* 判断是否是能接受的数据类型
*
* @param ob 对象
* @return 返回是否是能接受的数据类型
* /
public boolean accept ( Object ob ) {
return ob instanceof Commit2DBJavaScript ;
}
public boolean accept ( Object ob ) {
return ob instanceof Commit2DBJavaScript ;
}
}