@ -1,32 +1,29 @@
package com.fr.design.widget.component ;
import java.awt.* ;
import java.awt.event.ActionEvent ;
import java.awt.event.ActionListener ;
import com.fr.design.designer.IntervalConstants ;
import com.fr.design.gui.ibutton.UIButtonGroup ;
import com.fr.design.gui.ilable.UILabel ;
import javax.swing.* ;
import com.fr.design.gui.icombobox.DictionaryComboBox ;
import com.fr.design.gui.icombobox.DictionaryConstants ;
import com.fr.design.gui.ilable.UILabel ;
import com.fr.design.layout.FRGUIPaneFactory ;
import com.fr.design.layout.TableLayoutHelper ;
import com.fr.form.ui.CheckBoxGroup ;
import com.fr.form.ui.ComboCheckBox ;
import com.fr.form.ui.ReturnTypeProvider ;
import javax.swing.BorderFactory ;
import javax.swing.JPanel ;
import java.awt.BorderLayout ;
import java.awt.Component ;
public class CheckBoxDictPane extends JPanel {
public class ReturnType Pane extends JPanel {
private DictionaryComboBox delimiterComboBox ;
private UIButtonGroup returnTypeComboBox ;
private DictionaryComboBox startComboBox ;
private DictionaryComboBox endComboBox ;
private JPanel returnStringPane ;
private final DictionaryComboBox delimiterComboBox ;
private final UIButtonGroup returnTypeComboBox ;
private final DictionaryComboBox startComboBox ;
private final DictionaryComboBox endComboBox ;
private final JPanel returnStringPane ;
public CheckBoxDict Pane( ) {
public ReturnType Pane( ) {
this . setLayout ( FRGUIPaneFactory . createBorderLayout ( ) ) ;
delimiterComboBox = new DictionaryComboBox ( DictionaryConstants . delimiters , DictionaryConstants . delimiterDisplays ) ;
delimiterComboBox . setEditable ( true ) ;
@ -36,18 +33,13 @@ public class CheckBoxDictPane extends JPanel {
endComboBox . setEditable ( true ) ;
Component [ ] [ ] components = new Component [ ] [ ] {
new Component [ ] { new UILabel ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Form_Delimiter" ) ) , delimiterComboBox } ,
new Component [ ] { new UILabel ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Combo_CheckBox_Start_Symbol" ) ) , startComboBox } ,
new Component [ ] { new UILabel ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Combo_CheckBox_End_Symbol" ) ) , endComboBox }
new Component [ ] { new UILabel ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Combo_CheckBox_Start_Symbol" ) ) , startComboBox } ,
new Component [ ] { new UILabel ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Combo_CheckBox_End_Symbol" ) ) , endComboBox }
} ;
returnStringPane = TableLayoutHelper . createGapTableLayoutPane ( components , TableLayoutHelper . FILL_LASTCOLUMN , IntervalConstants . INTERVAL_W2 , IntervalConstants . INTERVAL_L1 ) ;
returnTypeComboBox = new UIButtonGroup ( new String [ ] { com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Widget_Array" ) , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_String" ) } ) ;
returnTypeComboBox . addActionListener ( new ActionListener ( ) {
@Override
public void actionPerformed ( ActionEvent e ) {
checkVisible ( returnTypeComboBox . getSelectedIndex ( ) ) ;
}
} ) ;
returnTypeComboBox . addActionListener ( e - > checkVisible ( returnTypeComboBox . getSelectedIndex ( ) ) ) ;
JPanel headPane = TableLayoutHelper . createGapTableLayoutPane (
new Component [ ] [ ] { new Component [ ] { new UILabel ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Widget_Date_Selector_Return_Type" ) ) , returnTypeComboBox } } , TableLayoutHelper . FILL_LASTCOLUMN , IntervalConstants . INTERVAL_L2 , IntervalConstants . INTERVAL_L1 ) ;
JPanel jPanel = FRGUIPaneFactory . createBorderLayout_S_Pane ( ) ;
@ -57,34 +49,33 @@ public class CheckBoxDictPane extends JPanel {
this . add ( jPanel ) ;
}
public void checkVisible ( int selectIndex ) {
returnStringPane . setVisible ( selectIndex = = 1 ) ;
public void setReturnType ( ReturnType returnType ) {
int selectIndex = returnType = = ReturnType . ARRAY ? 0 : 1 ;
returnTypeComboBox . setSelectedIndex ( selectIndex , true ) ;
checkVisible ( selectIndex ) ;
}
public void populate ( ComboCheckBox comboCheckBox ) {
this . delimiterComboBox . setSelectedItem ( comboCheckBox . getDelimiter ( ) ) ;
this . returnTypeComboBox . setSelectedIndex ( comboCheckBox . isReturnString ( ) ? 1 : 0 ) ;
this . startComboBox . setSelectedItem ( comboCheckBox . getStartSymbol ( ) ) ;
this . endComboBox . setSelectedItem ( comboCheckBox . getEndSymbol ( ) ) ;
checkVisible ( this . returnTypeComboBox . getSelectedIndex ( ) ) ;
public void checkVisible ( int selectIndex ) {
returnStringPane . setVisible ( selectIndex = = 1 ) ;
}
public void update ( ComboCheckBox comboCheckBox ) {
comboCheckBox . setDelimiter ( ( String ) this . delimiterComboBox . getSelectedItem ( ) ) ;
comboCheckBox . setReturnString ( this . returnTypeComboBox . getSelectedIndex ( ) ! = 0 ) ;
comboCheckBox . setStartSymbol ( ( String ) this . startComboBox . getSelectedItem ( ) ) ;
comboCheckBox . setEndSymbol ( ( String ) this . endComboBox . getSelectedItem ( ) ) ;
public void update ( ReturnTypeProvider returnTypeProvider ) {
returnTypeProvider . setDelimiter ( ( String ) this . delimiterComboBox . getSelectedItem ( ) ) ;
returnTypeProvider . setReturnString ( this . returnTypeComboBox . getSelectedIndex ( ) ! = 0 ) ;
returnTypeProvider . setStartSymbol ( ( String ) this . startComboBox . getSelectedItem ( ) ) ;
returnTypeProvider . setEndSymbol ( ( String ) this . endComboBox . getSelectedItem ( ) ) ;
}
public void populate ( CheckBoxGroup checkBoxGroup ) {
this . delimiterComboBox . setSelectedItem ( checkBoxGroup . getDelimiter ( ) ) ;
this . returnTypeComboBox . setSelectedIndex ( checkBoxGroup . isReturnString ( ) ? 1 : 0 ) ;
this . startComboBox . setSelectedItem ( checkBoxGroup . getStartSymbol ( ) ) ;
this . endComboBox . setSelectedItem ( checkBoxGroup . getEndSymbol ( ) ) ;
public void populate ( ReturnTypeProvider returnTypeProvider ) {
this . delimiterComboBox . setSelectedItem ( returnTypeProvider . getDelimiter ( ) ) ;
this . returnTypeComboBox . setSelectedIndex ( returnTypeProvider . isReturnString ( ) ? 1 : 0 ) ;
this . startComboBox . setSelectedItem ( returnTypeProvider . getStartSymbol ( ) ) ;
this . endComboBox . setSelectedItem ( returnTypeProvider . getEndSymbol ( ) ) ;
checkVisible ( this . returnTypeComboBox . getSelectedIndex ( ) ) ;
}
public void update ( CheckBoxGroup checkBoxGroup ) {
checkBoxGroup . setDelimiter ( ( String ) this . delimiterComboBox . getSelectedItem ( ) ) ;
checkBoxGroup . setReturnString ( this . returnTypeComboBox . getSelectedIndex ( ) ! = 0 ) ;
checkBoxGroup . setStartSymbol ( ( String ) this . startComboBox . getSelectedItem ( ) ) ;
checkBoxGroup . setEndSymbol ( ( String ) this . endComboBox . getSelectedItem ( ) ) ;
public enum ReturnType {
STRING ,
ARRAY
}
}