MoMeak
7 years ago
17 changed files with 890 additions and 232 deletions
@ -1,63 +1,80 @@
|
||||
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())); |
||||
} |
||||
|
||||
package com.fr.design.widget.ui; |
||||
|
||||
|
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
import com.fr.data.Dictionary; |
||||
import com.fr.design.gui.ispinner.UIBasicSpinner; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; |
||||
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; |
||||
private AccessibleDictionaryEditor dictPane; |
||||
|
||||
|
||||
public ButtonGroupDictPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
public void initComponents() { |
||||
dictPane = new AccessibleDictionaryEditor(); |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
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)); |
||||
|
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
double rowSize[] = {p, p}; |
||||
double columnSize[] = {p, p, f}; |
||||
Component[][] n_components = { |
||||
{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictPane, null}, |
||||
{adaptiveCheckbox, columnLabel, columnSpinner} |
||||
}; |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 16, 8); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
||||
this.add(panel); |
||||
|
||||
|
||||
} |
||||
|
||||
public void populate(ButtonGroup buttonGroup) { |
||||
dictPane.setValue(buttonGroup.getDictionary()); |
||||
adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); |
||||
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
||||
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
||||
columnSpinner.setValue(buttonGroup.getColumnsInRow()); |
||||
} |
||||
|
||||
public void update(ButtonGroup buttonGroup) { |
||||
buttonGroup.setDictionary((Dictionary) this.dictPane.getValue()); |
||||
buttonGroup.setAdaptive(adaptiveCheckbox.isSelected()); |
||||
buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue())); |
||||
} |
||||
|
||||
} |
@ -1 +1,64 @@
|
||||
package com.fr.design.widget.ui;
import com.fr.base.GraphHelper;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.CustomWriteAbleRepeatEditor;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Author : Shockway
* Date: 13-9-18
* Time: 下午2:17
*/
public abstract class CustomWritableRepeatEditorPane<T extends CustomWriteAbleRepeatEditor> extends WritableRepeatEditorPane<T> {
private UICheckBox customDataCheckBox;
private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30;
private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30;
public CustomWritableRepeatEditorPane() {
this.initComponents();
}
@Override
protected JPanel setThirdContentPane() {
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false);
this.customDataCheckBox.setPreferredSize(
new Dimension(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT));
JPanel otherContentPane = this.setForthContentPane();
if (otherContentPane != null) {
contentPane.add(otherContentPane,BorderLayout.CENTER);
}
return contentPane;
}
public JPanel setValidatePane(){
JPanel otherContentPane = super.setValidatePane();
otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5));
return otherContentPane;
}
protected abstract JPanel setForthContentPane();
protected void populateSubWritableRepeatEditorBean(T e) {
this.customDataCheckBox.setSelected(e.isCustomData());
populateSubCustomWritableRepeatEditorBean(e);
}
protected abstract void populateSubCustomWritableRepeatEditorBean(T e);
protected T updateSubWritableRepeatEditorBean() {
T e = updateSubCustomWritableRepeatEditorBean();
e.setCustomData(this.customDataCheckBox.isSelected());
return e;
}
protected abstract T updateSubCustomWritableRepeatEditorBean();
} |
||||
package com.fr.design.widget.ui; |
||||
|
||||
import com.fr.base.GraphHelper; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.form.ui.CustomWriteAbleRepeatEditor; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Author : Shockway |
||||
* Date: 13-9-18 |
||||
* Time: 下午2:17 |
||||
*/ |
||||
public abstract class CustomWritableRepeatEditorPane<T extends CustomWriteAbleRepeatEditor> extends WritableRepeatEditorPane<T> { |
||||
|
||||
private UICheckBox customDataCheckBox; |
||||
private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30; |
||||
private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30; |
||||
|
||||
public CustomWritableRepeatEditorPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel setThirdContentPane() { |
||||
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||
this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false); |
||||
this.customDataCheckBox.setPreferredSize( |
||||
new Dimension(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT)); |
||||
JPanel otherContentPane = this.setForthContentPane(); |
||||
return otherContentPane; |
||||
} |
||||
|
||||
|
||||
public JPanel setValidatePane(){ |
||||
JPanel otherContentPane = super.setValidatePane(); |
||||
otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5)); |
||||
return otherContentPane; |
||||
} |
||||
|
||||
|
||||
protected abstract JPanel setForthContentPane(); |
||||
|
||||
protected void populateSubWritableRepeatEditorBean(T e) { |
||||
this.customDataCheckBox.setSelected(e.isCustomData()); |
||||
populateSubCustomWritableRepeatEditorBean(e); |
||||
} |
||||
|
||||
protected abstract void populateSubCustomWritableRepeatEditorBean(T e); |
||||
|
||||
protected T updateSubWritableRepeatEditorBean() { |
||||
T e = updateSubCustomWritableRepeatEditorBean(); |
||||
e.setCustomData(this.customDataCheckBox.isSelected()); |
||||
return e; |
||||
} |
||||
|
||||
protected abstract T updateSubCustomWritableRepeatEditorBean(); |
||||
|
||||
} |
@ -1,63 +1,50 @@
|
||||
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; |
||||
} |
||||
package com.fr.design.widget.ui; |
||||
|
||||
import javax.swing.JPanel; |
||||
import com.fr.design.data.DataCreatorUI; |
||||
import com.fr.form.ui.RadioGroup; |
||||
|
||||
public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> { |
||||
|
||||
private ButtonGroupDictPane buttonGroupDictPane; |
||||
|
||||
public RadioGroupDefinePane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
@Override |
||||
protected void initComponents() { |
||||
super.initComponents(); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected JPanel setFirstContentPane() { |
||||
buttonGroupDictPane = new ButtonGroupDictPane(); |
||||
return buttonGroupDictPane; |
||||
} |
||||
|
||||
@Override |
||||
protected RadioGroup updateSubFieldEditorBean() { |
||||
RadioGroup ob = new RadioGroup(); |
||||
|
||||
this.buttonGroupDictPane.update(ob); |
||||
|
||||
return ob; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "radiogroup"; |
||||
} |
||||
|
||||
@Override |
||||
protected void populateSubFieldEditorBean(RadioGroup ob) { |
||||
this.buttonGroupDictPane.populate(ob); |
||||
} |
||||
|
||||
@Override |
||||
public DataCreatorUI dataUI() { |
||||
return null; |
||||
} |
||||
} |
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue