@ -7,6 +7,7 @@ import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup ;
import com.fr.design.gui.icombobox.UIComboBox ;
import com.fr.design.gui.ilable.UILabel ;
import com.fr.design.i18n.Toolkit ;
import com.fr.design.layout.TableLayout ;
import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane ;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane ;
@ -39,6 +40,7 @@ public class VanChartBackgroundPane extends BasicPane {
protected List < BackgroundQuickPane > paneList ;
protected UIComboBox typeComboBox ;
private UILabel transparentLabel ;
protected UINumberDragPane transparent ;
protected UIButtonGroup < Boolean > shadow ;
@ -46,6 +48,8 @@ public class VanChartBackgroundPane extends BasicPane {
private boolean hasAuto ;
private static final int AUTO = 0 ;
public VanChartBackgroundPane ( ) {
this ( false ) ;
}
@ -58,6 +62,9 @@ public class VanChartBackgroundPane extends BasicPane {
this . add ( panel , BorderLayout . CENTER ) ;
}
public UILabel getTransparentLabel ( ) {
return transparentLabel ;
}
public boolean isHasAuto ( ) {
return hasAuto ;
@ -78,6 +85,7 @@ public class VanChartBackgroundPane extends BasicPane {
final CardLayout cardlayout = new CardLayout ( ) ;
paneList = new ArrayList < > ( ) ;
initAutoPane ( ) ;
initList ( ) ;
centerPane = new JPanel ( cardlayout ) {
@ -100,24 +108,43 @@ public class VanChartBackgroundPane extends BasicPane {
public void itemStateChanged ( ItemEvent e ) {
cardlayout . show ( centerPane , ( String ) typeComboBox . getSelectedItem ( ) ) ;
fireStateChanged ( ) ;
checkTransparent ( ) ;
}
} ) ;
transparentLabel = new UILabel ( Toolkit . i18nText ( "Fine-Design_Report_Alpha" ) ) ;
transparent = new UINumberDragPane ( 0 , 100 ) ;
}
protected Component [ ] [ ] getPaneComponents ( ) {
shadow = new UIButtonGroup < Boolean > ( new String [ ] { com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Chart_On" ) , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Chart_Off" ) } , new Boolean [ ] { true , false } ) ;
shadow = new UIButtonGroup < Boolean > ( new String [ ] { Toolkit . i18nText ( "Fine-Design_Chart_On" ) , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Chart_Off" ) } , new Boolean [ ] { true , false } ) ;
return new Component [ ] [ ] {
new Component [ ] { null , null } ,
new Component [ ] { new UILabel ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Report_Fill" ) ) , typeComboBox } ,
new Component [ ] { new UILabel ( Toolkit . i18nText ( "Fine-Design_Report_Fill" ) ) , typeComboBox } ,
new Component [ ] { null , centerPane } ,
new Component [ ] { new UILabel ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Report_Alpha" ) ) , transparent } ,
new Component [ ] { new UILabel ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Chart_Shadow" ) ) , shadow } ,
new Component [ ] { transparentLabel , transparent } ,
new Component [ ] { new UILabel ( Toolkit . i18nText ( "Fine-Design_Chart_Shadow" ) ) , shadow } ,
} ;
}
protected void initAutoPane ( ) {
if ( isHasAuto ( ) ) {
paneList . add ( new NullBackgroundQuickPane ( ) {
public String title4PopupWindow ( ) {
return Toolkit . i18nText ( "Fine-Design_Chart_Automatic" ) ;
}
} ) ;
}
}
private void checkTransparent ( ) {
if ( isHasAuto ( ) ) {
boolean enable = typeComboBox . getSelectedIndex ( ) ! = AUTO ;
transparentLabel . setEnabled ( enable ) ;
transparent . setEnabled ( enable ) ;
}
}
protected void initList ( ) {
paneList . add ( new NullBackgroundQuickPane ( ) ) ;
paneList . add ( new ColorBackgroundQuickPane ( ) ) ;
@ -158,7 +185,17 @@ public class VanChartBackgroundPane extends BasicPane {
if ( shadow ! = null ) {
shadow . setSelectedIndex ( attr . isShadow ( ) = = true ? 0 : 1 ) ;
}
populateBackground ( attr , 0 ) ;
if ( isHasAuto ( ) ) {
if ( attr . isAutoBackground ( ) ) {
typeComboBox . setSelectedIndex ( AUTO ) ;
checkTransparent ( ) ;
return ;
}
populateBackground ( attr , 1 ) ;
} else {
populateBackground ( attr , 0 ) ;
}
}
public void populateBackground ( GeneralInfo attr , int begin ) {
@ -168,20 +205,29 @@ public class VanChartBackgroundPane extends BasicPane {
if ( pane . accept ( background ) ) {
pane . populateBean ( background ) ;
typeComboBox . setSelectedIndex ( i ) ;
checkTransparent ( ) ;
return ;
}
}
checkTransparent ( ) ;
}
public void update ( GeneralInfo attr ) {
if ( attr = = null ) {
attr = new GeneralInfo ( ) ;
}
updateBackground ( attr ) ;
attr . setAlpha ( ( float ) ( transparent . updateBean ( ) / ALPHA_V ) ) ;
if ( shadow ! = null ) {
attr . setShadow ( shadow . getSelectedIndex ( ) = = 0 ) ;
}
if ( isHasAuto ( ) ) {
if ( typeComboBox . getSelectedIndex ( ) = = AUTO ) {
attr . setAutoBackground ( true ) ;
return ;
}
attr . setAutoBackground ( false ) ;
}
updateBackground ( attr ) ;
}
public void updateBackground ( GeneralInfo attr ) {