@ -3,6 +3,7 @@ package com.fr.design.widget.ui.btn;
import java.awt.Component ;
import com.fr.form.ui.FreeButton ;
import com.fr.widgettheme.util.WidgetThemeDesignerUtils ;
/ * *
* 自定义按钮
@ -12,33 +13,49 @@ import com.fr.form.ui.FreeButton;
* Created on 2023 / 4 / 19
* /
public class FreeButtonDetailPane extends AbstractExtraButtonPane < FreeButton > {
private ButtonSytleDefinedPane buttonSytleDefinedPane ;
@Override
protected Component createCenterPane ( ) {
buttonSytleDefinedPane = new ButtonSytleDefinedPane ( ) ;
return createExtraPane ( buttonSytleDefinedPane ) ;
}
@Override
public FreeButton createButton ( ) {
return new FreeButton ( ) ;
}
public void populate ( FreeButton button ) {
super . populate ( button ) ;
buttonSytleDefinedPane . populate ( button ) ;
}
private ButtonSytleDefinedPane buttonSytleDefinedPane ;
@Override
protected Component createCenterPane ( ) {
buttonSytleDefinedPane = creatButtonSytleDefinedPane ( ) ;
return createExtraPane ( buttonSytleDefinedPane ) ;
}
@Override
public FreeButton createButton ( ) {
return new FreeButton ( ) ;
}
/ * *
* 填充button配置面板
* /
public void populate ( FreeButton button ) {
super . populate ( button ) ;
if ( buttonSytleDefinedPane ! = null ) {
buttonSytleDefinedPane . populate ( button ) ;
}
}
@Override
public FreeButton update ( ) {
FreeButton button = super . update ( ) ;
buttonSytleDefinedPane . update ( button ) ;
if ( buttonSytleDefinedPane ! = null ) {
buttonSytleDefinedPane . update ( button ) ;
}
return button ;
}
@Override
public Class classType ( ) {
return FreeButton . class ;
}
@Override
public Class classType ( ) {
return FreeButton . class ;
}
/ * *
* 自定义按钮控件开启控件显示增强时 , 原有的buttonSytleDefinedPane会被保留
* 内容和控件增强的pane重复 , 且不生效 。 其他控件目前不存在这种情况 , 因此要在实现这里做个判断
* 如果开启控件增强 , 原有的ButtonSytleDefinedPane不展示 , 创建时返回null
* /
private ButtonSytleDefinedPane creatButtonSytleDefinedPane ( ) {
return WidgetThemeDesignerUtils . enableWidgetEnhance ( ) ? null : new ButtonSytleDefinedPane ( ) ;
}
}