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