Browse Source

REPORT-2897 9.0设计器修改

视觉优化
master
MoMeak 7 years ago
parent
commit
161a93c244
  1. 120
      designer/src/com/fr/design/widget/ui/ButtonGroupDictPane.java
  2. 88
      designer/src/com/fr/design/widget/ui/CheckBoxDefinePane.java
  3. 44
      designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java
  4. 124
      designer/src/com/fr/design/widget/ui/RadioGroupDefinePane.java
  5. 71
      designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java

120
designer/src/com/fr/design/widget/ui/ButtonGroupDictPane.java

@ -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()));
}
}

88
designer/src/com/fr/design/widget/ui/CheckBoxDefinePane.java

@ -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;
}
}

44
designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java

@ -3,6 +3,8 @@ package com.fr.design.widget.ui;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
@ -27,7 +29,7 @@ import com.fr.form.ui.NumberEditor;
import com.fr.general.Inter;
public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> {
/**
/**FieldEditorDefinePane
*
*/
private static final long serialVersionUID = 8011242951911686805L;
@ -39,7 +41,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
private SpinnerNumberModel maxValueModel;
private UIBasicSpinner minValueSpinner;
private SpinnerNumberModel minValueModel;
private com.fr.design.editor.editor.IntegerEditor decimalLength;
private UIBasicSpinner decimalLength;
private JPanel limitNumberPane;
private WaterMarkDictPane waterMarkDictPane;
@ -80,7 +82,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
};
private ActionListener actionListener3 = new ActionListener() {
public ActionListener actionListener3 = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (setMaxValueCheckBox.isSelected()) {
maxValueSpinner.setVisible(true);
@ -144,7 +146,8 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
};
public NumberEditorDefinePane() {
super();
// super();
this.initComponents();
}
@ -169,25 +172,26 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
public JPanel setValidatePane() {
this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Decimals"));
this.decimalLength = new com.fr.design.editor.editor.IntegerEditor();
this.decimalLength.setColumns(10);
this.decimalLength = new UIBasicSpinner(new SpinnerNumberModel(16, 0, Integer.MAX_VALUE, 1));
this.decimalLength.setPreferredSize(new Dimension(155, 20));
this.allowDecimalsCheckBox.addActionListener(actionListener1);
this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Negative"));
this.allowNegativeCheckBox.addActionListener(actionListener2);
this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false);
this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Max_Value"), false);
this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
maxValueSpinner.setPreferredSize(new Dimension(120, 20));
maxValueSpinner.setPreferredSize(new Dimension(155, 20));
setNotAllowsInvalid(this.maxValueSpinner);
this.maxValueSpinner.setVisible(false);
this.setMaxValueCheckBox.addActionListener(actionListener3);
this.maxValueSpinner.addChangeListener(changeListener1);
this.setMinValueCheckBox = new UICheckBox(Inter.getLocText("Need_Min_Value"), false);
this.setMinValueCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Min_Value"), false);
this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
minValueSpinner.setPreferredSize(new Dimension(120, 20));
minValueSpinner.setPreferredSize(new Dimension(155, 20));
setNotAllowsInvalid(this.minValueSpinner);
this.minValueSpinner.setVisible(false);
this.setMinValueCheckBox.addActionListener(actionListener4);
@ -196,19 +200,29 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
UILabel numberLabel = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Double", "Numbers"}));
numberLabel.setBorder(BorderFactory.createEmptyBorder(0,12,0,0));
JPanel pane1 = new JPanel(new BorderLayout());
pane1.add(decimalLength, BorderLayout.CENTER);
pane1.setBorder(BorderFactory.createEmptyBorder(0,12,0,0));
JPanel pane2 = new JPanel(new BorderLayout());
pane2.add(maxValueSpinner, BorderLayout.CENTER);
pane2.setBorder(BorderFactory.createEmptyBorder(0,12,0,0));
JPanel pane3 = new JPanel(new BorderLayout());
pane3.add(minValueSpinner, BorderLayout.CENTER);
pane3.setBorder(BorderFactory.createEmptyBorder(0,12,0,0));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{allowDecimalsCheckBox, null },
new Component[]{numberLabel, decimalLength },
new Component[]{numberLabel, pane1 },
new Component[]{allowNegativeCheckBox, null},
new Component[]{setMaxValueCheckBox, maxValueSpinner},
new Component[]{setMinValueCheckBox, minValueSpinner},
new Component[]{setMaxValueCheckBox, pane2},
new Component[]{setMinValueCheckBox, pane3},
};
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, 1);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
panel.setBorder(BorderFactory.createEmptyBorder(0,1,0,0));
return panel;
@ -255,7 +269,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
NumberEditor ob = new NumberEditor();
ob.setAllowDecimals(allowDecimalsCheckBox.isSelected());
if (allowDecimalsCheckBox.isSelected()) {
ob.setMaxDecimalLength(this.decimalLength.getValue());
ob.setMaxDecimalLength((Integer) this.decimalLength.getValue());
}
ob.setAllowNegative(allowNegativeCheckBox.isSelected());

124
designer/src/com/fr/design/widget/ui/RadioGroupDefinePane.java

@ -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;
}
}

71
designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java

@ -1,7 +1,9 @@
package com.fr.design.widget.btn;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import java.awt.*;
import javax.swing.*;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
@ -12,11 +14,6 @@ import com.fr.form.ui.Button;
import com.fr.general.Inter;
import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
/**
* Created by IntelliJ IDEA.
* Author : Richer
@ -28,62 +25,39 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
private UITextField hotkeysTextField;
private UITextField buttonNameTextField;
private IconDefinePane iconPane;
private AttributeChangeListener listener;
public ButtonWithHotkeysDetailPane() {
initComponents();
}
private void initComponents() {
// creator.
this.setLayout(FRGUIPaneFactory.createBorderLayout());
// JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
// advancedPane.setPreferredSize(new Dimension(600, 341));
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
advancedPane.setPreferredSize(new Dimension(600, 341));
JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4));
this.add(advancedPane);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double rowSize[] = {p, p, p, p, p, p, p};
double columnSize[] = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 3}, {1, 1}, {1, 1}};
double rowSize[] = {p, p, p, p};
double columnSize[] = {p, p};
JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
iconPane = new IconDefinePane();
labelPane.add(iconPane);
Component[][] n_components = {
{new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField = new UITextField()},
{new UILabel("背景" + ":"), new UITextField()},
{new UILabel("字体" + ":"), new UITextField()},
{new UILabel("图标" + ":"), new UITextField()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField = new UITextField()}
{new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField = new UITextField(16)},
{new UILabel(Inter.getLocText("FR-Designer_Button-Icon") + ":"), labelPane},
{new UILabel(Inter.getLocText("FR-Designer_Button-Type") + ":"), createButtonTypeComboBox()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField = new UITextField(16)}
};
buttonNameTextField.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
}
@Override
public void focusLost(FocusEvent e) {
// creator.getWidget().set
}
});
hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ","));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, 10, 8);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
jPanel.add(panel, BorderLayout.CENTER);
UIExpandablePane advancedPane = new UIExpandablePane("高级", 280, 20, jPanel);
this.add(advancedPane);
}
//add By kerry
public void addAttributeChangeListener(AttributeChangeListener listener) {
this.listener = listener;
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 0, 8);
advancedPane.add(panel,BorderLayout.NORTH);
Component comp = createCenterPane();
if(comp != null ) {
advancedPane.add(comp,BorderLayout.CENTER);
}
}
protected abstract Component createCenterPane();
@Override
@ -104,11 +78,4 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
button.setHotkeys(hotkeysTextField.getText());
return button;
}
public void updateBean(Button ob) {
ob.setIconName(iconPane.update());
ob.setText(buttonNameTextField.getText());
ob.setHotkeys(hotkeysTextField.getText());
}
}
Loading…
Cancel
Save