Browse Source

Merge branch 'release/9.0' of http://www.finedevelop.com:2015/scm/~plough/design into release/9.0

master
plough 7 years ago
parent
commit
0b6e3debe4
  1. 149
      designer/src/com/fr/design/dscolumn/DSColumnAdvancedPane.java
  2. 4
      designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java
  3. 199
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  4. 2
      designer_form/src/com/fr/design/designer/beans/adapters/component/CompositeComponentAdapter.java
  5. 16
      designer_form/src/com/fr/design/designer/creator/CRPropertyDescriptorPane.java
  6. 33
      designer_form/src/com/fr/design/designer/creator/PropertyGroupPane.java
  7. 27
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

149
designer/src/com/fr/design/dscolumn/DSColumnAdvancedPane.java

@ -5,7 +5,10 @@ import com.fr.data.util.SortOrder;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.*; import com.fr.design.formula.CustomVariableResolver;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.SortFormulaPane;
import com.fr.design.formula.UIFormula;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
@ -28,6 +31,8 @@ import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.*;
public class DSColumnAdvancedPane extends BasicPane { public class DSColumnAdvancedPane extends BasicPane {
private static final String InsetText = " "; private static final String InsetText = " ";
@ -36,12 +41,11 @@ public class DSColumnAdvancedPane extends BasicPane {
private ValuePane valuePane; private ValuePane valuePane;
private UICheckBox horizontalExtendableCheckBox; private UICheckBox horizontalExtendableCheckBox;
private UICheckBox verticalExtendableCheckBox; private UICheckBox verticalExtendableCheckBox;
// private UICheckBox isCoverCheckBox;
private UICheckBox useMultiplyNumCheckBox; private UICheckBox useMultiplyNumCheckBox;
private UISpinner multiNumSpinner; private UISpinner multiNumSpinner;
public DSColumnAdvancedPane() { public DSColumnAdvancedPane() {
this(DSColumnPane.SETTING_ALL); this(DSColumnPane.SETTING_ALL);
} }
public DSColumnAdvancedPane(int setting) { public DSColumnAdvancedPane(int setting) {
@ -49,15 +53,15 @@ public class DSColumnAdvancedPane extends BasicPane {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
sortPane = new SortPane(); sortPane = new SortPane();
sortPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Sort-Sort_Order"),null)); sortPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Sort-Sort_Order"), null));
if (setting > DSColumnPane.SETTING_DSRELATED) { if (setting > DSColumnPane.SETTING_DSRELATED) {
selectCountPane = new SelectCountPane(); selectCountPane = new SelectCountPane();
selectCountPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("BindColumn-Results_Filter"),null)); selectCountPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("BindColumn-Results_Filter"), null));
} }
valuePane = new ValuePane(); valuePane = new ValuePane();
valuePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("BindColumn-Custom_Data_Appearance"),null)); valuePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("BindColumn-Custom_Data_Appearance"), null));
JPanel extendablePane = null; JPanel extendablePane = null;
@ -68,54 +72,54 @@ public class DSColumnAdvancedPane extends BasicPane {
extendableDirectionPane.add(horizontalExtendableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable"))); extendableDirectionPane.add(horizontalExtendableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable")));
extendableDirectionPane.add(verticalExtendableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable"))); extendableDirectionPane.add(verticalExtendableCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable")));
extendablePane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("ExpandD-Expandable")); extendablePane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("ExpandD-Expandable"));
extendablePane.setLayout(new BorderLayout()); extendablePane.setLayout(new BorderLayout());
extendablePane.add(extendableDirectionPane, BorderLayout.CENTER); extendablePane.add(extendableDirectionPane, BorderLayout.CENTER);
} }
JPanel multiNumPane = null; JPanel multiNumPane = null;
if (setting > DSColumnPane.SETTING_DSRELATED) { if (setting > DSColumnPane.SETTING_DSRELATED) {
multiNumPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Fill_blank_Data")); multiNumPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Fill_blank_Data"));
useMultiplyNumCheckBox = new UICheckBox(Inter.getLocText("Column_Multiple")); useMultiplyNumCheckBox = new UICheckBox(Inter.getLocText("Column_Multiple"));
multiNumPane.add(useMultiplyNumCheckBox); multiNumPane.add(useMultiplyNumCheckBox);
multiNumPane.add(new UILabel(InsetText)); multiNumPane.add(new UILabel(InsetText));
multiNumSpinner = new UISpinner(1, 10000, 1, 1); multiNumSpinner = new UISpinner(1, 10000, 1, 1);
multiNumPane.add(multiNumSpinner); multiNumPane.add(multiNumSpinner);
useMultiplyNumCheckBox.addActionListener(new ActionListener() { useMultiplyNumCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
checkButtonEnabled(); checkButtonEnabled();
} }
}); });
} }
double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED,
TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED};
double[] columnSize = {TableLayout.FILL}; double[] columnSize = {TableLayout.FILL};
Component[][] components = null; Component[][] components = null;
if (setting > DSColumnPane.SETTING_DSRELATED) { if (setting > DSColumnPane.SETTING_DSRELATED) {
components = new Component[][]{ components = new Component[][]{
{sortPane}, {sortPane},
{selectCountPane}, {selectCountPane},
{valuePane}, {valuePane},
{extendablePane}, {extendablePane},
{multiNumPane} {multiNumPane}
}; };
} else { } else {
components = new Component[][]{ components = new Component[][]{
{sortPane}, {sortPane},
{valuePane} {valuePane}
}; };
} }
this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER); this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("Advanced"); return Inter.getLocText("Advanced");
} }
public void populate(TemplateCellElement cellElement) { public void populate(TemplateCellElement cellElement) {
@ -127,13 +131,13 @@ public class DSColumnAdvancedPane extends BasicPane {
valuePane.populate(cellElement); valuePane.populate(cellElement);
if (selectCountPane != null) { if (selectCountPane != null) {
selectCountPane.populate(cellElement); selectCountPane.populate(cellElement);
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (cellExpandAttr == null) { if (cellExpandAttr == null) {
cellExpandAttr = new CellExpandAttr(); cellExpandAttr = new CellExpandAttr();
cellElement.setCellExpandAttr(cellExpandAttr); cellElement.setCellExpandAttr(cellExpandAttr);
} }
// extendable // extendable
switch (cellExpandAttr.getExtendable()) { switch (cellExpandAttr.getExtendable()) {
@ -176,9 +180,9 @@ public class DSColumnAdvancedPane extends BasicPane {
valuePane.update(cellElement); valuePane.update(cellElement);
if (selectCountPane != null) { if (selectCountPane != null) {
selectCountPane.update(cellElement); selectCountPane.update(cellElement);
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (cellExpandAttr == null) { if (cellExpandAttr == null) {
cellExpandAttr = new CellExpandAttr(); cellExpandAttr = new CellExpandAttr();
cellElement.setCellExpandAttr(cellExpandAttr); cellElement.setCellExpandAttr(cellExpandAttr);
@ -208,10 +212,10 @@ public class DSColumnAdvancedPane extends BasicPane {
} }
private static class SortPane extends SortFormulaPane { private static class SortPane extends SortFormulaPane {
private CellElement cellElement; private CellElement cellElement;
@Override @Override
public void formulaAction() { public void formulaAction() {
if (cellElement == null) { if (cellElement == null) {
return; return;
} }
@ -221,10 +225,10 @@ public class DSColumnAdvancedPane extends BasicPane {
} }
String[] displayNames = DesignTableDataManager.getSelectedColumnNames( String[] displayNames = DesignTableDataManager.getSelectedColumnNames(
DesignTableDataManager.getEditingTableDataSource(), ((DSColumn) value).getDSName()); DesignTableDataManager.getEditingTableDataSource(), ((DSColumn) value).getDSName());
showFormulaDialog(displayNames); showFormulaDialog(displayNames);
} }
void populate(CellElement cellElement) { void populate(CellElement cellElement) {
if (cellElement == null) { if (cellElement == null) {
@ -316,7 +320,7 @@ public class DSColumnAdvancedPane extends BasicPane {
} }
}); });
selectCountCardPane =FRGUIPaneFactory.createCardLayout_S_Pane(); selectCountCardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
this.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(InsetText), selectCountComboBox, this.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(InsetText), selectCountComboBox,
new UILabel(InsetText), selectCountCardPane}, FlowLayout.LEFT), BorderLayout.WEST); new UILabel(InsetText), selectCountCardPane}, FlowLayout.LEFT), BorderLayout.WEST);
// selectCountCardPane.setLayout(new CardLayout()); // selectCountCardPane.setLayout(new CardLayout());
@ -328,16 +332,16 @@ public class DSColumnAdvancedPane extends BasicPane {
bottomFormulaPane = new JFormulaField("-1"); bottomFormulaPane = new JFormulaField("-1");
serialTextField = new UITextField(18); serialTextField = new UITextField(18);
JPanel oddPane = GUICoreUtils.createFlowPane(new UILabel(Inter.getLocText("BindColumn-Result_Serial_Number_Start_From_1") JPanel oddPane = GUICoreUtils.createFlowPane(new UILabel(Inter.getLocText("BindColumn-Result_Serial_Number_Start_From_1")
+ " " + Inter.getLocText("BindColumn-Odd_Selected_(1,3,5...)")), FlowLayout.LEFT); + " " + Inter.getLocText("BindColumn-Odd_Selected_(1,3,5...)")), FlowLayout.LEFT);
JPanel evenPane = GUICoreUtils.createFlowPane(new UILabel(Inter.getLocText("BindColumn-Result_Serial_Number_Start_From_1") JPanel evenPane = GUICoreUtils.createFlowPane(new UILabel(Inter.getLocText("BindColumn-Result_Serial_Number_Start_From_1")
+ " " + Inter.getLocText("BindColumn-Even_Selected_(2,4,6...)")), FlowLayout.LEFT); + " " + Inter.getLocText("BindColumn-Even_Selected_(2,4,6...)")), FlowLayout.LEFT);
JPanel specifyPane = GUICoreUtils.createFlowPane(new JComponent[]{ JPanel specifyPane = GUICoreUtils.createFlowPane(new JComponent[]{
serialTextField, new UILabel( serialTextField, new UILabel(
Inter.getLocText(new String[]{ Inter.getLocText(new String[]{
"Format", "BindColumn-Result_Serial_Number_Start_From_1", "Inner_Parameter", "Group_Count"}, "Format", "BindColumn-Result_Serial_Number_Start_From_1", "Inner_Parameter", "Group_Count"},
new String[]{": 1,2-3,5,8 ", ",", "$__count__"}) new String[]{": 1,2-3,5,8 ", ",", "$__count__"})
) )
}, FlowLayout.LEFT); }, FlowLayout.LEFT);
serialTextField.setToolTipText(Inter.getLocText("StyleFormat-Sample") + ":=JOINARRAY(GREPARRAY(RANGE($__count__), item!=4), \",\")"); serialTextField.setToolTipText(Inter.getLocText("StyleFormat-Sample") + ":=JOINARRAY(GREPARRAY(RANGE($__count__), item!=4), \",\")");
selectCountCardPane.add(undefinedPane, "UNDEFINE"); selectCountCardPane.add(undefinedPane, "UNDEFINE");
selectCountCardPane.add(topFormulaPane, "TOP"); selectCountCardPane.add(topFormulaPane, "TOP");
@ -367,11 +371,11 @@ public class DSColumnAdvancedPane extends BasicPane {
if (selectCount != null) { if (selectCount != null) {
int selectCountType = selectCount.getType(); int selectCountType = selectCount.getType();
this.selectCountComboBox.setSelectedIndex(selectCountType); this.selectCountComboBox.setSelectedIndex(selectCountType);
if (selectCountType == SelectCount.TOP) { if (selectCountType == TOP.getValue()) {
this.topFormulaPane.populate(selectCount.getFormulaCount()); this.topFormulaPane.populate(selectCount.getFormulaCount());
} else if (selectCountType == SelectCount.BOTTOM) { } else if (selectCountType == BOTTOM.getValue()) {
this.bottomFormulaPane.populate(selectCount.getFormulaCount()); this.bottomFormulaPane.populate(selectCount.getFormulaCount());
} else if (selectCountType == SelectCount.SPECIFY) { } else if (selectCountType == SPECIFY.getValue()) {
this.serialTextField.setText(selectCount.getSerial()); this.serialTextField.setText(selectCount.getSerial());
} }
} }
@ -395,11 +399,11 @@ public class DSColumnAdvancedPane extends BasicPane {
SelectCount selectCount = new SelectCount(); SelectCount selectCount = new SelectCount();
dSColumn.setSelectCount(selectCount); dSColumn.setSelectCount(selectCount);
selectCount.setType(selectCountSelectIndex); selectCount.setType(selectCountSelectIndex);
if (selectCountSelectIndex == SelectCount.TOP) { if (selectCountSelectIndex == TOP.getValue()) {
selectCount.setFormulaCount(this.topFormulaPane.getFormulaText()); selectCount.setFormulaCount(this.topFormulaPane.getFormulaText());
} else if (selectCountSelectIndex == SelectCount.BOTTOM) { } else if (selectCountSelectIndex == BOTTOM.getValue()) {
selectCount.setFormulaCount(this.bottomFormulaPane.getFormulaText()); selectCount.setFormulaCount(this.bottomFormulaPane.getFormulaText());
} else if (selectCountSelectIndex == SelectCount.SPECIFY) { } else if (selectCountSelectIndex == SPECIFY.getValue()) {
selectCount.setSerial(this.serialTextField.getText()); selectCount.setSerial(this.serialTextField.getText());
} }
} }
@ -411,8 +415,8 @@ public class DSColumnAdvancedPane extends BasicPane {
return ((JSpinner.DefaultEditor) editor).getTextField(); return ((JSpinner.DefaultEditor) editor).getTextField();
} else { } else {
System.err.println("Unexpected editor type: " System.err.println("Unexpected editor type: "
+ spinner.getEditor().getClass() + spinner.getEditor().getClass()
+ " isn't a descendant of DefaultEditor"); + " isn't a descendant of DefaultEditor");
return null; return null;
} }
} }
@ -420,13 +424,13 @@ public class DSColumnAdvancedPane extends BasicPane {
private static class JFormulaField extends JPanel { private static class JFormulaField extends JPanel {
private CellElement cellElement; private CellElement cellElement;
private UITextField formulaTextField; private UITextField formulaTextField;
private String defaultValue; private String defaultValue;
public JFormulaField(String defaultValue) { public JFormulaField(String defaultValue) {
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
this.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); this.setLayout(FRGUIPaneFactory.createBoxFlowLayout());
UILabel bottomLabel = new UILabel("="); UILabel bottomLabel = new UILabel("=");
bottomLabel.setFont(new Font("Dialog", Font.BOLD, 12)); bottomLabel.setFont(new Font("Dialog", Font.BOLD, 12));
this.add(bottomLabel); this.add(bottomLabel);
@ -439,20 +443,21 @@ public class DSColumnAdvancedPane extends BasicPane {
bottomFrmulaButton.setToolTipText(Inter.getLocText("Formula") + "..."); bottomFrmulaButton.setToolTipText(Inter.getLocText("Formula") + "...");
bottomFrmulaButton.setPreferredSize(new Dimension(25, formulaTextField.getPreferredSize().height)); bottomFrmulaButton.setPreferredSize(new Dimension(25, formulaTextField.getPreferredSize().height));
bottomFrmulaButton.addActionListener(formulaButtonActionListener); bottomFrmulaButton.addActionListener(formulaButtonActionListener);
} }
public void populate(String formulaContent) {
this.formulaTextField.setText(formulaContent);
}
public void populate(String formulaContent) { public void populateElement(CellElement cellElement) {
this.formulaTextField.setText(formulaContent); this.cellElement = cellElement;
} }
public void populateElement(CellElement cellElement) {
this.cellElement = cellElement;
}
public String getFormulaText() { public String getFormulaText() {
return this.formulaTextField.getText(); return this.formulaTextField.getText();
} }
private ActionListener formulaButtonActionListener = new ActionListener() { private ActionListener formulaButtonActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
Formula valueFormula = new Formula(); Formula valueFormula = new Formula();
@ -479,7 +484,7 @@ public class DSColumnAdvancedPane extends BasicPane {
formulaPane.populate(valueFormula, new CustomVariableResolver(displayNames, true)); formulaPane.populate(valueFormula, new CustomVariableResolver(displayNames, true));
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(JFormulaField.this), new DialogActionAdapter() { formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(JFormulaField.this), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
Formula valueFormula = formulaPane.update(); Formula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) { if (valueFormula.getContent().length() <= 1) {
formulaTextField.setText(defaultValue); formulaTextField.setText(defaultValue);

4
designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java

@ -89,7 +89,9 @@ public class MobileRadioGroupPane extends BasicBeanPane<MobileFitAttrState>{
* 选中指定index的按钮 * 选中指定index的按钮
*/ */
public void selectIndexButton(int index) { public void selectIndexButton(int index) {
if (index < 0 || index > radioButtons.size() - 1) { //这里删了默认按钮,所以这边判断的时候不能-1了
// if (index < 0 || index > radioButtons.size() - 1) { fanglei: 这个注释不要删!不然以后可能忘记这个问题
if (index < 0 || index > radioButtons.size()) {
return; return;
} }

199
designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -34,6 +34,7 @@ import com.fr.report.cell.CellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellExpandAttr; import com.fr.report.cell.cellattr.CellExpandAttr;
import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.FilterTypeEnum;
import com.fr.report.cell.cellattr.core.group.SelectCount; import com.fr.report.cell.cellattr.core.group.SelectCount;
import javax.swing.*; import javax.swing.*;
@ -46,6 +47,9 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.*;
/** /**
* 单元格元素 数据列编辑器 * 单元格元素 数据列编辑器
* *
@ -58,10 +62,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
private static final double P = TableLayout.PREFERRED, F = TableLayout.FILL; private static final double P = TableLayout.PREFERRED, F = TableLayout.FILL;
private static final Color TIP_FONT_COLOR = new Color(0x7F333334, true); private static final Color TIP_FONT_COLOR = new Color(0x7F333334, true);
private enum FilterType {
//前N个 后N个 奇数 偶数 自定义 未定义
TOP, BOTTOM, ODD, EVEN, SPECIFY, UNDEFINE
}
private JPanel dsColumnRegion; private JPanel dsColumnRegion;
private JPanel centerPane; private JPanel centerPane;
@ -669,6 +669,69 @@ public class CellDSColumnEditor extends CellQuickEditor {
private JFormulaField topFormulaPane; private JFormulaField topFormulaPane;
private JFormulaField bottomFormulaPane; private JFormulaField bottomFormulaPane;
private ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
int selectIndex = rsComboBox.getSelectedIndex();
CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout();
CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout();
if (selectIndex == TOP.getValue()) {
//前N个
setCardPaneLayout.show(setCardPane, TOP.name());
tipCardPaneLayout.show(tipCardPane, TOP.name());
//隐藏tip 显示set
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
} else if (selectIndex == BOTTOM.getValue()) {
//后N个
setCardPaneLayout.show(setCardPane, BOTTOM.name());
tipCardPaneLayout.show(tipCardPane, BOTTOM.name());
//隐藏tip 显示set
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
} else if (selectIndex == ODD.getValue()) {
//奇数
setCardPaneLayout.show(setCardPane, ODD.name());
tipCardPaneLayout.show(tipCardPane, ODD.name());
//隐藏set 显示tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
} else if (selectIndex == EVEN.getValue()) {
//偶数
setCardPaneLayout.show(setCardPane, EVEN.name());
tipCardPaneLayout.show(tipCardPane, EVEN.name());
//隐藏set 显示tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
} else if (selectIndex == SPECIFY.getValue()) {
//指定
setCardPaneLayout.show(setCardPane, SPECIFY.name());
tipCardPaneLayout.show(tipCardPane, SPECIFY.name());
//显示set和tip
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
} else {
//未定义
setCardPaneLayout.show(setCardPane, UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, UNDEFINE.name());
//隐藏set和tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
}
}
};
public ResultSetFilterConfigPane() { public ResultSetFilterConfigPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel filterLabel = new UILabel(Inter.getLocText("BindColumn-Results_Filter")); UILabel filterLabel = new UILabel(Inter.getLocText("BindColumn-Results_Filter"));
@ -681,65 +744,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
Inter.getLocText("Even"), Inter.getLocText("Even"),
Inter.getLocText("Specify") Inter.getLocText("Specify")
}); });
rsComboBox.addActionListener(new ActionListener() { rsComboBox.addActionListener(actionListener);
public void actionPerformed(ActionEvent evt) {
int selectIndex = rsComboBox.getSelectedIndex();
CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout();
CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout();
if (selectIndex == 1) {
//前N个
setCardPaneLayout.show(setCardPane, FilterType.TOP.name());
tipCardPaneLayout.show(tipCardPane, FilterType.TOP.name());
//隐藏tip 显示set
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
} else if (selectIndex == 2) {
//后N个
setCardPaneLayout.show(setCardPane, FilterType.BOTTOM.name());
tipCardPaneLayout.show(tipCardPane, FilterType.BOTTOM.name());
//隐藏tip 显示set
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
} else if (selectIndex == 3) {
//奇数
setCardPaneLayout.show(setCardPane, FilterType.ODD.name());
tipCardPaneLayout.show(tipCardPane, FilterType.ODD.name());
//隐藏set 显示tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
} else if (selectIndex == 4) {
setCardPaneLayout.show(setCardPane, FilterType.EVEN.name());
tipCardPaneLayout.show(tipCardPane, FilterType.EVEN.name());
//隐藏set 显示tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
} else if (selectIndex == 5) {
setCardPaneLayout.show(setCardPane, FilterType.SPECIFY.name());
tipCardPaneLayout.show(tipCardPane, FilterType.SPECIFY.name());
//显示set和tip
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
} else {
setCardPaneLayout.show(setCardPane, FilterType.UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, FilterType.UNDEFINE.name());
//隐藏set和tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
}
}
});
//配置展示CardLayout //配置展示CardLayout
setCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); setCardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
//提示信息展示CardLayout //提示信息展示CardLayout
@ -747,36 +752,36 @@ public class CellDSColumnEditor extends CellQuickEditor {
//前N个 //前N个
topFormulaPane = new JFormulaField(DEFAULT_VALUE); topFormulaPane = new JFormulaField(DEFAULT_VALUE);
setCardPane.add(topFormulaPane, FilterType.TOP.name()); setCardPane.add(topFormulaPane, TOP.name());
tipCardPane.add(new JPanel(), FilterType.TOP.name()); tipCardPane.add(new JPanel(), TOP.name());
//后N个 //后N个
bottomFormulaPane = new JFormulaField(DEFAULT_VALUE); bottomFormulaPane = new JFormulaField(DEFAULT_VALUE);
setCardPane.add(bottomFormulaPane, FilterType.BOTTOM.name()); setCardPane.add(bottomFormulaPane, BOTTOM.name());
tipCardPane.add(new JPanel(), FilterType.BOTTOM.name()); tipCardPane.add(new JPanel(), BOTTOM.name());
//自定义值下方没有提示信息,也没有输入框 //自定义值下方没有提示信息,也没有输入框
setCardPane.add(new JPanel(), FilterType.UNDEFINE.name()); setCardPane.add(new JPanel(), UNDEFINE.name());
tipCardPane.add(new JPanel(), FilterType.UNDEFINE.name()); tipCardPane.add(new JPanel(), UNDEFINE.name());
//奇数 UILabel 占一行作为提示信息 //奇数 UILabel 占一行作为提示信息
setCardPane.add(new JPanel(), FilterType.ODD.name()); setCardPane.add(new JPanel(), ODD.name());
MultilineLabel oddTip = new MultilineLabel(Inter.getLocText("FS-Designer_DS_Filter_Odd_Tip")); MultilineLabel oddTip = new MultilineLabel(Inter.getLocText("FS-Designer_DS_Filter_Odd_Tip"));
oddTip.setForeground(TIP_FONT_COLOR); oddTip.setForeground(TIP_FONT_COLOR);
tipCardPane.add(oddTip, FilterType.ODD.name()); tipCardPane.add(oddTip, ODD.name());
//偶数 UILabel 占一行作为提示信息 //偶数 UILabel 占一行作为提示信息
setCardPane.add(new JPanel(), FilterType.EVEN.name()); setCardPane.add(new JPanel(), EVEN.name());
MultilineLabel evenTip = new MultilineLabel(Inter.getLocText("FS-Designer_DS_Filter_Even_Tip")); MultilineLabel evenTip = new MultilineLabel(Inter.getLocText("FS-Designer_DS_Filter_Even_Tip"));
evenTip.setForeground(TIP_FONT_COLOR); evenTip.setForeground(TIP_FONT_COLOR);
tipCardPane.add(evenTip, FilterType.EVEN.name()); tipCardPane.add(evenTip, EVEN.name());
//输入框占用右半边,提示信息占一行 //输入框占用右半边,提示信息占一行
serialTextField = new UITextField(16); serialTextField = new UITextField(16);
setCardPane.add(serialTextField, FilterType.SPECIFY.name()); setCardPane.add(serialTextField, SPECIFY.name());
MultilineLabel specifyTip = new MultilineLabel(Inter.getLocText("FS-Designer_DS_Filter_Specify_Tip")); MultilineLabel specifyTip = new MultilineLabel(Inter.getLocText("FS-Designer_DS_Filter_Specify_Tip"));
specifyTip.setForeground(TIP_FONT_COLOR); specifyTip.setForeground(TIP_FONT_COLOR);
tipCardPane.add(specifyTip, FilterType.SPECIFY.name()); tipCardPane.add(specifyTip, SPECIFY.name());
contentPane = TableLayoutHelper.createDiffVGapTableLayoutPane(new Component[][]{ contentPane = TableLayoutHelper.createDiffVGapTableLayoutPane(new Component[][]{
{filterLabel, rsComboBox}, {filterLabel, rsComboBox},
{null, setCardPane}, {null, setCardPane},
@ -787,6 +792,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
public void populate(CellElement cellElement) { public void populate(CellElement cellElement) {
rsComboBox.removeActionListener(actionListener);
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value != null && value instanceof DSColumn) {
@ -794,42 +800,59 @@ public class CellDSColumnEditor extends CellQuickEditor {
SelectCount selectCount = dSColumn.getSelectCount(); SelectCount selectCount = dSColumn.getSelectCount();
this.topFormulaPane.populateElement(cellElement); this.topFormulaPane.populateElement(cellElement);
this.bottomFormulaPane.populateElement(cellElement); this.bottomFormulaPane.populateElement(cellElement);
CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout();
CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout();
if (selectCount != null) { if (selectCount != null) {
int selectCountType = selectCount.getType(); int selectCountType = selectCount.getType();
this.rsComboBox.setSelectedIndex(selectCountType); this.rsComboBox.setSelectedIndex(selectCountType);
switch (selectCountType) { switch (FilterTypeEnum.getFilterByValue(selectCountType)) {
case SelectCount.TOP: case TOP:
this.topFormulaPane.populate(selectCount.getFormulaCount()); this.topFormulaPane.populate(selectCount.getFormulaCount());
//前N个
setCardPaneLayout.show(setCardPane, TOP.name());
tipCardPaneLayout.show(tipCardPane, TOP.name());
//隐藏tip 显示set //隐藏tip 显示set
setCardPane.setPreferredSize(new Dimension(156, 20)); setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(0, 0)); tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
break; break;
case SelectCount.BOTTOM: case BOTTOM:
this.bottomFormulaPane.populate(selectCount.getFormulaCount()); this.bottomFormulaPane.populate(selectCount.getFormulaCount());
//后N个
setCardPaneLayout.show(setCardPane, BOTTOM.name());
tipCardPaneLayout.show(tipCardPane, BOTTOM.name());
//隐藏tip 显示set //隐藏tip 显示set
setCardPane.setPreferredSize(new Dimension(156, 20)); setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(0, 0)); tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
break; break;
case SelectCount.SPECIFY: case SPECIFY:
this.serialTextField.setText(selectCount.getSerial()); this.serialTextField.setText(selectCount.getSerial());
//指定
setCardPaneLayout.show(setCardPane, SPECIFY.name());
tipCardPaneLayout.show(tipCardPane, SPECIFY.name());
//显示set和tip //显示set和tip
setCardPane.setPreferredSize(new Dimension(156, 20)); setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(224, 40)); tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
break; break;
case SelectCount.EVEN: case EVEN:
//偶数
setCardPaneLayout.show(setCardPane, EVEN.name());
tipCardPaneLayout.show(tipCardPane, EVEN.name());
//隐藏set 显示tip //隐藏set 显示tip
setCardPane.setPreferredSize(new Dimension(0, 0)); setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(224, 40)); tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
break; break;
case SelectCount.ODD: case ODD:
//奇数
setCardPaneLayout.show(setCardPane, ODD.name());
tipCardPaneLayout.show(tipCardPane, ODD.name());
//隐藏set 显示tip //隐藏set 显示tip
setCardPane.setPreferredSize(new Dimension(0, 0)); setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
@ -837,6 +860,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
break; break;
default: default:
//未定义
setCardPaneLayout.show(setCardPane, UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, UNDEFINE.name());
//隐藏set和tip //隐藏set和tip
setCardPane.setPreferredSize(new Dimension(0, 0)); setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
@ -844,6 +870,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
} }
} else { } else {
//未定义
setCardPaneLayout.show(setCardPane, UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, UNDEFINE.name());
//隐藏set和tip //隐藏set和tip
setCardPane.setPreferredSize(new Dimension(0, 0)); setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
@ -852,6 +881,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
} }
} }
rsComboBox.addActionListener(actionListener);
} }
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
@ -866,11 +896,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
SelectCount selectCount = new SelectCount(); SelectCount selectCount = new SelectCount();
selectCount.setType(selectedFilterIndex); selectCount.setType(selectedFilterIndex);
dSColumn.setSelectCount(selectCount); dSColumn.setSelectCount(selectCount);
if (selectedFilterIndex == SelectCount.TOP) { if (selectedFilterIndex == TOP.getValue()) {
selectCount.setFormulaCount(this.topFormulaPane.getFormulaText()); selectCount.setFormulaCount(this.topFormulaPane.getFormulaText());
} else if (selectedFilterIndex == SelectCount.BOTTOM) { } else if (selectedFilterIndex == BOTTOM.getValue()) {
selectCount.setFormulaCount(this.bottomFormulaPane.getFormulaText()); selectCount.setFormulaCount(this.bottomFormulaPane.getFormulaText());
} else if (selectedFilterIndex == SelectCount.SPECIFY) { } else if (selectedFilterIndex == SPECIFY.getValue()) {
selectCount.setSerial(this.serialTextField.getText()); selectCount.setSerial(this.serialTextField.getText());
} }
} }
@ -887,6 +917,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
topFormulaPane.addListener(formulaListener); topFormulaPane.addListener(formulaListener);
bottomFormulaPane.addListener(formulaListener); bottomFormulaPane.addListener(formulaListener);
rsComboBox.registerChangeListener(formulaListener); rsComboBox.registerChangeListener(formulaListener);
serialTextField.registerChangeListener(formulaListener);
} }
} }

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

@ -108,7 +108,7 @@ public class CompositeComponentAdapter implements ComponentAdapter {
ArrayList<PropertyGroupPane> groups = new ArrayList<PropertyGroupPane>(); ArrayList<PropertyGroupPane> groups = new ArrayList<PropertyGroupPane>();
for (String groupName : groupNames) { for (String groupName : groupNames) {
ArrayList<CRPropertyDescriptor> groupProperties = maps.get(groupName); ArrayList<CRPropertyDescriptor> groupProperties = maps.get(groupName);
PropertyGroupPane propertyGroupPane = new PropertyGroupPane(groupProperties.toArray(new CRPropertyDescriptor[0]), xCreator, groupName); PropertyGroupPane propertyGroupPane = new PropertyGroupPane(groupProperties.toArray(new CRPropertyDescriptor[0]), xCreator, groupName, designer);
groups.add(propertyGroupPane); groups.add(propertyGroupPane);
} }
return groups; return groups;

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

@ -2,10 +2,12 @@ package com.fr.design.designer.creator;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.xtable.TableUtils; import com.fr.design.gui.xtable.TableUtils;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.ExtendedPropertyEditor; import com.fr.design.mainframe.widget.editors.ExtendedPropertyEditor;
import com.fr.design.mainframe.widget.editors.StringEditor; import com.fr.design.mainframe.widget.editors.StringEditor;
@ -27,10 +29,12 @@ public class CRPropertyDescriptorPane {
private XCreator xCreator; private XCreator xCreator;
private PropertyEditor propertyEditor; private PropertyEditor propertyEditor;
private boolean isPopulate = true; private boolean isPopulate = true;
private FormDesigner designer;
public CRPropertyDescriptorPane(CRPropertyDescriptor crPropertyDescriptor, XCreator xCreator) { public CRPropertyDescriptorPane(CRPropertyDescriptor crPropertyDescriptor, XCreator xCreator, FormDesigner designer) {
this.crPropertyDescriptor = crPropertyDescriptor; this.crPropertyDescriptor = crPropertyDescriptor;
this.xCreator = xCreator; this.xCreator = xCreator;
this.designer = designer;
} }
public Component[] createTableLayoutComponent() { public Component[] createTableLayoutComponent() {
@ -49,7 +53,7 @@ public class CRPropertyDescriptorPane {
} }
private Component initEditorComponent(CRPropertyDescriptor crPropertyDescriptor, final XCreator xCreator) { private Component initEditorComponent(final CRPropertyDescriptor crPropertyDescriptor, final XCreator xCreator) {
Component component = null; Component component = null;
try { try {
// 如果已有的编辑器就生成对应的component // 如果已有的编辑器就生成对应的component
@ -87,6 +91,14 @@ public class CRPropertyDescriptorPane {
if (extendEditor.refreshInTime()) { if (extendEditor.refreshInTime()) {
WidgetPropertyPane.getInstance().refreshDockingView(); WidgetPropertyPane.getInstance().refreshDockingView();
} }
if (designer == null) {
return;
}
if ("widgetName".equals(crPropertyDescriptor.getName())) {
designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED);
} else {
designer.fireTargetModified();
}
} }
}); });

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

@ -1,19 +1,16 @@
package com.fr.design.designer.creator; package com.fr.design.designer.creator;
import com.fr.base.FRContext;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.FreeButton; import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
/** /**
* Created by kerry on 2017/9/7. * Created by kerry on 2017/9/7.
@ -23,6 +20,7 @@ public class PropertyGroupPane extends BasicPane {
private CRPropertyDescriptorPane[] crPropertyDescriptorPanes; private CRPropertyDescriptorPane[] crPropertyDescriptorPanes;
private XCreator xCreator; private XCreator xCreator;
private String groupName; private String groupName;
private FormDesigner designer;
public String getGroupName() { public String getGroupName() {
return groupName; return groupName;
@ -36,22 +34,25 @@ public class PropertyGroupPane extends BasicPane {
public PropertyGroupPane(CRPropertyDescriptor[] crPropertyDescriptors, XCreator xCreator) { public PropertyGroupPane(CRPropertyDescriptor[] crPropertyDescriptors, XCreator xCreator) {
this.crPropertyDescriptors = crPropertyDescriptors; this.crPropertyDescriptors = crPropertyDescriptors;
this.xCreator = xCreator; this.xCreator = xCreator;
this.setLayout(FRGUIPaneFactory.createBorderLayout());
initComponent(); initComponent();
} }
public PropertyGroupPane(CRPropertyDescriptor[] crPropertyDescriptors, XCreator xCreator, String groupName) { public PropertyGroupPane(CRPropertyDescriptor[] crPropertyDescriptors, XCreator xCreator, String groupName, FormDesigner designer) {
this(crPropertyDescriptors, xCreator); this.designer = designer;
this.groupName = groupName; this.groupName = groupName;
this.crPropertyDescriptors = crPropertyDescriptors;
this.xCreator = xCreator;
initComponent();
} }
public void initComponent() { public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
int count = crPropertyDescriptors.length; int count = crPropertyDescriptors.length;
crPropertyDescriptorPanes = new CRPropertyDescriptorPane[count]; crPropertyDescriptorPanes = new CRPropertyDescriptorPane[count];
Component[][] components = new Component[count][]; Component[][] components = new Component[count][];
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
crPropertyDescriptorPanes[i] = new CRPropertyDescriptorPane(crPropertyDescriptors[i], xCreator); crPropertyDescriptorPanes[i] = new CRPropertyDescriptorPane(crPropertyDescriptors[i], xCreator, designer);
components[i] = crPropertyDescriptorPanes[i].createTableLayoutComponent(); components[i] = crPropertyDescriptorPanes[i].createTableLayoutComponent();
} }
@ -71,21 +72,5 @@ public class PropertyGroupPane extends BasicPane {
return "PropertyGroupPane"; return "PropertyGroupPane";
} }
public static void main(String[] args) {
try {
XCreator xCreator = new XButton(new FreeButton(), new Dimension(100, 100));
PropertyGroupPane propertyGroupPane = new PropertyGroupPane(xCreator.supportedDescriptor(), xCreator);
JFrame jf = new JFrame("jFrame");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(propertyGroupPane, BorderLayout.CENTER);
jf.setSize(439, 400);
jf.setVisible(true);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
}
} }

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

@ -133,7 +133,18 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
jPanel.add(attriCardPane, BorderLayout.CENTER); jPanel.add(attriCardPane, BorderLayout.CENTER);
jPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); jPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
if(FormWidgetDefinePaneFactoryBase.isExtraXWidget(innerCreator.toData())){ final boolean isExtraWidget = FormWidgetDefinePaneFactoryBase.isExtraXWidget(innerCreator.toData());
this.listener = new AttributeChangeListener() {
@Override
public void attributeChange() {
if(!isExtraWidget){
updateCreator();
}
updateWidgetBound();
}
};
if(isExtraWidget){
return; return;
} }
@ -143,13 +154,6 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
jPanel.add(uiExpandablePane, BorderLayout.NORTH); jPanel.add(uiExpandablePane, BorderLayout.NORTH);
this.listener = new AttributeChangeListener() {
@Override
public void attributeChange() {
updateCreator();
}
};
} }
private void initDefinePane() { private void initDefinePane() {
@ -212,12 +216,14 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED); designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED);
return; return;
} }
fireValueChanged();
}
public void updateWidgetBound (){
if (widgetBoundPane != null && ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Coords_And_Size"))) { if (widgetBoundPane != null && ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Coords_And_Size"))) {
widgetBoundPane.update(); widgetBoundPane.update();
} }
designer.refreshDesignerUI();
fireValueChanged();
} }
@ -233,7 +239,6 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
XCreator creator = getXCreatorDedicated(); XCreator creator = getXCreatorDedicated();
creator.firePropertyChange(); creator.firePropertyChange();
designer.fireTargetModified(); designer.fireTargetModified();
designer.refreshDesignerUI();
} }
public String getIconPath() { public String getIconPath() {

Loading…
Cancel
Save