Browse Source

REPORT-2897 9.0设计器修改

视觉优化
master
MoMeak 7 years ago
parent
commit
161a93c244
  1. 14
      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. 4
      designer/src/com/fr/design/widget/ui/RadioGroupDefinePane.java
  5. 71
      designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java

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

@ -1,6 +1,7 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -28,7 +29,8 @@ public class ButtonGroupDictPane extends JPanel {
* *
*/ */
public void initComponents() { public void initComponents() {
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.setLayout(new FlowLayout(0));
JPanel pane = new JPanel(new FlowLayout());
adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true); adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true);
adaptiveCheckbox.addActionListener(new ActionListener() { adaptiveCheckbox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -36,12 +38,14 @@ public class ButtonGroupDictPane extends JPanel {
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); columnLabel.setVisible(!adaptiveCheckbox.isSelected());
} }
}); });
this.add(adaptiveCheckbox);
this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns") + ":"); this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns"));
this.add(columnLabel);
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);
this.add(pane);
} }
public void populate(ButtonGroup buttonGroup) { public void populate(ButtonGroup buttonGroup) {

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

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

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

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

@ -28,9 +28,9 @@ public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> {
@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;
} }

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

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