zpc 8 years ago
parent
commit
9aca6f02cb
  1. 130
      designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java
  2. 12
      designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java
  3. 7
      designer/src/com/fr/design/widget/CellWidgetCardPane.java
  4. 2
      designer/src/com/fr/design/widget/ui/ButtonDefinePane.java
  5. 15
      designer/src/com/fr/design/widget/ui/CheckBoxDefinePane.java
  6. 12
      designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java
  7. 2
      designer/src/com/fr/design/widget/ui/CustomWritableRepeatEditorPane.java
  8. 64
      designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java
  9. 13
      designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java
  10. 219
      designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java
  11. 15
      designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java
  12. 17
      designer/src/com/fr/design/widget/ui/MultiFileEditorPane.java
  13. 32
      designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java
  14. 5
      designer/src/com/fr/design/widget/ui/RadioGroupDefinePane.java
  15. 146
      designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java
  16. 4
      designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java
  17. 2
      designer/src/com/fr/design/widget/ui/WritableRepeatEditorPane.java
  18. 4
      designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java
  19. 6
      designer/src/com/fr/design/widget/ui/btn/TreeNodeToogleButtonDefinePane.java
  20. 192
      designer_base/src/com/fr/design/beans/location/Absorptionline.java
  21. 2
      designer_base/src/com/fr/design/beans/location/MoveUtils.java
  22. 10
      designer_base/src/com/fr/design/extra/PluginManagerPane.java
  23. 76
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  24. 185
      designer_base/src/com/fr/design/gui/frpane/RegPane.java
  25. 21
      designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java
  26. 17
      designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java
  27. 19
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  28. 2
      designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  29. 3
      designer_form/src/com/fr/design/designer/creator/XButton.java
  30. 2
      designer_form/src/com/fr/design/designer/creator/XChartEditor.java
  31. 2
      designer_form/src/com/fr/design/designer/creator/XCheckBox.java
  32. 30
      designer_form/src/com/fr/design/designer/creator/XCheckBoxGroup.java
  33. 11
      designer_form/src/com/fr/design/designer/creator/XComboBox.java
  34. 16
      designer_form/src/com/fr/design/designer/creator/XComboCheckBox.java
  35. 2
      designer_form/src/com/fr/design/designer/creator/XCustomWriteAbleRepeatEditor.java
  36. 25
      designer_form/src/com/fr/design/designer/creator/XDateEditor.java
  37. 4
      designer_form/src/com/fr/design/designer/creator/XDirectWriteEditor.java
  38. 2
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  39. 48
      designer_form/src/com/fr/design/designer/creator/XFieldEditor.java
  40. 2
      designer_form/src/com/fr/design/designer/creator/XLabel.java
  41. 31
      designer_form/src/com/fr/design/designer/creator/XNumberEditor.java
  42. 47
      designer_form/src/com/fr/design/designer/creator/XPassword.java
  43. 17
      designer_form/src/com/fr/design/designer/creator/XRadioGroup.java
  44. 65
      designer_form/src/com/fr/design/designer/creator/XTextArea.java
  45. 66
      designer_form/src/com/fr/design/designer/creator/XTextEditor.java
  46. 4
      designer_form/src/com/fr/design/designer/creator/XTreeComboBoxEditor.java
  47. 18
      designer_form/src/com/fr/design/designer/creator/XTreeEditor.java
  48. 94
      designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  49. 8
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  50. 12
      designer_form/src/com/fr/design/designer/properties/AbsoluteStateRenderer.java
  51. 12
      designer_form/src/com/fr/design/designer/properties/AbsoluteStateWrapper.java
  52. 94
      designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java
  53. 19
      designer_form/src/com/fr/design/designer/properties/items/FRAbsoluteConstraintsItems.java
  54. 1
      designer_form/src/com/fr/design/form/util/XCreatorConstants.java
  55. 5
      designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessiblePropertyEditor.java
  56. 13
      designer_form/src/com/fr/design/mainframe/widget/editors/AbsoluteLayoutDirectionEditor.java

130
designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java

@ -0,0 +1,130 @@
package com.fr.design.report.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.report.mobile.ElementCaseMobileAttr;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by kunsnat on 2016/8/3.
*/
public class MobileUseHtmlGroupPane extends BasicBeanPane<ElementCaseMobileAttr> {
private List<UIRadioButton> radioButtons = new ArrayList<UIRadioButton>();
public MobileUseHtmlGroupPane() {
initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(UITitledBorder.createBorderWithTitle(this.title4PopupWindow()));
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {p, p, p};
UIRadioButton useApp = new UIRadioButton(Inter.getLocText("FR-mobile_native_analysis"));
useApp.setSelected(true);
UIRadioButton useHTML5 = new UIRadioButton(Inter.getLocText("FR-mobile_html_analysis"));
addToButtonGroup(useApp, useHTML5);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_style")), useApp, useHTML5},
new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_annotation")), null, null}
};
JPanel usePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
usePane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10));
this.add(usePane);
}
private void addToButtonGroup(UIRadioButton... radios) {
ButtonGroup buttonGroup = new ButtonGroup();
for (UIRadioButton radio : radios) {
radioButtons.add(radio);
buttonGroup.add(radio);
}
}
/**
* 设置按钮状态
*/
public void setEnabled(boolean enabled) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.setEnabled(enabled);
}
}
/**
* 获取当前选中的按钮index
*
* @return 按钮index
*/
public int getSelectRadioIndex() {
for (int i = 0, len = radioButtons.size(); i < len; i++) {
if (radioButtons.get(i).isSelected()) {
return i;
}
}
return 0;
}
/**
* 选中指定index的按钮
*/
public void selectIndexButton(int index) {
if (index < 0 || index > radioButtons.size() - 1) {
return;
}
UIRadioButton button = radioButtons.get(index);
button.setSelected(true);
}
/**
* 给所有的按钮加上监听
*/
public void addActionListener(ActionListener actionListener) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.addActionListener(actionListener);
}
}
@Override
public void populateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) {
selectIndexButton(mobileAttr.isUseHTML() ? 1 : 0);
}
}
@Override
public ElementCaseMobileAttr updateBean() {
return null;
}
@Override
public void updateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) {
mobileAttr.setUseHTML(getSelectRadioIndex() == 1);
}
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-mobile_report_analysis");
}
}

12
designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java

@ -14,6 +14,8 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
private AppFitBrowserPane appFitBrowserPane; private AppFitBrowserPane appFitBrowserPane;
private MobileUseHtmlGroupPane htmlGroupPane;
public ReportMobileAttrPane() { public ReportMobileAttrPane() {
initComponents(); initComponents();
} }
@ -27,6 +29,8 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane); appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane);
this.add(appFitBrowserPane); this.add(appFitBrowserPane);
this.add(htmlGroupPane = new MobileUseHtmlGroupPane());
this.add(appFitPreviewPane); this.add(appFitPreviewPane);
} }
@ -37,11 +41,17 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
} }
appFitBrowserPane.populateBean(ob); appFitBrowserPane.populateBean(ob);
htmlGroupPane.populateBean(ob);
} }
@Override @Override
public ElementCaseMobileAttr updateBean() { public ElementCaseMobileAttr updateBean() {
return appFitBrowserPane.updateBean(); ElementCaseMobileAttr caseMobileAttr = appFitBrowserPane.updateBean();
htmlGroupPane.updateBean(caseMobileAttr);
return caseMobileAttr;
} }
@Override @Override

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

@ -86,7 +86,12 @@ public class CellWidgetCardPane extends BasicPane {
attriPane.remove(widgetPropertyPane); attriPane.remove(widgetPropertyPane);
widgetPropertyPane = new BasicWidgetPropertySettingPane(); widgetPropertyPane = new BasicWidgetPropertySettingPane();
attriPane.add(widgetPropertyPane, BorderLayout.NORTH); JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
northPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 0, 8));
JPanel basic = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Form-Basic_Properties"));
northPane.add(basic);
basic.add(widgetPropertyPane);
attriPane.add(northPane, BorderLayout.NORTH);
WidgetDefinePaneFactory.RN rn = WidgetDefinePaneFactory.createWidgetDefinePane(cellWidget, new Operator() { WidgetDefinePaneFactory.RN rn = WidgetDefinePaneFactory.createWidgetDefinePane(cellWidget, new Operator() {
@Override @Override

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

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

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

@ -21,23 +21,16 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
} }
private void iniComoponents() { private void iniComoponents() {
// this.setLayout(FRGUIPaneFactory.createBorderLayout());
//
// UILabel infoLabel = new UILabel();
// FRFont frFont = FRContext.getDefaultValues().getFRFont();
// infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24));
// infoLabel.setText(Inter.getLocText(
// "No_Editor_Property_Definition") + ".");
// infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
//
// this.add(infoLabel, BorderLayout.CENTER);
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8));
JPanel textPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel textPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
textPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); textPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced"));
advancedPane.add(textPane);
textPane.add(new UILabel(Inter.getLocText("Text") + ":")); textPane.add(new UILabel(Inter.getLocText("Text") + ":"));
text = new UITextField(8); text = new UITextField(8);
textPane.add(text); textPane.add(text);
this.add(textPane); this.add(advancedPane);
} }
@Override @Override

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

@ -41,14 +41,8 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); attrPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
// JPanel northPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); advancedPane.add(attrPane);
// checkBoxDictPane = new CheckBoxDictPane();
// northPane.add(checkBoxDictPane);
// checkbox = new UICheckBox(Inter.getLocText(new String[]{"Provide", "Choose_All"}));
// northPane.add(checkbox);
// attrPane.add(northPane, BorderLayout.NORTH);
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
checkBoxDictPane = new CheckBoxDictPane(); checkBoxDictPane = new CheckBoxDictPane();
@ -67,7 +61,7 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup
centerPane.add(buttonGroupDictPane); centerPane.add(buttonGroupDictPane);
attrPane.add(centerPane, BorderLayout.CENTER); attrPane.add(centerPane, BorderLayout.CENTER);
return attrPane; return advancedPane;
} }
@Override @Override

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

@ -1 +1 @@
package com.fr.design.widget.ui; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.ui.CustomWriteAbleRepeatEditor; import com.fr.general.Inter; import javax.swing.*; import java.awt.*; /** * Author : Shockway * Date: 13-9-18 * Time: 下午2:17 */ public abstract class CustomWritableRepeatEditorPane<T extends CustomWriteAbleRepeatEditor> extends WritableRepeatEditorPane<T> { private UICheckBox customDataCheckBox; public CustomWritableRepeatEditorPane() { this.initComponents(); } @Override protected JPanel setThirdContentPane() { JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); contentPane.add(contenter, BorderLayout.NORTH); this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false); contenter.add(this.customDataCheckBox); JPanel otherContentPane = this.setForthContentPane(); if (otherContentPane != null) { contentPane.add(otherContentPane,BorderLayout.CENTER); } return contentPane; } protected abstract JPanel setForthContentPane(); protected void populateSubWritableRepeatEditorBean(T e) { this.customDataCheckBox.setSelected(e.isCustomData()); populateSubCustomWritableRepeatEditorBean(e); } protected abstract void populateSubCustomWritableRepeatEditorBean(T e); protected T updateSubWritableRepeatEditorBean() { T e = updateSubCustomWritableRepeatEditorBean(); e.setCustomData(this.customDataCheckBox.isSelected()); return e; } protected abstract T updateSubCustomWritableRepeatEditorBean(); } package com.fr.design.widget.ui; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.CustomWriteAbleRepeatEditor; import com.fr.general.Inter; import javax.swing.*; import java.awt.*; /** * Author : Shockway * Date: 13-9-18 * Time: 下午2:17 */ public abstract class CustomWritableRepeatEditorPane<T extends CustomWriteAbleRepeatEditor> extends WritableRepeatEditorPane<T> { private UICheckBox customDataCheckBox; public CustomWritableRepeatEditorPane() { this.initComponents(); } @Override protected JPanel setThirdContentPane() { JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false); this.customDataCheckBox.setPreferredSize(new Dimension(100, 30)); getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{this.customDataCheckBox}, FlowLayout.LEFT, 5)); JPanel otherContentPane = this.setForthContentPane(); if (otherContentPane != null) { contentPane.add(otherContentPane,BorderLayout.CENTER); } return contentPane; } protected abstract JPanel setForthContentPane(); protected void populateSubWritableRepeatEditorBean(T e) { this.customDataCheckBox.setSelected(e.isCustomData()); populateSubCustomWritableRepeatEditorBean(e); } protected abstract void populateSubCustomWritableRepeatEditorBean(T e); protected T updateSubWritableRepeatEditorBean() { T e = updateSubCustomWritableRepeatEditorBean(); e.setCustomData(this.customDataCheckBox.isSelected()); return e; } protected abstract T updateSubCustomWritableRepeatEditorBean(); }

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

@ -9,8 +9,8 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.DateEditor; import com.fr.form.ui.DateEditor;
import com.fr.general.ComparatorUtils;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.script.Calculator; import com.fr.script.Calculator;
@ -21,9 +21,9 @@ import com.fr.stable.UtilEvalError;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
@ -32,8 +32,6 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
private UILabel sampleLabel;// preview private UILabel sampleLabel;// preview
// content // content
private UITextField patternTextField = null; private UITextField patternTextField = null;
private JList patternList = null;
private ValueEditorPane startDv; private ValueEditorPane startDv;
private ValueEditorPane endDv; private ValueEditorPane endDv;
@ -53,43 +51,39 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
@Override @Override
protected JPanel setSecondContentPane() { protected JPanel setSecondContentPane() {
JPanel otherContentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel otherContentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
otherContentPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
JPanel returnTypePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel returnTypePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
returnTypePane.add(new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), BorderLayout.WEST); 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 = new UIComboBox(new String[] { Inter.getLocText("String"), Inter.getLocText("Date") });
returnTypeComboBox.setPreferredSize(new Dimension(70, 20));
returnTypePane.add(returnTypeComboBox, BorderLayout.CENTER); returnTypePane.add(returnTypeComboBox, BorderLayout.CENTER);
otherContentPane.add(returnTypePane); JPanel firstPanel = GUICoreUtils.createFlowPane(new JComponent[]{returnTypePane}, FlowLayout.LEFT, 5);
firstPanel.setPreferredSize(new Dimension(141,30));
otherContentPane.add(firstPanel);
// sample pane // sample pane
JPanel samplePane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("StyleFormat-Sample"));
otherContentPane.add(samplePane, BorderLayout.NORTH);
sampleLabel = new UILabel(""); sampleLabel = new UILabel("");
samplePane.add(sampleLabel, BorderLayout.CENTER); // samplePane.add(sampleLabel, BorderLayout.CENTER);
sampleLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 4)); sampleLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 4));
sampleLabel.setHorizontalAlignment(SwingConstants.CENTER); sampleLabel.setHorizontalAlignment(SwingConstants.CENTER);
sampleLabel.setFont(FRContext.getDefaultValues().getFRFont()); sampleLabel.setFont(FRContext.getDefaultValues().getFRFont());
// content pane // content pane
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
otherContentPane.add(contentPane, BorderLayout.CENTER);
contentPane.setBorder(BorderFactory.createEmptyBorder(4, 0, 2, 0));
patternTextField = new UITextField(); patternTextField = new UITextField();
contentPane.add(patternTextField, BorderLayout.NORTH);
patternTextField.getDocument().addDocumentListener(patternTextDocumentListener); patternTextField.getDocument().addDocumentListener(patternTextDocumentListener);
patternList = new JList(new DefaultListModel());
DefaultListModel model = (DefaultListModel) patternList.getModel();
model.removeAllElements();
String[] arr = getDateFormateArray(); String[] arr = getDateFormateArray();
for (int i = 0; i < arr.length; i++) { final UIComboBox comboBox = new UIComboBox(arr);
model.addElement(arr[i]); comboBox.setPreferredSize(new Dimension(150,20));
} comboBox.addActionListener(new ActionListener(){
JScrollPane pScrollPane = new JScrollPane(patternList); public void actionPerformed(ActionEvent e){
pScrollPane.setPreferredSize(new Dimension(100, 120)); patternTextField.setText( (String)comboBox.getSelectedItem());
contentPane.add(pScrollPane, BorderLayout.CENTER); }
patternList.addListSelectionListener(patternListSelectionListener);
});
JPanel secondPanel = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"),comboBox,sampleLabel}, FlowLayout.LEFT, 5);
secondPanel.setPreferredSize(new Dimension(220,30));
otherContentPane.add(secondPanel);
otherContentPane.add(initStartEndDatePane(), BorderLayout.SOUTH); otherContentPane.add(initStartEndDatePane(), BorderLayout.SOUTH);
return otherContentPane; return otherContentPane;
} }
@ -146,12 +140,6 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
} }
} }
private ListSelectionListener patternListSelectionListener = new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) {
patternTextField.setText((String) patternList.getSelectedValue());
}
};
@Override @Override
protected void populateSubDirectWriteEditorBean(DateEditor e) { protected void populateSubDirectWriteEditorBean(DateEditor e) {
String formatText = e.getFormatText(); String formatText = e.getFormatText();
@ -160,18 +148,6 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 1 : 0); returnTypeComboBox.setSelectedIndex(e.isReturnDate() ? 1 : 0);
populateStartEnd(e); populateStartEnd(e);
DefaultListModel patternModel = (DefaultListModel) patternList.getModel();
if ((formatText == null || formatText.length() <= 0)) {
patternList.setSelectedIndex(0);
} else {
for (int i = 0; i < patternModel.size(); i++) {
if (ComparatorUtils.equals(patternModel.getElementAt(i).toString(), formatText)) {
patternList.setSelectedIndex(i);
return;
}
}
}
}; };
@Override @Override

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

@ -2,10 +2,12 @@ package com.fr.design.widget.ui;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.DirectWriteEditor; import com.fr.form.ui.DirectWriteEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
//richer:需要提供能否直接编辑的控件设置面板——下拉框、复选框、时间、日期、下拉树 //richer:需要提供能否直接编辑的控件设置面板——下拉框、复选框、时间、日期、下拉树
public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> extends FieldEditorDefinePane<T> { public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> extends FieldEditorDefinePane<T> {
@ -21,17 +23,18 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
contentPane.add(contenter);
directWriteCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_Edit"), false); directWriteCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_Edit"), false);
contenter.add(directWriteCheckBox); directWriteCheckBox.setPreferredSize(new Dimension(100, 30));
getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 5));
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
waterMarkDictPane = new WaterMarkDictPane(); waterMarkDictPane = new WaterMarkDictPane();
contenter.add(waterMarkDictPane); advancedPane.add(contentPane);
contentPane.add(waterMarkDictPane);
JPanel otherContentPane = this.setSecondContentPane(); JPanel otherContentPane = this.setSecondContentPane();
if (otherContentPane != null) { if (otherContentPane != null) {
contentPane.add(otherContentPane); contentPane.add(otherContentPane);
} }
return contentPane; return advancedPane;
} }
protected abstract JPanel setSecondContentPane(); protected abstract JPanel setSecondContentPane();

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

@ -1,112 +1,143 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import javax.swing.BorderFactory; import javax.swing.*;
import com.fr.design.gui.frpane.TreeSettingPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.present.dict.DictionaryPane; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.FieldEditor; import com.fr.form.ui.FieldEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.widget.DataModify;
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> { public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> {
private UICheckBox allowBlankCheckBox; private UICheckBox allowBlankCheckBox;
// richer:错误信息,是所有控件共有的属性,所以放到这里来 // richer:错误信息,是所有控件共有的属性,所以放到这里来
private UITextField errorMsgTextField; private UITextField errorMsgTextField;
private UITextField regErrorMsgTextField;
public FieldEditorDefinePane() { private JPanel validatePane;
this.initComponents();
} public FieldEditorDefinePane() {
this.initComponents();
protected void initComponents() { }
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); protected void initComponents() {
this.add(northPane, BorderLayout.NORTH); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel firstPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); this.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8));
firstPanel.setBorder(BorderFactory.createEmptyBorder(0, -2, 0, 0)); regErrorMsgTextField = new UITextField(16);
//JPanel firstPanel = FRGUIPaneFactory.createBorderLayout_M_Pane(); regErrorMsgTextField.getDocument().addDocumentListener(new DocumentListener() {
allowBlankCheckBox = new UICheckBox(Inter.getLocText("Allow_Blank")); public void changedUpdate(DocumentEvent e) {
// 是否允许为空 regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText());
firstPanel.add(allowBlankCheckBox); }
allowBlankCheckBox.addItemListener(new ItemListener() {
public void insertUpdate(DocumentEvent e) {
@Override regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText());
public void itemStateChanged(ItemEvent e) { }
errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected());
} public void removeUpdate(DocumentEvent e) {
}); regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText());
}
// 错误信息 });
JPanel errorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
firstPanel.add(errorMsgPane); //JPanel firstPanel = FRGUIPaneFactory.createBorderLayout_M_Pane();
northPane.add(firstPanel); allowBlankCheckBox = new UICheckBox(Inter.getLocText("Allow_Blank"));
errorMsgPane.add(new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":")); allowBlankCheckBox.setPreferredSize(new Dimension(75, 30));
errorMsgTextField = new UITextField(16); allowBlankCheckBox.addItemListener(new ItemListener() {
errorMsgPane.add(errorMsgTextField);
@Override
// richer:主要为了方便查看比较长的错误信息 public void itemStateChanged(ItemEvent e) {
errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected());
}
public void changedUpdate(DocumentEvent e) { });
errorMsgTextField.setToolTipText(errorMsgTextField.getText());
} // 错误信息
JPanel errorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
public void insertUpdate(DocumentEvent e) { errorMsgPane.add(new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"));
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); errorMsgTextField = new UITextField(16);
} errorMsgPane.add(errorMsgTextField);
public void removeUpdate(DocumentEvent e) { // richer:主要为了方便查看比较长的错误信息
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() {
}
}); public void changedUpdate(DocumentEvent e) {
JPanel contentPane = this.setFirstContentPane(); errorMsgTextField.setToolTipText(errorMsgTextField.getText());
if (contentPane != null) { }
//contentPane.add(firstPanel);
this.add(contentPane, BorderLayout.CENTER); public void insertUpdate(DocumentEvent e) {
} else { errorMsgTextField.setToolTipText(errorMsgTextField.getText());
//this.add(firstPanel, BorderLayout.CENTER); }
}
} public void removeUpdate(DocumentEvent e) {
errorMsgTextField.setToolTipText(errorMsgTextField.getText());
@Override }
public void populateBean(T ob) { });
this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); this.addAllowBlankPane(allowBlankCheckBox);
errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); JPanel contentPane = this.setFirstContentPane();
this.errorMsgTextField.setText(ob.getErrorMessage()); if (contentPane != null) {
//contentPane.add(firstPanel);
populateSubFieldEditorBean(ob); this.add(contentPane, BorderLayout.NORTH);
} } else {
//this.add(firstPanel, BorderLayout.CENTER);
protected abstract void populateSubFieldEditorBean(T ob); }
}
@Override
public T updateBean() { @Override
T e = updateSubFieldEditorBean(); public void populateBean(T ob) {
this.allowBlankCheckBox.setSelected(ob.isAllowBlank());
e.setAllowBlank(this.allowBlankCheckBox.isSelected()); errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected());
e.setErrorMessage(this.errorMsgTextField.getText()); this.errorMsgTextField.setText(ob.getErrorMessage());
return e; populateSubFieldEditorBean(ob);
} }
protected abstract T updateSubFieldEditorBean(); protected abstract void populateSubFieldEditorBean(T ob);
protected abstract JPanel setFirstContentPane(); @Override
public T updateBean() {
@Override T e = updateSubFieldEditorBean();
public void checkValid() throws Exception {
e.setAllowBlank(this.allowBlankCheckBox.isSelected());
} e.setErrorMessage(this.errorMsgTextField.getText());
return e;
}
protected abstract T updateSubFieldEditorBean();
protected abstract JPanel setFirstContentPane();
@Override
public void checkValid() throws Exception {
}
public void addAllowBlankPane(UICheckBox allowBlankCheckBox) {
JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate"));
validatePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
validatePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
northPane.add(validatePane);
this.add(northPane, BorderLayout.CENTER);
JPanel firstPane = GUICoreUtils.createFlowPane(new JComponent[]{allowBlankCheckBox}, FlowLayout.LEFT, 5);
validatePane.add(firstPane);
JPanel secondPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), errorMsgTextField}, FlowLayout.LEFT, 24);
secondPane.setPreferredSize(new Dimension(310, 23));
validatePane.add(secondPane);
}
public JPanel getValidatePane() {
return validatePane;
}
public UITextField getRegErrorMsgTextField() {
return regErrorMsgTextField;
}
} }

15
designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java

@ -1,7 +1,6 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Dimension;
import java.util.List; import java.util.List;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -18,6 +17,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.present.dict.DictionaryPane; import com.fr.design.present.dict.DictionaryPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.IframeEditor; import com.fr.form.ui.IframeEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
@ -36,6 +36,7 @@ public class IframeEditorDefinePane extends AbstractDataModify<IframeEditor> {
private void initComponents() { private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8));
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
JPanel attr = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); JPanel attr = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
@ -51,9 +52,15 @@ public class IframeEditorDefinePane extends AbstractDataModify<IframeEditor> {
{ new UILabel(Inter.getLocText("Form-Url") + ":"), srcTextField = new UITextField() }, { new UILabel(Inter.getLocText("Form-Url") + ":"), srcTextField = new UITextField() },
{ new UILabel(Inter.getLocText("Parameter") + ":"), parameterViewPane = new ReportletParameterViewPane() } }; { new UILabel(Inter.getLocText("Parameter") + ":"), parameterViewPane = new ReportletParameterViewPane() } };
parameterViewPane.setPreferredSize(new Dimension(400, 256)); parameterViewPane.setPreferredSize(new Dimension(400, 256));
JPanel centerPane = TableLayoutHelper.createTableLayoutPane(coms, rowSize, columnSize); JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
centerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
centerPane.add(GUICoreUtils.createFlowPane(new UILabel(Inter.getLocText("Form-Url") + ":"), srcTextField = new UITextField(16), FlowLayout.LEFT));
centerPane.add(GUICoreUtils.createFlowPane( new UILabel(Inter.getLocText("Parameter") + ":"), parameterViewPane = new ReportletParameterViewPane(), FlowLayout.LEFT));
parameterViewPane.setPreferredSize(new Dimension(540, 235));
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
advancedPane.add(contentPane);
contentPane.add(centerPane); contentPane.add(centerPane);
this.add(contentPane, BorderLayout.CENTER); this.add(advancedPane, BorderLayout.CENTER);
} }

17
designer/src/com/fr/design/widget/ui/MultiFileEditorPane.java

@ -1,16 +1,17 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Dimension;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.*;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.DictionaryComboBox; import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.gui.icombobox.DictionaryConstants; import com.fr.design.gui.icombobox.DictionaryConstants;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.MultiFileEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -32,7 +33,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
@Override @Override
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays);
acceptType.setPreferredSize(new Dimension(400, 18)); acceptType.setPreferredSize(new Dimension(200, 18));
singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD")); singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD"));
fileSizeField = new UINumberField(); fileSizeField = new UINumberField();
fileSizeField.setPreferredSize(new Dimension(80, 18)); fileSizeField.setPreferredSize(new Dimension(80, 18));
@ -40,20 +41,22 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
singleFilePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
singleFilePane.add(singleFileCheckBox); singleFilePane.add(singleFileCheckBox);
centerPane.add(singleFilePane, BorderLayout.NORTH); getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{singleFilePane}, FlowLayout.LEFT,0));
JPanel allowTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); JPanel allowTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
allowTypePane.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); allowTypePane.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
allowTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
allowTypePane.add(new UILabel(" " + Inter.getLocText("File-Allow_Upload_Files") + ":")); allowTypePane.add(new UILabel(" " + Inter.getLocText("File-Allow_Upload_Files") + ":"));
allowTypePane.add(acceptType); allowTypePane.add(acceptType);
centerPane.add(allowTypePane, BorderLayout.CENTER); getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{allowTypePane}, FlowLayout.LEFT,5));
JPanel fileSizePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); JPanel fileSizePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
fileSizePane.add(new UILabel(" " + Inter.getLocText("File-File_Size_Limit") + ":")); fileSizePane.add(new UILabel(" " + Inter.getLocText("File-File_Size_Limit") + ":"));
fileSizePane.add(fileSizeField); fileSizePane.add(fileSizeField);
fileSizePane.add(new UILabel(" KB")); fileSizePane.add(new UILabel(" KB"));
allowTypePane.add(fileSizePane); getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{fileSizePane}, FlowLayout.LEFT,11));
return centerPane; return centerPane;
} }

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

@ -121,9 +121,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if (setMaxValueCheckBox.isSelected()) { if (setMaxValueCheckBox.isSelected()) {
if (setMinValueCheckBox.isSelected()) { if (setMinValueCheckBox.isSelected()) {
minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue())); minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue()));
} }
} }
} }
}; };
@ -133,9 +133,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if (setMinValueCheckBox.isSelected()) { if (setMinValueCheckBox.isSelected()) {
if (setMaxValueCheckBox.isSelected()) { if (setMaxValueCheckBox.isSelected()) {
maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue())); maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue()));
} }
} }
} }
}; };
@ -153,26 +153,26 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
@Override @Override
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
JPanel content = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel content = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
content.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); content.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
content.setLayout(FRGUIPaneFactory.createBorderLayout()); content.setLayout(FRGUIPaneFactory.createBorderLayout());
// richer:数字的允许直接编辑没有意义 // richer:数字的允许直接编辑没有意义
JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
content.add(northPane, BorderLayout.NORTH); content.add(northPane, BorderLayout.NORTH);
waterMarkDictPane = new WaterMarkDictPane(); waterMarkDictPane = new WaterMarkDictPane();
northPane.add(waterMarkDictPane); northPane.add(waterMarkDictPane);
content.add(northPane, BorderLayout.NORTH);
this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals")); this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals"));
this.decimalLength = new com.fr.design.editor.editor.IntegerEditor(); this.decimalLength = new com.fr.design.editor.editor.IntegerEditor();
this.decimalLength.setColumns(4); this.decimalLength.setColumns(4);
limitNumberPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Double", "Numbers"}) + ":"), this.decimalLength}, limitNumberPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Double", "Numbers"}) + ":"), this.decimalLength},
FlowLayout.LEFT, 4); FlowLayout.LEFT, 4);
northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowDecimalsCheckBox, limitNumberPane}, FlowLayout.LEFT, 4)); getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowDecimalsCheckBox, limitNumberPane}, FlowLayout.LEFT, 4));
this.allowDecimalsCheckBox.addActionListener(actionListener1); this.allowDecimalsCheckBox.addActionListener(actionListener1);
this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative")); this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative"));
northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowNegativeCheckBox}, FlowLayout.LEFT, 4)); getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowNegativeCheckBox}, FlowLayout.LEFT, 4));
this.allowNegativeCheckBox.addActionListener(actionListener2); this.allowNegativeCheckBox.addActionListener(actionListener2);
this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false); this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false);
@ -180,7 +180,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
maxValueSpinner.setPreferredSize(new Dimension(120, 20)); maxValueSpinner.setPreferredSize(new Dimension(120, 20));
setNotAllowsInvalid(this.maxValueSpinner); setNotAllowsInvalid(this.maxValueSpinner);
northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMaxValueCheckBox, this.maxValueSpinner}, FlowLayout.LEFT, 4)); getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMaxValueCheckBox, this.maxValueSpinner}, FlowLayout.LEFT, 4));
this.maxValueSpinner.setVisible(false); this.maxValueSpinner.setVisible(false);
this.setMaxValueCheckBox.addActionListener(actionListener3); this.setMaxValueCheckBox.addActionListener(actionListener3);
this.maxValueSpinner.addChangeListener(changeListener1); this.maxValueSpinner.addChangeListener(changeListener1);
@ -189,10 +189,12 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D));
minValueSpinner.setPreferredSize(new Dimension(120, 20)); minValueSpinner.setPreferredSize(new Dimension(120, 20));
setNotAllowsInvalid(this.minValueSpinner); setNotAllowsInvalid(this.minValueSpinner);
northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMinValueCheckBox, this.minValueSpinner}, FlowLayout.LEFT, 4)); getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMinValueCheckBox, this.minValueSpinner}, FlowLayout.LEFT, 4));
this.minValueSpinner.setVisible(false); this.minValueSpinner.setVisible(false);
this.setMinValueCheckBox.addActionListener(actionListener4); this.setMinValueCheckBox.addActionListener(actionListener4);
this.minValueSpinner.addChangeListener(changeListener2); this.minValueSpinner.addChangeListener(changeListener2);
getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), getRegErrorMsgTextField()}, FlowLayout.LEFT, 24));
return content; return content;
} }
@ -227,7 +229,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
minValueSpinner.setVisible(true); minValueSpinner.setVisible(true);
minValueSpinner.setValue(new Double(e.getMinValue())); minValueSpinner.setValue(new Double(e.getMinValue()));
} }
this.getRegErrorMsgTextField().setText(e.getRegErrorMessage());
this.waterMarkDictPane.populate(e); this.waterMarkDictPane.populate(e);
} }
@ -255,6 +257,8 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
this.waterMarkDictPane.update(ob); this.waterMarkDictPane.update(ob);
ob.setRegErrorMessage(this.getRegErrorMsgTextField().getText());
return ob; return ob;
} }

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

@ -10,6 +10,7 @@ import com.fr.design.data.DataCreatorUI;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.present.dict.DictionaryPane; import com.fr.design.present.dict.DictionaryPane;
import com.fr.form.ui.RadioGroup; import com.fr.form.ui.RadioGroup;
import com.fr.general.Inter;
public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> { public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> {
private DictionaryPane dictPane; private DictionaryPane dictPane;
@ -34,8 +35,10 @@ public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> {
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
buttonGroupDictPane = new ButtonGroupDictPane(); buttonGroupDictPane = new ButtonGroupDictPane();
buttonGroupDictPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); buttonGroupDictPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
centerPane.add(buttonGroupDictPane); centerPane.add(buttonGroupDictPane);
attrPane.add(centerPane, BorderLayout.CENTER); advancedPane.add(centerPane);
attrPane.add(advancedPane, BorderLayout.CENTER);
return attrPane; return attrPane;
} }

146
designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java

@ -1,91 +1,107 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.gui.frpane.RegPane; import com.fr.design.gui.frpane.RegPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.TextEditor; import com.fr.form.ui.TextEditor;
import com.fr.form.ui.reg.RegExp;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor> { public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor> {
protected RegPane regPane; protected RegPane regPane;
private WaterMarkDictPane waterMarkDictPane; private WaterMarkDictPane waterMarkDictPane;
public TextFieldEditorDefinePane() { public TextFieldEditorDefinePane() {
this.initComponents(); this.initComponents();
} }
@Override @Override
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); regPane = createRegPane();
JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() {
contenter.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
attrPane.add(contenter, BorderLayout.NORTH);
regPane = createRegPane();
final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() {
@Override @Override
public void regChangeAction() { public void regChangeAction() {
waterMarkDictPane.setWaterMark(""); waterMarkDictPane.setWaterMark("");
regPane.removeRegChangeListener(this); regPane.removeRegChangeListener(this);
} }
}; };
final RegPane.PhoneRegListener pl = new RegPane.PhoneRegListener() { final RegPane.PhoneRegListener pl = new RegPane.PhoneRegListener() {
public void phoneRegChangeAction(RegPane.PhoneRegEvent e) { public void phoneRegChangeAction(RegPane.PhoneRegEvent e) {
if (StringUtils.isNotEmpty(e.getPhoneRegString()) if (StringUtils.isNotEmpty(e.getPhoneRegString())
&& StringUtils.isEmpty(waterMarkDictPane.getWaterMark())) { && StringUtils.isEmpty(waterMarkDictPane.getWaterMark())) {
waterMarkDictPane.setWaterMark(Inter.getLocText("Example") + ":" + e.getPhoneRegString()); waterMarkDictPane.setWaterMark(Inter.getLocText("Example") + ":" + e.getPhoneRegString());
regPane.addRegChangeListener(rl); regPane.addRegChangeListener(rl);
} }
} }
}; };
regPane.addPhoneRegListener(pl); regPane.addPhoneRegListener(pl);
getValidatePane().add(GUICoreUtils.createFlowPane(regPane, FlowLayout.LEFT));
getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), getRegErrorMsgTextField()}, FlowLayout.LEFT, 24));
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
waterMarkDictPane = new WaterMarkDictPane();
waterMarkDictPane.addInputKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent e) {
regPane.removePhoneRegListener(pl);
regPane.removeRegChangeListener(rl);
waterMarkDictPane.removeInputKeyListener(this);
}
});
//监听填写规则下拉框的值的变化
regPane.getRegComboBox().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
RegExp regExp = (RegExp) regPane.getRegComboBox().getSelectedItem();
if (!StringUtils.isNotEmpty(regExp.toRegText())) {
getRegErrorMsgTextField().setEnabled(false);
} else {
getRegErrorMsgTextField().setEnabled(true);
}
waterMarkDictPane = new WaterMarkDictPane(); }
waterMarkDictPane.addInputKeyListener(new KeyAdapter() { });
public void keyTyped(KeyEvent e) { advancedPane.add(waterMarkDictPane);
regPane.removePhoneRegListener(pl); attrPane.add(advancedPane, BorderLayout.NORTH);
regPane.removeRegChangeListener(rl); return attrPane;
waterMarkDictPane.removeInputKeyListener(this); }
}
});
contenter.add(regPane, BorderLayout.NORTH);
contenter.add(waterMarkDictPane, BorderLayout.CENTER);
return attrPane;
}
protected RegPane createRegPane() { protected RegPane createRegPane() {
return new RegPane(); return new RegPane();
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "text"; return "text";
} }
@Override @Override
protected void populateSubFieldEditorBean(TextEditor e) { protected void populateSubFieldEditorBean(TextEditor e) {
this.regPane.populate(e.getRegex()); this.regPane.populate(e.getRegex());
waterMarkDictPane.populate(e); getRegErrorMsgTextField().setText(e.getRegErrorMessage());
} waterMarkDictPane.populate(e);
}
@Override @Override
protected TextEditor updateSubFieldEditorBean() { protected TextEditor updateSubFieldEditorBean() {
TextEditor ob = newTextEditorInstance(); TextEditor ob = newTextEditorInstance();
ob.setRegErrorMessage(this.getRegErrorMsgTextField().getText());
ob.setRegex(this.regPane.update());
waterMarkDictPane.update(ob);
ob.setRegex(this.regPane.update()); return ob;
waterMarkDictPane.update(ob); }
return ob; protected TextEditor newTextEditorInstance() {
} return new TextEditor();
}
protected TextEditor newTextEditorInstance() {
return new TextEditor();
}
} }

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

@ -46,7 +46,9 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane<TreeEditor> {
} }
protected JPanel setSecondContentPane() { protected JPanel setSecondContentPane() {
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
advancedPane.add(contentPane);
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
contentPane.add(contenter,BorderLayout.NORTH); contentPane.add(contenter,BorderLayout.NORTH);
@ -56,7 +58,7 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane<TreeEditor> {
if (otherContentPane != null) { if (otherContentPane != null) {
contentPane.add(otherContentPane,BorderLayout.CENTER); contentPane.add(otherContentPane,BorderLayout.CENTER);
} }
return contentPane; return advancedPane;
} }
protected JPanel setThirdContentPane() { protected JPanel setThirdContentPane() {

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

@ -17,8 +17,6 @@ public abstract class WritableRepeatEditorPane<E extends WriteAbleRepeatEditor>
protected JPanel setSecondContentPane() { protected JPanel setSecondContentPane() {
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
contentPane.add(contenter,BorderLayout.NORTH);
JPanel otherContentPane = this.setThirdContentPane(); JPanel otherContentPane = this.setThirdContentPane();
if (otherContentPane != null) { if (otherContentPane != null) {
contentPane.add(otherContentPane,BorderLayout.CENTER); contentPane.add(otherContentPane,BorderLayout.CENTER);

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

@ -20,7 +20,9 @@ public abstract class WriteUnableRepeatEditorPane<E extends WriteUnableRepeatEdi
@Override @Override
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
advancedPane.add(contentPane);
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
JPanel contenter=FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); JPanel contenter=FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
removeRepeatCheckBox = new UICheckBox(Inter.getLocText("Form-Remove_Repeat_Data"), false); removeRepeatCheckBox = new UICheckBox(Inter.getLocText("Form-Remove_Repeat_Data"), false);
@ -29,7 +31,7 @@ public abstract class WriteUnableRepeatEditorPane<E extends WriteUnableRepeatEdi
JPanel otherContentPane = this.setThirdContentPane(); JPanel otherContentPane = this.setThirdContentPane();
if (otherContentPane != null) if (otherContentPane != null)
contentPane.add(otherContentPane,BorderLayout.CENTER); contentPane.add(otherContentPane,BorderLayout.CENTER);
return contentPane; return advancedPane;
} }
protected abstract JPanel setThirdContentPane(); protected abstract JPanel setThirdContentPane();
@Override @Override

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

@ -29,12 +29,14 @@ public class TreeNodeToogleButtonDefinePane<T extends TreeNodeToggleButton> exte
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double rowSize[] = {p}; double rowSize[] = {p};
double columnSize[] = {p, 300}; double columnSize[] = {p, 184};
Component[][] n_components = { Component[][] n_components = {
{new UILabel(Inter.getLocText(new String[]{"Form-Button", "Type"}) + ":"), createButtonTypeComboBox()} {new UILabel(Inter.getLocText(new String[]{"Form-Button", "Type"}) + ":"), createButtonTypeComboBox()}
}; };
JPanel northPane = TableLayoutHelper.createTableLayoutPane(n_components, rowSize, columnSize); JPanel northPane = TableLayoutHelper.createTableLayoutPane(n_components, rowSize, columnSize);
add(northPane, BorderLayout.CENTER); JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
advancedPane.add(northPane);
add(advancedPane, BorderLayout.CENTER);
} }
@Override @Override

192
designer_base/src/com/fr/design/beans/location/Absorptionline.java

@ -14,6 +14,7 @@ public class Absorptionline {
// 2.(x,y)(x±2根号3,y-2)(x±2根号3,y+2) // 2.(x,y)(x±2根号3,y-2)(x±2根号3,y+2)
private static int RECTANGLE_OFFSET_X = 2; private static int RECTANGLE_OFFSET_X = 2;
private static int RECTANGLE_OFFSET_Y = 3; private static int RECTANGLE_OFFSET_Y = 3;
private static int WIDGET_DISTANCE_MIN = 8;
//控件周围八个拖拽框的大小 //控件周围八个拖拽框的大小
private static int RESIZE_BOX_SIZE = 5; private static int RESIZE_BOX_SIZE = 5;
@ -238,114 +239,155 @@ public class Absorptionline {
//朝向上方的等距线 //朝向上方的等距线
private void paintTopEquidistantLine(Graphics g){ private void paintTopEquidistantLine(Graphics g){
int x1[] = { int x[] = {
equidistantStart.x + equidistantStart.width / 2, equidistantStart.x + equidistantStart.width / 2,
equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X, equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X,
equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X
}; };
int y1[] = { int[] y1, y2;
top, if (equidistantStart.y - top > WIDGET_DISTANCE_MIN) {
top + RECTANGLE_OFFSET_Y, y1 = new int[] {
top + RECTANGLE_OFFSET_Y top,
}; top + RECTANGLE_OFFSET_Y,
int x2[] = { top + RECTANGLE_OFFSET_Y
equidistantStart.x + equidistantStart.width / 2, };
equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X, y2 = new int[]{
equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X equidistantStart.y - RESIZE_BOX_SIZE,
}; equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y,
int y2[] = { equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y
equidistantStart.y - RESIZE_BOX_SIZE, };
equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y, }
equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y else{
}; y1 = new int[] {
g.fillPolygon(x1, y1, 3); top,
g.fillPolygon(x2, y2, 3); top - RECTANGLE_OFFSET_Y,
top - RECTANGLE_OFFSET_Y
};
y2 = new int[] {
equidistantStart.y,
equidistantStart.y + RECTANGLE_OFFSET_Y,
equidistantStart.y + RECTANGLE_OFFSET_Y
};
}
g.fillPolygon(x, y1, 3);
g.fillPolygon(x, y2, 3);
GraphHelper.drawLine(g, GraphHelper.drawLine(g,
equidistantStart.x + equidistantStart.width / 2, top, equidistantStart.x + equidistantStart.width / 2, top,
equidistantStart.x + equidistantStart.width / 2, equidistantStart.y - RESIZE_BOX_SIZE); equidistantStart.x + equidistantStart.width / 2, equidistantStart.y - RESIZE_BOX_SIZE);
} }
//朝向左侧的等距线 //朝向左侧的等距线
private void paintLeftEquidistantLine(Graphics g){ private void paintLeftEquidistantLine(Graphics g){
int x1[] = { int y[] = {
left,
left + RECTANGLE_OFFSET_Y,
left + RECTANGLE_OFFSET_Y,
};
int y1[] = {
equidistantStart.y + equidistantStart.height / 2, equidistantStart.y + equidistantStart.height / 2,
equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X, equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X,
equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X, equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X,
}; };
int x2[] = { int[] x1, x2;
equidistantStart.x - RESIZE_BOX_SIZE, if (equidistantStart.x - left > WIDGET_DISTANCE_MIN) {
equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y, x1 = new int[] {
equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y left,
}; left + RECTANGLE_OFFSET_Y,
int y2[] = { left + RECTANGLE_OFFSET_Y,
equidistantStart.y + equidistantStart.height / 2, };
equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X,
equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X x2 = new int[] {
}; equidistantStart.x - RESIZE_BOX_SIZE,
g.fillPolygon(x1, y1, 3); equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y,
g.fillPolygon(x2, y2, 3); equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y
};
}
else{
x1 = new int[] {
left,
left - RECTANGLE_OFFSET_Y,
left - RECTANGLE_OFFSET_Y,
};
x2 = new int[] {
equidistantStart.x,
equidistantStart.x + RECTANGLE_OFFSET_Y,
equidistantStart.x + RECTANGLE_OFFSET_Y
};
}
g.fillPolygon(x1, y, 3);
g.fillPolygon(x2, y, 3);
GraphHelper.drawLine(g, GraphHelper.drawLine(g,
left, equidistantStart.y + equidistantStart.height / 2, left, equidistantStart.y + equidistantStart.height / 2,
equidistantStart.x - RESIZE_BOX_SIZE, equidistantStart.y + equidistantStart.height / 2); equidistantStart.x, equidistantStart.y + equidistantStart.height / 2);
} }
//朝向下方的等距线 //朝向下方的等距线
private void paintBottomEquidistantLine(Graphics g) { private void paintBottomEquidistantLine(Graphics g) {
int x1[] = { int x[] = {
equidistantStart.x + equidistantStart.width / 2, equidistantStart.x + equidistantStart.width / 2,
equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X, equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X,
equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X, equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X,
}; };
int y1[] = { int[] y1, y2;
equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE, if (bottom - equidistantStart.y + equidistantStart.height > WIDGET_DISTANCE_MIN) {
equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, y1 = new int[] {
equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE,
}; equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y,
int x2[] = { equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y,
equidistantStart.x + equidistantStart.width / 2, };
equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X, y2 = new int[] {
equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X bottom,
}; bottom - RECTANGLE_OFFSET_Y,
int y2[] = { bottom - RECTANGLE_OFFSET_Y
bottom, };
bottom - RECTANGLE_OFFSET_Y, }
bottom - RECTANGLE_OFFSET_Y else{
}; y1 = new int[] {
g.fillPolygon(x1, y1, 3); equidistantStart.y + equidistantStart.height,
g.fillPolygon(x2, y2, 3); equidistantStart.y + equidistantStart.height - RECTANGLE_OFFSET_Y,
equidistantStart.y + equidistantStart.height - RECTANGLE_OFFSET_Y,
};
y2 = new int[] {
bottom,
bottom + RECTANGLE_OFFSET_Y,
bottom + RECTANGLE_OFFSET_Y
};
}
g.fillPolygon(x, y1, 3);
g.fillPolygon(x, y2, 3);
GraphHelper.drawLine(g, GraphHelper.drawLine(g,
equidistantStart.x + equidistantStart.width / 2, equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE, equidistantStart.x + equidistantStart.width / 2, equidistantStart.y + equidistantStart.height,
equidistantStart.x + equidistantStart.width / 2, bottom); equidistantStart.x + equidistantStart.width / 2, bottom);
} }
//朝向右侧的等距线 //朝向右侧的等距线
private void paintRightEquidistantLine(Graphics g){ private void paintRightEquidistantLine(Graphics g){
int x1[] = { int y[] = {
right,
right - 3,
right - 3
};
int y1[] = {
equidistantStart.y + equidistantStart.height / 2, equidistantStart.y + equidistantStart.height / 2,
equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X, equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X,
equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X
}; };
int x2[] = { int[] x1, x2;
equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE, if(right - equidistantStart.x > WIDGET_DISTANCE_MIN) {
equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, x1 = new int[]{
equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y right,
}; right - RECTANGLE_OFFSET_Y,
int y2[] = { right - RECTANGLE_OFFSET_Y
equidistantStart.y + equidistantStart.height / 2, };
equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X, x2 = new int[]{
equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X, equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE,
}; equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y,
g.fillPolygon(x1, y1, 3); equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y
g.fillPolygon(x2, y2, 3); };
}
else{
x1 = new int[]{
right,
right + RECTANGLE_OFFSET_Y,
right + RECTANGLE_OFFSET_Y
};
x2 = new int[]{
equidistantStart.x + equidistantStart.width,
equidistantStart.x + equidistantStart.width - RECTANGLE_OFFSET_Y,
equidistantStart.x + equidistantStart.width - RECTANGLE_OFFSET_Y
};
}
g.fillPolygon(x1, y, 3);
g.fillPolygon(x2, y, 3);
GraphHelper.drawLine(g, GraphHelper.drawLine(g,
equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE, equidistantStart.y + equidistantStart.height / 2, equidistantStart.x + equidistantStart.width, equidistantStart.y + equidistantStart.height / 2,
right, equidistantStart.y + equidistantStart.height / 2); right, equidistantStart.y + equidistantStart.height / 2);
} }
} }

2
designer_base/src/com/fr/design/beans/location/MoveUtils.java

@ -468,6 +468,7 @@ public class MoveUtils {
equidistantLines.add(equidistantLines1[0]); equidistantLines.add(equidistantLines1[0]);
equidistantLines.add(equidistantLines1[2]); equidistantLines.add(equidistantLines1[2]);
pEquidistantY.palce = operatingRectangle.y - offset / 2; pEquidistantY.palce = operatingRectangle.y - offset / 2;
operatingRectangle.y = pEquidistantY.palce;
} }
} }
if (equidistantLines1[1] != null && equidistantLines1[3] != null){//left, right if (equidistantLines1[1] != null && equidistantLines1[3] != null){//left, right
@ -477,6 +478,7 @@ public class MoveUtils {
equidistantLines.add(equidistantLines1[1]); equidistantLines.add(equidistantLines1[1]);
equidistantLines.add(equidistantLines1[3]); equidistantLines.add(equidistantLines1[3]);
pEquidistantX.palce = operatingRectangle.x - offset / 2; pEquidistantX.palce = operatingRectangle.x - offset / 2;
operatingRectangle.x = pEquidistantX.palce;
} }
} }
} }

10
designer_base/src/com/fr/design/extra/PluginManagerPane.java

@ -67,6 +67,16 @@ public class PluginManagerPane extends BasicPane {
} }
} }
/**
* 以关键词打开设计器商店
*
* @param keyword 关键词
*/
public PluginManagerPane(String keyword) {
this();
PluginWebBridge.getHelper().openWithSearch(keyword);
}
private void addPane(String installHome) { private void addPane(String installHome) {
PluginWebPane webPane = new PluginWebPane(new File(installHome).getAbsolutePath()); PluginWebPane webPane = new PluginWebPane(new File(installHome).getAbsolutePath());
add(webPane, BorderLayout.CENTER); add(webPane, BorderLayout.CENTER);

76
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -6,7 +6,6 @@ import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.*; import com.fr.design.extra.exe.*;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.plugin.Plugin; import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLicense; import com.fr.plugin.PluginLicense;
import com.fr.plugin.PluginLicenseManager; import com.fr.plugin.PluginLicenseManager;
@ -18,13 +17,14 @@ import javafx.scene.web.WebEngine;
import javafx.stage.FileChooser; import javafx.stage.FileChooser;
import javafx.stage.Stage; import javafx.stage.Stage;
import netscape.javascript.JSObject; import netscape.javascript.JSObject;
import org.json.JSONObject;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.*;
import java.util.List; import java.util.List;
/** /**
@ -35,6 +35,26 @@ public class PluginWebBridge {
private static PluginWebBridge helper; private static PluginWebBridge helper;
private UIDialog uiDialog; private UIDialog uiDialog;
private ACTIONS action;
private String ACTION = "action";
private String KEYWORD = "keyword";
private Map<String, Object> config;
/**
* 动作枚举
*/
public enum ACTIONS {
SEARCH("search");
private String context;
ACTIONS(String context) {
this.context = context;
}
public String getContext() {
return context;
}
}
public static PluginWebBridge getHelper() { public static PluginWebBridge getHelper() {
if (helper != null) { if (helper != null) {
@ -59,6 +79,54 @@ public class PluginWebBridge {
private PluginWebBridge() { private PluginWebBridge() {
} }
/**
* 获取打开动作配置
*
* @return 配置信息
*/
public String getRunConfig() {
if (action != null) {
JSONObject jsonObject = new JSONObject();
jsonObject.put(ACTION, action.getContext());
Set<String> keySet = config.keySet();
for (String key : keySet) {
jsonObject.put(key, config.get(key).toString());
}
return jsonObject.toString();
}
return StringUtils.EMPTY;
}
/**
* 配置打开动作
*
* @param action 动作
* @param config 参数
*/
public void setRunConfig(ACTIONS action, Map<String, Object> config) {
this.action = action;
this.config = config;
}
/**
* 清楚打开动作
*/
public void clearRunConfig() {
this.action = null;
this.config = null;
}
/**
* 打开时搜索
*
* @param keyword 关键词
*/
public void openWithSearch(String keyword) {
HashMap<String, Object> map = new HashMap<String, Object>(2);
map.put(KEYWORD, keyword);
setRunConfig(ACTIONS.SEARCH, map);
}
public void setEngine(WebEngine webEngine) { public void setEngine(WebEngine webEngine) {
this.webEngine = webEngine; this.webEngine = webEngine;
} }
@ -203,7 +271,7 @@ public class PluginWebBridge {
* *
* @return 已安装的插件授权对象 * @return 已安装的插件授权对象
*/ */
public PluginLicense getPluginLicenseByID(String pluginID ) { public PluginLicense getPluginLicenseByID(String pluginID) {
return PluginLicenseManager.getInstance().getPluginLicenseByID(pluginID); return PluginLicenseManager.getInstance().getPluginLicenseByID(pluginID);
} }
@ -296,7 +364,7 @@ public class PluginWebBridge {
/** /**
* 在本地浏览器里打开url * 在本地浏览器里打开url
* tips:重载的时候,需要给js调用的方法需要放在前面,否则可能不会被调用(此乃坑) * tips:重载的时候,需要给js调用的方法需要放在前面,否则可能不会被调用(此乃坑)
* 所以最好的是不要重载在js可以访问的接口文件中 * 所以最好的是不要重载在js可以访问的接口文件中
* *
* @param url 要打开的地址 * @param url 要打开的地址
*/ */

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

@ -48,15 +48,15 @@ public class RegPane extends BasicPane {
new MobileReg(), new MobileReg(),
new CustomReg() new CustomReg()
}; };
public static final RegExp[] TEXTAREA_REG_TYPE = { public static final RegExp[] TEXTAREA_REG_TYPE = {
new NoneReg(), new NoneReg(),
new LengthReg(), new LengthReg(),
new CustomReg() new CustomReg()
}; };
public static final RegExp[] PASSWORD_REG_TYPE = TEXTAREA_REG_TYPE; public static final RegExp[] PASSWORD_REG_TYPE = TEXTAREA_REG_TYPE;
private RegExp[] regType; private RegExp[] regType;
private UIComboBox regComboBox; private UIComboBox regComboBox;
private CardLayout detailedCardLayout; private CardLayout detailedCardLayout;
@ -64,16 +64,21 @@ public class RegPane extends BasicPane {
private RegPhonePane regPhonePane; private RegPhonePane regPhonePane;
private DefaultRegPane defaultRegPane; private DefaultRegPane defaultRegPane;
private CustomRegRexPane customRegRexPane; private CustomRegRexPane customRegRexPane;
public UIComboBox getRegComboBox(){
return regComboBox;
}
public RegPane() { public RegPane() {
this(ALL_REG_TYPE); this(ALL_REG_TYPE);
} }
public RegPane(RegExp[] types) { public RegPane(RegExp[] types) {
this.regType = types; this.regType = types;
this.initComponents(); this.initComponents();
} }
private void initComponents(){ private void initComponents(){
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
JPanel contentPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); JPanel contentPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
@ -82,7 +87,7 @@ public class RegPane extends BasicPane {
regComboBox = new UIComboBox(regType); regComboBox = new UIComboBox(regType);
regComboBox.setRenderer(listCellRender); regComboBox.setRenderer(listCellRender);
contentPane.add(regComboBox); contentPane.add(regComboBox);
final JPanel cardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); final JPanel cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
detailedCardLayout = new CardLayout(); detailedCardLayout = new CardLayout();
cardPane.setLayout(detailedCardLayout); cardPane.setLayout(detailedCardLayout);
@ -90,7 +95,7 @@ public class RegPane extends BasicPane {
cardPane.add((regLengthPane = new RegLengthPane()), "Length"); cardPane.add((regLengthPane = new RegLengthPane()), "Length");
cardPane.add((regPhonePane = new RegPhonePane()), "Phone"); cardPane.add((regPhonePane = new RegPhonePane()), "Phone");
cardPane.add((customRegRexPane = new CustomRegRexPane()), "Custom"); cardPane.add((customRegRexPane = new CustomRegRexPane()), "Custom");
this.add(cardPane); this.add(cardPane);
regComboBox.addActionListener(new ActionListener(){ regComboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -111,15 +116,15 @@ public class RegPane extends BasicPane {
} }
fireRegChangeAction(); fireRegChangeAction();
} }
} }
}); });
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Input_Rule"); return Inter.getLocText("FR-Designer_Input_Rule");
} }
private int getRegTypeIndex(RegExp regex) { private int getRegTypeIndex(RegExp regex) {
if (regex != null) { if (regex != null) {
for (int i = 0; i < regType.length; i++) { for (int i = 0; i < regType.length; i++) {
@ -131,7 +136,7 @@ public class RegPane extends BasicPane {
return 0; return 0;
} }
public void populate(RegExp regex) { public void populate(RegExp regex) {
regComboBox.setSelectedIndex(getRegTypeIndex(regex)); regComboBox.setSelectedIndex(getRegTypeIndex(regex));
if (regex instanceof LengthReg) { if (regex instanceof LengthReg) {
@ -144,111 +149,111 @@ public class RegPane extends BasicPane {
defaultRegPane.populate(regex); defaultRegPane.populate(regex);
} }
} }
public RegExp update(){ public RegExp update(){
RegExp regExp = (RegExp)regComboBox.getSelectedItem(); RegExp regExp = (RegExp)regComboBox.getSelectedItem();
if (regExp instanceof LengthReg){ if (regExp instanceof LengthReg){
return regLengthPane.update(); return regLengthPane.update();
} else if(regExp instanceof PhoneReg) { } else if(regExp instanceof PhoneReg) {
return regPhonePane.update(); return regPhonePane.update();
} else if(regExp instanceof NoneReg || regExp instanceof MailReg || regExp instanceof IDCardReg } else if(regExp instanceof NoneReg || regExp instanceof MailReg || regExp instanceof IDCardReg
|| regExp instanceof PostCardReg || regExp instanceof PhoneReg || regExp instanceof MobileReg) { || regExp instanceof PostCardReg || regExp instanceof PhoneReg || regExp instanceof MobileReg) {
return regExp; return regExp;
} }
else if (regExp instanceof CustomReg){ else if (regExp instanceof CustomReg){
if (customRegRexPane.isEmpty()) { if (customRegRexPane.isEmpty()) {
return new NoneReg(); return new NoneReg();
} }
return customRegRexPane.update(); return customRegRexPane.update();
} else { } else {
return defaultRegPane.update(); return defaultRegPane.update();
} }
} }
private static abstract class DisplayPane extends BasicPane { private static abstract class DisplayPane extends BasicPane {
public abstract void populate(RegExp regRex); public abstract void populate(RegExp regRex);
public abstract RegExp update(); public abstract RegExp update();
} }
private static class DefaultRegPane extends DisplayPane { private static class DefaultRegPane extends DisplayPane {
public RegExp regRex; public RegExp regRex;
public DefaultRegPane(){ public DefaultRegPane(){
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "Default"; return "Default";
} }
@Override @Override
public void populate(RegExp regRex) { public void populate(RegExp regRex) {
} }
@Override @Override
public RegExp update() { public RegExp update() {
return this.regRex; return this.regRex;
} }
} }
/** /**
* 添加电话规则监听器 * 添加电话规则监听器
* *
* @param listener 监听器 * @param listener 监听器
* *
* *
* @date 2014-12-3-下午7:30:55 * @date 2014-12-3-下午7:30:55
* *
*/ */
public void addPhoneRegListener(PhoneRegListener listener) { public void addPhoneRegListener(PhoneRegListener listener) {
this.listenerList.add(PhoneRegListener.class, listener); this.listenerList.add(PhoneRegListener.class, listener);
} }
/** /**
* 移除电话规则监听器 * 移除电话规则监听器
* *
* @param listener 监听器 * @param listener 监听器
* *
* *
* @date 2014-12-3-下午7:30:55 * @date 2014-12-3-下午7:30:55
* *
*/ */
public void removePhoneRegListener(PhoneRegListener listener) { public void removePhoneRegListener(PhoneRegListener listener) {
this.listenerList.remove(PhoneRegListener.class, listener); this.listenerList.remove(PhoneRegListener.class, listener);
} }
/** /**
* 添加正则监听器 * 添加正则监听器
* *
* @param listener 监听器 * @param listener 监听器
* *
* *
* @date 2014-12-3-下午7:29:48 * @date 2014-12-3-下午7:29:48
* *
*/ */
public void addRegChangeListener(RegChangeListener listener) { public void addRegChangeListener(RegChangeListener listener) {
this.listenerList.add(RegChangeListener.class, listener); this.listenerList.add(RegChangeListener.class, listener);
} }
/** /**
* 移除正则监听器 * 移除正则监听器
* *
* @param listener 监听器 * @param listener 监听器
* *
* *
* @date 2014-12-3-下午7:29:48 * @date 2014-12-3-下午7:29:48
* *
*/ */
public void removeRegChangeListener(RegChangeListener listener) { public void removeRegChangeListener(RegChangeListener listener) {
this.listenerList.remove(RegChangeListener.class, listener); this.listenerList.remove(RegChangeListener.class, listener);
} }
public class PhoneRegEvent extends EventObject { public class PhoneRegEvent extends EventObject {
private String phoneRegString; private String phoneRegString;
public PhoneRegEvent(Object source, String phoneRegString) { public PhoneRegEvent(Object source, String phoneRegString) {
@ -275,48 +280,48 @@ public class RegPane extends BasicPane {
return regString; return regString;
} }
} }
public interface PhoneRegListener extends EventListener{ public interface PhoneRegListener extends EventListener{
/** /**
* 电话规则变化监听 * 电话规则变化监听
* *
* @param e 变化事件 * @param e 变化事件
* *
* *
* @date 2014-12-3-下午7:29:01 * @date 2014-12-3-下午7:29:01
* *
*/ */
void phoneRegChangeAction(PhoneRegEvent e); void phoneRegChangeAction(PhoneRegEvent e);
} }
public interface RegChangeListener extends EventListener { public interface RegChangeListener extends EventListener {
/** /**
* 正则表达规则变化监听 * 正则表达规则变化监听
* *
* *
* @date 2014-12-3-下午7:29:01 * @date 2014-12-3-下午7:29:01
* *
*/ */
void regChangeAction(); void regChangeAction();
} }
protected void firePhoneRegAction(String phoneReg) { protected void firePhoneRegAction(String phoneReg) {
Object[] listeners = listenerList.getListenerList(); Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length-2; i>=0; i-=2) { for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==PhoneRegListener.class) { if (listeners[i]==PhoneRegListener.class) {
((PhoneRegListener)listeners[i+1]).phoneRegChangeAction(new PhoneRegEvent(this , phoneReg)); ((PhoneRegListener)listeners[i+1]).phoneRegChangeAction(new PhoneRegEvent(this , phoneReg));
} }
} }
} }
protected void fireRegChangeAction() { protected void fireRegChangeAction() {
Object[] listeners = listenerList.getListenerList(); Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length-2; i>=0; i-=2) { for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==RegChangeListener.class) { if (listeners[i]==RegChangeListener.class) {
((RegChangeListener)listeners[i+1]).regChangeAction(); ((RegChangeListener)listeners[i+1]).regChangeAction();
} }
} }
} }
private class RegPhonePane extends DisplayPane { private class RegPhonePane extends DisplayPane {
private static final String EMB_REG1 = "025-85679591"; private static final String EMB_REG1 = "025-85679591";
@ -324,7 +329,7 @@ public class RegPane extends BasicPane {
private static final String EMB_REG3 = "025 85679591"; private static final String EMB_REG3 = "025 85679591";
private static final int LIMIT_LENGTH = 20; private static final int LIMIT_LENGTH = 20;
private static final String REG_PATTERN = "0123456789-*# "; private static final String REG_PATTERN = "0123456789-*# ";
private UIComboBox dataTypeComboBox; private UIComboBox dataTypeComboBox;
private final String[] dataType = {EMB_REG1, EMB_REG2, EMB_REG3, Inter.getLocText("FR-Designer_Custom")}; private final String[] dataType = {EMB_REG1, EMB_REG2, EMB_REG3, Inter.getLocText("FR-Designer_Custom")};
DefaultComboBoxModel DefaultComboBoxModel= new DefaultComboBoxModel(dataType); DefaultComboBoxModel DefaultComboBoxModel= new DefaultComboBoxModel(dataType);
@ -357,7 +362,7 @@ public class RegPane extends BasicPane {
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "PHONE"; return "PHONE";
} }
@Override @Override
public void populate(RegExp regRex) { public void populate(RegExp regRex) {
if(!(regRex instanceof PhoneReg)) { if(!(regRex instanceof PhoneReg)) {
@ -369,13 +374,13 @@ public class RegPane extends BasicPane {
} }
dataTypeComboBox.setSelectedItem(((PhoneReg)regRex).getRegString()); dataTypeComboBox.setSelectedItem(((PhoneReg)regRex).getRegString());
} }
private boolean checkEmbedded(String regstr){ private boolean checkEmbedded(String regstr){
return !ComparatorUtils.equals(EMB_REG1, regstr) && return !ComparatorUtils.equals(EMB_REG1, regstr) &&
!ComparatorUtils.equals(EMB_REG2, regstr) && !ComparatorUtils.equals(EMB_REG2, regstr) &&
!ComparatorUtils.equals(EMB_REG3, regstr); !ComparatorUtils.equals(EMB_REG3, regstr);
} }
@Override @Override
public RegExp update() { public RegExp update() {
PhoneReg regRex = new PhoneReg(); PhoneReg regRex = new PhoneReg();
@ -383,11 +388,11 @@ public class RegPane extends BasicPane {
return regRex; return regRex;
} }
} }
private static class RegLengthPane extends DisplayPane { private static class RegLengthPane extends DisplayPane {
private UISpinner minLenSpinner; private UISpinner minLenSpinner;
private UISpinner maxLenSpinner; private UISpinner maxLenSpinner;
public RegLengthPane(){ public RegLengthPane(){
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length") + ":")); this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Min_Length") + ":"));
@ -395,9 +400,9 @@ public class RegPane extends BasicPane {
this.add(minLenSpinner); this.add(minLenSpinner);
this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":")); this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Max_Length") + ":"));
maxLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0); maxLenSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
this.add(maxLenSpinner); this.add(maxLenSpinner);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "LENGTH"; return "LENGTH";
@ -408,11 +413,11 @@ public class RegPane extends BasicPane {
if (!(regRex instanceof LengthReg)){ if (!(regRex instanceof LengthReg)){
return; return;
} }
int minLength = ((LengthReg)regRex).getMinLen(); int minLength = ((LengthReg)regRex).getMinLen();
int maxLength = ((LengthReg)regRex).getMaxLen(); int maxLength = ((LengthReg)regRex).getMaxLen();
minLenSpinner.setValue(minLength); minLenSpinner.setValue(minLength);
maxLenSpinner.setValue(maxLength); maxLenSpinner.setValue(maxLength);
} }
@Override @Override
@ -422,21 +427,21 @@ public class RegPane extends BasicPane {
LengthReg regRex = new LengthReg(); LengthReg regRex = new LengthReg();
regRex.setMinLen(startLength); regRex.setMinLen(startLength);
regRex.setMaxLen(endLength); regRex.setMaxLen(endLength);
return regRex; return regRex;
} }
} }
private static class CustomRegRexPane extends DisplayPane{ private static class CustomRegRexPane extends DisplayPane{
private UITextField regTextField; private UITextField regTextField;
public CustomRegRexPane(){ public CustomRegRexPane(){
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Expressions") + ":")); this.add(new UILabel(Inter.getLocText("FR-Designer_Reg_Expressions") + ":"));
regTextField = new UITextField(20); regTextField = new UITextField(20);
this.add(regTextField); this.add(regTextField);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "CUSTOM"; return "CUSTOM";
@ -451,19 +456,19 @@ public class RegPane extends BasicPane {
} }
@Override @Override
public RegExp update() { public RegExp update() {
return new CustomReg(regTextField.getText()); return new CustomReg(regTextField.getText());
} }
public boolean isEmpty() { public boolean isEmpty() {
return StringUtils.isEmpty(regTextField.getText()); return StringUtils.isEmpty(regTextField.getText());
} }
} }
ListCellRenderer listCellRender = new UIComboBoxRenderer(){ ListCellRenderer listCellRender = new UIComboBoxRenderer(){
@Override @Override
public Component getListCellRendererComponent(JList list, Object value, public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) { int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof NoneReg){ if (value instanceof NoneReg){
this.setText(Inter.getLocText("FR-Designer_None")); this.setText(Inter.getLocText("FR-Designer_None"));
@ -484,6 +489,6 @@ public class RegPane extends BasicPane {
} }
return this; return this;
} }
}; };
} }

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

@ -1,9 +1,8 @@
package com.fr.design.widget.btn; package com.fr.design.widget.btn;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Component;
import javax.swing.JPanel; import javax.swing.*;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
@ -32,7 +31,11 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
} }
private void initComponents() { private void initComponents() {
this.setLayout(new BorderLayout()); JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced"));
advancedPane.setPreferredSize(new Dimension(600,300));
JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4));
this.add(advancedPane);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double rowSize[] = {p, p, p, p}; double rowSize[] = {p, p, p, p};
double columnSize[] = {p, p}; double columnSize[] = {p, p};
@ -40,17 +43,17 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
iconPane = new IconDefinePane(); iconPane = new IconDefinePane();
labelPane.add(iconPane); labelPane.add(iconPane);
Component[][] n_components = { Component[][] n_components = {
{new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField = new UITextField(20)}, {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-Icon") + ":"), labelPane},
{new UILabel(Inter.getLocText("FR-Designer_Button-Type") + ":"), createButtonTypeComboBox()}, {new UILabel(Inter.getLocText("FR-Designer_Button-Type") + ":"), createButtonTypeComboBox()},
{new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField = new UITextField(40)} {new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField = new UITextField(16)}
}; };
hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ",")); hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ","));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 0, 4); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 0, 8);
add(panel,BorderLayout.NORTH); advancedPane.add(panel,BorderLayout.NORTH);
Component comp = createCenterPane(); Component comp = createCenterPane();
if(comp != null ) { if(comp != null ) {
add(comp,BorderLayout.CENTER); advancedPane.add(comp,BorderLayout.CENTER);
} }
} }

17
designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java

@ -100,7 +100,10 @@ public class CompositeComponentAdapter implements ComponentAdapter {
for (CRPropertyDescriptor property : properties) { for (CRPropertyDescriptor property : properties) {
String groupName = (String) property.getValue(XCreatorConstants.PROPERTY_CATEGORY); String groupName = (String) property.getValue(XCreatorConstants.PROPERTY_CATEGORY);
if (StringUtils.isEmpty(groupName)) { if (StringUtils.isEmpty(groupName)) {
groupName = XCreatorConstants.DEFAULT_GROUP_NAME; groupName = (String) property.getValue(XCreatorConstants.PROPERTY_VALIDATE);
if(StringUtils.isEmpty(groupName)){
groupName = XCreatorConstants.DEFAULT_GROUP_NAME;
}
} }
ArrayList<CRPropertyDescriptor> groupProperties = maps.get(groupName); ArrayList<CRPropertyDescriptor> groupProperties = maps.get(groupName);
if (groupProperties == null) { if (groupProperties == null) {
@ -110,6 +113,7 @@ public class CompositeComponentAdapter implements ComponentAdapter {
} }
groupProperties.add(property); groupProperties.add(property);
} }
adjustGroupNamesPosition(groupNames);
ArrayList<PropertyGroupModel> groups = new ArrayList<PropertyGroupModel>(); ArrayList<PropertyGroupModel> groups = new ArrayList<PropertyGroupModel>();
for (String groupName : groupNames) { for (String groupName : groupNames) {
ArrayList<CRPropertyDescriptor> groupProperties = maps.get(groupName); ArrayList<CRPropertyDescriptor> groupProperties = maps.get(groupName);
@ -120,6 +124,15 @@ public class CompositeComponentAdapter implements ComponentAdapter {
return groups; return groups;
} }
public void adjustGroupNamesPosition(ArrayList<String> groupNames){
for(String groupName : groupNames){
if(groupName.equals("Form-Basic_Properties")){
groupNames.remove(groupName);
groupNames.add(0,groupName);
break;
}
}
}
@Override @Override
public ArrayList<GroupModel> getXCreatorPropertyModel() { public ArrayList<GroupModel> getXCreatorPropertyModel() {
ArrayList<GroupModel> groupModels = new ArrayList<GroupModel>(); ArrayList<GroupModel> groupModels = new ArrayList<GroupModel>();
@ -130,7 +143,7 @@ public class CompositeComponentAdapter implements ComponentAdapter {
groupModels.addAll(groups); groupModels.addAll(groups);
return groupModels; return groupModels;
} }
/** /**
* 自适应布局中放置文本框等用的scaleLayout和报表块图表块支持的标题控件用的titleLayout时 * 自适应布局中放置文本框等用的scaleLayout和报表块图表块支持的标题控件用的titleLayout时
* 控件树处只显示父容器但是控件属性还是为自身的 * 控件树处只显示父容器但是控件属性还是为自身的

19
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

@ -2,14 +2,14 @@ package com.fr.design.designer.beans.adapters.layout;
import java.awt.*; import java.awt.*;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.ConstraintsGroupModel;
import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.HoverPainter;
import com.fr.design.designer.beans.painters.FRAbsoluteLayoutPainter; import com.fr.design.designer.beans.painters.FRAbsoluteLayoutPainter;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.properties.BoundsGroupModel; import com.fr.design.designer.properties.BoundsGroupModel;
import com.fr.design.designer.properties.FRAbsoluteLayoutPropertiesGroupModel;
import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
@ -67,6 +67,8 @@ public class FRAbsoluteLayoutAdapter extends AbstractLayoutAdapter {
} else { } else {
container.add(creator, creator.toData().getWidgetName()); container.add(creator, creator.toData().getWidgetName());
} }
XWAbsoluteLayout layout = (XWAbsoluteLayout) container;
layout.updateBoundsWidget(creator);
LayoutUtils.layoutRootContainer(container); LayoutUtils.layoutRootContainer(container);
} }
@ -84,6 +86,9 @@ public class FRAbsoluteLayoutAdapter extends AbstractLayoutAdapter {
WAbsoluteLayout wabs = (WAbsoluteLayout)container.toData(); WAbsoluteLayout wabs = (WAbsoluteLayout)container.toData();
fix(creator,creator.getX(),creator.getY()); fix(creator,creator.getX(),creator.getY());
wabs.setBounds(creator.toData(),creator.getBounds()); wabs.setBounds(creator.toData(),creator.getBounds());
XWAbsoluteLayout layout = (XWAbsoluteLayout) container;
layout.updateBoundsWidget(creator);
} }
/** /**
@ -112,4 +117,10 @@ public class FRAbsoluteLayoutAdapter extends AbstractLayoutAdapter {
public ConstraintsGroupModel getLayoutConstraints(XCreator creator) { public ConstraintsGroupModel getLayoutConstraints(XCreator creator) {
return new BoundsGroupModel((XWAbsoluteLayout)container, creator); return new BoundsGroupModel((XWAbsoluteLayout)container, creator);
} }
@Override
public GroupModel getLayoutProperties() {
XWAbsoluteLayout xwAbsoluteLayout = (XWAbsoluteLayout) container;
return new FRAbsoluteLayoutPropertiesGroupModel(xwAbsoluteLayout);
}
} }

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

@ -30,6 +30,8 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
private int cornerSize = 15; private int cornerSize = 15;
private int noneSize = 0; private int noneSize = 0;
protected static final Dimension BORDER_PREFERRED_SIZE = new Dimension(250, 150);
public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) { public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) {
super(widget, initSize); super(widget, initSize);
} }

3
designer_form/src/com/fr/design/designer/creator/XButton.java

@ -91,7 +91,7 @@ public class XButton extends XWidgetCreator {
protected CRPropertyDescriptor creatNonListenerStyle(int i) throws IntrospectionException{ protected CRPropertyDescriptor creatNonListenerStyle(int i) throws IntrospectionException{
CRPropertyDescriptor[] crPropertyDescriptors = { CRPropertyDescriptor[] crPropertyDescriptors = {
new CRPropertyDescriptor("text", this.data.getClass()).setI18NName( new CRPropertyDescriptor("text", this.data.getClass()).setI18NName(
Inter.getLocText(new String[] {"Form-Button", "Name"})), Inter.getLocText(new String[] {"Form-Button", "Name"})).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName( new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"Form-Button", "Style"})).setEditorClass( Inter.getLocText(new String[]{"Form-Button", "Style"})).setEditorClass(
ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
@ -164,6 +164,7 @@ public class XButton extends XWidgetCreator {
return new CRPropertyDescriptor[]{ return new CRPropertyDescriptor[]{
new CRPropertyDescriptor("text", this.data.getClass()) new CRPropertyDescriptor("text", this.data.getClass())
.setI18NName(Inter.getLocText(new String[] {"Form-Button", "Name"})) .setI18NName(Inter.getLocText(new String[] {"Form-Button", "Name"}))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() { .setPropertyChangeListener(new PropertyChangeAdapter() {
@Override @Override

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

@ -187,7 +187,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
* @return 返回大小. * @return 返回大小.
*/ */
public Dimension initEditorSize() { public Dimension initEditorSize() {
return new Dimension(250, 100); return BORDER_PREFERRED_SIZE;
} }
/** /**

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

@ -32,6 +32,7 @@ public class XCheckBox extends XWidgetCreator {
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[] { return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[] {
new CRPropertyDescriptor("text", this.data.getClass()).setI18NName(Inter.getLocText("Text")) new CRPropertyDescriptor("text", this.data.getClass()).setI18NName(Inter.getLocText("Text"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() { .setPropertyChangeListener(new PropertyChangeAdapter() {
@Override @Override
@ -41,6 +42,7 @@ public class XCheckBox extends XWidgetCreator {
}), }),
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class) Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class)
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() { .setPropertyChangeListener(new PropertyChangeAdapter() {
@Override @Override

30
designer_form/src/com/fr/design/designer/creator/XCheckBoxGroup.java

@ -34,35 +34,35 @@ public class XCheckBoxGroup extends XFieldEditor {
@Override @Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), getCRPropertyDescriptor()); CRPropertyDescriptor [] sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[] {
}
private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crp = new CRPropertyDescriptor[] {
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class), Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class)
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName( new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName(
Inter.getLocText("DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass( Inter.getLocText("DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass(
DictionaryRenderer.class), DictionaryRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")},super.supportedDescriptor());
CRPropertyDescriptor [] properties = (CRPropertyDescriptor[]) ArrayUtils.addAll(sup,getCRPropertyDescriptor());
return properties;
}
private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crp = new CRPropertyDescriptor[] {
new CRPropertyDescriptor("adaptive", this.data.getClass()).setI18NName(Inter.getLocText("Adaptive")) new CRPropertyDescriptor("adaptive", this.data.getClass()).setI18NName(Inter.getLocText("Adaptive"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced").setEditorClass(InChangeBooleanEditor.class), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced").setEditorClass(InChangeBooleanEditor.class),
new CRPropertyDescriptor("chooseAll", this.data.getClass()).setI18NName( new CRPropertyDescriptor("chooseAll", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"Provide", "Choose_All"})).putKeyValue( Inter.getLocText(new String[]{"Provide", "Choose_All"})).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("returnString", this.data.getClass()).setI18NName( new CRPropertyDescriptor("returnString", this.data.getClass()).setI18NName(
Inter.getLocText("Return-String")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( Inter.getLocText("Return-String")).setEditorClass(InChangeBooleanEditor.class)
XCreatorConstants.PROPERTY_CATEGORY, "Return-Value") }; .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") };
if (((CheckBoxGroup) this.toData()).isReturnString()) { if (((CheckBoxGroup) this.toData()).isReturnString()) {
crp = (CRPropertyDescriptor[]) ArrayUtils.addAll(crp, new CRPropertyDescriptor[] { crp = (CRPropertyDescriptor[]) ArrayUtils.addAll(crp, new CRPropertyDescriptor[] {
new CRPropertyDescriptor("delimiter", this.data.getClass()).setI18NName( new CRPropertyDescriptor("delimiter", this.data.getClass()).setI18NName(
Inter.getLocText("Form-Delimiter")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("Form-Delimiter")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
"Return-Value"),
new CRPropertyDescriptor("startSymbol", this.data.getClass()).setI18NName( new CRPropertyDescriptor("startSymbol", this.data.getClass()).setI18NName(
Inter.getLocText("ComboCheckBox-Start_Symbol")).putKeyValue( Inter.getLocText("ComboCheckBox-Start_Symbol")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
XCreatorConstants.PROPERTY_CATEGORY, "Return-Value"),
new CRPropertyDescriptor("endSymbol", this.data.getClass()).setI18NName( new CRPropertyDescriptor("endSymbol", this.data.getClass()).setI18NName(
Inter.getLocText("ComboCheckBox-End_Symbol")).putKeyValue( Inter.getLocText("ComboCheckBox-End_Symbol")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") });
XCreatorConstants.PROPERTY_CATEGORY, "Return-Value") });
} }
if (!((CheckBoxGroup) this.toData()).isAdaptive()) { if (!((CheckBoxGroup) this.toData()).isAdaptive()) {
crp = (CRPropertyDescriptor[]) ArrayUtils.add(crp, new CRPropertyDescriptor("columnsInRow", this.data crp = (CRPropertyDescriptor[]) ArrayUtils.add(crp, new CRPropertyDescriptor("columnsInRow", this.data

11
designer_form/src/com/fr/design/designer/creator/XComboBox.java

@ -10,6 +10,7 @@ import java.beans.IntrospectionException;
import javax.swing.JComponent; import javax.swing.JComponent;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.editors.DictionaryEditor; import com.fr.design.mainframe.widget.editors.DictionaryEditor;
@ -38,11 +39,11 @@ public class XComboBox extends XCustomWriteAbleRepeatEditor {
@Override @Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll( return (CRPropertyDescriptor[]) ArrayUtils.addAll(
super.supportedDescriptor(), new CRPropertyDescriptor[]{
new CRPropertyDescriptor[]{ new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class), new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass(DictionaryRenderer.class)
new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass(DictionaryRenderer.class) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
}); }, super.supportedDescriptor());
} }
@Override @Override

16
designer_form/src/com/fr/design/designer/creator/XComboCheckBox.java

@ -32,20 +32,20 @@ public class XComboCheckBox extends XComboBox {
Inter.getLocText("Form-Delimiter")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("Form-Delimiter")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY,
"Advanced"), "Advanced"),
new CRPropertyDescriptor("returnString", this.data.getClass()).setEditorClass( new CRPropertyDescriptor("returnString", this.data.getClass()).setEditorClass(
InChangeBooleanEditor.class).setI18NName(Inter.getLocText("Return-String")).putKeyValue( InChangeBooleanEditor.class).setI18NName(Inter.getLocText("Return-String"))
XCreatorConstants.PROPERTY_CATEGORY, "Return-Value") } : new CRPropertyDescriptor[] { .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") } : new CRPropertyDescriptor[] {
new CRPropertyDescriptor("delimiter", this.data.getClass()).setI18NName( new CRPropertyDescriptor("delimiter", this.data.getClass()).setI18NName(
Inter.getLocText("Form-Delimiter")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("Form-Delimiter")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY,
"Advanced"), "Advanced"),
new CRPropertyDescriptor("returnString", this.data.getClass()).setI18NName( new CRPropertyDescriptor("returnString", this.data.getClass()).setI18NName(
Inter.getLocText("Return-String")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( Inter.getLocText("Return-String")).setEditorClass(InChangeBooleanEditor.class)
XCreatorConstants.PROPERTY_CATEGORY, "Return-Value"), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("startSymbol", this.data.getClass()).setI18NName( new CRPropertyDescriptor("startSymbol", this.data.getClass()).setI18NName(
Inter.getLocText("ComboCheckBox-Start_Symbol")).putKeyValue( Inter.getLocText("ComboCheckBox-Start_Symbol"))
XCreatorConstants.PROPERTY_CATEGORY, "Return-Value"), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("endSymbol", this.data.getClass()).setI18NName( new CRPropertyDescriptor("endSymbol", this.data.getClass()).setI18NName(
Inter.getLocText("ComboCheckBox-End_Symbol")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("ComboCheckBox-End_Symbol"))
"Return-Value") }); .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") });
} }
@Override @Override

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

@ -1 +1 @@
package com.fr.design.designer.creator; import com.fr.form.ui.WriteAbleRepeatEditor; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import java.awt.*; import java.beans.IntrospectionException; /** * Author : Shockway * Date: 13-9-22 * Time: 上午10:40 */ public abstract class XCustomWriteAbleRepeatEditor extends XWriteAbleRepeatEditor { public XCustomWriteAbleRepeatEditor(WriteAbleRepeatEditor widget, Dimension initSize) { super(widget, initSize); } public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[] { new CRPropertyDescriptor("customData", this.data.getClass()).setI18NName(Inter.getLocText("Form-Allow_CustomData"))}); } } package com.fr.design.designer.creator; import com.fr.design.form.util.XCreatorConstants; import com.fr.form.ui.WriteAbleRepeatEditor; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import java.awt.*; import java.beans.IntrospectionException; /** * Author : Shockway * Date: 13-9-22 * Time: 上午10:40 */ public abstract class XCustomWriteAbleRepeatEditor extends XWriteAbleRepeatEditor { public XCustomWriteAbleRepeatEditor(WriteAbleRepeatEditor widget, Dimension initSize) { super(widget, initSize); } public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[] { new CRPropertyDescriptor("customData", this.data.getClass()).setI18NName(Inter.getLocText("Form-Allow_CustomData")) .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate")}); } }

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

@ -46,17 +46,20 @@ public class XDateEditor extends XDirectWriteEditor {
*/ */
@Override @Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), CRPropertyDescriptor [] tempt=(CRPropertyDescriptor[]) ArrayUtils.addAll(
new CRPropertyDescriptor[] { new CRPropertyDescriptor[] {
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass( Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(
WidgetValueEditor.class).setPropertyChangeListener(new PropertyChangeAdapter() { WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY,
"Advanced").setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() { @Override
initFieldText(); public void propertyChange() {
} initFieldText();
}), }
})},super.supportedDescriptor());
return (CRPropertyDescriptor[]) ArrayUtils.addAll(tempt,
new CRPropertyDescriptor[] {
new CRPropertyDescriptor("formatText", this.data.getClass()).setI18NName( new CRPropertyDescriptor("formatText", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Engine_Format")).setEditorClass(formatClass()).setRendererClass( Inter.getLocText("FR-Engine_Format")).setEditorClass(formatClass()).setRendererClass(
DateCellRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), DateCellRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
@ -66,11 +69,11 @@ public class XDateEditor extends XDirectWriteEditor {
new CRPropertyDescriptor("endDate", this.data.getClass()).setI18NName( new CRPropertyDescriptor("endDate", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_End-Date")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_End-Date")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY,
"Advanced").setEditorClass(DateRangeEditor.class), "Advanced").setEditorClass(DateRangeEditor.class),
new CRPropertyDescriptor("returnDate", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_Return-Date")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY,
"Return-Value"),
new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName( new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY,
"Advanced"),
new CRPropertyDescriptor("returnDate", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_Return-Date")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY,
"Advanced") "Advanced")
}); });
} }

4
designer_form/src/com/fr/design/designer/creator/XDirectWriteEditor.java

@ -6,6 +6,7 @@ package com.fr.design.designer.creator;
import java.awt.Dimension; import java.awt.Dimension;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.form.ui.DirectWriteEditor; import com.fr.form.ui.DirectWriteEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -24,6 +25,7 @@ public abstract class XDirectWriteEditor extends XFieldEditor {
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(),
new CRPropertyDescriptor[] { new CRPropertyDescriptor("directEdit", this.data.getClass()) new CRPropertyDescriptor[] { new CRPropertyDescriptor("directEdit", this.data.getClass())
.setI18NName(Inter.getLocText("Form-Allow_Edit")) }); .setI18NName(Inter.getLocText("Form-Allow_Edit")).putKeyValue(
XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate") });
} }
} }

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

@ -182,7 +182,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
* @return 尺寸 * @return 尺寸
*/ */
public Dimension initEditorSize() { public Dimension initEditorSize() {
return new Dimension(250, 100); return BORDER_PREFERRED_SIZE;
} }
/** /**

48
designer_form/src/com/fr/design/designer/creator/XFieldEditor.java

@ -13,8 +13,11 @@ import javax.swing.border.Border;
import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor; import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor;
import com.fr.form.ui.FieldEditor; import com.fr.form.ui.FieldEditor;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.reg.RegExp;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
/** /**
* @author richer * @author richer
@ -22,8 +25,8 @@ import com.fr.stable.ArrayUtils;
*/ */
public abstract class XFieldEditor extends XWidgetCreator { public abstract class XFieldEditor extends XWidgetCreator {
protected static final Border FIELDBORDER = BorderFactory.createLineBorder(new Color(128, 152, 186), 1); protected static final Border FIELDBORDER = BorderFactory.createLineBorder(new Color(128, 152, 186), 1);
public XFieldEditor(FieldEditor widget, Dimension initSize) { public XFieldEditor(FieldEditor widget, Dimension initSize) {
super(widget, initSize); super(widget, initSize);
} }
@ -31,22 +34,31 @@ public abstract class XFieldEditor extends XWidgetCreator {
@Override @Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll( return (CRPropertyDescriptor[]) ArrayUtils.addAll(
super.supportedDescriptor(),getCRPropertyDescriptor() super.supportedDescriptor(), getCRPropertyDescriptor()
); );
}
private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException {
CRPropertyDescriptor allowBlank = new CRPropertyDescriptor("allowBlank", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_Allow-Blank")).setEditorClass(InChangeBooleanEditor.class).putKeyValue(
XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate");
CRPropertyDescriptor blankErrorMsg = new CRPropertyDescriptor("errorMessage", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Engine_Verify-Message"))
.putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate");
CRPropertyDescriptor fontSize = new CRPropertyDescriptor("fontSize", this.data.getClass(), "getFontSize", "setFontSize")
.setI18NName(Inter.getLocText("FR-Designer_Font-Size"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Designer_Advanced");
return !((FieldEditor) toData()).isAllowBlank() ?
new CRPropertyDescriptor[]{allowBlank, blankErrorMsg, fontSize}
: new CRPropertyDescriptor[]{allowBlank, fontSize};
} }
private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException { public boolean isDisplayRegField(boolean displayRegField) {
CRPropertyDescriptor allowBlank = new CRPropertyDescriptor("allowBlank", this.data.getClass()).setI18NName( RegExp reg = ((TextEditor) toData()).getRegex();
Inter.getLocText("Allow_Blank")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( if (reg == null || !StringUtils.isNotEmpty(reg.toRegText())) {
XCreatorConstants.PROPERTY_CATEGORY, "Advanced");
CRPropertyDescriptor blankErrorMsg = new CRPropertyDescriptor("errorMessage", this.data.getClass()).setI18NName( displayRegField = false;
Inter.getLocText("Verify-Message")) }
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); return displayRegField;
CRPropertyDescriptor fontSize = new CRPropertyDescriptor("fontSize", this.data.getClass(), "getFontSize", "setFontSize") }
.setI18NName(Inter.getLocText(new String[]{"FRFont", "FRFont-Size"}))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced");
return !((FieldEditor) toData()).isAllowBlank() ?
new CRPropertyDescriptor[] {allowBlank, blankErrorMsg, fontSize}
: new CRPropertyDescriptor[] {allowBlank, fontSize};
}
} }

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

@ -59,7 +59,7 @@ public class XLabel extends XWidgetCreator {
new CRPropertyDescriptor[] { new CRPropertyDescriptor[] {
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass( Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(
WidgetValueEditor.class), WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("wrap", this.data.getClass()).setI18NName( new CRPropertyDescriptor("wrap", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_StyleAlignment-Wrap_Text")).putKeyValue( Inter.getLocText("FR-Designer_StyleAlignment-Wrap_Text")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),

31
designer_form/src/com/fr/design/designer/creator/XNumberEditor.java

@ -41,31 +41,42 @@ public class XNumberEditor extends XWrapperedFieldEditor {
*/ */
@Override @Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] sup = super.supportedDescriptor(); CRPropertyDescriptor[] sup =(CRPropertyDescriptor[]) ArrayUtils.addAll(
new CRPropertyDescriptor[] {
new CRPropertyDescriptor("widgetValue", this.data.getClass())
.setI18NName(Inter.getLocText(new String[]{"Widget", "Value"}))
.setEditorClass(WidgetValueEditor.class)
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")}
,super.supportedDescriptor());
CRPropertyDescriptor allowDecimal = new CRPropertyDescriptor("allowDecimals", this.data.getClass()) CRPropertyDescriptor allowDecimal = new CRPropertyDescriptor("allowDecimals", this.data.getClass())
.setEditorClass(InChangeBooleanEditor.class) .setEditorClass(InChangeBooleanEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_Allow_Decimals")); .setI18NName(Inter.getLocText("FR-Designer_Allow_Decimals"))
.putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate");
CRPropertyDescriptor decimalLength = new CRPropertyDescriptor("maxDecimalLength", this.data.getClass()) CRPropertyDescriptor decimalLength = new CRPropertyDescriptor("maxDecimalLength", this.data.getClass())
.setI18NName(Inter.getLocText(new String[]{"Double", "Numbers"})); .setI18NName(Inter.getLocText(new String[]{"Double", "Numbers"}))
.putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate");
sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, ((NumberEditor)this.data).isAllowDecimals() ? sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, ((NumberEditor)this.data).isAllowDecimals() ?
new CRPropertyDescriptor[] {allowDecimal, decimalLength} : new CRPropertyDescriptor[] {allowDecimal}); new CRPropertyDescriptor[] {allowDecimal, decimalLength} : new CRPropertyDescriptor[] {allowDecimal});
return (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, return (CRPropertyDescriptor[]) ArrayUtils.addAll(sup,
new CRPropertyDescriptor[] { new CRPropertyDescriptor[] {
new CRPropertyDescriptor("allowNegative", this.data.getClass()) new CRPropertyDescriptor("allowNegative", this.data.getClass())
.setI18NName(Inter.getLocText("FR-Designer_Allow_Negative")) .setI18NName(Inter.getLocText("FR-Designer_Allow_Negative"))
.setEditorClass(InChangeBooleanEditor.class), .setEditorClass(InChangeBooleanEditor.class)
.putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"),
new CRPropertyDescriptor("minValue", this.data.getClass()) new CRPropertyDescriptor("minValue", this.data.getClass())
.setI18NName(Inter.getLocText("FR-Designer_Min_Value")) .setI18NName(Inter.getLocText("FR-Designer_Min_Value"))
.setEditorClass(SpinnerMinNumberEditor.class), .setEditorClass(SpinnerMinNumberEditor.class)
.putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"),
new CRPropertyDescriptor("maxValue", this.data.getClass()) new CRPropertyDescriptor("maxValue", this.data.getClass())
.setI18NName(Inter.getLocText("FR-Designer_Max_Value")) .setI18NName(Inter.getLocText("FR-Designer_Max_Value"))
.setEditorClass(SpinnerMaxNumberEditor.class), .setEditorClass(SpinnerMaxNumberEditor.class)
new CRPropertyDescriptor("widgetValue", this.data.getClass()) .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"),
.setI18NName(Inter.getLocText(new String[]{"Widget", "Value"}))
.setEditorClass(WidgetValueEditor.class),
new CRPropertyDescriptor("waterMark", this.data.getClass()) new CRPropertyDescriptor("waterMark", this.data.getClass())
.setI18NName(Inter.getLocText("FR-Designer_WaterMark")) .setI18NName(Inter.getLocText("FR-Designer_WaterMark"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("regErrorMessage", this.data.getClass())
.setI18NName(Inter.getLocText("Verify-Message"))
.putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate")
}); });
} }

47
designer_form/src/com/fr/design/designer/creator/XPassword.java

@ -26,7 +26,7 @@ public class XPassword extends XWrapperedFieldEditor {
public XPassword(Password widget, Dimension initSize) { public XPassword(Password widget, Dimension initSize) {
super(widget, initSize); super(widget, initSize);
} }
@Override @Override
protected JComponent initEditor() { protected JComponent initEditor() {
if (editor == null) { if (editor == null) {
@ -39,28 +39,35 @@ public class XPassword extends XWrapperedFieldEditor {
protected String getIconName() { protected String getIconName() {
return "password_field_16.png"; return "password_field_16.png";
} }
/** /**
* 控件的属性列表 * 控件的属性列表
*
* @return 此控件所用的属性列表 * @return 此控件所用的属性列表
* @throws IntrospectionException 异常 * @throws IntrospectionException 异常
*/ */
@Override @Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), CRPropertyDescriptor[] sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(
new CRPropertyDescriptor[] { new CRPropertyDescriptor[]{
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass( Inter.getLocText("FR-Designer-Estate_Widget_Value")).setEditorClass(
WidgetValueEditor.class), WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Designer_Advanced")}
new CRPropertyDescriptor("regex", this.data.getClass()) , super.supportedDescriptor());
.setI18NName(Inter.getLocText("FR-Designer_Input_Rule")) CRPropertyDescriptor regErrorMessage = new CRPropertyDescriptor("regErrorMessage", this.data.getClass()).setI18NName(
.setEditorClass(RegexEditor.RegexEditor4TextArea.class) Inter.getLocText("FR-Engine_Verify-Message")).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate");
.putKeyValue("renderer", RegexCellRencerer.class) CRPropertyDescriptor regex = new CRPropertyDescriptor("regex", this.data.getClass())
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), .setI18NName(Inter.getLocText("FR-Designer_Input_Rule"))
new CRPropertyDescriptor("waterMark", this.data.getClass()) .setEditorClass(RegexEditor.RegexEditor4TextArea.class)
.setI18NName(Inter.getLocText("FR-Designer_WaterMark")) .putKeyValue("renderer", RegexCellRencerer.class)
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate");
}); CRPropertyDescriptor waterMark = new CRPropertyDescriptor("waterMark", this.data.getClass())
} .setI18NName(Inter.getLocText("FR-Designer_WaterMark"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Designer_Advanced");
boolean displayRegField = true;
displayRegField = isDisplayRegField(displayRegField);
return displayRegField ? (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[]{regex, regErrorMessage, waterMark}) :
(CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[]{regex, waterMark});
}
} }

17
designer_form/src/com/fr/design/designer/creator/XRadioGroup.java

@ -39,16 +39,19 @@ public class XRadioGroup extends XFieldEditor {
@Override @Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(),getCRPropertyDescriptor()); CRPropertyDescriptor [] sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[] {
}
private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crp = new CRPropertyDescriptor[] {
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class), Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(WidgetValueEditor.class)
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName( new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName(
Inter.getLocText("DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass( Inter.getLocText("DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass(
DictionaryRenderer.class), DictionaryRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")},super.supportedDescriptor());
CRPropertyDescriptor [] properties = (CRPropertyDescriptor[]) ArrayUtils.addAll(sup,getCRPropertyDescriptor());
return properties;
}
private CRPropertyDescriptor[] getCRPropertyDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crp = new CRPropertyDescriptor[] {
new CRPropertyDescriptor("adaptive", this.data.getClass()).setI18NName(Inter.getLocText("Adaptive")) new CRPropertyDescriptor("adaptive", this.data.getClass()).setI18NName(Inter.getLocText("Adaptive"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced").setEditorClass(InChangeBooleanEditor.class)}; .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced").setEditorClass(InChangeBooleanEditor.class)};
if (!toData().isAdaptive()) { if (!toData().isAdaptive()) {

65
designer_form/src/com/fr/design/designer/creator/XTextArea.java

@ -34,41 +34,46 @@ public class XTextArea extends XFieldEditor {
super(widget, initSize); super(widget, initSize);
} }
@Override @Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), CRPropertyDescriptor[] sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(
new CRPropertyDescriptor[] { new CRPropertyDescriptor[]{
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass( Inter.getLocText("FR-Designer-Estate_Widget_Value")).setEditorClass(
WidgetValueEditor.class), WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Designer_Advanced")}, super.supportedDescriptor());
new CRPropertyDescriptor("regex", this.data.getClass()).setI18NName( CRPropertyDescriptor regex = new CRPropertyDescriptor("regex", this.data.getClass()).setI18NName(
Inter.getLocText("Input_Rule")).setEditorClass(RegexEditor.RegexEditor4TextArea.class) Inter.getLocText("FR-Designer_Input_Rule")).setEditorClass(RegexEditor.RegexEditor4TextArea.class)
.putKeyValue("renderer", RegexCellRencerer.class).putKeyValue( .putKeyValue("renderer", RegexCellRencerer.class).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate");
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), CRPropertyDescriptor regErrorMessage = new CRPropertyDescriptor("regErrorMessage", this.data.getClass()).setI18NName(
new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName( Inter.getLocText("FR-Engine_Verify-Message")).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate");
Inter.getLocText("WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, CRPropertyDescriptor waterMark = new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName(
"Advanced"), }); Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY,
} "FR-Designer_Advanced");
boolean displayRegField = true;
@Override displayRegField = isDisplayRegField(displayRegField);
protected void paintComponent(Graphics g) { return displayRegField ? (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[]{regex, regErrorMessage, waterMark}) :
super.paintComponent(g); (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[]{regex, waterMark});
TextArea area = (TextArea) data; }
if (area.getWidgetValue() != null) {
Graphics2D g2d = (Graphics2D) g.create(); @Override
BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue() protected void paintComponent(Graphics g) {
.toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT) super.paintComponent(g);
.deriveVerticalAlignment(SwingConstants.TOP) TextArea area = (TextArea) data;
.deriveTextStyle(Style.TEXTSTYLE_WRAPTEXT), ScreenResolution.getScreenResolution()); if (area.getWidgetValue() != null) {
} Graphics2D g2d = (Graphics2D) g.create();
} BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue()
.toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT)
.deriveVerticalAlignment(SwingConstants.TOP)
.deriveTextStyle(Style.TEXTSTYLE_WRAPTEXT), ScreenResolution.getScreenResolution());
}
}
@Override @Override
protected JComponent initEditor() { protected JComponent initEditor() {
setBorder(FIELDBORDER); setBorder(FIELDBORDER);
return this; return this;
} }
@Override @Override
public Dimension initEditorSize() { public Dimension initEditorSize() {
return BIG_PREFERRED_SIZE; return BIG_PREFERRED_SIZE;

66
designer_form/src/com/fr/design/designer/creator/XTextEditor.java

@ -35,43 +35,49 @@ public class XTextEditor extends XWrapperedFieldEditor {
/** /**
* 控件的属性列表 * 控件的属性列表
*
* @return 此控件所用的属性列表 * @return 此控件所用的属性列表
* @throws IntrospectionException 异常 * @throws IntrospectionException 异常
*/ */
@Override @Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), CRPropertyDescriptor widgetValue = new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
new CRPropertyDescriptor[] { Inter.getLocText("FR-Designer-Estate_Widget_Value")).setEditorClass(
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Designer_Advanced");
Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass( CRPropertyDescriptor regex = new CRPropertyDescriptor("regex", this.data.getClass()).setI18NName(
WidgetValueEditor.class), Inter.getLocText("FR-Designer_Input_Rule")).setEditorClass(RegexEditor.class).putKeyValue(
new CRPropertyDescriptor("regex", this.data.getClass()).setI18NName( "renderer", RegexCellRencerer.class).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate");
Inter.getLocText("FR-Designer_Input_Rule")).setEditorClass(RegexEditor.class).putKeyValue( CRPropertyDescriptor regErrorMessage = new CRPropertyDescriptor("regErrorMessage", this.data.getClass()).setI18NName(
"renderer", RegexCellRencerer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Engine_Verify-Message")).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate");
"Advanced"), CRPropertyDescriptor waterMark = new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName(
new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName( Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY,
Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Designer_Advanced");
"Advanced"), }); CRPropertyDescriptor[] sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[]{widgetValue}, super.supportedDescriptor());
} boolean displayRegField = true;
displayRegField = isDisplayRegField(displayRegField);
@Override return displayRegField ? (CRPropertyDescriptor[]) ArrayUtils.addAll(sup,
public void paintComponent(Graphics g) { new CRPropertyDescriptor[]{regex, regErrorMessage, waterMark}) :
super.paintComponent(g); (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[]{regex, waterMark});
}
TextEditor area = (TextEditor) data; @Override
if (area.getWidgetValue() != null) { public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g.create(); super.paintComponent(g);
BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue()
.toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT) TextEditor area = (TextEditor) data;
.deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), ScreenResolution.getScreenResolution()); if (area.getWidgetValue() != null) {
} Graphics2D g2d = (Graphics2D) g.create();
} BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue()
.toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT)
.deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), ScreenResolution.getScreenResolution());
}
}
@Override @Override
protected JComponent initEditor() { protected JComponent initEditor() {
setBorder(FIELDBORDER); setBorder(FIELDBORDER);
return this; return this;
} }
@Override @Override
protected String getIconName() { protected String getIconName() {

4
designer_form/src/com/fr/design/designer/creator/XTreeComboBoxEditor.java

@ -53,13 +53,13 @@ public class XTreeComboBoxEditor extends XTreeEditor {
protected CRPropertyDescriptor[] addAllowEdit(CRPropertyDescriptor[] crp) throws IntrospectionException{ protected CRPropertyDescriptor[] addAllowEdit(CRPropertyDescriptor[] crp) throws IntrospectionException{
return (CRPropertyDescriptor[])ArrayUtils.add(crp, new CRPropertyDescriptor("directEdit", this.data.getClass()) return (CRPropertyDescriptor[])ArrayUtils.add(crp, new CRPropertyDescriptor("directEdit", this.data.getClass())
.setI18NName(Inter.getLocText("Form-Allow_Edit")).putKeyValue( .setI18NName(Inter.getLocText("Form-Allow_Edit")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced")); XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"));
} }
protected CRPropertyDescriptor[] addCustomData(CRPropertyDescriptor[] crp) throws IntrospectionException{ protected CRPropertyDescriptor[] addCustomData(CRPropertyDescriptor[] crp) throws IntrospectionException{
return (CRPropertyDescriptor[])ArrayUtils.add(crp, new CRPropertyDescriptor("customData", this.data.getClass()) return (CRPropertyDescriptor[])ArrayUtils.add(crp, new CRPropertyDescriptor("customData", this.data.getClass())
.setI18NName(Inter.getLocText("Form-Allow_CustomData")).putKeyValue( .setI18NName(Inter.getLocText("Form-Allow_CustomData")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced")); XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"));
} }
@Override @Override

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

@ -41,26 +41,28 @@ public class XTreeEditor extends XWidgetCreator {
CRPropertyDescriptor[] crp = !((FieldEditor) toData()).isAllowBlank() ? CRPropertyDescriptor[] crp = !((FieldEditor) toData()).isAllowBlank() ?
new CRPropertyDescriptor[]{ new CRPropertyDescriptor[]{
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(WidgetValueEditor.class), Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(WidgetValueEditor.class)
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("model", this.data.getClass(), "getNodeOrDict", "setNodeOrDict").setI18NName( new CRPropertyDescriptor("model", this.data.getClass(), "getNodeOrDict", "setNodeOrDict").setI18NName(
Inter.getLocText("FR-Designer_DS-Dictionary")).setEditorClass(TreeModelEditor.class).setRendererClass( Inter.getLocText("FR-Designer_DS-Dictionary")).setEditorClass(TreeModelEditor.class).setRendererClass(
TreeModelRenderer.class), TreeModelRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("allowBlank", this.data.getClass()).setI18NName( new CRPropertyDescriptor("allowBlank", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_Allow_Blank")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( Inter.getLocText("FR-Designer_Allow_Blank")).setEditorClass(InChangeBooleanEditor.class)
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"),
new CRPropertyDescriptor("errorMessage", this.data.getClass()).setI18NName( new CRPropertyDescriptor("errorMessage", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_Verify-Message")) Inter.getLocText("FR-Designer_Verify-Message"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), .putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"),
} }
: new CRPropertyDescriptor[]{ : new CRPropertyDescriptor[]{
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(WidgetValueEditor.class), Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(WidgetValueEditor.class)
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("model", this.data.getClass(), "getNodeOrDict", "setNodeOrDict").setI18NName( new CRPropertyDescriptor("model", this.data.getClass(), "getNodeOrDict", "setNodeOrDict").setI18NName(
Inter.getLocText("FR-Designer_DS-Dictionary")).setEditorClass(TreeModelEditor.class).setRendererClass( Inter.getLocText("FR-Designer_DS-Dictionary")).setEditorClass(TreeModelEditor.class).setRendererClass(
TreeModelRenderer.class), TreeModelRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("allowBlank", this.data.getClass()).setI18NName( new CRPropertyDescriptor("allowBlank", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_Allow_Blank")).setEditorClass(InChangeBooleanEditor.class).putKeyValue( Inter.getLocText("FR-Designer_Allow_Blank")).setEditorClass(InChangeBooleanEditor.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),}; XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate"),};
crp = this.addWaterMark(crp); crp = this.addWaterMark(crp);
crp = (CRPropertyDescriptor[]) ArrayUtils.add(crp, crp = (CRPropertyDescriptor[]) ArrayUtils.add(crp,

94
designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -7,6 +7,8 @@ import java.awt.*;
import java.awt.event.ContainerEvent; import java.awt.event.ContainerEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.beans.IntrospectionException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
@ -16,16 +18,26 @@ import com.fr.design.designer.beans.adapters.layout.AbsoluteLayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter;
import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.form.layout.FRAbsoluteLayout; import com.fr.design.form.layout.FRAbsoluteLayout;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormArea;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer;
import com.fr.form.ui.Connector; import com.fr.form.ui.Connector;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.WFitLayout;
import com.fr.general.FRScreen;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.core.PropertyChangeAdapter;
/** /**
* @author richer * @author richer
@ -35,6 +47,9 @@ public class XWAbsoluteLayout extends XLayoutContainer {
private static final int EDIT_BTN_WIDTH = 60; private static final int EDIT_BTN_WIDTH = 60;
private static final int EDIT_BTN_HEIGHT = 24; private static final int EDIT_BTN_HEIGHT = 24;
//由于屏幕分辨率不同,界面上的容器大小可能不是默认的100%,此时拖入组件时,保存的大小按照100%时的计算
protected double containerPercent = 1.0;
private HashMap<Connector,XConnector> xConnectorMap; private HashMap<Connector,XConnector> xConnectorMap;
@ -54,6 +69,61 @@ public class XWAbsoluteLayout extends XLayoutContainer {
connector = widget.getConnectorIndex(i); connector = widget.getConnectorIndex(i);
xConnectorMap.put(connector, new XConnector(connector, this)); xConnectorMap.put(connector, new XConnector(connector, this));
} }
initPercent();
}
//根据屏幕大小来确定显示的百分比, 1440*900默认100%, 1366*768缩放90%
private void initPercent(){
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension scrnsize = toolkit.getScreenSize();
double screenValue = FRScreen.getByDimension(scrnsize).getValue();
if(screenValue != FormArea.DEFAULT_SLIDER){
this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER);
}
}
/**
* 返回容器大小的百分比
* @return the containerPercent
*/
public double getContainerPercent() {
return containerPercent;
}
/**
* 设置容器大小的百分比
* @param containerPercent the containerPercent to set
*/
public void setContainerPercent(double containerPercent) {
this.containerPercent = containerPercent;
}
/**
* 界面容器大小不是默认的时处理控件的BoundsWidget且避免出现空隙
*/
private Rectangle dealWidgetBound(Rectangle rec) {
if (containerPercent == 1.0) {
return rec;
}
rec.x = (int) (rec.x/containerPercent);
rec.y = (int) (rec.y/containerPercent);
rec.width = (int) (rec.width/containerPercent);
rec.height = (int) (rec.height/containerPercent);
return rec;
}
/**
* 新增删除拉伸后更新每个组件的BoundsWidget
*/
public void updateBoundsWidget(XCreator xCreator) {
WAbsoluteLayout layout = this.toData();
if (xCreator.shouldScaleCreator() || xCreator.hasTitleStyle()) {
xCreator = (XLayoutContainer)xCreator.getParent();
}
BoundsWidget boundsWidget = layout.getBoundsWidget(xCreator.toData());
Rectangle rectangle = dealWidgetBound(xCreator.getBounds());
boundsWidget.setCalculatedBounds(rectangle);
} }
/** /**
@ -105,7 +175,17 @@ public class XWAbsoluteLayout extends XLayoutContainer {
protected void initLayoutManager() { protected void initLayoutManager() {
this.setLayout(new FRAbsoluteLayout()); this.setLayout(new FRAbsoluteLayout());
} }
/**
* 是否支持标题样式
*
* @return 默认false
*/
@Override
public boolean hasTitleStyle() {
return false;
}
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
@ -211,6 +291,18 @@ public class XWAbsoluteLayout extends XLayoutContainer {
} }
} }
/**
* 得到属性名
* @return 属性名
* @throws java.beans.IntrospectionException
*/
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor[] {
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_Form-Widget_Name"))
};
}
public void paint(Graphics g) { public void paint(Graphics g) {
super.paint(g); super.paint(g);
//如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层

8
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -88,6 +88,14 @@ public class XWCardLayout extends XLayoutContainer {
return (WCardLayout) data; return (WCardLayout) data;
} }
/**
* 初始化时默认的组件大小
* @return 默认Dimension
*/
public Dimension initEditorSize() {
return new Dimension(500, 300);
}
@Override @Override
protected void initLayoutManager() { protected void initLayoutManager() {
cardLayout = new FRCardLayout(toData().getHgap(), toData().getVgap()); cardLayout = new FRCardLayout(toData().getHgap(), toData().getVgap());

12
designer_form/src/com/fr/design/designer/properties/AbsoluteStateRenderer.java

@ -0,0 +1,12 @@
package com.fr.design.designer.properties;
import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer;
/**
* Created by zhouping on 2016/8/1.
*/
public class AbsoluteStateRenderer extends EncoderCellRenderer {
public AbsoluteStateRenderer() {
super(new AbsoluteStateWrapper());
}
}

12
designer_form/src/com/fr/design/designer/properties/AbsoluteStateWrapper.java

@ -0,0 +1,12 @@
package com.fr.design.designer.properties;
import com.fr.design.designer.properties.items.FRAbsoluteConstraintsItems;
/**
* Created by zhouping on 2016/8/1.
*/
public class AbsoluteStateWrapper extends ItemWrapper{
public AbsoluteStateWrapper() {
super(new FRAbsoluteConstraintsItems());
}
}

94
designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java

@ -0,0 +1,94 @@
package com.fr.design.designer.properties;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.mainframe.widget.editors.AbsoluteLayoutDirectionEditor;
import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor;
import com.fr.design.mainframe.widget.editors.PropertyCellEditor;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.general.Inter;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
/**
* Created by zhouping on 2016/8/1.
*/
public class FRAbsoluteLayoutPropertiesGroupModel implements GroupModel {
private PropertyCellEditor editor;
private DefaultTableCellRenderer renderer;
private AbsoluteLayoutDirectionEditor stateEditor;
private AbsoluteStateRenderer stateRenderer;
private WAbsoluteLayout layout;
private XWAbsoluteLayout xwAbsoluteLayout;
public FRAbsoluteLayoutPropertiesGroupModel(XWAbsoluteLayout xwAbsoluteLayout){
this.xwAbsoluteLayout = xwAbsoluteLayout;
this.layout = xwAbsoluteLayout.toData();
renderer = new DefaultTableCellRenderer();
editor = new PropertyCellEditor(new IntegerPropertyEditor());
stateEditor = new AbsoluteLayoutDirectionEditor();
stateRenderer = new AbsoluteStateRenderer();
}
/**
* 布局管理器自己的属性
*/
@Override
public String getGroupName() {
return Inter.getLocText("FR-Designer-Widget_Area_Scaling");
}
@Override
public int getRowCount() {
return 1;
}
@Override
public TableCellRenderer getRenderer(int row) {
return stateRenderer;
}
@Override
public TableCellEditor getEditor(int row) {
return stateEditor;
}
@Override
public Object getValue(int row, int column) {
if (column == 0) {
return Inter.getLocText("FR-Designer-Widget_Scaling_Mode");
} else {
return layout.getCompState();
}
}
@Override
public boolean setValue(Object value, int row, int column) {
int state = 0;
if(value instanceof Integer) {
state = (Integer)value;
}
if (column == 0 || state < 0) {
return false;
} else {
if (row == 0) {
layout.setCompState(state);
return true;
}
return false;
}
}
/**
* 是否可编辑
* @param row
* @return
*/
@Override
public boolean isEditable(int row) {
return true;
}
}

19
designer_form/src/com/fr/design/designer/properties/items/FRAbsoluteConstraintsItems.java

@ -0,0 +1,19 @@
package com.fr.design.designer.properties.items;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.general.Inter;
/**
* Created by zhouping on 2016/8/1.
*/
public class FRAbsoluteConstraintsItems implements ItemProvider{
public static final Item[] ITEMS = new Item[] {
new Item(Inter.getLocText("FR-Designer_Widget_Scaling_Mode_Fit"), WAbsoluteLayout.STATE_FIT),
new Item(Inter.getLocText("FR-Designer_Widget_Scaling_Mode_Fixed"), WAbsoluteLayout.STATE_FIXED)
};
public Item[] getItems() {
return ITEMS;
}
}

1
designer_form/src/com/fr/design/form/util/XCreatorConstants.java

@ -21,6 +21,7 @@ public class XCreatorConstants {
// 描述属性的分类 // 描述属性的分类
public static final String PROPERTY_CATEGORY = "category"; public static final String PROPERTY_CATEGORY = "category";
public static final String DEFAULT_GROUP_NAME = "Form-Basic_Properties"; public static final String DEFAULT_GROUP_NAME = "Form-Basic_Properties";
public static final String PROPERTY_VALIDATE = "FR-Designer_Validate";
public static final Color FORM_BG = new Color(252, 252, 254); public static final Color FORM_BG = new Color(252, 252, 254);
// 拖拽标识块的大小 // 拖拽标识块的大小
public static final int RESIZE_BOX_SIZ = 5; public static final int RESIZE_BOX_SIZ = 5;

5
designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessiblePropertyEditor.java

@ -33,6 +33,11 @@ public class AccessiblePropertyEditor extends AbstractPropertyEditor {
editor.setValue(value); editor.setValue(value);
} }
@Override
public boolean refreshInTime() {
return true;
}
@Override @Override
public Object getValue() { public Object getValue() {
return editor.getValue(); return editor.getValue();

13
designer_form/src/com/fr/design/mainframe/widget/editors/AbsoluteLayoutDirectionEditor.java

@ -0,0 +1,13 @@
package com.fr.design.mainframe.widget.editors;
import com.fr.design.designer.properties.EnumerationEditor;
import com.fr.design.designer.properties.items.FRAbsoluteConstraintsItems;
/**
* Created by zhouping on 2016/8/1.
*/
public class AbsoluteLayoutDirectionEditor extends EnumerationEditor {
public AbsoluteLayoutDirectionEditor() {
super(new FRAbsoluteConstraintsItems());
}
}
Loading…
Cancel
Save