@ -3,6 +3,7 @@ package com.fr.design.gui.itree.filetree;
import com.fr.design.dialog.BasicPane ;
import com.fr.design.file.TemplateTreePane ;
import com.fr.design.gui.ibutton.UIButton ;
import com.fr.design.gui.ilable.UILabel ;
import com.fr.design.gui.itextarea.UITextArea ;
import com.fr.design.layout.FRGUIPaneFactory ;
import com.fr.design.utils.DesignUtils ;
@ -11,6 +12,7 @@ import com.fr.file.filetree.IOFileNodeFilter;
import javax.swing.JPanel ;
import javax.swing.JScrollPane ;
import javax.swing.SwingWorker ;
import java.awt.BorderLayout ;
import java.awt.CardLayout ;
import java.awt.Font ;
@ -23,6 +25,8 @@ public class ReportletPane extends BasicPane {
private ClassFileTree classReportletTree ;
private JScrollPane c_panel ;
private JScrollPane loadPanel ;
private UIButton switchButton ;
private CardLayout card ;
private JPanel cardPane ;
@ -59,8 +63,13 @@ public class ReportletPane extends BasicPane {
cardPane . add ( t_panel = new JScrollPane ( templateReportletTree ) , "TEMPLATE" ) ;
classReportletTree = new ClassFileTree ( ) ;
cardPane . add ( c_panel = new JScrollPane ( classReportletTree ) , "CLASS" ) ;
JPanel panel = new JPanel ( ) ;
panel . add ( new UILabel ( "loading..." ) ) ;
cardPane . add ( loadPanel = new JScrollPane ( panel ) , "LOADING" ) ;
this . refreshEnv ( ) ;
// 初始化的时候没有采用到Class面板,没必要这里就刷新,这里只需要刷template面板就行
TemplateFileTree tree = TemplateTreePane . getInstance ( ) . getTemplateFileTree ( ) ;
this . templateReportletTree . setModel ( tree . getModel ( ) ) ;
}
/ *
@ -68,8 +77,20 @@ public class ReportletPane extends BasicPane {
* /
private void switchCardPane ( boolean switch2Class ) {
if ( switch2Class ) {
card . show ( cardPane , "CLASS " ) ;
card . show ( cardPane , "LOADING " ) ;
switchButton . setText ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Utils_Switch_To_Template_Reportlet" ) ) ;
new SwingWorker < Void , Void > ( ) {
@Override
protected Void doInBackground ( ) throws Exception {
classReportletTree . refreshEnv ( ) ;
return null ;
}
@Override
protected void done ( ) {
card . show ( cardPane , "CLASS" ) ;
}
} . execute ( ) ;
} else {
card . show ( cardPane , "TEMPLATE" ) ;
switchButton . setText ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Utils_Switch_To_Class_Reportlet" ) ) ;