forked from fanruan/design
MoMeak
7 years ago
5 changed files with 223 additions and 224 deletions
@ -1,59 +1,63 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent; |
import java.awt.*; |
||||||
import com.fr.design.gui.ispinner.UIBasicSpinner; |
import java.awt.event.ActionEvent; |
||||||
import java.awt.event.ActionListener; |
import com.fr.design.gui.ispinner.UIBasicSpinner; |
||||||
|
import java.awt.event.ActionListener; |
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import javax.swing.JPanel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import javax.swing.SpinnerNumberModel; |
import javax.swing.JPanel; |
||||||
|
import javax.swing.SpinnerNumberModel; |
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
import com.fr.form.ui.ButtonGroup; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.general.Inter; |
import com.fr.form.ui.ButtonGroup; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
public class ButtonGroupDictPane extends JPanel { |
|
||||||
private UIBasicSpinner columnSpinner; |
public class ButtonGroupDictPane extends JPanel { |
||||||
private UICheckBox adaptiveCheckbox; |
private UIBasicSpinner columnSpinner; |
||||||
private UILabel columnLabel; |
private UICheckBox adaptiveCheckbox; |
||||||
|
private UILabel columnLabel; |
||||||
public ButtonGroupDictPane() { |
|
||||||
this.initComponents(); |
public ButtonGroupDictPane() { |
||||||
} |
this.initComponents(); |
||||||
|
} |
||||||
/** |
|
||||||
* |
/** |
||||||
*/ |
* |
||||||
public void initComponents() { |
*/ |
||||||
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); |
public void initComponents() { |
||||||
adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true); |
this.setLayout(new FlowLayout(0)); |
||||||
adaptiveCheckbox.addActionListener(new ActionListener() { |
JPanel pane = new JPanel(new FlowLayout()); |
||||||
public void actionPerformed(ActionEvent e) { |
adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true); |
||||||
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
adaptiveCheckbox.addActionListener(new ActionListener() { |
||||||
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
public void actionPerformed(ActionEvent e) { |
||||||
} |
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
||||||
}); |
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
||||||
this.add(adaptiveCheckbox); |
} |
||||||
|
}); |
||||||
this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns") + ":"); |
|
||||||
this.add(columnLabel); |
this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns")); |
||||||
columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); |
columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); |
||||||
this.add(columnSpinner); |
pane.add(adaptiveCheckbox); |
||||||
} |
pane.add(columnLabel); |
||||||
|
pane.add(columnSpinner); |
||||||
public void populate(ButtonGroup buttonGroup) { |
|
||||||
adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); |
this.add(pane); |
||||||
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
} |
||||||
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
|
||||||
columnSpinner.setValue(buttonGroup.getColumnsInRow()); |
public void populate(ButtonGroup buttonGroup) { |
||||||
} |
adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); |
||||||
|
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
||||||
public void update(ButtonGroup buttonGroup) { |
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
||||||
buttonGroup.setAdaptive(adaptiveCheckbox.isSelected()); |
columnSpinner.setValue(buttonGroup.getColumnsInRow()); |
||||||
buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue())); |
} |
||||||
} |
|
||||||
|
public void update(ButtonGroup buttonGroup) { |
||||||
|
buttonGroup.setAdaptive(adaptiveCheckbox.isSelected()); |
||||||
|
buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue())); |
||||||
|
} |
||||||
|
|
||||||
} |
} |
@ -1,48 +1,62 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
|
import com.fr.design.constants.LayoutConstants; |
||||||
import com.fr.design.foldablepane.UIExpandablePane; |
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
|
|
||||||
import com.fr.design.gui.itextfield.UITextField; |
import com.fr.design.gui.itextfield.UITextField; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.form.ui.CheckBox; |
import com.fr.form.ui.CheckBox; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> { |
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> { |
||||||
private UITextField text; |
private UITextField text; |
||||||
|
|
||||||
public CheckBoxDefinePane() { |
public CheckBoxDefinePane() { |
||||||
this.iniComoponents(); |
this.iniComoponents(); |
||||||
} |
} |
||||||
|
|
||||||
private void iniComoponents() { |
private void iniComoponents() { |
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
this.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); |
text = new UITextField(8); |
||||||
JPanel textPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
JPanel panel = new JPanel(new BorderLayout()); |
||||||
textPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
panel.add(text, BorderLayout.CENTER); |
||||||
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, textPane); |
panel.setBorder(BorderFactory.createEmptyBorder(0, 35, 0, 0)); |
||||||
textPane.add(new UILabel(Inter.getLocText("Text") + ":")); |
|
||||||
text = new UITextField(8); |
double f = TableLayout.FILL; |
||||||
textPane.add(text); |
double p = TableLayout.PREFERRED; |
||||||
this.add(uiExpandablePane); |
Component[][] components = new Component[][]{ |
||||||
} |
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Text")), panel}, |
||||||
|
}; |
||||||
@Override |
double[] rowSize = {p}; |
||||||
protected String title4PopupWindow() { |
double[] columnSize = {p, f}; |
||||||
return "CheckBox"; |
int[][] rowCount = {{1, 1}}; |
||||||
} |
JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE); |
||||||
|
|
||||||
@Override |
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 24, pane); |
||||||
public void populateBean(CheckBox check) { |
pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15)); |
||||||
text.setText(check.getText()); |
|
||||||
} |
this.add(uiExpandablePane); |
||||||
|
} |
||||||
@Override |
|
||||||
public CheckBox updateBean() { |
@Override |
||||||
CheckBox box = new CheckBox(); |
protected String title4PopupWindow() { |
||||||
box.setText(text.getText()); |
return "CheckBox"; |
||||||
return box; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
|
public void populateBean(CheckBox check) { |
||||||
|
text.setText(check.getText()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public CheckBox updateBean() { |
||||||
|
CheckBox box = new CheckBox(); |
||||||
|
box.setText(text.getText()); |
||||||
|
return box; |
||||||
|
} |
||||||
} |
} |
@ -1,63 +1,63 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
import java.awt.FlowLayout; |
import java.awt.FlowLayout; |
||||||
|
|
||||||
import javax.swing.JPanel; |
import javax.swing.JPanel; |
||||||
|
|
||||||
import com.fr.design.data.DataCreatorUI; |
import com.fr.design.data.DataCreatorUI; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.design.present.dict.DictionaryPane; |
import com.fr.design.present.dict.DictionaryPane; |
||||||
import com.fr.form.ui.RadioGroup; |
import com.fr.form.ui.RadioGroup; |
||||||
|
|
||||||
public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> { |
public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> { |
||||||
private DictionaryPane dictPane; |
private DictionaryPane dictPane; |
||||||
|
|
||||||
private ButtonGroupDictPane buttonGroupDictPane; |
private ButtonGroupDictPane buttonGroupDictPane; |
||||||
|
|
||||||
public RadioGroupDefinePane() { |
public RadioGroupDefinePane() { |
||||||
this.initComponents(); |
this.initComponents(); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void initComponents() { |
protected void initComponents() { |
||||||
super.initComponents(); |
super.initComponents(); |
||||||
|
|
||||||
dictPane = new DictionaryPane(); |
dictPane = new DictionaryPane(); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected JPanel setFirstContentPane() { |
protected JPanel setFirstContentPane() { |
||||||
|
|
||||||
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
JPanel centerPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
||||||
buttonGroupDictPane = new ButtonGroupDictPane(); |
buttonGroupDictPane = new ButtonGroupDictPane(); |
||||||
buttonGroupDictPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
buttonGroupDictPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
||||||
centerPane.add(buttonGroupDictPane); |
centerPane.add(buttonGroupDictPane); |
||||||
return centerPane; |
return centerPane; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected RadioGroup updateSubFieldEditorBean() { |
protected RadioGroup updateSubFieldEditorBean() { |
||||||
RadioGroup ob = new RadioGroup(); |
RadioGroup ob = new RadioGroup(); |
||||||
|
|
||||||
ob.setDictionary(this.dictPane.updateBean()); |
ob.setDictionary(this.dictPane.updateBean()); |
||||||
this.buttonGroupDictPane.update(ob); |
this.buttonGroupDictPane.update(ob); |
||||||
|
|
||||||
return ob; |
return ob; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected String title4PopupWindow() { |
protected String title4PopupWindow() { |
||||||
return "radiogroup"; |
return "radiogroup"; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void populateSubFieldEditorBean(RadioGroup ob) { |
protected void populateSubFieldEditorBean(RadioGroup ob) { |
||||||
this.dictPane.populateBean(ob.getDictionary()); |
this.dictPane.populateBean(ob.getDictionary()); |
||||||
this.buttonGroupDictPane.populate(ob); |
this.buttonGroupDictPane.populate(ob); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public DataCreatorUI dataUI() { |
public DataCreatorUI dataUI() { |
||||||
return dictPane; |
return dictPane; |
||||||
} |
} |
||||||
} |
} |
Loading…
Reference in new issue