@ -14,11 +14,11 @@ import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor;
import com.fr.design.mainframe.widget.editors.ShortCutTextEditor ;
import com.fr.design.mainframe.widget.renderer.FontCellRenderer ;
import com.fr.design.mainframe.widget.renderer.IconCellRenderer ;
import com.fr.design.utils.DesignUtils ;
import com.fr.form.parameter.FormSubmitButton ;
import com.fr.form.ui.Button ;
import com.fr.form.ui.FreeButton ;
import com.fr.general.Background ;
import com.fr.stable.ArrayUtils ;
import com.fr.stable.core.PropertyChangeAdapter ;
@ -29,7 +29,6 @@ import java.awt.AlphaComposite;
import java.awt.BorderLayout ;
import java.awt.Color ;
import java.awt.Dimension ;
import java.awt.Font ;
import java.awt.Graphics ;
import java.awt.Graphics2D ;
import java.awt.geom.Rectangle2D ;
@ -42,7 +41,6 @@ import java.beans.IntrospectionException;
public class XButton extends XWidgetCreator {
public final static Background DEFAULTBG = new GradientBackground ( new Color ( 247 , 247 , 247 ) , new Color ( 210 , 210 , 210 ) , GradientBackground . TOP2BOTTOM ) ;
public final static Font DEFAULTFT = new Font ( "Song_TypeFace" , 0 , 12 ) ;
public final static Color DEFAULTFOREGROUNDCOLOR = Color . BLACK ;
private Background bg ;
private UILabel contentLabel ;
@ -77,6 +75,7 @@ public class XButton extends XWidgetCreator {
/ * *
* 根据下拉框选择返回按钮样式的默认设置或自定义设置列表
*
* @return 列表
* @throws IntrospectionException 抛错
* /
@ -117,6 +116,7 @@ public class XButton extends XWidgetCreator {
} ;
return crPropertyDescriptors [ i ] ;
}
protected CRPropertyDescriptor [ ] getisCustomStyle ( ) throws IntrospectionException {
return new CRPropertyDescriptor [ ] {
creatNonListenerStyle ( 0 ) . setPropertyChangeListener ( new PropertyChangeAdapter ( ) {
@ -193,6 +193,7 @@ public class XButton extends XWidgetCreator {
} ;
}
@Override
protected JComponent initEditor ( ) {
if ( editor = = null ) {
@ -230,7 +231,7 @@ public class XButton extends XWidgetCreator {
if ( ! button . isCustomStyle ( ) ) {
l . setBorder ( BorderFactory . createLineBorder ( new Color ( 148 , 148 , 148 ) ) ) ;
bg = DEFAULTBG ;
contentLabel . setFont ( DEFAULTFT ) ;
contentLabel . setFont ( DesignUtils . getDefaultGUIFont ( ) ) ;
contentLabel . setForeground ( DEFAULTFOREGROUNDCOLOR ) ;
editor . setLayout ( new BorderLayout ( ) ) ;
editor . add ( l , BorderLayout . CENTER ) ;
@ -276,8 +277,10 @@ public class XButton extends XWidgetCreator {
/ * *
* 初始化按钮的Size
*
* @return 尺寸
* /
@Override
public Dimension initEditorSize ( ) {
FreeButton button = ( FreeButton ) data ;
if ( checkbutton ( button ) ) {
@ -285,9 +288,11 @@ public class XButton extends XWidgetCreator {
}
return super . initEditorSize ( ) ;
}
private boolean checkbutton ( FreeButton button ) {
return ( button . isCustomStyle ( ) & & button . getButtonHeight ( ) > 0 & & button . getButtonWidth ( ) > 0 ) ;
}
@Override
protected String getIconName ( ) {
return "button_16.png" ;
@ -295,8 +300,8 @@ public class XButton extends XWidgetCreator {
/ * *
* data属性改变触发其他操作
*
* /
@Override
public void firePropertyChange ( ) {
FreeButton button = ( FreeButton ) data ;
setButtonText ( button . getText ( ) ) ;