kerry
7 years ago
13 changed files with 264 additions and 207 deletions
@ -1,63 +1,80 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
|
|
||||||
import java.awt.*; |
import java.awt.*; |
||||||
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
||||||
import com.fr.design.gui.ispinner.UIBasicSpinner; |
|
||||||
import java.awt.event.ActionListener; |
import com.fr.data.Dictionary; |
||||||
|
import com.fr.design.gui.ispinner.UIBasicSpinner; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import java.awt.event.ActionListener; |
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.SpinnerNumberModel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
|
|
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
import javax.swing.*; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.form.ui.ButtonGroup; |
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
import com.fr.general.Inter; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
public class ButtonGroupDictPane extends JPanel { |
import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; |
||||||
private UIBasicSpinner columnSpinner; |
import com.fr.form.ui.ButtonGroup; |
||||||
private UICheckBox adaptiveCheckbox; |
import com.fr.general.Inter; |
||||||
private UILabel columnLabel; |
|
||||||
|
|
||||||
public ButtonGroupDictPane() { |
public class ButtonGroupDictPane extends JPanel { |
||||||
this.initComponents(); |
private UIBasicSpinner columnSpinner; |
||||||
} |
private UICheckBox adaptiveCheckbox; |
||||||
|
private UILabel columnLabel; |
||||||
/** |
private AccessibleDictionaryEditor dictPane; |
||||||
* |
|
||||||
*/ |
|
||||||
public void initComponents() { |
public ButtonGroupDictPane() { |
||||||
this.setLayout(new FlowLayout(0)); |
this.initComponents(); |
||||||
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()); |
public void initComponents() { |
||||||
} |
dictPane = new AccessibleDictionaryEditor(); |
||||||
}); |
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true); |
||||||
this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns")); |
adaptiveCheckbox.addActionListener(new ActionListener() { |
||||||
columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); |
public void actionPerformed(ActionEvent e) { |
||||||
pane.add(adaptiveCheckbox); |
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
||||||
pane.add(columnLabel); |
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
||||||
pane.add(columnSpinner); |
} |
||||||
|
}); |
||||||
this.add(pane); |
this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns") + ":"); |
||||||
} |
columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); |
||||||
|
|
||||||
public void populate(ButtonGroup buttonGroup) { |
double f = TableLayout.FILL; |
||||||
adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); |
double p = TableLayout.PREFERRED; |
||||||
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
double rowSize[] = {p, p}; |
||||||
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
double columnSize[] = {p, p, f}; |
||||||
columnSpinner.setValue(buttonGroup.getColumnsInRow()); |
Component[][] n_components = { |
||||||
} |
{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), dictPane, null}, |
||||||
|
{adaptiveCheckbox, columnLabel, columnSpinner} |
||||||
public void update(ButtonGroup buttonGroup) { |
}; |
||||||
buttonGroup.setAdaptive(adaptiveCheckbox.isSelected()); |
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 16, 8); |
||||||
buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue())); |
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 @@ |
|||||||
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; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
import java.awt.FlowLayout; |
import javax.swing.JPanel; |
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
import javax.swing.JPanel; |
import com.fr.form.ui.RadioGroup; |
||||||
|
|
||||||
import com.fr.design.data.DataCreatorUI; |
public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> { |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.present.dict.DictionaryPane; |
private ButtonGroupDictPane buttonGroupDictPane; |
||||||
import com.fr.form.ui.RadioGroup; |
|
||||||
|
public RadioGroupDefinePane() { |
||||||
public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> { |
this.initComponents(); |
||||||
private DictionaryPane dictPane; |
} |
||||||
|
|
||||||
private ButtonGroupDictPane buttonGroupDictPane; |
@Override |
||||||
|
protected void initComponents() { |
||||||
public RadioGroupDefinePane() { |
super.initComponents(); |
||||||
this.initComponents(); |
|
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void initComponents() { |
protected JPanel setFirstContentPane() { |
||||||
super.initComponents(); |
buttonGroupDictPane = new ButtonGroupDictPane(); |
||||||
|
return buttonGroupDictPane; |
||||||
dictPane = new DictionaryPane(); |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
protected RadioGroup updateSubFieldEditorBean() { |
||||||
protected JPanel setFirstContentPane() { |
RadioGroup ob = new RadioGroup(); |
||||||
|
|
||||||
JPanel centerPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
this.buttonGroupDictPane.update(ob); |
||||||
buttonGroupDictPane = new ButtonGroupDictPane(); |
|
||||||
buttonGroupDictPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
return ob; |
||||||
centerPane.add(buttonGroupDictPane); |
} |
||||||
return centerPane; |
|
||||||
} |
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
@Override |
return "radiogroup"; |
||||||
protected RadioGroup updateSubFieldEditorBean() { |
} |
||||||
RadioGroup ob = new RadioGroup(); |
|
||||||
|
@Override |
||||||
ob.setDictionary(this.dictPane.updateBean()); |
protected void populateSubFieldEditorBean(RadioGroup ob) { |
||||||
this.buttonGroupDictPane.update(ob); |
this.buttonGroupDictPane.populate(ob); |
||||||
|
} |
||||||
return ob; |
|
||||||
} |
@Override |
||||||
|
public DataCreatorUI dataUI() { |
||||||
@Override |
return null; |
||||||
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