Browse Source

REPORT-3958&&REPORT-4373&&REPORT-4377&&REPORT-4372&&REPORT-4398&&REPORT-4393&&REPORT-4028&&REPORT-4192

master
kerry 7 years ago
parent
commit
520d43e38c
  1. 5
      designer/src/com/fr/design/widget/CellWidgetCardPane.java
  2. 4
      designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java
  3. 1
      designer/src/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java
  4. 28
      designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java
  5. 2
      designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java
  6. 36
      designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java
  7. 257
      designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java
  8. 4
      designer/src/com/fr/design/widget/ui/btn/DefineAppendColumnRowPane.java
  9. 5
      designer/src/com/fr/design/widget/ui/btn/DefineDeleteColumnRowPane.java
  10. 28
      designer/src/com/fr/design/widget/ui/btn/TreeNodeToogleButtonDefinePane.java
  11. 22
      designer_base/src/com/fr/design/designer/IntervalConstants.java
  12. 3
      designer_base/src/com/fr/design/gui/columnrow/ColumnRowPane.java
  13. 9
      designer_base/src/com/fr/design/gui/frpane/RegFieldPane.java
  14. 25
      designer_base/src/com/fr/design/gui/frpane/RegPane.java
  15. 68
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleImgBackgroundEditor.java
  16. 11
      designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java
  17. 29
      designer_base/src/com/fr/design/widget/component/BackgroundCompPane.java
  18. 168
      designer_base/src/com/fr/design/widget/component/CheckBoxDictPane.java
  19. 18
      designer_base/src/com/fr/design/widget/component/DateValuePane.java
  20. 303
      designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java
  21. 92
      designer_form/src/com/fr/design/designer/creator/CRPropertyDescriptorPane.java
  22. 70
      designer_form/src/com/fr/design/designer/creator/PropertyGroupPane.java
  23. 2
      designer_form/src/com/fr/design/designer/creator/XDateEditor.java
  24. 18
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  25. 18
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  26. 2
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  27. 7
      designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java
  28. 6
      designer_form/src/com/fr/design/widget/ui/designer/ButtonDefinePane.java
  29. 93
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDictPane.java
  30. 18
      designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java
  31. 32
      designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  32. 30
      designer_form/src/com/fr/design/widget/ui/designer/FreeButtonDefinePane.java
  33. 252
      designer_form/src/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java
  34. 3
      designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java
  35. 6
      designer_form/src/com/fr/design/widget/ui/designer/component/TabFitLayoutBackgroundPane.java
  36. 35
      designer_form/src/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java
  37. 46
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  38. 23
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteLayoutDefinePane.java
  39. 17
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  40. 9
      designer_form/src/com/fr/design/widget/ui/designer/layout/WCardLayoutDefinePane.java
  41. 21
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java

5
designer/src/com/fr/design/widget/CellWidgetCardPane.java

@ -73,8 +73,9 @@ public class CellWidgetCardPane extends BasicPane {
tabbedPane = new CardLayout();
center = new JPanel(tabbedPane);
jPanel.add(center, BorderLayout.CENTER);
jPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
attriTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
// attriTabPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
eventTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
initPaneList();
eventPane = initWidgetEventPane(pane);
@ -91,7 +92,7 @@ public class CellWidgetCardPane extends BasicPane {
}
};
tabsHeaderIconPane.setNeedLeftRightOutLine(false);
jPanel.add(tabsHeaderIconPane, BorderLayout.NORTH);
this.add(tabsHeaderIconPane, BorderLayout.NORTH);
widgetPropertyPane = new BasicWidgetPropertySettingPane();

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

@ -9,6 +9,7 @@ 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.widget.component.CheckBoxDictPane;
import com.fr.form.ui.CheckBoxGroup;
import com.fr.general.Inter;
@ -36,7 +37,7 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup
@Override
protected JPanel setFirstContentPane() {
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
checkbox = new UICheckBox(Inter.getLocText("FR-Designer_Advanced"));
checkbox = new UICheckBox(Inter.getLocText(new String[]{"Provide", "Choose_All"}));
checkbox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
buttonGroupDictPane = new ButtonGroupDictPane();
checkBoxDictPane = new CheckBoxDictPane();
@ -52,7 +53,6 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1},{1,1},{1,1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
// panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
advancePane.add(panel);
return advancePane;

1
designer/src/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java

@ -8,6 +8,7 @@ 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.design.widget.component.CheckBoxDictPane;
import com.fr.form.ui.ComboCheckBox;
import com.fr.general.Inter;

28
designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java

@ -3,13 +3,12 @@ package com.fr.design.widget.ui;
import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.data.core.FormatField;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.widget.component.DateValuePane;
import com.fr.form.ui.DateEditor;
import com.fr.general.DateUtils;
@ -19,6 +18,8 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.UtilEvalError;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -26,14 +27,14 @@ import java.text.SimpleDateFormat;
import java.util.Date;
public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> {
private UIHeadGroup returnTypeComboBox;
private UIButtonGroup returnTypeComboBox;
private DateValuePane startDv;
private DateValuePane endDv;
private UIComboBox currentFormatComboBox;
private UILabel currentSamplelabel;
private UIHeadGroup fomatHeadGroup;
private UIButtonGroup fomatHeadGroup;
@ -47,12 +48,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
@Override
protected JPanel setSecondContentPane() {
returnTypeComboBox = new UIHeadGroup(new String[] {Inter.getLocText("Date") , Inter.getLocText("String")}){
protected void tabChanged(int newSelectedIndex) {
//todo
}
};
returnTypeComboBox = new UIButtonGroup<>(new String[] {Inter.getLocText("Date") , Inter.getLocText("String")});
JPanel formatHead = createFormatHead();
startDv = new DateValuePane();
@ -118,8 +114,11 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
customPane.add(dateFormatPane, Inter.getLocText("StyleFormat-Date"));
customPane.add(timeFormatPane, Inter.getLocText("StyleFormat-Time"));
final String[] tabTitles = new String[]{Inter.getLocText("StyleFormat-Date"), Inter.getLocText("StyleFormat-Time")};
fomatHeadGroup = new UIHeadGroup(new String[]{Inter.getLocText("StyleFormat-Date"), Inter.getLocText("StyleFormat-Time")}){
protected void tabChanged(int newSelectedIndex) {
fomatHeadGroup = new UIButtonGroup(new String[]{Inter.getLocText("StyleFormat-Date"), Inter.getLocText("StyleFormat-Time")});
fomatHeadGroup.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int newSelectedIndex = fomatHeadGroup.getSelectedIndex();
cardLayout.show(customPane, tabTitles[newSelectedIndex]);
if(newSelectedIndex == 0){
currentFormatComboBox = dateFormatComboBox;
@ -130,12 +129,14 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
}
refreshPreviewLabel();
}
};
});
fomatHeadPane.add(fomatHeadGroup, BorderLayout.NORTH);
fomatHeadPane.add(customPane, BorderLayout.CENTER);
return fomatHeadPane;
}
private void refreshPreviewLabel() {
String text = (String) currentFormatComboBox.getSelectedItem();
if (text != null && text.length() > 0) {
@ -175,6 +176,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
protected void populateSubDirectWriteEditorBean(DateEditor e) {
String formatText = e.getFormatText();
fomatHeadGroup.setSelectedIndex(getDateType(e));
fomatHeadGroup.populateBean();
currentFormatComboBox.setSelectedItem(formatText);
returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 0 : 1);

2
designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java

@ -15,7 +15,7 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
protected WaterMarkDictPane waterMarkDictPane;
public DirectWriteEditorDefinePane() {
this.initComponents();
super();
}

36
designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java

@ -1,7 +1,7 @@
package com.fr.design.widget.ui;
import com.fr.base.GraphHelper;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
@ -20,8 +20,6 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> {
private static final int ALLOW_BLANK_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("FR-Designer_Allow_Null") + 30;
private static final int ALLOW_BLANK_CHECK_BOX_HEIGHT = 30;
protected UICheckBox allowBlankCheckBox;
// richer:错误信息,是所有控件共有的属性,所以放到这里来
protected UITextField errorMsgTextField;
@ -95,39 +93,29 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
protected void addValidatePane() {
validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
final UILabel uiLabel = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Error", "FR-Designer_Tooltips"}));
final UILabel uiLabel = new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip"));
initErrorMsgPane();
allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null"));
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT));
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
final JPanel errorTipPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{uiLabel, errorMsgTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
errorTipPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, 0, 0));
borderPane.add(errorTipPane, BorderLayout.CENTER);
allowBlankCheckBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
boolean isSelected = allowBlankCheckBox.isSelected();
uiLabel.setVisible(!isSelected);
errorMsgTextField.setVisible(!isSelected);
if (isSelected) {
uiLabel.setPreferredSize(new Dimension(0, 0));
errorMsgTextField.setPreferredSize(new Dimension(0, 0));
} else {
uiLabel.setPreferredSize(new Dimension(66, 20));
errorMsgTextField.setPreferredSize(new Dimension(150, 20));
}
errorTipPane.setVisible(!isSelected);
}
});
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
errorTipPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, 0, 0));
Component[][] components = new Component[][]{
new Component[]{allowBlankCheckBox, null},
new Component[]{uiLabel, errorMsgTextField},
new Component[]{allowBlankCheckBox},
new Component[]{borderPane},
};
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 1);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components,TableLayoutHelper.FILL_LASTCOLUMN, 5, 5);
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L6, 0));
validatePane.add(panel, BorderLayout.NORTH);
JPanel contentPane = this.setValidatePane();

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

@ -1,60 +1,20 @@
package com.fr.design.widget.ui;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JFormattedTextField;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.text.DefaultFormatter;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.component.NumberEditorValidatePane;
import com.fr.form.ui.NumberEditor;
import com.fr.general.Inter;
public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> {
/**
* FieldEditorDefinePane
*/
private static final long serialVersionUID = 8011242951911686805L;
private UICheckBox allowDecimalsCheckBox;
private UICheckBox allowNegativeCheckBox;
private UICheckBox setMaxValueCheckBox;
private UICheckBox setMinValueCheckBox;
private UIBasicSpinner maxValueSpinner;
private SpinnerNumberModel maxValueModel;
private UIBasicSpinner minValueSpinner;
private SpinnerNumberModel minValueModel;
private UISpinner decimalLength;
private JPanel limitNumberPane;
private WaterMarkDictPane waterMarkDictPane;
private ActionListener allowDecimalsListener;
private ActionListener allowNegativeListener ;
public ActionListener setMaxListener;
private ActionListener setMinListener;
private ChangeListener maxValueChangeListener;
private ChangeListener minValueChangeListener;
private WaterMarkDictPane waterMarkDictPane;
private NumberEditorValidatePane numberEditorValidatePane;
public NumberEditorDefinePane() {
}
@ -75,226 +35,23 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
}
public JPanel setValidatePane() {
initListeners();
this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Decimals"));
allowDecimalsCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.decimalLength = new UISpinner(0, Integer.MAX_VALUE, 1, 16);
this.allowDecimalsCheckBox.addActionListener(allowDecimalsListener);
this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Negative"));
this.allowNegativeCheckBox.addActionListener(allowNegativeListener);
allowNegativeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Max_Value"), false);
setMaxValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
setNotAllowsInvalid(this.maxValueSpinner);
this.setMaxValueCheckBox.addActionListener(setMaxListener);
this.maxValueSpinner.addChangeListener(maxValueChangeListener);
this.setMinValueCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Min_Value"), false);
setMinValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
setNotAllowsInvalid(this.minValueSpinner);
this.setMinValueCheckBox.addActionListener(setMinListener);
this.minValueSpinner.addChangeListener(minValueChangeListener);
UILabel numberLabel = new UILabel(Inter.getLocText("FR-Designer_Decimal_Places"));
limitNumberPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{numberLabel, decimalLength}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{allowDecimalsCheckBox, null},
new Component[]{limitNumberPane, null},
new Component[]{allowNegativeCheckBox, null},
new Component[]{setMaxValueCheckBox, maxValueSpinner},
new Component[]{setMinValueCheckBox, minValueSpinner},
};
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
pane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
return pane;
numberEditorValidatePane = new NumberEditorValidatePane();
return numberEditorValidatePane;
}
@Override
protected void populateSubFieldEditorBean(NumberEditor e) {
allowDecimalsCheckBox.setSelected(e.isAllowDecimals());
if (e.isAllowDecimals()) {
this.decimalLength.setValue(e.getMaxDecimalLength());
} else {
this.limitNumberPane.setVisible(false);
this.limitNumberPane.setPreferredSize(new Dimension(0,0));
}
allowNegativeCheckBox.setSelected(e.isAllowNegative());
if (e.getMaxValue() == Double.MAX_VALUE) {
setMaxValueCheckBox.setSelected(false);
maxValueSpinner.setValue(new Double(Double.MAX_VALUE));
maxValueSpinner.setEnabled(false);
} else {
setMaxValueCheckBox.setSelected(true);
maxValueSpinner.setEnabled(true);
maxValueSpinner.setValue(new Double(e.getMaxValue()));
}
if (e.getMinValue() == -Double.MAX_VALUE) {
setMinValueCheckBox.setSelected(false);
minValueSpinner.setValue(new Double(-Double.MAX_VALUE));
minValueSpinner.setEnabled(false);
} else {
minValueSpinner.setEnabled(true);
setMinValueCheckBox.setSelected(true);
minValueSpinner.setValue(new Double(e.getMinValue()));
}
this.numberEditorValidatePane.populate(e);
this.waterMarkDictPane.populate(e);
}
@Override
protected NumberEditor updateSubFieldEditorBean() {
NumberEditor ob = new NumberEditor();
ob.setAllowDecimals(allowDecimalsCheckBox.isSelected());
if (allowDecimalsCheckBox.isSelected()) {
ob.setMaxDecimalLength((int)this.decimalLength.getValue());
}
ob.setAllowNegative(allowNegativeCheckBox.isSelected());
if (setMaxValueCheckBox.isSelected()) {
ob.setMaxValue(Double.parseDouble("" + maxValueSpinner.getValue()));
} else {
ob.setMaxValue(Double.MAX_VALUE);
}
if (setMinValueCheckBox.isSelected()) {
ob.setMinValue(Double.parseDouble("" + minValueSpinner.getValue()));
} else {
ob.setMinValue(-Double.MAX_VALUE);
}
this.numberEditorValidatePane.update(ob);
this.waterMarkDictPane.update(ob);
return ob;
}
private void initListeners(){ allowDecimalsListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (allowDecimalsCheckBox.isSelected()) {
limitNumberPane.setVisible(true);
limitNumberPane.setPreferredSize(new Dimension(215,20));
} else {
limitNumberPane.setVisible(false);
limitNumberPane.setPreferredSize(new Dimension(0,0));
}
}
};
allowNegativeListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (allowNegativeCheckBox.isSelected()) {
minValueModel.setMinimum(-Double.MAX_VALUE);
if (!setMinValueCheckBox.isSelected()) {
maxValueModel.setMinimum(-Double.MAX_VALUE);
}
} else {
minValueModel.setMinimum(0.0);
if (!setMinValueCheckBox.isSelected()) {
maxValueModel.setMinimum(0.0);
}
Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (minValue < 0.0) {
minValueSpinner.setValue(0.0);
}
if (maxValue < 0.0) {
maxValueSpinner.setValue(0.0);
}
}
}
};
setMaxListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (setMaxValueCheckBox.isSelected()) {
maxValueSpinner.setEnabled(true);
Double value = new Double(0);
if (setMinValueCheckBox.isSelected()) {
Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
if (minValue > value) {
value = minValue;
}
}
maxValueSpinner.setValue(value);
} else {
maxValueSpinner.setEnabled(false);
minValueModel.setMaximum(Double.MAX_VALUE);
}
}
};
setMinListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (setMinValueCheckBox.isSelected()) {
minValueSpinner.setEnabled(true);
Double value = new Double(0);
if (setMaxValueCheckBox.isSelected()) {
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (maxValue < value) {
value = maxValue;
}
}
minValueSpinner.setValue(value);
} else {
minValueSpinner.setEnabled(false);
maxValueModel.setMinimum(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : new Double(0));
}
}
};
maxValueChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (setMaxValueCheckBox.isSelected()) {
if (setMinValueCheckBox.isSelected()) {
minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue()));
}
}
}
};
minValueChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (setMinValueCheckBox.isSelected()) {
if (setMaxValueCheckBox.isSelected()) {
maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue()));
}
}
}
};
}
private void setNotAllowsInvalid(UIBasicSpinner jspinner) {
JComponent editor = jspinner.getEditor();
if (editor instanceof UIBasicSpinner.DefaultEditor) {
JFormattedTextField ftf = ((UIBasicSpinner.DefaultEditor) editor).getTextField();
ftf.setColumns(10);
JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
DefaultFormatter df = (DefaultFormatter) formatter;
df.setAllowsInvalid(false);
}
}
}

4
designer/src/com/fr/design/widget/ui/btn/DefineAppendColumnRowPane.java

@ -38,11 +38,11 @@ public class DefineAppendColumnRowPane extends BasicPane {
crEditor = new ColumnRowEditor();
jNumberEditor = new UISpinner(0, 100 , 1, 0);
rowCountLable = new UILabel(Inter.getLocText("Edit-Row_Count") + ":");
rowCountLable = new UILabel(Inter.getLocText("Edit-Row_Count"));
JPanel lpane = FRGUIPaneFactory.createBorderLayout_S_Pane();
lpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
lpane.add(new UILabel(Inter.getLocText("Append_Delete_Row_Message")));
Component[][] components = { { new UILabel(Inter.getLocText(new String[]{"Specify", "Cell"}) + ":"), crEditor }, { rowCountLable, jNumberEditor } ,{lpane,null}};
Component[][] components = { { new UILabel(Inter.getLocText(new String[]{"Specify", "Cell"})), crEditor }, { rowCountLable, jNumberEditor } ,{lpane,null}};
JPanel contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));

5
designer/src/com/fr/design/widget/ui/btn/DefineDeleteColumnRowPane.java

@ -34,9 +34,10 @@ public class DefineDeleteColumnRowPane extends BasicPane {
double rowSize[] = { p, p};
double columnSize[] = { p, f};
crEditor = new ColumnRowEditor();
UILabel messageLabel = new UILabel(Inter.getLocText("Append_Delete_Row_Message"));
Component[][] components = {
{ new UILabel(Inter.getLocText(new String[]{"Specify", "Cell"}) + ":"), crEditor },
{new UILabel(Inter.getLocText("Append_Delete_Row_Message")),null}};
{ new UILabel(Inter.getLocText(new String[]{"Specify", "Cell"})), crEditor },
{ messageLabel, null}};
JPanel contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
setLayout(FRGUIPaneFactory.createBorderLayout());

28
designer/src/com/fr/design/widget/ui/btn/TreeNodeToogleButtonDefinePane.java

@ -1,5 +1,6 @@
package com.fr.design.widget.ui.btn;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
@ -27,34 +28,21 @@ public class TreeNodeToogleButtonDefinePane<T extends TreeNodeToggleButton> exte
}
protected void initComponents() {
setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double rowSize[] = {p};
double columnSize[] = {p, f};
Component[][] n_components = {
{new UILabel(Inter.getLocText("FR-Designer_Button-Type") + ":"), createButtonTypeComboBox()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Type")), createButtonTypeComboBox()},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 0, 8);
UIExpandablePane advancedPane = new UIExpandablePane("高级", 280, 20, panel);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, IntervalConstants.INTERVAL_L2, 8);
JPanel borderPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
borderPanel.add(panel, BorderLayout.CENTER);
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0));
UIExpandablePane advancedPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, borderPanel);
this.add(advancedPane);
// setLayout(FRGUIPaneFactory.createBorderLayout());
// double p = TableLayout.PREFERRED;
// double rowSize[] = {p};
// double columnSize[] = {p, 184};
// Component[][] n_components = {
// {new UILabel(Inter.getLocText(new String[]{"Form-Button", "Type"}) + ":"), createButtonTypeComboBox()}
// };
// JPanel northPane = TableLayoutHelper.createTableLayoutPane(n_components, rowSize, columnSize);
// JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
//// advancedPane.add(northPane);
// add(northPane);
}
@Override

22
designer_base/src/com/fr/design/designer/IntervalConstants.java

@ -0,0 +1,22 @@
package com.fr.design.designer;
/**
* Created by kerry on 2017/9/8.
*/
public class IntervalConstants {
public static final int INTERVAL_L1 = 10;
public static final int INTERVAL_L2 = 15;
public static final int INTERVAL_L3 = 155;
public static final int INTERVAL_L4 = 10;
public static final int INTERVAL_L5 = 12;
public static final int INTERVAL_L6 = 5;
public static final int INTERVAL_L7 = 8;
}

3
designer_base/src/com/fr/design/gui/columnrow/ColumnRowPane.java

@ -17,6 +17,7 @@ import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DocumentFilter;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.itextfield.UITextField;
@ -96,7 +97,7 @@ public class ColumnRowPane extends JPanel implements UIObserver {
* 初始化元素
*/
public void initComponents() {
this.setLayout(new GridLayout(0, 2, 0, 0));
this.setLayout(new GridLayout(0, 2, IntervalConstants.INTERVAL_L6, 0));
initColSpinner();
this.add(columnSpinner, BorderLayout.WEST);
initRowSpinner();

9
designer_base/src/com/fr/design/gui/frpane/RegFieldPane.java

@ -1,5 +1,7 @@
package com.fr.design.gui.frpane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
@ -31,6 +33,7 @@ public class RegFieldPane extends RegPane {
}
public void initComponents() {
this.setBorder(BorderFactory.createEmptyBorder(0, 0, IntervalConstants.INTERVAL_L1, 0));
regErrorMsgPane = new RegErrorMsgPane();
final RegChangeListener regChangeListener = new RegChangeListener() {
@ -68,9 +71,11 @@ public class RegFieldPane extends RegPane {
public RegErrorMsgPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
this.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0));
initRegErrorMsgField();
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip")), regErrorMsgField}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
UILabel tipLabel = new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip"));
tipLabel.setPreferredSize(new Dimension(60, 20));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tipLabel, regErrorMsgField}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, LayoutConstants.VGAP_MEDIUM);
this.add(panel);
}

25
designer_base/src/com/fr/design/gui/frpane/RegPane.java

@ -1,6 +1,7 @@
package com.fr.design.gui.frpane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
@ -70,7 +71,7 @@ public class RegPane extends BasicPane {
private void initComponents(){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
regComboBox = new UIComboBox(regType);
regComboBox.setRenderer(listCellRender);
@ -331,11 +332,13 @@ public class RegPane extends BasicPane {
private final String[] dataType = {EMB_REG1, EMB_REG2, EMB_REG3, Inter.getLocText("FR-Designer_Custom")};
DefaultComboBoxModel DefaultComboBoxModel= new DefaultComboBoxModel(dataType);
public RegPhonePane() {
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
this.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
dataTypeComboBox = new UIComboBox(DefaultComboBoxModel);
JTextField editFiled = (JTextField)(dataTypeComboBox.getEditor().getEditorComponent());
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Data_Type")), dataTypeComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
UILabel dataTypeLable = new UILabel(Inter.getLocText("FR-Designer_Data_Type"));
dataTypeLable.setPreferredSize(new Dimension(60, 20));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{dataTypeLable, dataTypeComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, 0);
this.add(panel);
editFiled.setDocument(new LimitedDocument(LIMIT_LENGTH, REG_PATTERN));
dataTypeComboBox.addItemListener(new ItemListener() {
@ -393,20 +396,24 @@ public class RegPane extends BasicPane {
public RegLengthPane(){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
this.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0));
this.setPreferredSize(new Dimension(210, 56));
minLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
maxLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
UILabel minLabel = new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length"));
UILabel maxLabel = new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length"));
minLabel.setPreferredSize(new Dimension(60, 20));
maxLabel.setPreferredSize(new Dimension(60, 20));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length") + ":"), minLenSpinner },
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":"), maxLenSpinner},
new Component[]{minLabel, minLenSpinner },
new Component[]{maxLabel, maxLenSpinner},
};
double[] rowSize = {p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, LayoutConstants.VGAP_MEDIUM);
this.add(panel);
@ -446,9 +453,9 @@ public class RegPane extends BasicPane {
public CustomRegRexPane(){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
this.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0));
regTextField = new UITextField();
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Expressions")), regTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Reg_Expressions")), regTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, LayoutConstants.VGAP_MEDIUM);
this.add(panel);
}

68
designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleImgBackgroundEditor.java → designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleImgBackgroundEditor.java

@ -1,35 +1,35 @@
package com.fr.design.mainframe.widget.accessibles;
import java.awt.Dimension;
import javax.swing.SwingUtilities;
import com.fr.base.background.ColorBackground;
import com.fr.design.mainframe.widget.wrappers.BackgroundWrapper;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.style.background.BackgroundButtonPane;
import com.fr.general.Background;
public class AccessibleImgBackgroundEditor extends UneditableAccessibleEditor {
private BackgroundButtonPane choosePane;
public AccessibleImgBackgroundEditor() {
super(new BackgroundWrapper());
}
@Override
protected void showEditorPane() {
choosePane = new BackgroundButtonPane();
choosePane.setPreferredSize(new Dimension(600, 400));
BasicDialog dlg = choosePane.showWindow(SwingUtilities.getWindowAncestor(this));
dlg.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
setValue(choosePane.update());
fireStateChanged();
}
});
choosePane.populate(getValue() instanceof Background ? (Background) getValue() : new ColorBackground());
dlg.setVisible(true);
}
package com.fr.design.mainframe.widget.accessibles;
import java.awt.Dimension;
import javax.swing.SwingUtilities;
import com.fr.base.background.ColorBackground;
import com.fr.design.mainframe.widget.wrappers.BackgroundWrapper;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.style.background.BackgroundButtonPane;
import com.fr.general.Background;
public class AccessibleImgBackgroundEditor extends UneditableAccessibleEditor {
private BackgroundButtonPane choosePane;
public AccessibleImgBackgroundEditor() {
super(new BackgroundWrapper());
}
@Override
protected void showEditorPane() {
choosePane = new BackgroundButtonPane();
choosePane.setPreferredSize(new Dimension(600, 400));
BasicDialog dlg = choosePane.showWindow(SwingUtilities.getWindowAncestor(this));
dlg.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
setValue(choosePane.update());
fireStateChanged();
}
});
choosePane.populate(getValue() instanceof Background ? (Background) getValue() : new ColorBackground());
dlg.setVisible(true);
}
}

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

@ -4,6 +4,7 @@ import java.awt.*;
import javax.swing.*;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
@ -42,13 +43,13 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
iconPane = new AccessibleIconEditor();
labelPane.add(iconPane);
Component[][] n_components = {
{new UILabel(Inter.getLocText("FR-Designer_Button-Type") + ":"), createButtonTypeComboBox()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField = new UITextField()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Icon") + ":"), iconPane},
{new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField = new UITextField()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Type")), createButtonTypeComboBox()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Name")), buttonNameTextField = new UITextField()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Icon")), iconPane},
{new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys")), hotkeysTextField = new UITextField()},
};
hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ","));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 16, 8);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, IntervalConstants.INTERVAL_L2, 8);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
advancePane.add(panel, BorderLayout.NORTH);
Component comp = createCenterPane();

29
designer_base/src/com/fr/design/widget/component/BackgroundCompPane.java

@ -1,14 +1,16 @@
package com.fr.design.widget.component;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
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.AccessibleBackgroundEditor;
import com.fr.design.mainframe.widget.accessibles.AccessibleImgBackgroundEditor;
import com.fr.form.ui.Widget;
import com.fr.general.Inter;
import com.vividsolutions.jts.index.bintree.Interval;
import javax.swing.*;
import java.awt.*;
@ -18,9 +20,9 @@ import java.awt.*;
*/
public abstract class BackgroundCompPane<T extends Widget> extends BasicPane {
protected UIButtonGroup backgroundHead;
protected AccessibleBackgroundEditor initalBackgroundEditor;
protected AccessibleBackgroundEditor overBackgroundEditor;
protected AccessibleBackgroundEditor clickBackgroundEditor;
protected AccessibleImgBackgroundEditor initalBackgroundEditor;
protected AccessibleImgBackgroundEditor overBackgroundEditor;
protected AccessibleImgBackgroundEditor clickBackgroundEditor;
private JPanel panel;
public BackgroundCompPane() {
@ -29,9 +31,11 @@ public abstract class BackgroundCompPane<T extends Widget> extends BasicPane {
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
initalBackgroundEditor = new AccessibleBackgroundEditor();
overBackgroundEditor = new AccessibleBackgroundEditor();
clickBackgroundEditor = new AccessibleBackgroundEditor();
UILabel headLabel = createUILable();
headLabel.setPreferredSize(new Dimension(50, 20));
initalBackgroundEditor = new AccessibleImgBackgroundEditor();
overBackgroundEditor = new AccessibleImgBackgroundEditor();
clickBackgroundEditor = new AccessibleImgBackgroundEditor();
String [] titles = new String[]{Inter.getLocText("FR-Designer_DEFAULT"), Inter.getLocText("FR-Designer_Custom")};
double f = TableLayout.FILL;
@ -44,14 +48,19 @@ public abstract class BackgroundCompPane<T extends Widget> extends BasicPane {
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Over")), overBackgroundEditor},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background-Click")), clickBackgroundEditor},
};
panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, 7);
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0));
backgroundHead = new UIButtonGroup(titles);
this.add(backgroundHead, BorderLayout.NORTH);
JPanel headPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{headLabel, backgroundHead}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, 7);
this.add(headPane, BorderLayout.NORTH);
this.add(panel, BorderLayout.CENTER);
}
protected UILabel createUILable(){
return new UILabel(Inter.getLocText("FR-Designer_Background"));
}
public void update(T e){
}

168
designer/src/com/fr/design/widget/ui/CheckBoxDictPane.java → designer_base/src/com/fr/design/widget/component/CheckBoxDictPane.java

@ -1,84 +1,86 @@
package com.fr.design.widget.ui;
import java.awt.*;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.gui.icombobox.DictionaryConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.CheckBoxGroup;
import com.fr.form.ui.ComboCheckBox;
import com.fr.general.Inter;
public class CheckBoxDictPane extends JPanel {
private DictionaryComboBox delimiterComboBox;
private UIButtonGroup returnTypeComboBox;
private DictionaryComboBox startComboBox;
private DictionaryComboBox endComboBox;
private JPanel delimiterPane;
private JPanel startPane;
private JPanel endPane;
public CheckBoxDictPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel returnTypePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
delimiterPane =FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel label = new UILabel(Inter.getLocText("Form-Delimiter") + ":");
delimiterPane.add(label, BorderLayout.WEST);
delimiterPane.add(delimiterComboBox = new DictionaryComboBox(DictionaryConstants.delimiters, DictionaryConstants.delimiterDisplays), BorderLayout.CENTER);
delimiterComboBox.setEditable(true);
startPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
startPane.add(new UILabel(Inter.getLocText("ComboCheckBox-Start_Symbol") + ":"), BorderLayout.WEST);
startPane.add(startComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER);
startComboBox.setEditable(true);
endPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
endPane.add(new UILabel(Inter.getLocText("ComboCheckBox-End_Symbol") + ":"), BorderLayout.WEST);
endPane.add(endComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER);
endComboBox.setEditable(true);
returnTypeComboBox = new UIButtonGroup(new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")});
returnTypePane.add(returnTypeComboBox, BorderLayout.CENTER);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypePane}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
this.add(jPanel);
}
private void checkVisible(int selectIndex){
delimiterPane.setVisible(selectIndex == 1);
startPane.setVisible(selectIndex == 1);
endPane.setVisible(selectIndex == 1);
}
public void populate(ComboCheckBox comboCheckBox) {
this.delimiterComboBox.setSelectedItem(comboCheckBox.getDelimiter());
this.returnTypeComboBox.setSelectedIndex(comboCheckBox.isReturnString() ? 1 : 0);
this.startComboBox.setSelectedItem(comboCheckBox.getStartSymbol());
this.endComboBox.setSelectedItem(comboCheckBox.getEndSymbol());
checkVisible(this.returnTypeComboBox.getSelectedIndex());
}
public void update(ComboCheckBox comboCheckBox) {
comboCheckBox.setDelimiter((String)this.delimiterComboBox.getSelectedItem());
comboCheckBox.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0);
comboCheckBox.setStartSymbol((String)this.startComboBox.getSelectedItem());
comboCheckBox.setEndSymbol((String)this.endComboBox.getSelectedItem());
}
public void populate(CheckBoxGroup checkBoxGroup) {
this.delimiterComboBox.setSelectedItem(checkBoxGroup.getDelimiter());
this.returnTypeComboBox.setSelectedIndex(checkBoxGroup.isReturnString() ? 1 : 0);
this.startComboBox.setSelectedItem(checkBoxGroup.getStartSymbol());
this.endComboBox.setSelectedItem(checkBoxGroup.getEndSymbol());
checkVisible(this.returnTypeComboBox.getSelectedIndex());
}
public void update(CheckBoxGroup checkBoxGroup) {
checkBoxGroup.setDelimiter((String)this.delimiterComboBox.getSelectedItem());
checkBoxGroup.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0);
checkBoxGroup.setStartSymbol((String)this.startComboBox.getSelectedItem());
checkBoxGroup.setEndSymbol((String)this.endComboBox.getSelectedItem());
}
package com.fr.design.widget.component;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.gui.icombobox.DictionaryConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.CheckBoxGroup;
import com.fr.form.ui.ComboCheckBox;
import com.fr.general.Inter;
public class CheckBoxDictPane extends JPanel {
private DictionaryComboBox delimiterComboBox;
private UIButtonGroup returnTypeComboBox;
private DictionaryComboBox startComboBox;
private DictionaryComboBox endComboBox;
private JPanel returnStringPane;
public CheckBoxDictPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
delimiterComboBox = new DictionaryComboBox(DictionaryConstants.delimiters, DictionaryConstants.delimiterDisplays);
delimiterComboBox.setEditable(true);
startComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays);
startComboBox.setEditable(true);
endComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays);
endComboBox.setEditable(true);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Form-Delimiter") + ":"), delimiterComboBox},
new Component[]{new UILabel(Inter.getLocText("ComboCheckBox-Start_Symbol") + ":"),startComboBox},
new Component[]{new UILabel(Inter.getLocText("ComboCheckBox-End_Symbol") + ":"),endComboBox}
};
returnStringPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
returnTypeComboBox = new UIButtonGroup(new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")});
returnTypeComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkVisible(returnTypeComboBox.getSelectedIndex());
}
});
JPanel headPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypeComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(headPane, BorderLayout.NORTH);
jPanel.add(returnStringPane, BorderLayout.CENTER);
this.add(jPanel);
}
public void checkVisible(int selectIndex){
returnStringPane.setVisible(selectIndex == 1);
}
public void populate(ComboCheckBox comboCheckBox) {
this.delimiterComboBox.setSelectedItem(comboCheckBox.getDelimiter());
this.returnTypeComboBox.setSelectedIndex(comboCheckBox.isReturnString() ? 1 : 0);
this.startComboBox.setSelectedItem(comboCheckBox.getStartSymbol());
this.endComboBox.setSelectedItem(comboCheckBox.getEndSymbol());
checkVisible(this.returnTypeComboBox.getSelectedIndex());
}
public void update(ComboCheckBox comboCheckBox) {
comboCheckBox.setDelimiter((String)this.delimiterComboBox.getSelectedItem());
comboCheckBox.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0);
comboCheckBox.setStartSymbol((String)this.startComboBox.getSelectedItem());
comboCheckBox.setEndSymbol((String)this.endComboBox.getSelectedItem());
}
public void populate(CheckBoxGroup checkBoxGroup) {
this.delimiterComboBox.setSelectedItem(checkBoxGroup.getDelimiter());
this.returnTypeComboBox.setSelectedIndex(checkBoxGroup.isReturnString() ? 1 : 0);
this.startComboBox.setSelectedItem(checkBoxGroup.getStartSymbol());
this.endComboBox.setSelectedItem(checkBoxGroup.getEndSymbol());
checkVisible(this.returnTypeComboBox.getSelectedIndex());
}
public void update(CheckBoxGroup checkBoxGroup) {
checkBoxGroup.setDelimiter((String)this.delimiterComboBox.getSelectedItem());
checkBoxGroup.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0);
checkBoxGroup.setStartSymbol((String)this.startComboBox.getSelectedItem());
checkBoxGroup.setEndSymbol((String)this.endComboBox.getSelectedItem());
}
}

18
designer_base/src/com/fr/design/widget/component/DateValuePane.java

@ -2,18 +2,20 @@ package com.fr.design.widget.component;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.editor.editor.*;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
/**
* Created by ibm on 2017/8/8.
*/
public class DateValuePane extends JPanel {
private UIHeadGroup widgetValueHead;
private UIButtonGroup widgetValueHead;
private Editor[] editor;
@ -31,9 +33,11 @@ public class DateValuePane extends JPanel {
customPane.add(editor[i], editor[i].getName());
tabTitles[i] = editor[i].getName();
}
widgetValueHead = new UIHeadGroup(tabTitles) {
widgetValueHead = new UIButtonGroup(tabTitles);
widgetValueHead.addChangeListener(new ChangeListener() {
@Override
public void tabChanged(int index) {
public void stateChanged(ChangeEvent e) {
int index = widgetValueHead.getSelectedIndex();
if (ComparatorUtils.equals(tabTitles[index], Inter.getLocText("None"))) {
customPane.setVisible(false);
} else {
@ -41,7 +45,7 @@ public class DateValuePane extends JPanel {
}
cardLayout.show(customPane, tabTitles[index]);
}
};
});
this.add(widgetValueHead, BorderLayout.NORTH);
this.add(customPane, BorderLayout.CENTER);
@ -56,6 +60,9 @@ public class DateValuePane extends JPanel {
}
public void populate(Object ob) {
if(ob == null){
setCardValue(0, ob);
}
for (int i = 0; i < editor.length; i++) {
if (editor[i].accept(ob)) {
setCardValue(i, ob);
@ -66,6 +73,7 @@ public class DateValuePane extends JPanel {
private void setCardValue(int i, Object object) {
widgetValueHead.setSelectedIndex(i);
widgetValueHead.populateBean();
editor[i].setValue(object);
// kunsnat: bug7861 所有的Editor值都要跟随改变, 因为populate的editor 从""
// 一定是最后的Editor哦.

303
designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java

@ -0,0 +1,303 @@
package com.fr.design.widget.component;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.ispinner.UISpinner;
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.NumberEditor;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.text.DefaultFormatter;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by kerry on 2017/9/10.
*/
public class NumberEditorValidatePane extends JPanel {
private UICheckBox allowDecimalsCheckBox;
private UICheckBox allowNegativeCheckBox;
private UICheckBox setMaxValueCheckBox;
private UICheckBox setMinValueCheckBox;
private UIBasicSpinner maxValueSpinner;
private SpinnerNumberModel maxValueModel;
private UIBasicSpinner minValueSpinner;
private SpinnerNumberModel minValueModel;
private UISpinner decimalLength;
private JPanel limitNumberPane;
private UITextField maxValueErrorTextField;
private UITextField minValueErrorTextField;
private JPanel maxValueFieldPane;
private JPanel minValueFieldPane;
private ActionListener allowDecimalsListener;
private ActionListener allowNegativeListener;
public ActionListener setMaxListener;
private ActionListener setMinListener;
private ChangeListener maxValueChangeListener;
private ChangeListener minValueChangeListener;
public NumberEditorValidatePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
initComponent();
}
private void initComponent() {
initListeners();
this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals"));
allowDecimalsCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.allowDecimalsCheckBox.addActionListener(allowDecimalsListener);
this.decimalLength = new UISpinner(0, Integer.MAX_VALUE, 1, 16);
this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative"));
this.allowNegativeCheckBox.addActionListener(allowNegativeListener);
allowNegativeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false);
setMaxValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
setNotAllowsInvalid(this.maxValueSpinner);
this.setMaxValueCheckBox.addActionListener(setMaxListener);
this.maxValueSpinner.addChangeListener(maxValueChangeListener);
this.setMinValueCheckBox = new UICheckBox(Inter.getLocText("Need_Min_Value"), false);
this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
setNotAllowsInvalid(this.minValueSpinner);
minValueSpinner.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.setMinValueCheckBox.addActionListener(setMinListener);
this.minValueSpinner.addChangeListener(minValueChangeListener);
setMinValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
initMaxMinValueFieldPane();
JPanel maxValueBorderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
maxValueBorderPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, 0, 0));
maxValueBorderPane.add(maxValueFieldPane, BorderLayout.CENTER);
JPanel minValueBorderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
minValueBorderPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, IntervalConstants.INTERVAL_L1, 0));
minValueBorderPane.add(minValueFieldPane, BorderLayout.CENTER);
UILabel numberLabel = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Double", "Numbers"}));
limitNumberPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{numberLabel, decimalLength}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
limitNumberPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, 0, 0));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{allowDecimalsCheckBox, null},
new Component[]{limitNumberPane, null},
new Component[]{allowNegativeCheckBox, null},
new Component[]{setMaxValueCheckBox, maxValueSpinner},
new Component[]{maxValueBorderPane, null},
new Component[]{setMinValueCheckBox, minValueSpinner},
new Component[]{minValueBorderPane, null},
};
double[] rowSize = {p, p, p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
this.add(panel);
}
private void initMaxMinValueFieldPane() {
maxValueErrorTextField = new UITextField();
minValueErrorTextField = new UITextField();
maxValueFieldPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip")), maxValueErrorTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
setMaxValueCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
maxValueFieldPane.setVisible(setMaxValueCheckBox.isSelected());
}
});
minValueFieldPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip")), minValueErrorTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
setMinValueCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
minValueFieldPane.setVisible(setMinValueCheckBox.isSelected());
}
});
}
private void initListeners() {
allowDecimalsListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (allowDecimalsCheckBox.isSelected()) {
limitNumberPane.setVisible(true);
limitNumberPane.setPreferredSize(new Dimension(215, 20));
} else {
limitNumberPane.setVisible(false);
limitNumberPane.setPreferredSize(new Dimension(0, 0));
}
}
};
allowNegativeListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (allowNegativeCheckBox.isSelected()) {
minValueModel.setMinimum(-Double.MAX_VALUE);
if (!setMinValueCheckBox.isSelected()) {
maxValueModel.setMinimum(-Double.MAX_VALUE);
}
} else {
minValueModel.setMinimum(0.0);
if (!setMinValueCheckBox.isSelected()) {
maxValueModel.setMinimum(0.0);
}
Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (minValue < 0.0) {
minValueSpinner.setValue(0.0);
}
if (maxValue < 0.0) {
maxValueSpinner.setValue(0.0);
}
}
}
};
setMaxListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (setMaxValueCheckBox.isSelected()) {
maxValueSpinner.setEnabled(true);
Double value = new Double(0);
if (setMinValueCheckBox.isSelected()) {
Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
if (minValue > value) {
value = minValue;
}
}
maxValueSpinner.setValue(value);
} else {
maxValueSpinner.setEnabled(false);
minValueModel.setMaximum(Double.MAX_VALUE);
}
}
};
setMinListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (setMinValueCheckBox.isSelected()) {
minValueSpinner.setEnabled(true);
Double value = new Double(0);
if (setMaxValueCheckBox.isSelected()) {
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (maxValue < value) {
value = maxValue;
}
}
minValueSpinner.setValue(value);
} else {
minValueSpinner.setEnabled(false);
maxValueModel.setMinimum(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : new Double(0));
}
}
};
maxValueChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (setMaxValueCheckBox.isSelected()) {
if (setMinValueCheckBox.isSelected()) {
minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue()));
}
}
}
};
minValueChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (setMinValueCheckBox.isSelected()) {
if (setMaxValueCheckBox.isSelected()) {
maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue()));
}
}
}
};
}
private void setNotAllowsInvalid(UIBasicSpinner jspinner) {
JComponent editor = jspinner.getEditor();
if (editor instanceof UIBasicSpinner.DefaultEditor) {
JFormattedTextField ftf = ((UIBasicSpinner.DefaultEditor) editor).getTextField();
ftf.setColumns(10);
JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
DefaultFormatter df = (DefaultFormatter) formatter;
df.setAllowsInvalid(false);
}
}
public void populate(NumberEditor e) {
allowDecimalsCheckBox.setSelected(e.isAllowDecimals());
if (e.isAllowDecimals()) {
this.decimalLength.setValue(e.getMaxDecimalLength());
} else {
this.limitNumberPane.setVisible(false);
}
allowNegativeCheckBox.setSelected(e.isAllowNegative());
if (e.getMaxValue() == Double.MAX_VALUE) {
setMaxValueCheckBox.setSelected(false);
maxValueFieldPane.setVisible(false);
maxValueSpinner.setValue(new Double(Double.MAX_VALUE));
maxValueSpinner.setEnabled(false);
} else {
setMaxValueCheckBox.setSelected(true);
maxValueSpinner.setEnabled(true);
maxValueFieldPane.setVisible(true);
maxValueSpinner.setValue(new Double(e.getMaxValue()));
}
if (e.getMinValue() == -Double.MAX_VALUE) {
setMinValueCheckBox.setSelected(false);
minValueFieldPane.setVisible(false);
minValueSpinner.setValue(new Double(-Double.MAX_VALUE));
minValueSpinner.setEnabled(false);
} else {
setMinValueCheckBox.setSelected(true);
minValueFieldPane.setVisible(true);
minValueSpinner.setEnabled(true);
minValueSpinner.setValue(new Double(e.getMinValue()));
}
}
public void update(NumberEditor ob) {
ob.setAllowDecimals(allowDecimalsCheckBox.isSelected());
if (allowDecimalsCheckBox.isSelected()) {
ob.setMaxDecimalLength((int) this.decimalLength.getValue());
}
ob.setAllowNegative(allowNegativeCheckBox.isSelected());
if (setMaxValueCheckBox.isSelected()) {
ob.setMaxValue(Double.parseDouble("" + maxValueSpinner.getValue()));
} else {
ob.setMaxValue(Double.MAX_VALUE);
}
if (setMinValueCheckBox.isSelected()) {
ob.setMinValue(Double.parseDouble("" + minValueSpinner.getValue()));
} else {
ob.setMinValue(-Double.MAX_VALUE);
}
}
}

92
designer_form/src/com/fr/design/designer/creator/CRPropertyDescriptorPane.java

@ -0,0 +1,92 @@
package com.fr.design.designer.creator;
import com.fr.base.FRContext;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.xtable.TableUtils;
import com.fr.design.mainframe.widget.editors.ExtendedPropertyEditor;
import com.fr.design.mainframe.widget.editors.StringEditor;
import com.fr.form.ui.Widget;
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyEditor;
import java.lang.reflect.Method;
/**
* Created by kerry on 2017/9/6.
*/
public class CRPropertyDescriptorPane {
private CRPropertyDescriptor crPropertyDescriptor;
private XCreator xCreator;
private PropertyEditor propertyEditor;
public CRPropertyDescriptorPane(CRPropertyDescriptor crPropertyDescriptor, XCreator xCreator) {
this.crPropertyDescriptor = crPropertyDescriptor;
this.xCreator = xCreator;
}
public Component[] createTableLayoutComponent() {
return new Component[]{new UILabel(crPropertyDescriptor.getDisplayName()), initEditorComponent(crPropertyDescriptor, xCreator)};
}
private Component initEditorComponent(CRPropertyDescriptor crPropertyDescriptor, final XCreator xCreator) {
Component component = null;
try {
// 如果已有的编辑器就生成对应的component
Class<?> editorClass = crPropertyDescriptor.getPropertyEditorClass();
if (editorClass != null) {
propertyEditor = initExtendEditor(crPropertyDescriptor, xCreator);
component = propertyEditor.getCustomEditor();
} else {
Class propType = crPropertyDescriptor.getPropertyType();
Class<? extends PropertyEditor> defaultEditorClass = TableUtils.getPropertyEditorClass(propType);
if (defaultEditorClass == null) {
defaultEditorClass = StringEditor.class;
}
propertyEditor = defaultEditorClass.newInstance();
component = propertyEditor.getCustomEditor();
}
propertyEditor.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
update(xCreator.toData());
}
});
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
return component;
}
private PropertyEditor initExtendEditor(CRPropertyDescriptor crPropertyDescriptor, XCreator xCreator) throws Exception {
ExtendedPropertyEditor editor = (ExtendedPropertyEditor) crPropertyDescriptor.createPropertyEditor(xCreator.toData());
if (editor == null) {
Class propType = crPropertyDescriptor.getPropertyType();
editor = TableUtils.getPropertyEditorClass(propType).newInstance();
}
return editor;
}
public void populate(Widget widget) {
try {
Method m = crPropertyDescriptor.getReadMethod();
Object value = m.invoke(widget);
propertyEditor.setValue(value);
} catch (Exception e) {
}
}
public void update(Widget widget) {
try {
Method m = crPropertyDescriptor.getWriteMethod();
m.invoke(widget, propertyEditor.getValue());
} catch (Exception e) {
}
}
}

70
designer_form/src/com/fr/design/designer/creator/PropertyGroupPane.java

@ -0,0 +1,70 @@
package com.fr.design.designer.creator;
import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.FreeButton;
import com.fr.form.ui.Widget;
import javax.swing.*;
import java.awt.*;
/**
* Created by kerry on 2017/9/7.
*/
public class PropertyGroupPane extends BasicPane {
private CRPropertyDescriptor[] crPropertyDescriptors;
private CRPropertyDescriptorPane[] crPropertyDescriptorPanes;
private XCreator xCreator;
public PropertyGroupPane(CRPropertyDescriptor[] crPropertyDescriptors, XCreator xCreator) {
this.crPropertyDescriptors = crPropertyDescriptors;
this.xCreator = xCreator;
this.setLayout(FRGUIPaneFactory.createBorderLayout());
initComponent();
}
public void initComponent() {
int count = crPropertyDescriptors.length;
crPropertyDescriptorPanes = new CRPropertyDescriptorPane[count];
Component[][] components = new Component[count][];
for (int i = 0; i < count; i++) {
crPropertyDescriptorPanes[i] = new CRPropertyDescriptorPane(crPropertyDescriptors[i], xCreator);
components[i] = crPropertyDescriptorPanes[i].createTableLayoutComponent();
}
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, 20, 10);
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
this.add(panel, BorderLayout.CENTER);
}
public void populate(Widget widget){
for(int i = 0; i< crPropertyDescriptorPanes.length; i++){
crPropertyDescriptorPanes[i].populate(widget);
}
}
@Override
protected String title4PopupWindow() {
return "PropertyGroupPane";
}
public static void main(String[] args) {
try{
XCreator xCreator = new XButton(new FreeButton(),new Dimension(100, 100));
PropertyGroupPane propertyGroupPane = new PropertyGroupPane(xCreator.supportedDescriptor(), xCreator);
JFrame jf = new JFrame("jFrame");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(propertyGroupPane, BorderLayout.CENTER);
jf.setSize(439, 400);
jf.setVisible(true);
}catch (Exception e){
FRContext.getLogger().error(e.getMessage());
}
}
}

2
designer_form/src/com/fr/design/designer/creator/XDateEditor.java

@ -119,7 +119,7 @@ public class XDateEditor extends XDirectWriteEditor {
if (editor == null) {
editor = FRGUIPaneFactory.createBorderLayout_S_Pane();
editor.add(textField = new UITextField(5), BorderLayout.CENTER);
btn = new LimpidButton("", this.getIconPath(), toData().isVisible() ? FULL_OPACITY : HALF_OPACITY);
btn = new LimpidButton(StringUtils.EMPTY, this.getIconPath(), toData().isVisible() ? FULL_OPACITY : HALF_OPACITY);
btn.setPreferredSize(new Dimension(21, 21));
editor.add(btn, BorderLayout.EAST);
textField.setOpaque(false);

18
designer_form/src/com/fr/design/designer/creator/XElementCase.java

@ -104,10 +104,15 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
.setI18NName(Inter.getLocText("Form-EC_toolbar"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
};
propertyTableEditor = resolveCompatible(propertyTableEditor);
CRPropertyDescriptor[] extraTableEditor = getExtraTableEditor();
return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraTableEditor);
}
public CRPropertyDescriptor[] getExtraTableEditor(){
CRPropertyDescriptor[] extraTableEditor = resolveCompatible();
FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(FormElementCaseEditorProcessor.MARK_STRING);
if (processor == null) {
return propertyTableEditor;
return extraTableEditor;
}
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
FitProvider wbTpl = (FitProvider) designer.getTarget();
@ -122,11 +127,12 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
if (editor.getReportFitAttr() == null) {
editor.setReportFitInPc(processor.getFitStateInPC(fitAttr));
}
return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor);
return (CRPropertyDescriptor[]) ArrayUtils.addAll(extraTableEditor, extraEditor);
}
private CRPropertyDescriptor[] resolveCompatible (CRPropertyDescriptor[] propertyTableEditor) {
private CRPropertyDescriptor[] resolveCompatible() {
CRPropertyDescriptor[] extraProperty = new CRPropertyDescriptor[0];
//这边有个插件兼容问题,之后还是要改回process才行
Set<FormElementCaseEditorProvider> set = ExtraDesignClassManager.getInstance().getArray(AbstractFormElementCaseEditorProvider.MARK_STRING);
for (FormElementCaseEditorProvider provider : set) {
@ -137,9 +143,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
FormProvider formProvider = designer.getTarget();
ElementCaseEditorProvider elementCaseEditorProvider = this.toData();
PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), formProvider, elementCaseEditorProvider);
propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor);
extraProperty = (CRPropertyDescriptor[]) ArrayUtils.addAll(extraProperty, extraEditor);
}
return propertyTableEditor;
return extraProperty;
}
@Override

18
designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -536,4 +536,22 @@ public class XWTabFitLayout extends XWFitLayout {
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[0];
}
public void firePropertyChange(){
checkButonType();
initialBackground = ((WTabFitLayout) data).getInitialBackground();
overBackground = ((WTabFitLayout) data).getOverBackground();
clickBackground = ((WTabFitLayout)data).getClickBackground();
CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData();
if(initialBackground != null){
xCardSwitchButton.setSelectBackground(initialBackground);
cardSwitchButton.setInitialBackground(initialBackground);
}
if(overBackground != null){
cardSwitchButton.setOverBackground(overBackground);
}
if(clickBackground != null){
cardSwitchButton.setClickBackground(clickBackground);
}
}
}

2
designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -137,6 +137,8 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
jPanel.add(attriCardPane, BorderLayout.CENTER);
this.listener = new AttributeChangeListener() {

7
designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java

@ -2,6 +2,7 @@ package com.fr.design.parameter;
import com.fr.base.BaseUtils;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.file.HistoryTemplateListPane;
@ -65,7 +66,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Form-Desin_Width")), designerWidth},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 10);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
jPanel.add(panel);
@ -97,8 +98,8 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
new Component[]{useParamsTemplate, null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WidgetDisplyPosition")), hAlignmentPane}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 10);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0));
jPanel.add(panel);
return jPanel;
}

6
designer_form/src/com/fr/design/widget/ui/designer/ButtonDefinePane.java

@ -44,12 +44,12 @@ public abstract class ButtonDefinePane<T extends Button> extends AbstractDataMod
UILabel backgroundLabel = new UILabel(Inter.getLocText("FR-Designer_Background"));
backgroundLabel.setVerticalAlignment(SwingConstants.TOP);
Component[][] n_components = {
{new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField},
{new UILabel(Inter.getLocText("FR-Designer_Button-Name")), buttonNameTextField},
{new UILabel(Inter.getLocText("FR-Designer_Label_Name")), labelNameTextField},
backgroundCompPane,
frFont,
{new UILabel(Inter.getLocText("FR-Designer_Icon") + ":"), iconPane},
{new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField}
{new UILabel(Inter.getLocText("FR-Designer_Icon")), iconPane},
{new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys")), hotkeysTextField}
};
hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ","));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, 10, 10);

93
designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDictPane.java

@ -1,93 +0,0 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.gui.icombobox.DictionaryConstants;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.CheckBoxGroup;
import com.fr.form.ui.ComboCheckBox;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class CheckBoxDictPane extends JPanel {
private DictionaryComboBox delimiterComboBox;
private UIComboBox returnTypeComboBox;
private DictionaryComboBox startComboBox;
private DictionaryComboBox endComboBox;
private JPanel delimiterPane;
private JPanel startPane;
private JPanel endPane;
public CheckBoxDictPane() {
JPanel returnTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST);
returnTypeComboBox = new UIComboBox(new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")});
returnTypePane.add(returnTypeComboBox, BorderLayout.CENTER);
this.add(returnTypePane);
delimiterPane =FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel label = new UILabel(Inter.getLocText("Form-Delimiter") + ":");
delimiterPane.add(label, BorderLayout.WEST);
delimiterPane.add(delimiterComboBox = new DictionaryComboBox(DictionaryConstants.delimiters, DictionaryConstants.delimiterDisplays), BorderLayout.CENTER);
delimiterComboBox.setEditable(true);
this.add(delimiterPane);
startPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
startPane.add(new UILabel(Inter.getLocText("ComboCheckBox-Start_Symbol") + ":"), BorderLayout.WEST);
startPane.add(startComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER);
startComboBox.setEditable(true);
this.add(startPane);
endPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
endPane.add(new UILabel(Inter.getLocText("ComboCheckBox-End_Symbol") + ":"), BorderLayout.WEST);
endPane.add(endComboBox = new DictionaryComboBox(DictionaryConstants.symbols, DictionaryConstants.symbolDisplays), BorderLayout.CENTER);
endComboBox.setEditable(true);
this.add(endPane);
returnTypeComboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
checkVisible();
}
});
}
private void checkVisible(){
delimiterPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1);
startPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1);
endPane.setVisible(returnTypeComboBox.getSelectedIndex() == 1);
}
public void populate(ComboCheckBox comboCheckBox) {
this.delimiterComboBox.setSelectedItem(comboCheckBox.getDelimiter());
this.returnTypeComboBox.setSelectedIndex(comboCheckBox.isReturnString() ? 1 : 0);
this.startComboBox.setSelectedItem(comboCheckBox.getStartSymbol());
this.endComboBox.setSelectedItem(comboCheckBox.getEndSymbol());
checkVisible();
}
public void update(ComboCheckBox comboCheckBox) {
comboCheckBox.setDelimiter((String)this.delimiterComboBox.getSelectedItem());
comboCheckBox.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0);
comboCheckBox.setStartSymbol((String)this.startComboBox.getSelectedItem());
comboCheckBox.setEndSymbol((String)this.endComboBox.getSelectedItem());
}
public void populate(CheckBoxGroup checkBoxGroup) {
this.delimiterComboBox.setSelectedItem(checkBoxGroup.getDelimiter());
this.returnTypeComboBox.setSelectedIndex(checkBoxGroup.isReturnString() ? 1 : 0);
this.startComboBox.setSelectedItem(checkBoxGroup.getStartSymbol());
this.endComboBox.setSelectedItem(checkBoxGroup.getEndSymbol());
checkVisible();
}
public void update(CheckBoxGroup checkBoxGroup) {
checkBoxGroup.setDelimiter((String)this.delimiterComboBox.getSelectedItem());
checkBoxGroup.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0);
checkBoxGroup.setStartSymbol((String)this.startComboBox.getSelectedItem());
checkBoxGroup.setEndSymbol((String)this.endComboBox.getSelectedItem());
}
}

18
designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java

@ -5,10 +5,8 @@ import com.fr.base.Formula;
import com.fr.data.core.FormatField;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -22,6 +20,8 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.UtilEvalError;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -34,10 +34,9 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
private DateValuePane endDv;
private WaterMarkDictPane waterMarkDictPane;
private FormWidgetValuePane formWidgetValuePane;
private UISpinner fontSizePane;
private UIComboBox currentFormatComboBox;
private UILabel currentSamplelabel;
private UIHeadGroup fomatHeadGroup;
private UIButtonGroup fomatHeadGroup;
public DateEditorDefinePane(XCreator xCreator) {
super(xCreator);
@ -53,7 +52,6 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
protected JPanel setFirstContentPane() {
waterMarkDictPane = new WaterMarkDictPane();
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false);
fontSizePane = new UISpinner(0, 20, 1, 0);
JPanel returnTypePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST);
returnTypeComboBox = new UIButtonGroup<>(new String[] {Inter.getLocText("Date") , Inter.getLocText("String")});
@ -125,8 +123,11 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
customPane.add(dateFormatPane, Inter.getLocText("StyleFormat-Date"));
customPane.add(timeFormatPane, Inter.getLocText("StyleFormat-Time"));
final String[] tabTitles = new String[]{Inter.getLocText("StyleFormat-Date"), Inter.getLocText("StyleFormat-Time")};
fomatHeadGroup = new UIHeadGroup(new String[]{Inter.getLocText("StyleFormat-Date"), Inter.getLocText("StyleFormat-Time")}){
protected void tabChanged(int newSelectedIndex) {
fomatHeadGroup = new UIButtonGroup(new String[]{Inter.getLocText("StyleFormat-Date"), Inter.getLocText("StyleFormat-Time")});
fomatHeadGroup.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int newSelectedIndex = fomatHeadGroup.getSelectedIndex();
cardLayout.show(customPane, tabTitles[newSelectedIndex]);
if(newSelectedIndex == 0){
currentFormatComboBox = dateFormatComboBox;
@ -137,7 +138,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
}
refreshPreviewLabel();
}
};
});
fomatHeadPane.add(fomatHeadGroup, BorderLayout.NORTH);
fomatHeadPane.add(customPane, BorderLayout.CENTER);
return fomatHeadPane;
@ -172,6 +173,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
protected void populateSubDirectWriteEditorBean(DateEditor e) {
String formatText = e.getFormatText();
fomatHeadGroup.setSelectedIndex(getDateType(e));
fomatHeadGroup.populateBean();
currentFormatComboBox.setSelectedItem(formatText);
waterMarkDictPane.populate(e);
returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 0 : 1);

32
designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java

@ -1,5 +1,7 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.*;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
@ -105,37 +107,25 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
protected void addValidatePane() {
initErrorMsgPane();
validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
final UILabel uiLabel = new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip"));
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
final JPanel errorTipPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{uiLabel, errorMsgTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
errorTipPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, 0, 0));
borderPane.add(errorTipPane, BorderLayout.CENTER);
allowBlankCheckBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
boolean isSelected = allowBlankCheckBox.isSelected();
uiLabel.setVisible(!isSelected);
errorMsgTextField.setVisible(!isSelected);
if (isSelected) {
uiLabel.setPreferredSize(new Dimension(0, 0));
errorMsgTextField.setPreferredSize(new Dimension(0, 0));
} else {
uiLabel.setPreferredSize(new Dimension(66, 20));
errorMsgTextField.setPreferredSize(new Dimension(150, 20));
}
errorTipPane.setVisible(!isSelected);
}
});
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{allowBlankCheckBox, null},
new Component[]{uiLabel, errorMsgTextField},
new Component[]{allowBlankCheckBox},
new Component[]{borderPane},
};
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 5, 5);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L6);
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0));
validatePane.add(panel, BorderLayout.NORTH);
JPanel contentPane = this.setValidatePane();
if (contentPane != null) {

30
designer_form/src/com/fr/design/widget/ui/designer/FreeButtonDefinePane.java

@ -3,6 +3,7 @@ package com.fr.design.widget.ui.designer;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.FRFontPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.component.ButtonBackgroundPane;
import com.fr.form.ui.FreeButton;
import com.fr.general.FRFont;
@ -17,6 +18,7 @@ import java.awt.*;
public class FreeButtonDefinePane extends ButtonDefinePane<FreeButton> {
private ButtonBackgroundPane backgroundCompPane;
private FRFontPane frFontPane;
private UILabel fontLabel;
public FreeButtonDefinePane(XCreator xcreator) {
super(xcreator);
@ -24,29 +26,41 @@ public class FreeButtonDefinePane extends ButtonDefinePane<FreeButton> {
public Component[] createBackgroundComp() {
backgroundCompPane = new ButtonBackgroundPane();
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background") + ":"), backgroundCompPane};
return new Component[]{backgroundCompPane,null};
}
public Component[] createFontPane() {
UILabel fontLabel = new UILabel(Inter.getLocText("FR-Designer_Font"));
JPanel fontLabelPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
fontLabel = new UILabel(Inter.getLocText("FR-Designer_Font"));
fontLabelPanel.add(fontLabel, BorderLayout.CENTER);
fontLabel.setVerticalAlignment(SwingConstants.TOP);
frFontPane = new FRFontPane();
return new Component[]{fontLabel, frFontPane};
JPanel fontPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
fontPanel.add(frFontPane, BorderLayout.CENTER);
return new Component[]{fontLabelPanel, fontPanel};
}
public void populateSubButtonPane(FreeButton e) {
backgroundCompPane.populate(e);
FRFont frFont = e.getFont();
if (frFont != null) {
frFontPane.populateBean(e.getFont());
frFontPane.setVisible(e.isCustomStyle());
fontLabel.setVisible(e.isCustomStyle());
if(e.isCustomStyle()){
FRFont frFont = e.getFont();
if (frFont != null) {
frFontPane.populateBean(e.getFont());
}
}
}
public FreeButton updateSubButtonPane() {
FreeButton freeButton = (FreeButton) creator.toData();
backgroundCompPane.update(freeButton);
FRFont frFont = freeButton.getFont() == null ? FRFont.getInstance() : freeButton.getFont();
freeButton.setFont(frFontPane.update(frFont));
frFontPane.setVisible(freeButton.isCustomStyle());
fontLabel.setVisible(freeButton.isCustomStyle());
if(freeButton.isCustomStyle()){
FRFont frFont = freeButton.getFont() == null ? FRFont.getInstance() : freeButton.getFont();
freeButton.setFont(frFontPane.update(frFont));
}
return freeButton;
}
}

252
designer_form/src/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java

@ -1,58 +1,30 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.component.NumberEditorValidatePane;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.NumberEditor;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.text.DefaultFormatter;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> {
public NumberEditorDefinePane(XCreator xCreator){
super(xCreator);
}
private FormWidgetValuePane formWidgetValuePane;
/**
*
*/
private static final long serialVersionUID = 8011242951911686805L;
private UICheckBox allowDecimalsCheckBox;
private UICheckBox allowNegativeCheckBox;
private UICheckBox setMaxValueCheckBox;
private UICheckBox setMinValueCheckBox;
private UIBasicSpinner maxValueSpinner;
private SpinnerNumberModel maxValueModel;
private UIBasicSpinner minValueSpinner;
private SpinnerNumberModel minValueModel;
private UISpinner decimalLength;
private JPanel limitNumberPane;
private WaterMarkDictPane waterMarkDictPane;
private ActionListener allowDecimalsListener;
private ActionListener allowNegativeListener ;
public ActionListener setMaxListener;
private ActionListener setMinListener;
private ChangeListener maxValueChangeListener;
private ChangeListener minValueChangeListener;
private FormWidgetValuePane formWidgetValuePane;
private NumberEditorValidatePane numberEditorValidatePane;
@ -84,237 +56,27 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
return boundsPane;
}
private void initListeners(){
allowDecimalsListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (allowDecimalsCheckBox.isSelected()) {
limitNumberPane.setVisible(true);
limitNumberPane.setPreferredSize(new Dimension(215,20));
} else {
limitNumberPane.setVisible(false);
limitNumberPane.setPreferredSize(new Dimension(0,0));
}
}
};
allowNegativeListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (allowNegativeCheckBox.isSelected()) {
minValueModel.setMinimum(-Double.MAX_VALUE);
if (!setMinValueCheckBox.isSelected()) {
maxValueModel.setMinimum(-Double.MAX_VALUE);
}
} else {
minValueModel.setMinimum(0.0);
if (!setMinValueCheckBox.isSelected()) {
maxValueModel.setMinimum(0.0);
}
Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (minValue < 0.0) {
minValueSpinner.setValue(0.0);
}
if (maxValue < 0.0) {
maxValueSpinner.setValue(0.0);
}
}
}
};
setMaxListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (setMaxValueCheckBox.isSelected()) {
maxValueSpinner.setEnabled(true);
Double value = new Double(0);
if (setMinValueCheckBox.isSelected()) {
Double minValue = Double.parseDouble("" + minValueSpinner.getValue());
if (minValue > value) {
value = minValue;
}
}
maxValueSpinner.setValue(value);
} else {
maxValueSpinner.setEnabled(false);
minValueModel.setMaximum(Double.MAX_VALUE);
}
}
};
setMinListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (setMinValueCheckBox.isSelected()) {
minValueSpinner.setEnabled(true);
Double value = new Double(0);
if (setMaxValueCheckBox.isSelected()) {
Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue());
if (maxValue < value) {
value = maxValue;
}
}
minValueSpinner.setValue(value);
} else {
minValueSpinner.setEnabled(false);
maxValueModel.setMinimum(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : new Double(0));
}
}
};
maxValueChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (setMaxValueCheckBox.isSelected()) {
if (setMinValueCheckBox.isSelected()) {
minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue()));
}
}
}
};
minValueChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (setMinValueCheckBox.isSelected()) {
if (setMaxValueCheckBox.isSelected()) {
maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue()));
}
}
}
};
}
public JPanel setValidatePane() {
initListeners();
this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals"));
this.decimalLength = new UISpinner(0, Integer.MAX_VALUE, 1, 16);
allowDecimalsCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.allowDecimalsCheckBox.addActionListener(allowDecimalsListener);
this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative"));
this.allowNegativeCheckBox.addActionListener(allowNegativeListener);
allowNegativeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false);
setMaxValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
setNotAllowsInvalid(this.maxValueSpinner);
this.setMaxValueCheckBox.addActionListener(setMaxListener);
this.maxValueSpinner.addChangeListener(maxValueChangeListener);
this.setMinValueCheckBox = new UICheckBox(Inter.getLocText("Need_Min_Value"), false);
this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
setNotAllowsInvalid(this.minValueSpinner);
minValueSpinner.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.setMinValueCheckBox.addActionListener(setMinListener);
this.minValueSpinner.addChangeListener(minValueChangeListener);
setMinValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
UILabel numberLabel = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Double", "Numbers"}));
limitNumberPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{numberLabel, decimalLength}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{allowDecimalsCheckBox, null },
new Component[]{limitNumberPane, null},
new Component[]{allowNegativeCheckBox, null},
new Component[]{setMaxValueCheckBox, maxValueSpinner},
new Component[]{setMinValueCheckBox, minValueSpinner},
};
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, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
return panel;
numberEditorValidatePane = new NumberEditorValidatePane();
return numberEditorValidatePane;
}
@Override
protected void populateSubFieldEditorBean(NumberEditor e) {
allowDecimalsCheckBox.setSelected(e.isAllowDecimals());
if (e.isAllowDecimals()) {
this.decimalLength.setValue(e.getMaxDecimalLength());
} else {
this.limitNumberPane.setVisible(false);
}
allowNegativeCheckBox.setSelected(e.isAllowNegative());
if (e.getMaxValue() == Double.MAX_VALUE) {
setMaxValueCheckBox.setSelected(false);
maxValueSpinner.setValue(new Double(Double.MAX_VALUE));
maxValueSpinner.setEnabled(false);
} else {
setMaxValueCheckBox.setSelected(true);
maxValueSpinner.setEnabled(true);
maxValueSpinner.setValue(new Double(e.getMaxValue()));
}
if (e.getMinValue() == -Double.MAX_VALUE) {
setMinValueCheckBox.setSelected(false);
minValueSpinner.setValue(new Double(-Double.MAX_VALUE));
minValueSpinner.setEnabled(false);
} else {
setMinValueCheckBox.setSelected(true);
minValueSpinner.setEnabled(true);
minValueSpinner.setValue(new Double(e.getMinValue()));
}
formWidgetValuePane.populate(e);
this.waterMarkDictPane.populate(e);
numberEditorValidatePane.populate(e);
}
@Override
protected NumberEditor updateSubFieldEditorBean() {
NumberEditor ob = (NumberEditor)creator.toData();
formWidgetValuePane.update(ob);
ob.setAllowDecimals(allowDecimalsCheckBox.isSelected());
if (allowDecimalsCheckBox.isSelected()) {
ob.setMaxDecimalLength((int)this.decimalLength.getValue());
}
ob.setAllowNegative(allowNegativeCheckBox.isSelected());
if (setMaxValueCheckBox.isSelected()) {
ob.setMaxValue(Double.parseDouble("" + maxValueSpinner.getValue()));
} else {
ob.setMaxValue(Double.MAX_VALUE);
}
if (setMinValueCheckBox.isSelected()) {
ob.setMinValue(Double.parseDouble("" + minValueSpinner.getValue()));
} else {
ob.setMinValue(-Double.MAX_VALUE);
}
this.waterMarkDictPane.update(ob);
numberEditorValidatePane.update(ob);
return ob;
}
private void setNotAllowsInvalid(UIBasicSpinner jspinner) {
JComponent editor = jspinner.getEditor();
if (editor instanceof UIBasicSpinner.DefaultEditor) {
JFormattedTextField ftf = ((UIBasicSpinner.DefaultEditor) editor).getTextField();
ftf.setColumns(10);
JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
DefaultFormatter df = (DefaultFormatter) formatter;
df.setAllowsInvalid(false);
}
}
public Object getValue(UIBasicSpinner jspinner){
JComponent editor = jspinner.getEditor();
if (editor instanceof UIBasicSpinner.DefaultEditor) {

3
designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java

@ -1,5 +1,6 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
@ -43,7 +44,7 @@ public class PaddingBoundPane extends BasicPane {
new Component[]{null, left, right},
new Component[]{null, new UILabel(Inter.getLocText("FR-Designer_Left"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Right"), SwingConstants.CENTER)},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 7);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
this.add(panel);

6
designer_form/src/com/fr/design/widget/ui/designer/component/TabFitLayoutBackgroundPane.java

@ -1,8 +1,10 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.widget.component.BackgroundCompPane;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Background;
import com.fr.general.Inter;
/**
* Created by ibm on 2017/8/8.
@ -44,6 +46,10 @@ public class TabFitLayoutBackgroundPane extends BackgroundCompPane<WTabFitLayout
switchCard();
}
protected UILabel createUILable(){
return new UILabel(Inter.getLocText("FR-Designer_Style"));
}
protected String title4PopupWindow() {
return "tabFitBackground";
}

35
designer_form/src/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java

@ -1,9 +1,8 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.designer.creator.*;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleElementCaseToolBarEditor;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
@ -20,39 +19,41 @@ import java.awt.*;
public class ElementEditorDefinePane extends WTitleLayoutDefinePane<ElementCaseEditor> {
private PaddingBoundPane paddingBoundPane;
private AccessibleElementCaseToolBarEditor elementCaseToolBarEditor;
private PropertyGroupPane extraPropertyGroupPane;
public ElementEditorDefinePane(XCreator xCreator){
public ElementEditorDefinePane(XCreator xCreator) {
super(xCreator);
}
protected JPanel createCenterPane(){
protected JPanel createCenterPane() {
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
paddingBoundPane = new PaddingBoundPane();
elementCaseToolBarEditor = new AccessibleElementCaseToolBarEditor();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{paddingBoundPane, null},
new Component[]{new UILabel("报表块工具栏"), elementCaseToolBarEditor}
new Component[]{new UILabel(Inter.getLocText("Form-EC_toolbar")), elementCaseToolBarEditor},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 10);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, 20, 10);
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
return panel;
CRPropertyDescriptor[] extraTableEditor = ((XElementCase)creator).getExtraTableEditor();
extraPropertyGroupPane = new PropertyGroupPane(extraTableEditor, creator);
centerPane.add(panel, BorderLayout.NORTH);
centerPane.add(extraPropertyGroupPane, BorderLayout.CENTER);
return centerPane;
}
protected ElementCaseEditor updateSubBean(){
ElementCaseEditor elementCaseEditor = (ElementCaseEditor)creator.toData();
protected ElementCaseEditor updateSubBean() {
ElementCaseEditor elementCaseEditor = (ElementCaseEditor) creator.toData();
paddingBoundPane.update(elementCaseEditor);
elementCaseEditor.setToolBars((FormToolBarManager[])elementCaseToolBarEditor.getValue());
elementCaseEditor.setToolBars((FormToolBarManager[]) elementCaseToolBarEditor.getValue());
return elementCaseEditor;
}
protected void populateSubBean(ElementCaseEditor ob){
protected void populateSubBean(ElementCaseEditor ob) {
paddingBoundPane.populate(ob);
elementCaseToolBarEditor.setValue(ob.getToolBars());
extraPropertyGroupPane.populate(ob);
}
}

46
designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

@ -1,16 +1,22 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.properties.items.FRLayoutTypeItems;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor;
import com.fr.design.widget.ui.designer.component.WidgetBoundPane;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBodyLayoutType;
@ -26,33 +32,38 @@ import java.util.Comparator;
* Created by ibm on 2017/8/2.
*/
public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
private XWAbsoluteBodyLayout xwAbsoluteBodyLayout;
private WAbsoluteBodyLayout wAbsoluteBodyLayout;
private AccessibleWLayoutBorderStyleEditor borderStyleEditor;
private UIComboBox layoutCombox;
private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE;
private static final int EACH_ROW_COUNT = 4;
public FRAbsoluteBodyLayoutDefinePane(XCreator xCreator) {
super(xCreator);
this.xwAbsoluteBodyLayout = (XWAbsoluteBodyLayout) xCreator;
wAbsoluteBodyLayout = xwAbsoluteBodyLayout.toData();
}
public void initComponent() {
super.initComponent();
borderStyleEditor = new AccessibleWLayoutBorderStyleEditor();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Style")), borderStyleEditor}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
borderPane.add(jPanel, BorderLayout.CENTER);
UIExpandablePane advancedPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, borderPane );
this.add(advancedPane, BorderLayout.NORTH);
}
public JPanel createThirdPane() {
initLayoutComboBox();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Attr_Layout_Type")), layoutCombox},
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Scaling_Mode")), comboBox},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 10);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
return panel;
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Attr_Layout_Type")), layoutCombox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, 7);
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Scaling_Mode")), comboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, 7);
jPanel.add(northPane, BorderLayout.NORTH);
jPanel.add(centerPane, BorderLayout.CENTER);
northPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0));
centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 0, 0));
return jPanel;
}
@ -72,8 +83,8 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
}
public void populateSubPane(WAbsoluteLayout ob) {
// WAbsoluteBodyLayout layout = (WAbsoluteBodyLayout) ob;
layoutCombox.setSelectedIndex(1);
borderStyleEditor.setValue(ob.getBorderStyle());
}
public WAbsoluteBodyLayout updateSubPane() {
@ -90,6 +101,7 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
switch2FitBodyLayout();
}
}
layout.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue());
return layout;
}

23
designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteLayoutDefinePane.java

@ -24,32 +24,27 @@ import java.awt.*;
* Created by ibm on 2017/8/2.
*/
public class FRAbsoluteLayoutDefinePane extends AbstractDataModify<WAbsoluteLayout> {
private XWAbsoluteLayout xwAbsoluteLayout;
private WAbsoluteLayout wAbsoluteLayout;
protected UIComboBox comboBox;
private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE;
private WidgetBoundPane boundPane;
public FRAbsoluteLayoutDefinePane(XCreator xCreator) {
super(xCreator);
this.xwAbsoluteLayout = (XWAbsoluteLayout) xCreator;
wAbsoluteLayout = xwAbsoluteLayout.toData();
initComponent();
}
public void initComponent() {
boundPane = new WidgetBoundPane(creator);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(boundPane, BorderLayout.NORTH);
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
boundPane = new WidgetBoundPane(creator);
centerPane.add(boundPane, BorderLayout.NORTH);
initUIComboBox();
JPanel thirdPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
thirdPane.add(createThirdPane(), BorderLayout.CENTER);
thirdPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
UIExpandablePane layoutExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer-Widget_Area_Scaling"), 280, 20,thirdPane );
this.add(layoutExpandablePane, BorderLayout.CENTER);
// JPanel thirdPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
// thirdPane.add(, BorderLayout.CENTER);
// thirdPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
UIExpandablePane layoutExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer-Widget_Area_Scaling"), 280, 20,createThirdPane() );
centerPane.add(layoutExpandablePane, BorderLayout.CENTER);
this.add(centerPane, BorderLayout.CENTER);
}
public JPanel createThirdPane() {

17
designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

@ -1,6 +1,7 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWFitLayout;
@ -80,18 +81,20 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
componentIntervel = new UISpinner(0, 100, 1, 0);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
int[][] rowCount = {{1, 1}, {1, 1}};
JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Attr_Layout_Type")), layoutComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, 7);
northPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0));
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Attr_Layout_Type")), layoutComboBox},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Component_Scale")), adaptComboBox},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Component_Interval")), componentIntervel}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 10);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
jPanel.add(panel, BorderLayout.CENTER);
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, 7);
centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 0, 0));
jPanel.add(northPane, BorderLayout.NORTH);
jPanel.add(centerPane, BorderLayout.CENTER);
return jPanel;
}

9
designer_form/src/com/fr/design/widget/ui/designer/layout/WCardLayoutDefinePane.java

@ -33,18 +33,17 @@ public class WCardLayoutDefinePane extends AbstractDataModify<WCardLayout> {
}
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
carouselInterval = new UISpinner(0, 20, 1, 0);
accessibleCardTagWLayoutBorderStyleEditor = new AccessibleCardTagWLayoutBorderStyleEditor();
accessibleCardTagWLayoutBorderStyleEditor.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
JPanel accessibleCardlayout = FRGUIPaneFactory.createBorderLayout_S_Pane();
accessibleCardlayout.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
accessibleCardlayout.add(accessibleCardTagWLayoutBorderStyleEditor, BorderLayout.CENTER);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel stylePane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Style")), accessibleCardTagWLayoutBorderStyleEditor}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
stylePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
accessibleCardlayout.add(stylePane, BorderLayout.CENTER);
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, accessibleCardlayout);
final JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
setCarousel = new UICheckBox(Inter.getLocText("FR-Designer_setCarousel"));
IntervalPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_carouselInterval")), carouselInterval}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
IntervalPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel.add(setCarousel, BorderLayout.NORTH);

21
designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java

@ -1,9 +1,11 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.AbstractDataModify;
@ -22,6 +24,7 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
private PaddingBoundPane paddingBoundPane;
private TabFitLayoutBackgroundPane borderStyle;
private UISpinner componentInterval;
private UITextField titleField;
public WTabFitLayoutDefinePane(XCreator xCreator) {
super(xCreator);
@ -32,7 +35,8 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
paddingBoundPane = new PaddingBoundPane();
borderStyle = new TabFitLayoutBackgroundPane();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style")), borderStyle}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{borderStyle, null}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
jPanel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0));
advancePane.add(jPanel, BorderLayout.NORTH);
advancePane.add(paddingBoundPane, BorderLayout.CENTER);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -43,8 +47,17 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
public void initLayoutComponent(){
componentInterval = new UISpinner(0, 100, 1, 0);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Component_Interval")), componentInterval}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
this.add(jPanel, BorderLayout.CENTER);
titleField = new UITextField();
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Component_Interval")), componentInterval},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Title")), titleField}
};
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
jPanel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0));
borderPane.add(jPanel, BorderLayout.CENTER);
UIExpandablePane currentEditTab = new UIExpandablePane(Inter.getLocText("FR-Designer_Current_tab"), 280, 20, borderPane);
this.add(currentEditTab, BorderLayout.CENTER);
}
@Override
@ -57,6 +70,7 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
borderStyle.populate(ob);
paddingBoundPane.populate(ob);
componentInterval.setValue(ob.getCompInterval());
titleField.setText(ob.getCurrentCard().getText());
}
@ -66,6 +80,7 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
borderStyle.update(layout);
paddingBoundPane.update(layout);
layout.setCompInterval((int)componentInterval.getValue());
layout.getCurrentCard().setText(titleField.getText());
return layout;
}
}

Loading…
Cancel
Save