Browse Source

REPORT-3293 9.0设计器控件设置重画

master
kerry 8 years ago
parent
commit
2979836e55
  1. 3
      designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java
  2. 1
      designer/src/com/fr/design/widget/WidgetPane.java
  3. 1
      designer/src/com/fr/design/widget/ui/ButtonDefinePane.java
  4. 12
      designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java
  5. 213
      designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java
  6. 7
      designer/src/com/fr/design/widget/ui/btn/AppendRowButtonDefinePane.java
  7. 9
      designer/src/com/fr/design/widget/ui/btn/DefineAppendColumnRowPane.java
  8. 25
      designer/src/com/fr/design/widget/ui/btn/DefineDeleteColumnRowPane.java
  9. 7
      designer/src/com/fr/design/widget/ui/btn/DeleteRowButtonDefinePane.java
  10. 20
      designer/src/com/fr/design/widget/ui/btn/FreeButtonDetailPane.java
  11. 0
      designer_base/src/com/fr/design/designer/properties/Decoder.java
  12. 18
      designer_base/src/com/fr/design/designer/properties/Encoder.java
  13. 16
      designer_base/src/com/fr/design/gui/frpane/RegPane.java
  14. 13
      designer_base/src/com/fr/design/gui/itextfield/UITextField.java
  15. 3
      designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java
  16. 8
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleBackgroundEditor.java
  17. 80
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleDictionaryEditor.java
  18. 80
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleEditor.java
  19. 8
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleIconEditor.java
  20. 388
      designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java
  21. 98
      designer_base/src/com/fr/design/mainframe/widget/accessibles/RendererField.java
  22. 44
      designer_base/src/com/fr/design/mainframe/widget/accessibles/UneditableAccessibleEditor.java
  23. 0
      designer_base/src/com/fr/design/mainframe/widget/editors/ITextComponent.java
  24. 0
      designer_base/src/com/fr/design/mainframe/widget/editors/TextField.java
  25. 186
      designer_base/src/com/fr/design/mainframe/widget/renderer/GenericCellRenderer.java
  26. 13
      designer_base/src/com/fr/design/mainframe/widget/renderer/IconCellRenderer.java
  27. 0
      designer_base/src/com/fr/design/mainframe/widget/wrappers/BackgroundWrapper.java
  28. 0
      designer_base/src/com/fr/design/mainframe/widget/wrappers/DictionaryWrapper.java
  29. 0
      designer_base/src/com/fr/design/mainframe/widget/wrappers/IconWrapper.java
  30. 3
      designer_base/src/com/fr/design/widget/DataModify.java
  31. 19
      designer_base/src/com/fr/design/widget/WidgetBoundsPaneFactory.java
  32. 2
      designer_base/src/com/fr/design/widget/btn/ButtonDetailPane.java
  33. 40
      designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java
  34. 28
      designer_base/src/com/fr/design/widget/component/BackgroundCompPane.java
  35. 48
      designer_base/src/com/fr/design/widget/component/ButtonBackgroundPane.java
  36. 81
      designer_base/src/com/fr/design/widget/component/DateValuePane.java
  37. 5
      designer_base/src/com/fr/design/widget/component/MouseActionBackground.java
  38. 1
      designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java
  39. 16
      designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java
  40. 10
      designer_form/src/com/fr/design/widget/ui/designer/ButtonDefinePane.java
  41. 16
      designer_form/src/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java
  42. 6
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java
  43. 3
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java
  44. 2
      designer_form/src/com/fr/design/widget/ui/designer/ComboBoxDefinePane.java
  45. 3
      designer_form/src/com/fr/design/widget/ui/designer/ComboCheckBoxDefinePane.java
  46. 3
      designer_form/src/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java
  47. 197
      designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java
  48. 5
      designer_form/src/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java
  49. 12
      designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  50. 15
      designer_form/src/com/fr/design/widget/ui/designer/FreeButtonDefinePane.java
  51. 6
      designer_form/src/com/fr/design/widget/ui/designer/LabelDefinePane.java
  52. 7
      designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java
  53. 20
      designer_form/src/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java
  54. 13
      designer_form/src/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java
  55. 2
      designer_form/src/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java
  56. 64
      designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonDetailPaneFactory.java
  57. 2
      designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java
  58. 143
      designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonSytleDefinedPane.java
  59. 30
      designer_form/src/com/fr/design/widget/ui/designer/btn/DefaultButtonDetailPane.java
  60. 56
      designer_form/src/com/fr/design/widget/ui/designer/btn/DefaultButtonStylePane.java
  61. 40
      designer_form/src/com/fr/design/widget/ui/designer/btn/FreeButtonDetailPane.java
  62. 2
      designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java
  63. 50
      designer_form/src/com/fr/design/widget/ui/designer/component/TabFitLayoutBackgroundPane.java
  64. 4
      designer_form/src/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java
  65. 4
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  66. 8
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteLayoutDefinePane.java
  67. 11
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  68. 15
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java
  69. 2
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java

3
designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java

@ -69,9 +69,6 @@ public class CellWidgetPropertyPane extends BasicPane {
Widget cellWidget = cellElement.getWidget();
if(cellWidget == null){
return;
}
// 这里进行克隆的原因是为了保留原始的Widget以便和新的Widget做比较来判断是否发生了改变
if (cellWidget != null) {

1
designer/src/com/fr/design/widget/WidgetPane.java

@ -120,6 +120,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
public void populate(Widget widget) {
if (widget == null) {
editorTypeComboBox.setSelectedIndex(-1);
return;
}

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

@ -20,7 +20,6 @@ public class ButtonDefinePane extends AbstractDataModify<Button> {
private void initComponent() {
setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8));
}
@Override

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

@ -6,15 +6,17 @@ import java.awt.FlowLayout;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import com.fr.data.Dictionary;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor;
import com.fr.design.present.dict.DictionaryPane;
import com.fr.form.ui.CheckBoxGroup;
import com.fr.general.Inter;
public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup> {
private DictionaryPane dictPane;
private AccessibleDictionaryEditor dictPane;
CheckBoxDictPane checkBoxDictPane;
@ -29,7 +31,7 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup
protected void initComponents() {
super.initComponents();
dictPane = new DictionaryPane();
dictPane = new AccessibleDictionaryEditor();
}
@Override
@ -64,7 +66,7 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup
@Override
protected void populateSubFieldEditorBean(CheckBoxGroup ob) {
this.dictPane.populateBean(ob.getDictionary());
this.dictPane.setValue(ob.getDictionary());
checkBoxDictPane.populate(ob);
checkbox.setSelected(ob.isChooseAll());
this.buttonGroupDictPane.populate(ob);
@ -74,7 +76,7 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup
protected CheckBoxGroup updateSubFieldEditorBean() {
CheckBoxGroup ob = new CheckBoxGroup();
ob.setDictionary(this.dictPane.updateBean());
ob.setDictionary((Dictionary) this.dictPane.getValue());
checkBoxDictPane.update(ob);
ob.setChooseAll(checkbox.isSelected());
this.buttonGroupDictPane.update(ob);
@ -83,6 +85,6 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup
@Override
public DataCreatorUI dataUI() {
return dictPane;
return null;
}
}

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

@ -3,21 +3,19 @@ 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.constants.LayoutConstants;
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.layout.FRGUIPaneFactory;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.widget.component.DateValuePane;
import com.fr.form.ui.DateEditor;
import com.fr.general.DateUtils;
import com.fr.general.Inter;
import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.UtilEvalError;
import javax.swing.*;
@ -28,19 +26,18 @@ import java.text.SimpleDateFormat;
import java.util.Date;
public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> {
private UIComboBox returnTypeComboBox;
private UILabel sampleLabel;// preview
// content
private UIComboBox dateFormatComboBox;
private ValueEditorPane startDv;
private ValueEditorPane endDv;
private UIHeadGroup returnTypeComboBox;
private DateValuePane startDv;
private DateValuePane endDv;
private UIComboBox currentFormatComboBox;
private UILabel currentSamplelabel;
private UIHeadGroup fomatHeadGroup;
public DateEditorDefinePane() {
this.initComponets();
}
private void initComponets() {
super.initComponents();
public DateEditorDefinePane() {
}
@Override
@ -50,71 +47,98 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
@Override
protected JPanel setSecondContentPane() {
JPanel returnTypePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST);
returnTypeComboBox = new UIComboBox(new String[] { Inter.getLocText("String"), Inter.getLocText("Date") });
returnTypeComboBox.setPreferredSize(new Dimension(70, 20));
// sample pane
sampleLabel = new UILabel("");
sampleLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 4));
sampleLabel.setHorizontalAlignment(SwingConstants.CENTER);
sampleLabel.setFont(FRContext.getDefaultValues().getFRFont());
// content pane
String[] arr = getDateFormateArray();
dateFormatComboBox = new UIComboBox(arr);
dateFormatComboBox.setPreferredSize(new Dimension(150,20));
dateFormatComboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
refreshPreviewLabel();
}
});
JPanel secondPanel = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"),dateFormatComboBox,sampleLabel}, FlowLayout.LEFT, 5);
secondPanel.setPreferredSize(new Dimension(220,30));
returnTypeComboBox = new UIHeadGroup(new String[] {Inter.getLocText("Date") , Inter.getLocText("String")}){
protected void tabChanged(int newSelectedIndex) {
//todo
}
};
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null);
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null);
JPanel formatHead = createFormatHead();
startDv = new DateValuePane();
endDv = new DateValuePane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypeComboBox },
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"), dateFormatComboBox},
new Component[]{null, sampleLabel},
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"), formatHead},
new Component[]{new UILabel(Inter.getLocText("FS_Start_Date") + ":"), startDv},
new Component[]{new UILabel(Inter.getLocText("FS_End_Date") + ":"), endDv},
new Component[]{waterMarkDictPane, null},
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypeComboBox }
};
double[] rowSize = {p, p,p,p,p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 1);
double[] rowSize = {p, p, p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return panel;
}
private String[] getDateFormateArray() {
return FormatField.getInstance().getDateFormatArray();
private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){
JPanel previewPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Base_StyleFormat_Sample"));
previewPane.add(sampleLabel);
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(previewPane, BorderLayout.NORTH);
jPanel.add(formatComboBox, BorderLayout.CENTER);
return jPanel;
}
protected JPanel initStartEndDatePane() {
JPanel rangePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
rangePane.add(new UILabel(Inter.getLocText("FS_Start_Date") + ":"));
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null);
rangePane.add(startDv);
rangePane.add(new UILabel(Inter.getLocText("FS_End_Date") + ":"));
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null);
rangePane.add(endDv);
return rangePane;
private UILabel createSamplePane(){
UILabel sampleLabel = new UILabel("");
sampleLabel.setHorizontalAlignment(SwingConstants.CENTER);
sampleLabel.setFont(FRContext.getDefaultValues().getFRFont());
return sampleLabel;
}
private JPanel createFormatHead(){
String[] dateArray = FormatField.getInstance().getFormatArray(FormatField.FormatContents.DATE);
String[] timeArray = FormatField.getInstance().getFormatArray(FormatField.FormatContents.TIME);
final UIComboBox dateFormatComboBox = new UIComboBox(dateArray);
final UIComboBox timeFormatComboBox = new UIComboBox(timeArray);
dateFormatComboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
refreshPreviewLabel();
}
});
timeFormatComboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
refreshPreviewLabel();
}
});
final UILabel dateSampleLabel = createSamplePane();
final UILabel timeSampleLabel = createSamplePane();
JPanel fomatHeadPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
final CardLayout cardLayout = new CardLayout();
final JPanel customPane = new JPanel(cardLayout);
JPanel dateFormatPane = createFormatPane(dateFormatComboBox, dateSampleLabel);
JPanel timeFormatPane = createFormatPane(timeFormatComboBox, timeSampleLabel);
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) {
cardLayout.show(customPane, tabTitles[newSelectedIndex]);
if(newSelectedIndex == 0){
currentFormatComboBox = dateFormatComboBox;
currentSamplelabel = dateSampleLabel;
}else{
currentFormatComboBox = timeFormatComboBox;
currentSamplelabel = timeSampleLabel;
}
refreshPreviewLabel();
CellWidgetPropertyPane.getInstance().update();
}
};
fomatHeadPane.add(fomatHeadGroup, BorderLayout.NORTH);
fomatHeadPane.add(customPane, BorderLayout.CENTER);
return fomatHeadPane;
}
private void refreshPreviewLabel() {
String text = (String) dateFormatComboBox.getSelectedItem();
String text = (String) currentFormatComboBox.getSelectedItem();
if (text != null && text.length() > 0) {
try {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(text);
@ -124,66 +148,57 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
sample += " " + Inter.getLocText("DateFormat-Custom_Warning");
c = Color.red;
}
this.sampleLabel.setText(sample);
this.sampleLabel.setForeground(c);
currentSamplelabel.setText(sample);
currentSamplelabel.setForeground(c);
} catch (Exception exp) {
this.sampleLabel.setForeground(Color.red);
this.sampleLabel.setText(exp.getMessage());
currentSamplelabel.setForeground(Color.red);
currentSamplelabel.setText(exp.getMessage());
}
} else {
this.sampleLabel.setText(new Date().toString());
currentSamplelabel.setText(new Date().toString());
}
}
private int getDateType(DateEditor e){
String[] timeArray = FormatField.getInstance().getFormatArray(FormatField.FormatContents.TIME);
if(e == null){
return 0;
}
String formatText = e.getFormatText();
if(ArrayUtils.contains(timeArray, formatText)){
return 1;
}
return 0;
}
@Override
protected void populateSubDirectWriteEditorBean(DateEditor e) {
String formatText = e.getFormatText();
dateFormatComboBox.setSelectedItem(formatText);
fomatHeadGroup.setSelectedIndex(getDateType(e));
currentFormatComboBox.setSelectedItem(formatText);
returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 1 : 0);
populateStartEnd(e);
returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 0 : 1);
startDv.populate(e.getStartDate());
endDv.populate(e.getEndDate());
}
@Override
protected DateEditor updateSubDirectWriteEditorBean() {
DateEditor ob = new DateEditor();
ob.setFormatText(this.getSimpleDateFormat().toPattern());
ob.setReturnDate(returnTypeComboBox.getSelectedIndex() == 1);
updateStartEnd(ob);
ob.setReturnDate(returnTypeComboBox.getSelectedIndex() == 0);
ob.setStartDate(startDv.update());
ob.setEndDate(endDv.update());
return ob;
}
/**
* 初始起止日期
* @param dateWidgetEditor 日期控件
*/
public void populateStartEnd(DateEditor dateWidgetEditor) {
Formula startFM = dateWidgetEditor.getStartDateFM();
Formula endFM = dateWidgetEditor.getEndDateFM();
if (startFM != null) {
startDv.populate(startFM);
} else {
String startStr = dateWidgetEditor.getStartText();
startDv.populate(StringUtils.isEmpty(startStr) ? null : DateUtils.string2Date(startStr, true));
}
if (endFM != null) {
endDv.populate(endFM);
} else {
String endStr = dateWidgetEditor.getEndText();
endDv.populate(StringUtils.isEmpty(endStr) ? null : DateUtils.string2Date(endStr, true));
}
}
/**
* 更新日期控件的起止日期
* @param dateWidgetEditor 日期控件
*/
public void updateStartEnd(DateEditor dateWidgetEditor) {
Object startObject = startDv.update();
Object startObject = "";
Object endObject = endDv.update();
// wei : 对公式的处理
Calculator cal = null;
@ -226,12 +241,12 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
}
private SimpleDateFormat getSimpleDateFormat() {
String text = (String) dateFormatComboBox.getSelectedItem();
String text = (String) currentFormatComboBox.getSelectedItem();
SimpleDateFormat simpleDateFormat;
if (text != null && text.length() > 0) {
try {
simpleDateFormat = new SimpleDateFormat(text);
this.sampleLabel.setText(simpleDateFormat.format(new Date()));
this.currentSamplelabel.setText(simpleDateFormat.format(new Date()));
} catch (Exception exp) {
simpleDateFormat = new SimpleDateFormat("");
}

7
designer/src/com/fr/design/widget/ui/btn/AppendRowButtonDefinePane.java

@ -38,11 +38,10 @@ public class AppendRowButtonDefinePane<T extends AppendRowButton> extends Button
}
@Override
public void populate(com.fr.form.ui.Button btn) {
public void populate(AppendRowButton btn) {
super.populate(btn);
if (btn instanceof AppendRowButton) {
defineColumnRowPane.populate((AppendRowButton) btn);
}
defineColumnRowPane.populate(btn);
}
@Override

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

@ -6,6 +6,7 @@ import javax.swing.BorderFactory;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
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;
@ -20,7 +21,7 @@ import com.fr.report.web.button.write.AppendRowButton;
*/
public class DefineAppendColumnRowPane extends BasicPane {
private ColumnRowEditor crEditor;
private com.fr.design.editor.editor.IntegerEditor jNumberEditor;
private UISpinner jNumberEditor;
private UILabel rowCountLable;
public DefineAppendColumnRowPane() {
@ -35,7 +36,7 @@ public class DefineAppendColumnRowPane extends BasicPane {
double columnSize[] = { p, f};
crEditor = new ColumnRowEditor();
jNumberEditor = new com.fr.design.editor.editor.IntegerEditor();
jNumberEditor = new UISpinner(0, 100 , 1, 0);
rowCountLable = new UILabel(Inter.getLocText("Edit-Row_Count") + ":");
JPanel lpane = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -56,11 +57,11 @@ public class DefineAppendColumnRowPane extends BasicPane {
public void populate(AppendRowButton btn) {
crEditor.setValue(btn.getFixCell());
jNumberEditor.setValue(new Integer(btn.getCount()));
jNumberEditor.setValue(btn.getCount());
}
public void update(AppendRowButton btn) {
btn.setFixCell(crEditor.getValue());
btn.setCount(jNumberEditor.getValue().intValue());
btn.setCount((int)jNumberEditor.getValue());
}
}

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

@ -1,14 +1,19 @@
package com.fr.design.widget.ui.btn;
import javax.swing.BorderFactory;
import javax.swing.*;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.ColumnRowEditor;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.report.web.button.write.DeleteRowButton;
import java.awt.*;
/**
* Created by IntelliJ IDEA. Author : Richer Version: 6.5.6 Date : 11-11-16 Time
* : 上午10:56
@ -23,12 +28,20 @@ public class DefineDeleteColumnRowPane extends BasicPane {
}
private void initComponents() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double rowSize[] = { p, p};
double columnSize[] = { p, f};
crEditor = new ColumnRowEditor();
setLayout(FRGUIPaneFactory.createL_FlowLayout());
setBorder(BorderFactory.createEmptyBorder(0, BORDER_LEFT, 0, 0));
add(new UILabel(Inter.getLocText(new String[]{"Specify", "Cell"}) + ":"));
add(crEditor);
add(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}};
JPanel contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
setLayout(FRGUIPaneFactory.createBorderLayout());
add(contentPane);
}
@Override

7
designer/src/com/fr/design/widget/ui/btn/DeleteRowButtonDefinePane.java

@ -36,11 +36,10 @@ public class DeleteRowButtonDefinePane<T extends DeleteRowButton> extends Button
}
@Override
public void populate(com.fr.form.ui.Button btn) {
public void populate(DeleteRowButton btn) {
super.populate(btn);
if (btn instanceof DeleteRowButton) {
ddcp.populate((DeleteRowButton) btn);
}
ddcp.populate(btn);
}
@Override

20
designer/src/com/fr/design/widget/ui/btn/FreeButtonDetailPane.java

@ -2,16 +2,20 @@ package com.fr.design.widget.ui.btn;
import java.awt.Component;
import com.fr.form.ui.Button;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.component.ButtonBackgroundPane;
import com.fr.form.ui.FreeButton;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
import com.fr.general.Inter;
public class FreeButtonDetailPane extends ButtonWithHotkeysDetailPane<FreeButton> {
private ButtonSytleDefinedPane stylePane;
private ButtonBackgroundPane backgroundCompPane;
@Override
protected Component createCenterPane() {
return stylePane = new ButtonSytleDefinedPane();
backgroundCompPane = new ButtonBackgroundPane();
return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background") + ":"), backgroundCompPane}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
}
@Override
@ -19,18 +23,16 @@ public class FreeButtonDetailPane extends ButtonWithHotkeysDetailPane<FreeButton
return new FreeButton();
}
@Override
public void populate(Button button) {
public void populate(FreeButton button) {
super.populate(button);
if(button instanceof FreeButton) {
stylePane.populate((FreeButton) button);
}
backgroundCompPane.populate(button);
}
@Override
public FreeButton update() {
FreeButton button = super.update();
return stylePane.update(button);
backgroundCompPane.update(button);
return button;
}
@Override

0
designer_form/src/com/fr/design/designer/properties/Decoder.java → designer_base/src/com/fr/design/designer/properties/Decoder.java

18
designer_form/src/com/fr/design/designer/properties/Encoder.java → designer_base/src/com/fr/design/designer/properties/Encoder.java

@ -1,10 +1,10 @@
package com.fr.design.designer.properties;
/**
* 将控件属性 转化成字符串
* @since 6.5.2
*/
public interface Encoder<T> {
String encode(T v);
package com.fr.design.designer.properties;
/**
* 将控件属性 转化成字符串
* @since 6.5.2
*/
public interface Encoder<T> {
String encode(T v);
}

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

@ -73,17 +73,13 @@ public class RegPane extends BasicPane {
private void initComponents(){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel contentPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
this.add(contentPane, BorderLayout.NORTH);
contentPane.add(new UILabel(Inter.getLocText("FR-Designer_Input_Rule")));
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
regComboBox = new UIComboBox(regType);
regComboBox.setPreferredSize(new Dimension(140, 20));
regComboBox.setRenderer(listCellRender);
UILabel uiLabel = new UILabel();
uiLabel.setPreferredSize(new Dimension(20, 20));
contentPane.add(uiLabel);
contentPane.add(regComboBox);
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Input_Rule")), regComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
this.add(contentPane, BorderLayout.NORTH);
regErrorMsgPane = new RegErrorMsgPane();
final JPanel cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
detailedCardLayout = new CardLayout();
@ -489,7 +485,7 @@ public class RegPane extends BasicPane {
public RegErrorMsgPane(){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(5,0,0,0));
this.setBorder(BorderFactory.createEmptyBorder(5, 0, 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);
this.add(panel);

13
designer_base/src/com/fr/design/gui/itextfield/UITextField.java

@ -13,6 +13,8 @@ import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.Document;
import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
/**
* @author Jerry
@ -59,19 +61,14 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
protected void initListener() {
if (shouldResponseChangeListener()) {
getDocument().addDocumentListener(new DocumentListener() {
addFocusListener(new FocusListener() {
@Override
public void insertUpdate(DocumentEvent e) {
public void focusGained(FocusEvent e) {
attributeChange();
}
@Override
public void removeUpdate(DocumentEvent e) {
attributeChange();
}
@Override
public void changedUpdate(DocumentEvent e) {
public void focusLost(FocusEvent e) {
attributeChange();
}
});

3
designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java

@ -23,6 +23,7 @@ public class BasicPropertyPane extends BasicPane {
protected void initContentPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
widgetName = new UITextField();
double f = TableLayout.FILL;
@ -34,7 +35,7 @@ public class BasicPropertyPane extends BasicPane {
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Name")), widgetName},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15));
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
this.add(panel, BorderLayout.NORTH);
}

8
designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleBackgroundEditor.java → designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleBackgroundEditor.java

@ -3,9 +3,9 @@
*/
package com.fr.design.mainframe.widget.accessibles;
import java.awt.Dimension;
import java.awt.*;
import javax.swing.SwingUtilities;
import javax.swing.*;
import com.fr.general.Background;
import com.fr.design.mainframe.widget.wrappers.BackgroundWrapper;
@ -25,6 +25,10 @@ public class AccessibleBackgroundEditor extends UneditableAccessibleEditor {
super(new BackgroundWrapper());
}
protected void setBorderVisible(){
this.setBorder(BorderFactory.createLineBorder(Color.lightGray));
}
@Override
protected void showEditorPane() {
if (backgroundPane == null) {

80
designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleDictionaryEditor.java → designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleDictionaryEditor.java

@ -1,38 +1,44 @@
package com.fr.design.mainframe.widget.accessibles;
import javax.swing.SwingUtilities;
import com.fr.data.Dictionary;
import com.fr.design.mainframe.widget.wrappers.DictionaryWrapper;
import com.fr.design.present.dict.DictionaryPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
public class AccessibleDictionaryEditor extends UneditableAccessibleEditor {
private DictionaryPane dictPane;
public AccessibleDictionaryEditor() {
super(new DictionaryWrapper());
}
@Override
protected void showEditorPane() {
if (dictPane == null) {
dictPane = new DictionaryPane();
}
BasicDialog dlg = dictPane.showWindow(SwingUtilities.getWindowAncestor(this));
dlg.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
Dictionary dict = dictPane.updateBean();
setValue(dict);
fireStateChanged();
}
});
dictPane.populateBean((Dictionary) getValue());
dlg.setVisible(true);
}
package com.fr.design.mainframe.widget.accessibles;
import javax.swing.*;
import com.fr.data.Dictionary;
import com.fr.design.mainframe.widget.wrappers.DictionaryWrapper;
import com.fr.design.present.dict.DictionaryPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import java.awt.*;
public class AccessibleDictionaryEditor extends UneditableAccessibleEditor {
private DictionaryPane dictPane;
public AccessibleDictionaryEditor() {
super(new DictionaryWrapper());
}
protected void setBorderVisible(){
this.setBorder(BorderFactory.createLineBorder(Color.lightGray));
}
@Override
protected void showEditorPane() {
if (dictPane == null) {
dictPane = new DictionaryPane();
}
BasicDialog dlg = dictPane.showWindow(SwingUtilities.getWindowAncestor(this));
dlg.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
Dictionary dict = dictPane.updateBean();
setValue(dict);
fireStateChanged();
}
});
dictPane.populateBean((Dictionary) getValue());
dlg.setVisible(true);
}
}

80
designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleEditor.java → designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleEditor.java

@ -1,41 +1,41 @@
package com.fr.design.mainframe.widget.accessibles;
import java.awt.Component;
import javax.swing.event.ChangeListener;
import com.fr.design.Exception.ValidationException;
/**
* 属性编辑器
* @since 6.5.2
*/
public interface AccessibleEditor {
/**
* 判断输入的值是否符合要求
* @throws ValidationException
*/
public void validateValue() throws ValidationException;
/**
* 获取编辑器里面的值
*/
public Object getValue();
/**
* 给编辑器设置值
* @param v
*/
public void setValue(Object v);
/**
* 自定义编辑器
* @return
*/
public Component getEditor();
public void addChangeListener(ChangeListener l);
public void removeChangeListener(ChangeListener l);
package com.fr.design.mainframe.widget.accessibles;
import java.awt.Component;
import javax.swing.event.ChangeListener;
import com.fr.design.Exception.ValidationException;
/**
* 属性编辑器
* @since 6.5.2
*/
public interface AccessibleEditor {
/**
* 判断输入的值是否符合要求
* @throws ValidationException
*/
public void validateValue() throws ValidationException;
/**
* 获取编辑器里面的值
*/
public Object getValue();
/**
* 给编辑器设置值
* @param v
*/
public void setValue(Object v);
/**
* 自定义编辑器
* @return
*/
public Component getEditor();
public void addChangeListener(ChangeListener l);
public void removeChangeListener(ChangeListener l);
}

8
designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleIconEditor.java → designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleIconEditor.java

@ -11,6 +11,9 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.form.ui.WidgetManager;
import javax.swing.*;
import java.awt.*;
public class AccessibleIconEditor extends UneditableAccessibleEditor {
private CustomIconPane customIconPane;
@ -24,6 +27,11 @@ public class AccessibleIconEditor extends UneditableAccessibleEditor {
return new RendererField(new IconCellRenderer());
}
protected void setBorderVisible(){
this.setBorder(BorderFactory.createLineBorder(Color.lightGray));
}
@Override
protected void showEditorPane() {
if (customIconPane == null) {

388
designer_form/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java → designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java

@ -1,193 +1,197 @@
package com.fr.design.mainframe.widget.accessibles;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.BorderFactory;
import com.fr.design.gui.ibutton.UIButton;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.BaseUtils;
import com.fr.design.Exception.ValidationException;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.editors.ITextComponent;
import com.fr.design.mainframe.widget.editors.TextField;
import com.fr.design.dialog.BasicPane;
import com.fr.design.designer.properties.Decoder;
import com.fr.design.designer.properties.Encoder;
/**
* @since 6.5.3
*/
public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor {
private ArrayList<ChangeListener> listeners;
private boolean showButton;
protected Encoder encoder;
private Decoder decoder;
private UIButton btPopup;
protected ITextComponent txtValue;
public BaseAccessibleEditor(Encoder enc, Decoder dec, boolean showBtn) {
listeners = new ArrayList<ChangeListener>();
this.showButton = showBtn;
this.encoder = enc;
this.decoder = dec;
initComponents();
txtValue.setEditable(dec != null);
((JComponent) txtValue).setBorder(null);
}
@Override
public void requestFocus() {
super.requestFocus();
if (decoder != null) {
((JComponent) txtValue).requestFocus();
} else if (showButton) {
btPopup.requestFocus();
}
}
protected ITextComponent createTextField() {
return new TextField();
}
private void initComponents() {
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1));
txtValue = createTextField();
setLayout(FRGUIPaneFactory.createBorderLayout());
txtValue.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
txtValueActionPerformed(evt);
}
});
add((JComponent) txtValue, BorderLayout.CENTER);
setOpaque(false);
if (showButton) {
btPopup = new UIButton();
initPopupButton();
btPopup.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
showEditorPane();
}
});
add(btPopup, BorderLayout.EAST);
}
}
@Override
protected String title4PopupWindow() {
return "Base";
}
// 显示编辑器细节
protected void showEditorPane() {
}
protected void initPopupButton() {
if (!isComboButton()) {
btPopup.setText("...");
btPopup.setPreferredSize(new Dimension(20, 20));
} else {
btPopup.setRolloverEnabled(true);
btPopup.setFocusPainted(false);
btPopup.setPreferredSize(new Dimension(15, 19));
btPopup.setBorderPainted(false);
btPopup.setContentAreaFilled(false);
btPopup.setMargin(new Insets(0, 0, 0, 0));
btPopup.setIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_up.png"));
btPopup.setPressedIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_down.png"));
btPopup.setRolloverIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_over.png"));
}
}
// 有的编辑器是使用下拉框来直接选择的,这时候就把按钮显示成下拉框
protected boolean isComboButton() {
return false;
}
private void txtValueActionPerformed(ActionEvent evt) {
try {
validateValue();
fireStateChanged();
} catch (ValidationException e) {
showMessage(e.getMessage(), this);
txtValue.selectAll();
((JComponent) txtValue).requestFocus();
}
}
@Override
public Component getEditor() {
return this;
}
@Override
public Object getValue() {
return decoder.decode(txtValue.getText());
}
@Override
public void setValue(Object v) {
if(encoder != null) {
txtValue.setText(encoder.encode(v));
}
txtValue.setValue(v);
}
@Override
public void addChangeListener(ChangeListener l) {
if (!listeners.contains(l)) {
listeners.add(l);
}
}
@Override
public void removeChangeListener(ChangeListener l) {
if (listeners.contains(l)) {
listeners.remove(l);
}
}
protected void fireStateChanged() {
ChangeEvent e = new ChangeEvent(this);
for (ChangeListener l : listeners) {
l.stateChanged(e);
}
}
public Encoder getEncoder() {
return encoder;
}
public void setEncoder(Encoder encoder) {
this.encoder = encoder;
}
@Override
public void validateValue() throws ValidationException {
if (decoder != null) {
decoder.validate(txtValue.getText());
}
}
public static void showMessage(String message, Component editorComponent) {
JOptionPane.showMessageDialog(editorComponent, message, "Validation Error", JOptionPane.ERROR_MESSAGE);
}
package com.fr.design.mainframe.widget.accessibles;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.BorderFactory;
import com.fr.design.gui.ibutton.UIButton;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.BaseUtils;
import com.fr.design.Exception.ValidationException;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.editors.ITextComponent;
import com.fr.design.mainframe.widget.editors.TextField;
import com.fr.design.dialog.BasicPane;
import com.fr.design.designer.properties.Decoder;
import com.fr.design.designer.properties.Encoder;
/**
* @since 6.5.3
*/
public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor {
private ArrayList<ChangeListener> listeners;
private boolean showButton;
protected Encoder encoder;
private Decoder decoder;
private UIButton btPopup;
protected ITextComponent txtValue;
public BaseAccessibleEditor(Encoder enc, Decoder dec, boolean showBtn) {
listeners = new ArrayList<ChangeListener>();
this.showButton = showBtn;
this.encoder = enc;
this.decoder = dec;
initComponents();
txtValue.setEditable(dec != null);
setBorderVisible();
}
protected void setBorderVisible(){
((JComponent) txtValue).setBorder(null);
}
@Override
public void requestFocus() {
super.requestFocus();
if (decoder != null) {
((JComponent) txtValue).requestFocus();
} else if (showButton) {
btPopup.requestFocus();
}
}
protected ITextComponent createTextField() {
return new TextField();
}
private void initComponents() {
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1));
txtValue = createTextField();
setLayout(FRGUIPaneFactory.createBorderLayout());
txtValue.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
txtValueActionPerformed(evt);
}
});
add((JComponent) txtValue, BorderLayout.CENTER);
setOpaque(false);
if (showButton) {
btPopup = new UIButton();
initPopupButton();
btPopup.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
showEditorPane();
}
});
add(btPopup, BorderLayout.EAST);
}
}
@Override
protected String title4PopupWindow() {
return "Base";
}
// 显示编辑器细节
protected void showEditorPane() {
}
protected void initPopupButton() {
if (!isComboButton()) {
btPopup.setText("...");
btPopup.setPreferredSize(new Dimension(20, 20));
} else {
btPopup.setRolloverEnabled(true);
btPopup.setFocusPainted(false);
btPopup.setPreferredSize(new Dimension(15, 19));
btPopup.setBorderPainted(false);
btPopup.setContentAreaFilled(false);
btPopup.setMargin(new Insets(0, 0, 0, 0));
btPopup.setIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_up.png"));
btPopup.setPressedIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_down.png"));
btPopup.setRolloverIcon(BaseUtils.readIcon("/com/fr/design/images/form/designer/drop_over.png"));
}
}
// 有的编辑器是使用下拉框来直接选择的,这时候就把按钮显示成下拉框
protected boolean isComboButton() {
return false;
}
private void txtValueActionPerformed(ActionEvent evt) {
try {
validateValue();
fireStateChanged();
} catch (ValidationException e) {
showMessage(e.getMessage(), this);
txtValue.selectAll();
((JComponent) txtValue).requestFocus();
}
}
@Override
public Component getEditor() {
return this;
}
@Override
public Object getValue() {
return decoder.decode(txtValue.getText());
}
@Override
public void setValue(Object v) {
if(encoder != null) {
txtValue.setText(encoder.encode(v));
}
txtValue.setValue(v);
}
@Override
public void addChangeListener(ChangeListener l) {
if (!listeners.contains(l)) {
listeners.add(l);
}
}
@Override
public void removeChangeListener(ChangeListener l) {
if (listeners.contains(l)) {
listeners.remove(l);
}
}
protected void fireStateChanged() {
ChangeEvent e = new ChangeEvent(this);
for (ChangeListener l : listeners) {
l.stateChanged(e);
}
}
public Encoder getEncoder() {
return encoder;
}
public void setEncoder(Encoder encoder) {
this.encoder = encoder;
}
@Override
public void validateValue() throws ValidationException {
if (decoder != null) {
decoder.validate(txtValue.getText());
}
}
public static void showMessage(String message, Component editorComponent) {
JOptionPane.showMessageDialog(editorComponent, message, "Validation Error", JOptionPane.ERROR_MESSAGE);
}
}

98
designer_form/src/com/fr/design/mainframe/widget/accessibles/RendererField.java → designer_base/src/com/fr/design/mainframe/widget/accessibles/RendererField.java

@ -1,50 +1,50 @@
package com.fr.design.mainframe.widget.accessibles;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import javax.swing.JComponent;
import com.fr.design.mainframe.widget.editors.ITextComponent;
import com.fr.design.mainframe.widget.renderer.GenericCellRenderer;
public class RendererField extends JComponent implements ITextComponent{
private GenericCellRenderer renderer;
public RendererField(GenericCellRenderer renderer) {
this.setLayout(new BorderLayout());
this.renderer = renderer;
add(renderer, BorderLayout.CENTER);
}
@Override
public void addActionListener(ActionListener l) {
}
@Override
public String getText() {
return null;
}
@Override
public void selectAll() {
}
@Override
public void setEditable(boolean editable) {
this.setEnabled(editable);
}
@Override
public void setText(String text) {
}
@Override
public void setValue(Object v) {
renderer.setValue(v);
this.repaint();
}
package com.fr.design.mainframe.widget.accessibles;
import java.awt.*;
import java.awt.event.ActionListener;
import javax.swing.*;
import com.fr.design.mainframe.widget.editors.ITextComponent;
import com.fr.design.mainframe.widget.renderer.GenericCellRenderer;
public class RendererField extends JComponent implements ITextComponent{
private GenericCellRenderer renderer;
public RendererField(GenericCellRenderer renderer) {
this.setLayout(new BorderLayout());
this.renderer = renderer;
add(renderer, BorderLayout.CENTER);
}
@Override
public void addActionListener(ActionListener l) {
}
@Override
public String getText() {
return null;
}
@Override
public void selectAll() {
}
@Override
public void setEditable(boolean editable) {
this.setEnabled(editable);
}
@Override
public void setText(String text) {
}
@Override
public void setValue(Object v) {
renderer.setValue(v);
this.repaint();
}
}

44
designer_form/src/com/fr/design/mainframe/widget/accessibles/UneditableAccessibleEditor.java → designer_base/src/com/fr/design/mainframe/widget/accessibles/UneditableAccessibleEditor.java

@ -1,23 +1,23 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.design.designer.properties.Encoder;
public abstract class UneditableAccessibleEditor extends BaseAccessibleEditor {
protected Object value;
public UneditableAccessibleEditor(Encoder enc) {
super(enc, null, true);
}
@Override
public Object getValue() {
return value;
}
@Override
public void setValue(Object v) {
this.value = v;
super.setValue(v);
}
package com.fr.design.mainframe.widget.accessibles;
import com.fr.design.designer.properties.Encoder;
public abstract class UneditableAccessibleEditor extends BaseAccessibleEditor {
protected Object value;
public UneditableAccessibleEditor(Encoder enc) {
super(enc, null, true);
}
@Override
public Object getValue() {
return value;
}
@Override
public void setValue(Object v) {
this.value = v;
super.setValue(v);
}
}

0
designer_form/src/com/fr/design/mainframe/widget/editors/ITextComponent.java → designer_base/src/com/fr/design/mainframe/widget/editors/ITextComponent.java

0
designer_form/src/com/fr/design/mainframe/widget/editors/TextField.java → designer_base/src/com/fr/design/mainframe/widget/editors/TextField.java

186
designer_form/src/com/fr/design/mainframe/widget/renderer/GenericCellRenderer.java → designer_base/src/com/fr/design/mainframe/widget/renderer/GenericCellRenderer.java

@ -1,94 +1,94 @@
package com.fr.design.mainframe.widget.renderer;
import java.awt.Color;
import java.awt.Component;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.table.TableCellRenderer;
public abstract class GenericCellRenderer extends JComponent implements TableCellRenderer {
private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Component component = getRendererComponent();
Color fg = null;
Color bg = null;
JTable.DropLocation dropLocation = table.getDropLocation();
if ((dropLocation != null) && !dropLocation.isInsertRow()
&& !dropLocation.isInsertColumn()
&& (dropLocation.getRow() == row)
&& (dropLocation.getColumn() == column)) {
fg = UIManager.getColor("Table.dropCellForeground");
bg = UIManager.getColor("Table.dropCellBackground");
isSelected = true;
}
if (isSelected) {
component.setForeground((fg == null) ? table.getSelectionForeground() : fg);
component.setBackground((bg == null) ? table.getSelectionBackground() : bg);
} else {
component.setForeground(table.getForeground());
component.setBackground(table.getBackground());
}
component.setFont(table.getFont());
if (hasFocus) {
Border border = null;
if (isSelected) {
border = UIManager.getBorder("Table.focusSelectedCellHighlightBorder");
}
if (border == null) {
border = UIManager.getBorder("Table.focusCellHighlightBorder");
}
((JComponent) component).setBorder(border);
if (!isSelected && table.isCellEditable(row, column)) {
Color col;
col = UIManager.getColor("Table.focusCellForeground");
if (col != null) {
component.setForeground(col);
}
col = UIManager.getColor("Table.focusCellBackground");
if (col != null) {
component.setBackground(col);
}
}
}
((JComponent) component).setBorder(getNoFocusBorder());
setValue(value);
return component;
}
private static Border getNoFocusBorder() {
if (System.getSecurityManager() != null) {
return SAFE_NO_FOCUS_BORDER;
} else {
return noFocusBorder;
}
}
public Component getRendererComponent() {
return this;
}
public abstract void setValue(Object value);
package com.fr.design.mainframe.widget.renderer;
import java.awt.Color;
import java.awt.Component;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.table.TableCellRenderer;
public abstract class GenericCellRenderer extends JComponent implements TableCellRenderer {
private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Component component = getRendererComponent();
Color fg = null;
Color bg = null;
JTable.DropLocation dropLocation = table.getDropLocation();
if ((dropLocation != null) && !dropLocation.isInsertRow()
&& !dropLocation.isInsertColumn()
&& (dropLocation.getRow() == row)
&& (dropLocation.getColumn() == column)) {
fg = UIManager.getColor("Table.dropCellForeground");
bg = UIManager.getColor("Table.dropCellBackground");
isSelected = true;
}
if (isSelected) {
component.setForeground((fg == null) ? table.getSelectionForeground() : fg);
component.setBackground((bg == null) ? table.getSelectionBackground() : bg);
} else {
component.setForeground(table.getForeground());
component.setBackground(table.getBackground());
}
component.setFont(table.getFont());
if (hasFocus) {
Border border = null;
if (isSelected) {
border = UIManager.getBorder("Table.focusSelectedCellHighlightBorder");
}
if (border == null) {
border = UIManager.getBorder("Table.focusCellHighlightBorder");
}
((JComponent) component).setBorder(border);
if (!isSelected && table.isCellEditable(row, column)) {
Color col;
col = UIManager.getColor("Table.focusCellForeground");
if (col != null) {
component.setForeground(col);
}
col = UIManager.getColor("Table.focusCellBackground");
if (col != null) {
component.setBackground(col);
}
}
}
((JComponent) component).setBorder(getNoFocusBorder());
setValue(value);
return component;
}
private static Border getNoFocusBorder() {
if (System.getSecurityManager() != null) {
return SAFE_NO_FOCUS_BORDER;
} else {
return noFocusBorder;
}
}
public Component getRendererComponent() {
return this;
}
public abstract void setValue(Object value);
}

13
designer_form/src/com/fr/design/mainframe/widget/renderer/IconCellRenderer.java → designer_base/src/com/fr/design/mainframe/widget/renderer/IconCellRenderer.java

@ -1,17 +1,22 @@
package com.fr.design.mainframe.widget.renderer;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.*;
import com.fr.base.FRContext;
import com.fr.base.Icon;
import com.fr.base.IconManager;
import com.fr.form.ui.WidgetManager;
import javax.swing.*;
public class IconCellRenderer extends GenericCellRenderer {
private Image img;
public IconCellRenderer(){
// this.setBorder(BorderFactory.createLineBorder());
}
@Override
public void setValue(Object v) {
try {
@ -34,7 +39,7 @@ public class IconCellRenderer extends GenericCellRenderer {
int height = getHeight();
g.setColor(getBackground());
g.fillRect(0, 0, width, height);
Graphics2D g2d = (Graphics2D) g;
if (img != null) {
g2d.drawImage(img, 4,

0
designer_form/src/com/fr/design/mainframe/widget/wrappers/BackgroundWrapper.java → designer_base/src/com/fr/design/mainframe/widget/wrappers/BackgroundWrapper.java

0
designer_form/src/com/fr/design/mainframe/widget/wrappers/DictionaryWrapper.java → designer_base/src/com/fr/design/mainframe/widget/wrappers/DictionaryWrapper.java

0
designer_form/src/com/fr/design/mainframe/widget/wrappers/IconWrapper.java → designer_base/src/com/fr/design/mainframe/widget/wrappers/IconWrapper.java

3
designer_base/src/com/fr/design/widget/DataModify.java

@ -1,9 +1,6 @@
package com.fr.design.widget;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.gui.frpane.TreeSettingPane;
import com.fr.design.present.dict.DictionaryPane;
import com.fr.form.ui.Widget;
import javax.swing.*;

19
designer_base/src/com/fr/design/widget/WidgetBoundsPaneFactory.java

@ -3,6 +3,7 @@ package com.fr.design.widget;
import com.fr.design.foldablepane.UIExpandablePane;
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;
import com.fr.general.Inter;
@ -16,6 +17,7 @@ import java.awt.*;
public class WidgetBoundsPaneFactory {
public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) {
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
@ -25,10 +27,10 @@ public class WidgetBoundsPaneFactory {
double[] rowSize = {p, p};
double[] columnSize = {p, f, f};
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5);
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15));
return new UIExpandablePane(Inter.getLocText("FR-Designer_Coords_And_Size"), 280, 24, panel);
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 10);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
boundsPane.add(panel);
return new UIExpandablePane(Inter.getLocText("FR-Designer_Coords_And_Size"), 280, 24, boundsPane);
}
public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height) {
@ -44,9 +46,10 @@ public class WidgetBoundsPaneFactory {
double[] rowSize = {p, p, p, p};
double[] columnSize = {p, f, f};
int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5);
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15));
return new UIExpandablePane(Inter.getLocText("FR-Designer_Coords_And_Size"), 230, 24, panel);
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 10);
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
boundsPane.add(panel);
return new UIExpandablePane(Inter.getLocText("FR-Designer_Coords_And_Size"), 230, 24, boundsPane);
}
}

2
designer_base/src/com/fr/design/widget/btn/ButtonDetailPane.java

@ -28,7 +28,7 @@ public abstract class ButtonDetailPane<T extends Button> extends BasicPane {
return Inter.getLocText("Button");
}
public void populate(Button button) {
public void populate(T button) {
}

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

@ -4,12 +4,13 @@ import java.awt.*;
import javax.swing.*;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
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.design.widget.IconDefinePane;
import com.fr.design.mainframe.widget.accessibles.AccessibleIconEditor;
import com.fr.form.ui.Button;
import com.fr.general.Inter;
import com.fr.stable.StableUtils;
@ -24,48 +25,49 @@ import com.fr.stable.StableUtils;
public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends ButtonDetailPane<T> {
private UITextField hotkeysTextField;
private UITextField buttonNameTextField;
private IconDefinePane iconPane;
private AccessibleIconEditor iconPane;
public ButtonWithHotkeysDetailPane() {
initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
advancedPane.setPreferredSize(new Dimension(600, 341));
JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4));
this.add(advancedPane);
this.setLayout(new BorderLayout(7, 7));
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double rowSize[] = {p, p, p, p};
double columnSize[] = {p, p};
double columnSize[] = {p, f};
JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
iconPane = new IconDefinePane();
iconPane = new AccessibleIconEditor();
labelPane.add(iconPane);
Component[][] n_components = {
{new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField = new UITextField(16)},
{new UILabel(Inter.getLocText("FR-Designer_Button-Icon") + ":"), labelPane},
{new UILabel(Inter.getLocText("FR-Designer_Button-Type") + ":"), createButtonTypeComboBox()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField = new UITextField(16)}
{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, 0, 8);
advancedPane.add(panel,BorderLayout.NORTH);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 16, 8);
advancePane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
advancePane.add(panel, BorderLayout.NORTH);
Component comp = createCenterPane();
if(comp != null ) {
advancedPane.add(comp,BorderLayout.CENTER);
advancePane.add(comp,BorderLayout.CENTER);
}
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane);
this.add(uiExpandablePane);
}
protected abstract Component createCenterPane();
@Override
public void populate(Button button) {
public void populate(T button) {
if (button == null) {
return;
}
iconPane.populate(button.getIconName());
iconPane.setValue(button.getIconName());
buttonNameTextField.setText(button.getText());
hotkeysTextField.setText(button.getHotkeys());
}
@ -73,7 +75,7 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
@Override
public T update() {
T button = createButton();
button.setIconName(iconPane.update());
button.setIconName((String)iconPane.getValue());
button.setText(buttonNameTextField.getText());
button.setHotkeys(hotkeysTextField.getText());
return button;

28
designer_form/src/com/fr/design/widget/ui/designer/component/BackgroundCompPane.java → designer_base/src/com/fr/design/widget/component/BackgroundCompPane.java

@ -1,4 +1,4 @@
package com.fr.design.widget.ui.designer.component;
package com.fr.design.widget.component;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIHeadGroup;
@ -7,6 +7,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.AccessibleBackgroundEditor;
import com.fr.form.ui.Widget;
import com.fr.general.Background;
import com.fr.general.Inter;
@ -16,11 +17,11 @@ import java.awt.*;
/**
* Created by ibm on 2017/8/6.
*/
public class BackgroundCompPane extends BasicPane {
private UIHeadGroup backgroundHead;
private AccessibleBackgroundEditor initalBackgroundEditor;
private AccessibleBackgroundEditor overBackgroundEditor;
private AccessibleBackgroundEditor clickBackgroundEditor;
public abstract class BackgroundCompPane<T extends Widget> extends BasicPane {
protected UIHeadGroup backgroundHead;
protected AccessibleBackgroundEditor initalBackgroundEditor;
protected AccessibleBackgroundEditor overBackgroundEditor;
protected AccessibleBackgroundEditor clickBackgroundEditor;
public BackgroundCompPane() {
@ -62,18 +63,9 @@ public class BackgroundCompPane extends BasicPane {
}
public MouseActionBackground update() {
MouseActionBackground mouseActionBackground = new MouseActionBackground((Background) initalBackgroundEditor.getValue(), (Background) overBackgroundEditor.getValue(), (Background) clickBackgroundEditor.getValue());
return mouseActionBackground;
}
protected String title4PopupWindow() {
return "";
}
public abstract void update(T e);
public abstract void populate(T e);
public void populate(MouseActionBackground background) {
initalBackgroundEditor.setValue(background.getInitialBackground());
overBackgroundEditor.setValue(background.getOverBackground());
clickBackgroundEditor.setValue(background.getClickBackground());
}
}

48
designer_base/src/com/fr/design/widget/component/ButtonBackgroundPane.java

@ -0,0 +1,48 @@
package com.fr.design.widget.component;
import com.fr.form.ui.FreeButton;
import com.fr.general.Background;
/**
* Created by ibm on 2017/8/8.
*/
public class ButtonBackgroundPane extends BackgroundCompPane<FreeButton> {
public ButtonBackgroundPane(){
}
public void update(FreeButton freeButton){
int selectIndex = backgroundHead.getSelectedIndex();
if(selectIndex == 0){
freeButton.setCustomStyle(false);
freeButton.setInitialBackground(null);
freeButton.setOverBackground(null);
freeButton.setClickBackground(null);
}else{
freeButton.setCustomStyle(true);
freeButton.setInitialBackground((Background) initalBackgroundEditor.getValue());
freeButton.setOverBackground((Background) overBackgroundEditor.getValue());
freeButton.setClickBackground((Background)clickBackgroundEditor.getValue());
}
}
public void populate(FreeButton freeButton){
if(!freeButton.isCustomStyle()){
backgroundHead.setSelectedIndex(0);
initalBackgroundEditor.setValue(null);
overBackgroundEditor.setValue(null);
clickBackgroundEditor.setValue(null);
}else{
backgroundHead.setSelectedIndex(1);
initalBackgroundEditor.setValue(freeButton.getInitialBackground());
overBackgroundEditor.setValue(freeButton.getOverBackground());
clickBackgroundEditor.setValue(freeButton.getClickBackground());
}
}
protected String title4PopupWindow() {
return "buttonBackground";
}
}

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

@ -0,0 +1,81 @@
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.general.ComparatorUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/8/8.
*/
public class DateValuePane extends JPanel {
private UIHeadGroup widgetValueHead;
private Editor[] editor;
public DateValuePane() {
editor = new Editor[]{
new NoneEditor(null, Inter.getLocText("None")),
new DateEditor(true, Inter.getLocText("Date")),
new FormulaEditor(Inter.getLocText("Parameter-Formula"))
};
this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL));
final CardLayout cardLayout = new CardLayout();
final JPanel customPane = new JPanel(cardLayout);
final String[] tabTitles = new String[editor.length];
for (int i = 0; i < editor.length; i++) {
customPane.add(editor[i], editor[i].getName());
tabTitles[i] = editor[i].getName();
}
widgetValueHead = new UIHeadGroup(tabTitles) {
@Override
public void tabChanged(int index) {
if (ComparatorUtils.equals(tabTitles[index], Inter.getLocText("None"))) {
customPane.setVisible(false);
} else {
customPane.setVisible(true);
}
cardLayout.show(customPane, tabTitles[index]);
}
};
this.add(widgetValueHead, BorderLayout.NORTH);
this.add(customPane, BorderLayout.CENTER);
}
public Object update() {
int index = widgetValueHead.getSelectedIndex();
Editor e = editor[index];
Object value = e.getValue();
return value;
}
public void populate(Object ob) {
for (int i = 0; i < editor.length; i++) {
if (editor[i].accept(ob)) {
setCardValue(i, ob);
break;
}
}
}
private void setCardValue(int i, Object object) {
widgetValueHead.setSelectedIndex(i);
editor[i].setValue(object);
// kunsnat: bug7861 所有的Editor值都要跟随改变, 因为populate的editor 从""
// 一定是最后的Editor哦.
for (int j = 0; j < editor.length; j++) {
if (i == j) {
continue;
}
this.editor[j].setValue(null);
}
}
}

5
designer_form/src/com/fr/design/widget/ui/designer/component/MouseActionBackground.java → designer_base/src/com/fr/design/widget/component/MouseActionBackground.java

@ -1,4 +1,4 @@
package com.fr.design.widget.ui.designer.component;
package com.fr.design.widget.component;
import com.fr.general.Background;
@ -17,6 +17,8 @@ public class MouseActionBackground {
this.clickBackground = clickBackground;
}
public Background getInitialBackground() {
return initialBackground;
}
@ -40,4 +42,5 @@ public class MouseActionBackground {
public void setClickBackground(Background clickBackground) {
this.clickBackground = clickBackground;
}
}

1
designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java

@ -21,6 +21,7 @@ public class FormBasicWidgetPropertyPane extends FormBasicPropertyPane {
protected void initOtherPane() {
JPanel pane2 = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane();
pane2.setBorder(BorderFactory.createEmptyBorder(0,0,10,0));
enableCheckBox = new UICheckBox(Inter.getLocText("Enabled"), true);
pane2.add(enableCheckBox);
visibleCheckBox = new UICheckBox(Inter.getLocText("Widget-Visible"), true);

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

@ -59,12 +59,15 @@ 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, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return panel;
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 10);
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
jPanel.add(panel);
return jPanel;
}
public JPanel createAdvancePane() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
displayReport = new UICheckBox(Inter.getLocText("FR-Designer_DisplayNothingBeforeQuery"));
background = new AccessibleBackgroundEditor();
Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
@ -84,9 +87,10 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
new Component[]{displayReport, null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WidgetDisplyPosition")), hAlignmentPane}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return panel;
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 10);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
jPanel.add(panel);
return jPanel;
}
@Override

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

@ -45,13 +45,15 @@ public abstract class ButtonDefinePane<T extends Button> extends AbstractDataMod
{new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField},
backgroundCompPane,
frFont,
{new UILabel(Inter.getLocText("FR-Designer_Icon" + ":")), iconPane},
{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, 8);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
UIExpandablePane advancedPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, panel);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, 10, 10);
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
boundsPane.add(panel);
UIExpandablePane advancedPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, boundsPane);
this.add(advancedPane);
}

16
designer_form/src/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java

@ -5,10 +5,12 @@ 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.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.ButtonGroup;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class ButtonGroupDictPane extends JPanel {
@ -24,14 +26,18 @@ public class ButtonGroupDictPane extends JPanel {
*
*/
public void initComponents() {
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true);
this.add(adaptiveCheckbox);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true);
adaptiveCheckbox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns") + ":");
this.add(columnLabel);
columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1));
this.add(columnSpinner);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{adaptiveCheckbox, columnLabel, columnSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
this.add(jPanel);
}
public void populate(ButtonGroup buttonGroup) {

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

@ -41,8 +41,10 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 3},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, panel);
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
boundsPane.add(panel);
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, boundsPane);
this.add(uiExpandablePane);
}

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

@ -40,6 +40,7 @@ public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane<CheckBoxGroup
public JPanel createOtherPane(){
checkbox = new UICheckBox(Inter.getLocText(new String[]{"Provide", "Choose_All"}));
checkbox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
final String[] tabTitles = new String[]{Inter.getLocText("Widget-Array"), Inter.getLocText("String")};
returnType = new UIHeadGroup(tabTitles) {
@Override
@ -65,7 +66,7 @@ public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane<CheckBoxGroup
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(0,5,5,5));
panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
return panel;
}

2
designer_form/src/com/fr/design/widget/ui/designer/ComboBoxDefinePane.java

@ -8,6 +8,7 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.form.ui.ComboBox;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class ComboBoxDefinePane extends DictEditorDefinePane<ComboBox> {
@ -20,6 +21,7 @@ public class ComboBoxDefinePane extends DictEditorDefinePane<ComboBox> {
public UICheckBox createRepeatCheckBox(){
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget_No_Repeat"));
removeRepeatCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
return removeRepeatCheckBox;
}

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

@ -26,6 +26,7 @@ public class ComboCheckBoxDefinePane extends DictEditorDefinePane<ComboCheckBox>
public UICheckBox createRepeatCheckBox(){
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Widget_No_Repeat"));
removeRepeatCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
return removeRepeatCheckBox;
}
@ -62,7 +63,7 @@ public class ComboCheckBoxDefinePane extends DictEditorDefinePane<ComboCheckBox>
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(0,5,5,5));
panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
return panel;
}

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

@ -29,10 +29,11 @@ public abstract class CustomWritableRepeatEditorPane<T extends CustomWriteAbleRe
public JPanel setValidatePane(){
this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false);
this.customDataCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.customDataCheckBox.setPreferredSize(
new Dimension(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT));
JPanel otherContentPane = super.setValidatePane();
otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5));
otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 0));
return otherContentPane;
}

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

@ -3,10 +3,7 @@ package com.fr.design.widget.ui.designer;
import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.data.core.FormatField;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
@ -14,14 +11,13 @@ 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.utils.gui.GUICoreUtils;
import com.fr.design.widget.component.DateValuePane;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.DateEditor;
import com.fr.general.DateUtils;
import com.fr.general.Inter;
import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.UtilEvalError;
import javax.swing.*;
@ -32,15 +28,15 @@ import java.text.SimpleDateFormat;
import java.util.Date;
public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> {
private UIComboBox returnTypeComboBox;
private UILabel sampleLabel;// preview
private UIComboBox dateFormatComboBox;
private ValueEditorPane startDv;
private ValueEditorPane endDv;
private UIHeadGroup returnTypeComboBox;
private DateValuePane startDv;
private DateValuePane endDv;
private WaterMarkDictPane waterMarkDictPane;
private FormWidgetValuePane formWidgetValuePane;
private UISpinner fontSizePane;
private UIHeadGroup formatHeader;
private UIComboBox currentFormatComboBox;
private UILabel currentSamplelabel;
private UIHeadGroup fomatHeadGroup;
public DateEditorDefinePane(XCreator xCreator) {
super(xCreator);
@ -59,35 +55,20 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
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 UIComboBox(new String[]{Inter.getLocText("String"), Inter.getLocText("Date")});
returnTypeComboBox.setPreferredSize(new Dimension(70, 20));
// sample pane
sampleLabel = new UILabel("");
sampleLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 4));
sampleLabel.setHorizontalAlignment(SwingConstants.CENTER);
sampleLabel.setFont(FRContext.getDefaultValues().getFRFont());
JPanel previewPane = FRGUIPaneFactory.createTitledBorderPane("示例");
previewPane.add(sampleLabel);
// content pane
String[] arr = getDateFormateArray();
dateFormatComboBox = new UIComboBox(arr);
dateFormatComboBox.setPreferredSize(new Dimension(150, 20));
dateFormatComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
refreshPreviewLabel();
returnTypeComboBox = new UIHeadGroup(new String[] {Inter.getLocText("Date") , Inter.getLocText("String")}){
protected void tabChanged(int newSelectedIndex) {
//todo
}
};
JPanel formatHead = createFormatHead();
});
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null);
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null);
initFormatHeader();
startDv = new DateValuePane();
endDv = new DateValuePane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane},
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"), dateFormatComboBox},
new Component[]{null, previewPane},
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"), formatHead},
new Component[]{new UILabel(Inter.getLocText("FS_Start_Date") + ":"), startDv},
new Component[]{new UILabel(Inter.getLocText("FS_End_Date") + ":"), endDv},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark") + ":"), waterMarkDictPane},
@ -95,43 +76,80 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypeComboBox}
};
double[] rowSize = {p, p, p, p, p, p, p, p, p, p};
double[] rowSize = {p, p, p, p, p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return panel;
int[][] rowCount = {{1, 3}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 10);
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
boundsPane.add(panel);
return boundsPane;
}
protected void initFormatHeader() {
String [] tabTitles = getDateFormateArray();
formatHeader = new UIHeadGroup(tabTitles){
protected void tabChanged(int newSelectedIndex) {
}
};
private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){
JPanel previewPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Base_StyleFormat_Sample"));
previewPane.add(sampleLabel);
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(previewPane, BorderLayout.NORTH);
jPanel.add(formatComboBox, BorderLayout.CENTER);
return jPanel;
}
private String[] getDateFormateArray() {
return FormatField.getInstance().getDateFormatArray();
private UILabel createSamplePane(){
UILabel sampleLabel = new UILabel("");
sampleLabel.setHorizontalAlignment(SwingConstants.CENTER);
sampleLabel.setFont(FRContext.getDefaultValues().getFRFont());
return sampleLabel;
}
protected JPanel initStartEndDatePane() {
JPanel rangePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
rangePane.add(new UILabel(Inter.getLocText("FS_Start_Date") + ":"));
startDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null);
rangePane.add(startDv);
rangePane.add(new UILabel(Inter.getLocText("FS_End_Date") + ":"));
endDv = ValueEditorPaneFactory.createDateValueEditorPane(null, null);
rangePane.add(endDv);
return rangePane;
private JPanel createFormatHead(){
String[] dateArray = FormatField.getInstance().getFormatArray(FormatField.FormatContents.DATE);
String[] timeArray = FormatField.getInstance().getFormatArray(FormatField.FormatContents.TIME);
final UIComboBox dateFormatComboBox = new UIComboBox(dateArray);
final UIComboBox timeFormatComboBox = new UIComboBox(timeArray);
dateFormatComboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
refreshPreviewLabel();
}
});
timeFormatComboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
refreshPreviewLabel();
}
});
final UILabel dateSampleLabel = createSamplePane();
final UILabel timeSampleLabel = createSamplePane();
JPanel fomatHeadPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
final CardLayout cardLayout = new CardLayout();
final JPanel customPane = new JPanel(cardLayout);
JPanel dateFormatPane = createFormatPane(dateFormatComboBox, dateSampleLabel);
JPanel timeFormatPane = createFormatPane(timeFormatComboBox, timeSampleLabel);
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) {
cardLayout.show(customPane, tabTitles[newSelectedIndex]);
if(newSelectedIndex == 0){
currentFormatComboBox = dateFormatComboBox;
currentSamplelabel = dateSampleLabel;
}else{
currentFormatComboBox = timeFormatComboBox;
currentSamplelabel = timeSampleLabel;
}
refreshPreviewLabel();
}
};
fomatHeadPane.add(fomatHeadGroup, BorderLayout.NORTH);
fomatHeadPane.add(customPane, BorderLayout.CENTER);
return fomatHeadPane;
}
private void refreshPreviewLabel() {
String text = (String) dateFormatComboBox.getSelectedItem();
String text = (String) currentFormatComboBox.getSelectedItem();
if (text != null && text.length() > 0) {
try {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(text);
@ -141,25 +159,28 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
sample += " " + Inter.getLocText("DateFormat-Custom_Warning");
c = Color.red;
}
this.sampleLabel.setText(sample);
this.sampleLabel.setForeground(c);
currentSamplelabel.setText(sample);
currentSamplelabel.setForeground(c);
} catch (Exception exp) {
this.sampleLabel.setForeground(Color.red);
this.sampleLabel.setText(exp.getMessage());
currentSamplelabel.setForeground(Color.red);
currentSamplelabel.setText(exp.getMessage());
}
} else {
this.sampleLabel.setText(new Date().toString());
currentSamplelabel.setText(new Date().toString());
}
}
@Override
protected void populateSubDirectWriteEditorBean(DateEditor e) {
String formatText = e.getFormatText();
dateFormatComboBox.setSelectedItem(formatText);
fomatHeadGroup.setSelectedIndex(getDateType(e));
currentFormatComboBox.setSelectedItem(formatText);
returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 1 : 0);
returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 0 : 1);
formWidgetValuePane.populate(e);
populateStartEnd(e);
startDv.populate(e.getStartDate());
endDv.populate(e.getEndDate());
}
@Override
@ -167,34 +188,14 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
DateEditor ob = new DateEditor();
ob.setFormatText(this.getSimpleDateFormat().toPattern());
ob.setReturnDate(returnTypeComboBox.getSelectedIndex() == 1);
ob.setReturnDate(returnTypeComboBox.getSelectedIndex() == 0);
formWidgetValuePane.update(ob);
updateStartEnd(ob);
ob.setStartDate(startDv.update());
ob.setEndDate(endDv.update());
return ob;
}
/**
* 初始起止日期
*
* @param dateWidgetEditor 日期控件
*/
public void populateStartEnd(DateEditor dateWidgetEditor) {
Formula startFM = dateWidgetEditor.getStartDateFM();
Formula endFM = dateWidgetEditor.getEndDateFM();
if (startFM != null) {
startDv.populate(startFM);
} else {
String startStr = dateWidgetEditor.getStartText();
startDv.populate(StringUtils.isEmpty(startStr) ? null : DateUtils.string2Date(startStr, true));
}
if (endFM != null) {
endDv.populate(endFM);
} else {
String endStr = dateWidgetEditor.getEndText();
endDv.populate(StringUtils.isEmpty(endStr) ? null : DateUtils.string2Date(endStr, true));
}
}
/**
* 更新日期控件的起止日期
@ -245,12 +246,12 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
}
private SimpleDateFormat getSimpleDateFormat() {
String text = (String) dateFormatComboBox.getSelectedItem();
String text = (String) currentFormatComboBox.getSelectedItem();
SimpleDateFormat simpleDateFormat;
if (text != null && text.length() > 0) {
try {
simpleDateFormat = new SimpleDateFormat(text);
this.sampleLabel.setText(simpleDateFormat.format(new Date()));
this.currentSamplelabel.setText(simpleDateFormat.format(new Date()));
} catch (Exception exp) {
simpleDateFormat = new SimpleDateFormat("");
}
@ -262,4 +263,16 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
}
private int getDateType(DateEditor e){
String[] timeArray = FormatField.getInstance().getFormatArray(FormatField.FormatContents.TIME);
if(e == null){
return 0;
}
String formatText = e.getFormatText();
if(ArrayUtils.contains(timeArray, formatText)){
return 1;
}
return 0;
}
}

5
designer_form/src/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java

@ -44,7 +44,7 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
double[] columnSize = {p, f};
int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1,1},{1,1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
advancePane.add(panel, BorderLayout.NORTH);
JPanel otherPane = createOtherPane();
if(otherPane != null){
@ -72,9 +72,10 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
public JPanel setValidatePane(){
directWriteCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_Edit"), false);
directWriteCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel otherContentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
otherContentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
JPanel jPanel = GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 5);
JPanel jPanel = GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 0);
jPanel.setPreferredSize(new Dimension(220, 30));
otherContentPane.add(jPanel);
return otherContentPane;

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

@ -39,13 +39,13 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null"));
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT));
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
// allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT));
fontSizePane = new UISpinner(0, 20, 1, 0);
errorMsgTextField = new UITextField();
JPanel contentPane = this.setFirstContentPane();
if (contentPane != null) {
UIExpandablePane uiExpandablePane = new UIExpandablePane("高级", 280, 20, contentPane);
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, contentPane);
this.add(uiExpandablePane, BorderLayout.NORTH);
}
this.addValidatePane();
@ -84,6 +84,8 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
protected void addValidatePane() {
validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
validatePane.setLayout(new BorderLayout(0, 5));
final UILabel uiLabel = new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip"));
allowBlankCheckBox.addItemListener(new ItemListener() {
@ -112,8 +114,8 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 2);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 5, 5);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
validatePane.add(panel, BorderLayout.NORTH);
JPanel contentPane = this.setValidatePane();
if (contentPane != null) {

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

@ -3,8 +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.widget.ui.designer.component.BackgroundCompPane;
import com.fr.design.widget.ui.designer.component.MouseActionBackground;
import com.fr.design.widget.component.ButtonBackgroundPane;
import com.fr.form.ui.FreeButton;
import com.fr.general.FRFont;
import com.fr.general.Inter;
@ -16,7 +15,7 @@ import java.awt.*;
* Created by ibm on 2017/8/6.
*/
public class FreeButtonDefinePane extends ButtonDefinePane<FreeButton> {
private BackgroundCompPane backgroundCompPane;
private ButtonBackgroundPane backgroundCompPane;
private FRFontPane frFontPane;
public FreeButtonDefinePane(XCreator xcreator) {
@ -24,7 +23,7 @@ public class FreeButtonDefinePane extends ButtonDefinePane<FreeButton> {
}
public Component[] createBackgroundComp() {
backgroundCompPane = new BackgroundCompPane();
backgroundCompPane = new ButtonBackgroundPane();
return new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background") + ":"), backgroundCompPane};
}
@ -36,8 +35,7 @@ public class FreeButtonDefinePane extends ButtonDefinePane<FreeButton> {
}
public void populateSubButtonPane(FreeButton e) {
MouseActionBackground mouseActionBackground = new MouseActionBackground(e.getInitialBackground(), e.getOverBackground(), e.getClickBackground());
backgroundCompPane.populate(mouseActionBackground);
backgroundCompPane.populate(e);
FRFont frFont = e.getFont();
if (frFont != null) {
frFontPane.populateBean(e.getFont());
@ -46,10 +44,7 @@ public class FreeButtonDefinePane extends ButtonDefinePane<FreeButton> {
public FreeButton updateSubButtonPane() {
FreeButton freeButton = (FreeButton) creator.toData();
MouseActionBackground mouseActionBackground = backgroundCompPane.update();
freeButton.setInitialBackground(mouseActionBackground.getInitialBackground());
freeButton.setOverBackground(mouseActionBackground.getOverBackground());
freeButton.setClickBackground(mouseActionBackground.getClickBackground());
backgroundCompPane.update(freeButton);
frFontPane.update(freeButton.getFont());
return freeButton;
}

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

@ -68,8 +68,10 @@ public class LabelDefinePane extends AbstractDataModify<Label> {
new Component[]{fontLabel, frFontPane},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return panel;
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
boundsPane.add(panel);
return boundsPane;
}
@Override

7
designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java

@ -36,6 +36,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
protected JPanel setFirstContentPane() {
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays);
singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD"));
singleFileCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
fileSizeField = new UINumberField();
fontSizeField = new UISpinner(0, 20, 1, 0);
@ -66,9 +67,11 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
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(5,5,5,5));
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
boundsPane.add(panel);
return panel;
return boundsPane;
}
@Override

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

@ -4,11 +4,13 @@ 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.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.NumberEditor;
import com.fr.general.Inter;
import com.fr.third.fr.pdf.layout.border.Border;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@ -165,28 +167,31 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
double[] columnSize = {p,f};
int[][] rowCount = {{1, 3},{1, 1},{1, 1}};
JPanel advancePane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
advancePane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
return advancePane;
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
advancePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
boundsPane.add(advancePane);
return boundsPane;
}
public JPanel setValidatePane() {
// super.addValidatePane();
this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals"));
this.decimalLength = new com.fr.design.editor.editor.IntegerEditor();
this.decimalLength.setColumns(4);
allowDecimalsCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.allowDecimalsCheckBox.addActionListener(actionListener1);
this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative"));
this.allowNegativeCheckBox.addActionListener(actionListener2);
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));
maxValueSpinner.setPreferredSize(new Dimension(120, 20));
setNotAllowsInvalid(this.maxValueSpinner);
this.setMaxValueCheckBox.addActionListener(actionListener3);
@ -196,9 +201,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
minValueSpinner.setPreferredSize(new Dimension(120, 20));
setNotAllowsInvalid(this.minValueSpinner);
minValueSpinner.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.setMinValueCheckBox.addActionListener(actionListener4);
this.minValueSpinner.addChangeListener(changeListener2);
setMinValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
double f = TableLayout.FILL;
@ -214,6 +219,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
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, 3);
panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
return panel;
}

13
designer_form/src/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java

@ -4,6 +4,7 @@ import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.frpane.RegPane;
import com.fr.design.gui.ilable.UILabel;
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.design.widget.ui.designer.component.FormWidgetValuePane;
@ -24,10 +25,6 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
super(xCreator);
}
public TextFieldEditorDefinePane() {
super();
}
@Override
protected JPanel setFirstContentPane() {
@ -79,9 +76,11 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 3},{1, 1},{1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
return panel;
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 10);
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
boundsPane.add(panel);
return boundsPane;
}
public JPanel setValidatePane(){

2
designer_form/src/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java

@ -49,7 +49,7 @@ public class TreeEditorDefinePane extends DictEditorDefinePane<TreeEditor> {
double[] rowSize = {p, p, p, p};
double[] columnSize = {p};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
return panel;
}

64
designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonDetailPaneFactory.java

@ -1,64 +0,0 @@
package com.fr.design.widget.ui.designer.btn;
import com.fr.base.FRContext;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.widget.btn.ButtonDetailPane;
import com.fr.form.ui.Button;
import com.fr.form.ui.FreeButton;
import com.fr.form.ui.Widget;
import com.fr.stable.bridge.BridgeMark;
import com.fr.stable.bridge.StableFactory;
import java.util.HashMap;
import java.util.Map;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-15
* Time : 下午6:29
*/
public class ButtonDetailPaneFactory {
private static Map<String, Class> detailMap = new HashMap<String, Class>();
static {
detailMap.put(Button.class.getName(), DefaultButtonDetailPane.class);
detailMap.put(FreeButton.class.getName(), FreeButtonDetailPane.class);
if (StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class) != null) {
detailMap.put(StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class).getName(), DesignModuleFactory.getButtonDetailPaneClass());
}
}
public static ButtonDetailPane<Button> createButtonDetailPane(Button button) {
Class cls = detailMap.get(button.getClass().getName());
ButtonDetailPane<Button> detailPane = null;
if (cls != null) {
try {
detailPane = (ButtonDetailPane) cls.newInstance();
detailPane.populate(button);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
return detailPane;
}
public static ButtonDetailPane<Button> createButtonDetailPane(Class cls, Button button) {
if (cls == null) {
return createButtonDetailPane(button);
}
Class aa = detailMap.get(cls.getName());
ButtonDetailPane<Button> detailPane = null;
if (aa != null) {
try {
detailPane = (ButtonDetailPane) aa.newInstance();
detailPane.populate(button == null ? detailPane.createButton() : button);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
return detailPane;
}
}

2
designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java

@ -47,7 +47,7 @@ public abstract class ButtonGroupDefinePane<T extends ButtonGroup> extends Field
double[] columnSize = {p, f};
int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
advancePane.add(panel, BorderLayout.NORTH);
JPanel otherPane = createOtherPane();
if (otherPane != null) {

143
designer_form/src/com/fr/design/widget/ui/designer/btn/ButtonSytleDefinedPane.java

@ -1,143 +0,0 @@
package com.fr.design.widget.ui.designer.btn;
import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageBackground;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundButtonPane;
import com.fr.form.ui.FreeButton;
import com.fr.general.Background;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ButtonSytleDefinedPane extends BasicPane {
// private UIComboBox buttonStyleComboBox;
// private JPanel card;
// private CardLayout cardLayout;
private BackgroundPane initBackgroundPane;
private BackgroundPane overBackgroundPane;
private BackgroundPane clickBackgroundPane;
private Background initBackground;
private Background overBackground;
private Background clickBackground;
public ButtonSytleDefinedPane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel buttonStylePane = new JPanel();
buttonStylePane.setLayout(new BorderLayout());
initBackgroundPane = new BackgroundPane(Inter.getLocText("FR-Designer_Background-Initial") + ":", Inter.getLocText("FR-Designer_Initial_Background_Tips"));
overBackgroundPane = new BackgroundPane(Inter.getLocText("FR-Designer_Background-Over") + ":", Inter.getLocText("FR-Designer_Mouse_Move_Tips"));
clickBackgroundPane = new BackgroundPane(Inter.getLocText("FR-Designer_Background-Click") + ":", Inter.getLocText("FR-Designer_Mouse_Click_Tips"));
JPanel table = FRGUIPaneFactory.createYBoxEmptyBorderPane();
table.setBorder(new TitledBorder(Inter.getLocText(new String[]{"Custom", "Form-Button", "Style"})));
table.add(initBackgroundPane);
table.add(overBackgroundPane);
table.add(clickBackgroundPane);
buttonStylePane.add(table, BorderLayout.WEST);
this.add(buttonStylePane, BorderLayout.CENTER);
}
public void populate(FreeButton button) {
if (button == null) {
return;
}
initBackgroundPane.populate(button.getInitialBackground());
overBackgroundPane.populate(button.getOverBackground());
clickBackgroundPane.populate(button.getClickBackground());
}
public FreeButton update(FreeButton button) {
button.setCustomStyle(true);
button.setInitialBackground(initBackgroundPane.update());
button.setOverBackground(overBackgroundPane.update());
button.setClickBackground(clickBackgroundPane.update());
return button;
}
@Override
protected String title4PopupWindow() {
return null;
}
class BackgroundPane extends JPanel {
private UIButton editButton;
private BackgroundButtonPane choosePane;
private Background background;
private UILabel ImagePreviewPane;
BackgroundPane(String text, String ToolTips) {
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 150));
UILabel label = new UILabel(text);
label.setToolTipText(ToolTips);
label.setPreferredSize(new Dimension(100, 20));
this.add(label);
ImagePreviewPane = new UILabel();
ImagePreviewPane.setPreferredSize(new Dimension(100, 20));
this.add(ImagePreviewPane);
editButton = new UIButton(Inter.getLocText("FR-Designer_Edit"));
editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
choosePane = new BackgroundButtonPane();
BasicDialog dlg = choosePane.showWindow(SwingUtilities
.getWindowAncestor(ButtonSytleDefinedPane.this));
dlg.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
populate(choosePane.update());
}
});
if(BackgroundPane.this.background == null){
BackgroundPane.this.background = new ColorBackground();
}
choosePane.populate((Background) BackgroundPane.this.background);
dlg.setVisible(true);
}
});
this.add(editButton);
}
public void populate(Background background) {
this.background = background;
if (background instanceof ImageBackground && ((ImageBackground) background).getImage() != null) {
ImagePreviewPane.setIcon(new ImageIcon(((ImageBackground) background).getImage()));
} else if(background instanceof ColorBackground && ((ColorBackground) background).getColor() != null){
ImagePreviewPane.setIcon(null);
ImagePreviewPane.setOpaque(true);
ImagePreviewPane.setBackground(((ColorBackground) background).getColor());
}else{
ImagePreviewPane.setIcon(null);
ImagePreviewPane.setOpaque(false);
ImagePreviewPane.setBackground(null);
}
}
public Background update() {
return background;
}
}
}

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

@ -1,30 +0,0 @@
package com.fr.design.widget.ui.designer.btn;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
import com.fr.form.ui.Button;
import com.fr.form.ui.FreeButton;
import java.awt.*;
/**
* Created by IntelliJ IDEA. Author : Richer Version: 6.5.6 Date : 11-11-15 Time
* : 下午6:24
*/
public class DefaultButtonDetailPane extends ButtonWithHotkeysDetailPane<Button> {
@Override
protected Component createCenterPane() {
return null;
}
@Override
public FreeButton createButton() {
return new FreeButton();
}
@Override
public Class classType() {
return Button.class;
}
}

56
designer_form/src/com/fr/design/widget/ui/designer/btn/DefaultButtonStylePane.java

@ -1,56 +0,0 @@
package com.fr.design.widget.ui.designer.btn;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.IconDefinePane;
import com.fr.form.ui.Button;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class DefaultButtonStylePane extends BasicPane {
private UITextField buttonNameTextField;
private IconDefinePane iconPane;
private UIComboBox buttonStyleComboBox;
public DefaultButtonStylePane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(new BorderLayout());
JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
iconPane = new IconDefinePane();
labelPane.add(iconPane);
Component[][] n_components = {
{ new UILabel(Inter.getLocText("Text") + ":"), buttonNameTextField = new UITextField(20) },
{ new UILabel(Inter.getLocText("Icon") + ":"), labelPane } };
JPanel panel = TableLayoutHelper.createTableLayoutPane(n_components, new double[]{-2, -2}, new double[]{-2, -2});
this.add(panel,BorderLayout.CENTER);
}
public void populate(Button button) {
buttonNameTextField.setText(button.getText());
iconPane.populate(button.getIconName());
}
public Button update(Button button) {
button.setText(buttonNameTextField.getText());
button.setIconName(iconPane.update());
return button;
}
@Override
protected String title4PopupWindow() {
return "default";
}
}

40
designer_form/src/com/fr/design/widget/ui/designer/btn/FreeButtonDetailPane.java

@ -1,40 +0,0 @@
package com.fr.design.widget.ui.designer.btn;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
import com.fr.form.ui.Button;
import com.fr.form.ui.FreeButton;
import java.awt.*;
public class FreeButtonDetailPane extends ButtonWithHotkeysDetailPane<FreeButton> {
private ButtonSytleDefinedPane stylePane;
@Override
protected Component createCenterPane() {
return stylePane = new ButtonSytleDefinedPane();
}
@Override
public FreeButton createButton() {
return new FreeButton();
}
@Override
public void populate(Button button) {
super.populate(button);
if(button instanceof FreeButton) {
stylePane.populate((FreeButton) button);
}
}
@Override
public FreeButton update() {
FreeButton button = super.update();
return stylePane.update(button);
}
@Override
public Class classType() {
return FreeButton.class;
}
}

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

@ -45,7 +45,7 @@ public class PaddingBoundPane extends BasicPane {
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);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
this.add(panel);
}

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

@ -0,0 +1,50 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.widget.component.BackgroundCompPane;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Background;
/**
* Created by ibm on 2017/8/8.
*/
public class TabFitLayoutBackgroundPane extends BackgroundCompPane<WTabFitLayout> {
public TabFitLayoutBackgroundPane(){
}
public void update(WTabFitLayout wTabFitLayout){
int selectIndex = backgroundHead.getSelectedIndex();
if(selectIndex == 0){
wTabFitLayout.setCustomStyle(false);
wTabFitLayout.setInitialBackground(null);
wTabFitLayout.setOverBackground(null);
wTabFitLayout.setClickBackground(null);
}else{
wTabFitLayout.setCustomStyle(true);
wTabFitLayout.setInitialBackground((Background) initalBackgroundEditor.getValue());
wTabFitLayout.setOverBackground((Background) overBackgroundEditor.getValue());
wTabFitLayout.setClickBackground((Background)clickBackgroundEditor.getValue());
}
}
public void populate(WTabFitLayout wTabFitLayout){
if(!wTabFitLayout.isCustomStyle()){
backgroundHead.setSelectedIndex(0);
initalBackgroundEditor.setValue(null);
overBackgroundEditor.setValue(null);
clickBackgroundEditor.setValue(null);
}else{
backgroundHead.setSelectedIndex(1);
initalBackgroundEditor.setValue(wTabFitLayout.getInitialBackground());
overBackgroundEditor.setValue(wTabFitLayout.getOverBackground());
clickBackgroundEditor.setValue(wTabFitLayout.getClickBackground());
}
}
protected String title4PopupWindow() {
return "tabFitBackground";
}
}

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

@ -38,8 +38,8 @@ public class ElementEditorDefinePane extends WTitleLayoutDefinePane<ElementCaseE
new Component[]{paddingBoundPane, null},
new Component[]{new UILabel("报表块工具栏"), elementCaseToolBarEditor}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 10);
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
return panel;
}

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

@ -50,8 +50,8 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
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, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 10);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
return panel;
}

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

@ -32,7 +32,6 @@ public class FRAbsoluteLayoutDefinePane extends AbstractDataModify<WAbsoluteLayo
public FRAbsoluteLayoutDefinePane(XCreator xCreator) {
super(xCreator);
this.xwAbsoluteLayout = (XWAbsoluteLayout) xCreator;
wAbsoluteLayout = xwAbsoluteLayout.toData();
initComponent();
@ -45,7 +44,10 @@ public class FRAbsoluteLayoutDefinePane extends AbstractDataModify<WAbsoluteLayo
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(boundPane, BorderLayout.NORTH);
initUIComboBox();
UIExpandablePane layoutExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer-Widget_Area_Scaling"), 280, 20, createThirdPane());
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);
}
@ -60,7 +62,7 @@ public class FRAbsoluteLayoutDefinePane extends AbstractDataModify<WAbsoluteLayo
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Scaling_Mode")), comboBox},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
return panel;
}

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

@ -67,7 +67,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
background = new AccessibleWLayoutBorderStyleEditor();
paddingBound = new PaddingBoundPane();
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background")), background}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
jp2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
jp2.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0));
jPanel.add(paddingBound, BorderLayout.CENTER);
jPanel.add(jp2, BorderLayout.NORTH);
return jPanel;
@ -88,8 +88,8 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
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, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 10);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
jPanel.add(panel, BorderLayout.CENTER);
return jPanel;
@ -124,7 +124,10 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
public WFitLayout updateBean() {
WFitLayout layout = (WFitLayout) creator.toData();
paddingBound.update(layout);
layout.setBorderStyle((LayoutBorderStyle) background.getValue());
LayoutBorderStyle borderStyle = (LayoutBorderStyle) background.getValue();
if(borderStyle != null){
layout.setBorderStyle(borderStyle);
}
Item item = (Item) layoutComboBox.getSelectedItem();
Object value = item.getValue();
int state = 0;

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

@ -7,9 +7,8 @@ import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.BackgroundCompPane;
import com.fr.design.widget.ui.designer.component.MouseActionBackground;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.design.widget.ui.designer.component.TabFitLayoutBackgroundPane;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Inter;
@ -21,7 +20,7 @@ import java.awt.*;
*/
public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
private PaddingBoundPane paddingBoundPane;
private BackgroundCompPane borderStyle;
private TabFitLayoutBackgroundPane borderStyle;
private UISpinner componentInterval;
public WTabFitLayoutDefinePane(XCreator xCreator) {
@ -32,7 +31,7 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
public void initComponent() {
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
paddingBoundPane = new PaddingBoundPane();
borderStyle = new BackgroundCompPane();
borderStyle = new TabFitLayoutBackgroundPane();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style")), borderStyle}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7);
advancePane.add(jPanel, BorderLayout.NORTH);
advancePane.add(paddingBoundPane, BorderLayout.CENTER);
@ -55,8 +54,7 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
@Override
public void populateBean(WTabFitLayout ob) {
MouseActionBackground mouseActionBackground = new MouseActionBackground(ob.getInitialBackground(), ob.getOverBackground(), ob.getClickBackground());
borderStyle.populate(mouseActionBackground);
borderStyle.populate(ob);
paddingBoundPane.populate(ob);
componentInterval.setValue(ob.getCompInterval());
}
@ -65,10 +63,7 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
@Override
public WTabFitLayout updateBean() {
WTabFitLayout layout = (WTabFitLayout) creator.toData();
MouseActionBackground mouseActionBackground = borderStyle.update();
layout.setInitialBackground(mouseActionBackground.getInitialBackground());
layout.setOverBackground(mouseActionBackground.getOverBackground());
layout.setClickBackground(mouseActionBackground.getClickBackground());
borderStyle.update(layout);
paddingBoundPane.update(layout);
layout.setCompInterval((int)componentInterval.getValue());
return layout;

2
designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java

@ -42,7 +42,7 @@ public abstract class WTitleLayoutDefinePane<T extends AbstractBorderStyleWidget
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style")), borderStyleEditor}
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
advancePane.add(panel, BorderLayout.NORTH);
JPanel centerPane = createCenterPane();
if(centerPane!=null){

Loading…
Cancel
Save