@ -3,6 +3,8 @@ package com.fr.design.fit.toolbar;
import com.fr.design.actions.UpdateAction ;
import com.fr.design.dialog.FineJOptionPane ;
import com.fr.design.file.TemplateTreePane ;
import com.fr.design.mainframe.FormDesigner ;
import com.fr.design.mainframe.JForm ;
import com.fr.design.fit.NewJForm ;
import com.fr.design.fit.common.AdaptiveSwitchUtil ;
import com.fr.design.fit.common.TemplateTool ;
@ -10,9 +12,9 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit ;
import com.fr.design.mainframe.BaseJForm ;
import com.fr.design.mainframe.DesignerContext ;
import com.fr.design.mainframe.JForm ;
import com.fr.design.mainframe.JTemplate ;
import com.fr.design.menu.MenuKeySet ;
import com.fr.design.utils.LoadingUtils ;
import com.fr.file.FILE ;
import com.fr.file.FILEChooserPane ;
import com.fr.file.FileFILE ;
@ -23,13 +25,10 @@ import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory ;
import javax.swing.Icon ;
import javax.swing.ImageIcon ;
import javax.swing.JComponent ;
import javax.swing.JLabel ;
import javax.swing.JOptionPane ;
import javax.swing.JPanel ;
import javax.swing.KeyStroke ;
import java.awt.BorderLayout ;
import java.awt.Color ;
import java.awt.Font ;
import java.awt.event.ActionEvent ;
@ -46,7 +45,6 @@ public class SwitchAction extends UpdateAction {
private UIButton switchBtn ;
private static final Icon SWITCH_ICON = IOUtils . readIcon ( "/com/fr/design/form/images/icon_switch.png" ) ;
private static final String LOADING_ICON_PATH = "/com/fr/design/form/images/loading.png" ;
private static final MenuKeySet SWITCH_ATTR = new MenuKeySet ( ) {
@Override
public char getMnemonic ( ) {
@ -132,19 +130,17 @@ public class SwitchAction extends UpdateAction {
* @date : 2020 / 9 / 30 15 : 18
* /
public void showLoadingJPanel ( ) {
JComponent area = TemplateTool . getCurrentEditingNewJForm ( ) . getFormDesign ( ) . getArea ( ) ;
JComponent formDesigner = TemplateTool . getCurrentEditingNewJForm ( ) . getFormDesign ( ) ;
area . remove ( formDesigner ) ;
JPanel loadingJPanel = new JPanel ( new BorderLayout ( ) ) ;
loadingJPanel . setBackground ( Color . WHITE ) ;
loadingJPanel . setBounds ( formDesigner . getBounds ( ) ) ;
JLabel jLabel = new JLabel ( new ImageIcon ( this . getClass ( ) . getResource ( LOADING_ICON_PATH ) ) , JLabel . CENTER ) ;
loadingJPanel . add ( jLabel , BorderLayout . CENTER ) ;
area . setLayout ( null ) ;
area . add ( loadingJPanel ) ;
DesignerContext . getDesignerFrame ( ) . setVisible ( true ) ;
NewJForm jForm = TemplateTool . getCurrentEditingNewJForm ( ) ;
if ( jForm ! = null ) {
FormDesigner formDesigner = jForm . getFormDesign ( ) ;
JComponent area = formDesigner . getArea ( ) ;
area . remove ( formDesigner ) ;
area . setLayout ( null ) ;
JPanel panel = LoadingUtils . createLoadingPane ( ) ;
panel . setBounds ( formDesigner . getBounds ( ) ) ;
area . add ( panel ) ;
DesignerContext . getDesignerFrame ( ) . setVisible ( true ) ;
}
}