@ -5,6 +5,7 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants ;
import com.fr.design.designer.IntervalConstants ;
import com.fr.design.gui.icombobox.LineComboBox ;
import com.fr.design.gui.icombobox.UIComboBox ;
import com.fr.design.gui.ilable.UILabel ;
import com.fr.design.gui.ispinner.UISpinner ;
import com.fr.design.i18n.Toolkit ;
@ -17,6 +18,7 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.mobile.MobileStyle ;
import com.fr.general.FRFont ;
import com.fr.invoke.Reflect ;
import com.fr.locale.InterProviderFactory ;
import com.fr.stable.Constants ;
import javax.swing.JPanel ;
@ -29,6 +31,8 @@ import java.awt.Component;
import java.awt.Dimension ;
import java.awt.FlowLayout ;
import java.awt.Font ;
import java.awt.event.ItemEvent ;
import java.awt.event.ItemListener ;
public class MobileStyleDefinePane extends BasicBeanPane < MobileStyle > {
@ -42,6 +46,8 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
private Widget widget ;
private MobileStyleCustomDefinePane customBeanPane ;
private Class < ? extends MobileStyle > mobileStyleClazz ;
private UIComboBox customCombo ;
private JPanel settingPane ;
private ColorSelectBox colorSelectBox ;
private Color titleColor = new Color ( 47 , 142 , 241 ) ;
private JPanel commomPane ;
@ -62,6 +68,8 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
@Override
public void populateBean ( MobileStyle ob ) {
this . customBeanPane . populateBean ( ob ) ;
customCombo . setSelectedIndex ( ob . isCommonCustom ( ) ? 1 : 0 ) ;
if ( ob . getBackground ( ) ! = null ) {
colorSelectBox . setSelectObject ( ( ( ColorBackground ) ob . getBackground ( ) ) . getColor ( ) ) ;
}
@ -83,6 +91,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
MobileStyle mobileStyle = Reflect . on ( mobileStyleClazz ) . create ( ) . get ( ) ;
this . widget . setMobileStyle ( mobileStyle ) ;
this . customBeanPane . updateBean ( ) ;
mobileStyle . setCommonCustom ( customCombo . getSelectedIndex ( ) = = 1 ) ;
mobileStyle . setBackground ( ColorBackground . getInstance ( colorSelectBox . getSelectObject ( ) ) ) ;
mobileStyle . setBorderType ( borderType . getSelectedLineStyle ( ) ) ;
mobileStyle . setBorderColor ( borderColor . getSelectObject ( ) ) ;
@ -126,6 +135,23 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
commomPane . setBorder ( titledBorder ) ;
this . add ( commomPane , BorderLayout . NORTH ) ;
customCombo = new UIComboBox ( new String [ ] { Toolkit . i18nText ( "Fine-Design_Mobile_Default" ) , Toolkit . i18nText ( "FIne-Design_Mobile_Custom" ) } ) ;
customCombo . setSelectedIndex ( 0 ) ;
customCombo . setPreferredSize ( new Dimension ( NORMAL_COMBO_WIDTH + 15 , 20 ) ) ;
customCombo . addItemListener ( new ItemListener ( ) {
@Override
public void itemStateChanged ( ItemEvent e ) {
boolean custom = customCombo . getSelectedIndex ( ) = = 1 ;
settingPane . setVisible ( custom ) ;
}
} ) ;
commomPane . add ( createLeftRightComponentsPane ( createConfigLabel ( Toolkit . i18nText ( "Fine-Design_Mobile_Attribute_setting" ) ) , customCombo ) ) ;
settingPane = FRGUIPaneFactory . createVerticalFlowLayout_Pane ( true , FlowLayout . LEADING , 0 , 10 ) ;
settingPane . setVisible ( false ) ;
commomPane . add ( settingPane ) ;
createBackgroundPane ( ) ;
createBorderPane ( ) ;
createIconSettingPane ( ) ;
@ -136,7 +162,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
colorSelectBox = new ColorSelectBox ( NORMAL_COMBO_WIDTH ) ;
JPanel backgroundPane = createLeftRightComponentsPane ( createConfigLabel ( Toolkit . i18nText ( "Fine-Design_Mobile_Widget_Background" ) ) , colorSelectBox ) ;
commom Pane. add ( backgroundPane ) ;
setting Pane. add ( backgroundPane ) ;
}
private void createBorderPane ( ) {
@ -146,19 +172,20 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
borderColor = new NewColorSelectBox ( NORMAL_COMBO_WIDTH ) ;
borderRadius = new UISpinner ( 0 , Integer . MAX_VALUE , 1 , 2 ) ;
borderRadius . setPreferredSize ( new Dimension ( NORMAL_COMBO_WIDTH + 20 , 20 ) ) ;
commom Pane. add ( createLeftRightComponentsPane ( createConfigLabel ( Toolkit . i18nText ( "Fine-Design_Mobile_Widget_BorderType" ) ) , borderType ) ) ;
commom Pane. add ( createLeftRightComponentsPane ( createConfigLabel ( Toolkit . i18nText ( "Fine-Design_Mobile_Widget_BorderColor" ) ) , borderColor ) ) ;
commom Pane. add ( createLeftRightComponentsPane ( createConfigLabel ( Toolkit . i18nText ( "Fine-Design_Mobile_Widget_BorderRadius" ) ) , borderRadius ) ) ;
setting Pane. add ( createLeftRightComponentsPane ( createConfigLabel ( Toolkit . i18nText ( "Fine-Design_Mobile_Widget_BorderType" ) ) , borderType ) ) ;
setting Pane. add ( createLeftRightComponentsPane ( createConfigLabel ( Toolkit . i18nText ( "Fine-Design_Mobile_Widget_BorderColor" ) ) , borderColor ) ) ;
setting Pane. add ( createLeftRightComponentsPane ( createConfigLabel ( Toolkit . i18nText ( "Fine-Design_Mobile_Widget_BorderRadius" ) ) , borderRadius ) ) ;
}
private void createIconSettingPane ( ) {
iconColor = new NewColorSelectBox ( NORMAL_COMBO_WIDTH ) ;
commomPane . add ( createLeftRightComponentsPane ( createConfigLabel ( Toolkit . i18nText ( "Fine-Design_Mobile_Widget_Icon_Color" ) ) , iconColor ) ) ;
iconColor . setSelectObject ( new Color ( 31 , 173 , 229 ) ) ;
settingPane . add ( createLeftRightComponentsPane ( createConfigLabel ( Toolkit . i18nText ( "Fine-Design_Mobile_Widget_Icon_Color" ) ) , iconColor ) ) ;
}
private void createFontPane ( ) {
fontConfigPane = new MobileStyleFontConfigPane ( ) ;
commom Pane. add ( createLeftRightComponentsPane ( createConfigLabel ( Toolkit . i18nText ( "Fine-Design_Mobile_Widget_Font" ) ) , fontConfigPane ) ) ;
setting Pane. add ( createLeftRightComponentsPane ( createConfigLabel ( Toolkit . i18nText ( "Fine-Design_Mobile_Widget_Font" ) ) , fontConfigPane ) ) ;
}
private void createCustomPane ( ) {